edge-impulse-api 1.82.6 → 1.82.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/build/library/sdk/api/adminApi.d.ts +4 -6
  2. package/build/library/sdk/api/adminApi.js +4782 -4928
  3. package/build/library/sdk/api/adminApi.js.map +1 -1
  4. package/build/library/sdk/api/authApi.d.ts +4 -6
  5. package/build/library/sdk/api/authApi.js +88 -56
  6. package/build/library/sdk/api/authApi.js.map +1 -1
  7. package/build/library/sdk/api/cDNApi.d.ts +4 -6
  8. package/build/library/sdk/api/cDNApi.js +76 -53
  9. package/build/library/sdk/api/cDNApi.js.map +1 -1
  10. package/build/library/sdk/api/canaryApi.d.ts +4 -6
  11. package/build/library/sdk/api/canaryApi.js +79 -53
  12. package/build/library/sdk/api/canaryApi.js.map +1 -1
  13. package/build/library/sdk/api/classifyApi.d.ts +4 -6
  14. package/build/library/sdk/api/classifyApi.js +527 -499
  15. package/build/library/sdk/api/classifyApi.js.map +1 -1
  16. package/build/library/sdk/api/dSPApi.d.ts +4 -6
  17. package/build/library/sdk/api/dSPApi.js +938 -942
  18. package/build/library/sdk/api/dSPApi.js.map +1 -1
  19. package/build/library/sdk/api/deploymentApi.d.ts +4 -6
  20. package/build/library/sdk/api/deploymentApi.js +680 -603
  21. package/build/library/sdk/api/deploymentApi.js.map +1 -1
  22. package/build/library/sdk/api/devicesApi.d.ts +4 -6
  23. package/build/library/sdk/api/devicesApi.js +802 -800
  24. package/build/library/sdk/api/devicesApi.js.map +1 -1
  25. package/build/library/sdk/api/emailVerificationApi.d.ts +4 -6
  26. package/build/library/sdk/api/emailVerificationApi.js +184 -190
  27. package/build/library/sdk/api/emailVerificationApi.js.map +1 -1
  28. package/build/library/sdk/api/exportApi.d.ts +4 -6
  29. package/build/library/sdk/api/exportApi.js +88 -56
  30. package/build/library/sdk/api/exportApi.js.map +1 -1
  31. package/build/library/sdk/api/featureFlagsApi.d.ts +4 -6
  32. package/build/library/sdk/api/featureFlagsApi.js +76 -52
  33. package/build/library/sdk/api/featureFlagsApi.js.map +1 -1
  34. package/build/library/sdk/api/healthApi.d.ts +4 -6
  35. package/build/library/sdk/api/healthApi.js +111 -97
  36. package/build/library/sdk/api/healthApi.js.map +1 -1
  37. package/build/library/sdk/api/impulseApi.d.ts +4 -6
  38. package/build/library/sdk/api/impulseApi.js +942 -902
  39. package/build/library/sdk/api/impulseApi.js.map +1 -1
  40. package/build/library/sdk/api/integrationsApi.d.ts +4 -6
  41. package/build/library/sdk/api/integrationsApi.js +136 -106
  42. package/build/library/sdk/api/integrationsApi.js.map +1 -1
  43. package/build/library/sdk/api/jobsApi.d.ts +4 -6
  44. package/build/library/sdk/api/jobsApi.js +2270 -2326
  45. package/build/library/sdk/api/jobsApi.js.map +1 -1
  46. package/build/library/sdk/api/learnApi.d.ts +22 -6
  47. package/build/library/sdk/api/learnApi.js +1597 -1424
  48. package/build/library/sdk/api/learnApi.js.map +1 -1
  49. package/build/library/sdk/api/loginApi.d.ts +4 -6
  50. package/build/library/sdk/api/loginApi.js +112 -98
  51. package/build/library/sdk/api/loginApi.js.map +1 -1
  52. package/build/library/sdk/api/metricsApi.d.ts +4 -6
  53. package/build/library/sdk/api/metricsApi.js +148 -144
  54. package/build/library/sdk/api/metricsApi.js.map +1 -1
  55. package/build/library/sdk/api/optimizationApi.d.ts +4 -6
  56. package/build/library/sdk/api/optimizationApi.js +844 -844
  57. package/build/library/sdk/api/optimizationApi.js.map +1 -1
  58. package/build/library/sdk/api/organizationBlocksApi.d.ts +4 -6
  59. package/build/library/sdk/api/organizationBlocksApi.js +1968 -1550
  60. package/build/library/sdk/api/organizationBlocksApi.js.map +1 -1
  61. package/build/library/sdk/api/organizationCreateProjectApi.d.ts +4 -6
  62. package/build/library/sdk/api/organizationCreateProjectApi.js +700 -652
  63. package/build/library/sdk/api/organizationCreateProjectApi.js.map +1 -1
  64. package/build/library/sdk/api/organizationDataApi.d.ts +4 -6
  65. package/build/library/sdk/api/organizationDataApi.js +2074 -1985
  66. package/build/library/sdk/api/organizationDataApi.js.map +1 -1
  67. package/build/library/sdk/api/organizationDataCampaignsApi.d.ts +4 -6
  68. package/build/library/sdk/api/organizationDataCampaignsApi.js +626 -602
  69. package/build/library/sdk/api/organizationDataCampaignsApi.js.map +1 -1
  70. package/build/library/sdk/api/organizationJobsApi.d.ts +4 -6
  71. package/build/library/sdk/api/organizationJobsApi.js +417 -399
  72. package/build/library/sdk/api/organizationJobsApi.js.map +1 -1
  73. package/build/library/sdk/api/organizationPipelinesApi.d.ts +4 -6
  74. package/build/library/sdk/api/organizationPipelinesApi.js +419 -401
  75. package/build/library/sdk/api/organizationPipelinesApi.js.map +1 -1
  76. package/build/library/sdk/api/organizationPortalsApi.d.ts +4 -6
  77. package/build/library/sdk/api/organizationPortalsApi.js +372 -352
  78. package/build/library/sdk/api/organizationPortalsApi.js.map +1 -1
  79. package/build/library/sdk/api/organizationsApi.d.ts +4 -6
  80. package/build/library/sdk/api/organizationsApi.js +4024 -4050
  81. package/build/library/sdk/api/organizationsApi.js.map +1 -1
  82. package/build/library/sdk/api/performanceCalibrationApi.d.ts +4 -6
  83. package/build/library/sdk/api/performanceCalibrationApi.js +586 -560
  84. package/build/library/sdk/api/performanceCalibrationApi.js.map +1 -1
  85. package/build/library/sdk/api/postProcessingApi.d.ts +4 -6
  86. package/build/library/sdk/api/postProcessingApi.js +279 -255
  87. package/build/library/sdk/api/postProcessingApi.js.map +1 -1
  88. package/build/library/sdk/api/projectsApi.d.ts +4 -6
  89. package/build/library/sdk/api/projectsApi.js +2758 -2818
  90. package/build/library/sdk/api/projectsApi.js.map +1 -1
  91. package/build/library/sdk/api/rawDataApi.d.ts +4 -6
  92. package/build/library/sdk/api/rawDataApi.js +3055 -3131
  93. package/build/library/sdk/api/rawDataApi.js.map +1 -1
  94. package/build/library/sdk/api/testApi.d.ts +4 -6
  95. package/build/library/sdk/api/testApi.js +152 -108
  96. package/build/library/sdk/api/testApi.js.map +1 -1
  97. package/build/library/sdk/api/themesApi.d.ts +4 -6
  98. package/build/library/sdk/api/themesApi.js +341 -305
  99. package/build/library/sdk/api/themesApi.js.map +1 -1
  100. package/build/library/sdk/api/thirdPartyAuthApi.d.ts +4 -6
  101. package/build/library/sdk/api/thirdPartyAuthApi.js +387 -353
  102. package/build/library/sdk/api/thirdPartyAuthApi.js.map +1 -1
  103. package/build/library/sdk/api/uploadPortalApi.d.ts +4 -6
  104. package/build/library/sdk/api/uploadPortalApi.js +375 -355
  105. package/build/library/sdk/api/uploadPortalApi.js.map +1 -1
  106. package/build/library/sdk/api/userApi.d.ts +4 -6
  107. package/build/library/sdk/api/userApi.js +2345 -2452
  108. package/build/library/sdk/api/userApi.js.map +1 -1
  109. package/build/library/sdk/api/vlmApi.d.ts +4 -6
  110. package/build/library/sdk/api/vlmApi.js +277 -253
  111. package/build/library/sdk/api/vlmApi.js.map +1 -1
  112. package/build/library/sdk/api/whitelabelsApi.d.ts +4 -6
  113. package/build/library/sdk/api/whitelabelsApi.js +408 -398
  114. package/build/library/sdk/api/whitelabelsApi.js.map +1 -1
  115. package/build/library/sdk/model/deployPretrainedModelRequest.d.ts +4 -0
  116. package/build/library/sdk/model/deployPretrainedModelRequest.js +5 -0
  117. package/build/library/sdk/model/deployPretrainedModelRequest.js.map +1 -1
  118. package/build/library/sdk/model/models.d.ts +47 -7
  119. package/build/library/sdk/model/models.js +33 -22
  120. package/build/library/sdk/model/models.js.map +1 -1
  121. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.d.ts +47 -0
  122. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js +55 -0
  123. package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js.map +1 -0
  124. package/build/library/sdk/model/uploadPretrainedModelRequest.d.ts +4 -0
  125. package/build/library/sdk/model/uploadPretrainedModelRequest.js +5 -0
  126. package/build/library/sdk/model/uploadPretrainedModelRequest.js.map +1 -1
  127. package/package.json +3 -2
