UNPKG

pterowrap

Version:

A node.js wrapper for Pterodactyl API

34 lines (33 loc) 1.16 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Server_1 = __importDefault(require("../../structures/client/Server")); const Util_1 = __importDefault(require("../../utils/Util")); class ServerManager { constructor(client) { this.client = client; } list(options = {}) { return new Promise(async (resolve, reject) => { try { resolve(await Util_1.default.handlePagination(this.client, "", options, Server_1.default)); } catch (e) { reject(e); } }); } get(identifier, options = {}) { return new Promise(async (resolve, reject) => { try { resolve(new Server_1.default(this.client, await this.client.call({ endpoint: "servers/" + identifier, parameters: options }))); } catch (e) { reject(e); } }); } } exports.default = ServerManager;