export type CreateApiLinkupResearchArgs = {body: {q: string, outputType: string, reasoningDepth?: string | undefined, mode?: string | undefined, structuredOutputSchema?: Record | undefined, fromDate?: string | undefined, toDate?: string | undefined, includeDomains?: Array | undefined, excludeDomains?: Array | undefined}}; export type CreateApiLinkupResearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates an asynchronous research task that performs comprehensive multi-step web research. Returns a task ID immediately. Poll GET /research/:id for results. * * POST /linkup/research */ export const createApiLinkupResearch = async (args: CreateApiLinkupResearchArgs, options?: CreateApiLinkupResearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/linkup/research${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 };