export type CreateApiOlostepV1CrawlsArgs = {body: {start_url: string, max_pages: number, include_urls?: Array | undefined, exclude_urls?: Array | undefined, max_depth?: number | undefined, include_external?: boolean | undefined, include_subdomain?: boolean | undefined, search_query?: string | undefined, top_n?: number | undefined, webhook_url?: string | undefined, timeout?: number | undefined}}; export type CreateApiOlostepV1CrawlsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Starts a new crawl. You receive a `id` to track the progress. The operation may take 1-10 mins depending upon the site and depth and pages parameters. * * POST /olostep/v1/crawls */ export const createApiOlostepV1Crawls = async (args: CreateApiOlostepV1CrawlsArgs, options?: CreateApiOlostepV1CrawlsOptions) => { 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(/\/+$/, '')}/olostep/v1/crawls${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 };