export type GetApiScreenshotsScanIdPngArgs = {scanId: string}; export type GetApiScreenshotsScanIdPngOptions = {baseUrl?: string | undefined, apikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Screenshot * * GET /screenshots/{scanId}.png */ export const getApiScreenshotsScanIdPng = async (args: GetApiScreenshotsScanIdPngArgs, options?: GetApiScreenshotsScanIdPngOptions) => { const {baseUrl = "https://urlscan.io", fetch: fetchFn = fetch, apikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") if (apikeyAuth !== undefined) headers.set("api-key", apikeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/screenshots/${encodeURIComponent(String(args.scanId))}.png${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 res.blob() };