@ignos/api-client 20260529.143.1 → 20260604.145.1-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AuthorizedApiBase.d.ts +8 -1
- package/lib/AuthorizedApiBase.js +4 -1
- package/lib/ignosportal-api.d.ts +101 -91
- package/lib/ignosportal-api.js +4 -1
- package/package.json +1 -1
- package/src/AuthorizedApiBase.ts +16 -3
- package/src/ignosportal-api.ts +110 -93
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
export interface IAccessTokenProvider {
|
|
2
2
|
getAccessToken: () => Promise<string>;
|
|
3
3
|
}
|
|
4
|
+
export interface ITenantIdProvider {
|
|
5
|
+
getTenantId: () => string | null;
|
|
6
|
+
}
|
|
7
|
+
export interface IApiClientConfig {
|
|
8
|
+
accessTokenProvider: IAccessTokenProvider;
|
|
9
|
+
tenantIdProvider: ITenantIdProvider;
|
|
10
|
+
}
|
|
4
11
|
export declare class AuthorizedApiBase {
|
|
5
12
|
private readonly config;
|
|
6
|
-
protected constructor(config:
|
|
13
|
+
protected constructor(config: IApiClientConfig);
|
|
7
14
|
protected transformOptions: (options: any) => Promise<any>;
|
|
8
15
|
protected jsonParseReviver: (_: any, value: any) => any;
|
|
9
16
|
}
|
package/lib/AuthorizedApiBase.js
CHANGED
|
@@ -3,8 +3,11 @@ export class AuthorizedApiBase {
|
|
|
3
3
|
this.transformOptions = async (options) => {
|
|
4
4
|
options.headers = {
|
|
5
5
|
...options.headers,
|
|
6
|
-
Authorization: "Bearer " + (await this.config.getAccessToken()),
|
|
6
|
+
Authorization: "Bearer " + (await this.config.accessTokenProvider.getAccessToken()),
|
|
7
7
|
};
|
|
8
|
+
const tenantId = this.config.tenantIdProvider.getTenantId();
|
|
9
|
+
if (tenantId)
|
|
10
|
+
options.headers["x-tenantid"] = tenantId;
|
|
8
11
|
return options;
|
|
9
12
|
};
|
|
10
13
|
this.jsonParseReviver = (_, value) => {
|