UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

65 lines • 2.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.History = exports.BaseHistory = void 0; const tslib_1 = require("../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const ConfigsAPI = tslib_1.__importStar(require("./configs.js")); const configs_1 = require("./configs.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseHistory = /* @__PURE__ */ (() => { class BaseHistory extends resource_1.APIResource { /** * Restores a historical published Zaraz configuration by ID for a zone. * * @example * ```ts * const configuration = await client.zaraz.history.update({ * zone_id: '023e105f4ecef8ad9ca31a8372d0c353', * body: 12345, * }); * ``` */ update(params, options) { const { zone_id, body } = params; return this._client.put((0, path_1.path) `/zones/${zone_id}/settings/zaraz/history`, { body: body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists a history of published Zaraz configuration records for a zone. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const historyListResponse of client.zaraz.history.list( * { zone_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { zone_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/zones/${zone_id}/settings/zaraz/history`, (pagination_1.SinglePage), { query, ...options }); } } BaseHistory._key = Object.freeze(['zaraz', 'history']); return BaseHistory; })(); exports.BaseHistory = BaseHistory; var History = /* @__PURE__ */ (() => { class History extends BaseHistory { constructor() { super(...arguments); this.configs = new ConfigsAPI.Configs(this._client); } } History.Configs = configs_1.Configs; History.BaseConfigs = configs_1.BaseConfigs; return History; })(); exports.History = History; //# sourceMappingURL=history.js.map