@emilgroup/commission-sdk-node 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/.openapi-generator/FILES +40 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +84 -0
  5. package/api/commission-agreement-versions-api.ts +535 -0
  6. package/api/commission-agreements-api.ts +642 -0
  7. package/api/commissions-api.ts +641 -0
  8. package/api/default-api.ts +128 -0
  9. package/api.ts +37 -0
  10. package/base.ts +327 -0
  11. package/common.ts +199 -0
  12. package/configuration.ts +118 -0
  13. package/dist/api/commission-agreement-versions-api.d.ts +300 -0
  14. package/dist/api/commission-agreement-versions-api.js +531 -0
  15. package/dist/api/commission-agreements-api.d.ts +357 -0
  16. package/dist/api/commission-agreements-api.js +624 -0
  17. package/dist/api/commissions-api.d.ts +357 -0
  18. package/dist/api/commissions-api.js +624 -0
  19. package/dist/api/default-api.d.ts +70 -0
  20. package/dist/api/default-api.js +204 -0
  21. package/dist/api.d.ts +15 -0
  22. package/dist/api.js +33 -0
  23. package/dist/base.d.ts +88 -0
  24. package/dist/base.js +434 -0
  25. package/dist/common.d.ts +92 -0
  26. package/dist/common.js +277 -0
  27. package/dist/configuration.d.ts +96 -0
  28. package/dist/configuration.js +52 -0
  29. package/dist/index.d.ts +15 -0
  30. package/dist/index.js +36 -0
  31. package/dist/models/commission-agreement-class.d.ts +89 -0
  32. package/dist/models/commission-agreement-class.js +25 -0
  33. package/dist/models/commission-agreement-version-class.d.ts +79 -0
  34. package/dist/models/commission-agreement-version-class.js +15 -0
  35. package/dist/models/commission-class.d.ts +103 -0
  36. package/dist/models/commission-class.js +15 -0
  37. package/dist/models/commission-item-class.d.ts +84 -0
  38. package/dist/models/commission-item-class.js +21 -0
  39. package/dist/models/create-commission-agreement-request-dto.d.ts +71 -0
  40. package/dist/models/create-commission-agreement-request-dto.js +25 -0
  41. package/dist/models/create-commission-agreement-response-class.d.ts +25 -0
  42. package/dist/models/create-commission-agreement-response-class.js +15 -0
  43. package/dist/models/create-commission-agreement-version-request-dto.d.ts +42 -0
  44. package/dist/models/create-commission-agreement-version-request-dto.js +15 -0
  45. package/dist/models/create-commission-agreement-version-response-class.d.ts +25 -0
  46. package/dist/models/create-commission-agreement-version-response-class.js +15 -0
  47. package/dist/models/create-commission-item-request-dto.d.ts +48 -0
  48. package/dist/models/create-commission-item-request-dto.js +21 -0
  49. package/dist/models/create-commission-request-dto.d.ts +55 -0
  50. package/dist/models/create-commission-request-dto.js +15 -0
  51. package/dist/models/create-commission-response-class.d.ts +25 -0
  52. package/dist/models/create-commission-response-class.js +15 -0
  53. package/dist/models/get-commission-agreement-response-class.d.ts +25 -0
  54. package/dist/models/get-commission-agreement-response-class.js +15 -0
  55. package/dist/models/get-commission-agreement-version-response-class.d.ts +25 -0
  56. package/dist/models/get-commission-agreement-version-response-class.js +15 -0
  57. package/dist/models/get-commission-response-class.d.ts +25 -0
  58. package/dist/models/get-commission-response-class.js +15 -0
  59. package/dist/models/index.d.ts +23 -0
  60. package/dist/models/index.js +39 -0
  61. package/dist/models/inline-response200.d.ts +54 -0
  62. package/dist/models/inline-response200.js +15 -0
  63. package/dist/models/inline-response503.d.ts +54 -0
  64. package/dist/models/inline-response503.js +15 -0
  65. package/dist/models/list-commission-agreement-versions-response-class.d.ts +43 -0
  66. package/dist/models/list-commission-agreement-versions-response-class.js +15 -0
  67. package/dist/models/list-commission-agreements-response-class.d.ts +43 -0
  68. package/dist/models/list-commission-agreements-response-class.js +15 -0
  69. package/dist/models/list-commissions-response-class.d.ts +43 -0
  70. package/dist/models/list-commissions-response-class.js +15 -0
  71. package/dist/models/update-commission-agreement-request-dto.d.ts +48 -0
  72. package/dist/models/update-commission-agreement-request-dto.js +21 -0
  73. package/dist/models/update-commission-agreement-response-class.d.ts +25 -0
  74. package/dist/models/update-commission-agreement-response-class.js +15 -0
  75. package/dist/models/update-commission-request-dto.d.ts +53 -0
  76. package/dist/models/update-commission-request-dto.js +20 -0
  77. package/dist/models/update-commission-response-class.d.ts +25 -0
  78. package/dist/models/update-commission-response-class.js +15 -0
  79. package/git_push.sh +57 -0
  80. package/index.ts +19 -0
  81. package/models/commission-agreement-class.ts +99 -0
  82. package/models/commission-agreement-version-class.ts +85 -0
  83. package/models/commission-class.ts +109 -0
  84. package/models/commission-item-class.ts +93 -0
  85. package/models/create-commission-agreement-request-dto.ts +81 -0
  86. package/models/create-commission-agreement-response-class.ts +31 -0
  87. package/models/create-commission-agreement-version-request-dto.ts +48 -0
  88. package/models/create-commission-agreement-version-response-class.ts +31 -0
  89. package/models/create-commission-item-request-dto.ts +57 -0
  90. package/models/create-commission-request-dto.ts +61 -0
  91. package/models/create-commission-response-class.ts +31 -0
  92. package/models/get-commission-agreement-response-class.ts +31 -0
  93. package/models/get-commission-agreement-version-response-class.ts +31 -0
  94. package/models/get-commission-response-class.ts +31 -0
  95. package/models/index.ts +23 -0
  96. package/models/inline-response200.ts +48 -0
  97. package/models/inline-response503.ts +48 -0
  98. package/models/list-commission-agreement-versions-response-class.ts +49 -0
  99. package/models/list-commission-agreements-response-class.ts +49 -0
  100. package/models/list-commissions-response-class.ts +49 -0
  101. package/models/update-commission-agreement-request-dto.ts +57 -0
  102. package/models/update-commission-agreement-response-class.ts +31 -0
  103. package/models/update-commission-request-dto.ts +62 -0
  104. package/models/update-commission-response-class.ts +31 -0
  105. package/package.json +29 -0
  106. package/tsconfig.json +23 -0
