@emilgroup/customer-sdk-node 1.1.1 → 1.4.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 (37) hide show
  1. package/.openapi-generator/FILES +7 -0
  2. package/README.md +22 -5
  3. package/api/customers-api.ts +549 -8
  4. package/base.ts +150 -9
  5. package/dist/api/customers-api.d.ts +324 -8
  6. package/dist/api/customers-api.js +398 -8
  7. package/dist/base.d.ts +12 -3
  8. package/dist/base.js +192 -13
  9. package/dist/models/get-customer-response-class.d.ts +24 -0
  10. package/dist/models/get-customer-response-class.js +15 -0
  11. package/dist/models/index.d.ts +7 -0
  12. package/dist/models/index.js +7 -0
  13. package/dist/models/initiate-auth-response-class.d.ts +4 -4
  14. package/dist/models/list-documents-response-class.d.ts +30 -0
  15. package/dist/models/list-documents-response-class.js +15 -0
  16. package/dist/models/request-policy-update-request-dto.d.ts +42 -0
  17. package/dist/models/request-policy-update-request-dto.js +15 -0
  18. package/dist/models/request-policy-update-response-class.d.ts +25 -0
  19. package/dist/models/request-policy-update-response-class.js +15 -0
  20. package/dist/models/respond-to-auth-challenge-class.d.ts +4 -4
  21. package/dist/models/update-account-request-dto.d.ts +96 -0
  22. package/dist/models/update-account-request-dto.js +21 -0
  23. package/dist/models/update-customer-request-dto.d.ts +31 -0
  24. package/dist/models/update-customer-request-dto.js +15 -0
  25. package/dist/models/update-customer-response-class.d.ts +24 -0
  26. package/dist/models/update-customer-response-class.js +15 -0
  27. package/models/get-customer-response-class.ts +30 -0
  28. package/models/index.ts +7 -0
  29. package/models/initiate-auth-response-class.ts +4 -4
  30. package/models/list-documents-response-class.ts +36 -0
  31. package/models/request-policy-update-request-dto.ts +48 -0
  32. package/models/request-policy-update-response-class.ts +31 -0
  33. package/models/respond-to-auth-challenge-class.ts +4 -4
  34. package/models/update-account-request-dto.ts +105 -0
  35. package/models/update-customer-request-dto.ts +37 -0
  36. package/models/update-customer-response-class.ts +30 -0
  37. package/package.json +4 -3
@@ -166,6 +166,48 @@ var CustomersApiAxiosParamCreator = function (configuration) {
166
166
  });
167
167
  });
168
168
  },
