edge-impulse-api 1.97.1 → 1.97.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/build/library/sdk/api/devicesApi.d.ts +92 -1
  2. package/build/library/sdk/api/devicesApi.js +414 -0
  3. package/build/library/sdk/api/devicesApi.js.map +1 -1
  4. package/build/library/sdk/api/learnApi.d.ts +2 -0
  5. package/build/library/sdk/api/learnApi.js +11 -0
  6. package/build/library/sdk/api/learnApi.js.map +1 -1
  7. package/build/library/sdk/model/datasetRatioDataRatio.d.ts +1 -1
  8. package/build/library/sdk/model/datasetSplitOptions.d.ts +1 -1
  9. package/build/library/sdk/model/deployPretrainedModelModelClassification.d.ts +1 -0
  10. package/build/library/sdk/model/deployPretrainedModelModelClassification.js.map +1 -1
  11. package/build/library/sdk/model/deploymentHistory.d.ts +5 -0
  12. package/build/library/sdk/model/deviceDeploymentEvent.d.ts +39 -0
  13. package/build/library/sdk/model/deviceDeploymentEvent.js +7 -0
  14. package/build/library/sdk/model/deviceDeploymentEvent.js.map +1 -0
  15. package/build/library/sdk/model/deviceModelDeploymentRequest.d.ts +6 -0
  16. package/build/library/sdk/model/deviceModelDeploymentRequest.js +4 -0
  17. package/build/library/sdk/model/deviceModelDeploymentRequest.js.map +1 -0
  18. package/build/library/sdk/model/deviceTelemetryInterval.d.ts +21 -0
  19. package/build/library/sdk/model/deviceTelemetryInterval.js +4 -0
  20. package/build/library/sdk/model/deviceTelemetryInterval.js.map +1 -0
  21. package/build/library/sdk/model/impulseLearnBlock.d.ts +2 -2
  22. package/build/library/sdk/model/impulseSpecificGpuTrainingProcessor.d.ts +5 -0
  23. package/build/library/sdk/model/impulseSpecificGpuTrainingProcessor.js +6 -0
  24. package/build/library/sdk/model/impulseSpecificGpuTrainingProcessor.js.map +1 -0
  25. package/build/library/sdk/model/listDeviceDeploymentHistoryResponse.d.ts +19 -0
  26. package/build/library/sdk/model/listDeviceDeploymentHistoryResponse.js +4 -0
  27. package/build/library/sdk/model/listDeviceDeploymentHistoryResponse.js.map +1 -0
  28. package/build/library/sdk/model/listDeviceTelemetryResponse.d.ts +16 -0
  29. package/build/library/sdk/model/listDeviceTelemetryResponse.js +4 -0
  30. package/build/library/sdk/model/listDeviceTelemetryResponse.js.map +1 -0
  31. package/build/library/sdk/model/listLatestDeviceTelemetryResponse.d.ts +12 -0
  32. package/build/library/sdk/model/listLatestDeviceTelemetryResponse.js +4 -0
  33. package/build/library/sdk/model/listLatestDeviceTelemetryResponse.js.map +1 -0
  34. package/build/library/sdk/model/models.d.ts +7 -1
  35. package/build/library/sdk/model/models.js +7 -1
  36. package/build/library/sdk/model/models.js.map +1 -1
  37. package/build/library/sdk/model/organizationCreateProjectRequest.d.ts +1 -2
  38. package/build/library/sdk/model/organizationCreateProjectRequest.js.map +1 -1
  39. package/build/library/sdk/model/organizationPipelineStep.d.ts +1 -2
  40. package/build/library/sdk/model/organizationPipelineStep.js.map +1 -1
  41. package/build/library/sdk/model/setKerasParameterRequest.d.ts +2 -2
  42. package/build/library/sdk/model/uploadPretrainedModelRequest.d.ts +8 -0
  43. package/build/library/sdk/model/uploadPretrainedModelRequest.js.map +1 -1
  44. package/package.json +1 -1
  45. package/build/library/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.d.ts +0 -6
  46. package/build/library/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.js +0 -6
  47. package/build/library/sdk/model/experimentalImpulseSpecificGpuTrainingProcessor.js.map +0 -1
