export type GetApiApiV1ScriboEmailVerificationsIdEventsArgs = {id: string, 'x-scribo-verification-secret': string}; export type GetApiApiV1ScriboEmailVerificationsIdEventsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Verification challenge event stream * * GET /api/v1/scribo/email-verifications/{id}/events */ export const getApiApiV1ScriboEmailVerificationsIdEvents = async (args: GetApiApiV1ScriboEmailVerificationsIdEventsArgs, options?: GetApiApiV1ScriboEmailVerificationsIdEventsOptions) => { const {baseUrl = "https://scribo.causaprima.ai", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") if (args['x-scribo-verification-secret'] != null) headers.set("x-scribo-verification-secret", String(args['x-scribo-verification-secret'])) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/scribo/email-verifications/${encodeURIComponent(String(args.id))}/events${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() };