@emilgroup/customer-sdk-node 1.4.0 → 1.6.1

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 (65) hide show
  1. package/.openapi-generator/FILES +11 -1
  2. package/README.md +2 -2
  3. package/api/customers-api.ts +353 -0
  4. package/base.ts +56 -13
  5. package/dist/api/customers-api.d.ts +205 -0
  6. package/dist/api/customers-api.js +271 -0
  7. package/dist/base.d.ts +1 -0
  8. package/dist/base.js +46 -8
  9. package/dist/models/account-class.d.ts +133 -0
  10. package/dist/models/{create-account-request-dto.js → account-class.js} +0 -6
  11. package/dist/models/account-policy-class.d.ts +30 -0
  12. package/dist/models/account-policy-class.js +15 -0
  13. package/dist/models/create-customer-request-dto.d.ts +0 -7
  14. package/dist/models/create-customer-response-class.d.ts +3 -2
  15. package/dist/models/customer-class.d.ts +67 -0
  16. package/dist/models/customer-class.js +15 -0
  17. package/dist/models/customer-document-class.d.ts +99 -0
  18. package/dist/models/customer-document-class.js +36 -0
  19. package/dist/models/get-customer-document-download-url-response-class.d.ts +24 -0
  20. package/dist/models/get-customer-document-download-url-response-class.js +15 -0
  21. package/dist/models/get-customer-response-class.d.ts +3 -2
  22. package/dist/models/index.d.ts +11 -1
  23. package/dist/models/index.js +11 -1
  24. package/dist/models/invoice-class.d.ts +135 -0
  25. package/dist/models/invoice-class.js +28 -0
  26. package/dist/models/list-documents-response-class.d.ts +3 -2
  27. package/dist/models/list-invoices-response-class.d.ts +3 -2
  28. package/dist/models/request-policy-update-request-dto.d.ts +3 -2
  29. package/dist/models/reset-password-by-customer-request-dto.d.ts +1 -1
  30. package/dist/models/shared-customer-policy-object-request-dto.d.ts +30 -0
  31. package/dist/models/shared-customer-policy-object-request-dto.js +15 -0
  32. package/dist/models/shared-invoice-item-class.d.ts +102 -0
  33. package/dist/models/shared-invoice-item-class.js +15 -0
  34. package/dist/models/terminate-customer-policy-request-dto.d.ts +24 -0
  35. package/dist/models/terminate-customer-policy-request-dto.js +15 -0
  36. package/dist/models/terminate-customer-policy-response-class.d.ts +25 -0
  37. package/dist/models/terminate-customer-policy-response-class.js +15 -0
  38. package/dist/models/update-account-request-dto.d.ts +10 -10
  39. package/dist/models/update-customer-response-class.d.ts +3 -2
  40. package/dist/models/withdraw-customer-policy-response-class.d.ts +25 -0
  41. package/dist/models/withdraw-customer-policy-response-class.js +15 -0
  42. package/models/account-class.ts +139 -0
  43. package/models/account-policy-class.ts +36 -0
  44. package/models/create-customer-request-dto.ts +0 -7
  45. package/models/create-customer-response-class.ts +3 -2
  46. package/models/customer-class.ts +73 -0
  47. package/models/customer-document-class.ts +108 -0
  48. package/models/get-customer-document-download-url-response-class.ts +30 -0
  49. package/models/get-customer-response-class.ts +3 -2
  50. package/models/index.ts +11 -1
  51. package/models/invoice-class.ts +145 -0
  52. package/models/list-documents-response-class.ts +3 -2
  53. package/models/list-invoices-response-class.ts +3 -2
  54. package/models/request-policy-update-request-dto.ts +3 -2
  55. package/models/reset-password-by-customer-request-dto.ts +1 -1
  56. package/models/shared-customer-policy-object-request-dto.ts +36 -0
  57. package/models/shared-invoice-item-class.ts +108 -0
  58. package/models/terminate-customer-policy-request-dto.ts +30 -0
  59. package/models/terminate-customer-policy-response-class.ts +31 -0
  60. package/models/update-account-request-dto.ts +10 -10
  61. package/models/update-customer-response-class.ts +3 -2
  62. package/models/withdraw-customer-policy-response-class.ts +31 -0
  63. package/package.json +1 -1
  64. package/dist/models/create-account-request-dto.d.ts +0 -102
  65. package/models/create-account-request-dto.ts +0 -111
