pterowrap
Version:
A node.js wrapper for Pterodactyl API
39 lines (38 loc) • 1.35 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Backup {
constructor(_client, data, _parentServer) {
this._client = _client;
this._parentServer = _parentServer;
const attributes = data.attributes;
this.uuid = attributes.uuid;
this.name = attributes.name;
this.ignored_files = attributes.ignored_files;
this.sha256_hash = attributes.sha256_hash;
this.bytes = attributes.bytes;
this.created_at = attributes.created_at;
this.completed_at = attributes.completed_at;
this.raw = attributes;
}
retrieveDownloadLink() {
return new Promise(async (resolve, reject) => {
try {
resolve(await this._client.call({ endpoint: `servers/${this._parentServer.identifier}/backups/${this.uuid}/download` }));
}
catch (e) {
reject(e);
}
});
}
delete() {
return new Promise(async (resolve, reject) => {
try {
resolve(await this._client.call({ endpoint: `servers/${this._parentServer.identifier}/backups/${this.uuid}`, method: "DELETE" }));
}
catch (e) {
reject(e);
}
});
}
}
exports.default = Backup;