An API of Ice and Fire client for Elixir
This project is unmaintained: I have no interest in maintaining it any more. If you want to take over, let me know at juan@juansoto.me.
In your mix.exs
:
defp deps do
[
{ :maester, "~> 1.0.0" }
]
end
Then run mix deps.get
.
Check out the fancy Hexdocs here.
First of all, add Maester to the application
function in your mix.exs
:
def application do
[applications: [:logger, :maester]]
end
You got three modules under Maester
: Book
, Character
, House
, and Request
. The first three allow you get the respective resources with a by_id
and all
functions. all
takes it optional filters. See the API documentation for possible filters and pass them in as a map.
Request
exposes a make
function that allows you to write any query and a filter map. The other modules use it under the hood.
In case of an error, you will get an {:error, message}
tuple.
For pagination, you can use the API's pagination options as filters, though if you need to find a specific item it's better to use the other filters.
Getting all characters who are female:
Maester.Character.all(%{:gender => "female"})
Getting a house by id:
Maester.House.by_id(378)
Getting the second page of characters:
Maester.Character.all(%{:page => 2})
You get the idea.
MIT © Juan Soto