jspteroapi
Version:
A pterodactyl v1 api using undici
42 lines (41 loc) • 1.63 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.settingsMethods = void 0;
class settingsMethods {
client;
constructor(client) {
this.client = client;
}
/**
* @param serverId - ID of the server to get (In the settings tab of server/in link)
* @param name - New name for the server
* @returns Successfuly set new server name!
* @example
* ```ts
* const res = await client.renameServer('c2f5a3b6', 'Best Server') // res = Successfuly set new server name!
* ```
* @example
* ```ts
* client.renameServer('c2f5a3b6', 'Best Server').then((res) => console.log(res)) // res = Successfuly set new server name!
* ```
*/
renameServer = async (serverId, name) => {
return await this.client.request('POST', { name }, 'Successfuly set new server name!', `/api/client/servers/${serverId}/settings/rename`);
};
/**
* @param serverId - ID of the server to get (In the settings tab of server/in link)
* @returns Successfuly started reinstalling!
* @example
* ```ts
* const res = await client.reinstallServer('c2f5a3b6') // res = Successfuly started reinstalling!
* ```
* @example
* ```ts
* client.reinstallServer('c2f5a3b6').then((res) => console.log(res)) // res = Successfuly started reinstalling!
* ```
*/
reinstallServer = async (serverId) => {
return await this.client.request('POST', null, 'Successfuly started reinstalling!', `/api/client/servers/${serverId}/settings/reinstall`);
};
}
exports.settingsMethods = settingsMethods;