package/dist/base.js ADDED
@@ -0,0 +1,434 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * EMIL CommissionService
6
+ * The EMIL CommissionService 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
+ var __extends = (this && this.__extends) || (function () {
16
+ var extendStatics = function (d, b) {
17
+ extendStatics = Object.setPrototypeOf ||
18
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
19
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
20
+ return extendStatics(d, b);
21
+ };
22
+ return function (d, b) {
23
+ if (typeof b !== "function" && b !== null)
24
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
25
+ extendStatics(d, b);
26
+ function __() { this.constructor = d; }
27
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
28
+ };
29
+ })();
30
+ var __assign = (this && this.__assign) || function () {
31
+ __assign = Object.assign || function(t) {
32
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
33
+ s = arguments[i];
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
35
+ t[p] = s[p];
36
+ }
37
+ return t;
38
+ };
39
+ return __assign.apply(this, arguments);
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
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
65
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
66
+ return new (P || (P = Promise))(function (resolve, reject) {
67
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
68
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
69
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
70
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
71
+ });
72
+ };
73
+ var __generator = (this && this.__generator) || function (thisArg, body) {
74
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
75
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
76
+ function verb(n) { return function (v) { return step([n, v]); }; }
77
+ function step(op) {
78
+ if (f) throw new TypeError("Generator is already executing.");
79
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
80
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
81
+ if (y = 0, t) op = [op[0] & 2, t.value];
82
+ switch (op[0]) {
83
+ case 0: case 1: t = op; break;
84
+ case 4: _.label++; return { value: op[1], done: false };
85
+ case 5: _.label++; y = op[1]; op = [0]; continue;
86
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
87
+ default:
88
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
89
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
90
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
91
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
92
+ if (t[2]) _.ops.pop();
93
+ _.trys.pop(); continue;
94
+ }
95
+ op = body.call(thisArg, _);
96
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
97
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
98
+ }
99
+ };
100
+ var __importDefault = (this && this.__importDefault) || function (mod) {
101
+ return (mod && mod.__esModule) ? mod : { "default": mod };
102
+ };
103
+ Object.defineProperty(exports, "__esModule", { value: true });
104
+ exports.RequiredError = exports.BaseAPI = exports.resetRetry = exports.Environment = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
105
+ var configuration_1 = require("./configuration");
106
+ // Some imports not used depending on template conditions
107
+ // @ts-ignore
108
+ 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
+ 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
+ /**
119
+ *
120
+ * @export
121
+ */
122
+ exports.COLLECTION_FORMATS = {
123
+ csv: ",",
124
+ ssv: " ",
125
+ tsv: "\t",
126
+ pipes: "|",
127
+ };
128
+ var Environment;
129
+ (function (Environment) {
130
+ Environment["Production"] = "https://apiv2.emil.de";
131
+ Environment["Test"] = "https://apiv2-test.emil.de";
132
+ Environment["Staging"] = "https://apiv2-staging.emil.de";
133
+ Environment["Development"] = "https://apiv2-dev.emil.de";
134
+ Environment["ProductionZurich"] = "https://eu-central-2.apiv2.emil.de";
135
+ })(Environment = exports.Environment || (exports.Environment = {}));
136
+ var _retry_count = 0;
137
+ var _retry = null;
138
+ function resetRetry() {
139
+ _retry_count = 0;
140
+ }
141
+ exports.resetRetry = resetRetry;
142
+ var NETWORK_ERROR_MESSAGE = "Network Error";
143
+ /**
144
+ *
145
+ * @export
146
+ * @class BaseAPI
147
+ */
148
+ var BaseAPI = /** @class */ (function () {
149
+ function BaseAPI(configuration, basePath, axios) {
150
+ if (basePath === void 0) { basePath = exports.BASE_PATH; }
151
+ if (axios === void 0) { axios = axios_1.default; }
152
+ this.basePath = basePath;
153
+ this.axios = axios;
154
+ if (configuration) {
155
+ this.configuration = configuration;
156
+ this.basePath = configuration.basePath || this.basePath;
157
+ }
158
+ else {
159
+ this.configuration = new configuration_1.Configuration({
160
+ basePath: this.basePath,
161
+ });
162
+ }
163
+ this.attachInterceptor(axios);
164
+ }
165
+ BaseAPI.prototype.initialize = function (env, targetWorkspace) {
166
+ if (env === void 0) { env = Environment.Production; }
167
+ return __awaiter(this, void 0, void 0, function () {
168
+ return __generator(this, function (_a) {
169
+ switch (_a.label) {
170
+ case 0:
171
+ this.configuration.basePath = env;
172
+ return [4 /*yield*/, this.loadCredentials()];
173
+ case 1:
174
+ _a.sent();
175
+ if (!this.username) return [3 /*break*/, 3];
176
+ return [4 /*yield*/, this.authorize(this.username, this.password, targetWorkspace)];
177
+ case 2:
178
+ _a.sent();
179
+ this.password = null; // to avoid keeping password loaded in memory.
180
+ _a.label = 3;
181
+ case 3: return [2 /*return*/];
182
+ }
183
+ });
184
+ });
185
+ };
186
+ BaseAPI.prototype.loadCredentials = function () {
187
+ return __awaiter(this, void 0, void 0, function () {
188
+ var error_1;
189
+ return __generator(this, function (_a) {
190
+ switch (_a.label) {
191
+ case 0:
192
+ _a.trys.push([0, 2, , 3]);
193
+ return [4 /*yield*/, this.readConfigFile()];
194
+ case 1:
195
+ _a.sent();
196
+ return [3 /*break*/, 3];
197
+ case 2:
198
+ error_1 = _a.sent();
199
+ console.warn("No credentials file found. Check that ".concat(filePath, " exists."));
200
+ return [3 /*break*/, 3];
201
+ case 3:
202
+ this.readEnvVariables();
203
+ if (!this.username) {
204
+ console.info("No credentials found in credentials file or environment variables. Either provide some or use \n authorize() function.");
205
+ }
206
+ return [2 /*return*/];
207
+ }
208
+ });
209
+ });
210
+ };
211
+ BaseAPI.prototype.readConfigFile = function () {
212
+ return __awaiter(this, void 0, void 0, function () {
213
+ var file, lines;
214
+ var _this = this;
215
+ return __generator(this, function (_a) {
216
+ switch (_a.label) {
217
+ case 0: return [4 /*yield*/, fs.promises.readFile(filePath, 'utf-8')];
218
+ case 1:
219
+ file = _a.sent();
220
+ lines = file.split(os.EOL)
221
+ .filter(Boolean);
222
+ lines.forEach(function (line) {
223
+ if (line.startsWith(KEY_USERNAME)) {
224
+ _this.username = line.length > KEY_USERNAME.length + 1 ? line.substring(KEY_USERNAME.length + 1) : '';
225
+ }
226
+ else if (line.startsWith(KEY_PASSWORD)) {
227
+ _this.password = line.length > KEY_PASSWORD.length + 1 ? line.substring(KEY_PASSWORD.length + 1) : '';
228
+ }
229
+ });
230
+ return [2 /*return*/];
231
+ }
232
+ });
233
+ });
234
+ };
235
+ BaseAPI.prototype.readEnvVariables = function () {
236
+ if (process.env.EMIL_USERNAME) {
237
+ this.username = process.env.EMIL_USERNAME;
238
+ this.password = process.env.EMIL_PASSWORD || '';
239
+ return true;
240
+ }
241
+ return false;
242
+ };
243
+ BaseAPI.prototype.selectEnvironment = function (env) {
244
+ this.configuration.basePath = env;
245
+ };
246
+ BaseAPI.prototype.authorize = function (username, password, targetWorkspace) {
247
+ return __awaiter(this, void 0, void 0, function () {
248
+ var options, response, accessToken, refreshToken;
249
+ return __generator(this, function (_a) {
250
+ switch (_a.label) {
251
+ case 0:
252
+ options = {
253
+ method: 'POST',
254
+ url: "".concat(this.configuration.basePath, "/authservice/v1/login"),
255
+ headers: { 'Content-Type': 'application/json' },
256
+ data: {
257
+ username: username,
258
+ password: password,
259
+ },
260
+ withCredentials: true,
261
+ };
262
+ return [4 /*yield*/, axios_1.default.request(options)];
263
+ case 1:
264
+ response = _a.sent();
265
+ accessToken = response.data.accessToken;
266
+ this.configuration.username = username;
267
+ this.configuration.accessToken = "Bearer ".concat(accessToken);
268
+ refreshToken = this.extractRefreshToken(response);
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
+ }
309
+ return [2 /*return*/];
310
+ }
311
+ });
312
+ });
313
+ };
314
+ BaseAPI.prototype.refreshTokenInternal = function () {
315
+ return __awaiter(this, void 0, void 0, function () {
316
+ var _a, username, refreshToken, options, accessToken;
317
+ return __generator(this, function (_b) {
318
+ switch (_b.label) {
319
+ case 0:
320
+ _a = this.configuration, username = _a.username, refreshToken = _a.refreshToken;
321
+ if (!username || !refreshToken) {
322
+ return [2 /*return*/, ''];
323
+ }
324
+ options = {
325
+ method: 'POST',
326
+ url: "".concat(this.configuration.basePath, "/authservice/v1/refresh-token"),
327
+ headers: {
328
+ 'Content-Type': 'application/json',
329
+ Cookie: refreshToken,
330
+ },
331
+ data: { username: username },
332
+ withCredentials: true,
333
+ };
334
+ return [4 /*yield*/, axios_1.default.request(options)];
335
+ case 1:
336
+ accessToken = (_b.sent()).data.accessToken;
337
+ return [2 /*return*/, accessToken];
338
+ }
339
+ });
340
+ });
341
+ };
342
+ BaseAPI.prototype.extractRefreshToken = function (response) {
343
+ if (response.headers && response.headers['set-cookie']
344
+ && response.headers['set-cookie'].length > 0) {
345
+ return "".concat(response.headers['set-cookie'][0].split(';')[0], ";");
346
+ }
347
+ return '';
348
+ };
349
+ BaseAPI.prototype.getConfiguration = function () {
350
+ return this.configuration;
351
+ };
352
+ BaseAPI.prototype.attachInterceptor = function (axios) {
353
+ var _this = this;
354
+ axios.interceptors.response.use(function (res) {
355
+ return res;
356
+ }, function (err) { return __awaiter(_this, void 0, void 0, function () {
357
+ var originalConfig, tokenString, accessToken, _error_1, tokenString, accessToken, _error_2;
358
+ return __generator(this, function (_a) {
359
+ switch (_a.label) {
360
+ case 0:
361
+ originalConfig = err.config;
362
+ if (!err.response) return [3 /*break*/, 5];
363
+ if (!(err.response.status === 401 && !originalConfig._retry)) return [3 /*break*/, 4];
364
+ originalConfig._retry = true;
365
+ _a.label = 1;
366
+ case 1:
367
+ _a.trys.push([1, 3, , 4]);
368
+ return [4 /*yield*/, this.refreshTokenInternal()];
369
+ case 2:
370
+ tokenString = _a.sent();
371
+ accessToken = "Bearer ".concat(tokenString);
372
+ originalConfig.headers['Authorization'] = accessToken;
373
+ this.configuration.accessToken = accessToken;
374
+ return [2 /*return*/, axios.request(originalConfig)];
375
+ case 3:
376
+ _error_1 = _a.sent();
377
+ if (_error_1.response && _error_1.response.data) {
378
+ return [2 /*return*/, Promise.reject(_error_1.response.data)];
379
+ }
380
+ return [2 /*return*/, Promise.reject(_error_1)];
381
+ case 4:
382
+ if (err.response.status === 403 && err.response.data) {
383
+ return [2 /*return*/, Promise.reject(err.response.data)];
384
+ }
385
+ return [3 /*break*/, 9];
386
+ case 5:
387
+ if (!(err.message === NETWORK_ERROR_MESSAGE
388
+ && err.isAxiosError
389
+ && originalConfig.headers.hasOwnProperty('Authorization')
390
+ && _retry_count < 4)) return [3 /*break*/, 9];
391
+ _retry_count++;
392
+ _a.label = 6;
393
+ case 6:
394
+ _a.trys.push([6, 8, , 9]);
395
+ return [4 /*yield*/, this.refreshTokenInternal()];
396
+ case 7:
397
+ tokenString = _a.sent();
398
+ accessToken = "Bearer ".concat(tokenString);
399
+ _retry = true;
400
+ originalConfig.headers['Authorization'] = accessToken;
401
+ this.configuration.accessToken = accessToken;
402
+ return [2 /*return*/, axios.request(__assign({}, originalConfig))];
403
+ case 8:
404
+ _error_2 = _a.sent();
405
+ if (_error_2.response && _error_2.response.data) {
406
+ return [2 /*return*/, Promise.reject(_error_2.response.data)];
407
+ }
408
+ return [2 /*return*/, Promise.reject(_error_2)];
409
+ case 9: return [2 /*return*/, Promise.reject(err)];
410
+ }
411
+ });
412
+ }); });
413
+ };
414
+ return BaseAPI;
415
+ }());
416
+ exports.BaseAPI = BaseAPI;
417
+ ;
418
+ /**
419
+ *
420
+ * @export
421
+ * @class RequiredError
422
+ * @extends {Error}
423
+ */
424
+ var RequiredError = /** @class */ (function (_super) {
425
+ __extends(RequiredError, _super);
426
+ function RequiredError(field, msg) {
427
+ var _this = _super.call(this, msg) || this;
428
+ _this.field = field;
429
+ _this.name = "RequiredError";
430
+ return _this;
431
+ }
432
+ return RequiredError;
433
+ }(Error));
434
+ exports.RequiredError = RequiredError;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * EMIL CommissionService
3
+ * The EMIL CommissionService 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 { Configuration } from "./configuration";
13
+ import { RequestArgs } from "./base";
14
+ import { AxiosInstance, AxiosResponse } from 'axios';
15
+ import { URL } from 'url';
16
+ /**
17
+ *
18
+ * @export
19
+ */
20
+ export declare const DUMMY_BASE_URL = "https://example.com";
21
+ /**
22
+ *
23
+ * @throws {RequiredError}
24
+ * @export
25
+ */
26
+ export declare const assertParamExists: (functionName: string, paramName: string, paramValue: unknown) => void;
27
+ /**
28
+ *
29
+ * @export
30
+ */
31
+ export declare const setApiKeyToObject: (object: any, keyParamName: string, configuration?: Configuration) => Promise<void>;
32
+ /**
33
+ *
34
+ * @export
35
+ */
36
+ export declare const setBasicAuthToObject: (object: any, configuration?: Configuration) => void;
37
+ /**
38
+ *
39
+ * @export
40
+ */
41
+ export declare const setBearerAuthToObject: (object: any, configuration?: Configuration) => Promise<void>;
42
+ /**
43
+ *
44
+ * @export
45
+ */
46
+ export declare const setOAuthToObject: (object: any, name: string, scopes: string[], configuration?: Configuration) => Promise<void>;
47
+ /**
48
+ *
49
+ * @export
50
+ */
51
+ export declare const setSearchParams: (url: URL, ...objects: any[]) => void;
52
+ /**
53
+ *
54
+ * @export
55
+ */
56
+ export declare const serializeDataIfNeeded: (value: any, requestOptions: any, configuration?: Configuration) => any;
57
+ /**
58
+ *
59
+ * @export
60
+ */
61
+ export declare const toPathString: (url: URL) => string;
62
+ /**
63
+ *
64
+ * @export
65
+ */
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>;
67
+ /**
68
+ * EMIL CommissionService
69
+ * The EMIL CommissionService API description
70
+ *
71
+ * The version of the OpenAPI document: 1.0
72
+ * Contact: kontakt@emil.de
73
+ *
74
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
75
+ * https://openapi-generator.tech
76
+ * Do not edit the class manually.
77
+ */
78
+ export interface IStorageConverter<D, SD> {
79
+ toStorageData(data: D): SD;
80
+ fromStorageData(storageData: SD): D;
81
+ }
82
+ export interface IStorage {
83
+ get<T>(key: string, converter?: IStorageConverter<T, any>): T | null;
84
+ set<T>(key: string, value: T, converter?: IStorageConverter<T, any>): void;
85
+ }
86
+ export declare class LocalStorage implements IStorage {
87
+ readonly storage: Storage;
88
+ constructor();
89
+ get<T>(key: string, converter?: IStorageConverter<T, any>): T | null;
90
+ set<T>(key: string, value: T, converter?: IStorageConverter<T, any>): void;
91
+ }
92
+ export declare const defaultStorage: () => IStorage;