@edgeiq/edgeiq-api-js 1.1.0 → 1.1.4

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.
@@ -11,6 +11,7 @@ interface DevicesInterface extends BaseModelInterface<Device, DeviceInput, Devic
11
11
  detachIngestor(id: string, ingestorId: string): Promise<string>;
12
12
  getIngestors(id: string): Promise<Ingestor[]>;
13
13
  attachRule(id: string, ruleId: string): Promise<string>;
14
+ bulkAttachRules(id: string, rulesIds: string[]): Promise<BulkActionResponse>;
14
15
  detachRule(id: string, ruleId: string): Promise<string>;
15
16
  getRules(id: string): Promise<Rule[]>;
16
17
  }
@@ -379,9 +379,35 @@ exports.Devices = (function (_super) {
379
379
  });
380
380
  });
381
381
  };
382
+ class_1.bulkAttachRules = function (id, rulesIds) {
383
+ return __awaiter(this, void 0, void 0, function () {
384
+ var axios, result, error_13;
385
+ return __generator(this, function (_a) {
386
+ switch (_a.label) {
387
+ case 0:
388
+ _a.trys.push([0, 2, , 3]);
389
+ this.logAction("Attaching " + rulesIds.length + " rules with to device with id " + id);
390
+ axios = __1.EdgeIQAPI.getAxios();
391
+ return [4, axios.post(constants_1.Endpoints.device + "/" + id + "/rules/bulk", {
392
+ data: { ids: rulesIds },
393
+ })];
394
+ case 1:
395
+ result = _a.sent();
396
+ return [2, result === null || result === void 0 ? void 0 : result.data];
397
+ case 2:
398
+ error_13 = _a.sent();
399
+ if ((0, helpers_1.isApiError)(error_13)) {
400
+ throw error_13;
401
+ }
402
+ throw error_13;
403
+ case 3: return [2];
404
+ }
405
+ });
406
+ });
407
+ };
382
408
  class_1.detachRule = function (id, ruleId) {
383
409
  return __awaiter(this, void 0, void 0, function () {
384
- var axios, error_13;
410
+ var axios, error_14;
385
411
  return __generator(this, function (_a) {
386
412
  switch (_a.label) {
387
413
  case 0:
@@ -393,11 +419,11 @@ exports.Devices = (function (_super) {
393
419
  _a.sent();
394
420
  return [2, (0, constants_1.getAttachMessage)('Rule', 'detach', 'device')];
395
421
  case 2:
396
- error_13 = _a.sent();
397
- if ((0, helpers_1.isApiError)(error_13)) {
398
- throw error_13;
422
+ error_14 = _a.sent();
423
+ if ((0, helpers_1.isApiError)(error_14)) {
424
+ throw error_14;
399
425
  }
400
- throw error_13;
426
+ throw error_14;
401
427
  case 3: return [2];
402
428
  }
403
429
  });
@@ -405,7 +431,7 @@ exports.Devices = (function (_super) {
405
431
  };
406
432
  class_1.getRules = function (id) {
407
433
  return __awaiter(this, void 0, void 0, function () {
408
- var axios, result, error_14;
434
+ var axios, result, error_15;
409
435
  return __generator(this, function (_a) {
410
436
  switch (_a.label) {
411
437
  case 0:
@@ -417,11 +443,11 @@ exports.Devices = (function (_super) {
417
443
  result = _a.sent();
418
444
  return [2, result === null || result === void 0 ? void 0 : result.data];
419
445
  case 2:
420
- error_14 = _a.sent();
421
- if ((0, helpers_1.isApiError)(error_14)) {
422
- throw error_14;
446
+ error_15 = _a.sent();
447
+ if ((0, helpers_1.isApiError)(error_15)) {
448
+ throw error_15;
423
449
  }
424
- throw error_14;
450
+ throw error_15;
425
451
  case 3: return [2];
426
452
  }
427
453
  });
@@ -27,6 +27,7 @@ export interface DeviceInput {
27
27
  name: string;
28
28
  unique_id: string;
29
29
  company_id: string;
30
+ serial?: string;
30
31
  device_type_id: string;
31
32
  last_report_id?: string;
32
33
  last_location_observation_id?: string;
@@ -2,6 +2,7 @@ import { Base, Filter, Filters, Pagination } from '../models';
2
2
  export interface EscrowDeviceInput {
3
3
  transfer_initiated_at?: string;
4
4
  transfer_completed_at?: string;
5
+ company_id: string;
5
6
  unique_id: string;
6
7
  token: string;
7
8
  lwm2m: boolean;
package/dist/models.d.ts CHANGED
@@ -9,7 +9,7 @@ export interface Pagination {
9
9
  export interface PaginationFilter {
10
10
  page: number;
11
11
  itemsPerPage: number;
12
- order_by: string;
12
+ order_by?: string;
13
13
  }
14
14
  export interface Filter {
15
15
  operator: 'eq' | 'ne' | 'like' | 'gt' | 'gte' | 'lt' | 'lte' | 'between' | 'in' | 'nin' | 'incany' | 'incall';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.1.0",
3
+ "version": "1.1.4",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",