cloudflare
Version:
The official TypeScript library for the Cloudflare API
40 lines • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Json = exports.BaseJson = 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 BaseJson = /* @__PURE__ */ (() => {
class BaseJson extends resource_1.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((0, path_1.path) `/accounts/${account_id}/browser-rendering/json`, {
query: { cacheTTL },
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseJson._key = Object.freeze([
'browserRendering',
'json',
]);
return BaseJson;
})();
exports.BaseJson = BaseJson;
class Json extends BaseJson {
}
exports.Json = Json;
//# sourceMappingURL=json.js.map