@emilgroup/account-sdk 1.49.1-beta.6 → 1.49.1-beta.8

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.
@@ -19,8 +19,6 @@ models/inline-response200.ts
19
19
  models/inline-response503.ts
20
20
  models/list-accounts-response-class.ts
21
21
  models/policy-class.ts
22
- models/register-account-policy-request-dto.ts
23
- models/register-policy-response-class.ts
24
22
  models/update-account-request-dto.ts
25
23
  models/update-account-response-class.ts
26
24
  package.json
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/account-sdk@1.49.1-beta.6 --save
20
+ npm install @emilgroup/account-sdk@1.49.1-beta.8 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/account-sdk@1.49.1-beta.6
24
+ yarn add @emilgroup/account-sdk@1.49.1-beta.8
25
25
  ```
26
26
 
27
27
  And then you can import `AccountsApi`.
@@ -29,10 +29,6 @@ import { GetAccountResponseClass } from '../models';
29
29
  // @ts-ignore
30
30
  import { ListAccountsResponseClass } from '../models';
31
31
  // @ts-ignore
32
- import { RegisterAccountPolicyRequestDto } from '../models';
33
- // @ts-ignore
34
- import { RegisterPolicyResponseClass } from '../models';
35
- // @ts-ignore
36
32
  import { UpdateAccountRequestDto } from '../models';
37
33
  // @ts-ignore
38
34
  import { UpdateAccountResponseClass } from '../models';
@@ -310,57 +306,6 @@ export const AccountsApiAxiosParamCreator = function (configuration?: Configurat
310
306
  options: localVarRequestOptions,
311
307
  };
312
308
  },
313
- /**
314
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
315
- * @summary Create the account policy
316
- * @param {string} code Unique identifier for the object.
317
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
318
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
319
- * @param {*} [options] Override http request option.
320
- * @throws {RequiredError}
321
- */
322
- registerPolicy: async (code: string, registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
323
- // verify required parameter 'code' is not null or undefined
324
- assertParamExists('registerPolicy', 'code', code)
325
- // verify required parameter 'registerAccountPolicyRequestDto' is not null or undefined
326
- assertParamExists('registerPolicy', 'registerAccountPolicyRequestDto', registerAccountPolicyRequestDto)
327
- const localVarPath = `/accountservice/v1/accounts/{code}/policies`
328
- .replace(`{${"code"}}`, encodeURIComponent(String(code)));
329
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
330
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
331
- let baseOptions;
332
- let baseAccessToken;
333
- if (configuration) {
334
- baseOptions = configuration.baseOptions;
335
- baseAccessToken = configuration.accessToken;
336
- }
337
-
338
- const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
339
- const localVarHeaderParameter = {} as any;
340
- const localVarQueryParameter = {} as any;
341
-
342
- // authentication bearer required
343
- // http bearer authentication required
344
- await setBearerAuthToObject(localVarHeaderParameter, configuration)
345
-
346
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
347
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
348
- }
349
-
350
-
351
-
352
- localVarHeaderParameter['Content-Type'] = 'application/json';
353
-
354
- setSearchParams(localVarUrlObj, localVarQueryParameter);
355
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
356
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
357
- localVarRequestOptions.data = serializeDataIfNeeded(registerAccountPolicyRequestDto, localVarRequestOptions, configuration)
358
-
359
- return {
360
- url: toPathString(localVarUrlObj),
361
- options: localVarRequestOptions,
362
- };
363
- },
364
309
  /**
365
310
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
366
311
  * @summary Update the account
@@ -490,19 +435,6 @@ export const AccountsApiFp = function(configuration?: Configuration) {
490
435
  const localVarAxiosArgs = await localVarAxiosParamCreator.listAccounts(authorization, pageSize, pageToken, filter, search, order, expand, filters, options);
491
436
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
492
437
  },
493
- /**
494
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
495
- * @summary Create the account policy
496
- * @param {string} code Unique identifier for the object.
497
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
498
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
499
- * @param {*} [options] Override http request option.
500
- * @throws {RequiredError}
501
- */
502
- async registerPolicy(code: string, registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RegisterPolicyResponseClass>> {
503
- const localVarAxiosArgs = await localVarAxiosParamCreator.registerPolicy(code, registerAccountPolicyRequestDto, authorization, options);
504
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
505
- },
506
438
  /**
507
439
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
508
440
  * @summary Update the account
@@ -589,18 +521,6 @@ export const AccountsApiFactory = function (configuration?: Configuration, baseP
589
521
  listAccounts(authorization?: string, pageSize?: number, pageToken?: string, filter?: 'firstName' | 'code' | 'email' | 'createdAt' | 'birthDate' | 'accountNumber' | 'title' | 'lastName' | 'gender' | 'street' | 'houseNumber' | 'zipCode' | 'city' | 'phone' | 'type' | 'companyName' | 'name' | 'partnerCode', search?: string, order?: 'id' | 'firstName' | 'lastName' | 'email' | 'createdAt' | 'accountNumber', expand?: 'policies', filters?: string, options?: any): AxiosPromise<ListAccountsResponseClass> {
590
522
  return localVarFp.listAccounts(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
591
523
  },
592
- /**
593
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
594
- * @summary Create the account policy
595
- * @param {string} code Unique identifier for the object.
596
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
597
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
598
- * @param {*} [options] Override http request option.
599
- * @throws {RequiredError}
600
- */
601
- registerPolicy(code: string, registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto, authorization?: string, options?: any): AxiosPromise<RegisterPolicyResponseClass> {
602
- return localVarFp.registerPolicy(code, registerAccountPolicyRequestDto, authorization, options).then((request) => request(axios, basePath));
603
- },
604
524
  /**
605
525
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
606
526
  * @summary Update the account
@@ -777,34 +697,6 @@ export interface AccountsApiListAccountsRequest {
777
697
  readonly filters?: string
778
698
  }
779
699
 
780
- /**
781
- * Request parameters for registerPolicy operation in AccountsApi.
782
- * @export
783
- * @interface AccountsApiRegisterPolicyRequest
784
- */
785
- export interface AccountsApiRegisterPolicyRequest {
786
- /**
787
- * Unique identifier for the object.
788
- * @type {string}
789
- * @memberof AccountsApiRegisterPolicy
790
- */
791
- readonly code: string
792
-
793
- /**
794
- *
795
- * @type {RegisterAccountPolicyRequestDto}
796
- * @memberof AccountsApiRegisterPolicy
797
- */
798
- readonly registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto
799
-
800
- /**
801
- * Bearer Token: provided by the login endpoint under the name accessToken.
802
- * @type {string}
803
- * @memberof AccountsApiRegisterPolicy
804
- */
805
- readonly authorization?: string
806
- }
807
-
808
700
  /**
809
701
  * Request parameters for updateAccount operation in AccountsApi.
810
702
  * @export
@@ -900,18 +792,6 @@ export class AccountsApi extends BaseAPI {
900
792
  return AccountsApiFp(this.configuration).listAccounts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then((request) => request(this.axios, this.basePath));
901
793
  }
902
794
 
903
- /**
904
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
905
- * @summary Create the account policy
906
- * @param {AccountsApiRegisterPolicyRequest} requestParameters Request parameters.
907
- * @param {*} [options] Override http request option.
908
- * @throws {RequiredError}
909
- * @memberof AccountsApi
910
- */
911
- public registerPolicy(requestParameters: AccountsApiRegisterPolicyRequest, options?: AxiosRequestConfig) {
912
- return AccountsApiFp(this.configuration).registerPolicy(requestParameters.code, requestParameters.registerAccountPolicyRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
913
- }
914
-
915
795
  /**
916
796
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
917
797
  * @summary Update the account
package/base.ts CHANGED
@@ -102,14 +102,10 @@ export class BaseAPI {
102
102
  this.configuration = configuration;
103
103
  this.basePath = configuration.basePath || this.basePath;
104
104
 
105
- if (configuration.cookieAuth) {
106
- this.useCookieAuth();
107
- } else {
108
- // Use config token if provided, otherwise use tokenData token
109
- const configToken = this.configuration.accessToken;
110
- const storedToken = accessToken ? `Bearer ${accessToken}` : '';
111
- this.configuration.accessToken = configToken || storedToken;
112
- }
105
+ // Use config token if provided, otherwise use tokenData token
106
+ const configToken = this.configuration.accessToken;
107
+ const storedToken = accessToken ? `Bearer ${accessToken}` : '';
108
+ this.configuration.accessToken = configToken || storedToken;
113
109
  } else {
114
110
  const { accessToken, username } = this.tokenData;
115
111
 
@@ -123,12 +119,6 @@ export class BaseAPI {
123
119
  this.attachInterceptor(axios);
124
120
  }
125
121
 
126
- // Cookie mode: the browser sends the HttpOnly access cookie, so no token is read from storage.
127
- private useCookieAuth() {
128
- this.configuration.username = this.configuration.username || this.tokenData.username;
129
- this.configuration.baseOptions = { ...this.configuration.baseOptions, withCredentials: true };
130
- }
131
-
132
122
  selectEnvironment(env: Environment) {
133
123
  this.selectBasePath(env);
134
124
  }
@@ -162,12 +152,10 @@ export class BaseAPI {
162
152
  const { data: { accessToken, permissions } } = response;
163
153
 
164
154
  this.configuration.username = username;
155
+ this.configuration.accessToken = `Bearer ${accessToken}`;
165
156
  this.tokenData.username = username;
157
+ this.tokenData.accessToken = accessToken;
166
158
  this.tokenData.permissions = permissions;
167
- if (!this.configuration.cookieAuth) {
168
- this.configuration.accessToken = `Bearer ${accessToken}`;
169
- this.tokenData.accessToken = accessToken;
170
- }
171
159
 
172
160
  // Switch workspace if provided
173
161
  if (targetWorkspace) {
@@ -190,7 +178,7 @@ export class BaseAPI {
190
178
  url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
191
179
  headers: {
192
180
  'Content-Type': 'application/json',
193
- ...(this.configuration.cookieAuth ? {} : { 'Authorization': `Bearer ${this.configuration.accessToken}` }),
181
+ 'Authorization': `Bearer ${this.configuration.accessToken}`,
194
182
  },
195
183
  data: {
196
184
  username: this.configuration.username,
@@ -202,12 +190,10 @@ export class BaseAPI {
202
190
  const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
203
191
 
204
192
  const { data: { accessToken, permissions } } = response;
205
-
193
+
194
+ this.configuration.accessToken = `Bearer ${accessToken}`;
195
+ this.tokenData.accessToken = accessToken;
206
196
  this.tokenData.permissions = permissions;
207
- if (!this.configuration.cookieAuth) {
208
- this.configuration.accessToken = `Bearer ${accessToken}`;
209
- this.tokenData.accessToken = accessToken;
210
- }
211
197
 
212
198
  this.storeTokenData({
213
199
  ...this.tokenData
@@ -247,11 +233,6 @@ export class BaseAPI {
247
233
 
248
234
  private storeTokenData(tokenData?: TokenData) {
249
235
  if (typeof window !== 'undefined') {
250
- if (tokenData && this.configuration?.cookieAuth) {
251
- // Cookie mode saves who is logged in, never the token; a token saved by apps not yet migrated stays.
252
- const { username, permissions } = tokenData;
253
- tokenData = { ...(defaultStorage().get<TokenData>(TOKEN_DATA) || {}), username, permissions };
254
- }
255
236
  defaultStorage().set<TokenData>(TOKEN_DATA, tokenData);
256
237
  }
257
238
  }
@@ -282,17 +263,15 @@ export class BaseAPI {
282
263
  originalConfig._retry = true;
283
264
  try {
284
265
  const { accessToken: tokenString, permissions } = await this.refreshTokenInternal();
266
+ const accessToken = `Bearer ${tokenString}`;
285
267
  this.tokenData.permissions = permissions;
286
268
 
287
269
  delete originalConfig.headers['Authorization']
288
270
 
289
- // In cookie mode the refresh reply renewed the access cookie, so retry without a header.
290
- if (!this.configuration.cookieAuth) {
291
- const accessToken = `Bearer ${tokenString}`;
292
- originalConfig.headers['Authorization'] = accessToken;
293
- this.configuration.accessToken = accessToken;
294
- this.tokenData.accessToken = tokenString;
295
- }
271
+ originalConfig.headers['Authorization'] = accessToken;
272
+
273
+ this.configuration.accessToken = accessToken;
274
+ this.tokenData.accessToken = tokenString;
296
275
 
297
276
  this.storeTokenData(this.tokenData);
298
277
 
package/configuration.ts CHANGED
@@ -21,7 +21,6 @@ export interface ConfigurationParameters {
21
21
  basePath?: string;
22
22
  baseOptions?: any;
23
23
  formDataCtor?: new () => any;
24
- cookieAuth?: boolean;
25
24
  }
26
25
 
27
26
  export class Configuration {
@@ -75,15 +74,6 @@ export class Configuration {
75
74
  */
76
75
  formDataCtor?: new () => any;
77
76
 
78
- /**
79
- * Authenticate with the HttpOnly access cookie instead of a stored token: every call sends credentials.
80
- * The browser holds one cookie, so use it with one logged-in account; log out through the auth service.
81
- *
82
- * @type {boolean}
83
- * @memberof Configuration
84
- */
85
- cookieAuth?: boolean;
86
-
87
77
  constructor(param: ConfigurationParameters = {}) {
88
78
  this.apiKey = param.apiKey;
89
79
  this.username = param.username;
@@ -92,7 +82,6 @@ export class Configuration {
92
82
  this.basePath = param.basePath;
93
83
  this.baseOptions = param.baseOptions;
94
84
  this.formDataCtor = param.formDataCtor;
95
- this.cookieAuth = param.cookieAuth;
96
85
  }
97
86
 
98
87
  /**
@@ -16,8 +16,6 @@ import { CreateAccountRequestDto } from '../models';
16
16
  import { CreateAccountResponseClass } from '../models';
17
17
  import { GetAccountResponseClass } from '../models';
18
18
  import { ListAccountsResponseClass } from '../models';
19
- import { RegisterAccountPolicyRequestDto } from '../models';
20
- import { RegisterPolicyResponseClass } from '../models';
21
19
  import { UpdateAccountRequestDto } from '../models';
22
20
  import { UpdateAccountResponseClass } from '../models';
23
21
  /**
@@ -78,16 +76,6 @@ export declare const AccountsApiAxiosParamCreator: (configuration?: Configuratio
78
76
  * @throws {RequiredError}
79
77
  */
80
78
  listAccounts: (authorization?: string, pageSize?: number, pageToken?: string, filter?: 'firstName' | 'code' | 'email' | 'createdAt' | 'birthDate' | 'accountNumber' | 'title' | 'lastName' | 'gender' | 'street' | 'houseNumber' | 'zipCode' | 'city' | 'phone' | 'type' | 'companyName' | 'name' | 'partnerCode', search?: string, order?: 'id' | 'firstName' | 'lastName' | 'email' | 'createdAt' | 'accountNumber', expand?: 'policies', filters?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
81
- /**
82
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
83
- * @summary Create the account policy
84
- * @param {string} code Unique identifier for the object.
85
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
86
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
87
- * @param {*} [options] Override http request option.
88
- * @throws {RequiredError}
89
- */
90
- registerPolicy: (code: string, registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
91
79
  /**
92
80
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
93
81
  * @summary Update the account
@@ -157,16 +145,6 @@ export declare const AccountsApiFp: (configuration?: Configuration) => {
157
145
  * @throws {RequiredError}
158
146
  */
159
147
  listAccounts(authorization?: string, pageSize?: number, pageToken?: string, filter?: 'firstName' | 'code' | 'email' | 'createdAt' | 'birthDate' | 'accountNumber' | 'title' | 'lastName' | 'gender' | 'street' | 'houseNumber' | 'zipCode' | 'city' | 'phone' | 'type' | 'companyName' | 'name' | 'partnerCode', search?: string, order?: 'id' | 'firstName' | 'lastName' | 'email' | 'createdAt' | 'accountNumber', expand?: 'policies', filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListAccountsResponseClass>>;
160
- /**
161
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
162
- * @summary Create the account policy
163
- * @param {string} code Unique identifier for the object.
164
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
165
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
166
- * @param {*} [options] Override http request option.
167
- * @throws {RequiredError}
168
- */
169
- registerPolicy(code: string, registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RegisterPolicyResponseClass>>;
170
148
  /**
171
149
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
172
150
  * @summary Update the account
@@ -236,16 +214,6 @@ export declare const AccountsApiFactory: (configuration?: Configuration, basePat
236
214
  * @throws {RequiredError}
237
215
  */
238
216
  listAccounts(authorization?: string, pageSize?: number, pageToken?: string, filter?: 'firstName' | 'code' | 'email' | 'createdAt' | 'birthDate' | 'accountNumber' | 'title' | 'lastName' | 'gender' | 'street' | 'houseNumber' | 'zipCode' | 'city' | 'phone' | 'type' | 'companyName' | 'name' | 'partnerCode', search?: string, order?: 'id' | 'firstName' | 'lastName' | 'email' | 'createdAt' | 'accountNumber', expand?: 'policies', filters?: string, options?: any): AxiosPromise<ListAccountsResponseClass>;
239
- /**
240
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
241
- * @summary Create the account policy
242
- * @param {string} code Unique identifier for the object.
243
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
244
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
245
- * @param {*} [options] Override http request option.
246
- * @throws {RequiredError}
247
- */
248
- registerPolicy(code: string, registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto, authorization?: string, options?: any): AxiosPromise<RegisterPolicyResponseClass>;
249
217
  /**
250
218
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
251
219
  * @summary Update the account
@@ -400,31 +368,6 @@ export interface AccountsApiListAccountsRequest {
400
368
  */
401
369
  readonly filters?: string;
402
370
  }
403
- /**
404
- * Request parameters for registerPolicy operation in AccountsApi.
405
- * @export
406
- * @interface AccountsApiRegisterPolicyRequest
407
- */
408
- export interface AccountsApiRegisterPolicyRequest {
409
- /**
410
- * Unique identifier for the object.
411
- * @type {string}
412
- * @memberof AccountsApiRegisterPolicy
413
- */
414
- readonly code: string;
415
- /**
416
- *
417
- * @type {RegisterAccountPolicyRequestDto}
418
- * @memberof AccountsApiRegisterPolicy
419
- */
420
- readonly registerAccountPolicyRequestDto: RegisterAccountPolicyRequestDto;
421
- /**
422
- * Bearer Token: provided by the login endpoint under the name accessToken.
423
- * @type {string}
424
- * @memberof AccountsApiRegisterPolicy
425
- */
426
- readonly authorization?: string;
427
- }
428
371
  /**
429
372
  * Request parameters for updateAccount operation in AccountsApi.
430
373
  * @export
@@ -502,15 +445,6 @@ export declare class AccountsApi extends BaseAPI {
502
445
  * @memberof AccountsApi
503
446
  */
504
447
  listAccounts(requestParameters?: AccountsApiListAccountsRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListAccountsResponseClass, any, {}>>;
505
- /**
506
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
507
- * @summary Create the account policy
508
- * @param {AccountsApiRegisterPolicyRequest} requestParameters Request parameters.
509
- * @param {*} [options] Override http request option.
510
- * @throws {RequiredError}
511
- * @memberof AccountsApi
512
- */
513
- registerPolicy(requestParameters: AccountsApiRegisterPolicyRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<RegisterPolicyResponseClass, any, {}>>;
514
448
  /**
515
449
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
516
450
  * @summary Update the account
@@ -365,59 +365,6 @@ var AccountsApiAxiosParamCreator = function (configuration) {
365
365
  });
366
366
  });
367
367
  },
368
- /**
369
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
370
- * @summary Create the account policy
371
- * @param {string} code Unique identifier for the object.
372
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
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
- registerPolicy: function (code, registerAccountPolicyRequestDto, authorization, options) {
378
- if (options === void 0) { options = {}; }
379
- return __awaiter(_this, void 0, void 0, function () {
380
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
381
- return __generator(this, function (_a) {
382
- switch (_a.label) {
383
- case 0:
384
- // verify required parameter 'code' is not null or undefined
385
- (0, common_1.assertParamExists)('registerPolicy', 'code', code);
386
- // verify required parameter 'registerAccountPolicyRequestDto' is not null or undefined
387
- (0, common_1.assertParamExists)('registerPolicy', 'registerAccountPolicyRequestDto', registerAccountPolicyRequestDto);
388
- localVarPath = "/accountservice/v1/accounts/{code}/policies"
389
- .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
390
- localVarUrlObj = new URL(localVarPath, common_1.DUMMY_BASE_URL);
391
- if (configuration) {
392
- baseOptions = configuration.baseOptions;
393
- baseAccessToken = configuration.accessToken;
394
- }
395
- localVarRequestOptions = __assign(__assign({ method: 'POST' }, baseOptions), options);
396
- localVarHeaderParameter = {};
397
- localVarQueryParameter = {};
398
- // authentication bearer required
399
- // http bearer authentication required
400
- return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
401
- case 1:
402
- // authentication bearer required
403
- // http bearer authentication required
404
- _a.sent();
405
- if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
406
- localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
407
- }
408
- localVarHeaderParameter['Content-Type'] = 'application/json';
409
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
410
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
411
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
412
- localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(registerAccountPolicyRequestDto, localVarRequestOptions, configuration);
413
- return [2 /*return*/, {
414
- url: (0, common_1.toPathString)(localVarUrlObj),
415
- options: localVarRequestOptions,
416
- }];
417
- }
418
- });
419
- });
420
- },
421
368
  /**
422
369
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
423
370
  * @summary Update the account
@@ -594,28 +541,6 @@ var AccountsApiFp = function (configuration) {
594
541
  });
595
542
  });
596
543
  },
597
- /**
598
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
599
- * @summary Create the account policy
600
- * @param {string} code Unique identifier for the object.
601
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
602
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
603
- * @param {*} [options] Override http request option.
604
- * @throws {RequiredError}
605
- */
606
- registerPolicy: function (code, registerAccountPolicyRequestDto, authorization, options) {
607
- return __awaiter(this, void 0, void 0, function () {
608
- var localVarAxiosArgs;
609
- return __generator(this, function (_a) {
610
- switch (_a.label) {
611
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.registerPolicy(code, registerAccountPolicyRequestDto, authorization, options)];
612
- case 1:
613
- localVarAxiosArgs = _a.sent();
614
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
615
- }
616
- });
617
- });
618
- },
619
544
  /**
620
545
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
621
546
  * @summary Update the account
@@ -711,18 +636,6 @@ var AccountsApiFactory = function (configuration, basePath, axios) {
711
636
  listAccounts: function (authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
712
637
  return localVarFp.listAccounts(authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then(function (request) { return request(axios, basePath); });
713
638
  },
714
- /**
715
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
716
- * @summary Create the account policy
717
- * @param {string} code Unique identifier for the object.
718
- * @param {RegisterAccountPolicyRequestDto} registerAccountPolicyRequestDto
719
- * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
720
- * @param {*} [options] Override http request option.
721
- * @throws {RequiredError}
722
- */
723
- registerPolicy: function (code, registerAccountPolicyRequestDto, authorization, options) {
724
- return localVarFp.registerPolicy(code, registerAccountPolicyRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
725
- },
726
639
  /**
727
640
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
728
641
  * @summary Update the account
@@ -810,18 +723,6 @@ var AccountsApi = /** @class */ (function (_super) {
810
723
  if (requestParameters === void 0) { requestParameters = {}; }
811
724
  return (0, exports.AccountsApiFp)(this.configuration).listAccounts(requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then(function (request) { return request(_this.axios, _this.basePath); });
812
725
  };
813
- /**
814
- * This will register an already existing policy to the account, so that the policy shows up among the account\'s policies. Both the policy code and the policy number must refer to a policy that was created beforehand. **Required Permissions** \"partner-management.partners.create\"
815
- * @summary Create the account policy
816
- * @param {AccountsApiRegisterPolicyRequest} requestParameters Request parameters.
817
- * @param {*} [options] Override http request option.
818
- * @throws {RequiredError}
819
- * @memberof AccountsApi
820
- */
821
- AccountsApi.prototype.registerPolicy = function (requestParameters, options) {
822
- var _this = this;
823
- return (0, exports.AccountsApiFp)(this.configuration).registerPolicy(requestParameters.code, requestParameters.registerAccountPolicyRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
824
- };
825
726
  /**
826
727
  * Updates the specified account by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
827
728
  * @summary Update the account
package/dist/base.d.ts CHANGED
@@ -63,7 +63,6 @@ export declare class BaseAPI {
63
63
  protected configuration: Configuration | undefined;
64
64
  private tokenData?;
65
65
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
66
- private useCookieAuth;
67
66
  selectEnvironment(env: Environment): void;
68
67
  selectBasePath(path: string): void;
69
68
  getPermissions(): Array<string>;
package/dist/base.js CHANGED
@@ -128,15 +128,10 @@ var BaseAPI = /** @class */ (function () {
128
128
  var accessToken = this.tokenData.accessToken;
129
129
  this.configuration = configuration;
130
130
  this.basePath = configuration.basePath || this.basePath;
131
- if (configuration.cookieAuth) {
132
- this.useCookieAuth();
133
- }
134
- else {
135
- // Use config token if provided, otherwise use tokenData token
136
- var configToken = this.configuration.accessToken;
137
- var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
138
- this.configuration.accessToken = configToken || storedToken;
139
- }
131
+ // Use config token if provided, otherwise use tokenData token
132
+ var configToken = this.configuration.accessToken;
133
+ var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
134
+ this.configuration.accessToken = configToken || storedToken;
140
135
  }
141
136
  else {
142
137
  var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
@@ -148,11 +143,6 @@ var BaseAPI = /** @class */ (function () {
148
143
  }
149
144
  this.attachInterceptor(axios);
150
145
  }
151
- // Cookie mode: the browser sends the HttpOnly access cookie, so no token is read from storage.
152
- BaseAPI.prototype.useCookieAuth = function () {
153
- this.configuration.username = this.configuration.username || this.tokenData.username;
154
- this.configuration.baseOptions = __assign(__assign({}, this.configuration.baseOptions), { withCredentials: true });
155
- };
156
146
  BaseAPI.prototype.selectEnvironment = function (env) {
157
147
  this.selectBasePath(env);
158
148
  };
@@ -187,12 +177,10 @@ var BaseAPI = /** @class */ (function () {
187
177
  response = _b.sent();
188
178
  _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
189
179
  this.configuration.username = username;
180
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
190
181
  this.tokenData.username = username;
182
+ this.tokenData.accessToken = accessToken;
191
183
  this.tokenData.permissions = permissions;
192
- if (!this.configuration.cookieAuth) {
193
- this.configuration.accessToken = "Bearer ".concat(accessToken);
194
- this.tokenData.accessToken = accessToken;
195
- }
196
184
  if (!targetWorkspace) return [3 /*break*/, 3];
197
185
  return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
198
186
  case 2:
@@ -218,7 +206,10 @@ var BaseAPI = /** @class */ (function () {
218
206
  options = {
219
207
  method: 'POST',
220
208
  url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
221
- headers: __assign({ 'Content-Type': 'application/json' }, (this.configuration.cookieAuth ? {} : { 'Authorization': "Bearer ".concat(this.configuration.accessToken) })),
209
+ headers: {
210
+ 'Content-Type': 'application/json',
211
+ 'Authorization': "Bearer ".concat(this.configuration.accessToken),
212
+ },
222
213
  data: {
223
214
  username: this.configuration.username,
224
215
  targetWorkspace: targetWorkspace,
@@ -229,11 +220,9 @@ var BaseAPI = /** @class */ (function () {
229
220
  case 1:
230
221
  response = _b.sent();
231
222
  _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
223
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
224
+ this.tokenData.accessToken = accessToken;
232
225
  this.tokenData.permissions = permissions;
233
- if (!this.configuration.cookieAuth) {
234
- this.configuration.accessToken = "Bearer ".concat(accessToken);
235
- this.tokenData.accessToken = accessToken;
236
- }
237
226
  this.storeTokenData(__assign({}, this.tokenData));
238
227
  return [2 /*return*/];
239
228
  }
@@ -276,13 +265,7 @@ var BaseAPI = /** @class */ (function () {
276
265
  });
277
266
  };
278
267
  BaseAPI.prototype.storeTokenData = function (tokenData) {
279
- var _a;
280
268
  if (typeof window !== 'undefined') {
281
- if (tokenData && ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.cookieAuth)) {
282
- // Cookie mode saves who is logged in, never the token; a token saved by apps not yet migrated stays.
283
- var username = tokenData.username, permissions = tokenData.permissions;
284
- tokenData = __assign(__assign({}, ((0, common_1.defaultStorage)().get(TOKEN_DATA) || {})), { username: username, permissions: permissions });
285
- }
286
269
  (0, common_1.defaultStorage)().set(TOKEN_DATA, tokenData);
287
270
  }
288
271
  };
@@ -317,15 +300,12 @@ var BaseAPI = /** @class */ (function () {
317
300
  return [4 /*yield*/, this.refreshTokenInternal()];
318
301
  case 2:
319
302
  _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
303
+ accessToken = "Bearer ".concat(tokenString);
320
304
  this.tokenData.permissions = permissions;
321
305
  delete originalConfig.headers['Authorization'];
322
- // In cookie mode the refresh reply renewed the access cookie, so retry without a header.
323
- if (!this.configuration.cookieAuth) {
324
- accessToken = "Bearer ".concat(tokenString);
325
- originalConfig.headers['Authorization'] = accessToken;
326
- this.configuration.accessToken = accessToken;
327
- this.tokenData.accessToken = tokenString;
328
- }
306
+ originalConfig.headers['Authorization'] = accessToken;
307
+ this.configuration.accessToken = accessToken;
308
+ this.tokenData.accessToken = tokenString;
329
309
  this.storeTokenData(this.tokenData);
330
310
  return [2 /*return*/, axios(originalConfig)];
331
311
  case 3:
@@ -17,7 +17,6 @@ export interface ConfigurationParameters {
17
17
  basePath?: string;
18
18
  baseOptions?: any;
19
19
  formDataCtor?: new () => any;
20
- cookieAuth?: boolean;
21
20
  }
22
21
  export declare class Configuration {
23
22
  /**
@@ -69,14 +68,6 @@ export declare class Configuration {
69
68
  * @type {new () => FormData}
70
69
  */
71
70
  formDataCtor?: new () => any;
72
- /**
73
- * Authenticate with the HttpOnly access cookie instead of a stored token: every call sends credentials.
74
- * The browser holds one cookie, so use it with one logged-in account; log out through the auth service.
75
- *
76
- * @type {boolean}
77
- * @memberof Configuration
78
- */
79
- cookieAuth?: boolean;
80
71
  constructor(param?: ConfigurationParameters);
81
72
  /**
82
73
  * Check if the given MIME is a JSON MIME.
@@ -24,7 +24,6 @@ var Configuration = /** @class */ (function () {
24
24
  this.basePath = param.basePath;
25
25
  this.baseOptions = param.baseOptions;
26
26
  this.formDataCtor = param.formDataCtor;
27
- this.cookieAuth = param.cookieAuth;
28
27
  }
29
28
  /**
30
29
  * Check if the given MIME is a JSON MIME.
@@ -6,7 +6,5 @@ export * from './inline-response200';
6
6
  export * from './inline-response503';
7
7
  export * from './list-accounts-response-class';
8
8
  export * from './policy-class';
9
- export * from './register-account-policy-request-dto';
10
- export * from './register-policy-response-class';
11
9
  export * from './update-account-request-dto';
12
10
  export * from './update-account-response-class';
@@ -22,7 +22,5 @@ __exportStar(require("./inline-response200"), exports);
22
22
  __exportStar(require("./inline-response503"), exports);
23
23
  __exportStar(require("./list-accounts-response-class"), exports);
24
24
  __exportStar(require("./policy-class"), exports);
25
- __exportStar(require("./register-account-policy-request-dto"), exports);
26
- __exportStar(require("./register-policy-response-class"), exports);
27
25
  __exportStar(require("./update-account-request-dto"), exports);
28
26
  __exportStar(require("./update-account-response-class"), exports);
package/models/index.ts CHANGED
@@ -6,7 +6,5 @@ export * from './inline-response200';
6
6
  export * from './inline-response503';
7
7
  export * from './list-accounts-response-class';
8
8
  export * from './policy-class';
9
- export * from './register-account-policy-request-dto';
10
- export * from './register-policy-response-class';
11
9
  export * from './update-account-request-dto';
12
10
  export * from './update-account-response-class';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/account-sdk",
3
- "version": "1.49.1-beta.6",
3
+ "version": "1.49.1-beta.8",
4
4
  "description": "OpenAPI client for @emilgroup/account-sdk",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [
@@ -1,30 +0,0 @@
1
- /**
2
- * EMIL AccountService
3
- * The EMIL AccountService API description
4
- *
5
- * The version of the OpenAPI document: 1.0
6
- * Contact: kontakt@emil.de
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- /**
13
- *
14
- * @export
15
- * @interface RegisterAccountPolicyRequestDto
16
- */
17
- export interface RegisterAccountPolicyRequestDto {
18
- /**
19
- * The policy code that will be registered to the current account
20
- * @type {string}
21
- * @memberof RegisterAccountPolicyRequestDto
22
- */
23
- 'policyCode': string;
24
- /**
25
- * The policy number that will be registered to the current account
26
- * @type {string}
27
- * @memberof RegisterAccountPolicyRequestDto
28
- */
29
- 'policyNumber': string;
30
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * EMIL AccountService
6
- * The EMIL AccountService API description
7
- *
8
- * The version of the OpenAPI document: 1.0
9
- * Contact: kontakt@emil.de
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,25 +0,0 @@
1
- /**
2
- * EMIL AccountService
3
- * The EMIL AccountService API description
4
- *
5
- * The version of the OpenAPI document: 1.0
6
- * Contact: kontakt@emil.de
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import { PolicyClass } from './policy-class';
13
- /**
14
- *
15
- * @export
16
- * @interface RegisterPolicyResponseClass
17
- */
18
- export interface RegisterPolicyResponseClass {
19
- /**
20
- * The policy response.
21
- * @type {PolicyClass}
22
- * @memberof RegisterPolicyResponseClass
23
- */
24
- 'policy': PolicyClass;
25
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * EMIL AccountService
6
- * The EMIL AccountService API description
7
- *
8
- * The version of the OpenAPI document: 1.0
9
- * Contact: kontakt@emil.de
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,36 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * EMIL AccountService
5
- * The EMIL AccountService API description
6
- *
7
- * The version of the OpenAPI document: 1.0
8
- * Contact: kontakt@emil.de
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
-
15
-
16
-
17
- /**
18
- *
19
- * @export
20
- * @interface RegisterAccountPolicyRequestDto
21
- */
22
- export interface RegisterAccountPolicyRequestDto {
23
- /**
24
- * The policy code that will be registered to the current account
25
- * @type {string}
26
- * @memberof RegisterAccountPolicyRequestDto
27
- */
28
- 'policyCode': string;
29
- /**
30
- * The policy number that will be registered to the current account
31
- * @type {string}
32
- * @memberof RegisterAccountPolicyRequestDto
33
- */
34
- 'policyNumber': string;
35
- }
36
-
@@ -1,31 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * EMIL AccountService
5
- * The EMIL AccountService API description
6
- *
7
- * The version of the OpenAPI document: 1.0
8
- * Contact: kontakt@emil.de
9
- *
10
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
- * https://openapi-generator.tech
12
- * Do not edit the class manually.
13
- */
14
-
15
-
16
- import { PolicyClass } from './policy-class';
17
-
18
- /**
19
- *
20
- * @export
21
- * @interface RegisterPolicyResponseClass
22
- */
23
- export interface RegisterPolicyResponseClass {
24
- /**
25
- * The policy response.
26
- * @type {PolicyClass}
27
- * @memberof RegisterPolicyResponseClass
28
- */
29
- 'policy': PolicyClass;
30
- }
31
-