@edgeiq/edgeiq-api-js 1.11.3 → 1.11.5

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.
@@ -1,9 +1,11 @@
1
- import { NetworkInterfaceAllReports, NetworkInterfaceInfo, NetworkInterfaceLatencyReport, NetworkInterfacePerformanceReport, NetworkInterfaceReport } from './models';
1
+ import { NetworkInterfaceSummary, NetworkInterfaceInfo, NetworkInterfaceLatencyReport, NetworkInterfacePerformanceReport, NetworkInterfaceReport } from './models';
2
2
  declare const NetworkInterfaceReports: {
3
3
  getDeviceNetworkInterfaceReport: (id: string) => Promise<NetworkInterfaceReport>;
4
4
  getDeviceNetworkInterfaceInfo: (device_id: string, interface_name?: string | undefined) => Promise<NetworkInterfaceInfo>;
5
5
  getDeviceNetworkInterfaceLatency: (device_id: string, interface_name?: string | undefined) => Promise<NetworkInterfaceLatencyReport>;
6
- getDeviceNetworkPerformance: (device_id: string) => Promise<NetworkInterfacePerformanceReport>;
7
- getDeviceNetworkInterfaceAllReports: (device_id: string, interface_name: string) => Promise<NetworkInterfaceAllReports>;
6
+ getDeviceNetworkInterfacePerformance: (device_id: string, interface_name?: string | undefined) => Promise<NetworkInterfacePerformanceReport>;
7
+ getDeviceNetworkConnectivity: (device_id: string) => Promise<{
8
+ [key: string]: NetworkInterfaceSummary;
9
+ }>;
8
10
  };
9
11
  export { NetworkInterfaceReports };
@@ -8,7 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { EdgeIQAPI } from '..';
11
+ import { Endpoints } from '../constants';
11
12
  import { isApiError } from '../helpers';