@@ -208,6 +208,48 @@ var CustomersApiAxiosParamCreator = function (configuration) {
208
208
  });
209
209
  });
210
210
  },
211
+ /**
212
+ * Get a presigned download url for document
213
+ * @summary Get a presigned download url for document
214
+ * @param {string} documentCode The document code
215
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
216
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
217
+ * @param {*} [options] Override http request option.
218
+ * @throws {RequiredError}
219
+ */
220
+ getCustomerDocumentDownloadUrl: function (documentCode, customerCode, authorization, options) {
221
+ if (options === void 0) { options = {}; }
222
+ return __awaiter(_this, void 0, void 0, function () {
223
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
224
+ return __generator(this, function (_a) {
225
+ // verify required parameter 'documentCode' is not null or undefined
226
+ (0, common_1.assertParamExists)('getCustomerDocumentDownloadUrl', 'documentCode', documentCode);
227
+ // verify required parameter 'customerCode' is not null or undefined
228
+ (0, common_1.assertParamExists)('getCustomerDocumentDownloadUrl', 'customerCode', customerCode);
229
+ localVarPath = "/v1/customers/{customerCode}/documents/{documentCode}/download-url"
230
+ .replace("{".concat("documentCode", "}"), encodeURIComponent(String(documentCode)))
231
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
232
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
233
+ if (configuration) {
234
+ baseOptions = configuration.baseOptions;
235
+ baseAccessToken = configuration.accessToken;
236
+ }
237
+ localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
238
+ localVarHeaderParameter = {};
239
+ localVarQueryParameter = {};
240
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
241
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
242
+ }
243
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
244
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
245
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
246
+ return [2 /*return*/, {
247
+ url: (0, common_1.toPathString)(localVarUrlObj),
248
+ options: localVarRequestOptions,
249
+ }];
250
+ });
251
+ });
252
+ },
211
253
  /**
212
254
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
213
255
  * @summary Get policy details
@@ -709,6 +751,53 @@ var CustomersApiAxiosParamCreator = function (configuration) {
709
751
  });
710
752
  });
711
753
  },
754
+ /**
755
+ * Request to terminate an existing policy by customer
756
+ * @summary Terminate a policy by customer
757
+ * @param {string} policyCode The policy code
758
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
759
+ * @param {TerminateCustomerPolicyRequestDto} terminateCustomerPolicyRequestDto
760
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
761
+ * @param {*} [options] Override http request option.
762
+ * @throws {RequiredError}
763
+ */
764
+ terminateCustomerPolicy: function (policyCode, customerCode, terminateCustomerPolicyRequestDto, authorization, options) {
765
+ if (options === void 0) { options = {}; }
766
+ return __awaiter(_this, void 0, void 0, function () {
767
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
768
+ return __generator(this, function (_a) {
769
+ // verify required parameter 'policyCode' is not null or undefined
770
+ (0, common_1.assertParamExists)('terminateCustomerPolicy', 'policyCode', policyCode);
771
+ // verify required parameter 'customerCode' is not null or undefined
772
+ (0, common_1.assertParamExists)('terminateCustomerPolicy', 'customerCode', customerCode);
773
+ // verify required parameter 'terminateCustomerPolicyRequestDto' is not null or undefined
774
+ (0, common_1.assertParamExists)('terminateCustomerPolicy', 'terminateCustomerPolicyRequestDto', terminateCustomerPolicyRequestDto);
775
+ localVarPath = "/v1/customers/{customerCode}/policies/{policyCode}/terminate"
776
+ .replace("{".concat("policyCode", "}"), encodeURIComponent(String(policyCode)))
777
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
778
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
779
+ if (configuration) {
780
+ baseOptions = configuration.baseOptions;
781
+ baseAccessToken = configuration.accessToken;
782
+ }
783
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
784
+ localVarHeaderParameter = {};
785
+ localVarQueryParameter = {};
786
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
787
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
788
+ }
789
+ localVarHeaderParameter['Content-Type'] = 'application/json';
790
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
791
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
792
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
793
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(terminateCustomerPolicyRequestDto, localVarRequestOptions, configuration);
794
+ return [2 /*return*/, {
795
+ url: (0, common_1.toPathString)(localVarUrlObj),
796
+ options: localVarRequestOptions,
797
+ }];
798
+ });
799
+ });
800
+ },
712
801
  /**
713
802
  * Update customer details like phone, email, names, addresses etc
714
803
  * @summary Update customer details
@@ -824,6 +913,48 @@ var CustomersApiAxiosParamCreator = function (configuration) {
824
913
  });
825
914
  });
826
915
  },
916
+ /**
917
+ * Withdraw policy by customer
918
+ * @summary Withdraw policy by customer
919
+ * @param {string} policyCode The policy code
920
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
921
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
922
+ * @param {*} [options] Override http request option.
923
+ * @throws {RequiredError}
924
+ */
925
+ withdrawCustomerPolicy: function (policyCode, customerCode, authorization, options) {
926
+ if (options === void 0) { options = {}; }
927
+ return __awaiter(_this, void 0, void 0, function () {
928
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
929
+ return __generator(this, function (_a) {
930
+ // verify required parameter 'policyCode' is not null or undefined
931
+ (0, common_1.assertParamExists)('withdrawCustomerPolicy', 'policyCode', policyCode);
932
+ // verify required parameter 'customerCode' is not null or undefined
933
+ (0, common_1.assertParamExists)('withdrawCustomerPolicy', 'customerCode', customerCode);
934
+ localVarPath = "/v1/customers/{customerCode}/policies/{policyCode}/withdraw"
935
+ .replace("{".concat("policyCode", "}"), encodeURIComponent(String(policyCode)))
936
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
937
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
938
+ if (configuration) {
939
+ baseOptions = configuration.baseOptions;
940
+ baseAccessToken = configuration.accessToken;
941
+ }
942
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
943
+ localVarHeaderParameter = {};
944
+ localVarQueryParameter = {};
945
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
946
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
947
+ }
948
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
949
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
950
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
951
+ return [2 /*return*/, {
952
+ url: (0, common_1.toPathString)(localVarUrlObj),
953
+ options: localVarRequestOptions,
954
+ }];
955
+ });
956
+ });
957
+ },
827
958
  };