@@ -14,7 +14,7 @@
14
14
  import type { Response as UndiciResponse } from 'undici-types';
15
15
  import { Authentication } from '../model/models';
16
16
  import { ApiKeyAuth, OAuth } from '../model/models';
17
- import type { CreateDeviceRequest, GenericApiResponse, GetDeviceResponse, GetImpulseRecordsRequest, GetInferenceHistoryResponse, GetInferenceMetricsRequest, GetInferenceMetricsResponse, KeepDeviceDebugStreamAliveRequest, ListDevicesResponse, RenameDeviceRequest, StartDeviceDebugStreamResponse, StartDeviceSnapshotDebugStreamRequest, StartSamplingRequest, StartSamplingResponse, StopDeviceDebugStreamRequest, StoreInferenceHistoryRequest } from '../model/models';
17
+ import type { CreateDeviceRequest, DeviceModelDeploymentRequest, GenericApiResponse, GetDeviceResponse, GetImpulseRecordsRequest, GetInferenceHistoryResponse, GetInferenceMetricsRequest, GetInferenceMetricsResponse, KeepDeviceDebugStreamAliveRequest, ListDeviceDeploymentHistoryResponse, ListDeviceTelemetryResponse, ListDevicesResponse, ListLatestDeviceTelemetryResponse, RenameDeviceRequest, StartDeviceDebugStreamResponse, StartDeviceSnapshotDebugStreamRequest, StartSamplingRequest, StartSamplingResponse, StopDeviceDebugStreamRequest, StoreInferenceHistoryRequest } from '../model/models';
18
18
  export declare enum DevicesApiApiKeys {
19
19
  ApiKeyAuthentication = 0,
20
20
  JWTAuthentication = 1,
@@ -38,6 +38,19 @@ type getInferenceMetricsQueryParams = {
38
38
  startTimestamp: number;
39
39
  endTimestamp?: number;
40
40
  };
41
+ type listDeviceDeploymentHistoryQueryParams = {
42
+ since?: number;
43
+ limit?: number;
44
+ offset?: number;
45
+ };
46
+ type listDeviceTelemetryQueryParams = {
47
+ since?: number;
48
+ limit?: number;
49
+ offset?: number;
50
+ };
51
+ type listLatestDeviceTelemetryQueryParams = {
52
+ since?: number;
53
+ };
41
54
  type storeInferenceHistoryQueryParams = {
42
55
  deploymentId: number;
43
56
  };
@@ -92,6 +105,21 @@ export declare class DevicesApi {
92
105
  [name: string]: string;
93
106
  }) => void;
94
107
  }): Promise<GenericApiResponse>;
