export type HeadApiMediaUploadsIdArgs = {id: string}; export type HeadApiMediaUploadsIdOptions = {baseUrl?: string | undefined, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Lightweight status check for a presigned upload slot. Returns the SAME state as * `GET /media/uploads/{id}` but with NO body — the status is carried in the * `X-Reveldigital-Upload-Status` header (`pending`, `uploaded`, or * `completed`) and, once finalized, the media id in `X-Reveldigital-Media-Id`. This * lets a client cheaply poll for completion without transferring or parsing a JSON body. * * HEAD /media/uploads/{id} * * Also accepts auth: ApiKeyInHeader, ApiKeyInQuery */ export const headApiMediaUploadsId = async (args: HeadApiMediaUploadsIdArgs, options?: HeadApiMediaUploadsIdOptions) => { const {baseUrl = "https://api.reveldigital.com", fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/media/uploads/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "HEAD", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };