@emilgroup/tenant-sdk-node 1.22.1-beta.1 → 1.24.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.
@@ -23,6 +23,8 @@ common.ts
23
23
  configuration.ts
24
24
  git_push.sh
25
25
  index.ts
26
+ models/assign-user-roles-request-dto.ts
27
+ models/assign-user-roles-response-class.ts
26
28
  models/batch-delete-request-dto.ts
27
29
  models/batch-delete-response-class.ts
28
30
  models/create-custom-schema-request-dto.ts
@@ -33,7 +35,6 @@ models/create-dashboard-request-dto.ts
33
35
  models/create-dashboard-response-class.ts
34
36
  models/create-data-report-request-dto.ts
35
37
  models/create-data-report-response-class.ts
36
- models/create-tenant-db-config-request-dto.ts
37
38
  models/create-tenant-request-dto.ts
38
39
  models/custom-field-dto.ts
39
40
  models/custom-schema-class.ts
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.22.1-beta.1 --save
20
+ npm install @emilgroup/tenant-sdk-node@1.24.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/tenant-sdk-node@1.22.1-beta.1
24
+ yarn add @emilgroup/tenant-sdk-node@1.24.0
25
25
  ```
26
26
 
27
27
  And then you can import `UsersApi`.
package/api/users-api.ts CHANGED
@@ -21,6 +21,10 @@ import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObj
21
21
  // @ts-ignore
22
22
  import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base';
23
23
  // @ts-ignore
24
+ import { AssignUserRolesRequestDto } from '../models';
25
+ // @ts-ignore
26
+ import { AssignUserRolesResponseClass } from '../models';
27
+ // @ts-ignore
24
28
  import { BatchDeleteRequestDto } from '../models';
25
29
  // @ts-ignore
26
30
  import { BatchDeleteResponseClass } from '../models';
@@ -50,6 +54,57 @@ const FormData = require('form-data');
50
54
  */
51
55
  export const UsersApiAxiosParamCreator = function (configuration?: Configuration) {
52
56
  return {
57
+ /**
58
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
59
+ * @param {number} id
60
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
61
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
62
+ * @param {*} [options] Override http request option.
63
+ * @deprecated
64
+ * @throws {RequiredError}
65
+ */
66
+ assignUserRoles: async (id: number, assignUserRolesRequestDto: AssignUserRolesRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
67
+ // verify required parameter 'id' is not null or undefined
68
+ assertParamExists('assignUserRoles', 'id', id)
69
+ // verify required parameter 'assignUserRolesRequestDto' is not null or undefined
70
+ assertParamExists('assignUserRoles', 'assignUserRolesRequestDto', assignUserRolesRequestDto)
71
+ const localVarPath = `/tenantservice/v1/users/{id}/assign-roles`
72
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
73
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
74
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
75
+ let baseOptions;
76
+ let baseAccessToken;
77
+ if (configuration) {
78
+ baseOptions = configuration.baseOptions;
79
+ baseAccessToken = configuration.accessToken;
80
+ }
81
+
82
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
83
+ const localVarHeaderParameter = {} as any;
84
+ const localVarQueryParameter = {} as any;
85
+
86
+ // authentication bearer required
87
+ // http bearer authentication required
88
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
89
+
90
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
91
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
92
+ }
93
+
94
+
95
+
96
+ localVarHeaderParameter['Content-Type'] = 'application/json';
97
+
98
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
99
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
100
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
101
+ localVarRequestOptions.data = serializeDataIfNeeded(assignUserRolesRequestDto, localVarRequestOptions, configuration)
102
+
103
+ return {
104
+ url: toPathString(localVarUrlObj),
105
+ options: localVarRequestOptions,
106
+ };
107
+ },
53
108
  /**
54
109
  *
55
110
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -373,6 +428,19 @@ export const UsersApiAxiosParamCreator = function (configuration?: Configuration
373
428
  export const UsersApiFp = function(configuration?: Configuration) {
374
429
  const localVarAxiosParamCreator = UsersApiAxiosParamCreator(configuration)
375
430
  return {
431
+ /**
432
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
433
+ * @param {number} id
434
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
435
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
436
+ * @param {*} [options] Override http request option.
437
+ * @deprecated
438
+ * @throws {RequiredError}
439
+ */
440
+ async assignUserRoles(id: number, assignUserRolesRequestDto: AssignUserRolesRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AssignUserRolesResponseClass>> {
441
+ const localVarAxiosArgs = await localVarAxiosParamCreator.assignUserRoles(id, assignUserRolesRequestDto, authorization, options);
442
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
443
+ },
376
444
  /**
377
445
  *
378
446
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -458,6 +526,18 @@ export const UsersApiFp = function(configuration?: Configuration) {
458
526
  export const UsersApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
459
527
  const localVarFp = UsersApiFp(configuration)
460
528
  return {
529
+ /**
530
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
531
+ * @param {number} id
532
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
533
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
534
+ * @param {*} [options] Override http request option.
535
+ * @deprecated
536
+ * @throws {RequiredError}
537
+ */
538
+ assignUserRoles(id: number, assignUserRolesRequestDto: AssignUserRolesRequestDto, authorization?: string, options?: any): AxiosPromise<AssignUserRolesResponseClass> {
539
+ return localVarFp.assignUserRoles(id, assignUserRolesRequestDto, authorization, options).then((request) => request(axios, basePath));
540
+ },
461
541
  /**
462
542
  *
463
543
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -530,6 +610,34 @@ export const UsersApiFactory = function (configuration?: Configuration, basePath
530
610
  };
531
611
  };
532
612
 
613
+ /**
614
+ * Request parameters for assignUserRoles operation in UsersApi.
615
+ * @export
616
+ * @interface UsersApiAssignUserRolesRequest
617
+ */
618
+ export interface UsersApiAssignUserRolesRequest {
619
+ /**
620
+ *
621
+ * @type {number}
622
+ * @memberof UsersApiAssignUserRoles
623
+ */
624
+ readonly id: number
625
+
626
+ /**
627
+ *
628
+ * @type {AssignUserRolesRequestDto}
629
+ * @memberof UsersApiAssignUserRoles
630
+ */
631
+ readonly assignUserRolesRequestDto: AssignUserRolesRequestDto
632
+
633
+ /**
634
+ * Bearer Token: provided by the login endpoint under the name accessToken.
635
+ * @type {string}
636
+ * @memberof UsersApiAssignUserRoles
637
+ */
638
+ readonly authorization?: string
639
+ }
640
+
533
641
  /**
534
642
  * Request parameters for deleteUsers operation in UsersApi.
535
643
  * @export
@@ -719,6 +827,18 @@ export interface UsersApiListUsersRequest {
719
827
  * @extends {BaseAPI}
720
828
  */
721
829
  export class UsersApi extends BaseAPI {
830
+ /**
831
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
832
+ * @param {UsersApiAssignUserRolesRequest} requestParameters Request parameters.
833
+ * @param {*} [options] Override http request option.
834
+ * @deprecated
835
+ * @throws {RequiredError}
836
+ * @memberof UsersApi
837
+ */
838
+ public assignUserRoles(requestParameters: UsersApiAssignUserRolesRequest, options?: AxiosRequestConfig) {
839
+ return UsersApiFp(this.configuration).assignUserRoles(requestParameters.id, requestParameters.assignUserRolesRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
840
+ }
841
+
722
842
  /**
723
843
  *
724
844
  * @param {UsersApiDeleteUsersRequest} requestParameters Request parameters.
package/base.ts CHANGED
@@ -79,7 +79,6 @@ export class BaseAPI {
79
79
  protected configuration: Configuration;
80
80
  private username?: string;
81
81
  private password?: string;
82
- private permissions?: string;
83
82
 
84
83
  constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) {
85
84
  if (configuration) {
@@ -150,10 +149,6 @@ export class BaseAPI {
150
149
  this.configuration.basePath = env;
151
150
  }
152
151
 
153
- getPermissions(): Array<string> {
154
- return this.permissions.split(',');
155
- }
156
-
157
152
  async authorize(username: string, password: string): Promise<void> {
158
153
  const options: AxiosRequestConfig = {
159
154
  method: 'POST',
@@ -168,21 +163,20 @@ export class BaseAPI {
168
163
 
169
164
  const response = await globalAxios.request<LoginClass>(options);
170
165
 
171
- const { data: { accessToken, permissions } } = response;
166
+ const { data: { accessToken } } = response;
172
167
  this.configuration.username = username;
173
168
  this.configuration.accessToken = `Bearer ${accessToken}`;
174
- this.permissions = permissions;
175
169
 
176
170
  const refreshToken = this.extractRefreshToken(response)
177
171
  this.configuration.refreshToken = refreshToken;
178
172
  }
179
173
 
180
- async refreshTokenInternal(): Promise<LoginClass> {
174
+ async refreshTokenInternal(): Promise<string> {
181
175
  const { username, refreshToken } = this.configuration;
182
176
 
183
177
 
184
178
  if (!username || !refreshToken) {
185
- throw new Error('Failed to refresh token.');
179
+ return '';
186
180
  }
187
181
 
188
182
  const options: AxiosRequestConfig = {
@@ -196,9 +190,9 @@ export class BaseAPI {
196
190
  withCredentials: true,
197
191
  };
198
192
 
199
- const response = await globalAxios.request<LoginClass>(options);
193
+ const { data: { accessToken } } = await globalAxios.request<LoginClass>(options);
200
194
 
201
- return response.data;
195
+ return accessToken;
202
196
  }
203
197
 
204
198
  private extractRefreshToken(response: AxiosResponse): string {
@@ -227,9 +221,8 @@ export class BaseAPI {
227
221
  if (err.response.status === 401 && !originalConfig._retry) {
228
222
  originalConfig._retry = true;
229
223
  try {
230
- const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
224
+ const tokenString = await this.refreshTokenInternal();
231
225
  const accessToken = `Bearer ${tokenString}`;
232
- this.permissions = permissions;
233
226
 
234
227
  originalConfig.headers['Authorization'] = `Bearer ${accessToken}`
235
228
 
@@ -253,9 +246,8 @@ export class BaseAPI {
253
246
  ){
254
247
  _retry_count++;
255
248
  try {
256
- const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
249
+ const tokenString = await this.refreshTokenInternal();
257
250
  const accessToken = `Bearer ${tokenString}`;
258
- this.permissions = permissions;
259
251
 
260
252
  _retry = true;
261
253
  originalConfig.headers['Authorization'] = accessToken;
@@ -12,6 +12,8 @@
12
12
  import { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
13
13
  import { Configuration } from '../configuration';
14
14
  import { RequestArgs, BaseAPI } from '../base';
15
+ import { AssignUserRolesRequestDto } from '../models';
16
+ import { AssignUserRolesResponseClass } from '../models';
15
17
  import { BatchDeleteRequestDto } from '../models';
16
18
  import { BatchDeleteResponseClass } from '../models';
17
19
  import { DisableUsersRequestDto } from '../models';
@@ -27,6 +29,16 @@ import { ListUsersResponseClass } from '../models';
27
29
  * @export
28
30
  */
29
31
  export declare const UsersApiAxiosParamCreator: (configuration?: Configuration) => {
32
+ /**
33
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
34
+ * @param {number} id
35
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
36
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
37
+ * @param {*} [options] Override http request option.
38
+ * @deprecated
39
+ * @throws {RequiredError}
40
+ */
41
+ assignUserRoles: (id: number, assignUserRolesRequestDto: AssignUserRolesRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
30
42
  /**
31
43
  *
32
44
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -90,6 +102,16 @@ export declare const UsersApiAxiosParamCreator: (configuration?: Configuration)
90
102
  * @export
91
103
  */
92
104
  export declare const UsersApiFp: (configuration?: Configuration) => {
105
+ /**
106
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
107
+ * @param {number} id
108
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
109
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
110
+ * @param {*} [options] Override http request option.
111
+ * @deprecated
112
+ * @throws {RequiredError}
113
+ */
114
+ assignUserRoles(id: number, assignUserRolesRequestDto: AssignUserRolesRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AssignUserRolesResponseClass>>;
93
115
  /**
94
116
  *
95
117
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -153,6 +175,16 @@ export declare const UsersApiFp: (configuration?: Configuration) => {
153
175
  * @export
154
176
  */
155
177
  export declare const UsersApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
178
+ /**
179
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
180
+ * @param {number} id
181
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
182
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
183
+ * @param {*} [options] Override http request option.
184
+ * @deprecated
185
+ * @throws {RequiredError}
186
+ */
187
+ assignUserRoles(id: number, assignUserRolesRequestDto: AssignUserRolesRequestDto, authorization?: string, options?: any): AxiosPromise<AssignUserRolesResponseClass>;
156
188
  /**
157
189
  *
158
190
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -211,6 +243,31 @@ export declare const UsersApiFactory: (configuration?: Configuration, basePath?:
211
243
  */
212
244
  listUsers(authorization?: string, pageSize?: any, pageToken?: any, filter?: string, search?: any, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListUsersResponseClass>;
213
245
  };
246
+ /**
247
+ * Request parameters for assignUserRoles operation in UsersApi.
248
+ * @export
249
+ * @interface UsersApiAssignUserRolesRequest
250
+ */
251
+ export interface UsersApiAssignUserRolesRequest {
252
+ /**
253
+ *
254
+ * @type {number}
255
+ * @memberof UsersApiAssignUserRoles
256
+ */
257
+ readonly id: number;
258
+ /**
259
+ *
260
+ * @type {AssignUserRolesRequestDto}
261
+ * @memberof UsersApiAssignUserRoles
262
+ */
263
+ readonly assignUserRolesRequestDto: AssignUserRolesRequestDto;
264
+ /**
265
+ * Bearer Token: provided by the login endpoint under the name accessToken.
266
+ * @type {string}
267
+ * @memberof UsersApiAssignUserRoles
268
+ */
269
+ readonly authorization?: string;
270
+ }
214
271
  /**
215
272
  * Request parameters for deleteUsers operation in UsersApi.
216
273
  * @export
@@ -380,6 +437,15 @@ export interface UsersApiListUsersRequest {
380
437
  * @extends {BaseAPI}
381
438
  */
382
439
  export declare class UsersApi extends BaseAPI {
440
+ /**
441
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
442
+ * @param {UsersApiAssignUserRolesRequest} requestParameters Request parameters.
443
+ * @param {*} [options] Override http request option.
444
+ * @deprecated
445
+ * @throws {RequiredError}
446
+ * @memberof UsersApi
447
+ */
448
+ assignUserRoles(requestParameters: UsersApiAssignUserRolesRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<AssignUserRolesResponseClass, any>>;
383
449
  /**
384
450
  *
385
451
  * @param {UsersApiDeleteUsersRequest} requestParameters Request parameters.
@@ -96,6 +96,59 @@ var FormData = require('form-data');
96
96
  var UsersApiAxiosParamCreator = function (configuration) {
97
97
  var _this = this;
98
98
  return {
99
+ /**
100
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
101
+ * @param {number} id
102
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
103
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
104
+ * @param {*} [options] Override http request option.
105
+ * @deprecated
106
+ * @throws {RequiredError}
107
+ */
108
+ assignUserRoles: function (id, assignUserRolesRequestDto, authorization, options) {
109
+ if (options === void 0) { options = {}; }
110
+ return __awaiter(_this, void 0, void 0, function () {
111
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
112
+ return __generator(this, function (_a) {
113
+ switch (_a.label) {
114
+ case 0:
115
+ // verify required parameter 'id' is not null or undefined
116
+ (0, common_1.assertParamExists)('assignUserRoles', 'id', id);
117
+ // verify required parameter 'assignUserRolesRequestDto' is not null or undefined
118
+ (0, common_1.assertParamExists)('assignUserRoles', 'assignUserRolesRequestDto', assignUserRolesRequestDto);
119
+ localVarPath = "/tenantservice/v1/users/{id}/assign-roles"
120
+ .replace("{".concat("id", "}"), encodeURIComponent(String(id)));
121
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
122
+ if (configuration) {
123
+ baseOptions = configuration.baseOptions;
124
+ baseAccessToken = configuration.accessToken;
125
+ }
126
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
127
+ localVarHeaderParameter = {};
128
+ localVarQueryParameter = {};
129
+ // authentication bearer required
130
+ // http bearer authentication required
131
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
132
+ case 1:
133
+ // authentication bearer required
134
+ // http bearer authentication required
135
+ _a.sent();
136
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
137
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
138
+ }
139
+ localVarHeaderParameter['Content-Type'] = 'application/json';
140
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
141
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
142
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
143
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(assignUserRolesRequestDto, localVarRequestOptions, configuration);
144
+ return [2 /*return*/, {
145
+ url: (0, common_1.toPathString)(localVarUrlObj),
146
+ options: localVarRequestOptions,
147
+ }];
148
+ }
149
+ });
150
+ });
151
+ },
99
152
  /**
100
153
  *
101
154
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -425,6 +478,28 @@ exports.UsersApiAxiosParamCreator = UsersApiAxiosParamCreator;
425
478
  var UsersApiFp = function (configuration) {
426
479
  var localVarAxiosParamCreator = (0, exports.UsersApiAxiosParamCreator)(configuration);
427
480
  return {
481
+ /**
482
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
483
+ * @param {number} id
484
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
485
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
486
+ * @param {*} [options] Override http request option.
487
+ * @deprecated
488
+ * @throws {RequiredError}
489
+ */
490
+ assignUserRoles: function (id, assignUserRolesRequestDto, authorization, options) {
491
+ return __awaiter(this, void 0, void 0, function () {
492
+ var localVarAxiosArgs;
493
+ return __generator(this, function (_a) {
494
+ switch (_a.label) {
495
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.assignUserRoles(id, assignUserRolesRequestDto, authorization, options)];
496
+ case 1:
497
+ localVarAxiosArgs = _a.sent();
498
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
499
+ }
500
+ });
501
+ });
502
+ },
428
503
  /**
429
504
  *
430
505
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -564,6 +639,18 @@ exports.UsersApiFp = UsersApiFp;
564
639
  var UsersApiFactory = function (configuration, basePath, axios) {
565
640
  var localVarFp = (0, exports.UsersApiFp)(configuration);
566
641
  return {
642
+ /**
643
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
644
+ * @param {number} id
645
+ * @param {AssignUserRolesRequestDto} assignUserRolesRequestDto
646
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
647
+ * @param {*} [options] Override http request option.
648
+ * @deprecated
649
+ * @throws {RequiredError}
650
+ */
651
+ assignUserRoles: function (id, assignUserRolesRequestDto, authorization, options) {
652
+ return localVarFp.assignUserRoles(id, assignUserRolesRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
653
+ },
567
654
  /**
568
655
  *
569
656
  * @param {BatchDeleteRequestDto} batchDeleteRequestDto
@@ -647,6 +734,18 @@ var UsersApi = /** @class */ (function (_super) {
647
734
  function UsersApi() {
648
735
  return _super !== null && _super.apply(this, arguments) || this;
649
736
  }
737
+ /**
738
+ * This endpoint is deprecated, please refer to the policy administration service at /policy-administration-service/api.
739
+ * @param {UsersApiAssignUserRolesRequest} requestParameters Request parameters.
740
+ * @param {*} [options] Override http request option.
741
+ * @deprecated
742
+ * @throws {RequiredError}
743
+ * @memberof UsersApi
744
+ */
745
+ UsersApi.prototype.assignUserRoles = function (requestParameters, options) {
746
+ var _this = this;
747
+ return (0, exports.UsersApiFp)(this.configuration).assignUserRoles(requestParameters.id, requestParameters.assignUserRolesRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
748
+ };
650
749
  /**
651
750
  *
652
751
  * @param {UsersApiDeleteUsersRequest} requestParameters Request parameters.
package/dist/base.d.ts CHANGED
@@ -53,16 +53,14 @@ export declare class BaseAPI {
53
53
  protected configuration: Configuration;
54
54
  private username?;
55
55
  private password?;
56
- private permissions?;
57
56
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
58
57
  initialize(env?: Environment): Promise<void>;
59
58
  private loadCredentials;
60
59
  private readConfigFile;
61
60
  private readEnvVariables;
62
61
  selectEnvironment(env: Environment): void;
63
- getPermissions(): Array<string>;
64
62
  authorize(username: string, password: string): Promise<void>;
65
- refreshTokenInternal(): Promise<LoginClass>;
63
+ refreshTokenInternal(): Promise<string>;
66
64
  private extractRefreshToken;
67
65
  getConfiguration(): Configuration;
68
66
  private attachInterceptor;
package/dist/base.js CHANGED
@@ -242,14 +242,11 @@ 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
- };
248
245
  BaseAPI.prototype.authorize = function (username, password) {
249
246
  return __awaiter(this, void 0, void 0, function () {
250
- var options, response, _a, accessToken, permissions, refreshToken;
251
- return __generator(this, function (_b) {
252
- switch (_b.label) {
247
+ var options, response, accessToken, refreshToken;
248
+ return __generator(this, function (_a) {
249
+ switch (_a.label) {
253
250
  case 0:
254
251
  options = {
255
252
  method: 'POST',
@@ -263,11 +260,10 @@ var BaseAPI = /** @class */ (function () {
263
260
  };
264
261
  return [4 /*yield*/, axios_1.default.request(options)];
265
262
  case 1:
266
- response = _b.sent();
267
- _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
263
+ response = _a.sent();
264
+ accessToken = response.data.accessToken;
268
265
  this.configuration.username = username;
269
266
  this.configuration.accessToken = "Bearer ".concat(accessToken);
270
- this.permissions = permissions;
271
267
  refreshToken = this.extractRefreshToken(response);
272
268
  this.configuration.refreshToken = refreshToken;
273
269
  return [2 /*return*/];
@@ -277,13 +273,13 @@ var BaseAPI = /** @class */ (function () {
277
273
  };
278
274
  BaseAPI.prototype.refreshTokenInternal = function () {
279
275
  return __awaiter(this, void 0, void 0, function () {
280
- var _a, username, refreshToken, options, response;
276
+ var _a, username, refreshToken, options, accessToken;
281
277
  return __generator(this, function (_b) {
282
278
  switch (_b.label) {
283
279
  case 0:
284
280
  _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
285
281
  if (!username || !refreshToken) {
286
- throw new Error('Failed to refresh token.');
282
+ return [2 /*return*/, ''];
287
283
  }
288
284
  options = {
289
285
  method: 'POST',
@@ -297,8 +293,8 @@ var BaseAPI = /** @class */ (function () {
297
293
  };
298
294
  return [4 /*yield*/, axios_1.default.request(options)];
299
295
  case 1:
300
- response = _b.sent();
301
- return [2 /*return*/, response.data];
296
+ accessToken = (_b.sent()).data.accessToken;
297
+ return [2 /*return*/, accessToken];
302
298
  }
303
299
  });
304
300
  });
@@ -318,27 +314,26 @@ var BaseAPI = /** @class */ (function () {
318
314
  axios.interceptors.response.use(function (res) {
319
315
  return res;
320
316
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
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) {
317
+ var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
318
+ return __generator(this, function (_a) {
319
+ switch (_a.label) {
324
320
  case 0:
325
321
  originalConfig = err.config;
326
322
  if (!err.response) return [3 /*break*/, 5];
327
323
  if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
328
324
  originalConfig._retry = true;
329
- _c.label = 1;
325
+ _a.label = 1;
330
326
  case 1:
331
- _c.trys.push([1, 3, , 4]);
327
+ _a.trys.push([1, 3, , 4]);
332
328
  return [4 /*yield*/, this.refreshTokenInternal()];
333
329
  case 2:
334
- _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
330
+ tokenString = _a.sent();
335
331
  accessToken = "Bearer ".concat(tokenString);
336
- this.permissions = permissions;
337
332
  originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
338
333
  this.configuration.accessToken = accessToken;
339
334
  return [2 /*return*/, axios.request(originalConfig)];
340
335
  case 3:
341
- _error_1 = _c.sent();
336
+ _error_1 = _a.sent();
342
337
  if (_error_1.response && _error_1.response.data) {
343
338
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
344
339
  }
@@ -354,20 +349,19 @@ var BaseAPI = /** @class */ (function () {
354
349
  && originalConfig.headers.hasOwnProperty('Authorization')
355
350
  && _retry_count < 4)) return [3 /*break*/, 9];
356
351
  _retry_count++;
357
- _c.label = 6;
352
+ _a.label = 6;
358
353
  case 6:
359
- _c.trys.push([6, 8, , 9]);
354
+ _a.trys.push([6, 8, , 9]);
360
355
  return [4 /*yield*/, this.refreshTokenInternal()];
361
356
  case 7:
362
- _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
357
+ tokenString = _a.sent();
363
358
  accessToken = "Bearer ".concat(tokenString);
364
- this.permissions = permissions;
365
359
  _retry = true;
366
360
  originalConfig.headers['Authorization'] = accessToken;
367
361
  this.configuration.accessToken = accessToken;
368
362
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
369
363
  case 8:
370
- _error_2 = _c.sent();
364
+ _error_2 = _a.sent();
371
365
  if (_error_2.response && _error_2.response.data) {
372
366
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
373
367
  }
@@ -12,19 +12,19 @@
12
12
  /**
13
13
  *
14
14
  * @export
15
- * @interface CreateTenantDbConfigRequestDto
15
+ * @interface AssignUserRolesRequestDto
16
16
  */
17
- export interface CreateTenantDbConfigRequestDto {
17
+ export interface AssignUserRolesRequestDto {
18
18
  /**
19
- * Tenant Slug
20
- * @type {string}
21
- * @memberof CreateTenantDbConfigRequestDto
19
+ * User id
20
+ * @type {number}
21
+ * @memberof AssignUserRolesRequestDto
22
22
  */
23
- 'tenantSlug': string;
23
+ 'userId': number;
24
24
  /**
25
- * Tenant DB Config
26
- * @type {object}
27
- * @memberof CreateTenantDbConfigRequestDto
25
+ * Role ids to be assigned
26
+ * @type {Array<number>}
27
+ * @memberof AssignUserRolesRequestDto
28
28
  */
29
- 'config': object;
29
+ 'roleIds': Array<number>;
30
30
  }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * EMIL Tenant Service
3
+ * The EMIL TenantService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ * Contact: kontakt@emil.de
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import { UserClass } from './user-class';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface AssignUserRolesResponseClass
17
+ */
18
+ export interface AssignUserRolesResponseClass {
19
+ /**
20
+ * user
21
+ * @type {UserClass}
22
+ * @memberof AssignUserRolesResponseClass
23
+ */
24
+ 'user': UserClass;
25
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL Tenant Service
6
+ * The EMIL TenantService API description
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ * Contact: kontakt@emil.de
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,5 @@
1
+ export * from './assign-user-roles-request-dto';
2
+ export * from './assign-user-roles-response-class';
1
3
  export * from './batch-delete-request-dto';
2
4
  export * from './batch-delete-response-class';
3
5
  export * from './create-custom-schema-request-dto';
@@ -8,7 +10,6 @@ export * from './create-dashboard-request-dto';
8
10
  export * from './create-dashboard-response-class';
9
11
  export * from './create-data-report-request-dto';
10
12
  export * from './create-data-report-response-class';
11
- export * from './create-tenant-db-config-request-dto';
12
13
  export * from './create-tenant-request-dto';
13
14
  export * from './custom-field-dto';
14
15
  export * from './custom-schema-class';
@@ -14,6 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./assign-user-roles-request-dto"), exports);
18
+ __exportStar(require("./assign-user-roles-response-class"), exports);
17
19
  __exportStar(require("./batch-delete-request-dto"), exports);
18
20
  __exportStar(require("./batch-delete-response-class"), exports);
19
21
  __exportStar(require("./create-custom-schema-request-dto"), exports);
@@ -24,7 +26,6 @@ __exportStar(require("./create-dashboard-request-dto"), exports);
24
26
  __exportStar(require("./create-dashboard-response-class"), exports);
25
27
  __exportStar(require("./create-data-report-request-dto"), exports);
26
28
  __exportStar(require("./create-data-report-response-class"), exports);
27
- __exportStar(require("./create-tenant-db-config-request-dto"), exports);
28
29
  __exportStar(require("./create-tenant-request-dto"), exports);
29
30
  __exportStar(require("./custom-field-dto"), exports);
30
31
  __exportStar(require("./custom-schema-class"), exports);
@@ -53,18 +53,6 @@ export interface InviteClass {
53
53
  * @memberof InviteClass
54
54
  */
55
55
  'updatedAt': string;
56
- /**
57
- * Identifier of the user who created the record.
58
- * @type {string}
59
- * @memberof InviteClass
60
- */
61
- 'createdBy': string;
62
- /**
63
- * Identifier of the user who last updated the record.
64
- * @type {string}
65
- * @memberof InviteClass
66
- */
67
- 'updatedBy': string;
68
56
  /**
69
57
  * Emil Resources Names (ERN) identifies the most specific owner of a resource.
70
58
  * @type {string}
@@ -89,6 +77,18 @@ export interface InviteClass {
89
77
  * @memberof InviteClass
90
78
  */
91
79
  'organizationId'?: number;
80
+ /**
81
+ * Identifier of the user who created the record.
82
+ * @type {string}
83
+ * @memberof InviteClass
84
+ */
85
+ 'createdBy': string;
86
+ /**
87
+ * Identifier of the user who last updated the record.
88
+ * @type {string}
89
+ * @memberof InviteClass
90
+ */
91
+ 'updatedBy': string;
92
92
  /**
93
93
  * Organization associated with the user
94
94
  * @type {OrganizationClass}
@@ -91,29 +91,29 @@ export interface UserClass {
91
91
  */
92
92
  'updatedAt': string;
93
93
  /**
94
- * Identifier of the user who created the record.
94
+ * Emil Resources Names (ERN) identifies the most specific owner of a resource.
95
95
  * @type {string}
96
96
  * @memberof UserClass
97
97
  */
98
- 'createdBy': string;
98
+ 'ern': string;
99
99
  /**
100
- * Identifier of the user who last updated the record.
100
+ * Associated partner code - only available if the partner has been invited and registered in EIS platform
101
101
  * @type {string}
102
102
  * @memberof UserClass
103
103
  */
104
- 'updatedBy': string;
104
+ 'partnerCode'?: string;
105
105
  /**
106
- * Emil Resources Names (ERN) identifies the most specific owner of a resource.
106
+ * Identifier of the user who created the record.
107
107
  * @type {string}
108
108
  * @memberof UserClass
109
109
  */
110
- 'ern': string;
110
+ 'createdBy': string;
111
111
  /**
112
- * Associated partner code - only available if the partner has been invited and registered in EIS platform
112
+ * Identifier of the user who last updated the record.
113
113
  * @type {string}
114
114
  * @memberof UserClass
115
115
  */
116
- 'partnerCode'?: string;
116
+ 'updatedBy': string;
117
117
  /**
118
118
  * Organization associated with the user
119
119
  * @type {OrganizationClass}
@@ -17,20 +17,20 @@
17
17
  /**
18
18
  *
19
19
  * @export
20
- * @interface CreateTenantDbConfigRequestDto
20
+ * @interface AssignUserRolesRequestDto
21
21
  */
22
- export interface CreateTenantDbConfigRequestDto {
22
+ export interface AssignUserRolesRequestDto {
23
23
  /**
24
- * Tenant Slug
25
- * @type {string}
26
- * @memberof CreateTenantDbConfigRequestDto
24
+ * User id
25
+ * @type {number}
26
+ * @memberof AssignUserRolesRequestDto
27
27
  */
28
- 'tenantSlug': string;
28
+ 'userId': number;
29
29
  /**
30
- * Tenant DB Config
31
- * @type {object}
32
- * @memberof CreateTenantDbConfigRequestDto
30
+ * Role ids to be assigned
31
+ * @type {Array<number>}
32
+ * @memberof AssignUserRolesRequestDto
33
33
  */
34
- 'config': object;
34
+ 'roleIds': Array<number>;
35
35
  }
36
36
 
@@ -0,0 +1,31 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL Tenant Service
5
+ * The EMIL TenantService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { UserClass } from './user-class';
17
+
18
+ /**
19
+ *
20
+ * @export
21
+ * @interface AssignUserRolesResponseClass
22
+ */
23
+ export interface AssignUserRolesResponseClass {
24
+ /**
25
+ * user
26
+ * @type {UserClass}
27
+ * @memberof AssignUserRolesResponseClass
28
+ */
29
+ 'user': UserClass;
30
+ }
31
+
package/models/index.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export * from './assign-user-roles-request-dto';
2
+ export * from './assign-user-roles-response-class';
1
3
  export * from './batch-delete-request-dto';
2
4
  export * from './batch-delete-response-class';
3
5
  export * from './create-custom-schema-request-dto';
@@ -8,7 +10,6 @@ export * from './create-dashboard-request-dto';
8
10
  export * from './create-dashboard-response-class';
9
11
  export * from './create-data-report-request-dto';
10
12
  export * from './create-data-report-response-class';
11
- export * from './create-tenant-db-config-request-dto';
12
13
  export * from './create-tenant-request-dto';
13
14
  export * from './custom-field-dto';
14
15
  export * from './custom-schema-class';
@@ -58,18 +58,6 @@ export interface InviteClass {
58
58
  * @memberof InviteClass
59
59
  */
60
60
  'updatedAt': string;
61
- /**
62
- * Identifier of the user who created the record.
63
- * @type {string}
64
- * @memberof InviteClass
65
- */
66
- 'createdBy': string;
67
- /**
68
- * Identifier of the user who last updated the record.
69
- * @type {string}
70
- * @memberof InviteClass
71
- */
72
- 'updatedBy': string;
73
61
  /**
74
62
  * Emil Resources Names (ERN) identifies the most specific owner of a resource.
75
63
  * @type {string}
@@ -94,6 +82,18 @@ export interface InviteClass {
94
82
  * @memberof InviteClass
95
83
  */
96
84
  'organizationId'?: number;
85
+ /**
86
+ * Identifier of the user who created the record.
87
+ * @type {string}
88
+ * @memberof InviteClass
89
+ */
90
+ 'createdBy': string;
91
+ /**
92
+ * Identifier of the user who last updated the record.
93
+ * @type {string}
94
+ * @memberof InviteClass
95
+ */
96
+ 'updatedBy': string;
97
97
  /**
98
98
  * Organization associated with the user
99
99
  * @type {OrganizationClass}
@@ -96,29 +96,29 @@ export interface UserClass {
96
96
  */
97
97
  'updatedAt': string;
98
98
  /**
99
- * Identifier of the user who created the record.
99
+ * Emil Resources Names (ERN) identifies the most specific owner of a resource.
100
100
  * @type {string}
101
101
  * @memberof UserClass
102
102
  */
103
- 'createdBy': string;
103
+ 'ern': string;
104
104
  /**
105
- * Identifier of the user who last updated the record.
105
+ * Associated partner code - only available if the partner has been invited and registered in EIS platform
106
106
  * @type {string}
107
107
  * @memberof UserClass
108
108
  */
109
- 'updatedBy': string;
109
+ 'partnerCode'?: string;
110
110
  /**
111
- * Emil Resources Names (ERN) identifies the most specific owner of a resource.
111
+ * Identifier of the user who created the record.
112
112
  * @type {string}
113
113
  * @memberof UserClass
114
114
  */
115
- 'ern': string;
115
+ 'createdBy': string;
116
116
  /**
117
- * Associated partner code - only available if the partner has been invited and registered in EIS platform
117
+ * Identifier of the user who last updated the record.
118
118
  * @type {string}
119
119
  * @memberof UserClass
120
120
  */
121
- 'partnerCode'?: string;
121
+ 'updatedBy': string;
122
122
  /**
123
123
  * Organization associated with the user
124
124
  * @type {OrganizationClass}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/tenant-sdk-node",
3
- "version": "1.22.1-beta.1",
3
+ "version": "1.24.0",
4
4
  "description": "OpenAPI client for @emilgroup/tenant-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [