export type GetApiMigrationsMigrationIdThreadStreamArgs = {after?: number | undefined, include?: ('user' | 'tools' | 'all') | undefined}; export type GetApiMigrationsMigrationIdThreadStreamOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream the thread (SSE) * * GET /migrations/{migration_id}/thread/stream */ export const getApiMigrationsMigrationIdThreadStream = async (args: GetApiMigrationsMigrationIdThreadStreamArgs, options?: GetApiMigrationsMigrationIdThreadStreamOptions) => { const {baseUrl = "https://app.vern.so/api/v1", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") if (args.after != null) query.append("after", String(args.after)) if (args.include != null) query.append("include", String(args.include)) if (apiKey !== undefined) headers.set("x-api-key", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/migrations/${encodeURIComponent(String(args.migration_id))}/thread/stream${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() };