UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

97 lines • 3.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SiteInfo = exports.BaseSiteInfo = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const pagination_1 = require("../../core/pagination.js"); const path_1 = require("../../internal/utils/path.js"); var BaseSiteInfo = /* @__PURE__ */ (() => { class BaseSiteInfo extends resource_1.APIResource { /** * Creates a new Web Analytics site. * * @example * ```ts * const site = await client.rum.siteInfo.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/rum/site_info`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Updates an existing Web Analytics site. * * @example * ```ts * const site = await client.rum.siteInfo.update( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ update(siteID, params, options) { const { account_id, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/rum/site_info/${siteID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all Web Analytics sites of an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const site of client.rum.siteInfo.list({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * })) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/rum/site_info/list`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Deletes an existing Web Analytics site. * * @example * ```ts * const siteInfo = await client.rum.siteInfo.delete( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ delete(siteID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/rum/site_info/${siteID}`, options)._thenUnwrap((obj) => obj.result); } /** * Retrieves a Web Analytics site. * * @example * ```ts * const site = await client.rum.siteInfo.get( * '023e105f4ecef8ad9ca31a8372d0c353', * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(siteID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/rum/site_info/${siteID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSiteInfo._key = Object.freeze(['rum', 'siteInfo']); return BaseSiteInfo; })(); exports.BaseSiteInfo = BaseSiteInfo; class SiteInfo extends BaseSiteInfo { } exports.SiteInfo = SiteInfo; //# sourceMappingURL=site-info.js.map