[][src]Module fred_rs::client

Functions and definitons related to the persistent client

use fred_rs::client::FredClient;
use fred_rs::series::observation::{Builder, Units, Frequency, Response};
 
// Create the client object
let mut c = match FredClient::new() {
    Ok(c) => c,
    Err(msg) => {
        println!("{}", msg);
        return
    },
};
 
// Create the argument builder
let mut builder = Builder::new();
 
// Set the arguments for the builder
builder
    .observation_start("2000-01-01")
    .units(Units::PCH)
    .frequency(Frequency::M);
 
// Make the request and pass in the builder to apply the arguments
let resp: Response = match c.series_observation("GNPCA", Some(builder)) {
    Ok(resp) => resp,
    Err(msg) => {
        println!("{}", msg);
        return
    },
};

Structs

FredClient

Persistent client object used to access the FRED API