edge-impulse-api 1.82.6 → 1.82.7

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 (127) hide show
  1. package/build/library/sdk/api/adminApi.d.ts +4 -6
  2. package/build/library/sdk/api/adminApi.js +4782 -4928
  3. package/build/library/sdk/api/adminApi.js.map +1 -1
  4. package/build/library/sdk/api/authApi.d.ts +4 -6
  5. package/build/library/sdk/api/authApi.js +88 -56
  6. package/build/library/sdk/api/authApi.js.map +1 -1
  7. package/build/library/sdk/api/cDNApi.d.ts +4 -6
  8. package/build/library/sdk/api/cDNApi.js +76 -53
  9. package/build/library/sdk/api/cDNApi.js.map +1 -1
  10. package/build/library/sdk/api/canaryApi.d.ts +4 -6
  11. package/build/library/sdk/api/canaryApi.js +79 -53
  12. package/build/library/sdk/api/canaryApi.js.map +1 -1
  13. package/build/library/sdk/api/classifyApi.d.ts +4 -6
  14. package/build/library/sdk/api/classifyApi.js +527 -499
  15. package/build/library/sdk/api/classifyApi.js.map +1 -1
  16. package/build/library/sdk/api/dSPApi.d.ts +4 -6
  17. package/build/library/sdk/api/dSPApi.js +938 -942
  18. package/build/library/sdk/api/dSPApi.js.map +1 -1
  19. package/build/library/sdk/api/deploymentApi.d.ts +4 -6
  20. package/build/library/sdk/api/deploymentApi.js +680 -603
  21. package/build/library/sdk/api/deploymentApi.js.map +1 -1
  22. package/build/library/sdk/api/devicesApi.d.ts +4 -6
  23. package/build/library/sdk/api/devicesApi.js +802 -800
  24. package/build/library/sdk/api/devicesApi.js.map +1 -1
  25. package/build/library/sdk/api/emailVerificationApi.d.ts +4 -6
  26. package/build/library/sdk/api/emailVerificationApi.js +184 -190
  27. package/build/library/sdk/api/emailVerificationApi.js.map +1 -1
  28. package/build/library/sdk/api/exportApi.d.ts +4 -6
  29. package/build/library/sdk/api/exportApi.js +88 -56
  30. package/build/library/sdk/api/exportApi.js.map +1 -1
  31. package/build/library/sdk/api/featureFlagsApi.d.ts +4 -6
  32. package/build/library/sdk/api/featureFlagsApi.js +76 -52
  33. package/build/library/sdk/api/featureFlagsApi.js.map +1 -1
  34. package/build/library/sdk/api/healthApi.d.ts +4 -6
  35. package/build/library/sdk/api/healthApi.js +111 -97
  36. package/build/library/sdk/api/healthApi.js.map +1 -1
  37. package/build/library/sdk/api/impulseApi.d.ts +4 -6
  38. package/build/library/sdk/api/impulseApi.js +942 -902
  39. package/build/library/sdk/api/impulseApi.js.map +1 -1
  40. package/build/library/sdk/api/integrationsApi.d.ts +4 -6
  41. package/build/library/sdk/api/integrationsApi.js +136 -106
  42. package/build/library/sdk/api/integrationsApi.js.map +1 -1
  43. package/build/library/sdk/api/jobsApi.d.ts +4 -6
  44. package/build/library/sdk/api/jobsApi.js +2270 -2326
  45. package/build/library/sdk/api/jobsApi.js.map +1 -1
  46. package/build/library/sdk/api/learnApi.d.ts +22 -6
  47. package/build/library/sdk/api/learnApi.js +1597 -1424
  48. package/build/library/sdk/api/learnApi.js.map +1 -1
  49. package/build/library/sdk/api/loginApi.d.ts +4 -6
  50. package/build/library/sdk/api/loginApi.js +112 -98
  51. package/build/library/sdk/api/loginApi.js.map +1 -1
  52. package/build/library/sdk/api/metricsApi.d.ts +4 -6
  53. package/build/library/sdk/api/metricsApi.js +148 -144
  54. package/build/library/sdk/api/metricsApi.js.map +1 -1
  55. package/build/library/sdk/api/optimizationApi.d.ts +4 -6
  56. package/build/library/sdk/api/optimizationApi.js +844 -844
  57. package/build/library/sdk/api/optimizationApi.js.map +1 -1
  58. package/build/library/sdk/api/organizationBlocksApi.d.ts +4 -6
  59. package/build/library/sdk/api/organizationBlocksApi.js +1968 -1550
  60. package/build/library/sdk/api/organizationBlocksApi.js.map +1 -1
  61. package/build/library/sdk/api/organizationCreateProjectApi.d.ts +4 -6
  62. package/build/library/sdk/api/organizationCreateProjectApi.js +700 -652
  63. package/build/library/sdk/api/organizationCreateProjectApi.js.map +1 -1
  64. package/build/library/sdk/api/organizationDataApi.d.ts +4 -6
  65. package/build/library/sdk/api/organizationDataApi.js +2074 -1985
  66. package/build/library/sdk/api/organizationDataApi.js.map +1 -1
  67. package/build/library/sdk/api/organizationDataCampaignsApi.d.ts +4 -6
  68. package/build/library/sdk/api/organizationDataCampaignsApi.js +626 -602
  69. package/build/library/sdk/api/organizationDataCampaignsApi.js.map +1 -1
  70. package/build/library/sdk/api/organizationJobsApi.d.ts +4 -6
  71. package/build/library/sdk/api/organizationJobsApi.js +417 -399
  72. package/build/library/sdk/api/organizationJobsApi.js.map +1 -1
  73. package/build/library/sdk/api/organizationPipelinesApi.d.ts +4 -6
  74. package/build/library/sdk/api/organizationPipelinesApi.js +419 -401
  75. package/build/library/sdk/api/organizationPipelinesApi.js.map +1 -1
  76. package/build/library/sdk/api/organizationPortalsApi.d.ts +4 -6
  77. package/build/library/sdk/api/organizationPortalsApi.js +372 -352
  78. package/build/library/sdk/api/organizationPortalsApi.js.map +1 -1
  79. package/build/library/sdk/api/organizationsApi.d.ts +4 -6
  80. package/build/library/sdk/api/organizationsApi.js +4024 -4050
  81. package/build/library/sdk/api/organizationsApi.js.map +1 -1
  82. package/build/library/sdk/api/performanceCalibrationApi.d.ts +4 -6
  83. package/build/library/sdk/api/performanceCalibrationApi.js +586 -560
  84. package/build/library/sdk/api/performanceCalibrationApi.js.map +1 -1
  85. package/build/library/sdk/api/postProcessingApi.d.ts +4 -6
  86. package/build/library/sdk/api/postProcessingApi.js +279 -255
  87. package/build/library/sdk/api/postProcessingApi.js.map +1 -1
  88. package/build/library/sdk/api/projectsApi.d.ts +4 -6
  89. package/build/library/sdk/api/projectsApi.js +2758 -2818
  90. package/build/library/sdk/api/projectsApi.js.map +1 -1
  91. package/build/library/sdk/api/rawDataApi.d.ts +4 -6
  92. package/build/library/sdk/api/rawDataApi.js +3055 -3131
  93. package/build/library/sdk/api/rawDataApi.js.map +1 -1
  94. package/build/library/sdk/api/testApi.d.ts +4 -6
  95. package/build/library/sdk/api/testApi.js +152 -108
  96. package/build/library/sdk/api/testApi.js.map +1 -1
  97. package/build/library/sdk/api/themesApi.d.ts +4 -6
  98. package/build/library/sdk/api/themesApi.js +341 -305
  99. package/build/library/sdk/api/themesApi.js.map +1 -1
  100. package/build/library/sdk/api/thirdPartyAuthApi.d.ts +4 -6
  101. package/build/library/sdk/api/thirdPartyAuthApi.js +387 -353
  102. package/build/library/sdk/api/thirdPartyAuthApi.js.map +1 -1
  103. package/build/library/sdk/api/uploadPortalApi.d.ts +4 -6
  104. package/build/library/sdk/api/uploadPortalApi.js +375 -355
  105. package/build/library/sdk/api/uploadPortalApi.js.map +1 -1
  106. package/build/library/sdk/api/userApi.d.ts +4 -6
  107. package/build/library/sdk/api/userApi.js +2345 -2452
  108. package/build/library/sdk/api/userApi.js.map +1 -1
  109. package/build/library/sdk/api/vlmApi.d.ts +4 -6
  110. package/build/library/sdk/api/vlmApi.js +277 -253
  111. package/build/library/sdk/api/vlmApi.js.map +1 -1
  112. package/build/library/sdk/api/whitelabelsApi.d.ts +4 -6
  113. package/build/library/sdk/api/whitelabelsApi.js +408 -398
  114. package/build/library/sdk/api/whitelabelsApi.js.map +1 -1
  115. package/build/library/sdk/model/deployPretrainedModelRequest.d.ts +4 -0
  116. package/build/library/sdk/model/deployPretrainedModelRequest.js +5 -0
  117. package/build/library/sdk/model/deployPretrainedModelRequest.js.map +1 -1
  118. package/build/library/sdk/model/models.d.ts +47 -7
  119. package/build/library/sdk/model/models.js +33 -22
  120. package/build/library/sdk/model/models.js.map +1 -1
  121. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.d.ts +47 -0
  122. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js +55 -0
  123. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js.map +1 -0
  124. package/build/library/sdk/model/uploadPretrainedModelRequest.d.ts +4 -0
  125. package/build/library/sdk/model/uploadPretrainedModelRequest.js +5 -0
  126. package/build/library/sdk/model/uploadPretrainedModelRequest.js.map +1 -1
  127. package/package.json +3 -2
@@ -12,14 +12,31 @@
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.OrganizationBlocksApi = exports.OrganizationBlocksApiApiKeys = void 0;
15
- // tslint:disable-next-line: variable-name, no-var-requires
16
15
  const PATH = require('path');
17
- // tslint:disable-next-line: no-unsafe-any
18
16
  module.paths.push(PATH.join(process.cwd(), 'node_modules'));
19
- const localVarRequest = require("request");
17
+ let fetch;
18
+ let FormData;
19
+ if (globalThis.fetch && globalThis.FormData) {
20
+ fetch = globalThis.fetch;
21
+ FormData = globalThis.FormData;
22
+ }
23
+ else {
24
+ const undici = require('undici');
25
+ fetch = undici.fetch;
26
+ FormData = undici.FormData;
27
+ }
20
28
  const models_1 = require("../model/models");
21
29
  const models_2 = require("../model/models");
22
30
  let defaultBasePath = 'https://studio.edgeimpulse.com/v1';
31
+ async function parseResponse(res) {
32
+ const ct = (res.headers.get('content-type') || '').toLowerCase();
33
+ if (ct.includes('application/json'))
34
+ return res.json();
35
+ if (/^(image|video|audio)\/|application\/(octet-stream|zip|x-tar|cbor)/.test(ct)) {
36
+ return Buffer.from(await res.arrayBuffer());
37
+ }
38
+ return res.text();
39
+ }
23
40
  // ===============================================
24
41
  // This file is autogenerated - Please do not edit
25
42
  // ===============================================
@@ -30,10 +47,30 @@ var OrganizationBlocksApiApiKeys;
30
47
  OrganizationBlocksApiApiKeys[OrganizationBlocksApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
31
48
  })(OrganizationBlocksApiApiKeys = exports.OrganizationBlocksApiApiKeys || (exports.OrganizationBlocksApiApiKeys = {}));
