edge-impulse-api 1.82.6 → 1.82.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/build/library/sdk/api/adminApi.d.ts +4 -6
  2. package/build/library/sdk/api/adminApi.js +4782 -4928
  3. package/build/library/sdk/api/adminApi.js.map +1 -1
  4. package/build/library/sdk/api/authApi.d.ts +4 -6
  5. package/build/library/sdk/api/authApi.js +88 -56
  6. package/build/library/sdk/api/authApi.js.map +1 -1
  7. package/build/library/sdk/api/cDNApi.d.ts +4 -6
  8. package/build/library/sdk/api/cDNApi.js +76 -53
  9. package/build/library/sdk/api/cDNApi.js.map +1 -1
  10. package/build/library/sdk/api/canaryApi.d.ts +4 -6
  11. package/build/library/sdk/api/canaryApi.js +79 -53
  12. package/build/library/sdk/api/canaryApi.js.map +1 -1
  13. package/build/library/sdk/api/classifyApi.d.ts +4 -6
  14. package/build/library/sdk/api/classifyApi.js +527 -499
  15. package/build/library/sdk/api/classifyApi.js.map +1 -1
  16. package/build/library/sdk/api/dSPApi.d.ts +4 -6
  17. package/build/library/sdk/api/dSPApi.js +938 -942
  18. package/build/library/sdk/api/dSPApi.js.map +1 -1
  19. package/build/library/sdk/api/deploymentApi.d.ts +4 -6
  20. package/build/library/sdk/api/deploymentApi.js +680 -603
  21. package/build/library/sdk/api/deploymentApi.js.map +1 -1
  22. package/build/library/sdk/api/devicesApi.d.ts +4 -6
  23. package/build/library/sdk/api/devicesApi.js +802 -800
  24. package/build/library/sdk/api/devicesApi.js.map +1 -1
  25. package/build/library/sdk/api/emailVerificationApi.d.ts +4 -6
  26. package/build/library/sdk/api/emailVerificationApi.js +184 -190
  27. package/build/library/sdk/api/emailVerificationApi.js.map +1 -1
  28. package/build/library/sdk/api/exportApi.d.ts +4 -6
  29. package/build/library/sdk/api/exportApi.js +88 -56
  30. package/build/library/sdk/api/exportApi.js.map +1 -1
  31. package/build/library/sdk/api/featureFlagsApi.d.ts +4 -6
  32. package/build/library/sdk/api/featureFlagsApi.js +76 -52
  33. package/build/library/sdk/api/featureFlagsApi.js.map +1 -1
  34. package/build/library/sdk/api/healthApi.d.ts +4 -6
  35. package/build/library/sdk/api/healthApi.js +111 -97
  36. package/build/library/sdk/api/healthApi.js.map +1 -1
  37. package/build/library/sdk/api/impulseApi.d.ts +4 -6
  38. package/build/library/sdk/api/impulseApi.js +942 -902
  39. package/build/library/sdk/api/impulseApi.js.map +1 -1
  40. package/build/library/sdk/api/integrationsApi.d.ts +4 -6
  41. package/build/library/sdk/api/integrationsApi.js +136 -106
  42. package/build/library/sdk/api/integrationsApi.js.map +1 -1
  43. package/build/library/sdk/api/jobsApi.d.ts +4 -6
  44. package/build/library/sdk/api/jobsApi.js +2270 -2326
  45. package/build/library/sdk/api/jobsApi.js.map +1 -1
  46. package/build/library/sdk/api/learnApi.d.ts +22 -6
  47. package/build/library/sdk/api/learnApi.js +1597 -1424
  48. package/build/library/sdk/api/learnApi.js.map +1 -1
  49. package/build/library/sdk/api/loginApi.d.ts +4 -6
  50. package/build/library/sdk/api/loginApi.js +112 -98
  51. package/build/library/sdk/api/loginApi.js.map +1 -1
  52. package/build/library/sdk/api/metricsApi.d.ts +4 -6
  53. package/build/library/sdk/api/metricsApi.js +148 -144
  54. package/build/library/sdk/api/metricsApi.js.map +1 -1
  55. package/build/library/sdk/api/optimizationApi.d.ts +4 -6
  56. package/build/library/sdk/api/optimizationApi.js +844 -844
  57. package/build/library/sdk/api/optimizationApi.js.map +1 -1
  58. package/build/library/sdk/api/organizationBlocksApi.d.ts +4 -6
  59. package/build/library/sdk/api/organizationBlocksApi.js +1968 -1550
  60. package/build/library/sdk/api/organizationBlocksApi.js.map +1 -1
  61. package/build/library/sdk/api/organizationCreateProjectApi.d.ts +4 -6
  62. package/build/library/sdk/api/organizationCreateProjectApi.js +700 -652
  63. package/build/library/sdk/api/organizationCreateProjectApi.js.map +1 -1
  64. package/build/library/sdk/api/organizationDataApi.d.ts +4 -6
  65. package/build/library/sdk/api/organizationDataApi.js +2074 -1985
  66. package/build/library/sdk/api/organizationDataApi.js.map +1 -1
  67. package/build/library/sdk/api/organizationDataCampaignsApi.d.ts +4 -6
  68. package/build/library/sdk/api/organizationDataCampaignsApi.js +626 -602
  69. package/build/library/sdk/api/organizationDataCampaignsApi.js.map +1 -1
  70. package/build/library/sdk/api/organizationJobsApi.d.ts +4 -6
  71. package/build/library/sdk/api/organizationJobsApi.js +417 -399
  72. package/build/library/sdk/api/organizationJobsApi.js.map +1 -1
  73. package/build/library/sdk/api/organizationPipelinesApi.d.ts +4 -6
  74. package/build/library/sdk/api/organizationPipelinesApi.js +419 -401
  75. package/build/library/sdk/api/organizationPipelinesApi.js.map +1 -1
  76. package/build/library/sdk/api/organizationPortalsApi.d.ts +4 -6
  77. package/build/library/sdk/api/organizationPortalsApi.js +372 -352
  78. package/build/library/sdk/api/organizationPortalsApi.js.map +1 -1
  79. package/build/library/sdk/api/organizationsApi.d.ts +4 -6
  80. package/build/library/sdk/api/organizationsApi.js +4024 -4050
  81. package/build/library/sdk/api/organizationsApi.js.map +1 -1
  82. package/build/library/sdk/api/performanceCalibrationApi.d.ts +4 -6
  83. package/build/library/sdk/api/performanceCalibrationApi.js +586 -560
  84. package/build/library/sdk/api/performanceCalibrationApi.js.map +1 -1
  85. package/build/library/sdk/api/postProcessingApi.d.ts +4 -6
  86. package/build/library/sdk/api/postProcessingApi.js +279 -255
  87. package/build/library/sdk/api/postProcessingApi.js.map +1 -1
  88. package/build/library/sdk/api/projectsApi.d.ts +4 -6
  89. package/build/library/sdk/api/projectsApi.js +2758 -2818
  90. package/build/library/sdk/api/projectsApi.js.map +1 -1
  91. package/build/library/sdk/api/rawDataApi.d.ts +4 -6
  92. package/build/library/sdk/api/rawDataApi.js +3055 -3131
  93. package/build/library/sdk/api/rawDataApi.js.map +1 -1
  94. package/build/library/sdk/api/testApi.d.ts +4 -6
  95. package/build/library/sdk/api/testApi.js +152 -108
  96. package/build/library/sdk/api/testApi.js.map +1 -1
  97. package/build/library/sdk/api/themesApi.d.ts +4 -6
  98. package/build/library/sdk/api/themesApi.js +341 -305
  99. package/build/library/sdk/api/themesApi.js.map +1 -1
  100. package/build/library/sdk/api/thirdPartyAuthApi.d.ts +4 -6
  101. package/build/library/sdk/api/thirdPartyAuthApi.js +387 -353
  102. package/build/library/sdk/api/thirdPartyAuthApi.js.map +1 -1
  103. package/build/library/sdk/api/uploadPortalApi.d.ts +4 -6
  104. package/build/library/sdk/api/uploadPortalApi.js +375 -355
  105. package/build/library/sdk/api/uploadPortalApi.js.map +1 -1
  106. package/build/library/sdk/api/userApi.d.ts +4 -6
  107. package/build/library/sdk/api/userApi.js +2345 -2452
  108. package/build/library/sdk/api/userApi.js.map +1 -1
  109. package/build/library/sdk/api/vlmApi.d.ts +4 -6
  110. package/build/library/sdk/api/vlmApi.js +277 -253
  111. package/build/library/sdk/api/vlmApi.js.map +1 -1
  112. package/build/library/sdk/api/whitelabelsApi.d.ts +4 -6
  113. package/build/library/sdk/api/whitelabelsApi.js +408 -398
  114. package/build/library/sdk/api/whitelabelsApi.js.map +1 -1
  115. package/build/library/sdk/model/deployPretrainedModelRequest.d.ts +4 -0
  116. package/build/library/sdk/model/deployPretrainedModelRequest.js +5 -0
  117. package/build/library/sdk/model/deployPretrainedModelRequest.js.map +1 -1
  118. package/build/library/sdk/model/models.d.ts +47 -7
  119. package/build/library/sdk/model/models.js +33 -22
  120. package/build/library/sdk/model/models.js.map +1 -1
  121. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.d.ts +47 -0
  122. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js +55 -0
  123. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js.map +1 -0
  124. package/build/library/sdk/model/uploadPretrainedModelRequest.d.ts +4 -0
  125. package/build/library/sdk/model/uploadPretrainedModelRequest.js +5 -0
  126. package/build/library/sdk/model/uploadPretrainedModelRequest.js.map +1 -1
  127. package/package.json +3 -2
