export type UpdateApiUploadIdArgs = {id: string, body: BodyInit}; export type UpdateApiUploadIdOptions = {baseUrl: string, CurioAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload the deal data * * PUT /upload/{id} */ export const updateApiUploadId = async (args: UpdateApiUploadIdArgs, options: UpdateApiUploadIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, CurioAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/octet-stream") headers.set('accept', "*/*") if (CurioAuth !== undefined) headers.set("Authorization", CurioAuth) const url = `${baseUrl.replace(/\/+$/, '')}/upload/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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() };