Skip to main content
Module

x/ptereno/lib/models/Client.ts>default

An efficient and fully compliant Pterodactyl API wrapper.
Latest
class default
import { default } from "https://deno.land/x/ptereno@v1.0.1/lib/models/Client.ts";

Constructors

new
default(endpoint: string, api_token: string)

Represents a Pterodactyl client object, used for automating client requests.

Methods

private
uploadFileMP(server: string, unnamed 1: UploadFileOptions)

Uploads a local file to a specific server.

Sends POST requests using multipart form data.

changeDockerImage(server: string, dockerImage: string)

Changes the docker image on a given server.

compressFile(server: string, unnamed 1: SingleFileOptions)

Compresses a file on a specific server.

compressFiles(server: string, unnamed 1: MultiFileOptions)

Compresses multiple files on a specific server.

copyFile(server: string, file: string)

Makes a copy of a file.

Creates a new API key.

createBackup(server: string, options?: NewBackupOptions)

Creates a new server backup.

If no options are provided, the panel will fill in the data for you.

createDatabase(server: string, options: NewDatabaseOptions)

Creates a new server database.

createFolder(server: string, unnamed 1: FolderOptions)

Creates a new folder on a specific server.

createSchedule(server: string, unnamed 1: NewScheduleOptions)

Creates a new schedule on a specific server.

If you need help with setting up cron schedules, refer to this website: https://crontab.guru/

createTask(
server: string,
schedule: number,
unnamed 2: TaskOptions,
)

Creates a new task on a specific schedule.

The payload field can only be used if action is not set to backup.

createUser(server: string, unnamed 1: NewUserOptions)

Creates a new server subuser.

decompressFile(server: string, unnamed 1: SingleFileOptions)

Decompresses a file on a specific server.

delete2FA(password: string)

Removes two-factor authentication from the bearer account.

deleteAllocation(server: string, id: number)

Deletes a server allocation.

The allocation must not be the default server allocation.

deleteAPIKey(id: number)

Deletes an API key.

deleteBackup(server: string, uuid: string)

Restores a server backup.

deleteDatabase(server: string, database: string)

Deletes a server database.

deleteFile(server: string, unnamed 1: SingleFileOptions)

Deletes a file on a specific server.

deleteFiles(server: string, unnamed 1: MultiFileOptions)

Deletes multiple files on a specific server.

deleteSchedule(server: string, id: number)

Deletes a schedule of a specific server.

deleteTask(
server: string,
schedule: number,
id: number,
)

Deletes a task on a specific schedule.

deleteUser(server: string, uuid: string)

Deletes a specific server subuser.

downloadFile(server: string, file: string)

Retrieves a download link to the file.

enable2FA(code: string)

Enables two-factor authentication and retrieves recovery tokens.

Retrieves a two-factor QR code image.

Retrieves details associated with the bearer account.

getAllocations(server: string)

Retrieves a list of server allocations.

Retrieves all available permissions.

Retrieves a list of all API keys associated with the account.

getBackup(server: string, uuid: string)

Retrieves a specific server backup.

getBackupDownload(server: string, uuid: string)

Retrieves a url for downloading a server backup.

getBackups(server: string)

Retrieves a list of server backups.

getDatabases(server: string, params?: DatabaseParameters)

Retrieves a list of database objects on a server.

getFileContents(server: string, file: string)

Retrieves raw contents from a file.

The file parameter can also include a directory to the file. Both bukkit.yml and /logs/latest.txt are valid.

getFiles(server: string, directory?: string)

Retrieves a list of files.

getFTPServer(server: string)

Retrieves a URL to connect with the FTP server.

getResources(server: string)

Retrieves current statistics about a server.

getSchedule(server: string, id: number)

Retrieves a specific schedule from a server.

getSchedules(server: string)

Retrieves a list of server schedules.

getServer(server: string, params?: ServerParameters)

Retrieves server information.

Retrieves a list of servers.

getServerSocket(server: string)

Retrieves a url and token used to connect to a server websocket.

getUser(server: string, uuid: string)

Retrieves a specific server subuser.

getUsers(server: string)

Retrieves a list of server subusers.

getVariables(server: string)

Retrieves a list of server startup variables.

joinServerSocket(server: string, options?: SocketOptions)

Returns a websocket connection to the server.

lockBackup(server: string, uuid: string)

Locks a server backup. This also unlocks backups that are already locked.

reinstallServer(server: string)

Triggers a server to reinstall.

WARNING: This can potentially delete preexisting server files, use this method with caution.

renameFile(server: string, options: RenameFileOptions)

Changes the name of a file.

renameServer(server: string, name: string)

Renames a specific server.

restoreBackup(server: string, uuid: string)

Restores a server backup.

rotateDatabasePWD(server: string, database: string)

Changes the password of a server database.

sendCommand(server: string, command: string)

Sends a command to a server.

sendPowerAction(server: string, action: PowerActionType)

Sends a power signal to a server.

setAllocationNote(
server: string,
id: number,
note: string,
)

Sets the note on a server allocation.

setPrimaryAllocation(server: string, id: number)

Sets a server's primary allocation.

Updates the account email address.

updateFileCHMOD(server: string, unnamed 1: UpdateFileCHMODOptions)

Updates the chmod for a single file.

updateFilesCHMOD(server: string, unnamed 1: UpdateFilesCHMODOptions)

Updates the chmod for multiple files.

Updates the account password.

updateSchedule(
server: string,
id: number,
)

Updates a specific schedule on a server.

updateTask(
server: string,
schedule: number,
id: number,
unnamed 3: TaskOptions,
)

Updates a task on a specific schedule.

updateUser(
server: string,
uuid: string,
unnamed 2: UpdateUserOptions,
)

Updates the permissions for a specific server subuser.

updateVariable(server: string, unnamed 1: UpdateVariableOptions)

Updates a server startup variable.

uploadFile(server: string, unnamed 1: UploadFileOptions)

Uploads a local file to a specific server.

Sends POST requests with raw body data.

Requires read permissions.

writeFile(
server: string,
target: string,
data: string | Uint8Array,
)

Writes data into a file on a specific server.

If you want to upload a file and have it handled for you, use the uploadFile method.