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.ThemesApi = exports.ThemesApiApiKeys = 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 ThemesApiApiKeys;
30
47
  ThemesApiApiKeys[ThemesApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
31
48
  })(ThemesApiApiKeys = exports.ThemesApiApiKeys || (exports.ThemesApiApiKeys = {}));
32
49
  class ThemesApi {
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 ThemesApi {
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
  }
@@ -87,9 +121,11 @@ class ThemesApi {
87
121
  const localVarPath = this.basePath + '/api/themes/{themeId}'
88
122
  .replace('{' + 'themeId' + '}', encodeURIComponent(String(themeId)));
89
123
  let localVarQueryParameters = {};
90
- let localVarHeaderParams = Object.assign({
91
- 'User-Agent': 'edgeimpulse-api nodejs'
92
- }, this.defaultHeaders);
124
+ let localVarHeaderParams = {
125
+ 'User-Agent': 'edgeimpulse-api nodejs',
126
+ 'Content-Type': 'application/json',
127
+ ...this.defaultHeaders,
128
+ };
93
129
  const produces = ['application/json'];
94
130
  // give precedence to 'application/json'
95
131
  if (produces.indexOf('application/json') >= 0) {
@@ -98,60 +134,56 @@ class ThemesApi {
98
134
  else {
99
135
  localVarHeaderParams.Accept = produces.join(',');
100
136
  }
101
- let localVarFormParams = {};
137
+ let localVarFormParams;
102
138
  // verify required parameter 'themeId' is not null or undefined
103
139
  if (themeId === null || themeId === undefined) {
104
140
  throw new Error('Required parameter themeId was null or undefined when calling deleteTheme.');
105
141
  }
106
- Object.assign(localVarHeaderParams, options.headers);
107
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
108
- let localVarUseFormData = false;
142
+ localVarHeaderParams = {
143
+ ...localVarHeaderParams,
144
+ ...options.headers,
145
+ ...this.opts.extraHeaders,
146
+ };
147
+ const queryString = Object.entries(localVarQueryParameters)
148
+ .filter(([, value]) => value !== undefined)
149
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
150
+ .join('&');
151
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
109
152
  let localVarRequestOptions = {
110
153
  method: 'DELETE',
111
- qs: localVarQueryParameters,
112
- headers: localVarHeaderParams,
113
- uri: localVarPath,
114
- useQuerystring: this._useQuerystring,
115
- agentOptions: { keepAlive: false },
116
- json: true,
154
+ headers: { ...localVarHeaderParams },
117
155
  };
118
- let authenticationPromise = Promise.resolve();
119
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
120
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
121
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
122
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
123
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
124
- return authenticationPromise.then(() => {
125
- if (Object.keys(localVarFormParams).length) {
126
- if (localVarUseFormData) {
127
- localVarRequestOptions.formData = localVarFormParams;
128
- }
129
- else {
130
- localVarRequestOptions.form = localVarFormParams;
131
- }
156
+ let requestOptions = localVarRequestOptions;
157
+ let url = localVarUrl;
158
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
159
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
160
+ url = auth_ApiKeyAuthentication.url;
161
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
162
+ requestOptions = auth_JWTAuthentication.requestOptions;
163
+ url = auth_JWTAuthentication.url;
164
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
165
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
166
+ url = auth_JWTHttpHeaderAuthentication.url;
167
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
168
+ requestOptions = auth_OAuth2.requestOptions;
169
+ url = auth_OAuth2.url;
170
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
171
+ requestOptions = authDefault.requestOptions;
172
+ url = authDefault.url;
173
+ if (localVarFormParams) {
174
+ delete requestOptions.headers['Content-Type'];
175
+ if (localVarFormParams instanceof FormData) {
176
+ // FormData: fetch will handle Content-Type automatically.
177
+ requestOptions.body = localVarFormParams;
132
178
  }
133
- return new Promise((resolve, reject) => {
134
- localVarRequest(localVarRequestOptions, (error, response, body) => {
135
- if (error) {
136
- reject(error);
137
- }
138
- else {
139
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
140
- if (typeof body.success === 'boolean' && !body.success) {
141
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
142
- reject(new Error(body.error || errString));
143
- }
144
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
145
- resolve(body);
146
- }
147
- else {
148
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
149
- reject(errString);
150
- }
151
- }
152
- });
153
- });
154
- });
179
+ else if (Object.keys(localVarFormParams).length > 0) {
180
+ // URL-encoded form
181
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
182
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
183
+ }
184
+ }
185
+ const response = await fetch(url, requestOptions);
186
+ return this.handleResponse(response, 'GenericApiResponse');
155
187
  }
156
188
  /**
157
189
  * Get a theme given its unique identifier.
@@ -162,9 +194,11 @@ class ThemesApi {
162
194
  const localVarPath = this.basePath + '/api/themes/{themeId}'
163
195
  .replace('{' + 'themeId' + '}', encodeURIComponent(String(themeId)));
164
196
  let localVarQueryParameters = {};
165
- let localVarHeaderParams = Object.assign({
166
- 'User-Agent': 'edgeimpulse-api nodejs'
167
- }, this.defaultHeaders);
197
+ let localVarHeaderParams = {
198
+ 'User-Agent': 'edgeimpulse-api nodejs',
199
+ 'Content-Type': 'application/json',
200
+ ...this.defaultHeaders,
201
+ };
168
202
  const produces = ['application/json'];
169
203
  // give precedence to 'application/json'
170
204
  if (produces.indexOf('application/json') >= 0) {
@@ -173,60 +207,56 @@ class ThemesApi {
173
207
  else {
174
208
  localVarHeaderParams.Accept = produces.join(',');
175
209
  }
176
- let localVarFormParams = {};
210
+ let localVarFormParams;
177
211
  // verify required parameter 'themeId' is not null or undefined
178
212
  if (themeId === null || themeId === undefined) {
179
213
  throw new Error('Required parameter themeId was null or undefined when calling getTheme.');
180
214
  }
181
- Object.assign(localVarHeaderParams, options.headers);
182
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
183
- let localVarUseFormData = false;
215
+ localVarHeaderParams = {
216
+ ...localVarHeaderParams,
217
+ ...options.headers,
218
+ ...this.opts.extraHeaders,
219
+ };
220
+ const queryString = Object.entries(localVarQueryParameters)
221
+ .filter(([, value]) => value !== undefined)
222
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
223
+ .join('&');
224
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
184
225
  let localVarRequestOptions = {
185
226
  method: 'GET',
186
- qs: localVarQueryParameters,
187
- headers: localVarHeaderParams,
188
- uri: localVarPath,
189
- useQuerystring: this._useQuerystring,
190
- agentOptions: { keepAlive: false },
191
- json: true,
227
+ headers: { ...localVarHeaderParams },
192
228
  };
193
- let authenticationPromise = Promise.resolve();
194
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
195
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
196
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
197
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
198
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
199
- return authenticationPromise.then(() => {
200
- if (Object.keys(localVarFormParams).length) {
201
- if (localVarUseFormData) {
202
- localVarRequestOptions.formData = localVarFormParams;
203
- }
204
- else {
205
- localVarRequestOptions.form = localVarFormParams;
206
- }
229
+ let requestOptions = localVarRequestOptions;
230
+ let url = localVarUrl;
231
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
232
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
233
+ url = auth_ApiKeyAuthentication.url;
234
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
235
+ requestOptions = auth_JWTAuthentication.requestOptions;
236
+ url = auth_JWTAuthentication.url;
237
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
238
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
239
+ url = auth_JWTHttpHeaderAuthentication.url;
240
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
241
+ requestOptions = auth_OAuth2.requestOptions;
242
+ url = auth_OAuth2.url;
243
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
244
+ requestOptions = authDefault.requestOptions;
245
+ url = authDefault.url;
246
+ if (localVarFormParams) {
247
+ delete requestOptions.headers['Content-Type'];
248
+ if (localVarFormParams instanceof FormData) {
249
+ // FormData: fetch will handle Content-Type automatically.
250
+ requestOptions.body = localVarFormParams;
207
251
  }
208
- return new Promise((resolve, reject) => {
209
- localVarRequest(localVarRequestOptions, (error, response, body) => {
210
- if (error) {
211
- reject(error);
212
- }
213
- else {
214
- body = models_1.ObjectSerializer.deserialize(body, "GetThemeResponse");
215
- if (typeof body.success === 'boolean' && !body.success) {
216
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
217
- reject(new Error(body.error || errString));
218
- }
219
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
220
- resolve(body);
221
- }
222
- else {
223
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
224
- reject(errString);
225
- }
226
- }
227
- });
228
- });
229
- });
252
+ else if (Object.keys(localVarFormParams).length > 0) {
253
+ // URL-encoded form
254
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
255
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
256
+ }
257
+ }
258
+ const response = await fetch(url, requestOptions);
259
+ return this.handleResponse(response, 'GetThemeResponse');
230
260
  }
231
261
  /**
232
262
  * Get all available Studio themes.
@@ -235,9 +265,11 @@ class ThemesApi {
235
265
  async getThemes(options = { headers: {} }) {
236
266
  const localVarPath = this.basePath + '/api/themes';
237
267
  let localVarQueryParameters = {};
238
- let localVarHeaderParams = Object.assign({
239
- 'User-Agent': 'edgeimpulse-api nodejs'
240
- }, this.defaultHeaders);
268
+ let localVarHeaderParams = {
269
+ 'User-Agent': 'edgeimpulse-api nodejs',
270
+ 'Content-Type': 'application/json',
271
+ ...this.defaultHeaders,
272
+ };
241
273
  const produces = ['application/json'];
242
274
  // give precedence to 'application/json'
243
275
  if (produces.indexOf('application/json') >= 0) {
@@ -246,56 +278,52 @@ class ThemesApi {
246
278
  else {
247
279
  localVarHeaderParams.Accept = produces.join(',');
248
280
  }
249
- let localVarFormParams = {};
250
- Object.assign(localVarHeaderParams, options.headers);
251
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
252
- let localVarUseFormData = false;
281
+ let localVarFormParams;
282
+ localVarHeaderParams = {
283
+ ...localVarHeaderParams,
284
+ ...options.headers,
285
+ ...this.opts.extraHeaders,
286
+ };
287
+ const queryString = Object.entries(localVarQueryParameters)
288
+ .filter(([, value]) => value !== undefined)
289
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
290
+ .join('&');
291
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
253
292
  let localVarRequestOptions = {
254
293
  method: 'GET',
255
- qs: localVarQueryParameters,
256
- headers: localVarHeaderParams,
257
- uri: localVarPath,
258
- useQuerystring: this._useQuerystring,
259
- agentOptions: { keepAlive: false },
260
- json: true,
294
+ headers: { ...localVarHeaderParams },
261
295
  };
262
- let authenticationPromise = Promise.resolve();
263
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
264
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
265
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
266
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
267
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
268
- return authenticationPromise.then(() => {
269
- if (Object.keys(localVarFormParams).length) {
270
- if (localVarUseFormData) {
271
- localVarRequestOptions.formData = localVarFormParams;
272
- }
273
- else {
274
- localVarRequestOptions.form = localVarFormParams;
275
- }
296
+ let requestOptions = localVarRequestOptions;
297
+ let url = localVarUrl;
298
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
299
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
300
+ url = auth_ApiKeyAuthentication.url;
301
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
302
+ requestOptions = auth_JWTAuthentication.requestOptions;
303
+ url = auth_JWTAuthentication.url;
304
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
305
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
306
+ url = auth_JWTHttpHeaderAuthentication.url;
307
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
308
+ requestOptions = auth_OAuth2.requestOptions;
309
+ url = auth_OAuth2.url;
310
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
311
+ requestOptions = authDefault.requestOptions;
312
+ url = authDefault.url;
313
+ if (localVarFormParams) {
314
+ delete requestOptions.headers['Content-Type'];
315
+ if (localVarFormParams instanceof FormData) {
316
+ // FormData: fetch will handle Content-Type automatically.
317
+ requestOptions.body = localVarFormParams;
276
318
  }
277
- return new Promise((resolve, reject) => {
278
- localVarRequest(localVarRequestOptions, (error, response, body) => {
279
- if (error) {
280
- reject(error);
281
- }
282
- else {
283
- body = models_1.ObjectSerializer.deserialize(body, "GetThemesResponse");
284
- if (typeof body.success === 'boolean' && !body.success) {
285
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
286
- reject(new Error(body.error || errString));
287
- }
288
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
289
- resolve(body);
290
- }
291
- else {
292
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
293
- reject(errString);
294
- }
295
- }
296
- });
297
- });
298
- });
319
+ else if (Object.keys(localVarFormParams).length > 0) {
320
+ // URL-encoded form
321
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
322
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
323
+ }
324
+ }
325
+ const response = await fetch(url, requestOptions);
326
+ return this.handleResponse(response, 'GetThemesResponse');
299
327
  }
300
328
  /**
301
329
  * Update some or all theme colors.
@@ -307,9 +335,11 @@ class ThemesApi {
307
335
  const localVarPath = this.basePath + '/api/themes/{themeId}/colors'
308
336
  .replace('{' + 'themeId' + '}', encodeURIComponent(String(themeId)));
309
337
  let localVarQueryParameters = {};
310
- let localVarHeaderParams = Object.assign({
311
- 'User-Agent': 'edgeimpulse-api nodejs'
312
- }, this.defaultHeaders);
338
+ let localVarHeaderParams = {
339
+ 'User-Agent': 'edgeimpulse-api nodejs',
340
+ 'Content-Type': 'application/json',
341
+ ...this.defaultHeaders,
342
+ };
313
343
  const produces = ['application/json'];
314
344
  // give precedence to 'application/json'
315
345
  if (produces.indexOf('application/json') >= 0) {
@@ -318,7 +348,7 @@ class ThemesApi {
318
348
  else {
319
349
  localVarHeaderParams.Accept = produces.join(',');
320
350
  }
321
- let localVarFormParams = {};
351
+ let localVarFormParams;
322
352
  // verify required parameter 'themeId' is not null or undefined
323
353
  if (themeId === null || themeId === undefined) {
324
354
  throw new Error('Required parameter themeId was null or undefined when calling updateThemeColors.');
@@ -327,56 +357,52 @@ class ThemesApi {
327
357
  if (updateThemeColorsRequest === null || updateThemeColorsRequest === undefined) {
328
358
  throw new Error('Required parameter updateThemeColorsRequest was null or undefined when calling updateThemeColors.');
329
359
  }
330
- Object.assign(localVarHeaderParams, options.headers);
331
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
332
- let localVarUseFormData = false;
360
+ localVarHeaderParams = {
361
+ ...localVarHeaderParams,
362
+ ...options.headers,
363
+ ...this.opts.extraHeaders,
364
+ };
365
+ const queryString = Object.entries(localVarQueryParameters)
366
+ .filter(([, value]) => value !== undefined)
367
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
368
+ .join('&');
369
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
333
370
  let localVarRequestOptions = {
334
371
  method: 'POST',
335
- qs: localVarQueryParameters,
336
- headers: localVarHeaderParams,
337
- uri: localVarPath,
338
- useQuerystring: this._useQuerystring,
339
- agentOptions: { keepAlive: false },
340
- json: true,
341
- body: models_1.ObjectSerializer.serialize(updateThemeColorsRequest, "UpdateThemeColorsRequest")
372
+ headers: { ...localVarHeaderParams },
342
373
  };
343
- let authenticationPromise = Promise.resolve();
344
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
345
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
346
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
347
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
348
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
349
- return authenticationPromise.then(() => {
350
- if (Object.keys(localVarFormParams).length) {
351
- if (localVarUseFormData) {
352
- localVarRequestOptions.formData = localVarFormParams;
353
- }
354
- else {
355
- localVarRequestOptions.form = localVarFormParams;
356
- }
374
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateThemeColorsRequest, "UpdateThemeColorsRequest"));
375
+ let requestOptions = localVarRequestOptions;
376
+ let url = localVarUrl;
377
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
378
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
379
+ url = auth_ApiKeyAuthentication.url;
380
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
381
+ requestOptions = auth_JWTAuthentication.requestOptions;
382
+ url = auth_JWTAuthentication.url;
383
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
384
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
385
+ url = auth_JWTHttpHeaderAuthentication.url;
386
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
387
+ requestOptions = auth_OAuth2.requestOptions;
388
+ url = auth_OAuth2.url;
389
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
390
+ requestOptions = authDefault.requestOptions;
391
+ url = authDefault.url;
392
+ if (localVarFormParams) {
393
+ delete requestOptions.headers['Content-Type'];
394
+ if (localVarFormParams instanceof FormData) {
395
+ // FormData: fetch will handle Content-Type automatically.
396
+ requestOptions.body = localVarFormParams;
357
397
  }
358
- return new Promise((resolve, reject) => {
359
- localVarRequest(localVarRequestOptions, (error, response, body) => {
360
- if (error) {
361
- reject(error);
362
- }
363
- else {
364
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
365
- if (typeof body.success === 'boolean' && !body.success) {
366
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
367
- reject(new Error(body.error || errString));
368
- }
369
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
370
- resolve(body);
371
- }
372
- else {
373
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
374
- reject(errString);
375
- }
376
- }
377
- });
378
- });
379
- });
398
+ else if (Object.keys(localVarFormParams).length > 0) {
399
+ // URL-encoded form
400
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
401
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
402
+ }
403
+ }
404
+ const response = await fetch(url, requestOptions);
405
+ return this.handleResponse(response, 'GenericApiResponse');
380
406
  }
381
407
  /**
382
408
  * Update the theme favicon
@@ -388,9 +414,11 @@ class ThemesApi {
388
414
  const localVarPath = this.basePath + '/api/themes/{themeId}/favicon'
389
415
  .replace('{' + 'themeId' + '}', encodeURIComponent(String(themeId)));
390
416
  let localVarQueryParameters = {};
391
- let localVarHeaderParams = Object.assign({
392
- 'User-Agent': 'edgeimpulse-api nodejs'
393
- }, this.defaultHeaders);
417
+ let localVarHeaderParams = {
418
+ 'User-Agent': 'edgeimpulse-api nodejs',
419
+ 'Content-Type': 'application/json',
420
+ ...this.defaultHeaders,
421
+ };
394
422
  const produces = ['application/json'];
395
423
  // give precedence to 'application/json'
396
424
  if (produces.indexOf('application/json') >= 0) {
@@ -399,7 +427,7 @@ class ThemesApi {
399
427
  else {
400
428
  localVarHeaderParams.Accept = produces.join(',');
401
429
  }
402
- let localVarFormParams = {};
430
+ let localVarFormParams;
403
431
  // verify required parameter 'themeId' is not null or undefined
404
432
  if (themeId === null || themeId === undefined) {
405
433
  throw new Error('Required parameter themeId was null or undefined when calling updateThemeFavicon.');
@@ -408,59 +436,69 @@ class ThemesApi {
408
436
  if (params.image === null || params.image === undefined) {
409
437
  throw new Error('Required parameter params.image was null or undefined when calling updateThemeFavicon.');
410
438
  }
411
- Object.assign(localVarHeaderParams, options.headers);
412
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
413
- let localVarUseFormData = false;
439
+ localVarHeaderParams = {
440
+ ...localVarHeaderParams,
441
+ ...options.headers,
442
+ ...this.opts.extraHeaders,
443
+ };
414
444
  if (params.image !== undefined) {
415
- localVarFormParams['image'] = params.image;
445
+ if (!(localVarFormParams instanceof FormData)) {
446
+ const existingParams = localVarFormParams;
447
+ localVarFormParams = new FormData();
448
+ if (existingParams && typeof existingParams === 'object') {
449
+ Object.keys(existingParams).forEach(key => {
450
+ localVarFormParams.append(key, existingParams[key]);
451
+ });
452
+ }
453
+ }
454
+ const imageFiles = Array.isArray(params.image) ? params.image : [params.image];
455
+ const Blob = globalThis.Blob || require('buffer').Blob;
456
+ imageFiles.forEach((f) => {
457
+ localVarFormParams.append('image', new Blob([f.value], {
458
+ type: f.options.contentType
459
+ }), f.options.filename);
460
+ });
416
461
  }
417
- localVarUseFormData = true;
462
+ const queryString = Object.entries(localVarQueryParameters)
463
+ .filter(([, value]) => value !== undefined)
464
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
465
+ .join('&');
466
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
418
467
  let localVarRequestOptions = {
419
468
  method: 'POST',
420
- qs: localVarQueryParameters,
421
- headers: localVarHeaderParams,
422
- uri: localVarPath,
423
- useQuerystring: this._useQuerystring,
424
- agentOptions: { keepAlive: false },
425
- json: true,
469
+ headers: { ...localVarHeaderParams },
426
470
  };
427
- let authenticationPromise = Promise.resolve();
428
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
429
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
430
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
431
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
432
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
433
- return authenticationPromise.then(() => {
434
- if (Object.keys(localVarFormParams).length) {
435
- if (localVarUseFormData) {
436
- localVarRequestOptions.formData = localVarFormParams;
437
- }
438
- else {
439
- localVarRequestOptions.form = localVarFormParams;
440
- }
471
+ let requestOptions = localVarRequestOptions;
472
+ let url = localVarUrl;
473
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
474
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
475
+ url = auth_ApiKeyAuthentication.url;
476
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
477
+ requestOptions = auth_JWTAuthentication.requestOptions;
478
+ url = auth_JWTAuthentication.url;
479
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
480
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
481
+ url = auth_JWTHttpHeaderAuthentication.url;
482
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
483
+ requestOptions = auth_OAuth2.requestOptions;
484
+ url = auth_OAuth2.url;
485
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
486
+ requestOptions = authDefault.requestOptions;
487
+ url = authDefault.url;
488
+ if (localVarFormParams) {
489
+ delete requestOptions.headers['Content-Type'];
490
+ if (localVarFormParams instanceof FormData) {
491
+ // FormData: fetch will handle Content-Type automatically.
492
+ requestOptions.body = localVarFormParams;
441
493
  }
442
- return new Promise((resolve, reject) => {
443
- localVarRequest(localVarRequestOptions, (error, response, body) => {
444
- if (error) {
445
- reject(error);
446
- }
447
- else {
448
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
449
- if (typeof body.success === 'boolean' && !body.success) {
450
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
451
- reject(new Error(body.error || errString));
452
- }
453
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
454
- resolve(body);
455
- }
456
- else {
457
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
458
- reject(errString);
459
- }
460
- }
461
- });
462
- });
463
- });
494
+ else if (Object.keys(localVarFormParams).length > 0) {
495
+ // URL-encoded form
496
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
497
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
498
+ }
499
+ }
500
+ const response = await fetch(url, requestOptions);
501
+ return this.handleResponse(response, 'GenericApiResponse');
464
502
  }
465
503
  /**
466
504
  * Update some or all theme logos.
@@ -472,9 +510,11 @@ class ThemesApi {
472
510
  const localVarPath = this.basePath + '/api/themes/{themeId}/logos'
473
511
  .replace('{' + 'themeId' + '}', encodeURIComponent(String(themeId)));
474
512
  let localVarQueryParameters = {};
475
- let localVarHeaderParams = Object.assign({
476
- 'User-Agent': 'edgeimpulse-api nodejs'
477
- }, this.defaultHeaders);
513
+ let localVarHeaderParams = {
514
+ 'User-Agent': 'edgeimpulse-api nodejs',
515
+ 'Content-Type': 'application/json',
516
+ ...this.defaultHeaders,
517
+ };
478
518
  const produces = ['application/json'];
479
519
  // give precedence to 'application/json'
480
520
  if (produces.indexOf('application/json') >= 0) {
@@ -483,7 +523,7 @@ class ThemesApi {
483
523
  else {
484
524
  localVarHeaderParams.Accept = produces.join(',');
485
525
  }
486
- let localVarFormParams = {};
526
+ let localVarFormParams;
487
527
  // verify required parameter 'themeId' is not null or undefined
488
528
  if (themeId === null || themeId === undefined) {
489
529
  throw new Error('Required parameter themeId was null or undefined when calling updateThemeLogos.');
@@ -492,56 +532,52 @@ class ThemesApi {
492
532
  if (updateThemeLogosRequest === null || updateThemeLogosRequest === undefined) {
493
533
  throw new Error('Required parameter updateThemeLogosRequest was null or undefined when calling updateThemeLogos.');
494
534
  }
495
- Object.assign(localVarHeaderParams, options.headers);
496
- Object.assign(localVarHeaderParams, this.opts.extraHeaders);
497
- let localVarUseFormData = false;
535
+ localVarHeaderParams = {
536
+ ...localVarHeaderParams,
537
+ ...options.headers,
538
+ ...this.opts.extraHeaders,
539
+ };
540
+ const queryString = Object.entries(localVarQueryParameters)
541
+ .filter(([, value]) => value !== undefined)
542
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
543
+ .join('&');
544
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
498
545
  let localVarRequestOptions = {
499
546
  method: 'POST',
500
- qs: localVarQueryParameters,
501
- headers: localVarHeaderParams,
502
- uri: localVarPath,
503
- useQuerystring: this._useQuerystring,
504
- agentOptions: { keepAlive: false },
505
- json: true,
506
- body: models_1.ObjectSerializer.serialize(updateThemeLogosRequest, "UpdateThemeLogosRequest")
547
+ headers: { ...localVarHeaderParams },
507
548
  };
508
- let authenticationPromise = Promise.resolve();
509
- authenticationPromise = authenticationPromise.then(() => this.authentications.ApiKeyAuthentication.applyToRequest(localVarRequestOptions));
510
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTAuthentication.applyToRequest(localVarRequestOptions));
511
- authenticationPromise = authenticationPromise.then(() => this.authentications.JWTHttpHeaderAuthentication.applyToRequest(localVarRequestOptions));
512
- authenticationPromise = authenticationPromise.then(() => this.authentications.OAuth2.applyToRequest(localVarRequestOptions));
513
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
514
- return authenticationPromise.then(() => {
515
- if (Object.keys(localVarFormParams).length) {
516
- if (localVarUseFormData) {
517
- localVarRequestOptions.formData = localVarFormParams;
518
- }
519
- else {
520
- localVarRequestOptions.form = localVarFormParams;
521
- }
549
+ localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(updateThemeLogosRequest, "UpdateThemeLogosRequest"));
550
+ let requestOptions = localVarRequestOptions;
551
+ let url = localVarUrl;
552
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
553
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
554
+ url = auth_ApiKeyAuthentication.url;
555
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
556
+ requestOptions = auth_JWTAuthentication.requestOptions;
557
+ url = auth_JWTAuthentication.url;
558
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
559
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
560
+ url = auth_JWTHttpHeaderAuthentication.url;
561
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
562
+ requestOptions = auth_OAuth2.requestOptions;
563
+ url = auth_OAuth2.url;
564
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
565
+ requestOptions = authDefault.requestOptions;
566
+ url = authDefault.url;
567
+ if (localVarFormParams) {
568
+ delete requestOptions.headers['Content-Type'];
569
+ if (localVarFormParams instanceof FormData) {
570
+ // FormData: fetch will handle Content-Type automatically.
571
+ requestOptions.body = localVarFormParams;
522
572
  }
523
- return new Promise((resolve, reject) => {
524
- localVarRequest(localVarRequestOptions, (error, response, body) => {
525
- if (error) {
526
- reject(error);
527
- }
528
- else {
529
- body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
530
- if (typeof body.success === 'boolean' && !body.success) {
531
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
532
- reject(new Error(body.error || errString));
533
- }
534
- else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
535
- resolve(body);
536
- }
537
- else {
538
- const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
539
- reject(errString);
540
- }
541
- }
542
- });
543
- });
544
- });
573
+ else if (Object.keys(localVarFormParams).length > 0) {
574
+ // URL-encoded form
575
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
576
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
577
+ }
578
+ }
579
+ const response = await fetch(url, requestOptions);
580
+ return this.handleResponse(response, 'GenericApiResponse');
545
581
  }
546
582
  }
547
583
  exports.ThemesApi = ThemesApi;