@emilgroup/notification-sdk-node 1.3.0 → 1.4.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.
Files changed (43) hide show
  1. package/.openapi-generator/FILES +1 -0
  2. package/README.md +2 -2
  3. package/api/default-api.ts +8 -4
  4. package/api/email-verifications-api.ts +8 -8
  5. package/api/layouts-api.ts +71 -71
  6. package/api/notification-templates-api.ts +71 -71
  7. package/api/notifications-api.ts +4 -4
  8. package/base.ts +55 -20
  9. package/common.ts +2 -2
  10. package/configuration.ts +9 -0
  11. package/dist/api/default-api.d.ts +8 -4
  12. package/dist/api/default-api.js +8 -4
  13. package/dist/api/email-verifications-api.d.ts +8 -8
  14. package/dist/api/email-verifications-api.js +8 -8
  15. package/dist/api/layouts-api.d.ts +64 -64
  16. package/dist/api/layouts-api.js +50 -50
  17. package/dist/api/notification-templates-api.d.ts +64 -64
  18. package/dist/api/notification-templates-api.js +50 -50
  19. package/dist/api/notifications-api.d.ts +4 -4
  20. package/dist/api/notifications-api.js +4 -4
  21. package/dist/base.d.ts +13 -5
  22. package/dist/base.js +64 -30
  23. package/dist/common.js +2 -2
  24. package/dist/configuration.d.ts +6 -0
  25. package/dist/configuration.js +8 -0
  26. package/dist/models/html-template-class.d.ts +0 -6
  27. package/dist/models/index.d.ts +1 -0
  28. package/dist/models/index.js +1 -0
  29. package/dist/models/initiate-email-verification-dto.d.ts +1 -1
  30. package/dist/models/inline-response200.d.ts +6 -6
  31. package/dist/models/inline-response503.d.ts +6 -6
  32. package/dist/models/s3-document-dto.d.ts +36 -0
  33. package/dist/models/s3-document-dto.js +15 -0
  34. package/dist/models/send-notification-request-dto.d.ts +3 -2
  35. package/models/html-template-class.ts +0 -6
  36. package/models/index.ts +1 -0
  37. package/models/initiate-email-verification-dto.ts +1 -1
  38. package/models/inline-response200.ts +6 -6
  39. package/models/inline-response503.ts +6 -6
  40. package/models/s3-document-dto.ts +42 -0
  41. package/models/send-notification-request-dto.ts +3 -2
  42. package/package.json +1 -1
  43. package/tsconfig.json +1 -0
@@ -97,7 +97,7 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
97
97
  var _this = this;
