signalk-server
Version:
An implementation of a [Signal K](http://signalk.org) server for boats.
55 lines • 2.25 kB
TypeScript
import { IRouter } from 'express';
import { WithSecurityStrategy } from '../../security';
import { SignalKMessageHub } from '../../app';
import { WeatherProvider, WeatherData, Position, WeatherReqParams, WeatherForecastType } from '@signalk/server-api';
interface WeatherApplication extends WithSecurityStrategy, SignalKMessageHub, IRouter {
}
export declare class WeatherApi {
private app;
private weatherProviders;
private defaultProviderId?;
constructor(app: WeatherApplication);
start(): Promise<void>;
register(pluginId: string, provider: WeatherProvider): void;
unRegister(pluginId: string): void;
/** Server API methods */
/**
* @description Return array of observations for the provided location
* @param position Location for which to retrieve observation data
* @param options Parameters to filter the returned data
*/
getObservations(position: Position, options?: WeatherReqParams): Promise<WeatherData[] | undefined>;
/**
* @description Return array of forecasts for the provided location
* @param position Location for which to retrieve forecast data
* @param type Type of forecast point | daily
* @param options Parameters to filter the returned data
*/
getForecasts(position: Position, type: WeatherForecastType, options?: WeatherReqParams): Promise<WeatherData[]>;
/**
* @description Return array of warnings for the provided location
* @param position Location for which to retrieve warning data
*/
getWarnings(position: Position): Promise<import("@signalk/server-api").WeatherWarning[] | undefined>;
private updateAllowed;
/** @returns 1= OK, 0= invalid location, -1= location not provided */
private checkLocation;
private parseRequest;
private initApiEndpoints;
/** Returns provider to use as data source.
* @param req API request.
*/
private useProvider;
/**
* Parse request.query into weather provider options
* @param query req.query
*/
private parseQueryOptions;
/**
* Ensure the query parameter value is a number
* @param q Query param value
*/
private parseValueAsNumber;
}
export {};
//# sourceMappingURL=index.d.ts.map