export type CreateApiBytemineCrawlIntelArgs = {body: {url: string}}; export type CreateApiBytemineCrawlIntelOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Crawl a website's key pages and return comprehensive intel: company profile, contacts, social links, tech stack, sales signals, pain points, conversation starters. 1 credit per page (min 5). * * POST /bytemine/crawl/intel */ export const createApiBytemineCrawlIntel = async (args: CreateApiBytemineCrawlIntelArgs, options?: CreateApiBytemineCrawlIntelOptions) => { 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(/\/+$/, '')}/bytemine/crawl/intel${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 };