@healthcloudai/hc-assets-connector
v0.0.2
Published
Healthcheck Assets SDK with TypeScrip and token refresh
Maintainers
Readme
Healthcheck Assets Connector
This library provides a client for retrieving app assets and updating user image URLs. It is built on top of the shared Healthcheck HTTP and Login connectors.
Features
- Fetch app assets by asset type
- Update authenticated user image URL
- Uses shared authentication from
HCLoginClient - Built on shared Healthcheck HttpClient
Installation
npm install @healthcloudai/hc-assets-connector \
@healthcloudai/hc-login-connector \
@healthcloudai/hc-httpImport
import { HCAssetsClient } from "@healthcloudai/hc-assets-connector";
import { HCLoginClient } from "@healthcloudai/hc-login-connector";
import { FetchClient } from "@healthcloudai/hc-http";Usage
Configuration
Before using assets methods, configure and authenticate the login client.
const httpClient = new FetchClient();
const loginClient = new HCLoginClient(httpClient);
loginClient.configure("tenant-id", "dev");
await loginClient.login("[email protected]", "password");
const assetsClient = new HCAssetsClient(httpClient, loginClient);Methods
Get App Assets
Retrieves assets for a given app type (cards | faq).
const assets = await assetsClient.getAppAssets("cards");How It Works
HCLoginClient
- Handles authentication and token management
- Resolves tenant base URL
- Provides authorization headers
HttpClient
- Handles all HTTP communication
HCAssetsClient
- Calls assets endpoints using base URL and auth headers from
HCLoginClient - Exposes asset-specific API methods
- Calls assets endpoints using base URL and auth headers from
Notes
HCLoginClientmust be configured and logged in before calling assets methods
