Skip to content
AlienDwarf edited this page Sep 5, 2022 · 4 revisions

Class OpenMeteoClient

Handles communication with the Open-Meteo API.

Inheritance: OpenMeteoClient

Namespace: OpenMeteo

Definition

public class OpenMeteoClient

Constructors

Declaration

public OpenMeteoClient()

Parameters

Type Name Description

Properties

Methods

QueryAsync(string)

Gets weather data of a given location

Declaration

public async Task<WeatherForecast?> QueryAsync(string location)

Parameters

Type Name Description
string location Name of the location to search for

Returns

Type Description
Task<WeatherForecast?> Awaitable Task of Weather data for the given location or Task<null> if there was an error

QueryAsync(GeocodingOptions)

Performs two GET-Requests (first geocoding api for latitude,longitude, then weather forecast) to get weather data of a location

Declaration

public async Task<WeatherForecast?> QueryAsync(GeocodingOptions options)

Parameters

Type Name Description
GeocodingOptions options Geocoding options

Returns

Type Description
Task<WeatherForecast?> Awaitable Task of Weather data for the given location or Task<null> if there was an error

QueryAsync(WeatherForecastOptions)

Performs one GET-Request to get weather data for a given location

Declaration

public async Task<WeatherForecast?> QueryAsync(WeatherForecastOptions options)

Parameters

Type Name Description
WeatherForecastOptions options options object

Returns

Type Description
Task<WeatherForecast?> Awaitable Task of Weather data for the given location or Task<null> if there was an error

QueryAsync(float, float)

Performs one GET-Request to get weather data for a given location

Declaration

public async Task<WeatherForecast?> QueryAsync(float latitude, float longitude)

Parameters

Type Name Description
float latitude Geographical WGS84 coordinate of the location
float longitude Geographical WGS84 coordinate of the location

Returns

Type Description
Task<WeatherForecast?> Awaitable Task of Weather data for the given location or Task<null> if there was an error

QueryAsync(string, WeatherForecastOptions)

Gets Weather Forecast for a given location with individual options

Declaration

public async Task<WeatherForecast?> QueryAsync(string location, WeatherForecastOptions options)

Parameters

Type Name Description
string location name of a location/city to search for
WeatherForecastOptions options options object

Returns

Type Description
Task<WeatherForecast?> Awaitable Task of Weather data for the given location or Task<null> if there was an error

QueryAsync(AirQualityOptions)

Gets air quality data for a given location with individual options

Declaration

public async Task<AirQuality?> QueryAsync(AirQualityOptions options)

Parameters

Type Name Description
AirQualityOptions options options object

Returns

Type Description
Task<AirQuality?> Awaitable Task of air quality data for the given location or Task<null> if there was an error

GetLocationDataAsync(string)

Performs one GET-Request to Open-Meteo Geocoding API

Declaration

public async Task<GeocodingApiResponse?> GetLocationDataAsync(string location)

Parameters

Type Name Description
string location Name of a location or city

Returns

Type Description
Task<GeocodingApiResponse?> Awaitable Task of Geocoding data for the given location or Task<null> if there was an error

GetLocationDataAsync(GeocodingOptions)

Performs one GET-Request to Open-Meteo Geocoding API

Declaration

public async Task<GeocodingApiResponse?> GetLocationDataAsync(GeocodingOptions options)

Parameters

Type Name Description
GeocodingOptions options options object

Returns

Type Description
Task<GeocodingApiResponse?> Awaitable Task of Geocoding data for the given location or Task<null> if there was an error

GetLocationLatitudeLongitudeAsync(string)

Performs one GET-Request to get a (float, float) tuple

Declaration

public async Task<(float latitude, float longitude)?> GetLocationLatitudeLongitudeAsync(string location)

Parameters

Type Name Description
string location Name of a location or city

Returns

Type Description
Task<(float, float)?> (latitude, longitude) tuple of the first found location or null if there was an error