@teemill/projects 1.12.1 → 1.12.4

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 (117) hide show
  1. package/.openapi-generator/FILES +1 -0
  2. package/.openapi-generator/VERSION +1 -1
  3. package/README.md +2 -2
  4. package/dist/apis/ProjectsApi.d.ts +4 -4
  5. package/dist/apis/ProjectsApi.js +517 -927
  6. package/dist/esm/apis/ProjectsApi.d.ts +241 -0
  7. package/dist/esm/apis/ProjectsApi.js +701 -0
  8. package/dist/esm/apis/index.d.ts +1 -0
  9. package/dist/esm/apis/index.js +3 -0
  10. package/dist/esm/index.d.ts +3 -0
  11. package/dist/esm/index.js +5 -0
  12. package/dist/esm/models/ApiError.d.ts +37 -0
  13. package/dist/esm/models/ApiError.js +42 -0
  14. package/dist/esm/models/CreateInviteRequest.d.ts +31 -0
  15. package/dist/esm/models/CreateInviteRequest.js +40 -0
  16. package/dist/esm/models/CreateProjectRequest.d.ts +43 -0
  17. package/dist/esm/models/CreateProjectRequest.js +44 -0
  18. package/dist/esm/models/CreateUserRequest.d.ts +56 -0
  19. package/dist/esm/models/CreateUserRequest.js +55 -0
  20. package/dist/esm/models/CreateUserRequestAvatar.d.ts +31 -0
  21. package/dist/esm/models/CreateUserRequestAvatar.js +43 -0
  22. package/dist/esm/models/InstallTemplateRequest.d.ts +31 -0
  23. package/dist/esm/models/InstallTemplateRequest.js +38 -0
  24. package/dist/esm/models/Integration.d.ts +49 -0
  25. package/dist/esm/models/Integration.js +47 -0
  26. package/dist/esm/models/IntegrationInfo.d.ts +49 -0
  27. package/dist/esm/models/IntegrationInfo.js +52 -0
  28. package/dist/esm/models/IntegrationsResponse.d.ts +32 -0
  29. package/dist/esm/models/IntegrationsResponse.js +41 -0
  30. package/dist/esm/models/Project.d.ts +50 -0
  31. package/dist/esm/models/Project.js +51 -0
  32. package/dist/esm/models/ProjectInvite.d.ts +56 -0
  33. package/dist/esm/models/ProjectInvite.js +57 -0
  34. package/dist/esm/models/ProjectInvites.d.ts +38 -0
  35. package/dist/esm/models/ProjectInvites.js +45 -0
  36. package/dist/esm/models/ProjectLogo.d.ts +37 -0
  37. package/dist/esm/models/ProjectLogo.js +40 -0
  38. package/dist/esm/models/ProjectUser.d.ts +83 -0
  39. package/dist/esm/models/ProjectUser.js +75 -0
  40. package/dist/esm/models/ProjectUserAvatar.d.ts +31 -0
  41. package/dist/esm/models/ProjectUserAvatar.js +38 -0
  42. package/dist/esm/models/ProjectUsers.d.ts +38 -0
  43. package/dist/esm/models/ProjectUsers.js +45 -0
  44. package/dist/esm/models/ProjectsResponse.d.ts +32 -0
  45. package/dist/esm/models/ProjectsResponse.js +41 -0
  46. package/dist/esm/models/SetupIntegrationRequest.d.ts +31 -0
  47. package/dist/esm/models/SetupIntegrationRequest.js +40 -0
  48. package/dist/esm/models/UpdateProjectRequest.d.ts +31 -0
  49. package/dist/esm/models/UpdateProjectRequest.js +38 -0
  50. package/dist/esm/models/UpdateUserRequest.d.ts +56 -0
  51. package/dist/esm/models/UpdateUserRequest.js +52 -0
  52. package/dist/esm/models/UpdateUserRequestAvatar.d.ts +31 -0
  53. package/dist/esm/models/UpdateUserRequestAvatar.js +43 -0
  54. package/dist/esm/models/index.d.ts +16 -0
  55. package/dist/esm/models/index.js +18 -0
  56. package/dist/esm/runtime.d.ts +187 -0
  57. package/dist/esm/runtime.js +333 -0
  58. package/dist/models/ApiError.d.ts +1 -1
  59. package/dist/models/ApiError.js +1 -1
  60. package/dist/models/CreateInviteRequest.d.ts +1 -1
  61. package/dist/models/CreateInviteRequest.js +1 -1
  62. package/dist/models/CreateProjectRequest.d.ts +1 -1
  63. package/dist/models/CreateProjectRequest.js +1 -1
  64. package/dist/models/CreateUserRequest.js +3 -3
  65. package/dist/models/CreateUserRequestAvatar.js +2 -2
  66. package/dist/models/InstallTemplateRequest.d.ts +1 -1
  67. package/dist/models/InstallTemplateRequest.js +1 -1
  68. package/dist/models/Integration.d.ts +2 -2
  69. package/dist/models/Integration.js +1 -1
  70. package/dist/models/IntegrationInfo.js +1 -1
  71. package/dist/models/IntegrationsResponse.d.ts +1 -1
  72. package/dist/models/IntegrationsResponse.js +2 -2
  73. package/dist/models/Project.d.ts +2 -2
  74. package/dist/models/Project.js +2 -2
  75. package/dist/models/ProjectInvite.d.ts +1 -1
  76. package/dist/models/ProjectInvite.js +2 -2
  77. package/dist/models/ProjectInvites.d.ts +1 -1
  78. package/dist/models/ProjectInvites.js +2 -2
  79. package/dist/models/ProjectLogo.d.ts +1 -1
  80. package/dist/models/ProjectLogo.js +1 -1
  81. package/dist/models/ProjectUser.d.ts +1 -1
  82. package/dist/models/ProjectUser.js +2 -2
  83. package/dist/models/ProjectUserAvatar.d.ts +1 -1
  84. package/dist/models/ProjectUserAvatar.js +1 -1
  85. package/dist/models/ProjectUsers.d.ts +1 -1
  86. package/dist/models/ProjectUsers.js +2 -2
  87. package/dist/models/ProjectsResponse.d.ts +1 -1
  88. package/dist/models/ProjectsResponse.js +2 -2
  89. package/dist/models/SetupIntegrationRequest.d.ts +1 -1
  90. package/dist/models/SetupIntegrationRequest.js +1 -1
  91. package/dist/models/UpdateProjectRequest.d.ts +1 -1
  92. package/dist/models/UpdateProjectRequest.js +1 -1
  93. package/dist/models/UpdateUserRequest.js +3 -3
  94. package/dist/models/UpdateUserRequestAvatar.js +2 -2
  95. package/dist/runtime.d.ts +1 -1
  96. package/dist/runtime.js +223 -439
  97. package/package.json +4 -2
  98. package/src/apis/ProjectsApi.ts +6 -8
  99. package/src/models/ApiError.ts +1 -1
  100. package/src/models/CreateInviteRequest.ts +1 -1
  101. package/src/models/CreateProjectRequest.ts +1 -1
  102. package/src/models/InstallTemplateRequest.ts +1 -1
  103. package/src/models/Integration.ts +2 -2
  104. package/src/models/IntegrationsResponse.ts +1 -1
  105. package/src/models/Project.ts +2 -2
  106. package/src/models/ProjectInvite.ts +1 -1
  107. package/src/models/ProjectInvites.ts +1 -1
  108. package/src/models/ProjectLogo.ts +1 -1
  109. package/src/models/ProjectUser.ts +1 -1
  110. package/src/models/ProjectUserAvatar.ts +1 -1
  111. package/src/models/ProjectUsers.ts +1 -1
  112. package/src/models/ProjectsResponse.ts +1 -1
  113. package/src/models/SetupIntegrationRequest.ts +1 -1
  114. package/src/models/UpdateProjectRequest.ts +1 -1
  115. package/src/runtime.ts +1 -1
  116. package/tsconfig.esm.json +7 -0
  117. package/tsconfig.json +2 -2
