View Source Census.Query (Census v0.3.0)

Struct representing an API query.

Link to this section Summary

Functions

Returns the api url for a given query.

Link to this section Types

@type t() :: %Census.Query{
  client: term(),
  foreach: term(),
  get: term(),
  within: term()
}

Link to this section Functions

@spec url(t()) :: String.t()

Returns the api url for a given query.

Usage:

iex> client = %Census.Client{api_key: "YOUR_API_KEY"}
iex> query = %Census.Query{client: client, get: "NAME", foreach: "COUNTY:*", within: "STATE:55"}
iex> Census.Query.url(query)
"https://api.census.gov/data/2010/dec/sf1?key=YOUR_API_KEY&get=NAME&for=COUNTY:*&in=STATE:55"