import type { ApiAppBackup, ApiAppBackupAll } from "@discloudapp/api-types/v2"; import { type PathLike } from "fs"; import type DiscloudApp from "../discloudApp/DiscloudApp"; import Base from "./Base"; /** * Callback de progresso do download */ export type DownloadProgressCallback = (progress: { /** * Bytes baixados */ downloaded: number; /** * Total de bytes (pode ser 0 se o servidor não informar) */ total: number; }) => void | Promise; export default class AppBackup extends Base { /** * Your app id */ readonly appId: string; /** * The backup url. * - You can access it `only once`. */ url: string; /** * The backup status */ status?: string; /** * The backup {@link Buffer} */ data?: Buffer; constructor(discloudApp: DiscloudApp, data: ApiAppBackupAll | ApiAppBackup); protected _patch(data: Partial): this; /** * Make backup of your application * * @param path - Backup path * @param filename - Backup file name * @param onProgress - Callback para acompanhar o progresso do download */ download(path?: PathLike, filename?: string, onProgress?: DownloadProgressCallback): Promise; }