UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

92 lines • 3.38 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { V4PagePaginationArray } from "../../core/pagination.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseSiteInfo = /* @__PURE__ */ (() => { class BaseSiteInfo extends 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(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(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(path `/accounts/${account_id}/rum/site_info/list`, (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(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(path `/accounts/${account_id}/rum/site_info/${siteID}`, options)._thenUnwrap((obj) => obj.result); } } BaseSiteInfo._key = Object.freeze(['rum', 'siteInfo']); return BaseSiteInfo; })(); export class SiteInfo extends BaseSiteInfo { } //# sourceMappingURL=site-info.mjs.map