UNPKG

updown.io

Version:
29 lines (28 loc) 943 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.UpdownIO = void 0; const api_client_1 = require("@ffflorian/api-client"); const api_1 = require("./api"); class UpdownIO { constructor(options) { if (typeof options === 'string') { options = { apiKey: options }; } this.apiClient = new api_client_1.APIClient('https://updown.io/api/', { headers: Object.assign({}, ((options === null || options === void 0 ? void 0 : options.apiKey) && { 'X-API-KEY': options.apiKey })), }); this.api = { checks: new api_1.ChecksAPI(this.apiClient), nodes: new api_1.NodesAPI(this.apiClient), }; } /** * Set a new API URL. * @param newURL The new API url */ setApiUrl(newURL) { this.api.checks.setApiUrl(newURL); this.api.nodes.setApiUrl(newURL); } } exports.UpdownIO = UpdownIO;