UNPKG

pterowrap

Version:

A node.js wrapper for Pterodactyl API

36 lines (35 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Location { constructor(_client, data) { this._client = _client; const attributes = data.attributes; this.id = attributes.id; this.short = attributes.short; this.long = attributes.long; this.updated_at = attributes.updated_at; this.created_at = attributes.created_at; this.raw = attributes; } update(params) { return new Promise(async (resolve, reject) => { try { resolve(new Location(this._client, await this._client.call({ endpoint: "locations/" + this.id, method: "PATCH", body: params }))); } catch (e) { reject(e); } }); } delete() { return new Promise(async (resolve, reject) => { try { resolve(await this._client.call({ endpoint: "locations/" + this.id, method: "DELETE" })); } catch (e) { reject(e); } }); } } exports.default = Location;