https://github.com/kylesurowiec/swapi-elixir
An API wrapper for https://swapi.co built with Elixir
https://github.com/kylesurowiec/swapi-elixir
api-wrapper elixir swapi
Last synced: 2 months ago
JSON representation
An API wrapper for https://swapi.co built with Elixir
- Host: GitHub
- URL: https://github.com/kylesurowiec/swapi-elixir
- Owner: kylesurowiec
- License: mit
- Created: 2019-08-16T19:42:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-06T15:17:49.000Z (almost 6 years ago)
- Last Synced: 2025-07-08T07:53:08.416Z (6 months ago)
- Topics: api-wrapper, elixir, swapi
- Language: Elixir
- Homepage:
- Size: 13.7 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Swapi
**An API wrapper for https://swapi.co built with Elixir**
## Examples
```elixir
defmodule Examples do
def main() do
# Output:
# A New Hope
# Attack of the Clones
# The Phantom Menace
# ...
Swapi.get_all_films()
|> Enum.each(fn f -> IO.puts("#{f["title"]}") end)
# Output:
# Alderaan
# Yavin IV
# Hoth
# ...
Swapi.get_all_planets()
|> Enum.each(fn p -> IO.puts("#{p["name"]}") end)
# Output:
# Hutt: Huttese
# Yoda's species: Galactic basic
# Trandoshan: Dosh
Swapi.get_all_species()
|> Enum.each(fn s -> IO.puts("#{s["name"]}: #{s["language"]}") end)
end
end
```
## Installation
The package can be installed by adding `swapi_elixir` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:swapi_elixir, "~> 1.0.0"}
]
end
```