Elixir Based Star Wars API Wrapper
A simple wrapper for the Star Wars API - Swapi Documentation
Installation
The Hex package can be installed as:
Add
swapi
to your list of dependencies inmix.exs
:def deps do [{:swapi, "~> 0.0.1"}] end
Ensure
swapi
is started before your application:def application do [applications: [:swapi]] end
Usage
Root
# Get the list of resources
iex> Swapi.root
{:ok, {...}}
People
# Get all people
iex> Swapi.people
{:ok, {...}}
# Get single person
iex> Swapi.people(1)
{:ok, {...}}
Films
# Get all films
iex> Swapi.films
{:ok, {...}}
# Get single film
iex> Swapi.films(1)
{:ok, {...}}
Starships
# Get all starships
iex> Swapi.starships
{:ok, {...}}
# Get single starship
iex> Swapi.starships(1)
{:ok, {...}}
Vehicles
# Get all vehicles
iex> Swapi.vehicles
{:ok, {...}}
# Get single vehicle
iex> Swapi.vehicles(1)
{:ok, {...}}
Species
# Get all species
iex> Swapi.species
{:ok, {...}}
# Get single species
iex> Swapi.species(1)
{:ok, {...}}
Planets
# Get all planets
iex> Swapi.planets
{:ok, {...}}
# Get single planet
iex> Swapi.planets(1)
{:ok, {...}}
Schema
# Get the schema for people (all other resources work as well)
iex> Swapi.schema("people")
{:ok, {...}}