Powered by AppSignal & Oban Pro
Would you like to see your link here? Contact us

Congress Quickstart

livebook/quickstart.livemd

Congress Quickstart

# install the dependency
# in your mix.exs
# defp deps do [
#  {:congress, "~> 0.1.0"}
# ]

congress_root = Path.join(__DIR__, "..")
Mix.install([{:congress, path: congress_root}])

Create a new request reference

Congress uses req, so any additional configuration of the client can be done, for example, using steps.

api_key = System.get_env("LB_CONGRESS_API_KEY")
req = Congress.new(api_key: api_key)

Get a list of the most recent bills from the most recent US Congress.

{:ok, response} = Congress.Bill.bills(req)

Get more information about the first bill in the list:

first = List.first(response.bills)
{:ok, bill} = Congress.Bill.bill(req, first.congress, first.type, first.number)
{:ok, summaries} = Congress.Bill.summaries(req, first.congress, first.type, first.number)