edge-impulse-linux 1.18.3 → 1.20.1

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