@edgeiq/edgeiq-api-js 1.11.10 → 1.11.12
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/dist/devices/index.d.ts +3 -1
- package/dist/devices/index.js +32 -0
- package/dist/devices/models.d.ts +11 -0
- package/package.json +1 -1
package/dist/devices/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { BaseModelInterface } from '../core/ModelClass';
|
|
|
3
3
|
import { GatewayCommand, GatewayCommandRequest } from '../gatewayCommands/models';
|
|
4
4
|
import { BulkActionResponse, PaginationFilter } from '../models';
|
|
5
5
|
import { Lwm2mObjectLinks } from '../lwm2m/models';
|
|
6
|
-
import { DevicesFilters, Device, DeviceInput, PaginatedDevices, DeviceExportColumnn } from './models';
|
|
6
|
+
import { DevicesFilters, Device, DeviceInput, PaginatedDevices, DeviceExportColumnn, DeviceUptime, DeviceUptimeHistory } from './models';
|
|
7
7
|
import { CommandExecutionsFilters, PaginatedCommandExecutions } from '../commandExecutions/models';
|
|
8
8
|
import { AwsThingGroup } from '../models';
|
|
9
9
|
interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, DevicesFilters, PaginatedDevices> {
|
|
@@ -44,6 +44,8 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
|
|
|
44
44
|
bulkExecuteWorkflow(workflowId: string, ids: string[]): Promise<BulkActionResponse>;
|
|
45
45
|
revokeCertificate(id: string, certificateId: string, revoke: boolean): Promise<string>;
|
|
46
46
|
getExportColumns(): Promise<DeviceExportColumnn[]>;
|
|
47
|
+
getDeviceUptime(id: string, start: string, end: string): Promise<DeviceUptime>;
|
|
48
|
+
getDeviceUptimeHistory(id: string, start: string, end: string): Promise<DeviceUptimeHistory>;
|
|
47
49
|
}
|
|
48
50
|
export declare const Devices: DevicesInterface;
|
|
49
51
|
export {};
|
package/dist/devices/index.js
CHANGED
|
@@ -683,4 +683,36 @@ export const Devices = class extends BaseModelClass {
|
|
|
683
683
|
}
|
|
684
684
|
});
|
|
685
685
|
}
|
|
686
|
+
static getDeviceUptime(id, start, end) {
|
|
687
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
688
|
+
try {
|
|
689
|
+
this.logAction('Getting device uptime');
|
|
690
|
+
const axios = EdgeIQAPI.getAxios();
|
|
691
|
+
const result = yield axios.get(`${Endpoints.device}/${id}/uptime?created_at_gte=${start}&created_at_lte=${end}`);
|
|
692
|
+
return result === null || result === void 0 ? void 0 : result.data;
|
|
693
|
+
}
|
|
694
|
+
catch (error) {
|
|
695
|
+
if (isApiError(error)) {
|
|
696
|
+
throw error;
|
|
697
|
+
}
|
|
698
|
+
throw error;
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
static getDeviceUptimeHistory(id, start, end) {
|
|
703
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
704
|
+
try {
|
|
705
|
+
this.logAction('Getting device uptime');
|
|
706
|
+
const axios = EdgeIQAPI.getAxios();
|
|
707
|
+
const result = yield axios.get(`${Endpoints.device}/${id}/uptime_history?created_at_gte=${start}&created_at_lte=${end}`);
|
|
708
|
+
return result === null || result === void 0 ? void 0 : result.data;
|
|
709
|
+
}
|
|
710
|
+
catch (error) {
|
|
711
|
+
if (isApiError(error)) {
|
|
712
|
+
throw error;
|
|
713
|
+
}
|
|
714
|
+
throw error;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
}
|
|
686
718
|
};
|
package/dist/devices/models.d.ts
CHANGED
|
@@ -48,6 +48,17 @@ export interface DeviceExportColumnn {
|
|
|
48
48
|
name: string;
|
|
49
49
|
is_default: boolean;
|
|
50
50
|
}
|
|
51
|
+
export interface DeviceUptime {
|
|
52
|
+
start: string;
|
|
53
|
+
end: string;
|
|
54
|
+
uptime: number;
|
|
55
|
+
}
|
|
56
|
+
export interface DeviceUptimeHistory {
|
|
57
|
+
categories: unknown;
|
|
58
|
+
category_percentage: string;
|
|
59
|
+
data: unknown;
|
|
60
|
+
measure: string;
|
|
61
|
+
}
|
|
51
62
|
export interface DeviceInput {
|
|
52
63
|
name: string;
|
|
53
64
|
unique_id: string;
|