98
98
  return {
99
99
  /**
100
- *
100
+ * undefined **Required Permissions** \"notification-management.email-templates.create\"
101
101
  * @param {CreateNotificationTemplateRequestDto} createNotificationTemplateRequestDto
102
102
  * @param {string} [authorization] Bearer Token
103
103
  * @param {*} [options] Override http request option.
@@ -145,7 +145,7 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
145
145
  });
146
146
  },
147
147
  /**
148
- *
148
+ * undefined **Required Permissions** \"notification-management.email-templates.delete\"
149
149
  * @param {number} id
150
150
  * @param {string} [authorization] Bearer Token
151
151
  * @param {*} [options] Override http request option.
@@ -192,7 +192,7 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
192
192
  });
193
193
  },
194
194
  /**
195
- *
195
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
196
196
  * @param {number} id
197
197
  * @param {number} id2
198
198
  * @param {string} [authorization] Bearer Token
@@ -249,19 +249,19 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
249
249
  });
250
250
  },
251
251
  /**
252
- *
252
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
253
253
  * @param {string} [authorization] Bearer Token
254
- * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
255
- * @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.
256
- * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
257
- * @param {any} [filters] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
258
- * @param {any} [search] Search the list by any field. For instance, if you want to search by code add code=xxx in order to fetch the result.
259
- * @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.
260
- * @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.
254
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
255
+ * @param {string} [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.
256
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
257
+ * @param {string} [search] To search the list by any field, pass search=xxx to fetch the result.
258
+ * @param {string} [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.
259
+ * @param {string} [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.
260
+ * @param {string} [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.
261
261
  * @param {*} [options] Override http request option.
262
262
  * @throws {RequiredError}
263
263
  */
264
- listNotificationTemplates: function (authorization, pageSize, pageToken, filter, filters, search, order, expand, options) {
264
+ listNotificationTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
265
265
  if (options === void 0) { options = {}; }
266
266
  return __awaiter(_this, void 0, void 0, function () {
267
267
  var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
@@ -293,9 +293,6 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
293
293
  if (filter !== undefined) {
294
294
  localVarQueryParameter['filter'] = filter;
295
295
  }
296
- if (filters !== undefined) {
297
- localVarQueryParameter['filters'] = filters;
298
- }
299
296
  if (search !== undefined) {
300
297
  localVarQueryParameter['search'] = search;
301
298
  }
@@ -305,6 +302,9 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
305
302
  if (expand !== undefined) {
306
303
  localVarQueryParameter['expand'] = expand;
307
304
  }
305
+ if (filters !== undefined) {
306
+ localVarQueryParameter['filters'] = filters;
307
+ }
308
308
  if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
309
309
  localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
310
310
  }
@@ -320,7 +320,7 @@ var NotificationTemplatesApiAxiosParamCreator = function (configuration) {
320
320
  });
321
321
  },
322
322
  /**
323
- *
323
+ * undefined **Required Permissions** \"notification-management.email-templates.update\"
324
324
  * @param {number} id
325
325
  * @param {UpdateNotificationTemplateRequestDto} updateNotificationTemplateRequestDto
326
326
  * @param {string} [authorization] Bearer Token
@@ -382,7 +382,7 @@ var NotificationTemplatesApiFp = function (configuration) {
382
382
  var localVarAxiosParamCreator = (0, exports.NotificationTemplatesApiAxiosParamCreator)(configuration);
383
383
  return {
384
384
  /**
385
- *
385
+ * undefined **Required Permissions** \"notification-management.email-templates.create\"
386
386
  * @param {CreateNotificationTemplateRequestDto} createNotificationTemplateRequestDto
387
387
  * @param {string} [authorization] Bearer Token
388
388
  * @param {*} [options] Override http request option.
@@ -402,7 +402,7 @@ var NotificationTemplatesApiFp = function (configuration) {
402
402
  });
403
403
  },
404
404
  /**
405
- *
405
+ * undefined **Required Permissions** \"notification-management.email-templates.delete\"
406
406
  * @param {number} id
407
407
  * @param {string} [authorization] Bearer Token
408
408
  * @param {*} [options] Override http request option.
@@ -422,7 +422,7 @@ var NotificationTemplatesApiFp = function (configuration) {
422
422
  });
423
423
  },
424
424
  /**
425
- *
425
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
426
426
  * @param {number} id
427
427
  * @param {number} id2
428
428
  * @param {string} [authorization] Bearer Token
@@ -444,24 +444,24 @@ var NotificationTemplatesApiFp = function (configuration) {
444
444
  });
445
445
  },
446
446
  /**
447
- *
447
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
448
448
  * @param {string} [authorization] Bearer Token
449
- * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
450
- * @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.
451
- * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
452
- * @param {any} [filters] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
453
- * @param {any} [search] Search the list by any field. For instance, if you want to search by code add code=xxx in order to fetch the result.
454
- * @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.
455
- * @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.
449
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
450
+ * @param {string} [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.
451
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
452
+ * @param {string} [search] To search the list by any field, pass search=xxx to fetch the result.
453
+ * @param {string} [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.
454
+ * @param {string} [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.
455
+ * @param {string} [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.
456
456
  * @param {*} [options] Override http request option.
457
457
  * @throws {RequiredError}
458
458
  */
459
- listNotificationTemplates: function (authorization, pageSize, pageToken, filter, filters, search, order, expand, options) {
459
+ listNotificationTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
460
460
  return __awaiter(this, void 0, void 0, function () {
461
461
  var localVarAxiosArgs;
462
462
  return __generator(this, function (_a) {
463
463
  switch (_a.label) {
464
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.listNotificationTemplates(authorization, pageSize, pageToken, filter, filters, search, order, expand, options)];
464
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.listNotificationTemplates(authorization, pageSize, pageToken, filter, search, order, expand, filters, options)];
465
465
  case 1:
466
466
  localVarAxiosArgs = _a.sent();
467
467
  return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
@@ -470,7 +470,7 @@ var NotificationTemplatesApiFp = function (configuration) {
470
470
  });
471
471
  },
472
472
  /**
473
- *
473
+ * undefined **Required Permissions** \"notification-management.email-templates.update\"
474
474
  * @param {number} id
475
475
  * @param {UpdateNotificationTemplateRequestDto} updateNotificationTemplateRequestDto
476
476
  * @param {string} [authorization] Bearer Token
@@ -501,7 +501,7 @@ var NotificationTemplatesApiFactory = function (configuration, basePath, axios)
501
501
  var localVarFp = (0, exports.NotificationTemplatesApiFp)(configuration);
502
502
  return {
503
503
  /**
504
- *
504
+ * undefined **Required Permissions** \"notification-management.email-templates.create\"
505
505
  * @param {CreateNotificationTemplateRequestDto} createNotificationTemplateRequestDto
506
506
  * @param {string} [authorization] Bearer Token
507
507
  * @param {*} [options] Override http request option.
@@ -511,7 +511,7 @@ var NotificationTemplatesApiFactory = function (configuration, basePath, axios)
511
511
  return localVarFp.createNotificationTemplate(createNotificationTemplateRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
512
512
  },
513
513
  /**
514
- *
514
+ * undefined **Required Permissions** \"notification-management.email-templates.delete\"
515
515
  * @param {number} id
516
516
  * @param {string} [authorization] Bearer Token
517
517
  * @param {*} [options] Override http request option.
@@ -521,7 +521,7 @@ var NotificationTemplatesApiFactory = function (configuration, basePath, axios)
521
521
  return localVarFp.deleteNotificationTemplate(id, authorization, options).then(function (request) { return request(axios, basePath); });
522
522
  },
523
523
  /**
524
- *
524
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
525
525
  * @param {number} id
526
526
  * @param {number} id2
527
527
  * @param {string} [authorization] Bearer Token
@@ -533,23 +533,23 @@ var NotificationTemplatesApiFactory = function (configuration, basePath, axios)
533
533
  return localVarFp.getNotificationTemplate(id, id2, authorization, expand, options).then(function (request) { return request(axios, basePath); });
534
534
  },
535
535
  /**
536
- *
536
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
537
537
  * @param {string} [authorization] Bearer Token
538
- * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
539
- * @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.
540
- * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
541
- * @param {any} [filters] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
542
- * @param {any} [search] Search the list by any field. For instance, if you want to search by code add code=xxx in order to fetch the result.
543
- * @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.
544
- * @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.
538
+ * @param {number} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 50. Default: 10.
539
+ * @param {string} [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.
540
+ * @param {string} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
541
+ * @param {string} [search] To search the list by any field, pass search=xxx to fetch the result.
542
+ * @param {string} [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.
543
+ * @param {string} [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.
544
+ * @param {string} [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.
545
545
  * @param {*} [options] Override http request option.
546
546
  * @throws {RequiredError}
547
547
  */
548
- listNotificationTemplates: function (authorization, pageSize, pageToken, filter, filters, search, order, expand, options) {
549
- return localVarFp.listNotificationTemplates(authorization, pageSize, pageToken, filter, filters, search, order, expand, options).then(function (request) { return request(axios, basePath); });
548
+ listNotificationTemplates: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
549
+ return localVarFp.listNotificationTemplates(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then(function (request) { return request(axios, basePath); });
550
550
  },
551
551
  /**
552
- *
552
+ * undefined **Required Permissions** \"notification-management.email-templates.update\"
553
553
  * @param {number} id
554
554
  * @param {UpdateNotificationTemplateRequestDto} updateNotificationTemplateRequestDto
555
555
  * @param {string} [authorization] Bearer Token
@@ -574,7 +574,7 @@ var NotificationTemplatesApi = /** @class */ (function (_super) {
574
574
  return _super !== null && _super.apply(this, arguments) || this;
575
575
  }
576
576
  /**
577
- *
577
+ * undefined **Required Permissions** \"notification-management.email-templates.create\"
578
578
  * @param {NotificationTemplatesApiCreateNotificationTemplateRequest} requestParameters Request parameters.
579
579
  * @param {*} [options] Override http request option.
580
580
  * @throws {RequiredError}
@@ -585,7 +585,7 @@ var NotificationTemplatesApi = /** @class */ (function (_super) {
585
585
  return (0, exports.NotificationTemplatesApiFp)(this.configuration).createNotificationTemplate(requestParameters.createNotificationTemplateRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
586
586
  };
587
587
  /**
588
- *
588
+ * undefined **Required Permissions** \"notification-management.email-templates.delete\"
589
589
  * @param {NotificationTemplatesApiDeleteNotificationTemplateRequest} requestParameters Request parameters.
590
590
  * @param {*} [options] Override http request option.
591
591
  * @throws {RequiredError}
@@ -596,7 +596,7 @@ var NotificationTemplatesApi = /** @class */ (function (_super) {
596
596
  return (0, exports.NotificationTemplatesApiFp)(this.configuration).deleteNotificationTemplate(requestParameters.id, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
597
597
  };
598
598
  /**
599
- *
599
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
600
600
  * @param {NotificationTemplatesApiGetNotificationTemplateRequest} requestParameters Request parameters.
601
601
  * @param {*} [options] Override http request option.
602
602
  * @throws {RequiredError}
@@ -607,7 +607,7 @@ var NotificationTemplatesApi = /** @class */ (function (_super) {
607
607
  return (0, exports.NotificationTemplatesApiFp)(this.configuration).getNotificationTemplate(requestParameters.id, requestParameters.id2, requestParameters.authorization, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
608
608
  };
609
609
  /**
610
- *
610
+ * undefined **Required Permissions** \"notification-management.email-templates.view\"
611
611
  * @param {NotificationTemplatesApiListNotificationTemplatesRequest} requestParameters Request parameters.
612
612
  * @param {*} [options] Override http request option.
613
613
  * @throws {RequiredError}
@@ -616,10 +616,10 @@ var NotificationTemplatesApi = /** @class */ (function (_super) {
616
616
  NotificationTemplatesApi.prototype.listNotificationTemplates = function (requestParameters, options) {
617
617
  var _this = this;
618
618
  if (requestParameters === void 0) { requestParameters = {}; }
619
- return (0, exports.NotificationTemplatesApiFp)(this.configuration).listNotificationTemplates(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.filters, requestParameters.search, requestParameters.order, requestParameters.expand, options).then(function (request) { return request(_this.axios, _this.basePath); });
619
+ return (0, exports.NotificationTemplatesApiFp)(this.configuration).listNotificationTemplates(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then(function (request) { return request(_this.axios, _this.basePath); });
620
620
  };
621
621
  /**
622
- *
622
+ * undefined **Required Permissions** \"notification-management.email-templates.update\"
623
623
  * @param {NotificationTemplatesApiUpdateNotificationTemplateRequest} requestParameters Request parameters.
624
624
  * @param {*} [options] Override http request option.
625
625
  * @throws {RequiredError}
@@ -20,7 +20,7 @@ import { SendNotificationResponseClass } from '../models';
20
20
  */
21
21
  export declare const NotificationsApiAxiosParamCreator: (configuration?: Configuration) => {
22
22
  /**
23
- *
23
+ * undefined **Required Permissions** none
24
24
  * @param {SendNotificationRequestDto} sendNotificationRequestDto
25
25
  * @param {string} [authorization] Bearer Token
26
26
  * @param {*} [options] Override http request option.
@@ -34,7 +34,7 @@ export declare const NotificationsApiAxiosParamCreator: (configuration?: Configu
34
34
  */
35
35
  export declare const NotificationsApiFp: (configuration?: Configuration) => {
36
36
  /**
37
- *
37
+ * undefined **Required Permissions** none
38
38
  * @param {SendNotificationRequestDto} sendNotificationRequestDto
39
39
  * @param {string} [authorization] Bearer Token
40
40
  * @param {*} [options] Override http request option.
@@ -48,7 +48,7 @@ export declare const NotificationsApiFp: (configuration?: Configuration) => {
48
48
  */
49
49
  export declare const NotificationsApiFactory: (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) => {
50
50
  /**
51
- *
51
+ * undefined **Required Permissions** none
52
52
  * @param {SendNotificationRequestDto} sendNotificationRequestDto
53
53
  * @param {string} [authorization] Bearer Token
54
54
  * @param {*} [options] Override http request option.
@@ -83,7 +83,7 @@ export interface NotificationsApiSendNotificationRequest {
83
83
  */
84
84
  export declare class NotificationsApi extends BaseAPI {
85
85
  /**
86
- *
86
+ * undefined **Required Permissions** none
87
87
  * @param {NotificationsApiSendNotificationRequest} requestParameters Request parameters.
88
88
  * @param {*} [options] Override http request option.
89
89
  * @throws {RequiredError}
@@ -97,7 +97,7 @@ var NotificationsApiAxiosParamCreator = function (configuration) {
97
97
  var _this = this;
98
98
  return {
99
99
  /**
100
- *
100
+ * undefined **Required Permissions** none
101
101
  * @param {SendNotificationRequestDto} sendNotificationRequestDto
102
102
  * @param {string} [authorization] Bearer Token
103
103
  * @param {*} [options] Override http request option.
@@ -155,7 +155,7 @@ var NotificationsApiFp = function (configuration) {
155
155
  var localVarAxiosParamCreator = (0, exports.NotificationsApiAxiosParamCreator)(configuration);
156
156
  return {
157
157
  /**
158
- *
158
+ * undefined **Required Permissions** none
159
159
  * @param {SendNotificationRequestDto} sendNotificationRequestDto
160
160
  * @param {string} [authorization] Bearer Token
161
161
  * @param {*} [options] Override http request option.
@@ -185,7 +185,7 @@ var NotificationsApiFactory = function (configuration, basePath, axios) {
185
185
  var localVarFp = (0, exports.NotificationsApiFp)(configuration);
186
186
  return {
187
187
  /**
188
- *
188
+ * undefined **Required Permissions** none
189
189
  * @param {SendNotificationRequestDto} sendNotificationRequestDto
190
190
  * @param {string} [authorization] Bearer Token
191
191
  * @param {*} [options] Override http request option.
@@ -209,7 +209,7 @@ var NotificationsApi = /** @class */ (function (_super) {
209
209
  return _super !== null && _super.apply(this, arguments) || this;
210
210
  }
211
211
  /**
212
- *
212
+ * undefined **Required Permissions** none
213
213
  * @param {NotificationsApiSendNotificationRequest} requestParameters Request parameters.
214
214
  * @param {*} [options] Override http request option.
215
215
  * @throws {RequiredError}
package/dist/base.d.ts CHANGED
@@ -26,9 +26,18 @@ export interface LoginClass {
26
26
  accessToken: string;
27
27
  permissions: string;
28
28
  }
29
+ export interface SwitchWorkspaceRequest {
30
+ username: string;
31
+ targetWorkspace: string;
32
+ }
33
+ export interface SwitchWorkspaceResponseClass {
34
+ accessToken: string;
35
+ permissions: string;
36
+ }
29
37
  export declare enum Environment {
30
38
  Production = "https://apiv2.emil.de",
31
39
  Test = "https://apiv2-test.emil.de",
40
+ Staging = "https://apiv2-staging.emil.de",
32
41
  Development = "https://apiv2-dev.emil.de",
33
42
  ProductionZurich = "https://eu-central-2.apiv2.emil.de"
34
43
  }
@@ -53,16 +62,15 @@ export declare class BaseAPI {
53
62
  protected configuration: Configuration;
54
63
  private username?;
55
64
  private password?;
56
- private permissions?;
57
65
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
58
- initialize(env?: Environment): Promise<void>;
66
+ initialize(env?: Environment, targetWorkspace?: string): Promise<void>;
59
67
  private loadCredentials;
60
68
  private readConfigFile;
61
69
  private readEnvVariables;
62
70
  selectEnvironment(env: Environment): void;
63
- getPermissions(): Array<string>;
64
- authorize(username: string, password: string): Promise<void>;
65
- refreshTokenInternal(): Promise<LoginClass>;
71
+ authorize(username: string, password: string, targetWorkspace?: string): Promise<void>;
72
+ switchWorkspace(targetWorkspace: string): Promise<void>;
73
+ refreshTokenInternal(): Promise<string>;
66
74
  private extractRefreshToken;
67
75
  getConfiguration(): Configuration;
68
76
  private attachInterceptor;
package/dist/base.js CHANGED
@@ -129,6 +129,7 @@ var Environment;
129
129
  (function (Environment) {
130
130
  Environment["Production"] = "https://apiv2.emil.de";
131
131
  Environment["Test"] = "https://apiv2-test.emil.de";
132
+ Environment["Staging"] = "https://apiv2-staging.emil.de";
132
133
  Environment["Development"] = "https://apiv2-dev.emil.de";
133
134
  Environment["ProductionZurich"] = "https://eu-central-2.apiv2.emil.de";
134
135
  })(Environment = exports.Environment || (exports.Environment = {}));
@@ -161,7 +162,7 @@ var BaseAPI = /** @class */ (function () {
161
162
  }
162
163
  this.attachInterceptor(axios);
163
164
  }
164
- BaseAPI.prototype.initialize = function (env) {
165
+ BaseAPI.prototype.initialize = function (env, targetWorkspace) {
165
166
  if (env === void 0) { env = Environment.Production; }
166
167
  return __awaiter(this, void 0, void 0, function () {
167
168
  return __generator(this, function (_a) {
@@ -172,7 +173,7 @@ var BaseAPI = /** @class */ (function () {
172
173
  case 1:
173
174
  _a.sent();
174
175
  if (!this.username) return [3 /*break*/, 3];
175
- return [4 /*yield*/, this.authorize(this.username, this.password)];
176
+ return [4 /*yield*/, this.authorize(this.username, this.password, targetWorkspace)];
176
177
  case 2:
177
178
  _a.sent();
178
179
  this.password = null; // to avoid keeping password loaded in memory.
@@ -242,14 +243,11 @@ var BaseAPI = /** @class */ (function () {
242
243
  BaseAPI.prototype.selectEnvironment = function (env) {
243
244
  this.configuration.basePath = env;
244
245
  };
245
- BaseAPI.prototype.getPermissions = function () {
246
- return this.permissions.split(',');
247
- };
248
- BaseAPI.prototype.authorize = function (username, password) {
246
+ BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
249
247
  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) {
248
+ var options, response, accessToken, refreshToken;
249
+ return __generator(this, function (_a) {
250
+ switch (_a.label) {
253
251
  case 0:
254
252
  options = {
255
253
  method: 'POST',
@@ -263,13 +261,51 @@ var BaseAPI = /** @class */ (function () {
263
261
  };
264
262
  return [4 /*yield*/, axios_1.default.request(options)];
265
263
  case 1:
266
- response = _b.sent();
267
- _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
264
+ response = _a.sent();
265
+ accessToken = response.data.accessToken;
268
266
  this.configuration.username = username;
269
267
  this.configuration.accessToken = "Bearer ".concat(accessToken);
270
- this.permissions = permissions;
271
268
  refreshToken = this.extractRefreshToken(response);
272
269
  this.configuration.refreshToken = refreshToken;
270
+ if (!targetWorkspace) return [3 /*break*/, 3];
271
+ return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
272
+ case 2:
273
+ _a.sent();
274
+ _a.label = 3;
275
+ case 3: return [2 /*return*/];
276
+ }
277
+ });
278
+ });
279
+ };
280
+ BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
281
+ return __awaiter(this, void 0, void 0, function () {
282
+ var options, response, accessToken, refreshToken;
283
+ return __generator(this, function (_a) {
284
+ switch (_a.label) {
285
+ case 0:
286
+ options = {
287
+ method: 'POST',
288
+ url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
289
+ headers: {
290
+ 'Content-Type': 'application/json',
291
+ 'Authorization': "Bearer ".concat(this.configuration.accessToken),
292
+ 'Cookie': this.configuration.refreshToken,
293
+ },
294
+ data: {
295
+ username: this.configuration.username,
296
+ targetWorkspace: targetWorkspace,
297
+ },
298
+ withCredentials: true,
299
+ };
300
+ return [4 /*yield*/, axios_1.default.request(options)];
301
+ case 1:
302
+ response = _a.sent();
303
+ accessToken = response.data.accessToken;
304
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
305
+ refreshToken = this.extractRefreshToken(response);
306
+ if (refreshToken) {
307
+ this.configuration.refreshToken = refreshToken;
308
+ }
273
309
  return [2 /*return*/];
274
310
  }
275
311
  });
@@ -277,13 +313,13 @@ var BaseAPI = /** @class */ (function () {
277
313
  };
278
314
  BaseAPI.prototype.refreshTokenInternal = function () {
279
315
  return __awaiter(this, void 0, void 0, function () {
280
- var _a, username, refreshToken, options, response;
316
+ var _a, username, refreshToken, options, accessToken;
281
317
  return __generator(this, function (_b) {
282
318
  switch (_b.label) {
283
319
  case 0:
284
320
  _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
285
321
  if (!username || !refreshToken) {
286
- throw new Error('Failed to refresh token.');
322
+ return [2 /*return*/, ''];
287
323
  }
288
324
  options = {
289
325
  method: 'POST',
@@ -297,8 +333,8 @@ var BaseAPI = /** @class */ (function () {
297
333
  };
298
334
  return [4 /*yield*/, axios_1.default.request(options)];
299
335
  case 1:
300
- response = _b.sent();
301
- return [2 /*return*/, response.data];
336
+ accessToken = (_b.sent()).data.accessToken;
337
+ return [2 /*return*/, accessToken];
302
338
  }
303
339
  });
304
340
  });
@@ -318,27 +354,26 @@ var BaseAPI = /** @class */ (function () {
318
354
  axios.interceptors.response.use(function (res) {
319
355
  return res;
320
356
  }, 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) {
357
+ var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
358
+ return __generator(this, function (_a) {
359
+ switch (_a.label) {
324
360
  case 0:
325
361
  originalConfig = err.config;
326
362
  if (!err.response) return [3 /*break*/, 5];
327
363
  if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
328
364
  originalConfig._retry = true;
329
- _c.label = 1;
365
+ _a.label = 1;
330
366
  case 1:
331
- _c.trys.push([1, 3, , 4]);
367
+ _a.trys.push([1, 3, , 4]);
332
368
  return [4 /*yield*/, this.refreshTokenInternal()];
333
369
  case 2:
334
- _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
370
+ tokenString = _a.sent();
335
371
  accessToken = "Bearer ".concat(tokenString);
336
- this.permissions = permissions;
337
- originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
372
+ originalConfig.headers['Authorization'] = accessToken;
338
373
  this.configuration.accessToken = accessToken;
339
374
  return [2 /*return*/, axios.request(originalConfig)];
340
375
  case 3:
341
- _error_1 = _c.sent();
376
+ _error_1 = _a.sent();
342
377
  if (_error_1.response && _error_1.response.data) {
343
378
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
344
379
  }
@@ -354,20 +389,19 @@ var BaseAPI = /** @class */ (function () {
354
389
  && originalConfig.headers.hasOwnProperty('Authorization')
355
390
  && _retry_count < 4)) return [3 /*break*/, 9];
356
391
  _retry_count++;
357
- _c.label = 6;
392
+ _a.label = 6;
358
393
  case 6:
359
- _c.trys.push([6, 8, , 9]);
394
+ _a.trys.push([6, 8, , 9]);
360
395
  return [4 /*yield*/, this.refreshTokenInternal()];
361
396
  case 7:
362
- _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
397
+ tokenString = _a.sent();
363
398
  accessToken = "Bearer ".concat(tokenString);
364
- this.permissions = permissions;
365
399
  _retry = true;
366
400
  originalConfig.headers['Authorization'] = accessToken;
367
401
  this.configuration.accessToken = accessToken;
368
402
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
369
403
  case 8:
370
- _error_2 = _c.sent();
404
+ _error_2 = _a.sent();
371
405
  if (_error_2.response && _error_2.response.data) {
372
406
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
373
407
  }
package/dist/common.js CHANGED
@@ -141,7 +141,7 @@ var setBearerAuthToObject = function (object, configuration) {
141
141
  _b.label = 4;
142
142
  case 4:
143
143
  accessToken = _a;
144
- object["Authorization"] = "Bearer " + accessToken;
144
+ object["Authorization"] = configuration.getBearerToken(accessToken);
145
145
  _b.label = 5;
146
146
  case 5: return [2 /*return*/];
147
147
  }
@@ -171,7 +171,7 @@ var setOAuthToObject = function (object, name, scopes, configuration) {
171
171
  _b.label = 4;
172
172
  case 4:
173
173
  localVarAccessTokenValue = _a;
174
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
174
+ object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
175
175
  _b.label = 5;
176
176
  case 5: return [2 /*return*/];
177
177
  }
@@ -87,4 +87,10 @@ export declare class Configuration {
87
87
  * @return True if the given MIME is JSON, false otherwise.
88
88
  */
89
89
  isJsonMime(mime: string): boolean;
90
+ /**
91
+ * Returns "Bearer" token.
92
+ * @param token - access token.
93
+ * @return Bearer token.
94
+ */
95
+ getBearerToken(token?: string): string;
90
96
  }
@@ -39,6 +39,14 @@ var Configuration = /** @class */ (function () {
39
39
  var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
40
40
  return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
41
41
  };
42
+ /**
43
+ * Returns "Bearer" token.
44
+ * @param token - access token.
45
+ * @return Bearer token.
46
+ */
47
+ Configuration.prototype.getBearerToken = function (token) {
48
+ return ('' + token).startsWith("Bearer") ? token : "Bearer " + token;
49
+ };
42
50
  return Configuration;
43
51
  }());
44
52
  exports.Configuration = Configuration;