UNPKG

@matheustrres/brasilapi

Version:

Lightweight, easy-to-use & free of dependencies wrapper for BrasilAPI

77 lines (76 loc) 3.6 kB
import { Source } from './source'; import { type Weather, type City, type ListParams, type WeatherForecast, type OceanForecast } from '../typings'; import { type Result } from '../typings/result'; import { Paginator } from '../utils/paginator'; interface ICPTEC { listCities(params?: ListParams): Promise<Result<Paginator<City>>>; listWeatherInCapitals(params?: ListParams): Promise<Result<Paginator<Weather>>>; getAirportWeather(icaoCode: string): Promise<Result<Weather>>; getCity(cityName: string, params?: ListParams): Promise<Result<Paginator<City>>>; getCityWeatherForecast(cityCode: number): Promise<Result<WeatherForecast>>; getCityOceanForecast(cityCode: number): Promise<Result<OceanForecast>>; } /** * Represents the source from BrasilAPI CPTEC's endpoint responses */ export declare class BrasilAPICPTEC extends Source implements ICPTEC { protected readonly URL = "https://brasilapi.com.br/api/cptec/v1"; /** * Lists all the cities with their respective codes in the CPTEC services * * @param {ListParams} [params] - The listing parameters * @param {Number} [params.itemsPerPage] - The limit of items per page * @param {Number} [params.page] - The page number to start with * @param {Number} [params.skip] - The amount of items to skip * @param {Number} [params.take] - The amount of items to take * @returns {Promise<Result<Paginator<City>>>} */ listCities(params?: ListParams): Promise<Result<Paginator<City>>>; /** * Lists the current weather conditions in the country's capitals, * based on the ground stations at their airport * * @param {ListParams} [params] - The listing parameters * @param {Number} [params.itemsPerPage] - The limit of items per page * @param {Number} [params.page] - The page number to start with * @param {Number} [params.skip] - The amount of items to skip * @param {Number} [params.take] - The amount of items to take * @returns {Promise<Result<Paginator<Weather>>>} */ listWeatherInCapitals(params?: ListParams): Promise<Result<Paginator<Weather>>>; /** * Lists all the cities corresponding to the search term along with their * respective codes in the CPTEC services * * @param {String} cityName - The name of the city to search for * @param {ListParams} [params] - The listing parameters * @param {Number} [params.itemsPerPage] - The limit of items per page * @param {Number} [params.page] - The page number to start with * @param {Number} [params.skip] - The amount of items to skip * @param {Number} [params.take] - The amount of items to take * @returns {Promise<Result<Paginator<City>>>} */ getCity(cityName: string, params?: ListParams): Promise<Result<Paginator<City>>>; /** * Gets current weather conditions at an airport * * @param {String} icaoCode - The airport ICAO code * @returns {Promise<Result<Weather>>} */ getAirportWeather(icaoCode: string): Promise<Result<Weather>>; /** * Gets the weather forecast for 1 day in the city entered * * @param {Number} cityCode - The city code * @returns {Promise<Result<WeatherForecast>>} */ getCityWeatherForecast(cityCode: number): Promise<Result<WeatherForecast>>; /** * Gets the ocean forecast for 1 day in the city entered * * @param {Number} cityCode - The city code * @returns {Promise<Result<OceanForecast>>} */ getCityOceanForecast(cityCode: number): Promise<Result<OceanForecast>>; } export {};