@edgeiq/edgeiq-api-js 1.2.13 → 1.2.16

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.
@@ -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,7 +1,10 @@
1
1
  import { BaseModelInterface } from '../core/ModelClass';
2
+ import { BulkActionResponse } from '../models';
2
3
  import { DeviceTransferRequest, DeviceTransferRequestInput, DeviceTransferRequestsFilters, PaginatedDeviceTransferRequests } from './models';
3
4
  interface DeviceTransferRequestsInterface extends BaseModelInterface<DeviceTransferRequest, DeviceTransferRequestInput, DeviceTransferRequestsFilters, PaginatedDeviceTransferRequests> {
4
5
  update(deviceTransferRequest: DeviceTransferRequest): Promise<DeviceTransferRequest>;
6
+ accept(id: string, deviceTypeId: string): Promise<string>;
7
+ bulkAccept(ids: string[], deviceTypeId: string): Promise<BulkActionResponse>;
5
8
  }
6
9
  export declare const DeviceTransferRequests: DeviceTransferRequestsInterface;
7
10
  export {};
@@ -194,5 +194,56 @@ exports.DeviceTransferRequests = (function (_super) {
194
194
  });
195
195
  });
196
196
  };
197
+ class_1.accept = function (id, deviceTypeId) {
198
+ return __awaiter(this, void 0, void 0, function () {
199
+ var axios, data, error_6;
200
+ return __generator(this, function (_a) {
201
+ switch (_a.label) {
202
+ case 0:
203
+ _a.trys.push([0, 2, , 3]);
204
+ this.logAction("Accepting device transfer request with id " + id);
205
+ axios = __1.EdgeIQAPI.getAxios();
206
+ data = JSON.stringify({ device_type_id: deviceTypeId });
207
+ return [4, axios.post(constants_1.Endpoints.deviceTransferRequest + "/" + id + "/transfer", data)];
208
+ case 1:
209
+ _a.sent();
210
+ return [2, 'Device transfer request accepted'];
211
+ case 2:
212
+ error_6 = _a.sent();
213
+ if ((0, helpers_1.isApiError)(error_6)) {
214
+ throw error_6;
215
+ }
216
+ throw error_6;
217
+ case 3: return [2];
218
+ }
219
+ });
220
+ });
221
+ };
222
+ class_1.bulkAccept = function (ids, deviceTypeId) {
223
+ return __awaiter(this, void 0, void 0, function () {
224
+ var axios, result, error_7;
225
+ return __generator(this, function (_a) {
226
+ switch (_a.label) {
227
+ case 0:
228
+ _a.trys.push([0, 2, , 3]);
229
+ this.logAction("Accepting " + ids.length + " device transfer requests with device type with ID: " + deviceTypeId);
230
+ axios = __1.EdgeIQAPI.getAxios();
231
+ return [4, axios.post(constants_1.Endpoints.deviceTransferRequest + "/bulk/transfer", {
232
+ data: { ids: ids, device_type_id: deviceTypeId },
233
+ })];
234
+ case 1:
235
+ result = _a.sent();
236
+ return [2, result === null || result === void 0 ? void 0 : result.data];
237
+ case 2:
238
+ error_7 = _a.sent();
239
+ if ((0, helpers_1.isApiError)(error_7)) {
240
+ throw error_7;
241
+ }
242
+ throw error_7;
243
+ case 3: return [2];
244
+ }
245
+ });
246
+ });
247
+ };
197
248
  return class_1;
198
249
  }(ModelClass_1.BaseModelClass));
@@ -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.13",
3
+ "version": "1.2.16",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",