edge-impulse-api 1.82.6 → 1.82.8

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.OrganizationCreateProjectApi = exports.OrganizationCreateProjectApiApiKeys = 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 OrganizationCreateProjectApiApiKeys;
30
47
  OrganizationCreateProjectApiApiKeys[OrganizationCreateProjectApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
31
48
  })(OrganizationCreateProjectApiApiKeys = exports.OrganizationCreateProjectApiApiKeys || (exports.OrganizationCreateProjectApiApiKeys = {}));
32
49
  class OrganizationCreateProjectApi {
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 OrganizationCreateProjectApi {
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
  }
@@ -89,9 +123,11 @@ class OrganizationCreateProjectApi {
89
123
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
90
124
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)));
91
125
  let localVarQueryParameters = {};
92
- let localVarHeaderParams = Object.assign({
93
- 'User-Agent': 'edgeimpulse-api nodejs'
94
- }, this.defaultHeaders);
126
+ let localVarHeaderParams = {
127
+ 'User-Agent': 'edgeimpulse-api nodejs',
128
+ 'Content-Type': 'application/json',
129
+ ...this.defaultHeaders,
130
+ };
95
131
  const produces = ['application/json'];
96
132
  // give precedence to 'application/json'
97
133
  if (produces.indexOf('application/json') >= 0) {
@@ -100,7 +136,7 @@ class OrganizationCreateProjectApi {
100
136
  else {
101
137
  localVarHeaderParams.Accept = produces.join(',');
102
138
  }
103
- let localVarFormParams = {};
139
+ let localVarFormParams;
104
140
  // verify required parameter 'organizationId' is not null or undefined
105
141
  if (organizationId === null || organizationId === undefined) {
106
142
  throw new Error('Required parameter organizationId was null or undefined when calling clearOrganizationTransform.');
@@ -109,55 +145,51 @@ class OrganizationCreateProjectApi {
109
145
  if (createProjectId === null || createProjectId === undefined) {
110
146
  throw new Error('Required parameter createProjectId was null or undefined when calling clearOrganizationTransform.');
111
147
  }
112
- Object.assign(localVarHeaderParams, options.headers);
113
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
114
- let localVarUseFormData = false;
148
+ localVarHeaderParams = {
149
+ ...localVarHeaderParams,
150
+ ...options.headers,
151
+ ...this.opts.extraHeaders,
152
+ };
153
+ const queryString = Object.entries(localVarQueryParameters)
154
+ .filter(([, value]) => value !== undefined)
155
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
156
+ .join('&');
157
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
115
158
  let localVarRequestOptions = {
116
159
  method: 'POST',
117
- qs: localVarQueryParameters,
118
- headers: localVarHeaderParams,
119
- uri: localVarPath,
120
- useQuerystring: this._useQuerystring,
121
- agentOptions: { keepAlive: false },
122
- json: true,
160
+ headers: { ...localVarHeaderParams },
123
161
  };
124
- let authenticationPromise = Promise.resolve();
125
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
126
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
127
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
128
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
129
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
130
- return authenticationPromise.then(() => {
131
- if (Object.keys(localVarFormParams).length) {
132
- if (localVarUseFormData) {
133
- localVarRequestOptions.formData = localVarFormParams;
134
- }
135
- else {
136
- localVarRequestOptions.form = localVarFormParams;
137
- }
162
+ let requestOptions = localVarRequestOptions;
163
+ let url = localVarUrl;
164
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
165
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
166
+ url = auth_ApiKeyAuthentication.url;
167
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
168
+ requestOptions = auth_JWTAuthentication.requestOptions;
169
+ url = auth_JWTAuthentication.url;
170
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
171
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
172
+ url = auth_JWTHttpHeaderAuthentication.url;
173
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
174
+ requestOptions = auth_OAuth2.requestOptions;
175
+ url = auth_OAuth2.url;
176
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
177
+ requestOptions = authDefault.requestOptions;
178
+ url = authDefault.url;
179
+ if (localVarFormParams) {
180
+ delete requestOptions.headers['Content-Type'];
181
+ if (localVarFormParams instanceof FormData) {
182
+ // FormData: fetch will handle Content-Type automatically.
183
+ requestOptions.body = localVarFormParams;
138
184
  }
139
- return new Promise((resolve, reject) => {
140
- localVarRequest(localVarRequestOptions, (error, response, body) => {
141
- if (error) {
142
- reject(error);
143
- }
144
- else {
145
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
146
- if (typeof body.success === 'boolean' && !body.success) {
147
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
148
- reject(new Error(body.error || errString));
149
- }
150
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
151
- resolve(body);
152
- }
153
- else {
154
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
155
- reject(errString);
156
- }
157
- }
158
- });
159
- });
160
- });
185
+ else if (Object.keys(localVarFormParams).length > 0) {
186
+ // URL-encoded form
187
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
188
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
189
+ }
190
+ }
191
+ const response = await fetch(url, requestOptions);
192
+ return this.handleResponse(response, 'GenericApiResponse');
161
193
  }
162
194
  /**
163
195
  * Remove a transformation job. This will stop all running jobs.
@@ -170,9 +202,11 @@ class OrganizationCreateProjectApi {
170
202
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
171
203
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)));
172
204
  let localVarQueryParameters = {};
173
- let localVarHeaderParams = Object.assign({
174
- 'User-Agent': 'edgeimpulse-api nodejs'
175
- }, this.defaultHeaders);
205
+ let localVarHeaderParams = {
206
+ 'User-Agent': 'edgeimpulse-api nodejs',
207
+ 'Content-Type': 'application/json',
208
+ ...this.defaultHeaders,
209
+ };
176
210
  const produces = ['application/json'];
177
211
  // give precedence to 'application/json'
178
212
  if (produces.indexOf('application/json') >= 0) {
@@ -181,7 +215,7 @@ class OrganizationCreateProjectApi {
181
215
  else {
182
216
  localVarHeaderParams.Accept = produces.join(',');
183
217
  }
184
- let localVarFormParams = {};
218
+ let localVarFormParams;
185
219
  // verify required parameter 'organizationId' is not null or undefined
186
220
  if (organizationId === null || organizationId === undefined) {
187
221
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationCreateProject.');
@@ -190,55 +224,51 @@ class OrganizationCreateProjectApi {
190
224
  if (createProjectId === null || createProjectId === undefined) {
191
225
  throw new Error('Required parameter createProjectId was null or undefined when calling deleteOrganizationCreateProject.');
192
226
  }
193
- Object.assign(localVarHeaderParams, options.headers);
194
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
195
- let localVarUseFormData = false;
227
+ localVarHeaderParams = {
228
+ ...localVarHeaderParams,
229
+ ...options.headers,
230
+ ...this.opts.extraHeaders,
231
+ };
232
+ const queryString = Object.entries(localVarQueryParameters)
233
+ .filter(([, value]) => value !== undefined)
234
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
235
+ .join('&');
236
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
196
237
  let localVarRequestOptions = {
197
238
  method: 'DELETE',
198
- qs: localVarQueryParameters,
199
- headers: localVarHeaderParams,
200
- uri: localVarPath,
201
- useQuerystring: this._useQuerystring,
202
- agentOptions: { keepAlive: false },
203
- json: true,
239
+ headers: { ...localVarHeaderParams },
204
240
  };
205
- let authenticationPromise = Promise.resolve();
206
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
207
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
208
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
209
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
210
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
211
- return authenticationPromise.then(() => {
212
- if (Object.keys(localVarFormParams).length) {
213
- if (localVarUseFormData) {
214
- localVarRequestOptions.formData = localVarFormParams;
215
- }
216
- else {
217
- localVarRequestOptions.form = localVarFormParams;
218
- }
241
+ let requestOptions = localVarRequestOptions;
242
+ let url = localVarUrl;
243
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
244
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
245
+ url = auth_ApiKeyAuthentication.url;
246
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
247
+ requestOptions = auth_JWTAuthentication.requestOptions;
248
+ url = auth_JWTAuthentication.url;
249
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
250
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
251
+ url = auth_JWTHttpHeaderAuthentication.url;
252
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
253
+ requestOptions = auth_OAuth2.requestOptions;
254
+ url = auth_OAuth2.url;
255
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
256
+ requestOptions = authDefault.requestOptions;
257
+ url = authDefault.url;
258
+ if (localVarFormParams) {
259
+ delete requestOptions.headers['Content-Type'];
260
+ if (localVarFormParams instanceof FormData) {
261
+ // FormData: fetch will handle Content-Type automatically.
262
+ requestOptions.body = localVarFormParams;
219
263
  }
220
- return new Promise((resolve, reject) => {
221
- localVarRequest(localVarRequestOptions, (error, response, body) => {
222
- if (error) {
223
- reject(error);
224
- }
225
- else {
226
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
227
- if (typeof body.success === 'boolean' && !body.success) {
228
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
229
- reject(new Error(body.error || errString));
230
- }
231
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
232
- resolve(body);
233
- }
234
- else {
235
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
236
- reject(errString);
237
- }
238
- }
239
- });
240
- });
241
- });
264
+ else if (Object.keys(localVarFormParams).length > 0) {
265
+ // URL-encoded form
266
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
267
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
268
+ }
269
+ }
270
+ const response = await fetch(url, requestOptions);
271
+ return this.handleResponse(response, 'GenericApiResponse');
242
272
  }
243
273
  /**
244
274
  * Remove a file from a create project job. Only files for which no jobs are running can be deleted.
@@ -253,9 +283,11 @@ class OrganizationCreateProjectApi {
253
283
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)))
254
284
  .replace('{' + 'createProjectFileId' + '}', encodeURIComponent(String(createProjectFileId)));
255
285
  let localVarQueryParameters = {};
256
- let localVarHeaderParams = Object.assign({
257
- 'User-Agent': 'edgeimpulse-api nodejs'
258
- }, this.defaultHeaders);
286
+ let localVarHeaderParams = {
287
+ 'User-Agent': 'edgeimpulse-api nodejs',
288
+ 'Content-Type': 'application/json',
289
+ ...this.defaultHeaders,
290
+ };
259
291
  const produces = ['application/json'];
260
292
  // give precedence to 'application/json'
261
293
  if (produces.indexOf('application/json') >= 0) {
@@ -264,7 +296,7 @@ class OrganizationCreateProjectApi {
264
296
  else {
265
297
  localVarHeaderParams.Accept = produces.join(',');
266
298
  }
267
- let localVarFormParams = {};
299
+ let localVarFormParams;
268
300
  // verify required parameter 'organizationId' is not null or undefined
269
301
  if (organizationId === null || organizationId === undefined) {
270
302
  throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationCreateProjectFile.');
@@ -277,55 +309,51 @@ class OrganizationCreateProjectApi {
277
309
  if (createProjectFileId === null || createProjectFileId === undefined) {
278
310
  throw new Error('Required parameter createProjectFileId was null or undefined when calling deleteOrganizationCreateProjectFile.');
279
311
  }
280
- Object.assign(localVarHeaderParams, options.headers);
281
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
282
- let localVarUseFormData = false;
312
+ localVarHeaderParams = {
313
+ ...localVarHeaderParams,
314
+ ...options.headers,
315
+ ...this.opts.extraHeaders,
316
+ };
317
+ const queryString = Object.entries(localVarQueryParameters)
318
+ .filter(([, value]) => value !== undefined)
319
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
320
+ .join('&');
321
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
283
322
  let localVarRequestOptions = {
284
323
  method: 'DELETE',
285
- qs: localVarQueryParameters,
286
- headers: localVarHeaderParams,
287
- uri: localVarPath,
288
- useQuerystring: this._useQuerystring,
289
- agentOptions: { keepAlive: false },
290
- json: true,
324
+ headers: { ...localVarHeaderParams },
291
325
  };
292
- let authenticationPromise = Promise.resolve();
293
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
294
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
295
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
296
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
297
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
298
- return authenticationPromise.then(() => {
299
- if (Object.keys(localVarFormParams).length) {
300
- if (localVarUseFormData) {
301
- localVarRequestOptions.formData = localVarFormParams;
302
- }
303
- else {
304
- localVarRequestOptions.form = localVarFormParams;
305
- }
326
+ let requestOptions = localVarRequestOptions;
327
+ let url = localVarUrl;
328
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
329
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
330
+ url = auth_ApiKeyAuthentication.url;
331
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
332
+ requestOptions = auth_JWTAuthentication.requestOptions;
333
+ url = auth_JWTAuthentication.url;
334
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
335
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
336
+ url = auth_JWTHttpHeaderAuthentication.url;
337
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
338
+ requestOptions = auth_OAuth2.requestOptions;
339
+ url = auth_OAuth2.url;
340
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
341
+ requestOptions = authDefault.requestOptions;
342
+ url = authDefault.url;
343
+ if (localVarFormParams) {
344
+ delete requestOptions.headers['Content-Type'];
345
+ if (localVarFormParams instanceof FormData) {
346
+ // FormData: fetch will handle Content-Type automatically.
347
+ requestOptions.body = localVarFormParams;
306
348
  }
307
- return new Promise((resolve, reject) => {
308
- localVarRequest(localVarRequestOptions, (error, response, body) => {
309
- if (error) {
310
- reject(error);
311
- }
312
- else {
313
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
314
- if (typeof body.success === 'boolean' && !body.success) {
315
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
316
- reject(new Error(body.error || errString));
317
- }
318
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
319
- resolve(body);
320
- }
321
- else {
322
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
323
- reject(errString);
324
- }
325
- }
326
- });
327
- });
328
- });
349
+ else if (Object.keys(localVarFormParams).length > 0) {
350
+ // URL-encoded form
351
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
352
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
353
+ }
354
+ }
355
+ const response = await fetch(url, requestOptions);
356
+ return this.handleResponse(response, 'GenericApiResponse');
329
357
  }
330
358
  /**
331
359
  * Get the current status of a transformation job job.
@@ -341,9 +369,11 @@ class OrganizationCreateProjectApi {
341
369
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
342
370
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)));
343
371
  let localVarQueryParameters = {};
344
- let localVarHeaderParams = Object.assign({
345
- 'User-Agent': 'edgeimpulse-api nodejs'
346
- }, this.defaultHeaders);
372
+ let localVarHeaderParams = {
373
+ 'User-Agent': 'edgeimpulse-api nodejs',
374
+ 'Content-Type': 'application/json',
375
+ ...this.defaultHeaders,
376
+ };
347
377
  const produces = ['application/json'];
348
378
  // give precedence to 'application/json'
349
379
  if (produces.indexOf('application/json') >= 0) {
@@ -352,7 +382,7 @@ class OrganizationCreateProjectApi {
352
382
  else {
353
383
  localVarHeaderParams.Accept = produces.join(',');
354
384
  }
355
- let localVarFormParams = {};
385
+ let localVarFormParams;
356
386
  // verify required parameter 'organizationId' is not null or undefined
357
387
  if (organizationId === null || organizationId === undefined) {
358
388
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationCreateProjectStatus.');
@@ -378,55 +408,51 @@ class OrganizationCreateProjectApi {
378
408
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.selection) !== undefined) {
379
409
  localVarQueryParameters['selection'] = models_1.ObjectSerializer.serialize(queryParams.selection, "string");
380
410
  }
381
- Object.assign(localVarHeaderParams, options.headers);
382
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
383
- let localVarUseFormData = false;
411
+ localVarHeaderParams = {
412
+ ...localVarHeaderParams,
413
+ ...options.headers,
414
+ ...this.opts.extraHeaders,
415
+ };
416
+ const queryString = Object.entries(localVarQueryParameters)
417
+ .filter(([, value]) => value !== undefined)
418
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
419
+ .join('&');
420
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
384
421
  let localVarRequestOptions = {
385
422
  method: 'GET',
386
- qs: localVarQueryParameters,
387
- headers: localVarHeaderParams,
388
- uri: localVarPath,
389
- useQuerystring: this._useQuerystring,
390
- agentOptions: { keepAlive: false },
391
- json: true,
423
+ headers: { ...localVarHeaderParams },
392
424
  };
393
- let authenticationPromise = Promise.resolve();
394
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
395
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
396
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
397
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
398
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
399
- return authenticationPromise.then(() => {
400
- if (Object.keys(localVarFormParams).length) {
401
- if (localVarUseFormData) {
402
- localVarRequestOptions.formData = localVarFormParams;
403
- }
404
- else {
405
- localVarRequestOptions.form = localVarFormParams;
406
- }
425
+ let requestOptions = localVarRequestOptions;
426
+ let url = localVarUrl;
427
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
428
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
429
+ url = auth_ApiKeyAuthentication.url;
430
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
431
+ requestOptions = auth_JWTAuthentication.requestOptions;
432
+ url = auth_JWTAuthentication.url;
433
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
434
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
435
+ url = auth_JWTHttpHeaderAuthentication.url;
436
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
437
+ requestOptions = auth_OAuth2.requestOptions;
438
+ url = auth_OAuth2.url;
439
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
440
+ requestOptions = authDefault.requestOptions;
441
+ url = authDefault.url;
442
+ if (localVarFormParams) {
443
+ delete requestOptions.headers['Content-Type'];
444
+ if (localVarFormParams instanceof FormData) {
445
+ // FormData: fetch will handle Content-Type automatically.
446
+ requestOptions.body = localVarFormParams;
407
447
  }
408
- return new Promise((resolve, reject) => {
409
- localVarRequest(localVarRequestOptions, (error, response, body) => {
410
- if (error) {
411
- reject(error);
412
- }
413
- else {
414
- body = models_1.ObjectSerializer.deserialize(body, "OrganizationCreateProjectStatusResponse");
415
- if (typeof body.success === 'boolean' && !body.success) {
416
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
417
- reject(new Error(body.error || errString));
418
- }
419
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
420
- resolve(body);
421
- }
422
- else {
423
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
424
- reject(errString);
425
- }
426
- }
427
- });
428
- });
429
- });
448
+ else if (Object.keys(localVarFormParams).length > 0) {
449
+ // URL-encoded form
450
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
451
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
452
+ }
453
+ }
454
+ const response = await fetch(url, requestOptions);
455
+ return this.handleResponse(response, 'OrganizationCreateProjectStatusResponse');
430
456
  }
431
457
  /**
432
458
  * Get list of transformation jobs.
@@ -440,9 +466,11 @@ class OrganizationCreateProjectApi {
440
466
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/create-project'
441
467
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
442
468
  let localVarQueryParameters = {};
443
- let localVarHeaderParams = Object.assign({
444
- 'User-Agent': 'edgeimpulse-api nodejs'
445
- }, this.defaultHeaders);
469
+ let localVarHeaderParams = {
470
+ 'User-Agent': 'edgeimpulse-api nodejs',
471
+ 'Content-Type': 'application/json',
472
+ ...this.defaultHeaders,
473
+ };
446
474
  const produces = ['application/json'];
447
475
  // give precedence to 'application/json'
448
476
  if (produces.indexOf('application/json') >= 0) {
@@ -451,7 +479,7 @@ class OrganizationCreateProjectApi {
451
479
  else {
452
480
  localVarHeaderParams.Accept = produces.join(',');
453
481
  }
454
- let localVarFormParams = {};
482
+ let localVarFormParams;
455
483
  // verify required parameter 'organizationId' is not null or undefined
456
484
  if (organizationId === null || organizationId === undefined) {
457
485
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationCreateProjects.');
@@ -465,55 +493,51 @@ class OrganizationCreateProjectApi {
465
493
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.includePipelineJobs) !== undefined) {
466
494
  localVarQueryParameters['includePipelineJobs'] = models_1.ObjectSerializer.serialize(queryParams.includePipelineJobs, "boolean");
467
495
  }
468
- Object.assign(localVarHeaderParams, options.headers);
469
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
470
- let localVarUseFormData = false;
496
+ localVarHeaderParams = {
497
+ ...localVarHeaderParams,
498
+ ...options.headers,
499
+ ...this.opts.extraHeaders,
500
+ };
501
+ const queryString = Object.entries(localVarQueryParameters)
502
+ .filter(([, value]) => value !== undefined)
503
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
504
+ .join('&');
505
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
471
506
  let localVarRequestOptions = {
472
507
  method: 'GET',
473
- qs: localVarQueryParameters,
474
- headers: localVarHeaderParams,
475
- uri: localVarPath,
476
- useQuerystring: this._useQuerystring,
477
- agentOptions: { keepAlive: false },
478
- json: true,
508
+ headers: { ...localVarHeaderParams },
479
509
  };
480
- let authenticationPromise = Promise.resolve();
481
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
482
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
483
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
484
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
485
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
486
- return authenticationPromise.then(() => {
487
- if (Object.keys(localVarFormParams).length) {
488
- if (localVarUseFormData) {
489
- localVarRequestOptions.formData = localVarFormParams;
490
- }
491
- else {
492
- localVarRequestOptions.form = localVarFormParams;
493
- }
510
+ let requestOptions = localVarRequestOptions;
511
+ let url = localVarUrl;
512
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
513
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
514
+ url = auth_ApiKeyAuthentication.url;
515
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
516
+ requestOptions = auth_JWTAuthentication.requestOptions;
517
+ url = auth_JWTAuthentication.url;
518
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
519
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
520
+ url = auth_JWTHttpHeaderAuthentication.url;
521
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
522
+ requestOptions = auth_OAuth2.requestOptions;
523
+ url = auth_OAuth2.url;
524
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
525
+ requestOptions = authDefault.requestOptions;
526
+ url = authDefault.url;
527
+ if (localVarFormParams) {
528
+ delete requestOptions.headers['Content-Type'];
529
+ if (localVarFormParams instanceof FormData) {
530
+ // FormData: fetch will handle Content-Type automatically.
531
+ requestOptions.body = localVarFormParams;
494
532
  }
495
- return new Promise((resolve, reject) => {
496
- localVarRequest(localVarRequestOptions, (error, response, body) => {
497
- if (error) {
498
- reject(error);
499
- }
500
- else {
501
- body = models_1.ObjectSerializer.deserialize(body, "OrganizationGetCreateProjectsResponse");
502
- if (typeof body.success === 'boolean' && !body.success) {
503
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
504
- reject(new Error(body.error || errString));
505
- }
506
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
507
- resolve(body);
508
- }
509
- else {
510
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
511
- reject(errString);
512
- }
513
- }
514
- });
515
- });
516
- });
533
+ else if (Object.keys(localVarFormParams).length > 0) {
534
+ // URL-encoded form
535
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
536
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
537
+ }
538
+ }
539
+ const response = await fetch(url, requestOptions);
540
+ return this.handleResponse(response, 'OrganizationGetCreateProjectsResponse');
517
541
  }
518
542
  /**
519
543
  * Add a new collaborator to a project owned by an organisation.
@@ -525,9 +549,11 @@ class OrganizationCreateProjectApi {
525
549
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/add-project-collaborator'
526
550
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
527
551
  let localVarQueryParameters = {};
528
- let localVarHeaderParams = Object.assign({
529
- 'User-Agent': 'edgeimpulse-api nodejs'
530
- }, this.defaultHeaders);
552
+ let localVarHeaderParams = {
553
+ 'User-Agent': 'edgeimpulse-api nodejs',
554
+ 'Content-Type': 'application/json',
555
+ ...this.defaultHeaders,
556
+ };
531
557
  const produces = ['application/json'];
532
558
  // give precedence to 'application/json'
533
559
  if (produces.indexOf('application/json') >= 0) {
@@ -536,7 +562,7 @@ class OrganizationCreateProjectApi {
536
562
  else {
537
563
  localVarHeaderParams.Accept = produces.join(',');
538
564
  }
539
- let localVarFormParams = {};
565
+ let localVarFormParams;
540
566
  // verify required parameter 'organizationId' is not null or undefined
541
567
  if (organizationId === null || organizationId === undefined) {
542
568
  throw new Error('Required parameter organizationId was null or undefined when calling organizationAddCollaborator.');
@@ -545,56 +571,52 @@ class OrganizationCreateProjectApi {
545
571
  if (updateOrganizationAddCollaboratorRequest === null || updateOrganizationAddCollaboratorRequest === undefined) {
546
572
  throw new Error('Required parameter updateOrganizationAddCollaboratorRequest was null or undefined when calling organizationAddCollaborator.');
547
573
  }
548
- Object.assign(localVarHeaderParams, options.headers);
549
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
550
- let localVarUseFormData = false;
574
+ localVarHeaderParams = {
575
+ ...localVarHeaderParams,
576
+ ...options.headers,
577
+ ...this.opts.extraHeaders,
578
+ };
579
+ const queryString = Object.entries(localVarQueryParameters)
580
+ .filter(([, value]) => value !== undefined)
581
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
582
+ .join('&');
583
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
551
584
  let localVarRequestOptions = {
552
585
  method: 'POST',
553
- qs: localVarQueryParameters,
554
- headers: localVarHeaderParams,
555
- uri: localVarPath,
556
- useQuerystring: this._useQuerystring,
557
- agentOptions: { keepAlive: false },
558
- json: true,
559
- body: models_1.ObjectSerializer.serialize(updateOrganizationAddCollaboratorRequest, "UpdateOrganizationAddCollaboratorRequest")
586
+ headers: { ...localVarHeaderParams },
560
587
  };
561
- let authenticationPromise = Promise.resolve();
562
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
563
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
564
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
565
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
566
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
567
- return authenticationPromise.then(() => {
568
- if (Object.keys(localVarFormParams).length) {
569
- if (localVarUseFormData) {
570
- localVarRequestOptions.formData = localVarFormParams;
571
- }
572
- else {
573
- localVarRequestOptions.form = localVarFormParams;
574
- }
588
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateOrganizationAddCollaboratorRequest, "UpdateOrganizationAddCollaboratorRequest"));
589
+ let requestOptions = localVarRequestOptions;
590
+ let url = localVarUrl;
591
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
592
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
593
+ url = auth_ApiKeyAuthentication.url;
594
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
595
+ requestOptions = auth_JWTAuthentication.requestOptions;
596
+ url = auth_JWTAuthentication.url;
597
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
598
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
599
+ url = auth_JWTHttpHeaderAuthentication.url;
600
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
601
+ requestOptions = auth_OAuth2.requestOptions;
602
+ url = auth_OAuth2.url;
603
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
604
+ requestOptions = authDefault.requestOptions;
605
+ url = authDefault.url;
606
+ if (localVarFormParams) {
607
+ delete requestOptions.headers['Content-Type'];
608
+ if (localVarFormParams instanceof FormData) {
609
+ // FormData: fetch will handle Content-Type automatically.
610
+ requestOptions.body = localVarFormParams;
575
611
  }
576
- return new Promise((resolve, reject) => {
577
- localVarRequest(localVarRequestOptions, (error, response, body) => {
578
- if (error) {
579
- reject(error);
580
- }
581
- else {
582
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
583
- if (typeof body.success === 'boolean' && !body.success) {
584
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
585
- reject(new Error(body.error || errString));
586
- }
587
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
588
- resolve(body);
589
- }
590
- else {
591
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
592
- reject(errString);
593
- }
594
- }
595
- });
596
- });
597
- });
612
+ else if (Object.keys(localVarFormParams).length > 0) {
613
+ // URL-encoded form
614
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
615
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
616
+ }
617
+ }
618
+ const response = await fetch(url, requestOptions);
619
+ return this.handleResponse(response, 'GenericApiResponse');
598
620
  }
599
621
  /**
600
622
  * Create a new empty project within an organization.
@@ -606,9 +628,11 @@ class OrganizationCreateProjectApi {
606
628
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/new-project'
607
629
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
608
630
  let localVarQueryParameters = {};
609
- let localVarHeaderParams = Object.assign({
610
- 'User-Agent': 'edgeimpulse-api nodejs'
611
- }, this.defaultHeaders);
631
+ let localVarHeaderParams = {
632
+ 'User-Agent': 'edgeimpulse-api nodejs',
633
+ 'Content-Type': 'application/json',
634
+ ...this.defaultHeaders,
635
+ };
612
636
  const produces = ['application/json'];
613
637
  // give precedence to 'application/json'
614
638
  if (produces.indexOf('application/json') >= 0) {
@@ -617,7 +641,7 @@ class OrganizationCreateProjectApi {
617
641
  else {
618
642
  localVarHeaderParams.Accept = produces.join(',');
619
643
  }
620
- let localVarFormParams = {};
644
+ let localVarFormParams;
621
645
  // verify required parameter 'organizationId' is not null or undefined
622
646
  if (organizationId === null || organizationId === undefined) {
623
647
  throw new Error('Required parameter organizationId was null or undefined when calling organizationCreateEmptyProject.');
@@ -626,56 +650,52 @@ class OrganizationCreateProjectApi {
626
650
  if (updateOrganizationCreateEmptyProjectRequest === null || updateOrganizationCreateEmptyProjectRequest === undefined) {
627
651
  throw new Error('Required parameter updateOrganizationCreateEmptyProjectRequest was null or undefined when calling organizationCreateEmptyProject.');
628
652
  }
629
- Object.assign(localVarHeaderParams, options.headers);
630
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
631
- let localVarUseFormData = false;
653
+ localVarHeaderParams = {
654
+ ...localVarHeaderParams,
655
+ ...options.headers,
656
+ ...this.opts.extraHeaders,
657
+ };
658
+ const queryString = Object.entries(localVarQueryParameters)
659
+ .filter(([, value]) => value !== undefined)
660
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
661
+ .join('&');
662
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
632
663
  let localVarRequestOptions = {
633
664
  method: 'POST',
634
- qs: localVarQueryParameters,
635
- headers: localVarHeaderParams,
636
- uri: localVarPath,
637
- useQuerystring: this._useQuerystring,
638
- agentOptions: { keepAlive: false },
639
- json: true,
640
- body: models_1.ObjectSerializer.serialize(updateOrganizationCreateEmptyProjectRequest, "UpdateOrganizationCreateEmptyProjectRequest")
665
+ headers: { ...localVarHeaderParams },
641
666
  };
642
- let authenticationPromise = Promise.resolve();
643
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
644
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
645
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
646
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
647
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
648
- return authenticationPromise.then(() => {
649
- if (Object.keys(localVarFormParams).length) {
650
- if (localVarUseFormData) {
651
- localVarRequestOptions.formData = localVarFormParams;
652
- }
653
- else {
654
- localVarRequestOptions.form = localVarFormParams;
655
- }
667
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateOrganizationCreateEmptyProjectRequest, "UpdateOrganizationCreateEmptyProjectRequest"));
668
+ let requestOptions = localVarRequestOptions;
669
+ let url = localVarUrl;
670
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
671
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
672
+ url = auth_ApiKeyAuthentication.url;
673
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
674
+ requestOptions = auth_JWTAuthentication.requestOptions;
675
+ url = auth_JWTAuthentication.url;
676
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
677
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
678
+ url = auth_JWTHttpHeaderAuthentication.url;
679
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
680
+ requestOptions = auth_OAuth2.requestOptions;
681
+ url = auth_OAuth2.url;
682
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
683
+ requestOptions = authDefault.requestOptions;
684
+ url = authDefault.url;
685
+ if (localVarFormParams) {
686
+ delete requestOptions.headers['Content-Type'];
687
+ if (localVarFormParams instanceof FormData) {
688
+ // FormData: fetch will handle Content-Type automatically.
689
+ requestOptions.body = localVarFormParams;
656
690
  }
657
- return new Promise((resolve, reject) => {
658
- localVarRequest(localVarRequestOptions, (error, response, body) => {
659
- if (error) {
660
- reject(error);
661
- }
662
- else {
663
- body = models_1.ObjectSerializer.deserialize(body, "CreateProjectResponse");
664
- if (typeof body.success === 'boolean' && !body.success) {
665
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
666
- reject(new Error(body.error || errString));
667
- }
668
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
669
- resolve(body);
670
- }
671
- else {
672
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
673
- reject(errString);
674
- }
675
- }
676
- });
677
- });
678
- });
691
+ else if (Object.keys(localVarFormParams).length > 0) {
692
+ // URL-encoded form
693
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
694
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
695
+ }
696
+ }
697
+ const response = await fetch(url, requestOptions);
698
+ return this.handleResponse(response, 'CreateProjectResponse');
679
699
  }
680
700
  /**
681
701
  * Start a transformation job to fetch data from the organization and put it in a project, or transform into new data.
@@ -687,9 +707,11 @@ class OrganizationCreateProjectApi {
687
707
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/create-project'
688
708
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
689
709
  let localVarQueryParameters = {};
690
- let localVarHeaderParams = Object.assign({
691
- 'User-Agent': 'edgeimpulse-api nodejs'
692
- }, this.defaultHeaders);
710
+ let localVarHeaderParams = {
711
+ 'User-Agent': 'edgeimpulse-api nodejs',
712
+ 'Content-Type': 'application/json',
713
+ ...this.defaultHeaders,
714
+ };
693
715
  const produces = ['application/json'];
694
716
  // give precedence to 'application/json'
695
717
  if (produces.indexOf('application/json') >= 0) {
@@ -698,7 +720,7 @@ class OrganizationCreateProjectApi {
698
720
  else {
699
721
  localVarHeaderParams.Accept = produces.join(',');
700
722
  }
701
- let localVarFormParams = {};
723
+ let localVarFormParams;
702
724
  // verify required parameter 'organizationId' is not null or undefined
703
725
  if (organizationId === null || organizationId === undefined) {
704
726
  throw new Error('Required parameter organizationId was null or undefined when calling organizationCreateProject.');
@@ -707,56 +729,52 @@ class OrganizationCreateProjectApi {
707
729
  if (organizationCreateProjectRequest === null || organizationCreateProjectRequest === undefined) {
708
730
  throw new Error('Required parameter organizationCreateProjectRequest was null or undefined when calling organizationCreateProject.');
709
731
  }
710
- Object.assign(localVarHeaderParams, options.headers);
711
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
712
- let localVarUseFormData = false;
732
+ localVarHeaderParams = {
733
+ ...localVarHeaderParams,
734
+ ...options.headers,
735
+ ...this.opts.extraHeaders,
736
+ };
737
+ const queryString = Object.entries(localVarQueryParameters)
738
+ .filter(([, value]) => value !== undefined)
739
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
740
+ .join('&');
741
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
713
742
  let localVarRequestOptions = {
714
743
  method: 'POST',
715
- qs: localVarQueryParameters,
716
- headers: localVarHeaderParams,
717
- uri: localVarPath,
718
- useQuerystring: this._useQuerystring,
719
- agentOptions: { keepAlive: false },
720
- json: true,
721
- body: models_1.ObjectSerializer.serialize(organizationCreateProjectRequest, "OrganizationCreateProjectRequest")
744
+ headers: { ...localVarHeaderParams },
722
745
  };
723
- let authenticationPromise = Promise.resolve();
724
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
725
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
726
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
727
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
728
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
729
- return authenticationPromise.then(() => {
730
- if (Object.keys(localVarFormParams).length) {
731
- if (localVarUseFormData) {
732
- localVarRequestOptions.formData = localVarFormParams;
733
- }
734
- else {
735
- localVarRequestOptions.form = localVarFormParams;
736
- }
746
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(organizationCreateProjectRequest, "OrganizationCreateProjectRequest"));
747
+ let requestOptions = localVarRequestOptions;
748
+ let url = localVarUrl;
749
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
750
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
751
+ url = auth_ApiKeyAuthentication.url;
752
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
753
+ requestOptions = auth_JWTAuthentication.requestOptions;
754
+ url = auth_JWTAuthentication.url;
755
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
756
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
757
+ url = auth_JWTHttpHeaderAuthentication.url;
758
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
759
+ requestOptions = auth_OAuth2.requestOptions;
760
+ url = auth_OAuth2.url;
761
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
762
+ requestOptions = authDefault.requestOptions;
763
+ url = authDefault.url;
764
+ if (localVarFormParams) {
765
+ delete requestOptions.headers['Content-Type'];
766
+ if (localVarFormParams instanceof FormData) {
767
+ // FormData: fetch will handle Content-Type automatically.
768
+ requestOptions.body = localVarFormParams;
737
769
  }
738
- return new Promise((resolve, reject) => {
739
- localVarRequest(localVarRequestOptions, (error, response, body) => {
740
- if (error) {
741
- reject(error);
742
- }
743
- else {
744
- body = models_1.ObjectSerializer.deserialize(body, "OrganizationCreateProjectResponse");
745
- if (typeof body.success === 'boolean' && !body.success) {
746
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
747
- reject(new Error(body.error || errString));
748
- }
749
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
750
- resolve(body);
751
- }
752
- else {
753
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
754
- reject(errString);
755
- }
756
- }
757
- });
758
- });
759
- });
770
+ else if (Object.keys(localVarFormParams).length > 0) {
771
+ // URL-encoded form
772
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
773
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
774
+ }
775
+ }
776
+ const response = await fetch(url, requestOptions);
777
+ return this.handleResponse(response, 'OrganizationCreateProjectResponse');
760
778
  }
761
779
  /**
762
780
  * Retry a transformation action on a file from a transformation job. Only files that have failed can be retried.
@@ -771,9 +789,11 @@ class OrganizationCreateProjectApi {
771
789
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)))
772
790
  .replace('{' + 'createProjectFileId' + '}', encodeURIComponent(String(createProjectFileId)));
773
791
  let localVarQueryParameters = {};
774
- let localVarHeaderParams = Object.assign({
775
- 'User-Agent': 'edgeimpulse-api nodejs'
776
- }, this.defaultHeaders);
792
+ let localVarHeaderParams = {
793
+ 'User-Agent': 'edgeimpulse-api nodejs',
794
+ 'Content-Type': 'application/json',
795
+ ...this.defaultHeaders,
796
+ };
777
797
  const produces = ['application/json'];
778
798
  // give precedence to 'application/json'
779
799
  if (produces.indexOf('application/json') >= 0) {
@@ -782,7 +802,7 @@ class OrganizationCreateProjectApi {
782
802
  else {
783
803
  localVarHeaderParams.Accept = produces.join(',');
784
804
  }
785
- let localVarFormParams = {};
805
+ let localVarFormParams;
786
806
  // verify required parameter 'organizationId' is not null or undefined
787
807
  if (organizationId === null || organizationId === undefined) {
788
808
  throw new Error('Required parameter organizationId was null or undefined when calling retryOrganizationCreateProjectFile.');
@@ -795,55 +815,51 @@ class OrganizationCreateProjectApi {
795
815
  if (createProjectFileId === null || createProjectFileId === undefined) {
796
816
  throw new Error('Required parameter createProjectFileId was null or undefined when calling retryOrganizationCreateProjectFile.');
797
817
  }
798
- Object.assign(localVarHeaderParams, options.headers);
799
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
800
- let localVarUseFormData = false;
818
+ localVarHeaderParams = {
819
+ ...localVarHeaderParams,
820
+ ...options.headers,
821
+ ...this.opts.extraHeaders,
822
+ };
823
+ const queryString = Object.entries(localVarQueryParameters)
824
+ .filter(([, value]) => value !== undefined)
825
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
826
+ .join('&');
827
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
801
828
  let localVarRequestOptions = {
802
829
  method: 'POST',
803
- qs: localVarQueryParameters,
804
- headers: localVarHeaderParams,
805
- uri: localVarPath,
806
- useQuerystring: this._useQuerystring,
807
- agentOptions: { keepAlive: false },
808
- json: true,
830
+ headers: { ...localVarHeaderParams },
809
831
  };
810
- let authenticationPromise = Promise.resolve();
811
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
812
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
813
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
814
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
815
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
816
- return authenticationPromise.then(() => {
817
- if (Object.keys(localVarFormParams).length) {
818
- if (localVarUseFormData) {
819
- localVarRequestOptions.formData = localVarFormParams;
820
- }
821
- else {
822
- localVarRequestOptions.form = localVarFormParams;
823
- }
832
+ let requestOptions = localVarRequestOptions;
833
+ let url = localVarUrl;
834
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
835
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
836
+ url = auth_ApiKeyAuthentication.url;
837
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
838
+ requestOptions = auth_JWTAuthentication.requestOptions;
839
+ url = auth_JWTAuthentication.url;
840
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
841
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
842
+ url = auth_JWTHttpHeaderAuthentication.url;
843
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
844
+ requestOptions = auth_OAuth2.requestOptions;
845
+ url = auth_OAuth2.url;
846
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
847
+ requestOptions = authDefault.requestOptions;
848
+ url = authDefault.url;
849
+ if (localVarFormParams) {
850
+ delete requestOptions.headers['Content-Type'];
851
+ if (localVarFormParams instanceof FormData) {
852
+ // FormData: fetch will handle Content-Type automatically.
853
+ requestOptions.body = localVarFormParams;
824
854
  }
825
- return new Promise((resolve, reject) => {
826
- localVarRequest(localVarRequestOptions, (error, response, body) => {
827
- if (error) {
828
- reject(error);
829
- }
830
- else {
831
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
832
- if (typeof body.success === 'boolean' && !body.success) {
833
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
834
- reject(new Error(body.error || errString));
835
- }
836
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
837
- resolve(body);
838
- }
839
- else {
840
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
841
- reject(errString);
842
- }
843
- }
844
- });
845
- });
846
- });
855
+ else if (Object.keys(localVarFormParams).length > 0) {
856
+ // URL-encoded form
857
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
858
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
859
+ }
860
+ }
861
+ const response = await fetch(url, requestOptions);
862
+ return this.handleResponse(response, 'GenericApiResponse');
847
863
  }
848
864
  /**
849
865
  * Retry all failed transform job from a transformation job. Only jobs that have failed will be retried.
@@ -856,9 +872,11 @@ class OrganizationCreateProjectApi {
856
872
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
857
873
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)));
858
874
  let localVarQueryParameters = {};
859
- let localVarHeaderParams = Object.assign({
860
- 'User-Agent': 'edgeimpulse-api nodejs'
861
- }, this.defaultHeaders);
875
+ let localVarHeaderParams = {
876
+ 'User-Agent': 'edgeimpulse-api nodejs',
877
+ 'Content-Type': 'application/json',
878
+ ...this.defaultHeaders,
879
+ };
862
880
  const produces = ['application/json'];
863
881
  // give precedence to 'application/json'
864
882
  if (produces.indexOf('application/json') >= 0) {
@@ -867,7 +885,7 @@ class OrganizationCreateProjectApi {
867
885
  else {
868
886
  localVarHeaderParams.Accept = produces.join(',');
869
887
  }
870
- let localVarFormParams = {};
888
+ let localVarFormParams;
871
889
  // verify required parameter 'organizationId' is not null or undefined
872
890
  if (organizationId === null || organizationId === undefined) {
873
891
  throw new Error('Required parameter organizationId was null or undefined when calling retryOrganizationTransform.');
@@ -876,55 +894,51 @@ class OrganizationCreateProjectApi {
876
894
  if (createProjectId === null || createProjectId === undefined) {
877
895
  throw new Error('Required parameter createProjectId was null or undefined when calling retryOrganizationTransform.');
878
896
  }
879
- Object.assign(localVarHeaderParams, options.headers);
880
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
881
- let localVarUseFormData = false;
897
+ localVarHeaderParams = {
898
+ ...localVarHeaderParams,
899
+ ...options.headers,
900
+ ...this.opts.extraHeaders,
901
+ };
902
+ const queryString = Object.entries(localVarQueryParameters)
903
+ .filter(([, value]) => value !== undefined)
904
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
905
+ .join('&');
906
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
882
907
  let localVarRequestOptions = {
883
908
  method: 'POST',
884
- qs: localVarQueryParameters,
885
- headers: localVarHeaderParams,
886
- uri: localVarPath,
887
- useQuerystring: this._useQuerystring,
888
- agentOptions: { keepAlive: false },
889
- json: true,
909
+ headers: { ...localVarHeaderParams },
890
910
  };
891
- let authenticationPromise = Promise.resolve();
892
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
893
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
894
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
895
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
896
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
897
- return authenticationPromise.then(() => {
898
- if (Object.keys(localVarFormParams).length) {
899
- if (localVarUseFormData) {
900
- localVarRequestOptions.formData = localVarFormParams;
901
- }
902
- else {
903
- localVarRequestOptions.form = localVarFormParams;
904
- }
911
+ let requestOptions = localVarRequestOptions;
912
+ let url = localVarUrl;
913
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
914
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
915
+ url = auth_ApiKeyAuthentication.url;
916
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
917
+ requestOptions = auth_JWTAuthentication.requestOptions;
918
+ url = auth_JWTAuthentication.url;
919
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
920
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
921
+ url = auth_JWTHttpHeaderAuthentication.url;
922
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
923
+ requestOptions = auth_OAuth2.requestOptions;
924
+ url = auth_OAuth2.url;
925
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
926
+ requestOptions = authDefault.requestOptions;
927
+ url = authDefault.url;
928
+ if (localVarFormParams) {
929
+ delete requestOptions.headers['Content-Type'];
930
+ if (localVarFormParams instanceof FormData) {
931
+ // FormData: fetch will handle Content-Type automatically.
932
+ requestOptions.body = localVarFormParams;
905
933
  }
906
- return new Promise((resolve, reject) => {
907
- localVarRequest(localVarRequestOptions, (error, response, body) => {
908
- if (error) {
909
- reject(error);
910
- }
911
- else {
912
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
913
- if (typeof body.success === 'boolean' && !body.success) {
914
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
915
- reject(new Error(body.error || errString));
916
- }
917
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
918
- resolve(body);
919
- }
920
- else {
921
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
922
- reject(errString);
923
- }
924
- }
925
- });
926
- });
927
- });
934
+ else if (Object.keys(localVarFormParams).length > 0) {
935
+ // URL-encoded form
936
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
937
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
938
+ }
939
+ }
940
+ const response = await fetch(url, requestOptions);
941
+ return this.handleResponse(response, 'GenericApiResponse');
928
942
  }
929
943
  /**
930
944
  * Retry the upload job from a transformation job. Only jobs that have failed can be retried.
@@ -937,9 +951,11 @@ class OrganizationCreateProjectApi {
937
951
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
938
952
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)));
939
953
  let localVarQueryParameters = {};
940
- let localVarHeaderParams = Object.assign({
941
- 'User-Agent': 'edgeimpulse-api nodejs'
942
- }, this.defaultHeaders);
954
+ let localVarHeaderParams = {
955
+ 'User-Agent': 'edgeimpulse-api nodejs',
956
+ 'Content-Type': 'application/json',
957
+ ...this.defaultHeaders,
958
+ };
943
959
  const produces = ['application/json'];
944
960
  // give precedence to 'application/json'
945
961
  if (produces.indexOf('application/json') >= 0) {
@@ -948,7 +964,7 @@ class OrganizationCreateProjectApi {
948
964
  else {
949
965
  localVarHeaderParams.Accept = produces.join(',');
950
966
  }
951
- let localVarFormParams = {};
967
+ let localVarFormParams;
952
968
  // verify required parameter 'organizationId' is not null or undefined
953
969
  if (organizationId === null || organizationId === undefined) {
954
970
  throw new Error('Required parameter organizationId was null or undefined when calling retryOrganizationUpload.');
@@ -957,55 +973,51 @@ class OrganizationCreateProjectApi {
957
973
  if (createProjectId === null || createProjectId === undefined) {
958
974
  throw new Error('Required parameter createProjectId was null or undefined when calling retryOrganizationUpload.');
959
975
  }
960
- Object.assign(localVarHeaderParams, options.headers);
961
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
962
- let localVarUseFormData = false;
976
+ localVarHeaderParams = {
977
+ ...localVarHeaderParams,
978
+ ...options.headers,
979
+ ...this.opts.extraHeaders,
980
+ };
981
+ const queryString = Object.entries(localVarQueryParameters)
982
+ .filter(([, value]) => value !== undefined)
983
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
984
+ .join('&');
985
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
963
986
  let localVarRequestOptions = {
964
987
  method: 'POST',
965
- qs: localVarQueryParameters,
966
- headers: localVarHeaderParams,
967
- uri: localVarPath,
968
- useQuerystring: this._useQuerystring,
969
- agentOptions: { keepAlive: false },
970
- json: true,
988
+ headers: { ...localVarHeaderParams },
971
989
  };
972
- let authenticationPromise = Promise.resolve();
973
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
974
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
975
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
976
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
977
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
978
- return authenticationPromise.then(() => {
979
- if (Object.keys(localVarFormParams).length) {
980
- if (localVarUseFormData) {
981
- localVarRequestOptions.formData = localVarFormParams;
982
- }
983
- else {
984
- localVarRequestOptions.form = localVarFormParams;
985
- }
990
+ let requestOptions = localVarRequestOptions;
991
+ let url = localVarUrl;
992
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
993
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
994
+ url = auth_ApiKeyAuthentication.url;
995
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
996
+ requestOptions = auth_JWTAuthentication.requestOptions;
997
+ url = auth_JWTAuthentication.url;
998
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
999
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1000
+ url = auth_JWTHttpHeaderAuthentication.url;
1001
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1002
+ requestOptions = auth_OAuth2.requestOptions;
1003
+ url = auth_OAuth2.url;
1004
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1005
+ requestOptions = authDefault.requestOptions;
1006
+ url = authDefault.url;
1007
+ if (localVarFormParams) {
1008
+ delete requestOptions.headers['Content-Type'];
1009
+ if (localVarFormParams instanceof FormData) {
1010
+ // FormData: fetch will handle Content-Type automatically.
1011
+ requestOptions.body = localVarFormParams;
986
1012
  }
987
- return new Promise((resolve, reject) => {
988
- localVarRequest(localVarRequestOptions, (error, response, body) => {
989
- if (error) {
990
- reject(error);
991
- }
992
- else {
993
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
994
- if (typeof body.success === 'boolean' && !body.success) {
995
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
996
- reject(new Error(body.error || errString));
997
- }
998
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
999
- resolve(body);
1000
- }
1001
- else {
1002
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1003
- reject(errString);
1004
- }
1005
- }
1006
- });
1007
- });
1008
- });
1013
+ else if (Object.keys(localVarFormParams).length > 0) {
1014
+ // URL-encoded form
1015
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1016
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1017
+ }
1018
+ }
1019
+ const response = await fetch(url, requestOptions);
1020
+ return this.handleResponse(response, 'GenericApiResponse');
1009
1021
  }
1010
1022
  /**
1011
1023
  * Update the properties of a transformation job.
@@ -1019,9 +1031,11 @@ class OrganizationCreateProjectApi {
1019
1031
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
1020
1032
  .replace('{' + 'createProjectId' + '}', encodeURIComponent(String(createProjectId)));
1021
1033
  let localVarQueryParameters = {};
1022
- let localVarHeaderParams = Object.assign({
1023
- 'User-Agent': 'edgeimpulse-api nodejs'
1024
- }, this.defaultHeaders);
1034
+ let localVarHeaderParams = {
1035
+ 'User-Agent': 'edgeimpulse-api nodejs',
1036
+ 'Content-Type': 'application/json',
1037
+ ...this.defaultHeaders,
1038
+ };
1025
1039
  const produces = ['application/json'];
1026
1040
  // give precedence to 'application/json'
1027
1041
  if (produces.indexOf('application/json') >= 0) {
@@ -1030,7 +1044,7 @@ class OrganizationCreateProjectApi {
1030
1044
  else {
1031
1045
  localVarHeaderParams.Accept = produces.join(',');
1032
1046
  }
1033
- let localVarFormParams = {};
1047
+ let localVarFormParams;
1034
1048
  // verify required parameter 'organizationId' is not null or undefined
1035
1049
  if (organizationId === null || organizationId === undefined) {
1036
1050
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationCreateProject.');
@@ -1043,56 +1057,52 @@ class OrganizationCreateProjectApi {
1043
1057
  if (updateOrganizationCreateProjectRequest === null || updateOrganizationCreateProjectRequest === undefined) {
1044
1058
  throw new Error('Required parameter updateOrganizationCreateProjectRequest was null or undefined when calling updateOrganizationCreateProject.');
1045
1059
  }
1046
- Object.assign(localVarHeaderParams, options.headers);
1047
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1048
- let localVarUseFormData = false;
1060
+ localVarHeaderParams = {
1061
+ ...localVarHeaderParams,
1062
+ ...options.headers,
1063
+ ...this.opts.extraHeaders,
1064
+ };
1065
+ const queryString = Object.entries(localVarQueryParameters)
1066
+ .filter(([, value]) => value !== undefined)
1067
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1068
+ .join('&');
1069
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1049
1070
  let localVarRequestOptions = {
1050
1071
  method: 'POST',
1051
- qs: localVarQueryParameters,
1052
- headers: localVarHeaderParams,
1053
- uri: localVarPath,
1054
- useQuerystring: this._useQuerystring,
1055
- agentOptions: { keepAlive: false },
1056
- json: true,
1057
- body: models_1.ObjectSerializer.serialize(updateOrganizationCreateProjectRequest, "UpdateOrganizationCreateProjectRequest")
1072
+ headers: { ...localVarHeaderParams },
1058
1073
  };
1059
- let authenticationPromise = Promise.resolve();
1060
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1061
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1062
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1063
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1064
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1065
- return authenticationPromise.then(() => {
1066
- if (Object.keys(localVarFormParams).length) {
1067
- if (localVarUseFormData) {
1068
- localVarRequestOptions.formData = localVarFormParams;
1069
- }
1070
- else {
1071
- localVarRequestOptions.form = localVarFormParams;
1072
- }
1074
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateOrganizationCreateProjectRequest, "UpdateOrganizationCreateProjectRequest"));
1075
+ let requestOptions = localVarRequestOptions;
1076
+ let url = localVarUrl;
1077
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1078
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1079
+ url = auth_ApiKeyAuthentication.url;
1080
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1081
+ requestOptions = auth_JWTAuthentication.requestOptions;
1082
+ url = auth_JWTAuthentication.url;
1083
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1084
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1085
+ url = auth_JWTHttpHeaderAuthentication.url;
1086
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1087
+ requestOptions = auth_OAuth2.requestOptions;
1088
+ url = auth_OAuth2.url;
1089
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1090
+ requestOptions = authDefault.requestOptions;
1091
+ url = authDefault.url;
1092
+ if (localVarFormParams) {
1093
+ delete requestOptions.headers['Content-Type'];
1094
+ if (localVarFormParams instanceof FormData) {
1095
+ // FormData: fetch will handle Content-Type automatically.
1096
+ requestOptions.body = localVarFormParams;
1073
1097
  }
1074
- return new Promise((resolve, reject) => {
1075
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1076
- if (error) {
1077
- reject(error);
1078
- }
1079
- else {
1080
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
1081
- if (typeof body.success === 'boolean' && !body.success) {
1082
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1083
- reject(new Error(body.error || errString));
1084
- }
1085
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1086
- resolve(body);
1087
- }
1088
- else {
1089
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1090
- reject(errString);
1091
- }
1092
- }
1093
- });
1094
- });
1095
- });
1098
+ else if (Object.keys(localVarFormParams).length > 0) {
1099
+ // URL-encoded form
1100
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1101
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1102
+ }
1103
+ }
1104
+ const response = await fetch(url, requestOptions);
1105
+ return this.handleResponse(response, 'GenericApiResponse');
1096
1106
  }
1097
1107
  /**
1098
1108
  * Upload a zip file containing a custom transformation or deployment block.
@@ -1106,9 +1116,11 @@ class OrganizationCreateProjectApi {
1106
1116
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/custom-block'
1107
1117
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
1108
1118
  let localVarQueryParameters = {};
1109
- let localVarHeaderParams = Object.assign({
1110
- 'User-Agent': 'edgeimpulse-api nodejs'
1111
- }, this.defaultHeaders);
1119
+ let localVarHeaderParams = {
1120
+ 'User-Agent': 'edgeimpulse-api nodejs',
1121
+ 'Content-Type': 'application/json',
1122
+ ...this.defaultHeaders,
1123
+ };
1112
1124
  const produces = ['application/json'];
1113
1125
  // give precedence to 'application/json'
1114
1126
  if (produces.indexOf('application/json') >= 0) {
@@ -1117,7 +1129,7 @@ class OrganizationCreateProjectApi {
1117
1129
  else {
1118
1130
  localVarHeaderParams.Accept = produces.join(',');
1119
1131
  }
1120
- let localVarFormParams = {};
1132
+ let localVarFormParams;
1121
1133
  // verify required parameter 'organizationId' is not null or undefined
1122
1134
  if (organizationId === null || organizationId === undefined) {
1123
1135
  throw new Error('Required parameter organizationId was null or undefined when calling uploadCustomBlock.');
@@ -1134,65 +1146,101 @@ class OrganizationCreateProjectApi {
1134
1146
  if (params.blockId === null || params.blockId === undefined) {
1135
1147
  throw new Error('Required parameter params.blockId was null or undefined when calling uploadCustomBlock.');
1136
1148
  }
1137
- Object.assign(localVarHeaderParams, options.headers);
1138
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
1139
- let localVarUseFormData = false;
1149
+ localVarHeaderParams = {
1150
+ ...localVarHeaderParams,
1151
+ ...options.headers,
1152
+ ...this.opts.extraHeaders,
1153
+ };
1140
1154
  if (params.tar !== undefined) {
1141
- localVarFormParams['tar'] = params.tar;
1155
+ if (!(localVarFormParams instanceof FormData)) {
1156
+ const existingParams = localVarFormParams;
1157
+ localVarFormParams = new FormData();
1158
+ if (existingParams && typeof existingParams === 'object') {
1159
+ Object.keys(existingParams).forEach(key => {
1160
+ localVarFormParams.append(key, existingParams[key]);
1161
+ });
1162
+ }
1163
+ }
1164
+ const tarFiles = Array.isArray(params.tar) ? params.tar : [params.tar];
1165
+ const Blob = globalThis.Blob || require('buffer').Blob;
1166
+ tarFiles.forEach((f) => {
1167
+ localVarFormParams.append('tar', new Blob([f.value], {
1168
+ type: f.options.contentType
1169
+ }), f.options.filename);
1170
+ });
1142
1171
  }
1143
- localVarUseFormData = true;
1144
1172
  if (params.type !== undefined) {
1145
- localVarFormParams['type'] = models_1.ObjectSerializer.serializeFormData(params.type, "string");
1173
+ const isParametersField = "type" === "parameters";
1174
+ const serializableParams = isParametersField && params && ("parameters" in params);
1175
+ const typeSerialized = serializableParams
1176
+ ? JSON.stringify(params.parameters)
1177
+ : models_1.ObjectSerializer.serializeFormData(params.type, "string");
1178
+ if (localVarFormParams instanceof FormData) {
1179
+ localVarFormParams.append('type', typeSerialized);
1180
+ }
1181
+ else {
1182
+ if (!localVarFormParams) {
1183
+ localVarFormParams = {};
1184
+ }
1185
+ localVarFormParams['type'] = typeSerialized;
1186
+ }
1146
1187
  }
1147
1188
  if (params.blockId !== undefined) {
1148
- localVarFormParams['blockId'] = models_1.ObjectSerializer.serializeFormData(params.blockId, "number");
1189
+ const isParametersField = "blockId" === "parameters";
1190
+ const serializableParams = isParametersField && params && ("parameters" in params);
1191
+ const blockIdSerialized = serializableParams
1192
+ ? JSON.stringify(params.parameters)
1193
+ : models_1.ObjectSerializer.serializeFormData(params.blockId, "number");
1194
+ if (localVarFormParams instanceof FormData) {
1195
+ localVarFormParams.append('blockId', blockIdSerialized);
1196
+ }
1197
+ else {
1198
+ if (!localVarFormParams) {
1199
+ localVarFormParams = {};
1200
+ }
1201
+ localVarFormParams['blockId'] = blockIdSerialized;
1202
+ }
1149
1203
  }
1204
+ const queryString = Object.entries(localVarQueryParameters)
1205
+ .filter(([, value]) => value !== undefined)
1206
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1207
+ .join('&');
1208
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1150
1209
  let localVarRequestOptions = {
1151
1210
  method: 'POST',
1152
- qs: localVarQueryParameters,
1153
- headers: localVarHeaderParams,
1154
- uri: localVarPath,
1155
- useQuerystring: this._useQuerystring,
1156
- agentOptions: { keepAlive: false },
1157
- json: true,
1211
+ headers: { ...localVarHeaderParams },
1158
1212
  };
1159
- let authenticationPromise = Promise.resolve();
1160
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
1161
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
1162
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
1163
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
1164
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1165
- return authenticationPromise.then(() => {
1166
- if (Object.keys(localVarFormParams).length) {
1167
- if (localVarUseFormData) {
1168
- localVarRequestOptions.formData = localVarFormParams;
1169
- }
1170
- else {
1171
- localVarRequestOptions.form = localVarFormParams;
1172
- }
1213
+ let requestOptions = localVarRequestOptions;
1214
+ let url = localVarUrl;
1215
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1216
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1217
+ url = auth_ApiKeyAuthentication.url;
1218
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1219
+ requestOptions = auth_JWTAuthentication.requestOptions;
1220
+ url = auth_JWTAuthentication.url;
1221
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1222
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1223
+ url = auth_JWTHttpHeaderAuthentication.url;
1224
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1225
+ requestOptions = auth_OAuth2.requestOptions;
1226
+ url = auth_OAuth2.url;
1227
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1228
+ requestOptions = authDefault.requestOptions;
1229
+ url = authDefault.url;
1230
+ if (localVarFormParams) {
1231
+ delete requestOptions.headers['Content-Type'];
1232
+ if (localVarFormParams instanceof FormData) {
1233
+ // FormData: fetch will handle Content-Type automatically.
1234
+ requestOptions.body = localVarFormParams;
1173
1235
  }
1174
- return new Promise((resolve, reject) => {
1175
- localVarRequest(localVarRequestOptions, (error, response, body) => {
1176
- if (error) {
1177
- reject(error);
1178
- }
1179
- else {
1180
- body = models_1.ObjectSerializer.deserialize(body, "StartJobResponse");
1181
- if (typeof body.success === 'boolean' && !body.success) {
1182
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1183
- reject(new Error(body.error || errString));
1184
- }
1185
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1186
- resolve(body);
1187
- }
1188
- else {
1189
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
1190
- reject(errString);
1191
- }
1192
- }
1193
- });
1194
- });
1195
- });
1236
+ else if (Object.keys(localVarFormParams).length > 0) {
1237
+ // URL-encoded form
1238
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
1239
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
1240
+ }
1241
+ }
1242
+ const response = await fetch(url, requestOptions);
1243
+ return this.handleResponse(response, 'StartJobResponse');
1196
1244
  }
1197
1245
  }
1198
1246
  exports.OrganizationCreateProjectApi = OrganizationCreateProjectApi;