export type GetApiApiV1VisaLiveOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Live activity Server-Sent Events stream (public) * * GET /api/v1/visa/live */ export const getApiApiV1VisaLive = async (options?: GetApiApiV1VisaLiveOptions) => { const {baseUrl = "https://visa.orizn.app", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/visa/live${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.text() };