@emilgroup/insurance-sdk-node 1.76.1-beta.9 → 1.78.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 (33) hide show
  1. package/.openapi-generator/FILES +3 -0
  2. package/README.md +2 -2
  3. package/api/policies-api.ts +120 -0
  4. package/base.ts +45 -3
  5. package/dist/api/policies-api.d.ts +66 -0
  6. package/dist/api/policies-api.js +99 -0
  7. package/dist/base.d.ts +11 -2
  8. package/dist/base.js +42 -3
  9. package/dist/models/create-product-field-request-dto.d.ts +22 -0
  10. package/dist/models/create-product-field-request-dto.js +9 -1
  11. package/dist/models/create-product-version-request-dto.d.ts +30 -0
  12. package/dist/models/create-product-version-request-dto.js +15 -0
  13. package/dist/models/index.d.ts +3 -0
  14. package/dist/models/index.js +3 -0
  15. package/dist/models/product-field-class.d.ts +34 -0
  16. package/dist/models/product-field-class.js +9 -0
  17. package/dist/models/restore-policy-version-request-dto.d.ts +30 -0
  18. package/dist/models/restore-policy-version-request-dto.js +15 -0
  19. package/dist/models/restore-policy-version-response-class.d.ts +25 -0
  20. package/dist/models/restore-policy-version-response-class.js +15 -0
  21. package/dist/models/shared-product-field-class.d.ts +34 -0
  22. package/dist/models/shared-product-field-class.js +9 -0
  23. package/dist/models/update-product-field-request-dto.d.ts +22 -0
  24. package/dist/models/update-product-field-request-dto.js +9 -1
  25. package/models/create-product-field-request-dto.ts +24 -0
  26. package/models/create-product-version-request-dto.ts +36 -0
  27. package/models/index.ts +3 -0
  28. package/models/product-field-class.ts +38 -0
  29. package/models/restore-policy-version-request-dto.ts +36 -0
  30. package/models/restore-policy-version-response-class.ts +31 -0
  31. package/models/shared-product-field-class.ts +38 -0
  32. package/models/update-product-field-request-dto.ts +24 -0
  33. package/package.json +1 -1
@@ -87,6 +87,7 @@ models/create-product-field-request-dto.ts
87
87
  models/create-product-field-response-class.ts
88
88
  models/create-product-request-dto.ts
89
89
  models/create-product-response-class.ts
90
+ models/create-product-version-request-dto.ts
90
91
  models/create-status-transition-rule-request-dto.ts
91
92
  models/create-status-transition-rule-response-class.ts
92
93
  models/csv-product-factor-dto.ts
@@ -208,6 +209,8 @@ models/product-field-class.ts
208
209
  models/product-field-type-class.ts
209
210
  models/product-version-class.ts
210
211
  models/rest-clone-lead-account-request-dto.ts
212
+ models/restore-policy-version-request-dto.ts
213
+ models/restore-policy-version-response-class.ts
211
214
  models/sepa-dto.ts
212
215
  models/shared-create-lead-policy-request-dto.ts
213
216
  models/shared-invoice-class.ts
package/README.md CHANGED
@@ -17,11 +17,11 @@ Although this package can be used in both TypeScript and JavaScript, it is inten
17
17
  Navigate to the folder of your consuming project and run one of the following commands:
18
18
 
19
19
  ```
20
- npm install @emilgroup/insurance-sdk-node@1.76.1-beta.9 --save
20
+ npm install @emilgroup/insurance-sdk-node@1.78.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/insurance-sdk-node@1.76.1-beta.9
24
+ yarn add @emilgroup/insurance-sdk-node@1.78.0
25
25
  ```
26
26
 
27
27
  And then you can import `PoliciesApi`.
@@ -47,6 +47,10 @@ import { PatchPolicyRequestDto } from '../models';
47
47
  // @ts-ignore
48
48
  import { PatchPolicyResponseClass } from '../models';
49
49
  // @ts-ignore
50
+ import { RestorePolicyVersionRequestDto } from '../models';
51
+ // @ts-ignore
52
+ import { RestorePolicyVersionResponseClass } from '../models';
53
+ // @ts-ignore
50
54
  import { SuspendPolicyRequestDto } from '../models';
