-
Notifications
You must be signed in to change notification settings - Fork 9
OpenMeteoClient
AlienDwarf edited this page Sep 5, 2022
·
4 revisions
Handles communication with the Open-Meteo API.
public class OpenMeteoClient
public OpenMeteoClient()
Type | Name | Description |
---|
Gets weather data of a given location
public async Task<WeatherForecast?> QueryAsync(string location)
Type | Name | Description |
---|---|---|
string |
location | Name of the location to search for |
Type | Description |
---|---|
Task<WeatherForecast?> |
Awaitable Task of Weather data for the given location or Task<null> if there was an error |
Performs two GET-Requests (first geocoding api for latitude,longitude, then weather forecast) to get weather data of a location
public async Task<WeatherForecast?> QueryAsync(GeocodingOptions options)
Type | Name | Description |
---|---|---|
GeocodingOptions |
options | Geocoding options |
Type | Description |
---|---|
Task<WeatherForecast?> |
Awaitable Task of Weather data for the given location or Task<null> if there was an error |
Performs one GET-Request to get weather data for a given location
public async Task<WeatherForecast?> QueryAsync(WeatherForecastOptions options)
Type | Name | Description |
---|---|---|
WeatherForecastOptions |
options | options object |
Type | Description |
---|---|
Task<WeatherForecast?> |
Awaitable Task of Weather data for the given location or Task<null> if there was an error |
Performs one GET-Request to get weather data for a given location
public async Task<WeatherForecast?> QueryAsync(float latitude, float longitude)
Type | Name | Description |
---|---|---|
float |
latitude | Geographical WGS84 coordinate of the location |
float |
longitude | Geographical WGS84 coordinate of the location |
Type | Description |
---|---|
Task<WeatherForecast?> |
Awaitable Task of Weather data for the given location or Task<null> if there was an error |
Gets Weather Forecast for a given location with individual options
public async Task<WeatherForecast?> QueryAsync(string location, WeatherForecastOptions options)
Type | Name | Description |
---|---|---|
string |
location | name of a location/city to search for |
WeatherForecastOptions |
options | options object |
Type | Description |
---|---|
Task<WeatherForecast?> |
Awaitable Task of Weather data for the given location or Task<null> if there was an error |
Gets air quality data for a given location with individual options
public async Task<AirQuality?> QueryAsync(AirQualityOptions options)
Type | Name | Description |
---|---|---|
AirQualityOptions |
options | options object |
Type | Description |
---|---|
Task<AirQuality?> |
Awaitable Task of air quality data for the given location or Task<null> if there was an error |
Performs one GET-Request to Open-Meteo Geocoding API
public async Task<GeocodingApiResponse?> GetLocationDataAsync(string location)
Type | Name | Description |
---|---|---|
string |
location | Name of a location or city |
Type | Description |
---|---|
Task<GeocodingApiResponse?> |
Awaitable Task of Geocoding data for the given location or Task<null> if there was an error |
Performs one GET-Request to Open-Meteo Geocoding API
public async Task<GeocodingApiResponse?> GetLocationDataAsync(GeocodingOptions options)
Type | Name | Description |
---|---|---|
GeocodingOptions |
options | options object |
Type | Description |
---|---|
Task<GeocodingApiResponse?> |
Awaitable Task of Geocoding data for the given location or Task<null> if there was an error |
Performs one GET-Request to get a (float, float) tuple
public async Task<(float latitude, float longitude)?> GetLocationLatitudeLongitudeAsync(string location)
Type | Name | Description |
---|---|---|
string |
location | Name of a location or city |
Type | Description |
---|---|
Task<(float, float)?> |
(latitude, longitude) tuple of the first found location or null if there was an error |