export type GetApiApiSessionsSessionIdExportScreenshotsArgs = {sessionId: string, locale?: ('en' | 'ja' | 'ko') | undefined}; export type GetApiApiSessionsSessionIdExportScreenshotsOptions = {baseUrl: string, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Export a session's screenshots as a ZIP * * GET /api/sessions/{sessionId}/export/screenshots */ export const getApiApiSessionsSessionIdExportScreenshots = async (args: GetApiApiSessionsSessionIdExportScreenshotsArgs, options: GetApiApiSessionsSessionIdExportScreenshotsOptions) => { const {baseUrl, fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/zip") 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/screenshots${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() };