UNPKG

pterowrap

Version:

A node.js wrapper for Pterodactyl API

39 lines (38 loc) 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Subuser { constructor(_client, data, _parentServer) { this._client = _client; this._parentServer = _parentServer; const attributes = data.attributes; this.uuid = attributes.uuid; this.username = attributes.username; this.email = attributes.email; this.image = attributes.image; this["2fa_enable"] = attributes["2fa_enable"]; this.created_at = attributes.created_at; this.permissions = attributes.permissions; this.raw = attributes; } update(params) { return new Promise(async (resolve, reject) => { try { resolve(new Subuser(this._client, (await this._client.call({ endpoint: `servers/${this._parentServer.identifier}/users/${this.uuid}`, method: "POST", body: params })).data, this._parentServer)); } catch (e) { reject(e); } }); } delete() { return new Promise(async (resolve, reject) => { try { resolve(await this._client.call({ endpoint: `servers/${this._parentServer.identifier}/users/${this.uuid}`, method: "DELETE" })); } catch (e) { reject(e); } }); } } exports.default = Subuser;