@@ -12,14 +12,31 @@
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.DeploymentApi = exports.DeploymentApiApiKeys = 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 DeploymentApiApiKeys;
30
47
  DeploymentApiApiKeys[DeploymentApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
31
48
  })(DeploymentApiApiKeys = exports.DeploymentApiApiKeys || (exports.DeploymentApiApiKeys = {}));
32
49
  class DeploymentApi {
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 DeploymentApi {
54
91
  }
55
92
  this.opts = opts !== null && opts !== void 0 ? opts : {};
56
93
  }
57
- set useQuerystring(value) {
58
- this._useQuerystring = value;
59
- }
60
94
  set basePath(basePath) {
61
95
  this._basePath = basePath;
62
96
  }
@@ -91,9 +125,11 @@ class DeploymentApi {
91
125
  const localVarPath = this.basePath + '/api/{projectId}/deployment/download'
92
126
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
93
127
  let localVarQueryParameters = {};
94
- let localVarHeaderParams = Object.assign({
95
- 'User-Agent': 'edgeimpulse-api nodejs'
96
- }, this.defaultHeaders);
128
+ let localVarHeaderParams = {
129
+ 'User-Agent': 'edgeimpulse-api nodejs',
130
+ 'Content-Type': 'application/json',
131
+ ...this.defaultHeaders,
132
+ };
97
133
  const produces = ['application/zip'];
98
134
  // give precedence to 'application/json'
99
135
  if (produces.indexOf('application/json') >= 0) {
@@ -102,7 +138,7 @@ class DeploymentApi {
102
138
  else {
103
139
  localVarHeaderParams.Accept = produces.join(',');
104
140
  }
105
- let localVarFormParams = {};
141
+ let localVarFormParams;
106
142
  // verify required parameter 'projectId' is not null or undefined
107
143
  if (projectId === null || projectId === undefined) {
108
144
  throw new Error('Required parameter projectId was null or undefined when calling downloadBuild.');
@@ -123,55 +159,51 @@ class DeploymentApi {
123
159
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
124
160
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
125
161
  }
126
- Object.assign(localVarHeaderParams, options.headers);
127
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
128
- let localVarUseFormData = false;
162
+ localVarHeaderParams = {
163
+ ...localVarHeaderParams,
164
+ ...options.headers,
165
+ ...this.opts.extraHeaders,
166
+ };
167
+ const queryString = Object.entries(localVarQueryParameters)
168
+ .filter(([, value]) => value !== undefined)
169
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
170
+ .join('&');
171
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
129
172
  let localVarRequestOptions = {
130
173
  method: 'GET',
131
- qs: localVarQueryParameters,
132
- headers: localVarHeaderParams,
133
- uri: localVarPath,
134
- useQuerystring: this._useQuerystring,
135
- agentOptions: { keepAlive: false },
136
- encoding: null,
174
+ headers: { ...localVarHeaderParams },
137
175
  };
138
- let authenticationPromise = Promise.resolve();
139
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
140
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
141
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
142
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
143
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
144
- return authenticationPromise.then(() => {
145
- if (Object.keys(localVarFormParams).length) {
146
- if (localVarUseFormData) {
147
- localVarRequestOptions.formData = localVarFormParams;
148
- }
149
- else {
150
- localVarRequestOptions.form = localVarFormParams;
151
- }
176
+ let requestOptions = localVarRequestOptions;
177
+ let url = localVarUrl;
178
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
179
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
180
+ url = auth_ApiKeyAuthentication.url;
181
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
182
+ requestOptions = auth_JWTAuthentication.requestOptions;
183
+ url = auth_JWTAuthentication.url;
184
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
185
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
186
+ url = auth_JWTHttpHeaderAuthentication.url;
187
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
188
+ requestOptions = auth_OAuth2.requestOptions;
189
+ url = auth_OAuth2.url;
190
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
191
+ requestOptions = authDefault.requestOptions;
192
+ url = authDefault.url;
193
+ if (localVarFormParams) {
194
+ delete requestOptions.headers['Content-Type'];
195
+ if (localVarFormParams instanceof FormData) {
196
+ // FormData: fetch will handle Content-Type automatically.
197
+ requestOptions.body = localVarFormParams;
152
198
  }
153
- return new Promise((resolve, reject) => {
154
- localVarRequest(localVarRequestOptions, (error, response, body) => {
155
- if (error) {
156
- reject(error);
157
- }
158
- else {
159
- body = models_1.ObjectSerializer.deserialize(body, "Buffer");
160
- if (typeof body.success === 'boolean' && !body.success) {
161
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
162
- reject(new Error(body.error || errString));
163
- }
164
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
165
- resolve(body);
166
- }
167
- else {
168
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
169
- reject(errString);
170
- }
171
- }
172
- });
173
- });
174
- });
199
+ else if (Object.keys(localVarFormParams).length > 0) {
200
+ // URL-encoded form
201
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
202
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
203
+ }
204
+ }
205
+ const response = await fetch(url, requestOptions);
206
+ return this.handleResponse(response, 'Buffer');
175
207
  }
176
208
  /**
177
209
  * Automatically find the current posterior parameters for the Syntiant deployment target
@@ -188,9 +220,11 @@ class DeploymentApi {
188
220
  const localVarPath = this.basePath + '/api/{projectId}/jobs/find-syntiant-posterior'
189
221
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
190
222
  let localVarQueryParameters = {};
191
- let localVarHeaderParams = Object.assign({
192
- 'User-Agent': 'edgeimpulse-api nodejs'
193
- }, this.defaultHeaders);
223
+ let localVarHeaderParams = {
224
+ 'User-Agent': 'edgeimpulse-api nodejs',
225
+ 'Content-Type': 'application/json',
226
+ ...this.defaultHeaders,
227
+ };
194
228
  const produces = ['application/json'];
195
229
  // give precedence to 'application/json'
196
230
  if (produces.indexOf('application/json') >= 0) {
@@ -199,7 +233,7 @@ class DeploymentApi {
199
233
  else {
200
234
  localVarHeaderParams.Accept = produces.join(',');
201
235
  }
202
- let localVarFormParams = {};
236
+ let localVarFormParams;
203
237
  // verify required parameter 'projectId' is not null or undefined
204
238
  if (projectId === null || projectId === undefined) {
205
239
  throw new Error('Required parameter projectId was null or undefined when calling findSyntiantPosterior.');
@@ -215,72 +249,135 @@ class DeploymentApi {
215
249
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
216
250
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
217
251
  }
218
- Object.assign(localVarHeaderParams, options.headers);
219
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
220
- let localVarUseFormData = false;
252
+ localVarHeaderParams = {
253
+ ...localVarHeaderParams,
254
+ ...options.headers,
255
+ ...this.opts.extraHeaders,
256
+ };
221
257
  if (params.targetWords !== undefined) {
222
- localVarFormParams['targetWords'] = models_1.ObjectSerializer.serializeFormData(params.targetWords, "Array<string>");
258
+ const isParametersField = "targetWords" === "parameters";
259
+ const serializableParams = isParametersField && params && ("parameters" in params);
260
+ const targetWordsSerialized = serializableParams
261
+ ? JSON.stringify(params.parameters)
262
+ : models_1.ObjectSerializer.serializeFormData(params.targetWords, "Array<string>");
263
+ if (localVarFormParams instanceof FormData) {
264
+ localVarFormParams.append('targetWords', targetWordsSerialized);
265
+ }
266
+ else {
267
+ if (!localVarFormParams) {
268
+ localVarFormParams = {};
269
+ }
270
+ localVarFormParams['targetWords'] = targetWordsSerialized;
271
+ }
223
272
  }
224
273
  if (params.referenceSet !== undefined) {
225
- localVarFormParams['referenceSet'] = models_1.ObjectSerializer.serializeFormData(params.referenceSet, "string");
274
+ const isParametersField = "referenceSet" === "parameters";
275
+ const serializableParams = isParametersField && params && ("parameters" in params);
276
+ const referenceSetSerialized = serializableParams
277
+ ? JSON.stringify(params.parameters)
278
+ : models_1.ObjectSerializer.serializeFormData(params.referenceSet, "string");
279
+ if (localVarFormParams instanceof FormData) {
280
+ localVarFormParams.append('referenceSet', referenceSetSerialized);
281
+ }
282
+ else {
283
+ if (!localVarFormParams) {
284
+ localVarFormParams = {};
285
+ }
286
+ localVarFormParams['referenceSet'] = referenceSetSerialized;
287
+ }
226
288
  }
227
289
  if (params.wavFile !== undefined) {
228
- localVarFormParams['wavFile'] = params.wavFile;
290
+ if (!(localVarFormParams instanceof FormData)) {
291
+ const existingParams = localVarFormParams;
292
+ localVarFormParams = new FormData();
293
+ if (existingParams && typeof existingParams === 'object') {
294
+ Object.keys(existingParams).forEach(key => {
295
+ localVarFormParams.append(key, existingParams[key]);
296
+ });
297
+ }
298
+ }
299
+ const wavFileFiles = Array.isArray(params.wavFile) ? params.wavFile : [params.wavFile];
300
+ const Blob = globalThis.Blob || require('buffer').Blob;
301
+ wavFileFiles.forEach((f) => {
302
+ localVarFormParams.append('wavFile', new Blob([f.value], {
303
+ type: f.options.contentType
304
+ }), f.options.filename);
305
+ });
229
306
  }
230
- localVarUseFormData = true;
231
307
  if (params.metaCsvFile !== undefined) {
232
- localVarFormParams['metaCsvFile'] = params.metaCsvFile;
308
+ if (!(localVarFormParams instanceof FormData)) {
309
+ const existingParams = localVarFormParams;
310
+ localVarFormParams = new FormData();
311
+ if (existingParams && typeof existingParams === 'object') {
312
+ Object.keys(existingParams).forEach(key => {
313
+ localVarFormParams.append(key, existingParams[key]);
314
+ });
315
+ }
316
+ }
317
+ const metaCsvFileFiles = Array.isArray(params.metaCsvFile) ? params.metaCsvFile : [params.metaCsvFile];
318
+ const Blob = globalThis.Blob || require('buffer').Blob;
319
+ metaCsvFileFiles.forEach((f) => {
320
+ localVarFormParams.append('metaCsvFile', new Blob([f.value], {
321
+ type: f.options.contentType
322
+ }), f.options.filename);
323
+ });
233
324
  }
234
- localVarUseFormData = true;
235
325
  if (params.deploymentTarget !== undefined) {
236
- localVarFormParams['deploymentTarget'] = models_1.ObjectSerializer.serializeFormData(params.deploymentTarget, "string");
326
+ const isParametersField = "deploymentTarget" === "parameters";
327
+ const serializableParams = isParametersField && params && ("parameters" in params);
328
+ const deploymentTargetSerialized = serializableParams
329
+ ? JSON.stringify(params.parameters)
330
+ : models_1.ObjectSerializer.serializeFormData(params.deploymentTarget, "string");
331
+ if (localVarFormParams instanceof FormData) {
332
+ localVarFormParams.append('deploymentTarget', deploymentTargetSerialized);
333
+ }
334
+ else {
335
+ if (!localVarFormParams) {
336
+ localVarFormParams = {};
337
+ }
338
+ localVarFormParams['deploymentTarget'] = deploymentTargetSerialized;
339
+ }
237
340
  }
341
+ const queryString = Object.entries(localVarQueryParameters)
342
+ .filter(([, value]) => value !== undefined)
343
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
344
+ .join('&');
345
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
238
346
  let localVarRequestOptions = {
239
347
  method: 'POST',
240
- qs: localVarQueryParameters,
241
- headers: localVarHeaderParams,
242
- uri: localVarPath,
243
- useQuerystring: this._useQuerystring,
244
- agentOptions: { keepAlive: false },
245
- json: true,
348
+ headers: { ...localVarHeaderParams },
246
349
  };
247
- let authenticationPromise = Promise.resolve();
248
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
249
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
250
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
251
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
252
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
253
- return authenticationPromise.then(() => {
254
- if (Object.keys(localVarFormParams).length) {
255
- if (localVarUseFormData) {
256
- localVarRequestOptions.formData = localVarFormParams;
257
- }
258
- else {
259
- localVarRequestOptions.form = localVarFormParams;
260
- }
350
+ let requestOptions = localVarRequestOptions;
351
+ let url = localVarUrl;
352
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
353
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
354
+ url = auth_ApiKeyAuthentication.url;
355
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
356
+ requestOptions = auth_JWTAuthentication.requestOptions;
357
+ url = auth_JWTAuthentication.url;
358
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
359
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
360
+ url = auth_JWTHttpHeaderAuthentication.url;
361
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
362
+ requestOptions = auth_OAuth2.requestOptions;
363
+ url = auth_OAuth2.url;
364
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
365
+ requestOptions = authDefault.requestOptions;
366
+ url = authDefault.url;
367
+ if (localVarFormParams) {
368
+ delete requestOptions.headers['Content-Type'];
369
+ if (localVarFormParams instanceof FormData) {
370
+ // FormData: fetch will handle Content-Type automatically.
371
+ requestOptions.body = localVarFormParams;
261
372
  }
262
- return new Promise((resolve, reject) => {
263
- localVarRequest(localVarRequestOptions, (error, response, body) => {
264
- if (error) {
265
- reject(error);
266
- }
267
- else {
268
- body = models_1.ObjectSerializer.deserialize(body, "StartJobResponse");
269
- if (typeof body.success === 'boolean' && !body.success) {
270
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
271
- reject(new Error(body.error || errString));
272
- }
273
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
274
- resolve(body);
275
- }
276
- else {
277
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
278
- reject(errString);
279
- }
280
- }
281
- });
282
- });
283
- });
373
+ else if (Object.keys(localVarFormParams).length > 0) {
374
+ // URL-encoded form
375
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
376
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
377
+ }
378
+ }
379
+ const response = await fetch(url, requestOptions);
380
+ return this.handleResponse(response, 'StartJobResponse');
284
381
  }
285
382
  /**
286
383
  * Gives information on whether a deployment was already built for a type
@@ -295,9 +392,11 @@ class DeploymentApi {
295
392
  const localVarPath = this.basePath + '/api/{projectId}/deployment'
296
393
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
297
394
  let localVarQueryParameters = {};
298
- let localVarHeaderParams = Object.assign({
299
- 'User-Agent': 'edgeimpulse-api nodejs'
300
- }, this.defaultHeaders);
395
+ let localVarHeaderParams = {
396
+ 'User-Agent': 'edgeimpulse-api nodejs',
397
+ 'Content-Type': 'application/json',
398
+ ...this.defaultHeaders,
399
+ };
301
400
  const produces = ['application/json'];
302
401
  // give precedence to 'application/json'
303
402
  if (produces.indexOf('application/json') >= 0) {
@@ -306,7 +405,7 @@ class DeploymentApi {
306
405
  else {
307
406
  localVarHeaderParams.Accept = produces.join(',');
308
407
  }
309
- let localVarFormParams = {};
408
+ let localVarFormParams;
310
409
  // verify required parameter 'projectId' is not null or undefined
311
410
  if (projectId === null || projectId === undefined) {
312
411
  throw new Error('Required parameter projectId was null or undefined when calling getDeployment.');
@@ -327,55 +426,51 @@ class DeploymentApi {
327
426
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
328
427
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
329
428
  }
330
- Object.assign(localVarHeaderParams, options.headers);
331
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
332
- let localVarUseFormData = false;
429
+ localVarHeaderParams = {
430
+ ...localVarHeaderParams,
431
+ ...options.headers,
432
+ ...this.opts.extraHeaders,
433
+ };
434
+ const queryString = Object.entries(localVarQueryParameters)
435
+ .filter(([, value]) => value !== undefined)
436
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
437
+ .join('&');
438
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
333
439
  let localVarRequestOptions = {
334
440
  method: 'GET',
335
- qs: localVarQueryParameters,
336
- headers: localVarHeaderParams,
337
- uri: localVarPath,
338
- useQuerystring: this._useQuerystring,
339
- agentOptions: { keepAlive: false },
340
- json: true,
441
+ headers: { ...localVarHeaderParams },
341
442
  };
342
- let authenticationPromise = Promise.resolve();
343
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
344
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
345
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
346
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
347
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
348
- return authenticationPromise.then(() => {
349
- if (Object.keys(localVarFormParams).length) {
350
- if (localVarUseFormData) {
351
- localVarRequestOptions.formData = localVarFormParams;
352
- }
353
- else {
354
- localVarRequestOptions.form = localVarFormParams;
355
- }
443
+ let requestOptions = localVarRequestOptions;
444
+ let url = localVarUrl;
445
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
446
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
447
+ url = auth_ApiKeyAuthentication.url;
448
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
449
+ requestOptions = auth_JWTAuthentication.requestOptions;
450
+ url = auth_JWTAuthentication.url;
451
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
452
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
453
+ url = auth_JWTHttpHeaderAuthentication.url;
454
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
455
+ requestOptions = auth_OAuth2.requestOptions;
456
+ url = auth_OAuth2.url;
457
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
458
+ requestOptions = authDefault.requestOptions;
459
+ url = authDefault.url;
460
+ if (localVarFormParams) {
461
+ delete requestOptions.headers['Content-Type'];
462
+ if (localVarFormParams instanceof FormData) {
463
+ // FormData: fetch will handle Content-Type automatically.
464
+ requestOptions.body = localVarFormParams;
356
465
  }
357
- return new Promise((resolve, reject) => {
358
- localVarRequest(localVarRequestOptions, (error, response, body) => {
359
- if (error) {
360
- reject(error);
361
- }
362
- else {
363
- body = models_1.ObjectSerializer.deserialize(body, "GetDeploymentResponse");
364
- if (typeof body.success === 'boolean' && !body.success) {
365
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
366
- reject(new Error(body.error || errString));
367
- }
368
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
369
- resolve(body);
370
- }
371
- else {
372
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
373
- reject(errString);
374
- }
375
- }
376
- });
377
- });
378
- });
466
+ else if (Object.keys(localVarFormParams).length > 0) {
467
+ // URL-encoded form
468
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
469
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
470
+ }
471
+ }
472
+ const response = await fetch(url, requestOptions);
473
+ return this.handleResponse(response, 'GetDeploymentResponse');
379
474
  }
380
475
  /**
381
476
  * Get evaluate job result, containing detailed performance statistics for every possible variant of the impulse.
@@ -387,9 +482,11 @@ class DeploymentApi {
387
482
  const localVarPath = this.basePath + '/api/{projectId}/deployment/evaluate'
388
483
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
389
484
  let localVarQueryParameters = {};
390
- let localVarHeaderParams = Object.assign({
391
- 'User-Agent': 'edgeimpulse-api nodejs'
392
- }, this.defaultHeaders);
485
+ let localVarHeaderParams = {
486
+ 'User-Agent': 'edgeimpulse-api nodejs',
487
+ 'Content-Type': 'application/json',
488
+ ...this.defaultHeaders,
489
+ };
393
490
  const produces = ['application/json'];
394
491
  // give precedence to 'application/json'
395
492
  if (produces.indexOf('application/json') >= 0) {
@@ -398,7 +495,7 @@ class DeploymentApi {
398
495
  else {
399
496
  localVarHeaderParams.Accept = produces.join(',');
400
497
  }
401
- let localVarFormParams = {};
498
+ let localVarFormParams;
402
499
  // verify required parameter 'projectId' is not null or undefined
403
500
  if (projectId === null || projectId === undefined) {
404
501
  throw new Error('Required parameter projectId was null or undefined when calling getEvaluateJobResult.');
@@ -406,55 +503,51 @@ class DeploymentApi {
406
503
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
407
504
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
408
505
  }
409
- Object.assign(localVarHeaderParams, options.headers);
410
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
411
- let localVarUseFormData = false;
506
+ localVarHeaderParams = {
507
+ ...localVarHeaderParams,
508
+ ...options.headers,
509
+ ...this.opts.extraHeaders,
510
+ };
511
+ const queryString = Object.entries(localVarQueryParameters)
512
+ .filter(([, value]) => value !== undefined)
513
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
514
+ .join('&');
515
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
412
516
  let localVarRequestOptions = {
413
517
  method: 'GET',
414
- qs: localVarQueryParameters,
415
- headers: localVarHeaderParams,
416
- uri: localVarPath,
417
- useQuerystring: this._useQuerystring,
418
- agentOptions: { keepAlive: false },
419
- json: true,
518
+ headers: { ...localVarHeaderParams },
420
519
  };
421
- let authenticationPromise = Promise.resolve();
422
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
423
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
424
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
425
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
426
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
427
- return authenticationPromise.then(() => {
428
- if (Object.keys(localVarFormParams).length) {
429
- if (localVarUseFormData) {
430
- localVarRequestOptions.formData = localVarFormParams;
431
- }
432
- else {
433
- localVarRequestOptions.form = localVarFormParams;
434
- }
520
+ let requestOptions = localVarRequestOptions;
521
+ let url = localVarUrl;
522
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
523
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
524
+ url = auth_ApiKeyAuthentication.url;
525
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
526
+ requestOptions = auth_JWTAuthentication.requestOptions;
527
+ url = auth_JWTAuthentication.url;
528
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
529
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
530
+ url = auth_JWTHttpHeaderAuthentication.url;
531
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
532
+ requestOptions = auth_OAuth2.requestOptions;
533
+ url = auth_OAuth2.url;
534
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
535
+ requestOptions = authDefault.requestOptions;
536
+ url = authDefault.url;
537
+ if (localVarFormParams) {
538
+ delete requestOptions.headers['Content-Type'];
539
+ if (localVarFormParams instanceof FormData) {
540
+ // FormData: fetch will handle Content-Type automatically.
541
+ requestOptions.body = localVarFormParams;
435
542
  }
436
- return new Promise((resolve, reject) => {
437
- localVarRequest(localVarRequestOptions, (error, response, body) => {
438
- if (error) {
439
- reject(error);
440
- }
441
- else {
442
- body = models_1.ObjectSerializer.deserialize(body, "EvaluateJobResponse");
443
- if (typeof body.success === 'boolean' && !body.success) {
444
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
445
- reject(new Error(body.error || errString));
446
- }
447
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
448
- resolve(body);
449
- }
450
- else {
451
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
452
- reject(errString);
453
- }
454
- }
455
- });
456
- });
457
- });
543
+ else if (Object.keys(localVarFormParams).length > 0) {
544
+ // URL-encoded form
545
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
546
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
547
+ }
548
+ }
549
+ const response = await fetch(url, requestOptions);
550
+ return this.handleResponse(response, 'EvaluateJobResponse');
458
551
  }
459
552
  /**
460
553
  * Get evaluate job result, containing detailed performance statistics for every possible variant of the impulse. This only checks cache, and throws an error if there is no data in cache.
@@ -466,9 +559,11 @@ class DeploymentApi {
466
559
  const localVarPath = this.basePath + '/api/{projectId}/deployment/evaluate/cache'
467
560
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
468
561
  let localVarQueryParameters = {};
469
- let localVarHeaderParams = Object.assign({
470
- 'User-Agent': 'edgeimpulse-api nodejs'
471
- }, this.defaultHeaders);
562
+ let localVarHeaderParams = {
563
+ 'User-Agent': 'edgeimpulse-api nodejs',
564
+ 'Content-Type': 'application/json',
565
+ ...this.defaultHeaders,
566
+ };
472
567
  const produces = ['application/json'];
473
568
  // give precedence to 'application/json'
474
569
  if (produces.indexOf('application/json') >= 0) {
@@ -477,7 +572,7 @@ class DeploymentApi {
477
572
  else {
478
573
  localVarHeaderParams.Accept = produces.join(',');
479
574
  }
480
- let localVarFormParams = {};
575
+ let localVarFormParams;
481
576
  // verify required parameter 'projectId' is not null or undefined
482
577
  if (projectId === null || projectId === undefined) {
483
578
  throw new Error('Required parameter projectId was null or undefined when calling getEvaluateJobResultCache.');
@@ -485,55 +580,51 @@ class DeploymentApi {
485
580
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
486
581
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
487
582
  }
488
- Object.assign(localVarHeaderParams, options.headers);
489
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
490
- let localVarUseFormData = false;
583
+ localVarHeaderParams = {
584
+ ...localVarHeaderParams,
585
+ ...options.headers,
586
+ ...this.opts.extraHeaders,
587
+ };
588
+ const queryString = Object.entries(localVarQueryParameters)
589
+ .filter(([, value]) => value !== undefined)
590
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
591
+ .join('&');
592
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
491
593
  let localVarRequestOptions = {
492
594
  method: 'GET',
493
- qs: localVarQueryParameters,
494
- headers: localVarHeaderParams,
495
- uri: localVarPath,
496
- useQuerystring: this._useQuerystring,
497
- agentOptions: { keepAlive: false },
498
- json: true,
595
+ headers: { ...localVarHeaderParams },
499
596
  };
500
- let authenticationPromise = Promise.resolve();
501
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
502
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
503
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
504
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
505
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
506
- return authenticationPromise.then(() => {
507
- if (Object.keys(localVarFormParams).length) {
508
- if (localVarUseFormData) {
509
- localVarRequestOptions.formData = localVarFormParams;
510
- }
511
- else {
512
- localVarRequestOptions.form = localVarFormParams;
513
- }
597
+ let requestOptions = localVarRequestOptions;
598
+ let url = localVarUrl;
599
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
600
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
601
+ url = auth_ApiKeyAuthentication.url;
602
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
603
+ requestOptions = auth_JWTAuthentication.requestOptions;
604
+ url = auth_JWTAuthentication.url;
605
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
606
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
607
+ url = auth_JWTHttpHeaderAuthentication.url;
608
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
609
+ requestOptions = auth_OAuth2.requestOptions;
610
+ url = auth_OAuth2.url;
611
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
612
+ requestOptions = authDefault.requestOptions;
613
+ url = authDefault.url;
614
+ if (localVarFormParams) {
615
+ delete requestOptions.headers['Content-Type'];
616
+ if (localVarFormParams instanceof FormData) {
617
+ // FormData: fetch will handle Content-Type automatically.
618
+ requestOptions.body = localVarFormParams;
514
619
  }
515
- return new Promise((resolve, reject) => {
516
- localVarRequest(localVarRequestOptions, (error, response, body) => {
517
- if (error) {
518
- reject(error);
519
- }
520
- else {
521
- body = models_1.ObjectSerializer.deserialize(body, "EvaluateJobResponse");
522
- if (typeof body.success === 'boolean' && !body.success) {
523
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
524
- reject(new Error(body.error || errString));
525
- }
526
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
527
- resolve(body);
528
- }
529
- else {
530
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
531
- reject(errString);
532
- }
533
- }
534
- });
535
- });
536
- });
620
+ else if (Object.keys(localVarFormParams).length > 0) {
621
+ // URL-encoded form
622
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
623
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
624
+ }
625
+ }
626
+ const response = await fetch(url, requestOptions);
627
+ return this.handleResponse(response, 'EvaluateJobResponse');
537
628
  }
538
629
  /**
539
630
  * Get information on the result of the last successful deployment job, including info on the build e.g. whether it is still valid.
@@ -545,9 +636,11 @@ class DeploymentApi {
545
636
  const localVarPath = this.basePath + '/api/{projectId}/deployment/last'
546
637
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
547
638
  let localVarQueryParameters = {};
548
- let localVarHeaderParams = Object.assign({
549
- 'User-Agent': 'edgeimpulse-api nodejs'
550
- }, this.defaultHeaders);
639
+ let localVarHeaderParams = {
640
+ 'User-Agent': 'edgeimpulse-api nodejs',
641
+ 'Content-Type': 'application/json',
642
+ ...this.defaultHeaders,
643
+ };
551
644
  const produces = ['application/json'];
552
645
  // give precedence to 'application/json'
553
646
  if (produces.indexOf('application/json') >= 0) {
@@ -556,7 +649,7 @@ class DeploymentApi {
556
649
  else {
557
650
  localVarHeaderParams.Accept = produces.join(',');
558
651
  }
559
- let localVarFormParams = {};
652
+ let localVarFormParams;
560
653
  // verify required parameter 'projectId' is not null or undefined
561
654
  if (projectId === null || projectId === undefined) {
562
655
  throw new Error('Required parameter projectId was null or undefined when calling getLastDeploymentBuild.');
@@ -564,55 +657,51 @@ class DeploymentApi {
564
657
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
565
658
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
566
659
  }
567
- Object.assign(localVarHeaderParams, options.headers);
568
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
569
- let localVarUseFormData = false;
660
+ localVarHeaderParams = {
661
+ ...localVarHeaderParams,
662
+ ...options.headers,
663
+ ...this.opts.extraHeaders,
664
+ };
665
+ const queryString = Object.entries(localVarQueryParameters)
666
+ .filter(([, value]) => value !== undefined)
667
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
668
+ .join('&');
669
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
570
670
  let localVarRequestOptions = {
571
671
  method: 'GET',
572
- qs: localVarQueryParameters,
573
- headers: localVarHeaderParams,
574
- uri: localVarPath,
575
- useQuerystring: this._useQuerystring,
576
- agentOptions: { keepAlive: false },
577
- json: true,
672
+ headers: { ...localVarHeaderParams },
578
673
  };
579
- let authenticationPromise = Promise.resolve();
580
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
581
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
582
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
583
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
584
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
585
- return authenticationPromise.then(() => {
586
- if (Object.keys(localVarFormParams).length) {
587
- if (localVarUseFormData) {
588
- localVarRequestOptions.formData = localVarFormParams;
589
- }
590
- else {
591
- localVarRequestOptions.form = localVarFormParams;
592
- }
674
+ let requestOptions = localVarRequestOptions;
675
+ let url = localVarUrl;
676
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
677
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
678
+ url = auth_ApiKeyAuthentication.url;
679
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
680
+ requestOptions = auth_JWTAuthentication.requestOptions;
681
+ url = auth_JWTAuthentication.url;
682
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
683
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
684
+ url = auth_JWTHttpHeaderAuthentication.url;
685
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
686
+ requestOptions = auth_OAuth2.requestOptions;
687
+ url = auth_OAuth2.url;
688
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
689
+ requestOptions = authDefault.requestOptions;
690
+ url = authDefault.url;
691
+ if (localVarFormParams) {
692
+ delete requestOptions.headers['Content-Type'];
693
+ if (localVarFormParams instanceof FormData) {
694
+ // FormData: fetch will handle Content-Type automatically.
695
+ requestOptions.body = localVarFormParams;
593
696
  }
594
- return new Promise((resolve, reject) => {
595
- localVarRequest(localVarRequestOptions, (error, response, body) => {
596
- if (error) {
597
- reject(error);
598
- }
599
- else {
600
- body = models_1.ObjectSerializer.deserialize(body, "GetLastDeploymentBuildResponse");
601
- if (typeof body.success === 'boolean' && !body.success) {
602
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
603
- reject(new Error(body.error || errString));
604
- }
605
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
606
- resolve(body);
607
- }
608
- else {
609
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
610
- reject(errString);
611
- }
612
- }
613
- });
614
- });
615
- });
697
+ else if (Object.keys(localVarFormParams).length > 0) {
698
+ // URL-encoded form
699
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
700
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
701
+ }
702
+ }
703
+ const response = await fetch(url, requestOptions);
704
+ return this.handleResponse(response, 'GetLastDeploymentBuildResponse');
616
705
  }
617
706
  /**
618
707
  * Get a list of deployments that have previously ran (or are currently running) on-device. These deployments can be used by model monitoring. This is experimental and may change in the future.
@@ -624,9 +713,11 @@ class DeploymentApi {
624
713
  const localVarPath = this.basePath + '/api/{projectId}/deployment/monitoring'
625
714
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
626
715
  let localVarQueryParameters = {};
627
- let localVarHeaderParams = Object.assign({
628
- 'User-Agent': 'edgeimpulse-api nodejs'
629
- }, this.defaultHeaders);
716
+ let localVarHeaderParams = {
717
+ 'User-Agent': 'edgeimpulse-api nodejs',
718
+ 'Content-Type': 'application/json',
719
+ ...this.defaultHeaders,
720
+ };
630
721
  const produces = ['application/json'];
631
722
  // give precedence to 'application/json'
632
723
  if (produces.indexOf('application/json') >= 0) {
@@ -635,7 +726,7 @@ class DeploymentApi {
635
726
  else {
636
727
  localVarHeaderParams.Accept = produces.join(',');
637
728
  }
638
- let localVarFormParams = {};
729
+ let localVarFormParams;
639
730
  // verify required parameter 'projectId' is not null or undefined
640
731
  if (projectId === null || projectId === undefined) {
641
732
  throw new Error('Required parameter projectId was null or undefined when calling getModelMonitoringDeployments.');
@@ -643,55 +734,51 @@ class DeploymentApi {
643
734
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.startTimestamp) !== undefined) {
644
735
  localVarQueryParameters['startTimestamp'] = models_1.ObjectSerializer.serialize(queryParams.startTimestamp, "number");
645
736
  }
646
- Object.assign(localVarHeaderParams, options.headers);
647
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
648
- let localVarUseFormData = false;
737
+ localVarHeaderParams = {
738
+ ...localVarHeaderParams,
739
+ ...options.headers,
740
+ ...this.opts.extraHeaders,
741
+ };
742
+ const queryString = Object.entries(localVarQueryParameters)
743
+ .filter(([, value]) => value !== undefined)
744
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
745
+ .join('&');
746
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
649
747
  let localVarRequestOptions = {
650
748
  method: 'GET',
651
- qs: localVarQueryParameters,
652
- headers: localVarHeaderParams,
653
- uri: localVarPath,
654
- useQuerystring: this._useQuerystring,
655
- agentOptions: { keepAlive: false },
656
- json: true,
749
+ headers: { ...localVarHeaderParams },
657
750
  };
658
- let authenticationPromise = Promise.resolve();
659
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
660
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
661
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
662
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
663
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
664
- return authenticationPromise.then(() => {
665
- if (Object.keys(localVarFormParams).length) {
666
- if (localVarUseFormData) {
667
- localVarRequestOptions.formData = localVarFormParams;
668
- }
669
- else {
670
- localVarRequestOptions.form = localVarFormParams;
671
- }
751
+ let requestOptions = localVarRequestOptions;
752
+ let url = localVarUrl;
753
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
754
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
755
+ url = auth_ApiKeyAuthentication.url;
756
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
757
+ requestOptions = auth_JWTAuthentication.requestOptions;
758
+ url = auth_JWTAuthentication.url;
759
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
760
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
761
+ url = auth_JWTHttpHeaderAuthentication.url;
762
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
763
+ requestOptions = auth_OAuth2.requestOptions;
764
+ url = auth_OAuth2.url;
765
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
766
+ requestOptions = authDefault.requestOptions;
767
+ url = authDefault.url;
768
+ if (localVarFormParams) {
769
+ delete requestOptions.headers['Content-Type'];
770
+ if (localVarFormParams instanceof FormData) {
771
+ // FormData: fetch will handle Content-Type automatically.
772
+ requestOptions.body = localVarFormParams;
672
773
  }
673
- return new Promise((resolve, reject) => {
674
- localVarRequest(localVarRequestOptions, (error, response, body) => {
675
- if (error) {
676
- reject(error);
677
- }
678
- else {
679
- body = models_1.ObjectSerializer.deserialize(body, "GetModelMonitoringDeploymentsResponse");
680
- if (typeof body.success === 'boolean' && !body.success) {
681
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
682
- reject(new Error(body.error || errString));
683
- }
684
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
685
- resolve(body);
686
- }
687
- else {
688
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
689
- reject(errString);
690
- }
691
- }
692
- });
693
- });
694
- });
774
+ else if (Object.keys(localVarFormParams).length > 0) {
775
+ // URL-encoded form
776
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
777
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
778
+ }
779
+ }
780
+ const response = await fetch(url, requestOptions);
781
+ return this.handleResponse(response, 'GetModelMonitoringDeploymentsResponse');
695
782
  }
696
783
  /**
697
784
  * Get the current posterior parameters for the Syntiant deployment target
@@ -703,9 +790,11 @@ class DeploymentApi {
703
790
  const localVarPath = this.basePath + '/api/{projectId}/deployment/syntiant/posterior'
704
791
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
705
792
  let localVarQueryParameters = {};
706
- let localVarHeaderParams = Object.assign({
707
- 'User-Agent': 'edgeimpulse-api nodejs'
708
- }, this.defaultHeaders);
793
+ let localVarHeaderParams = {
794
+ 'User-Agent': 'edgeimpulse-api nodejs',
795
+ 'Content-Type': 'application/json',
796
+ ...this.defaultHeaders,
797
+ };
709
798
  const produces = ['application/json'];
710
799
  // give precedence to 'application/json'
711
800
  if (produces.indexOf('application/json') >= 0) {
@@ -714,7 +803,7 @@ class DeploymentApi {
714
803
  else {
715
804
  localVarHeaderParams.Accept = produces.join(',');
716
805
  }
717
- let localVarFormParams = {};
806
+ let localVarFormParams;
718
807
  // verify required parameter 'projectId' is not null or undefined
719
808
  if (projectId === null || projectId === undefined) {
720
809
  throw new Error('Required parameter projectId was null or undefined when calling getSyntiantPosterior.');
@@ -722,55 +811,51 @@ class DeploymentApi {
722
811
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
723
812
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
724
813
  }
725
- Object.assign(localVarHeaderParams, options.headers);
726
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
727
- let localVarUseFormData = false;
814
+ localVarHeaderParams = {
815
+ ...localVarHeaderParams,
816
+ ...options.headers,
817
+ ...this.opts.extraHeaders,
818
+ };
819
+ const queryString = Object.entries(localVarQueryParameters)
820
+ .filter(([, value]) => value !== undefined)
821
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
822
+ .join('&');
823
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
728
824
  let localVarRequestOptions = {
729
825
  method: 'GET',
730
- qs: localVarQueryParameters,
731
- headers: localVarHeaderParams,
732
- uri: localVarPath,
733
- useQuerystring: this._useQuerystring,
734
- agentOptions: { keepAlive: false },
735
- json: true,
826
+ headers: { ...localVarHeaderParams },
736
827
  };
737
- let authenticationPromise = Promise.resolve();
738
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
739
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
740
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
741
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
742
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
743
- return authenticationPromise.then(() => {
744
- if (Object.keys(localVarFormParams).length) {
745
- if (localVarUseFormData) {
746
- localVarRequestOptions.formData = localVarFormParams;
747
- }
748
- else {
749
- localVarRequestOptions.form = localVarFormParams;
750
- }
828
+ let requestOptions = localVarRequestOptions;
829
+ let url = localVarUrl;
830
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
831
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
832
+ url = auth_ApiKeyAuthentication.url;
833
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
834
+ requestOptions = auth_JWTAuthentication.requestOptions;
835
+ url = auth_JWTAuthentication.url;
836
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
837
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
838
+ url = auth_JWTHttpHeaderAuthentication.url;
839
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
840
+ requestOptions = auth_OAuth2.requestOptions;
841
+ url = auth_OAuth2.url;
842
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
843
+ requestOptions = authDefault.requestOptions;
844
+ url = authDefault.url;
845
+ if (localVarFormParams) {
846
+ delete requestOptions.headers['Content-Type'];
847
+ if (localVarFormParams instanceof FormData) {
848
+ // FormData: fetch will handle Content-Type automatically.
849
+ requestOptions.body = localVarFormParams;
751
850
  }
752
- return new Promise((resolve, reject) => {
753
- localVarRequest(localVarRequestOptions, (error, response, body) => {
754
- if (error) {
755
- reject(error);
756
- }
757
- else {
758
- body = models_1.ObjectSerializer.deserialize(body, "GetSyntiantPosteriorResponse");
759
- if (typeof body.success === 'boolean' && !body.success) {
760
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
761
- reject(new Error(body.error || errString));
762
- }
763
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
764
- resolve(body);
765
- }
766
- else {
767
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
768
- reject(errString);
769
- }
770
- }
771
- });
772
- });
773
- });
851
+ else if (Object.keys(localVarFormParams).length > 0) {
852
+ // URL-encoded form
853
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
854
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
855
+ }
856
+ }
857
+ const response = await fetch(url, requestOptions);
858
+ return this.handleResponse(response, 'GetSyntiantPosteriorResponse');
774
859
  }
775
860
  /**
776
861
  * List all deployment targets
@@ -779,9 +864,11 @@ class DeploymentApi {
779
864
  async listAllDeploymentTargets(options = { headers: {} }) {
780
865
  const localVarPath = this.basePath + '/api/deployment/targets';
781
866
  let localVarQueryParameters = {};
782
- let localVarHeaderParams = Object.assign({
783
- 'User-Agent': 'edgeimpulse-api nodejs'
784
- }, this.defaultHeaders);
867
+ let localVarHeaderParams = {
868
+ 'User-Agent': 'edgeimpulse-api nodejs',
869
+ 'Content-Type': 'application/json',
870
+ ...this.defaultHeaders,
871
+ };
785
872
  const produces = ['application/json'];
786
873
  // give precedence to 'application/json'
787
874
  if (produces.indexOf('application/json') >= 0) {
@@ -790,56 +877,52 @@ class DeploymentApi {
790
877
  else {
791
878
  localVarHeaderParams.Accept = produces.join(',');
792
879
  }
793
- let localVarFormParams = {};
794
- Object.assign(localVarHeaderParams, options.headers);
795
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
796
- let localVarUseFormData = false;
880
+ let localVarFormParams;
881
+ localVarHeaderParams = {
882
+ ...localVarHeaderParams,
883
+ ...options.headers,
884
+ ...this.opts.extraHeaders,
885
+ };
886
+ const queryString = Object.entries(localVarQueryParameters)
887
+ .filter(([, value]) => value !== undefined)
888
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
889
+ .join('&');
890
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
797
891
  let localVarRequestOptions = {
798
892
  method: 'GET',
799
- qs: localVarQueryParameters,
800
- headers: localVarHeaderParams,
801
- uri: localVarPath,
802
- useQuerystring: this._useQuerystring,
803
- agentOptions: { keepAlive: false },
804
- json: true,
893
+ headers: { ...localVarHeaderParams },
805
894
  };
806
- let authenticationPromise = Promise.resolve();
807
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
808
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
809
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
810
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
811
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
812
- return authenticationPromise.then(() => {
813
- if (Object.keys(localVarFormParams).length) {
814
- if (localVarUseFormData) {
815
- localVarRequestOptions.formData = localVarFormParams;
816
- }
817
- else {
818
- localVarRequestOptions.form = localVarFormParams;
819
- }
895
+ let requestOptions = localVarRequestOptions;
896
+ let url = localVarUrl;
897
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
898
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
899
+ url = auth_ApiKeyAuthentication.url;
900
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
901
+ requestOptions = auth_JWTAuthentication.requestOptions;
902
+ url = auth_JWTAuthentication.url;
903
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
904
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
905
+ url = auth_JWTHttpHeaderAuthentication.url;
906
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
907
+ requestOptions = auth_OAuth2.requestOptions;
908
+ url = auth_OAuth2.url;
909
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
910
+ requestOptions = authDefault.requestOptions;
911
+ url = authDefault.url;
912
+ if (localVarFormParams) {
913
+ delete requestOptions.headers['Content-Type'];
914
+ if (localVarFormParams instanceof FormData) {
915
+ // FormData: fetch will handle Content-Type automatically.
916
+ requestOptions.body = localVarFormParams;
820
917
  }
821
- return new Promise((resolve, reject) => {
822
- localVarRequest(localVarRequestOptions, (error, response, body) => {
823
- if (error) {
824
- reject(error);
825
- }
826
- else {
827
- body = models_1.ObjectSerializer.deserialize(body, "DeploymentTargetsResponse");
828
- if (typeof body.success === 'boolean' && !body.success) {
829
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
830
- reject(new Error(body.error || errString));
831
- }
832
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
833
- resolve(body);
834
- }
835
- else {
836
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
837
- reject(errString);
838
- }
839
- }
840
- });
841
- });
842
- });
918
+ else if (Object.keys(localVarFormParams).length > 0) {
919
+ // URL-encoded form
920
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
921
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
922
+ }
923
+ }
924
+ const response = await fetch(url, requestOptions);
925
+ return this.handleResponse(response, 'DeploymentTargetsResponse');
843
926
  }
844
927
  /**
845
928
  * List deployment targets for a project
@@ -851,9 +934,11 @@ class DeploymentApi {
851
934
  const localVarPath = this.basePath + '/api/{projectId}/deployment/targets'
852
935
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
853
936
  let localVarQueryParameters = {};
854
- let localVarHeaderParams = Object.assign({
855
- 'User-Agent': 'edgeimpulse-api nodejs'
856
- }, this.defaultHeaders);
937
+ let localVarHeaderParams = {
938
+ 'User-Agent': 'edgeimpulse-api nodejs',
939
+ 'Content-Type': 'application/json',
940
+ ...this.defaultHeaders,
941
+ };
857
942
  const produces = ['application/json'];
858
943
  // give precedence to 'application/json'
859
944
  if (produces.indexOf('application/json') >= 0) {
@@ -862,7 +947,7 @@ class DeploymentApi {
862
947
  else {
863
948
  localVarHeaderParams.Accept = produces.join(',');
864
949
  }
865
- let localVarFormParams = {};
950
+ let localVarFormParams;
866
951
  // verify required parameter 'projectId' is not null or undefined
867
952
  if (projectId === null || projectId === undefined) {
868
953
  throw new Error('Required parameter projectId was null or undefined when calling listDeploymentTargetsForProject.');
@@ -870,55 +955,51 @@ class DeploymentApi {
870
955
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
871
956
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
872
957
  }
873
- Object.assign(localVarHeaderParams, options.headers);
874
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
875
- let localVarUseFormData = false;
958
+ localVarHeaderParams = {
959
+ ...localVarHeaderParams,
960
+ ...options.headers,
961
+ ...this.opts.extraHeaders,
962
+ };
963
+ const queryString = Object.entries(localVarQueryParameters)
964
+ .filter(([, value]) => value !== undefined)
965
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
966
+ .join('&');
967
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
876
968
  let localVarRequestOptions = {
877
969
  method: 'GET',
878
- qs: localVarQueryParameters,
879
- headers: localVarHeaderParams,
880
- uri: localVarPath,
881
- useQuerystring: this._useQuerystring,
882
- agentOptions: { keepAlive: false },
883
- json: true,
970
+ headers: { ...localVarHeaderParams },
884
971
  };
885
- let authenticationPromise = Promise.resolve();
886
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
887
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
888
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
889
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
890
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
891
- return authenticationPromise.then(() => {
892
- if (Object.keys(localVarFormParams).length) {
893
- if (localVarUseFormData) {
894
- localVarRequestOptions.formData = localVarFormParams;
895
- }
896
- else {
897
- localVarRequestOptions.form = localVarFormParams;
898
- }
972
+ let requestOptions = localVarRequestOptions;
973
+ let url = localVarUrl;
974
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
975
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
976
+ url = auth_ApiKeyAuthentication.url;
977
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
978
+ requestOptions = auth_JWTAuthentication.requestOptions;
979
+ url = auth_JWTAuthentication.url;
980
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
981
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
982
+ url = auth_JWTHttpHeaderAuthentication.url;
983
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
984
+ requestOptions = auth_OAuth2.requestOptions;
985
+ url = auth_OAuth2.url;
986
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
987
+ requestOptions = authDefault.requestOptions;
988
+ url = authDefault.url;
989
+ if (localVarFormParams) {
990
+ delete requestOptions.headers['Content-Type'];
991
+ if (localVarFormParams instanceof FormData) {
992
+ // FormData: fetch will handle Content-Type automatically.
993
+ requestOptions.body = localVarFormParams;
899
994
  }
900
- return new Promise((resolve, reject) => {
901
- localVarRequest(localVarRequestOptions, (error, response, body) => {
902
- if (error) {
903
- reject(error);
904
- }
905
- else {
906
- body = models_1.ObjectSerializer.deserialize(body, "ProjectDeploymentTargetsResponse");
907
- if (typeof body.success === 'boolean' && !body.success) {
908
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
909
- reject(new Error(body.error || errString));
910
- }
911
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
912
- resolve(body);
913
- }
914
- else {
915
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
916
- reject(errString);
917
- }
918
- }
919
- });
920
- });
921
- });
995
+ else if (Object.keys(localVarFormParams).length > 0) {
996
+ // URL-encoded form
997
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
998
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
999
+ }
1000
+ }
1001
+ const response = await fetch(url, requestOptions);
1002
+ return this.handleResponse(response, 'ProjectDeploymentTargetsResponse');
922
1003
  }
923
1004
  /**
924
1005
  * List deployment targets for a project from data sources page (it shows some things like all Linux deploys, and hides \'fake\' deploy targets like mobile phone / computer)
@@ -930,9 +1011,11 @@ class DeploymentApi {
930
1011
  const localVarPath = this.basePath + '/api/{projectId}/deployment/targets/data-sources'
931
1012
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
932
1013
  let localVarQueryParameters = {};
933
- let localVarHeaderParams = Object.assign({
934
- 'User-Agent': 'edgeimpulse-api nodejs'
935
- }, this.defaultHeaders);
1014
+ let localVarHeaderParams = {
1015
+ 'User-Agent': 'edgeimpulse-api nodejs',
1016
+ 'Content-Type': 'application/json',
1017
+ ...this.defaultHeaders,
1018
+ };
936
1019
  const produces = ['application/json'];
937
1020
  // give precedence to 'application/json'
938
1021
  if (produces.indexOf('application/json') >= 0) {
@@ -941,7 +1024,7 @@ class DeploymentApi {
941
1024
  else {
942
1025
  localVarHeaderParams.Accept = produces.join(',');
943
1026
  }
944
- let localVarFormParams = {};
1027
+ let localVarFormParams;
945
1028
  // verify required parameter 'projectId' is not null or undefined
946
1029
  if (projectId === null || projectId === undefined) {
947
1030
  throw new Error('Required parameter projectId was null or undefined when calling listDeploymentTargetsForProjectDataSources.');
@@ -949,55 +1032,51 @@ class DeploymentApi {
949
1032
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
950
1033
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
951
1034
  }
952
- Object.assign(localVarHeaderParams, options.headers);
953
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
954
- let localVarUseFormData = false;
1035
+ localVarHeaderParams = {
1036
+ ...localVarHeaderParams,
1037
+ ...options.headers,
1038
+ ...this.opts.extraHeaders,
1039
+ };
1040
+ const queryString = Object.entries(localVarQueryParameters)
1041
+ .filter(([, value]) => value !== undefined)
1042
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1043
+ .join('&');
1044
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
955
1045
  let localVarRequestOptions = {
956
1046
  method: 'GET',
957
- qs: localVarQueryParameters,
958
- headers: localVarHeaderParams,
959
- uri: localVarPath,
960
- useQuerystring: this._useQuerystring,
961
- agentOptions: { keepAlive: false },
962
- json: true,
1047
+ headers: { ...localVarHeaderParams },
963
1048
  };
964
- let authenticationPromise = Promise.resolve();
965
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
966
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
967
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
968
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
969
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
970
- return authenticationPromise.then(() => {
971
- if (Object.keys(localVarFormParams).length) {
972
- if (localVarUseFormData) {
973
- localVarRequestOptions.formData = localVarFormParams;
974
- }
975
- else {
976
- localVarRequestOptions.form = localVarFormParams;
977
- }
1049
+ let requestOptions = localVarRequestOptions;
1050
+ let url = localVarUrl;
1051
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1052
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1053
+ url = auth_ApiKeyAuthentication.url;
1054
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1055
+ requestOptions = auth_JWTAuthentication.requestOptions;
1056
+ url = auth_JWTAuthentication.url;
1057
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1058
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1059
+ url = auth_JWTHttpHeaderAuthentication.url;
1060
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1061
+ requestOptions = auth_OAuth2.requestOptions;
1062
+ url = auth_OAuth2.url;
1063
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1064
+ requestOptions = authDefault.requestOptions;
1065
+ url = authDefault.url;
1066
+ if (localVarFormParams) {
1067
+ delete requestOptions.headers['Content-Type'];
1068
+ if (localVarFormParams instanceof FormData) {
1069
+ // FormData: fetch will handle Content-Type automatically.
1070
+ requestOptions.body = localVarFormParams;
978
1071
  }
979
- return new Promise((resolve, reject) => {
980
- localVarRequest(localVarRequestOptions, (error, response, body) => {
981
- if (error) {
982
- reject(error);
983
- }
984
- else {
985
- body = models_1.ObjectSerializer.deserialize(body, "DeploymentTargetsResponse");
986
- if (typeof body.success === 'boolean' && !body.success) {
987
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
988
- reject(new Error(body.error || errString));
989
- }
990
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
991
- resolve(body);
992
- }
993
- else {
994
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
995
- reject(errString);
996
- }
997
- }
998
- });
999
- });
1000
- });
1072
+ else if (Object.keys(localVarFormParams).length > 0) {
1073
+ // URL-encoded form
1074
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1075
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1076
+ }
1077
+ }
1078
+ const response = await fetch(url, requestOptions);
1079
+ return this.handleResponse(response, 'DeploymentTargetsResponse');
1001
1080
  }
1002
1081
  /**
1003
1082
  * Set the current posterior parameters for the Syntiant deployment target
@@ -1010,9 +1089,11 @@ class DeploymentApi {
1010
1089
  const localVarPath = this.basePath + '/api/{projectId}/deployment/syntiant/posterior'
1011
1090
  .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
1012
1091
  let localVarQueryParameters = {};
1013
- let localVarHeaderParams = Object.assign({
1014
- 'User-Agent': 'edgeimpulse-api nodejs'
1015
- }, this.defaultHeaders);
1092
+ let localVarHeaderParams = {
1093
+ 'User-Agent': 'edgeimpulse-api nodejs',
1094
+ 'Content-Type': 'application/json',
1095
+ ...this.defaultHeaders,
1096
+ };
1016
1097
  const produces = ['application/json'];
1017
1098
  // give precedence to 'application/json'
1018
1099
  if (produces.indexOf('application/json') >= 0) {
@@ -1021,7 +1102,7 @@ class DeploymentApi {
1021
1102
  else {
1022
1103
  localVarHeaderParams.Accept = produces.join(',');
1023
1104
  }
1024
- let localVarFormParams = {};
1105
+ let localVarFormParams;
1025
1106
  // verify required parameter 'projectId' is not null or undefined
1026
1107
  if (projectId === null || projectId === undefined) {
1027
1108
  throw new Error('Required parameter projectId was null or undefined when calling setSyntiantPosterior.');
@@ -1033,56 +1114,52 @@ class DeploymentApi {
1033
1114
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
1034
1115
  localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
1035
1116
  }
1036
- Object.assign(localVarHeaderParams, options.headers);
1037
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1038
- let localVarUseFormData = false;
1117
+ localVarHeaderParams = {
1118
+ ...localVarHeaderParams,
1119
+ ...options.headers,
1120
+ ...this.opts.extraHeaders,
1121
+ };
1122
+ const queryString = Object.entries(localVarQueryParameters)
1123
+ .filter(([, value]) => value !== undefined)
1124
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1125
+ .join('&');
1126
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1039
1127
  let localVarRequestOptions = {
1040
1128
  method: 'POST',
1041
- qs: localVarQueryParameters,
1042
- headers: localVarHeaderParams,
1043
- uri: localVarPath,
1044
- useQuerystring: this._useQuerystring,
1045
- agentOptions: { keepAlive: false },
1046
- json: true,
1047
- body: models_1.ObjectSerializer.serialize(setSyntiantPosteriorRequest, "SetSyntiantPosteriorRequest")
1129
+ headers: { ...localVarHeaderParams },
1048
1130
  };
1049
- let authenticationPromise = Promise.resolve();
1050
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1051
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1052
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1053
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1054
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1055
- return authenticationPromise.then(() => {
1056
- if (Object.keys(localVarFormParams).length) {
1057
- if (localVarUseFormData) {
1058
- localVarRequestOptions.formData = localVarFormParams;
1059
- }
1060
- else {
1061
- localVarRequestOptions.form = localVarFormParams;
1062
- }
1131
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(setSyntiantPosteriorRequest, "SetSyntiantPosteriorRequest"));
1132
+ let requestOptions = localVarRequestOptions;
1133
+ let url = localVarUrl;
1134
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1135
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1136
+ url = auth_ApiKeyAuthentication.url;
1137
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1138
+ requestOptions = auth_JWTAuthentication.requestOptions;
1139
+ url = auth_JWTAuthentication.url;
1140
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1141
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1142
+ url = auth_JWTHttpHeaderAuthentication.url;
1143
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1144
+ requestOptions = auth_OAuth2.requestOptions;
1145
+ url = auth_OAuth2.url;
1146
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1147
+ requestOptions = authDefault.requestOptions;
1148
+ url = authDefault.url;
1149
+ if (localVarFormParams) {
1150
+ delete requestOptions.headers['Content-Type'];
1151
+ if (localVarFormParams instanceof FormData) {
1152
+ // FormData: fetch will handle Content-Type automatically.
1153
+ requestOptions.body = localVarFormParams;
1063
1154
  }
1064
- return new Promise((resolve, reject) => {
1065
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1066
- if (error) {
1067
- reject(error);
1068
- }
1069
- else {
1070
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
1071
- if (typeof body.success === 'boolean' && !body.success) {
1072
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1073
- reject(new Error(body.error || errString));
1074
- }
1075
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1076
- resolve(body);
1077
- }
1078
- else {
1079
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1080
- reject(errString);
1081
- }
1082
- }
1083
- });
1084
- });
1085
- });
1155
+ else if (Object.keys(localVarFormParams).length > 0) {
1156
+ // URL-encoded form
1157
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1158
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1159
+ }
1160
+ }
1161
+ const response = await fetch(url, requestOptions);
1162
+ return this.handleResponse(response, 'GenericApiResponse');
1086
1163
  }
1087
1164
  }
1088
1165
  exports.DeploymentApi = DeploymentApi;