cloudflare
Version:
The official TypeScript library for the Cloudflare API
45 lines • 1.83 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 BaseGeolocations = /* @__PURE__ */ (() => {
class BaseGeolocations extends APIResource {
/**
* Retrieves a list of geolocations. Geolocation names can be localized by sending
* an `Accept-Language` HTTP header with a BCP 47 language tag (e.g.,
* `Accept-Language: pt-PT`). The full quality-value chain is supported (e.g.,
* `pt-PT,pt;q=0.9,en;q=0.8`).
*
* @example
* ```ts
* const geolocations = await client.radar.geolocations.list();
* ```
*/
list(query = {}, options) {
return this._client.get('/radar/geolocations', { query, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves the requested Geolocation information. Geolocation names can be
* localized by sending an `Accept-Language` HTTP header with a BCP 47 language tag
* (e.g., `Accept-Language: pt-PT`). The full quality-value chain is supported
* (e.g., `pt-PT,pt;q=0.9,en;q=0.8`).
*
* @example
* ```ts
* const geolocation = await client.radar.geolocations.get(
* '3190509',
* );
* ```
*/
get(geoID, query = {}, options) {
return this._client.get(path `/radar/geolocations/${geoID}`, { query, ...options })._thenUnwrap((obj) => obj.result);
}
}
BaseGeolocations._key = Object.freeze([
'radar',
'geolocations',
]);
return BaseGeolocations;
})();
export class Geolocations extends BaseGeolocations {
}
//# sourceMappingURL=geolocations.mjs.map