OpenWeather_SDK

This library is a small rust wrapper for making requests to the [OpenWeather API]. This library includes:

Query Types Supported

Getting Started

Initialize the library

```rust use openweather_sdk::prelude::{ OpenWeather, Units, Language };

let openweather = OpenWeather::new( "MYPRIVATEAPIKEY".tostring(), Units::Imperial, Language::English ); ```

OneCall Query

```rust let lat = 38.795021; let lon = -77.273300;

let res = openweather.onecall.call(lat, lon).await; let res2 = openweather.onecall.historical(lat, lon, 1606223802).await;

// Select fields openweather.onecall.fields.minutely = false; openweather.onecall.fields.hourly = false; let res4 = openweather.one_call.call(lat, lon).await; ```

Forecast Query

```rust let lat = 38.795021; let lon = -77.273300;

let res = openweather.forecast.call(lat, lon).await; ```

Maps Query

```rust let lat = 38.795021; let lon = -77.273300; let zoom = 1; let xtiles = 1; let ytiles = 1;

let res = openweather.maps.getcloudmap(zoom, xtiles, ytiles).await; let res2 = openweather.maps.getprecipitationmap(zoom, xtiles, ytiles).await; let res3 = openweather.maps.gettemperaturemap(zoom, xtiles, ytiles).await; let res4 = openweather.maps.getwindspeedmap(zoom, xtiles, ytiles).await; let res5 = openweather.maps.getpressuremap(zoom, xtiles, y_tiles).await; ```

Air Pollution Query

```rust let lat = 38.795021; let lon = -77.273300;

let res = openweather.airpollution.getcurrentairpollution(lat, lon).await; let res2 = openweather.airpollution.getforecastairpollution(lat, lon).await;```

let start = 1606223802; let end = 1606482999; let res2 = openweather.airpollution.gethistoricalairpollution(lat, lon, start, end).await; ```

Geocoding Query

```rust let lat = 38.795021; let lon = -77.273300;

let city = "Washington"; let state = "DC"; let country = "US"; let limit = 5;

let res = openweather.geocoding.getgeocoding(city, Some(state), Some(country), limit).await; let res2 = openweather.geocoding.getgeocodingbyzipcode("20001", None).await; let res3 = openweather.geocoding.getlocation_data(lat, lon, limit).await; ```

Dependencies

License

Contributing

Author