export type GetApiOppsV1ApiResourcesFilesResourceIdDownloadArgs = {Authorization: string, api_key: string, resourceId: string, status?: string | undefined, token?: string | undefined}; export type GetApiOppsV1ApiResourcesFilesResourceIdDownloadOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * get attachment * * GET /opps/v1/api/resources/files/{resourceId}/download */ export const getApiOppsV1ApiResourcesFilesResourceIdDownload = async (args: GetApiOppsV1ApiResourcesFilesResourceIdDownloadArgs, options: GetApiOppsV1ApiResourcesFilesResourceIdDownloadOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args.api_key != null) query.append("api_key", String(args.api_key)) if (args.status != null) query.append("status", String(args.status)) if (args.token != null) query.append("token", String(args.token)) const url = `${baseUrl.replace(/\/+$/, '')}/opps/v1/api/resources/files/${encodeURIComponent(String(args.resourceId))}/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 res.blob() };