export type GetApiContextDevWebScreenshotArgs = {domain?: string | undefined, directUrl?: string | undefined, fullScreenshot?: string | undefined, page?: string | undefined, prioritize?: string | undefined}; export type GetApiContextDevWebScreenshotOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Capture a screenshot of a website. Supports both viewport (standard browser view) and full page screenshots. * * GET /context-dev/web/screenshot */ export const getApiContextDevWebScreenshot = async (args: GetApiContextDevWebScreenshotArgs, options?: GetApiContextDevWebScreenshotOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.domain != null) query.append("domain", String(args.domain)) if (args.directUrl != null) query.append("directUrl", String(args.directUrl)) if (args.fullScreenshot != null) query.append("fullScreenshot", String(args.fullScreenshot)) if (args.page != null) query.append("page", String(args.page)) if (args.prioritize != null) query.append("prioritize", String(args.prioritize)) const url = `${baseUrl.replace(/\/+$/, '')}/context-dev/web/screenshot${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };