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