UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

35 lines • 1.25 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 BaseJson = /* @__PURE__ */ (() => { class BaseJson extends APIResource { /** * Gets json from a webpage from a provided URL or HTML. Pass `prompt` or `schema` * in the body. Control page loading with `gotoOptions` and `waitFor*` options. * * @example * ```ts * const json = await client.browserRendering.json.create({ * account_id: 'account_id', * url: 'https://www.example.com/', * }); * ``` */ create(params, options) { const { account_id, cacheTTL, ...body } = params; return this._client.post(path `/accounts/${account_id}/browser-rendering/json`, { query: { cacheTTL }, body, ...options, })._thenUnwrap((obj) => obj.result); } } BaseJson._key = Object.freeze([ 'browserRendering', 'json', ]); return BaseJson; })(); export class Json extends BaseJson { } //# sourceMappingURL=json.mjs.map