@emilgroup/tenant-sdk-node 1.16.0 → 1.16.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-node@1.16.0 --save
20
+ npm install @emilgroup/tenant-sdk-node@1.16.1-beta.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/tenant-sdk-node@1.16.0
24
+ yarn add @emilgroup/tenant-sdk-node@1.16.1-beta.0
25
25
  ```
26
26
 
27
27
  And then you can import `UsersApi`.
@@ -90,7 +90,7 @@ export const CustomSchemaApiAxiosParamCreator = function (configuration?: Config
90
90
  };
91
91
  },
92
92
  /**
93
- * 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.
93
+ * 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.
94
94
  * @summary Retrieve the custom-schema
95
95
  * @param {string} code Unique identifier for the object.
96
96
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -289,7 +289,7 @@ export const CustomSchemaApiFp = function(configuration?: Configuration) {
289
289
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
290
290
  },
291
291
  /**
292
- * 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.
292
+ * 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.
293
293
  * @summary Retrieve the custom-schema
294
294
  * @param {string} code Unique identifier for the object.
295
295
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -354,7 +354,7 @@ export const CustomSchemaApiFactory = function (configuration?: Configuration, b
354
354
  return localVarFp.createCustomSchema(createCustomSchemaRequestDto, authorization, options).then((request) => request(axios, basePath));
355
355
  },
356
356
  /**
357
- * 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.
357
+ * 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.
358
358
  * @summary Retrieve the custom-schema
359
359
  * @param {string} code Unique identifier for the object.
360
360
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -557,7 +557,7 @@ export class CustomSchemaApi extends BaseAPI {
557
557
  }
558
558
 
559
559
  /**
560
- * 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.
560
+ * 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.
561
561
  * @summary Retrieve the custom-schema
562
562
  * @param {CustomSchemaApiGetCustomSchemaRequest} requestParameters Request parameters.
563
563
  * @param {*} [options] Override http request option.
@@ -134,7 +134,7 @@ export const DataReportApiAxiosParamCreator = function (configuration?: Configur
134
134
  };
135
135
  },
136
136
  /**
137
- * 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.
137
+ * 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.
138
138
  * @summary Retrieve the data-report
139
139
  * @param {string} code Unique identifier for the object.
140
140
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -344,7 +344,7 @@ export const DataReportApiFp = function(configuration?: Configuration) {
344
344
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
345
345
  },
346
346
  /**
347
- * 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.
347
+ * 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.
348
348
  * @summary Retrieve the data-report
349
349
  * @param {string} code Unique identifier for the object.
350
350
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -419,7 +419,7 @@ export const DataReportApiFactory = function (configuration?: Configuration, bas
419
419
  return localVarFp.deleteAlert(id, authorization, options).then((request) => request(axios, basePath));
420
420
  },
421
421
  /**
422
- * 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.
422
+ * 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.
423
423
  * @summary Retrieve the data-report
424
424
  * @param {string} code Unique identifier for the object.
425
425
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -654,7 +654,7 @@ export class DataReportApi extends BaseAPI {
654
654
  }
655
655
 
656
656
  /**
657
- * 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.
657
+ * 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.
658
658
  * @summary Retrieve the data-report
659
659
  * @param {DataReportApiGetDataReportRequest} requestParameters Request parameters.
660
660
  * @param {*} [options] Override http request option.
@@ -33,7 +33,7 @@ const FormData = require('form-data');
33
33
  export const SettingsApiAxiosParamCreator = function (configuration?: Configuration) {
34
34
  return {
35
35
  /**
36
- * 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.
36
+ * 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
37
  * @summary Retrieve the settings
38
38
  * @param {string} keys
39
39
  * @param {string} [authorization] Bearer Token
@@ -91,7 +91,7 @@ export const SettingsApiFp = function(configuration?: Configuration) {
91
91
  const localVarAxiosParamCreator = SettingsApiAxiosParamCreator(configuration)
92
92
  return {
93
93
  /**
94
- * 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.
94
+ * 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.
95
95
  * @summary Retrieve the settings
96
96
  * @param {string} keys
97
97
  * @param {string} [authorization] Bearer Token
@@ -113,7 +113,7 @@ export const SettingsApiFactory = function (configuration?: Configuration, baseP
113
113
  const localVarFp = SettingsApiFp(configuration)
114
114
  return {
115
115
  /**
116
- * 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.
116
+ * 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.
117
117
  * @summary Retrieve the settings
118
118
  * @param {string} keys
119
119
  * @param {string} [authorization] Bearer Token
@@ -155,7 +155,7 @@ export interface SettingsApiGetTenantSettingsRequest {
155
155
  */
156
156
  export class SettingsApi extends BaseAPI {
157
157
  /**
158
- * 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.
158
+ * 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.
159
159
  * @summary Retrieve the settings
160
160
  * @param {SettingsApiGetTenantSettingsRequest} requestParameters Request parameters.
161
161
  * @param {*} [options] Override http request option.
package/base.ts CHANGED
@@ -79,6 +79,7 @@ export class BaseAPI {
79
79
  protected configuration: Configuration;
80
80
  private username?: string;
81
81
  private password?: string;
82
+ private permissions: Array<string> = [];
82
83
 
83
84
  constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
84
85
  if (configuration) {
@@ -149,6 +150,10 @@ export class BaseAPI {
149
150
  this.configuration.basePath = env;
150
151
  }
151
152
 
153
+ getPermissions(): Array<string> {
154
+ return this.permissions;
155
+ }
156
+
152
157
  async authorize(username: string, password: string): Promise<void> {
153
158
  const options: AxiosRequestConfig = {
154
159
  method: 'POST',
@@ -163,20 +168,21 @@ export class BaseAPI {
163
168
 
164
169
  const response = await globalAxios.request<LoginClass>(options);
165
170
 
166
- const { data: { accessToken } } = response;
171
+ const { data: { accessToken, permissions } } = response;
167
172
  this.configuration.username = username;
168
173
  this.configuration.accessToken = `Bearer ${accessToken}`;
174
+ this.permissions = permissions;
169
175
 
170
176
  const refreshToken = this.extractRefreshToken(response)
171
177
  this.configuration.refreshToken = refreshToken;
172
178
  }
173
179
 
174
- async refreshTokenInternal(): Promise<string> {
180
+ async refreshTokenInternal(): Promise<LoginClass> {
175
181
  const { username, refreshToken } = this.configuration;
176
182
 
177
183
 
178
184
  if (!username || !refreshToken) {
179
- return '';
185
+ throw new Error('Failed to refresh token.');
180
186
  }
181
187
 
182
188
  const options: AxiosRequestConfig = {
@@ -190,9 +196,9 @@ export class BaseAPI {
190
196
  withCredentials: true,
191
197
  };
192
198
 
193
- const { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
199
+ const response = await globalAxios.request<LoginClass>(options);
194
200
 
195
- return accessToken;
201
+ return response.data;
196
202
  }
197
203
 
198
204
  private extractRefreshToken(response: AxiosResponse): string {
@@ -221,8 +227,9 @@ export class BaseAPI {
221
227
  if (err.response.status === 401 && !originalConfig._retry) {
222
228
  originalConfig._retry = true;
223
229
  try {
224
- const tokenString = await this.refreshTokenInternal();
230
+ const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
225
231
  const accessToken = `Bearer ${tokenString}`;
232
+ this.permissions = permissions;
226
233
 
227
234
  originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
228
235
 
@@ -246,8 +253,9 @@ export class BaseAPI {
246
253
  ){
247
254
  _retry_count++;
248
255
  try {
249
- const tokenString = await this.refreshTokenInternal();
256
+ const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
250
257
  const accessToken = `Bearer ${tokenString}`;
258
+ this.permissions = permissions;
251
259
 
252
260
  _retry = true;
253
261
  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.
@@ -146,7 +146,7 @@ var CustomSchemaApiAxiosParamCreator = function (configuration) {
146
146
  });
147
147
  },
148
148
  /**
149
- * 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.
149
+ * 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.
150
150
  * @summary Retrieve the custom-schema
151
151
  * @param {string} code Unique identifier for the object.
152
152
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -354,7 +354,7 @@ var CustomSchemaApiFp = function (configuration) {
354
354
  });
355
355
  },
356
356
  /**
357
- * 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.
357
+ * 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.
358
358
  * @summary Retrieve the custom-schema
359
359
  * @param {string} code Unique identifier for the object.
360
360
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -446,7 +446,7 @@ var CustomSchemaApiFactory = function (configuration, basePath, axios) {
446
446
  return localVarFp.createCustomSchema(createCustomSchemaRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
447
447
  },
448
448
  /**
449
- * 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.
449
+ * 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.
450
450
  * @summary Retrieve the custom-schema
451
451
  * @param {string} code Unique identifier for the object.
452
452
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -513,7 +513,7 @@ var CustomSchemaApi = /** @class */ (function (_super) {
513
513
  return (0, exports.CustomSchemaApiFp)(this.configuration).createCustomSchema(requestParameters.createCustomSchemaRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
514
514
  };
515
515
  /**
516
- * 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.
516
+ * 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.
517
517
  * @summary Retrieve the custom-schema
518
518
  * @param {CustomSchemaApiGetCustomSchemaRequest} requestParameters Request parameters.
519
519
  * @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.
@@ -193,7 +193,7 @@ var DataReportApiAxiosParamCreator = function (configuration) {
193
193
  });
194
194
  },
195
195
  /**
196
- * 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.
196
+ * 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.
197
197
  * @summary Retrieve the data-report
198
198
  * @param {string} code Unique identifier for the object.
199
199
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -421,7 +421,7 @@ var DataReportApiFp = function (configuration) {
421
421
  });
422
422
  },
423
423
  /**
424
- * 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.
424
+ * 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.
425
425
  * @summary Retrieve the data-report
426
426
  * @param {string} code Unique identifier for the object.
427
427
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -523,7 +523,7 @@ var DataReportApiFactory = function (configuration, basePath, axios) {
523
523
  return localVarFp.deleteAlert(id, authorization, options).then(function (request) { return request(axios, basePath); });
524
524
  },
525
525
  /**
526
- * 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.
526
+ * 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.
527
527
  * @summary Retrieve the data-report
528
528
  * @param {string} code Unique identifier for the object.
529
529
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
@@ -601,7 +601,7 @@ var DataReportApi = /** @class */ (function (_super) {
601
601
  return (0, exports.DataReportApiFp)(this.configuration).deleteAlert(requestParameters.id, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
602
602
  };
603
603
  /**
604
- * 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.
604
+ * 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.
605
605
  * @summary Retrieve the data-report
606
606
  * @param {DataReportApiGetDataReportRequest} requestParameters Request parameters.
607
607
  * @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.
@@ -97,7 +97,7 @@ var SettingsApiAxiosParamCreator = function (configuration) {
97
97
  var _this = this;
98
98
  return {
99
99
  /**
100
- * 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.
100
+ * 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.
101
101
  * @summary Retrieve the settings
102
102
  * @param {string} keys
103
103
  * @param {string} [authorization] Bearer Token
@@ -157,7 +157,7 @@ var SettingsApiFp = function (configuration) {
157
157
  var localVarAxiosParamCreator = (0, exports.SettingsApiAxiosParamCreator)(configuration);
158
158
  return {
159
159
  /**
160
- * 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.
160
+ * 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.
161
161
  * @summary Retrieve the settings
162
162
  * @param {string} keys
163
163
  * @param {string} [authorization] Bearer Token
@@ -188,7 +188,7 @@ var SettingsApiFactory = function (configuration, basePath, axios) {
188
188
  var localVarFp = (0, exports.SettingsApiFp)(configuration);
189
189
  return {
190
190
  /**
191
- * 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.
191
+ * 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.
192
192
  * @summary Retrieve the settings
193
193
  * @param {string} keys
194
194
  * @param {string} [authorization] Bearer Token
@@ -213,7 +213,7 @@ var SettingsApi = /** @class */ (function (_super) {
213
213
  return _super !== null && _super.apply(this, arguments) || this;
214
214
  }
215
215
  /**
216
- * 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.
216
+ * 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.
217
217
  * @summary Retrieve the settings
218
218
  * @param {SettingsApiGetTenantSettingsRequest} requestParameters Request parameters.
219
219
  * @param {*} [options] Override http request option.
package/dist/base.d.ts CHANGED
@@ -53,14 +53,16 @@ export declare class BaseAPI {
53
53
  protected configuration: Configuration;
54
54
  private username?;
55
55
  private password?;
56
+ private permissions;
56
57
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
57
58
  initialize(env?: Environment): Promise<void>;
58
59
  private loadCredentials;
59
60
  private readConfigFile;
60
61
  private readEnvVariables;
61
62
  selectEnvironment(env: Environment): void;
63
+ getPermissions(): Array<string>;
62
64
  authorize(username: string, password: string): Promise<void>;
63
- refreshTokenInternal(): Promise<string>;
65
+ refreshTokenInternal(): Promise<LoginClass>;
64
66
  private extractRefreshToken;
65
67
  getConfiguration(): Configuration;
66
68
  private attachInterceptor;
package/dist/base.js CHANGED
@@ -150,6 +150,7 @@ var BaseAPI = /** @class */ (function () {
150
150
  if (axios === void 0) { axios = axios_1.default; }
151
151
  this.basePath = basePath;
152
152
  this.axios = axios;
153
+ this.permissions = [];
153
154
  if (configuration) {
154
155
  this.configuration = configuration;
155
156
  this.basePath = configuration.basePath || this.basePath;
@@ -242,11 +243,14 @@ var BaseAPI = /** @class */ (function () {
242
243
  BaseAPI.prototype.selectEnvironment = function (env) {
243
244
  this.configuration.basePath = env;
244
245
  };
246
+ BaseAPI.prototype.getPermissions = function () {
247
+ return this.permissions;
248
+ };
245
249
  BaseAPI.prototype.authorize = function (username, password) {
246
250
  return __awaiter(this, void 0, void 0, function () {
247
- var options, response, accessToken, refreshToken;
248
- return __generator(this, function (_a) {
249
- switch (_a.label) {
251
+ var options, response, _a, accessToken, permissions, refreshToken;
252
+ return __generator(this, function (_b) {
253
+ switch (_b.label) {
250
254
  case 0:
251
255
  options = {
252
256
  method: 'POST',
@@ -260,10 +264,11 @@ var BaseAPI = /** @class */ (function () {
260
264
  };
261
265
  return [4 /*yield*/, axios_1.default.request(options)];
262
266
  case 1:
263
- response = _a.sent();
264
- accessToken = response.data.accessToken;
267
+ response = _b.sent();
268
+ _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
265
269
  this.configuration.username = username;
266
270
  this.configuration.accessToken = "Bearer ".concat(accessToken);
271
+ this.permissions = permissions;
267
272
  refreshToken = this.extractRefreshToken(response);
268
273
  this.configuration.refreshToken = refreshToken;
269
274
  return [2 /*return*/];
@@ -273,13 +278,13 @@ var BaseAPI = /** @class */ (function () {
273
278
  };
274
279
  BaseAPI.prototype.refreshTokenInternal = function () {
275
280
  return __awaiter(this, void 0, void 0, function () {
276
- var _a, username, refreshToken, options, accessToken;
281
+ var _a, username, refreshToken, options, response;
277
282
  return __generator(this, function (_b) {
278
283
  switch (_b.label) {
279
284
  case 0:
280
285
  _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
281
286
  if (!username || !refreshToken) {
282
- return [2 /*return*/, ''];
287
+ throw new Error('Failed to refresh token.');
283
288
  }
284
289
  options = {
285
290
  method: 'POST',
@@ -293,8 +298,8 @@ var BaseAPI = /** @class */ (function () {
293
298
  };
294
299
  return [4 /*yield*/, axios_1.default.request(options)];
295
300
  case 1:
296
- accessToken = (_b.sent()).data.accessToken;
297
- return [2 /*return*/, accessToken];
301
+ response = _b.sent();
302
+ return [2 /*return*/, response.data];
298
303
  }
299
304
  });
300
305
  });
@@ -314,26 +319,27 @@ var BaseAPI = /** @class */ (function () {
314
319
  axios.interceptors.response.use(function (res) {
315
320
  return res;
316
321
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
317
- var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
318
- return __generator(this, function (_a) {
319
- switch (_a.label) {
322
+ var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
323
+ return __generator(this, function (_c) {
324
+ switch (_c.label) {
320
325
  case 0:
321
326
  originalConfig = err.config;
322
327
  if (!err.response) return [3 /*break*/, 5];
323
328
  if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
324
329
  originalConfig._retry = true;
325
- _a.label = 1;
330
+ _c.label = 1;
326
331
  case 1:
327
- _a.trys.push([1, 3, , 4]);
332
+ _c.trys.push([1, 3, , 4]);
328
333
  return [4 /*yield*/, this.refreshTokenInternal()];
329
334
  case 2:
330
- tokenString = _a.sent();
335
+ _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
331
336
  accessToken = "Bearer ".concat(tokenString);
337
+ this.permissions = permissions;
332
338
  originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
333
339
  this.configuration.accessToken = accessToken;
334
340
  return [2 /*return*/, axios.request(originalConfig)];
335
341
  case 3:
336
- _error_1 = _a.sent();
342
+ _error_1 = _c.sent();
337
343
  if (_error_1.response && _error_1.response.data) {
338
344
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
339
345
  }
@@ -349,19 +355,20 @@ var BaseAPI = /** @class */ (function () {
349
355
  && originalConfig.headers.hasOwnProperty('Authorization')
350
356
  && _retry_count < 4)) return [3 /*break*/, 9];
351
357
  _retry_count++;
352
- _a.label = 6;
358
+ _c.label = 6;
353
359
  case 6:
354
- _a.trys.push([6, 8, , 9]);
360
+ _c.trys.push([6, 8, , 9]);
355
361
  return [4 /*yield*/, this.refreshTokenInternal()];
356
362
  case 7:
357
- tokenString = _a.sent();
363
+ _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
358
364
  accessToken = "Bearer ".concat(tokenString);
365
+ this.permissions = permissions;
359
366
  _retry = true;
360
367
  originalConfig.headers['Authorization'] = accessToken;
361
368
  this.configuration.accessToken = accessToken;
362
369
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
363
370
  case 8:
364
- _error_2 = _a.sent();
371
+ _error_2 = _c.sent();
365
372
  if (_error_2.response && _error_2.response.data) {
366
373
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
367
374
  }
@@ -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
  };
@@ -22,11 +22,11 @@ export interface InviteOrgRequestDto {
22
22
  */
23
23
  'email': string;
24
24
  /**
25
- * Role ids to be assigned.
26
- * @type {Array<number>}
25
+ * Codes associated with the roles to be assigned.
26
+ * @type {Array<string>}
27
27
  * @memberof InviteOrgRequestDto
28
28
  */
29
- 'roleIds': Array<number>;
29
+ 'roleCodes': Array<string>;
30
30
  /**
31
31
  * Name of the invited organization.
32
32
  * @type {string}
@@ -28,9 +28,9 @@ export interface InviteUserRequestDto {
28
28
  */
29
29
  'organizationId'?: number;
30
30
  /**
31
- * Role ids to be assigned.
32
- * @type {Array<number>}
31
+ * Codes associated with the roles to be assigned.
32
+ * @type {Array<string>}
33
33
  * @memberof InviteUserRequestDto
34
34
  */
35
- 'roleIds': Array<number>;
35
+ 'roleCodes': Array<string>;
36
36
  }
@@ -22,11 +22,11 @@ export interface InviteUsersRequestDto {
22
22
  */
23
23
  'emails': Array<string>;
24
24
  /**
25
- * Role ids to be assigned.
26
- * @type {Array<number>}
25
+ * Codes associated with the roles to be assigned.
26
+ * @type {Array<string>}
27
27
  * @memberof InviteUsersRequestDto
28
28
  */
29
- 'roleIds': Array<number>;
29
+ 'roleCodes': Array<string>;
30
30
  /**
31
31
  * Organization associated with the users.
32
32
  * @type {number}
@@ -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];
@@ -27,11 +27,11 @@ export interface InviteOrgRequestDto {
27
27
  */
28
28
  'email': string;
29
29
  /**
30
- * Role ids to be assigned.
31
- * @type {Array<number>}
30
+ * Codes associated with the roles to be assigned.
31
+ * @type {Array<string>}
32
32
  * @memberof InviteOrgRequestDto
33
33
  */
34
- 'roleIds': Array<number>;
34
+ 'roleCodes': Array<string>;
35
35
  /**
36
36
  * Name of the invited organization.
37
37
  * @type {string}
@@ -33,10 +33,10 @@ export interface InviteUserRequestDto {
33
33
  */
34
34
  'organizationId'?: number;
35
35
  /**
36
- * Role ids to be assigned.
37
- * @type {Array<number>}
36
+ * Codes associated with the roles to be assigned.
37
+ * @type {Array<string>}
38
38
  * @memberof InviteUserRequestDto
39
39
  */
40
- 'roleIds': Array<number>;
40
+ 'roleCodes': Array<string>;
41
41
  }
42
42
 
@@ -27,11 +27,11 @@ export interface InviteUsersRequestDto {
27
27
  */
28
28
  'emails': Array<string>;
29
29
  /**
30
- * Role ids to be assigned.
31
- * @type {Array<number>}
30
+ * Codes associated with the roles to be assigned.
31
+ * @type {Array<string>}
32
32
  * @memberof InviteUsersRequestDto
33
33
  */
34
- 'roleIds': Array<number>;
34
+ 'roleCodes': Array<string>;
35
35
  /**
36
36
  * Organization associated with the users.
37
37
  * @type {number}
@@ -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-node",
3
- "version": "1.16.0",
3
+ "version": "1.16.1-beta.0",
4
4
  "description": "OpenAPI client for @emilgroup/tenant-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [