node-firewalla
Version:
Package to talk your firewalla box & API
59 lines (58 loc) • 2.52 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.FWWebGroupApi = void 0;
const Networker_js_1 = require("./Networker.js");
const AuthApi_js_1 = require("./AuthApi.js");
class FWWebGroupApi extends AuthApi_js_1.AuthApi {
constructor(gid) {
super();
this.gid = gid;
this.setApiNetworker(new Networker_js_1.Networker(`https://my.firewalla.com`));
this.getApiNetworker().addHeader("x-firewalla-id", gid);
}
getDevices() {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative("/v1/device/list");
});
}
getBoxInfo() {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative("/v1/box/info");
});
}
getBoxSummaryInfo() {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative("/v1/dashboard/summaryInfo");
});
}
getAlarms() {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative("/v1/alarm/info");
});
}
getDeviceInfo(mac) {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative(`/v1/device/${mac}`);
});
}
getRules() {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative(`/v1/rule/list`);
});
}
getDataUsage() {
return __awaiter(this, void 0, void 0, function* () {
return this.getApiNetworker().authGetRelative(`/v1/dashboard/dataUsage`);
});
}
}
exports.FWWebGroupApi = FWWebGroupApi;