@emilgroup/insurance-sdk 1.77.1-beta.9 → 1.79.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 +51 -2
  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 +10 -1
  8. package/dist/base.js +46 -2
  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@1.77.1-beta.9 --save
20
+ npm install @emilgroup/insurance-sdk@1.79.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/insurance-sdk@1.77.1-beta.9
24
+ yarn add @emilgroup/insurance-sdk@1.79.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';
@@ -749,6 +753,57 @@ export const PoliciesApiAxiosParamCreator = function (configuration?: Configurat
749
753
  options: localVarRequestOptions,
750
754
  };
751
755
  },
756
+ /**
757
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
758
+ * @summary Restore a policy version by versionId
759
+ * @param {string} policyCode The policy code.
760
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
761
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
762
+ * @param {*} [options] Override http request option.
763
+ * @throws {RequiredError}
764
+ */
765
+ restorePolicyVersion: async (policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
766
+ // verify required parameter 'policyCode' is not null or undefined
767
+ assertParamExists('restorePolicyVersion', 'policyCode', policyCode)
768
+ // verify required parameter 'restorePolicyVersionRequestDto' is not null or undefined
769
+ assertParamExists('restorePolicyVersion', 'restorePolicyVersionRequestDto', restorePolicyVersionRequestDto)
770
+ const localVarPath = `/insuranceservice/v1/policies/{policyCode}/restore-policy-version`
771
+ .replace(`{${"policyCode"}}`, encodeURIComponent(String(policyCode)));
772
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
773
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
774
+ let baseOptions;
775
+ let baseAccessToken;
776
+ if (configuration) {
777
+ baseOptions = configuration.baseOptions;
778
+ baseAccessToken = configuration.accessToken;
779
+ }
780
+
781
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
782
+ const localVarHeaderParameter = {} as any;
783
+ const localVarQueryParameter = {} as any;
784
+
785
+ // authentication bearer required
786
+ // http bearer authentication required
787
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
788
+
789
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
790
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
791
+ }
792
+
793
+
794
+
795
+ localVarHeaderParameter['Content-Type'] = 'application/json';
796
+
797
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
798
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
799
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
800
+ localVarRequestOptions.data = serializeDataIfNeeded(restorePolicyVersionRequestDto, localVarRequestOptions, configuration)
801
+
802
+ return {
803
+ url: toPathString(localVarUrlObj),
804
+ options: localVarRequestOptions,
805
+ };
806
+ },
752
807
  /**
753
808
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
754
809
  * @summary Suspend a policy by tenant
@@ -1134,6 +1189,19 @@ export const PoliciesApiFp = function(configuration?: Configuration) {
1134
1189
  const localVarAxiosArgs = await localVarAxiosParamCreator.patchPolicy(code, patchPolicyRequestDto, authorization, options);
1135
1190
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1136
1191
  },
1192
+ /**
1193
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1194
+ * @summary Restore a policy version by versionId
1195
+ * @param {string} policyCode The policy code.
1196
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1197
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1198
+ * @param {*} [options] Override http request option.
1199
+ * @throws {RequiredError}
1200
+ */
1201
+ async restorePolicyVersion(policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RestorePolicyVersionResponseClass>> {
1202
+ const localVarAxiosArgs = await localVarAxiosParamCreator.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options);
1203
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1204
+ },
1137
1205
  /**
1138
1206
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1139
1207
  * @summary Suspend a policy by tenant
@@ -1355,6 +1423,18 @@ export const PoliciesApiFactory = function (configuration?: Configuration, baseP
1355
1423
  patchPolicy(code: string, patchPolicyRequestDto: PatchPolicyRequestDto, authorization?: string, options?: any): AxiosPromise<PatchPolicyResponseClass> {
1356
1424
  return localVarFp.patchPolicy(code, patchPolicyRequestDto, authorization, options).then((request) => request(axios, basePath));
1357
1425
  },
1426
+ /**
1427
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1428
+ * @summary Restore a policy version by versionId
1429
+ * @param {string} policyCode The policy code.
1430
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1431
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1432
+ * @param {*} [options] Override http request option.
1433
+ * @throws {RequiredError}
1434
+ */
1435
+ restorePolicyVersion(policyCode: string, restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto, authorization?: string, options?: any): AxiosPromise<RestorePolicyVersionResponseClass> {
1436
+ return localVarFp.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options).then((request) => request(axios, basePath));
1437
+ },
1358
1438
  /**
1359
1439
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1360
1440
  * @summary Suspend a policy by tenant
@@ -1847,6 +1927,34 @@ export interface PoliciesApiPatchPolicyRequest {
1847
1927
  readonly authorization?: string
1848
1928
  }
1849
1929
 
1930
+ /**
1931
+ * Request parameters for restorePolicyVersion operation in PoliciesApi.
1932
+ * @export
1933
+ * @interface PoliciesApiRestorePolicyVersionRequest
1934
+ */
1935
+ export interface PoliciesApiRestorePolicyVersionRequest {
1936
+ /**
1937
+ * The policy code.
1938
+ * @type {string}
1939
+ * @memberof PoliciesApiRestorePolicyVersion
1940
+ */
1941
+ readonly policyCode: string
1942
+
1943
+ /**
1944
+ *
1945
+ * @type {RestorePolicyVersionRequestDto}
1946
+ * @memberof PoliciesApiRestorePolicyVersion
1947
+ */
1948
+ readonly restorePolicyVersionRequestDto: RestorePolicyVersionRequestDto
1949
+
1950
+ /**
1951
+ * Bearer Token: provided by the login endpoint under the name accessToken.
1952
+ * @type {string}
1953
+ * @memberof PoliciesApiRestorePolicyVersion
1954
+ */
1955
+ readonly authorization?: string
1956
+ }
1957
+
1850
1958
  /**
1851
1959
  * Request parameters for suspendPolicy operation in PoliciesApi.
1852
1960
  * @export
@@ -2110,6 +2218,18 @@ export class PoliciesApi extends BaseAPI {
2110
2218
  return PoliciesApiFp(this.configuration).patchPolicy(requestParameters.code, requestParameters.patchPolicyRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
2111
2219
  }
2112
2220
 
2221
+ /**
2222
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
2223
+ * @summary Restore a policy version by versionId
2224
+ * @param {PoliciesApiRestorePolicyVersionRequest} requestParameters Request parameters.
2225
+ * @param {*} [options] Override http request option.
2226
+ * @throws {RequiredError}
2227
+ * @memberof PoliciesApi
2228
+ */
2229
+ public restorePolicyVersion(requestParameters: PoliciesApiRestorePolicyVersionRequest, options?: AxiosRequestConfig) {
2230
+ return PoliciesApiFp(this.configuration).restorePolicyVersion(requestParameters.policyCode, requestParameters.restorePolicyVersionRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
2231
+ }
2232
+
2113
2233
  /**
2114
2234
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
2115
2235
  * @summary Suspend a policy by tenant
package/base.ts CHANGED
@@ -37,6 +37,16 @@ export interface LoginClass {
37
37
  permissions: string;
38
38
  }
39
39
 
40
+ export interface SwitchWorkspaceRequest {
41
+ username: string;
42
+ targetWorkspace: string;
43
+ }
44
+
45
+ export interface SwitchWorkspaceResponseClass {
46
+ accessToken: string;
47
+ permissions: string;
48
+ }
49
+
40
50
  export enum Environment {
41
51
  Production = 'https://apiv2.emil.de',
42
52
  Test = 'https://apiv2-test.emil.de',
@@ -87,9 +97,14 @@ export class BaseAPI {
87
97
  this.loadTokenData();
88
98
 
89
99
  if (configuration) {
100
+ const { accessToken } = this.tokenData;
90
101
  this.configuration = configuration;
91
102
  this.basePath = configuration.basePath || this.basePath;
92
- this.configuration.accessToken = this.tokenData.accessToken ? `Bearer ${this.tokenData.accessToken}` : '';
103
+
104
+ // Use config token if provided, otherwise use tokenData token
105
+ const configToken = this.configuration.accessToken;
106
+ const storedToken = accessToken ? `Bearer ${accessToken}` : '';
107
+ this.configuration.accessToken = configToken || storedToken;
93
108
  } else {
94
109
  const { accessToken, username } = this.tokenData;
95
110
 
@@ -119,7 +134,7 @@ export class BaseAPI {
119
134
  return this.tokenData.permissions.split(',');
120
135
  }
121
136
 
122
- async authorize(username: string, password: string): Promise<void> {
137
+ async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
123
138
  const options: AxiosRequestConfig = {
124
139
  method: 'POST',
125
140
  url: `${this.configuration.basePath}/authservice/v1/login`,
@@ -141,6 +156,40 @@ export class BaseAPI {
141
156
  this.tokenData.accessToken = accessToken;
142
157
  this.tokenData.permissions = permissions;
143
158
 
159
+ // Switch workspace if provided
160
+ if (targetWorkspace) {
161
+ await this.switchWorkspace(targetWorkspace);
162
+ } else {
163
+ // Only store if no workspace switch (since switchWorkspace will store after switching)
164
+ this.storeTokenData({
165
+ ...this.tokenData
166
+ });
167
+ }
168
+ }
169
+
170
+ async switchWorkspace(targetWorkspace: string): Promise<void> {
171
+ const options: AxiosRequestConfig = {
172
+ method: 'POST',
173
+ url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
174
+ headers: {
175
+ 'Content-Type': 'application/json',
176
+ 'Authorization': `Bearer ${this.configuration.accessToken}`,
177
+ },
178
+ data: {
179
+ username: this.configuration.username,
180
+ targetWorkspace,
181
+ } as SwitchWorkspaceRequest,
182
+ withCredentials: true,
183
+ };
184
+
185
+ const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
186
+
187
+ const { data: { accessToken, permissions } } = response;
188
+
189
+ this.configuration.accessToken = `Bearer ${accessToken}`;
190
+ this.tokenData.accessToken = accessToken;
191
+ this.tokenData.permissions = permissions;
192
+
144
193
  this.storeTokenData({
145
194
  ...this.tokenData
146
195
  });
@@ -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
@@ -781,6 +781,59 @@ var PoliciesApiAxiosParamCreator = function (configuration) {
781
781
  });
782
782
  });
783
783
  },
784
+ /**
785
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
786
+ * @summary Restore a policy version by versionId
787
+ * @param {string} policyCode The policy code.
788
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
789
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
790
+ * @param {*} [options] Override http request option.
791
+ * @throws {RequiredError}
792
+ */
793
+ restorePolicyVersion: function (policyCode, restorePolicyVersionRequestDto, authorization, options) {
794
+ if (options === void 0) { options = {}; }
795
+ return __awaiter(_this, void 0, void 0, function () {
796
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
797
+ return __generator(this, function (_a) {
798
+ switch (_a.label) {
799
+ case 0:
800
+ // verify required parameter 'policyCode' is not null or undefined
801
+ (0, common_1.assertParamExists)('restorePolicyVersion', 'policyCode', policyCode);
802
+ // verify required parameter 'restorePolicyVersionRequestDto' is not null or undefined
803
+ (0, common_1.assertParamExists)('restorePolicyVersion', 'restorePolicyVersionRequestDto', restorePolicyVersionRequestDto);
804
+ localVarPath = "/insuranceservice/v1/policies/{policyCode}/restore-policy-version"
805
+ .replace("{".concat("policyCode", "}"), encodeURIComponent(String(policyCode)));
806
+ localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
807
+ if (configuration) {
808
+ baseOptions = configuration.baseOptions;
809
+ baseAccessToken = configuration.accessToken;
810
+ }
811
+ localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
812
+ localVarHeaderParameter = {};
813
+ localVarQueryParameter = {};
814
+ // authentication bearer required
815
+ // http bearer authentication required
816
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
817
+ case 1:
818
+ // authentication bearer required
819
+ // http bearer authentication required
820
+ _a.sent();
821
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
822
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
823
+ }
824
+ localVarHeaderParameter['Content-Type'] = 'application/json';
825
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
826
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
827
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
828
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(restorePolicyVersionRequestDto, localVarRequestOptions, configuration);
829
+ return [2 /*return*/, {
830
+ url: (0, common_1.toPathString)(localVarUrlObj),
831
+ options: localVarRequestOptions,
832
+ }];
833
+ }
834
+ });
835
+ });
836
+ },
784
837
  /**
785
838
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
786
839
  * @summary Suspend a policy by tenant
@@ -1282,6 +1335,28 @@ var PoliciesApiFp = function (configuration) {
1282
1335
  });
1283
1336
  });
1284
1337
  },
1338
+ /**
1339
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1340
+ * @summary Restore a policy version by versionId
1341
+ * @param {string} policyCode The policy code.
1342
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1343
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1344
+ * @param {*} [options] Override http request option.
1345
+ * @throws {RequiredError}
1346
+ */
1347
+ restorePolicyVersion: function (policyCode, restorePolicyVersionRequestDto, authorization, options) {
1348
+ return __awaiter(this, void 0, void 0, function () {
1349
+ var localVarAxiosArgs;
1350
+ return __generator(this, function (_a) {
1351
+ switch (_a.label) {
1352
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options)];
1353
+ case 1:
1354
+ localVarAxiosArgs = _a.sent();
1355
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
1356
+ }
1357
+ });
1358
+ });
1359
+ },
1285
1360
  /**
1286
1361
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1287
1362
  * @summary Suspend a policy by tenant
@@ -1539,6 +1614,18 @@ var PoliciesApiFactory = function (configuration, basePath, axios) {
1539
1614
  patchPolicy: function (code, patchPolicyRequestDto, authorization, options) {
1540
1615
  return localVarFp.patchPolicy(code, patchPolicyRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1541
1616
  },
1617
+ /**
1618
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1619
+ * @summary Restore a policy version by versionId
1620
+ * @param {string} policyCode The policy code.
1621
+ * @param {RestorePolicyVersionRequestDto} restorePolicyVersionRequestDto
1622
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
1623
+ * @param {*} [options] Override http request option.
1624
+ * @throws {RequiredError}
1625
+ */
1626
+ restorePolicyVersion: function (policyCode, restorePolicyVersionRequestDto, authorization, options) {
1627
+ return localVarFp.restorePolicyVersion(policyCode, restorePolicyVersionRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1628
+ },
1542
1629
  /**
1543
1630
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1544
1631
  * @summary Suspend a policy by tenant
@@ -1747,6 +1834,18 @@ var PoliciesApi = /** @class */ (function (_super) {
1747
1834
  var _this = this;
1748
1835
  return (0, exports.PoliciesApiFp)(this.configuration).patchPolicy(requestParameters.code, requestParameters.patchPolicyRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1749
1836
  };
1837
+ /**
1838
+ * Request to restore an existing policy version by versionId. **Required Permissions** \"policy-management.policies.update\"
1839
+ * @summary Restore a policy version by versionId
1840
+ * @param {PoliciesApiRestorePolicyVersionRequest} requestParameters Request parameters.
1841
+ * @param {*} [options] Override http request option.
1842
+ * @throws {RequiredError}
1843
+ * @memberof PoliciesApi
1844
+ */
1845
+ PoliciesApi.prototype.restorePolicyVersion = function (requestParameters, options) {
1846
+ var _this = this;
1847
+ return (0, exports.PoliciesApiFp)(this.configuration).restorePolicyVersion(requestParameters.policyCode, requestParameters.restorePolicyVersionRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1848
+ };
1750
1849
  /**
1751
1850
  * Request to suspend an existing policy by tenant. **Required Permissions** \"policy-management.policies.update\"
1752
1851
  * @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",
@@ -57,7 +65,8 @@ export declare class BaseAPI {
57
65
  selectEnvironment(env: Environment): void;
58
66
  selectBasePath(path: string): void;
59
67
  getPermissions(): Array<string>;
60
- authorize(username: string, password: string): Promise<void>;
68
+ authorize(username: string, password: string, targetWorkspace?: string): Promise<void>;
69
+ switchWorkspace(targetWorkspace: string): Promise<void>;
61
70
  refreshTokenInternal(): Promise<LoginClass>;
62
71
  private storeTokenData;
63
72
  loadTokenData(): void;
package/dist/base.js CHANGED
@@ -124,9 +124,13 @@ var BaseAPI = /** @class */ (function () {
124
124
  this.axios = axios;
125
125
  this.loadTokenData();
126
126
  if (configuration) {
127
+ var accessToken = this.tokenData.accessToken;
127
128
  this.configuration = configuration;
128
129
  this.basePath = configuration.basePath || this.basePath;
129
- this.configuration.accessToken = this.tokenData.accessToken ? "Bearer ".concat(this.tokenData.accessToken) : '';
130
+ // Use config token if provided, otherwise use tokenData token
131
+ var configToken = this.configuration.accessToken;
132
+ var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
133
+ this.configuration.accessToken = configToken || storedToken;
130
134
  }
131
135
  else {
132
136
  var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
@@ -151,7 +155,7 @@ var BaseAPI = /** @class */ (function () {
151
155
  }
152
156
  return this.tokenData.permissions.split(',');
153
157
  };
154
- BaseAPI.prototype.authorize = function (username, password) {
158
+ BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
155
159
  return __awaiter(this, void 0, void 0, function () {
156
160
  var options, response, _a, accessToken, permissions;
157
161
  return __generator(this, function (_b) {
@@ -176,6 +180,46 @@ var BaseAPI = /** @class */ (function () {
176
180
  this.tokenData.username = username;
177
181
  this.tokenData.accessToken = accessToken;
178
182
  this.tokenData.permissions = permissions;
183
+ if (!targetWorkspace) return [3 /*break*/, 3];
184
+ return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
185
+ case 2:
186
+ _b.sent();
187
+ return [3 /*break*/, 4];
188
+ case 3:
189
+ // Only store if no workspace switch (since switchWorkspace will store after switching)
190
+ this.storeTokenData(__assign({}, this.tokenData));
191
+ _b.label = 4;
192
+ case 4: return [2 /*return*/];
193
+ }
194
+ });
195
+ });
196
+ };
197
+ BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
198
+ return __awaiter(this, void 0, void 0, function () {
199
+ var options, response, _a, accessToken, permissions;
200
+ return __generator(this, function (_b) {
201
+ switch (_b.label) {
202
+ case 0:
203
+ options = {
204
+ method: 'POST',
205
+ url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
206
+ headers: {
207
+ 'Content-Type': 'application/json',
208
+ 'Authorization': "Bearer ".concat(this.configuration.accessToken),
209
+ },
210
+ data: {
211
+ username: this.configuration.username,
212
+ targetWorkspace: targetWorkspace,
213
+ },
214
+ withCredentials: true,
215
+ };
216
+ return [4 /*yield*/, axios_1.default.request(options)];
217
+ case 1:
218
+ response = _b.sent();
219
+ _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
220
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
221
+ this.tokenData.accessToken = accessToken;
222
+ this.tokenData.permissions = permissions;
179
223
  this.storeTokenData(__assign({}, this.tokenData));
180
224
  return [2 /*return*/];
181
225
  }
@@ -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
+ };