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
impl FredClient
Sourcepub fn new() -> Result<FredClient, String>
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
},
};Sourcepub fn series(
&mut self,
series_id: &str,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn series( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn series_categories(
&mut self,
series_id: &str,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn series_categories( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn series_observation(
&mut self,
series_id: &str,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn series_observation( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn series_release(
&mut self,
series_id: &str,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn series_release( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn series_vintagedates(
&mut self,
series_id: &str,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn series_vintagedates( &mut self, series_id: &str, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn series_search(
&mut self,
search_text: &str,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn series_search( &mut self, 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]
Sourcepub fn source(
&mut self,
source_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn source( &mut self, source_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn source_releases(
&mut self,
source_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn source_releases( &mut self, source_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn category_children(
&mut self,
category_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn category_children( &mut self, category_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn category_series(
&mut self,
category_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn category_series( &mut self, category_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn release(
&mut self,
release_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn release( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn release_series(
&mut self,
release_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn release_series( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Sourcepub fn release_sources(
&mut self,
release_id: usize,
builder: Option<Builder>,
) -> Result<Response, String>
pub fn release_sources( &mut self, release_id: usize, builder: Option<Builder>, ) -> Result<Response, String>
Trait Implementations§
Source§impl Clone for FredClient
impl Clone for FredClient
Source§fn clone(&self) -> FredClient
fn clone(&self) -> FredClient
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FredClient
impl !RefUnwindSafe for FredClient
impl Send for FredClient
impl Sync for FredClient
impl Unpin for FredClient
impl !UnwindSafe for FredClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more