Struct FredClient

Source
pub struct FredClient { /* private fields */ }
Expand description

Persistent client object used to access the FRED API

Each method for the client represents a data endpoint provided by the API and will return a data object representing the response contents.

Implementations§

Source§

impl FredClient

Source

pub fn new() -> Result<FredClient, String>

Creates and initializes a new client object

The client will attempt to load an API key from the environment variable ‘FRED_API_KEY’. If this variable is undefined, the key remains empty.

If a connection cannot be made to the FRED API, it returns Err containing an error message.

use fred_rs::client::FredClient;
 
let mut client = match FredClient::new() {
    Ok(c) => c,
    Err(msg) => {
        println!("{}", msg);
        return
    },
};
Source

pub fn with_key(&mut self, key: &str)

Sets the FRED API key for the client

§Arguments
  • key - The API key generated to access FRED
use fred_rs::client::FredClient;
 
let mut client = match FredClient::new() {
    Ok(c) => c,
    Err(msg) => {
        println!("{}", msg);
        return
    },
};
 
client.with_key("abcdefghijklmnopqrstuvwxyz123456");
Source

pub fn series( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series

§Arguments

series_id - The id for a series [Link]

Source

pub fn series_categories( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series::categories

§Arguments

series_id - The id for a series [Link]

Source

pub fn series_observation( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series::observation

§Arguments

series_id - The id for a series [Link]

Source

pub fn series_release( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series::release

§Arguments

series_id - The id for a series [Link]

Source

pub fn series_tags( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series::tags

§Arguments

series_id - The id for a series [Link]

Source

pub fn series_updates( &mut self, builder: Option<Builder>, ) -> Result<Response, String>

Source

pub fn series_vintagedates( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series::vintagedates

§Arguments

series_id - The id for a series [Link]

See fred_rs::series::search

§Arguments

search_text - The words to match against economic data series [Link]

Source

pub fn series_search_tags( &mut self, series_search_text: &str, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::series::search::tags

§Arguments

series_search_text - The words to match against economic data series [Link]

See fred_rs::series::search::related_tags

§Arguments

series_search_text - The words to match against economic data series [Link]

Source

pub fn tags(&mut self, builder: Option<Builder>) -> Result<Response, String>

Source

pub fn tags_series(&mut self, builder: Builder) -> Result<Response, String>

Source

pub fn related_tags(&mut self, builder: Builder) -> Result<Response, String>

Source

pub fn sources(&mut self, builder: Option<Builder>) -> Result<Response, String>

Source

pub fn source( &mut self, source_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::source

§Arguments

source_id - The id for a source [Link]

Source

pub fn source_releases( &mut self, source_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::source::releases

§Arguments

source_id - The id for a source [Link]

Source

pub fn category(&mut self, category_id: usize) -> Result<Response, String>

See fred_rs::category

§Arguments

category_id - The id for a category [Link]

Source

pub fn category_children( &mut self, category_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::category::children

§Arguments

category_id - The id for a category [Link]

See fred_rs::category::related

§Arguments

category_id - The id for a category [Link]

Source

pub fn category_series( &mut self, category_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::category::series

§Arguments

category_id - The id for a category [Link]

Source

pub fn category_tags( &mut self, category_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::category::tags

§Arguments

category_id - The id for a category [Link]

See fred_rs::category::related_tags

§Arguments

category_id - The id for a category [Link]

Source

pub fn releases(&mut self, builder: Option<Builder>) -> Result<Response, String>

Source

pub fn releases_dates( &mut self, builder: Option<Builder>, ) -> Result<Response, String>

Source

pub fn release( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::release

§Arguments

release_id - The id for a release [Link]

Source

pub fn release_series( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::release::series

§Arguments

release_id - The id for a release [Link]

Source

pub fn release_sources( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::release::sources

§Arguments

release_id - The id for a release [Link]

Source

pub fn release_tags( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::release::tags

§Arguments

release_id - The id for a release [Link]

See fred_rs::release::related_tags

§Arguments

release_id - The id for a release [Link]

Source

pub fn release_tables( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>

See fred_rs::release::tables

§Arguments

release_id - The id for a release [Link]

Trait Implementations§

Source§

impl Clone for FredClient

Source§

fn clone(&self) -> FredClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FredClient

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,