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.OrganizationPipelinesApi = exports.OrganizationPipelinesApiApiKeys = 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 OrganizationPipelinesApiApiKeys;
30
47
  OrganizationPipelinesApiApiKeys[OrganizationPipelinesApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
31
48
  })(OrganizationPipelinesApiApiKeys = exports.OrganizationPipelinesApiApiKeys || (exports.OrganizationPipelinesApiApiKeys = {}));
32
49
  class OrganizationPipelinesApi {
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 OrganizationPipelinesApi {
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
  }
@@ -88,9 +122,11 @@ class OrganizationPipelinesApi {
88
122
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/pipelines'
89
123
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
90
124
  let localVarQueryParameters = {};
91
- let localVarHeaderParams = Object.assign({
92
- 'User-Agent': 'edgeimpulse-api nodejs'
93
- }, this.defaultHeaders);
125
+ let localVarHeaderParams = {
126
+ 'User-Agent': 'edgeimpulse-api nodejs',
127
+ 'Content-Type': 'application/json',
128
+ ...this.defaultHeaders,
129
+ };
94
130
  const produces = ['application/json'];
95
131
  // give precedence to 'application/json'
96
132
  if (produces.indexOf('application/json') >= 0) {
@@ -99,7 +135,7 @@ class OrganizationPipelinesApi {
99
135
  else {
100
136
  localVarHeaderParams.Accept = produces.join(',');
101
137
  }
102
- let localVarFormParams = {};
138
+ let localVarFormParams;
103
139
  // verify required parameter 'organizationId' is not null or undefined
104
140
  if (organizationId === null || organizationId === undefined) {
105
141
  throw new Error('Required parameter organizationId was null or undefined when calling createOrganizationPipeline.');
@@ -108,56 +144,52 @@ class OrganizationPipelinesApi {
108
144
  if (organizationUpdatePipelineBody === null || organizationUpdatePipelineBody === undefined) {
109
145
  throw new Error('Required parameter organizationUpdatePipelineBody was null or undefined when calling createOrganizationPipeline.');
110
146
  }
111
- Object.assign(localVarHeaderParams, options.headers);
112
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
113
- let localVarUseFormData = false;
147
+ localVarHeaderParams = {
148
+ ...localVarHeaderParams,
149
+ ...options.headers,
150
+ ...this.opts.extraHeaders,
151
+ };
152
+ const queryString = Object.entries(localVarQueryParameters)
153
+ .filter(([, value]) => value !== undefined)
154
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
155
+ .join('&');
156
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
114
157
  let localVarRequestOptions = {
115
158
  method: 'POST',
116
- qs: localVarQueryParameters,
117
- headers: localVarHeaderParams,
118
- uri: localVarPath,
119
- useQuerystring: this._useQuerystring,
120
- agentOptions: { keepAlive: false },
121
- json: true,
122
- body: models_1.ObjectSerializer.serialize(organizationUpdatePipelineBody, "OrganizationUpdatePipelineBody")
159
+ headers: { ...localVarHeaderParams },
123
160
  };
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
- }
161
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(organizationUpdatePipelineBody, "OrganizationUpdatePipelineBody"));
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;
184
+ }
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';
138
189
  }
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, "EntityCreatedResponse");
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
- });
190
+ }
191
+ const response = await fetch(url, requestOptions);
192
+ return this.handleResponse(response, 'EntityCreatedResponse');
161
193
  }
