UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

38 lines • 1.4 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseSnapshot = /* @__PURE__ */ (() => { class BaseSnapshot extends APIResource { /** * Returns the page's HTML content and screenshot. Control page loading with * `gotoOptions` and `waitFor*` options. Customize screenshots with `viewport`, * `fullPage`, `clip` and others. * * @example * ```ts * const snapshot = * await client.browserRendering.snapshot.create({ * account_id: 'account_id', * url: 'https://www.example.com/', * formats: ['content', 'screenshot'], * }); * ``` */ create(params, options) { const { account_id, cacheTTL, ...body } = params; return this._client.post(path `/accounts/${account_id}/browser-rendering/snapshot`, { query: { cacheTTL }, body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseSnapshot._key = Object.freeze([ 'browserRendering', 'snapshot', ]); return BaseSnapshot; })(); export class Snapshot extends BaseSnapshot { } //# sourceMappingURL=snapshot.mjs.map