UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

85 lines • 2.99 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import * as WebCrawlersAPI from "./web-crawlers.mjs"; import { BaseWebCrawlers, WebCrawlers, } from "./web-crawlers.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseBots = /* @__PURE__ */ (() => { class BaseBots extends APIResource { /** * Retrieves a list of bots. * * @example * ```ts * const bots = await client.radar.bots.list(); * ``` */ list(query = {}, options) { return this._client.get('/radar/bots', { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves the requested bot information. * * @example * ```ts * const bot = await client.radar.bots.get('gptbot'); * ``` */ get(botSlug, query = {}, options) { return this._client.get(path `/radar/bots/${botSlug}`, { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves an aggregated summary of bots HTTP requests grouped by the specified * dimension. * * @example * ```ts * const response = await client.radar.bots.summary('BOT'); * ``` */ summary(dimension, query = {}, options) { return this._client.get(path `/radar/bots/summary/${dimension}`, { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves bots HTTP request volume over time. * * @example * ```ts * const response = await client.radar.bots.timeseries(); * ``` */ timeseries(query = {}, options) { return this._client.get('/radar/bots/timeseries', { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Retrieves the distribution of HTTP requests from bots, grouped by the specified * dimension over time. * * @example * ```ts * const response = await client.radar.bots.timeseriesGroups( * 'BOT', * ); * ``` */ timeseriesGroups(dimension, query = {}, options) { return this._client.get(path `/radar/bots/timeseries_groups/${dimension}`, { query, ...options, })._thenUnwrap((obj) => obj.result); } } BaseBots._key = Object.freeze(['radar', 'bots']); return BaseBots; })(); export var Bots = /* @__PURE__ */ (() => { class Bots extends BaseBots { constructor() { super(...arguments); this.webCrawlers = new WebCrawlersAPI.WebCrawlers(this._client); } } Bots.WebCrawlers = WebCrawlers; Bots.BaseWebCrawlers = BaseWebCrawlers; return Bots; })(); //# sourceMappingURL=bots.mjs.map