An Elixir Pokéapi client
In your mix.exs:
defp deps do
[
{ :dexter, "~> 1.0.0" }
]
endThen run mix deps.get.
Check out the fancy HexDocs here.
First of all, add Dexter to the application function in your mix.exs:
def application do
[applications: [:logger, :dexter]]
endThere's a lot of modules under Dexter that represent each endpoint. See the API documentation or the Hex docs above for possible endpoints and arguments. Note that the endpoints that have a - in then use _ in Dexter.
Request exposes a make function that allows you to write any query, with the full URL or just the endpoint. The other modules use it under the hood.
All queries are cached in a naive, Agent-based cache.
In case of an error, you will get an {:error, message} tuple.
Get info about Bulbasaur:
Dexter.Pokemon.get(1) # Or `Dexter.Pokemon.get("bulbasaur")`Get info about the Master Ball:
Dexter.Item.get(1)You get the idea.
MIT © Juan Soto