Hey, did you ever want to hold a terry fold?, I got one right here, grab my terry flap.
Elixir client for the Rick and Morty API
The Rick and Morty API (or ShlaAPI) is a RESTful API based on the television show Rick and Morty. You will access to data about hundreds of characters, images, locations and episodes.
To get started check the documentation on rickandmortyapi.com
Add ex_shla
to your list of dependencies in mix.exs
:
def deps do
[
{:ex_shla, "~> 0.1.5"}
]
end
iex> ExShla.info()
%{
characters: "https://rickandmortyapi.com/api/character",
episodes: "https://rickandmortyapi.com/api/episode",
locations: "https://rickandmortyapi.com/api/location"
}
iex> ExShla.character(1)
{:ok, %ExShla.Resource.Character{
created: "2017-11-04T18:48:46.250Z",
episode: [
"https://rickandmortyapi.com/api/episode/1",
...
],
gender: "Male",
id: 1,
image: "https://rickandmortyapi.com/api/character/avatar/1.jpeg",
location: %{
name: "Earth (Replacement Dimension)",
url: "https://rickandmortyapi.com/api/location/20"
},
name: "Rick Sanchez",
origin: %{
name: "Earth (C-137)",
url: "https://rickandmortyapi.com/api/location/1"
},
species: "Human",
status: "Alive",
type: "",
url: "https://rickandmortyapi.com/api/character/1"
}}
iex> ExShla.characters()
{:ok, %{
data: [%ExShla.Resource.Character{}, ...],
meta: %ExShla.Meta{
count: 394,
next: "https://rickandmortyapi.com/api/character/?page=2",
pages: 20,
prev: ""
}
}}
iex> ExShla.episode(1)
{:ok, %ExShla.Resource.Episode{
air_date: "December 2, 2013",
characters: [
"https://rickandmortyapi.com/api/character/1",
...
]
created: "2017-11-10T12:56:33.798Z",
episode: "S01E01",
id: 1,
name: "Pilot",
url: "https://rickandmortyapi.com/api/episode/1"
}}
iex> ExShla.episodes()
{:ok, %{
data: [%ExShla.Resource.Episode{}, ...],
meta: %ExShla.Meta{
count: 31,
next: "https://rickandmortyapi.com/api/episode/?page=2",
pages: 2,
prev: ""
}
}}
iex> ExShla.location(1)
{:ok, %ExShla.Resource.Location{
created: "2017-11-10T12:42:04.162Z",
dimension: "Dimension C-137",
id: 1,
name: "Earth (C-137)",
residents: [
"https://rickandmortyapi.com/api/character/38",
...
],
type: "Planet",
url: "https://rickandmortyapi.com/api/location/1"
}}
iex> ExShla.locations()
{:ok, %{
data: [%ExShla.Resource.Location{}, ...],
meta: %ExShla.Meta{
count: 67,
next: "https://rickandmortyapi.com/api/location/?page=2",
pages: 4,
prev: ""
}
}}