export type GetApiApiV1PhotoIdBlobArgs = {id: string, autoConvert?: boolean | undefined}; export type GetApiApiV1PhotoIdBlobOptions = {baseUrl: string, LocalUserJWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * 🛡️ Get a photo blob. * * GET /api/v1/photo/{id}/blob */ export const getApiApiV1PhotoIdBlob = async (args: GetApiApiV1PhotoIdBlobArgs, options: GetApiApiV1PhotoIdBlobOptions) => { const {baseUrl, fetch: fetchFn = fetch, LocalUserJWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.autoConvert != null) query.append("autoConvert", String(args.autoConvert)) if (LocalUserJWT !== undefined) headers.set('authorization', `Bearer ${LocalUserJWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/photo/${encodeURIComponent(String(args.id))}/blob${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 };