cloudflare
Version:
The official TypeScript library for the Cloudflare API
50 lines • 2.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Geolocations = exports.BaseGeolocations = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../core/resource.js");
const path_1 = require("../../internal/utils/path.js");
var BaseGeolocations = /* @__PURE__ */ (() => {
class BaseGeolocations extends resource_1.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((0, path_1.path) `/radar/geolocations/${geoID}`, { query, ...options })._thenUnwrap((obj) => obj.result);
}
}
BaseGeolocations._key = Object.freeze([
'radar',
'geolocations',
]);
return BaseGeolocations;
})();
exports.BaseGeolocations = BaseGeolocations;
class Geolocations extends BaseGeolocations {
}
exports.Geolocations = Geolocations;
//# sourceMappingURL=geolocations.js.map