@@ -12,14 +12,31 @@
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.OrganizationPortalsApi = exports.OrganizationPortalsApiApiKeys = 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 OrganizationPortalsApiApiKeys;
30
47
  OrganizationPortalsApiApiKeys[OrganizationPortalsApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
31
48
  })(OrganizationPortalsApiApiKeys = exports.OrganizationPortalsApiApiKeys || (exports.OrganizationPortalsApiApiKeys = {}));
32
49
  class OrganizationPortalsApi {
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 OrganizationPortalsApi {
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 OrganizationPortalsApi {
88
122
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/portals/create'
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 OrganizationPortalsApi {
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 createOrganizationPortal.');
@@ -108,56 +144,52 @@ class OrganizationPortalsApi {
108
144
  if (createOrganizationPortalRequest === null || createOrganizationPortalRequest === undefined) {
109
145
  throw new Error('Required parameter createOrganizationPortalRequest was null or undefined when calling createOrganizationPortal.');
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(createOrganizationPortalRequest, "CreateOrganizationPortalRequest")
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(createOrganizationPortalRequest, "CreateOrganizationPortalRequest"));
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, "CreateOrganizationPortalResponse");
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, 'CreateOrganizationPortalResponse');
161
193
  }
162
194
  /**
163
195
  * Deletes an upload portal for the organization.
@@ -170,9 +202,11 @@ class OrganizationPortalsApi {
170
202
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
171
203
  .replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
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 OrganizationPortalsApi {
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 deleteOrganizationPortal.');
@@ -190,55 +224,51 @@ class OrganizationPortalsApi {
190
224
  if (portalId === null || portalId === undefined) {
191
225
  throw new Error('Required parameter portalId was null or undefined when calling deleteOrganizationPortal.');
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;
263
+ }
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';
219
268
  }
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
- });
269
+ }
270
+ const response = await fetch(url, requestOptions);
271
+ return this.handleResponse(response, 'GenericApiResponse');
242
272
  }
243
273
  /**
244
274
  * Retrieve a single upload portals identified by ID.
@@ -251,9 +281,11 @@ class OrganizationPortalsApi {
251
281
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
252
282
  .replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
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 OrganizationPortalsApi {
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 getOrganizationPortal.');
@@ -271,55 +303,51 @@ class OrganizationPortalsApi {
271
303
  if (portalId === null || portalId === undefined) {
272
304
  throw new Error('Required parameter portalId was null or undefined when calling getOrganizationPortal.');
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, "GetOrganizationPortalResponse");
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, 'GetOrganizationPortalResponse');
323
351
  }
324
352
  /**
325
353
  * Retrieve all configured upload portals.
@@ -330,9 +358,11 @@ class OrganizationPortalsApi {
330
358
  const localVarPath = this.basePath + '/api/organizations/{organizationId}/portals'
331
359
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
332
360
  let localVarQueryParameters = {};
333
- let localVarHeaderParams = Object.assign({
334
- 'User-Agent': 'edgeimpulse-api nodejs'
335
- }, this.defaultHeaders);
361
+ let localVarHeaderParams = {
362
+ 'User-Agent': 'edgeimpulse-api nodejs',
363
+ 'Content-Type': 'application/json',
364
+ ...this.defaultHeaders,
365
+ };
336
366
  const produces = ['application/json'];
337
367
  // give precedence to 'application/json'
338
368
  if (produces.indexOf('application/json') >= 0) {
@@ -341,60 +371,56 @@ class OrganizationPortalsApi {
341
371
  else {
342
372
  localVarHeaderParams.Accept = produces.join(',');
343
373
  }
344
- let localVarFormParams = {};
374
+ let localVarFormParams;
345
375
  // verify required parameter 'organizationId' is not null or undefined
346
376
  if (organizationId === null || organizationId === undefined) {
347
377
  throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationPortals.');
348
378
  }
349
- Object.assign(localVarHeaderParams, options.headers);
350
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
351
- let localVarUseFormData = false;
379
+ localVarHeaderParams = {
380
+ ...localVarHeaderParams,
381
+ ...options.headers,
382
+ ...this.opts.extraHeaders,
383
+ };
384
+ const queryString = Object.entries(localVarQueryParameters)
385
+ .filter(([, value]) => value !== undefined)
386
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
387
+ .join('&');
388
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
352
389
  let localVarRequestOptions = {
353
390
  method: 'GET',
354
- qs: localVarQueryParameters,
355
- headers: localVarHeaderParams,
356
- uri: localVarPath,
357
- useQuerystring: this._useQuerystring,
358
- agentOptions: { keepAlive: false },
359
- json: true,
391
+ headers: { ...localVarHeaderParams },
360
392
  };
361
- let authenticationPromise = Promise.resolve();
362
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
363
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
364
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
365
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
366
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
367
- return authenticationPromise.then(() => {
368
- if (Object.keys(localVarFormParams).length) {
369
- if (localVarUseFormData) {
370
- localVarRequestOptions.formData = localVarFormParams;
371
- }
372
- else {
373
- localVarRequestOptions.form = localVarFormParams;
374
- }
393
+ let requestOptions = localVarRequestOptions;
394
+ let url = localVarUrl;
395
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
396
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
397
+ url = auth_ApiKeyAuthentication.url;
398
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
399
+ requestOptions = auth_JWTAuthentication.requestOptions;
400
+ url = auth_JWTAuthentication.url;
401
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
402
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
403
+ url = auth_JWTHttpHeaderAuthentication.url;
404
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
405
+ requestOptions = auth_OAuth2.requestOptions;
406
+ url = auth_OAuth2.url;
407
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
408
+ requestOptions = authDefault.requestOptions;
409
+ url = authDefault.url;
410
+ if (localVarFormParams) {
411
+ delete requestOptions.headers['Content-Type'];
412
+ if (localVarFormParams instanceof FormData) {
413
+ // FormData: fetch will handle Content-Type automatically.
414
+ requestOptions.body = localVarFormParams;
375
415
  }
376
- return new Promise((resolve, reject) => {
377
- localVarRequest(localVarRequestOptions, (error, response, body) => {
378
- if (error) {
379
- reject(error);
380
- }
381
- else {
382
- body = models_1.ObjectSerializer.deserialize(body, "ListOrganizationPortalsResponse");
383
- if (typeof body.success === 'boolean' && !body.success) {
384
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
385
- reject(new Error(body.error || errString));
386
- }
387
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
388
- resolve(body);
389
- }
390
- else {
391
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
392
- reject(errString);
393
- }
394
- }
395
- });
396
- });
397
- });
416
+ else if (Object.keys(localVarFormParams).length > 0) {
417
+ // URL-encoded form
418
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
419
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
420
+ }
421
+ }
422
+ const response = await fetch(url, requestOptions);
423
+ return this.handleResponse(response, 'ListOrganizationPortalsResponse');
398
424
  }
399
425
  /**
400
426
  * Rotates the token for an upload portal.
@@ -407,9 +433,11 @@ class OrganizationPortalsApi {
407
433
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
408
434
  .replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
409
435
  let localVarQueryParameters = {};
410
- let localVarHeaderParams = Object.assign({
411
- 'User-Agent': 'edgeimpulse-api nodejs'
412
- }, this.defaultHeaders);
436
+ let localVarHeaderParams = {
437
+ 'User-Agent': 'edgeimpulse-api nodejs',
438
+ 'Content-Type': 'application/json',
439
+ ...this.defaultHeaders,
440
+ };
413
441
  const produces = ['application/json'];
414
442
  // give precedence to 'application/json'
415
443
  if (produces.indexOf('application/json') >= 0) {
@@ -418,7 +446,7 @@ class OrganizationPortalsApi {
418
446
  else {
419
447
  localVarHeaderParams.Accept = produces.join(',');
420
448
  }
421
- let localVarFormParams = {};
449
+ let localVarFormParams;
422
450
  // verify required parameter 'organizationId' is not null or undefined
423
451
  if (organizationId === null || organizationId === undefined) {
424
452
  throw new Error('Required parameter organizationId was null or undefined when calling rotateOrganizationPortalToken.');
@@ -427,55 +455,51 @@ class OrganizationPortalsApi {
427
455
  if (portalId === null || portalId === undefined) {
428
456
  throw new Error('Required parameter portalId was null or undefined when calling rotateOrganizationPortalToken.');
429
457
  }
430
- Object.assign(localVarHeaderParams, options.headers);
431
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
432
- let localVarUseFormData = false;
458
+ localVarHeaderParams = {
459
+ ...localVarHeaderParams,
460
+ ...options.headers,
461
+ ...this.opts.extraHeaders,
462
+ };
463
+ const queryString = Object.entries(localVarQueryParameters)
464
+ .filter(([, value]) => value !== undefined)
465
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
466
+ .join('&');
467
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
433
468
  let localVarRequestOptions = {
434
469
  method: 'DELETE',
435
- qs: localVarQueryParameters,
436
- headers: localVarHeaderParams,
437
- uri: localVarPath,
438
- useQuerystring: this._useQuerystring,
439
- agentOptions: { keepAlive: false },
440
- json: true,
470
+ headers: { ...localVarHeaderParams },
441
471
  };
442
- let authenticationPromise = Promise.resolve();
443
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
444
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
445
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
446
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
447
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
448
- return authenticationPromise.then(() => {
449
- if (Object.keys(localVarFormParams).length) {
450
- if (localVarUseFormData) {
451
- localVarRequestOptions.formData = localVarFormParams;
452
- }
453
- else {
454
- localVarRequestOptions.form = localVarFormParams;
455
- }
472
+ let requestOptions = localVarRequestOptions;
473
+ let url = localVarUrl;
474
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
475
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
476
+ url = auth_ApiKeyAuthentication.url;
477
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
478
+ requestOptions = auth_JWTAuthentication.requestOptions;
479
+ url = auth_JWTAuthentication.url;
480
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
481
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
482
+ url = auth_JWTHttpHeaderAuthentication.url;
483
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
484
+ requestOptions = auth_OAuth2.requestOptions;
485
+ url = auth_OAuth2.url;
486
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
487
+ requestOptions = authDefault.requestOptions;
488
+ url = authDefault.url;
489
+ if (localVarFormParams) {
490
+ delete requestOptions.headers['Content-Type'];
491
+ if (localVarFormParams instanceof FormData) {
492
+ // FormData: fetch will handle Content-Type automatically.
493
+ requestOptions.body = localVarFormParams;
494
+ }
495
+ else if (Object.keys(localVarFormParams).length > 0) {
496
+ // URL-encoded form
497
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
498
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
456
499
  }
457
- return new Promise((resolve, reject) => {
458
- localVarRequest(localVarRequestOptions, (error, response, body) => {
459
- if (error) {
460
- reject(error);
461
- }
462
- else {
463
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
464
- if (typeof body.success === 'boolean' && !body.success) {
465
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
466
- reject(new Error(body.error || errString));
467
- }
468
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
469
- resolve(body);
470
- }
471
- else {
472
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
473
- reject(errString);
474
- }
475
- }
476
- });
477
- });
478
- });
500
+ }
501
+ const response = await fetch(url, requestOptions);
502
+ return this.handleResponse(response, 'GenericApiResponse');
479
503
  }
480
504
  /**
481
505
  * Updates an upload portal for the organization.
@@ -489,9 +513,11 @@ class OrganizationPortalsApi {
489
513
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
490
514
  .replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
491
515
  let localVarQueryParameters = {};
492
- let localVarHeaderParams = Object.assign({
493
- 'User-Agent': 'edgeimpulse-api nodejs'
494
- }, this.defaultHeaders);
516
+ let localVarHeaderParams = {
517
+ 'User-Agent': 'edgeimpulse-api nodejs',
518
+ 'Content-Type': 'application/json',
519
+ ...this.defaultHeaders,
520
+ };
495
521
  const produces = ['application/json'];
496
522
  // give precedence to 'application/json'
497
523
  if (produces.indexOf('application/json') >= 0) {
@@ -500,7 +526,7 @@ class OrganizationPortalsApi {
500
526
  else {
501
527
  localVarHeaderParams.Accept = produces.join(',');
502
528
  }
503
- let localVarFormParams = {};
529
+ let localVarFormParams;
504
530
  // verify required parameter 'organizationId' is not null or undefined
505
531
  if (organizationId === null || organizationId === undefined) {
506
532
  throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationPortal.');
@@ -513,56 +539,52 @@ class OrganizationPortalsApi {
513
539
  if (createOrganizationPortalRequest === null || createOrganizationPortalRequest === undefined) {
514
540
  throw new Error('Required parameter createOrganizationPortalRequest was null or undefined when calling updateOrganizationPortal.');
515
541
  }
516
- Object.assign(localVarHeaderParams, options.headers);
517
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
518
- let localVarUseFormData = false;
542
+ localVarHeaderParams = {
543
+ ...localVarHeaderParams,
544
+ ...options.headers,
545
+ ...this.opts.extraHeaders,
546
+ };
547
+ const queryString = Object.entries(localVarQueryParameters)
548
+ .filter(([, value]) => value !== undefined)
549
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
550
+ .join('&');
551
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
519
552
  let localVarRequestOptions = {
520
553
  method: 'PUT',
521
- qs: localVarQueryParameters,
522
- headers: localVarHeaderParams,
523
- uri: localVarPath,
524
- useQuerystring: this._useQuerystring,
525
- agentOptions: { keepAlive: false },
526
- json: true,
527
- body: models_1.ObjectSerializer.serialize(createOrganizationPortalRequest, "CreateOrganizationPortalRequest")
554
+ headers: { ...localVarHeaderParams },
528
555
  };
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
- }
556
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(createOrganizationPortalRequest, "CreateOrganizationPortalRequest"));
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, "UpdateOrganizationPortalResponse");
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, 'UpdateOrganizationPortalResponse');
566
588
  }
567
589
  /**
568
590
  * Retrieve a subset of files from the portal, to be used in the data source wizard.
@@ -575,9 +597,11 @@ class OrganizationPortalsApi {
575
597
  .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
576
598
  .replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
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 OrganizationPortalsApi {
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 verifyOrganizationPortal.');
@@ -595,55 +619,51 @@ class OrganizationPortalsApi {
595
619
  if (portalId === null || portalId === undefined) {
596
620
  throw new Error('Required parameter portalId was null or undefined when calling verifyOrganizationPortal.');
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: 'GET',
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;
624
658
  }
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, "VerifyOrganizationBucketResponse");
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
- });
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';
663
+ }
664
+ }
665
+ const response = await fetch(url, requestOptions);
666
+ return this.handleResponse(response, 'VerifyOrganizationBucketResponse');
647
667
  }
648
668
  }
649
669
  exports.OrganizationPortalsApi = OrganizationPortalsApi;