UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

41 lines • 1.46 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { buildHeaders } from "../../internal/headers.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BasePDF = /* @__PURE__ */ (() => { class BasePDF extends 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(path `/accounts/${account_id}/browser-rendering/pdf`, { query: { cacheTTL }, body, ...options, headers: buildHeaders([{ Accept: 'application/pdf' }, options?.headers]), __binaryResponse: true, }); } } BasePDF._key = Object.freeze([ 'browserRendering', 'pdf', ]); return BasePDF; })(); export class PDF extends BasePDF { } //# sourceMappingURL=pdf.mjs.map