32
49
  class OrganizationBlocksApi {
50
+ async handleResponse(response, returnType) {
51
+ let body = await parseResponse(response);
52
+ if (!response.ok) {
53
+ let errorMsg;
54
+ if (typeof body === 'object' && body !== null && 'error' in body) {
55
+ errorMsg = body.error;
56
+ }
57
+ else {
58
+ errorMsg = `Failed to call "${response.url}", returned ${response.status}: ` + (typeof body === 'string' ? body : JSON.stringify(body));
59
+ }
60
+ throw new Error(errorMsg);
61
+ }
62
+ if (returnType) {
63
+ body = models_1.ObjectSerializer.deserialize(body, returnType);
64
+ }
65
+ if (typeof body.success === 'boolean' && !body.success) {
66
+ const errString = `Failed to call "${response.url}", returned ${response.status}: ` + body.error;
67
+ throw new Error(body.error || errString);
68
+ }
69
+ return body;
70
+ }
33
71
  constructor(basePathOrUsername, opts, password, basePath) {
34
72
  this._basePath = defaultBasePath;
35
73
  this.defaultHeaders = {};
36
- this._useQuerystring = false;
37
74
  this._opts = {};
38
75
  this.authentications = {
39
76
  'default': new models_1.VoidAuth(),
@@ -54,9 +91,6 @@ class OrganizationBlocksApi {
54
91
  }
55
92
  this.opts = opts !== null && opts !== void 0 ? opts : {};
56
93
  }
57
- set useQuerystring(value) {
58
- this._useQuerystring = value;
59
- }
60
94
  set basePath(basePath) {
61
95
  this._basePath = basePath;
62
96
  }
@@ -104,9 +138,11 @@ class OrganizationBlocksApi {
104
138
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/deploy'
105
139
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
106
140
  let localVarQueryParameters = {};
107
- let localVarHeaderParams = Object.assign({
108
- 'User-Agent': 'edgeimpulse-api nodejs'
109
- }, this.defaultHeaders);
141
+ let localVarHeaderParams = {
142
+ 'User-Agent': 'edgeimpulse-api nodejs',
143
+ 'Content-Type': 'application/json',
144
+ ...this.defaultHeaders,
145
+ };
110
146
  const produces = ['application/json'];
111
147
  // give precedence to 'application/json'
112
148
  if (produces.indexOf('application/json') >= 0) {
@@ -115,7 +151,7 @@ class OrganizationBlocksApi {
115
151
  else {
116
152
  localVarHeaderParams.Accept = produces.join(',');
117
153
  }
118
- let localVarFormParams = {};
154
+ let localVarFormParams;
119
155
  // verify required parameter 'organizationId' is not null or undefined
120
156
  if (organizationId === null || organizationId === undefined) {
121
157
  throw new Error('Required parameter organizationId was null or undefined when calling addOrganizationDeployBlock.');
@@ -136,107 +172,325 @@ class OrganizationBlocksApi {
136
172
  if (params.cliArguments === null || params.cliArguments === undefined) {
137
173
  throw new Error('Required parameter params.cliArguments was null or undefined when calling addOrganizationDeployBlock.');
138
174
  }
139
- Object.assign(localVarHeaderParams, options.headers);
140
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
141
- let localVarUseFormData = false;
175
+ localVarHeaderParams = {
176
+ ...localVarHeaderParams,
177
+ ...options.headers,
178
+ ...this.opts.extraHeaders,
179
+ };
142
180
  if (params.name !== undefined) {
143
- localVarFormParams['name'] = models_1.ObjectSerializer.serializeFormData(params.name, "string");
181
+ const isParametersField = "name" === "parameters";
182
+ const serializableParams = isParametersField && params && ("parameters" in params);
183
+ const nameSerialized = serializableParams
184
+ ? JSON.stringify(params.parameters)
185
+ : models_1.ObjectSerializer.serializeFormData(params.name, "string");
186
+ if (localVarFormParams instanceof FormData) {
187
+ localVarFormParams.append('name', nameSerialized);
188
+ }
189
+ else {
190
+ if (!localVarFormParams) {
191
+ localVarFormParams = {};
192
+ }
193
+ localVarFormParams['name'] = nameSerialized;
194
+ }
144
195
  }
145
196
  if (params.dockerContainer !== undefined) {
146
- localVarFormParams['dockerContainer'] = models_1.ObjectSerializer.serializeFormData(params.dockerContainer, "string");
197
+ const isParametersField = "dockerContainer" === "parameters";
198
+ const serializableParams = isParametersField && params && ("parameters" in params);
199
+ const dockerContainerSerialized = serializableParams
200
+ ? JSON.stringify(params.parameters)
201
+ : models_1.ObjectSerializer.serializeFormData(params.dockerContainer, "string");
202
+ if (localVarFormParams instanceof FormData) {
203
+ localVarFormParams.append('dockerContainer', dockerContainerSerialized);
204
+ }
205
+ else {
206
+ if (!localVarFormParams) {
207
+ localVarFormParams = {};
208
+ }
209
+ localVarFormParams['dockerContainer'] = dockerContainerSerialized;
210
+ }
147
211
  }
148
212
  if (params.description !== undefined) {
149
- localVarFormParams['description'] = models_1.ObjectSerializer.serializeFormData(params.description, "string");
213
+ const isParametersField = "description" === "parameters";
214
+ const serializableParams = isParametersField && params && ("parameters" in params);
215
+ const descriptionSerialized = serializableParams
216
+ ? JSON.stringify(params.parameters)
217
+ : models_1.ObjectSerializer.serializeFormData(params.description, "string");
218
+ if (localVarFormParams instanceof FormData) {
219
+ localVarFormParams.append('description', descriptionSerialized);
220
+ }
221
+ else {
222
+ if (!localVarFormParams) {
223
+ localVarFormParams = {};
224
+ }
225
+ localVarFormParams['description'] = descriptionSerialized;
226
+ }
150
227
  }
151
228
  if (params.cliArguments !== undefined) {
152
- localVarFormParams['cliArguments'] = models_1.ObjectSerializer.serializeFormData(params.cliArguments, "string");
229
+ const isParametersField = "cliArguments" === "parameters";
230
+ const serializableParams = isParametersField && params && ("parameters" in params);
231
+ const cliArgumentsSerialized = serializableParams
232
+ ? JSON.stringify(params.parameters)
233
+ : models_1.ObjectSerializer.serializeFormData(params.cliArguments, "string");
234
+ if (localVarFormParams instanceof FormData) {
235
+ localVarFormParams.append('cliArguments', cliArgumentsSerialized);
236
+ }
237
+ else {
238
+ if (!localVarFormParams) {
239
+ localVarFormParams = {};
240
+ }
241
+ localVarFormParams['cliArguments'] = cliArgumentsSerialized;
242
+ }
153
243
  }
154
244
  if (params.requestsCpu !== undefined) {
155
- localVarFormParams['requestsCpu'] = models_1.ObjectSerializer.serializeFormData(params.requestsCpu, "number");
245
+ const isParametersField = "requestsCpu" === "parameters";
246
+ const serializableParams = isParametersField && params && ("parameters" in params);
247
+ const requestsCpuSerialized = serializableParams
248
+ ? JSON.stringify(params.parameters)
249
+ : models_1.ObjectSerializer.serializeFormData(params.requestsCpu, "number");
250
+ if (localVarFormParams instanceof FormData) {
251
+ localVarFormParams.append('requestsCpu', requestsCpuSerialized);
252
+ }
253
+ else {
254
+ if (!localVarFormParams) {
255
+ localVarFormParams = {};
256
+ }
257
+ localVarFormParams['requestsCpu'] = requestsCpuSerialized;
258
+ }
156
259
  }
157
260
  if (params.requestsMemory !== undefined) {
158
- localVarFormParams['requestsMemory'] = models_1.ObjectSerializer.serializeFormData(params.requestsMemory, "number");
261
+ const isParametersField = "requestsMemory" === "parameters";
262
+ const serializableParams = isParametersField && params && ("parameters" in params);
263
+ const requestsMemorySerialized = serializableParams
264
+ ? JSON.stringify(params.parameters)
265
+ : models_1.ObjectSerializer.serializeFormData(params.requestsMemory, "number");
266
+ if (localVarFormParams instanceof FormData) {
267
+ localVarFormParams.append('requestsMemory', requestsMemorySerialized);
268
+ }
269
+ else {
270
+ if (!localVarFormParams) {
271
+ localVarFormParams = {};
272
+ }
273
+ localVarFormParams['requestsMemory'] = requestsMemorySerialized;
274
+ }
159
275
  }
160
276
  if (params.limitsCpu !== undefined) {
161
- localVarFormParams['limitsCpu'] = models_1.ObjectSerializer.serializeFormData(params.limitsCpu, "number");
277
+ const isParametersField = "limitsCpu" === "parameters";
278
+ const serializableParams = isParametersField && params && ("parameters" in params);
279
+ const limitsCpuSerialized = serializableParams
280
+ ? JSON.stringify(params.parameters)
281
+ : models_1.ObjectSerializer.serializeFormData(params.limitsCpu, "number");
282
+ if (localVarFormParams instanceof FormData) {
283
+ localVarFormParams.append('limitsCpu', limitsCpuSerialized);
284
+ }
285
+ else {
286
+ if (!localVarFormParams) {
287
+ localVarFormParams = {};
288
+ }
289
+ localVarFormParams['limitsCpu'] = limitsCpuSerialized;
290
+ }
162
291
  }
163
292
  if (params.limitsMemory !== undefined) {
164
- localVarFormParams['limitsMemory'] = models_1.ObjectSerializer.serializeFormData(params.limitsMemory, "number");
293
+ const isParametersField = "limitsMemory" === "parameters";
294
+ const serializableParams = isParametersField && params && ("parameters" in params);
295
+ const limitsMemorySerialized = serializableParams
296
+ ? JSON.stringify(params.parameters)
297
+ : models_1.ObjectSerializer.serializeFormData(params.limitsMemory, "number");
298
+ if (localVarFormParams instanceof FormData) {
299
+ localVarFormParams.append('limitsMemory', limitsMemorySerialized);
300
+ }
301
+ else {
302
+ if (!localVarFormParams) {
303
+ localVarFormParams = {};
304
+ }
305
+ localVarFormParams['limitsMemory'] = limitsMemorySerialized;
306
+ }
165
307
  }
166
308
  if (params.photo !== undefined) {
167
- localVarFormParams['photo'] = params.photo;
309
+ if (!(localVarFormParams instanceof FormData)) {
310
+ const existingParams = localVarFormParams;
311
+ localVarFormParams = new FormData();
312
+ if (existingParams && typeof existingParams === 'object') {
313
+ Object.keys(existingParams).forEach(key => {
314
+ localVarFormParams.append(key, existingParams[key]);
315
+ });
316
+ }
317
+ }
318
+ const photoFiles = Array.isArray(params.photo) ? params.photo : [params.photo];
319
+ const Blob = globalThis.Blob || require('buffer').Blob;
320
+ photoFiles.forEach((f) => {
321
+ localVarFormParams.append('photo', new Blob([f.value], {
322
+ type: f.options.contentType
323
+ }), f.options.filename);
324
+ });
168
325
  }
169
- localVarUseFormData = true;
170
326
  if (params.integrateUrl !== undefined) {
171
- localVarFormParams['integrateUrl'] = models_1.ObjectSerializer.serializeFormData(params.integrateUrl, "string");
327
+ const isParametersField = "integrateUrl" === "parameters";
328
+ const serializableParams = isParametersField && params && ("parameters" in params);
329
+ const integrateUrlSerialized = serializableParams
330
+ ? JSON.stringify(params.parameters)
331
+ : models_1.ObjectSerializer.serializeFormData(params.integrateUrl, "string");
332
+ if (localVarFormParams instanceof FormData) {
333
+ localVarFormParams.append('integrateUrl', integrateUrlSerialized);
334
+ }
335
+ else {
336
+ if (!localVarFormParams) {
337
+ localVarFormParams = {};
338
+ }
339
+ localVarFormParams['integrateUrl'] = integrateUrlSerialized;
340
+ }
172
341
  }
173
342
  if (params.privileged !== undefined) {
174
- localVarFormParams['privileged'] = models_1.ObjectSerializer.serializeFormData(params.privileged, "boolean");
343
+ const isParametersField = "privileged" === "parameters";
344
+ const serializableParams = isParametersField && params && ("parameters" in params);
345
+ const privilegedSerialized = serializableParams
346
+ ? JSON.stringify(params.parameters)
347
+ : models_1.ObjectSerializer.serializeFormData(params.privileged, "boolean");
348
+ if (localVarFormParams instanceof FormData) {
349
+ localVarFormParams.append('privileged', privilegedSerialized);
350
+ }
351
+ else {
352
+ if (!localVarFormParams) {
353
+ localVarFormParams = {};
354
+ }
355
+ localVarFormParams['privileged'] = privilegedSerialized;
356
+ }
175
357
  }
176
358
  if (params.mountLearnBlock !== undefined) {
177
- localVarFormParams['mountLearnBlock'] = models_1.ObjectSerializer.serializeFormData(params.mountLearnBlock, "boolean");
359
+ const isParametersField = "mountLearnBlock" === "parameters";
360
+ const serializableParams = isParametersField && params && ("parameters" in params);
361
+ const mountLearnBlockSerialized = serializableParams
362
+ ? JSON.stringify(params.parameters)
363
+ : models_1.ObjectSerializer.serializeFormData(params.mountLearnBlock, "boolean");
364
+ if (localVarFormParams instanceof FormData) {
365
+ localVarFormParams.append('mountLearnBlock', mountLearnBlockSerialized);
366
+ }
367
+ else {
368
+ if (!localVarFormParams) {
369
+ localVarFormParams = {};
370
+ }
371
+ localVarFormParams['mountLearnBlock'] = mountLearnBlockSerialized;
372
+ }
178
373
  }
179
374
  if (params.supportsEonCompiler !== undefined) {
180
- localVarFormParams['supportsEonCompiler'] = models_1.ObjectSerializer.serializeFormData(params.supportsEonCompiler, "boolean");
375
+ const isParametersField = "supportsEonCompiler" === "parameters";
376
+ const serializableParams = isParametersField && params && ("parameters" in params);
377
+ const supportsEonCompilerSerialized = serializableParams
378
+ ? JSON.stringify(params.parameters)
379
+ : models_1.ObjectSerializer.serializeFormData(params.supportsEonCompiler, "boolean");
380
+ if (localVarFormParams instanceof FormData) {
381
+ localVarFormParams.append('supportsEonCompiler', supportsEonCompilerSerialized);
382
+ }
383
+ else {
384
+ if (!localVarFormParams) {
385
+ localVarFormParams = {};
386
+ }
387
+ localVarFormParams['supportsEonCompiler'] = supportsEonCompilerSerialized;
388
+ }
181
389
  }
182
390
  if (params.showOptimizations !== undefined) {
183
- localVarFormParams['showOptimizations'] = models_1.ObjectSerializer.serializeFormData(params.showOptimizations, "boolean");
391
+ const isParametersField = "showOptimizations" === "parameters";
392
+ const serializableParams = isParametersField && params && ("parameters" in params);
393
+ const showOptimizationsSerialized = serializableParams
394
+ ? JSON.stringify(params.parameters)
395
+ : models_1.ObjectSerializer.serializeFormData(params.showOptimizations, "boolean");
396
+ if (localVarFormParams instanceof FormData) {
397
+ localVarFormParams.append('showOptimizations', showOptimizationsSerialized);
398
+ }
399
+ else {
400
+ if (!localVarFormParams) {
401
+ localVarFormParams = {};
402
+ }
403
+ localVarFormParams['showOptimizations'] = showOptimizationsSerialized;
404
+ }
184
405
  }
185
406
  if (params.category !== undefined) {
186
- localVarFormParams['category'] = models_1.ObjectSerializer.serializeFormData(params.category, "string");
407
+ const isParametersField = "category" === "parameters";
408
+ const serializableParams = isParametersField && params && ("parameters" in params);
409
+ const categorySerialized = serializableParams
410
+ ? JSON.stringify(params.parameters)
411
+ : models_1.ObjectSerializer.serializeFormData(params.category, "string");
412
+ if (localVarFormParams instanceof FormData) {
413
+ localVarFormParams.append('category', categorySerialized);
414
+ }
415
+ else {
416
+ if (!localVarFormParams) {
417
+ localVarFormParams = {};
418
+ }
419
+ localVarFormParams['category'] = categorySerialized;
420
+ }
187
421
  }
188
422
  if (params.sourceCodeDownloadStaffOnly !== undefined) {
189
- localVarFormParams['sourceCodeDownloadStaffOnly'] = models_1.ObjectSerializer.serializeFormData(params.sourceCodeDownloadStaffOnly, "boolean");
423
+ const isParametersField = "sourceCodeDownloadStaffOnly" === "parameters";
424
+ const serializableParams = isParametersField && params && ("parameters" in params);
425
+ const sourceCodeDownloadStaffOnlySerialized = serializableParams
426
+ ? JSON.stringify(params.parameters)
427
+ : models_1.ObjectSerializer.serializeFormData(params.sourceCodeDownloadStaffOnly, "boolean");
428
+ if (localVarFormParams instanceof FormData) {
429
+ localVarFormParams.append('sourceCodeDownloadStaffOnly', sourceCodeDownloadStaffOnlySerialized);
430
+ }
431
+ else {
432
+ if (!localVarFormParams) {
433
+ localVarFormParams = {};
434
+ }
435
+ localVarFormParams['sourceCodeDownloadStaffOnly'] = sourceCodeDownloadStaffOnlySerialized;
436
+ }
190
437
  }
191
438
  if (params.parameters !== undefined) {
192
- localVarFormParams['parameters'] = JSON.stringify(params.parameters);
439
+ const isParametersField = "parameters" === "parameters";
440
+ const serializableParams = isParametersField && params && ("parameters" in params);
441
+ const parametersSerialized = serializableParams
442
+ ? JSON.stringify(params.parameters)
443
+ : models_1.ObjectSerializer.serializeFormData(params.parameters, "Array<object>");
444
+ if (localVarFormParams instanceof FormData) {
445
+ localVarFormParams.append('parameters', parametersSerialized);
446
+ }
447
+ else {
448
+ if (!localVarFormParams) {
449
+ localVarFormParams = {};
450
+ }
451
+ localVarFormParams['parameters'] = parametersSerialized;
452
+ }
193
453
  }
454
+ const queryString = Object.entries(localVarQueryParameters)
455
+ .filter(([, value]) => value !== undefined)
456
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
457
+ .join('&');
458
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
194
459
  let localVarRequestOptions = {
195
460
  method: 'POST',
196
- qs: localVarQueryParameters,
197
- headers: localVarHeaderParams,
198
- uri: localVarPath,
199
- useQuerystring: this._useQuerystring,
200
- agentOptions: { keepAlive: false },
201
- json: true,
202
- };
203
- let authenticationPromise = Promise.resolve();
204
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
205
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
206
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
207
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
208
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
209
- return authenticationPromise.then(() => {
210
- if (Object.keys(localVarFormParams).length) {
211
- if (localVarUseFormData) {
212
- localVarRequestOptions.formData = localVarFormParams;
213
- }
214
- else {
215
- localVarRequestOptions.form = localVarFormParams;
216
- }
461
+ headers: { ...localVarHeaderParams },
462
+ };
463
+ let requestOptions = localVarRequestOptions;
464
+ let url = localVarUrl;
465
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
466
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
467
+ url = auth_ApiKeyAuthentication.url;
468
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
469
+ requestOptions = auth_JWTAuthentication.requestOptions;
470
+ url = auth_JWTAuthentication.url;
471
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
472
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
473
+ url = auth_JWTHttpHeaderAuthentication.url;
474
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
475
+ requestOptions = auth_OAuth2.requestOptions;
476
+ url = auth_OAuth2.url;
477
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
478
+ requestOptions = authDefault.requestOptions;
479
+ url = authDefault.url;
480
+ if (localVarFormParams) {
481
+ delete requestOptions.headers['Content-Type'];
482
+ if (localVarFormParams instanceof FormData) {
483
+ // FormData: fetch will handle Content-Type automatically.
484
+ requestOptions.body = localVarFormParams;
217
485
  }
218
- return new Promise((resolve, reject) => {
219
- localVarRequest(localVarRequestOptions, (error, response, body) => {
220
- if (error) {
221
- reject(error);
222
- }
223
- else {
224
- body = models_1.ObjectSerializer.deserialize(body, "EntityCreatedResponse");
225
- if (typeof body.success === 'boolean' && !body.success) {
226
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
227
- reject(new Error(body.error || errString));
228
- }
229
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
230
- resolve(body);
231
- }
232
- else {
233
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
234
- reject(errString);
235
- }
236
- }
237
- });
238
- });
239
- });
486
+ else if (Object.keys(localVarFormParams).length > 0) {
487
+ // URL-encoded form
488
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
489
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
490
+ }
491
+ }
492
+ const response = await fetch(url, requestOptions);
493
+ return this.handleResponse(response, 'EntityCreatedResponse');
240
494
  }
241
495
  /**
242
496
  * Adds a dsp block.
@@ -248,9 +502,11 @@ class OrganizationBlocksApi {
248
502
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/dsp'
249
503
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
250
504
  let localVarQueryParameters = {};
251
- let localVarHeaderParams = Object.assign({
252
- 'User-Agent': 'edgeimpulse-api nodejs'
253
- }, this.defaultHeaders);
505
+ let localVarHeaderParams = {
506
+ 'User-Agent': 'edgeimpulse-api nodejs',
507
+ 'Content-Type': 'application/json',
508
+ ...this.defaultHeaders,
509
+ };
254
510
  const produces = ['application/json'];
255
511
  // give precedence to 'application/json'
256
512
  if (produces.indexOf('application/json') >= 0) {
@@ -259,7 +515,7 @@ class OrganizationBlocksApi {
259
515
  else {
260
516
  localVarHeaderParams.Accept = produces.join(',');
261
517
  }
262
- let localVarFormParams = {};
518
+ let localVarFormParams;
263
519
  // verify required parameter 'organizationId' is not null or undefined
264
520
  if (organizationId === null || organizationId === undefined) {
265
521
  throw new Error('Required parameter organizationId was null or undefined when calling addOrganizationDspBlock.');
@@ -268,56 +524,52 @@ class OrganizationBlocksApi {
268
524
  if (addOrganizationDspBlockRequest === null || addOrganizationDspBlockRequest === undefined) {
269
525
  throw new Error('Required parameter addOrganizationDspBlockRequest was null or undefined when calling addOrganizationDspBlock.');
270
526
  }
271
- Object.assign(localVarHeaderParams, options.headers);
272
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
273
- let localVarUseFormData = false;
527
+ localVarHeaderParams = {
528
+ ...localVarHeaderParams,
529
+ ...options.headers,
530
+ ...this.opts.extraHeaders,
531
+ };
532
+ const queryString = Object.entries(localVarQueryParameters)
533
+ .filter(([, value]) => value !== undefined)
534
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
535
+ .join('&');
536
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
274
537
  let localVarRequestOptions = {
275
538
  method: 'POST',
276
- qs: localVarQueryParameters,
277
- headers: localVarHeaderParams,
278
- uri: localVarPath,
279
- useQuerystring: this._useQuerystring,
280
- agentOptions: { keepAlive: false },
281
- json: true,
282
- body: models_1.ObjectSerializer.serialize(addOrganizationDspBlockRequest, "AddOrganizationDspBlockRequest")
283
- };
284
- let authenticationPromise = Promise.resolve();
285
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
286
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
287
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
288
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
289
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
290
- return authenticationPromise.then(() => {
291
- if (Object.keys(localVarFormParams).length) {
292
- if (localVarUseFormData) {
293
- localVarRequestOptions.formData = localVarFormParams;
294
- }
295
- else {
296
- localVarRequestOptions.form = localVarFormParams;
297
- }
539
+ headers: { ...localVarHeaderParams },
540
+ };
541
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(addOrganizationDspBlockRequest, "AddOrganizationDspBlockRequest"));
542
+ let requestOptions = localVarRequestOptions;
543
+ let url = localVarUrl;
544
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
545
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
546
+ url = auth_ApiKeyAuthentication.url;
547
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
548
+ requestOptions = auth_JWTAuthentication.requestOptions;
549
+ url = auth_JWTAuthentication.url;
550
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
551
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
552
+ url = auth_JWTHttpHeaderAuthentication.url;
553
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
554
+ requestOptions = auth_OAuth2.requestOptions;
555
+ url = auth_OAuth2.url;
556
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
557
+ requestOptions = authDefault.requestOptions;
558
+ url = authDefault.url;
559
+ if (localVarFormParams) {
560
+ delete requestOptions.headers['Content-Type'];
561
+ if (localVarFormParams instanceof FormData) {
562
+ // FormData: fetch will handle Content-Type automatically.
563
+ requestOptions.body = localVarFormParams;
298
564
  }
299
- return new Promise((resolve, reject) => {
300
- localVarRequest(localVarRequestOptions, (error, response, body) => {
301
- if (error) {
302
- reject(error);
303
- }
304
- else {
305
- body = models_1.ObjectSerializer.deserialize(body, "EntityCreatedResponse");
306
- if (typeof body.success === 'boolean' && !body.success) {
307
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
308
- reject(new Error(body.error || errString));
309
- }
310
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
311
- resolve(body);
312
- }
313
- else {
314
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
315
- reject(errString);
316
- }
317
- }
318
- });
319
- });
320
- });
565
+ else if (Object.keys(localVarFormParams).length > 0) {
566
+ // URL-encoded form
567
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
568
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
569
+ }
570
+ }
571
+ const response = await fetch(url, requestOptions);
572
+ return this.handleResponse(response, 'EntityCreatedResponse');
321
573
  }
322
574
  /**
323
575
  * Adds a secret.
@@ -329,9 +581,11 @@ class OrganizationBlocksApi {
329
581
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/secrets'
330
582
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
331
583
  let localVarQueryParameters = {};
332
- let localVarHeaderParams = Object.assign({
333
- 'User-Agent': 'edgeimpulse-api nodejs'
334
- }, this.defaultHeaders);
584
+ let localVarHeaderParams = {
585
+ 'User-Agent': 'edgeimpulse-api nodejs',
586
+ 'Content-Type': 'application/json',
587
+ ...this.defaultHeaders,
588
+ };
335
589
  const produces = ['application/json'];
336
590
  // give precedence to 'application/json'
337
591
  if (produces.indexOf('application/json') >= 0) {
@@ -340,7 +594,7 @@ class OrganizationBlocksApi {
340
594
  else {
341
595
  localVarHeaderParams.Accept = produces.join(',');
342
596
  }
343
- let localVarFormParams = {};
597
+ let localVarFormParams;
344
598
  // verify required parameter 'organizationId' is not null or undefined
345
599
  if (organizationId === null || organizationId === undefined) {
346
600
  throw new Error('Required parameter organizationId was null or undefined when calling addOrganizationSecret.');
@@ -349,56 +603,52 @@ class OrganizationBlocksApi {
349
603
  if (addOrganizationSecretRequest === null || addOrganizationSecretRequest === undefined) {
350
604
  throw new Error('Required parameter addOrganizationSecretRequest was null or undefined when calling addOrganizationSecret.');
351
605
  }
352
- Object.assign(localVarHeaderParams, options.headers);
353
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
354
- let localVarUseFormData = false;
606
+ localVarHeaderParams = {
607
+ ...localVarHeaderParams,
608
+ ...options.headers,
609
+ ...this.opts.extraHeaders,
610
+ };
611
+ const queryString = Object.entries(localVarQueryParameters)
612
+ .filter(([, value]) => value !== undefined)
613
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
614
+ .join('&');
615
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
355
616
  let localVarRequestOptions = {
356
617
  method: 'POST',
357
- qs: localVarQueryParameters,
358
- headers: localVarHeaderParams,
359
- uri: localVarPath,
360
- useQuerystring: this._useQuerystring,
361
- agentOptions: { keepAlive: false },
362
- json: true,
363
- body: models_1.ObjectSerializer.serialize(addOrganizationSecretRequest, "AddOrganizationSecretRequest")
364
- };
365
- let authenticationPromise = Promise.resolve();
366
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
367
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
368
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
369
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
370
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
371
- return authenticationPromise.then(() => {
372
- if (Object.keys(localVarFormParams).length) {
373
- if (localVarUseFormData) {
374
- localVarRequestOptions.formData = localVarFormParams;
375
- }
376
- else {
377
- localVarRequestOptions.form = localVarFormParams;
378
- }
618
+ headers: { ...localVarHeaderParams },
619
+ };
620
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(addOrganizationSecretRequest, "AddOrganizationSecretRequest"));
621
+ let requestOptions = localVarRequestOptions;
622
+ let url = localVarUrl;
623
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
624
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
625
+ url = auth_ApiKeyAuthentication.url;
626
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
627
+ requestOptions = auth_JWTAuthentication.requestOptions;
628
+ url = auth_JWTAuthentication.url;
629
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
630
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
631
+ url = auth_JWTHttpHeaderAuthentication.url;
632
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
633
+ requestOptions = auth_OAuth2.requestOptions;
634
+ url = auth_OAuth2.url;
635
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
636
+ requestOptions = authDefault.requestOptions;
637
+ url = authDefault.url;
638
+ if (localVarFormParams) {
639
+ delete requestOptions.headers['Content-Type'];
640
+ if (localVarFormParams instanceof FormData) {
641
+ // FormData: fetch will handle Content-Type automatically.
642
+ requestOptions.body = localVarFormParams;
379
643
  }
380
- return new Promise((resolve, reject) => {
381
- localVarRequest(localVarRequestOptions, (error, response, body) => {
382
- if (error) {
383
- reject(error);
384
- }
385
- else {
386
- body = models_1.ObjectSerializer.deserialize(body, "EntityCreatedResponse");
387
- if (typeof body.success === 'boolean' && !body.success) {
388
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
389
- reject(new Error(body.error || errString));
390
- }
391
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
392
- resolve(body);
393
- }
394
- else {
395
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
396
- reject(errString);
397
- }
398
- }
399
- });
400
- });
401
- });
644
+ else if (Object.keys(localVarFormParams).length > 0) {
645
+ // URL-encoded form
646
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
647
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
648
+ }
649
+ }
650
+ const response = await fetch(url, requestOptions);
651
+ return this.handleResponse(response, 'EntityCreatedResponse');
402
652
  }
403
653
  /**
404
654
  * Adds a transfer learning block.
@@ -410,9 +660,11 @@ class OrganizationBlocksApi {
410
660
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/transfer-learning'
411
661
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
412
662
  let localVarQueryParameters = {};
413
- let localVarHeaderParams = Object.assign({
414
- 'User-Agent': 'edgeimpulse-api nodejs'
415
- }, this.defaultHeaders);
663
+ let localVarHeaderParams = {
664
+ 'User-Agent': 'edgeimpulse-api nodejs',
665
+ 'Content-Type': 'application/json',
666
+ ...this.defaultHeaders,
667
+ };
416
668
  const produces = ['application/json'];
417
669
  // give precedence to 'application/json'
418
670
  if (produces.indexOf('application/json') >= 0) {
@@ -421,7 +673,7 @@ class OrganizationBlocksApi {
421
673
  else {
422
674
  localVarHeaderParams.Accept = produces.join(',');
423
675
  }
424
- let localVarFormParams = {};
676
+ let localVarFormParams;
425
677
  // verify required parameter 'organizationId' is not null or undefined
426
678
  if (organizationId === null || organizationId === undefined) {
427
679
  throw new Error('Required parameter organizationId was null or undefined when calling addOrganizationTransferLearningBlock.');
@@ -430,56 +682,52 @@ class OrganizationBlocksApi {
430
682
  if (addOrganizationTransferLearningBlockRequest === null || addOrganizationTransferLearningBlockRequest === undefined) {
431
683
  throw new Error('Required parameter addOrganizationTransferLearningBlockRequest was null or undefined when calling addOrganizationTransferLearningBlock.');
432
684
  }
433
- Object.assign(localVarHeaderParams, options.headers);
434
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
435
- let localVarUseFormData = false;
685
+ localVarHeaderParams = {
686
+ ...localVarHeaderParams,
687
+ ...options.headers,
688
+ ...this.opts.extraHeaders,
689
+ };
690
+ const queryString = Object.entries(localVarQueryParameters)
691
+ .filter(([, value]) => value !== undefined)
692
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
693
+ .join('&');
694
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
436
695
  let localVarRequestOptions = {
437
696
  method: 'POST',
438
- qs: localVarQueryParameters,
439
- headers: localVarHeaderParams,
440
- uri: localVarPath,
441
- useQuerystring: this._useQuerystring,
442
- agentOptions: { keepAlive: false },
443
- json: true,
444
- body: models_1.ObjectSerializer.serialize(addOrganizationTransferLearningBlockRequest, "AddOrganizationTransferLearningBlockRequest")
445
- };
446
- let authenticationPromise = Promise.resolve();
447
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
448
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
449
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
450
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
451
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
452
- return authenticationPromise.then(() => {
453
- if (Object.keys(localVarFormParams).length) {
454
- if (localVarUseFormData) {
455
- localVarRequestOptions.formData = localVarFormParams;
456
- }
457
- else {
458
- localVarRequestOptions.form = localVarFormParams;
459
- }
697
+ headers: { ...localVarHeaderParams },
698
+ };
699
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(addOrganizationTransferLearningBlockRequest, "AddOrganizationTransferLearningBlockRequest"));
700
+ let requestOptions = localVarRequestOptions;
701
+ let url = localVarUrl;
702
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
703
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
704
+ url = auth_ApiKeyAuthentication.url;
705
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
706
+ requestOptions = auth_JWTAuthentication.requestOptions;
707
+ url = auth_JWTAuthentication.url;
708
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
709
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
710
+ url = auth_JWTHttpHeaderAuthentication.url;
711
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
712
+ requestOptions = auth_OAuth2.requestOptions;
713
+ url = auth_OAuth2.url;
714
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
715
+ requestOptions = authDefault.requestOptions;
716
+ url = authDefault.url;
717
+ if (localVarFormParams) {
718
+ delete requestOptions.headers['Content-Type'];
719
+ if (localVarFormParams instanceof FormData) {
720
+ // FormData: fetch will handle Content-Type automatically.
721
+ requestOptions.body = localVarFormParams;
460
722
  }
461
- return new Promise((resolve, reject) => {
462
- localVarRequest(localVarRequestOptions, (error, response, body) => {
463
- if (error) {
464
- reject(error);
465
- }
466
- else {
467
- body = models_1.ObjectSerializer.deserialize(body, "EntityCreatedResponse");
468
- if (typeof body.success === 'boolean' && !body.success) {
469
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
470
- reject(new Error(body.error || errString));
471
- }
472
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
473
- resolve(body);
474
- }
475
- else {
476
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
477
- reject(errString);
478
- }
479
- }
480
- });
481
- });
482
- });
723
+ else if (Object.keys(localVarFormParams).length > 0) {
724
+ // URL-encoded form
725
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
726
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
727
+ }
728
+ }
729
+ const response = await fetch(url, requestOptions);
730
+ return this.handleResponse(response, 'EntityCreatedResponse');
483
731
  }
484
732
  /**
485
733
  * Adds a transformation block.
@@ -491,9 +739,11 @@ class OrganizationBlocksApi {
491
739
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/transformation'
492
740
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
493
741
  let localVarQueryParameters = {};
494
- let localVarHeaderParams = Object.assign({
495
- 'User-Agent': 'edgeimpulse-api nodejs'
496
- }, this.defaultHeaders);
742
+ let localVarHeaderParams = {
743
+ 'User-Agent': 'edgeimpulse-api nodejs',
744
+ 'Content-Type': 'application/json',
745
+ ...this.defaultHeaders,
746
+ };
497
747
  const produces = ['application/json'];
498
748
  // give precedence to 'application/json'
499
749
  if (produces.indexOf('application/json') >= 0) {
@@ -502,7 +752,7 @@ class OrganizationBlocksApi {
502
752
  else {
503
753
  localVarHeaderParams.Accept = produces.join(',');
504
754
  }
505
- let localVarFormParams = {};
755
+ let localVarFormParams;
506
756
  // verify required parameter 'organizationId' is not null or undefined
507
757
  if (organizationId === null || organizationId === undefined) {
508
758
  throw new Error('Required parameter organizationId was null or undefined when calling addOrganizationTransformationBlock.');
@@ -511,56 +761,52 @@ class OrganizationBlocksApi {
511
761
  if (addOrganizationTransformationBlockRequest === null || addOrganizationTransformationBlockRequest === undefined) {
512
762
  throw new Error('Required parameter addOrganizationTransformationBlockRequest was null or undefined when calling addOrganizationTransformationBlock.');
513
763
  }
514
- Object.assign(localVarHeaderParams, options.headers);
515
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
516
- let localVarUseFormData = false;
764
+ localVarHeaderParams = {
765
+ ...localVarHeaderParams,
766
+ ...options.headers,
767
+ ...this.opts.extraHeaders,
768
+ };
769
+ const queryString = Object.entries(localVarQueryParameters)
770
+ .filter(([, value]) => value !== undefined)
771
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
772
+ .join('&');
773
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
517
774
  let localVarRequestOptions = {
518
775
  method: 'POST',
519
- qs: localVarQueryParameters,
520
- headers: localVarHeaderParams,
521
- uri: localVarPath,
522
- useQuerystring: this._useQuerystring,
523
- agentOptions: { keepAlive: false },
524
- json: true,
525
- body: models_1.ObjectSerializer.serialize(addOrganizationTransformationBlockRequest, "AddOrganizationTransformationBlockRequest")
526
- };
527
- let authenticationPromise = Promise.resolve();
528
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
529
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
530
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
531
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
532
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
533
- return authenticationPromise.then(() => {
534
- if (Object.keys(localVarFormParams).length) {
535
- if (localVarUseFormData) {
536
- localVarRequestOptions.formData = localVarFormParams;
537
- }
538
- else {
539
- localVarRequestOptions.form = localVarFormParams;
540
- }
776
+ headers: { ...localVarHeaderParams },
777
+ };
778
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(addOrganizationTransformationBlockRequest, "AddOrganizationTransformationBlockRequest"));
779
+ let requestOptions = localVarRequestOptions;
780
+ let url = localVarUrl;
781
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
782
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
783
+ url = auth_ApiKeyAuthentication.url;
784
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
785
+ requestOptions = auth_JWTAuthentication.requestOptions;
786
+ url = auth_JWTAuthentication.url;
787
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
788
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
789
+ url = auth_JWTHttpHeaderAuthentication.url;
790
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
791
+ requestOptions = auth_OAuth2.requestOptions;
792
+ url = auth_OAuth2.url;
793
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
794
+ requestOptions = authDefault.requestOptions;
795
+ url = authDefault.url;
796
+ if (localVarFormParams) {
797
+ delete requestOptions.headers['Content-Type'];
798
+ if (localVarFormParams instanceof FormData) {
799
+ // FormData: fetch will handle Content-Type automatically.
800
+ requestOptions.body = localVarFormParams;
541
801
  }
542
- return new Promise((resolve, reject) => {
543
- localVarRequest(localVarRequestOptions, (error, response, body) => {
544
- if (error) {
545
- reject(error);
546
- }
547
- else {
548
- body = models_1.ObjectSerializer.deserialize(body, "EntityCreatedResponse");
549
- if (typeof body.success === 'boolean' && !body.success) {
550
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
551
- reject(new Error(body.error || errString));
552
- }
553
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
554
- resolve(body);
555
- }
556
- else {
557
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
558
- reject(errString);
559
- }
560
- }
561
- });
562
- });
563
- });
802
+ else if (Object.keys(localVarFormParams).length > 0) {
803
+ // URL-encoded form
804
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
805
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
806
+ }
807
+ }
808
+ const response = await fetch(url, requestOptions);
809
+ return this.handleResponse(response, 'EntityCreatedResponse');
564
810
  }
565
811
  /**
566
812
  * Deletes a deploy block.
@@ -573,9 +819,11 @@ class OrganizationBlocksApi {
573
819
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
574
820
  .replace('{' + 'deployId' + '}', encodeURIComponent(String(deployId)));
575
821
  let localVarQueryParameters = {};
576
- let localVarHeaderParams = Object.assign({
577
- 'User-Agent': 'edgeimpulse-api nodejs'
578
- }, this.defaultHeaders);
822
+ let localVarHeaderParams = {
823
+ 'User-Agent': 'edgeimpulse-api nodejs',
824
+ 'Content-Type': 'application/json',
825
+ ...this.defaultHeaders,
826
+ };
579
827
  const produces = ['application/json'];
580
828
  // give precedence to 'application/json'
581
829
  if (produces.indexOf('application/json') >= 0) {
@@ -584,7 +832,7 @@ class OrganizationBlocksApi {
584
832
  else {
585
833
  localVarHeaderParams.Accept = produces.join(',');
586
834
  }
587
- let localVarFormParams = {};
835
+ let localVarFormParams;
588
836
  // verify required parameter 'organizationId' is not null or undefined
589
837
  if (organizationId === null || organizationId === undefined) {
590
838
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationDeployBlock.');
@@ -593,55 +841,51 @@ class OrganizationBlocksApi {
593
841
  if (deployId === null || deployId === undefined) {
594
842
  throw new Error('Required parameter deployId was null or undefined when calling deleteOrganizationDeployBlock.');
595
843
  }
596
- Object.assign(localVarHeaderParams, options.headers);
597
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
598
- let localVarUseFormData = false;
844
+ localVarHeaderParams = {
845
+ ...localVarHeaderParams,
846
+ ...options.headers,
847
+ ...this.opts.extraHeaders,
848
+ };
849
+ const queryString = Object.entries(localVarQueryParameters)
850
+ .filter(([, value]) => value !== undefined)
851
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
852
+ .join('&');
853
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
599
854
  let localVarRequestOptions = {
600
855
  method: 'DELETE',
601
- qs: localVarQueryParameters,
602
- headers: localVarHeaderParams,
603
- uri: localVarPath,
604
- useQuerystring: this._useQuerystring,
605
- agentOptions: { keepAlive: false },
606
- json: true,
607
- };
608
- let authenticationPromise = Promise.resolve();
609
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
610
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
611
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
612
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
613
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
614
- return authenticationPromise.then(() => {
615
- if (Object.keys(localVarFormParams).length) {
616
- if (localVarUseFormData) {
617
- localVarRequestOptions.formData = localVarFormParams;
618
- }
619
- else {
620
- localVarRequestOptions.form = localVarFormParams;
621
- }
856
+ headers: { ...localVarHeaderParams },
857
+ };
858
+ let requestOptions = localVarRequestOptions;
859
+ let url = localVarUrl;
860
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
861
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
862
+ url = auth_ApiKeyAuthentication.url;
863
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
864
+ requestOptions = auth_JWTAuthentication.requestOptions;
865
+ url = auth_JWTAuthentication.url;
866
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
867
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
868
+ url = auth_JWTHttpHeaderAuthentication.url;
869
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
870
+ requestOptions = auth_OAuth2.requestOptions;
871
+ url = auth_OAuth2.url;
872
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
873
+ requestOptions = authDefault.requestOptions;
874
+ url = authDefault.url;
875
+ if (localVarFormParams) {
876
+ delete requestOptions.headers['Content-Type'];
877
+ if (localVarFormParams instanceof FormData) {
878
+ // FormData: fetch will handle Content-Type automatically.
879
+ requestOptions.body = localVarFormParams;
622
880
  }
623
- return new Promise((resolve, reject) => {
624
- localVarRequest(localVarRequestOptions, (error, response, body) => {
625
- if (error) {
626
- reject(error);
627
- }
628
- else {
629
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
630
- if (typeof body.success === 'boolean' && !body.success) {
631
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
632
- reject(new Error(body.error || errString));
633
- }
634
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
635
- resolve(body);
636
- }
637
- else {
638
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
639
- reject(errString);
640
- }
641
- }
642
- });
643
- });
644
- });
881
+ else if (Object.keys(localVarFormParams).length > 0) {
882
+ // URL-encoded form
883
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
884
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
885
+ }
886
+ }
887
+ const response = await fetch(url, requestOptions);
888
+ return this.handleResponse(response, 'GenericApiResponse');
645
889
  }
646
890
  /**
647
891
  * Deletes a dsp block.
@@ -654,9 +898,11 @@ class OrganizationBlocksApi {
654
898
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
655
899
  .replace('{' + 'dspId' + '}', encodeURIComponent(String(dspId)));
656
900
  let localVarQueryParameters = {};
657
- let localVarHeaderParams = Object.assign({
658
- 'User-Agent': 'edgeimpulse-api nodejs'
659
- }, this.defaultHeaders);
901
+ let localVarHeaderParams = {
902
+ 'User-Agent': 'edgeimpulse-api nodejs',
903
+ 'Content-Type': 'application/json',
904
+ ...this.defaultHeaders,
905
+ };
660
906
  const produces = ['application/json'];
661
907
  // give precedence to 'application/json'
662
908
  if (produces.indexOf('application/json') >= 0) {
@@ -665,7 +911,7 @@ class OrganizationBlocksApi {
665
911
  else {
666
912
  localVarHeaderParams.Accept = produces.join(',');
667
913
  }
668
- let localVarFormParams = {};
914
+ let localVarFormParams;
669
915
  // verify required parameter 'organizationId' is not null or undefined
670
916
  if (organizationId === null || organizationId === undefined) {
671
917
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationDspBlock.');
@@ -674,55 +920,51 @@ class OrganizationBlocksApi {
674
920
  if (dspId === null || dspId === undefined) {
675
921
  throw new Error('Required parameter dspId was null or undefined when calling deleteOrganizationDspBlock.');
676
922
  }
677
- Object.assign(localVarHeaderParams, options.headers);
678
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
679
- let localVarUseFormData = false;
923
+ localVarHeaderParams = {
924
+ ...localVarHeaderParams,
925
+ ...options.headers,
926
+ ...this.opts.extraHeaders,
927
+ };
928
+ const queryString = Object.entries(localVarQueryParameters)
929
+ .filter(([, value]) => value !== undefined)
930
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
931
+ .join('&');
932
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
680
933
  let localVarRequestOptions = {
681
934
  method: 'DELETE',
682
- qs: localVarQueryParameters,
683
- headers: localVarHeaderParams,
684
- uri: localVarPath,
685
- useQuerystring: this._useQuerystring,
686
- agentOptions: { keepAlive: false },
687
- json: true,
688
- };
689
- let authenticationPromise = Promise.resolve();
690
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
691
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
692
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
693
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
694
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
695
- return authenticationPromise.then(() => {
696
- if (Object.keys(localVarFormParams).length) {
697
- if (localVarUseFormData) {
698
- localVarRequestOptions.formData = localVarFormParams;
699
- }
700
- else {
701
- localVarRequestOptions.form = localVarFormParams;
702
- }
935
+ headers: { ...localVarHeaderParams },
936
+ };
937
+ let requestOptions = localVarRequestOptions;
938
+ let url = localVarUrl;
939
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
940
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
941
+ url = auth_ApiKeyAuthentication.url;
942
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
943
+ requestOptions = auth_JWTAuthentication.requestOptions;
944
+ url = auth_JWTAuthentication.url;
945
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
946
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
947
+ url = auth_JWTHttpHeaderAuthentication.url;
948
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
949
+ requestOptions = auth_OAuth2.requestOptions;
950
+ url = auth_OAuth2.url;
951
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
952
+ requestOptions = authDefault.requestOptions;
953
+ url = authDefault.url;
954
+ if (localVarFormParams) {
955
+ delete requestOptions.headers['Content-Type'];
956
+ if (localVarFormParams instanceof FormData) {
957
+ // FormData: fetch will handle Content-Type automatically.
958
+ requestOptions.body = localVarFormParams;
703
959
  }
704
- return new Promise((resolve, reject) => {
705
- localVarRequest(localVarRequestOptions, (error, response, body) => {
706
- if (error) {
707
- reject(error);
708
- }
709
- else {
710
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
711
- if (typeof body.success === 'boolean' && !body.success) {
712
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
713
- reject(new Error(body.error || errString));
714
- }
715
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
716
- resolve(body);
717
- }
718
- else {
719
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
720
- reject(errString);
721
- }
722
- }
723
- });
724
- });
725
- });
960
+ else if (Object.keys(localVarFormParams).length > 0) {
961
+ // URL-encoded form
962
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
963
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
964
+ }
965
+ }
966
+ const response = await fetch(url, requestOptions);
967
+ return this.handleResponse(response, 'GenericApiResponse');
726
968
  }
727
969
  /**
728
970
  * Deletes a secret
@@ -735,9 +977,11 @@ class OrganizationBlocksApi {
735
977
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
736
978
  .replace('{' + 'secretId' + '}', encodeURIComponent(String(secretId)));
737
979
  let localVarQueryParameters = {};
738
- let localVarHeaderParams = Object.assign({
739
- 'User-Agent': 'edgeimpulse-api nodejs'
740
- }, this.defaultHeaders);
980
+ let localVarHeaderParams = {
981
+ 'User-Agent': 'edgeimpulse-api nodejs',
982
+ 'Content-Type': 'application/json',
983
+ ...this.defaultHeaders,
984
+ };
741
985
  const produces = ['application/json'];
742
986
  // give precedence to 'application/json'
743
987
  if (produces.indexOf('application/json') >= 0) {
@@ -746,7 +990,7 @@ class OrganizationBlocksApi {
746
990
  else {
747
991
  localVarHeaderParams.Accept = produces.join(',');
748
992
  }
749
- let localVarFormParams = {};
993
+ let localVarFormParams;
750
994
  // verify required parameter 'organizationId' is not null or undefined
751
995
  if (organizationId === null || organizationId === undefined) {
752
996
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationSecret.');
@@ -755,55 +999,51 @@ class OrganizationBlocksApi {
755
999
  if (secretId === null || secretId === undefined) {
756
1000
  throw new Error('Required parameter secretId was null or undefined when calling deleteOrganizationSecret.');
757
1001
  }
758
- Object.assign(localVarHeaderParams, options.headers);
759
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
760
- let localVarUseFormData = false;
1002
+ localVarHeaderParams = {
1003
+ ...localVarHeaderParams,
1004
+ ...options.headers,
1005
+ ...this.opts.extraHeaders,
1006
+ };
1007
+ const queryString = Object.entries(localVarQueryParameters)
1008
+ .filter(([, value]) => value !== undefined)
1009
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1010
+ .join('&');
1011
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
761
1012
  let localVarRequestOptions = {
762
1013
  method: 'DELETE',
763
- qs: localVarQueryParameters,
764
- headers: localVarHeaderParams,
765
- uri: localVarPath,
766
- useQuerystring: this._useQuerystring,
767
- agentOptions: { keepAlive: false },
768
- json: true,
769
- };
770
- let authenticationPromise = Promise.resolve();
771
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
772
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
773
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
774
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
775
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
776
- return authenticationPromise.then(() => {
777
- if (Object.keys(localVarFormParams).length) {
778
- if (localVarUseFormData) {
779
- localVarRequestOptions.formData = localVarFormParams;
780
- }
781
- else {
782
- localVarRequestOptions.form = localVarFormParams;
783
- }
1014
+ headers: { ...localVarHeaderParams },
1015
+ };
1016
+ let requestOptions = localVarRequestOptions;
1017
+ let url = localVarUrl;
1018
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1019
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1020
+ url = auth_ApiKeyAuthentication.url;
1021
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1022
+ requestOptions = auth_JWTAuthentication.requestOptions;
1023
+ url = auth_JWTAuthentication.url;
1024
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1025
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1026
+ url = auth_JWTHttpHeaderAuthentication.url;
1027
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1028
+ requestOptions = auth_OAuth2.requestOptions;
1029
+ url = auth_OAuth2.url;
1030
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1031
+ requestOptions = authDefault.requestOptions;
1032
+ url = authDefault.url;
1033
+ if (localVarFormParams) {
1034
+ delete requestOptions.headers['Content-Type'];
1035
+ if (localVarFormParams instanceof FormData) {
1036
+ // FormData: fetch will handle Content-Type automatically.
1037
+ requestOptions.body = localVarFormParams;
784
1038
  }
785
- return new Promise((resolve, reject) => {
786
- localVarRequest(localVarRequestOptions, (error, response, body) => {
787
- if (error) {
788
- reject(error);
789
- }
790
- else {
791
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
792
- if (typeof body.success === 'boolean' && !body.success) {
793
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
794
- reject(new Error(body.error || errString));
795
- }
796
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
797
- resolve(body);
798
- }
799
- else {
800
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
801
- reject(errString);
802
- }
803
- }
804
- });
805
- });
806
- });
1039
+ else if (Object.keys(localVarFormParams).length > 0) {
1040
+ // URL-encoded form
1041
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1042
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1043
+ }
1044
+ }
1045
+ const response = await fetch(url, requestOptions);
1046
+ return this.handleResponse(response, 'GenericApiResponse');
807
1047
  }
808
1048
  /**
809
1049
  * Deletes a transfer learning block.
@@ -816,9 +1056,11 @@ class OrganizationBlocksApi {
816
1056
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
817
1057
  .replace('{' + 'transferLearningId' + '}', encodeURIComponent(String(transferLearningId)));
818
1058
  let localVarQueryParameters = {};
819
- let localVarHeaderParams = Object.assign({
820
- 'User-Agent': 'edgeimpulse-api nodejs'
821
- }, this.defaultHeaders);
1059
+ let localVarHeaderParams = {
1060
+ 'User-Agent': 'edgeimpulse-api nodejs',
1061
+ 'Content-Type': 'application/json',
1062
+ ...this.defaultHeaders,
1063
+ };
822
1064
  const produces = ['application/json'];
823
1065
  // give precedence to 'application/json'
824
1066
  if (produces.indexOf('application/json') >= 0) {
@@ -827,7 +1069,7 @@ class OrganizationBlocksApi {
827
1069
  else {
828
1070
  localVarHeaderParams.Accept = produces.join(',');
829
1071
  }
830
- let localVarFormParams = {};
1072
+ let localVarFormParams;
831
1073
  // verify required parameter 'organizationId' is not null or undefined
832
1074
  if (organizationId === null || organizationId === undefined) {
833
1075
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationTransferLearningBlock.');
@@ -836,55 +1078,51 @@ class OrganizationBlocksApi {
836
1078
  if (transferLearningId === null || transferLearningId === undefined) {
837
1079
  throw new Error('Required parameter transferLearningId was null or undefined when calling deleteOrganizationTransferLearningBlock.');
838
1080
  }
839
- Object.assign(localVarHeaderParams, options.headers);
840
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
841
- let localVarUseFormData = false;
1081
+ localVarHeaderParams = {
1082
+ ...localVarHeaderParams,
1083
+ ...options.headers,
1084
+ ...this.opts.extraHeaders,
1085
+ };
1086
+ const queryString = Object.entries(localVarQueryParameters)
1087
+ .filter(([, value]) => value !== undefined)
1088
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1089
+ .join('&');
1090
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
842
1091
  let localVarRequestOptions = {
843
1092
  method: 'DELETE',
844
- qs: localVarQueryParameters,
845
- headers: localVarHeaderParams,
846
- uri: localVarPath,
847
- useQuerystring: this._useQuerystring,
848
- agentOptions: { keepAlive: false },
849
- json: true,
850
- };
851
- let authenticationPromise = Promise.resolve();
852
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
853
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
854
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
855
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
856
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
857
- return authenticationPromise.then(() => {
858
- if (Object.keys(localVarFormParams).length) {
859
- if (localVarUseFormData) {
860
- localVarRequestOptions.formData = localVarFormParams;
861
- }
862
- else {
863
- localVarRequestOptions.form = localVarFormParams;
864
- }
1093
+ headers: { ...localVarHeaderParams },
1094
+ };
1095
+ let requestOptions = localVarRequestOptions;
1096
+ let url = localVarUrl;
1097
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1098
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1099
+ url = auth_ApiKeyAuthentication.url;
1100
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1101
+ requestOptions = auth_JWTAuthentication.requestOptions;
1102
+ url = auth_JWTAuthentication.url;
1103
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1104
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1105
+ url = auth_JWTHttpHeaderAuthentication.url;
1106
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1107
+ requestOptions = auth_OAuth2.requestOptions;
1108
+ url = auth_OAuth2.url;
1109
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1110
+ requestOptions = authDefault.requestOptions;
1111
+ url = authDefault.url;
1112
+ if (localVarFormParams) {
1113
+ delete requestOptions.headers['Content-Type'];
1114
+ if (localVarFormParams instanceof FormData) {
1115
+ // FormData: fetch will handle Content-Type automatically.
1116
+ requestOptions.body = localVarFormParams;
865
1117
  }
866
- return new Promise((resolve, reject) => {
867
- localVarRequest(localVarRequestOptions, (error, response, body) => {
868
- if (error) {
869
- reject(error);
870
- }
871
- else {
872
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
873
- if (typeof body.success === 'boolean' && !body.success) {
874
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
875
- reject(new Error(body.error || errString));
876
- }
877
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
878
- resolve(body);
879
- }
880
- else {
881
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
882
- reject(errString);
883
- }
884
- }
885
- });
886
- });
887
- });
1118
+ else if (Object.keys(localVarFormParams).length > 0) {
1119
+ // URL-encoded form
1120
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1121
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1122
+ }
1123
+ }
1124
+ const response = await fetch(url, requestOptions);
1125
+ return this.handleResponse(response, 'GenericApiResponse');
888
1126
  }
889
1127
  /**
890
1128
  * Deletes a transformation block.
@@ -897,9 +1135,11 @@ class OrganizationBlocksApi {
897
1135
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
898
1136
  .replace('{' + 'transformationId' + '}', encodeURIComponent(String(transformationId)));
899
1137
  let localVarQueryParameters = {};
900
- let localVarHeaderParams = Object.assign({
901
- 'User-Agent': 'edgeimpulse-api nodejs'
902
- }, this.defaultHeaders);
1138
+ let localVarHeaderParams = {
1139
+ 'User-Agent': 'edgeimpulse-api nodejs',
1140
+ 'Content-Type': 'application/json',
1141
+ ...this.defaultHeaders,
1142
+ };
903
1143
  const produces = ['application/json'];
904
1144
  // give precedence to 'application/json'
905
1145
  if (produces.indexOf('application/json') >= 0) {
@@ -908,7 +1148,7 @@ class OrganizationBlocksApi {
908
1148
  else {
909
1149
  localVarHeaderParams.Accept = produces.join(',');
910
1150
  }
911
- let localVarFormParams = {};
1151
+ let localVarFormParams;
912
1152
  // verify required parameter 'organizationId' is not null or undefined
913
1153
  if (organizationId === null || organizationId === undefined) {
914
1154
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationTransformationBlock.');
@@ -917,55 +1157,51 @@ class OrganizationBlocksApi {
917
1157
  if (transformationId === null || transformationId === undefined) {
918
1158
  throw new Error('Required parameter transformationId was null or undefined when calling deleteOrganizationTransformationBlock.');
919
1159
  }
920
- Object.assign(localVarHeaderParams, options.headers);
921
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
922
- let localVarUseFormData = false;
1160
+ localVarHeaderParams = {
1161
+ ...localVarHeaderParams,
1162
+ ...options.headers,
1163
+ ...this.opts.extraHeaders,
1164
+ };
1165
+ const queryString = Object.entries(localVarQueryParameters)
1166
+ .filter(([, value]) => value !== undefined)
1167
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1168
+ .join('&');
1169
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
923
1170
  let localVarRequestOptions = {
924
1171
  method: 'DELETE',
925
- qs: localVarQueryParameters,
926
- headers: localVarHeaderParams,
927
- uri: localVarPath,
928
- useQuerystring: this._useQuerystring,
929
- agentOptions: { keepAlive: false },
930
- json: true,
931
- };
932
- let authenticationPromise = Promise.resolve();
933
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
934
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
935
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
936
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
937
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
938
- return authenticationPromise.then(() => {
939
- if (Object.keys(localVarFormParams).length) {
940
- if (localVarUseFormData) {
941
- localVarRequestOptions.formData = localVarFormParams;
942
- }
943
- else {
944
- localVarRequestOptions.form = localVarFormParams;
945
- }
1172
+ headers: { ...localVarHeaderParams },
1173
+ };
1174
+ let requestOptions = localVarRequestOptions;
1175
+ let url = localVarUrl;
1176
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1177
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1178
+ url = auth_ApiKeyAuthentication.url;
1179
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1180
+ requestOptions = auth_JWTAuthentication.requestOptions;
1181
+ url = auth_JWTAuthentication.url;
1182
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1183
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1184
+ url = auth_JWTHttpHeaderAuthentication.url;
1185
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1186
+ requestOptions = auth_OAuth2.requestOptions;
1187
+ url = auth_OAuth2.url;
1188
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1189
+ requestOptions = authDefault.requestOptions;
1190
+ url = authDefault.url;
1191
+ if (localVarFormParams) {
1192
+ delete requestOptions.headers['Content-Type'];
1193
+ if (localVarFormParams instanceof FormData) {
1194
+ // FormData: fetch will handle Content-Type automatically.
1195
+ requestOptions.body = localVarFormParams;
946
1196
  }
947
- return new Promise((resolve, reject) => {
948
- localVarRequest(localVarRequestOptions, (error, response, body) => {
949
- if (error) {
950
- reject(error);
951
- }
952
- else {
953
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
954
- if (typeof body.success === 'boolean' && !body.success) {
955
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
956
- reject(new Error(body.error || errString));
957
- }
958
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
959
- resolve(body);
960
- }
961
- else {
962
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
963
- reject(errString);
964
- }
965
- }
966
- });
967
- });
968
- });
1197
+ else if (Object.keys(localVarFormParams).length > 0) {
1198
+ // URL-encoded form
1199
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1200
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1201
+ }
1202
+ }
1203
+ const response = await fetch(url, requestOptions);
1204
+ return this.handleResponse(response, 'GenericApiResponse');
969
1205
  }
970
1206
  /**
971
1207
  * Download the source code for this block.
@@ -978,9 +1214,11 @@ class OrganizationBlocksApi {
978
1214
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
979
1215
  .replace('{' + 'deployId' + '}', encodeURIComponent(String(deployId)));
980
1216
  let localVarQueryParameters = {};
981
- let localVarHeaderParams = Object.assign({
982
- 'User-Agent': 'edgeimpulse-api nodejs'
983
- }, this.defaultHeaders);
1217
+ let localVarHeaderParams = {
1218
+ 'User-Agent': 'edgeimpulse-api nodejs',
1219
+ 'Content-Type': 'application/json',
1220
+ ...this.defaultHeaders,
1221
+ };
984
1222
  const produces = ['application/json'];
985
1223
  // give precedence to 'application/json'
986
1224
  if (produces.indexOf('application/json') >= 0) {
@@ -989,7 +1227,7 @@ class OrganizationBlocksApi {
989
1227
  else {
990
1228
  localVarHeaderParams.Accept = produces.join(',');
991
1229
  }
992
- let localVarFormParams = {};
1230
+ let localVarFormParams;
993
1231
  // verify required parameter 'organizationId' is not null or undefined
994
1232
  if (organizationId === null || organizationId === undefined) {
995
1233
  throw new Error('Required parameter organizationId was null or undefined when calling exportOrganizationDeployBlock.');
@@ -998,55 +1236,51 @@ class OrganizationBlocksApi {
998
1236
  if (deployId === null || deployId === undefined) {
999
1237
  throw new Error('Required parameter deployId was null or undefined when calling exportOrganizationDeployBlock.');
1000
1238
  }
1001
- Object.assign(localVarHeaderParams, options.headers);
1002
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1003
- let localVarUseFormData = false;
1239
+ localVarHeaderParams = {
1240
+ ...localVarHeaderParams,
1241
+ ...options.headers,
1242
+ ...this.opts.extraHeaders,
1243
+ };
1244
+ const queryString = Object.entries(localVarQueryParameters)
1245
+ .filter(([, value]) => value !== undefined)
1246
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1247
+ .join('&');
1248
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1004
1249
  let localVarRequestOptions = {
1005
1250
  method: 'POST',
1006
- qs: localVarQueryParameters,
1007
- headers: localVarHeaderParams,
1008
- uri: localVarPath,
1009
- useQuerystring: this._useQuerystring,
1010
- agentOptions: { keepAlive: false },
1011
- json: true,
1012
- };
1013
- let authenticationPromise = Promise.resolve();
1014
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1015
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1016
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1017
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1018
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1019
- return authenticationPromise.then(() => {
1020
- if (Object.keys(localVarFormParams).length) {
1021
- if (localVarUseFormData) {
1022
- localVarRequestOptions.formData = localVarFormParams;
1023
- }
1024
- else {
1025
- localVarRequestOptions.form = localVarFormParams;
1026
- }
1251
+ headers: { ...localVarHeaderParams },
1252
+ };
1253
+ let requestOptions = localVarRequestOptions;
1254
+ let url = localVarUrl;
1255
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1256
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1257
+ url = auth_ApiKeyAuthentication.url;
1258
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1259
+ requestOptions = auth_JWTAuthentication.requestOptions;
1260
+ url = auth_JWTAuthentication.url;
1261
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1262
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1263
+ url = auth_JWTHttpHeaderAuthentication.url;
1264
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1265
+ requestOptions = auth_OAuth2.requestOptions;
1266
+ url = auth_OAuth2.url;
1267
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1268
+ requestOptions = authDefault.requestOptions;
1269
+ url = authDefault.url;
1270
+ if (localVarFormParams) {
1271
+ delete requestOptions.headers['Content-Type'];
1272
+ if (localVarFormParams instanceof FormData) {
1273
+ // FormData: fetch will handle Content-Type automatically.
1274
+ requestOptions.body = localVarFormParams;
1027
1275
  }
1028
- return new Promise((resolve, reject) => {
1029
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1030
- if (error) {
1031
- reject(error);
1032
- }
1033
- else {
1034
- body = models_1.ObjectSerializer.deserialize(body, "ExportBlockResponse");
1035
- if (typeof body.success === 'boolean' && !body.success) {
1036
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1037
- reject(new Error(body.error || errString));
1038
- }
1039
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1040
- resolve(body);
1041
- }
1042
- else {
1043
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1044
- reject(errString);
1045
- }
1046
- }
1047
- });
1048
- });
1049
- });
1276
+ else if (Object.keys(localVarFormParams).length > 0) {
1277
+ // URL-encoded form
1278
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1279
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1280
+ }
1281
+ }
1282
+ const response = await fetch(url, requestOptions);
1283
+ return this.handleResponse(response, 'ExportBlockResponse');
1050
1284
  }
1051
1285
  /**
1052
1286
  * Download the source code for this block.
@@ -1059,9 +1293,11 @@ class OrganizationBlocksApi {
1059
1293
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1060
1294
  .replace('{' + 'dspId' + '}', encodeURIComponent(String(dspId)));
1061
1295
  let localVarQueryParameters = {};
1062
- let localVarHeaderParams = Object.assign({
1063
- 'User-Agent': 'edgeimpulse-api nodejs'
1064
- }, this.defaultHeaders);
1296
+ let localVarHeaderParams = {
1297
+ 'User-Agent': 'edgeimpulse-api nodejs',
1298
+ 'Content-Type': 'application/json',
1299
+ ...this.defaultHeaders,
1300
+ };
1065
1301
  const produces = ['application/json'];
1066
1302
  // give precedence to 'application/json'
1067
1303
  if (produces.indexOf('application/json') >= 0) {
@@ -1070,7 +1306,7 @@ class OrganizationBlocksApi {
1070
1306
  else {
1071
1307
  localVarHeaderParams.Accept = produces.join(',');
1072
1308
  }
1073
- let localVarFormParams = {};
1309
+ let localVarFormParams;
1074
1310
  // verify required parameter 'organizationId' is not null or undefined
1075
1311
  if (organizationId === null || organizationId === undefined) {
1076
1312
  throw new Error('Required parameter organizationId was null or undefined when calling exportOrganizationDspBlock.');
@@ -1079,55 +1315,51 @@ class OrganizationBlocksApi {
1079
1315
  if (dspId === null || dspId === undefined) {
1080
1316
  throw new Error('Required parameter dspId was null or undefined when calling exportOrganizationDspBlock.');
1081
1317
  }
1082
- Object.assign(localVarHeaderParams, options.headers);
1083
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1084
- let localVarUseFormData = false;
1318
+ localVarHeaderParams = {
1319
+ ...localVarHeaderParams,
1320
+ ...options.headers,
1321
+ ...this.opts.extraHeaders,
1322
+ };
1323
+ const queryString = Object.entries(localVarQueryParameters)
1324
+ .filter(([, value]) => value !== undefined)
1325
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1326
+ .join('&');
1327
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1085
1328
  let localVarRequestOptions = {
1086
1329
  method: 'POST',
1087
- qs: localVarQueryParameters,
1088
- headers: localVarHeaderParams,
1089
- uri: localVarPath,
1090
- useQuerystring: this._useQuerystring,
1091
- agentOptions: { keepAlive: false },
1092
- json: true,
1093
- };
1094
- let authenticationPromise = Promise.resolve();
1095
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1096
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1097
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1098
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1099
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1100
- return authenticationPromise.then(() => {
1101
- if (Object.keys(localVarFormParams).length) {
1102
- if (localVarUseFormData) {
1103
- localVarRequestOptions.formData = localVarFormParams;
1104
- }
1105
- else {
1106
- localVarRequestOptions.form = localVarFormParams;
1107
- }
1330
+ headers: { ...localVarHeaderParams },
1331
+ };
1332
+ let requestOptions = localVarRequestOptions;
1333
+ let url = localVarUrl;
1334
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1335
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1336
+ url = auth_ApiKeyAuthentication.url;
1337
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1338
+ requestOptions = auth_JWTAuthentication.requestOptions;
1339
+ url = auth_JWTAuthentication.url;
1340
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1341
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1342
+ url = auth_JWTHttpHeaderAuthentication.url;
1343
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1344
+ requestOptions = auth_OAuth2.requestOptions;
1345
+ url = auth_OAuth2.url;
1346
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1347
+ requestOptions = authDefault.requestOptions;
1348
+ url = authDefault.url;
1349
+ if (localVarFormParams) {
1350
+ delete requestOptions.headers['Content-Type'];
1351
+ if (localVarFormParams instanceof FormData) {
1352
+ // FormData: fetch will handle Content-Type automatically.
1353
+ requestOptions.body = localVarFormParams;
1108
1354
  }
1109
- return new Promise((resolve, reject) => {
1110
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1111
- if (error) {
1112
- reject(error);
1113
- }
1114
- else {
1115
- body = models_1.ObjectSerializer.deserialize(body, "ExportBlockResponse");
1116
- if (typeof body.success === 'boolean' && !body.success) {
1117
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1118
- reject(new Error(body.error || errString));
1119
- }
1120
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1121
- resolve(body);
1122
- }
1123
- else {
1124
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1125
- reject(errString);
1126
- }
1127
- }
1128
- });
1129
- });
1130
- });
1355
+ else if (Object.keys(localVarFormParams).length > 0) {
1356
+ // URL-encoded form
1357
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1358
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1359
+ }
1360
+ }
1361
+ const response = await fetch(url, requestOptions);
1362
+ return this.handleResponse(response, 'ExportBlockResponse');
1131
1363
  }
1132
1364
  /**
1133
1365
  * Download the source code for this block.
@@ -1140,9 +1372,11 @@ class OrganizationBlocksApi {
1140
1372
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1141
1373
  .replace('{' + 'transferLearningId' + '}', encodeURIComponent(String(transferLearningId)));
1142
1374
  let localVarQueryParameters = {};
1143
- let localVarHeaderParams = Object.assign({
1144
- 'User-Agent': 'edgeimpulse-api nodejs'
1145
- }, this.defaultHeaders);
1375
+ let localVarHeaderParams = {
1376
+ 'User-Agent': 'edgeimpulse-api nodejs',
1377
+ 'Content-Type': 'application/json',
1378
+ ...this.defaultHeaders,
1379
+ };
1146
1380
  const produces = ['application/json'];
1147
1381
  // give precedence to 'application/json'
1148
1382
  if (produces.indexOf('application/json') >= 0) {
@@ -1151,7 +1385,7 @@ class OrganizationBlocksApi {
1151
1385
  else {
1152
1386
  localVarHeaderParams.Accept = produces.join(',');
1153
1387
  }
1154
- let localVarFormParams = {};
1388
+ let localVarFormParams;
1155
1389
  // verify required parameter 'organizationId' is not null or undefined
1156
1390
  if (organizationId === null || organizationId === undefined) {
1157
1391
  throw new Error('Required parameter organizationId was null or undefined when calling exportOrganizationTransferLearningBlock.');
@@ -1160,55 +1394,51 @@ class OrganizationBlocksApi {
1160
1394
  if (transferLearningId === null || transferLearningId === undefined) {
1161
1395
  throw new Error('Required parameter transferLearningId was null or undefined when calling exportOrganizationTransferLearningBlock.');
1162
1396
  }
1163
- Object.assign(localVarHeaderParams, options.headers);
1164
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1165
- let localVarUseFormData = false;
1397
+ localVarHeaderParams = {
1398
+ ...localVarHeaderParams,
1399
+ ...options.headers,
1400
+ ...this.opts.extraHeaders,
1401
+ };
1402
+ const queryString = Object.entries(localVarQueryParameters)
1403
+ .filter(([, value]) => value !== undefined)
1404
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1405
+ .join('&');
1406
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1166
1407
  let localVarRequestOptions = {
1167
1408
  method: 'POST',
1168
- qs: localVarQueryParameters,
1169
- headers: localVarHeaderParams,
1170
- uri: localVarPath,
1171
- useQuerystring: this._useQuerystring,
1172
- agentOptions: { keepAlive: false },
1173
- json: true,
1174
- };
1175
- let authenticationPromise = Promise.resolve();
1176
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1177
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1178
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1179
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1180
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1181
- return authenticationPromise.then(() => {
1182
- if (Object.keys(localVarFormParams).length) {
1183
- if (localVarUseFormData) {
1184
- localVarRequestOptions.formData = localVarFormParams;
1185
- }
1186
- else {
1187
- localVarRequestOptions.form = localVarFormParams;
1188
- }
1409
+ headers: { ...localVarHeaderParams },
1410
+ };
1411
+ let requestOptions = localVarRequestOptions;
1412
+ let url = localVarUrl;
1413
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1414
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1415
+ url = auth_ApiKeyAuthentication.url;
1416
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1417
+ requestOptions = auth_JWTAuthentication.requestOptions;
1418
+ url = auth_JWTAuthentication.url;
1419
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1420
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1421
+ url = auth_JWTHttpHeaderAuthentication.url;
1422
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1423
+ requestOptions = auth_OAuth2.requestOptions;
1424
+ url = auth_OAuth2.url;
1425
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1426
+ requestOptions = authDefault.requestOptions;
1427
+ url = authDefault.url;
1428
+ if (localVarFormParams) {
1429
+ delete requestOptions.headers['Content-Type'];
1430
+ if (localVarFormParams instanceof FormData) {
1431
+ // FormData: fetch will handle Content-Type automatically.
1432
+ requestOptions.body = localVarFormParams;
1189
1433
  }
1190
- return new Promise((resolve, reject) => {
1191
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1192
- if (error) {
1193
- reject(error);
1194
- }
1195
- else {
1196
- body = models_1.ObjectSerializer.deserialize(body, "ExportBlockResponse");
1197
- if (typeof body.success === 'boolean' && !body.success) {
1198
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1199
- reject(new Error(body.error || errString));
1200
- }
1201
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1202
- resolve(body);
1203
- }
1204
- else {
1205
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1206
- reject(errString);
1207
- }
1208
- }
1209
- });
1210
- });
1211
- });
1434
+ else if (Object.keys(localVarFormParams).length > 0) {
1435
+ // URL-encoded form
1436
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1437
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1438
+ }
1439
+ }
1440
+ const response = await fetch(url, requestOptions);
1441
+ return this.handleResponse(response, 'ExportBlockResponse');
1212
1442
  }
1213
1443
  /**
1214
1444
  * Download the source code for this block.
@@ -1221,9 +1451,11 @@ class OrganizationBlocksApi {
1221
1451
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1222
1452
  .replace('{' + 'transformationId' + '}', encodeURIComponent(String(transformationId)));
1223
1453
  let localVarQueryParameters = {};
1224
- let localVarHeaderParams = Object.assign({
1225
- 'User-Agent': 'edgeimpulse-api nodejs'
1226
- }, this.defaultHeaders);
1454
+ let localVarHeaderParams = {
1455
+ 'User-Agent': 'edgeimpulse-api nodejs',
1456
+ 'Content-Type': 'application/json',
1457
+ ...this.defaultHeaders,
1458
+ };
1227
1459
  const produces = ['application/json'];
1228
1460
  // give precedence to 'application/json'
1229
1461
  if (produces.indexOf('application/json') >= 0) {
@@ -1232,7 +1464,7 @@ class OrganizationBlocksApi {
1232
1464
  else {
1233
1465
  localVarHeaderParams.Accept = produces.join(',');
1234
1466
  }
1235
- let localVarFormParams = {};
1467
+ let localVarFormParams;
1236
1468
  // verify required parameter 'organizationId' is not null or undefined
1237
1469
  if (organizationId === null || organizationId === undefined) {
1238
1470
  throw new Error('Required parameter organizationId was null or undefined when calling exportOrganizationTransformationBlock.');
@@ -1241,55 +1473,51 @@ class OrganizationBlocksApi {
1241
1473
  if (transformationId === null || transformationId === undefined) {
1242
1474
  throw new Error('Required parameter transformationId was null or undefined when calling exportOrganizationTransformationBlock.');
1243
1475
  }
1244
- Object.assign(localVarHeaderParams, options.headers);
1245
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1246
- let localVarUseFormData = false;
1476
+ localVarHeaderParams = {
1477
+ ...localVarHeaderParams,
1478
+ ...options.headers,
1479
+ ...this.opts.extraHeaders,
1480
+ };
1481
+ const queryString = Object.entries(localVarQueryParameters)
1482
+ .filter(([, value]) => value !== undefined)
1483
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1484
+ .join('&');
1485
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1247
1486
  let localVarRequestOptions = {
1248
1487
  method: 'POST',
1249
- qs: localVarQueryParameters,
1250
- headers: localVarHeaderParams,
1251
- uri: localVarPath,
1252
- useQuerystring: this._useQuerystring,
1253
- agentOptions: { keepAlive: false },
1254
- json: true,
1255
- };
1256
- let authenticationPromise = Promise.resolve();
1257
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1258
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1259
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1260
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1261
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1262
- return authenticationPromise.then(() => {
1263
- if (Object.keys(localVarFormParams).length) {
1264
- if (localVarUseFormData) {
1265
- localVarRequestOptions.formData = localVarFormParams;
1266
- }
1267
- else {
1268
- localVarRequestOptions.form = localVarFormParams;
1269
- }
1488
+ headers: { ...localVarHeaderParams },
1489
+ };
1490
+ let requestOptions = localVarRequestOptions;
1491
+ let url = localVarUrl;
1492
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1493
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1494
+ url = auth_ApiKeyAuthentication.url;
1495
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1496
+ requestOptions = auth_JWTAuthentication.requestOptions;
1497
+ url = auth_JWTAuthentication.url;
1498
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1499
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1500
+ url = auth_JWTHttpHeaderAuthentication.url;
1501
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1502
+ requestOptions = auth_OAuth2.requestOptions;
1503
+ url = auth_OAuth2.url;
1504
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1505
+ requestOptions = authDefault.requestOptions;
1506
+ url = authDefault.url;
1507
+ if (localVarFormParams) {
1508
+ delete requestOptions.headers['Content-Type'];
1509
+ if (localVarFormParams instanceof FormData) {
1510
+ // FormData: fetch will handle Content-Type automatically.
1511
+ requestOptions.body = localVarFormParams;
1270
1512
  }
1271
- return new Promise((resolve, reject) => {
1272
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1273
- if (error) {
1274
- reject(error);
1275
- }
1276
- else {
1277
- body = models_1.ObjectSerializer.deserialize(body, "ExportBlockResponse");
1278
- if (typeof body.success === 'boolean' && !body.success) {
1279
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1280
- reject(new Error(body.error || errString));
1281
- }
1282
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1283
- resolve(body);
1284
- }
1285
- else {
1286
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1287
- reject(errString);
1288
- }
1289
- }
1290
- });
1291
- });
1292
- });
1513
+ else if (Object.keys(localVarFormParams).length > 0) {
1514
+ // URL-encoded form
1515
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1516
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1517
+ }
1518
+ }
1519
+ const response = await fetch(url, requestOptions);
1520
+ return this.handleResponse(response, 'ExportBlockResponse');
1293
1521
  }
1294
1522
  /**
1295
1523
  * Gets a deploy block.
@@ -1302,9 +1530,11 @@ class OrganizationBlocksApi {
1302
1530
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1303
1531
  .replace('{' + 'deployId' + '}', encodeURIComponent(String(deployId)));
1304
1532
  let localVarQueryParameters = {};
1305
- let localVarHeaderParams = Object.assign({
1306
- 'User-Agent': 'edgeimpulse-api nodejs'
1307
- }, this.defaultHeaders);
1533
+ let localVarHeaderParams = {
1534
+ 'User-Agent': 'edgeimpulse-api nodejs',
1535
+ 'Content-Type': 'application/json',
1536
+ ...this.defaultHeaders,
1537
+ };
1308
1538
  const produces = ['application/json'];
1309
1539
  // give precedence to 'application/json'
1310
1540
  if (produces.indexOf('application/json') >= 0) {
@@ -1313,7 +1543,7 @@ class OrganizationBlocksApi {
1313
1543
  else {
1314
1544
  localVarHeaderParams.Accept = produces.join(',');
1315
1545
  }
1316
- let localVarFormParams = {};
1546
+ let localVarFormParams;
1317
1547
  // verify required parameter 'organizationId' is not null or undefined
1318
1548
  if (organizationId === null || organizationId === undefined) {
1319
1549
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationDeployBlock.');
@@ -1322,55 +1552,51 @@ class OrganizationBlocksApi {
1322
1552
  if (deployId === null || deployId === undefined) {
1323
1553
  throw new Error('Required parameter deployId was null or undefined when calling getOrganizationDeployBlock.');
1324
1554
  }
1325
- Object.assign(localVarHeaderParams, options.headers);
1326
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1327
- let localVarUseFormData = false;
1555
+ localVarHeaderParams = {
1556
+ ...localVarHeaderParams,
1557
+ ...options.headers,
1558
+ ...this.opts.extraHeaders,
1559
+ };
1560
+ const queryString = Object.entries(localVarQueryParameters)
1561
+ .filter(([, value]) => value !== undefined)
1562
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1563
+ .join('&');
1564
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1328
1565
  let localVarRequestOptions = {
1329
1566
  method: 'GET',
1330
- qs: localVarQueryParameters,
1331
- headers: localVarHeaderParams,
1332
- uri: localVarPath,
1333
- useQuerystring: this._useQuerystring,
1334
- agentOptions: { keepAlive: false },
1335
- json: true,
1336
- };
1337
- let authenticationPromise = Promise.resolve();
1338
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1339
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1340
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1341
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1342
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1343
- return authenticationPromise.then(() => {
1344
- if (Object.keys(localVarFormParams).length) {
1345
- if (localVarUseFormData) {
1346
- localVarRequestOptions.formData = localVarFormParams;
1347
- }
1348
- else {
1349
- localVarRequestOptions.form = localVarFormParams;
1350
- }
1567
+ headers: { ...localVarHeaderParams },
1568
+ };
1569
+ let requestOptions = localVarRequestOptions;
1570
+ let url = localVarUrl;
1571
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1572
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1573
+ url = auth_ApiKeyAuthentication.url;
1574
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1575
+ requestOptions = auth_JWTAuthentication.requestOptions;
1576
+ url = auth_JWTAuthentication.url;
1577
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1578
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1579
+ url = auth_JWTHttpHeaderAuthentication.url;
1580
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1581
+ requestOptions = auth_OAuth2.requestOptions;
1582
+ url = auth_OAuth2.url;
1583
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1584
+ requestOptions = authDefault.requestOptions;
1585
+ url = authDefault.url;
1586
+ if (localVarFormParams) {
1587
+ delete requestOptions.headers['Content-Type'];
1588
+ if (localVarFormParams instanceof FormData) {
1589
+ // FormData: fetch will handle Content-Type automatically.
1590
+ requestOptions.body = localVarFormParams;
1351
1591
  }
1352
- return new Promise((resolve, reject) => {
1353
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1354
- if (error) {
1355
- reject(error);
1356
- }
1357
- else {
1358
- body = models_1.ObjectSerializer.deserialize(body, "GetOrganizationDeployBlockResponse");
1359
- if (typeof body.success === 'boolean' && !body.success) {
1360
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1361
- reject(new Error(body.error || errString));
1362
- }
1363
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1364
- resolve(body);
1365
- }
1366
- else {
1367
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1368
- reject(errString);
1369
- }
1370
- }
1371
- });
1372
- });
1373
- });
1592
+ else if (Object.keys(localVarFormParams).length > 0) {
1593
+ // URL-encoded form
1594
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1595
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1596
+ }
1597
+ }
1598
+ const response = await fetch(url, requestOptions);
1599
+ return this.handleResponse(response, 'GetOrganizationDeployBlockResponse');
1374
1600
  }
1375
1601
  /**
1376
1602
  * Gets a dsp block.
@@ -1383,9 +1609,11 @@ class OrganizationBlocksApi {
1383
1609
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1384
1610
  .replace('{' + 'dspId' + '}', encodeURIComponent(String(dspId)));
1385
1611
  let localVarQueryParameters = {};
1386
- let localVarHeaderParams = Object.assign({
1387
- 'User-Agent': 'edgeimpulse-api nodejs'
1388
- }, this.defaultHeaders);
1612
+ let localVarHeaderParams = {
1613
+ 'User-Agent': 'edgeimpulse-api nodejs',
1614
+ 'Content-Type': 'application/json',
1615
+ ...this.defaultHeaders,
1616
+ };
1389
1617
  const produces = ['application/json'];
1390
1618
  // give precedence to 'application/json'
1391
1619
  if (produces.indexOf('application/json') >= 0) {
@@ -1394,7 +1622,7 @@ class OrganizationBlocksApi {
1394
1622
  else {
1395
1623
  localVarHeaderParams.Accept = produces.join(',');
1396
1624
  }
1397
- let localVarFormParams = {};
1625
+ let localVarFormParams;
1398
1626
  // verify required parameter 'organizationId' is not null or undefined
1399
1627
  if (organizationId === null || organizationId === undefined) {
1400
1628
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationDspBlock.');
@@ -1403,55 +1631,51 @@ class OrganizationBlocksApi {
1403
1631
  if (dspId === null || dspId === undefined) {
1404
1632
  throw new Error('Required parameter dspId was null or undefined when calling getOrganizationDspBlock.');
1405
1633
  }
1406
- Object.assign(localVarHeaderParams, options.headers);
1407
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1408
- let localVarUseFormData = false;
1634
+ localVarHeaderParams = {
1635
+ ...localVarHeaderParams,
1636
+ ...options.headers,
1637
+ ...this.opts.extraHeaders,
1638
+ };
1639
+ const queryString = Object.entries(localVarQueryParameters)
1640
+ .filter(([, value]) => value !== undefined)
1641
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1642
+ .join('&');
1643
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1409
1644
  let localVarRequestOptions = {
1410
1645
  method: 'GET',
1411
- qs: localVarQueryParameters,
1412
- headers: localVarHeaderParams,
1413
- uri: localVarPath,
1414
- useQuerystring: this._useQuerystring,
1415
- agentOptions: { keepAlive: false },
1416
- json: true,
1417
- };
1418
- let authenticationPromise = Promise.resolve();
1419
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1420
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1421
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1422
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1423
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1424
- return authenticationPromise.then(() => {
1425
- if (Object.keys(localVarFormParams).length) {
1426
- if (localVarUseFormData) {
1427
- localVarRequestOptions.formData = localVarFormParams;
1428
- }
1429
- else {
1430
- localVarRequestOptions.form = localVarFormParams;
1431
- }
1646
+ headers: { ...localVarHeaderParams },
1647
+ };
1648
+ let requestOptions = localVarRequestOptions;
1649
+ let url = localVarUrl;
1650
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1651
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1652
+ url = auth_ApiKeyAuthentication.url;
1653
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1654
+ requestOptions = auth_JWTAuthentication.requestOptions;
1655
+ url = auth_JWTAuthentication.url;
1656
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1657
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1658
+ url = auth_JWTHttpHeaderAuthentication.url;
1659
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1660
+ requestOptions = auth_OAuth2.requestOptions;
1661
+ url = auth_OAuth2.url;
1662
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1663
+ requestOptions = authDefault.requestOptions;
1664
+ url = authDefault.url;
1665
+ if (localVarFormParams) {
1666
+ delete requestOptions.headers['Content-Type'];
1667
+ if (localVarFormParams instanceof FormData) {
1668
+ // FormData: fetch will handle Content-Type automatically.
1669
+ requestOptions.body = localVarFormParams;
1432
1670
  }
1433
- return new Promise((resolve, reject) => {
1434
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1435
- if (error) {
1436
- reject(error);
1437
- }
1438
- else {
1439
- body = models_1.ObjectSerializer.deserialize(body, "GetOrganizationDspBlockResponse");
1440
- if (typeof body.success === 'boolean' && !body.success) {
1441
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1442
- reject(new Error(body.error || errString));
1443
- }
1444
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1445
- resolve(body);
1446
- }
1447
- else {
1448
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1449
- reject(errString);
1450
- }
1451
- }
1452
- });
1453
- });
1454
- });
1671
+ else if (Object.keys(localVarFormParams).length > 0) {
1672
+ // URL-encoded form
1673
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1674
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1675
+ }
1676
+ }
1677
+ const response = await fetch(url, requestOptions);
1678
+ return this.handleResponse(response, 'GetOrganizationDspBlockResponse');
1455
1679
  }
1456
1680
  /**
1457
1681
  * Gets a transfer learning block.
@@ -1464,9 +1688,11 @@ class OrganizationBlocksApi {
1464
1688
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1465
1689
  .replace('{' + 'transferLearningId' + '}', encodeURIComponent(String(transferLearningId)));
1466
1690
  let localVarQueryParameters = {};
1467
- let localVarHeaderParams = Object.assign({
1468
- 'User-Agent': 'edgeimpulse-api nodejs'
1469
- }, this.defaultHeaders);
1691
+ let localVarHeaderParams = {
1692
+ 'User-Agent': 'edgeimpulse-api nodejs',
1693
+ 'Content-Type': 'application/json',
1694
+ ...this.defaultHeaders,
1695
+ };
1470
1696
  const produces = ['application/json'];
1471
1697
  // give precedence to 'application/json'
1472
1698
  if (produces.indexOf('application/json') >= 0) {
@@ -1475,7 +1701,7 @@ class OrganizationBlocksApi {
1475
1701
  else {
1476
1702
  localVarHeaderParams.Accept = produces.join(',');
1477
1703
  }
1478
- let localVarFormParams = {};
1704
+ let localVarFormParams;
1479
1705
  // verify required parameter 'organizationId' is not null or undefined
1480
1706
  if (organizationId === null || organizationId === undefined) {
1481
1707
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationTransferLearningBlock.');
@@ -1484,55 +1710,51 @@ class OrganizationBlocksApi {
1484
1710
  if (transferLearningId === null || transferLearningId === undefined) {
1485
1711
  throw new Error('Required parameter transferLearningId was null or undefined when calling getOrganizationTransferLearningBlock.');
1486
1712
  }
1487
- Object.assign(localVarHeaderParams, options.headers);
1488
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1489
- let localVarUseFormData = false;
1713
+ localVarHeaderParams = {
1714
+ ...localVarHeaderParams,
1715
+ ...options.headers,
1716
+ ...this.opts.extraHeaders,
1717
+ };
1718
+ const queryString = Object.entries(localVarQueryParameters)
1719
+ .filter(([, value]) => value !== undefined)
1720
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1721
+ .join('&');
1722
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1490
1723
  let localVarRequestOptions = {
1491
1724
  method: 'GET',
1492
- qs: localVarQueryParameters,
1493
- headers: localVarHeaderParams,
1494
- uri: localVarPath,
1495
- useQuerystring: this._useQuerystring,
1496
- agentOptions: { keepAlive: false },
1497
- json: true,
1498
- };
1499
- let authenticationPromise = Promise.resolve();
1500
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1501
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1502
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1503
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1504
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1505
- return authenticationPromise.then(() => {
1506
- if (Object.keys(localVarFormParams).length) {
1507
- if (localVarUseFormData) {
1508
- localVarRequestOptions.formData = localVarFormParams;
1509
- }
1510
- else {
1511
- localVarRequestOptions.form = localVarFormParams;
1512
- }
1725
+ headers: { ...localVarHeaderParams },
1726
+ };
1727
+ let requestOptions = localVarRequestOptions;
1728
+ let url = localVarUrl;
1729
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1730
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1731
+ url = auth_ApiKeyAuthentication.url;
1732
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1733
+ requestOptions = auth_JWTAuthentication.requestOptions;
1734
+ url = auth_JWTAuthentication.url;
1735
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1736
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1737
+ url = auth_JWTHttpHeaderAuthentication.url;
1738
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1739
+ requestOptions = auth_OAuth2.requestOptions;
1740
+ url = auth_OAuth2.url;
1741
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1742
+ requestOptions = authDefault.requestOptions;
1743
+ url = authDefault.url;
1744
+ if (localVarFormParams) {
1745
+ delete requestOptions.headers['Content-Type'];
1746
+ if (localVarFormParams instanceof FormData) {
1747
+ // FormData: fetch will handle Content-Type automatically.
1748
+ requestOptions.body = localVarFormParams;
1513
1749
  }
1514
- return new Promise((resolve, reject) => {
1515
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1516
- if (error) {
1517
- reject(error);
1518
- }
1519
- else {
1520
- body = models_1.ObjectSerializer.deserialize(body, "GetOrganizationTransferLearningBlockResponse");
1521
- if (typeof body.success === 'boolean' && !body.success) {
1522
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1523
- reject(new Error(body.error || errString));
1524
- }
1525
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1526
- resolve(body);
1527
- }
1528
- else {
1529
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1530
- reject(errString);
1531
- }
1532
- }
1533
- });
1534
- });
1535
- });
1750
+ else if (Object.keys(localVarFormParams).length > 0) {
1751
+ // URL-encoded form
1752
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1753
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1754
+ }
1755
+ }
1756
+ const response = await fetch(url, requestOptions);
1757
+ return this.handleResponse(response, 'GetOrganizationTransferLearningBlockResponse');
1536
1758
  }
1537
1759
  /**
1538
1760
  * Get a transformation block.
@@ -1545,9 +1767,11 @@ class OrganizationBlocksApi {
1545
1767
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1546
1768
  .replace('{' + 'transformationId' + '}', encodeURIComponent(String(transformationId)));
1547
1769
  let localVarQueryParameters = {};
1548
- let localVarHeaderParams = Object.assign({
1549
- 'User-Agent': 'edgeimpulse-api nodejs'
1550
- }, this.defaultHeaders);
1770
+ let localVarHeaderParams = {
1771
+ 'User-Agent': 'edgeimpulse-api nodejs',
1772
+ 'Content-Type': 'application/json',
1773
+ ...this.defaultHeaders,
1774
+ };
1551
1775
  const produces = ['application/json'];
1552
1776
  // give precedence to 'application/json'
1553
1777
  if (produces.indexOf('application/json') >= 0) {
@@ -1556,7 +1780,7 @@ class OrganizationBlocksApi {
1556
1780
  else {
1557
1781
  localVarHeaderParams.Accept = produces.join(',');
1558
1782
  }
1559
- let localVarFormParams = {};
1783
+ let localVarFormParams;
1560
1784
  // verify required parameter 'organizationId' is not null or undefined
1561
1785
  if (organizationId === null || organizationId === undefined) {
1562
1786
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationTransformationBlock.');
@@ -1565,55 +1789,51 @@ class OrganizationBlocksApi {
1565
1789
  if (transformationId === null || transformationId === undefined) {
1566
1790
  throw new Error('Required parameter transformationId was null or undefined when calling getOrganizationTransformationBlock.');
1567
1791
  }
1568
- Object.assign(localVarHeaderParams, options.headers);
1569
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1570
- let localVarUseFormData = false;
1792
+ localVarHeaderParams = {
1793
+ ...localVarHeaderParams,
1794
+ ...options.headers,
1795
+ ...this.opts.extraHeaders,
1796
+ };
1797
+ const queryString = Object.entries(localVarQueryParameters)
1798
+ .filter(([, value]) => value !== undefined)
1799
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1800
+ .join('&');
1801
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1571
1802
  let localVarRequestOptions = {
1572
1803
  method: 'GET',
1573
- qs: localVarQueryParameters,
1574
- headers: localVarHeaderParams,
1575
- uri: localVarPath,
1576
- useQuerystring: this._useQuerystring,
1577
- agentOptions: { keepAlive: false },
1578
- json: true,
1579
- };
1580
- let authenticationPromise = Promise.resolve();
1581
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1582
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1583
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1584
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1585
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1586
- return authenticationPromise.then(() => {
1587
- if (Object.keys(localVarFormParams).length) {
1588
- if (localVarUseFormData) {
1589
- localVarRequestOptions.formData = localVarFormParams;
1590
- }
1591
- else {
1592
- localVarRequestOptions.form = localVarFormParams;
1593
- }
1804
+ headers: { ...localVarHeaderParams },
1805
+ };
1806
+ let requestOptions = localVarRequestOptions;
1807
+ let url = localVarUrl;
1808
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1809
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1810
+ url = auth_ApiKeyAuthentication.url;
1811
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1812
+ requestOptions = auth_JWTAuthentication.requestOptions;
1813
+ url = auth_JWTAuthentication.url;
1814
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1815
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1816
+ url = auth_JWTHttpHeaderAuthentication.url;
1817
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1818
+ requestOptions = auth_OAuth2.requestOptions;
1819
+ url = auth_OAuth2.url;
1820
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1821
+ requestOptions = authDefault.requestOptions;
1822
+ url = authDefault.url;
1823
+ if (localVarFormParams) {
1824
+ delete requestOptions.headers['Content-Type'];
1825
+ if (localVarFormParams instanceof FormData) {
1826
+ // FormData: fetch will handle Content-Type automatically.
1827
+ requestOptions.body = localVarFormParams;
1594
1828
  }
1595
- return new Promise((resolve, reject) => {
1596
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1597
- if (error) {
1598
- reject(error);
1599
- }
1600
- else {
1601
- body = models_1.ObjectSerializer.deserialize(body, "GetOrganizationTransformationBlockResponse");
1602
- if (typeof body.success === 'boolean' && !body.success) {
1603
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1604
- reject(new Error(body.error || errString));
1605
- }
1606
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1607
- resolve(body);
1608
- }
1609
- else {
1610
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1611
- reject(errString);
1612
- }
1613
- }
1614
- });
1615
- });
1616
- });
1829
+ else if (Object.keys(localVarFormParams).length > 0) {
1830
+ // URL-encoded form
1831
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1832
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1833
+ }
1834
+ }
1835
+ const response = await fetch(url, requestOptions);
1836
+ return this.handleResponse(response, 'GetOrganizationTransformationBlockResponse');
1617
1837
  }
1618
1838
  /**
1619
1839
  * Retrieve a transformation blocks published by other organizations, available for all organizations.
@@ -1626,9 +1846,11 @@ class OrganizationBlocksApi {
1626
1846
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1627
1847
  .replace('{' + 'transformationId' + '}', encodeURIComponent(String(transformationId)));
1628
1848
  let localVarQueryParameters = {};
1629
- let localVarHeaderParams = Object.assign({
1630
- 'User-Agent': 'edgeimpulse-api nodejs'
1631
- }, this.defaultHeaders);
1849
+ let localVarHeaderParams = {
1850
+ 'User-Agent': 'edgeimpulse-api nodejs',
1851
+ 'Content-Type': 'application/json',
1852
+ ...this.defaultHeaders,
1853
+ };
1632
1854
  const produces = ['application/json'];
1633
1855
  // give precedence to 'application/json'
1634
1856
  if (produces.indexOf('application/json') >= 0) {
@@ -1637,7 +1859,7 @@ class OrganizationBlocksApi {
1637
1859
  else {
1638
1860
  localVarHeaderParams.Accept = produces.join(',');
1639
1861
  }
1640
- let localVarFormParams = {};
1862
+ let localVarFormParams;
1641
1863
  // verify required parameter 'organizationId' is not null or undefined
1642
1864
  if (organizationId === null || organizationId === undefined) {
1643
1865
  throw new Error('Required parameter organizationId was null or undefined when calling getPublicOrganizationTransformationBlock.');
@@ -1646,55 +1868,51 @@ class OrganizationBlocksApi {
1646
1868
  if (transformationId === null || transformationId === undefined) {
1647
1869
  throw new Error('Required parameter transformationId was null or undefined when calling getPublicOrganizationTransformationBlock.');
1648
1870
  }
1649
- Object.assign(localVarHeaderParams, options.headers);
1650
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1651
- let localVarUseFormData = false;
1871
+ localVarHeaderParams = {
1872
+ ...localVarHeaderParams,
1873
+ ...options.headers,
1874
+ ...this.opts.extraHeaders,
1875
+ };
1876
+ const queryString = Object.entries(localVarQueryParameters)
1877
+ .filter(([, value]) => value !== undefined)
1878
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1879
+ .join('&');
1880
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1652
1881
  let localVarRequestOptions = {
1653
1882
  method: 'GET',
1654
- qs: localVarQueryParameters,
1655
- headers: localVarHeaderParams,
1656
- uri: localVarPath,
1657
- useQuerystring: this._useQuerystring,
1658
- agentOptions: { keepAlive: false },
1659
- json: true,
1660
- };
1661
- let authenticationPromise = Promise.resolve();
1662
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1663
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1664
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1665
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1666
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1667
- return authenticationPromise.then(() => {
1668
- if (Object.keys(localVarFormParams).length) {
1669
- if (localVarUseFormData) {
1670
- localVarRequestOptions.formData = localVarFormParams;
1671
- }
1672
- else {
1673
- localVarRequestOptions.form = localVarFormParams;
1674
- }
1883
+ headers: { ...localVarHeaderParams },
1884
+ };
1885
+ let requestOptions = localVarRequestOptions;
1886
+ let url = localVarUrl;
1887
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1888
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1889
+ url = auth_ApiKeyAuthentication.url;
1890
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1891
+ requestOptions = auth_JWTAuthentication.requestOptions;
1892
+ url = auth_JWTAuthentication.url;
1893
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1894
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1895
+ url = auth_JWTHttpHeaderAuthentication.url;
1896
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1897
+ requestOptions = auth_OAuth2.requestOptions;
1898
+ url = auth_OAuth2.url;
1899
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1900
+ requestOptions = authDefault.requestOptions;
1901
+ url = authDefault.url;
1902
+ if (localVarFormParams) {
1903
+ delete requestOptions.headers['Content-Type'];
1904
+ if (localVarFormParams instanceof FormData) {
1905
+ // FormData: fetch will handle Content-Type automatically.
1906
+ requestOptions.body = localVarFormParams;
1675
1907
  }
1676
- return new Promise((resolve, reject) => {
1677
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1678
- if (error) {
1679
- reject(error);
1680
- }
1681
- else {
1682
- body = models_1.ObjectSerializer.deserialize(body, "GetPublicOrganizationTransformationBlockResponse");
1683
- if (typeof body.success === 'boolean' && !body.success) {
1684
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1685
- reject(new Error(body.error || errString));
1686
- }
1687
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1688
- resolve(body);
1689
- }
1690
- else {
1691
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1692
- reject(errString);
1693
- }
1694
- }
1695
- });
1696
- });
1697
- });
1908
+ else if (Object.keys(localVarFormParams).length > 0) {
1909
+ // URL-encoded form
1910
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1911
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1912
+ }
1913
+ }
1914
+ const response = await fetch(url, requestOptions);
1915
+ return this.handleResponse(response, 'GetPublicOrganizationTransformationBlockResponse');
1698
1916
  }
1699
1917
  /**
1700
1918
  * Retrieve all deploy blocks.
@@ -1705,9 +1923,11 @@ class OrganizationBlocksApi {
1705
1923
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/deploy'
1706
1924
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
1707
1925
  let localVarQueryParameters = {};
1708
- let localVarHeaderParams = Object.assign({
1709
- 'User-Agent': 'edgeimpulse-api nodejs'
1710
- }, this.defaultHeaders);
1926
+ let localVarHeaderParams = {
1927
+ 'User-Agent': 'edgeimpulse-api nodejs',
1928
+ 'Content-Type': 'application/json',
1929
+ ...this.defaultHeaders,
1930
+ };
1711
1931
  const produces = ['application/json'];
1712
1932
  // give precedence to 'application/json'
1713
1933
  if (produces.indexOf('application/json') >= 0) {
@@ -1716,60 +1936,56 @@ class OrganizationBlocksApi {
1716
1936
  else {
1717
1937
  localVarHeaderParams.Accept = produces.join(',');
1718
1938
  }
1719
- let localVarFormParams = {};
1939
+ let localVarFormParams;
1720
1940
  // verify required parameter 'organizationId' is not null or undefined
1721
1941
  if (organizationId === null || organizationId === undefined) {
1722
1942
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationDeployBlocks.');
1723
1943
  }
1724
- Object.assign(localVarHeaderParams, options.headers);
1725
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1726
- let localVarUseFormData = false;
1944
+ localVarHeaderParams = {
1945
+ ...localVarHeaderParams,
1946
+ ...options.headers,
1947
+ ...this.opts.extraHeaders,
1948
+ };
1949
+ const queryString = Object.entries(localVarQueryParameters)
1950
+ .filter(([, value]) => value !== undefined)
1951
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1952
+ .join('&');
1953
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1727
1954
  let localVarRequestOptions = {
1728
1955
  method: 'GET',
1729
- qs: localVarQueryParameters,
1730
- headers: localVarHeaderParams,
1731
- uri: localVarPath,
1732
- useQuerystring: this._useQuerystring,
1733
- agentOptions: { keepAlive: false },
1734
- json: true,
1735
- };
1736
- let authenticationPromise = Promise.resolve();
1737
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1738
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1739
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1740
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1741
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1742
- return authenticationPromise.then(() => {
1743
- if (Object.keys(localVarFormParams).length) {
1744
- if (localVarUseFormData) {
1745
- localVarRequestOptions.formData = localVarFormParams;
1746
- }
1747
- else {
1748
- localVarRequestOptions.form = localVarFormParams;
1749
- }
1956
+ headers: { ...localVarHeaderParams },
1957
+ };
1958
+ let requestOptions = localVarRequestOptions;
1959
+ let url = localVarUrl;
1960
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1961
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1962
+ url = auth_ApiKeyAuthentication.url;
1963
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1964
+ requestOptions = auth_JWTAuthentication.requestOptions;
1965
+ url = auth_JWTAuthentication.url;
1966
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1967
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1968
+ url = auth_JWTHttpHeaderAuthentication.url;
1969
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1970
+ requestOptions = auth_OAuth2.requestOptions;
1971
+ url = auth_OAuth2.url;
1972
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1973
+ requestOptions = authDefault.requestOptions;
1974
+ url = authDefault.url;
1975
+ if (localVarFormParams) {
1976
+ delete requestOptions.headers['Content-Type'];
1977
+ if (localVarFormParams instanceof FormData) {
1978
+ // FormData: fetch will handle Content-Type automatically.
1979
+ requestOptions.body = localVarFormParams;
1750
1980
  }
1751
- return new Promise((resolve, reject) => {
1752
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1753
- if (error) {
1754
- reject(error);
1755
- }
1756
- else {
1757
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationDeployBlocksResponse");
1758
- if (typeof body.success === 'boolean' && !body.success) {
1759
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1760
- reject(new Error(body.error || errString));
1761
- }
1762
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1763
- resolve(body);
1764
- }
1765
- else {
1766
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1767
- reject(errString);
1768
- }
1769
- }
1770
- });
1771
- });
1772
- });
1981
+ else if (Object.keys(localVarFormParams).length > 0) {
1982
+ // URL-encoded form
1983
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1984
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1985
+ }
1986
+ }
1987
+ const response = await fetch(url, requestOptions);
1988
+ return this.handleResponse(response, 'ListOrganizationDeployBlocksResponse');
1773
1989
  }
1774
1990
  /**
1775
1991
  * Retrieve all dsp blocks.
@@ -1780,9 +1996,11 @@ class OrganizationBlocksApi {
1780
1996
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/dsp'
1781
1997
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
1782
1998
  let localVarQueryParameters = {};
1783
- let localVarHeaderParams = Object.assign({
1784
- 'User-Agent': 'edgeimpulse-api nodejs'
1785
- }, this.defaultHeaders);
1999
+ let localVarHeaderParams = {
2000
+ 'User-Agent': 'edgeimpulse-api nodejs',
2001
+ 'Content-Type': 'application/json',
2002
+ ...this.defaultHeaders,
2003
+ };
1786
2004
  const produces = ['application/json'];
1787
2005
  // give precedence to 'application/json'
1788
2006
  if (produces.indexOf('application/json') >= 0) {
@@ -1791,60 +2009,56 @@ class OrganizationBlocksApi {
1791
2009
  else {
1792
2010
  localVarHeaderParams.Accept = produces.join(',');
1793
2011
  }
1794
- let localVarFormParams = {};
2012
+ let localVarFormParams;
1795
2013
  // verify required parameter 'organizationId' is not null or undefined
1796
2014
  if (organizationId === null || organizationId === undefined) {
1797
2015
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationDspBlocks.');
1798
2016
  }
1799
- Object.assign(localVarHeaderParams, options.headers);
1800
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1801
- let localVarUseFormData = false;
2017
+ localVarHeaderParams = {
2018
+ ...localVarHeaderParams,
2019
+ ...options.headers,
2020
+ ...this.opts.extraHeaders,
2021
+ };
2022
+ const queryString = Object.entries(localVarQueryParameters)
2023
+ .filter(([, value]) => value !== undefined)
2024
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2025
+ .join('&');
2026
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1802
2027
  let localVarRequestOptions = {
1803
2028
  method: 'GET',
1804
- qs: localVarQueryParameters,
1805
- headers: localVarHeaderParams,
1806
- uri: localVarPath,
1807
- useQuerystring: this._useQuerystring,
1808
- agentOptions: { keepAlive: false },
1809
- json: true,
1810
- };
1811
- let authenticationPromise = Promise.resolve();
1812
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1813
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1814
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1815
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1816
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1817
- return authenticationPromise.then(() => {
1818
- if (Object.keys(localVarFormParams).length) {
1819
- if (localVarUseFormData) {
1820
- localVarRequestOptions.formData = localVarFormParams;
1821
- }
1822
- else {
1823
- localVarRequestOptions.form = localVarFormParams;
1824
- }
2029
+ headers: { ...localVarHeaderParams },
2030
+ };
2031
+ let requestOptions = localVarRequestOptions;
2032
+ let url = localVarUrl;
2033
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2034
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2035
+ url = auth_ApiKeyAuthentication.url;
2036
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2037
+ requestOptions = auth_JWTAuthentication.requestOptions;
2038
+ url = auth_JWTAuthentication.url;
2039
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2040
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2041
+ url = auth_JWTHttpHeaderAuthentication.url;
2042
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2043
+ requestOptions = auth_OAuth2.requestOptions;
2044
+ url = auth_OAuth2.url;
2045
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2046
+ requestOptions = authDefault.requestOptions;
2047
+ url = authDefault.url;
2048
+ if (localVarFormParams) {
2049
+ delete requestOptions.headers['Content-Type'];
2050
+ if (localVarFormParams instanceof FormData) {
2051
+ // FormData: fetch will handle Content-Type automatically.
2052
+ requestOptions.body = localVarFormParams;
1825
2053
  }
1826
- return new Promise((resolve, reject) => {
1827
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1828
- if (error) {
1829
- reject(error);
1830
- }
1831
- else {
1832
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationDspBlocksResponse");
1833
- if (typeof body.success === 'boolean' && !body.success) {
1834
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1835
- reject(new Error(body.error || errString));
1836
- }
1837
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1838
- resolve(body);
1839
- }
1840
- else {
1841
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1842
- reject(errString);
1843
- }
1844
- }
1845
- });
1846
- });
1847
- });
2054
+ else if (Object.keys(localVarFormParams).length > 0) {
2055
+ // URL-encoded form
2056
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2057
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2058
+ }
2059
+ }
2060
+ const response = await fetch(url, requestOptions);
2061
+ return this.handleResponse(response, 'ListOrganizationDspBlocksResponse');
1848
2062
  }
1849
2063
  /**
1850
2064
  * Retrieve all secrets.
@@ -1855,9 +2069,11 @@ class OrganizationBlocksApi {
1855
2069
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/secrets'
1856
2070
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
1857
2071
  let localVarQueryParameters = {};
1858
- let localVarHeaderParams = Object.assign({
1859
- 'User-Agent': 'edgeimpulse-api nodejs'
1860
- }, this.defaultHeaders);
2072
+ let localVarHeaderParams = {
2073
+ 'User-Agent': 'edgeimpulse-api nodejs',
2074
+ 'Content-Type': 'application/json',
2075
+ ...this.defaultHeaders,
2076
+ };
1861
2077
  const produces = ['application/json'];
1862
2078
  // give precedence to 'application/json'
1863
2079
  if (produces.indexOf('application/json') >= 0) {
@@ -1866,60 +2082,56 @@ class OrganizationBlocksApi {
1866
2082
  else {
1867
2083
  localVarHeaderParams.Accept = produces.join(',');
1868
2084
  }
1869
- let localVarFormParams = {};
2085
+ let localVarFormParams;
1870
2086
  // verify required parameter 'organizationId' is not null or undefined
1871
2087
  if (organizationId === null || organizationId === undefined) {
1872
2088
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationSecrets.');
1873
2089
  }
1874
- Object.assign(localVarHeaderParams, options.headers);
1875
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1876
- let localVarUseFormData = false;
2090
+ localVarHeaderParams = {
2091
+ ...localVarHeaderParams,
2092
+ ...options.headers,
2093
+ ...this.opts.extraHeaders,
2094
+ };
2095
+ const queryString = Object.entries(localVarQueryParameters)
2096
+ .filter(([, value]) => value !== undefined)
2097
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2098
+ .join('&');
2099
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1877
2100
  let localVarRequestOptions = {
1878
2101
  method: 'GET',
1879
- qs: localVarQueryParameters,
1880
- headers: localVarHeaderParams,
1881
- uri: localVarPath,
1882
- useQuerystring: this._useQuerystring,
1883
- agentOptions: { keepAlive: false },
1884
- json: true,
1885
- };
1886
- let authenticationPromise = Promise.resolve();
1887
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1888
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1889
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1890
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1891
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1892
- return authenticationPromise.then(() => {
1893
- if (Object.keys(localVarFormParams).length) {
1894
- if (localVarUseFormData) {
1895
- localVarRequestOptions.formData = localVarFormParams;
1896
- }
1897
- else {
1898
- localVarRequestOptions.form = localVarFormParams;
1899
- }
2102
+ headers: { ...localVarHeaderParams },
2103
+ };
2104
+ let requestOptions = localVarRequestOptions;
2105
+ let url = localVarUrl;
2106
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2107
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2108
+ url = auth_ApiKeyAuthentication.url;
2109
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2110
+ requestOptions = auth_JWTAuthentication.requestOptions;
2111
+ url = auth_JWTAuthentication.url;
2112
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2113
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2114
+ url = auth_JWTHttpHeaderAuthentication.url;
2115
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2116
+ requestOptions = auth_OAuth2.requestOptions;
2117
+ url = auth_OAuth2.url;
2118
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2119
+ requestOptions = authDefault.requestOptions;
2120
+ url = authDefault.url;
2121
+ if (localVarFormParams) {
2122
+ delete requestOptions.headers['Content-Type'];
2123
+ if (localVarFormParams instanceof FormData) {
2124
+ // FormData: fetch will handle Content-Type automatically.
2125
+ requestOptions.body = localVarFormParams;
1900
2126
  }
1901
- return new Promise((resolve, reject) => {
1902
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1903
- if (error) {
1904
- reject(error);
1905
- }
1906
- else {
1907
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationSecretsResponse");
1908
- if (typeof body.success === 'boolean' && !body.success) {
1909
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1910
- reject(new Error(body.error || errString));
1911
- }
1912
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1913
- resolve(body);
1914
- }
1915
- else {
1916
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1917
- reject(errString);
1918
- }
1919
- }
1920
- });
1921
- });
1922
- });
2127
+ else if (Object.keys(localVarFormParams).length > 0) {
2128
+ // URL-encoded form
2129
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2130
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2131
+ }
2132
+ }
2133
+ const response = await fetch(url, requestOptions);
2134
+ return this.handleResponse(response, 'ListOrganizationSecretsResponse');
1923
2135
  }
1924
2136
  /**
1925
2137
  * Retrieve all transfer learning blocks.
@@ -1930,9 +2142,11 @@ class OrganizationBlocksApi {
1930
2142
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/transfer-learning'
1931
2143
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
1932
2144
  let localVarQueryParameters = {};
1933
- let localVarHeaderParams = Object.assign({
1934
- 'User-Agent': 'edgeimpulse-api nodejs'
1935
- }, this.defaultHeaders);
2145
+ let localVarHeaderParams = {
2146
+ 'User-Agent': 'edgeimpulse-api nodejs',
2147
+ 'Content-Type': 'application/json',
2148
+ ...this.defaultHeaders,
2149
+ };
1936
2150
  const produces = ['application/json'];
1937
2151
  // give precedence to 'application/json'
1938
2152
  if (produces.indexOf('application/json') >= 0) {
@@ -1941,60 +2155,56 @@ class OrganizationBlocksApi {
1941
2155
  else {
1942
2156
  localVarHeaderParams.Accept = produces.join(',');
1943
2157
  }
1944
- let localVarFormParams = {};
2158
+ let localVarFormParams;
1945
2159
  // verify required parameter 'organizationId' is not null or undefined
1946
2160
  if (organizationId === null || organizationId === undefined) {
1947
2161
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationTransferLearningBlocks.');
1948
2162
  }
1949
- Object.assign(localVarHeaderParams, options.headers);
1950
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1951
- let localVarUseFormData = false;
2163
+ localVarHeaderParams = {
2164
+ ...localVarHeaderParams,
2165
+ ...options.headers,
2166
+ ...this.opts.extraHeaders,
2167
+ };
2168
+ const queryString = Object.entries(localVarQueryParameters)
2169
+ .filter(([, value]) => value !== undefined)
2170
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2171
+ .join('&');
2172
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1952
2173
  let localVarRequestOptions = {
1953
2174
  method: 'GET',
1954
- qs: localVarQueryParameters,
1955
- headers: localVarHeaderParams,
1956
- uri: localVarPath,
1957
- useQuerystring: this._useQuerystring,
1958
- agentOptions: { keepAlive: false },
1959
- json: true,
1960
- };
1961
- let authenticationPromise = Promise.resolve();
1962
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1963
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1964
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1965
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1966
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1967
- return authenticationPromise.then(() => {
1968
- if (Object.keys(localVarFormParams).length) {
1969
- if (localVarUseFormData) {
1970
- localVarRequestOptions.formData = localVarFormParams;
1971
- }
1972
- else {
1973
- localVarRequestOptions.form = localVarFormParams;
1974
- }
2175
+ headers: { ...localVarHeaderParams },
2176
+ };
2177
+ let requestOptions = localVarRequestOptions;
2178
+ let url = localVarUrl;
2179
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2180
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2181
+ url = auth_ApiKeyAuthentication.url;
2182
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2183
+ requestOptions = auth_JWTAuthentication.requestOptions;
2184
+ url = auth_JWTAuthentication.url;
2185
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2186
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2187
+ url = auth_JWTHttpHeaderAuthentication.url;
2188
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2189
+ requestOptions = auth_OAuth2.requestOptions;
2190
+ url = auth_OAuth2.url;
2191
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2192
+ requestOptions = authDefault.requestOptions;
2193
+ url = authDefault.url;
2194
+ if (localVarFormParams) {
2195
+ delete requestOptions.headers['Content-Type'];
2196
+ if (localVarFormParams instanceof FormData) {
2197
+ // FormData: fetch will handle Content-Type automatically.
2198
+ requestOptions.body = localVarFormParams;
1975
2199
  }
1976
- return new Promise((resolve, reject) => {
1977
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1978
- if (error) {
1979
- reject(error);
1980
- }
1981
- else {
1982
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationTransferLearningBlocksResponse");
1983
- if (typeof body.success === 'boolean' && !body.success) {
1984
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1985
- reject(new Error(body.error || errString));
1986
- }
1987
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1988
- resolve(body);
1989
- }
1990
- else {
1991
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1992
- reject(errString);
1993
- }
1994
- }
1995
- });
1996
- });
1997
- });
2200
+ else if (Object.keys(localVarFormParams).length > 0) {
2201
+ // URL-encoded form
2202
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2203
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2204
+ }
2205
+ }
2206
+ const response = await fetch(url, requestOptions);
2207
+ return this.handleResponse(response, 'ListOrganizationTransferLearningBlocksResponse');
1998
2208
  }
1999
2209
  /**
2000
2210
  * Retrieve all transformation blocks.
@@ -2005,9 +2215,11 @@ class OrganizationBlocksApi {
2005
2215
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/transformation'
2006
2216
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
2007
2217
  let localVarQueryParameters = {};
2008
- let localVarHeaderParams = Object.assign({
2009
- 'User-Agent': 'edgeimpulse-api nodejs'
2010
- }, this.defaultHeaders);
2218
+ let localVarHeaderParams = {
2219
+ 'User-Agent': 'edgeimpulse-api nodejs',
2220
+ 'Content-Type': 'application/json',
2221
+ ...this.defaultHeaders,
2222
+ };
2011
2223
  const produces = ['application/json'];
2012
2224
  // give precedence to 'application/json'
2013
2225
  if (produces.indexOf('application/json') >= 0) {
@@ -2016,60 +2228,56 @@ class OrganizationBlocksApi {
2016
2228
  else {
2017
2229
  localVarHeaderParams.Accept = produces.join(',');
2018
2230
  }
2019
- let localVarFormParams = {};
2231
+ let localVarFormParams;
2020
2232
  // verify required parameter 'organizationId' is not null or undefined
2021
2233
  if (organizationId === null || organizationId === undefined) {
2022
2234
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationTransformationBlocks.');
2023
2235
  }
2024
- Object.assign(localVarHeaderParams, options.headers);
2025
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2026
- let localVarUseFormData = false;
2236
+ localVarHeaderParams = {
2237
+ ...localVarHeaderParams,
2238
+ ...options.headers,
2239
+ ...this.opts.extraHeaders,
2240
+ };
2241
+ const queryString = Object.entries(localVarQueryParameters)
2242
+ .filter(([, value]) => value !== undefined)
2243
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2244
+ .join('&');
2245
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2027
2246
  let localVarRequestOptions = {
2028
2247
  method: 'GET',
2029
- qs: localVarQueryParameters,
2030
- headers: localVarHeaderParams,
2031
- uri: localVarPath,
2032
- useQuerystring: this._useQuerystring,
2033
- agentOptions: { keepAlive: false },
2034
- json: true,
2035
- };
2036
- let authenticationPromise = Promise.resolve();
2037
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2038
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2039
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2040
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2041
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2042
- return authenticationPromise.then(() => {
2043
- if (Object.keys(localVarFormParams).length) {
2044
- if (localVarUseFormData) {
2045
- localVarRequestOptions.formData = localVarFormParams;
2046
- }
2047
- else {
2048
- localVarRequestOptions.form = localVarFormParams;
2049
- }
2248
+ headers: { ...localVarHeaderParams },
2249
+ };
2250
+ let requestOptions = localVarRequestOptions;
2251
+ let url = localVarUrl;
2252
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2253
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2254
+ url = auth_ApiKeyAuthentication.url;
2255
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2256
+ requestOptions = auth_JWTAuthentication.requestOptions;
2257
+ url = auth_JWTAuthentication.url;
2258
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2259
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2260
+ url = auth_JWTHttpHeaderAuthentication.url;
2261
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2262
+ requestOptions = auth_OAuth2.requestOptions;
2263
+ url = auth_OAuth2.url;
2264
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2265
+ requestOptions = authDefault.requestOptions;
2266
+ url = authDefault.url;
2267
+ if (localVarFormParams) {
2268
+ delete requestOptions.headers['Content-Type'];
2269
+ if (localVarFormParams instanceof FormData) {
2270
+ // FormData: fetch will handle Content-Type automatically.
2271
+ requestOptions.body = localVarFormParams;
2050
2272
  }
2051
- return new Promise((resolve, reject) => {
2052
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2053
- if (error) {
2054
- reject(error);
2055
- }
2056
- else {
2057
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationTransformationBlocksResponse");
2058
- if (typeof body.success === 'boolean' && !body.success) {
2059
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2060
- reject(new Error(body.error || errString));
2061
- }
2062
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2063
- resolve(body);
2064
- }
2065
- else {
2066
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2067
- reject(errString);
2068
- }
2069
- }
2070
- });
2071
- });
2072
- });
2273
+ else if (Object.keys(localVarFormParams).length > 0) {
2274
+ // URL-encoded form
2275
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2276
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2277
+ }
2278
+ }
2279
+ const response = await fetch(url, requestOptions);
2280
+ return this.handleResponse(response, 'ListOrganizationTransformationBlocksResponse');
2073
2281
  }
2074
2282
  /**
2075
2283
  * Retrieve all transformation blocks published by other organizations, available for all organizations.
@@ -2080,9 +2288,11 @@ class OrganizationBlocksApi {
2080
2288
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/transformation/public'
2081
2289
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
2082
2290
  let localVarQueryParameters = {};
2083
- let localVarHeaderParams = Object.assign({
2084
- 'User-Agent': 'edgeimpulse-api nodejs'
2085
- }, this.defaultHeaders);
2291
+ let localVarHeaderParams = {
2292
+ 'User-Agent': 'edgeimpulse-api nodejs',
2293
+ 'Content-Type': 'application/json',
2294
+ ...this.defaultHeaders,
2295
+ };
2086
2296
  const produces = ['application/json'];
2087
2297
  // give precedence to 'application/json'
2088
2298
  if (produces.indexOf('application/json') >= 0) {
@@ -2091,60 +2301,56 @@ class OrganizationBlocksApi {
2091
2301
  else {
2092
2302
  localVarHeaderParams.Accept = produces.join(',');
2093
2303
  }
2094
- let localVarFormParams = {};
2304
+ let localVarFormParams;
2095
2305
  // verify required parameter 'organizationId' is not null or undefined
2096
2306
  if (organizationId === null || organizationId === undefined) {
2097
2307
  throw new Error('Required parameter organizationId was null or undefined when calling listPublicOrganizationTransformationBlocks.');
2098
2308
  }
2099
- Object.assign(localVarHeaderParams, options.headers);
2100
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2101
- let localVarUseFormData = false;
2309
+ localVarHeaderParams = {
2310
+ ...localVarHeaderParams,
2311
+ ...options.headers,
2312
+ ...this.opts.extraHeaders,
2313
+ };
2314
+ const queryString = Object.entries(localVarQueryParameters)
2315
+ .filter(([, value]) => value !== undefined)
2316
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2317
+ .join('&');
2318
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2102
2319
  let localVarRequestOptions = {
2103
2320
  method: 'GET',
2104
- qs: localVarQueryParameters,
2105
- headers: localVarHeaderParams,
2106
- uri: localVarPath,
2107
- useQuerystring: this._useQuerystring,
2108
- agentOptions: { keepAlive: false },
2109
- json: true,
2110
- };
2111
- let authenticationPromise = Promise.resolve();
2112
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2113
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2114
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2115
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2116
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2117
- return authenticationPromise.then(() => {
2118
- if (Object.keys(localVarFormParams).length) {
2119
- if (localVarUseFormData) {
2120
- localVarRequestOptions.formData = localVarFormParams;
2121
- }
2122
- else {
2123
- localVarRequestOptions.form = localVarFormParams;
2124
- }
2321
+ headers: { ...localVarHeaderParams },
2322
+ };
2323
+ let requestOptions = localVarRequestOptions;
2324
+ let url = localVarUrl;
2325
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2326
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2327
+ url = auth_ApiKeyAuthentication.url;
2328
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2329
+ requestOptions = auth_JWTAuthentication.requestOptions;
2330
+ url = auth_JWTAuthentication.url;
2331
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2332
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2333
+ url = auth_JWTHttpHeaderAuthentication.url;
2334
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2335
+ requestOptions = auth_OAuth2.requestOptions;
2336
+ url = auth_OAuth2.url;
2337
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2338
+ requestOptions = authDefault.requestOptions;
2339
+ url = authDefault.url;
2340
+ if (localVarFormParams) {
2341
+ delete requestOptions.headers['Content-Type'];
2342
+ if (localVarFormParams instanceof FormData) {
2343
+ // FormData: fetch will handle Content-Type automatically.
2344
+ requestOptions.body = localVarFormParams;
2125
2345
  }
2126
- return new Promise((resolve, reject) => {
2127
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2128
- if (error) {
2129
- reject(error);
2130
- }
2131
- else {
2132
- body = models_1.ObjectSerializer.deserialize(body, "ListPublicOrganizationTransformationBlocksResponse");
2133
- if (typeof body.success === 'boolean' && !body.success) {
2134
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2135
- reject(new Error(body.error || errString));
2136
- }
2137
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2138
- resolve(body);
2139
- }
2140
- else {
2141
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2142
- reject(errString);
2143
- }
2144
- }
2145
- });
2146
- });
2147
- });
2346
+ else if (Object.keys(localVarFormParams).length > 0) {
2347
+ // URL-encoded form
2348
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2349
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2350
+ }
2351
+ }
2352
+ const response = await fetch(url, requestOptions);
2353
+ return this.handleResponse(response, 'ListPublicOrganizationTransformationBlocksResponse');
2148
2354
  }
2149
2355
  /**
2150
2356
  * Retry launch a dsp block.
@@ -2157,9 +2363,11 @@ class OrganizationBlocksApi {
2157
2363
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
2158
2364
  .replace('{' + 'dspId' + '}', encodeURIComponent(String(dspId)));
2159
2365
  let localVarQueryParameters = {};
2160
- let localVarHeaderParams = Object.assign({
2161
- 'User-Agent': 'edgeimpulse-api nodejs'
2162
- }, this.defaultHeaders);
2366
+ let localVarHeaderParams = {
2367
+ 'User-Agent': 'edgeimpulse-api nodejs',
2368
+ 'Content-Type': 'application/json',
2369
+ ...this.defaultHeaders,
2370
+ };
2163
2371
  const produces = ['application/json'];
2164
2372
  // give precedence to 'application/json'
2165
2373
  if (produces.indexOf('application/json') >= 0) {
@@ -2168,7 +2376,7 @@ class OrganizationBlocksApi {
2168
2376
  else {
2169
2377
  localVarHeaderParams.Accept = produces.join(',');
2170
2378
  }
2171
- let localVarFormParams = {};
2379
+ let localVarFormParams;
2172
2380
  // verify required parameter 'organizationId' is not null or undefined
2173
2381
  if (organizationId === null || organizationId === undefined) {
2174
2382
  throw new Error('Required parameter organizationId was null or undefined when calling retryOrganizationDspBlock.');
@@ -2177,55 +2385,51 @@ class OrganizationBlocksApi {
2177
2385
  if (dspId === null || dspId === undefined) {
2178
2386
  throw new Error('Required parameter dspId was null or undefined when calling retryOrganizationDspBlock.');
2179
2387
  }
2180
- Object.assign(localVarHeaderParams, options.headers);
2181
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2182
- let localVarUseFormData = false;
2388
+ localVarHeaderParams = {
2389
+ ...localVarHeaderParams,
2390
+ ...options.headers,
2391
+ ...this.opts.extraHeaders,
2392
+ };
2393
+ const queryString = Object.entries(localVarQueryParameters)
2394
+ .filter(([, value]) => value !== undefined)
2395
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2396
+ .join('&');
2397
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2183
2398
  let localVarRequestOptions = {
2184
2399
  method: 'POST',
2185
- qs: localVarQueryParameters,
2186
- headers: localVarHeaderParams,
2187
- uri: localVarPath,
2188
- useQuerystring: this._useQuerystring,
2189
- agentOptions: { keepAlive: false },
2190
- json: true,
2191
- };
2192
- let authenticationPromise = Promise.resolve();
2193
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2194
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2195
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2196
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2197
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2198
- return authenticationPromise.then(() => {
2199
- if (Object.keys(localVarFormParams).length) {
2200
- if (localVarUseFormData) {
2201
- localVarRequestOptions.formData = localVarFormParams;
2202
- }
2203
- else {
2204
- localVarRequestOptions.form = localVarFormParams;
2205
- }
2400
+ headers: { ...localVarHeaderParams },
2401
+ };
2402
+ let requestOptions = localVarRequestOptions;
2403
+ let url = localVarUrl;
2404
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2405
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2406
+ url = auth_ApiKeyAuthentication.url;
2407
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2408
+ requestOptions = auth_JWTAuthentication.requestOptions;
2409
+ url = auth_JWTAuthentication.url;
2410
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2411
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2412
+ url = auth_JWTHttpHeaderAuthentication.url;
2413
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2414
+ requestOptions = auth_OAuth2.requestOptions;
2415
+ url = auth_OAuth2.url;
2416
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2417
+ requestOptions = authDefault.requestOptions;
2418
+ url = authDefault.url;
2419
+ if (localVarFormParams) {
2420
+ delete requestOptions.headers['Content-Type'];
2421
+ if (localVarFormParams instanceof FormData) {
2422
+ // FormData: fetch will handle Content-Type automatically.
2423
+ requestOptions.body = localVarFormParams;
2206
2424
  }
2207
- return new Promise((resolve, reject) => {
2208
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2209
- if (error) {
2210
- reject(error);
2211
- }
2212
- else {
2213
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
2214
- if (typeof body.success === 'boolean' && !body.success) {
2215
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2216
- reject(new Error(body.error || errString));
2217
- }
2218
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2219
- resolve(body);
2220
- }
2221
- else {
2222
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2223
- reject(errString);
2224
- }
2225
- }
2226
- });
2227
- });
2228
- });
2425
+ else if (Object.keys(localVarFormParams).length > 0) {
2426
+ // URL-encoded form
2427
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2428
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2429
+ }
2430
+ }
2431
+ const response = await fetch(url, requestOptions);
2432
+ return this.handleResponse(response, 'GenericApiResponse');
2229
2433
  }
2230
2434
  /**
2231
2435
  * Updates a deploy block. Only values in the body will be updated.
@@ -2255,9 +2459,11 @@ class OrganizationBlocksApi {
2255
2459
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
2256
2460
  .replace('{' + 'deployId' + '}', encodeURIComponent(String(deployId)));
2257
2461
  let localVarQueryParameters = {};
2258
- let localVarHeaderParams = Object.assign({
2259
- 'User-Agent': 'edgeimpulse-api nodejs'
2260
- }, this.defaultHeaders);
2462
+ let localVarHeaderParams = {
2463
+ 'User-Agent': 'edgeimpulse-api nodejs',
2464
+ 'Content-Type': 'application/json',
2465
+ ...this.defaultHeaders,
2466
+ };
2261
2467
  const produces = ['application/json'];
2262
2468
  // give precedence to 'application/json'
2263
2469
  if (produces.indexOf('application/json') >= 0) {
@@ -2266,7 +2472,7 @@ class OrganizationBlocksApi {
2266
2472
  else {
2267
2473
  localVarHeaderParams.Accept = produces.join(',');
2268
2474
  }
2269
- let localVarFormParams = {};
2475
+ let localVarFormParams;
2270
2476
  // verify required parameter 'organizationId' is not null or undefined
2271
2477
  if (organizationId === null || organizationId === undefined) {
2272
2478
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationDeployBlock.');
@@ -2275,107 +2481,325 @@ class OrganizationBlocksApi {
2275
2481
  if (deployId === null || deployId === undefined) {
2276
2482
  throw new Error('Required parameter deployId was null or undefined when calling updateOrganizationDeployBlock.');
2277
2483
  }
2278
- Object.assign(localVarHeaderParams, options.headers);
2279
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2280
- let localVarUseFormData = false;
2484
+ localVarHeaderParams = {
2485
+ ...localVarHeaderParams,
2486
+ ...options.headers,
2487
+ ...this.opts.extraHeaders,
2488
+ };
2281
2489
  if (params.name !== undefined) {
2282
- localVarFormParams['name'] = models_1.ObjectSerializer.serializeFormData(params.name, "string");
2490
+ const isParametersField = "name" === "parameters";
2491
+ const serializableParams = isParametersField && params && ("parameters" in params);
2492
+ const nameSerialized = serializableParams
2493
+ ? JSON.stringify(params.parameters)
2494
+ : models_1.ObjectSerializer.serializeFormData(params.name, "string");
2495
+ if (localVarFormParams instanceof FormData) {
2496
+ localVarFormParams.append('name', nameSerialized);
2497
+ }
2498
+ else {
2499
+ if (!localVarFormParams) {
2500
+ localVarFormParams = {};
2501
+ }
2502
+ localVarFormParams['name'] = nameSerialized;
2503
+ }
2283
2504
  }
2284
2505
  if (params.dockerContainer !== undefined) {
2285
- localVarFormParams['dockerContainer'] = models_1.ObjectSerializer.serializeFormData(params.dockerContainer, "string");
2506
+ const isParametersField = "dockerContainer" === "parameters";
2507
+ const serializableParams = isParametersField && params && ("parameters" in params);
2508
+ const dockerContainerSerialized = serializableParams
2509
+ ? JSON.stringify(params.parameters)
2510
+ : models_1.ObjectSerializer.serializeFormData(params.dockerContainer, "string");
2511
+ if (localVarFormParams instanceof FormData) {
2512
+ localVarFormParams.append('dockerContainer', dockerContainerSerialized);
2513
+ }
2514
+ else {
2515
+ if (!localVarFormParams) {
2516
+ localVarFormParams = {};
2517
+ }
2518
+ localVarFormParams['dockerContainer'] = dockerContainerSerialized;
2519
+ }
2286
2520
  }
2287
2521
  if (params.description !== undefined) {
2288
- localVarFormParams['description'] = models_1.ObjectSerializer.serializeFormData(params.description, "string");
2522
+ const isParametersField = "description" === "parameters";
2523
+ const serializableParams = isParametersField && params && ("parameters" in params);
2524
+ const descriptionSerialized = serializableParams
2525
+ ? JSON.stringify(params.parameters)
2526
+ : models_1.ObjectSerializer.serializeFormData(params.description, "string");
2527
+ if (localVarFormParams instanceof FormData) {
2528
+ localVarFormParams.append('description', descriptionSerialized);
2529
+ }
2530
+ else {
2531
+ if (!localVarFormParams) {
2532
+ localVarFormParams = {};
2533
+ }
2534
+ localVarFormParams['description'] = descriptionSerialized;
2535
+ }
2289
2536
  }
2290
2537
  if (params.cliArguments !== undefined) {
2291
- localVarFormParams['cliArguments'] = models_1.ObjectSerializer.serializeFormData(params.cliArguments, "string");
2538
+ const isParametersField = "cliArguments" === "parameters";
2539
+ const serializableParams = isParametersField && params && ("parameters" in params);
2540
+ const cliArgumentsSerialized = serializableParams
2541
+ ? JSON.stringify(params.parameters)
2542
+ : models_1.ObjectSerializer.serializeFormData(params.cliArguments, "string");
2543
+ if (localVarFormParams instanceof FormData) {
2544
+ localVarFormParams.append('cliArguments', cliArgumentsSerialized);
2545
+ }
2546
+ else {
2547
+ if (!localVarFormParams) {
2548
+ localVarFormParams = {};
2549
+ }
2550
+ localVarFormParams['cliArguments'] = cliArgumentsSerialized;
2551
+ }
2292
2552
  }
2293
2553
  if (params.requestsCpu !== undefined) {
2294
- localVarFormParams['requestsCpu'] = models_1.ObjectSerializer.serializeFormData(params.requestsCpu, "number");
2554
+ const isParametersField = "requestsCpu" === "parameters";
2555
+ const serializableParams = isParametersField && params && ("parameters" in params);
2556
+ const requestsCpuSerialized = serializableParams
2557
+ ? JSON.stringify(params.parameters)
2558
+ : models_1.ObjectSerializer.serializeFormData(params.requestsCpu, "number");
2559
+ if (localVarFormParams instanceof FormData) {
2560
+ localVarFormParams.append('requestsCpu', requestsCpuSerialized);
2561
+ }
2562
+ else {
2563
+ if (!localVarFormParams) {
2564
+ localVarFormParams = {};
2565
+ }
2566
+ localVarFormParams['requestsCpu'] = requestsCpuSerialized;
2567
+ }
2295
2568
  }
2296
2569
  if (params.requestsMemory !== undefined) {
2297
- localVarFormParams['requestsMemory'] = models_1.ObjectSerializer.serializeFormData(params.requestsMemory, "number");
2570
+ const isParametersField = "requestsMemory" === "parameters";
2571
+ const serializableParams = isParametersField && params && ("parameters" in params);
2572
+ const requestsMemorySerialized = serializableParams
2573
+ ? JSON.stringify(params.parameters)
2574
+ : models_1.ObjectSerializer.serializeFormData(params.requestsMemory, "number");
2575
+ if (localVarFormParams instanceof FormData) {
2576
+ localVarFormParams.append('requestsMemory', requestsMemorySerialized);
2577
+ }
2578
+ else {
2579
+ if (!localVarFormParams) {
2580
+ localVarFormParams = {};
2581
+ }
2582
+ localVarFormParams['requestsMemory'] = requestsMemorySerialized;
2583
+ }
2298
2584
  }
2299
2585
  if (params.limitsCpu !== undefined) {
2300
- localVarFormParams['limitsCpu'] = models_1.ObjectSerializer.serializeFormData(params.limitsCpu, "number");
2586
+ const isParametersField = "limitsCpu" === "parameters";
2587
+ const serializableParams = isParametersField && params && ("parameters" in params);
2588
+ const limitsCpuSerialized = serializableParams
2589
+ ? JSON.stringify(params.parameters)
2590
+ : models_1.ObjectSerializer.serializeFormData(params.limitsCpu, "number");
2591
+ if (localVarFormParams instanceof FormData) {
2592
+ localVarFormParams.append('limitsCpu', limitsCpuSerialized);
2593
+ }
2594
+ else {
2595
+ if (!localVarFormParams) {
2596
+ localVarFormParams = {};
2597
+ }
2598
+ localVarFormParams['limitsCpu'] = limitsCpuSerialized;
2599
+ }
2301
2600
  }
2302
2601
  if (params.limitsMemory !== undefined) {
2303
- localVarFormParams['limitsMemory'] = models_1.ObjectSerializer.serializeFormData(params.limitsMemory, "number");
2602
+ const isParametersField = "limitsMemory" === "parameters";
2603
+ const serializableParams = isParametersField && params && ("parameters" in params);
2604
+ const limitsMemorySerialized = serializableParams
2605
+ ? JSON.stringify(params.parameters)
2606
+ : models_1.ObjectSerializer.serializeFormData(params.limitsMemory, "number");
2607
+ if (localVarFormParams instanceof FormData) {
2608
+ localVarFormParams.append('limitsMemory', limitsMemorySerialized);
2609
+ }
2610
+ else {
2611
+ if (!localVarFormParams) {
2612
+ localVarFormParams = {};
2613
+ }
2614
+ localVarFormParams['limitsMemory'] = limitsMemorySerialized;
2615
+ }
2304
2616
  }
2305
2617
  if (params.photo !== undefined) {
2306
- localVarFormParams['photo'] = params.photo;
2618
+ if (!(localVarFormParams instanceof FormData)) {
2619
+ const existingParams = localVarFormParams;
2620
+ localVarFormParams = new FormData();
2621
+ if (existingParams && typeof existingParams === 'object') {
2622
+ Object.keys(existingParams).forEach(key => {
2623
+ localVarFormParams.append(key, existingParams[key]);
2624
+ });
2625
+ }
2626
+ }
2627
+ const photoFiles = Array.isArray(params.photo) ? params.photo : [params.photo];
2628
+ const Blob = globalThis.Blob || require('buffer').Blob;
2629
+ photoFiles.forEach((f) => {
2630
+ localVarFormParams.append('photo', new Blob([f.value], {
2631
+ type: f.options.contentType
2632
+ }), f.options.filename);
2633
+ });
2307
2634
  }
2308
- localVarUseFormData = true;
2309
2635
  if (params.integrateUrl !== undefined) {
2310
- localVarFormParams['integrateUrl'] = models_1.ObjectSerializer.serializeFormData(params.integrateUrl, "string");
2636
+ const isParametersField = "integrateUrl" === "parameters";
2637
+ const serializableParams = isParametersField && params && ("parameters" in params);
2638
+ const integrateUrlSerialized = serializableParams
2639
+ ? JSON.stringify(params.parameters)
2640
+ : models_1.ObjectSerializer.serializeFormData(params.integrateUrl, "string");
2641
+ if (localVarFormParams instanceof FormData) {
2642
+ localVarFormParams.append('integrateUrl', integrateUrlSerialized);
2643
+ }
2644
+ else {
2645
+ if (!localVarFormParams) {
2646
+ localVarFormParams = {};
2647
+ }
2648
+ localVarFormParams['integrateUrl'] = integrateUrlSerialized;
2649
+ }
2311
2650
  }
2312
2651
  if (params.privileged !== undefined) {
2313
- localVarFormParams['privileged'] = models_1.ObjectSerializer.serializeFormData(params.privileged, "boolean");
2652
+ const isParametersField = "privileged" === "parameters";
2653
+ const serializableParams = isParametersField && params && ("parameters" in params);
2654
+ const privilegedSerialized = serializableParams
2655
+ ? JSON.stringify(params.parameters)
2656
+ : models_1.ObjectSerializer.serializeFormData(params.privileged, "boolean");
2657
+ if (localVarFormParams instanceof FormData) {
2658
+ localVarFormParams.append('privileged', privilegedSerialized);
2659
+ }
2660
+ else {
2661
+ if (!localVarFormParams) {
2662
+ localVarFormParams = {};
2663
+ }
2664
+ localVarFormParams['privileged'] = privilegedSerialized;
2665
+ }
2314
2666
  }
2315
2667
  if (params.mountLearnBlock !== undefined) {
2316
- localVarFormParams['mountLearnBlock'] = models_1.ObjectSerializer.serializeFormData(params.mountLearnBlock, "boolean");
2668
+ const isParametersField = "mountLearnBlock" === "parameters";
2669
+ const serializableParams = isParametersField && params && ("parameters" in params);
2670
+ const mountLearnBlockSerialized = serializableParams
2671
+ ? JSON.stringify(params.parameters)
2672
+ : models_1.ObjectSerializer.serializeFormData(params.mountLearnBlock, "boolean");
2673
+ if (localVarFormParams instanceof FormData) {
2674
+ localVarFormParams.append('mountLearnBlock', mountLearnBlockSerialized);
2675
+ }
2676
+ else {
2677
+ if (!localVarFormParams) {
2678
+ localVarFormParams = {};
2679
+ }
2680
+ localVarFormParams['mountLearnBlock'] = mountLearnBlockSerialized;
2681
+ }
2317
2682
  }
2318
2683
  if (params.supportsEonCompiler !== undefined) {
2319
- localVarFormParams['supportsEonCompiler'] = models_1.ObjectSerializer.serializeFormData(params.supportsEonCompiler, "boolean");
2684
+ const isParametersField = "supportsEonCompiler" === "parameters";
2685
+ const serializableParams = isParametersField && params && ("parameters" in params);
2686
+ const supportsEonCompilerSerialized = serializableParams
2687
+ ? JSON.stringify(params.parameters)
2688
+ : models_1.ObjectSerializer.serializeFormData(params.supportsEonCompiler, "boolean");
2689
+ if (localVarFormParams instanceof FormData) {
2690
+ localVarFormParams.append('supportsEonCompiler', supportsEonCompilerSerialized);
2691
+ }
2692
+ else {
2693
+ if (!localVarFormParams) {
2694
+ localVarFormParams = {};
2695
+ }
2696
+ localVarFormParams['supportsEonCompiler'] = supportsEonCompilerSerialized;
2697
+ }
2320
2698
  }
2321
2699
  if (params.showOptimizations !== undefined) {
2322
- localVarFormParams['showOptimizations'] = models_1.ObjectSerializer.serializeFormData(params.showOptimizations, "boolean");
2700
+ const isParametersField = "showOptimizations" === "parameters";
2701
+ const serializableParams = isParametersField && params && ("parameters" in params);
2702
+ const showOptimizationsSerialized = serializableParams
2703
+ ? JSON.stringify(params.parameters)
2704
+ : models_1.ObjectSerializer.serializeFormData(params.showOptimizations, "boolean");
2705
+ if (localVarFormParams instanceof FormData) {
2706
+ localVarFormParams.append('showOptimizations', showOptimizationsSerialized);
2707
+ }
2708
+ else {
2709
+ if (!localVarFormParams) {
2710
+ localVarFormParams = {};
2711
+ }
2712
+ localVarFormParams['showOptimizations'] = showOptimizationsSerialized;
2713
+ }
2323
2714
  }
2324
2715
  if (params.category !== undefined) {
2325
- localVarFormParams['category'] = models_1.ObjectSerializer.serializeFormData(params.category, "string");
2716
+ const isParametersField = "category" === "parameters";
2717
+ const serializableParams = isParametersField && params && ("parameters" in params);
2718
+ const categorySerialized = serializableParams
2719
+ ? JSON.stringify(params.parameters)
2720
+ : models_1.ObjectSerializer.serializeFormData(params.category, "string");
2721
+ if (localVarFormParams instanceof FormData) {
2722
+ localVarFormParams.append('category', categorySerialized);
2723
+ }
2724
+ else {
2725
+ if (!localVarFormParams) {
2726
+ localVarFormParams = {};
2727
+ }
2728
+ localVarFormParams['category'] = categorySerialized;
2729
+ }
2326
2730
  }
2327
2731
  if (params.sourceCodeDownloadStaffOnly !== undefined) {
2328
- localVarFormParams['sourceCodeDownloadStaffOnly'] = models_1.ObjectSerializer.serializeFormData(params.sourceCodeDownloadStaffOnly, "boolean");
2732
+ const isParametersField = "sourceCodeDownloadStaffOnly" === "parameters";
2733
+ const serializableParams = isParametersField && params && ("parameters" in params);
2734
+ const sourceCodeDownloadStaffOnlySerialized = serializableParams
2735
+ ? JSON.stringify(params.parameters)
2736
+ : models_1.ObjectSerializer.serializeFormData(params.sourceCodeDownloadStaffOnly, "boolean");
2737
+ if (localVarFormParams instanceof FormData) {
2738
+ localVarFormParams.append('sourceCodeDownloadStaffOnly', sourceCodeDownloadStaffOnlySerialized);
2739
+ }
2740
+ else {
2741
+ if (!localVarFormParams) {
2742
+ localVarFormParams = {};
2743
+ }
2744
+ localVarFormParams['sourceCodeDownloadStaffOnly'] = sourceCodeDownloadStaffOnlySerialized;
2745
+ }
2329
2746
  }
2330
2747
  if (params.parameters !== undefined) {
2331
- localVarFormParams['parameters'] = JSON.stringify(params.parameters);
2748
+ const isParametersField = "parameters" === "parameters";
2749
+ const serializableParams = isParametersField && params && ("parameters" in params);
2750
+ const parametersSerialized = serializableParams
2751
+ ? JSON.stringify(params.parameters)
2752
+ : models_1.ObjectSerializer.serializeFormData(params.parameters, "Array<object>");
2753
+ if (localVarFormParams instanceof FormData) {
2754
+ localVarFormParams.append('parameters', parametersSerialized);
2755
+ }
2756
+ else {
2757
+ if (!localVarFormParams) {
2758
+ localVarFormParams = {};
2759
+ }
2760
+ localVarFormParams['parameters'] = parametersSerialized;
2761
+ }
2332
2762
  }
2763
+ const queryString = Object.entries(localVarQueryParameters)
2764
+ .filter(([, value]) => value !== undefined)
2765
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2766
+ .join('&');
2767
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2333
2768
  let localVarRequestOptions = {
2334
2769
  method: 'POST',
2335
- qs: localVarQueryParameters,
2336
- headers: localVarHeaderParams,
2337
- uri: localVarPath,
2338
- useQuerystring: this._useQuerystring,
2339
- agentOptions: { keepAlive: false },
2340
- json: true,
2341
- };
2342
- let authenticationPromise = Promise.resolve();
2343
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2344
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2345
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2346
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2347
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2348
- return authenticationPromise.then(() => {
2349
- if (Object.keys(localVarFormParams).length) {
2350
- if (localVarUseFormData) {
2351
- localVarRequestOptions.formData = localVarFormParams;
2352
- }
2353
- else {
2354
- localVarRequestOptions.form = localVarFormParams;
2355
- }
2770
+ headers: { ...localVarHeaderParams },
2771
+ };
2772
+ let requestOptions = localVarRequestOptions;
2773
+ let url = localVarUrl;
2774
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2775
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2776
+ url = auth_ApiKeyAuthentication.url;
2777
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2778
+ requestOptions = auth_JWTAuthentication.requestOptions;
2779
+ url = auth_JWTAuthentication.url;
2780
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2781
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2782
+ url = auth_JWTHttpHeaderAuthentication.url;
2783
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2784
+ requestOptions = auth_OAuth2.requestOptions;
2785
+ url = auth_OAuth2.url;
2786
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2787
+ requestOptions = authDefault.requestOptions;
2788
+ url = authDefault.url;
2789
+ if (localVarFormParams) {
2790
+ delete requestOptions.headers['Content-Type'];
2791
+ if (localVarFormParams instanceof FormData) {
2792
+ // FormData: fetch will handle Content-Type automatically.
2793
+ requestOptions.body = localVarFormParams;
2356
2794
  }
2357
- return new Promise((resolve, reject) => {
2358
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2359
- if (error) {
2360
- reject(error);
2361
- }
2362
- else {
2363
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
2364
- if (typeof body.success === 'boolean' && !body.success) {
2365
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2366
- reject(new Error(body.error || errString));
2367
- }
2368
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2369
- resolve(body);
2370
- }
2371
- else {
2372
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2373
- reject(errString);
2374
- }
2375
- }
2376
- });
2377
- });
2378
- });
2795
+ else if (Object.keys(localVarFormParams).length > 0) {
2796
+ // URL-encoded form
2797
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2798
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2799
+ }
2800
+ }
2801
+ const response = await fetch(url, requestOptions);
2802
+ return this.handleResponse(response, 'GenericApiResponse');
2379
2803
  }
2380
2804
  /**
2381
2805
  * Updates a dsp block. Only values in the body will be updated.
@@ -2389,9 +2813,11 @@ class OrganizationBlocksApi {
2389
2813
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
2390
2814
  .replace('{' + 'dspId' + '}', encodeURIComponent(String(dspId)));
2391
2815
  let localVarQueryParameters = {};
2392
- let localVarHeaderParams = Object.assign({
2393
- 'User-Agent': 'edgeimpulse-api nodejs'
2394
- }, this.defaultHeaders);
2816
+ let localVarHeaderParams = {
2817
+ 'User-Agent': 'edgeimpulse-api nodejs',
2818
+ 'Content-Type': 'application/json',
2819
+ ...this.defaultHeaders,
2820
+ };
2395
2821
  const produces = ['application/json'];
2396
2822
  // give precedence to 'application/json'
2397
2823
  if (produces.indexOf('application/json') >= 0) {
@@ -2400,7 +2826,7 @@ class OrganizationBlocksApi {
2400
2826
  else {
2401
2827
  localVarHeaderParams.Accept = produces.join(',');
2402
2828
  }
2403
- let localVarFormParams = {};
2829
+ let localVarFormParams;
2404
2830
  // verify required parameter 'organizationId' is not null or undefined
2405
2831
  if (organizationId === null || organizationId === undefined) {
2406
2832
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationDspBlock.');
@@ -2413,56 +2839,52 @@ class OrganizationBlocksApi {
2413
2839
  if (updateOrganizationDspBlockRequest === null || updateOrganizationDspBlockRequest === undefined) {
2414
2840
  throw new Error('Required parameter updateOrganizationDspBlockRequest was null or undefined when calling updateOrganizationDspBlock.');
2415
2841
  }
2416
- Object.assign(localVarHeaderParams, options.headers);
2417
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2418
- let localVarUseFormData = false;
2842
+ localVarHeaderParams = {
2843
+ ...localVarHeaderParams,
2844
+ ...options.headers,
2845
+ ...this.opts.extraHeaders,
2846
+ };
2847
+ const queryString = Object.entries(localVarQueryParameters)
2848
+ .filter(([, value]) => value !== undefined)
2849
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2850
+ .join('&');
2851
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2419
2852
  let localVarRequestOptions = {
2420
2853
  method: 'POST',
2421
- qs: localVarQueryParameters,
2422
- headers: localVarHeaderParams,
2423
- uri: localVarPath,
2424
- useQuerystring: this._useQuerystring,
2425
- agentOptions: { keepAlive: false },
2426
- json: true,
2427
- body: models_1.ObjectSerializer.serialize(updateOrganizationDspBlockRequest, "UpdateOrganizationDspBlockRequest")
2428
- };
2429
- let authenticationPromise = Promise.resolve();
2430
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2431
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2432
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2433
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2434
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2435
- return authenticationPromise.then(() => {
2436
- if (Object.keys(localVarFormParams).length) {
2437
- if (localVarUseFormData) {
2438
- localVarRequestOptions.formData = localVarFormParams;
2439
- }
2440
- else {
2441
- localVarRequestOptions.form = localVarFormParams;
2442
- }
2854
+ headers: { ...localVarHeaderParams },
2855
+ };
2856
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateOrganizationDspBlockRequest, "UpdateOrganizationDspBlockRequest"));
2857
+ let requestOptions = localVarRequestOptions;
2858
+ let url = localVarUrl;
2859
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2860
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2861
+ url = auth_ApiKeyAuthentication.url;
2862
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2863
+ requestOptions = auth_JWTAuthentication.requestOptions;
2864
+ url = auth_JWTAuthentication.url;
2865
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2866
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2867
+ url = auth_JWTHttpHeaderAuthentication.url;
2868
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2869
+ requestOptions = auth_OAuth2.requestOptions;
2870
+ url = auth_OAuth2.url;
2871
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2872
+ requestOptions = authDefault.requestOptions;
2873
+ url = authDefault.url;
2874
+ if (localVarFormParams) {
2875
+ delete requestOptions.headers['Content-Type'];
2876
+ if (localVarFormParams instanceof FormData) {
2877
+ // FormData: fetch will handle Content-Type automatically.
2878
+ requestOptions.body = localVarFormParams;
2443
2879
  }
2444
- return new Promise((resolve, reject) => {
2445
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2446
- if (error) {
2447
- reject(error);
2448
- }
2449
- else {
2450
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
2451
- if (typeof body.success === 'boolean' && !body.success) {
2452
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2453
- reject(new Error(body.error || errString));
2454
- }
2455
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2456
- resolve(body);
2457
- }
2458
- else {
2459
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2460
- reject(errString);
2461
- }
2462
- }
2463
- });
2464
- });
2465
- });
2880
+ else if (Object.keys(localVarFormParams).length > 0) {
2881
+ // URL-encoded form
2882
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2883
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2884
+ }
2885
+ }
2886
+ const response = await fetch(url, requestOptions);
2887
+ return this.handleResponse(response, 'GenericApiResponse');
2466
2888
  }
2467
2889
  /**
2468
2890
  * Updates a transfer learning block. Only values in the body will be updated.
@@ -2476,9 +2898,11 @@ class OrganizationBlocksApi {
2476
2898
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
2477
2899
  .replace('{' + 'transferLearningId' + '}', encodeURIComponent(String(transferLearningId)));
2478
2900
  let localVarQueryParameters = {};
2479
- let localVarHeaderParams = Object.assign({
2480
- 'User-Agent': 'edgeimpulse-api nodejs'
2481
- }, this.defaultHeaders);
2901
+ let localVarHeaderParams = {
2902
+ 'User-Agent': 'edgeimpulse-api nodejs',
2903
+ 'Content-Type': 'application/json',
2904
+ ...this.defaultHeaders,
2905
+ };
2482
2906
  const produces = ['application/json'];
2483
2907
  // give precedence to 'application/json'
2484
2908
  if (produces.indexOf('application/json') >= 0) {
@@ -2487,7 +2911,7 @@ class OrganizationBlocksApi {
2487
2911
  else {
2488
2912
  localVarHeaderParams.Accept = produces.join(',');
2489
2913
  }
2490
- let localVarFormParams = {};
2914
+ let localVarFormParams;
2491
2915
  // verify required parameter 'organizationId' is not null or undefined
2492
2916
  if (organizationId === null || organizationId === undefined) {
2493
2917
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationTransferLearningBlock.');
@@ -2500,56 +2924,52 @@ class OrganizationBlocksApi {
2500
2924
  if (updateOrganizationTransferLearningBlockRequest === null || updateOrganizationTransferLearningBlockRequest === undefined) {
2501
2925
  throw new Error('Required parameter updateOrganizationTransferLearningBlockRequest was null or undefined when calling updateOrganizationTransferLearningBlock.');
2502
2926
  }
2503
- Object.assign(localVarHeaderParams, options.headers);
2504
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2505
- let localVarUseFormData = false;
2927
+ localVarHeaderParams = {
2928
+ ...localVarHeaderParams,
2929
+ ...options.headers,
2930
+ ...this.opts.extraHeaders,
2931
+ };
2932
+ const queryString = Object.entries(localVarQueryParameters)
2933
+ .filter(([, value]) => value !== undefined)
2934
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
2935
+ .join('&');
2936
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2506
2937
  let localVarRequestOptions = {
2507
2938
  method: 'POST',
2508
- qs: localVarQueryParameters,
2509
- headers: localVarHeaderParams,
2510
- uri: localVarPath,
2511
- useQuerystring: this._useQuerystring,
2512
- agentOptions: { keepAlive: false },
2513
- json: true,
2514
- body: models_1.ObjectSerializer.serialize(updateOrganizationTransferLearningBlockRequest, "UpdateOrganizationTransferLearningBlockRequest")
2515
- };
2516
- let authenticationPromise = Promise.resolve();
2517
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2518
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2519
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2520
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2521
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2522
- return authenticationPromise.then(() => {
2523
- if (Object.keys(localVarFormParams).length) {
2524
- if (localVarUseFormData) {
2525
- localVarRequestOptions.formData = localVarFormParams;
2526
- }
2527
- else {
2528
- localVarRequestOptions.form = localVarFormParams;
2529
- }
2939
+ headers: { ...localVarHeaderParams },
2940
+ };
2941
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateOrganizationTransferLearningBlockRequest, "UpdateOrganizationTransferLearningBlockRequest"));
2942
+ let requestOptions = localVarRequestOptions;
2943
+ let url = localVarUrl;
2944
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
2945
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
2946
+ url = auth_ApiKeyAuthentication.url;
2947
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
2948
+ requestOptions = auth_JWTAuthentication.requestOptions;
2949
+ url = auth_JWTAuthentication.url;
2950
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
2951
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
2952
+ url = auth_JWTHttpHeaderAuthentication.url;
2953
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
2954
+ requestOptions = auth_OAuth2.requestOptions;
2955
+ url = auth_OAuth2.url;
2956
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
2957
+ requestOptions = authDefault.requestOptions;
2958
+ url = authDefault.url;
2959
+ if (localVarFormParams) {
2960
+ delete requestOptions.headers['Content-Type'];
2961
+ if (localVarFormParams instanceof FormData) {
2962
+ // FormData: fetch will handle Content-Type automatically.
2963
+ requestOptions.body = localVarFormParams;
2530
2964
  }
2531
- return new Promise((resolve, reject) => {
2532
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2533
- if (error) {
2534
- reject(error);
2535
- }
2536
- else {
2537
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
2538
- if (typeof body.success === 'boolean' && !body.success) {
2539
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2540
- reject(new Error(body.error || errString));
2541
- }
2542
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2543
- resolve(body);
2544
- }
2545
- else {
2546
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2547
- reject(errString);
2548
- }
2549
- }
2550
- });
2551
- });
2552
- });
2965
+ else if (Object.keys(localVarFormParams).length > 0) {
2966
+ // URL-encoded form
2967
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
2968
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
2969
+ }
2970
+ }
2971
+ const response = await fetch(url, requestOptions);
2972
+ return this.handleResponse(response, 'GenericApiResponse');
2553
2973
  }
2554
2974
  /**
2555
2975
  * Updates a transformation block. Only values in the body will be updated.
@@ -2563,9 +2983,11 @@ class OrganizationBlocksApi {
2563
2983
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
2564
2984
  .replace('{' + 'transformationId' + '}', encodeURIComponent(String(transformationId)));
2565
2985
  let localVarQueryParameters = {};
2566
- let localVarHeaderParams = Object.assign({
2567
- 'User-Agent': 'edgeimpulse-api nodejs'
2568
- }, this.defaultHeaders);
2986
+ let localVarHeaderParams = {
2987
+ 'User-Agent': 'edgeimpulse-api nodejs',
2988
+ 'Content-Type': 'application/json',
2989
+ ...this.defaultHeaders,
2990
+ };
2569
2991
  const produces = ['application/json'];
2570
2992
  // give precedence to 'application/json'
2571
2993
  if (produces.indexOf('application/json') >= 0) {
@@ -2574,7 +2996,7 @@ class OrganizationBlocksApi {
2574
2996
  else {
2575
2997
  localVarHeaderParams.Accept = produces.join(',');
2576
2998
  }
2577
- let localVarFormParams = {};
2999
+ let localVarFormParams;
2578
3000
  // verify required parameter 'organizationId' is not null or undefined
2579
3001
  if (organizationId === null || organizationId === undefined) {
2580
3002
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationTransformationBlock.');
@@ -2587,56 +3009,52 @@ class OrganizationBlocksApi {
2587
3009
  if (updateOrganizationTransformationBlockRequest === null || updateOrganizationTransformationBlockRequest === undefined) {
2588
3010
  throw new Error('Required parameter updateOrganizationTransformationBlockRequest was null or undefined when calling updateOrganizationTransformationBlock.');
2589
3011
  }
2590
- Object.assign(localVarHeaderParams, options.headers);
2591
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
2592
- let localVarUseFormData = false;
3012
+ localVarHeaderParams = {
3013
+ ...localVarHeaderParams,
3014
+ ...options.headers,
3015
+ ...this.opts.extraHeaders,
3016
+ };
3017
+ const queryString = Object.entries(localVarQueryParameters)
3018
+ .filter(([, value]) => value !== undefined)
3019
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
3020
+ .join('&');
3021
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
2593
3022
  let localVarRequestOptions = {
2594
3023
  method: 'POST',
2595
- qs: localVarQueryParameters,
2596
- headers: localVarHeaderParams,
2597
- uri: localVarPath,
2598
- useQuerystring: this._useQuerystring,
2599
- agentOptions: { keepAlive: false },
2600
- json: true,
2601
- body: models_1.ObjectSerializer.serialize(updateOrganizationTransformationBlockRequest, "UpdateOrganizationTransformationBlockRequest")
2602
- };
2603
- let authenticationPromise = Promise.resolve();
2604
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
2605
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
2606
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
2607
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
2608
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
2609
- return authenticationPromise.then(() => {
2610
- if (Object.keys(localVarFormParams).length) {
2611
- if (localVarUseFormData) {
2612
- localVarRequestOptions.formData = localVarFormParams;
2613
- }
2614
- else {
2615
- localVarRequestOptions.form = localVarFormParams;
2616
- }
3024
+ headers: { ...localVarHeaderParams },
3025
+ };
3026
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateOrganizationTransformationBlockRequest, "UpdateOrganizationTransformationBlockRequest"));
3027
+ let requestOptions = localVarRequestOptions;
3028
+ let url = localVarUrl;
3029
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
3030
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
3031
+ url = auth_ApiKeyAuthentication.url;
3032
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
3033
+ requestOptions = auth_JWTAuthentication.requestOptions;
3034
+ url = auth_JWTAuthentication.url;
3035
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
3036
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
3037
+ url = auth_JWTHttpHeaderAuthentication.url;
3038
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
3039
+ requestOptions = auth_OAuth2.requestOptions;
3040
+ url = auth_OAuth2.url;
3041
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
3042
+ requestOptions = authDefault.requestOptions;
3043
+ url = authDefault.url;
3044
+ if (localVarFormParams) {
3045
+ delete requestOptions.headers['Content-Type'];
3046
+ if (localVarFormParams instanceof FormData) {
3047
+ // FormData: fetch will handle Content-Type automatically.
3048
+ requestOptions.body = localVarFormParams;
2617
3049
  }
2618
- return new Promise((resolve, reject) => {
2619
- localVarRequest(localVarRequestOptions, (error, response, body) => {
2620
- if (error) {
2621
- reject(error);
2622
- }
2623
- else {
2624
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
2625
- if (typeof body.success === 'boolean' && !body.success) {
2626
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2627
- reject(new Error(body.error || errString));
2628
- }
2629
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
2630
- resolve(body);
2631
- }
2632
- else {
2633
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
2634
- reject(errString);
2635
- }
2636
- }
2637
- });
2638
- });
2639
- });
3050
+ else if (Object.keys(localVarFormParams).length > 0) {
3051
+ // URL-encoded form
3052
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
3053
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
3054
+ }
3055
+ }
3056
+ const response = await fetch(url, requestOptions);
3057
+ return this.handleResponse(response, 'GenericApiResponse');
2640
3058
  }
2641
3059
  }
2642
3060
  exports.OrganizationBlocksApi = OrganizationBlocksApi;