node-firewalla
Version:
Package to talk your firewalla box & API
79 lines (78 loc) • 3.83 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.NetworkService = void 0;
const index_js_1 = require("../api/index.js");
const index_js_2 = require("../models/index.js");
const FWGroupService_js_1 = require("./FWGroupService.js");
class NetworkService extends FWGroupService_js_1.FWGroupService {
ping() {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWCmdMessage("ping");
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
/**
* @param {string} wanUUID - the UUID of the WAN interface to run the speedtest on
* @param {string} serverId - the ID of the remote server to run the speedtest on
* @param {boolean} noUpload - whether to skip upload for the speedtest
* @param {boolean} noDownload - whether to skip download for the speedtest
*/
runSpeedtest(wanUUID = "", serverId = "", noUpload = false, noDownload = false) {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWCmdMessage("runInternetSpeedtest", { wanUUID, serverId, noUpload, noDownload });
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
/**
* @param {Date} begin - Only return speedtests after this date
*/
getSpeedtestResults(begin = new Date(0)) {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWGetMessage("internetSpeedtestResults", { begin: (Number(begin) / 1000) });
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
getMonthlyDataUsage() {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWGetMessage("monthlyDataUsage");
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
/**
* @param {Date} acl - ?? unknown parameter
*/
getLast12MonthlyDateUsage(acl = true) {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWGetMessage("last12monthlyDataUsage", { acl });
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
getNetworkMonitorData() {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWGetMessage("networkMonitorData");
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
getDataPlan() {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWGetMessage("dataPlan");
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
getMyPublicKey() {
return __awaiter(this, void 0, void 0, function* () {
let msg = new index_js_2.FWGetMessage("mypubkey");
return index_js_1.FWGroupApi.sendMessageToBox(this.fwGroup, msg);
});
}
}
exports.NetworkService = NetworkService;