package/dist/runtime.js CHANGED
@@ -5,39 +5,13 @@
5
5
  * Projects API
6
6
  * Manage Teemill Projects For full documentation on functionality and account settings go to [teemill.com](https://teemill.com)
7
7
  *
8
- * The version of the OpenAPI document: 1.12.1
8
+ * The version of the OpenAPI document: 1.12.4
9
9
  * Contact: hello@teemill.com
10
10
  *
11
11
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
12
  * https://openapi-generator.tech
13
13
  * Do not edit the class manually.
14
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
15
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
42
16
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
43
17
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -47,254 +21,125 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
47
21
  step((generator = generator.apply(thisArg, _arguments || [])).next());
48
22
  });
49
23
  };
50
- var __generator = (this && this.__generator) || function (thisArg, body) {
51
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
52
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
53
- function verb(n) { return function (v) { return step([n, v]); }; }
54
- function step(op) {
55
- if (f) throw new TypeError("Generator is already executing.");
56
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
57
- 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;
58
- if (y = 0, t) op = [op[0] & 2, t.value];
59
- switch (op[0]) {
60
- case 0: case 1: t = op; break;
61
- case 4: _.label++; return { value: op[1], done: false };
62
- case 5: _.label++; y = op[1]; op = [0]; continue;
63
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
64
- default:
65
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
66
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
67
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
68
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
69
- if (t[2]) _.ops.pop();
70
- _.trys.pop(); continue;
71
- }
72
- op = body.call(thisArg, _);
73
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
74
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
75
- }
76
- };
77
24
  Object.defineProperty(exports, "__esModule", { value: true });
