[][src]Struct rparif::client::RParifClient

pub struct RParifClient<'a> { /* fields omitted */ }

Client to call HTTP API

Implementations

impl<'_> RParifClient<'_>[src]

pub fn new(api_key: &str) -> RParifClient[src]

Construct a new client

Arguments

  • api_key - API key to authenticate call

pub fn new_test(api_key: &str) -> RParifClient[src]

Constructor used for test with httpmock. It use http://localhost:5000 as URL to call mock instead of real services

Arguments

  • api_key - any string

pub fn index(&self) -> Result<Vec<Index>, RParifError>[src]

Access global pollution index for previous day, current day and next day through indice endpoint

Errors

pub fn index_day(&self, day: Day) -> Result<Vec<Index>, RParifError>[src]

Retrieve index pollution (global and per pollutant) for a given date (previous day, current or next day) using indiceJour endpoint

Arguments

  • day - Which day to get indices pollution for

Errors

pub fn index_city(&self, cities: Vec<&str>) -> Result<Vec<Index>, RParifError>[src]

Allow to get pollution indices for multiple cities through idxville endpoint.
The indes is the combination of indices for all pollutants listed in index

Arguments

  • cities - List of INSEE city code. See here or here to find corresponding code

Errors

pub fn episode(&self) -> Result<Vec<Episode>, RParifError>[src]

List pollution alert for previous day, current day and next day using episode endpoint

Errors

Trait Implementations

impl<'a> Debug for RParifClient<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for RParifClient<'a>

impl<'a> Send for RParifClient<'a>

impl<'a> Sync for RParifClient<'a>

impl<'a> Unpin for RParifClient<'a>

impl<'a> !UnwindSafe for RParifClient<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.