cloudflare
Version:
The official TypeScript library for the Cloudflare API
91 lines • 3.28 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bots = exports.BaseBots = 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 WebCrawlersAPI = tslib_1.__importStar(require("./web-crawlers.js"));
const web_crawlers_1 = require("./web-crawlers.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseBots = /* @__PURE__ */ (() => {
class BaseBots extends resource_1.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((0, path_1.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((0, path_1.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((0, path_1.path) `/radar/bots/timeseries_groups/${dimension}`, {
query,
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseBots._key = Object.freeze(['radar', 'bots']);
return BaseBots;
})();
exports.BaseBots = BaseBots;
var Bots = /* @__PURE__ */ (() => {
class Bots extends BaseBots {
constructor() {
super(...arguments);
this.webCrawlers = new WebCrawlersAPI.WebCrawlers(this._client);
}
}
Bots.WebCrawlers = web_crawlers_1.WebCrawlers;
Bots.BaseWebCrawlers = web_crawlers_1.BaseWebCrawlers;
return Bots;
})();
exports.Bots = Bots;
//# sourceMappingURL=bots.js.map