828
959
  };
829
960
  exports.CustomersApiAxiosParamCreator = CustomersApiAxiosParamCreator;
@@ -896,6 +1027,28 @@ var CustomersApiFp = function (configuration) {
896
1027
  });
897
1028
  });
898
1029
  },
1030
+ /**
1031
+ * Get a presigned download url for document
1032
+ * @summary Get a presigned download url for document
1033
+ * @param {string} documentCode The document code
1034
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1035
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1036
+ * @param {*} [options] Override http request option.
1037
+ * @throws {RequiredError}
1038
+ */
1039
+ getCustomerDocumentDownloadUrl: function (documentCode, customerCode, authorization, options) {
1040
+ return __awaiter(this, void 0, void 0, function () {
1041
+ var localVarAxiosArgs;
1042
+ return __generator(this, function (_a) {
1043
+ switch (_a.label) {
1044
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.getCustomerDocumentDownloadUrl(documentCode, customerCode, authorization, options)];
1045
+ case 1:
1046
+ localVarAxiosArgs = _a.sent();
1047
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1048
+ }
1049
+ });
1050
+ });
1051
+ },
899
1052
  /**
900
1053
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
901
1054
  * @summary Get policy details
@@ -1146,6 +1299,29 @@ var CustomersApiFp = function (configuration) {
1146
1299
  });
1147
1300
  });
1148
1301
  },
1302
+ /**
1303
+ * Request to terminate an existing policy by customer
1304
+ * @summary Terminate a policy by customer
1305
+ * @param {string} policyCode The policy code
1306
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1307
+ * @param {TerminateCustomerPolicyRequestDto} terminateCustomerPolicyRequestDto
1308
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1309
+ * @param {*} [options] Override http request option.
1310
+ * @throws {RequiredError}
1311
+ */
1312
+ terminateCustomerPolicy: function (policyCode, customerCode, terminateCustomerPolicyRequestDto, authorization, options) {
1313
+ return __awaiter(this, void 0, void 0, function () {
1314
+ var localVarAxiosArgs;
1315
+ return __generator(this, function (_a) {
1316
+ switch (_a.label) {
1317
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.terminateCustomerPolicy(policyCode, customerCode, terminateCustomerPolicyRequestDto, authorization, options)];
1318
+ case 1:
1319
+ localVarAxiosArgs = _a.sent();
1320
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1321
+ }
1322
+ });
1323
+ });
1324
+ },
1149
1325
  /**
1150
1326
  * Update customer details like phone, email, names, addresses etc
1151
1327
  * @summary Update customer details
@@ -1208,6 +1384,28 @@ var CustomersApiFp = function (configuration) {
1208
1384
  });
1209
1385
  });
1210
1386
  },
1387
+ /**
1388
+ * Withdraw policy by customer
1389
+ * @summary Withdraw policy by customer
1390
+ * @param {string} policyCode The policy code
1391
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1392
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1393
+ * @param {*} [options] Override http request option.
1394
+ * @throws {RequiredError}
1395
+ */
1396
+ withdrawCustomerPolicy: function (policyCode, customerCode, authorization, options) {
1397
+ return __awaiter(this, void 0, void 0, function () {
1398
+ var localVarAxiosArgs;
1399
+ return __generator(this, function (_a) {
1400
+ switch (_a.label) {
1401
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.withdrawCustomerPolicy(policyCode, customerCode, authorization, options)];
1402
+ case 1:
1403
+ localVarAxiosArgs = _a.sent();
1404
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1405
+ }
1406
+ });
1407
+ });
1408
+ },
1211
1409
  };