162
194
  /**
163
195
  * Delete an organizational pipelines
@@ -170,9 +202,11 @@ class OrganizationPipelinesApi {
170
202
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
171
203
  .replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
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 OrganizationPipelinesApi {
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 deleteOrganizationPipeline.');
@@ -190,55 +224,51 @@ class OrganizationPipelinesApi {
190
224
  if (pipelineId === null || pipelineId === undefined) {
191
225
  throw new Error('Required parameter pipelineId was null or undefined when calling deleteOrganizationPipeline.');
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
  * Retrieve an organizational pipelines
@@ -251,9 +281,11 @@ class OrganizationPipelinesApi {
251
281
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
252
282
  .replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
253
283
  let localVarQueryParameters = {};
254
- let localVarHeaderParams = Object.assign({
255
- 'User-Agent': 'edgeimpulse-api nodejs'
256
- }, this.defaultHeaders);
284
+ let localVarHeaderParams = {
285
+ 'User-Agent': 'edgeimpulse-api nodejs',
286
+ 'Content-Type': 'application/json',
287
+ ...this.defaultHeaders,
288
+ };
257
289
  const produces = ['application/json'];
258
290
  // give precedence to 'application/json'
259
291
  if (produces.indexOf('application/json') >= 0) {
@@ -262,7 +294,7 @@ class OrganizationPipelinesApi {
262
294
  else {
263
295
  localVarHeaderParams.Accept = produces.join(',');
264
296
  }
265
- let localVarFormParams = {};
297
+ let localVarFormParams;
266
298
  // verify required parameter 'organizationId' is not null or undefined
267
299
  if (organizationId === null || organizationId === undefined) {
268
300
  throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationPipeline.');
@@ -271,55 +303,51 @@ class OrganizationPipelinesApi {
271
303
  if (pipelineId === null || pipelineId === undefined) {
272
304
  throw new Error('Required parameter pipelineId was null or undefined when calling getOrganizationPipeline.');
273
305
  }
274
- Object.assign(localVarHeaderParams, options.headers);
275
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
276
- let localVarUseFormData = false;
306
+ localVarHeaderParams = {
307
+ ...localVarHeaderParams,
308
+ ...options.headers,
309
+ ...this.opts.extraHeaders,
310
+ };
311
+ const queryString = Object.entries(localVarQueryParameters)
312
+ .filter(([, value]) => value !== undefined)
313
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
314
+ .join('&');
315
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
277
316
  let localVarRequestOptions = {
278
317
  method: 'GET',
279
- qs: localVarQueryParameters,
280
- headers: localVarHeaderParams,
281
- uri: localVarPath,
282
- useQuerystring: this._useQuerystring,
283
- agentOptions: { keepAlive: false },
284
- json: true,
318
+ headers: { ...localVarHeaderParams },
285
319
  };
286
- let authenticationPromise = Promise.resolve();
287
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
288
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
289
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
290
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
291
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
292
- return authenticationPromise.then(() => {
293
- if (Object.keys(localVarFormParams).length) {
294
- if (localVarUseFormData) {
295
- localVarRequestOptions.formData = localVarFormParams;
296
- }
297
- else {
298
- localVarRequestOptions.form = localVarFormParams;
299
- }
320
+ let requestOptions = localVarRequestOptions;
321
+ let url = localVarUrl;
322
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
323
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
324
+ url = auth_ApiKeyAuthentication.url;
325
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
326
+ requestOptions = auth_JWTAuthentication.requestOptions;
327
+ url = auth_JWTAuthentication.url;
328
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
329
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
330
+ url = auth_JWTHttpHeaderAuthentication.url;
331
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
332
+ requestOptions = auth_OAuth2.requestOptions;
333
+ url = auth_OAuth2.url;
334
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
335
+ requestOptions = authDefault.requestOptions;
336
+ url = authDefault.url;
337
+ if (localVarFormParams) {
338
+ delete requestOptions.headers['Content-Type'];
339
+ if (localVarFormParams instanceof FormData) {
340
+ // FormData: fetch will handle Content-Type automatically.
341
+ requestOptions.body = localVarFormParams;
342
+ }
343
+ else if (Object.keys(localVarFormParams).length > 0) {
344
+ // URL-encoded form
345
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
346
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
300
347
  }
301
- return new Promise((resolve, reject) => {
302
- localVarRequest(localVarRequestOptions, (error, response, body) => {
303
- if (error) {
304
- reject(error);
305
- }
306
- else {
307
- body = models_1.ObjectSerializer.deserialize(body, "GetOrganizationPipelinesResponse");
308
- if (typeof body.success === 'boolean' && !body.success) {
309
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
310
- reject(new Error(body.error || errString));
311
- }
312
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
313
- resolve(body);
314
- }
315
- else {
316
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
317
- reject(errString);
318
- }
319
- }
320
- });
321
- });
322
- });
348
+ }
349
+ const response = await fetch(url, requestOptions);
350
+ return this.handleResponse(response, 'GetOrganizationPipelinesResponse');
323
351
  }
324
352
  /**
325
353
  * Retrieve all archived organizational pipelines
@@ -331,9 +359,11 @@ class OrganizationPipelinesApi {
331
359
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/pipelines/archived'
332
360
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
333
361
  let localVarQueryParameters = {};
334
- let localVarHeaderParams = Object.assign({
335
- 'User-Agent': 'edgeimpulse-api nodejs'
336
- }, this.defaultHeaders);
362
+ let localVarHeaderParams = {
363
+ 'User-Agent': 'edgeimpulse-api nodejs',
364
+ 'Content-Type': 'application/json',
365
+ ...this.defaultHeaders,
366
+ };
337
367
  const produces = ['application/json'];
338
368
  // give precedence to 'application/json'
339
369
  if (produces.indexOf('application/json') >= 0) {
@@ -342,7 +372,7 @@ class OrganizationPipelinesApi {
342
372
  else {
343
373
  localVarHeaderParams.Accept = produces.join(',');
344
374
  }
345
- let localVarFormParams = {};
375
+ let localVarFormParams;
346
376
  // verify required parameter 'organizationId' is not null or undefined
347
377
  if (organizationId === null || organizationId === undefined) {
348
378
  throw new Error('Required parameter organizationId was null or undefined when calling listArchivedOrganizationPipelines.');
@@ -350,55 +380,51 @@ class OrganizationPipelinesApi {
350
380
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.projectId) !== undefined) {
351
381
  localVarQueryParameters['projectId'] = models_1.ObjectSerializer.serialize(queryParams.projectId, "number");
352
382
  }
353
- Object.assign(localVarHeaderParams, options.headers);
354
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
355
- let localVarUseFormData = false;
383
+ localVarHeaderParams = {
384
+ ...localVarHeaderParams,
385
+ ...options.headers,
386
+ ...this.opts.extraHeaders,
387
+ };
388
+ const queryString = Object.entries(localVarQueryParameters)
389
+ .filter(([, value]) => value !== undefined)
390
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
391
+ .join('&');
392
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
356
393
  let localVarRequestOptions = {
357
394
  method: 'GET',
358
- qs: localVarQueryParameters,
359
- headers: localVarHeaderParams,
360
- uri: localVarPath,
361
- useQuerystring: this._useQuerystring,
362
- agentOptions: { keepAlive: false },
363
- json: true,
395
+ headers: { ...localVarHeaderParams },
364
396
  };
365
- let authenticationPromise = Promise.resolve();
366
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
367
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
368
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
369
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
370
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
371
- return authenticationPromise.then(() => {
372
- if (Object.keys(localVarFormParams).length) {
373
- if (localVarUseFormData) {
374
- localVarRequestOptions.formData = localVarFormParams;
375
- }
376
- else {
377
- localVarRequestOptions.form = localVarFormParams;
378
- }
397
+ let requestOptions = localVarRequestOptions;
398
+ let url = localVarUrl;
399
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
400
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
401
+ url = auth_ApiKeyAuthentication.url;
402
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
403
+ requestOptions = auth_JWTAuthentication.requestOptions;
404
+ url = auth_JWTAuthentication.url;
405
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
406
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
407
+ url = auth_JWTHttpHeaderAuthentication.url;
408
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
409
+ requestOptions = auth_OAuth2.requestOptions;
410
+ url = auth_OAuth2.url;
411
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
412
+ requestOptions = authDefault.requestOptions;
413
+ url = authDefault.url;
414
+ if (localVarFormParams) {
415
+ delete requestOptions.headers['Content-Type'];
416
+ if (localVarFormParams instanceof FormData) {
417
+ // FormData: fetch will handle Content-Type automatically.
418
+ requestOptions.body = localVarFormParams;
379
419
  }
380
- return new Promise((resolve, reject) => {
381
- localVarRequest(localVarRequestOptions, (error, response, body) => {
382
- if (error) {
383
- reject(error);
384
- }
385
- else {
386
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationPipelinesResponse");
387
- if (typeof body.success === 'boolean' && !body.success) {
388
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
389
- reject(new Error(body.error || errString));
390
- }
391
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
392
- resolve(body);
393
- }
394
- else {
395
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
396
- reject(errString);
397
- }
398
- }
399
- });
400
- });
401
- });
420
+ else if (Object.keys(localVarFormParams).length > 0) {
421
+ // URL-encoded form
422
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
423
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
424
+ }
425
+ }
426
+ const response = await fetch(url, requestOptions);
427
+ return this.handleResponse(response, 'ListOrganizationPipelinesResponse');
402
428
  }
403
429
  /**
404
430
  * Retrieve all organizational pipelines
@@ -410,9 +436,11 @@ class OrganizationPipelinesApi {
410
436
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/pipelines'
411
437
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
412
438
  let localVarQueryParameters = {};
413
- let localVarHeaderParams = Object.assign({
414
- 'User-Agent': 'edgeimpulse-api nodejs'
415
- }, this.defaultHeaders);
439
+ let localVarHeaderParams = {
440
+ 'User-Agent': 'edgeimpulse-api nodejs',
441
+ 'Content-Type': 'application/json',
442
+ ...this.defaultHeaders,
443
+ };
416
444
  const produces = ['application/json'];
417
445
  // give precedence to 'application/json'
418
446
  if (produces.indexOf('application/json') >= 0) {
@@ -421,7 +449,7 @@ class OrganizationPipelinesApi {
421
449
  else {
422
450
  localVarHeaderParams.Accept = produces.join(',');
423
451
  }
424
- let localVarFormParams = {};
452
+ let localVarFormParams;
425
453
  // verify required parameter 'organizationId' is not null or undefined
426
454
  if (organizationId === null || organizationId === undefined) {
427
455
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationPipelines.');
@@ -429,55 +457,51 @@ class OrganizationPipelinesApi {
429
457
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.projectId) !== undefined) {
430
458
  localVarQueryParameters['projectId'] = models_1.ObjectSerializer.serialize(queryParams.projectId, "number");
431
459
  }
432
- Object.assign(localVarHeaderParams, options.headers);
433
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
434
- let localVarUseFormData = false;
460
+ localVarHeaderParams = {
461
+ ...localVarHeaderParams,
462
+ ...options.headers,
463
+ ...this.opts.extraHeaders,
464
+ };
465
+ const queryString = Object.entries(localVarQueryParameters)
466
+ .filter(([, value]) => value !== undefined)
467
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
468
+ .join('&');
469
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
435
470
  let localVarRequestOptions = {
436
471
  method: 'GET',
437
- qs: localVarQueryParameters,
438
- headers: localVarHeaderParams,
439
- uri: localVarPath,
440
- useQuerystring: this._useQuerystring,
441
- agentOptions: { keepAlive: false },
442
- json: true,
472
+ headers: { ...localVarHeaderParams },
443
473
  };
444
- let authenticationPromise = Promise.resolve();
445
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
446
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
447
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
448
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
449
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
450
- return authenticationPromise.then(() => {
451
- if (Object.keys(localVarFormParams).length) {
452
- if (localVarUseFormData) {
453
- localVarRequestOptions.formData = localVarFormParams;
454
- }
455
- else {
456
- localVarRequestOptions.form = localVarFormParams;
457
- }
474
+ let requestOptions = localVarRequestOptions;
475
+ let url = localVarUrl;
476
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
477
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
478
+ url = auth_ApiKeyAuthentication.url;
479
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
480
+ requestOptions = auth_JWTAuthentication.requestOptions;
481
+ url = auth_JWTAuthentication.url;
482
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
483
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
484
+ url = auth_JWTHttpHeaderAuthentication.url;
485
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
486
+ requestOptions = auth_OAuth2.requestOptions;
487
+ url = auth_OAuth2.url;
488
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
489
+ requestOptions = authDefault.requestOptions;
490
+ url = authDefault.url;
491
+ if (localVarFormParams) {
492
+ delete requestOptions.headers['Content-Type'];
493
+ if (localVarFormParams instanceof FormData) {
494
+ // FormData: fetch will handle Content-Type automatically.
495
+ requestOptions.body = localVarFormParams;
496
+ }
497
+ else if (Object.keys(localVarFormParams).length > 0) {
498
+ // URL-encoded form
499
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
500
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
458
501
  }
459
- return new Promise((resolve, reject) => {
460
- localVarRequest(localVarRequestOptions, (error, response, body) => {
461
- if (error) {
462
- reject(error);
463
- }
464
- else {
465
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationPipelinesResponse");
466
- if (typeof body.success === 'boolean' && !body.success) {
467
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
468
- reject(new Error(body.error || errString));
469
- }
470
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
471
- resolve(body);
472
- }
473
- else {
474
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
475
- reject(errString);
476
- }
477
- }
478
- });
479
- });
480
- });
502
+ }
503
+ const response = await fetch(url, requestOptions);
504
+ return this.handleResponse(response, 'ListOrganizationPipelinesResponse');
481
505
  }
482
506
  /**
483
507
  * Run an organizational pipeline
@@ -491,9 +515,11 @@ class OrganizationPipelinesApi {
491
515
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
492
516
  .replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
493
517
  let localVarQueryParameters = {};
494
- let localVarHeaderParams = Object.assign({
495
- 'User-Agent': 'edgeimpulse-api nodejs'
496
- }, this.defaultHeaders);
518
+ let localVarHeaderParams = {
519
+ 'User-Agent': 'edgeimpulse-api nodejs',
520
+ 'Content-Type': 'application/json',
521
+ ...this.defaultHeaders,
522
+ };
497
523
  const produces = ['application/json'];
498
524
  // give precedence to 'application/json'
499
525
  if (produces.indexOf('application/json') >= 0) {
@@ -502,7 +528,7 @@ class OrganizationPipelinesApi {
502
528
  else {
503
529
  localVarHeaderParams.Accept = produces.join(',');
504
530
  }
505
- let localVarFormParams = {};
531
+ let localVarFormParams;
506
532
  // verify required parameter 'organizationId' is not null or undefined
507
533
  if (organizationId === null || organizationId === undefined) {
508
534
  throw new Error('Required parameter organizationId was null or undefined when calling runOrganizationPipeline.');
@@ -514,55 +540,51 @@ class OrganizationPipelinesApi {
514
540
  if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.ignoreLastSuccessfulRun) !== undefined) {
515
541
  localVarQueryParameters['ignoreLastSuccessfulRun'] = models_1.ObjectSerializer.serialize(queryParams.ignoreLastSuccessfulRun, "boolean");
516
542
  }
517
- Object.assign(localVarHeaderParams, options.headers);
518
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
519
- let localVarUseFormData = false;
543
+ localVarHeaderParams = {
544
+ ...localVarHeaderParams,
545
+ ...options.headers,
546
+ ...this.opts.extraHeaders,
547
+ };
548
+ const queryString = Object.entries(localVarQueryParameters)
549
+ .filter(([, value]) => value !== undefined)
550
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
551
+ .join('&');
552
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
520
553
  let localVarRequestOptions = {
521
554
  method: 'POST',
522
- qs: localVarQueryParameters,
523
- headers: localVarHeaderParams,
524
- uri: localVarPath,
525
- useQuerystring: this._useQuerystring,
526
- agentOptions: { keepAlive: false },
527
- json: true,
555
+ headers: { ...localVarHeaderParams },
528
556
  };
529
- let authenticationPromise = Promise.resolve();
530
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
531
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
532
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
533
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
534
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
535
- return authenticationPromise.then(() => {
536
- if (Object.keys(localVarFormParams).length) {
537
- if (localVarUseFormData) {
538
- localVarRequestOptions.formData = localVarFormParams;
539
- }
540
- else {
541
- localVarRequestOptions.form = localVarFormParams;
542
- }
557
+ let requestOptions = localVarRequestOptions;
558
+ let url = localVarUrl;
559
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
560
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
561
+ url = auth_ApiKeyAuthentication.url;
562
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
563
+ requestOptions = auth_JWTAuthentication.requestOptions;
564
+ url = auth_JWTAuthentication.url;
565
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
566
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
567
+ url = auth_JWTHttpHeaderAuthentication.url;
568
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
569
+ requestOptions = auth_OAuth2.requestOptions;
570
+ url = auth_OAuth2.url;
571
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
572
+ requestOptions = authDefault.requestOptions;
573
+ url = authDefault.url;
574
+ if (localVarFormParams) {
575
+ delete requestOptions.headers['Content-Type'];
576
+ if (localVarFormParams instanceof FormData) {
577
+ // FormData: fetch will handle Content-Type automatically.
578
+ requestOptions.body = localVarFormParams;
543
579
  }
544
- return new Promise((resolve, reject) => {
545
- localVarRequest(localVarRequestOptions, (error, response, body) => {
546
- if (error) {
547
- reject(error);
548
- }
549
- else {
550
- body = models_1.ObjectSerializer.deserialize(body, "RunOrganizationPipelineResponse");
551
- if (typeof body.success === 'boolean' && !body.success) {
552
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
553
- reject(new Error(body.error || errString));
554
- }
555
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
556
- resolve(body);
557
- }
558
- else {
559
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
560
- reject(errString);
561
- }
562
- }
563
- });
564
- });
565
- });
580
+ else if (Object.keys(localVarFormParams).length > 0) {
581
+ // URL-encoded form
582
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
583
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
584
+ }
585
+ }
586
+ const response = await fetch(url, requestOptions);
587
+ return this.handleResponse(response, 'RunOrganizationPipelineResponse');
566
588
  }
567
589
  /**
568
590
  * Stops the pipeline, and marks it as failed.
@@ -575,9 +597,11 @@ class OrganizationPipelinesApi {
575
597
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
576
598
  .replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
577
599
  let localVarQueryParameters = {};
578
- let localVarHeaderParams = Object.assign({
579
- 'User-Agent': 'edgeimpulse-api nodejs'
580
- }, this.defaultHeaders);
600
+ let localVarHeaderParams = {
601
+ 'User-Agent': 'edgeimpulse-api nodejs',
602
+ 'Content-Type': 'application/json',
603
+ ...this.defaultHeaders,
604
+ };
581
605
  const produces = ['application/json'];
582
606
  // give precedence to 'application/json'
583
607
  if (produces.indexOf('application/json') >= 0) {
@@ -586,7 +610,7 @@ class OrganizationPipelinesApi {
586
610
  else {
587
611
  localVarHeaderParams.Accept = produces.join(',');
588
612
  }
589
- let localVarFormParams = {};
613
+ let localVarFormParams;
590
614
  // verify required parameter 'organizationId' is not null or undefined
591
615
  if (organizationId === null || organizationId === undefined) {
592
616
  throw new Error('Required parameter organizationId was null or undefined when calling stopOrganizationPipeline.');
@@ -595,55 +619,51 @@ class OrganizationPipelinesApi {
595
619
  if (pipelineId === null || pipelineId === undefined) {
596
620
  throw new Error('Required parameter pipelineId was null or undefined when calling stopOrganizationPipeline.');
597
621
  }
598
- Object.assign(localVarHeaderParams, options.headers);
599
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
600
- let localVarUseFormData = false;
622
+ localVarHeaderParams = {
623
+ ...localVarHeaderParams,
624
+ ...options.headers,
625
+ ...this.opts.extraHeaders,
626
+ };
627
+ const queryString = Object.entries(localVarQueryParameters)
628
+ .filter(([, value]) => value !== undefined)
629
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
630
+ .join('&');
631
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
601
632
  let localVarRequestOptions = {
602
633
  method: 'POST',
603
- qs: localVarQueryParameters,
604
- headers: localVarHeaderParams,
605
- uri: localVarPath,
606
- useQuerystring: this._useQuerystring,
607
- agentOptions: { keepAlive: false },
608
- json: true,
634
+ headers: { ...localVarHeaderParams },
609
635
  };
610
- let authenticationPromise = Promise.resolve();
611
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
612
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
613
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
614
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
615
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
616
- return authenticationPromise.then(() => {
617
- if (Object.keys(localVarFormParams).length) {
618
- if (localVarUseFormData) {
619
- localVarRequestOptions.formData = localVarFormParams;
620
- }
621
- else {
622
- localVarRequestOptions.form = localVarFormParams;
623
- }
636
+ let requestOptions = localVarRequestOptions;
637
+ let url = localVarUrl;
638
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
639
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
640
+ url = auth_ApiKeyAuthentication.url;
641
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
642
+ requestOptions = auth_JWTAuthentication.requestOptions;
643
+ url = auth_JWTAuthentication.url;
644
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
645
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
646
+ url = auth_JWTHttpHeaderAuthentication.url;
647
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
648
+ requestOptions = auth_OAuth2.requestOptions;
649
+ url = auth_OAuth2.url;
650
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
651
+ requestOptions = authDefault.requestOptions;
652
+ url = authDefault.url;
653
+ if (localVarFormParams) {
654
+ delete requestOptions.headers['Content-Type'];
655
+ if (localVarFormParams instanceof FormData) {
656
+ // FormData: fetch will handle Content-Type automatically.
657
+ requestOptions.body = localVarFormParams;
658
+ }
659
+ else if (Object.keys(localVarFormParams).length > 0) {
660
+ // URL-encoded form
661
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
662
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
624
663
  }
625
- return new Promise((resolve, reject) => {
626
- localVarRequest(localVarRequestOptions, (error, response, body) => {
627
- if (error) {
628
- reject(error);
629
- }
630
- else {
631
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
632
- if (typeof body.success === 'boolean' && !body.success) {
633
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
634
- reject(new Error(body.error || errString));
635
- }
636
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
637
- resolve(body);
638
- }
639
- else {
640
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
641
- reject(errString);
642
- }
643
- }
644
- });
645
- });
646
- });
664
+ }
665
+ const response = await fetch(url, requestOptions);
666
+ return this.handleResponse(response, 'GenericApiResponse');
647
667
  }
648
668
  /**
649
669
  * Update an organizational pipelines
@@ -657,9 +677,11 @@ class OrganizationPipelinesApi {
657
677
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
658
678
  .replace('{' + 'pipelineId' + '}', encodeURIComponent(String(pipelineId)));
659
679
  let localVarQueryParameters = {};
660
- let localVarHeaderParams = Object.assign({
661
- 'User-Agent': 'edgeimpulse-api nodejs'
662
- }, this.defaultHeaders);
680
+ let localVarHeaderParams = {
681
+ 'User-Agent': 'edgeimpulse-api nodejs',
682
+ 'Content-Type': 'application/json',
683
+ ...this.defaultHeaders,
684
+ };
663
685
  const produces = ['application/json'];
664
686
  // give precedence to 'application/json'
665
687
  if (produces.indexOf('application/json') >= 0) {
@@ -668,7 +690,7 @@ class OrganizationPipelinesApi {
668
690
  else {
669
691
  localVarHeaderParams.Accept = produces.join(',');
670
692
  }
671
- let localVarFormParams = {};
693
+ let localVarFormParams;
672
694
  // verify required parameter 'organizationId' is not null or undefined
673
695
  if (organizationId === null || organizationId === undefined) {
674
696
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationPipeline.');
@@ -681,56 +703,52 @@ class OrganizationPipelinesApi {
681
703
  if (organizationUpdatePipelineBody === null || organizationUpdatePipelineBody === undefined) {
682
704
  throw new Error('Required parameter organizationUpdatePipelineBody was null or undefined when calling updateOrganizationPipeline.');
683
705
  }
684
- Object.assign(localVarHeaderParams, options.headers);
685
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
686
- let localVarUseFormData = false;
706
+ localVarHeaderParams = {
707
+ ...localVarHeaderParams,
708
+ ...options.headers,
709
+ ...this.opts.extraHeaders,
710
+ };
711
+ const queryString = Object.entries(localVarQueryParameters)
712
+ .filter(([, value]) => value !== undefined)
713
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
714
+ .join('&');
715
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
687
716
  let localVarRequestOptions = {
688
717
  method: 'POST',
689
- qs: localVarQueryParameters,
690
- headers: localVarHeaderParams,
691
- uri: localVarPath,
692
- useQuerystring: this._useQuerystring,
693
- agentOptions: { keepAlive: false },
694
- json: true,
695
- body: models_1.ObjectSerializer.serialize(organizationUpdatePipelineBody, "OrganizationUpdatePipelineBody")
718
+ headers: { ...localVarHeaderParams },
696
719
  };
697
- let authenticationPromise = Promise.resolve();
698
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
699
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
700
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
701
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
702
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
703
- return authenticationPromise.then(() => {
704
- if (Object.keys(localVarFormParams).length) {
705
- if (localVarUseFormData) {
706
- localVarRequestOptions.formData = localVarFormParams;
707
- }
708
- else {
709
- localVarRequestOptions.form = localVarFormParams;
710
- }
720
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(organizationUpdatePipelineBody, "OrganizationUpdatePipelineBody"));
721
+ let requestOptions = localVarRequestOptions;
722
+ let url = localVarUrl;
723
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
724
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
725
+ url = auth_ApiKeyAuthentication.url;
726
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
727
+ requestOptions = auth_JWTAuthentication.requestOptions;
728
+ url = auth_JWTAuthentication.url;
729
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
730
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
731
+ url = auth_JWTHttpHeaderAuthentication.url;
732
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
733
+ requestOptions = auth_OAuth2.requestOptions;
734
+ url = auth_OAuth2.url;
735
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
736
+ requestOptions = authDefault.requestOptions;
737
+ url = authDefault.url;
738
+ if (localVarFormParams) {
739
+ delete requestOptions.headers['Content-Type'];
740
+ if (localVarFormParams instanceof FormData) {
741
+ // FormData: fetch will handle Content-Type automatically.
742
+ requestOptions.body = localVarFormParams;
711
743
  }
712
- return new Promise((resolve, reject) => {
713
- localVarRequest(localVarRequestOptions, (error, response, body) => {
714
- if (error) {
715
- reject(error);
716
- }
717
- else {
718
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
719
- if (typeof body.success === 'boolean' && !body.success) {
720
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
721
- reject(new Error(body.error || errString));
722
- }
723
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
724
- resolve(body);
725
- }
726
- else {
727
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
728
- reject(errString);
729
- }
730
- }
731
- });
732
- });
733
- });
744
+ else if (Object.keys(localVarFormParams).length > 0) {
745
+ // URL-encoded form
746
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
747
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
748
+ }
749
+ }
750
+ const response = await fetch(url, requestOptions);
751
+ return this.handleResponse(response, 'GenericApiResponse');
734
752
  }
735
753
  }
736
754
  exports.OrganizationPipelinesApi = OrganizationPipelinesApi;