pterowrap
Version:
A node.js wrapper for Pterodactyl API
43 lines (42 loc) • 1.46 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class User {
constructor(_client, data) {
this._client = _client;
const attributes = data.attributes;
this.id = attributes.id;
this.external_id = attributes.external_id;
this.uuid = attributes.uuid;
this.username = attributes.username;
this.email = attributes.email;
this.first_name = attributes.first_name;
this.last_name = attributes.last_name;
this.language = attributes.language;
this.root_admin = attributes.root_admin;
this["2fa"] = attributes["2fa"];
this.created_at = attributes.created_at;
this.updated_at = attributes.updated_at;
this.raw = attributes;
}
update(params) {
return new Promise(async (resolve, reject) => {
try {
resolve(new User(this._client, await this._client.call({ endpoint: "users/" + this.id, method: "PATCH", body: params })));
}
catch (e) {
reject(e);
}
});
}
delete() {
return new Promise(async (resolve, reject) => {
try {
resolve(await this._client.call({ endpoint: "users/" + this.id, method: "DELETE" }));
}
catch (e) {
reject(e);
}
});
}
}
exports.default = User;