Skip to content

Latest commit

 

History

History
57 lines (36 loc) · 1.14 KB

readme.md

File metadata and controls

57 lines (36 loc) · 1.14 KB

dexter

An Elixir Pokéapi client

Install

In your mix.exs:

defp deps do
  [
    { :dexter, "~> 1.0.0" }
  ]
end

Then run mix deps.get.

Usage

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]]
end

There'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.

Examples

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.

License

MIT © Juan Soto