export type DreamType = 'omni'; export type ScheduleDreamRequest = {observer: string, observed?: (string | null) | undefined, dream_type: DreamType, session_id?: (string | null) | undefined}; export type CreateApiV3WorkspacesWorkspaceIdScheduleDreamArgs = {workspace_id: string, body: ScheduleDreamRequest}; export type CreateApiV3WorkspacesWorkspaceIdScheduleDreamOptions = {baseUrl?: string | undefined, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Schedule Dream * * POST /v3/workspaces/{workspace_id}/schedule_dream */ export const createApiV3WorkspacesWorkspaceIdScheduleDream = async (args: CreateApiV3WorkspacesWorkspaceIdScheduleDreamArgs, options?: CreateApiV3WorkspacesWorkspaceIdScheduleDreamOptions) => { const {baseUrl = "https://api.honcho.dev", fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/workspaces/${encodeURIComponent(String(args.workspace_id))}/schedule_dream${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };