export type GetApiDryRunEventsCorrelationIdArgs = {correlationId: string, teamId: string}; export type GetApiDryRunEventsCorrelationIdOptions = {baseUrl?: string | undefined, jwt?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stream dry run events * * GET /dry-run/events/{correlationId} */ export const getApiDryRunEventsCorrelationId = async (args: GetApiDryRunEventsCorrelationIdArgs, options?: GetApiDryRunEventsCorrelationIdOptions) => { const {baseUrl = "http://localhost:3001", fetch: fetchFn = fetch, jwt} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.teamId != null) query.append("teamId", String(args.teamId)) if (jwt !== undefined) headers.set('authorization', `Bearer ${jwt}`) const url = `${baseUrl.replace(/\/+$/, '')}/dry-run/events/${encodeURIComponent(String(args.correlationId))}${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 undefined };