@edgeiq/edgeiq-api-js 1.2.12 → 1.2.15

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.
@@ -2,6 +2,7 @@ import { BaseModelInterface } from '../core/ModelClass';
2
2
  import { BulkActionResponse } from '../models';
3
3
  import { Command, CommandInput, CommandsFilters, PaginatedCommands } from './models';
4
4
  interface CommandsInterface extends BaseModelInterface<Command, CommandInput, CommandsFilters, PaginatedCommands> {
5
+ update(command: Command): Promise<Command>;
5
6
  deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
6
7
  assignToDevice(commandId: string, deviceId: string): Promise<string>;
7
8
  assignToDeviceType(commandId: string, deviceTypeId: string): Promise<string>;
@@ -84,6 +84,7 @@ export declare const BaseEndpoints: {
84
84
  translator: string;
85
85
  userType: string;
86
86
  user: string;
87
+ logs: string;
87
88
  };
88
89
  export declare const Endpoints: {
89
90
  me: string;
@@ -124,6 +125,7 @@ export declare const Endpoints: {
124
125
  translator: string;
125
126
  userType: string;
126
127
  user: string;
128
+ logs: string;
127
129
  };
128
130
  export declare const MethodsActions: {
129
131
  post: string;
package/dist/constants.js CHANGED
@@ -100,6 +100,7 @@ exports.BaseEndpoints = {
100
100
  translator: 'translators',
101
101
  userType: 'user_types',
102
102
  user: 'users',
103
+ logs: 'logs',
103
104
  };
104
105
  exports.Endpoints = {
105
106
  me: 'me',
@@ -140,6 +141,7 @@ exports.Endpoints = {
140
141
  translator: "" + exports.BaseEndpoints.translator,
141
142
  userType: "" + exports.BaseEndpoints.userType,
142
143
  user: "" + exports.BaseEndpoints.user,
144
+ logs: "" + exports.BaseEndpoints.logs,
143
145
  };
144
146
  exports.MethodsActions = {
145
147
  post: 'creating',
@@ -1,5 +1,7 @@
1
1
  import { Ingestor, Rule, Command } from '..';
2
2
  import { BaseModelInterface } from '../core/ModelClass';
3
+ import { Log } from '../log/models';
4
+ import { GatewayCommand } from '../gatewayCommands/models';
3
5
  import { BulkActionResponse } from '../models';
4
6
  import { DevicesFilters, Device, DeviceInput, PaginatedDevices } from './models';
5
7
  interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, DevicesFilters, PaginatedDevices> {
@@ -17,6 +19,8 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
17
19
  getCommands(id: string): Promise<Command[]>;
18
20
  csvBulkUpload(file: File): Promise<BulkActionResponse>;
19
21
  csvBulkDownload(filters?: DevicesFilters): Promise<File>;
22
+ getLogs(id: string): Promise<Log[]>;
23
+ requestLogs(id: string): Promise<GatewayCommand>;
20
24
  }
21
25
  export declare const Devices: DevicesInterface;
22
26
  export {};
@@ -533,5 +533,56 @@ exports.Devices = (function (_super) {
533
533
  });
534
534
  });
535
535
  };
536
+ class_1.getLogs = function (id) {
537
+ return __awaiter(this, void 0, void 0, function () {
538
+ var axios, result, error_19;
539
+ return __generator(this, function (_a) {
540
+ switch (_a.label) {
541
+ case 0:
542
+ _a.trys.push([0, 2, , 3]);
543
+ this.logAction("Getting logs attached to device with id " + id);
544
+ axios = __1.EdgeIQAPI.getAxios();
545
+ return [4, axios.get(constants_1.Endpoints.device + "/" + id + "/" + constants_1.Endpoints.logs)];
546
+ case 1:
547
+ result = _a.sent();
548
+ return [2, result === null || result === void 0 ? void 0 : result.data];
549
+ case 2:
550
+ error_19 = _a.sent();
551
+ if ((0, helpers_1.isApiError)(error_19)) {
552
+ throw error_19;
553
+ }
554
+ throw error_19;
555
+ case 3: return [2];
556
+ }
557
+ });
558
+ });
559
+ };
560
+ class_1.requestLogs = function (id) {
561
+ return __awaiter(this, void 0, void 0, function () {
562
+ var axios, result, error_20;
563
+ return __generator(this, function (_a) {
564
+ switch (_a.label) {
565
+ case 0:
566
+ _a.trys.push([0, 2, , 3]);
567
+ this.logAction("requesting logs for device with " + id);
568
+ axios = __1.EdgeIQAPI.getAxios();
569
+ return [4, axios.post(constants_1.Endpoints.device + "/" + id + "/" + constants_1.Endpoints.gatewayCommand, {
570
+ command_type: 'log_upload',
571
+ schedule: null,
572
+ })];
573
+ case 1:
574
+ result = _a.sent();
575
+ return [2, result === null || result === void 0 ? void 0 : result.data];
576
+ case 2:
577
+ error_20 = _a.sent();
578
+ if ((0, helpers_1.isApiError)(error_20)) {
579
+ throw error_20;
580
+ }
581
+ throw error_20;
582
+ case 3: return [2];
583
+ }
584
+ });
585
+ });
586
+ };
536
587
  return class_1;
537
588
  }(ModelClass_1.BaseModelClass));
@@ -0,0 +1,6 @@
1
+ export interface Log {
2
+ created_at: string;
3
+ name: string;
4
+ size: number;
5
+ url: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,17 @@ export interface Attribute {
6
6
  value: string;
7
7
  data_type: PollableAttributeDataType;
8
8
  }
9
+ export interface MIBObject {
10
+ name: string;
11
+ OID: string;
12
+ type: string;
13
+ enabled: boolean;
14
+ objects?: MIBObject[];
15
+ }
16
+ export interface MIB {
17
+ identity: string;
18
+ objects?: MIBObject[];
19
+ }
9
20
  export interface PollableAttributeInput {
10
21
  type: PollableAttributeType;
11
22
  name: string;
@@ -15,6 +26,7 @@ export interface PollableAttributeInput {
15
26
  [key: string]: unknown;
16
27
  };
17
28
  attributes: Attribute[];
29
+ mib?: MIB;
18
30
  }
19
31
  export interface PollableAttribute extends PollableAttributeInput, Base {
20
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.2.12",
3
+ "version": "1.2.15",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",