export type CreateApiTinyfishFetchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Fetch web pages and extract clean content. Submit up to 10 URLs, returns structured content in markdown (default) or HTML. Supports link/image extraction, CSS selector scoping, per-URL timeouts, and conditional requests via ETag/Last-Modified. * * POST /tinyfish-fetch/ */ export const createApiTinyfishFetch = async (options?: CreateApiTinyfishFetchOptions) => { const {baseUrl = "https://mpp.orthogonal.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/tinyfish-fetch/${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 };