13
+ const ONE_RESULT_PAGING = `&page_meta=true&page=1&per_page=1`;
12
14
  const NetworkInterfaceReports = {
13
15
  getDeviceNetworkInterfaceReport: (id) => __awaiter(void 0, void 0, void 0, function* () {
14
16
  try {
@@ -24,11 +26,11 @@ const NetworkInterfaceReports = {
24
26
  }
25
27
  }),
26
28
  getDeviceNetworkInterfaceInfo: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
27
- var _a;
29
+ var _a, _b;
28
30
  try {
29
31
  const axios = EdgeIQAPI.getAxios();
30
- const result = yield axios.get(`network_interface_infos?device_id=${device_id}${interface_name ? `&interface_name=${interface_name}` : ''}`);
31
- return (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a[0];
32
+ const result = yield axios.get(`network_interface_infos?device_id=${device_id}${interface_name ? `&interface_name=${interface_name}` : ''}${ONE_RESULT_PAGING}`);
33
+ return (_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.resources) === null || _b === void 0 ? void 0 : _b[0];
32
34
  }
33
35
  catch (error) {
34
36
  if (isApiError(error)) {
@@ -38,11 +40,11 @@ const NetworkInterfaceReports = {
38
40
  }
39
41
  }),
40
42
  getDeviceNetworkInterfaceLatency: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
41
- var _b;
43
+ var _c, _d;
42
44
  try {
43
45
  const axios = EdgeIQAPI.getAxios();
44
- const result = yield axios.get(`network_interface_latency_reports?device_id=${device_id}${interface_name ? `&interface_name=${interface_name}` : ''}`);
45
- return (_b = result === null || result === void 0 ? void 0 : result.data) === null || _b === void 0 ? void 0 : _b[0];
46
+ const result = yield axios.get(`network_interface_latency_reports?device_id=${device_id}${interface_name ? `&interface_name=${interface_name}` : ''}${ONE_RESULT_PAGING}`);
47
+ return (_d = (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c.resources) === null || _d === void 0 ? void 0 : _d[0];
46
48
  }
47
49
  catch (error) {
48
50
  if (isApiError(error)) {
@@ -51,12 +53,12 @@ const NetworkInterfaceReports = {
51
53
  throw error;
52
54
  }
53
55
  }),
54
- getDeviceNetworkPerformance: (device_id) => __awaiter(void 0, void 0, void 0, function* () {
55
- var _c;
56
+ getDeviceNetworkInterfacePerformance: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
57
+ var _e, _f;
56
58
  try {
57
59
  const axios = EdgeIQAPI.getAxios();
58
- const result = yield axios.get(`network_interface_performance_reports?device_id=${device_id}`);
59
- return (_c = result === null || result === void 0 ? void 0 : result.data) === null || _c === void 0 ? void 0 : _c[0];
60
+ const result = yield axios.get(`network_interface_performance_reports?device_id=${device_id}${interface_name ? `&interface_name=${interface_name}` : ''}${ONE_RESULT_PAGING}`);
61
+ return (_f = (_e = result === null || result === void 0 ? void 0 : result.data) === null || _e === void 0 ? void 0 : _e.resources) === null || _f === void 0 ? void 0 : _f[0];
60
62
  }
61
63
  catch (error) {
62
64
  if (isApiError(error)) {
@@ -65,25 +67,11 @@ const NetworkInterfaceReports = {
65
67
  throw error;
66
68
  }
67
69
  }),
68
- getDeviceNetworkInterfaceAllReports: (device_id, interface_name) => __awaiter(void 0, void 0, void 0, function* () {
69
- var _d, _e, _f, _g;
70
+ getDeviceNetworkConnectivity: (device_id) => __awaiter(void 0, void 0, void 0, function* () {
70
71
  try {
71
72
  const axios = EdgeIQAPI.getAxios();
72
- const info = yield axios.get(`network_interface_infos?device_id=${device_id}&interface_name=${interface_name}`);
73
- const latency = yield axios.get(`network_interface_latency_reports?device_id=${device_id}&interface_name=${interface_name}`);
74
- if ((info === null || info === void 0 ? void 0 : info.data) && (info === null || info === void 0 ? void 0 : info.data[0])) {
75
- const infoData = info === null || info === void 0 ? void 0 : info.data[0];
76
- const report = yield axios.get(`network_interface_reports/${infoData.network_interfaces_report_id}`);
77
- return {
78
- info: (_d = info === null || info === void 0 ? void 0 : info.data) === null || _d === void 0 ? void 0 : _d[0],
79
- latency: (_e = latency === null || latency === void 0 ? void 0 : latency.data) === null || _e === void 0 ? void 0 : _e[0],
80
- report: report === null || report === void 0 ? void 0 : report.data,
81
- };
82
- }
83
- return {
84
- info: (_f = info === null || info === void 0 ? void 0 : info.data) === null || _f === void 0 ? void 0 : _f[0],
85
- latency: (_g = latency === null || latency === void 0 ? void 0 : latency.data) === null || _g === void 0 ? void 0 : _g[0],
86
- };
73
+ const result = yield axios.get(`${Endpoints.device}/${device_id}/network_connectivity/latest`);
74
+ return result === null || result === void 0 ? void 0 : result.data;
87
75
  }
88
76
  catch (error) {
89
77
  if (isApiError(error)) {
@@ -29,6 +29,16 @@ export interface NetworkInterfaceInfo extends Base {
29
29
  interface_mac_address: string;
30
30
  cellular_strength: string;
31
31
  cellular_mode: string;
32
+ cellular_modem_name: string;
33
+ cellular_modem_manufacturer: string;
34
+ cellular_modem_revision: string;
35
+ cellular_3gpp_imei: string;
36
+ cellular_3gpp_operator_code: string;
37
+ cellular_3gpp_operator_name: string;
38
+ cellular_3gpp_registration_state: string;
39
+ cellular_modem_additional_info: {
40
+ [key: string]: string;
41
+ };
32
42
  ipv4_enabled: boolean;
33
43
  ipv4_address: string;
34
44
  ipv4_netmask: string;
@@ -81,10 +91,10 @@ export interface NetworkInterfacePerformanceReport extends Base {
81
91
  upload_speed_mbps: number;
82
92
  test_duration_seconds: number;
83
93
  }
84
- export interface NetworkInterfaceAllReports {
94
+ export interface NetworkInterfaceSummary {
85
95
  info?: NetworkInterfaceInfo;
86
- latency?: NetworkInterfaceLatencyReport;
87
- report?: NetworkInterfaceReport;
96
+ latency?: NetworkInterfaceLatencyReport[];
97
+ performance?: NetworkInterfacePerformanceReport[];
88
98
  }
89
99
  export interface NetworkInterfaceFilters extends Filters {
90
100
  device_id?: Filter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.11.3",
3
+ "version": "1.11.5",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",