pterowrap
Version:
A node.js wrapper for Pterodactyl API
39 lines (38 loc) • 1.39 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Egg_1 = __importDefault(require("../../structures/application/Egg"));
class EggManager {
constructor(client, _parentNest) {
this.client = client;
this._parentNest = _parentNest;
}
list(options = {}) {
return new Promise(async (resolve, reject) => {
try {
const list = await this.client.call({ endpoint: `nests/${this._parentNest.id}/eggs`, parameters: options });
const r = [];
for (let i = 0; i < list.data.length; i++) {
r.push(new Egg_1.default(this.client, list.data[i]));
}
resolve(r);
}
catch (e) {
reject(e);
}
});
}
get(id, options = {}) {
return new Promise(async (resolve, reject) => {
try {
resolve(new Egg_1.default(this.client, await this.client.call({ endpoint: `nests/${this._parentNest.id}/eggs/${id}`, parameters: options })));
}
catch (e) {
reject(e);
}
});
}
}
exports.default = EggManager;