export type GetApiV1ProjectsProjectIdExportsDownloadArgs = {projectId: string, objectKey: string, filename?: string | undefined}; export type GetApiV1ProjectsProjectIdExportsDownloadOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download a specific export artifact by object key * * GET /v1/projects/{projectId}/exports/download */ export const getApiV1ProjectsProjectIdExportsDownload = async (args: GetApiV1ProjectsProjectIdExportsDownloadArgs, options: GetApiV1ProjectsProjectIdExportsDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.objectKey != null) query.append("objectKey", String(args.objectKey)) if (args.filename != null) query.append("filename", String(args.filename)) if (apiKey !== undefined) headers.set("X-API-Key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/projects/${encodeURIComponent(String(args.projectId))}/exports/download${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 undefined };