export type UpdateApiV1MultipartGcsComposeArgs = {token: string, body: BodyInit}; export type UpdateApiV1MultipartGcsComposeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Compose the parts of a GCS parallel upload into a single object. * * PUT /v1/multipart/gcs/compose/ */ export const updateApiV1MultipartGcsCompose = async (args: UpdateApiV1MultipartGcsComposeArgs, options: UpdateApiV1MultipartGcsComposeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/xml") if (args.token != null) query.append("token", String(args.token)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/multipart/gcs/compose/${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 undefined };