1212
1410
  };
1213
1411
  exports.CustomersApiFp = CustomersApiFp;
@@ -1250,6 +1448,18 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
1250
1448
  getCustomer: function (customerCode, expand, authorization, options) {
1251
1449
  return localVarFp.getCustomer(customerCode, expand, authorization, options).then(function (request) { return request(axios, basePath); });
1252
1450
  },
1451
+ /**
1452
+ * Get a presigned download url for document
1453
+ * @summary Get a presigned download url for document
1454
+ * @param {string} documentCode The document code
1455
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1456
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1457
+ * @param {*} [options] Override http request option.
1458
+ * @throws {RequiredError}
1459
+ */
1460
+ getCustomerDocumentDownloadUrl: function (documentCode, customerCode, authorization, options) {
1461
+ return localVarFp.getCustomerDocumentDownloadUrl(documentCode, customerCode, authorization, options).then(function (request) { return request(axios, basePath); });
1462
+ },
1253
1463
  /**
1254
1464
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
1255
1465
  * @summary Get policy details
@@ -1390,6 +1600,19 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
1390
1600
  respondToAuthChallenge: function (respondToAuthChallengeRequestDto, options) {
1391
1601
  return localVarFp.respondToAuthChallenge(respondToAuthChallengeRequestDto, options).then(function (request) { return request(axios, basePath); });
1392
1602
  },
1603
+ /**
1604
+ * Request to terminate an existing policy by customer
1605
+ * @summary Terminate a policy by customer
1606
+ * @param {string} policyCode The policy code
1607
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1608
+ * @param {TerminateCustomerPolicyRequestDto} terminateCustomerPolicyRequestDto
1609
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1610
+ * @param {*} [options] Override http request option.
1611
+ * @throws {RequiredError}
1612
+ */
1613
+ terminateCustomerPolicy: function (policyCode, customerCode, terminateCustomerPolicyRequestDto, authorization, options) {
1614
+ return localVarFp.terminateCustomerPolicy(policyCode, customerCode, terminateCustomerPolicyRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1615
+ },
1393
1616
  /**
1394
1617
  * Update customer details like phone, email, names, addresses etc
1395
1618
  * @summary Update customer details
@@ -1422,6 +1645,18 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
1422
1645
  verifyResetPasswordToken: function (resetToken, options) {
1423
1646
  return localVarFp.verifyResetPasswordToken(resetToken, options).then(function (request) { return request(axios, basePath); });
1424
1647
  },
1648
+ /**
1649
+ * Withdraw policy by customer
1650
+ * @summary Withdraw policy by customer
1651
+ * @param {string} policyCode The policy code
1652
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1653
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1654
+ * @param {*} [options] Override http request option.
1655
+ * @throws {RequiredError}
1656
+ */
1657
+ withdrawCustomerPolicy: function (policyCode, customerCode, authorization, options) {
1658
+ return localVarFp.withdrawCustomerPolicy(policyCode, customerCode, authorization, options).then(function (request) { return request(axios, basePath); });
1659
+ },
1425
1660
  };
