UNPKG

pterowrap

Version:

A node.js wrapper for Pterodactyl API

34 lines (33 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Variable { constructor(_client, data, _parentServer) { this._client = _client; this._parentServer = _parentServer; const attributes = data.attributes; this.name = attributes.name; this.description = attributes.description; this.env_variable = attributes.env_variable; this.default_value = attributes.default_value; this.server_value = attributes.server_value; this.is_editable = attributes.is_editable; this.rules = attributes.rules; this.raw = attributes; } update(value) { return new Promise(async (resolve, reject) => { try { const data = await this._client.call({ endpoint: `servers/${this._parentServer.identifier}/startup/variable`, method: "PUT", body: { key: this.env_variable, value }, }); resolve(new Variable(this._client, data, this._parentServer)); } catch (e) { reject(e); } }); } } exports.default = Variable;