@edgeiq/edgeiq-api-js 1.11.7 → 1.11.9

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.
@@ -76,6 +76,7 @@ export declare const BaseEndpoints: {
76
76
  file: string;
77
77
  gatewayCommand: string;
78
78
  gatewayCsvUpload: string;
79
+ heartbeats: string;
79
80
  ingestor: string;
80
81
  integration: string;
81
82
  integrationEvent: string;
@@ -131,6 +132,7 @@ export declare const Endpoints: {
131
132
  discoveredDevice: string;
132
133
  escrowDevice: string;
133
134
  gatewayCommand: string;
135
+ heartbeats: string;
134
136
  ingestor: string;
135
137
  integration: string;
136
138
  integrationEvent: string;
package/dist/constants.js CHANGED
@@ -78,6 +78,7 @@ export const BaseEndpoints = {
78
78
  file: 'files',
79
79
  gatewayCommand: 'gateway_commands',
80
80
  gatewayCsvUpload: 'gateway_csv_upload',
81
+ heartbeats: 'heartbeats',
81
82
  ingestor: 'ingestors',
82
83
  integration: 'integrations',
83
84
  integrationEvent: 'integration_events',
@@ -133,6 +134,7 @@ export const Endpoints = {
133
134
  discoveredDevice: `${BaseEndpoints.discoveredDevice}`,
134
135
  escrowDevice: `${BaseEndpoints.escrowDevice}`,
135
136
  gatewayCommand: `${BaseEndpoints.gatewayCommand}`,
137
+ heartbeats: `${BaseEndpoints.heartbeats}`,
136
138
  ingestor: `${BaseEndpoints.ingestor}`,
137
139
  integration: `${BaseEndpoints.integration}`,
138
140
  integrationEvent: `${BaseEndpoints.integrationEvent}`,
@@ -1,4 +1,4 @@
1
- import { Command, EIQFile, Ingestor, Log, PaginatedSettings, Rule, SettingFilters } from '..';
1
+ import { Command, EIQFile, Ingestor, LogFile, PaginatedSettings, Rule, SettingFilters } from '..';
2
2
  import { BaseModelInterface } from '../core/ModelClass';
3
3
  import { GatewayCommand, GatewayCommandRequest } from '../gatewayCommands/models';
4
4
  import { BulkActionResponse, PaginationFilter } from '../models';
@@ -23,7 +23,7 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
23
23
  getCommands(id: string): Promise<Command[]>;
24
24
  csvBulkUpload(file: File): Promise<BulkActionResponse>;
25
25
  csvBulkDownload(filters?: DevicesFilters): Promise<File>;
26
- getLogs(id: string): Promise<Log[]>;
26
+ getLogs(id: string): Promise<LogFile[]>;
27
27
  requestLogs(id: string): Promise<GatewayCommand>;
28
28
  deviceLwm2mObjetLinks(id: string): Promise<Lwm2mObjectLinks[]>;
29
29
  processGatewayCommand(deviceId: string, gatewayCommandRequest: GatewayCommandRequest): Promise<GatewayCommand>;
@@ -1,6 +1,7 @@
1
- export interface Log {
1
+ export interface LogFile {
2
2
  created_at: string;
3
3
  name: string;
4
4
  size: number;
5
5
  url: string;
6
+ log_file_path: string;
6
7
  }
@@ -1,8 +1,9 @@
1
1
  import { BaseModelInterface } from '../core/ModelClass';
2
- import { BulkActionResponse } from '../models';
2
+ import { BulkActionResponse, PaginationFilter } from '../models';
3
3
  import { Report, ReportInput, ReportsFilters, PaginatedReports } from './models';
4
4
  interface ReportsInterface extends BaseModelInterface<Report, ReportInput, ReportsFilters, PaginatedReports> {
5
5
  deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
6
+ listHeartbeats(filters: ReportsFilters, pagination: PaginationFilter): Promise<PaginatedReports>;
6
7
  }
7
8
  export declare const Reports: ReportsInterface;
8
9
  export {};
@@ -56,6 +56,32 @@ export const Reports = class extends BaseModelClass {
56
56
  }
57
57
  });
58
58
  }
59
+ static listHeartbeats(filters, pagination) {
60
+ var _a, _b, _c, _d;
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ try {
63
+ this.logAction(`Listing reports with following filters: ${filters !== null && filters !== void 0 ? filters : '{}'}.\n And pagination ${pagination !== null && pagination !== void 0 ? pagination : '{}'}`);
64
+ const axios = EdgeIQAPI.getAxios();
65
+ const result = yield axios.get(Endpoints.heartbeats, {
66
+ params: parseFilters(filters, pagination),
67
+ });
68
+ return {
69
+ reports: (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources,
70
+ pagination: {
71
+ page: (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b.page,
72
+ itemsPerPage: (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.per_page,
73
+ total: (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.total,
74
+ },
75
+ };
76
+ }
77
+ catch (error) {
78
+ if (isApiError(error)) {
79
+ throw error;
80
+ }
81
+ throw error;
82
+ }
83
+ });
84
+ }
59
85
  static getOneById(id) {
60
86
  return __awaiter(this, void 0, void 0, function* () {
61
87
  try {
@@ -8,7 +8,6 @@ export interface ReportInput {
8
8
  };
9
9
  raw_data?: string;
10
10
  seq: number;
11
- heartbeat?: boolean;
12
11
  type?: string;
13
12
  }
14
13
  export interface Report extends ReportInput, Base {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.11.7",
3
+ "version": "1.11.9",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",