78
25
  exports.TextApiResponse = exports.BlobApiResponse = exports.VoidApiResponse = exports.JSONApiResponse = exports.canConsumeForm = exports.mapValues = exports.querystring = exports.exists = exports.COLLECTION_FORMATS = exports.RequiredError = exports.FetchError = exports.ResponseError = exports.BaseAPI = exports.DefaultConfig = exports.Configuration = exports.BASE_PATH = void 0;
79
26
  exports.BASE_PATH = "https://localhost:8080".replace(/\/+$/, "");
80
- var Configuration = /** @class */ (function () {
81
- function Configuration(configuration) {
82
- if (configuration === void 0) { configuration = {}; }
27
+ class Configuration {
28
+ constructor(configuration = {}) {
83
29
  this.configuration = configuration;
84
30
  }
85
- Object.defineProperty(Configuration.prototype, "config", {
86
- set: function (configuration) {
87
- this.configuration = configuration;
88
- },
89
- enumerable: false,
90
- configurable: true
91
- });
92
- Object.defineProperty(Configuration.prototype, "basePath", {
93
- get: function () {
94
- return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
95
- },
96
- enumerable: false,
97
- configurable: true
98
- });
99
- Object.defineProperty(Configuration.prototype, "fetchApi", {
100
- get: function () {
101
- return this.configuration.fetchApi;
102
- },
103
- enumerable: false,
104
- configurable: true
105
- });
106
- Object.defineProperty(Configuration.prototype, "middleware", {
107
- get: function () {
108
- return this.configuration.middleware || [];
109
- },
110
- enumerable: false,
111
- configurable: true
112
- });
113
- Object.defineProperty(Configuration.prototype, "queryParamsStringify", {
114
- get: function () {
115
- return this.configuration.queryParamsStringify || querystring;
116
- },
117
- enumerable: false,
118
- configurable: true
119
- });
120
- Object.defineProperty(Configuration.prototype, "username", {
121
- get: function () {
122
- return this.configuration.username;
123
- },
124
- enumerable: false,
125
- configurable: true
126
- });
127
- Object.defineProperty(Configuration.prototype, "password", {
128
- get: function () {
129
- return this.configuration.password;
130
- },
131
- enumerable: false,
132
- configurable: true
133
- });
134
- Object.defineProperty(Configuration.prototype, "apiKey", {
135
- get: function () {
136
- var apiKey = this.configuration.apiKey;
137
- if (apiKey) {
138
- return typeof apiKey === 'function' ? apiKey : function () { return apiKey; };
139
- }
140
- return undefined;
141
- },
142
- enumerable: false,
143
- configurable: true
144
- });
145
- Object.defineProperty(Configuration.prototype, "accessToken", {
146
- get: function () {
147
- var _this = this;
148
- var accessToken = this.configuration.accessToken;
149
- if (accessToken) {
150
- return typeof accessToken === 'function' ? accessToken : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
151
- return [2 /*return*/, accessToken];
152
- }); }); };
153
- }
154
- return undefined;
155
- },
156
- enumerable: false,
157
- configurable: true
158
- });
159
- Object.defineProperty(Configuration.prototype, "headers", {
160
- get: function () {
161
- return this.configuration.headers;
162
- },
163
- enumerable: false,
164
- configurable: true
165
- });
166
- Object.defineProperty(Configuration.prototype, "credentials", {
167
- get: function () {
168
- return this.configuration.credentials;
169
- },
170
- enumerable: false,
171
- configurable: true
172
- });
173
- return Configuration;
174
- }());
31
+ set config(configuration) {
32
+ this.configuration = configuration;
33
+ }
34
+ get basePath() {
35
+ return this.configuration.basePath != null ? this.configuration.basePath : exports.BASE_PATH;
36
+ }
37
+ get fetchApi() {
38
+ return this.configuration.fetchApi;
39
+ }
40
+ get middleware() {
41
+ return this.configuration.middleware || [];
42
+ }
43
+ get queryParamsStringify() {
44
+ return this.configuration.queryParamsStringify || querystring;
45
+ }
46
+ get username() {
47
+ return this.configuration.username;
48
+ }
49
+ get password() {
50
+ return this.configuration.password;
51
+ }
52
+ get apiKey() {
53
+ const apiKey = this.configuration.apiKey;
54
+ if (apiKey) {
55
+ return typeof apiKey === 'function' ? apiKey : () => apiKey;
56
+ }
57
+ return undefined;
58
+ }
59
+ get accessToken() {
60
+ const accessToken = this.configuration.accessToken;
61
+ if (accessToken) {
62
+ return typeof accessToken === 'function' ? accessToken : () => __awaiter(this, void 0, void 0, function* () { return accessToken; });
63
+ }
64
+ return undefined;
65
+ }
66
+ get headers() {
67
+ return this.configuration.headers;
68
+ }
69
+ get credentials() {
70
+ return this.configuration.credentials;
71
+ }
72
+ }
175
73
  exports.Configuration = Configuration;
