#rest

bin+lib freddo

An opinionated library to access the Federal Reserve of St Louis data API

1 unstable release

0.1.0 May 21, 2022

#182 in #rest

MIT license

32KB
778 lines

Freddo

This is an opinionated library for accessing the Federal Reserve of St Louis data API. It may not implement all the functionalities of the API.

For a like-for-like implementation of the API in Rust, see fred-rs.

Pre-requisites

  • You will need an API key that can be generated here
  • To use the library, store the API key as the environment variable FRED_API_KEY

General structure

  • A client stores the API key and the base URLs that are needed to interact with the API
  • The use of the library starts with the construction of a query
  • Each query belongs to one of the three types:
    • data which obtains the actual observations
    • search which allows the user to search for data series using key words
    • info which obtains the metadata related to a data series
  • Each query has an execute method to carry out the request

lib.rs:

Freddo is an opinionated way to access the Federal Reserve of St. Louis Data API.

Everything starts by instantiating a Query.

There are 3 types of queries.

  1. data: Gets observation data from the API
  2. search: Search for data series via search text
  3. info: Gets metadata associated with a data series

Calling the execute method on a query will send the REST request via a client which stores session parameters and the API key.

Dependencies

~4–16MB
~216K SLoC