@emilgroup/translation-sdk 1.1.0 → 1.1.1-beta.11

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/dist/base.d.ts CHANGED
@@ -24,12 +24,22 @@ export declare const COLLECTION_FORMATS: {
24
24
  };
25
25
  export interface LoginClass {
26
26
  accessToken: string;
27
- permissions: Array<string>;
27
+ permissions: string;
28
+ }
29
+ export interface SwitchWorkspaceRequest {
30
+ username: string;
31
+ targetWorkspace: string;
32
+ }
33
+ export interface SwitchWorkspaceResponseClass {
34
+ accessToken: string;
35
+ permissions: string;
28
36
  }
29
37
  export declare enum Environment {
30
38
  Production = "https://apiv2.emil.de",
31
39
  Test = "https://apiv2-test.emil.de",
32
- Development = "https://apiv2-dev.emil.de"
40
+ Staging = "https://apiv2-staging.emil.de",
41
+ Development = "https://apiv2-dev.emil.de",
42
+ ProductionZurich = "https://eu-central-2.apiv2.emil.de"
33
43
  }
34
44
  export declare function resetRetry(): void;
35
45
  /**
@@ -49,19 +59,18 @@ export interface RequestArgs {
49
59
  export declare class BaseAPI {
50
60
  protected basePath: string;
51
61
  protected axios: AxiosInstance;
52
- protected configuration: Configuration;
53
- private username?;
54
- private password?;
62
+ protected configuration: Configuration | undefined;
63
+ private tokenData?;
55
64
  constructor(configuration?: Configuration, basePath?: string, axios?: AxiosInstance);
56
- initialize(env?: Environment): Promise<void>;
57
- private loadCredentials;
58
- private readConfigFile;
59
- private readEnvVariables;
60
65
  selectEnvironment(env: Environment): void;
61
- authorize(username: string, password: string): Promise<void>;
62
- refreshTokenInternal(): Promise<string>;
63
- private extractRefreshToken;
64
- getConfiguration(): Configuration;
66
+ selectBasePath(path: string): void;
67
+ getPermissions(): Array<string>;
68
+ authorize(username: string, password: string, targetWorkspace?: string): Promise<void>;
69
+ switchWorkspace(targetWorkspace: string): Promise<void>;
70
+ refreshTokenInternal(): Promise<LoginClass>;
71
+ private storeTokenData;
72
+ loadTokenData(): void;
73
+ cleanTokenData(): void;
65
74
  private attachInterceptor;
66
75
  }
67
76
  /**
package/dist/base.js CHANGED
@@ -38,29 +38,6 @@ var __assign = (this && this.__assign) || function () {
38
38
  };
39
39
  return __assign.apply(this, arguments);
40
40
  };
41
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
42
- if (k2 === undefined) k2 = k;
43
- var desc = Object.getOwnPropertyDescriptor(m, k);
44
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
45
- desc = { enumerable: true, get: function() { return m[k]; } };
46
- }
47
- Object.defineProperty(o, k2, desc);
48
- }) : (function(o, m, k, k2) {
49
- if (k2 === undefined) k2 = k;
50
- o[k2] = m[k];
51
- }));
52
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
53
- Object.defineProperty(o, "default", { enumerable: true, value: v });
54
- }) : function(o, v) {
55
- o["default"] = v;
56
- });
57
- var __importStar = (this && this.__importStar) || function (mod) {
58
- if (mod && mod.__esModule) return mod;
59
- var result = {};
60
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
61
- __setModuleDefault(result, mod);
62
- return result;
63
- };
64
41
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
65
42
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66
43
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -103,18 +80,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
103
80
  Object.defineProperty(exports, "__esModule", { value: true });
104
81
  exports.RequiredError = exports.BaseAPI = exports.resetRetry = exports.Environment = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
105
82
  var configuration_1 = require("./configuration");
83
+ var common_1 = require("./common");
106
84
  // Some imports not used depending on template conditions
107
85
  // @ts-ignore
108
86
  var axios_1 = __importDefault(require("axios"));
109
- var fs = __importStar(require("fs"));
110
- var path = __importStar(require("path"));
111
- var os = __importStar(require("os"));
112
87
  exports.BASE_PATH = "https://apiv2.emil.de".replace(/\/+$/, "");
113
- var CONFIG_DIRECTORY = '.emil';
114
- var CONFIG_FILENAME = 'credentials';
115
- var KEY_USERNAME = 'emil_username';
116
- var KEY_PASSWORD = 'emil_password';
117
- var filePath = os.homedir() + path.sep + CONFIG_DIRECTORY + path.sep + CONFIG_FILENAME;
118
88
  /**
119
89
  *
120
90
  * @export
@@ -129,7 +99,9 @@ var Environment;
129
99
  (function (Environment) {
130
100
  Environment["Production"] = "https://apiv2.emil.de";
131
101
  Environment["Test"] = "https://apiv2-test.emil.de";
102
+ Environment["Staging"] = "https://apiv2-staging.emil.de";
132
103
  Environment["Development"] = "https://apiv2-dev.emil.de";
104
+ Environment["ProductionZurich"] = "https://eu-central-2.apiv2.emil.de";
133
105
  })(Environment = exports.Environment || (exports.Environment = {}));
134
106
  var _retry_count = 0;
135
107
  var _retry = null;
@@ -138,6 +110,7 @@ function resetRetry() {
138
110
  }
139
111
  exports.resetRetry = resetRetry;
140
112
  var NETWORK_ERROR_MESSAGE = "Network Error";
113
+ var TOKEN_DATA = 'APP_TOKEN';
141
114
  /**
142
115
  *
143
116
  * @export
@@ -149,122 +122,107 @@ var BaseAPI = /** @class */ (function () {
149
122
  if (axios === void 0) { axios = axios_1.default; }
150
123
  this.basePath = basePath;
151
124
  this.axios = axios;
125
+ this.loadTokenData();
152
126
  if (configuration) {
127
+ var accessToken = this.tokenData.accessToken;
153
128
  this.configuration = configuration;
154
129
  this.basePath = configuration.basePath || this.basePath;
130
+ // Use config token if provided, otherwise use tokenData token
131
+ var configToken = this.configuration.accessToken;
132
+ var storedToken = accessToken ? "Bearer ".concat(accessToken) : '';
133
+ this.configuration.accessToken = configToken || storedToken;
155
134
  }
156
135
  else {
136
+ var _a = this.tokenData, accessToken = _a.accessToken, username = _a.username;
157
137
  this.configuration = new configuration_1.Configuration({
158
138
  basePath: this.basePath,
139
+ accessToken: accessToken ? "Bearer ".concat(accessToken) : '',
140
+ username: username,
159
141
  });
160
142
  }
161
143
  this.attachInterceptor(axios);
162
144
  }
163
- BaseAPI.prototype.initialize = function (env) {
164
- if (env === void 0) { env = Environment.Production; }
165
- return __awaiter(this, void 0, void 0, function () {
166
- return __generator(this, function (_a) {
167
- switch (_a.label) {
168
- case 0:
169
- this.configuration.basePath = env;
170
- return [4 /*yield*/, this.loadCredentials()];
171
- case 1:
172
- _a.sent();
173
- if (!this.username) return [3 /*break*/, 3];
174
- return [4 /*yield*/, this.authorize(this.username, this.password)];
175
- case 2:
176
- _a.sent();
177
- this.password = null; // to avoid keeping password loaded in memory.
178
- _a.label = 3;
179
- case 3: return [2 /*return*/];
180
- }
181
- });
182
- });
145
+ BaseAPI.prototype.selectEnvironment = function (env) {
146
+ this.selectBasePath(env);
147
+ };
148
+ BaseAPI.prototype.selectBasePath = function (path) {
149
+ this.configuration.basePath = path;
150
+ };
151
+ BaseAPI.prototype.getPermissions = function () {
152
+ var _a;
153
+ if (!((_a = this.tokenData) === null || _a === void 0 ? void 0 : _a.permissions)) {
154
+ return [];
155
+ }
156
+ return this.tokenData.permissions.split(',');
183
157
  };
184
- BaseAPI.prototype.loadCredentials = function () {
158
+ BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
185
159
  return __awaiter(this, void 0, void 0, function () {
186
- var error_1;
187
- return __generator(this, function (_a) {
188
- switch (_a.label) {
160
+ var options, response, _a, accessToken, permissions;
161
+ return __generator(this, function (_b) {
162
+ switch (_b.label) {
189
163
  case 0:
190
- _a.trys.push([0, 2, , 3]);
191
- return [4 /*yield*/, this.readConfigFile()];
164
+ options = {
165
+ method: 'POST',
166
+ url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
167
+ headers: { 'Content-Type': 'application/json' },
168
+ data: {
169
+ username: username,
170
+ password: password,
171
+ },
172
+ withCredentials: true,
173
+ };
174
+ return [4 /*yield*/, axios_1.default.request(options)];
192
175
  case 1:
193
- _a.sent();
194
- return [3 /*break*/, 3];
176
+ response = _b.sent();
177
+ _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
178
+ this.configuration.username = username;
179
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
180
+ this.tokenData.username = username;
181
+ this.tokenData.accessToken = accessToken;
182
+ this.tokenData.permissions = permissions;
183
+ if (!targetWorkspace) return [3 /*break*/, 3];
184
+ return [4 /*yield*/, this.switchWorkspace(targetWorkspace)];
195
185
  case 2:
196
- error_1 = _a.sent();
197
- console.warn("No credentials file found. Check that ".concat(filePath, " exists."));
198
- return [3 /*break*/, 3];
186
+ _b.sent();
187
+ return [3 /*break*/, 4];
199
188
  case 3:
200
- this.readEnvVariables();
201
- if (!this.username) {
202
- console.info("No credentials found in credentials file or environment variables. Either provide some or use \n authorize() function.");
203
- }
204
- return [2 /*return*/];
205
- }
206
- });
207
- });
208
- };
209
- BaseAPI.prototype.readConfigFile = function () {
210
- return __awaiter(this, void 0, void 0, function () {
211
- var file, lines;
212
- var _this = this;
213
- return __generator(this, function (_a) {
214
- switch (_a.label) {
215
- case 0: return [4 /*yield*/, fs.promises.readFile(filePath, 'utf-8')];
216
- case 1:
217
- file = _a.sent();
218
- lines = file.split(os.EOL)
219
- .filter(Boolean);
220
- lines.forEach(function (line) {
221
- if (line.startsWith(KEY_USERNAME)) {
222
- _this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
223
- }
224
- else if (line.startsWith(KEY_PASSWORD)) {
225
- _this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
226
- }
227
- });
189
+ // Only store if no workspace switch (since switchWorkspace will store after switching)
190
+ this.storeTokenData(__assign({}, this.tokenData));
191
+ _b.label = 4;
192
+ case 4:
193
+ this.storeTokenData(__assign({}, this.tokenData));
228
194
  return [2 /*return*/];
229
195
  }
230
196
  });
231
197
  });
232
198
  };
233
- BaseAPI.prototype.readEnvVariables = function () {
234
- if (process.env.EMIL_USERNAME) {
235
- this.username = process.env.EMIL_USERNAME;
236
- this.password = process.env.EMIL_PASSWORD || '';
237
- return true;
238
- }
239
- return false;
240
- };
241
- BaseAPI.prototype.selectEnvironment = function (env) {
242
- this.configuration.basePath = env;
243
- };
244
- BaseAPI.prototype.authorize = function (username, password) {
199
+ BaseAPI.prototype.switchWorkspace = function (targetWorkspace) {
245
200
  return __awaiter(this, void 0, void 0, function () {
246
- var options, response, accessToken, refreshToken;
247
- return __generator(this, function (_a) {
248
- switch (_a.label) {
201
+ var options, response, _a, accessToken, permissions;
202
+ return __generator(this, function (_b) {
203
+ switch (_b.label) {
249
204
  case 0:
250
205
  options = {
251
206
  method: 'POST',
252
- url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
253
- headers: { 'Content-Type': 'application/json' },
207
+ url: "".concat(this.configuration.basePath, "/authservice/v1/workspaces/switch"),
208
+ headers: {
209
+ 'Content-Type': 'application/json',
210
+ 'Authorization': "Bearer ".concat(this.configuration.accessToken),
211
+ },
254
212
  data: {
255
- username: username,
256
- password: password,
213
+ username: this.configuration.username,
214
+ targetWorkspace: targetWorkspace,
257
215
  },
258
216
  withCredentials: true,
259
217
  };
260
218
  return [4 /*yield*/, axios_1.default.request(options)];
261
219
  case 1:
262
- response = _a.sent();
263
- accessToken = response.data.accessToken;
264
- this.configuration.username = username;
220
+ response = _b.sent();
221
+ _a = response.data, accessToken = _a.accessToken, permissions = _a.permissions;
265
222
  this.configuration.accessToken = "Bearer ".concat(accessToken);
266
- refreshToken = this.extractRefreshToken(response);
267
- this.configuration.refreshToken = refreshToken;
223
+ this.tokenData.accessToken = accessToken;
224
+ this.tokenData.permissions = permissions;
225
+ this.storeTokenData(__assign({}, this.tokenData));
268
226
  return [2 /*return*/];
269
227
  }
270
228
  });
@@ -272,95 +230,111 @@ var BaseAPI = /** @class */ (function () {
272
230
  };
273
231
  BaseAPI.prototype.refreshTokenInternal = function () {
274
232
  return __awaiter(this, void 0, void 0, function () {
275
- var _a, username, refreshToken, options, accessToken;
276
- return __generator(this, function (_b) {
277
- switch (_b.label) {
233
+ var username, refreshTokenAxios, options, response;
234
+ var _this = this;
235
+ return __generator(this, function (_a) {
236
+ switch (_a.label) {
278
237
  case 0:
279
- _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
280
- if (!username || !refreshToken) {
281
- return [2 /*return*/, ''];
238
+ username = this.configuration.username;
239
+ if (!username) {
240
+ throw new Error('Failed to refresh token.');
282
241
  }
242
+ refreshTokenAxios = axios_1.default.create();
243
+ refreshTokenAxios.interceptors.response.use(function (response) {
244
+ var permissions = response.data.permissions;
245
+ _this.tokenData.permissions = permissions;
246
+ _this.storeTokenData(_this.tokenData);
247
+ return response;
248
+ });
283
249
  options = {
284
250
  method: 'POST',
285
251
  url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
286
252
  headers: {
287
253
  'Content-Type': 'application/json',
288
- Cookie: refreshToken,
289
254
  },
290
255
  data: { username: username },
291
256
  withCredentials: true,
292
257
  };
293
- return [4 /*yield*/, axios_1.default.request(options)];
258
+ return [4 /*yield*/, refreshTokenAxios.request(options)];
294
259
  case 1:
295
- accessToken = (_b.sent()).data.accessToken;
296
- return [2 /*return*/, accessToken];
260
+ response = _a.sent();
261
+ return [2 /*return*/, response.data];
297
262
  }
298
263
  });
299
264
  });
300
265
  };
301
- BaseAPI.prototype.extractRefreshToken = function (response) {
302
- if (response.headers && response.headers['set-cookie']
303
- && response.headers['set-cookie'].length > 0) {
304
- return "".concat(response.headers['set-cookie'][0].split(';')[0], ";");
266
+ BaseAPI.prototype.storeTokenData = function (tokenData) {
267
+ if (typeof window !== 'undefined') {
268
+ (0, common_1.defaultStorage)().set(TOKEN_DATA, tokenData);
305
269
  }
306
- return '';
307
270
  };
308
- BaseAPI.prototype.getConfiguration = function () {
309
- return this.configuration;
271
+ BaseAPI.prototype.loadTokenData = function () {
272
+ if (typeof window !== 'undefined') {
273
+ this.tokenData = (0, common_1.defaultStorage)().get(TOKEN_DATA) || {};
274
+ }
275
+ else {
276
+ this.tokenData = {};
277
+ }
278
+ };
279
+ BaseAPI.prototype.cleanTokenData = function () {
280
+ this.storeTokenData(null);
310
281
  };
311
282
  BaseAPI.prototype.attachInterceptor = function (axios) {
312
283
  var _this = this;
313
284
  axios.interceptors.response.use(function (res) {
314
285
  return res;
315
286
  }, function (err) { return __awaiter(_this, void 0, void 0, function () {
316
- var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
317
- return __generator(this, function (_a) {
318
- switch (_a.label) {
287
+ var originalConfig, _a, tokenString, permissions, accessToken, _error_1, _b, tokenString, permissions, accessToken, _error_2;
288
+ return __generator(this, function (_c) {
289
+ switch (_c.label) {
319
290
  case 0:
320
291
  originalConfig = err.config;
321
- if (!err.response) return [3 /*break*/, 5];
322
- if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
292
+ if (!(err.response && !(err.response instanceof XMLHttpRequest))) return [3 /*break*/, 5];
293
+ if (!((err.response.status === 401 || err.response.status === 403)
294
+ && !originalConfig._retry)) return [3 /*break*/, 4];
323
295
  originalConfig._retry = true;
324
- _a.label = 1;
296
+ _c.label = 1;
325
297
  case 1:
326
- _a.trys.push([1, 3, , 4]);
298
+ _c.trys.push([1, 3, , 4]);
327
299
  return [4 /*yield*/, this.refreshTokenInternal()];
328
300
  case 2:
329
- tokenString = _a.sent();
301
+ _a = _c.sent(), tokenString = _a.accessToken, permissions = _a.permissions;
330
302
  accessToken = "Bearer ".concat(tokenString);
331
- originalConfig.headers['Authorization'] = "Bearer ".concat(accessToken);
303
+ this.tokenData.permissions = permissions;
304
+ delete originalConfig.headers['Authorization'];
305
+ originalConfig.headers['Authorization'] = accessToken;
332
306
  this.configuration.accessToken = accessToken;
333
- return [2 /*return*/, axios.request(originalConfig)];
307
+ this.tokenData.accessToken = tokenString;
308
+ this.storeTokenData(this.tokenData);
309
+ return [2 /*return*/, axios(originalConfig)];
334
310
  case 3:
335
- _error_1 = _a.sent();
311
+ _error_1 = _c.sent();
336
312
  if (_error_1.response && _error_1.response.data) {
337
313
  return [2 /*return*/, Promise.reject(_error_1.response.data)];
338
314
  }
339
315
  return [2 /*return*/, Promise.reject(_error_1)];
340
- case 4:
341
- if (err.response.status === 403 && err.response.data) {
342
- return [2 /*return*/, Promise.reject(err.response.data)];
343
- }
344
- return [3 /*break*/, 9];
316
+ case 4: return [3 /*break*/, 9];
345
317
  case 5:
346
318
  if (!(err.message === NETWORK_ERROR_MESSAGE
347
- && err.isAxiosError
348
319
  && originalConfig.headers.hasOwnProperty('Authorization')
349
320
  && _retry_count < 4)) return [3 /*break*/, 9];
350
321
  _retry_count++;
351
- _a.label = 6;
322
+ _c.label = 6;
352
323
  case 6:
353
- _a.trys.push([6, 8, , 9]);
324
+ _c.trys.push([6, 8, , 9]);
354
325
  return [4 /*yield*/, this.refreshTokenInternal()];
355
326
  case 7:
356
- tokenString = _a.sent();
327
+ _b = _c.sent(), tokenString = _b.accessToken, permissions = _b.permissions;
357
328
  accessToken = "Bearer ".concat(tokenString);
329
+ this.tokenData.permissions = permissions;
358
330
  _retry = true;
359
331
  originalConfig.headers['Authorization'] = accessToken;
360
332
  this.configuration.accessToken = accessToken;
333
+ this.tokenData.accessToken = tokenString;
334
+ this.storeTokenData(this.tokenData);
361
335
  return [2 /*return*/, axios.request(__assign({}, originalConfig))];
362
336
  case 8:
363
- _error_2 = _a.sent();
337
+ _error_2 = _c.sent();
364
338
  if (_error_2.response && _error_2.response.data) {
365
339
  return [2 /*return*/, Promise.reject(_error_2.response.data)];
366
340
  }
package/dist/common.d.ts CHANGED
@@ -12,7 +12,6 @@
12
12
  import { Configuration } from "./configuration";
13
13
  import { RequestArgs } from "./base";
14
14
  import { AxiosInstance, AxiosResponse } from 'axios';
15
- import { URL } from 'url';
16
15
  /**
17
16
  *
18
17
  * @export
@@ -63,7 +62,7 @@ export declare const toPathString: (url: URL) => string;
63
62
  *
64
63
  * @export
65
64
  */
66
- export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
65
+ export declare const createRequestFunction: (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) => <T = unknown, R = AxiosResponse<T, any, {}>>(axios?: AxiosInstance, basePath?: string) => Promise<R>;
67
66
  /**
68
67
  * EMIL TranslationService
69
68
  * The EMIL TranslationService API description
package/dist/common.js CHANGED
@@ -62,7 +62,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
62
62
  Object.defineProperty(exports, "__esModule", { value: true });
63
63
  exports.defaultStorage = exports.LocalStorage = exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;
64
64
  var base_1 = require("./base");
65
- var url_1 = require("url");
66
65
  /**
67
66
  *
68
67
  * @export
@@ -141,7 +140,7 @@ var setBearerAuthToObject = function (object, configuration) {
141
140
  _b.label = 4;
142
141
  case 4:
143
142
  accessToken = _a;
144
- object["Authorization"] = "Bearer " + accessToken;
143
+ object["Authorization"] = configuration.getBearerToken(accessToken);
145
144
  _b.label = 5;
146
145
  case 5: return [2 /*return*/];
147
146
  }
@@ -171,7 +170,7 @@ var setOAuthToObject = function (object, name, scopes, configuration) {
171
170
  _b.label = 4;
172
171
  case 4:
173
172
  localVarAccessTokenValue = _a;
174
- object["Authorization"] = "Bearer " + localVarAccessTokenValue;
173
+ object["Authorization"] = configuration.getBearerToken(localVarAccessTokenValue);
175
174
  _b.label = 5;
176
175
  case 5: return [2 /*return*/];
177
176
  }
@@ -188,7 +187,7 @@ var setSearchParams = function (url) {
188
187
  for (var _i = 1; _i < arguments.length; _i++) {
189
188
  objects[_i - 1] = arguments[_i];
190
189
  }
191
- var searchParams = new url_1.URLSearchParams(url.search);
190
+ var searchParams = new URLSearchParams(url.search);
192
191
  for (var _a = 0, objects_1 = objects; _a < objects_1.length; _a++) {
193
192
  var object = objects_1[_a];
194
193
  for (var key in object) {
@@ -68,13 +68,6 @@ export declare class Configuration {
68
68
  * @type {new () => FormData}
69
69
  */
70
70
  formDataCtor?: new () => any;
71
- /**
72
- * parameter for automatically refreshing access token for oauth2 security
73
- *
74
- * @type {string}
75
- * @memberof Configuration
76
- */
77
- refreshToken?: string;
78
71
  constructor(param?: ConfigurationParameters);
79
72
  /**
80
73
  * Check if the given MIME is a JSON MIME.
@@ -87,4 +80,10 @@ export declare class Configuration {
87
80
  * @return True if the given MIME is JSON, false otherwise.
88
81
  */
89
82
  isJsonMime(mime: string): boolean;
83
+ /**
84
+ * Returns "Bearer" token.
85
+ * @param token - access token.
86
+ * @return Bearer token.
87
+ */
88
+ getBearerToken(token?: string): string;
90
89
  }
@@ -39,6 +39,14 @@ var Configuration = /** @class */ (function () {
39
39
  var jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
40
40
  return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
41
41
  };
42
+ /**
43
+ * Returns "Bearer" token.
44
+ * @param token - access token.
45
+ * @return Bearer token.
46
+ */
47
+ Configuration.prototype.getBearerToken = function (token) {
48
+ return ('' + token).startsWith("Bearer") ? token : "Bearer " + token;
49
+ };
42
50
  return Configuration;
43
51
  }());
44
52
  exports.Configuration = Configuration;
@@ -16,7 +16,7 @@
16
16
  */
17
17
  export interface CreateProductLanguageRequestDto {
18
18
  /**
19
- * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
19
+ * A slug is a human-readable, unique identifier, used to identify a resource instead of a less human-readable identifier like an id.
20
20
  * @type {string}
21
21
  * @memberof CreateProductLanguageRequestDto
22
22
  */
@@ -1,6 +1,8 @@
1
1
  export * from './create-product-language-request-dto';
2
2
  export * from './create-product-language-response-class';
3
3
  export * from './get-product-language-response-class';
4
+ export * from './inline-response200';
5
+ export * from './inline-response503';
4
6
  export * from './list-product-languages-response-class';
5
7
  export * from './list-translations-response-class';
6
8
  export * from './product-language-class';
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./create-product-language-request-dto"), exports);
18
18
  __exportStar(require("./create-product-language-response-class"), exports);
19
19
  __exportStar(require("./get-product-language-response-class"), exports);
20
+ __exportStar(require("./inline-response200"), exports);
21
+ __exportStar(require("./inline-response503"), exports);
20
22
  __exportStar(require("./list-product-languages-response-class"), exports);
21
23
  __exportStar(require("./list-translations-response-class"), exports);
22
24
  __exportStar(require("./product-language-class"), exports);
@@ -0,0 +1,54 @@
1
+ /**
2
+ * EMIL TranslationService
3
+ * The EMIL TranslationService 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 InlineResponse200
16
+ */
17
+ export interface InlineResponse200 {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof InlineResponse200
22
+ */
23
+ 'status'?: string;
24
+ /**
25
+ *
26
+ * @type {{ [key: string]: { [key: string]: object; }; }}
27
+ * @memberof InlineResponse200
28
+ */
29
+ 'info'?: {
30
+ [key: string]: {
31
+ [key: string]: object;
32
+ };
33
+ } | null;
34
+ /**
35
+ *
36
+ * @type {{ [key: string]: { [key: string]: object; }; }}
37
+ * @memberof InlineResponse200
38
+ */
39
+ 'error'?: {
40
+ [key: string]: {
41
+ [key: string]: object;
42
+ };
43
+ } | null;
44
+ /**
45
+ *
46
+ * @type {{ [key: string]: { [key: string]: object; }; }}
47
+ * @memberof InlineResponse200
48
+ */
49
+ 'details'?: {
50
+ [key: string]: {
51
+ [key: string]: object;
52
+ };
53
+ };
54
+ }