# Interface WeatherApi

interface WeatherApi {
getForecasts: (
position: Position,
type: WeatherForecastType,
options?: WeatherReqParams,
) => Promise<WeatherData[]>;
getObservations: (
position: Position,
options?: WeatherReqParams,
) => Promise<WeatherData[]>;
getWarnings: (position: Position) => Promise<WeatherWarning[]>;
register: (pluginId: string, provider: WeatherProvider) => void;
unRegister: (pluginId: string) => void;
}

- Defined in weatherapi.ts:4

##### Index

### Other

register
unRegister

### Weather API

getForecasts
getObservations
getWarnings

## Other

### register

register: (pluginId: string, provider: WeatherProvider) => void

- Defined in weatherapi.ts:5

### unRegister

unRegister: (pluginId: string) => void

- Defined in weatherapi.ts:6

## Weather API

### getForecasts

getForecasts: (
position: Position,
type: WeatherForecastType,
options?: WeatherReqParams,
) => Promise<WeatherData[]>

Retrieves forecast data from the weather provider for the supplied position, forecast type and number of intervals. The returned array of forecasts should be ordered in ascending date order.

#### Type Declaration

- - (
    position: Position,
    type: WeatherForecastType,
    options?: WeatherReqParams,
    ): Promise<WeatherData[]>

  - #### Parameters

    - position: Position

      Location of interest

    - type: WeatherForecastType

      Type of forecast point | daily

    - `Optional` options: WeatherReqParams

      Options

    #### Returns Promise<WeatherData[]>

#### Example

Retrieve point forecast data for the next eight point intervalss

    getForecasts(
      {latitude: 16.34765, longitude: 12.5432},
      'point',
      {maxCount: 8}
    );

    [
        {
            "date": "2024-05-03T06:00:00.259Z",
            "type": "point",
            "outside": { ... }
        },
        {
            "date": "2024-05-03T05:00:00.259Z",
            "type": "point",
            "outside": { ... }
        }
    ]

- Defined in weatherapi.ts:77

### getObservations

getObservations: (
position: Position,
options?: WeatherReqParams,
) => Promise<WeatherData[]>

Retrieves observation data from the weather provider for the supplied position. The returned array of observations should be ordered in descending date order.

#### Type Declaration

- - (position: Position, options?: WeatherReqParams): Promise<WeatherData[]>

  - #### Parameters

    - position: Position

      Location of interest

    - `Optional` options: WeatherReqParams

      Options

    #### Returns Promise<WeatherData[]>

#### Example

     getObservations({latitude: 16.34765, longitude: 12.5432}, {maxCount: 1});

    [
        {
            "date": "2024-05-03T06:00:00.259Z",
            "type": "observation",
            "outside": { ... }
        },
        {
            "date": "2024-05-03T05:00:00.259Z",
            "type": "observation",
            "outside": { ... }
        }
    ]

- Defined in weatherapi.ts:37

### getWarnings

getWarnings: (position: Position) => Promise<WeatherWarning[]>

Retrieves warning data from the weather provider for the supplied position. The returned array of warnings should be ordered in ascending date order.

#### Type Declaration

- - (position: Position): Promise<WeatherWarning[]>

  - #### Parameters

    - position: Position

      Location of interest

    #### Returns Promise<WeatherWarning[]>

#### Example

     getWarnings({latitude: 16.34765, longitude: 12.5432});

    [
      {
        "startTime": "2024-05-03T05:00:00.259Z",
        "endTime": "2024-05-03T08:00:00.702Z",
        "details": "Strong wind warning.",
        "source": "MyWeatherService",
        "type": "Warning"
      }
    ]

- Defined in weatherapi.ts:108