108
+ /**
109
+ * Request that a device connected in inference mode deploys a specific project deployment version.
110
+ * @summary Deploy a model version to a device
111
+ * @param projectId Project ID
112
+ * @param deviceId Device ID
113
+ * @param deviceModelDeploymentRequest
114
+ */
115
+ deployDeviceModel(projectId: number, deviceId: string, deviceModelDeploymentRequest: DeviceModelDeploymentRequest, options?: {
116
+ headers: {
117
+ [name: string]: string;
118
+ };
119
+ responseHeadersCallback?: (headers: {
120
+ [name: string]: string;
121
+ }) => void;
122
+ }): Promise<GenericApiResponse>;
95
123
  /**
96
124
  * Downloads exported on-device inference history data. This is experimental and may change in the future.
97
125
  * @summary Download exported on-device inference history
@@ -188,6 +216,40 @@ export declare class DevicesApi {
188
216
  [name: string]: string;
189
217
  }) => void;
190
218
  }): Promise<GenericApiResponse>;
219
+ /**
220
+ * Lists model deployment and rollback events reported by this device, newest first.
221
+ * @summary List device deployment events
222
+ * @param projectId Project ID
223
+ * @param deviceId Device ID
224
+ * @param since Inclusive Unix timestamp in milliseconds based on Studio\&#39;s server receive time.
225
+ * @param limit Maximum number of results
226
+ * @param offset Offset in results, can be used in conjunction with LimitResultsParameter to implement paging.
227
+ */
228
+ listDeviceDeploymentHistory(projectId: number, deviceId: string, queryParams?: listDeviceDeploymentHistoryQueryParams, options?: {
229
+ headers: {
230
+ [name: string]: string;
231
+ };
232
+ responseHeadersCallback?: (headers: {
233
+ [name: string]: string;
234
+ }) => void;
235
+ }): Promise<ListDeviceDeploymentHistoryResponse>;
236
+ /**
237
+ * Lists one device\'s telemetry reports in newest-first order. Each item represents one device-reported time window and contains metrics for the device and every workload included in that report.
238
+ * @summary List device telemetry history
239
+ * @param projectId Project ID
240
+ * @param deviceId Device ID
241
+ * @param since Inclusive Unix timestamp in milliseconds based on Studio\&#39;s server receive time.
242
+ * @param limit Maximum number of results
243
+ * @param offset Offset in results, can be used in conjunction with LimitResultsParameter to implement paging.
244
+ */
245
+ listDeviceTelemetry(projectId: number, deviceId: string, queryParams?: listDeviceTelemetryQueryParams, options?: {
246
+ headers: {
247
+ [name: string]: string;
248
+ };
249
+ responseHeadersCallback?: (headers: {
250
+ [name: string]: string;
251
+ }) => void;
252
+ }): Promise<ListDeviceTelemetryResponse>;
191
253
  /**
192
254
  * 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.
193
255
  * @summary Lists devices
@@ -201,6 +263,20 @@ export declare class DevicesApi {
201
263
  [name: string]: string;
202
264
  }) => void;
203
265
  }): Promise<ListDevicesResponse>;
266
+ /**
267
+ * Lists the most recently received telemetry report for every device in the project. Each item contains the device metrics and all workload metrics from the original device-reported time window; devices that have not reported telemetry are omitted.
268
+ * @summary List latest device telemetry
269
+ * @param projectId Project ID
270
+ * @param since Inclusive Unix timestamp in milliseconds based on Studio\&#39;s server receive time.
271
+ */
272
+ listLatestDeviceTelemetry(projectId: number, queryParams?: listLatestDeviceTelemetryQueryParams, options?: {
273
+ headers: {
274
+ [name: string]: string;
275
+ };
276
+ responseHeadersCallback?: (headers: {
277
+ [name: string]: string;
278
+ }) => void;
279
+ }): Promise<ListLatestDeviceTelemetryResponse>;
204
280
  /**
205
281
  * Set the current name for a device.
206
282
  * @summary Rename device
@@ -230,6 +306,21 @@ export declare class DevicesApi {
230
306
  [name: string]: string;
231
307
  }) => void;
232
308
  }): Promise<GenericApiResponse>;
309
+ /**
310
+ * Request that a device connected in inference mode rolls back to a specific project deployment version that it still holds.
311
+ * @summary Roll back a model version on a device
312
+ * @param projectId Project ID
313
+ * @param deviceId Device ID
314
+ * @param deviceModelDeploymentRequest
315
+ */
316
+ rollbackDeviceModel(projectId: number, deviceId: string, deviceModelDeploymentRequest: DeviceModelDeploymentRequest, options?: {
317
+ headers: {
318
+ [name: string]: string;
319
+ };
320
+ responseHeadersCallback?: (headers: {
321
+ [name: string]: string;
322
+ }) => void;
323
+ }): Promise<GenericApiResponse>;
233
324
  /**
234
325
  * 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).
235
326
  * @summary Start inference debug stream
@@ -275,6 +275,88 @@ class DevicesApi {
275
275
  }
276
276
  return resp;
277
277
  }
278
+ /**
279
+ * Request that a device connected in inference mode deploys a specific project deployment version.
280
+ * @summary Deploy a model version to a device
281
+ * @param projectId Project ID
282
+ * @param deviceId Device ID
283
+ * @param deviceModelDeploymentRequest
284
+ */
285
+ async deployDeviceModel(projectId, deviceId, deviceModelDeploymentRequest, options = { headers: {} }) {
286
+ const localVarPath = this.basePath + '/api/{projectId}/devices/{deviceId}/deploy-model'
287
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
288
+ .replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
289
+ let queryParameters = {};
290
+ let localVarHeaderParams = {
291
+ 'User-Agent': 'edgeimpulse-api nodejs',
292
+ 'Content-Type': 'application/json',
293
+ ...this.defaultHeaders,
294
+ };
295
+ const produces = ['application/json'];
296
+ // give precedence to 'application/json'
297
+ if (produces.indexOf('application/json') >= 0) {
298
+ localVarHeaderParams.Accept = 'application/json';
299
+ }
300
+ else {
301
+ localVarHeaderParams.Accept = produces.join(',');
302
+ }
303
+ let localVarFormParams;
304
+ // verify required parameter 'projectId' is not null or undefined
305
+ if (projectId === null || projectId === undefined) {
306
+ throw new Error('Required parameter projectId was null or undefined when calling deployDeviceModel.');
307
+ }
308
+ // verify required parameter 'deviceId' is not null or undefined
309
+ if (deviceId === null || deviceId === undefined) {
310
+ throw new Error('Required parameter deviceId was null or undefined when calling deployDeviceModel.');
311
+ }
312
+ // verify required parameter 'deviceModelDeploymentRequest' is not null or undefined
313
+ if (deviceModelDeploymentRequest === null || deviceModelDeploymentRequest === undefined) {
314
+ throw new Error('Required parameter deviceModelDeploymentRequest was null or undefined when calling deployDeviceModel.');
315
+ }
316
+ localVarHeaderParams = {
317
+ ...localVarHeaderParams,
318
+ ...options.headers,
319
+ ...this.opts.extraHeaders,
320
+ };
321
+ const queryString = Object.entries(queryParameters)
322
+ .filter(([, value]) => value !== undefined)
323
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
324
+ .join('&');
325
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
326
+ let localVarRequestOptions = {
327
+ method: 'POST',
328
+ headers: { ...localVarHeaderParams },
329
+ };
330
+ localVarRequestOptions.body = JSON.stringify(deviceModelDeploymentRequest);
331
+ let requestOptions = localVarRequestOptions;
332
+ let url = localVarUrl;
333
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
334
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
335
+ url = auth_ApiKeyAuthentication.url;
336
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
337
+ requestOptions = auth_JWTAuthentication.requestOptions;
338
+ url = auth_JWTAuthentication.url;
339
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
340
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
341
+ url = auth_JWTHttpHeaderAuthentication.url;
342
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
343
+ requestOptions = auth_OAuth2.requestOptions;
344
+ url = auth_OAuth2.url;
345
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
346
+ requestOptions = authDefault.requestOptions;
347
+ url = authDefault.url;
348
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
349
+ const response = await fetch(url, requestOptions);
350
+ const resp = this.handleResponse(response, 'GenericApiResponse');
351
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
352
+ const headerCb = options.responseHeadersCallback;
353
+ // on next tick, so we have time to handle the response
354
+ setTimeout(() => {
355
+ headerCb(Object.fromEntries(response.headers.entries()));
356
+ }, 0);
357
+ }
358
+ return resp;
359
+ }
278
360
  /**
279
361
  * Downloads exported on-device inference history data. This is experimental and may change in the future.
280
362
  * @summary Download exported on-device inference history
@@ -803,6 +885,182 @@ class DevicesApi {
803
885
  }
804
886
  return resp;
805
887
  }
888
+ /**
889
+ * Lists model deployment and rollback events reported by this device, newest first.
890
+ * @summary List device deployment events
891
+ * @param projectId Project ID
892
+ * @param deviceId Device ID
893
+ * @param since Inclusive Unix timestamp in milliseconds based on Studio\&#39;s server receive time.
894
+ * @param limit Maximum number of results
895
+ * @param offset Offset in results, can be used in conjunction with LimitResultsParameter to implement paging.
896
+ */
897
+ async listDeviceDeploymentHistory(projectId, deviceId, queryParams, options = { headers: {} }) {
898
+ const localVarPath = this.basePath + '/api/{projectId}/devices/{deviceId}/deployment-events'
899
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
900
+ .replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
901
+ let queryParameters = {};
902
+ let localVarHeaderParams = {
903
+ 'User-Agent': 'edgeimpulse-api nodejs',
904
+ 'Content-Type': 'application/json',
905
+ ...this.defaultHeaders,
906
+ };
907
+ const produces = ['application/json'];
908
+ // give precedence to 'application/json'
909
+ if (produces.indexOf('application/json') >= 0) {
910
+ localVarHeaderParams.Accept = 'application/json';
911
+ }
912
+ else {
913
+ localVarHeaderParams.Accept = produces.join(',');
914
+ }
915
+ let localVarFormParams;
916
+ // verify required parameter 'projectId' is not null or undefined
917
+ if (projectId === null || projectId === undefined) {
918
+ throw new Error('Required parameter projectId was null or undefined when calling listDeviceDeploymentHistory.');
919
+ }
920
+ // verify required parameter 'deviceId' is not null or undefined
921
+ if (deviceId === null || deviceId === undefined) {
922
+ throw new Error('Required parameter deviceId was null or undefined when calling listDeviceDeploymentHistory.');
923
+ }
924
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.since) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.since) !== null) {
925
+ queryParameters['since'] = queryParams.since;
926
+ }
927
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.limit) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.limit) !== null) {
928
+ queryParameters['limit'] = queryParams.limit;
929
+ }
930
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.offset) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.offset) !== null) {
931
+ queryParameters['offset'] = queryParams.offset;
932
+ }
933
+ localVarHeaderParams = {
934
+ ...localVarHeaderParams,
935
+ ...options.headers,
936
+ ...this.opts.extraHeaders,
937
+ };
938
+ const queryString = Object.entries(queryParameters)
939
+ .filter(([, value]) => value !== undefined)
940
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
941
+ .join('&');
942
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
943
+ let localVarRequestOptions = {
944
+ method: 'GET',
945
+ headers: { ...localVarHeaderParams },
946
+ };
947
+ let requestOptions = localVarRequestOptions;
948
+ let url = localVarUrl;
949
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
950
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
951
+ url = auth_ApiKeyAuthentication.url;
952
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
953
+ requestOptions = auth_JWTAuthentication.requestOptions;
954
+ url = auth_JWTAuthentication.url;
955
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
956
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
957
+ url = auth_JWTHttpHeaderAuthentication.url;
958
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
959
+ requestOptions = auth_OAuth2.requestOptions;
960
+ url = auth_OAuth2.url;
961
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
962
+ requestOptions = authDefault.requestOptions;
963
+ url = authDefault.url;
964
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
965
+ const response = await fetch(url, requestOptions);
966
+ const resp = this.handleResponse(response, 'ListDeviceDeploymentHistoryResponse');
967
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
968
+ const headerCb = options.responseHeadersCallback;
969
+ // on next tick, so we have time to handle the response
970
+ setTimeout(() => {
971
+ headerCb(Object.fromEntries(response.headers.entries()));
972
+ }, 0);
973
+ }
974
+ return resp;
975
+ }
976
+ /**
977
+ * Lists one device\'s telemetry reports in newest-first order. Each item represents one device-reported time window and contains metrics for the device and every workload included in that report.
978
+ * @summary List device telemetry history
979
+ * @param projectId Project ID
980
+ * @param deviceId Device ID
981
+ * @param since Inclusive Unix timestamp in milliseconds based on Studio\&#39;s server receive time.
982
+ * @param limit Maximum number of results
983
+ * @param offset Offset in results, can be used in conjunction with LimitResultsParameter to implement paging.
984
+ */
985
+ async listDeviceTelemetry(projectId, deviceId, queryParams, options = { headers: {} }) {
986
+ const localVarPath = this.basePath + '/api/{projectId}/devices/{deviceId}/telemetry'
987
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
988
+ .replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
989
+ let queryParameters = {};
990
+ let localVarHeaderParams = {
991
+ 'User-Agent': 'edgeimpulse-api nodejs',
992
+ 'Content-Type': 'application/json',
993
+ ...this.defaultHeaders,
994
+ };
995
+ const produces = ['application/json'];
996
+ // give precedence to 'application/json'
997
+ if (produces.indexOf('application/json') >= 0) {
998
+ localVarHeaderParams.Accept = 'application/json';
999
+ }
1000
+ else {
1001
+ localVarHeaderParams.Accept = produces.join(',');
1002
+ }
1003
+ let localVarFormParams;
1004
+ // verify required parameter 'projectId' is not null or undefined
1005
+ if (projectId === null || projectId === undefined) {
1006
+ throw new Error('Required parameter projectId was null or undefined when calling listDeviceTelemetry.');
1007
+ }
1008
+ // verify required parameter 'deviceId' is not null or undefined
1009
+ if (deviceId === null || deviceId === undefined) {
1010
+ throw new Error('Required parameter deviceId was null or undefined when calling listDeviceTelemetry.');
1011
+ }
1012
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.since) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.since) !== null) {
1013
+ queryParameters['since'] = queryParams.since;
1014
+ }
1015
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.limit) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.limit) !== null) {
1016
+ queryParameters['limit'] = queryParams.limit;
1017
+ }
1018
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.offset) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.offset) !== null) {
1019
+ queryParameters['offset'] = queryParams.offset;
1020
+ }
1021
+ localVarHeaderParams = {
1022
+ ...localVarHeaderParams,
1023
+ ...options.headers,
1024
+ ...this.opts.extraHeaders,
1025
+ };
1026
+ const queryString = Object.entries(queryParameters)
1027
+ .filter(([, value]) => value !== undefined)
1028
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1029
+ .join('&');
1030
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1031
+ let localVarRequestOptions = {
1032
+ method: 'GET',
1033
+ headers: { ...localVarHeaderParams },
1034
+ };
1035
+ let requestOptions = localVarRequestOptions;
1036
+ let url = localVarUrl;
1037
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1038
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1039
+ url = auth_ApiKeyAuthentication.url;
1040
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1041
+ requestOptions = auth_JWTAuthentication.requestOptions;
1042
+ url = auth_JWTAuthentication.url;
1043
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1044
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1045
+ url = auth_JWTHttpHeaderAuthentication.url;
1046
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1047
+ requestOptions = auth_OAuth2.requestOptions;
1048
+ url = auth_OAuth2.url;
1049
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1050
+ requestOptions = authDefault.requestOptions;
1051
+ url = authDefault.url;
1052
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
1053
+ const response = await fetch(url, requestOptions);
1054
+ const resp = this.handleResponse(response, 'ListDeviceTelemetryResponse');
1055
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
1056
+ const headerCb = options.responseHeadersCallback;
1057
+ // on next tick, so we have time to handle the response
1058
+ setTimeout(() => {
1059
+ headerCb(Object.fromEntries(response.headers.entries()));
1060
+ }, 0);
1061
+ }
1062
+ return resp;
1063
+ }
806
1064
  /**
807
1065
  * 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.
808
1066
  * @summary Lists devices
@@ -873,6 +1131,80 @@ class DevicesApi {
873
1131
  }
874
1132
  return resp;
875
1133
  }
1134
+ /**
1135
+ * Lists the most recently received telemetry report for every device in the project. Each item contains the device metrics and all workload metrics from the original device-reported time window; devices that have not reported telemetry are omitted.
1136
+ * @summary List latest device telemetry
1137
+ * @param projectId Project ID
1138
+ * @param since Inclusive Unix timestamp in milliseconds based on Studio\&#39;s server receive time.
1139
+ */
1140
+ async listLatestDeviceTelemetry(projectId, queryParams, options = { headers: {} }) {
1141
+ const localVarPath = this.basePath + '/api/{projectId}/devices/telemetry/latest'
1142
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
1143
+ let queryParameters = {};
1144
+ let localVarHeaderParams = {
1145
+ 'User-Agent': 'edgeimpulse-api nodejs',
1146
+ 'Content-Type': 'application/json',
1147
+ ...this.defaultHeaders,
1148
+ };
1149
+ const produces = ['application/json'];
1150
+ // give precedence to 'application/json'
1151
+ if (produces.indexOf('application/json') >= 0) {
1152
+ localVarHeaderParams.Accept = 'application/json';
1153
+ }
1154
+ else {
1155
+ localVarHeaderParams.Accept = produces.join(',');
1156
+ }
1157
+ let localVarFormParams;
1158
+ // verify required parameter 'projectId' is not null or undefined
1159
+ if (projectId === null || projectId === undefined) {
1160
+ throw new Error('Required parameter projectId was null or undefined when calling listLatestDeviceTelemetry.');
1161
+ }
1162
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.since) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.since) !== null) {
1163
+ queryParameters['since'] = queryParams.since;
1164
+ }
1165
+ localVarHeaderParams = {
1166
+ ...localVarHeaderParams,
1167
+ ...options.headers,
1168
+ ...this.opts.extraHeaders,
1169
+ };
1170
+ const queryString = Object.entries(queryParameters)
1171
+ .filter(([, value]) => value !== undefined)
1172
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1173
+ .join('&');
1174
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1175
+ let localVarRequestOptions = {
1176
+ method: 'GET',
1177
+ headers: { ...localVarHeaderParams },
1178
+ };
1179
+ let requestOptions = localVarRequestOptions;
1180
+ let url = localVarUrl;
1181
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1182
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1183
+ url = auth_ApiKeyAuthentication.url;
1184
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1185
+ requestOptions = auth_JWTAuthentication.requestOptions;
1186
+ url = auth_JWTAuthentication.url;
1187
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1188
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1189
+ url = auth_JWTHttpHeaderAuthentication.url;
1190
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1191
+ requestOptions = auth_OAuth2.requestOptions;
1192
+ url = auth_OAuth2.url;
1193
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1194
+ requestOptions = authDefault.requestOptions;
1195
+ url = authDefault.url;
1196
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
1197
+ const response = await fetch(url, requestOptions);
1198
+ const resp = this.handleResponse(response, 'ListLatestDeviceTelemetryResponse');
1199
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
1200
+ const headerCb = options.responseHeadersCallback;
1201
+ // on next tick, so we have time to handle the response
1202
+ setTimeout(() => {
1203
+ headerCb(Object.fromEntries(response.headers.entries()));
1204
+ }, 0);
1205
+ }
1206
+ return resp;
1207
+ }
876
1208
  /**
877
1209
  * Set the current name for a device.
878
1210
  * @summary Rename device
@@ -1031,6 +1363,88 @@ class DevicesApi {
1031
1363
  }
1032
1364
  return resp;
1033
1365
  }
1366
+ /**
1367
+ * Request that a device connected in inference mode rolls back to a specific project deployment version that it still holds.
1368
+ * @summary Roll back a model version on a device
1369
+ * @param projectId Project ID
1370
+ * @param deviceId Device ID
1371
+ * @param deviceModelDeploymentRequest
1372
+ */
1373
+ async rollbackDeviceModel(projectId, deviceId, deviceModelDeploymentRequest, options = { headers: {} }) {
1374
+ const localVarPath = this.basePath + '/api/{projectId}/devices/{deviceId}/rollback-model'
1375
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
1376
+ .replace('{' + 'deviceId' + '}', encodeURIComponent(String(deviceId)));
1377
+ let queryParameters = {};
1378
+ let localVarHeaderParams = {
1379
+ 'User-Agent': 'edgeimpulse-api nodejs',
1380
+ 'Content-Type': 'application/json',
1381
+ ...this.defaultHeaders,
1382
+ };
1383
+ const produces = ['application/json'];
1384
+ // give precedence to 'application/json'
1385
+ if (produces.indexOf('application/json') >= 0) {
1386
+ localVarHeaderParams.Accept = 'application/json';
1387
+ }
1388
+ else {
1389
+ localVarHeaderParams.Accept = produces.join(',');
1390
+ }
1391
+ let localVarFormParams;
1392
+ // verify required parameter 'projectId' is not null or undefined
1393
+ if (projectId === null || projectId === undefined) {
1394
+ throw new Error('Required parameter projectId was null or undefined when calling rollbackDeviceModel.');
1395
+ }
1396
+ // verify required parameter 'deviceId' is not null or undefined
1397
+ if (deviceId === null || deviceId === undefined) {
1398
+ throw new Error('Required parameter deviceId was null or undefined when calling rollbackDeviceModel.');
1399
+ }
1400
+ // verify required parameter 'deviceModelDeploymentRequest' is not null or undefined
1401
+ if (deviceModelDeploymentRequest === null || deviceModelDeploymentRequest === undefined) {
1402
+ throw new Error('Required parameter deviceModelDeploymentRequest was null or undefined when calling rollbackDeviceModel.');
1403
+ }
1404
+ localVarHeaderParams = {
1405
+ ...localVarHeaderParams,
1406
+ ...options.headers,
1407
+ ...this.opts.extraHeaders,
1408
+ };
1409
+ const queryString = Object.entries(queryParameters)
1410
+ .filter(([, value]) => value !== undefined)
1411
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1412
+ .join('&');
1413
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1414
+ let localVarRequestOptions = {
1415
+ method: 'POST',
1416
+ headers: { ...localVarHeaderParams },
1417
+ };
1418
+ localVarRequestOptions.body = JSON.stringify(deviceModelDeploymentRequest);
1419
+ let requestOptions = localVarRequestOptions;
1420
+ let url = localVarUrl;
1421
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1422
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1423
+ url = auth_ApiKeyAuthentication.url;
1424
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1425
+ requestOptions = auth_JWTAuthentication.requestOptions;
1426
+ url = auth_JWTAuthentication.url;
1427
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1428
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1429
+ url = auth_JWTHttpHeaderAuthentication.url;
1430
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1431
+ requestOptions = auth_OAuth2.requestOptions;
1432
+ url = auth_OAuth2.url;
1433
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1434
+ requestOptions = authDefault.requestOptions;
1435
+ url = authDefault.url;
1436
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
1437
+ const response = await fetch(url, requestOptions);
1438
+ const resp = this.handleResponse(response, 'GenericApiResponse');
1439
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
1440
+ const headerCb = options.responseHeadersCallback;
1441
+ // on next tick, so we have time to handle the response
1442
+ setTimeout(() => {
1443
+ headerCb(Object.fromEntries(response.headers.entries()));
1444
+ }, 0);
1445
+ }
1446
+ return resp;
1447
+ }
1034
1448
  /**
1035
1449
  * 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).
1036
1450
  * @summary Start inference debug stream