observation-js
Version:
A fully-typed TypeScript client for the waarneming.nl API.
36 lines (35 loc) • 952 B
JavaScript
export class Regions {
#client;
/**
* @internal
*/
constructor(client) {
this.#client = client;
}
/**
* Fetches a list of all regions.
* This is a public endpoint and does not require authentication.
*
* @returns A promise that resolves to a list of region objects.
* @throws {ApiError} If the request fails.
*/
async list() {
return this.#client.publicRequest('regions/', {
method: 'GET',
clientCache: true,
});
}
/**
* Fetches a list of all region types.
* This is a public endpoint and does not require authentication.
*
* @returns A promise that resolves to a list of region type objects.
* @throws {ApiError} If the request fails.
*/
async listTypes() {
return this.#client.publicRequest('region-types/', {
method: 'GET',
clientCache: true,
});
}
}