pterodactyl-api-wrapper
Version:
[](https://npmjs.com/package/pterodactyl-api-wrapper) [](LICENSE)
1 lines • 228 kB
Source Map (JSON)
{"version":3,"sources":["../src/class/main/Setup.ts","../src/functions/createAppCall.ts","../src/class/source/app/users/listUsers.ts","../src/class/source/app/users/userDetails.ts","../src/class/source/app/users/userDetails_externalId.ts","../src/class/source/app/users/createUser.ts","../src/class/source/app/users/updateUser.ts","../src/class/source/app/users/deleteUser.ts","../src/class/source/app/nodes/listNodes.ts","../src/class/source/app/nodes/nodeDetails.ts","../src/class/source/app/nodes/nodeConfiguration.ts","../src/class/source/app/nodes/createNode.ts","../src/class/source/app/nodes/updateNode.ts","../src/class/source/app/nodes/deleteNode.ts","../src/class/source/app/locations/listLocations.ts","../src/class/source/app/locations/locationDetails.ts","../src/class/source/app/locations/createLocation.ts","../src/class/source/app/locations/updateLocation.ts","../src/class/source/app/locations/deleteLocation.ts","../src/class/source/app/servers/listServers.ts","../src/class/source/app/servers/serverDetails.ts","../src/class/source/app/servers/serverDetails_externalId.ts","../src/class/source/app/servers/updateDetails.ts","../src/class/source/app/servers/updateServerBuild.ts","../src/class/source/app/servers/updateServerStartup.ts","../src/class/source/app/servers/createServer.ts","../src/class/source/app/servers/suspendServer.ts","../src/class/source/app/servers/unsuspendServer.ts","../src/class/source/app/servers/reinstallServer.ts","../src/class/source/app/servers/deleteServer.ts","../src/class/source/app/servers/forceDeleteServer.ts","../src/class/source/app/servers/databases/listDatabases.ts","../src/class/source/app/servers/databases/databaseDetails.ts","../src/class/source/app/servers/databases/createDatabase.ts","../src/class/source/app/servers/databases/resetDatabasePassword.ts","../src/class/source/app/servers/databases/deleteDatabase.ts","../src/class/source/app/nests/eggs/listEggs.ts","../src/class/source/app/nests/eggs/eggDetails.ts","../src/class/source/app/nests/listNests.ts","../src/class/source/app/nests/nestDetails.ts","../src/class/source/app/nodes/allocations/listAllocations.ts","../src/class/source/app/nodes/allocations/createAllocations.ts","../src/class/source/app/nodes/allocations/deleteAllocation.ts","../src/class/main/Application.ts","../src/class/source/client/account/accountDetails.ts","../src/class/source/client/account/2faEnable.ts","../src/class/source/client/account/2faDisable.ts","../src/class/source/client/account/updateEmail.ts","../src/class/source/client/account/updatePassword.ts","../src/class/source/client/account/createApiKey.ts","../src/class/source/client/account/deleteApiKey.ts","../src/class/source/client/account/listApiKeys.ts","../src/class/source/client/listServers.ts","../src/class/source/client/showPermissions.ts","../src/class/source/client/servers/command.ts","../src/class/source/client/servers/power.ts","../src/class/source/client/servers/consoleDetails.ts","../src/class/source/client/servers/resources.ts","../src/class/source/client/servers/serverDetails.ts","../src/class/source/client/servers/backups/listBackups.ts","../src/class/source/client/servers/backups/backupDetails.ts","../src/class/source/client/servers/backups/createBackup.ts","../src/class/source/client/servers/backups/deleteBackup.ts","../src/class/source/client/servers/backups/downloadBackup.ts","../src/class/source/client/servers/files/listFiles.ts","../src/class/source/client/servers/files/getFileContent.ts","../src/class/source/client/servers/files/downloadFile.ts","../src/class/source/client/servers/files/renameFile.ts","../src/class/source/client/servers/files/copyFile.ts","../src/class/source/client/servers/files/writeFile.ts","../src/class/source/client/servers/files/compressFile.ts","../src/class/source/client/servers/files/decompressFile.ts","../src/class/source/client/servers/files/deleteFile.ts","../src/class/source/client/servers/files/createFolder.ts","../src/class/source/client/servers/files/uploadFile.ts","../src/class/source/client/servers/network/listAllocations.ts","../src/class/source/client/servers/network/assignAllocations.ts","../src/class/source/client/servers/network/setAllocationNote.ts","../src/class/source/client/servers/network/setPrimaryAllocation.ts","../src/class/source/client/servers/network/unassignAllocation.ts","../src/class/source/client/servers/schedules/listSchedules.ts","../src/class/source/client/servers/schedules/createSchedule.ts","../src/class/source/client/servers/schedules/scheduleDetails.ts","../src/class/source/client/servers/schedules/updateSchedule.ts","../src/class/source/client/servers/schedules/deleteSchedule.ts","../src/class/source/client/servers/schedules/createTask.ts","../src/class/source/client/servers/schedules/updateTask.ts","../src/class/source/client/servers/schedules/deleteTask.ts","../src/class/source/client/servers/settings/renameServer.ts","../src/class/source/client/servers/settings/reinstallServer.ts","../src/class/source/client/servers/startup/listVariables.ts","../src/class/source/client/servers/startup/updateVariable.ts","../src/class/source/client/servers/users/listUsers.ts","../src/class/source/client/servers/users/createUser.ts","../src/class/source/client/servers/users/updateUser.ts","../src/class/source/client/servers/users/deleteUser.ts","../src/class/source/client/servers/users/userDetails.ts","../src/class/main/Client.ts","../src/class/main/WSConnection.ts","../src/index.ts"],"sourcesContent":["/**\n * The Setup class provides a way to configure global settings for the Pterodactyl API Wrapper.\n * The primary use is to set the panel URL, which is then used in all API requests.\n *\n * @example\n * Setup.setPanel(\"https://panel.example.com\");\n * const panelUrl = Setup.getPanel();\n */\nexport default class Setup {\n private static panelUrl: string;\n\n /**\n * Sets the global panel URL.\n * @param url - The URL of the Pterodactyl panel.\n */\n public static setPanel(url: string): void {\n this.panelUrl = url;\n }\n\n /**\n * Gets the globally set panel URL.\n * @returns The panel URL.\n * @throws If the panel URL has not been set.\n */\n public static getPanel(): string {\n if (!this.panelUrl) {\n throw new Error(\"Panel URL is not set. Use Setup.setPanel(url) before making API calls.\");\n }\n return this.panelUrl;\n }\n}\n","import axios from \"axios\";\n\n/**\n * Creates an API Call to the Application API of your Pterodactyl panel.\n *\n * @param {Object} options - API call options.\n * @param {string} options.panel - Your panel's URL.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.endpoint - The API endpoint to call.\n * @param {\"GET\" | \"DELETE\" | \"POST\" | \"PATCH\" | \"PUT\"} options.method - HTTP method.\n * @param {any} [options.body] - Request body (for POST and PATCH requests).\n * @returns {Promise<any>} - The data fetched from the API.\n *\n * @throws {Error} - Throws an error if the API request fails.\n *\n * @example\n * (async () => {\n * try {\n * const data = await ApplicationAPICall({\n * panel: \"https://panel.example.com\",\n * apiKey: \"your-api-key\",\n * endpoint: \"users\",\n * method: \"GET\"\n * });\n * console.log(\"API Response:\", data);\n * } catch (error) {\n * console.error(\"Error:\", error);\n * }\n * })();\n */\nexport default async function ApplicationAPICall(options: {\n panel: string;\n apiKey: string;\n endpoint: string;\n method: \"GET\" | \"DELETE\" | \"POST\" | \"PATCH\" | \"PUT\";\n body?: any;\n}): Promise<any> {\n const url = `${options.panel}/api/application/${options.endpoint}`;\n const headers = {\n 'Accept': \"application/json\",\n 'Content-Type': \"application/json\",\n 'Authorization': `Bearer ${options.apiKey}`\n };\n\n let body: string | undefined = undefined;\n\n if (options.body && options.method !== \"GET\" && options.method !== \"DELETE\") {\n body = typeof options.body === \"string\" ? options.body : JSON.stringify(options.body);\n }\n\n try {\n if (options.method === \"PATCH\") {\n const response = await axios.patch(url, options.body, { headers });\n return response.data;\n } else {\n const response = await fetch(url, {\n method: options.method,\n headers,\n body\n });\n\n if (!response.ok) {\n throw new Error(`API call failed with status ${response.status}: ${await response.text()}`);\n }\n\n return await response.json();\n }\n } catch (error) {\n throw new Error(`Error in API call: ${error instanceof Error ? error.message : String(error)}`);\n }\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n data: {\n object: string,\n attributes: {\n id: number,\n external_id: string | null,\n uuid: string,\n username: string,\n email: string,\n first_name: string,\n last_name: string,\n language: string,\n root_admin: boolean,\n \"2fa\": boolean,\n created_at: string,\n updated_at: string\n }\n }[],\n meta: {\n pagination: {\n total: number,\n count: number,\n per_page: number,\n current_page: number,\n total_page: number,\n links: object\n }\n }\n}\n\n/**\n * Retrieves a list of users from the Pterodactyl panel API, with optional filters and sorting.\n * This function makes a `GET` request and includes the request body if required.\n *\n * @param {Object} options - Configuration options for the API call.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {boolean} [options.showLinkedServers=false] - Whether to include linked servers in the response.\n * @param {Object} [options.filters] - Filters to apply when retrieving users.\n * @param {string} [options.filters.email] - Filter users by their email address.\n * @param {string} [options.filters.uuid] - Filter users by their UUID.\n * @param {string} [options.filters.username] - Filter users by their username.\n * @param {string} [options.filters.external_id] - Filter users by their external ID.\n * @param {Object} [options.sortBy] - Sorting preferences for the response.\n * @param {boolean} [options.sortBy.id=false] - Sort users by ID.\n * @param {boolean} [options.sortBy.uuid=false] - Sort users by UUID.\n * @returns {Promise<Response>} - A Promise resolving to the API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\n\nexport default async function listUsers(options: { \n apiKey: string, \n panel: string, \n showLinkedServers?: boolean, \n filters?: { \n email?: string, \n uuid?: string, \n username?: string, \n external_id?: string\n },\n sortBy?: {\n id?: boolean,\n uuid?: boolean\n }\n}): Promise<Response> {\n const body = {\n servers: options.showLinkedServers ?? false,\n filters: {\n email: options.filters?.email ?? null,\n uuid: options.filters?.uuid ?? null,\n username: options.filters?.username ?? null,\n external_id: options.filters?.external_id ?? null\n },\n sortBy: {\n id: options.sortBy?.id ?? false,\n uuid: options.sortBy?.uuid ?? false\n }\n };\n\n return ApplicationAPICall({\n panel: options.panel,\n apiKey: options.apiKey,\n endpoint: \"users\",\n method: \"GET\",\n body: JSON.stringify(body) \n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string | null,\n uuid: string,\n username: string,\n email: string,\n first_name: string,\n last_name: string,\n language: string,\n root_admin: string,\n \"2fa\": boolean,\n created_at: string,\n updated_at: string\n }\n}\n\n/**\n * Retrieves details of a specific user from the Pterodactyl panel API.\n * Optionally, it can include the list of servers associated with the user.\n *\n * @param {Object} options - Configuration options for the API call.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {string} options.user_id - The unique ID of the user to retrieve.\n * @param {boolean} [options.listServers=false] - Whether to include the user's linked servers in the response.\n * @returns {Promise<Response>} - A Promise resolving to the API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function userDetails(options: { \n apiKey: string, \n panel: string, \n user_id: string, \n listServers?: boolean \n}): Promise<Response> {\n return ApplicationAPICall({\n panel: options.panel,\n apiKey: options.apiKey,\n endpoint: `user/${options.user_id}`,\n method: \"GET\",\n body: JSON.stringify({ servers: options.listServers ?? false }) // Ensuring body is a string\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string | null,\n uuid: string,\n username: string,\n email: string,\n first_name: string,\n last_name: string,\n language: string,\n root_admin: string,\n \"2fa\": boolean,\n created_at: string,\n updated_at: string\n }\n}\n\n/**\n * Retrieves user details from the Pterodactyl panel API using an external identifier.\n * Optionally, it can include the list of servers associated with the user.\n *\n * @param {Object} options - Configuration options for the API call.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {string} options.external_id - The external identifier of the user to retrieve.\n * @param {boolean} [options.listServers=false] - Whether to include the user's linked servers in the response.\n * @returns {Promise<Response>} - A Promise resolving to the API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n *\n * @example\n * (async () => {\n * try {\n * const userData = await userDetailsByExternalIdentifier({\n * panel: \"https://panel.example.com\",\n * apiKey: \"your-api-key\",\n * external_id: \"external-user-1234\",\n * listServers: true\n * });\n * console.log(\"User Details:\", userData);\n * } catch (error) {\n * console.error(\"Error:\", error);\n * }\n * })();\n */\nexport default async function userDetailsByExternalIdentifier(options: { \n apiKey: string, \n panel: string, \n external_id: string, \n listServers?: boolean \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: `users/external/${options.external_id}`,\n body: JSON.stringify({ servers: options.listServers ?? false }) // Ensuring body is a JSON string\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string | null,\n uuid: string,\n username: string,\n email: string,\n first_name: string,\n last_name: string,\n language: string,\n root_admin: string,\n \"2fa\": boolean,\n created_at: string,\n updated_at: string\n }\n}\n\n/**\n * Creates a new user in the Pterodactyl panel using the provided user details.\n * If `first_name` or `last_name` are not provided, they default to `\"Pterodactyl\"` and `\"User\"`, respectively.\n *\n * @param {Object} options - Configuration options for the API call.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {Object} options.user_details - The details of the user to be created.\n * @param {string} options.user_details.email - The email address of the user.\n * @param {string} options.user_details.username - The username of the user.\n * @param {string} [options.user_details.first_name=\"Pterodactyl\"] - The first name of the user (optional).\n * @param {string} [options.user_details.last_name=\"User\"] - The last name of the user (optional).\n * @returns {Promise<Response>} - A Promise resolving to the API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n *\n * @example\n * (async () => {\n * try {\n * const newUser = await createUser({\n * panel: \"https://panel.example.com\",\n * apiKey: \"your-api-key\",\n * user_details: {\n * email: \"newuser@example.com\",\n * username: \"newUser123\",\n * first_name: \"John\",\n * last_name: \"Doe\"\n * }\n * });\n * console.log(\"User Created:\", newUser);\n * } catch (error) {\n * console.error(\"Error creating user:\", error);\n * }\n * })();\n */\nexport default async function createUser(options: {\n apiKey: string;\n panel: string;\n user_details: {\n email: string;\n username: string;\n first_name?: string;\n last_name?: string;\n };\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"POST\",\n endpoint: \"users\",\n body: JSON.stringify({\n email: options.user_details.email,\n username: options.user_details.username,\n first_name: options.user_details.first_name ?? \"Pterodactyl\",\n last_name: options.user_details.last_name ?? \"User\"\n }) \n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string | null,\n uuid: string,\n username: string,\n email: string,\n first_name: string,\n last_name: string,\n language: string,\n root_admin: string,\n \"2fa\": boolean,\n created_at: string,\n updated_at: string\n }\n}\n\n/**\n * Updates a user's details on the Pterodactyl panel.\n * You can update the user's email, username, first name, last name, language, or password.\n *\n * @param {Object} options - Configuration options for the API call.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.user_id - The ID of the user to update.\n * @param {Object} options.data - The data to update for the user.\n * @param {string} [options.data.email] - The new email of the user (optional).\n * @param {string} [options.data.username] - The new username of the user (optional).\n * @param {string} [options.data.first_name] - The new first name of the user (optional).\n * @param {string} [options.data.last_name] - The new last name of the user (optional).\n * @param {string} [options.data.language] - The new language preference for the user (optional).\n * @param {string} [options.data.password] - The new password for the user (optional).\n * @returns {Promise<Response>} - A Promise resolving to the API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n *\n * @example\n * (async () => {\n * try {\n * const updatedUser = await updateUser({\n * panel: \"https://panel.example.com\",\n * apiKey: \"your-api-key\",\n * user_id: 1234,\n * data: {\n * email: \"newemail@example.com\",\n * username: \"UpdatedUsername\",\n * first_name: \"John\",\n * last_name: \"Doe\"\n * }\n * });\n * console.log(\"User Updated:\", updatedUser);\n * } catch (error) {\n * console.error(\"Error updating user:\", error);\n * }\n * })();\n */\nexport default async function updateUser(options: {\n apiKey: string;\n panel: string;\n user_id: number;\n data: {\n email?: string;\n username?: string;\n first_name?: string;\n last_name?: string;\n language?: string;\n password?: string;\n };\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n endpoint: `users/${options.user_id}`, // Fixed endpoint (removed extra \"/\")\n method: \"PATCH\",\n body: JSON.stringify(options.data) // Ensured the body is stringified\n });\n}","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\n/**\n * Deletes a user from the Pterodactyl panel using the given identifier.\n *\n * @param {Object} options - Configuration options for the API call.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.identifier - The unique identifier (ID) of the user to be deleted.\n * @returns {Promise<any>} - A Promise resolving to the API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n *\n * @example\n * (async () => {\n * try {\n * const response = await deleteUser({\n * panel: \"https://panel.example.com\",\n * apiKey: \"your-api-key\",\n * identifier: 1234\n * });\n * console.log(\"User Deleted:\", response);\n * } catch (error) {\n * console.error(\"Error deleting user:\", error);\n * }\n * })();\n */\nexport default async function deleteUser(options: { \n apiKey: string; \n panel: string; \n identifier: number; \n}): Promise<any> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"DELETE\",\n endpoint: `users/${options.identifier}`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\nexport interface Response {\n object: string,\n data: {\n object: string,\n attributes: {\n id: number,\n uuid: string,\n public: boolean,\n name: string,\n description: string,\n location_id: number,\n fqdn: string,\n scheme: string,\n behind_proxy: string,\n maintenance_mode: boolean,\n memory: number,\n memory_overallocate: number,\n disk: number,\n disk_overallocate: number,\n upload_size: number,\n daemon_listen: number,\n daemon_sftp: number,\n daemon_base: string,\n created_at: string,\n updated_at: string\n }\n }[],\n meta: {\n pagination: {\n total: number,\n count: number,\n per_page: number,\n current_page: number,\n total_pages: number,\n links: object\n }\n }\n}\n\n/**\n * Retrieves a list of all nodes on the Pterodactyl panel.\n *\n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @returns {Promise<Response>} - API response containing all nodes.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function listNodes(options: { \n apiKey: string; \n panel: string; \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: \"nodes\"\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n uuid: string,\n public: boolean,\n name: string,\n description: string,\n location_id: number,\n fqdn: string,\n scheme: string,\n behind_proxy: boolean,\n maintenance_mode: boolean,\n memory: number,\n memory_overallocate: number,\n disk: number,\n disk_overallocate: number,\n upload_size: number,\n daemon_listen: number,\n daemon_base: string,\n created_at: string,\n updated_at: string\n }\n}\n\n/**\n * Retrieves details of a specific node.\n *\n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.node_id - The ID of the node whose details are requested.\n * @returns {Promise<Response>} - API response containing node details.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function nodeDetails(options: { \n apiKey: string; \n panel: string; \n node_id: number; \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: `nodes/${options.node_id}`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n debug: boolean,\n uuid: string,\n token_id: string,\n token: string,\n api: {\n host: string,\n ssl: {\n enabled: boolean,\n cert: string,\n key: string\n },\n upload_limit: string,\n },\n system: {\n data: string,\n sftp: {\n bind_port: number\n }\n },\n remote: string\n}\n\n/**\n * Retrieves the configuration settings of a specific node.\n *\n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.node_id - The ID of the node whose configuration is requested.\n * @returns {Promise<Response>} - API response containing the node configuration.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function nodeConfiguration(options: { \n apiKey: string; \n panel: string; \n node_id: number; \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: `nodes/${options.node_id}/configuration`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n uuid: string,\n public: boolean,\n name: string,\n description: null | string,\n location_id: number,\n fqdn: string,\n scheme: string,\n behind_proxy: boolean,\n maintenance_mode: boolean,\n memory: number,\n memory_overallocate: number,\n disk: number,\n disk_overallocate: number,\n upload_size: number,\n daemon_listen: number,\n daemon_sftp: number,\n daemon_base: string,\n created_at: string,\n updated_at: string,\n allocated_resources: {\n memory: number,\n disk: number\n }\n },\n meta: {\n resource: string\n }\n}\n\n/**\n * Creates a new node on the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {Object} options.node_data - Node details for creation.\n * @param {string} options.node_data.name - The name of the node.\n * @param {string} [options.node_data.description] - Optional description of the node.\n * @param {number} options.node_data.location_id - The ID of the location where the node should be created.\n * @param {string} options.node_data.fqdn - The fully qualified domain name of the node.\n * @param {\"http\" | \"https\"} options.node_data.scheme - The scheme (HTTP or HTTPS) for the node.\n * @param {number} options.node_data.memory - The amount of memory allocated to the node (in MB).\n * @param {number} options.node_data.disk - The amount of disk space allocated to the node (in MB).\n * @param {number[]} [options.node_data.ports] - Optional list of ports assigned to the node.\n * @param {number} options.node_data.daemon_sftp - The SFTP port of the node.\n * @param {number} options.node_data.daemon_listen - The daemon listen port of the node.\n * @returns {Promise<Response>} - API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function createNode(options: { \n apiKey: string; \n panel: string; \n node_data: {\n name: string;\n description?: string;\n location_id: number;\n fqdn: string;\n scheme: \"http\" | \"https\";\n memory: number;\n disk: number;\n ports?: number[];\n daemon_sftp: number;\n daemon_listen: number;\n };\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"POST\",\n endpoint: \"nodes\",\n body: JSON.stringify(options.node_data)\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n uuid: string,\n public: boolean, \n name: string,\n description: string,\n location_id: number,\n fqdn: string,\n scheme: string,\n behind_proxy: boolean,\n maintenance_mode: boolean,\n memory: number,\n memory_overallocate: number,\n disk: number,\n disk_overallocate: number,\n upload_size: number,\n daemon_listen: number,\n daemon_sftp: number,\n daemon_base: string,\n created_at: string,\n updated_at: string,\n mounts: [],\n allocated_resources: {\n memory: number,\n disk: number\n }\n }\n}\n\n/**\n * Updates an existing node with new settings.\n *\n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.node_id - The ID of the node to update.\n * @param {Object} options.update_data - The new data for the node update.\n * @param {string} [options.update_data.name] - The new name for the node (optional).\n * @param {string} [options.update_data.description] - The new description for the node (optional).\n * @param {number} [options.update_data.location_id] - The new location ID for the node (optional).\n * @param {number} [options.update_data.memory] - The new memory allocation for the node (optional, in MB).\n * @param {number} [options.update_data.disk] - The new disk allocation for the node (optional, in MB).\n * @param {number} [options.update_data.daemon_sftp] - The new SFTP port for the node (optional).\n * @param {number} [options.update_data.daemon_listen] - The new daemon listen port for the node (optional).\n * @returns {Promise<Response>} - API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function updateNode(options: { \n apiKey: string; \n panel: string; \n node_id: number; \n update_data: {\n name?: string;\n description?: string;\n location_id?: number;\n memory?: number;\n disk?: number;\n daemon_sftp?: number;\n daemon_listen?: number;\n };\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"PATCH\",\n endpoint: `nodes/${options.node_id}`,\n body: JSON.stringify(options.update_data)\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\n/**\n * Deletes a node from the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.node_id - The ID of the node to delete.\n * @returns {Promise<any>} - API response.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function deleteNode(options: { \n apiKey: string; \n panel: string; \n node_id: number; \n}): Promise<any> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"DELETE\",\n endpoint: `nodes/${options.node_id}`\n });\n}","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string;\n data: {\n object: string;\n attributes: {\n id: number;\n short: string;\n long: string;\n updated_at: string;\n created_at: string;\n };\n }[];\n meta: {\n pagination: {\n total: number;\n count: number;\n per_page: number;\n current_page: number;\n total_pages: number;\n links: object;\n };\n };\n }\n \n\n/**\n * Retrieves a list of all locations from the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @returns {Promise<Response>} - API response containing all locations.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function listLocations(options: { \n apiKey: string; \n panel: string; \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: \"locations\"\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n short: string,\n long: string,\n updated_at: string,\n created_at: string\n }\n}\n\n/**\n * Retrieves details of a specific location from the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.location_id - The ID of the location to retrieve.\n * @returns {Promise<Response>} - API response containing location details.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function locationDetails(options: { \n apiKey: string; \n panel: string; \n location_id: number; \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: `locations/${options.location_id}`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n short: string,\n long: string,\n updates_at: string,\n created_at: string\n },\n meta: {\n resource: string\n }\n}\n\n/**\n * Creates a new location on the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {Object} options.location_data - The data required to create a new location.\n * @param {string} options.location_data.short - A short identifier for the location (e.g., \"us-east\").\n * @param {string} options.location_data.long - A long description of the location (e.g., \"US East Coast Datacenter\").\n * @returns {Promise<Response>} - API response containing the created location details.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function createLocation(options: { \n apiKey: string; \n panel: string; \n location_data: {\n short: string;\n long: string;\n };\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"POST\",\n endpoint: \"locations\",\n body: JSON.stringify(options.location_data)\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n short: string,\n long: string,\n updated_at: string,\n created_at: string\n }\n}\n\n/**\n * Updates an existing location on the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.location_id - The ID of the location to update.\n * @param {Object} options.update_data - The new data for updating the location.\n * @param {string} [options.update_data.short] - The new short identifier for the location (optional).\n * @param {string} [options.update_data.long] - The new long description of the location (optional).\n * @returns {Promise<Response>} - API response confirming the update.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function updateLocation(options: { \n apiKey: string; \n panel: string; \n location_id: number; \n update_data: {\n short?: string;\n long?: string;\n };\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"PATCH\",\n endpoint: `locations/${options.location_id}`,\n body: JSON.stringify(options.update_data)\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\n/**\n * Deletes a location from the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {number} options.location_id - The ID of the location to delete.\n * @returns {Promise<any>} - API response confirming the deletion.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function deleteLocation(options: { \n apiKey: string; \n panel: string; \n location_id: number; \n}): Promise<any> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"DELETE\",\n endpoint: `locations/${options.location_id}`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n data: {\n object: string,\n attributes: {\n id: number,\n external_id: string,\n uuid: string,\n identifier: string,\n name: string,\n description: string,\n suspended: boolean,\n limits: {\n memory: number,\n swap: number,\n disk: number,\n io: number,\n cpu: number,\n threads: null | number[]\n },\n feature_limits: {\n databases: number,\n allocations: number,\n backups: number\n },\n user: number,\n node: number,\n allocation: number,\n nest: number,\n egg: number,\n pack: any,\n container: {\n startup_command: string,\n image: string,\n installed: boolean,\n environment: object\n },\n updated_at: string,\n created_at: string,\n relationship: {\n databases: {\n object: string,\n data: {\n object: string,\n attributes: {\n id: number,\n server: number,\n host: number, \n database: string,\n username: string,\n remote: string,\n max_connections: number,\n created_at: string,\n updated_at: string\n }\n }[]\n }[]\n }\n }\n }[],\n meta: {\n pagination: {\n total: number,\n count: number,\n per_page: number,\n current_page: number,\n total_pages: number,\n links: object\n }\n }\n}\n\n/**\n * Retrieves a list of all servers from the Pterodactyl panel.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @returns {Promise<Response>} - API response containing the list of servers.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function listServers(options: { \n apiKey: string; \n panel: string; \n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: \"servers\"\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string,\n uuid: string,\n identifier: string,\n name: string,\n description: string,\n suspended: boolean,\n limits: {\n memory: number,\n swap: number,\n disk: number,\n io: number,\n cpu: number,\n threads: null | number[]\n },\n feature_limits: {\n databases: number,\n allocations: number,\n backups: number\n },\n user: number,\n node: number,\n allocation: number,\n nest: number,\n egg: number,\n pack: boolean,\n container: {\n startup_commands: string,\n image: string,\n installed: boolean,\n environment: object\n }\n updated_at: number,\n created_at: number\n }\n}\n\n/**\n * Retrieves details of a specific server.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {string} options.server_id - The ID of the server.\n * @returns {Promise<Response>} - API response containing server details.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function serverDetails(options: { \n apiKey: string; \n panel: string; \n server_id: string;\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: `servers/${options.server_id}`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string,\n uuid: string,\n identifier: string,\n name: string,\n description: string,\n suspended: boolean,\n limits: {\n memory: number,\n swap: number,\n disk: number,\n io: number,\n cpu: number,\n threads: null | number[]\n },\n feature_limits: {\n databases: number,\n allocations: number,\n backups: number\n },\n user: number,\n node: number,\n allocation: number,\n nest: number,\n egg: number,\n pack: boolean,\n container: {\n startup_commands: string,\n image: string,\n installed: boolean,\n environment: object\n }\n updated_at: number,\n created_at: number\n }\n}\n\n/**\n * Retrieves details of a specific server using an external identifier.\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {string} options.external_id - The external identifier of the server.\n * @returns {Promise<Response>} - API response containing server details.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function serverDetailsExternalIdentifier(options: { \n apiKey: string; \n panel: string; \n external_id: string;\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"GET\",\n endpoint: `servers/external/${options.external_id}`\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string,\n uuid: string,\n identifier: string,\n name: string,\n descriptions: string,\n suspendes: boolean,\n limits: {\n memory: number,\n swap: number,\n disk: number,\n io: number,\n cpu: number,\n threads: number[] | null\n },\n feature_limits: {\n databases: number,\n allocations: number,\n backups: number\n },\n user: number,\n node: number,\n allocation: number,\n nest: number,\n egg: number,\n container: {\n startup_command: string,\n image: string,\n installed: boolean,\n environment: [],\n },\n updated_at: string,\n created_at: string\n }\n}\n\n/**\n * Updates details of a specific server (name or description).\n * \n * @param {Object} options - API call options.\n * @param {string} options.apiKey - The API key for authentication.\n * @param {string} options.panel - The base URL of the Pterodactyl panel.\n * @param {string} options.server_id - The ID of the server.\n * @param {Object} options.update_data - The new server details.\n * @returns {Promise<Response>} - API response confirming the update.\n *\n * @throws {Error} - Throws an error if the API request fails.\n */\nexport default async function updateDetails(options: { \n apiKey: string; \n panel: string; \n server_id: string;\n update_data: any;\n}): Promise<Response> {\n return ApplicationAPICall({\n apiKey: options.apiKey,\n panel: options.panel,\n method: \"PATCH\",\n endpoint: `servers/${options.server_id}/details`,\n body: JSON.stringify(options.update_data)\n });\n}\n","import ApplicationAPICall from \"../../../../functions/createAppCall\";\n\nexport interface Response {\n object: string,\n attributes: {\n id: number,\n external_id: string,\n uuid: string,\n identifier: string,\n name: string,\n descriptions: string,\n suspendes: boolean,\n limits: {\n memory: number,\n swap: number,\n disk: number,\n io: number,\n cpu: number,\n threads: number[] | null\n },\n feature_limits: {\n databases: number,\n allocations: number,\n backups: number\n },\n user: number,\n node: number,\n allocation: number,\n nest: number,\n egg: number,\n container: {\n startup_command: string,\n image: string,\n installed: boolean,\n environment: [],\n },\n updated_at: strin