UNPKG

pterowrap

Version:

A node.js wrapper for Pterodactyl API

44 lines (43 loc) 1.48 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const Node_1 = __importDefault(require("../../structures/application/Node")); const Util_1 = __importDefault(require("../../utils/Util")); class NodeManager { constructor(client) { this.client = client; } list(options = {}) { return new Promise(async (resolve, reject) => { try { resolve(await Util_1.default.handlePagination(this.client, "nodes", options, Node_1.default)); } catch (e) { reject(e); } }); } get(id, options = {}) { return new Promise(async (resolve, reject) => { try { resolve(new Node_1.default(this.client, await this.client.call({ endpoint: "nodes/" + id, parameters: options }))); } catch (e) { reject(e); } }); } create(params) { return new Promise(async (resolve, reject) => { try { resolve(new Node_1.default(this.client, await this.client.call({ endpoint: "nodes", method: "POST", body: params }))); } catch (e) { reject(e); } }); } } exports.default = NodeManager;