169
+ /**
170
+ * Get customer details
171
+ * @summary Get customer details
172
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
173
+ * @param {string} [expand] Fields to expand response by - [account]
174
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
175
+ * @param {*} [options] Override http request option.
176
+ * @throws {RequiredError}
177
+ */
178
+ getCustomer: function (customerCode, expand, authorization, options) {
179
+ if (options === void 0) { options = {}; }
180
+ return __awaiter(_this, void 0, void 0, function () {
181
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
182
+ return __generator(this, function (_a) {
183
+ // verify required parameter 'customerCode' is not null or undefined
184
+ (0, common_1.assertParamExists)('getCustomer', 'customerCode', customerCode);
185
+ localVarPath = "/v1/customers/{customerCode}"
186
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
187
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
188
+ if (configuration) {
189
+ baseOptions = configuration.baseOptions;
190
+ baseAccessToken = configuration.accessToken;
191
+ }
192
+ localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
193
+ localVarHeaderParameter = {};
194
+ localVarQueryParameter = {};
195
+ if (expand !== undefined) {
196
+ localVarQueryParameter['expand'] = expand;
197
+ }
198
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
199
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
200
+ }
201
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
202
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
203
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
204
+ return [2 /*return*/, {
205
+ url: (0, common_1.toPathString)(localVarUrlObj),
206
+ options: localVarRequestOptions,
207
+ }];
208
+ });
209
+ });
210
+ },
169
211
  /**
170
212
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
171
213
  * @summary Get policy details
@@ -249,7 +291,7 @@ var CustomersApiAxiosParamCreator = function (configuration) {
249
291
  },
250
292
  /**
251
293
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
252
- * @summary Invite by customer
294
+ * @summary Invite a customer by self
253
295
  * @param {InviteByCustomerRequestDto} inviteByCustomerRequestDto
254
296
  * @param {string} [authorization] Bearer Token: provided by the Emil Insurance Suite\'s Auth login endpoint under the name accessToken
255
297
  * @param {*} [options] Override http request option.
@@ -288,7 +330,7 @@ var CustomersApiAxiosParamCreator = function (configuration) {
288
330
  },
289
331
  /**
290
332
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
291
- * @summary Invite by tenant
333
+ * @summary Invite a customer by tenant
292
334
  * @param {InviteByCustomerRequestDto} inviteByCustomerRequestDto
293
335
  * @param {string} [authorization] Bearer Token: provided by the Emil Insurance Suite\'s Auth login endpoint under the name accessToken
294
336
  * @param {*} [options] Override http request option.
@@ -325,6 +367,68 @@ var CustomersApiAxiosParamCreator = function (configuration) {
325
367
  });
326
368
  });
327
369
  },
370
+ /**
371
+ * List all the documents of a customer
372
+ * @summary List documents of a customer
373
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
374
+ * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
375
+ * @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.
376
+ * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
377
+ * @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.
378
+ * @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.
379
+ * @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.
380
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
381
+ * @param {*} [options] Override http request option.
382
+ * @throws {RequiredError}
383
+ */
384
+ listDocuments: function (customerCode, pageSize, pageToken, filter, search, order, expand, authorization, options) {
385
+ if (options === void 0) { options = {}; }
386
+ return __awaiter(_this, void 0, void 0, function () {
387
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
388
+ return __generator(this, function (_a) {
389
+ // verify required parameter 'customerCode' is not null or undefined
390
+ (0, common_1.assertParamExists)('listDocuments', 'customerCode', customerCode);
391
+ localVarPath = "/v1/customers/{customerCode}/documents"
392
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
393
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
394
+ if (configuration) {
395
+ baseOptions = configuration.baseOptions;
396
+ baseAccessToken = configuration.accessToken;
397
+ }
398
+ localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
399
+ localVarHeaderParameter = {};
400
+ localVarQueryParameter = {};
401
+ if (pageSize !== undefined) {
402
+ localVarQueryParameter['pageSize'] = pageSize;
403
+ }
404
+ if (pageToken !== undefined) {
405
+ localVarQueryParameter['pageToken'] = pageToken;
406
+ }
407
+ if (filter !== undefined) {
408
+ localVarQueryParameter['filter'] = filter;
409
+ }
410
+ if (search !== undefined) {
411
+ localVarQueryParameter['search'] = search;
412
+ }
413
+ if (order !== undefined) {
414
+ localVarQueryParameter['order'] = order;
415
+ }
416
+ if (expand !== undefined) {
417
+ localVarQueryParameter['expand'] = expand;
418
+ }
419
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
420
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
421
+ }
422
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
423
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
424
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
425
+ return [2 /*return*/, {
426
+ url: (0, common_1.toPathString)(localVarUrlObj),
427
+ options: localVarRequestOptions,
428
+ }];
429
+ });
430
+ });
431
+ },
328
432
  /**
329
433
  * List all the invoices of a customer
330
434
  * @summary List invoices of a customer
@@ -488,6 +592,53 @@ var CustomersApiAxiosParamCreator = function (configuration) {
488
592
  });
489
593
  });
490
594
  },
595
+ /**
596
+ * Request to update an existing policy by customer
597
+ * @summary Request policy update by customer
598
+ * @param {string} policyCode The policy code
599
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
600
+ * @param {RequestPolicyUpdateRequestDto} requestPolicyUpdateRequestDto
601
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
602
+ * @param {*} [options] Override http request option.
603
+ * @throws {RequiredError}
604
+ */
605
+ requestPolicyUpdate: function (policyCode, customerCode, requestPolicyUpdateRequestDto, authorization, options) {
606
+ if (options === void 0) { options = {}; }
607
+ return __awaiter(_this, void 0, void 0, function () {
608
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
609
+ return __generator(this, function (_a) {
610
+ // verify required parameter 'policyCode' is not null or undefined
611
+ (0, common_1.assertParamExists)('requestPolicyUpdate', 'policyCode', policyCode);
612
+ // verify required parameter 'customerCode' is not null or undefined
613
+ (0, common_1.assertParamExists)('requestPolicyUpdate', 'customerCode', customerCode);
614
+ // verify required parameter 'requestPolicyUpdateRequestDto' is not null or undefined
615
+ (0, common_1.assertParamExists)('requestPolicyUpdate', 'requestPolicyUpdateRequestDto', requestPolicyUpdateRequestDto);
616
+ localVarPath = "/v1/customers/{customerCode}/policies/{policyCode}/request-update"
617
+ .replace("{".concat("policyCode", "}"), encodeURIComponent(String(policyCode)))
618
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
619
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
620
+ if (configuration) {
621
+ baseOptions = configuration.baseOptions;
622
+ baseAccessToken = configuration.accessToken;
623
+ }
624
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
625
+ localVarHeaderParameter = {};
626
+ localVarQueryParameter = {};
627
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
628
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
629
+ }
630
+ localVarHeaderParameter['Content-Type'] = 'application/json';
631
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
632
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
633
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
634
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(requestPolicyUpdateRequestDto, localVarRequestOptions, configuration);
635
+ return [2 /*return*/, {
636
+ url: (0, common_1.toPathString)(localVarUrlObj),
637
+ options: localVarRequestOptions,
638
+ }];
639
+ });
640
+ });
641
+ },
491
642
  /**
492
643
  * Change customer\'s password using the token provided by the reset password endpoint.
493
644
  * @summary Change password by customer
@@ -558,6 +709,49 @@ var CustomersApiAxiosParamCreator = function (configuration) {
558
709
  });
559
710
  });
560
711
  },
712
+ /**
713
+ * Update customer details like phone, email, names, addresses etc
714
+ * @summary Update customer details
715
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
716
+ * @param {UpdateCustomerRequestDto} updateCustomerRequestDto
717
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
718
+ * @param {*} [options] Override http request option.
719
+ * @throws {RequiredError}
720
+ */
721
+ updateCustomer: function (customerCode, updateCustomerRequestDto, authorization, options) {
722
+ if (options === void 0) { options = {}; }
723
+ return __awaiter(_this, void 0, void 0, function () {
724
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
725
+ return __generator(this, function (_a) {
726
+ // verify required parameter 'customerCode' is not null or undefined
727
+ (0, common_1.assertParamExists)('updateCustomer', 'customerCode', customerCode);
728
+ // verify required parameter 'updateCustomerRequestDto' is not null or undefined
729
+ (0, common_1.assertParamExists)('updateCustomer', 'updateCustomerRequestDto', updateCustomerRequestDto);
730
+ localVarPath = "/v1/customers/{customerCode}"
731
+ .replace("{".concat("customerCode", "}"), encodeURIComponent(String(customerCode)));
732
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
733
+ if (configuration) {
734
+ baseOptions = configuration.baseOptions;
735
+ baseAccessToken = configuration.accessToken;
736
+ }
737
+ localVarRequestOptions = __assign(__assign({ method: 'PUT' }, baseOptions), options);
738
+ localVarHeaderParameter = {};
739
+ localVarQueryParameter = {};
740
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
741
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
742
+ }
743
+ localVarHeaderParameter['Content-Type'] = 'application/json';
744
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
745
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
746
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
747
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(updateCustomerRequestDto, localVarRequestOptions, configuration);
748
+ return [2 /*return*/, {
749
+ url: (0, common_1.toPathString)(localVarUrlObj),
750
+ options: localVarRequestOptions,
751
+ }];
752
+ });
753
+ });
754
+ },
561
755
  /**
562
756
  * Verify the invite sent to the customer via email.
563
757
  * @summary Verify customer\'s invite token
@@ -680,6 +874,28 @@ var CustomersApiFp = function (configuration) {
680
874
  });
681
875
  });
682
876
  },
877
+ /**
878
+ * Get customer details
879
+ * @summary Get customer details
880
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
881
+ * @param {string} [expand] Fields to expand response by - [account]
882
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
883
+ * @param {*} [options] Override http request option.
884
+ * @throws {RequiredError}
885
+ */
886
+ getCustomer: function (customerCode, expand, authorization, options) {
887
+ return __awaiter(this, void 0, void 0, function () {
888
+ var localVarAxiosArgs;
889
+ return __generator(this, function (_a) {
890
+ switch (_a.label) {
891
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.getCustomer(customerCode, expand, authorization, options)];
892
+ case 1:
893
+ localVarAxiosArgs = _a.sent();
894
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
895
+ }
896
+ });
897
+ });
898
+ },
683
899
  /**
684
900
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
685
901
  * @summary Get policy details
@@ -725,7 +941,7 @@ var CustomersApiFp = function (configuration) {
725
941
  },
726
942
  /**
727
943
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
728
- * @summary Invite by customer
944
+ * @summary Invite a customer by self
729
945
  * @param {InviteByCustomerRequestDto} inviteByCustomerRequestDto
730
946
  * @param {string} [authorization] Bearer Token: provided by the Emil Insurance Suite\'s Auth login endpoint under the name accessToken
731
947
  * @param {*} [options] Override http request option.
@@ -746,7 +962,7 @@ var CustomersApiFp = function (configuration) {
746
962
  },
747
963
  /**
748
964
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
749
- * @summary Invite by tenant
965
+ * @summary Invite a customer by tenant
750
966
  * @param {InviteByCustomerRequestDto} inviteByCustomerRequestDto
751
967
  * @param {string} [authorization] Bearer Token: provided by the Emil Insurance Suite\'s Auth login endpoint under the name accessToken
752
968
  * @param {*} [options] Override http request option.
@@ -765,6 +981,33 @@ var CustomersApiFp = function (configuration) {
765
981
  });
766
982
  });
767
983
  },
984
+ /**
985
+ * List all the documents of a customer
986
+ * @summary List documents of a customer
987
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
988
+ * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
989
+ * @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.
990
+ * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
991
+ * @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.
992
+ * @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.
993
+ * @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.
994
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
995
+ * @param {*} [options] Override http request option.
996
+ * @throws {RequiredError}
997
+ */
998
+ listDocuments: function (customerCode, pageSize, pageToken, filter, search, order, expand, authorization, options) {
999
+ return __awaiter(this, void 0, void 0, function () {
1000
+ var localVarAxiosArgs;
1001
+ return __generator(this, function (_a) {
1002
+ switch (_a.label) {
1003
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.listDocuments(customerCode, pageSize, pageToken, filter, search, order, expand, authorization, options)];
1004
+ case 1:
1005
+ localVarAxiosArgs = _a.sent();
1006
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1007
+ }
1008
+ });
1009
+ });
1010
+ },
768
1011
  /**
769
1012
  * List all the invoices of a customer
770
1013
  * @summary List invoices of a customer
@@ -840,6 +1083,29 @@ var CustomersApiFp = function (configuration) {
840
1083
  });
841
1084
  });
842
1085
  },
1086
+ /**
1087
+ * Request to update an existing policy by customer
1088
+ * @summary Request policy update by customer
1089
+ * @param {string} policyCode The policy code
1090
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1091
+ * @param {RequestPolicyUpdateRequestDto} requestPolicyUpdateRequestDto
1092
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1093
+ * @param {*} [options] Override http request option.
1094
+ * @throws {RequiredError}
1095
+ */
1096
+ requestPolicyUpdate: function (policyCode, customerCode, requestPolicyUpdateRequestDto, authorization, options) {
1097
+ return __awaiter(this, void 0, void 0, function () {
1098
+ var localVarAxiosArgs;
1099
+ return __generator(this, function (_a) {
1100
+ switch (_a.label) {
1101
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.requestPolicyUpdate(policyCode, customerCode, requestPolicyUpdateRequestDto, authorization, options)];
1102
+ case 1:
1103
+ localVarAxiosArgs = _a.sent();
1104
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1105
+ }
1106
+ });
1107
+ });
1108
+ },
843
1109
  /**
844
1110
  * Change customer\'s password using the token provided by the reset password endpoint.
845
1111
  * @summary Change password by customer
@@ -880,6 +1146,28 @@ var CustomersApiFp = function (configuration) {
880
1146
  });
881
1147
  });
882
1148
  },
1149
+ /**
1150
+ * Update customer details like phone, email, names, addresses etc
1151
+ * @summary Update customer details
1152
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1153
+ * @param {UpdateCustomerRequestDto} updateCustomerRequestDto
1154
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1155
+ * @param {*} [options] Override http request option.
1156
+ * @throws {RequiredError}
1157
+ */
1158
+ updateCustomer: function (customerCode, updateCustomerRequestDto, authorization, options) {
1159
+ return __awaiter(this, void 0, void 0, function () {
1160
+ var localVarAxiosArgs;
1161
+ return __generator(this, function (_a) {
1162
+ switch (_a.label) {
1163
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.updateCustomer(customerCode, updateCustomerRequestDto, authorization, options)];
1164
+ case 1:
1165
+ localVarAxiosArgs = _a.sent();
1166
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1167
+ }
1168
+ });
1169
+ });
1170
+ },
883
1171
  /**
884
1172
  * Verify the invite sent to the customer via email.
885
1173
  * @summary Verify customer\'s invite token
@@ -950,6 +1238,18 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
950
1238
  forgotPassword: function (forgotPasswordRequestDto, options) {
951
1239
  return localVarFp.forgotPassword(forgotPasswordRequestDto, options).then(function (request) { return request(axios, basePath); });
952
1240
  },
1241
+ /**
1242
+ * Get customer details
1243
+ * @summary Get customer details
1244
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1245
+ * @param {string} [expand] Fields to expand response by - [account]
1246
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1247
+ * @param {*} [options] Override http request option.
1248
+ * @throws {RequiredError}
1249
+ */
1250
+ getCustomer: function (customerCode, expand, authorization, options) {
1251
+ return localVarFp.getCustomer(customerCode, expand, authorization, options).then(function (request) { return request(axios, basePath); });
1252
+ },
953
1253
  /**
954
1254
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
955
1255
  * @summary Get policy details
@@ -975,7 +1275,7 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
975
1275
  },
976
1276
  /**
977
1277
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
978
- * @summary Invite by customer
1278
+ * @summary Invite a customer by self
979
1279
  * @param {InviteByCustomerRequestDto} inviteByCustomerRequestDto
980
1280
  * @param {string} [authorization] Bearer Token: provided by the Emil Insurance Suite\'s Auth login endpoint under the name accessToken
981
1281
  * @param {*} [options] Override http request option.
@@ -986,7 +1286,7 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
986
1286
  },
987
1287
  /**
988
1288
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
989
- * @summary Invite by tenant
1289
+ * @summary Invite a customer by tenant
990
1290
  * @param {InviteByCustomerRequestDto} inviteByCustomerRequestDto
991
1291
  * @param {string} [authorization] Bearer Token: provided by the Emil Insurance Suite\'s Auth login endpoint under the name accessToken
992
1292
  * @param {*} [options] Override http request option.
@@ -995,6 +1295,23 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
995
1295
  inviteByTenant: function (inviteByCustomerRequestDto, authorization, options) {
996
1296
  return localVarFp.inviteByTenant(inviteByCustomerRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
997
1297
  },
1298
+ /**
1299
+ * List all the documents of a customer
1300
+ * @summary List documents of a customer
1301
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1302
+ * @param {any} [pageSize] A limit on the number of objects to be returned. Limit ranges between 1 and 100. Default: 10.
1303
+ * @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.
1304
+ * @param {any} [filter] Filter the response by one or multiple fields. In general, fetching filtered responses will conserve bandwidth and reduce response time.
1305
+ * @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.
1306
+ * @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.
1307
+ * @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.
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
+ listDocuments: function (customerCode, pageSize, pageToken, filter, search, order, expand, authorization, options) {
1313
+ return localVarFp.listDocuments(customerCode, pageSize, pageToken, filter, search, order, expand, authorization, options).then(function (request) { return request(axios, basePath); });
1314
+ },
998
1315
  /**
999
1316
  * List all the invoices of a customer
1000
1317
  * @summary List invoices of a customer
@@ -1040,6 +1357,19 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
1040
1357
  refreshToken: function (refreshTokenDto, cookie, options) {
1041
1358
  return localVarFp.refreshToken(refreshTokenDto, cookie, options).then(function (request) { return request(axios, basePath); });
1042
1359
  },
1360
+ /**
1361
+ * Request to update an existing policy by customer
1362
+ * @summary Request policy update by customer
1363
+ * @param {string} policyCode The policy code
1364
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1365
+ * @param {RequestPolicyUpdateRequestDto} requestPolicyUpdateRequestDto
1366
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1367
+ * @param {*} [options] Override http request option.
1368
+ * @throws {RequiredError}
1369
+ */
1370
+ requestPolicyUpdate: function (policyCode, customerCode, requestPolicyUpdateRequestDto, authorization, options) {
1371
+ return localVarFp.requestPolicyUpdate(policyCode, customerCode, requestPolicyUpdateRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1372
+ },
1043
1373
  /**
1044
1374
  * Change customer\'s password using the token provided by the reset password endpoint.
1045
1375
  * @summary Change password by customer
@@ -1060,6 +1390,18 @@ var CustomersApiFactory = function (configuration, basePath, axios) {
1060
1390
  respondToAuthChallenge: function (respondToAuthChallengeRequestDto, options) {
1061
1391
  return localVarFp.respondToAuthChallenge(respondToAuthChallengeRequestDto, options).then(function (request) { return request(axios, basePath); });
1062
1392
  },
1393
+ /**
1394
+ * Update customer details like phone, email, names, addresses etc
1395
+ * @summary Update customer details
1396
+ * @param {string} customerCode The customer code or \"me\" for the currently logged in customer
1397
+ * @param {UpdateCustomerRequestDto} updateCustomerRequestDto
1398
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1399
+ * @param {*} [options] Override http request option.
1400
+ * @throws {RequiredError}
1401
+ */
1402
+ updateCustomer: function (customerCode, updateCustomerRequestDto, authorization, options) {
1403
+ return localVarFp.updateCustomer(customerCode, updateCustomerRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1404
+ },
1063
1405
  /**
1064
1406
  * Verify the invite sent to the customer via email.
1065
1407
  * @summary Verify customer\'s invite token
@@ -1118,6 +1460,18 @@ var CustomersApi = /** @class */ (function (_super) {
1118
1460
  var _this = this;
1119
1461
  return (0, exports.CustomersApiFp)(this.configuration).forgotPassword(requestParameters.forgotPasswordRequestDto, options).then(function (request) { return request(_this.axios, _this.basePath); });
1120
1462
  };
1463
+ /**
1464
+ * Get customer details
1465
+ * @summary Get customer details
1466
+ * @param {CustomersApiGetCustomerRequest} requestParameters Request parameters.
1467
+ * @param {*} [options] Override http request option.
1468
+ * @throws {RequiredError}
1469
+ * @memberof CustomersApi
1470
+ */
1471
+ CustomersApi.prototype.getCustomer = function (requestParameters, options) {
1472
+ var _this = this;
1473
+ return (0, exports.CustomersApiFp)(this.configuration).getCustomer(requestParameters.customerCode, requestParameters.expand, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1474
+ };
1121
1475
  /**
1122
1476
  * Get detailed policy that belongs to a customer; the details can be expanded using expand query parameter.
1123
1477
  * @summary Get policy details
@@ -1144,7 +1498,7 @@ var CustomersApi = /** @class */ (function (_super) {
1144
1498
  };
1145
1499
  /**
1146
1500
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
1147
- * @summary Invite by customer
1501
+ * @summary Invite a customer by self
1148
1502
  * @param {CustomersApiInviteByCustomerRequest} requestParameters Request parameters.
1149
1503
  * @param {*} [options] Override http request option.
1150
1504
  * @throws {RequiredError}
@@ -1156,7 +1510,7 @@ var CustomersApi = /** @class */ (function (_super) {
1156
1510
  };
1157
1511
  /**
1158
1512
  * Send a customer an invite via email to register. An account should have been created before inviting the customer. To invite users without accounts and policies is not yet supported.
1159
- * @summary Invite by tenant
1513
+ * @summary Invite a customer by tenant
1160
1514
  * @param {CustomersApiInviteByTenantRequest} requestParameters Request parameters.
1161
1515
  * @param {*} [options] Override http request option.
1162
1516
  * @throws {RequiredError}
@@ -1166,6 +1520,18 @@ var CustomersApi = /** @class */ (function (_super) {
1166
1520
  var _this = this;
1167
1521
  return (0, exports.CustomersApiFp)(this.configuration).inviteByTenant(requestParameters.inviteByCustomerRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1168
1522
  };
1523
+ /**
1524
+ * List all the documents of a customer
1525
+ * @summary List documents of a customer
1526
+ * @param {CustomersApiListDocumentsRequest} requestParameters Request parameters.
1527
+ * @param {*} [options] Override http request option.
1528
+ * @throws {RequiredError}
1529
+ * @memberof CustomersApi
1530
+ */
1531
+ CustomersApi.prototype.listDocuments = function (requestParameters, options) {
1532
+ var _this = this;
1533
+ return (0, exports.CustomersApiFp)(this.configuration).listDocuments(requestParameters.customerCode, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1534
+ };
1169
1535
  /**
1170
1536
  * List all the invoices of a customer
1171
1537
  * @summary List invoices of a customer
@@ -1202,6 +1568,18 @@ var CustomersApi = /** @class */ (function (_super) {
1202
1568
  var _this = this;
1203
1569
  return (0, exports.CustomersApiFp)(this.configuration).refreshToken(requestParameters.refreshTokenDto, requestParameters.cookie, options).then(function (request) { return request(_this.axios, _this.basePath); });
1204
1570
  };
1571
+ /**
1572
+ * Request to update an existing policy by customer
1573
+ * @summary Request policy update by customer
1574
+ * @param {CustomersApiRequestPolicyUpdateRequest} requestParameters Request parameters.
1575
+ * @param {*} [options] Override http request option.
1576
+ * @throws {RequiredError}
1577
+ * @memberof CustomersApi
1578
+ */
1579
+ CustomersApi.prototype.requestPolicyUpdate = function (requestParameters, options) {
1580
+ var _this = this;
1581
+ return (0, exports.CustomersApiFp)(this.configuration).requestPolicyUpdate(requestParameters.policyCode, requestParameters.customerCode, requestParameters.requestPolicyUpdateRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1582
+ };
1205
1583
  /**
1206
1584
  * Change customer\'s password using the token provided by the reset password endpoint.
1207
1585
  * @summary Change password by customer
@@ -1226,6 +1604,18 @@ var CustomersApi = /** @class */ (function (_super) {
1226
1604
  var _this = this;
1227
1605
  return (0, exports.CustomersApiFp)(this.configuration).respondToAuthChallenge(requestParameters.respondToAuthChallengeRequestDto, options).then(function (request) { return request(_this.axios, _this.basePath); });
1228
1606
  };
1607
+ /**
1608
+ * Update customer details like phone, email, names, addresses etc
1609
+ * @summary Update customer details
1610
+ * @param {CustomersApiUpdateCustomerRequest} requestParameters Request parameters.
1611
+ * @param {*} [options] Override http request option.
1612
+ * @throws {RequiredError}
1613
+ * @memberof CustomersApi
1614
+ */
1615
+ CustomersApi.prototype.updateCustomer = function (requestParameters, options) {
1616
+ var _this = this;
1617
+ return (0, exports.CustomersApiFp)(this.configuration).updateCustomer(requestParameters.customerCode, requestParameters.updateCustomerRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1618
+ };
1229
1619
  /**
1230
1620
  * Verify the invite sent to the customer via email.
1231
1621
  * @summary Verify customer\'s invite token
package/dist/base.d.ts CHANGED
@@ -10,7 +10,8 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import { Configuration } from "./configuration";
13
- import { AxiosInstance, AxiosRequestConfig } from 'axios';
13
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
14
+ import { InitiateAuthResponseClass, RespondToAuthChallengeClass, RespondToAuthChallengeRequestDto } from "./models";
14
15
  export declare const BASE_PATH: string;
15
16
  /**
16
17
  *
@@ -51,10 +52,18 @@ export declare class BaseAPI {
51
52
  protected configuration: Configuration | undefined;
52
53
  private username?;
53
54
  private password?;
55
+ private isCustomerToken;
54
56
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
57
+ initialize(env?: Environment): Promise<void>;
58
+ private loadCredentials;
59
+ private readConfigFile;
60
+ private readEnvVariables;
55
61
  selectEnvironment(env: Environment): void;
56
- authorize(username: string, password: string, tenantSlug: string): Promise<void>;
57
- refreshTokenInternal(): Promise<string>;
62
+ authorize(username: string, password: string): Promise<void>;
63
+ initiateAuthorization(username: string, password: string, tenantSlug: string): Promise<AxiosResponse<InitiateAuthResponseClass>>;
64
+ respondToAuthorizationChallenge(respondToAuthChallengeRequestDto: RespondToAuthChallengeRequestDto): Promise<AxiosResponse<RespondToAuthChallengeClass>>;
65
+ refreshTokenTenant(): Promise<string>;
66
+ refreshTokenCustomer(): Promise<string>;
58
67
  private extractRefreshToken;
59
68
  private attachInterceptor;
60
69
  }