@emilgroup/partner-sdk-node 1.15.1-beta.2 → 1.16.1-beta.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.
@@ -48,6 +48,8 @@ models/list-related-partners-response-class.ts
48
48
  models/list-tags-response-class.ts
49
49
  models/map-partner-to-account-response-class.ts
50
50
  models/mapped-account-from-partner-class.ts
51
+ models/merge-partners-request-dto.ts
52
+ models/merge-partners-response-class.ts
51
53
  models/partner-class.ts
52
54
  models/partner-relation-class.ts
53
55
  models/partner-relation-type-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/partner-sdk-node@1.15.1-beta.2 --save
20
+ npm install @emilgroup/partner-sdk-node@1.16.1-beta.0 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/partner-sdk-node@1.15.1-beta.2
24
+ yarn add @emilgroup/partner-sdk-node@1.16.1-beta.0
25
25
  ```
26
26
 
27
27
  And then you can import `PartnersApi`.
@@ -39,6 +39,10 @@ import { ListRelatedPartnersResponseClass } from '../models';
39
39
  // @ts-ignore
40
40
  import { MapPartnerToAccountResponseClass } from '../models';
41
41
  // @ts-ignore
42
+ import { MergePartnersRequestDto } from '../models';
43
+ // @ts-ignore
44
+ import { MergePartnersResponseClass } from '../models';
45
+ // @ts-ignore
42
46
  import { TagPartnerRequestDtoRest } from '../models';
43
47
  // @ts-ignore
44
48
  import { UpdatePartnerRequestDto } from '../models';
@@ -444,6 +448,57 @@ export const PartnersApiAxiosParamCreator = function (configuration?: Configurat
444
448
  options: localVarRequestOptions,
445
449
  };
446
450
  },
451
+ /**
452
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
453
+ * @summary Update the partner
454
+ * @param {string} code Unique identifier for the object.
455
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
456
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
457
+ * @param {*} [options] Override http request option.
458
+ * @throws {RequiredError}
459
+ */
460
+ mergePartners: async (code: string, mergePartnersRequestDto: MergePartnersRequestDto, authorization?: string, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
461
+ // verify required parameter 'code' is not null or undefined
462
+ assertParamExists('mergePartners', 'code', code)
463
+ // verify required parameter 'mergePartnersRequestDto' is not null or undefined
464
+ assertParamExists('mergePartners', 'mergePartnersRequestDto', mergePartnersRequestDto)
465
+ const localVarPath = `/partnerservice/v1/partners/merger/{code}`
466
+ .replace(`{${"code"}}`, encodeURIComponent(String(code)));
467
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
468
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
469
+ let baseOptions;
470
+ let baseAccessToken;
471
+ if (configuration) {
472
+ baseOptions = configuration.baseOptions;
473
+ baseAccessToken = configuration.accessToken;
474
+ }
475
+
476
+ const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options};
477
+ const localVarHeaderParameter = {} as any;
478
+ const localVarQueryParameter = {} as any;
479
+
480
+ // authentication bearer required
481
+ // http bearer authentication required
482
+ await setBearerAuthToObject(localVarHeaderParameter, configuration)
483
+
484
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
485
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
486
+ }
487
+
488
+
489
+
490
+ localVarHeaderParameter['Content-Type'] = 'application/json';
491
+
492
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
493
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
494
+ localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
495
+ localVarRequestOptions.data = serializeDataIfNeeded(mergePartnersRequestDto, localVarRequestOptions, configuration)
496
+
497
+ return {
498
+ url: toPathString(localVarUrlObj),
499
+ options: localVarRequestOptions,
500
+ };
501
+ },
447
502
  /**
448
503
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
449
504
  * @summary Update the partner
@@ -654,6 +709,19 @@ export const PartnersApiFp = function(configuration?: Configuration) {
654
709
  const localVarAxiosArgs = await localVarAxiosParamCreator.listRelationsForPartner(code, authorization, pageSize, pageToken, filter, search, order, expand, filters, options);
655
710
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
656
711
  },
712
+ /**
713
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
714
+ * @summary Update the partner
715
+ * @param {string} code Unique identifier for the object.
716
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
717
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
718
+ * @param {*} [options] Override http request option.
719
+ * @throws {RequiredError}
720
+ */
721
+ async mergePartners(code: string, mergePartnersRequestDto: MergePartnersRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<MergePartnersResponseClass>> {
722
+ const localVarAxiosArgs = await localVarAxiosParamCreator.mergePartners(code, mergePartnersRequestDto, authorization, options);
723
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
724
+ },
657
725
  /**
658
726
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
659
727
  * @summary Update the partner
@@ -781,6 +849,18 @@ export const PartnersApiFactory = function (configuration?: Configuration, baseP
781
849
  listRelationsForPartner(code: string, authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListRelatedPartnersResponseClass> {
782
850
  return localVarFp.listRelationsForPartner(code, authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then((request) => request(axios, basePath));
783
851
  },
852
+ /**
853
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
854
+ * @summary Update the partner
855
+ * @param {string} code Unique identifier for the object.
856
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
857
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
858
+ * @param {*} [options] Override http request option.
859
+ * @throws {RequiredError}
860
+ */
861
+ mergePartners(code: string, mergePartnersRequestDto: MergePartnersRequestDto, authorization?: string, options?: any): AxiosPromise<MergePartnersResponseClass> {
862
+ return localVarFp.mergePartners(code, mergePartnersRequestDto, authorization, options).then((request) => request(axios, basePath));
863
+ },
784
864
  /**
785
865
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
786
866
  * @summary Update the partner
@@ -1053,6 +1133,34 @@ export interface PartnersApiListRelationsForPartnerRequest {
1053
1133
  readonly filters?: string
1054
1134
  }
1055
1135
 
1136
+ /**
1137
+ * Request parameters for mergePartners operation in PartnersApi.
1138
+ * @export
1139
+ * @interface PartnersApiMergePartnersRequest
1140
+ */
1141
+ export interface PartnersApiMergePartnersRequest {
1142
+ /**
1143
+ * Unique identifier for the object.
1144
+ * @type {string}
1145
+ * @memberof PartnersApiMergePartners
1146
+ */
1147
+ readonly code: string
1148
+
1149
+ /**
1150
+ *
1151
+ * @type {MergePartnersRequestDto}
1152
+ * @memberof PartnersApiMergePartners
1153
+ */
1154
+ readonly mergePartnersRequestDto: MergePartnersRequestDto
1155
+
1156
+ /**
1157
+ * Bearer Token: provided by the login endpoint under the name accessToken.
1158
+ * @type {string}
1159
+ * @memberof PartnersApiMergePartners
1160
+ */
1161
+ readonly authorization?: string
1162
+ }
1163
+
1056
1164
  /**
1057
1165
  * Request parameters for tagPartner operation in PartnersApi.
1058
1166
  * @export
@@ -1200,6 +1308,18 @@ export class PartnersApi extends BaseAPI {
1200
1308
  return PartnersApiFp(this.configuration).listRelationsForPartner(requestParameters.code, requestParameters.authorization, requestParameters.pageSize, requestParameters.pageToken, requestParameters.filter, requestParameters.search, requestParameters.order, requestParameters.expand, requestParameters.filters, options).then((request) => request(this.axios, this.basePath));
1201
1309
  }
1202
1310
 
1311
+ /**
1312
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
1313
+ * @summary Update the partner
1314
+ * @param {PartnersApiMergePartnersRequest} requestParameters Request parameters.
1315
+ * @param {*} [options] Override http request option.
1316
+ * @throws {RequiredError}
1317
+ * @memberof PartnersApi
1318
+ */
1319
+ public mergePartners(requestParameters: PartnersApiMergePartnersRequest, options?: AxiosRequestConfig) {
1320
+ return PartnersApiFp(this.configuration).mergePartners(requestParameters.code, requestParameters.mergePartnersRequestDto, requestParameters.authorization, options).then((request) => request(this.axios, this.basePath));
1321
+ }
1322
+
1203
1323
  /**
1204
1324
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
1205
1325
  * @summary Update the partner
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> {
@@ -21,6 +21,8 @@ import { GetPartnerResponseClass } from '../models';
21
21
  import { ListPartnersResponseClass } from '../models';
22
22
  import { ListRelatedPartnersResponseClass } from '../models';
23
23
  import { MapPartnerToAccountResponseClass } from '../models';
24
+ import { MergePartnersRequestDto } from '../models';
25
+ import { MergePartnersResponseClass } from '../models';
24
26
  import { TagPartnerRequestDtoRest } from '../models';
25
27
  import { UpdatePartnerRequestDto } from '../models';
26
28
  import { UpdatePartnerResponseClass } from '../models';
@@ -106,6 +108,16 @@ export declare const PartnersApiAxiosParamCreator: (configuration?: Configuratio
106
108
  * @throws {RequiredError}
107
109
  */
108
110
  listRelationsForPartner: (code: string, authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
111
+ /**
112
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
113
+ * @summary Update the partner
114
+ * @param {string} code Unique identifier for the object.
115
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
116
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
117
+ * @param {*} [options] Override http request option.
118
+ * @throws {RequiredError}
119
+ */
120
+ mergePartners: (code: string, mergePartnersRequestDto: MergePartnersRequestDto, authorization?: string, options?: AxiosRequestConfig) => Promise<RequestArgs>;
109
121
  /**
110
122
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
111
123
  * @summary Update the partner
@@ -209,6 +221,16 @@ export declare const PartnersApiFp: (configuration?: Configuration) => {
209
221
  * @throws {RequiredError}
210
222
  */
211
223
  listRelationsForPartner(code: string, authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListRelatedPartnersResponseClass>>;
224
+ /**
225
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
226
+ * @summary Update the partner
227
+ * @param {string} code Unique identifier for the object.
228
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
229
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
230
+ * @param {*} [options] Override http request option.
231
+ * @throws {RequiredError}
232
+ */
233
+ mergePartners(code: string, mergePartnersRequestDto: MergePartnersRequestDto, authorization?: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<MergePartnersResponseClass>>;
212
234
  /**
213
235
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
214
236
  * @summary Update the partner
@@ -312,6 +334,16 @@ export declare const PartnersApiFactory: (configuration?: Configuration, basePat
312
334
  * @throws {RequiredError}
313
335
  */
314
336
  listRelationsForPartner(code: string, authorization?: string, pageSize?: number, pageToken?: string, filter?: string, search?: string, order?: string, expand?: string, filters?: string, options?: any): AxiosPromise<ListRelatedPartnersResponseClass>;
337
+ /**
338
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
339
+ * @summary Update the partner
340
+ * @param {string} code Unique identifier for the object.
341
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
342
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
343
+ * @param {*} [options] Override http request option.
344
+ * @throws {RequiredError}
345
+ */
346
+ mergePartners(code: string, mergePartnersRequestDto: MergePartnersRequestDto, authorization?: string, options?: any): AxiosPromise<MergePartnersResponseClass>;
315
347
  /**
316
348
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
317
349
  * @summary Update the partner
@@ -550,6 +582,31 @@ export interface PartnersApiListRelationsForPartnerRequest {
550
582
  */
551
583
  readonly filters?: string;
552
584
  }
585
+ /**
586
+ * Request parameters for mergePartners operation in PartnersApi.
587
+ * @export
588
+ * @interface PartnersApiMergePartnersRequest
589
+ */
590
+ export interface PartnersApiMergePartnersRequest {
591
+ /**
592
+ * Unique identifier for the object.
593
+ * @type {string}
594
+ * @memberof PartnersApiMergePartners
595
+ */
596
+ readonly code: string;
597
+ /**
598
+ *
599
+ * @type {MergePartnersRequestDto}
600
+ * @memberof PartnersApiMergePartners
601
+ */
602
+ readonly mergePartnersRequestDto: MergePartnersRequestDto;
603
+ /**
604
+ * Bearer Token: provided by the login endpoint under the name accessToken.
605
+ * @type {string}
606
+ * @memberof PartnersApiMergePartners
607
+ */
608
+ readonly authorization?: string;
609
+ }
553
610
  /**
554
611
  * Request parameters for tagPartner operation in PartnersApi.
555
612
  * @export
@@ -670,6 +727,15 @@ export declare class PartnersApi extends BaseAPI {
670
727
  * @memberof PartnersApi
671
728
  */
672
729
  listRelationsForPartner(requestParameters: PartnersApiListRelationsForPartnerRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<ListRelatedPartnersResponseClass, any>>;
730
+ /**
731
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
732
+ * @summary Update the partner
733
+ * @param {PartnersApiMergePartnersRequest} requestParameters Request parameters.
734
+ * @param {*} [options] Override http request option.
735
+ * @throws {RequiredError}
736
+ * @memberof PartnersApi
737
+ */
738
+ mergePartners(requestParameters: PartnersApiMergePartnersRequest, options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<MergePartnersResponseClass, any>>;
673
739
  /**
674
740
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
675
741
  * @summary Update the partner
@@ -490,6 +490,59 @@ var PartnersApiAxiosParamCreator = function (configuration) {
490
490
  });
491
491
  });
492
492
  },
493
+ /**
494
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
495
+ * @summary Update the partner
496
+ * @param {string} code Unique identifier for the object.
497
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
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
+ mergePartners: function (code, mergePartnersRequestDto, authorization, options) {
503
+ if (options === void 0) { options = {}; }
504
+ return __awaiter(_this, void 0, void 0, function () {
505
+ var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
506
+ return __generator(this, function (_a) {
507
+ switch (_a.label) {
508
+ case 0:
509
+ // verify required parameter 'code' is not null or undefined
510
+ (0, common_1.assertParamExists)('mergePartners', 'code', code);
511
+ // verify required parameter 'mergePartnersRequestDto' is not null or undefined
512
+ (0, common_1.assertParamExists)('mergePartners', 'mergePartnersRequestDto', mergePartnersRequestDto);
513
+ localVarPath = "/partnerservice/v1/partners/merger/{code}"
514
+ .replace("{".concat("code", "}"), encodeURIComponent(String(code)));
515
+ localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
516
+ if (configuration) {
517
+ baseOptions = configuration.baseOptions;
518
+ baseAccessToken = configuration.accessToken;
519
+ }
520
+ localVarRequestOptions = __assign(__assign({ method: 'PUT' }, baseOptions), options);
521
+ localVarHeaderParameter = {};
522
+ localVarQueryParameter = {};
523
+ // authentication bearer required
524
+ // http bearer authentication required
525
+ return [4 /*yield*/, (0, common_1.setBearerAuthToObject)(localVarHeaderParameter, configuration)];
526
+ case 1:
527
+ // authentication bearer required
528
+ // http bearer authentication required
529
+ _a.sent();
530
+ if (authorization !== undefined && authorization !== null || baseAccessToken !== undefined && baseAccessToken !== null) {
531
+ localVarHeaderParameter['Authorization'] = String(authorization ? authorization : baseAccessToken);
532
+ }
533
+ localVarHeaderParameter['Content-Type'] = 'application/json';
534
+ (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
535
+ headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
536
+ localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
537
+ localVarRequestOptions.data = (0, common_1.serializeDataIfNeeded)(mergePartnersRequestDto, localVarRequestOptions, configuration);
538
+ return [2 /*return*/, {
539
+ url: (0, common_1.toPathString)(localVarUrlObj),
540
+ options: localVarRequestOptions,
541
+ }];
542
+ }
543
+ });
544
+ });
545
+ },
493
546
  /**
494
547
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
495
548
  * @summary Update the partner
@@ -767,6 +820,28 @@ var PartnersApiFp = function (configuration) {
767
820
  });
768
821
  });
769
822
  },
823
+ /**
824
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
825
+ * @summary Update the partner
826
+ * @param {string} code Unique identifier for the object.
827
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
828
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
829
+ * @param {*} [options] Override http request option.
830
+ * @throws {RequiredError}
831
+ */
832
+ mergePartners: function (code, mergePartnersRequestDto, authorization, options) {
833
+ return __awaiter(this, void 0, void 0, function () {
834
+ var localVarAxiosArgs;
835
+ return __generator(this, function (_a) {
836
+ switch (_a.label) {
837
+ case 0: return [4 /*yield*/, localVarAxiosParamCreator.mergePartners(code, mergePartnersRequestDto, authorization, options)];
838
+ case 1:
839
+ localVarAxiosArgs = _a.sent();
840
+ return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
841
+ }
842
+ });
843
+ });
844
+ },
770
845
  /**
771
846
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
772
847
  * @summary Update the partner
@@ -912,6 +987,18 @@ var PartnersApiFactory = function (configuration, basePath, axios) {
912
987
  listRelationsForPartner: function (code, authorization, pageSize, pageToken, filter, search, order, expand, filters, options) {
913
988
  return localVarFp.listRelationsForPartner(code, authorization, pageSize, pageToken, filter, search, order, expand, filters, options).then(function (request) { return request(axios, basePath); });
914
989
  },
990
+ /**
991
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
992
+ * @summary Update the partner
993
+ * @param {string} code Unique identifier for the object.
994
+ * @param {MergePartnersRequestDto} mergePartnersRequestDto
995
+ * @param {string} [authorization] Bearer Token: provided by the login endpoint under the name accessToken.
996
+ * @param {*} [options] Override http request option.
997
+ * @throws {RequiredError}
998
+ */
999
+ mergePartners: function (code, mergePartnersRequestDto, authorization, options) {
1000
+ return localVarFp.mergePartners(code, mergePartnersRequestDto, authorization, options).then(function (request) { return request(axios, basePath); });
1001
+ },
915
1002
  /**
916
1003
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
917
1004
  * @summary Update the partner
@@ -1035,6 +1122,18 @@ var PartnersApi = /** @class */ (function (_super) {
1035
1122
  var _this = this;
1036
1123
  return (0, exports.PartnersApiFp)(this.configuration).listRelationsForPartner(requestParameters.code, 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); });
1037
1124
  };
1125
+ /**
1126
+ * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\", \"partner-management.partners.delete\"
1127
+ * @summary Update the partner
1128
+ * @param {PartnersApiMergePartnersRequest} requestParameters Request parameters.
1129
+ * @param {*} [options] Override http request option.
1130
+ * @throws {RequiredError}
1131
+ * @memberof PartnersApi
1132
+ */
1133
+ PartnersApi.prototype.mergePartners = function (requestParameters, options) {
1134
+ var _this = this;
1135
+ return (0, exports.PartnersApiFp)(this.configuration).mergePartners(requestParameters.code, requestParameters.mergePartnersRequestDto, requestParameters.authorization, options).then(function (request) { return request(_this.axios, _this.basePath); });
1136
+ };
1038
1137
  /**
1039
1138
  * Updates the specified partner by setting the values of the parameters passed. Any parameters not provided will be left unchanged. **Required Permissions** \"partner-management.partners.update\"
1040
1139
  * @summary Update the partner
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
  });
@@ -30,6 +30,8 @@ export * from './list-related-partners-response-class';
30
30
  export * from './list-tags-response-class';
31
31
  export * from './map-partner-to-account-response-class';
32
32
  export * from './mapped-account-from-partner-class';
33
+ export * from './merge-partners-request-dto';
34
+ export * from './merge-partners-response-class';
33
35
  export * from './partner-class';
34
36
  export * from './partner-relation-class';
35
37
  export * from './partner-relation-type-class';
@@ -46,6 +46,8 @@ __exportStar(require("./list-related-partners-response-class"), exports);
46
46
  __exportStar(require("./list-tags-response-class"), exports);
47
47
  __exportStar(require("./map-partner-to-account-response-class"), exports);
48
48
  __exportStar(require("./mapped-account-from-partner-class"), exports);
49
+ __exportStar(require("./merge-partners-request-dto"), exports);
50
+ __exportStar(require("./merge-partners-response-class"), exports);
49
51
  __exportStar(require("./partner-class"), exports);
50
52
  __exportStar(require("./partner-relation-class"), exports);
51
53
  __exportStar(require("./partner-relation-type-class"), exports);
@@ -0,0 +1,36 @@
1
+ /**
2
+ * EMIL PartnerService
3
+ * The EMIL PartnerService 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 MergePartnersRequestDto
16
+ */
17
+ export interface MergePartnersRequestDto {
18
+ /**
19
+ * Unique identifier for the object.
20
+ * @type {Array<string>}
21
+ * @memberof MergePartnersRequestDto
22
+ */
23
+ 'partnerToDeleteCodes': Array<string>;
24
+ /**
25
+ * The custom fields object, based on partner schema.
26
+ * @type {object}
27
+ * @memberof MergePartnersRequestDto
28
+ */
29
+ 'customFields': object;
30
+ /**
31
+ * User selected list of partner relations identifiers
32
+ * @type {Array<number>}
33
+ * @memberof MergePartnersRequestDto
34
+ */
35
+ 'relationsIds': Array<number>;
36
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL PartnerService
6
+ * The EMIL PartnerService 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 });
@@ -0,0 +1,25 @@
1
+ /**
2
+ * EMIL PartnerService
3
+ * The EMIL PartnerService 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 { PartnerClass } from './partner-class';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface MergePartnersResponseClass
17
+ */
18
+ export interface MergePartnersResponseClass {
19
+ /**
20
+ * The partner response.
21
+ * @type {PartnerClass}
22
+ * @memberof MergePartnersResponseClass
23
+ */
24
+ 'partner': PartnerClass;
25
+ }
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL PartnerService
6
+ * The EMIL PartnerService 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 });
package/models/index.ts CHANGED
@@ -30,6 +30,8 @@ export * from './list-related-partners-response-class';
30
30
  export * from './list-tags-response-class';
31
31
  export * from './map-partner-to-account-response-class';
32
32
  export * from './mapped-account-from-partner-class';
33
+ export * from './merge-partners-request-dto';
34
+ export * from './merge-partners-response-class';
33
35
  export * from './partner-class';
34
36
  export * from './partner-relation-class';
35
37
  export * from './partner-relation-type-class';
@@ -0,0 +1,42 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL PartnerService
5
+ * The EMIL PartnerService 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 MergePartnersRequestDto
21
+ */
22
+ export interface MergePartnersRequestDto {
23
+ /**
24
+ * Unique identifier for the object.
25
+ * @type {Array<string>}
26
+ * @memberof MergePartnersRequestDto
27
+ */
28
+ 'partnerToDeleteCodes': Array<string>;
29
+ /**
30
+ * The custom fields object, based on partner schema.
31
+ * @type {object}
32
+ * @memberof MergePartnersRequestDto
33
+ */
34
+ 'customFields': object;
35
+ /**
36
+ * User selected list of partner relations identifiers
37
+ * @type {Array<number>}
38
+ * @memberof MergePartnersRequestDto
39
+ */
40
+ 'relationsIds': Array<number>;
41
+ }
42
+
@@ -0,0 +1,31 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL PartnerService
5
+ * The EMIL PartnerService 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 { PartnerClass } from './partner-class';
17
+
18
+ /**
19
+ *
20
+ * @export
21
+ * @interface MergePartnersResponseClass
22
+ */
23
+ export interface MergePartnersResponseClass {
24
+ /**
25
+ * The partner response.
26
+ * @type {PartnerClass}
27
+ * @memberof MergePartnersResponseClass
28
+ */
29
+ 'partner': PartnerClass;
30
+ }
31
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/partner-sdk-node",
3
- "version": "1.15.1-beta.2",
3
+ "version": "1.16.1-beta.0",
4
4
  "description": "OpenAPI client for @emilgroup/partner-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [