@edgeiq/edgeiq-api-js 1.3.10 → 1.3.11
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.
- package/dist/rules/index.d.ts +3 -0
- package/dist/rules/index.js +48 -0
- package/package.json +1 -1
package/dist/rules/index.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Device, DeviceType } from '..';
|
|
1
2
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
3
|
import { BulkActionResponse } from '../models';
|
|
3
4
|
import { Rule, RuleInput, PaginatedRules, RulesFilters } from './models';
|
|
4
5
|
interface RulesInterface extends BaseModelInterface<Rule, RuleInput, RulesFilters, PaginatedRules> {
|
|
5
6
|
update(rule: Rule): Promise<Rule>;
|
|
6
7
|
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
8
|
+
getDevices(id: string): Promise<Device[]>;
|
|
9
|
+
getDeviceTypes(id: string): Promise<DeviceType[]>;
|
|
7
10
|
}
|
|
8
11
|
export declare const Rules: RulesInterface;
|
|
9
12
|
export {};
|
package/dist/rules/index.js
CHANGED
|
@@ -220,5 +220,53 @@ exports.Rules = (function (_super) {
|
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
};
|
|
223
|
+
class_1.getDevices = function (id) {
|
|
224
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
225
|
+
var axios, result, error_7;
|
|
226
|
+
return __generator(this, function (_a) {
|
|
227
|
+
switch (_a.label) {
|
|
228
|
+
case 0:
|
|
229
|
+
_a.trys.push([0, 2, , 3]);
|
|
230
|
+
this.logAction("Getting Devices attached to rule with id " + id);
|
|
231
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
232
|
+
return [4, axios.get(constants_1.Endpoints.rule + "/" + id + "/devices")];
|
|
233
|
+
case 1:
|
|
234
|
+
result = _a.sent();
|
|
235
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
236
|
+
case 2:
|
|
237
|
+
error_7 = _a.sent();
|
|
238
|
+
if ((0, helpers_1.isApiError)(error_7)) {
|
|
239
|
+
throw error_7;
|
|
240
|
+
}
|
|
241
|
+
throw error_7;
|
|
242
|
+
case 3: return [2];
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
class_1.getDeviceTypes = function (id) {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
249
|
+
var axios, result, error_8;
|
|
250
|
+
return __generator(this, function (_a) {
|
|
251
|
+
switch (_a.label) {
|
|
252
|
+
case 0:
|
|
253
|
+
_a.trys.push([0, 2, , 3]);
|
|
254
|
+
this.logAction("Getting Device types attached to rule with id " + id);
|
|
255
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
256
|
+
return [4, axios.get(constants_1.Endpoints.rule + "/" + id + "/device_types")];
|
|
257
|
+
case 1:
|
|
258
|
+
result = _a.sent();
|
|
259
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
260
|
+
case 2:
|
|
261
|
+
error_8 = _a.sent();
|
|
262
|
+
if ((0, helpers_1.isApiError)(error_8)) {
|
|
263
|
+
throw error_8;
|
|
264
|
+
}
|
|
265
|
+
throw error_8;
|
|
266
|
+
case 3: return [2];
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
};
|
|
223
271
|
return class_1;
|
|
224
272
|
}(ModelClass_1.BaseModelClass));
|