export type GetApiApiSessionsSessionIdExportPdfArgs = {sessionId: string, locale?: ('en' | 'ja' | 'ko') | undefined}; export type GetApiApiSessionsSessionIdExportPdfOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export a session result as a PDF * * GET /api/sessions/{sessionId}/export/pdf */ export const getApiApiSessionsSessionIdExportPdf = async (args: GetApiApiSessionsSessionIdExportPdfArgs, options: GetApiApiSessionsSessionIdExportPdfOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (args.locale != null) query.append("locale", String(args.locale)) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/sessions/${encodeURIComponent(String(args.sessionId))}/export/pdf${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() };