pterowrap
Version:
A node.js wrapper for Pterodactyl API
35 lines (34 loc) • 1.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Util_1 = __importDefault(require("../../utils/Util"));
const Allocation_1 = __importDefault(require("../../structures/application/Allocation"));
class AllocationManager {
constructor(client, _parentNode) {
this.client = client;
this._parentNode = _parentNode;
}
list(options = {}) {
return new Promise(async (resolve, reject) => {
try {
resolve(await Util_1.default.handlePagination(this.client, `nodes/${this._parentNode.id}/allocations`, options, Allocation_1.default, this._parentNode));
}
catch (e) {
reject(e);
}
});
}
create(params) {
return new Promise(async (resolve, reject) => {
try {
resolve(await this.client.call({ endpoint: `nodes/${this._parentNode.id}/allocations`, method: "POST", body: params }));
}
catch (e) {
reject(e);
}
});
}
}
exports.default = AllocationManager;