export type GetApiHappenstanceV1ResearchResearchIdArgs = {research_id: string}; export type GetApiHappenstanceV1ResearchResearchIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get the status and results of a research request. Returns status (RUNNING, COMPLETED, FAILED, FAILED_AMBIGUOUS) and a detailed profile when completed. * * GET /happenstance/v1/research/{research_id} */ export const getApiHappenstanceV1ResearchResearchId = async (args: GetApiHappenstanceV1ResearchResearchIdArgs, options?: GetApiHappenstanceV1ResearchResearchIdOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.research_id != null) query.append("research_id", String(args.research_id)) const url = `${baseUrl.replace(/\/+$/, '')}/happenstance/v1/research/${encodeURIComponent(String(args.research_id))}${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 };