UNPKG

updown.io

Version:
51 lines (50 loc) 2.03 kB
"use strict"; 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.NodesAPI = void 0; const Endpoints_1 = require("../Endpoints"); class NodesAPI { constructor(apiClient) { this.apiClient = apiClient; } /** List all updown.io monitoring nodes IPv4 addresses. */ getIpv4Nodes() { return __awaiter(this, void 0, void 0, function* () { const endpoint = Endpoints_1.Endpoint.Nodes.ipv4(); const { data } = yield this.apiClient.get(endpoint); return data; }); } /** List all updown.io monitoring nodes IPv6 addresses. */ getIpv6Nodes() { return __awaiter(this, void 0, void 0, function* () { const endpoint = Endpoints_1.Endpoint.Nodes.ipv6(); const { data } = yield this.apiClient.get(endpoint); return data; }); } /** List all updown.io monitoring nodes. */ getNodes() { return __awaiter(this, void 0, void 0, function* () { const endpoint = Endpoints_1.Endpoint.nodes(); const { data } = yield this.apiClient.get(endpoint); return data; }); } /** * Set a new API URL. * @param newURL The new API url */ setApiUrl(newURL) { this.apiClient.setBaseURL(newURL); } } exports.NodesAPI = NodesAPI;