pterowrap
Version:
A node.js wrapper for Pterodactyl API
44 lines (43 loc) • 1.52 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const Location_1 = __importDefault(require("../../structures/application/Location"));
const Util_1 = __importDefault(require("../../utils/Util"));
class LocationManager {
constructor(client) {
this.client = client;
}
list(options = {}) {
return new Promise(async (resolve, reject) => {
try {
resolve(await Util_1.default.handlePagination(this.client, "locations", options, Location_1.default));
}
catch (e) {
reject(e);
}
});
}
get(id, options = {}) {
return new Promise(async (resolve, reject) => {
try {
resolve(new Location_1.default(this.client, await this.client.call({ endpoint: "locations/" + id, parameters: options })));
}
catch (e) {
reject(e);
}
});
}
create(params) {
return new Promise(async (resolve, reject) => {
try {
resolve(new Location_1.default(this.client, await this.client.call({ endpoint: "locations", method: "POST", body: params })));
}
catch (e) {
reject(e);
}
});
}
}
exports.default = LocationManager;