edge-impulse-api 1.82.6 → 1.82.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.DevicesApi = exports.DevicesApiApiKeys = 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 DevicesApiApiKeys;
|
|
|
30
47
|
DevicesApiApiKeys[DevicesApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
|
|
31
48
|
})(DevicesApiApiKeys = exports.DevicesApiApiKeys || (exports.DevicesApiApiKeys = {}));
|
|
32
49
|
class DevicesApi {
|
|
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 DevicesApi {
|
|
|
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 DevicesApi {
|
|
|
88
122
|
const localVarPath = this.basePath + '/api/{projectId}/devices/create'
|
|
89
123
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
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 DevicesApi {
|
|
|
99
135
|
else {
|
|
100
136
|
localVarHeaderParams.Accept = produces.join(',');
|
|
101
137
|
}
|
|
102
|
-
let localVarFormParams
|
|
138
|
+
let localVarFormParams;
|
|
103
139
|
// verify required parameter 'projectId' is not null or undefined
|
|
104
140
|
if (projectId === null || projectId === undefined) {
|
|
105
141
|
throw new Error('Required parameter projectId was null or undefined when calling createDevice.');
|
|
@@ -108,56 +144,52 @@ class DevicesApi {
|
|
|
108
144
|
if (createDeviceRequest === null || createDeviceRequest === undefined) {
|
|
109
145
|
throw new Error('Required parameter createDeviceRequest was null or undefined when calling createDevice.');
|
|
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(createDeviceRequest, "CreateDeviceRequest")
|
|
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(createDeviceRequest, "CreateDeviceRequest"));
|
|
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, 'GenericApiResponse');
|
|
161
193
|
}
|
|
162
194
|
/**
|
|
163
195
|
* Delete a device. When this device sends a new message to ingestion or connects to remote management the device will be recreated.
|
|
@@ -170,9 +202,11 @@ class DevicesApi {
|
|
|
170
202
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
171
203
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
172
204
|
let localVarQueryParameters = {};
|
|
173
|
-
let localVarHeaderParams =
|
|
174
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
175
|
-
|
|
205
|
+
let localVarHeaderParams = {
|
|
206
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
207
|
+
'Content-Type': 'application/json',
|
|
208
|
+
...this.defaultHeaders,
|
|
209
|
+
};
|
|
176
210
|
const produces = ['application/json'];
|
|
177
211
|
// give precedence to 'application/json'
|
|
178
212
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -181,7 +215,7 @@ class DevicesApi {
|
|
|
181
215
|
else {
|
|
182
216
|
localVarHeaderParams.Accept = produces.join(',');
|
|
183
217
|
}
|
|
184
|
-
let localVarFormParams
|
|
218
|
+
let localVarFormParams;
|
|
185
219
|
// verify required parameter 'projectId' is not null or undefined
|
|
186
220
|
if (projectId === null || projectId === undefined) {
|
|
187
221
|
throw new Error('Required parameter projectId was null or undefined when calling deleteDevice.');
|
|
@@ -190,55 +224,51 @@ class DevicesApi {
|
|
|
190
224
|
if (deviceId === null || deviceId === undefined) {
|
|
191
225
|
throw new Error('Required parameter deviceId was null or undefined when calling deleteDevice.');
|
|
192
226
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
227
|
+
localVarHeaderParams = {
|
|
228
|
+
...localVarHeaderParams,
|
|
229
|
+
...options.headers,
|
|
230
|
+
...this.opts.extraHeaders,
|
|
231
|
+
};
|
|
232
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
233
|
+
.filter(([, value]) => value !== undefined)
|
|
234
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
235
|
+
.join('&');
|
|
236
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
196
237
|
let localVarRequestOptions = {
|
|
197
238
|
method: 'DELETE',
|
|
198
|
-
|
|
199
|
-
headers: localVarHeaderParams,
|
|
200
|
-
uri: localVarPath,
|
|
201
|
-
useQuerystring: this._useQuerystring,
|
|
202
|
-
agentOptions: { keepAlive: false },
|
|
203
|
-
json: true,
|
|
239
|
+
headers: { ...localVarHeaderParams },
|
|
204
240
|
};
|
|
205
|
-
let
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
241
|
+
let requestOptions = localVarRequestOptions;
|
|
242
|
+
let url = localVarUrl;
|
|
243
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
244
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
245
|
+
url = auth_ApiKeyAuthentication.url;
|
|
246
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
247
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
248
|
+
url = auth_JWTAuthentication.url;
|
|
249
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
250
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
251
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
252
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
253
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
254
|
+
url = auth_OAuth2.url;
|
|
255
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
256
|
+
requestOptions = authDefault.requestOptions;
|
|
257
|
+
url = authDefault.url;
|
|
258
|
+
if (localVarFormParams) {
|
|
259
|
+
delete requestOptions.headers['Content-Type'];
|
|
260
|
+
if (localVarFormParams instanceof FormData) {
|
|
261
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
262
|
+
requestOptions.body = localVarFormParams;
|
|
219
263
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
229
|
-
reject(new Error(body.error || errString));
|
|
230
|
-
}
|
|
231
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
232
|
-
resolve(body);
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
236
|
-
reject(errString);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
});
|
|
264
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
265
|
+
// URL-encoded form
|
|
266
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
267
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const response = await fetch(url, requestOptions);
|
|
271
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
242
272
|
}
|
|
243
273
|
/**
|
|
244
274
|
* Downloads exported on-device inference history data. This is experimental and may change in the future.
|
|
@@ -254,9 +284,11 @@ class DevicesApi {
|
|
|
254
284
|
const localVarPath = this.basePath + '/api/{projectId}/devices/inference-history/download-export'
|
|
255
285
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
256
286
|
let localVarQueryParameters = {};
|
|
257
|
-
let localVarHeaderParams =
|
|
258
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
259
|
-
|
|
287
|
+
let localVarHeaderParams = {
|
|
288
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
289
|
+
'Content-Type': 'application/json',
|
|
290
|
+
...this.defaultHeaders,
|
|
291
|
+
};
|
|
260
292
|
const produces = ['application/zip'];
|
|
261
293
|
// give precedence to 'application/json'
|
|
262
294
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -265,7 +297,7 @@ class DevicesApi {
|
|
|
265
297
|
else {
|
|
266
298
|
localVarHeaderParams.Accept = produces.join(',');
|
|
267
299
|
}
|
|
268
|
-
let localVarFormParams
|
|
300
|
+
let localVarFormParams;
|
|
269
301
|
// verify required parameter 'projectId' is not null or undefined
|
|
270
302
|
if (projectId === null || projectId === undefined) {
|
|
271
303
|
throw new Error('Required parameter projectId was null or undefined when calling downloadInferenceHistoryExport.');
|
|
@@ -301,55 +333,51 @@ class DevicesApi {
|
|
|
301
333
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.format) !== undefined) {
|
|
302
334
|
localVarQueryParameters['format'] = models_1.ObjectSerializer.serialize(queryParams.format, "'row-per-summary' | 'row-per-value'");
|
|
303
335
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
336
|
+
localVarHeaderParams = {
|
|
337
|
+
...localVarHeaderParams,
|
|
338
|
+
...options.headers,
|
|
339
|
+
...this.opts.extraHeaders,
|
|
340
|
+
};
|
|
341
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
342
|
+
.filter(([, value]) => value !== undefined)
|
|
343
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
344
|
+
.join('&');
|
|
345
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
307
346
|
let localVarRequestOptions = {
|
|
308
347
|
method: 'GET',
|
|
309
|
-
|
|
310
|
-
headers: localVarHeaderParams,
|
|
311
|
-
uri: localVarPath,
|
|
312
|
-
useQuerystring: this._useQuerystring,
|
|
313
|
-
agentOptions: { keepAlive: false },
|
|
314
|
-
encoding: null,
|
|
348
|
+
headers: { ...localVarHeaderParams },
|
|
315
349
|
};
|
|
316
|
-
let
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
350
|
+
let requestOptions = localVarRequestOptions;
|
|
351
|
+
let url = localVarUrl;
|
|
352
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
353
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
354
|
+
url = auth_ApiKeyAuthentication.url;
|
|
355
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
356
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
357
|
+
url = auth_JWTAuthentication.url;
|
|
358
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
359
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
360
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
361
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
362
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
363
|
+
url = auth_OAuth2.url;
|
|
364
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
365
|
+
requestOptions = authDefault.requestOptions;
|
|
366
|
+
url = authDefault.url;
|
|
367
|
+
if (localVarFormParams) {
|
|
368
|
+
delete requestOptions.headers['Content-Type'];
|
|
369
|
+
if (localVarFormParams instanceof FormData) {
|
|
370
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
371
|
+
requestOptions.body = localVarFormParams;
|
|
372
|
+
}
|
|
373
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
374
|
+
// URL-encoded form
|
|
375
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
376
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
330
377
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
reject(error);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
body = models_1.ObjectSerializer.deserialize(body, "Buffer");
|
|
338
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
339
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
340
|
-
reject(new Error(body.error || errString));
|
|
341
|
-
}
|
|
342
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
343
|
-
resolve(body);
|
|
344
|
-
}
|
|
345
|
-
else {
|
|
346
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
347
|
-
reject(errString);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
});
|
|
352
|
-
});
|
|
378
|
+
}
|
|
379
|
+
const response = await fetch(url, requestOptions);
|
|
380
|
+
return this.handleResponse(response, 'Buffer');
|
|
353
381
|
}
|
|
354
382
|
/**
|
|
355
383
|
* Retrieves a single device
|
|
@@ -362,9 +390,11 @@ class DevicesApi {
|
|
|
362
390
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
363
391
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
364
392
|
let localVarQueryParameters = {};
|
|
365
|
-
let localVarHeaderParams =
|
|
366
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
367
|
-
|
|
393
|
+
let localVarHeaderParams = {
|
|
394
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
395
|
+
'Content-Type': 'application/json',
|
|
396
|
+
...this.defaultHeaders,
|
|
397
|
+
};
|
|
368
398
|
const produces = ['application/json'];
|
|
369
399
|
// give precedence to 'application/json'
|
|
370
400
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -373,7 +403,7 @@ class DevicesApi {
|
|
|
373
403
|
else {
|
|
374
404
|
localVarHeaderParams.Accept = produces.join(',');
|
|
375
405
|
}
|
|
376
|
-
let localVarFormParams
|
|
406
|
+
let localVarFormParams;
|
|
377
407
|
// verify required parameter 'projectId' is not null or undefined
|
|
378
408
|
if (projectId === null || projectId === undefined) {
|
|
379
409
|
throw new Error('Required parameter projectId was null or undefined when calling getDevice.');
|
|
@@ -382,55 +412,51 @@ class DevicesApi {
|
|
|
382
412
|
if (deviceId === null || deviceId === undefined) {
|
|
383
413
|
throw new Error('Required parameter deviceId was null or undefined when calling getDevice.');
|
|
384
414
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
415
|
+
localVarHeaderParams = {
|
|
416
|
+
...localVarHeaderParams,
|
|
417
|
+
...options.headers,
|
|
418
|
+
...this.opts.extraHeaders,
|
|
419
|
+
};
|
|
420
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
421
|
+
.filter(([, value]) => value !== undefined)
|
|
422
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
423
|
+
.join('&');
|
|
424
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
388
425
|
let localVarRequestOptions = {
|
|
389
426
|
method: 'GET',
|
|
390
|
-
|
|
391
|
-
headers: localVarHeaderParams,
|
|
392
|
-
uri: localVarPath,
|
|
393
|
-
useQuerystring: this._useQuerystring,
|
|
394
|
-
agentOptions: { keepAlive: false },
|
|
395
|
-
json: true,
|
|
427
|
+
headers: { ...localVarHeaderParams },
|
|
396
428
|
};
|
|
397
|
-
let
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
429
|
+
let requestOptions = localVarRequestOptions;
|
|
430
|
+
let url = localVarUrl;
|
|
431
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
432
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
433
|
+
url = auth_ApiKeyAuthentication.url;
|
|
434
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
435
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
436
|
+
url = auth_JWTAuthentication.url;
|
|
437
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
438
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
439
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
440
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
441
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
442
|
+
url = auth_OAuth2.url;
|
|
443
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
444
|
+
requestOptions = authDefault.requestOptions;
|
|
445
|
+
url = authDefault.url;
|
|
446
|
+
if (localVarFormParams) {
|
|
447
|
+
delete requestOptions.headers['Content-Type'];
|
|
448
|
+
if (localVarFormParams instanceof FormData) {
|
|
449
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
450
|
+
requestOptions.body = localVarFormParams;
|
|
451
|
+
}
|
|
452
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
453
|
+
// URL-encoded form
|
|
454
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
455
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
411
456
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
reject(error);
|
|
416
|
-
}
|
|
417
|
-
else {
|
|
418
|
-
body = models_1.ObjectSerializer.deserialize(body, "GetDeviceResponse");
|
|
419
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
420
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
421
|
-
reject(new Error(body.error || errString));
|
|
422
|
-
}
|
|
423
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
424
|
-
resolve(body);
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
428
|
-
reject(errString);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
});
|
|
432
|
-
});
|
|
433
|
-
});
|
|
457
|
+
}
|
|
458
|
+
const response = await fetch(url, requestOptions);
|
|
459
|
+
return this.handleResponse(response, 'GetDeviceResponse');
|
|
434
460
|
}
|
|
435
461
|
/**
|
|
436
462
|
* Retrieve impulse records from the device.
|
|
@@ -444,9 +470,11 @@ class DevicesApi {
|
|
|
444
470
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
445
471
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
446
472
|
let localVarQueryParameters = {};
|
|
447
|
-
let localVarHeaderParams =
|
|
448
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
449
|
-
|
|
473
|
+
let localVarHeaderParams = {
|
|
474
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
475
|
+
'Content-Type': 'application/json',
|
|
476
|
+
...this.defaultHeaders,
|
|
477
|
+
};
|
|
450
478
|
const produces = ['application/json'];
|
|
451
479
|
// give precedence to 'application/json'
|
|
452
480
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -455,7 +483,7 @@ class DevicesApi {
|
|
|
455
483
|
else {
|
|
456
484
|
localVarHeaderParams.Accept = produces.join(',');
|
|
457
485
|
}
|
|
458
|
-
let localVarFormParams
|
|
486
|
+
let localVarFormParams;
|
|
459
487
|
// verify required parameter 'projectId' is not null or undefined
|
|
460
488
|
if (projectId === null || projectId === undefined) {
|
|
461
489
|
throw new Error('Required parameter projectId was null or undefined when calling getImpulseRecords.');
|
|
@@ -468,56 +496,52 @@ class DevicesApi {
|
|
|
468
496
|
if (getImpulseRecordsRequest === null || getImpulseRecordsRequest === undefined) {
|
|
469
497
|
throw new Error('Required parameter getImpulseRecordsRequest was null or undefined when calling getImpulseRecords.');
|
|
470
498
|
}
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
499
|
+
localVarHeaderParams = {
|
|
500
|
+
...localVarHeaderParams,
|
|
501
|
+
...options.headers,
|
|
502
|
+
...this.opts.extraHeaders,
|
|
503
|
+
};
|
|
504
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
505
|
+
.filter(([, value]) => value !== undefined)
|
|
506
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
507
|
+
.join('&');
|
|
508
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
474
509
|
let localVarRequestOptions = {
|
|
475
510
|
method: 'POST',
|
|
476
|
-
|
|
477
|
-
headers: localVarHeaderParams,
|
|
478
|
-
uri: localVarPath,
|
|
479
|
-
useQuerystring: this._useQuerystring,
|
|
480
|
-
agentOptions: { keepAlive: false },
|
|
481
|
-
json: true,
|
|
482
|
-
body: models_1.ObjectSerializer.serialize(getImpulseRecordsRequest, "GetImpulseRecordsRequest")
|
|
511
|
+
headers: { ...localVarHeaderParams },
|
|
483
512
|
};
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
513
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(getImpulseRecordsRequest, "GetImpulseRecordsRequest"));
|
|
514
|
+
let requestOptions = localVarRequestOptions;
|
|
515
|
+
let url = localVarUrl;
|
|
516
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
517
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
518
|
+
url = auth_ApiKeyAuthentication.url;
|
|
519
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
520
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
521
|
+
url = auth_JWTAuthentication.url;
|
|
522
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
523
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
524
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
525
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
526
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
527
|
+
url = auth_OAuth2.url;
|
|
528
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
529
|
+
requestOptions = authDefault.requestOptions;
|
|
530
|
+
url = authDefault.url;
|
|
531
|
+
if (localVarFormParams) {
|
|
532
|
+
delete requestOptions.headers['Content-Type'];
|
|
533
|
+
if (localVarFormParams instanceof FormData) {
|
|
534
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
535
|
+
requestOptions.body = localVarFormParams;
|
|
498
536
|
}
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
508
|
-
reject(new Error(body.error || errString));
|
|
509
|
-
}
|
|
510
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
511
|
-
resolve(body);
|
|
512
|
-
}
|
|
513
|
-
else {
|
|
514
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
515
|
-
reject(errString);
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
});
|
|
519
|
-
});
|
|
520
|
-
});
|
|
537
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
538
|
+
// URL-encoded form
|
|
539
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
540
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
const response = await fetch(url, requestOptions);
|
|
544
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
521
545
|
}
|
|
522
546
|
/**
|
|
523
547
|
* Get summary metrics for historical on-device inferences, aggregated by device and by time. This is experimental and may change in the future.
|
|
@@ -532,9 +556,11 @@ class DevicesApi {
|
|
|
532
556
|
const localVarPath = this.basePath + '/api/{projectId}/devices/inference-history'
|
|
533
557
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
534
558
|
let localVarQueryParameters = {};
|
|
535
|
-
let localVarHeaderParams =
|
|
536
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
537
|
-
|
|
559
|
+
let localVarHeaderParams = {
|
|
560
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
561
|
+
'Content-Type': 'application/json',
|
|
562
|
+
...this.defaultHeaders,
|
|
563
|
+
};
|
|
538
564
|
const produces = ['application/json'];
|
|
539
565
|
// give precedence to 'application/json'
|
|
540
566
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -543,7 +569,7 @@ class DevicesApi {
|
|
|
543
569
|
else {
|
|
544
570
|
localVarHeaderParams.Accept = produces.join(',');
|
|
545
571
|
}
|
|
546
|
-
let localVarFormParams
|
|
572
|
+
let localVarFormParams;
|
|
547
573
|
// verify required parameter 'projectId' is not null or undefined
|
|
548
574
|
if (projectId === null || projectId === undefined) {
|
|
549
575
|
throw new Error('Required parameter projectId was null or undefined when calling getInferenceHistory.');
|
|
@@ -564,55 +590,51 @@ class DevicesApi {
|
|
|
564
590
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.devices) !== undefined) {
|
|
565
591
|
localVarQueryParameters['devices'] = models_1.ObjectSerializer.serialize(queryParams.devices, "string");
|
|
566
592
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
593
|
+
localVarHeaderParams = {
|
|
594
|
+
...localVarHeaderParams,
|
|
595
|
+
...options.headers,
|
|
596
|
+
...this.opts.extraHeaders,
|
|
597
|
+
};
|
|
598
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
599
|
+
.filter(([, value]) => value !== undefined)
|
|
600
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
601
|
+
.join('&');
|
|
602
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
570
603
|
let localVarRequestOptions = {
|
|
571
604
|
method: 'GET',
|
|
572
|
-
|
|
573
|
-
headers: localVarHeaderParams,
|
|
574
|
-
uri: localVarPath,
|
|
575
|
-
useQuerystring: this._useQuerystring,
|
|
576
|
-
agentOptions: { keepAlive: false },
|
|
577
|
-
json: true,
|
|
605
|
+
headers: { ...localVarHeaderParams },
|
|
578
606
|
};
|
|
579
|
-
let
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
607
|
+
let requestOptions = localVarRequestOptions;
|
|
608
|
+
let url = localVarUrl;
|
|
609
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
610
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
611
|
+
url = auth_ApiKeyAuthentication.url;
|
|
612
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
613
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
614
|
+
url = auth_JWTAuthentication.url;
|
|
615
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
616
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
617
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
618
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
619
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
620
|
+
url = auth_OAuth2.url;
|
|
621
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
622
|
+
requestOptions = authDefault.requestOptions;
|
|
623
|
+
url = authDefault.url;
|
|
624
|
+
if (localVarFormParams) {
|
|
625
|
+
delete requestOptions.headers['Content-Type'];
|
|
626
|
+
if (localVarFormParams instanceof FormData) {
|
|
627
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
628
|
+
requestOptions.body = localVarFormParams;
|
|
629
|
+
}
|
|
630
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
631
|
+
// URL-encoded form
|
|
632
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
633
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
593
634
|
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
reject(error);
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
body = models_1.ObjectSerializer.deserialize(body, "GetInferenceHistoryResponse");
|
|
601
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
602
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
603
|
-
reject(new Error(body.error || errString));
|
|
604
|
-
}
|
|
605
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
606
|
-
resolve(body);
|
|
607
|
-
}
|
|
608
|
-
else {
|
|
609
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
610
|
-
reject(errString);
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
});
|
|
615
|
-
});
|
|
635
|
+
}
|
|
636
|
+
const response = await fetch(url, requestOptions);
|
|
637
|
+
return this.handleResponse(response, 'GetInferenceHistoryResponse');
|
|
616
638
|
}
|
|
617
639
|
/**
|
|
618
640
|
* Get metrics from past on-device inferences, filtered and aggregated by custom criteria. This is experimental and may change in the future.
|
|
@@ -627,9 +649,11 @@ class DevicesApi {
|
|
|
627
649
|
const localVarPath = this.basePath + '/api/{projectId}/devices/inference-history/metrics'
|
|
628
650
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
629
651
|
let localVarQueryParameters = {};
|
|
630
|
-
let localVarHeaderParams =
|
|
631
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
632
|
-
|
|
652
|
+
let localVarHeaderParams = {
|
|
653
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
654
|
+
'Content-Type': 'application/json',
|
|
655
|
+
...this.defaultHeaders,
|
|
656
|
+
};
|
|
633
657
|
const produces = ['application/json'];
|
|
634
658
|
// give precedence to 'application/json'
|
|
635
659
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -638,7 +662,7 @@ class DevicesApi {
|
|
|
638
662
|
else {
|
|
639
663
|
localVarHeaderParams.Accept = produces.join(',');
|
|
640
664
|
}
|
|
641
|
-
let localVarFormParams
|
|
665
|
+
let localVarFormParams;
|
|
642
666
|
// verify required parameter 'projectId' is not null or undefined
|
|
643
667
|
if (projectId === null || projectId === undefined) {
|
|
644
668
|
throw new Error('Required parameter projectId was null or undefined when calling getInferenceMetrics.');
|
|
@@ -660,56 +684,52 @@ class DevicesApi {
|
|
|
660
684
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.endTimestamp) !== undefined) {
|
|
661
685
|
localVarQueryParameters['endTimestamp'] = models_1.ObjectSerializer.serialize(queryParams.endTimestamp, "number");
|
|
662
686
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
687
|
+
localVarHeaderParams = {
|
|
688
|
+
...localVarHeaderParams,
|
|
689
|
+
...options.headers,
|
|
690
|
+
...this.opts.extraHeaders,
|
|
691
|
+
};
|
|
692
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
693
|
+
.filter(([, value]) => value !== undefined)
|
|
694
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
695
|
+
.join('&');
|
|
696
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
666
697
|
let localVarRequestOptions = {
|
|
667
698
|
method: 'POST',
|
|
668
|
-
|
|
669
|
-
headers: localVarHeaderParams,
|
|
670
|
-
uri: localVarPath,
|
|
671
|
-
useQuerystring: this._useQuerystring,
|
|
672
|
-
agentOptions: { keepAlive: false },
|
|
673
|
-
json: true,
|
|
674
|
-
body: models_1.ObjectSerializer.serialize(getInferenceMetricsRequest, "GetInferenceMetricsRequest")
|
|
699
|
+
headers: { ...localVarHeaderParams },
|
|
675
700
|
};
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
701
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(getInferenceMetricsRequest, "GetInferenceMetricsRequest"));
|
|
702
|
+
let requestOptions = localVarRequestOptions;
|
|
703
|
+
let url = localVarUrl;
|
|
704
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
705
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
706
|
+
url = auth_ApiKeyAuthentication.url;
|
|
707
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
708
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
709
|
+
url = auth_JWTAuthentication.url;
|
|
710
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
711
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
712
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
713
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
714
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
715
|
+
url = auth_OAuth2.url;
|
|
716
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
717
|
+
requestOptions = authDefault.requestOptions;
|
|
718
|
+
url = authDefault.url;
|
|
719
|
+
if (localVarFormParams) {
|
|
720
|
+
delete requestOptions.headers['Content-Type'];
|
|
721
|
+
if (localVarFormParams instanceof FormData) {
|
|
722
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
723
|
+
requestOptions.body = localVarFormParams;
|
|
724
|
+
}
|
|
725
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
726
|
+
// URL-encoded form
|
|
727
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
728
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
690
729
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
reject(error);
|
|
695
|
-
}
|
|
696
|
-
else {
|
|
697
|
-
body = models_1.ObjectSerializer.deserialize(body, "GetInferenceMetricsResponse");
|
|
698
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
699
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
700
|
-
reject(new Error(body.error || errString));
|
|
701
|
-
}
|
|
702
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
703
|
-
resolve(body);
|
|
704
|
-
}
|
|
705
|
-
else {
|
|
706
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
707
|
-
reject(errString);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
|
-
});
|
|
712
|
-
});
|
|
730
|
+
}
|
|
731
|
+
const response = await fetch(url, requestOptions);
|
|
732
|
+
return this.handleResponse(response, 'GetInferenceMetricsResponse');
|
|
713
733
|
}
|
|
714
734
|
/**
|
|
715
735
|
* If you have opened a debug stream, ping this interface every 10 seconds to let us know to keep the debug stream open.
|
|
@@ -723,9 +743,11 @@ class DevicesApi {
|
|
|
723
743
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
724
744
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
725
745
|
let localVarQueryParameters = {};
|
|
726
|
-
let localVarHeaderParams =
|
|
727
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
728
|
-
|
|
746
|
+
let localVarHeaderParams = {
|
|
747
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
748
|
+
'Content-Type': 'application/json',
|
|
749
|
+
...this.defaultHeaders,
|
|
750
|
+
};
|
|
729
751
|
const produces = ['application/json'];
|
|
730
752
|
// give precedence to 'application/json'
|
|
731
753
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -734,7 +756,7 @@ class DevicesApi {
|
|
|
734
756
|
else {
|
|
735
757
|
localVarHeaderParams.Accept = produces.join(',');
|
|
736
758
|
}
|
|
737
|
-
let localVarFormParams
|
|
759
|
+
let localVarFormParams;
|
|
738
760
|
// verify required parameter 'projectId' is not null or undefined
|
|
739
761
|
if (projectId === null || projectId === undefined) {
|
|
740
762
|
throw new Error('Required parameter projectId was null or undefined when calling keepDeviceDebugStreamAlive.');
|
|
@@ -747,56 +769,52 @@ class DevicesApi {
|
|
|
747
769
|
if (keepDeviceDebugStreamAliveRequest === null || keepDeviceDebugStreamAliveRequest === undefined) {
|
|
748
770
|
throw new Error('Required parameter keepDeviceDebugStreamAliveRequest was null or undefined when calling keepDeviceDebugStreamAlive.');
|
|
749
771
|
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
772
|
+
localVarHeaderParams = {
|
|
773
|
+
...localVarHeaderParams,
|
|
774
|
+
...options.headers,
|
|
775
|
+
...this.opts.extraHeaders,
|
|
776
|
+
};
|
|
777
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
778
|
+
.filter(([, value]) => value !== undefined)
|
|
779
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
780
|
+
.join('&');
|
|
781
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
753
782
|
let localVarRequestOptions = {
|
|
754
783
|
method: 'POST',
|
|
755
|
-
|
|
756
|
-
headers: localVarHeaderParams,
|
|
757
|
-
uri: localVarPath,
|
|
758
|
-
useQuerystring: this._useQuerystring,
|
|
759
|
-
agentOptions: { keepAlive: false },
|
|
760
|
-
json: true,
|
|
761
|
-
body: models_1.ObjectSerializer.serialize(keepDeviceDebugStreamAliveRequest, "KeepDeviceDebugStreamAliveRequest")
|
|
784
|
+
headers: { ...localVarHeaderParams },
|
|
762
785
|
};
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
786
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(keepDeviceDebugStreamAliveRequest, "KeepDeviceDebugStreamAliveRequest"));
|
|
787
|
+
let requestOptions = localVarRequestOptions;
|
|
788
|
+
let url = localVarUrl;
|
|
789
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
790
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
791
|
+
url = auth_ApiKeyAuthentication.url;
|
|
792
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
793
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
794
|
+
url = auth_JWTAuthentication.url;
|
|
795
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
796
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
797
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
798
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
799
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
800
|
+
url = auth_OAuth2.url;
|
|
801
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
802
|
+
requestOptions = authDefault.requestOptions;
|
|
803
|
+
url = authDefault.url;
|
|
804
|
+
if (localVarFormParams) {
|
|
805
|
+
delete requestOptions.headers['Content-Type'];
|
|
806
|
+
if (localVarFormParams instanceof FormData) {
|
|
807
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
808
|
+
requestOptions.body = localVarFormParams;
|
|
777
809
|
}
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
787
|
-
reject(new Error(body.error || errString));
|
|
788
|
-
}
|
|
789
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
790
|
-
resolve(body);
|
|
791
|
-
}
|
|
792
|
-
else {
|
|
793
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
794
|
-
reject(errString);
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
});
|
|
798
|
-
});
|
|
799
|
-
});
|
|
810
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
811
|
+
// URL-encoded form
|
|
812
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
813
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
const response = await fetch(url, requestOptions);
|
|
817
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
800
818
|
}
|
|
801
819
|
/**
|
|
802
820
|
* List all devices for this project. Devices get included here if they connect to the remote management API or if they have sent data to the ingestion API and had the `device_id` field set.
|
|
@@ -807,9 +825,11 @@ class DevicesApi {
|
|
|
807
825
|
const localVarPath = this.basePath + '/api/{projectId}/devices'
|
|
808
826
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
809
827
|
let localVarQueryParameters = {};
|
|
810
|
-
let localVarHeaderParams =
|
|
811
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
812
|
-
|
|
828
|
+
let localVarHeaderParams = {
|
|
829
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
830
|
+
'Content-Type': 'application/json',
|
|
831
|
+
...this.defaultHeaders,
|
|
832
|
+
};
|
|
813
833
|
const produces = ['application/json'];
|
|
814
834
|
// give precedence to 'application/json'
|
|
815
835
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -818,60 +838,56 @@ class DevicesApi {
|
|
|
818
838
|
else {
|
|
819
839
|
localVarHeaderParams.Accept = produces.join(',');
|
|
820
840
|
}
|
|
821
|
-
let localVarFormParams
|
|
841
|
+
let localVarFormParams;
|
|
822
842
|
// verify required parameter 'projectId' is not null or undefined
|
|
823
843
|
if (projectId === null || projectId === undefined) {
|
|
824
844
|
throw new Error('Required parameter projectId was null or undefined when calling listDevices.');
|
|
825
845
|
}
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
846
|
+
localVarHeaderParams = {
|
|
847
|
+
...localVarHeaderParams,
|
|
848
|
+
...options.headers,
|
|
849
|
+
...this.opts.extraHeaders,
|
|
850
|
+
};
|
|
851
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
852
|
+
.filter(([, value]) => value !== undefined)
|
|
853
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
854
|
+
.join('&');
|
|
855
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
829
856
|
let localVarRequestOptions = {
|
|
830
857
|
method: 'GET',
|
|
831
|
-
|
|
832
|
-
headers: localVarHeaderParams,
|
|
833
|
-
uri: localVarPath,
|
|
834
|
-
useQuerystring: this._useQuerystring,
|
|
835
|
-
agentOptions: { keepAlive: false },
|
|
836
|
-
json: true,
|
|
858
|
+
headers: { ...localVarHeaderParams },
|
|
837
859
|
};
|
|
838
|
-
let
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
860
|
+
let requestOptions = localVarRequestOptions;
|
|
861
|
+
let url = localVarUrl;
|
|
862
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
863
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
864
|
+
url = auth_ApiKeyAuthentication.url;
|
|
865
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
866
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
867
|
+
url = auth_JWTAuthentication.url;
|
|
868
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
869
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
870
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
871
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
872
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
873
|
+
url = auth_OAuth2.url;
|
|
874
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
875
|
+
requestOptions = authDefault.requestOptions;
|
|
876
|
+
url = authDefault.url;
|
|
877
|
+
if (localVarFormParams) {
|
|
878
|
+
delete requestOptions.headers['Content-Type'];
|
|
879
|
+
if (localVarFormParams instanceof FormData) {
|
|
880
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
881
|
+
requestOptions.body = localVarFormParams;
|
|
882
|
+
}
|
|
883
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
884
|
+
// URL-encoded form
|
|
885
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
886
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
852
887
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
reject(error);
|
|
857
|
-
}
|
|
858
|
-
else {
|
|
859
|
-
body = models_1.ObjectSerializer.deserialize(body, "ListDevicesResponse");
|
|
860
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
861
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
862
|
-
reject(new Error(body.error || errString));
|
|
863
|
-
}
|
|
864
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
865
|
-
resolve(body);
|
|
866
|
-
}
|
|
867
|
-
else {
|
|
868
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
869
|
-
reject(errString);
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
});
|
|
873
|
-
});
|
|
874
|
-
});
|
|
888
|
+
}
|
|
889
|
+
const response = await fetch(url, requestOptions);
|
|
890
|
+
return this.handleResponse(response, 'ListDevicesResponse');
|
|
875
891
|
}
|
|
876
892
|
/**
|
|
877
893
|
* Set the current name for a device.
|
|
@@ -885,9 +901,11 @@ class DevicesApi {
|
|
|
885
901
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
886
902
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
887
903
|
let localVarQueryParameters = {};
|
|
888
|
-
let localVarHeaderParams =
|
|
889
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
890
|
-
|
|
904
|
+
let localVarHeaderParams = {
|
|
905
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
906
|
+
'Content-Type': 'application/json',
|
|
907
|
+
...this.defaultHeaders,
|
|
908
|
+
};
|
|
891
909
|
const produces = ['application/json'];
|
|
892
910
|
// give precedence to 'application/json'
|
|
893
911
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -896,7 +914,7 @@ class DevicesApi {
|
|
|
896
914
|
else {
|
|
897
915
|
localVarHeaderParams.Accept = produces.join(',');
|
|
898
916
|
}
|
|
899
|
-
let localVarFormParams
|
|
917
|
+
let localVarFormParams;
|
|
900
918
|
// verify required parameter 'projectId' is not null or undefined
|
|
901
919
|
if (projectId === null || projectId === undefined) {
|
|
902
920
|
throw new Error('Required parameter projectId was null or undefined when calling renameDevice.');
|
|
@@ -909,56 +927,52 @@ class DevicesApi {
|
|
|
909
927
|
if (renameDeviceRequest === null || renameDeviceRequest === undefined) {
|
|
910
928
|
throw new Error('Required parameter renameDeviceRequest was null or undefined when calling renameDevice.');
|
|
911
929
|
}
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
930
|
+
localVarHeaderParams = {
|
|
931
|
+
...localVarHeaderParams,
|
|
932
|
+
...options.headers,
|
|
933
|
+
...this.opts.extraHeaders,
|
|
934
|
+
};
|
|
935
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
936
|
+
.filter(([, value]) => value !== undefined)
|
|
937
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
938
|
+
.join('&');
|
|
939
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
915
940
|
let localVarRequestOptions = {
|
|
916
941
|
method: 'POST',
|
|
917
|
-
|
|
918
|
-
headers: localVarHeaderParams,
|
|
919
|
-
uri: localVarPath,
|
|
920
|
-
useQuerystring: this._useQuerystring,
|
|
921
|
-
agentOptions: { keepAlive: false },
|
|
922
|
-
json: true,
|
|
923
|
-
body: models_1.ObjectSerializer.serialize(renameDeviceRequest, "RenameDeviceRequest")
|
|
942
|
+
headers: { ...localVarHeaderParams },
|
|
924
943
|
};
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
944
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(renameDeviceRequest, "RenameDeviceRequest"));
|
|
945
|
+
let requestOptions = localVarRequestOptions;
|
|
946
|
+
let url = localVarUrl;
|
|
947
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
948
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
949
|
+
url = auth_ApiKeyAuthentication.url;
|
|
950
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
951
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
952
|
+
url = auth_JWTAuthentication.url;
|
|
953
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
954
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
955
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
956
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
957
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
958
|
+
url = auth_OAuth2.url;
|
|
959
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
960
|
+
requestOptions = authDefault.requestOptions;
|
|
961
|
+
url = authDefault.url;
|
|
962
|
+
if (localVarFormParams) {
|
|
963
|
+
delete requestOptions.headers['Content-Type'];
|
|
964
|
+
if (localVarFormParams instanceof FormData) {
|
|
965
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
966
|
+
requestOptions.body = localVarFormParams;
|
|
967
|
+
}
|
|
968
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
969
|
+
// URL-encoded form
|
|
970
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
971
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
939
972
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
reject(error);
|
|
944
|
-
}
|
|
945
|
-
else {
|
|
946
|
-
body = models_1.ObjectSerializer.deserialize(body, "GenericApiResponse");
|
|
947
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
948
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
949
|
-
reject(new Error(body.error || errString));
|
|
950
|
-
}
|
|
951
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
952
|
-
resolve(body);
|
|
953
|
-
}
|
|
954
|
-
else {
|
|
955
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
956
|
-
reject(errString);
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
});
|
|
960
|
-
});
|
|
961
|
-
});
|
|
973
|
+
}
|
|
974
|
+
const response = await fetch(url, requestOptions);
|
|
975
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
962
976
|
}
|
|
963
977
|
/**
|
|
964
978
|
* Trigger a model update request, this only works for devices connected to remote management server in inference mode.
|
|
@@ -971,9 +985,11 @@ class DevicesApi {
|
|
|
971
985
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
972
986
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
973
987
|
let localVarQueryParameters = {};
|
|
974
|
-
let localVarHeaderParams =
|
|
975
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
976
|
-
|
|
988
|
+
let localVarHeaderParams = {
|
|
989
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
990
|
+
'Content-Type': 'application/json',
|
|
991
|
+
...this.defaultHeaders,
|
|
992
|
+
};
|
|
977
993
|
const produces = ['application/json'];
|
|
978
994
|
// give precedence to 'application/json'
|
|
979
995
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -982,7 +998,7 @@ class DevicesApi {
|
|
|
982
998
|
else {
|
|
983
999
|
localVarHeaderParams.Accept = produces.join(',');
|
|
984
1000
|
}
|
|
985
|
-
let localVarFormParams
|
|
1001
|
+
let localVarFormParams;
|
|
986
1002
|
// verify required parameter 'projectId' is not null or undefined
|
|
987
1003
|
if (projectId === null || projectId === undefined) {
|
|
988
1004
|
throw new Error('Required parameter projectId was null or undefined when calling requestDeviceModelUpdate.');
|
|
@@ -991,55 +1007,51 @@ class DevicesApi {
|
|
|
991
1007
|
if (deviceId === null || deviceId === undefined) {
|
|
992
1008
|
throw new Error('Required parameter deviceId was null or undefined when calling requestDeviceModelUpdate.');
|
|
993
1009
|
}
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
1010
|
+
localVarHeaderParams = {
|
|
1011
|
+
...localVarHeaderParams,
|
|
1012
|
+
...options.headers,
|
|
1013
|
+
...this.opts.extraHeaders,
|
|
1014
|
+
};
|
|
1015
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1016
|
+
.filter(([, value]) => value !== undefined)
|
|
1017
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1018
|
+
.join('&');
|
|
1019
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
997
1020
|
let localVarRequestOptions = {
|
|
998
1021
|
method: 'POST',
|
|
999
|
-
|
|
1000
|
-
headers: localVarHeaderParams,
|
|
1001
|
-
uri: localVarPath,
|
|
1002
|
-
useQuerystring: this._useQuerystring,
|
|
1003
|
-
agentOptions: { keepAlive: false },
|
|
1004
|
-
json: true,
|
|
1022
|
+
headers: { ...localVarHeaderParams },
|
|
1005
1023
|
};
|
|
1006
|
-
let
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1024
|
+
let requestOptions = localVarRequestOptions;
|
|
1025
|
+
let url = localVarUrl;
|
|
1026
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1027
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1028
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1029
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1030
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1031
|
+
url = auth_JWTAuthentication.url;
|
|
1032
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1033
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1034
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1035
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1036
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1037
|
+
url = auth_OAuth2.url;
|
|
1038
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1039
|
+
requestOptions = authDefault.requestOptions;
|
|
1040
|
+
url = authDefault.url;
|
|
1041
|
+
if (localVarFormParams) {
|
|
1042
|
+
delete requestOptions.headers['Content-Type'];
|
|
1043
|
+
if (localVarFormParams instanceof FormData) {
|
|
1044
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1045
|
+
requestOptions.body = localVarFormParams;
|
|
1020
1046
|
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1030
|
-
reject(new Error(body.error || errString));
|
|
1031
|
-
}
|
|
1032
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1033
|
-
resolve(body);
|
|
1034
|
-
}
|
|
1035
|
-
else {
|
|
1036
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1037
|
-
reject(errString);
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
});
|
|
1041
|
-
});
|
|
1042
|
-
});
|
|
1047
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1048
|
+
// URL-encoded form
|
|
1049
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1050
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
const response = await fetch(url, requestOptions);
|
|
1054
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
1043
1055
|
}
|
|
1044
1056
|
/**
|
|
1045
1057
|
* Start an inference debug stream for this device with inference results (and images if a camera is attached). Updates are streamed through the websocket API. A keep-alive token is returned, you\'ll need to ping the API (with keepDeviceDebugStreamAlive) every 10 seconds (so we know when the client is disconnected).
|
|
@@ -1052,9 +1064,11 @@ class DevicesApi {
|
|
|
1052
1064
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
1053
1065
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
1054
1066
|
let localVarQueryParameters = {};
|
|
1055
|
-
let localVarHeaderParams =
|
|
1056
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
1057
|
-
|
|
1067
|
+
let localVarHeaderParams = {
|
|
1068
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
1069
|
+
'Content-Type': 'application/json',
|
|
1070
|
+
...this.defaultHeaders,
|
|
1071
|
+
};
|
|
1058
1072
|
const produces = ['application/json'];
|
|
1059
1073
|
// give precedence to 'application/json'
|
|
1060
1074
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -1063,7 +1077,7 @@ class DevicesApi {
|
|
|
1063
1077
|
else {
|
|
1064
1078
|
localVarHeaderParams.Accept = produces.join(',');
|
|
1065
1079
|
}
|
|
1066
|
-
let localVarFormParams
|
|
1080
|
+
let localVarFormParams;
|
|
1067
1081
|
// verify required parameter 'projectId' is not null or undefined
|
|
1068
1082
|
if (projectId === null || projectId === undefined) {
|
|
1069
1083
|
throw new Error('Required parameter projectId was null or undefined when calling startDeviceInferenceDebugStream.');
|
|
@@ -1072,55 +1086,51 @@ class DevicesApi {
|
|
|
1072
1086
|
if (deviceId === null || deviceId === undefined) {
|
|
1073
1087
|
throw new Error('Required parameter deviceId was null or undefined when calling startDeviceInferenceDebugStream.');
|
|
1074
1088
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1089
|
+
localVarHeaderParams = {
|
|
1090
|
+
...localVarHeaderParams,
|
|
1091
|
+
...options.headers,
|
|
1092
|
+
...this.opts.extraHeaders,
|
|
1093
|
+
};
|
|
1094
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1095
|
+
.filter(([, value]) => value !== undefined)
|
|
1096
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1097
|
+
.join('&');
|
|
1098
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
1078
1099
|
let localVarRequestOptions = {
|
|
1079
1100
|
method: 'POST',
|
|
1080
|
-
|
|
1081
|
-
headers: localVarHeaderParams,
|
|
1082
|
-
uri: localVarPath,
|
|
1083
|
-
useQuerystring: this._useQuerystring,
|
|
1084
|
-
agentOptions: { keepAlive: false },
|
|
1085
|
-
json: true,
|
|
1101
|
+
headers: { ...localVarHeaderParams },
|
|
1086
1102
|
};
|
|
1087
|
-
let
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1103
|
+
let requestOptions = localVarRequestOptions;
|
|
1104
|
+
let url = localVarUrl;
|
|
1105
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1106
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1107
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1108
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1109
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1110
|
+
url = auth_JWTAuthentication.url;
|
|
1111
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1112
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1113
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1114
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1115
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1116
|
+
url = auth_OAuth2.url;
|
|
1117
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1118
|
+
requestOptions = authDefault.requestOptions;
|
|
1119
|
+
url = authDefault.url;
|
|
1120
|
+
if (localVarFormParams) {
|
|
1121
|
+
delete requestOptions.headers['Content-Type'];
|
|
1122
|
+
if (localVarFormParams instanceof FormData) {
|
|
1123
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1124
|
+
requestOptions.body = localVarFormParams;
|
|
1101
1125
|
}
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1111
|
-
reject(new Error(body.error || errString));
|
|
1112
|
-
}
|
|
1113
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1114
|
-
resolve(body);
|
|
1115
|
-
}
|
|
1116
|
-
else {
|
|
1117
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1118
|
-
reject(errString);
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
});
|
|
1122
|
-
});
|
|
1123
|
-
});
|
|
1126
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1127
|
+
// URL-encoded form
|
|
1128
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1129
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
const response = await fetch(url, requestOptions);
|
|
1133
|
+
return this.handleResponse(response, 'StartDeviceDebugStreamResponse');
|
|
1124
1134
|
}
|
|
1125
1135
|
/**
|
|
1126
1136
|
* Start a snapshot debug stream for this device with a current camera view. Updates are streamed through the websocket API. A keep-alive token is returned, you\'ll need to ping the API (with keepDeviceDebugStreamAlive) every 10 seconds (so we know when the client is disconnected).
|
|
@@ -1134,9 +1144,11 @@ class DevicesApi {
|
|
|
1134
1144
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
1135
1145
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
1136
1146
|
let localVarQueryParameters = {};
|
|
1137
|
-
let localVarHeaderParams =
|
|
1138
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
1139
|
-
|
|
1147
|
+
let localVarHeaderParams = {
|
|
1148
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
1149
|
+
'Content-Type': 'application/json',
|
|
1150
|
+
...this.defaultHeaders,
|
|
1151
|
+
};
|
|
1140
1152
|
const produces = ['application/json'];
|
|
1141
1153
|
// give precedence to 'application/json'
|
|
1142
1154
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -1145,7 +1157,7 @@ class DevicesApi {
|
|
|
1145
1157
|
else {
|
|
1146
1158
|
localVarHeaderParams.Accept = produces.join(',');
|
|
1147
1159
|
}
|
|
1148
|
-
let localVarFormParams
|
|
1160
|
+
let localVarFormParams;
|
|
1149
1161
|
// verify required parameter 'projectId' is not null or undefined
|
|
1150
1162
|
if (projectId === null || projectId === undefined) {
|
|
1151
1163
|
throw new Error('Required parameter projectId was null or undefined when calling startDeviceSnapshotDebugStream.');
|
|
@@ -1158,56 +1170,52 @@ class DevicesApi {
|
|
|
1158
1170
|
if (startDeviceSnapshotDebugStreamRequest === null || startDeviceSnapshotDebugStreamRequest === undefined) {
|
|
1159
1171
|
throw new Error('Required parameter startDeviceSnapshotDebugStreamRequest was null or undefined when calling startDeviceSnapshotDebugStream.');
|
|
1160
1172
|
}
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1173
|
+
localVarHeaderParams = {
|
|
1174
|
+
...localVarHeaderParams,
|
|
1175
|
+
...options.headers,
|
|
1176
|
+
...this.opts.extraHeaders,
|
|
1177
|
+
};
|
|
1178
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1179
|
+
.filter(([, value]) => value !== undefined)
|
|
1180
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1181
|
+
.join('&');
|
|
1182
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
1164
1183
|
let localVarRequestOptions = {
|
|
1165
1184
|
method: 'POST',
|
|
1166
|
-
|
|
1167
|
-
headers: localVarHeaderParams,
|
|
1168
|
-
uri: localVarPath,
|
|
1169
|
-
useQuerystring: this._useQuerystring,
|
|
1170
|
-
agentOptions: { keepAlive: false },
|
|
1171
|
-
json: true,
|
|
1172
|
-
body: models_1.ObjectSerializer.serialize(startDeviceSnapshotDebugStreamRequest, "StartDeviceSnapshotDebugStreamRequest")
|
|
1185
|
+
headers: { ...localVarHeaderParams },
|
|
1173
1186
|
};
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1187
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(startDeviceSnapshotDebugStreamRequest, "StartDeviceSnapshotDebugStreamRequest"));
|
|
1188
|
+
let requestOptions = localVarRequestOptions;
|
|
1189
|
+
let url = localVarUrl;
|
|
1190
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1191
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1192
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1193
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1194
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1195
|
+
url = auth_JWTAuthentication.url;
|
|
1196
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1197
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1198
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1199
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1200
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1201
|
+
url = auth_OAuth2.url;
|
|
1202
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1203
|
+
requestOptions = authDefault.requestOptions;
|
|
1204
|
+
url = authDefault.url;
|
|
1205
|
+
if (localVarFormParams) {
|
|
1206
|
+
delete requestOptions.headers['Content-Type'];
|
|
1207
|
+
if (localVarFormParams instanceof FormData) {
|
|
1208
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1209
|
+
requestOptions.body = localVarFormParams;
|
|
1210
|
+
}
|
|
1211
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1212
|
+
// URL-encoded form
|
|
1213
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1214
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1188
1215
|
}
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
reject(error);
|
|
1193
|
-
}
|
|
1194
|
-
else {
|
|
1195
|
-
body = models_1.ObjectSerializer.deserialize(body, "StartDeviceDebugStreamResponse");
|
|
1196
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
1197
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1198
|
-
reject(new Error(body.error || errString));
|
|
1199
|
-
}
|
|
1200
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1201
|
-
resolve(body);
|
|
1202
|
-
}
|
|
1203
|
-
else {
|
|
1204
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1205
|
-
reject(errString);
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
|
-
});
|
|
1209
|
-
});
|
|
1210
|
-
});
|
|
1216
|
+
}
|
|
1217
|
+
const response = await fetch(url, requestOptions);
|
|
1218
|
+
return this.handleResponse(response, 'StartDeviceDebugStreamResponse');
|
|
1211
1219
|
}
|
|
1212
1220
|
/**
|
|
1213
1221
|
* Start sampling on a device. This function returns immediately. Updates are streamed through the websocket API.
|
|
@@ -1221,9 +1229,11 @@ class DevicesApi {
|
|
|
1221
1229
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
1222
1230
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
1223
1231
|
let localVarQueryParameters = {};
|
|
1224
|
-
let localVarHeaderParams =
|
|
1225
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
1226
|
-
|
|
1232
|
+
let localVarHeaderParams = {
|
|
1233
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
1234
|
+
'Content-Type': 'application/json',
|
|
1235
|
+
...this.defaultHeaders,
|
|
1236
|
+
};
|
|
1227
1237
|
const produces = ['application/json'];
|
|
1228
1238
|
// give precedence to 'application/json'
|
|
1229
1239
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -1232,7 +1242,7 @@ class DevicesApi {
|
|
|
1232
1242
|
else {
|
|
1233
1243
|
localVarHeaderParams.Accept = produces.join(',');
|
|
1234
1244
|
}
|
|
1235
|
-
let localVarFormParams
|
|
1245
|
+
let localVarFormParams;
|
|
1236
1246
|
// verify required parameter 'projectId' is not null or undefined
|
|
1237
1247
|
if (projectId === null || projectId === undefined) {
|
|
1238
1248
|
throw new Error('Required parameter projectId was null or undefined when calling startSampling.');
|
|
@@ -1245,56 +1255,52 @@ class DevicesApi {
|
|
|
1245
1255
|
if (startSamplingRequest === null || startSamplingRequest === undefined) {
|
|
1246
1256
|
throw new Error('Required parameter startSamplingRequest was null or undefined when calling startSampling.');
|
|
1247
1257
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1258
|
+
localVarHeaderParams = {
|
|
1259
|
+
...localVarHeaderParams,
|
|
1260
|
+
...options.headers,
|
|
1261
|
+
...this.opts.extraHeaders,
|
|
1262
|
+
};
|
|
1263
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1264
|
+
.filter(([, value]) => value !== undefined)
|
|
1265
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1266
|
+
.join('&');
|
|
1267
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
1251
1268
|
let localVarRequestOptions = {
|
|
1252
1269
|
method: 'POST',
|
|
1253
|
-
|
|
1254
|
-
headers: localVarHeaderParams,
|
|
1255
|
-
uri: localVarPath,
|
|
1256
|
-
useQuerystring: this._useQuerystring,
|
|
1257
|
-
agentOptions: { keepAlive: false },
|
|
1258
|
-
json: true,
|
|
1259
|
-
body: models_1.ObjectSerializer.serialize(startSamplingRequest, "StartSamplingRequest")
|
|
1270
|
+
headers: { ...localVarHeaderParams },
|
|
1260
1271
|
};
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1272
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(startSamplingRequest, "StartSamplingRequest"));
|
|
1273
|
+
let requestOptions = localVarRequestOptions;
|
|
1274
|
+
let url = localVarUrl;
|
|
1275
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1276
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1277
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1278
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1279
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1280
|
+
url = auth_JWTAuthentication.url;
|
|
1281
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1282
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1283
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1284
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1285
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1286
|
+
url = auth_OAuth2.url;
|
|
1287
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1288
|
+
requestOptions = authDefault.requestOptions;
|
|
1289
|
+
url = authDefault.url;
|
|
1290
|
+
if (localVarFormParams) {
|
|
1291
|
+
delete requestOptions.headers['Content-Type'];
|
|
1292
|
+
if (localVarFormParams instanceof FormData) {
|
|
1293
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1294
|
+
requestOptions.body = localVarFormParams;
|
|
1295
|
+
}
|
|
1296
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1297
|
+
// URL-encoded form
|
|
1298
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1299
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1275
1300
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
reject(error);
|
|
1280
|
-
}
|
|
1281
|
-
else {
|
|
1282
|
-
body = models_1.ObjectSerializer.deserialize(body, "StartSamplingResponse");
|
|
1283
|
-
if (typeof body.success === 'boolean' && !body.success) {
|
|
1284
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1285
|
-
reject(new Error(body.error || errString));
|
|
1286
|
-
}
|
|
1287
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1288
|
-
resolve(body);
|
|
1289
|
-
}
|
|
1290
|
-
else {
|
|
1291
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1292
|
-
reject(errString);
|
|
1293
|
-
}
|
|
1294
|
-
}
|
|
1295
|
-
});
|
|
1296
|
-
});
|
|
1297
|
-
});
|
|
1301
|
+
}
|
|
1302
|
+
const response = await fetch(url, requestOptions);
|
|
1303
|
+
return this.handleResponse(response, 'StartSamplingResponse');
|
|
1298
1304
|
}
|
|
1299
1305
|
/**
|
|
1300
1306
|
* If you have opened a debug stream, close it.
|
|
@@ -1308,9 +1314,11 @@ class DevicesApi {
|
|
|
1308
1314
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
1309
1315
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
1310
1316
|
let localVarQueryParameters = {};
|
|
1311
|
-
let localVarHeaderParams =
|
|
1312
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
1313
|
-
|
|
1317
|
+
let localVarHeaderParams = {
|
|
1318
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
1319
|
+
'Content-Type': 'application/json',
|
|
1320
|
+
...this.defaultHeaders,
|
|
1321
|
+
};
|
|
1314
1322
|
const produces = ['application/json'];
|
|
1315
1323
|
// give precedence to 'application/json'
|
|
1316
1324
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -1319,7 +1327,7 @@ class DevicesApi {
|
|
|
1319
1327
|
else {
|
|
1320
1328
|
localVarHeaderParams.Accept = produces.join(',');
|
|
1321
1329
|
}
|
|
1322
|
-
let localVarFormParams
|
|
1330
|
+
let localVarFormParams;
|
|
1323
1331
|
// verify required parameter 'projectId' is not null or undefined
|
|
1324
1332
|
if (projectId === null || projectId === undefined) {
|
|
1325
1333
|
throw new Error('Required parameter projectId was null or undefined when calling stopDeviceDebugStream.');
|
|
@@ -1332,56 +1340,52 @@ class DevicesApi {
|
|
|
1332
1340
|
if (stopDeviceDebugStreamRequest === null || stopDeviceDebugStreamRequest === undefined) {
|
|
1333
1341
|
throw new Error('Required parameter stopDeviceDebugStreamRequest was null or undefined when calling stopDeviceDebugStream.');
|
|
1334
1342
|
}
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1343
|
+
localVarHeaderParams = {
|
|
1344
|
+
...localVarHeaderParams,
|
|
1345
|
+
...options.headers,
|
|
1346
|
+
...this.opts.extraHeaders,
|
|
1347
|
+
};
|
|
1348
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1349
|
+
.filter(([, value]) => value !== undefined)
|
|
1350
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1351
|
+
.join('&');
|
|
1352
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
1338
1353
|
let localVarRequestOptions = {
|
|
1339
1354
|
method: 'POST',
|
|
1340
|
-
|
|
1341
|
-
headers: localVarHeaderParams,
|
|
1342
|
-
uri: localVarPath,
|
|
1343
|
-
useQuerystring: this._useQuerystring,
|
|
1344
|
-
agentOptions: { keepAlive: false },
|
|
1345
|
-
json: true,
|
|
1346
|
-
body: models_1.ObjectSerializer.serialize(stopDeviceDebugStreamRequest, "StopDeviceDebugStreamRequest")
|
|
1355
|
+
headers: { ...localVarHeaderParams },
|
|
1347
1356
|
};
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1357
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(stopDeviceDebugStreamRequest, "StopDeviceDebugStreamRequest"));
|
|
1358
|
+
let requestOptions = localVarRequestOptions;
|
|
1359
|
+
let url = localVarUrl;
|
|
1360
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1361
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1362
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1363
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1364
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1365
|
+
url = auth_JWTAuthentication.url;
|
|
1366
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1367
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1368
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1369
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1370
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1371
|
+
url = auth_OAuth2.url;
|
|
1372
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1373
|
+
requestOptions = authDefault.requestOptions;
|
|
1374
|
+
url = authDefault.url;
|
|
1375
|
+
if (localVarFormParams) {
|
|
1376
|
+
delete requestOptions.headers['Content-Type'];
|
|
1377
|
+
if (localVarFormParams instanceof FormData) {
|
|
1378
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1379
|
+
requestOptions.body = localVarFormParams;
|
|
1362
1380
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1372
|
-
reject(new Error(body.error || errString));
|
|
1373
|
-
}
|
|
1374
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1375
|
-
resolve(body);
|
|
1376
|
-
}
|
|
1377
|
-
else {
|
|
1378
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1379
|
-
reject(errString);
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
|
-
});
|
|
1383
|
-
});
|
|
1384
|
-
});
|
|
1381
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1382
|
+
// URL-encoded form
|
|
1383
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1384
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
const response = await fetch(url, requestOptions);
|
|
1388
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
1385
1389
|
}
|
|
1386
1390
|
/**
|
|
1387
1391
|
* Store historical on-device inference data
|
|
@@ -1396,9 +1400,11 @@ class DevicesApi {
|
|
|
1396
1400
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
1397
1401
|
.replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
|
|
1398
1402
|
let localVarQueryParameters = {};
|
|
1399
|
-
let localVarHeaderParams =
|
|
1400
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
1401
|
-
|
|
1403
|
+
let localVarHeaderParams = {
|
|
1404
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
1405
|
+
'Content-Type': 'application/json',
|
|
1406
|
+
...this.defaultHeaders,
|
|
1407
|
+
};
|
|
1402
1408
|
const produces = ['application/json'];
|
|
1403
1409
|
// give precedence to 'application/json'
|
|
1404
1410
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -1407,7 +1413,7 @@ class DevicesApi {
|
|
|
1407
1413
|
else {
|
|
1408
1414
|
localVarHeaderParams.Accept = produces.join(',');
|
|
1409
1415
|
}
|
|
1410
|
-
let localVarFormParams
|
|
1416
|
+
let localVarFormParams;
|
|
1411
1417
|
// verify required parameter 'projectId' is not null or undefined
|
|
1412
1418
|
if (projectId === null || projectId === undefined) {
|
|
1413
1419
|
throw new Error('Required parameter projectId was null or undefined when calling storeInferenceHistory.');
|
|
@@ -1427,56 +1433,52 @@ class DevicesApi {
|
|
|
1427
1433
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.deploymentId) !== undefined) {
|
|
1428
1434
|
localVarQueryParameters['deploymentId'] = models_1.ObjectSerializer.serialize(queryParams.deploymentId, "number");
|
|
1429
1435
|
}
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1436
|
+
localVarHeaderParams = {
|
|
1437
|
+
...localVarHeaderParams,
|
|
1438
|
+
...options.headers,
|
|
1439
|
+
...this.opts.extraHeaders,
|
|
1440
|
+
};
|
|
1441
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1442
|
+
.filter(([, value]) => value !== undefined)
|
|
1443
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1444
|
+
.join('&');
|
|
1445
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
1433
1446
|
let localVarRequestOptions = {
|
|
1434
1447
|
method: 'POST',
|
|
1435
|
-
|
|
1436
|
-
headers: localVarHeaderParams,
|
|
1437
|
-
uri: localVarPath,
|
|
1438
|
-
useQuerystring: this._useQuerystring,
|
|
1439
|
-
agentOptions: { keepAlive: false },
|
|
1440
|
-
json: true,
|
|
1441
|
-
body: models_1.ObjectSerializer.serialize(storeInferenceHistoryRequest, "StoreInferenceHistoryRequest")
|
|
1448
|
+
headers: { ...localVarHeaderParams },
|
|
1442
1449
|
};
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1450
|
+
localVarRequestOptions.body = JSON.stringify(models_1.ObjectSerializer.serialize(storeInferenceHistoryRequest, "StoreInferenceHistoryRequest"));
|
|
1451
|
+
let requestOptions = localVarRequestOptions;
|
|
1452
|
+
let url = localVarUrl;
|
|
1453
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1454
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1455
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1456
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1457
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1458
|
+
url = auth_JWTAuthentication.url;
|
|
1459
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1460
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1461
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1462
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1463
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1464
|
+
url = auth_OAuth2.url;
|
|
1465
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1466
|
+
requestOptions = authDefault.requestOptions;
|
|
1467
|
+
url = authDefault.url;
|
|
1468
|
+
if (localVarFormParams) {
|
|
1469
|
+
delete requestOptions.headers['Content-Type'];
|
|
1470
|
+
if (localVarFormParams instanceof FormData) {
|
|
1471
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1472
|
+
requestOptions.body = localVarFormParams;
|
|
1457
1473
|
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1467
|
-
reject(new Error(body.error || errString));
|
|
1468
|
-
}
|
|
1469
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1470
|
-
resolve(body);
|
|
1471
|
-
}
|
|
1472
|
-
else {
|
|
1473
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1474
|
-
reject(errString);
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
});
|
|
1478
|
-
});
|
|
1479
|
-
});
|
|
1474
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1475
|
+
// URL-encoded form
|
|
1476
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1477
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
const response = await fetch(url, requestOptions);
|
|
1481
|
+
return this.handleResponse(response, 'GenericApiResponse');
|
|
1480
1482
|
}
|
|
1481
1483
|
}
|
|
1482
1484
|
exports.DevicesApi = DevicesApi;
|