export type GetApiApiReposNamespaceRepoNameExportDownloadResourceArgs = {namespace: string, repo_name: string, resource: string}; export type GetApiApiReposNamespaceRepoNameExportDownloadResourceOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export resource as a zip * * GET /api/repos/{namespace}/{repo_name}/export/download/{resource} */ export const getApiApiReposNamespaceRepoNameExportDownloadResource = async (args: GetApiApiReposNamespaceRepoNameExportDownloadResourceArgs, options?: GetApiApiReposNamespaceRepoNameExportDownloadResourceOptions) => { const {baseUrl = "https://hub.oxen.ai", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/repos/${encodeURIComponent(String(args.namespace))}/${encodeURIComponent(String(args.repo_name))}/export/download/${encodeURIComponent(String(args.resource))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };