export type CreateApiContextDevWebExtractOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Crawl a website, use the provided JSON Schema and instructions to prioritize relevant internal links, and extract structured data from the selected pages. * * POST /context-dev/web/extract */ export const createApiContextDevWebExtract = async (options?: CreateApiContextDevWebExtractOptions) => { const {baseUrl = "https://mpp.orthogonal.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/context-dev/web/extract${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };