export type GetApiApiImageImageIdArgs = {image_id: string}; export type GetApiApiImageImageIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get image * * GET /api/image/{image_id} */ export const getApiApiImageImageId = async (args: GetApiApiImageImageIdArgs, options?: GetApiApiImageImageIdOptions) => { const {baseUrl = "https://search.elixpo.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") const url = `${baseUrl.replace(/\/+$/, '')}/api/image/${encodeURIComponent(String(args.image_id))}${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() };