cloudflare
Version:
The official TypeScript library for the Cloudflare API
43 lines • 1.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Snapshot = exports.BaseSnapshot = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const path_1 = require("../../internal/utils/path.js");
var BaseSnapshot = /* @__PURE__ */ (() => {
class BaseSnapshot extends resource_1.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((0, path_1.path) `/accounts/${account_id}/browser-rendering/snapshot`, {
query: { cacheTTL },
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseSnapshot._key = Object.freeze([
'browserRendering',
'snapshot',
]);
return BaseSnapshot;
})();
exports.BaseSnapshot = BaseSnapshot;
class Snapshot extends BaseSnapshot {
}
exports.Snapshot = Snapshot;
//# sourceMappingURL=snapshot.js.map