176
74
  exports.DefaultConfig = new Configuration();
177
75
  /**
178
76
  * This is the base class for all generated API classes.
179
77
  */
180
- var BaseAPI = /** @class */ (function () {
181
- function BaseAPI(configuration) {
182
- if (configuration === void 0) { configuration = exports.DefaultConfig; }
183
- var _this = this;
78
+ class BaseAPI {
79
+ constructor(configuration = exports.DefaultConfig) {
184
80
  this.configuration = configuration;
185
- this.fetchApi = function (url, init) { return __awaiter(_this, void 0, void 0, function () {
186
- var fetchParams, _i, _a, middleware, response, e_1, _b, _c, middleware, _d, _e, middleware;
187
- return __generator(this, function (_f) {
188
- switch (_f.label) {
189
- case 0:
190
- fetchParams = { url: url, init: init };
191
- _i = 0, _a = this.middleware;
192
- _f.label = 1;
193
- case 1:
194
- if (!(_i < _a.length)) return [3 /*break*/, 4];
195
- middleware = _a[_i];
196
- if (!middleware.pre) return [3 /*break*/, 3];
197
- return [4 /*yield*/, middleware.pre(__assign({ fetch: this.fetchApi }, fetchParams))];
198
- case 2:
199
- fetchParams = (_f.sent()) || fetchParams;
200
- _f.label = 3;
201
- case 3:
202
- _i++;
203
- return [3 /*break*/, 1];
204
- case 4:
205
- response = undefined;
206
- _f.label = 5;
207
- case 5:
208
- _f.trys.push([5, 7, , 12]);
209
- return [4 /*yield*/, (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init)];
210
- case 6:
211
- response = _f.sent();
212
- return [3 /*break*/, 12];
213
- case 7:
214
- e_1 = _f.sent();
215
- _b = 0, _c = this.middleware;
216
- _f.label = 8;
217
- case 8:
218
- if (!(_b < _c.length)) return [3 /*break*/, 11];
219
- middleware = _c[_b];
220
- if (!middleware.onError) return [3 /*break*/, 10];
221
- return [4 /*yield*/, middleware.onError({
222
- fetch: this.fetchApi,
223
- url: fetchParams.url,
224
- init: fetchParams.init,
225
- error: e_1,
226
- response: response ? response.clone() : undefined,
227
- })];
228
- case 9:
229
- response = (_f.sent()) || response;
230
- _f.label = 10;
231
- case 10:
232
- _b++;
233
- return [3 /*break*/, 8];
234
- case 11:
235
- if (response === undefined) {
236
- if (e_1 instanceof Error) {
237
- throw new FetchError(e_1, 'The request failed and the interceptors did not return an alternative response');
238
- }
239
- else {
240
- throw e_1;
241
- }
242
- }
243
- return [3 /*break*/, 12];
244
- case 12:
245
- _d = 0, _e = this.middleware;
246
- _f.label = 13;
247
- case 13:
248
- if (!(_d < _e.length)) return [3 /*break*/, 16];
249
- middleware = _e[_d];
250
- if (!middleware.post) return [3 /*break*/, 15];
251
- return [4 /*yield*/, middleware.post({
252
- fetch: this.fetchApi,
253
- url: fetchParams.url,
254
- init: fetchParams.init,
255
- response: response.clone(),
256
- })];
257
- case 14:
258
- response = (_f.sent()) || response;
259
- _f.label = 15;
260
- case 15:
261
- _d++;
262
- return [3 /*break*/, 13];
263
- case 16: return [2 /*return*/, response];
81
+ this.fetchApi = (url, init) => __awaiter(this, void 0, void 0, function* () {
82
+ let fetchParams = { url, init };
83
+ for (const middleware of this.middleware) {
84
+ if (middleware.pre) {
85
+ fetchParams = (yield middleware.pre(Object.assign({ fetch: this.fetchApi }, fetchParams))) || fetchParams;
86
+ }
87
+ }
88
+ let response = undefined;
89
+ try {
90
+ response = yield (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
91
+ }
92
+ catch (e) {
93
+ for (const middleware of this.middleware) {
94
+ if (middleware.onError) {
95
+ response = (yield middleware.onError({
96
+ fetch: this.fetchApi,
97
+ url: fetchParams.url,
98
+ init: fetchParams.init,
99
+ error: e,
100
+ response: response ? response.clone() : undefined,
101
+ })) || response;
102
+ }
103
+ }
104
+ if (response === undefined) {
105
+ if (e instanceof Error) {
106
+ throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
107
+ }
108
+ else {
109
+ throw e;
110
+ }
111
+ }
112
+ }
113
+ for (const middleware of this.middleware) {
114
+ if (middleware.post) {
115
+ response = (yield middleware.post({
116
+ fetch: this.fetchApi,
117
+ url: fetchParams.url,
118
+ init: fetchParams.init,
119
+ response: response.clone(),
120
+ })) || response;
264
121
  }
265
- });
266
- }); };
122
+ }
123
+ return response;
124
+ });
267
125
  this.middleware = configuration.middleware;
268
126
  }
269
- BaseAPI.prototype.isResponseError = function (error) {
127
+ isResponseError(error) {
270
128
  return error instanceof Error && error.name === 'ResponseError';
271
- };
272
- BaseAPI.prototype.withMiddleware = function () {
273
- var _a;
274
- var middlewares = [];
275
- for (var _i = 0; _i < arguments.length; _i++) {
276
- middlewares[_i] = arguments[_i];
277
- }
278
- var next = this.clone();
279
- next.middleware = (_a = next.middleware).concat.apply(_a, middlewares);
129
+ }
130
+ withMiddleware(...middlewares) {
131
+ const next = this.clone();
132
+ next.middleware = next.middleware.concat(...middlewares);
280
133
  return next;
281
- };
282
- BaseAPI.prototype.withPreMiddleware = function () {
283
- var preMiddlewares = [];
284
- for (var _i = 0; _i < arguments.length; _i++) {
285
- preMiddlewares[_i] = arguments[_i];
286
- }
287
- var middlewares = preMiddlewares.map(function (pre) { return ({ pre: pre }); });
288
- return this.withMiddleware.apply(this, middlewares);
289
- };
290
- BaseAPI.prototype.withPostMiddleware = function () {
291
- var postMiddlewares = [];
292
- for (var _i = 0; _i < arguments.length; _i++) {
293
- postMiddlewares[_i] = arguments[_i];
294
- }
295
- var middlewares = postMiddlewares.map(function (post) { return ({ post: post }); });
296
- return this.withMiddleware.apply(this, middlewares);
297
- };
134
+ }
135
+ withPreMiddleware(...preMiddlewares) {
136
+ const middlewares = preMiddlewares.map((pre) => ({ pre }));
137
+ return this.withMiddleware(...middlewares);
138
+ }
139
+ withPostMiddleware(...postMiddlewares) {
140
+ const middlewares = postMiddlewares.map((post) => ({ post }));
141
+ return this.withMiddleware(...middlewares);
142
+ }
298
143
  /**
299
144
  * Check if the given MIME is a JSON MIME.
300
145
  * JSON MIME examples:
@@ -305,96 +150,75 @@ var BaseAPI = /** @class */ (function () {
305
150
  * @param mime - MIME (Multipurpose Internet Mail Extensions)
306
151
  * @return True if the given MIME is JSON, false otherwise.
307
152
  */
308
- BaseAPI.prototype.isJsonMime = function (mime) {
153
+ isJsonMime(mime) {
309
154
  if (!mime) {
310
155
  return false;
311
156
  }
312
157
  return BaseAPI.jsonRegex.test(mime);
313
- };
314
- BaseAPI.prototype.request = function (context, initOverrides) {
315
- return __awaiter(this, void 0, void 0, function () {
316
- var _a, url, init, response;
317
- return __generator(this, function (_b) {
318
- switch (_b.label) {
319
- case 0: return [4 /*yield*/, this.createFetchParams(context, initOverrides)];
320
- case 1:
321
- _a = _b.sent(), url = _a.url, init = _a.init;
322
- return [4 /*yield*/, this.fetchApi(url, init)];
323
- case 2:
324
- response = _b.sent();
325
- if (response && (response.status >= 200 && response.status < 300)) {
326
- return [2 /*return*/, response];
327
- }
328
- throw new ResponseError(response, 'Response returned an error code');
329
- }
330
- });
158
+ }
159
+ request(context, initOverrides) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ const { url, init } = yield this.createFetchParams(context, initOverrides);
162
+ const response = yield this.fetchApi(url, init);
163
+ if (response && (response.status >= 200 && response.status < 300)) {
164
+ return response;
165
+ }
166
+ throw new ResponseError(response, 'Response returned an error code');
331
167
  });
332
- };
333
- BaseAPI.prototype.createFetchParams = function (context, initOverrides) {
334
- return __awaiter(this, void 0, void 0, function () {
335
- var url, headers, initOverrideFn, initParams, overriddenInit, _a, body, init;
336
- var _this = this;
337
- return __generator(this, function (_b) {
338
- switch (_b.label) {
339
- case 0:
340
- url = this.configuration.basePath + context.path;
341
- if (context.query !== undefined && Object.keys(context.query).length !== 0) {
342
- // only add the querystring to the URL if there are query parameters.
343
- // this is done to avoid urls ending with a "?" character which buggy webservers
344
- // do not handle correctly sometimes.
345
- url += '?' + this.configuration.queryParamsStringify(context.query);
346
- }
347
- headers = Object.assign({}, this.configuration.headers, context.headers);
348
- Object.keys(headers).forEach(function (key) { return headers[key] === undefined ? delete headers[key] : {}; });
349
- initOverrideFn = typeof initOverrides === "function"
350
- ? initOverrides
351
- : function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
352
- return [2 /*return*/, initOverrides];
353
- }); }); };
354
- initParams = {
355
- method: context.method,
356
- headers: headers,
357
- body: context.body,
358
- credentials: this.configuration.credentials,
359
- };
360
- _a = [__assign({}, initParams)];
361
- return [4 /*yield*/, initOverrideFn({
362
- init: initParams,
363
- context: context,
364
- })];
365
- case 1:
366
- overriddenInit = __assign.apply(void 0, _a.concat([(_b.sent())]));
367
- if (isFormData(overriddenInit.body)
368
- || (overriddenInit.body instanceof URLSearchParams)
369
- || isBlob(overriddenInit.body)) {
370
- body = overriddenInit.body;
371
- }
372
- else if (this.isJsonMime(headers['Content-Type'])) {
373
- body = JSON.stringify(overriddenInit.body);
374
- }
375
- else {
376
- body = overriddenInit.body;
377
- }
378
- init = __assign(__assign({}, overriddenInit), { body: body });
379
- return [2 /*return*/, { url: url, init: init }];
380
- }
381
- });
168
+ }
169
+ createFetchParams(context, initOverrides) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ let url = this.configuration.basePath + context.path;
172
+ if (context.query !== undefined && Object.keys(context.query).length !== 0) {
173
+ // only add the querystring to the URL if there are query parameters.
174
+ // this is done to avoid urls ending with a "?" character which buggy webservers
175
+ // do not handle correctly sometimes.
176
+ url += '?' + this.configuration.queryParamsStringify(context.query);
177
+ }
178
+ const headers = Object.assign({}, this.configuration.headers, context.headers);
179
+ Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
180
+ const initOverrideFn = typeof initOverrides === "function"
181
+ ? initOverrides
182
+ : () => __awaiter(this, void 0, void 0, function* () { return initOverrides; });
183
+ const initParams = {
184
+ method: context.method,
185
+ headers,
186
+ body: context.body,
187
+ credentials: this.configuration.credentials,
188
+ };
189
+ const overriddenInit = Object.assign(Object.assign({}, initParams), (yield initOverrideFn({
190
+ init: initParams,
191
+ context,
192
+ })));
193
+ let body;
194
+ if (isFormData(overriddenInit.body)
195
+ || (overriddenInit.body instanceof URLSearchParams)
196
+ || isBlob(overriddenInit.body)) {
197
+ body = overriddenInit.body;
198
+ }
199
+ else if (this.isJsonMime(headers['Content-Type'])) {
200
+ body = JSON.stringify(overriddenInit.body);
201
+ }
202
+ else {
203
+ body = overriddenInit.body;
204
+ }
205
+ const init = Object.assign(Object.assign({}, overriddenInit), { body });
206
+ return { url, init };
382
207
  });
383
- };
208
+ }
384
209
  /**
385
210
  * Create a shallow clone of `this` by constructing a new instance
386
211
  * and then shallow cloning data members.
387
212
  */
388
- BaseAPI.prototype.clone = function () {
389
- var constructor = this.constructor;
390
- var next = new constructor(this.configuration);
213
+ clone() {
214
+ const constructor = this.constructor;
215
+ const next = new constructor(this.configuration);
391
216
  next.middleware = this.middleware.slice();
392
217
  return next;
393
- };
394
- BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
395
- return BaseAPI;
396
- }());
218
+ }
219
+ }
397
220
  exports.BaseAPI = BaseAPI;
