export type GetApiOcrRequestIdEocrArgs = {request_id: string}; export type GetApiOcrRequestIdEocrOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get eOCR document * * GET /ocr/{request_id}/eocr */ export const getApiOcrRequestIdEocr = async (args: GetApiOcrRequestIdEocrArgs, options?: GetApiOcrRequestIdEocrOptions) => { const {baseUrl = "https://us.app.zuva.ai/api/v2", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/ocr/${encodeURIComponent(String(args.request_id))}/eocr${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() };