export type CreateApiBytemineCrawlSnapshotArgs = {body: {url: string}}; export type CreateApiBytemineCrawlSnapshotOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Save a snapshot of a page's current content for change tracking. Use with /crawl/diff to detect changes. 1 credit. * * POST /bytemine/crawl/snapshot */ export const createApiBytemineCrawlSnapshot = async (args: CreateApiBytemineCrawlSnapshotArgs, options?: CreateApiBytemineCrawlSnapshotOptions) => { 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/snapshot${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 };