@emilgroup/tenant-sdk 1.16.0 → 1.17.1-beta.0

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/README.md CHANGED
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/tenant-sdk@1.16.0 --save
20
+ npm install @emilgroup/tenant-sdk@1.17.1-beta.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/tenant-sdk@1.16.0
24
+ yarn add @emilgroup/tenant-sdk@1.17.1-beta.0
25
25
  ```
26
26
 
27
27
  And then you can import `UsersApi`.
@@ -86,7 +86,7 @@ export const CustomSchemaApiAxiosParamCreator = function (configuration?: Config
86
86
  };
87
87
  },
88
88
  /**
89
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
89
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
90
90
  * @summary Retrieve the custom-schema
91
91
  * @param {string} code Unique identifier for the object.
92
92
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -285,7 +285,7 @@ export const CustomSchemaApiFp = function(configuration?: Configuration) {
285
285
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
286
286
  },
287
287
  /**
288
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
288
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
289
289
  * @summary Retrieve the custom-schema
290
290
  * @param {string} code Unique identifier for the object.
291
291
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -350,7 +350,7 @@ export const CustomSchemaApiFactory = function (configuration?: Configuration, b
350
350
  return localVarFp.createCustomSchema(createCustomSchemaRequestDto, authorization, options).then((request) => request(axios, basePath));
351
351
  },
352
352
  /**
353
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
353
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
354
354
  * @summary Retrieve the custom-schema
355
355
  * @param {string} code Unique identifier for the object.
356
356
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -553,7 +553,7 @@ export class CustomSchemaApi extends BaseAPI {
553
553
  }
554
554
 
555
555
  /**
556
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
556
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
557
557
  * @summary Retrieve the custom-schema
558
558
  * @param {CustomSchemaApiGetCustomSchemaRequest} requestParameters Request parameters.
559
559
  * @param {*} [options] Override http request option.
@@ -130,7 +130,7 @@ export const DataReportApiAxiosParamCreator = function (configuration?: Configur
130
130
  };
131
131
  },
132
132
  /**
133
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
133
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
134
134
  * @summary Retrieve the data-report
135
135
  * @param {string} code Unique identifier for the object.
136
136
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -340,7 +340,7 @@ export const DataReportApiFp = function(configuration?: Configuration) {
340
340
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
341
341
  },
342
342
  /**
343
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
343
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
344
344
  * @summary Retrieve the data-report
345
345
  * @param {string} code Unique identifier for the object.
346
346
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -415,7 +415,7 @@ export const DataReportApiFactory = function (configuration?: Configuration, bas
415
415
  return localVarFp.deleteAlert(id, authorization, options).then((request) => request(axios, basePath));
416
416
  },
417
417
  /**
418
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
418
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
419
419
  * @summary Retrieve the data-report
420
420
  * @param {string} code Unique identifier for the object.
421
421
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -650,7 +650,7 @@ export class DataReportApi extends BaseAPI {
650
650
  }
651
651
 
652
652
  /**
653
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
653
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
654
654
  * @summary Retrieve the data-report
655
655
  * @param {DataReportApiGetDataReportRequest} requestParameters Request parameters.
656
656
  * @param {*} [options] Override http request option.
@@ -29,7 +29,7 @@ import { GetSettingsResponseClass } from '../models';
29
29
  export const SettingsApiAxiosParamCreator = function (configuration?: Configuration) {
30
30
  return {
31
31
  /**
32
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
32
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
33
33
  * @summary Retrieve the settings
34
34
  * @param {string} keys
35
35
  * @param {string} [authorization] Bearer Token
@@ -87,7 +87,7 @@ export const SettingsApiFp = function(configuration?: Configuration) {
87
87
  const localVarAxiosParamCreator = SettingsApiAxiosParamCreator(configuration)
88
88
  return {
89
89
  /**
90
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
90
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
91
91
  * @summary Retrieve the settings
92
92
  * @param {string} keys
93
93
  * @param {string} [authorization] Bearer Token
@@ -109,7 +109,7 @@ export const SettingsApiFactory = function (configuration?: Configuration, baseP
109
109
  const localVarFp = SettingsApiFp(configuration)
110
110
  return {
111
111
  /**
112
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
112
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
113
113
  * @summary Retrieve the settings
114
114
  * @param {string} keys
115
115
  * @param {string} [authorization] Bearer Token
@@ -151,7 +151,7 @@ export interface SettingsApiGetTenantSettingsRequest {
151
151
  */
152
152
  export class SettingsApi extends BaseAPI {
153
153
  /**
154
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
154
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
155
155
  * @summary Retrieve the settings
156
156
  * @param {SettingsApiGetTenantSettingsRequest} requestParameters Request parameters.
157
157
  * @param {*} [options] Override http request option.
package/base.ts CHANGED
@@ -77,6 +77,7 @@ const TOKEN_DATA = 'APP_TOKEN';
77
77
  export class BaseAPI {
78
78
  protected configuration: Configuration | undefined;
79
79
  private tokenData?: TokenData;
80
+ private permissions: Array<string> = [];
80
81
 
81
82
  constructor(configuration?: Configuration,
82
83
  protected basePath: string = BASE_PATH,
@@ -109,6 +110,10 @@ export class BaseAPI {
109
110
  this.configuration.basePath = path;
110
111
  }
111
112
 
113
+ getPermissions(): Array<string> {
114
+ return this.permissions;
115
+ }
116
+
112
117
  async authorize(username: string, password: string): Promise<void> {
113
118
  const options: AxiosRequestConfig = {
114
119
  method: 'POST',
@@ -123,23 +128,24 @@ export class BaseAPI {
123
128
 
124
129
  const response = await globalAxios.request<LoginClass>(options);
125
130
 
126
- const { data: { accessToken } } = response;
131
+ const { data: { accessToken, permissions } } = response;
127
132
 
128
133
  this.configuration.username = username;
129
134
  this.configuration.accessToken = `Bearer ${accessToken}`;
130
135
  this.tokenData.username = username;
131
136
  this.tokenData.accessToken = accessToken;
137
+ this.permissions = permissions;
132
138
 
133
139
  this.storeTokenData({
134
140
  ...this.tokenData
135
141
  });
136
142
  }
137
143
 
138
- async refreshTokenInternal(): Promise<string> {
144
+ async refreshTokenInternal(): Promise<LoginClass> {
139
145
  const { username } = this.configuration;
140
146
 
141
147
  if (!username) {
142
- return '';
148
+ throw new Error('Failed to refresh token.');
143
149
  }
144
150
 
145
151
  const options: AxiosRequestConfig = {
@@ -152,9 +158,9 @@ export class BaseAPI {
152
158
  withCredentials: true,
153
159
  };
154
160
 
155
- const { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
161
+ const response = await globalAxios.request<LoginClass>(options);
156
162
 
157
- return accessToken;
163
+ return response.data;
158
164
  }
159
165
 
160
166
  private storeTokenData(tokenData?: TokenData) {
@@ -188,8 +194,9 @@ export class BaseAPI {
188
194
  && !originalConfig._retry) {
189
195
  originalConfig._retry = true;
190
196
  try {
191
- let tokenString = await this.refreshTokenInternal();
197
+ const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
192
198
  const accessToken = `Bearer ${tokenString}`;
199
+ this.permissions = permissions;
193
200
 
194
201
  delete originalConfig.headers['Authorization']
195
202
 
@@ -214,8 +221,9 @@ export class BaseAPI {
214
221
  ) {
215
222
  _retry_count++;
216
223
  try {
217
- let tokenString = await this.refreshTokenInternal();
224
+ const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
218
225
  const accessToken = `Bearer ${tokenString}`;
226
+ this.permissions = permissions;
219
227
 
220
228
  _retry = true;
221
229
  originalConfig.headers['Authorization'] = accessToken;
@@ -33,7 +33,7 @@ export declare const CustomSchemaApiAxiosParamCreator: (configuration?: Configur
33
33
  */
34
34
  createCustomSchema: (createCustomSchemaRequestDto: CreateCustomSchemaRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
35
35
  /**
36
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
36
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
37
37
  * @summary Retrieve the custom-schema
38
38
  * @param {string} code Unique identifier for the object.
39
39
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -83,7 +83,7 @@ export declare const CustomSchemaApiFp: (configuration?: Configuration) => {
83
83
  */
84
84
  createCustomSchema(createCustomSchemaRequestDto: CreateCustomSchemaRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<CreateCustomSchemaResponseClass>>;
85
85
  /**
86
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
86
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
87
87
  * @summary Retrieve the custom-schema
88
88
  * @param {string} code Unique identifier for the object.
89
89
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -133,7 +133,7 @@ export declare const CustomSchemaApiFactory: (configuration?: Configuration, bas
133
133
  */
134
134
  createCustomSchema(createCustomSchemaRequestDto: CreateCustomSchemaRequestDto, authorization?: string, options?: any): AxiosPromise<CreateCustomSchemaResponseClass>;
135
135
  /**
136
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
136
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
137
137
  * @summary Retrieve the custom-schema
138
138
  * @param {string} code Unique identifier for the object.
139
139
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -309,7 +309,7 @@ export declare class CustomSchemaApi extends BaseAPI {
309
309
  */
310
310
  createCustomSchema(requestParameters: CustomSchemaApiCreateCustomSchemaRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<CreateCustomSchemaResponseClass, any>>;
311
311
  /**
312
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
312
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
313
313
  * @summary Retrieve the custom-schema
314
314
  * @param {CustomSchemaApiGetCustomSchemaRequest} requestParameters Request parameters.
315
315
  * @param {*} [options] Override http request option.
@@ -142,7 +142,7 @@ var CustomSchemaApiAxiosParamCreator = function (configuration) {
142
142
  });
143
143
  },
144
144
  /**
145
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
145
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
146
146
  * @summary Retrieve the custom-schema
147
147
  * @param {string} code Unique identifier for the object.
148
148
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -350,7 +350,7 @@ var CustomSchemaApiFp = function (configuration) {
350
350
  });
351
351
  },
352
352
  /**
353
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
353
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
354
354
  * @summary Retrieve the custom-schema
355
355
  * @param {string} code Unique identifier for the object.
356
356
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -442,7 +442,7 @@ var CustomSchemaApiFactory = function (configuration, basePath, axios) {
442
442
  return localVarFp.createCustomSchema(createCustomSchemaRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
443
443
  },
444
444
  /**
445
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
445
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
446
446
  * @summary Retrieve the custom-schema
447
447
  * @param {string} code Unique identifier for the object.
448
448
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -509,7 +509,7 @@ var CustomSchemaApi = /** @class */ (function (_super) {
509
509
  return (0, exports.CustomSchemaApiFp)(this.configuration).createCustomSchema(requestParameters.createCustomSchemaRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
510
510
  };
511
511
  /**
512
- * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
512
+ * Retrieves the details of the custom-schema that was previously created. Supply the unique custom-schema code that was returned when you created it and Emil Api will return the corresponding custom-schema information.
513
513
  * @summary Retrieve the custom-schema
514
514
  * @param {CustomSchemaApiGetCustomSchemaRequest} requestParameters Request parameters.
515
515
  * @param {*} [options] Override http request option.
@@ -41,7 +41,7 @@ export declare const DataReportApiAxiosParamCreator: (configuration?: Configurat
41
41
  */
42
42
  deleteAlert: (id: string, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
43
43
  /**
44
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
44
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
45
45
  * @summary Retrieve the data-report
46
46
  * @param {string} code Unique identifier for the object.
47
47
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -99,7 +99,7 @@ export declare const DataReportApiFp: (configuration?: Configuration) => {
99
99
  */
100
100
  deleteAlert(id: string, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>>;
101
101
  /**
102
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
102
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
103
103
  * @summary Retrieve the data-report
104
104
  * @param {string} code Unique identifier for the object.
105
105
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -157,7 +157,7 @@ export declare const DataReportApiFactory: (configuration?: Configuration, baseP
157
157
  */
158
158
  deleteAlert(id: string, authorization?: string, options?: any): AxiosPromise<void>;
159
159
  /**
160
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
160
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
161
161
  * @summary Retrieve the data-report
162
162
  * @param {string} code Unique identifier for the object.
163
163
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -360,7 +360,7 @@ export declare class DataReportApi extends BaseAPI {
360
360
  */
361
361
  deleteAlert(requestParameters: DataReportApiDeleteAlertRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<void, any>>;
362
362
  /**
363
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
363
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
364
364
  * @summary Retrieve the data-report
365
365
  * @param {DataReportApiGetDataReportRequest} requestParameters Request parameters.
366
366
  * @param {*} [options] Override http request option.
@@ -189,7 +189,7 @@ var DataReportApiAxiosParamCreator = function (configuration) {
189
189
  });
190
190
  },
191
191
  /**
192
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
192
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
193
193
  * @summary Retrieve the data-report
194
194
  * @param {string} code Unique identifier for the object.
195
195
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -417,7 +417,7 @@ var DataReportApiFp = function (configuration) {
417
417
  });
418
418
  },
419
419
  /**
420
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
420
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
421
421
  * @summary Retrieve the data-report
422
422
  * @param {string} code Unique identifier for the object.
423
423
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -519,7 +519,7 @@ var DataReportApiFactory = function (configuration, basePath, axios) {
519
519
  return localVarFp.deleteAlert(id, authorization, options).then(function (request) { return request(axios, basePath); });
520
520
  },
521
521
  /**
522
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
522
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
523
523
  * @summary Retrieve the data-report
524
524
  * @param {string} code Unique identifier for the object.
525
525
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -597,7 +597,7 @@ var DataReportApi = /** @class */ (function (_super) {
597
597
  return (0, exports.DataReportApiFp)(this.configuration).deleteAlert(requestParameters.id, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
598
598
  };
599
599
  /**
600
- * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
600
+ * Retrieves the details of the data-report that was previously created. Supply the unique data-report code that was returned when you created it and Emil Api will return the corresponding data-report information.
601
601
  * @summary Retrieve the data-report
602
602
  * @param {DataReportApiGetDataReportRequest} requestParameters Request parameters.
603
603
  * @param {*} [options] Override http request option.
@@ -19,7 +19,7 @@ import { GetSettingsResponseClass } from '../models';
19
19
  */
20
20
  export declare const SettingsApiAxiosParamCreator: (configuration?: Configuration) => {
21
21
  /**
22
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
22
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
23
23
  * @summary Retrieve the settings
24
24
  * @param {string} keys
25
25
  * @param {string} [authorization] Bearer Token
@@ -34,7 +34,7 @@ export declare const SettingsApiAxiosParamCreator: (configuration?: Configuratio
34
34
  */
35
35
  export declare const SettingsApiFp: (configuration?: Configuration) => {
36
36
  /**
37
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
37
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
38
38
  * @summary Retrieve the settings
39
39
  * @param {string} keys
40
40
  * @param {string} [authorization] Bearer Token
@@ -49,7 +49,7 @@ export declare const SettingsApiFp: (configuration?: Configuration) => {
49
49
  */
50
50
  export declare const SettingsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
51
51
  /**
52
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
52
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
53
53
  * @summary Retrieve the settings
54
54
  * @param {string} keys
55
55
  * @param {string} [authorization] Bearer Token
@@ -85,7 +85,7 @@ export interface SettingsApiGetTenantSettingsRequest {
85
85
  */
86
86
  export declare class SettingsApi extends BaseAPI {
87
87
  /**
88
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
88
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
89
89
  * @summary Retrieve the settings
90
90
  * @param {SettingsApiGetTenantSettingsRequest} requestParameters Request parameters.
91
91
  * @param {*} [options] Override http request option.
@@ -93,7 +93,7 @@ var SettingsApiAxiosParamCreator = function (configuration) {
93
93
  var _this = this;
94
94
  return {
95
95
  /**
96
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
96
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
97
97
  * @summary Retrieve the settings
98
98
  * @param {string} keys
99
99
  * @param {string} [authorization] Bearer Token
@@ -153,7 +153,7 @@ var SettingsApiFp = function (configuration) {
153
153
  var localVarAxiosParamCreator = (0, exports.SettingsApiAxiosParamCreator)(configuration);
154
154
  return {
155
155
  /**
156
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
156
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
157
157
  * @summary Retrieve the settings
158
158
  * @param {string} keys
159
159
  * @param {string} [authorization] Bearer Token
@@ -184,7 +184,7 @@ var SettingsApiFactory = function (configuration, basePath, axios) {
184
184
  var localVarFp = (0, exports.SettingsApiFp)(configuration);
185
185
  return {
186
186
  /**
187
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
187
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
188
188
  * @summary Retrieve the settings
189
189
  * @param {string} keys
190
190
  * @param {string} [authorization] Bearer Token
@@ -209,7 +209,7 @@ var SettingsApi = /** @class */ (function (_super) {
209
209
  return _super !== null && _super.apply(this, arguments) || this;
210
210
  }
211
211
  /**
212
- * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
212
+ * Retrieves the details of the settings that was previously created. Supply the unique settings code that was returned when you created it and Emil Api will return the corresponding settings information.
213
213
  * @summary Retrieve the settings
214
214
  * @param {SettingsApiGetTenantSettingsRequest} requestParameters Request parameters.
215
215
  * @param {*} [options] Override http request option.
package/dist/base.d.ts CHANGED
@@ -52,11 +52,13 @@ export declare class BaseAPI {
52
52
  protected axios: AxiosInstance;
53
53
  protected configuration: Configuration | undefined;
54
54
  private tokenData?;
55
+ private permissions;
55
56
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
56
57
  selectEnvironment(env: Environment): void;
57
58
  selectBasePath(path: string): void;
59
+ getPermissions(): Array<string>;
58
60
  authorize(username: string, password: string): Promise<void>;
59
- refreshTokenInternal(): Promise<string>;
61
+ refreshTokenInternal(): Promise<LoginClass>;
60
62
  private storeTokenData;
61
63
  loadTokenData(): void;
62
64
  cleanTokenData(): void;
package/dist/base.js CHANGED
@@ -121,6 +121,7 @@ var BaseAPI = /** @class */ (function () {
121
121
  if (axios === void 0) { axios = axios_1.default; }
122
122
  this.basePath = basePath;
123
123
  this.axios = axios;
124
+ this.permissions = [];
124
125
  this.loadTokenData();
125
126
  if (configuration) {
126
127
  this.configuration = configuration;
@@ -143,11 +144,14 @@ var BaseAPI = /** @class */ (function () {
143
144
  BaseAPI.prototype.selectBasePath = function (path) {
144
145
  this.configuration.basePath = path;
145
146
  };
147
+ BaseAPI.prototype.getPermissions = function () {
148
+ return this.permissions;
149
+ };
146
150
  BaseAPI.prototype.authorize = function (username, password) {
147
151
  return __awaiter(this, void 0, void 0, function () {
148
- var options, response, accessToken;
149
- return __generator(this, function (_a) {
150
- switch (_a.label) {
152
+ var options, response, _a, accessToken, permissions;
153
+ return __generator(this, function (_b) {
154
+ switch (_b.label) {
151
155
  case 0:
152
156
  options = {
153
157
  method: 'POST',
@@ -161,12 +165,13 @@ var BaseAPI = /** @class */ (function () {
161
165
  };
162
166
  return [4 /*yield*/, axios_1.default.request(options)];
163
167
  case 1:
164
- response = _a.sent();
165
- accessToken = response.data.accessToken;
168
+ response = _b.sent();
169
+ _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
166
170
  this.configuration.username = username;
167
171
  this.configuration.accessToken = "Bearer ".concat(accessToken);
168
172
  this.tokenData.username = username;
169
173
  this.tokenData.accessToken = accessToken;
174
+ this.permissions = permissions;
170
175
  this.storeTokenData(__assign({}, this.tokenData));
171
176
  return [2 /*return*/];
172
177
  }
@@ -175,13 +180,13 @@ var BaseAPI = /** @class */ (function () {
175
180
  };
176
181
  BaseAPI.prototype.refreshTokenInternal = function () {
177
182
  return __awaiter(this, void 0, void 0, function () {
178
- var username, options, accessToken;
183
+ var username, options, response;
179
184
  return __generator(this, function (_a) {
180
185
  switch (_a.label) {
181
186
  case 0:
182
187
  username = this.configuration.username;
183
188
  if (!username) {
184
- return [2 /*return*/, ''];
189
+ throw new Error('Failed to refresh token.');
185
190
  }
186
191
  options = {
187
192
  method: 'POST',
@@ -194,8 +199,8 @@ var BaseAPI = /** @class */ (function () {
194
199
  };
195
200
  return [4 /*yield*/, axios_1.default.request(options)];
196
201
  case 1:
197
- accessToken = (_a.sent()).data.accessToken;
198
- return [2 /*return*/, accessToken];
202
+ response = _a.sent();
203
+ return [2 /*return*/, response.data];
199
204
  }
200
205
  });
201
206
  });
@@ -221,22 +226,23 @@ var BaseAPI = /** @class */ (function () {
221
226
  axios.interceptors.response.use(function (res) {
222
227
  return res;
223
228
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
224
- var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
225
- return __generator(this, function (_a) {
226
- switch (_a.label) {
229
+ var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
230
+ return __generator(this, function (_c) {
231
+ switch (_c.label) {
227
232
  case 0:
228
233
  originalConfig = err.config;
229
234
  if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
230
235
  if (!((err.response.status === 401 || err.response.status === 403)
231
236
  && !originalConfig._retry)) return [3 /*break*/, 4];
232
237
  originalConfig._retry = true;
233
- _a.label = 1;
238
+ _c.label = 1;
234
239
  case 1:
235
- _a.trys.push([1, 3, , 4]);
240
+ _c.trys.push([1, 3, , 4]);
236
241
  return [4 /*yield*/, this.refreshTokenInternal()];
237
242
  case 2:
238
- tokenString = _a.sent();
243
+ _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
239
244
  accessToken = "Bearer ".concat(tokenString);
245
+ this.permissions = permissions;
240
246
  delete originalConfig.headers['Authorization'];
241
247
  originalConfig.headers['Authorization'] = accessToken;
242
248
  this.configuration.accessToken = accessToken;
@@ -244,7 +250,7 @@ var BaseAPI = /** @class */ (function () {
244
250
  this.storeTokenData(this.tokenData);
245
251
  return [2 /*return*/, axios(originalConfig)];
246
252
  case 3:
247
- _error_1 = _a.sent();
253
+ _error_1 = _c.sent();
248
254
  if (_error_1.response && _error_1.response.data) {
249
255
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
250
256
  }
@@ -255,13 +261,14 @@ var BaseAPI = /** @class */ (function () {
255
261
  && originalConfig.headers.hasOwnProperty('Authorization')
256
262
  && _retry_count < 4)) return [3 /*break*/, 9];
257
263
  _retry_count++;
258
- _a.label = 6;
264
+ _c.label = 6;
259
265
  case 6:
260
- _a.trys.push([6, 8, , 9]);
266
+ _c.trys.push([6, 8, , 9]);
261
267
  return [4 /*yield*/, this.refreshTokenInternal()];
262
268
  case 7:
263
- tokenString = _a.sent();
269
+ _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
264
270
  accessToken = "Bearer ".concat(tokenString);
271
+ this.permissions = permissions;
265
272
  _retry = true;
266
273
  originalConfig.headers['Authorization'] = accessToken;
267
274
  this.configuration.accessToken = accessToken;
@@ -269,7 +276,7 @@ var BaseAPI = /** @class */ (function () {
269
276
  this.storeTokenData(this.tokenData);
270
277
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
271
278
  case 8:
272
- _error_2 = _a.sent();
279
+ _error_2 = _c.sent();
273
280
  if (_error_2.response && _error_2.response.data) {
274
281
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
275
282
  }
@@ -41,5 +41,6 @@ export declare const CreateCustomSchemaRequestDtoEntityEnum: {
41
41
  readonly Invoice: "invoice";
42
42
  readonly Payment: "payment";
43
43
  readonly Organization: "organization";
44
+ readonly PayoutDetails: "payout_details";
44
45
  };
45
46
  export type CreateCustomSchemaRequestDtoEntityEnum = typeof CreateCustomSchemaRequestDtoEntityEnum[keyof typeof CreateCustomSchemaRequestDtoEntityEnum];
@@ -19,5 +19,6 @@ exports.CreateCustomSchemaRequestDtoEntityEnum = {
19
19
  Claim: 'claim',
20
20
  Invoice: 'invoice',
21
21
  Payment: 'payment',
22
- Organization: 'organization'
22
+ Organization: 'organization',
23
+ PayoutDetails: 'payout_details'
23
24
  };
@@ -41,5 +41,6 @@ export declare const UpdateCustomSchemaRequestDtoEntityEnum: {
41
41
  readonly Invoice: "invoice";
42
42
  readonly Payment: "payment";
43
43
  readonly Organization: "organization";
44
+ readonly PayoutDetails: "payout_details";
44
45
  };
45
46
  export type UpdateCustomSchemaRequestDtoEntityEnum = typeof UpdateCustomSchemaRequestDtoEntityEnum[keyof typeof UpdateCustomSchemaRequestDtoEntityEnum];
@@ -19,5 +19,6 @@ exports.UpdateCustomSchemaRequestDtoEntityEnum = {
19
19
  Claim: 'claim',
20
20
  Invoice: 'invoice',
21
21
  Payment: 'payment',
22
- Organization: 'organization'
22
+ Organization: 'organization',
23
+ PayoutDetails: 'payout_details'
23
24
  };
@@ -46,7 +46,8 @@ export const CreateCustomSchemaRequestDtoEntityEnum = {
46
46
  Claim: 'claim',
47
47
  Invoice: 'invoice',
48
48
  Payment: 'payment',
49
- Organization: 'organization'
49
+ Organization: 'organization',
50
+ PayoutDetails: 'payout_details'
50
51
  } as const;
51
52
 
52
53
  export type CreateCustomSchemaRequestDtoEntityEnum = typeof CreateCustomSchemaRequestDtoEntityEnum[keyof typeof CreateCustomSchemaRequestDtoEntityEnum];
@@ -46,7 +46,8 @@ export const UpdateCustomSchemaRequestDtoEntityEnum = {
46
46
  Claim: 'claim',
47
47
  Invoice: 'invoice',
48
48
  Payment: 'payment',
49
- Organization: 'organization'
49
+ Organization: 'organization',
50
+ PayoutDetails: 'payout_details'
50
51
  } as const;
51
52
 
52
53
  export type UpdateCustomSchemaRequestDtoEntityEnum = typeof UpdateCustomSchemaRequestDtoEntityEnum[keyof typeof UpdateCustomSchemaRequestDtoEntityEnum];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/tenant-sdk",
3
- "version": "1.16.0",
3
+ "version": "1.17.1-beta.0",
4
4
  "description": "OpenAPI client for @emilgroup/tenant-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [