UNPKG

flight-planner

Version:

Plan and route VFR flights

38 lines (37 loc) 1.71 kB
import { MetarStation } from "../index.js"; import RepositoryBase from "../repository.js"; /** * WeatherService class provides methods to manage and retrieve METAR station data. * * @class WeatherService * @property {RepositoryBase<MetarStation>} [repository] - Optional repository for fetching METAR data. */ declare class WeatherService { private repository; /** * Creates a new instance of the WeatherService class. * * @param repository - An optional repository for fetching METAR data. * @returns An instance of the WeatherService class. */ constructor(repository: RepositoryBase<MetarStation>); /** * Finds METAR station(s) by ICAO code(s). * * @param icao - The ICAO code(s) of the METAR station(s) to find. * @returns A promise that resolves to an array of METAR stations, or undefined if none found. * @throws Error if the repository is not set or doesn't support fetchByICAO. */ get(icao: string | string[]): Promise<MetarStation[] | undefined>; /** * Finds the nearest METAR station to the given location. * * @param location - The geographical location to find the nearest METAR station to. * @param radius - The search radius in kilometers (default is 100 km). * @param exclude - An optional array of ICAO codes to exclude from the search. * @returns A promise that resolves to the nearest METAR station, or undefined if not found. * @throws Error if the repository is not set or if no appropriate fetch method is available. */ nearest(location: GeoJSON.Position, radius?: number, exclude?: string[]): Promise<MetarStation | undefined>; } export default WeatherService;