@ignos/api-client 20240308.0.8762

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.
@@ -0,0 +1,8 @@
1
+ export interface IAccessTokenProvider {
2
+ getAccessToken: () => Promise<string>;
3
+ }
4
+ export declare class AuthorizedApiBase {
5
+ private readonly config;
6
+ protected constructor(config: IAccessTokenProvider);
7
+ protected transformOptions: (options: any) => Promise<any>;
8
+ }
@@ -0,0 +1,12 @@
1
+ export class AuthorizedApiBase {
2
+ constructor(config) {
3
+ this.transformOptions = async (options) => {
4
+ options.headers = {
5
+ ...options.headers,
6
+ Authorization: 'Bearer ' + (await this.config.getAccessToken()),
7
+ };
8
+ return options;
9
+ };
10
+ this.config = config;
11
+ }
12
+ }