UNPKG

pterodactyl-api-wrapper

Version:

[![NPM version](https://img.shields.io/npm/v/pterodactyl-api-wrapper.svg)](https://npmjs.com/package/pterodactyl-api-wrapper) [![License](https://img.shields.io/npm/l/pterodactyl-api-wrapper.svg)](LICENSE)

29 lines (27 loc) 976 B
import ClientAPICall from "../../../../../functions/createAppCall"; /** * Renames a server on the panel. * * @param {Object} options - API call options. * @param {string} options.apiKey - The API key for authentication. * @param {string} options.panel - The base URL of the Pterodactyl panel. * @param {string} options.server_id - The ID of the server. * @param {string} options.new_name - The new name for the server. * @returns {Promise<any>} - API response confirming the server rename. * * @throws {Error} - Throws an error if the API request fails. */ export default async function renameServer(options: { apiKey: string; panel: string; server_id: string; new_name: string; }): Promise<any> { return ClientAPICall({ apiKey: options.apiKey, panel: options.panel, method: "PATCH", endpoint: `servers/${options.server_id}/settings/rename`, body: JSON.stringify({ name: options.new_name }) }); }