@emilgroup/tenant-sdk-node 1.16.0 → 1.17.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.
@@ -491,16 +491,16 @@ var UsersApiAxiosParamCreator = function (configuration) {
491
491
  });
492
492
  },
493
493
  /**
494
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
494
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
495
495
  * @summary List users
496
496
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
497
497
  * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
498
498
  * @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
499
- * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
499
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, email, sub, status, organizationId, ern</i>
500
500
  * @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
501
- * @param {any} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
502
- * @param {any} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
503
- * @param {any} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
501
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: email</i>
502
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: roles, subscriptions, organizations<i>
503
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, email, sub, status, organizationId, ern</i>
504
504
  * @param {*} [options] Override http request option.
505
505
  * @throws {RequiredError}
506
506
  */
@@ -736,16 +736,16 @@ var UsersApiFp = function (configuration) {
736
736
  });
737
737
  },
738
738
  /**
739
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
739
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
740
740
  * @summary List users
741
741
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
742
742
  * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
743
743
  * @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
744
- * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
744
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, email, sub, status, organizationId, ern</i>
745
745
  * @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
746
- * @param {any} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
747
- * @param {any} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
748
- * @param {any} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
746
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: email</i>
747
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: roles, subscriptions, organizations<i>
748
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, email, sub, status, organizationId, ern</i>
749
749
  * @param {*} [options] Override http request option.
750
750
  * @throws {RequiredError}
751
751
  */
@@ -856,16 +856,16 @@ var UsersApiFactory = function (configuration, basePath, axios) {
856
856
  return localVarFp.getUser(code, code2, authorization, expand, options).then(function (request) { return request(axios, basePath); });
857
857
  },
858
858
  /**
859
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
859
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
860
860
  * @summary List users
861
861
  * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
862
862
  * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
863
863
  * @param {any} [pageToken] A cursor for use in pagination. pageToken is an ID that defines your place in the list. For instance, if you make a list request and receive 100 objects and pageToken=1, your subsequent call can include pageToken=2 in order to fetch the next page of the list.
864
- * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
864
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.<br/> <br/> <i>Allowed values: id, code, email, sub, status, organizationId, ern</i>
865
865
  * @param {any} [search] To search the list by any field, pass search=xxx to fetch the result.
866
- * @param {any} [order] The order parameter determines how the results should be sorted according to a specified field. It functions similarly to an SQL ORDER BY. Sorting can be performed in either ascending (ASC) or descending (DESC) order. Default: ASC.
867
- * @param {any} [expand] Use this parameter to fetch additional information about the list items. The expand query parameter increases the set of fields that appear in the response in addition to the default ones. Expanding resources can reduce the number of API calls required to accomplish a task. However, use this with parsimony as some expanded fields can drastically increase payload size.
868
- * @param {any} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations. In general, fetching filtered responses conserves bandwidth and reduces response time.
866
+ * @param {string} [order] Order allows you to specify the desired order of entities retrieved from the server by ascending (ASC) or descending (DESC) order.<br/> <br/> <i>Allowed values: email</i>
867
+ * @param {string} [expand] Expand to fetch additional information about the list items. Expanding resources can reduce the number of API calls required to accomplish a task. Use with discretion as some expanded fields can drastically increase payload size.<br/> <br/> <i>Allowed values: roles, subscriptions, organizations<i>
868
+ * @param {string} [filters] Filters the response by one or multiple fields. Advanced filter functionality allows you to perform more complex filtering operations.<br/> <br/> <i>Allowed values: id, code, email, sub, status, organizationId, ern</i>
869
869
  * @param {*} [options] Override http request option.
870
870
  * @throws {RequiredError}
871
871
  */