1426
1661
  };
1427
1662
  exports.CustomersApiFactory = CustomersApiFactory;
@@ -1472,6 +1707,18 @@ var CustomersApi = /** @class */ (function (_super) {
1472
1707
  var _this = this;
1473
1708
  return (0, exports.CustomersApiFp)(this.configuration).getCustomer(requestParameters.customerCode, requestParameters.expand, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1474
1709
  };
1710
+ /**
1711
+ * Get a presigned download url for document
1712
+ * @summary Get a presigned download url for document
1713
+ * @param {CustomersApiGetCustomerDocumentDownloadUrlRequest} requestParameters Request parameters.
1714
+ * @param {*} [options] Override http request option.
1715
+ * @throws {RequiredError}
1716
+ * @memberof CustomersApi
1717
+ */
1718
+ CustomersApi.prototype.getCustomerDocumentDownloadUrl = function (requestParameters, options) {
1719
+ var _this = this;
1720
+ return (0, exports.CustomersApiFp)(this.configuration).getCustomerDocumentDownloadUrl(requestParameters.documentCode, requestParameters.customerCode, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1721
+ };
1475
1722
  /**
1476
1723
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
1477
1724
  * @summary Get policy details
@@ -1604,6 +1851,18 @@ var CustomersApi = /** @class */ (function (_super) {
1604
1851
  var _this = this;
1605
1852
  return (0, exports.CustomersApiFp)(this.configuration).respondToAuthChallenge(requestParameters.respondToAuthChallengeRequestDto, options).then(function (request) { return request(_this.axios, _this.basePath); });
1606
1853
  };
1854
+ /**
1855
+ * Request to terminate an existing policy by customer
1856
+ * @summary Terminate a policy by customer
1857
+ * @param {CustomersApiTerminateCustomerPolicyRequest} requestParameters Request parameters.
1858
+ * @param {*} [options] Override http request option.
1859
+ * @throws {RequiredError}
1860
+ * @memberof CustomersApi
1861
+ */
1862
+ CustomersApi.prototype.terminateCustomerPolicy = function (requestParameters, options) {
1863
+ var _this = this;
1864
+ return (0, exports.CustomersApiFp)(this.configuration).terminateCustomerPolicy(requestParameters.policyCode, requestParameters.customerCode, requestParameters.terminateCustomerPolicyRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1865
+ };
1607
1866
  /**
1608
1867
  * Update customer details like phone, email, names, addresses etc
1609
1868
  * @summary Update customer details
@@ -1640,6 +1899,18 @@ var CustomersApi = /** @class */ (function (_super) {
1640
1899
  var _this = this;
1641
1900
  return (0, exports.CustomersApiFp)(this.configuration).verifyResetPasswordToken(requestParameters.resetToken, options).then(function (request) { return request(_this.axios, _this.basePath); });
1642
1901
  };
1902
+ /**
1903
+ * Withdraw policy by customer
1904
+ * @summary Withdraw policy by customer
1905
+ * @param {CustomersApiWithdrawCustomerPolicyRequest} requestParameters Request parameters.
1906
+ * @param {*} [options] Override http request option.
1907
+ * @throws {RequiredError}
1908
+ * @memberof CustomersApi
1909
+ */
1910
+ CustomersApi.prototype.withdrawCustomerPolicy = function (requestParameters, options) {
1911
+ var _this = this;
1912
+ return (0, exports.CustomersApiFp)(this.configuration).withdrawCustomerPolicy(requestParameters.policyCode, requestParameters.customerCode, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1913
+ };
1643
1914
  return CustomersApi;
1644
1915
  }(base_1.BaseAPI));
1645
1916
  exports.CustomersApi = CustomersApi;
package/dist/base.d.ts CHANGED
@@ -50,6 +50,7 @@ export declare class BaseAPI {
50
50
  protected basePath: string;
51
51
  protected axios: AxiosInstance;
52
52
  protected configuration: Configuration | undefined;
53
+ private lastRequestConfig?;
53
54
  private username?;
54
55
  private password?;
55
56
  private isCustomerToken;
package/dist/base.js CHANGED
@@ -130,6 +130,7 @@ var Environment;
130
130
  Environment["Production"] = "https://apiv2.emil.de";
131
131
  Environment["Test"] = "https://apiv2-test.emil.de";
132
132
  })(Environment = exports.Environment || (exports.Environment = {}));
133
+ var NETWORK_ERROR_MESSAGE = "Network Error";
133
134
  /**
134
135
  *
135
136
  * @export
@@ -254,9 +255,9 @@ var BaseAPI = /** @class */ (function () {
254
255
  case 1:
255
256
  response = _a.sent();
256
257
  accessToken = response.data.accessToken;
257
- refreshToken = this.extractRefreshToken(response);
258
258
  this.configuration.username = username;
259
259
  this.configuration.accessToken = "Bearer ".concat(accessToken);
260
+ refreshToken = this.extractRefreshToken(response);
260
261
  this.configuration.refreshToken = refreshToken;
261
262
  return [2 /*return*/];
262
263
  }
@@ -288,12 +289,12 @@ var BaseAPI = /** @class */ (function () {
288
289
  response = _a.sent();
289
290
  if (response.data.authenticationResult) {
290
291
  accessToken = response.data.authenticationResult.accessToken;
291
- refreshToken = this.extractRefreshToken(response);
292
292
  this.configuration.username = username;
293
293
  this.configuration.tenantSlug = tenantSlug;
294
294
  this.configuration.accessToken = "Bearer ".concat(accessToken);
295
- this.configuration.refreshToken = refreshToken;
296
295
  this.isCustomerToken = true;
296
+ refreshToken = this.extractRefreshToken(response);
297
+ this.configuration.refreshToken = refreshToken;
297
298
  }
298
299
  return [2 /*return*/, response];
299
300
  }
@@ -318,10 +319,10 @@ var BaseAPI = /** @class */ (function () {
318
319
  response = _a.sent();
319
320
  if (response.data.authenticationResult) {
320
321
  accessToken = response.data.authenticationResult.accessToken;
321
- refreshToken = this.extractRefreshToken(response);
322
322
  this.configuration.accessToken = "Bearer ".concat(accessToken);
323
- this.configuration.refreshToken = refreshToken;
324
323
  this.isCustomerToken = true;
324
+ refreshToken = this.extractRefreshToken(response);
325
+ this.configuration.refreshToken = refreshToken;
325
326
  }
326
327
  return [2 /*return*/, response];
327
328
  }
@@ -393,10 +394,17 @@ var BaseAPI = /** @class */ (function () {
393
394
  };
394
395
  BaseAPI.prototype.attachInterceptor = function (axios) {
395
396
  var _this = this;
397
+ axios.interceptors.request.use(function (config) {
398
+ var _a;
399
+ if (((_a = config.url) === null || _a === void 0 ? void 0 : _a.indexOf('refresh-token')) === -1) {
400
+ _this.lastRequestConfig = config;
401
+ }
402
+ return config;
403
+ });
396
404
  axios.interceptors.response.use(function (res) {
397
405
  return res;
398
406
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
399
- var originalConfig, tokenString, accessToken, localVarHeaderParameter, _error_1;
407
+ var originalConfig, tokenString, accessToken, localVarHeaderParameter, _error_1, tokenString, accessToken, localVarHeaderParameter, _error_2;
400
408
  return __generator(this, function (_a) {
401
409
  switch (_a.label) {
402
410
  case 0:
@@ -434,8 +442,38 @@ var BaseAPI = /** @class */ (function () {
434
442
  if (err.response.status === 403 && err.response.data) {
435
443
  return [2 /*return*/, Promise.reject(err.response.data)];
436
444
  }
437
- _a.label = 8;
438
- case 8: return [2 /*return*/, Promise.reject(err)];
445
+ return [3 /*break*/, 15];
446
+ case 8:
447
+ if (!(err.message === NETWORK_ERROR_MESSAGE && !originalConfig._retry)) return [3 /*break*/, 15];
448
+ _a.label = 9;
449
+ case 9:
450
+ _a.trys.push([9, 14, , 15]);
451
+ tokenString = void 0;
452
+ if (!this.isCustomerToken) return [3 /*break*/, 11];
453
+ return [4 /*yield*/, this.refreshTokenCustomer()];
454
+ case 10:
455
+ tokenString = _a.sent();
456
+ return [3 /*break*/, 13];
457
+ case 11: return [4 /*yield*/, this.refreshTokenTenant()];
458
+ case 12:
459
+ tokenString = _a.sent();
460
+ _a.label = 13;
461
+ case 13:
462
+ accessToken = "Bearer ".concat(tokenString);
463
+ localVarHeaderParameter = {};
464
+ localVarHeaderParameter['Authorization'] = accessToken;
465
+ this.lastRequestConfig.headers = __assign(__assign({}, originalConfig.headers), localVarHeaderParameter);
466
+ originalConfig = __assign({}, this.lastRequestConfig);
467
+ originalConfig._retry = true;
468
+ this.configuration.accessToken = accessToken;
469
+ return [2 /*return*/, axios(originalConfig)];
470
+ case 14:
471
+ _error_2 = _a.sent();
472
+ if (_error_2.response && _error_2.response.data) {
473
+ return [2 /*return*/, Promise.reject(_error_2.response.data)];
474
+ }
475
+ return [2 /*return*/, Promise.reject(_error_2)];
476
+ case 15: return [2 /*return*/, Promise.reject(err)];
439
477
  }
440
478
  });
441
479
  }); });
@@ -0,0 +1,133 @@
1
+ /**
2
+ * EMIL CustomerService
3
+ * The EMIL CustomerService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
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 { AccountPolicyClass } from './account-policy-class';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface AccountClass
17
+ */
18
+ export interface AccountClass {
19
+ /**
20
+ * Internal unique identifier for the object. You should not have to use this, use code instead.
21
+ * @type {number}
22
+ * @memberof AccountClass
23
+ */
24
+ 'id': number;
25
+ /**
26
+ * Unique identifier for the object.
27
+ * @type {string}
28
+ * @memberof AccountClass
29
+ */
30
+ 'code': string;
31
+ /**
32
+ * Optional field in order to use a specific account number.
33
+ * @type {string}
34
+ * @memberof AccountClass
35
+ */
36
+ 'accountNumber': string;
37
+ /**
38
+ * The account\'s first name.
39
+ * @type {string}
40
+ * @memberof AccountClass
41
+ */
42
+ 'firstName': string;
43
+ /**
44
+ * The account\'s last name.
45
+ * @type {string}
46
+ * @memberof AccountClass
47
+ */
48
+ 'lastName': string;
49
+ /**
50
+ * The account\'s email address, It is displayed alongside the account in your dashboard and can be useful for searching and tracking.
51
+ * @type {string}
52
+ * @memberof AccountClass
53
+ */
54
+ 'email': string;
55
+ /**
56
+ * The account\'s gender.
57
+ * @type {string}
58
+ * @memberof AccountClass
59
+ */
60
+ 'gender': string;
61
+ /**
62
+ * The account\'s street name.
63
+ * @type {string}
64
+ * @memberof AccountClass
65
+ */
66
+ 'street': string;
67
+ /**
68
+ * The account\'s house number.
69
+ * @type {string}
70
+ * @memberof AccountClass
71
+ */
72
+ 'houseNumber': string;
73
+ /**
74
+ * The account\'s ZIP or postal code
75
+ * @type {string}
76
+ * @memberof AccountClass
77
+ */
78
+ 'zipCode': string;
79
+ /**
80
+ * The account\'s city, district, suburb, town, or village.
81
+ * @type {string}
82
+ * @memberof AccountClass
83
+ */
84
+ 'city': string;
85
+ /**
86
+ * The account\'s date of birth
87
+ * @type {string}
88
+ * @memberof AccountClass
89
+ */
90
+ 'birthDate': string;
91
+ /**
92
+ * The account\'s phone number.
93
+ * @type {string}
94
+ * @memberof AccountClass
95
+ */
96
+ 'phone': string;
97
+ /**
98
+ * The account\'s version.
99
+ * @type {number}
100
+ * @memberof AccountClass
101
+ */
102
+ 'version': number;
103
+ /**
104
+ * Time at which the object was created.
105
+ * @type {string}
106
+ * @memberof AccountClass
107
+ */
108
+ 'createdAt': string;
109
+ /**
110
+ * Time at which the object was updated.
111
+ * @type {string}
112
+ * @memberof AccountClass
113
+ */
114
+ 'updatedAt': string;
115
+ /**
116
+ * Policies linked to the account.
117
+ * @type {Array<AccountPolicyClass>}
118
+ * @memberof AccountClass
119
+ */
120
+ 'policies': Array<AccountPolicyClass>;
121
+ /**
122
+ * Optional field contain extra information
123
+ * @type {object}
124
+ * @memberof AccountClass
125
+ */
126
+ 'metadata': object;
127
+ /**
128
+ * Optional field contain custom fields
129
+ * @type {object}
130
+ * @memberof AccountClass
131
+ */
132
+ 'customFields': object;
133
+ }
@@ -13,9 +13,3 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.CreateAccountRequestDtoGenderEnum = void 0;
17
- exports.CreateAccountRequestDtoGenderEnum = {
18
- Male: 'male',
19
- Female: 'female',
20
- Unspecified: 'unspecified'
21
- };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * EMIL CustomerService
3
+ * The EMIL CustomerService API description
4
+ *
5
+ * The version of the OpenAPI document: 1.0
6
+ *
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
+ /**
13
+ *
14
+ * @export
15
+ * @interface AccountPolicyClass
16
+ */
17
+ export interface AccountPolicyClass {
18
+ /**
19
+ * Unique identifier for a policy.
20
+ * @type {string}
21
+ * @memberof AccountPolicyClass
22
+ */
23
+ 'policyCode': string;
24
+ /**
25
+ * Number used on official documents.
26
+ * @type {string}
27
+ * @memberof AccountPolicyClass
28
+ */
29
+ 'policyNumber': string;
30
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL CustomerService
6
+ * The EMIL CustomerService API description
7
+ *
8
+ * The version of the OpenAPI document: 1.0
9
+ *
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 });