221
+ BaseAPI.jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
398
222
  ;
399
223
  function isBlob(value) {
400
224
  return typeof Blob !== 'undefined' && value instanceof Blob;
@@ -402,38 +226,29 @@ function isBlob(value) {
402
226
  function isFormData(value) {
403
227
  return typeof FormData !== "undefined" && value instanceof FormData;
404
228
  }
405
- var ResponseError = /** @class */ (function (_super) {
406
- __extends(ResponseError, _super);
407
- function ResponseError(response, msg) {
408
- var _this = _super.call(this, msg) || this;
409
- _this.response = response;
410
- _this.name = "ResponseError";
411
- return _this;
412
- }
413
- return ResponseError;
414
- }(Error));
229
+ class ResponseError extends Error {
230
+ constructor(response, msg) {
231
+ super(msg);
232
+ this.response = response;
233
+ this.name = "ResponseError";
234
+ }
235
+ }
415
236
  exports.ResponseError = ResponseError;
416
- var FetchError = /** @class */ (function (_super) {
417
- __extends(FetchError, _super);
418
- function FetchError(cause, msg) {
419
- var _this = _super.call(this, msg) || this;
420
- _this.cause = cause;
421
- _this.name = "FetchError";
422
- return _this;
423
- }
424
- return FetchError;
425
- }(Error));
237
+ class FetchError extends Error {
238
+ constructor(cause, msg) {
239
+ super(msg);
240
+ this.cause = cause;
241
+ this.name = "FetchError";
242
+ }
243
+ }
426
244
  exports.FetchError = FetchError;
427
- var RequiredError = /** @class */ (function (_super) {
428
- __extends(RequiredError, _super);
429
- function RequiredError(field, msg) {
430
- var _this = _super.call(this, msg) || this;
431
- _this.field = field;
432
- _this.name = "RequiredError";
433
- return _this;
434
- }
435
- return RequiredError;
436
- }(Error));
245
+ class RequiredError extends Error {
246
+ constructor(field, msg) {
247
+ super(msg);
248
+ this.field = field;
249
+ this.name = "RequiredError";
250
+ }
251
+ }
437
252
  exports.RequiredError = RequiredError;
438
253
  exports.COLLECTION_FORMATS = {
439
254
  csv: ",",
@@ -442,48 +257,42 @@ exports.COLLECTION_FORMATS = {
442
257
  pipes: "|",
443
258
  };
444
259
  function exists(json, key) {
445
- var value = json[key];
260
+ const value = json[key];
446
261
  return value !== null && value !== undefined;
447
262
  }
448
263
  exports.exists = exists;
449
- function querystring(params, prefix) {
450
- if (prefix === void 0) { prefix = ''; }
264
+ function querystring(params, prefix = '') {
451
265
  return Object.keys(params)
452
- .map(function (key) { return querystringSingleKey(key, params[key], prefix); })
453
- .filter(function (part) { return part.length > 0; })
266
+ .map(key => querystringSingleKey(key, params[key], prefix))
267
+ .filter(part => part.length > 0)
454
268
  .join('&');
455
269
  }
456
270
  exports.querystring = querystring;
457
- function querystringSingleKey(key, value, keyPrefix) {
458
- if (keyPrefix === void 0) { keyPrefix = ''; }
459
- var fullKey = keyPrefix + (keyPrefix.length ? "[".concat(key, "]") : key);
271
+ function querystringSingleKey(key, value, keyPrefix = '') {
272
+ const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
460
273
  if (value instanceof Array) {
461
- var multiValue = value.map(function (singleValue) { return encodeURIComponent(String(singleValue)); })
462
- .join("&".concat(encodeURIComponent(fullKey), "[]="));
463
- return "".concat(encodeURIComponent(fullKey), "[]=").concat(multiValue);
274
+ const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
275
+ .join(`&${encodeURIComponent(fullKey)}[]=`);
276
+ return `${encodeURIComponent(fullKey)}[]=${multiValue}`;
464
277
  }
465
278
  if (value instanceof Set) {
466
- var valueAsArray = Array.from(value);
279
+ const valueAsArray = Array.from(value);
467
280
  return querystringSingleKey(key, valueAsArray, keyPrefix);
468
281
  }
469
282
  if (value instanceof Date) {
470
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(value.toISOString()));
283
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
471
284
  }
472
285
  if (value instanceof Object) {
473
286
  return querystring(value, fullKey);
474
287
  }
475
- return "".concat(encodeURIComponent(fullKey), "=").concat(encodeURIComponent(String(value)));
288
+ return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
476
289
  }
477
290
  function mapValues(data, fn) {
478
- return Object.keys(data).reduce(function (acc, key) {
479
- var _a;
480
- return (__assign(__assign({}, acc), (_a = {}, _a[key] = fn(data[key]), _a)));
481
- }, {});
291
+ return Object.keys(data).reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: fn(data[key]) })), {});
482
292
  }
483
293
  exports.mapValues = mapValues;
484
294
  function canConsumeForm(consumes) {
485
- for (var _i = 0, consumes_1 = consumes; _i < consumes_1.length; _i++) {
486
- var consume = consumes_1[_i];
295
+ for (const consume of consumes) {
487
296
  if ('multipart/form-data' === consume.contentType) {
488
297
  return true;
489
298
  }
@@ -491,75 +300,50 @@ function canConsumeForm(consumes) {
491
300
  return false;
492
301
  }
493
302
  exports.canConsumeForm = canConsumeForm;
494
- var JSONApiResponse = /** @class */ (function () {
495
- function JSONApiResponse(raw, transformer) {
496
- if (transformer === void 0) { transformer = function (jsonValue) { return jsonValue; }; }
303
+ class JSONApiResponse {
304
+ constructor(raw, transformer = (jsonValue) => jsonValue) {
497
305
  this.raw = raw;
498
306
  this.transformer = transformer;
499
307
  }
500
- JSONApiResponse.prototype.value = function () {
501
- return __awaiter(this, void 0, void 0, function () {
502
- var _a;
503
- return __generator(this, function (_b) {
504
- switch (_b.label) {
505
- case 0:
506
- _a = this.transformer;
507
- return [4 /*yield*/, this.raw.json()];
508
- case 1: return [2 /*return*/, _a.apply(this, [_b.sent()])];
509
- }
510
- });
308
+ value() {
309
+ return __awaiter(this, void 0, void 0, function* () {
310
+ return this.transformer(yield this.raw.json());
511
311
  });
512
- };
513
- return JSONApiResponse;
514
- }());
312
+ }
313
+ }
515
314
  exports.JSONApiResponse = JSONApiResponse;
516
- var VoidApiResponse = /** @class */ (function () {
517
- function VoidApiResponse(raw) {
315
+ class VoidApiResponse {
316
+ constructor(raw) {
518
317
  this.raw = raw;
519
318
  }
520
- VoidApiResponse.prototype.value = function () {
521
- return __awaiter(this, void 0, void 0, function () {
522
- return __generator(this, function (_a) {
523
- return [2 /*return*/, undefined];
524
- });
319
+ value() {
320
+ return __awaiter(this, void 0, void 0, function* () {
321
+ return undefined;
525
322
  });
526
- };
527
- return VoidApiResponse;
528
- }());
323
+ }
324
+ }
529
325
  exports.VoidApiResponse = VoidApiResponse;
530
- var BlobApiResponse = /** @class */ (function () {
531
- function BlobApiResponse(raw) {
326
+ class BlobApiResponse {
327
+ constructor(raw) {
532
328
  this.raw = raw;
533
329
  }
534
- BlobApiResponse.prototype.value = function () {
535
- return __awaiter(this, void 0, void 0, function () {
536
- return __generator(this, function (_a) {
537
- switch (_a.label) {
538
- case 0: return [4 /*yield*/, this.raw.blob()];
539
- case 1: return [2 /*return*/, _a.sent()];
540
- }
541
- });
330
+ value() {
331
+ return __awaiter(this, void 0, void 0, function* () {
332
+ return yield this.raw.blob();
542
333
  });
543
- };
334
+ }
544
335
  ;
545
- return BlobApiResponse;
546
- }());
336
+ }
547
337
  exports.BlobApiResponse = BlobApiResponse;
548
- var TextApiResponse = /** @class */ (function () {
549
- function TextApiResponse(raw) {
338
+ class TextApiResponse {
339
+ constructor(raw) {
550
340
  this.raw = raw;
551
341
  }
552
- TextApiResponse.prototype.value = function () {
553
- return __awaiter(this, void 0, void 0, function () {
554
- return __generator(this, function (_a) {
555
- switch (_a.label) {
556
- case 0: return [4 /*yield*/, this.raw.text()];
557
- case 1: return [2 /*return*/, _a.sent()];
558
- }
559
- });
342
+ value() {
343
+ return __awaiter(this, void 0, void 0, function* () {
344
+ return yield this.raw.text();
560
345
  });
561
- };
346
+ }
562
347
  ;
563
- return TextApiResponse;
564
- }());
348
+ }
565
349
  exports.TextApiResponse = TextApiResponse;