@@ -975,7 +975,7 @@ var UsersApi = /** @class */ (function (_super) {
975
975
  return (0, exports.UsersApiFp)(this.configuration).getUser(requestParameters.code, requestParameters.code2, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
976
976
  };
977
977
  /**
978
- * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
978
+ * Returns a list of users you have previously created. The users are returned in sorted order, with the oldest one appearing first. For more information about pagination, read the Pagination documentation.
979
979
  * @summary List users
980
980
  * @param {UsersApiListUsersRequest} requestParameters Request parameters.
981
981
  * @param {*} [options] Override http request option.
package/dist/base.d.ts CHANGED
@@ -24,7 +24,7 @@ export declare const COLLECTION_FORMATS: {
24
24
  };
25
25
  export interface LoginClass {
26
26
  accessToken: string;
27
- permissions: Array<string>;
27
+ permissions: string;
28
28
  }
29
29
  export declare enum Environment {
30
30
  Production = "https://apiv2.emil.de",
@@ -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
@@ -242,11 +242,14 @@ var BaseAPI = /** @class */ (function () {
242
242
  BaseAPI.prototype.selectEnvironment = function (env) {
243
243
  this.configuration.basePath = env;
244
244
  };
245
+ BaseAPI.prototype.getPermissions = function () {
246
+ return this.permissions.split(',');
247
+ };
245
248
  BaseAPI.prototype.authorize = function (username, password) {
246
249
  return __awaiter(this, void 0, void 0, function () {
247
- var options, response, accessToken, refreshToken;
248
- return __generator(this, function (_a) {
249
- switch (_a.label) {
250
+ var options, response, _a, accessToken, permissions, refreshToken;
251
+ return __generator(this, function (_b) {
252
+ switch (_b.label) {
250
253
  case 0:
251
254
  options = {
252
255
  method: 'POST',
@@ -260,10 +263,11 @@ var BaseAPI = /** @class */ (function () {
260
263
  };
261
264
  return [4 /*yield*/, axios_1.default.request(options)];
262
265
  case 1:
263
- response = _a.sent();
264
- accessToken = response.data.accessToken;
266
+ response = _b.sent();
267
+ _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
265
268
  this.configuration.username = username;
266
269
  this.configuration.accessToken = "Bearer ".concat(accessToken);
270
+ this.permissions = permissions;
267
271
  refreshToken = this.extractRefreshToken(response);
268
272
  this.configuration.refreshToken = refreshToken;
269
273
  return [2 /*return*/];
@@ -273,13 +277,13 @@ var BaseAPI = /** @class */ (function () {
273
277
  };
274
278
  BaseAPI.prototype.refreshTokenInternal = function () {
275
279
  return __awaiter(this, void 0, void 0, function () {
276
- var _a, username, refreshToken, options, accessToken;
280
+ var _a, username, refreshToken, options, response;
277
281
  return __generator(this, function (_b) {
278
282
  switch (_b.label) {
279
283
  case 0:
280
284
  _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
281
285
  if (!username || !refreshToken) {
282
- return [2 /*return*/, ''];
286
+ throw new Error('Failed to refresh token.');
283
287
  }
284
288
  options = {
285
289
  method: 'POST',
@@ -293,8 +297,8 @@ var BaseAPI = /** @class */ (function () {
293
297
  };
294
298
  return [4 /*yield*/, axios_1.default.request(options)];
295
299
  case 1:
296
- accessToken = (_b.sent()).data.accessToken;
297
- return [2 /*return*/, accessToken];
300
+ response = _b.sent();
301
+ return [2 /*return*/, response.data];
298
302
  }
299
303
  });
300
304
  });
@@ -314,26 +318,27 @@ var BaseAPI = /** @class */ (function () {
314
318
  axios.interceptors.response.use(function (res) {
315
319
  return res;
316
320
  }, 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) {
321
+ var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
322
+ return __generator(this, function (_c) {
323
+ switch (_c.label) {
320
324
  case 0:
321
325
  originalConfig = err.config;
322
326
  if (!err.response) return [3 /*break*/, 5];
323
327
  if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
324
328
  originalConfig._retry = true;
325
- _a.label = 1;
329
+ _c.label = 1;
326
330
  case 1:
327
- _a.trys.push([1, 3, , 4]);
331
+ _c.trys.push([1, 3, , 4]);
328
332
  return [4 /*yield*/, this.refreshTokenInternal()];
329
333
  case 2:
330
- tokenString = _a.sent();
334
+ _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
331
335
  accessToken = "Bearer ".concat(tokenString);
336
+ this.permissions = permissions;
332
337
  originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
333
338
  this.configuration.accessToken = accessToken;
334
339
  return [2 /*return*/, axios.request(originalConfig)];
335
340
  case 3:
336
- _error_1 = _a.sent();
341
+ _error_1 = _c.sent();
337
342
  if (_error_1.response && _error_1.response.data) {
338
343
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
339
344
  }
@@ -349,19 +354,20 @@ var BaseAPI = /** @class */ (function () {
349
354
  && originalConfig.headers.hasOwnProperty('Authorization')
350
355
  && _retry_count < 4)) return [3 /*break*/, 9];
351
356
  _retry_count++;
352
- _a.label = 6;
357
+ _c.label = 6;
353
358
  case 6:
354
- _a.trys.push([6, 8, , 9]);
359
+ _c.trys.push([6, 8, , 9]);
355
360
  return [4 /*yield*/, this.refreshTokenInternal()];
356
361
  case 7:
357
- tokenString = _a.sent();
362
+ _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
358
363
  accessToken = "Bearer ".concat(tokenString);
364
+ this.permissions = permissions;
359
365
  _retry = true;
360
366
  originalConfig.headers['Authorization'] = accessToken;
361
367
  this.configuration.accessToken = accessToken;
362
368
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
363
369
  case 8:
364
- _error_2 = _a.sent();
370
+ _error_2 = _c.sent();
365
371
  if (_error_2.response && _error_2.response.data) {
366
372
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
367
373
  }
@@ -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
  };
@@ -53,6 +53,12 @@ export interface InviteClass {
53
53
  * @memberof InviteClass
54
54
  */
55
55
  'updatedAt': string;
56
+ /**
57
+ * Emil Resources Names (ERN) identifies the most specific owner of a resource.
58
+ * @type {string}
59
+ * @memberof InviteClass
60
+ */
61
+ 'ern': string;
56
62
  /**
57
63
  * Organization associated with the user
58
64
  * @type {OrganizationClass}
@@ -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
  };
@@ -90,6 +90,12 @@ export interface UserClass {
90
90
  * @memberof UserClass
91
91
  */
92
92
  'updatedAt': string;
93
+ /**
94
+ * Emil Resources Names (ERN) identifies the most specific owner of a resource.
95
+ * @type {string}
96
+ * @memberof UserClass
97
+ */
98
+ 'ern': string;
93
99
  /**
94
100
  * Organization associated with the user
95
101
  * @type {OrganizationClass}
@@ -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];
@@ -58,6 +58,12 @@ export interface InviteClass {
58
58
  * @memberof InviteClass
59
59
  */
60
60
  'updatedAt': string;
61
+ /**
62
+ * Emil Resources Names (ERN) identifies the most specific owner of a resource.
63
+ * @type {string}
64
+ * @memberof InviteClass
65
+ */
66
+ 'ern': string;
61
67
  /**
62
68
  * Organization associated with the user
63
69
  * @type {OrganizationClass}
@@ -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];
@@ -95,6 +95,12 @@ export interface UserClass {
95
95
  * @memberof UserClass
96
96
  */
97
97
  'updatedAt': string;
98
+ /**
99
+ * Emil Resources Names (ERN) identifies the most specific owner of a resource.
100
+ * @type {string}
101
+ * @memberof UserClass
102
+ */
103
+ 'ern': string;
98
104
  /**
99
105
  * Organization associated with the user
100
106
  * @type {OrganizationClass}
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.17.0",
4
4
  "description": "OpenAPI client for @emilgroup/tenant-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [