cloudflare
Version:
The official TypeScript library for the Cloudflare API
43 lines • 1.56 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseLocations = /* @__PURE__ */ (() => {
class BaseLocations extends APIResource {
/**
* Retrieves a list of locations.
*
* @example
* ```ts
* const locations =
* await client.radar.entities.locations.list();
* ```
*/
list(query = {}, options) {
return this._client.get('/radar/entities/locations', { query, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves the requested location information. (A confidence level below `5`
* indicates a low level of confidence in the traffic data - normally this happens
* because Cloudflare has a small amount of traffic from/to this location).
*
* @example
* ```ts
* const location = await client.radar.entities.locations.get(
* 'US',
* );
* ```
*/
get(location, query = {}, options) {
return this._client.get(path `/radar/entities/locations/${location}`, { query, ...options })._thenUnwrap((obj) => obj.result);
}
}
BaseLocations._key = Object.freeze([
'radar',
'entities',
'locations',
]);
return BaseLocations;
})();
export class Locations extends BaseLocations {
}
//# sourceMappingURL=locations.mjs.map