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.ClassifyApi = exports.ClassifyApiApiKeys = 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 ClassifyApiApiKeys;
|
|
|
30
47
|
ClassifyApiApiKeys[ClassifyApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
|
|
31
48
|
})(ClassifyApiApiKeys = exports.ClassifyApiApiKeys || (exports.ClassifyApiApiKeys = {}));
|
|
32
49
|
class ClassifyApi {
|
|
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 ClassifyApi {
|
|
|
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
|
}
|
|
@@ -89,9 +123,11 @@ class ClassifyApi {
|
|
|
89
123
|
const localVarPath = this.basePath + '/api/{projectId}/classify/image'
|
|
90
124
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
91
125
|
let localVarQueryParameters = {};
|
|
92
|
-
let localVarHeaderParams =
|
|
93
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
94
|
-
|
|
126
|
+
let localVarHeaderParams = {
|
|
127
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
...this.defaultHeaders,
|
|
130
|
+
};
|
|
95
131
|
const produces = ['application/json'];
|
|
96
132
|
// give precedence to 'application/json'
|
|
97
133
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -100,7 +136,7 @@ class ClassifyApi {
|
|
|
100
136
|
else {
|
|
101
137
|
localVarHeaderParams.Accept = produces.join(',');
|
|
102
138
|
}
|
|
103
|
-
let localVarFormParams
|
|
139
|
+
let localVarFormParams;
|
|
104
140
|
// verify required parameter 'projectId' is not null or undefined
|
|
105
141
|
if (projectId === null || projectId === undefined) {
|
|
106
142
|
throw new Error('Required parameter projectId was null or undefined when calling classifyImage.');
|
|
@@ -112,59 +148,69 @@ class ClassifyApi {
|
|
|
112
148
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
|
|
113
149
|
localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
|
|
114
150
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
151
|
+
localVarHeaderParams = {
|
|
152
|
+
...localVarHeaderParams,
|
|
153
|
+
...options.headers,
|
|
154
|
+
...this.opts.extraHeaders,
|
|
155
|
+
};
|
|
118
156
|
if (params.image !== undefined) {
|
|
119
|
-
localVarFormParams
|
|
157
|
+
if (!(localVarFormParams instanceof FormData)) {
|
|
158
|
+
const existingParams = localVarFormParams;
|
|
159
|
+
localVarFormParams = new FormData();
|
|
160
|
+
if (existingParams && typeof existingParams === 'object') {
|
|
161
|
+
Object.keys(existingParams).forEach(key => {
|
|
162
|
+
localVarFormParams.append(key, existingParams[key]);
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
const imageFiles = Array.isArray(params.image) ? params.image : [params.image];
|
|
167
|
+
const Blob = globalThis.Blob || require('buffer').Blob;
|
|
168
|
+
imageFiles.forEach((f) => {
|
|
169
|
+
localVarFormParams.append('image', new Blob([f.value], {
|
|
170
|
+
type: f.options.contentType
|
|
171
|
+
}), f.options.filename);
|
|
172
|
+
});
|
|
120
173
|
}
|
|
121
|
-
|
|
174
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
175
|
+
.filter(([, value]) => value !== undefined)
|
|
176
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
177
|
+
.join('&');
|
|
178
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
122
179
|
let localVarRequestOptions = {
|
|
123
180
|
method: 'POST',
|
|
124
|
-
|
|
125
|
-
headers: localVarHeaderParams,
|
|
126
|
-
uri: localVarPath,
|
|
127
|
-
useQuerystring: this._useQuerystring,
|
|
128
|
-
agentOptions: { keepAlive: false },
|
|
129
|
-
json: true,
|
|
181
|
+
headers: { ...localVarHeaderParams },
|
|
130
182
|
};
|
|
131
|
-
let
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
183
|
+
let requestOptions = localVarRequestOptions;
|
|
184
|
+
let url = localVarUrl;
|
|
185
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
186
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
187
|
+
url = auth_ApiKeyAuthentication.url;
|
|
188
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
189
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
190
|
+
url = auth_JWTAuthentication.url;
|
|
191
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
192
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
193
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
194
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
195
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
196
|
+
url = auth_OAuth2.url;
|
|
197
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
198
|
+
requestOptions = authDefault.requestOptions;
|
|
199
|
+
url = authDefault.url;
|
|
200
|
+
if (localVarFormParams) {
|
|
201
|
+
delete requestOptions.headers['Content-Type'];
|
|
202
|
+
if (localVarFormParams instanceof FormData) {
|
|
203
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
204
|
+
requestOptions.body = localVarFormParams;
|
|
145
205
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
155
|
-
reject(new Error(body.error || errString));
|
|
156
|
-
}
|
|
157
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
158
|
-
resolve(body);
|
|
159
|
-
}
|
|
160
|
-
else {
|
|
161
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
162
|
-
reject(errString);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
});
|
|
206
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
207
|
+
// URL-encoded form
|
|
208
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
209
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const response = await fetch(url, requestOptions);
|
|
213
|
+
return this.handleResponse(response, 'TestPretrainedModelResponse');
|
|
168
214
|
}
|
|
169
215
|
/**
|
|
170
216
|
* This API is deprecated, use classifySampleV2 instead (`/v1/api/{projectId}/classify/v2/{sampleId}`). Classify a complete file against the current impulse. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted.
|
|
@@ -179,9 +225,11 @@ class ClassifyApi {
|
|
|
179
225
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
180
226
|
.replace('{' + 'sampleId' + '}', encodeURIComponent(String(sampleId)));
|
|
181
227
|
let localVarQueryParameters = {};
|
|
182
|
-
let localVarHeaderParams =
|
|
183
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
184
|
-
|
|
228
|
+
let localVarHeaderParams = {
|
|
229
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
230
|
+
'Content-Type': 'application/json',
|
|
231
|
+
...this.defaultHeaders,
|
|
232
|
+
};
|
|
185
233
|
const produces = ['application/json'];
|
|
186
234
|
// give precedence to 'application/json'
|
|
187
235
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -190,7 +238,7 @@ class ClassifyApi {
|
|
|
190
238
|
else {
|
|
191
239
|
localVarHeaderParams.Accept = produces.join(',');
|
|
192
240
|
}
|
|
193
|
-
let localVarFormParams
|
|
241
|
+
let localVarFormParams;
|
|
194
242
|
// verify required parameter 'projectId' is not null or undefined
|
|
195
243
|
if (projectId === null || projectId === undefined) {
|
|
196
244
|
throw new Error('Required parameter projectId was null or undefined when calling classifySample.');
|
|
@@ -205,55 +253,51 @@ class ClassifyApi {
|
|
|
205
253
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
|
|
206
254
|
localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
|
|
207
255
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
256
|
+
localVarHeaderParams = {
|
|
257
|
+
...localVarHeaderParams,
|
|
258
|
+
...options.headers,
|
|
259
|
+
...this.opts.extraHeaders,
|
|
260
|
+
};
|
|
261
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
262
|
+
.filter(([, value]) => value !== undefined)
|
|
263
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
264
|
+
.join('&');
|
|
265
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
211
266
|
let localVarRequestOptions = {
|
|
212
267
|
method: 'GET',
|
|
213
|
-
|
|
214
|
-
headers: localVarHeaderParams,
|
|
215
|
-
uri: localVarPath,
|
|
216
|
-
useQuerystring: this._useQuerystring,
|
|
217
|
-
agentOptions: { keepAlive: false },
|
|
218
|
-
json: true,
|
|
268
|
+
headers: { ...localVarHeaderParams },
|
|
219
269
|
};
|
|
220
|
-
let
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
270
|
+
let requestOptions = localVarRequestOptions;
|
|
271
|
+
let url = localVarUrl;
|
|
272
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
273
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
274
|
+
url = auth_ApiKeyAuthentication.url;
|
|
275
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
276
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
277
|
+
url = auth_JWTAuthentication.url;
|
|
278
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
279
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
280
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
281
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
282
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
283
|
+
url = auth_OAuth2.url;
|
|
284
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
285
|
+
requestOptions = authDefault.requestOptions;
|
|
286
|
+
url = authDefault.url;
|
|
287
|
+
if (localVarFormParams) {
|
|
288
|
+
delete requestOptions.headers['Content-Type'];
|
|
289
|
+
if (localVarFormParams instanceof FormData) {
|
|
290
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
291
|
+
requestOptions.body = localVarFormParams;
|
|
234
292
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
244
|
-
reject(new Error(body.error || errString));
|
|
245
|
-
}
|
|
246
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
247
|
-
resolve(body);
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
251
|
-
reject(errString);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
});
|
|
256
|
-
});
|
|
293
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
294
|
+
// URL-encoded form
|
|
295
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
296
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
const response = await fetch(url, requestOptions);
|
|
300
|
+
return this.handleResponse(response, 'ClassifySampleResponse');
|
|
257
301
|
}
|
|
258
302
|
/**
|
|
259
303
|
* This API is deprecated, use classifySampleByLearnBlockV2 (`/v1/api/{projectId}/classify/anomaly-gmm/v2/{blockId}/{sampleId}`) instead. Classify a complete file against the specified learn block. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted.
|
|
@@ -268,9 +312,11 @@ class ClassifyApi {
|
|
|
268
312
|
.replace('{' + 'sampleId' + '}', encodeURIComponent(String(sampleId)))
|
|
269
313
|
.replace('{' + 'blockId' + '}', encodeURIComponent(String(blockId)));
|
|
270
314
|
let localVarQueryParameters = {};
|
|
271
|
-
let localVarHeaderParams =
|
|
272
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
273
|
-
|
|
315
|
+
let localVarHeaderParams = {
|
|
316
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
317
|
+
'Content-Type': 'application/json',
|
|
318
|
+
...this.defaultHeaders,
|
|
319
|
+
};
|
|
274
320
|
const produces = ['application/json'];
|
|
275
321
|
// give precedence to 'application/json'
|
|
276
322
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -279,7 +325,7 @@ class ClassifyApi {
|
|
|
279
325
|
else {
|
|
280
326
|
localVarHeaderParams.Accept = produces.join(',');
|
|
281
327
|
}
|
|
282
|
-
let localVarFormParams
|
|
328
|
+
let localVarFormParams;
|
|
283
329
|
// verify required parameter 'projectId' is not null or undefined
|
|
284
330
|
if (projectId === null || projectId === undefined) {
|
|
285
331
|
throw new Error('Required parameter projectId was null or undefined when calling classifySampleByLearnBlock.');
|
|
@@ -292,55 +338,51 @@ class ClassifyApi {
|
|
|
292
338
|
if (blockId === null || blockId === undefined) {
|
|
293
339
|
throw new Error('Required parameter blockId was null or undefined when calling classifySampleByLearnBlock.');
|
|
294
340
|
}
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
341
|
+
localVarHeaderParams = {
|
|
342
|
+
...localVarHeaderParams,
|
|
343
|
+
...options.headers,
|
|
344
|
+
...this.opts.extraHeaders,
|
|
345
|
+
};
|
|
346
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
347
|
+
.filter(([, value]) => value !== undefined)
|
|
348
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
349
|
+
.join('&');
|
|
350
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
298
351
|
let localVarRequestOptions = {
|
|
299
352
|
method: 'GET',
|
|
300
|
-
|
|
301
|
-
headers: localVarHeaderParams,
|
|
302
|
-
uri: localVarPath,
|
|
303
|
-
useQuerystring: this._useQuerystring,
|
|
304
|
-
agentOptions: { keepAlive: false },
|
|
305
|
-
json: true,
|
|
353
|
+
headers: { ...localVarHeaderParams },
|
|
306
354
|
};
|
|
307
|
-
let
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
355
|
+
let requestOptions = localVarRequestOptions;
|
|
356
|
+
let url = localVarUrl;
|
|
357
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
358
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
359
|
+
url = auth_ApiKeyAuthentication.url;
|
|
360
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
361
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
362
|
+
url = auth_JWTAuthentication.url;
|
|
363
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
364
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
365
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
366
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
367
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
368
|
+
url = auth_OAuth2.url;
|
|
369
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
370
|
+
requestOptions = authDefault.requestOptions;
|
|
371
|
+
url = authDefault.url;
|
|
372
|
+
if (localVarFormParams) {
|
|
373
|
+
delete requestOptions.headers['Content-Type'];
|
|
374
|
+
if (localVarFormParams instanceof FormData) {
|
|
375
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
376
|
+
requestOptions.body = localVarFormParams;
|
|
321
377
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
331
|
-
reject(new Error(body.error || errString));
|
|
332
|
-
}
|
|
333
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
334
|
-
resolve(body);
|
|
335
|
-
}
|
|
336
|
-
else {
|
|
337
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
338
|
-
reject(errString);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
});
|
|
342
|
-
});
|
|
343
|
-
});
|
|
378
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
379
|
+
// URL-encoded form
|
|
380
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
381
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const response = await fetch(url, requestOptions);
|
|
385
|
+
return this.handleResponse(response, 'ClassifySampleResponse');
|
|
344
386
|
}
|
|
345
387
|
/**
|
|
346
388
|
* Classify a complete file against the specified learn block. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted. Depending on the size of your file, whether your sample is resampled, and whether the result is cached you\'ll get either the result or a job back. If you receive a job, then wait for the completion of the job, and then call this function again to receive the results. The unoptimized (float32) model is used by default, and classification with an optimized (int8) model can be slower.
|
|
@@ -357,9 +399,11 @@ class ClassifyApi {
|
|
|
357
399
|
.replace('{' + 'sampleId' + '}', encodeURIComponent(String(sampleId)))
|
|
358
400
|
.replace('{' + 'blockId' + '}', encodeURIComponent(String(blockId)));
|
|
359
401
|
let localVarQueryParameters = {};
|
|
360
|
-
let localVarHeaderParams =
|
|
361
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
362
|
-
|
|
402
|
+
let localVarHeaderParams = {
|
|
403
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
404
|
+
'Content-Type': 'application/json',
|
|
405
|
+
...this.defaultHeaders,
|
|
406
|
+
};
|
|
363
407
|
const produces = ['application/json'];
|
|
364
408
|
// give precedence to 'application/json'
|
|
365
409
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -368,7 +412,7 @@ class ClassifyApi {
|
|
|
368
412
|
else {
|
|
369
413
|
localVarHeaderParams.Accept = produces.join(',');
|
|
370
414
|
}
|
|
371
|
-
let localVarFormParams
|
|
415
|
+
let localVarFormParams;
|
|
372
416
|
// verify required parameter 'projectId' is not null or undefined
|
|
373
417
|
if (projectId === null || projectId === undefined) {
|
|
374
418
|
throw new Error('Required parameter projectId was null or undefined when calling classifySampleByLearnBlockV2.');
|
|
@@ -387,55 +431,51 @@ class ClassifyApi {
|
|
|
387
431
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.truncateStructuredLabels) !== undefined) {
|
|
388
432
|
localVarQueryParameters['truncateStructuredLabels'] = models_1.ObjectSerializer.serialize(queryParams.truncateStructuredLabels, "boolean");
|
|
389
433
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
434
|
+
localVarHeaderParams = {
|
|
435
|
+
...localVarHeaderParams,
|
|
436
|
+
...options.headers,
|
|
437
|
+
...this.opts.extraHeaders,
|
|
438
|
+
};
|
|
439
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
440
|
+
.filter(([, value]) => value !== undefined)
|
|
441
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
442
|
+
.join('&');
|
|
443
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
393
444
|
let localVarRequestOptions = {
|
|
394
445
|
method: 'POST',
|
|
395
|
-
|
|
396
|
-
headers: localVarHeaderParams,
|
|
397
|
-
uri: localVarPath,
|
|
398
|
-
useQuerystring: this._useQuerystring,
|
|
399
|
-
agentOptions: { keepAlive: false },
|
|
400
|
-
json: true,
|
|
446
|
+
headers: { ...localVarHeaderParams },
|
|
401
447
|
};
|
|
402
|
-
let
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
448
|
+
let requestOptions = localVarRequestOptions;
|
|
449
|
+
let url = localVarUrl;
|
|
450
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
451
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
452
|
+
url = auth_ApiKeyAuthentication.url;
|
|
453
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
454
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
455
|
+
url = auth_JWTAuthentication.url;
|
|
456
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
457
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
458
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
459
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
460
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
461
|
+
url = auth_OAuth2.url;
|
|
462
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
463
|
+
requestOptions = authDefault.requestOptions;
|
|
464
|
+
url = authDefault.url;
|
|
465
|
+
if (localVarFormParams) {
|
|
466
|
+
delete requestOptions.headers['Content-Type'];
|
|
467
|
+
if (localVarFormParams instanceof FormData) {
|
|
468
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
469
|
+
requestOptions.body = localVarFormParams;
|
|
416
470
|
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
426
|
-
reject(new Error(body.error || errString));
|
|
427
|
-
}
|
|
428
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
429
|
-
resolve(body);
|
|
430
|
-
}
|
|
431
|
-
else {
|
|
432
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
433
|
-
reject(errString);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
});
|
|
471
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
472
|
+
// URL-encoded form
|
|
473
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
474
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
const response = await fetch(url, requestOptions);
|
|
478
|
+
return this.handleResponse(response, 'ClassifySampleResponse | StartJobResponse');
|
|
439
479
|
}
|
|
440
480
|
/**
|
|
441
481
|
* Classify a complete file against the current impulse, for all given variants. Depending on the size of your file and whether the sample is resampled, you may get a job ID in the response.
|
|
@@ -452,9 +492,11 @@ class ClassifyApi {
|
|
|
452
492
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
453
493
|
.replace('{' + 'sampleId' + '}', encodeURIComponent(String(sampleId)));
|
|
454
494
|
let localVarQueryParameters = {};
|
|
455
|
-
let localVarHeaderParams =
|
|
456
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
457
|
-
|
|
495
|
+
let localVarHeaderParams = {
|
|
496
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
497
|
+
'Content-Type': 'application/json',
|
|
498
|
+
...this.defaultHeaders,
|
|
499
|
+
};
|
|
458
500
|
const produces = ['application/json'];
|
|
459
501
|
// give precedence to 'application/json'
|
|
460
502
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -463,7 +505,7 @@ class ClassifyApi {
|
|
|
463
505
|
else {
|
|
464
506
|
localVarHeaderParams.Accept = produces.join(',');
|
|
465
507
|
}
|
|
466
|
-
let localVarFormParams
|
|
508
|
+
let localVarFormParams;
|
|
467
509
|
// verify required parameter 'projectId' is not null or undefined
|
|
468
510
|
if (projectId === null || projectId === undefined) {
|
|
469
511
|
throw new Error('Required parameter projectId was null or undefined when calling classifySampleForVariants.');
|
|
@@ -488,55 +530,51 @@ class ClassifyApi {
|
|
|
488
530
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.truncateStructuredLabels) !== undefined) {
|
|
489
531
|
localVarQueryParameters['truncateStructuredLabels'] = models_1.ObjectSerializer.serialize(queryParams.truncateStructuredLabels, "boolean");
|
|
490
532
|
}
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
533
|
+
localVarHeaderParams = {
|
|
534
|
+
...localVarHeaderParams,
|
|
535
|
+
...options.headers,
|
|
536
|
+
...this.opts.extraHeaders,
|
|
537
|
+
};
|
|
538
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
539
|
+
.filter(([, value]) => value !== undefined)
|
|
540
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
541
|
+
.join('&');
|
|
542
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
494
543
|
let localVarRequestOptions = {
|
|
495
544
|
method: 'POST',
|
|
496
|
-
|
|
497
|
-
headers: localVarHeaderParams,
|
|
498
|
-
uri: localVarPath,
|
|
499
|
-
useQuerystring: this._useQuerystring,
|
|
500
|
-
agentOptions: { keepAlive: false },
|
|
501
|
-
json: true,
|
|
545
|
+
headers: { ...localVarHeaderParams },
|
|
502
546
|
};
|
|
503
|
-
let
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
547
|
+
let requestOptions = localVarRequestOptions;
|
|
548
|
+
let url = localVarUrl;
|
|
549
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
550
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
551
|
+
url = auth_ApiKeyAuthentication.url;
|
|
552
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
553
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
554
|
+
url = auth_JWTAuthentication.url;
|
|
555
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
556
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
557
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
558
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
559
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
560
|
+
url = auth_OAuth2.url;
|
|
561
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
562
|
+
requestOptions = authDefault.requestOptions;
|
|
563
|
+
url = authDefault.url;
|
|
564
|
+
if (localVarFormParams) {
|
|
565
|
+
delete requestOptions.headers['Content-Type'];
|
|
566
|
+
if (localVarFormParams instanceof FormData) {
|
|
567
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
568
|
+
requestOptions.body = localVarFormParams;
|
|
517
569
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
527
|
-
reject(new Error(body.error || errString));
|
|
528
|
-
}
|
|
529
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
530
|
-
resolve(body);
|
|
531
|
-
}
|
|
532
|
-
else {
|
|
533
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
534
|
-
reject(errString);
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
|
-
});
|
|
570
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
571
|
+
// URL-encoded form
|
|
572
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
573
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
const response = await fetch(url, requestOptions);
|
|
577
|
+
return this.handleResponse(response, 'ClassifySampleResponseMultipleVariants | StartJobResponse');
|
|
540
578
|
}
|
|
541
579
|
/**
|
|
542
580
|
* Classify a complete file against the current impulse. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and classify for every window that is extracted. Depending on the size of your file, whether your sample is resampled, and whether the result is cached you\'ll get either the result or a job back. If you receive a job, then wait for the completion of the job, and then call this function again to receive the results. The unoptimized (float32) model is used by default, and classification with an optimized (int8) model can be slower.
|
|
@@ -553,9 +591,11 @@ class ClassifyApi {
|
|
|
553
591
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
|
|
554
592
|
.replace('{' + 'sampleId' + '}', encodeURIComponent(String(sampleId)));
|
|
555
593
|
let localVarQueryParameters = {};
|
|
556
|
-
let localVarHeaderParams =
|
|
557
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
558
|
-
|
|
594
|
+
let localVarHeaderParams = {
|
|
595
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
596
|
+
'Content-Type': 'application/json',
|
|
597
|
+
...this.defaultHeaders,
|
|
598
|
+
};
|
|
559
599
|
const produces = ['application/json'];
|
|
560
600
|
// give precedence to 'application/json'
|
|
561
601
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -564,7 +604,7 @@ class ClassifyApi {
|
|
|
564
604
|
else {
|
|
565
605
|
localVarHeaderParams.Accept = produces.join(',');
|
|
566
606
|
}
|
|
567
|
-
let localVarFormParams
|
|
607
|
+
let localVarFormParams;
|
|
568
608
|
// verify required parameter 'projectId' is not null or undefined
|
|
569
609
|
if (projectId === null || projectId === undefined) {
|
|
570
610
|
throw new Error('Required parameter projectId was null or undefined when calling classifySampleV2.');
|
|
@@ -585,55 +625,51 @@ class ClassifyApi {
|
|
|
585
625
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.truncateStructuredLabels) !== undefined) {
|
|
586
626
|
localVarQueryParameters['truncateStructuredLabels'] = models_1.ObjectSerializer.serialize(queryParams.truncateStructuredLabels, "boolean");
|
|
587
627
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
628
|
+
localVarHeaderParams = {
|
|
629
|
+
...localVarHeaderParams,
|
|
630
|
+
...options.headers,
|
|
631
|
+
...this.opts.extraHeaders,
|
|
632
|
+
};
|
|
633
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
634
|
+
.filter(([, value]) => value !== undefined)
|
|
635
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
636
|
+
.join('&');
|
|
637
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
591
638
|
let localVarRequestOptions = {
|
|
592
639
|
method: 'POST',
|
|
593
|
-
|
|
594
|
-
headers: localVarHeaderParams,
|
|
595
|
-
uri: localVarPath,
|
|
596
|
-
useQuerystring: this._useQuerystring,
|
|
597
|
-
agentOptions: { keepAlive: false },
|
|
598
|
-
json: true,
|
|
640
|
+
headers: { ...localVarHeaderParams },
|
|
599
641
|
};
|
|
600
|
-
let
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
642
|
+
let requestOptions = localVarRequestOptions;
|
|
643
|
+
let url = localVarUrl;
|
|
644
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
645
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
646
|
+
url = auth_ApiKeyAuthentication.url;
|
|
647
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
648
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
649
|
+
url = auth_JWTAuthentication.url;
|
|
650
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
651
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
652
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
653
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
654
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
655
|
+
url = auth_OAuth2.url;
|
|
656
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
657
|
+
requestOptions = authDefault.requestOptions;
|
|
658
|
+
url = authDefault.url;
|
|
659
|
+
if (localVarFormParams) {
|
|
660
|
+
delete requestOptions.headers['Content-Type'];
|
|
661
|
+
if (localVarFormParams instanceof FormData) {
|
|
662
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
663
|
+
requestOptions.body = localVarFormParams;
|
|
614
664
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
624
|
-
reject(new Error(body.error || errString));
|
|
625
|
-
}
|
|
626
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
627
|
-
resolve(body);
|
|
628
|
-
}
|
|
629
|
-
else {
|
|
630
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
631
|
-
reject(errString);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
});
|
|
635
|
-
});
|
|
636
|
-
});
|
|
665
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
666
|
+
// URL-encoded form
|
|
667
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
668
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
const response = await fetch(url, requestOptions);
|
|
672
|
+
return this.handleResponse(response, 'ClassifySampleResponse | StartJobResponse');
|
|
637
673
|
}
|
|
638
674
|
/**
|
|
639
675
|
* Get classify job result, containing the result for the complete testing dataset.
|
|
@@ -648,9 +684,11 @@ class ClassifyApi {
|
|
|
648
684
|
const localVarPath = this.basePath + '/api/{projectId}/classify/all/result'
|
|
649
685
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
650
686
|
let localVarQueryParameters = {};
|
|
651
|
-
let localVarHeaderParams =
|
|
652
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
653
|
-
|
|
687
|
+
let localVarHeaderParams = {
|
|
688
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
689
|
+
'Content-Type': 'application/json',
|
|
690
|
+
...this.defaultHeaders,
|
|
691
|
+
};
|
|
654
692
|
const produces = ['application/json'];
|
|
655
693
|
// give precedence to 'application/json'
|
|
656
694
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -659,7 +697,7 @@ class ClassifyApi {
|
|
|
659
697
|
else {
|
|
660
698
|
localVarHeaderParams.Accept = produces.join(',');
|
|
661
699
|
}
|
|
662
|
-
let localVarFormParams
|
|
700
|
+
let localVarFormParams;
|
|
663
701
|
// verify required parameter 'projectId' is not null or undefined
|
|
664
702
|
if (projectId === null || projectId === undefined) {
|
|
665
703
|
throw new Error('Required parameter projectId was null or undefined when calling getClassifyJobResult.');
|
|
@@ -676,55 +714,51 @@ class ClassifyApi {
|
|
|
676
714
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.truncateStructuredLabels) !== undefined) {
|
|
677
715
|
localVarQueryParameters['truncateStructuredLabels'] = models_1.ObjectSerializer.serialize(queryParams.truncateStructuredLabels, "boolean");
|
|
678
716
|
}
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
717
|
+
localVarHeaderParams = {
|
|
718
|
+
...localVarHeaderParams,
|
|
719
|
+
...options.headers,
|
|
720
|
+
...this.opts.extraHeaders,
|
|
721
|
+
};
|
|
722
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
723
|
+
.filter(([, value]) => value !== undefined)
|
|
724
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
725
|
+
.join('&');
|
|
726
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
682
727
|
let localVarRequestOptions = {
|
|
683
728
|
method: 'GET',
|
|
684
|
-
|
|
685
|
-
headers: localVarHeaderParams,
|
|
686
|
-
uri: localVarPath,
|
|
687
|
-
useQuerystring: this._useQuerystring,
|
|
688
|
-
agentOptions: { keepAlive: false },
|
|
689
|
-
json: true,
|
|
729
|
+
headers: { ...localVarHeaderParams },
|
|
690
730
|
};
|
|
691
|
-
let
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
731
|
+
let requestOptions = localVarRequestOptions;
|
|
732
|
+
let url = localVarUrl;
|
|
733
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
734
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
735
|
+
url = auth_ApiKeyAuthentication.url;
|
|
736
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
737
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
738
|
+
url = auth_JWTAuthentication.url;
|
|
739
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
740
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
741
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
742
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
743
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
744
|
+
url = auth_OAuth2.url;
|
|
745
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
746
|
+
requestOptions = authDefault.requestOptions;
|
|
747
|
+
url = authDefault.url;
|
|
748
|
+
if (localVarFormParams) {
|
|
749
|
+
delete requestOptions.headers['Content-Type'];
|
|
750
|
+
if (localVarFormParams instanceof FormData) {
|
|
751
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
752
|
+
requestOptions.body = localVarFormParams;
|
|
705
753
|
}
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
715
|
-
reject(new Error(body.error || errString));
|
|
716
|
-
}
|
|
717
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
718
|
-
resolve(body);
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
722
|
-
reject(errString);
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
});
|
|
727
|
-
});
|
|
754
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
755
|
+
// URL-encoded form
|
|
756
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
757
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
const response = await fetch(url, requestOptions);
|
|
761
|
+
return this.handleResponse(response, 'ClassifyJobResponse');
|
|
728
762
|
}
|
|
729
763
|
/**
|
|
730
764
|
* Get classify job result, containing the predictions for a given page.
|
|
@@ -756,9 +790,11 @@ class ClassifyApi {
|
|
|
756
790
|
const localVarPath = this.basePath + '/api/{projectId}/classify/all/result/page'
|
|
757
791
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
758
792
|
let localVarQueryParameters = {};
|
|
759
|
-
let localVarHeaderParams =
|
|
760
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
761
|
-
|
|
793
|
+
let localVarHeaderParams = {
|
|
794
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
795
|
+
'Content-Type': 'application/json',
|
|
796
|
+
...this.defaultHeaders,
|
|
797
|
+
};
|
|
762
798
|
const produces = ['application/json'];
|
|
763
799
|
// give precedence to 'application/json'
|
|
764
800
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -767,7 +803,7 @@ class ClassifyApi {
|
|
|
767
803
|
else {
|
|
768
804
|
localVarHeaderParams.Accept = produces.join(',');
|
|
769
805
|
}
|
|
770
|
-
let localVarFormParams
|
|
806
|
+
let localVarFormParams;
|
|
771
807
|
// verify required parameter 'projectId' is not null or undefined
|
|
772
808
|
if (projectId === null || projectId === undefined) {
|
|
773
809
|
throw new Error('Required parameter projectId was null or undefined when calling getClassifyJobResultPage.');
|
|
@@ -835,55 +871,51 @@ class ClassifyApi {
|
|
|
835
871
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.maxDate) !== undefined) {
|
|
836
872
|
localVarQueryParameters['maxDate'] = models_1.ObjectSerializer.serialize(queryParams.maxDate, "Date");
|
|
837
873
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
874
|
+
localVarHeaderParams = {
|
|
875
|
+
...localVarHeaderParams,
|
|
876
|
+
...options.headers,
|
|
877
|
+
...this.opts.extraHeaders,
|
|
878
|
+
};
|
|
879
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
880
|
+
.filter(([, value]) => value !== undefined)
|
|
881
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
882
|
+
.join('&');
|
|
883
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
841
884
|
let localVarRequestOptions = {
|
|
842
885
|
method: 'GET',
|
|
843
|
-
|
|
844
|
-
headers: localVarHeaderParams,
|
|
845
|
-
uri: localVarPath,
|
|
846
|
-
useQuerystring: this._useQuerystring,
|
|
847
|
-
agentOptions: { keepAlive: false },
|
|
848
|
-
json: true,
|
|
886
|
+
headers: { ...localVarHeaderParams },
|
|
849
887
|
};
|
|
850
|
-
let
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
888
|
+
let requestOptions = localVarRequestOptions;
|
|
889
|
+
let url = localVarUrl;
|
|
890
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
891
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
892
|
+
url = auth_ApiKeyAuthentication.url;
|
|
893
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
894
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
895
|
+
url = auth_JWTAuthentication.url;
|
|
896
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
897
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
898
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
899
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
900
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
901
|
+
url = auth_OAuth2.url;
|
|
902
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
903
|
+
requestOptions = authDefault.requestOptions;
|
|
904
|
+
url = authDefault.url;
|
|
905
|
+
if (localVarFormParams) {
|
|
906
|
+
delete requestOptions.headers['Content-Type'];
|
|
907
|
+
if (localVarFormParams instanceof FormData) {
|
|
908
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
909
|
+
requestOptions.body = localVarFormParams;
|
|
864
910
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
874
|
-
reject(new Error(body.error || errString));
|
|
875
|
-
}
|
|
876
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
877
|
-
resolve(body);
|
|
878
|
-
}
|
|
879
|
-
else {
|
|
880
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
881
|
-
reject(errString);
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
});
|
|
885
|
-
});
|
|
886
|
-
});
|
|
911
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
912
|
+
// URL-encoded form
|
|
913
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
914
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
const response = await fetch(url, requestOptions);
|
|
918
|
+
return this.handleResponse(response, 'ClassifyJobResponsePage');
|
|
887
919
|
}
|
|
888
920
|
/**
|
|
889
921
|
* Get metrics, calculated during a classify all job, for all available model variants. This is experimental and may change in the future.
|
|
@@ -895,9 +927,11 @@ class ClassifyApi {
|
|
|
895
927
|
const localVarPath = this.basePath + '/api/{projectId}/classify/all/metrics'
|
|
896
928
|
.replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
|
|
897
929
|
let localVarQueryParameters = {};
|
|
898
|
-
let localVarHeaderParams =
|
|
899
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
900
|
-
|
|
930
|
+
let localVarHeaderParams = {
|
|
931
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
932
|
+
'Content-Type': 'application/json',
|
|
933
|
+
...this.defaultHeaders,
|
|
934
|
+
};
|
|
901
935
|
const produces = ['application/json'];
|
|
902
936
|
// give precedence to 'application/json'
|
|
903
937
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -906,7 +940,7 @@ class ClassifyApi {
|
|
|
906
940
|
else {
|
|
907
941
|
localVarHeaderParams.Accept = produces.join(',');
|
|
908
942
|
}
|
|
909
|
-
let localVarFormParams
|
|
943
|
+
let localVarFormParams;
|
|
910
944
|
// verify required parameter 'projectId' is not null or undefined
|
|
911
945
|
if (projectId === null || projectId === undefined) {
|
|
912
946
|
throw new Error('Required parameter projectId was null or undefined when calling getClassifyMetricsAllVariants.');
|
|
@@ -914,55 +948,51 @@ class ClassifyApi {
|
|
|
914
948
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.impulseId) !== undefined) {
|
|
915
949
|
localVarQueryParameters['impulseId'] = models_1.ObjectSerializer.serialize(queryParams.impulseId, "number");
|
|
916
950
|
}
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
951
|
+
localVarHeaderParams = {
|
|
952
|
+
...localVarHeaderParams,
|
|
953
|
+
...options.headers,
|
|
954
|
+
...this.opts.extraHeaders,
|
|
955
|
+
};
|
|
956
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
957
|
+
.filter(([, value]) => value !== undefined)
|
|
958
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
959
|
+
.join('&');
|
|
960
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
920
961
|
let localVarRequestOptions = {
|
|
921
962
|
method: 'GET',
|
|
922
|
-
|
|
923
|
-
headers: localVarHeaderParams,
|
|
924
|
-
uri: localVarPath,
|
|
925
|
-
useQuerystring: this._useQuerystring,
|
|
926
|
-
agentOptions: { keepAlive: false },
|
|
927
|
-
json: true,
|
|
963
|
+
headers: { ...localVarHeaderParams },
|
|
928
964
|
};
|
|
929
|
-
let
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
965
|
+
let requestOptions = localVarRequestOptions;
|
|
966
|
+
let url = localVarUrl;
|
|
967
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
968
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
969
|
+
url = auth_ApiKeyAuthentication.url;
|
|
970
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
971
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
972
|
+
url = auth_JWTAuthentication.url;
|
|
973
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
974
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
975
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
976
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
977
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
978
|
+
url = auth_OAuth2.url;
|
|
979
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
980
|
+
requestOptions = authDefault.requestOptions;
|
|
981
|
+
url = authDefault.url;
|
|
982
|
+
if (localVarFormParams) {
|
|
983
|
+
delete requestOptions.headers['Content-Type'];
|
|
984
|
+
if (localVarFormParams instanceof FormData) {
|
|
985
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
986
|
+
requestOptions.body = localVarFormParams;
|
|
943
987
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
953
|
-
reject(new Error(body.error || errString));
|
|
954
|
-
}
|
|
955
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
956
|
-
resolve(body);
|
|
957
|
-
}
|
|
958
|
-
else {
|
|
959
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
960
|
-
reject(errString);
|
|
961
|
-
}
|
|
962
|
-
}
|
|
963
|
-
});
|
|
964
|
-
});
|
|
965
|
-
});
|
|
988
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
989
|
+
// URL-encoded form
|
|
990
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
991
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
const response = await fetch(url, requestOptions);
|
|
995
|
+
return this.handleResponse(response, 'MetricsAllVariantsResponse');
|
|
966
996
|
}
|
|
967
997
|
/**
|
|
968
998
|
* Get raw sample features for a particular window. This is only available after a live classification job has completed and raw features have been cached.
|
|
@@ -979,9 +1009,11 @@ class ClassifyApi {
|
|
|
979
1009
|
.replace('{' + 'sampleId' + '}', encodeURIComponent(String(sampleId)))
|
|
980
1010
|
.replace('{' + 'windowIndex' + '}', encodeURIComponent(String(windowIndex)));
|
|
981
1011
|
let localVarQueryParameters = {};
|
|
982
|
-
let localVarHeaderParams =
|
|
983
|
-
'User-Agent': 'edgeimpulse-api nodejs'
|
|
984
|
-
|
|
1012
|
+
let localVarHeaderParams = {
|
|
1013
|
+
'User-Agent': 'edgeimpulse-api nodejs',
|
|
1014
|
+
'Content-Type': 'application/json',
|
|
1015
|
+
...this.defaultHeaders,
|
|
1016
|
+
};
|
|
985
1017
|
const produces = ['application/json'];
|
|
986
1018
|
// give precedence to 'application/json'
|
|
987
1019
|
if (produces.indexOf('application/json') >= 0) {
|
|
@@ -990,7 +1022,7 @@ class ClassifyApi {
|
|
|
990
1022
|
else {
|
|
991
1023
|
localVarHeaderParams.Accept = produces.join(',');
|
|
992
1024
|
}
|
|
993
|
-
let localVarFormParams
|
|
1025
|
+
let localVarFormParams;
|
|
994
1026
|
// verify required parameter 'projectId' is not null or undefined
|
|
995
1027
|
if (projectId === null || projectId === undefined) {
|
|
996
1028
|
throw new Error('Required parameter projectId was null or undefined when calling getSampleWindowFromCache.');
|
|
@@ -1009,55 +1041,51 @@ class ClassifyApi {
|
|
|
1009
1041
|
if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.truncateStructuredLabels) !== undefined) {
|
|
1010
1042
|
localVarQueryParameters['truncateStructuredLabels'] = models_1.ObjectSerializer.serialize(queryParams.truncateStructuredLabels, "boolean");
|
|
1011
1043
|
}
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1044
|
+
localVarHeaderParams = {
|
|
1045
|
+
...localVarHeaderParams,
|
|
1046
|
+
...options.headers,
|
|
1047
|
+
...this.opts.extraHeaders,
|
|
1048
|
+
};
|
|
1049
|
+
const queryString = Object.entries(localVarQueryParameters)
|
|
1050
|
+
.filter(([, value]) => value !== undefined)
|
|
1051
|
+
.map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
|
|
1052
|
+
.join('&');
|
|
1053
|
+
let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
|
|
1015
1054
|
let localVarRequestOptions = {
|
|
1016
1055
|
method: 'GET',
|
|
1017
|
-
|
|
1018
|
-
headers: localVarHeaderParams,
|
|
1019
|
-
uri: localVarPath,
|
|
1020
|
-
useQuerystring: this._useQuerystring,
|
|
1021
|
-
agentOptions: { keepAlive: false },
|
|
1022
|
-
json: true,
|
|
1056
|
+
headers: { ...localVarHeaderParams },
|
|
1023
1057
|
};
|
|
1024
|
-
let
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1058
|
+
let requestOptions = localVarRequestOptions;
|
|
1059
|
+
let url = localVarUrl;
|
|
1060
|
+
const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
|
|
1061
|
+
requestOptions = auth_ApiKeyAuthentication.requestOptions;
|
|
1062
|
+
url = auth_ApiKeyAuthentication.url;
|
|
1063
|
+
const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
|
|
1064
|
+
requestOptions = auth_JWTAuthentication.requestOptions;
|
|
1065
|
+
url = auth_JWTAuthentication.url;
|
|
1066
|
+
const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
|
|
1067
|
+
requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
|
|
1068
|
+
url = auth_JWTHttpHeaderAuthentication.url;
|
|
1069
|
+
const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
|
|
1070
|
+
requestOptions = auth_OAuth2.requestOptions;
|
|
1071
|
+
url = auth_OAuth2.url;
|
|
1072
|
+
const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
|
|
1073
|
+
requestOptions = authDefault.requestOptions;
|
|
1074
|
+
url = authDefault.url;
|
|
1075
|
+
if (localVarFormParams) {
|
|
1076
|
+
delete requestOptions.headers['Content-Type'];
|
|
1077
|
+
if (localVarFormParams instanceof FormData) {
|
|
1078
|
+
// FormData: fetch will handle Content-Type automatically.
|
|
1079
|
+
requestOptions.body = localVarFormParams;
|
|
1038
1080
|
}
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1048
|
-
reject(new Error(body.error || errString));
|
|
1049
|
-
}
|
|
1050
|
-
else if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
1051
|
-
resolve(body);
|
|
1052
|
-
}
|
|
1053
|
-
else {
|
|
1054
|
-
const errString = `Failed to call "${localVarPath}", returned ${response.statusCode}: ` + response.body;
|
|
1055
|
-
reject(errString);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
});
|
|
1059
|
-
});
|
|
1060
|
-
});
|
|
1081
|
+
else if (Object.keys(localVarFormParams).length > 0) {
|
|
1082
|
+
// URL-encoded form
|
|
1083
|
+
requestOptions.body = new URLSearchParams(localVarFormParams).toString();
|
|
1084
|
+
requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
const response = await fetch(url, requestOptions);
|
|
1088
|
+
return this.handleResponse(response, 'GetSampleResponse');
|
|
1061
1089
|
}
|
|
1062
1090
|
}
|
|
1063
1091
|
exports.ClassifyApi = ClassifyApi;
|