export type CreateApiApiReposNamespaceRepoNameVersionsBatchDownloadArgs = {namespace: string, repo_name: string, body: BodyInit}; export type CreateApiApiReposNamespaceRepoNameVersionsBatchDownloadOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Batch download files (Tarball) * * POST /api/repos/{namespace}/{repo_name}/versions/batch-download */ export const createApiApiReposNamespaceRepoNameVersionsBatchDownload = async (args: CreateApiApiReposNamespaceRepoNameVersionsBatchDownloadArgs, options?: CreateApiApiReposNamespaceRepoNameVersionsBatchDownloadOptions) => { const {baseUrl = "https://hub.oxen.ai", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/gzip") headers.set('accept', "application/gzip") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/repos/${encodeURIComponent(String(args.namespace))}/${encodeURIComponent(String(args.repo_name))}/versions/batch-download${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };