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.
- package/build/library/sdk/api/adminApi.d.ts +4 -6
- package/build/library/sdk/api/adminApi.js +4782 -4928
- package/build/library/sdk/api/adminApi.js.map +1 -1
- package/build/library/sdk/api/authApi.d.ts +4 -6
- package/build/library/sdk/api/authApi.js +88 -56
- package/build/library/sdk/api/authApi.js.map +1 -1
- package/build/library/sdk/api/cDNApi.d.ts +4 -6
- package/build/library/sdk/api/cDNApi.js +76 -53
- package/build/library/sdk/api/cDNApi.js.map +1 -1
- package/build/library/sdk/api/canaryApi.d.ts +4 -6
- package/build/library/sdk/api/canaryApi.js +79 -53
- package/build/library/sdk/api/canaryApi.js.map +1 -1
- package/build/library/sdk/api/classifyApi.d.ts +4 -6
- package/build/library/sdk/api/classifyApi.js +527 -499
- package/build/library/sdk/api/classifyApi.js.map +1 -1
- package/build/library/sdk/api/dSPApi.d.ts +4 -6
- package/build/library/sdk/api/dSPApi.js +938 -942
- package/build/library/sdk/api/dSPApi.js.map +1 -1
- package/build/library/sdk/api/deploymentApi.d.ts +4 -6
- package/build/library/sdk/api/deploymentApi.js +680 -603
- package/build/library/sdk/api/deploymentApi.js.map +1 -1
- package/build/library/sdk/api/devicesApi.d.ts +4 -6
- package/build/library/sdk/api/devicesApi.js +802 -800
- package/build/library/sdk/api/devicesApi.js.map +1 -1
- package/build/library/sdk/api/emailVerificationApi.d.ts +4 -6
- package/build/library/sdk/api/emailVerificationApi.js +184 -190
- package/build/library/sdk/api/emailVerificationApi.js.map +1 -1
- package/build/library/sdk/api/exportApi.d.ts +4 -6
- package/build/library/sdk/api/exportApi.js +88 -56
- package/build/library/sdk/api/exportApi.js.map +1 -1
- package/build/library/sdk/api/featureFlagsApi.d.ts +4 -6
- package/build/library/sdk/api/featureFlagsApi.js +76 -52
- package/build/library/sdk/api/featureFlagsApi.js.map +1 -1
- package/build/library/sdk/api/healthApi.d.ts +4 -6
- package/build/library/sdk/api/healthApi.js +111 -97
- package/build/library/sdk/api/healthApi.js.map +1 -1
- package/build/library/sdk/api/impulseApi.d.ts +4 -6
- package/build/library/sdk/api/impulseApi.js +942 -902
- package/build/library/sdk/api/impulseApi.js.map +1 -1
- package/build/library/sdk/api/integrationsApi.d.ts +4 -6
- package/build/library/sdk/api/integrationsApi.js +136 -106
- package/build/library/sdk/api/integrationsApi.js.map +1 -1
- package/build/library/sdk/api/jobsApi.d.ts +4 -6
- package/build/library/sdk/api/jobsApi.js +2270 -2326
- package/build/library/sdk/api/jobsApi.js.map +1 -1
- package/build/library/sdk/api/learnApi.d.ts +22 -6
- package/build/library/sdk/api/learnApi.js +1597 -1424
- package/build/library/sdk/api/learnApi.js.map +1 -1
- package/build/library/sdk/api/loginApi.d.ts +4 -6
- package/build/library/sdk/api/loginApi.js +112 -98
- package/build/library/sdk/api/loginApi.js.map +1 -1
- package/build/library/sdk/api/metricsApi.d.ts +4 -6
- package/build/library/sdk/api/metricsApi.js +148 -144
- package/build/library/sdk/api/metricsApi.js.map +1 -1
- package/build/library/sdk/api/optimizationApi.d.ts +4 -6
- package/build/library/sdk/api/optimizationApi.js +844 -844
- package/build/library/sdk/api/optimizationApi.js.map +1 -1
- package/build/library/sdk/api/organizationBlocksApi.d.ts +4 -6
- package/build/library/sdk/api/organizationBlocksApi.js +1968 -1550
- package/build/library/sdk/api/organizationBlocksApi.js.map +1 -1
- package/build/library/sdk/api/organizationCreateProjectApi.d.ts +4 -6
- package/build/library/sdk/api/organizationCreateProjectApi.js +700 -652
- package/build/library/sdk/api/organizationCreateProjectApi.js.map +1 -1
- package/build/library/sdk/api/organizationDataApi.d.ts +4 -6
- package/build/library/sdk/api/organizationDataApi.js +2074 -1985
- package/build/library/sdk/api/organizationDataApi.js.map +1 -1
- package/build/library/sdk/api/organizationDataCampaignsApi.d.ts +4 -6
- package/build/library/sdk/api/organizationDataCampaignsApi.js +626 -602
- package/build/library/sdk/api/organizationDataCampaignsApi.js.map +1 -1
- package/build/library/sdk/api/organizationJobsApi.d.ts +4 -6
- package/build/library/sdk/api/organizationJobsApi.js +417 -399
- package/build/library/sdk/api/organizationJobsApi.js.map +1 -1
- package/build/library/sdk/api/organizationPipelinesApi.d.ts +4 -6
- package/build/library/sdk/api/organizationPipelinesApi.js +419 -401
- package/build/library/sdk/api/organizationPipelinesApi.js.map +1 -1
- package/build/library/sdk/api/organizationPortalsApi.d.ts +4 -6
- package/build/library/sdk/api/organizationPortalsApi.js +372 -352
- package/build/library/sdk/api/organizationPortalsApi.js.map +1 -1
- package/build/library/sdk/api/organizationsApi.d.ts +4 -6
- package/build/library/sdk/api/organizationsApi.js +4024 -4050
- package/build/library/sdk/api/organizationsApi.js.map +1 -1
- package/build/library/sdk/api/performanceCalibrationApi.d.ts +4 -6
- package/build/library/sdk/api/performanceCalibrationApi.js +586 -560
- package/build/library/sdk/api/performanceCalibrationApi.js.map +1 -1
- package/build/library/sdk/api/postProcessingApi.d.ts +4 -6
- package/build/library/sdk/api/postProcessingApi.js +279 -255
- package/build/library/sdk/api/postProcessingApi.js.map +1 -1
- package/build/library/sdk/api/projectsApi.d.ts +4 -6
- package/build/library/sdk/api/projectsApi.js +2758 -2818
- package/build/library/sdk/api/projectsApi.js.map +1 -1
- package/build/library/sdk/api/rawDataApi.d.ts +4 -6
- package/build/library/sdk/api/rawDataApi.js +3055 -3131
- package/build/library/sdk/api/rawDataApi.js.map +1 -1
- package/build/library/sdk/api/testApi.d.ts +4 -6
- package/build/library/sdk/api/testApi.js +152 -108
- package/build/library/sdk/api/testApi.js.map +1 -1
- package/build/library/sdk/api/themesApi.d.ts +4 -6
- package/build/library/sdk/api/themesApi.js +341 -305
- package/build/library/sdk/api/themesApi.js.map +1 -1
- package/build/library/sdk/api/thirdPartyAuthApi.d.ts +4 -6
- package/build/library/sdk/api/thirdPartyAuthApi.js +387 -353
- package/build/library/sdk/api/thirdPartyAuthApi.js.map +1 -1
- package/build/library/sdk/api/uploadPortalApi.d.ts +4 -6
- package/build/library/sdk/api/uploadPortalApi.js +375 -355
- package/build/library/sdk/api/uploadPortalApi.js.map +1 -1
- package/build/library/sdk/api/userApi.d.ts +4 -6
- package/build/library/sdk/api/userApi.js +2345 -2452
- package/build/library/sdk/api/userApi.js.map +1 -1
- package/build/library/sdk/api/vlmApi.d.ts +4 -6
- package/build/library/sdk/api/vlmApi.js +277 -253
- package/build/library/sdk/api/vlmApi.js.map +1 -1
- package/build/library/sdk/api/whitelabelsApi.d.ts +4 -6
- package/build/library/sdk/api/whitelabelsApi.js +408 -398
- package/build/library/sdk/api/whitelabelsApi.js.map +1 -1
- package/build/library/sdk/model/deployPretrainedModelRequest.d.ts +4 -0
- package/build/library/sdk/model/deployPretrainedModelRequest.js +5 -0
- package/build/library/sdk/model/deployPretrainedModelRequest.js.map +1 -1
- package/build/library/sdk/model/models.d.ts +47 -7
- package/build/library/sdk/model/models.js +33 -22
- package/build/library/sdk/model/models.js.map +1 -1
- package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.d.ts +47 -0
- package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js +55 -0
- package/build/library/sdk/model/uploadPretrainedModelByUrlRequest.js.map +1 -0
- package/build/library/sdk/model/uploadPretrainedModelRequest.d.ts +4 -0
- package/build/library/sdk/model/uploadPretrainedModelRequest.js +5 -0
- package/build/library/sdk/model/uploadPretrainedModelRequest.js.map +1 -1
- package/package.json +3 -2
|
@@ -12,14 +12,31 @@
|
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.UploadPortalApi = exports.UploadPortalApiApiKeys = 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
|
-
|
|
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 UploadPortalApiApiKeys;
|
|
|
30
47
|
UploadPortalApiApiKeys[UploadPortalApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
|
|
31
48
|
})(UploadPortalApiApiKeys = exports.UploadPortalApiApiKeys || (exports.UploadPortalApiApiKeys = {}));
|
|
32
49
|
class UploadPortalApi {
|
|
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 UploadPortalApi {
|
|
|
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 UploadPortalApi {
|
|
|
88
122
|
const localVarPath = this.basePath + '/api/portals/{portalId}/upload-link'
|
|
89
123
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
90
124
|
let localVarQueryParameters = {};
|
|
91
|
-
let localVarHeaderParams =
|
|
92
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
93
|
-
|
|
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 UploadPortalApi {
|
|
|
99
135
|
else {
|
|
100
136
|
localVarHeaderParams.Accept = produces.join(',');
|
|
101
137
|
}
|
|
102
|
-
let localVarFormParams
|
|
138
|
+
let localVarFormParams;
|
|
103
139
|
// verify required parameter 'portalId' is not null or undefined
|
|
104
140
|
if (portalId === null || portalId === undefined) {
|
|
105
141
|
throw new Error('Required parameter portalId was null or undefined when calling createSignedUploadLink.');
|
|
@@ -108,56 +144,52 @@ class UploadPortalApi {
|
|
|
108
144
|
if (createSignedUploadLinkRequest === null || createSignedUploadLinkRequest === undefined) {
|
|
109
145
|
throw new Error('Required parameter createSignedUploadLinkRequest was null or undefined when calling createSignedUploadLink.');
|
|
110
146
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
117
|
-
headers: localVarHeaderParams,
|
|
118
|
-
uri: localVarPath,
|
|
119
|
-
useQuerystring: this._useQuerystring,
|
|
120
|
-
agentOptions: { keepAlive: false },
|
|
121
|
-
json: true,
|
|
122
|
-
body: models_1.ObjectSerializer.serialize(createSignedUploadLinkRequest, "CreateSignedUploadLinkRequest")
|
|
159
|
+
headers: { ...localVarHeaderParams },
|
|
123
160
|
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
161
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(createSignedUploadLinkRequest, "CreateSignedUploadLinkRequest"));
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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, 'CreateSignedUploadLinkResponse');
|
|
161
193
|
}
|
|
162
194
|
/**
|
|
163
195
|
* Delete a file from an upload portal (requires JWT auth).
|
|
@@ -169,9 +201,11 @@ class UploadPortalApi {
|
|
|
169
201
|
const localVarPath = this.basePath + '/api/portals/{portalId}/files/delete'
|
|
170
202
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
171
203
|
let localVarQueryParameters = {};
|
|
172
|
-
let localVarHeaderParams =
|
|
173
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
174
|
-
|
|
204
|
+
let localVarHeaderParams = {
|
|
205
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
206
|
+
'Content-Type': 'application/json',
|
|
207
|
+
...this.defaultHeaders,
|
|
208
|
+
};
|
|
175
209
|
const produces = ['application/json'];
|
|
176
210
|
// give precedence to 'application/json'
|
|
177
211
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -180,7 +214,7 @@ class UploadPortalApi {
|
|
|
180
214
|
else {
|
|
181
215
|
localVarHeaderParams.Accept = produces.join(',');
|
|
182
216
|
}
|
|
183
|
-
let localVarFormParams
|
|
217
|
+
let localVarFormParams;
|
|
184
218
|
// verify required parameter 'portalId' is not null or undefined
|
|
185
219
|
if (portalId === null || portalId === undefined) {
|
|
186
220
|
throw new Error('Required parameter portalId was null or undefined when calling deletePortalFile.');
|
|
@@ -189,56 +223,52 @@ class UploadPortalApi {
|
|
|
189
223
|
if (deletePortalFileRequest === null || deletePortalFileRequest === undefined) {
|
|
190
224
|
throw new Error('Required parameter deletePortalFileRequest was null or undefined when calling deletePortalFile.');
|
|
191
225
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
226
|
+
localVarHeaderParams = {
|
|
227
|
+
...localVarHeaderParams,
|
|
228
|
+
...options.headers,
|
|
229
|
+
...this.opts.extraHeaders,
|
|
230
|
+
};
|
|
231
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
232
|
+
.filter(([, value]) => value !== undefined)
|
|
233
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
234
|
+
.join('&');
|
|
235
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
195
236
|
let localVarRequestOptions = {
|
|
196
237
|
method: 'POST',
|
|
197
|
-
|
|
198
|
-
headers: localVarHeaderParams,
|
|
199
|
-
uri: localVarPath,
|
|
200
|
-
useQuerystring: this._useQuerystring,
|
|
201
|
-
agentOptions: { keepAlive: false },
|
|
202
|
-
json: true,
|
|
203
|
-
body: models_1.ObjectSerializer.serialize(deletePortalFileRequest, "DeletePortalFileRequest")
|
|
238
|
+
headers: { ...localVarHeaderParams },
|
|
204
239
|
};
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
240
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(deletePortalFileRequest, "DeletePortalFileRequest"));
|
|
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
|
-
|
|
221
|
-
|
|
222
|
-
|
|
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
|
* Download a file from an upload portal (requires JWT auth). Will return a signed URL to the bucket.
|
|
@@ -250,9 +280,11 @@ class UploadPortalApi {
|
|
|
250
280
|
const localVarPath = this.basePath + '/api/portals/{portalId}/files/download'
|
|
251
281
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
252
282
|
let localVarQueryParameters = {};
|
|
253
|
-
let localVarHeaderParams =
|
|
254
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
255
|
-
|
|
283
|
+
let localVarHeaderParams = {
|
|
284
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
285
|
+
'Content-Type': 'application/json',
|
|
286
|
+
...this.defaultHeaders,
|
|
287
|
+
};
|
|
256
288
|
const produces = ['application/json'];
|
|
257
289
|
// give precedence to 'application/json'
|
|
258
290
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -261,7 +293,7 @@ class UploadPortalApi {
|
|
|
261
293
|
else {
|
|
262
294
|
localVarHeaderParams.Accept = produces.join(',');
|
|
263
295
|
}
|
|
264
|
-
let localVarFormParams
|
|
296
|
+
let localVarFormParams;
|
|
265
297
|
// verify required parameter 'portalId' is not null or undefined
|
|
266
298
|
if (portalId === null || portalId === undefined) {
|
|
267
299
|
throw new Error('Required parameter portalId was null or undefined when calling downloadPortalFile.');
|
|
@@ -270,56 +302,52 @@ class UploadPortalApi {
|
|
|
270
302
|
if (downloadPortalFileRequest === null || downloadPortalFileRequest === undefined) {
|
|
271
303
|
throw new Error('Required parameter downloadPortalFileRequest was null or undefined when calling downloadPortalFile.');
|
|
272
304
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
305
|
+
localVarHeaderParams = {
|
|
306
|
+
...localVarHeaderParams,
|
|
307
|
+
...options.headers,
|
|
308
|
+
...this.opts.extraHeaders,
|
|
309
|
+
};
|
|
310
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
311
|
+
.filter(([, value]) => value !== undefined)
|
|
312
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
313
|
+
.join('&');
|
|
314
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
276
315
|
let localVarRequestOptions = {
|
|
277
316
|
method: 'POST',
|
|
278
|
-
|
|
279
|
-
headers: localVarHeaderParams,
|
|
280
|
-
uri: localVarPath,
|
|
281
|
-
useQuerystring: this._useQuerystring,
|
|
282
|
-
agentOptions: { keepAlive: false },
|
|
283
|
-
json: true,
|
|
284
|
-
body: models_1.ObjectSerializer.serialize(downloadPortalFileRequest, "DownloadPortalFileRequest")
|
|
317
|
+
headers: { ...localVarHeaderParams },
|
|
285
318
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
319
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(downloadPortalFileRequest, "DownloadPortalFileRequest"));
|
|
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
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
reject(error);
|
|
305
|
-
}
|
|
306
|
-
else {
|
|
307
|
-
body = models_1.ObjectSerializer.deserialize(body, "DownloadPortalFileResponse");
|
|
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, 'DownloadPortalFileResponse');
|
|
323
351
|
}
|
|
324
352
|
/**
|
|
325
353
|
* Get information about a portal
|
|
@@ -330,9 +358,11 @@ class UploadPortalApi {
|
|
|
330
358
|
const localVarPath = this.basePath + '/api/portals/{portalId}'
|
|
331
359
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
332
360
|
let localVarQueryParameters = {};
|
|
333
|
-
let localVarHeaderParams =
|
|
334
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
335
|
-
|
|
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 UploadPortalApi {
|
|
|
341
371
|
else {
|
|
342
372
|
localVarHeaderParams.Accept = produces.join(',');
|
|
343
373
|
}
|
|
344
|
-
let localVarFormParams
|
|
374
|
+
let localVarFormParams;
|
|
345
375
|
// verify required parameter 'portalId' is not null or undefined
|
|
346
376
|
if (portalId === null || portalId === undefined) {
|
|
347
377
|
throw new Error('Required parameter portalId was null or undefined when calling getPortalInfo.');
|
|
348
378
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
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
|
-
|
|
355
|
-
headers: localVarHeaderParams,
|
|
356
|
-
uri: localVarPath,
|
|
357
|
-
useQuerystring: this._useQuerystring,
|
|
358
|
-
agentOptions: { keepAlive: false },
|
|
359
|
-
json: true,
|
|
391
|
+
headers: { ...localVarHeaderParams },
|
|
360
392
|
};
|
|
361
|
-
let
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
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, 'PortalInfoResponse');
|
|
398
424
|
}
|
|
399
425
|
/**
|
|
400
426
|
* List all files and directories in specified prefix.
|
|
@@ -406,9 +432,11 @@ class UploadPortalApi {
|
|
|
406
432
|
const localVarPath = this.basePath + '/api/portals/{portalId}/files'
|
|
407
433
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
408
434
|
let localVarQueryParameters = {};
|
|
409
|
-
let localVarHeaderParams =
|
|
410
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
411
|
-
|
|
435
|
+
let localVarHeaderParams = {
|
|
436
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
437
|
+
'Content-Type': 'application/json',
|
|
438
|
+
...this.defaultHeaders,
|
|
439
|
+
};
|
|
412
440
|
const produces = ['application/json'];
|
|
413
441
|
// give precedence to 'application/json'
|
|
414
442
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -417,7 +445,7 @@ class UploadPortalApi {
|
|
|
417
445
|
else {
|
|
418
446
|
localVarHeaderParams.Accept = produces.join(',');
|
|
419
447
|
}
|
|
420
|
-
let localVarFormParams
|
|
448
|
+
let localVarFormParams;
|
|
421
449
|
// verify required parameter 'portalId' is not null or undefined
|
|
422
450
|
if (portalId === null || portalId === undefined) {
|
|
423
451
|
throw new Error('Required parameter portalId was null or undefined when calling listPortalFilesInFolder.');
|
|
@@ -426,56 +454,52 @@ class UploadPortalApi {
|
|
|
426
454
|
if (listPortalFilesInFolderRequest === null || listPortalFilesInFolderRequest === undefined) {
|
|
427
455
|
throw new Error('Required parameter listPortalFilesInFolderRequest was null or undefined when calling listPortalFilesInFolder.');
|
|
428
456
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
457
|
+
localVarHeaderParams = {
|
|
458
|
+
...localVarHeaderParams,
|
|
459
|
+
...options.headers,
|
|
460
|
+
...this.opts.extraHeaders,
|
|
461
|
+
};
|
|
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}` : '');
|
|
432
467
|
let localVarRequestOptions = {
|
|
433
468
|
method: 'POST',
|
|
434
|
-
|
|
435
|
-
headers: localVarHeaderParams,
|
|
436
|
-
uri: localVarPath,
|
|
437
|
-
useQuerystring: this._useQuerystring,
|
|
438
|
-
agentOptions: { keepAlive: false },
|
|
439
|
-
json: true,
|
|
440
|
-
body: models_1.ObjectSerializer.serialize(listPortalFilesInFolderRequest, "ListPortalFilesInFolderRequest")
|
|
469
|
+
headers: { ...localVarHeaderParams },
|
|
441
470
|
};
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
471
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(listPortalFilesInFolderRequest, "ListPortalFilesInFolderRequest"));
|
|
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
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
reject(error);
|
|
461
|
-
}
|
|
462
|
-
else {
|
|
463
|
-
body = models_1.ObjectSerializer.deserialize(body, "ListPortalFilesInFolderResponse");
|
|
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, 'ListPortalFilesInFolderResponse');
|
|
479
503
|
}
|
|
480
504
|
/**
|
|
481
505
|
* Rename a file on an upload portal (requires JWT auth).
|
|
@@ -487,9 +511,11 @@ class UploadPortalApi {
|
|
|
487
511
|
const localVarPath = this.basePath + '/api/portals/{portalId}/files/rename'
|
|
488
512
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
489
513
|
let localVarQueryParameters = {};
|
|
490
|
-
let localVarHeaderParams =
|
|
491
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
492
|
-
|
|
514
|
+
let localVarHeaderParams = {
|
|
515
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
516
|
+
'Content-Type': 'application/json',
|
|
517
|
+
...this.defaultHeaders,
|
|
518
|
+
};
|
|
493
519
|
const produces = ['application/json'];
|
|
494
520
|
// give precedence to 'application/json'
|
|
495
521
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -498,7 +524,7 @@ class UploadPortalApi {
|
|
|
498
524
|
else {
|
|
499
525
|
localVarHeaderParams.Accept = produces.join(',');
|
|
500
526
|
}
|
|
501
|
-
let localVarFormParams
|
|
527
|
+
let localVarFormParams;
|
|
502
528
|
// verify required parameter 'portalId' is not null or undefined
|
|
503
529
|
if (portalId === null || portalId === undefined) {
|
|
504
530
|
throw new Error('Required parameter portalId was null or undefined when calling renamePortalFile.');
|
|
@@ -507,56 +533,52 @@ class UploadPortalApi {
|
|
|
507
533
|
if (renamePortalFileRequest === null || renamePortalFileRequest === undefined) {
|
|
508
534
|
throw new Error('Required parameter renamePortalFileRequest was null or undefined when calling renamePortalFile.');
|
|
509
535
|
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
536
|
+
localVarHeaderParams = {
|
|
537
|
+
...localVarHeaderParams,
|
|
538
|
+
...options.headers,
|
|
539
|
+
...this.opts.extraHeaders,
|
|
540
|
+
};
|
|
541
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
542
|
+
.filter(([, value]) => value !== undefined)
|
|
543
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
544
|
+
.join('&');
|
|
545
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
513
546
|
let localVarRequestOptions = {
|
|
514
547
|
method: 'POST',
|
|
515
|
-
|
|
516
|
-
headers: localVarHeaderParams,
|
|
517
|
-
uri: localVarPath,
|
|
518
|
-
useQuerystring: this._useQuerystring,
|
|
519
|
-
agentOptions: { keepAlive: false },
|
|
520
|
-
json: true,
|
|
521
|
-
body: models_1.ObjectSerializer.serialize(renamePortalFileRequest, "RenamePortalFileRequest")
|
|
548
|
+
headers: { ...localVarHeaderParams },
|
|
522
549
|
};
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
550
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(renamePortalFileRequest, "RenamePortalFileRequest"));
|
|
551
|
+
let requestOptions = localVarRequestOptions;
|
|
552
|
+
let url = localVarUrl;
|
|
553
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
554
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
555
|
+
url = auth_ApiKeyAuthentication.url;
|
|
556
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
557
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
558
|
+
url = auth_JWTAuthentication.url;
|
|
559
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
560
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
561
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
562
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
563
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
564
|
+
url = auth_OAuth2.url;
|
|
565
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
566
|
+
requestOptions = authDefault.requestOptions;
|
|
567
|
+
url = authDefault.url;
|
|
568
|
+
if (localVarFormParams) {
|
|
569
|
+
delete requestOptions.headers['Content-Type'];
|
|
570
|
+
if (localVarFormParams instanceof FormData) {
|
|
571
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
572
|
+
requestOptions.body = localVarFormParams;
|
|
537
573
|
}
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
547
|
-
reject(new Error(body.error || errString));
|
|
548
|
-
}
|
|
549
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
550
|
-
resolve(body);
|
|
551
|
-
}
|
|
552
|
-
else {
|
|
553
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
554
|
-
reject(errString);
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
});
|
|
574
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
575
|
+
// URL-encoded form
|
|
576
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
577
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
const response = await fetch(url, requestOptions);
|
|
581
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
560
582
|
}
|
|
561
583
|
/**
|
|
562
584
|
* View a file that\'s located in an upload portal (requires JWT auth). File might be converted (e.g. Parquet) or truncated (e.g. CSV).
|
|
@@ -568,9 +590,11 @@ class UploadPortalApi {
|
|
|
568
590
|
const localVarPath = this.basePath + '/api/portals/{portalId}/files/view'
|
|
569
591
|
.replace('{' + 'portalId' + '}', encodeURIComponent(String(portalId)));
|
|
570
592
|
let localVarQueryParameters = {};
|
|
571
|
-
let localVarHeaderParams =
|
|
572
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
573
|
-
|
|
593
|
+
let localVarHeaderParams = {
|
|
594
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
595
|
+
'Content-Type': 'application/json',
|
|
596
|
+
...this.defaultHeaders,
|
|
597
|
+
};
|
|
574
598
|
const produces = ['application/octet-stream'];
|
|
575
599
|
// give precedence to 'application/json'
|
|
576
600
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -579,7 +603,7 @@ class UploadPortalApi {
|
|
|
579
603
|
else {
|
|
580
604
|
localVarHeaderParams.Accept = produces.join(',');
|
|
581
605
|
}
|
|
582
|
-
let localVarFormParams
|
|
606
|
+
let localVarFormParams;
|
|
583
607
|
// verify required parameter 'portalId' is not null or undefined
|
|
584
608
|
if (portalId === null || portalId === undefined) {
|
|
585
609
|
throw new Error('Required parameter portalId was null or undefined when calling viewPortalFile.');
|
|
@@ -591,55 +615,51 @@ class UploadPortalApi {
|
|
|
591
615
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.path) !== undefined) {
|
|
592
616
|
localVarQueryParameters['path'] = models_1.ObjectSerializer.serialize(queryParams.path, "string");
|
|
593
617
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
618
|
+
localVarHeaderParams = {
|
|
619
|
+
...localVarHeaderParams,
|
|
620
|
+
...options.headers,
|
|
621
|
+
...this.opts.extraHeaders,
|
|
622
|
+
};
|
|
623
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
624
|
+
.filter(([, value]) => value !== undefined)
|
|
625
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
626
|
+
.join('&');
|
|
627
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
597
628
|
let localVarRequestOptions = {
|
|
598
629
|
method: 'GET',
|
|
599
|
-
|
|
600
|
-
headers: localVarHeaderParams,
|
|
601
|
-
uri: localVarPath,
|
|
602
|
-
useQuerystring: this._useQuerystring,
|
|
603
|
-
agentOptions: { keepAlive: false },
|
|
604
|
-
encoding: null,
|
|
630
|
+
headers: { ...localVarHeaderParams },
|
|
605
631
|
};
|
|
606
|
-
let
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
632
|
+
let requestOptions = localVarRequestOptions;
|
|
633
|
+
let url = localVarUrl;
|
|
634
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
635
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
636
|
+
url = auth_ApiKeyAuthentication.url;
|
|
637
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
638
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
639
|
+
url = auth_JWTAuthentication.url;
|
|
640
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
641
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
642
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
643
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
644
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
645
|
+
url = auth_OAuth2.url;
|
|
646
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
647
|
+
requestOptions = authDefault.requestOptions;
|
|
648
|
+
url = authDefault.url;
|
|
649
|
+
if (localVarFormParams) {
|
|
650
|
+
delete requestOptions.headers['Content-Type'];
|
|
651
|
+
if (localVarFormParams instanceof FormData) {
|
|
652
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
653
|
+
requestOptions.body = localVarFormParams;
|
|
620
654
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
630
|
-
reject(new Error(body.error || errString));
|
|
631
|
-
}
|
|
632
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
633
|
-
resolve(body);
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
637
|
-
reject(errString);
|
|
638
|
-
}
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
});
|
|
642
|
-
});
|
|
655
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
656
|
+
// URL-encoded form
|
|
657
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
658
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
const response = await fetch(url, requestOptions);
|
|
662
|
+
return this.handleResponse(response, 'Buffer');
|
|
643
663
|
}
|
|
644
664
|
}
|
|
645
665
|
exports.UploadPortalApi = UploadPortalApi;
|