[][src]Crate rparif

This lib allow to access Airparif indice pollution API for Ile-de-France (France). It needs an API key to work.

Through the client it allows access to the following endpoints :

  • indice : it provides the global pollution index
  • indiceJour : it returns global and per pollutant indices for previous, current or next day
  • idxville : returns indice and pollutant for given cities for previous, current and next day
  • episode : returns pollution alerts

Examples

Getting and displaying global pollution indices :

use rparif::client::RParifClient;

let client = RParifClient::new("my-api-key");
let indices = client.index()?;
for index in indices.into_iter() {
    println!("{}", index);
}

Fetching pollution alert :

use rparif::client::RParifClient;

let client = RParifClient::new("my-api-key");
let episodes = client.episode()?;
for episode in episodes.into_iter() {
    println!("{}", episode);
}

Modules

client

Client that allow to make request to AirParif services and convert JSON result into objects

error

rparif errors

objects

Several objects used to represent pollution index and alerts

Functions

episode

Convenient function that allow easy to access episode endpoint.
If multiple calls needs to be made to HTTP API, use RParifClient

indice

Convenient function that allow easy to access indice endpoint.
If multiple calls needs to be made to HTTP API, use RParifClient

indice_city

Convenient function that allow easy to access idxville endpoint.
If multiple calls needs to be made to HTTP API, use RParifClient

indice_day

Convenient function that allow easy to access indiceJour endpoint.
If multiple calls needs to be made to HTTP API, use RParifClient