export type CreateApiOlostepV1ScrapesArgs = {body: {url_to_scrape: string, wait_before_scraping?: number | undefined, formats?: Array | undefined, remove_css_selectors?: string | undefined, actions?: (Array<{type: string, milliseconds?: number | undefined}>) | undefined, country?: string | undefined, transformer?: string | undefined, remove_images?: boolean | undefined, remove_class_names?: Array | undefined, parser?: ({id?: string | undefined}) | undefined, llm_extract?: ({schema?: Record | undefined}) | undefined, links_on_page?: ({absolute_links?: boolean | undefined, query_to_order_links_by?: string | undefined, include_links?: Array | undefined, exclude_links?: Array | undefined}) | undefined, screen_size?: ({screen_type?: string | undefined, screen_width?: number | undefined, screen_height?: number | undefined}) | undefined, metadata?: Record | undefined}}; export type CreateApiOlostepV1ScrapesOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Initiate a web page scrape * * POST /olostep/v1/scrapes */ export const createApiOlostepV1Scrapes = async (args: CreateApiOlostepV1ScrapesArgs, options?: CreateApiOlostepV1ScrapesOptions) => { 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/scrapes${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 };