pub struct Client { /* private fields */ }Expand description
Async Open-Meteo API client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new() -> Self
pub fn new() -> Self
Constructs a client using the public free-tier Open-Meteo forecast API.
Panics only if the crate’s built-in default client configuration is invalid or the internal HTTP client cannot be constructed.
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Starts a custom client builder.
Sourcepub fn forecast(&self, latitude: f64, longitude: f64) -> ForecastBuilder<'_>
pub fn forecast(&self, latitude: f64, longitude: f64) -> ForecastBuilder<'_>
Starts a general forecast request for one coordinate.
Sourcepub fn forecast_batch<I>(&self, locations: I) -> ForecastBatchBuilder<'_>
pub fn forecast_batch<I>(&self, locations: I) -> ForecastBatchBuilder<'_>
Starts a general forecast request for multiple coordinates.
Sourcepub fn forecast_many<I>(&self, locations: I) -> ForecastBatchBuilder<'_>
pub fn forecast_many<I>(&self, locations: I) -> ForecastBatchBuilder<'_>
Alias for Self::forecast_batch.
Sourcepub fn archive(
&self,
latitude: f64,
longitude: f64,
start_date: Date,
end_date: Date,
) -> ArchiveBuilder<'_>
pub fn archive( &self, latitude: f64, longitude: f64, start_date: Date, end_date: Date, ) -> ArchiveBuilder<'_>
Starts an archive request for one coordinate and an inclusive date range.
Sourcepub fn historical_forecast(
&self,
latitude: f64,
longitude: f64,
start_date: Date,
end_date: Date,
) -> HistoricalForecastBuilder<'_>
pub fn historical_forecast( &self, latitude: f64, longitude: f64, start_date: Date, end_date: Date, ) -> HistoricalForecastBuilder<'_>
Starts a historical forecast request for one coordinate and an inclusive date range.
Sourcepub fn previous_runs(
&self,
latitude: f64,
longitude: f64,
) -> PreviousRunsBuilder<'_>
pub fn previous_runs( &self, latitude: f64, longitude: f64, ) -> PreviousRunsBuilder<'_>
Starts a previous model runs request for one coordinate.
Sourcepub fn ensemble(&self, latitude: f64, longitude: f64) -> EnsembleBuilder<'_>
pub fn ensemble(&self, latitude: f64, longitude: f64) -> EnsembleBuilder<'_>
Starts an ensemble forecast request for one coordinate.
Sourcepub fn seasonal(&self, latitude: f64, longitude: f64) -> SeasonalBuilder<'_>
pub fn seasonal(&self, latitude: f64, longitude: f64) -> SeasonalBuilder<'_>
Starts a seasonal forecast request for one coordinate.
Sourcepub fn climate(
&self,
latitude: f64,
longitude: f64,
start_date: Date,
end_date: Date,
) -> ClimateBuilder<'_>
pub fn climate( &self, latitude: f64, longitude: f64, start_date: Date, end_date: Date, ) -> ClimateBuilder<'_>
Starts a climate projection request for one coordinate and an inclusive date range.
Sourcepub fn satellite_radiation(
&self,
latitude: f64,
longitude: f64,
) -> SatelliteRadiationBuilder<'_>
pub fn satellite_radiation( &self, latitude: f64, longitude: f64, ) -> SatelliteRadiationBuilder<'_>
Starts a satellite-radiation request for one coordinate.
Sourcepub fn flood(&self, latitude: f64, longitude: f64) -> FloodBuilder<'_>
pub fn flood(&self, latitude: f64, longitude: f64) -> FloodBuilder<'_>
Starts a flood forecast request for one coordinate.
Sourcepub fn marine(&self, latitude: f64, longitude: f64) -> MarineBuilder<'_>
pub fn marine(&self, latitude: f64, longitude: f64) -> MarineBuilder<'_>
Starts a marine forecast request for one coordinate.
Sourcepub fn air_quality(
&self,
latitude: f64,
longitude: f64,
) -> AirQualityBuilder<'_>
pub fn air_quality( &self, latitude: f64, longitude: f64, ) -> AirQualityBuilder<'_>
Starts an air-quality request for one coordinate.
Sourcepub fn geocode(&self, name: impl Into<String>) -> GeocodingBuilder<'_>
pub fn geocode(&self, name: impl Into<String>) -> GeocodingBuilder<'_>
Starts a geocoding request by place name.
use openmeteo_rs::Client;
let client = Client::new();
let locations = client
.geocode("Zurich")
.count(1)
.language("en")
.send()
.await?;
if let Some(location) = locations.first() {
println!("{}, {}", location.latitude, location.longitude);
}Source§impl Client
impl Client
Sourcepub async fn elevation<I>(&self, points: I) -> Result<Vec<Option<f32>>>
pub async fn elevation<I>(&self, points: I) -> Result<Vec<Option<f32>>>
Looks up elevations for one or more coordinates.
Returned values are metres above sea level and preserve the input
coordinate order. A value is None when Open-Meteo has no elevation
coverage for that coordinate. Open-Meteo accepts at most 100 coordinate
pairs per elevation request.
use openmeteo_rs::Client;
let client = Client::new();
let elevations = client
.elevation([(52.52, 13.41), (47.3769, 8.5417)])
.await?;
assert_eq!(elevations.len(), 2);