@emilgroup/claim-sdk-node 1.35.1-beta.4 → 1.35.1-beta.6

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.
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/claim-sdk-node@1.35.1-beta.4 --save
20
+ npm install @emilgroup/claim-sdk-node@1.35.1-beta.6 --save
21
21
  ```
22
22
  or
23
23
  ```
24
- yarn add @emilgroup/claim-sdk-node@1.35.1-beta.4
24
+ yarn add @emilgroup/claim-sdk-node@1.35.1-beta.6
25
25
  ```
26
26
 
27
27
  And then you can import `ClaimsApi`.
@@ -57,38 +57,6 @@ export const HealthCheckApiAxiosParamCreator = function (configuration?: Configu
57
57
 
58
58
 
59
59
 
60
- setSearchParams(localVarUrlObj, localVarQueryParameter);
61
- let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
62
- localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
63
-
64
- return {
65
- url: toPathString(localVarUrlObj),
66
- options: localVarRequestOptions,
67
- };
68
- },
69
- /**
70
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
71
- * @summary Health Check
72
- * @param {*} [options] Override http request option.
73
- * @throws {RequiredError}
74
- */
75
- check_1: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
76
- const localVarPath = `/v1/claims/health`;
77
- // use dummy base URL string because the URL constructor only accepts absolute URLs.
78
- const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
79
- let baseOptions;
80
- let baseAccessToken;
81
- if (configuration) {
82
- baseOptions = configuration.baseOptions;
83
- baseAccessToken = configuration.accessToken;
84
- }
85
-
86
- const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
87
- const localVarHeaderParameter = {} as any;
88
- const localVarQueryParameter = {} as any;
89
-
90
-
91
-
92
60
  setSearchParams(localVarUrlObj, localVarQueryParameter);
93
61
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
94
62
  localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
@@ -118,16 +86,6 @@ export const HealthCheckApiFp = function(configuration?: Configuration) {
118
86
  const localVarAxiosArgs = await localVarAxiosParamCreator.check(options);
119
87
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
120
88
  },
121
- /**
122
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
123
- * @summary Health Check
124
- * @param {*} [options] Override http request option.
125
- * @throws {RequiredError}
126
- */
127
- async check_1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse200>> {
128
- const localVarAxiosArgs = await localVarAxiosParamCreator.check_1(options);
129
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
130
- },
131
89
  }
132
90
  };
133
91
 
@@ -147,15 +105,6 @@ export const HealthCheckApiFactory = function (configuration?: Configuration, ba
147
105
  check(options?: any): AxiosPromise<InlineResponse200> {
148
106
  return localVarFp.check(options).then((request) => request(axios, basePath));
149
107
  },
150
- /**
151
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
152
- * @summary Health Check
153
- * @param {*} [options] Override http request option.
154
- * @throws {RequiredError}
155
- */
156
- check_1(options?: any): AxiosPromise<InlineResponse200> {
157
- return localVarFp.check_1(options).then((request) => request(axios, basePath));
158
- },
159
108
  };
160
109
  };
161
110
 
@@ -176,15 +125,4 @@ export class HealthCheckApi extends BaseAPI {
176
125
  public check(options?: AxiosRequestConfig) {
177
126
  return HealthCheckApiFp(this.configuration).check(options).then((request) => request(this.axios, this.basePath));
178
127
  }
179
-
180
- /**
181
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
182
- * @summary Health Check
183
- * @param {*} [options] Override http request option.
184
- * @throws {RequiredError}
185
- * @memberof HealthCheckApi
186
- */
187
- public check_1(options?: AxiosRequestConfig) {
188
- return HealthCheckApiFp(this.configuration).check_1(options).then((request) => request(this.axios, this.basePath));
189
- }
190
128
  }
package/base.ts CHANGED
@@ -44,6 +44,16 @@ export interface LoginClass {
44
44
  permissions: string;
45
45
  }
46
46
 
47
+ export interface SwitchWorkspaceRequest {
48
+ username: string;
49
+ targetWorkspace: string;
50
+ }
51
+
52
+ export interface SwitchWorkspaceResponseClass {
53
+ accessToken: string;
54
+ permissions: string;
55
+ }
56
+
47
57
  export enum Environment {
48
58
  Production = 'https://apiv2.emil.de',
49
59
  Test = 'https://apiv2-test.emil.de',
@@ -94,13 +104,13 @@ export class BaseAPI {
94
104
  this.attachInterceptor(axios);
95
105
  }
96
106
 
97
- async initialize(env: Environment = Environment.Production) {
107
+ async initialize(env: Environment = Environment.Production, targetWorkspace?: string) {
98
108
  this.configuration.basePath = env;
99
109
 
100
110
  await this.loadCredentials();
101
111
 
102
112
  if (this.username) {
103
- await this.authorize(this.username, this.password);
113
+ await this.authorize(this.username, this.password, targetWorkspace);
104
114
  this.password = null; // to avoid keeping password loaded in memory.
105
115
  }
106
116
  }
@@ -150,7 +160,7 @@ export class BaseAPI {
150
160
  this.configuration.basePath = env;
151
161
  }
152
162
 
153
- async authorize(username: string, password: string): Promise<void> {
163
+ async authorize(username: string, password: string, targetWorkspace?: string): Promise<void> {
154
164
  const options: AxiosRequestConfig = {
155
165
  method: 'POST',
156
166
  url: `${this.configuration.basePath}/authservice/v1/login`,
@@ -170,6 +180,38 @@ export class BaseAPI {
170
180
 
171
181
  const refreshToken = this.extractRefreshToken(response)
172
182
  this.configuration.refreshToken = refreshToken;
183
+
184
+ // Switch workspace if provided
185
+ if (targetWorkspace) {
186
+ await this.switchWorkspace(targetWorkspace);
187
+ }
188
+ }
189
+
190
+ async switchWorkspace(targetWorkspace: string): Promise<void> {
191
+ const options: AxiosRequestConfig = {
192
+ method: 'POST',
193
+ url: `${this.configuration.basePath}/authservice/v1/workspaces/switch`,
194
+ headers: {
195
+ 'Content-Type': 'application/json',
196
+ 'Authorization': `Bearer ${this.configuration.accessToken}`,
197
+ 'Cookie': this.configuration.refreshToken,
198
+ },
199
+ data: {
200
+ username: this.configuration.username,
201
+ targetWorkspace,
202
+ } as SwitchWorkspaceRequest,
203
+ withCredentials: true,
204
+ };
205
+
206
+ const response = await globalAxios.request<SwitchWorkspaceResponseClass>(options);
207
+
208
+ const { data: { accessToken } } = response;
209
+ this.configuration.accessToken = `Bearer ${accessToken}`;
210
+
211
+ const refreshToken = this.extractRefreshToken(response);
212
+ if (refreshToken) {
213
+ this.configuration.refreshToken = refreshToken;
214
+ }
173
215
  }
174
216
 
175
217
  async refreshTokenInternal(): Promise<string> {
@@ -25,13 +25,6 @@ export declare const HealthCheckApiAxiosParamCreator: (configuration?: Configura
25
25
  * @throws {RequiredError}
26
26
  */
27
27
  check: (options?: AxiosRequestConfig) => Promise<RequestArgs>;
28
- /**
29
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
30
- * @summary Health Check
31
- * @param {*} [options] Override http request option.
32
- * @throws {RequiredError}
33
- */
34
- check_1: (options?: AxiosRequestConfig) => Promise<RequestArgs>;
35
28
  };
36
29
  /**
37
30
  * HealthCheckApi - functional programming interface
@@ -45,13 +38,6 @@ export declare const HealthCheckApiFp: (configuration?: Configuration) => {
45
38
  * @throws {RequiredError}
46
39
  */
47
40
  check(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse200>>;
48
- /**
49
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
50
- * @summary Health Check
51
- * @param {*} [options] Override http request option.
52
- * @throws {RequiredError}
53
- */
54
- check_1(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<InlineResponse200>>;
55
41
  };
56
42
  /**
57
43
  * HealthCheckApi - factory interface
@@ -65,13 +51,6 @@ export declare const HealthCheckApiFactory: (configuration?: Configuration, base
65
51
  * @throws {RequiredError}
66
52
  */
67
53
  check(options?: any): AxiosPromise<InlineResponse200>;
68
- /**
69
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
70
- * @summary Health Check
71
- * @param {*} [options] Override http request option.
72
- * @throws {RequiredError}
73
- */
74
- check_1(options?: any): AxiosPromise<InlineResponse200>;
75
54
  };
76
55
  /**
77
56
  * HealthCheckApi - object-oriented interface
@@ -88,12 +67,4 @@ export declare class HealthCheckApi extends BaseAPI {
88
67
  * @memberof HealthCheckApi
89
68
  */
90
69
  check(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<InlineResponse200, any>>;
91
- /**
92
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
93
- * @summary Health Check
94
- * @param {*} [options] Override http request option.
95
- * @throws {RequiredError}
96
- * @memberof HealthCheckApi
97
- */
98
- check_1(options?: AxiosRequestConfig): Promise<import("axios").AxiosResponse<InlineResponse200, any>>;
99
70
  }
@@ -126,36 +126,6 @@ var HealthCheckApiAxiosParamCreator = function (configuration) {
126
126
  });
127
127
  });
128
128
  },
129
- /**
130
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
131
- * @summary Health Check
132
- * @param {*} [options] Override http request option.
133
- * @throws {RequiredError}
134
- */
135
- check_1: function (options) {
136
- if (options === void 0) { options = {}; }
137
- return __awaiter(_this, void 0, void 0, function () {
138
- var localVarPath, localVarUrlObj, baseOptions, baseAccessToken, localVarRequestOptions, localVarHeaderParameter, localVarQueryParameter, headersFromBaseOptions;
139
- return __generator(this, function (_a) {
140
- localVarPath = "/v1/claims/health";
141
- localVarUrlObj = new url_1.URL(localVarPath, common_1.DUMMY_BASE_URL);
142
- if (configuration) {
143
- baseOptions = configuration.baseOptions;
144
- baseAccessToken = configuration.accessToken;
145
- }
146
- localVarRequestOptions = __assign(__assign({ method: 'GET' }, baseOptions), options);
147
- localVarHeaderParameter = {};
148
- localVarQueryParameter = {};
149
- (0, common_1.setSearchParams)(localVarUrlObj, localVarQueryParameter);
150
- headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
151
- localVarRequestOptions.headers = __assign(__assign(__assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
152
- return [2 /*return*/, {
153
- url: (0, common_1.toPathString)(localVarUrlObj),
154
- options: localVarRequestOptions,
155
- }];
156
- });
157
- });
158
- },
159
129
  };
160
130
  };
161
131
  exports.HealthCheckApiAxiosParamCreator = HealthCheckApiAxiosParamCreator;
@@ -185,25 +155,6 @@ var HealthCheckApiFp = function (configuration) {
185
155
  });
186
156
  });
187
157
  },
188
- /**
189
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
190
- * @summary Health Check
191
- * @param {*} [options] Override http request option.
192
- * @throws {RequiredError}
193
- */
194
- check_1: function (options) {
195
- return __awaiter(this, void 0, void 0, function () {
196
- var localVarAxiosArgs;
197
- return __generator(this, function (_a) {
198
- switch (_a.label) {
199
- case 0: return [4 /*yield*/, localVarAxiosParamCreator.check_1(options)];
200
- case 1:
201
- localVarAxiosArgs = _a.sent();
202
- return [2 /*return*/, (0, common_1.createRequestFunction)(localVarAxiosArgs, axios_1.default, base_1.BASE_PATH, configuration)];
203
- }
204
- });
205
- });
206
- },
207
158
  };
208
159
  };
209
160
  exports.HealthCheckApiFp = HealthCheckApiFp;
@@ -223,15 +174,6 @@ var HealthCheckApiFactory = function (configuration, basePath, axios) {
223
174
  check: function (options) {
224
175
  return localVarFp.check(options).then(function (request) { return request(axios, basePath); });
225
176
  },
226
- /**
227
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
228
- * @summary Health Check
229
- * @param {*} [options] Override http request option.
230
- * @throws {RequiredError}
231
- */
232
- check_1: function (options) {
233
- return localVarFp.check_1(options).then(function (request) { return request(axios, basePath); });
234
- },
235
177
  };
236
178
  };
237
179
  exports.HealthCheckApiFactory = HealthCheckApiFactory;
@@ -257,17 +199,6 @@ var HealthCheckApi = /** @class */ (function (_super) {
257
199
  var _this = this;
258
200
  return (0, exports.HealthCheckApiFp)(this.configuration).check(options).then(function (request) { return request(_this.axios, _this.basePath); });
259
201
  };
260
- /**
261
- * Returns the health status of the claim service. This endpoint is used to monitor the operational status of the claim service. It typically returns a simple status indicator, such as \'UP\' or \'OK\', confirming that the service is operational and available.
262
- * @summary Health Check
263
- * @param {*} [options] Override http request option.
264
- * @throws {RequiredError}
265
- * @memberof HealthCheckApi
266
- */
267
- HealthCheckApi.prototype.check_1 = function (options) {
268
- var _this = this;
269
- return (0, exports.HealthCheckApiFp)(this.configuration).check_1(options).then(function (request) { return request(_this.axios, _this.basePath); });
270
- };
271
202
  return HealthCheckApi;
272
203
  }(base_1.BaseAPI));
273
204
  exports.HealthCheckApi = HealthCheckApi;
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emilgroup/claim-sdk-node",
3
- "version": "1.35.1-beta.4",
3
+ "version": "1.35.1-beta.6",
4
4
  "description": "OpenAPI client for @emilgroup/claim-sdk-node",
5
5
  "author": "OpenAPI-Generator Contributors",
6
6
  "keywords": [