UNPKG

pterowrap

Version:

A node.js wrapper for Pterodactyl API

51 lines (50 loc) 1.84 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const User_1 = __importDefault(require("../../structures/client/User")); const APIKeyManager_1 = __importDefault(require("./account/APIKeyManager")); const TwoFactorManager_1 = __importDefault(require("./account/TwoFactorManager")); class AccountManager { constructor(client) { this.client = client; this.twofactor = new TwoFactorManager_1.default(client); this.apikeys = new APIKeyManager_1.default(client); } retrieveDetails() { return new Promise(async (resolve, reject) => { try { resolve(new User_1.default(this.client, await this.client.call({ endpoint: "account" }))); } catch (e) { reject(e); } }); } updateEmail(email, password) { return new Promise(async (resolve, reject) => { try { resolve(await this.client.call({ endpoint: "account/email", method: "PUT", body: { email, password } })); } catch (e) { reject(e); } }); } updatePassword(current, password) { return new Promise(async (resolve, reject) => { try { resolve(await this.client.call({ endpoint: "account/password", method: "PUT", body: { current_password: current, password, password_confirmation: password }, })); } catch (e) { reject(e); } }); } } exports.default = AccountManager;