export type AccountId = string; export type FilePath = string; export type DeleteApiV2AccountsAccountIdFilesArgs = {accountId: AccountId, filePath: FilePath}; export type DeleteApiV2AccountsAccountIdFilesOptions = {baseUrl?: string | undefined, authorizationHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a file synchronously. * * Requires a `secret_*` API key. Alternatively, you can use a `public_*` API key and JWT-based auth. * * DELETE /v2/accounts/{accountId}/files */ export const deleteApiV2AccountsAccountIdFiles = async (args: DeleteApiV2AccountsAccountIdFilesArgs, options?: DeleteApiV2AccountsAccountIdFilesOptions) => { const {baseUrl = "https://api.bytescale.com", fetch: fetchFn = fetch, authorizationHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.filePath != null) query.append("filePath", String(args.filePath)) if (authorizationHeader !== undefined) headers.set("Authorization", authorizationHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v2/accounts/${encodeURIComponent(String(args.accountId))}/files${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };