UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

46 lines • 1.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PDF = exports.BasePDF = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const headers_1 = require("../../internal/headers.js"); const path_1 = require("../../internal/utils/path.js"); var BasePDF = /* @__PURE__ */ (() => { class BasePDF extends resource_1.APIResource { /** * Fetches rendered PDF from provided URL or HTML. Check available options like * `gotoOptions` and `waitFor*` to control page load behaviour. * * @example * ```ts * const pdf = await client.browserRendering.pdf.create({ * account_id: 'account_id', * url: 'https://www.example.com/', * }); * * const content = await pdf.blob(); * console.log(content); * ``` */ create(params, options) { const { account_id, cacheTTL, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/browser-rendering/pdf`, { query: { cacheTTL }, body, ...options, headers: (0, headers_1.buildHeaders)([{ Accept: 'application/pdf' }, options?.headers]), __binaryResponse: true, }); } } BasePDF._key = Object.freeze([ 'browserRendering', 'pdf', ]); return BasePDF; })(); exports.BasePDF = BasePDF; class PDF extends BasePDF { } exports.PDF = PDF; //# sourceMappingURL=pdf.js.map