export type MachineIDPathSegment = string; export type GetApiV1MachinesMachineIdStatusStreamArgs = {'X-Dedalus-Org-Id'?: string | undefined, machine_id: MachineIDPathSegment, 'Last-Event-ID'?: string | undefined}; export type GetApiV1MachinesMachineIdStatusStreamOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Watch machine lifecycle status * * GET /v1/machines/{machine_id}/status/stream * * Also accepts auth: BearerAuth */ export const getApiV1MachinesMachineIdStatusStream = async (args: GetApiV1MachinesMachineIdStatusStreamArgs, options?: GetApiV1MachinesMachineIdStatusStreamOptions) => { const {baseUrl = "https://dcs.dedaluslabs.ai", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") if (args['X-Dedalus-Org-Id'] != null) headers.set("X-Dedalus-Org-Id", String(args['X-Dedalus-Org-Id'])) if (args['Last-Event-ID'] != null) headers.set("Last-Event-ID", String(args['Last-Event-ID'])) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/machines/${encodeURIComponent(String(args.machine_id))}/status/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() };