UNPKG

jspteroapi

Version:

A pterodactyl v1 api using undici

110 lines (109 loc) 4.32 kB
import { Backup, BackupAttributes } from 'client/interfaces/Backups'; import { Client } from '../index'; export declare class backupMethods { private readonly client; constructor(client: Client); /** * @internal */ private getBackups; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @returns An array of backups * @example * ```ts * const res = await client.getAllBackups('7e74354d') // res = Backup[] * ``` * @example * ```ts * client.getAllBackups('7e74354d').then((res) => console.log(res)) // res = Backup[] * ``` */ getAllBackups: (serverId: string) => Promise<Backup[]>; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @param name - Name of the backup * @param ignored - Ignored files / folders * @returns Backup information * @example * ```ts * const res = await client.createBackup('7e74354d') // res = BackupAttributes * ``` * @example * ```ts * client.createBackup('7e74354d', 'RandomBackup').then((res) => console.log(res)) // res = BackupAttributes * ``` */ createBackup: (serverId: string, name?: string, ignored?: string[], isLocked?: boolean) => Promise<BackupAttributes>; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @param backupId - ID of the backup to get * @returns Backup information * @example * ```ts * const res = await client.getBackupInfo('7e74354d', '3a4e4b2a') // res = BackupAttributes * ``` * @example * ```ts * client.getBackupInfo('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = BackupAttributes * ``` */ getBackupInfo: (serverId: string, backupId: string) => Promise<BackupAttributes>; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @param backupId - ID of the backup to toggle lock of * @returns Backup information * @example * ```ts * const res = await client.toggleLockBackup('7e74354d', '3a4e4b2a') // res = BackupAttributes * ``` * @example * ```ts * client.toggleLockBackup('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = BackupAttributes * ``` */ toggleLockBackup: (serverId: string, backupId: string) => Promise<BackupAttributes>; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @param backupId - ID of the backup to restore * @param truncate - Whether to remove all files before restoring backup * @returns Sucessfully restored backup * @example * ```ts * const res = await client.restoreBackup('7e74354d', '3a4e4b2a') // res = Sucessfully restored backup * ``` * @example * ```ts * client.restoreBackup('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = Sucessfully restored backup * ``` */ restoreBackup: (serverId: string, backupId: string, truncate?: boolean) => Promise<BackupAttributes>; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @param backupId - ID of the backup to get * @returns Returns backup download url * @example * ```ts * const res = await client.getBackupDownloadLink('7e74354d', '3a4e4b2a') // res = url (string) * ``` * @example * ```ts * client.getBackupDownloadLink('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = url (string) * ``` */ getBackupDownloadLink: (serverId: string, backupId: string) => Promise<string>; /** * @param serverId - ID of the server to get (In the settings tab of server/in link) * @param backupId - ID of the backup to delete * @returns Backup information * @example * ```ts * const res = await client.deleteBackup('7e74354d', '3a4e4b2a') // res = Backup successfully deleted! * ``` * @example * ```ts * client.deleteBackup('7e74354d', '3a4e4b2a').then((res) => console.log(res)) // res = Backup successfully deleted! * ``` */ deleteBackup: (serverId: string, backupId: string) => Promise<string>; }