@or-sdk/data-hub
v0.28.2
Published
OneReach SDK client for Data Hub
Readme
@or-sdk/data-hub
OneReach SDK client for Data Hub.
When to use
- Use this package when integrating with the Data Hub capability on the OneReach platform.
- Use its typed client and exported models instead of hand-writing requests to that service.
When not to use
- Do not use it for a different platform capability; choose the dedicated
@or-sdk/*package instead. - Do not use it for generic third-party HTTP calls.
Installation
$ npm i @or-sdk/data-hubUsage
import { DataHub } from '@or-sdk/data-hub'
// with direct api url
const dataHub = new DataHub({
token: 'my-account-token-string',
dataHubUrl: 'http://example.data-hub/endpoint'
});
// with service discovery(slower)
const dataHub = new DataHub({
token: 'my-account-token-string',
discoveryUrl: 'http://example.discovery/endpoint'
});Configuration
- Prefer
dataHubUrlwhen the service URL is known; it avoids a discovery request. - Use
discoveryUrlonly when the service URL is not available. - Provide
tokenas a bearer-token string or getter where supported.
Common pitfalls
- Keep the client token current when it can expire; a token getter is preferable where the constructor accepts one.
- Treat the generated TypeScript types as the authoritative contract for optional parameters and response shapes.
Method map
| Method | Purpose |
|---|---|
| parseError(...) | See the exported TypeScript signature for parameters and result. |
| getOperationName(...) | See the exported TypeScript signature for parameters and result. |
| subscribe(...) | See the exported TypeScript signature for parameters and result. |
More detail
Full signatures and exported types are available in src/ and dist/types/.
Additional API reference
Methods below were missing from the package guide. Signatures and return types are taken directly from the exported source API.
DataHub
| Method | Returns | Purpose |
|---|---|---|
| makeRequest(params: CalApiParams) | Promise<T> | Make request |
| getFullList(method: CalApiParams['method'], route: string, data: GraphqlRequestData) | Promise<List<T>> | Get full list from paginated request |