51
55
  // @ts-ignore
52
56
  import { SuspendPolicyResponseClass } from '../models';
@@ -753,6 +757,57 @@ export const PoliciesApiAxiosParamCreator = function (configuration?: Configurat
753
757
  options: localVarRequestOptions,
754
758
  };
755
759
  },
760
+ /**
761
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
762
+ * @summary Restore a policy version by versionId
763
+ * @param {string} policyCode The policy code.
764
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
765
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
766
+ * @param {*} [options] Override http request option.
767
+ * @throws {RequiredError}
768
+ */
769
+ restorePolicyVersion: async (policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
770
+ // verify required parameter 'policyCode' is not null or undefined
771
+ assertParamExists('restorePolicyVersion', 'policyCode', policyCode)
772
+ // verify required parameter 'restorePolicyVersionRequestDto' is not null or undefined
773
+ assertParamExists('restorePolicyVersion', 'restorePolicyVersionRequestDto', restorePolicyVersionRequestDto)
774
+ const localVarPath = `/insuranceservice/v1/policies/{policyCode}/restore-policy-version`
775
+ .replace(`{${"policyCode"}}`, encodeURIComponent(String(policyCode)));
776
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
777
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
778
+ let baseOptions;
779
+ let baseAccessToken;
780
+ if (configuration) {
781
+ baseOptions = configuration.baseOptions;
782
+ baseAccessToken = configuration.accessToken;
783
+ }
784
+
785
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
786
+ const localVarHeaderParameter = {} as any;
787
+ const localVarQueryParameter = {} as any;
788
+
789
+ // authentication bearer required
790
+ // http bearer authentication required
791
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
792
+
793
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
794
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
795
+ }
796
+
797
+
798
+
799
+ localVarHeaderParameter['Content-Type'] = 'application/json';
800
+
801
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
802
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
803
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
804
+ localVarRequestOptions.data = serializeDataIfNeeded(restorePolicyVersionRequestDto, localVarRequestOptions, configuration)
805
+
806
+ return {
807
+ url: toPathString(localVarUrlObj),
808
+ options: localVarRequestOptions,
809
+ };
810
+ },
756
811
  /**
757
812
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
758
813
  * @summary Suspend a policy by tenant
@@ -1138,6 +1193,19 @@ export const PoliciesApiFp = function(configuration?: Configuration) {
1138
1193
  const localVarAxiosArgs = await localVarAxiosParamCreator.patchPolicy(code, patchPolicyRequestDto, authorization, options);
1139
1194
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1140
1195
  },
1196
+ /**
1197
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1198
+ * @summary Restore a policy version by versionId
1199
+ * @param {string} policyCode The policy code.
1200
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1201
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1202
+ * @param {*} [options] Override http request option.
1203
+ * @throws {RequiredError}
1204
+ */
1205
+ async restorePolicyVersion(policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RestorePolicyVersionResponseClass>> {
1206
+ const localVarAxiosArgs = await localVarAxiosParamCreator.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options);
1207
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1208
+ },
1141
1209
  /**
1142
1210
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1143
1211
  * @summary Suspend a policy by tenant
@@ -1359,6 +1427,18 @@ export const PoliciesApiFactory = function (configuration?: Configuration, baseP
1359
1427
  patchPolicy(code: string, patchPolicyRequestDto: PatchPolicyRequestDto, authorization?: string, options?: any): AxiosPromise<PatchPolicyResponseClass> {
1360
1428
  return localVarFp.patchPolicy(code, patchPolicyRequestDto, authorization, options).then((request) => request(axios, basePath));
1361
1429
  },
1430
+ /**
1431
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1432
+ * @summary Restore a policy version by versionId
1433
+ * @param {string} policyCode The policy code.
1434
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1435
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1436
+ * @param {*} [options] Override http request option.
1437
+ * @throws {RequiredError}
1438
+ */
1439
+ restorePolicyVersion(policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: any): AxiosPromise<RestorePolicyVersionResponseClass> {
1440
+ return localVarFp.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options).then((request) => request(axios, basePath));
1441
+ },
1362
1442
  /**
1363
1443
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1364
1444
  * @summary Suspend a policy by tenant
@@ -1851,6 +1931,34 @@ export interface PoliciesApiPatchPolicyRequest {
1851
1931
  readonly authorization?: string
1852
1932
  }
1853
1933
 
1934
+ /**
1935
+ * Request parameters for restorePolicyVersion operation in PoliciesApi.
1936
+ * @export
1937
+ * @interface PoliciesApiRestorePolicyVersionRequest
1938
+ */
1939
+ export interface PoliciesApiRestorePolicyVersionRequest {
1940
+ /**
1941
+ * The policy code.
1942
+ * @type {string}
1943
+ * @memberof PoliciesApiRestorePolicyVersion
1944
+ */
1945
+ readonly policyCode: string
1946
+
1947
+ /**
1948
+ *
1949
+ * @type {RestorePolicyVersionRequestDto}
1950
+ * @memberof PoliciesApiRestorePolicyVersion
1951
+ */
1952
+ readonly restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto
1953
+
1954
+ /**
1955
+ * Bearer Token: provided by the login endpoint under the name accessToken.
1956
+ * @type {string}
1957
+ * @memberof PoliciesApiRestorePolicyVersion
1958
+ */
1959
+ readonly authorization?: string
1960
+ }
1961
+
1854
1962
  /**
1855
1963
  * Request parameters for suspendPolicy operation in PoliciesApi.
1856
1964
  * @export
@@ -2114,6 +2222,18 @@ export class PoliciesApi extends BaseAPI {
2114
2222
  return PoliciesApiFp(this.configuration).patchPolicy(requestParameters.code, requestParameters.patchPolicyRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
2115
2223
  }
2116
2224
 
2225
+ /**
2226
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
2227
+ * @summary Restore a policy version by versionId
2228
+ * @param {PoliciesApiRestorePolicyVersionRequest} requestParameters Request parameters.
2229
+ * @param {*} [options] Override http request option.
2230
+ * @throws {RequiredError}
2231
+ * @memberof PoliciesApi
2232
+ */
2233
+ public restorePolicyVersion(requestParameters: PoliciesApiRestorePolicyVersionRequest, options?: AxiosRequestConfig) {
2234
+ return PoliciesApiFp(this.configuration).restorePolicyVersion(requestParameters.policyCode, requestParameters.restorePolicyVersionRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
2235
+ }
2236
+
2117
2237
  /**
2118
2238
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
2119
2239
  * @summary Suspend a policy by tenant
package/base.ts CHANGED
@@ -44,6 +44,16 @@ export interface LoginClass {
44
44
  permissions: string;
45
45
  }
46
46
 
47
+ export interface SwitchWorkspaceRequest {
48
+ username: string;
49
+ targetWorkspace: string;
50
+ }
51
+
52
+ export interface SwitchWorkspaceResponseClass {
53
+ accessToken: string;
54
+ permissions: string;
55
+ }
56
+
47
57
  export enum Environment {
48
58
  Production = 'https://apiv2.emil.de',
49
59
  Test = 'https://apiv2-test.emil.de',
@@ -94,13 +104,13 @@ export class BaseAPI {
94
104
  this.attachInterceptor(axios);
95
105
  }
96
106
 
97
- async initialize(env: Environment = Environment.Production) {
107
+ async initialize(env: Environment = Environment.Production, targetWorkspace?: string) {
98
108
  this.configuration.basePath = env;
99
109
 
100
110
  await this.loadCredentials();
101
111
 
102
112
  if (this.username) {
103
- await this.authorize(this.username, this.password);
113
+ await this.authorize(this.username, this.password, targetWorkspace);
104
114
  this.password = null; // to avoid keeping password loaded in memory.
105
115
  }
106
116
  }
@@ -150,7 +160,7 @@ export class BaseAPI {
150
160
  this.configuration.basePath = env;
151
161
  }
152
162
 
153
- async authorize(username: string, password: string): Promise<void> {
163
+ async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
154
164
  const options: AxiosRequestConfig = {
155
165
  method: 'POST',
156
166
  url: `${this.configuration.basePath}/authservice/v1/login`,
@@ -170,6 +180,38 @@ export class BaseAPI {
170
180
 
171
181
  const refreshToken = this.extractRefreshToken(response)
172
182
  this.configuration.refreshToken = refreshToken;
183
+
184
+ // Switch workspace if provided
185
+ if (targetWorkspace) {
186
+ await this.switchWorkspace(targetWorkspace);
187
+ }
188
+ }
189
+
190
+ async switchWorkspace(targetWorkspace: string): Promise<void> {
191
+ const options: AxiosRequestConfig = {
192
+ method: 'POST',
193
+ url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
194
+ headers: {
195
+ 'Content-Type': 'application/json',
196
+ 'Authorization': `Bearer ${this.configuration.accessToken}`,
197
+ 'Cookie': this.configuration.refreshToken,
198
+ },
199
+ data: {
200
+ username: this.configuration.username,
201
+ targetWorkspace,
202
+ } as SwitchWorkspaceRequest,
203
+ withCredentials: true,
204
+ };
205
+
206
+ const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
207
+
208
+ const { data: { accessToken } } = response;
209
+ this.configuration.accessToken = `Bearer ${accessToken}`;
210
+
211
+ const refreshToken = this.extractRefreshToken(response);
212
+ if (refreshToken) {
213
+ this.configuration.refreshToken = refreshToken;
214
+ }
173
215
  }
174
216
 
175
217
  async refreshTokenInternal(): Promise<string> {
@@ -25,6 +25,8 @@ import { ListPolicyVersionResponseClass } from '../models';
25
25
  import { PatchDraftPolicyRequestDto } from '../models';
26
26
  import { PatchPolicyRequestDto } from '../models';
27
27
  import { PatchPolicyResponseClass } from '../models';
28
+ import { RestorePolicyVersionRequestDto } from '../models';
29
+ import { RestorePolicyVersionResponseClass } from '../models';
28
30
  import { SuspendPolicyRequestDto } from '../models';
29
31
  import { SuspendPolicyResponseClass } from '../models';
30
32
  import { TerminatePolicyRequestDto } from '../models';
@@ -172,6 +174,16 @@ export declare const PoliciesApiAxiosParamCreator: (configuration?: Configuratio
172
174
  * @throws {RequiredError}
173
175
  */
174
176
  patchPolicy: (code: string, patchPolicyRequestDto: PatchPolicyRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
177
+ /**
178
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
179
+ * @summary Restore a policy version by versionId
180
+ * @param {string} policyCode The policy code.
181
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
182
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
183
+ * @param {*} [options] Override http request option.
184
+ * @throws {RequiredError}
185
+ */
186
+ restorePolicyVersion: (policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
175
187
  /**
176
188
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
177
189
  * @summary Suspend a policy by tenant
@@ -353,6 +365,16 @@ export declare const PoliciesApiFp: (configuration?: Configuration) => {
353
365
  * @throws {RequiredError}
354
366
  */
355
367
  patchPolicy(code: string, patchPolicyRequestDto: PatchPolicyRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PatchPolicyResponseClass>>;
368
+ /**
369
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
370
+ * @summary Restore a policy version by versionId
371
+ * @param {string} policyCode The policy code.
372
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
373
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
374
+ * @param {*} [options] Override http request option.
375
+ * @throws {RequiredError}
376
+ */
377
+ restorePolicyVersion(policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RestorePolicyVersionResponseClass>>;
356
378
  /**
357
379
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
358
380
  * @summary Suspend a policy by tenant
@@ -534,6 +556,16 @@ export declare const PoliciesApiFactory: (configuration?: Configuration, basePat
534
556
  * @throws {RequiredError}
535
557
  */
536
558
  patchPolicy(code: string, patchPolicyRequestDto: PatchPolicyRequestDto, authorization?: string, options?: any): AxiosPromise<PatchPolicyResponseClass>;
559
+ /**
560
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
561
+ * @summary Restore a policy version by versionId
562
+ * @param {string} policyCode The policy code.
563
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
564
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
565
+ * @param {*} [options] Override http request option.
566
+ * @throws {RequiredError}
567
+ */
568
+ restorePolicyVersion(policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: any): AxiosPromise<RestorePolicyVersionResponseClass>;
537
569
  /**
538
570
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
539
571
  * @summary Suspend a policy by tenant
@@ -965,6 +997,31 @@ export interface PoliciesApiPatchPolicyRequest {
965
997
  */
966
998
  readonly authorization?: string;
967
999
  }
1000
+ /**
1001
+ * Request parameters for restorePolicyVersion operation in PoliciesApi.
1002
+ * @export
1003
+ * @interface PoliciesApiRestorePolicyVersionRequest
1004
+ */
1005
+ export interface PoliciesApiRestorePolicyVersionRequest {
1006
+ /**
1007
+ * The policy code.
1008
+ * @type {string}
1009
+ * @memberof PoliciesApiRestorePolicyVersion
1010
+ */
1011
+ readonly policyCode: string;
1012
+ /**
1013
+ *
1014
+ * @type {RestorePolicyVersionRequestDto}
1015
+ * @memberof PoliciesApiRestorePolicyVersion
1016
+ */
1017
+ readonly restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto;
1018
+ /**
1019
+ * Bearer Token: provided by the login endpoint under the name accessToken.
1020
+ * @type {string}
1021
+ * @memberof PoliciesApiRestorePolicyVersion
1022
+ */
1023
+ readonly authorization?: string;
1024
+ }
968
1025
  /**
969
1026
  * Request parameters for suspendPolicy operation in PoliciesApi.
970
1027
  * @export
@@ -1180,6 +1237,15 @@ export declare class PoliciesApi extends BaseAPI {
1180
1237
  * @memberof PoliciesApi
1181
1238
  */
1182
1239
  patchPolicy(requestParameters: PoliciesApiPatchPolicyRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<PatchPolicyResponseClass, any>>;
1240
+ /**
1241
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1242
+ * @summary Restore a policy version by versionId
1243
+ * @param {PoliciesApiRestorePolicyVersionRequest} requestParameters Request parameters.
1244
+ * @param {*} [options] Override http request option.
1245
+ * @throws {RequiredError}
1246
+ * @memberof PoliciesApi
1247
+ */
1248
+ restorePolicyVersion(requestParameters: PoliciesApiRestorePolicyVersionRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<RestorePolicyVersionResponseClass, any>>;
1183
1249
  /**
1184
1250
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1185
1251
  * @summary Suspend a policy by tenant
@@ -785,6 +785,59 @@ var PoliciesApiAxiosParamCreator = function (configuration) {
785
785
  });
786
786
  });
787
787
  },
788
+ /**
789
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
790
+ * @summary Restore a policy version by versionId
791
+ * @param {string} policyCode The policy code.
792
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
793
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
794
+ * @param {*} [options] Override http request option.
795
+ * @throws {RequiredError}
796
+ */
797
+ restorePolicyVersion: function (policyCode, restorePolicyVersionRequestDto, authorization, options) {
798
+ if (options === void 0) { options = {}; }
799
+ return __awaiter(_this, void 0, void 0, function () {
800
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
801
+ return __generator(this, function (_a) {
802
+ switch (_a.label) {
803
+ case 0:
804
+ // verify required parameter 'policyCode' is not null or undefined
805
+ (0, common_1.assertParamExists)('restorePolicyVersion', 'policyCode', policyCode);
806
+ // verify required parameter 'restorePolicyVersionRequestDto' is not null or undefined
807
+ (0, common_1.assertParamExists)('restorePolicyVersion', 'restorePolicyVersionRequestDto', restorePolicyVersionRequestDto);
808
+ localVarPath = "/insuranceservice/v1/policies/{policyCode}/restore-policy-version"
809
+ .replace("{".concat("policyCode", "}"), encodeURIComponent(String(policyCode)));
810
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
811
+ if (configuration) {
812
+ baseOptions = configuration.baseOptions;
813
+ baseAccessToken = configuration.accessToken;
814
+ }
815
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
816
+ localVarHeaderParameter = {};
817
+ localVarQueryParameter = {};
818
+ // authentication bearer required
819
+ // http bearer authentication required
820
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
821
+ case 1:
822
+ // authentication bearer required
823
+ // http bearer authentication required
824
+ _a.sent();
825
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
826
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
827
+ }
828
+ localVarHeaderParameter['Content-Type'] = 'application/json';
829
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
830
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
831
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
832
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(restorePolicyVersionRequestDto, localVarRequestOptions, configuration);
833
+ return [2 /*return*/, {
834
+ url: (0, common_1.toPathString)(localVarUrlObj),
835
+ options: localVarRequestOptions,
836
+ }];
837
+ }
838
+ });
839
+ });
840
+ },
788
841
  /**
789
842
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
790
843
  * @summary Suspend a policy by tenant
@@ -1286,6 +1339,28 @@ var PoliciesApiFp = function (configuration) {
1286
1339
  });
1287
1340
  });
1288
1341
  },
1342
+ /**
1343
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1344
+ * @summary Restore a policy version by versionId
1345
+ * @param {string} policyCode The policy code.
1346
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1347
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1348
+ * @param {*} [options] Override http request option.
1349
+ * @throws {RequiredError}
1350
+ */
1351
+ restorePolicyVersion: function (policyCode, restorePolicyVersionRequestDto, authorization, options) {
1352
+ return __awaiter(this, void 0, void 0, function () {
1353
+ var localVarAxiosArgs;
1354
+ return __generator(this, function (_a) {
1355
+ switch (_a.label) {
1356
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options)];
1357
+ case 1:
1358
+ localVarAxiosArgs = _a.sent();
1359
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1360
+ }
1361
+ });
1362
+ });
1363
+ },
1289
1364
  /**
1290
1365
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1291
1366
  * @summary Suspend a policy by tenant
@@ -1543,6 +1618,18 @@ var PoliciesApiFactory = function (configuration, basePath, axios) {
1543
1618
  patchPolicy: function (code, patchPolicyRequestDto, authorization, options) {
1544
1619
  return localVarFp.patchPolicy(code, patchPolicyRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1545
1620
  },
1621
+ /**
1622
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1623
+ * @summary Restore a policy version by versionId
1624
+ * @param {string} policyCode The policy code.
1625
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1626
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1627
+ * @param {*} [options] Override http request option.
1628
+ * @throws {RequiredError}
1629
+ */
1630
+ restorePolicyVersion: function (policyCode, restorePolicyVersionRequestDto, authorization, options) {
1631
+ return localVarFp.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1632
+ },
1546
1633
  /**
1547
1634
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1548
1635
  * @summary Suspend a policy by tenant
@@ -1751,6 +1838,18 @@ var PoliciesApi = /** @class */ (function (_super) {
1751
1838
  var _this = this;
1752
1839
  return (0, exports.PoliciesApiFp)(this.configuration).patchPolicy(requestParameters.code, requestParameters.patchPolicyRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1753
1840
  };
1841
+ /**
1842
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1843
+ * @summary Restore a policy version by versionId
1844
+ * @param {PoliciesApiRestorePolicyVersionRequest} requestParameters Request parameters.
1845
+ * @param {*} [options] Override http request option.
1846
+ * @throws {RequiredError}
1847
+ * @memberof PoliciesApi
1848
+ */
1849
+ PoliciesApi.prototype.restorePolicyVersion = function (requestParameters, options) {
1850
+ var _this = this;
1851
+ return (0, exports.PoliciesApiFp)(this.configuration).restorePolicyVersion(requestParameters.policyCode, requestParameters.restorePolicyVersionRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1852
+ };
1754
1853
  /**
1755
1854
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1756
1855
  * @summary Suspend a policy by tenant
package/dist/base.d.ts CHANGED
@@ -26,6 +26,14 @@ 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",
@@ -55,12 +63,13 @@ export declare class BaseAPI {
55
63
  private username?;
56
64
  private password?;
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
- authorize(username: string, password: string): Promise<void>;
71
+ authorize(username: string, password: string, targetWorkspace?: string): Promise<void>;
72
+ switchWorkspace(targetWorkspace: string): Promise<void>;
64
73
  refreshTokenInternal(): Promise<string>;
65
74
  private extractRefreshToken;
66
75
  getConfiguration(): Configuration;
package/dist/base.js CHANGED
@@ -162,7 +162,7 @@ var BaseAPI = /** @class */ (function () {
162
162
  }
163
163
  this.attachInterceptor(axios);
164
164
  }
165
- BaseAPI.prototype.initialize = function (env) {
165
+ BaseAPI.prototype.initialize = function (env, targetWorkspace) {
166
166
  if (env === void 0) { env = Environment.Production; }
167
167
  return __awaiter(this, void 0, void 0, function () {
168
168
  return __generator(this, function (_a) {
@@ -173,7 +173,7 @@ var BaseAPI = /** @class */ (function () {
173
173
  case 1:
174
174
  _a.sent();
175
175
  if (!this.username) return [3 /*break*/, 3];
176
- return [4 /*yield*/, this.authorize(this.username, this.password)];
176
+ return [4 /*yield*/, this.authorize(this.username, this.password, targetWorkspace)];
177
177
  case 2:
178
178
  _a.sent();
179
179
  this.password = null; // to avoid keeping password loaded in memory.
@@ -243,7 +243,7 @@ var BaseAPI = /** @class */ (function () {
243
243
  BaseAPI.prototype.selectEnvironment = function (env) {
244
244
  this.configuration.basePath = env;
245
245
  };
246
- BaseAPI.prototype.authorize = function (username, password) {
246
+ BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
247
247
  return __awaiter(this, void 0, void 0, function () {
248
248
  var options, response, accessToken, refreshToken;
249
249
  return __generator(this, function (_a) {
@@ -267,6 +267,45 @@ var BaseAPI = /** @class */ (function () {
267
267
  this.configuration.accessToken = "Bearer ".concat(accessToken);
268
268
  refreshToken = this.extractRefreshToken(response);
269
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
+ }
270
309
  return [2 /*return*/];
271
310
  }
272
311
  });
@@ -141,9 +141,31 @@ export interface CreateProductFieldRequestDto {
141
141
  * @memberof CreateProductFieldRequestDto
142
142
  */
143
143
  'metadata'?: object;
144
+ /**
145
+ * Overrides automatic dependency check result (if this field is used in the premium calculation or not).
146
+ * @type {string}
147
+ * @memberof CreateProductFieldRequestDto
148
+ */
149
+ 'usedInPremiumCalculationOverride'?: CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum;
150
+ /**
151
+ * Overrides automatic dependency check result (if this field is used in the product field calculation or not).
152
+ * @type {string}
153
+ * @memberof CreateProductFieldRequestDto
154
+ */
155
+ 'usedInFieldCalculationOverride'?: CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum;
144
156
  }
145
157
  export declare const CreateProductFieldRequestDtoTypeEntityEnum: {
146
158
  readonly SystemProductFieldType: "system_product_field_type";
147
159
  readonly ProductFactorType: "product_factor_type";
148
160
  };
149
161
  export type CreateProductFieldRequestDtoTypeEntityEnum = typeof CreateProductFieldRequestDtoTypeEntityEnum[keyof typeof CreateProductFieldRequestDtoTypeEntityEnum];
162
+ export declare const CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum: {
163
+ readonly Used: "used";
164
+ readonly NotUsed: "not_used";
165
+ };
166
+ export type CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum = typeof CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum[keyof typeof CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum];
167
+ export declare const CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum: {
168
+ readonly Used: "used";
169
+ readonly NotUsed: "not_used";
170
+ };
171
+ export type CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum = typeof CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum[keyof typeof CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum];
@@ -13,8 +13,16 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.CreateProductFieldRequestDtoTypeEntityEnum = void 0;
16
+ exports.CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum = exports.CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum = exports.CreateProductFieldRequestDtoTypeEntityEnum = void 0;
17
17
  exports.CreateProductFieldRequestDtoTypeEntityEnum = {
18
18
  SystemProductFieldType: 'system_product_field_type',
19
19
  ProductFactorType: 'product_factor_type'
20
20
  };
21
+ exports.CreateProductFieldRequestDtoUsedInPremiumCalculationOverrideEnum = {
22
+ Used: 'used',
23
+ NotUsed: 'not_used'
24
+ };
25
+ exports.CreateProductFieldRequestDtoUsedInFieldCalculationOverrideEnum = {
26
+ Used: 'used',
27
+ NotUsed: 'not_used'
28
+ };