@edgeiq/edgeiq-api-js 1.6.3 → 1.6.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.
@@ -8,6 +8,7 @@ interface ConfigurationsInterface extends BaseModelInterface<Configuration, Conf
8
8
  update(configuration: Configuration): Promise<Configuration>;
9
9
  deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
10
10
  addCommand(id: string, commandId: string, usage: string): Promise<string>;
11
+ removeCommand(id: string, commandId: string): Promise<string>;
11
12
  getSendCommands(id: string): Promise<Command[]>;
12
13
  getFetchCommand(id: string): Promise<Command>;
13
14
  getDevices(id: string): Promise<Device[]>;
@@ -243,19 +243,19 @@ exports.Configurations = (function (_super) {
243
243
  });
244
244
  });
245
245
  };
246
- class_1.getSendCommands = function (id) {
246
+ class_1.removeCommand = function (id, commandId) {
247
247
  return __awaiter(this, void 0, void 0, function () {
248
- var axios, result, error_8;
248
+ var axios, error_8;
249
249
  return __generator(this, function (_a) {
250
250
  switch (_a.label) {
251
251
  case 0:
252
252
  _a.trys.push([0, 2, , 3]);
253
- this.logAction("Getting send commands attached to configuration with id " + id);
253
+ this.logAction("Removing a relation between configuration with id: " + id + " and command with id " + commandId);
254
254
  axios = core_1.EdgeIQAPI.getAxios();
255
- return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/" + constants_1.Endpoints.command + "?usage=send")];
255
+ return [4, axios.delete(constants_1.Endpoints.configuration + "/" + id + "/commands/" + commandId)];
256
256
  case 1:
257
- result = _a.sent();
258
- return [2, result === null || result === void 0 ? void 0 : result.data];
257
+ _a.sent();
258
+ return [2, (0, constants_1.getAttachMessage)('Command', 'detach', 'configuration')];
259
259
  case 2:
260
260
  error_8 = _a.sent();
261
261
  if ((0, helpers_1.isApiError)(error_8)) {
@@ -267,19 +267,19 @@ exports.Configurations = (function (_super) {
267
267
  });
268
268
  });
269
269
  };
270
- class_1.getFetchCommand = function (id) {
270
+ class_1.getSendCommands = function (id) {
271
271
  return __awaiter(this, void 0, void 0, function () {
272
272
  var axios, result, error_9;
273
273
  return __generator(this, function (_a) {
274
274
  switch (_a.label) {
275
275
  case 0:
276
276
  _a.trys.push([0, 2, , 3]);
277
- this.logAction("Getting fetch command attached to configuration with id " + id);
277
+ this.logAction("Getting send commands attached to configuration with id " + id);
278
278
  axios = core_1.EdgeIQAPI.getAxios();
279
- return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/" + constants_1.Endpoints.command + "?usage=fetch")];
279
+ return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/" + constants_1.Endpoints.command + "?usage=send")];
280
280
  case 1:
281
281
  result = _a.sent();
282
- return [2, result === null || result === void 0 ? void 0 : result.data[0]];
282
+ return [2, result === null || result === void 0 ? void 0 : result.data];
283
283
  case 2:
284
284
  error_9 = _a.sent();
285
285
  if ((0, helpers_1.isApiError)(error_9)) {
@@ -291,19 +291,19 @@ exports.Configurations = (function (_super) {
291
291
  });
292
292
  });
293
293
  };
294
- class_1.getDevices = function (id) {
294
+ class_1.getFetchCommand = function (id) {
295
295
  return __awaiter(this, void 0, void 0, function () {
296
296
  var axios, result, error_10;
297
297
  return __generator(this, function (_a) {
298
298
  switch (_a.label) {
299
299
  case 0:
300
300
  _a.trys.push([0, 2, , 3]);
301
- this.logAction("Getting Devices attached to configuration with id " + id);
301
+ this.logAction("Getting fetch command attached to configuration with id " + id);
302
302
  axios = core_1.EdgeIQAPI.getAxios();
303
- return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/devices")];
303
+ return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/" + constants_1.Endpoints.command + "?usage=fetch")];
304
304
  case 1:
305
305
  result = _a.sent();
306
- return [2, result === null || result === void 0 ? void 0 : result.data];
306
+ return [2, result === null || result === void 0 ? void 0 : result.data[0]];
307
307
  case 2:
308
308
  error_10 = _a.sent();
309
309
  if ((0, helpers_1.isApiError)(error_10)) {
@@ -315,16 +315,16 @@ exports.Configurations = (function (_super) {
315
315
  });
316
316
  });
317
317
  };
318
- class_1.getDeviceTypes = function (id) {
318
+ class_1.getDevices = function (id) {
319
319
  return __awaiter(this, void 0, void 0, function () {
320
320
  var axios, result, error_11;
321
321
  return __generator(this, function (_a) {
322
322
  switch (_a.label) {
323
323
  case 0:
324
324
  _a.trys.push([0, 2, , 3]);
325
- this.logAction("Getting Device types attached to configuration with id " + id);
325
+ this.logAction("Getting Devices attached to configuration with id " + id);
326
326
  axios = core_1.EdgeIQAPI.getAxios();
327
- return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/device_types")];
327
+ return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/devices")];
328
328
  case 1:
329
329
  result = _a.sent();
330
330
  return [2, result === null || result === void 0 ? void 0 : result.data];
@@ -339,5 +339,29 @@ exports.Configurations = (function (_super) {
339
339
  });
340
340
  });
341
341
  };
342
+ class_1.getDeviceTypes = function (id) {
343
+ return __awaiter(this, void 0, void 0, function () {
344
+ var axios, result, error_12;
345
+ return __generator(this, function (_a) {
346
+ switch (_a.label) {
347
+ case 0:
348
+ _a.trys.push([0, 2, , 3]);
349
+ this.logAction("Getting Device types attached to configuration with id " + id);
350
+ axios = core_1.EdgeIQAPI.getAxios();
351
+ return [4, axios.get(constants_1.Endpoints.configuration + "/" + id + "/device_types")];
352
+ case 1:
353
+ result = _a.sent();
354
+ return [2, result === null || result === void 0 ? void 0 : result.data];
355
+ case 2:
356
+ error_12 = _a.sent();
357
+ if ((0, helpers_1.isApiError)(error_12)) {
358
+ throw error_12;
359
+ }
360
+ throw error_12;
361
+ case 3: return [2];
362
+ }
363
+ });
364
+ });
365
+ };
342
366
  return class_1;
343
367
  }(ModelClass_1.BaseModelClass));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeiq/edgeiq-api-js",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "author": "EdgeIQ",
5
5
  "license": "ISC",
6
6
  "description": "This project presents EdgeIQ API SDK.",