An Elixir Wrapper Library for https://pokeapi.co/
pokedex is a wrapper library for the PokéAPI written in Elixir. It includes requests for all
resources in the PokéAPI-v2 with Cache-Control
in the HTTP headers requests.
In order to manage HTTP requests, it uses Tesla as HTTP client.
- Elixir >= 1.5
- Tesla 1.2.1 (https://github.com/teamon/tesla)
- Jason 1.0.0
Every functions works if the input parameter is a number()
or a number
as a string()
. For those functions that have an endpoint like {id or name}
the input parameter may be also an atom()
or a string()
.
NOTE: Those functions that don't apply the previous cases will be indicated.
For all resources related to berries, the parameter may be atom()
, number()
or string()
.
Berry
iex(1)> {:ok, berry} = Pokedex.Berries.berry(1) # or "1"
iex(2)> {:ok, berry} = Pokedex.Berries.berry(:cheri)
iex(3)> {:ok, berry} = Pokedex.Berries.berry("cheri")
Berry Firmness
iex(1)> {:ok, berry_firmness} = Pokedex.Berries.berry_firmness(1) # or "1"
iex(2)> {:ok, berry_firmness} = Pokedex.Berries.berry_firmness(:very_soft)
iex(3)> {:ok, berry_firmness} = Pokedex.Berries.berry_firmness("very-soft")
Berry Flavor
iex(1)> {:ok, berry_flavor} = Pokedex.Berries.berry_flavor(1) # or "1"
iex(2)> {:ok, berry_flavor} = Pokedex.Berries.berry_flavor(:spicy)
iex(3)> {:ok, berry_flavor} = Pokedex.Berries.berry_flavor("spicy")
For all resources related to contests, the parameter may be number()
or string()
, but only the contest types may be atom()
too.
Contest Type
iex(1)> {:ok, contest_type} = Pokedex.Contests.contest_type(1) # or "1"
iex(2)> {:ok, contest_type} = Pokedex.Contests.contest_type(:cool)
iex(3)> {:ok, contest_type} = Pokedex.Contests.contest_type("cool")
Contest Effect
iex(1)> {:ok, contest_effect} = Pokedex.Contests.contest_effect(1)
iex(2)> {:ok, contest_effect} = Pokedex.Contests.contest_effect("1")
Super Contest Effect
iex(1)> {:ok, super_contest_effect} = Pokedex.Contests.super_contest_effect(1)
iex(2)> {:ok, super_contest_effect} = Pokedex.Contests.super_contest_effect("1")
For all resources related to encounters, the parameter may be atom()
, number()
or string()
.
Encounter Method
iex(1)> {:ok, encounter_method} = Pokedex.Encounters.encounter_method(3) # or "3"
iex(2)> {:ok, encounter_method} = Pokedex.Encounters.encounter_method(:good_rod)
iex(3)> {:ok, encounter_method} = Pokedex.Encounters.encounter_method("good-rod")
Encounter Condition
iex(1)> {:ok, encounter_condition} = Pokedex.Encounters.encouter_condition(1) # or "1"
iex(2)> {:ok, encounter_condition} = Pokedex.Encounters.encouter_condition(:swarm)
iex(3)> {:ok, encounter_condition} = Pokedex.Encounters.encouter_condition("swarm")
Encounter Condition Value
iex(1)> {:ok, enconter_condtion_value} = Pokedex.Encounters.encounter_condition_value(1) # or "1"
iex(2)> {:ok, enconter_condtion_value} = Pokedex.Encounters.encounter_condition_value(:swarm_yes)
iex(3)> {:ok, enconter_condtion_value} = Pokedex.Encounters.encounter_condition_value("swarm-yes")
For all resources related to evolution, the parameter may be number()
or string()
, but only evolution trigger may be atom()
too.
Evolution Chain
iex(1)> {:ok, evolution_chain} = Pokedex.Evolution.evolution_chain(1)
iex(2)> {:ok, evolution_chain} = Pokedex.Evolution.evolution_chain("1")
Evolution Trigger
iex(1)> {:ok, evolution_trigger} = Pokedex.Evolution.evolution_trigger(1) # or "1"
iex(2)> {:ok, evolution_trigger} = Pokedex.Evolution.evolution_trigger(:level_up)
iex(3)> {:ok, evolution_trigger} = Pokedex.Evolution.evolution_trigger("level-up")
For all resources related to games, the parameter may be atom()
, number()
or string()
.
Generation
iex(1)> {:ok, generation} = Pokedex.Games.generation(1) # or "1"
iex(2)> {:ok, generation} = Pokedex.Games.generation(:generation_i)
iex(3)> {:ok, generation} = Pokedex.Games.generation("generation-i")
Pokedex
iex(1)> {:ok, pokedex} = Pokedex.Games.pokedex(1) # or "1"
iex(2)> {:ok, pokedex} = Pokedex.Games.pokedex(:national)
iex(3)> {:ok, pokedex} = Pokedex.Games.pokedex("national")
Version
iex(1)> {:ok, version} = Pokedex.Games.version(1) # or "1"
iex(2)> {:ok, version} = Pokedex.Games.version(:red)
iex(3)> {:ok, version} = Pokedex.Games.version("red")
Version Group
iex(1)> {:ok, version_group} = Pokedex.Games.version_group(1) # or "1"
iex(2)> {:ok, version_group} = Pokedex.Games.version_group(:red_blue)
iex(3)> {:ok, version_group} = Pokedex.Games.version_group("red-blue")
For all resources related to items, the parameter may be atom()
, number()
or string()
.
Item
iex(1)> {:ok, item} = Pokedex.Items.item(1) # or "1"
iex(2)> {:ok, item} = Pokedex.Items.item(:master_ball)
iex(3)> {:ok, item} = Pokedex.Items.item("master-ball")
Item Attribute
iex(1)> {:ok,item_attribute = Pokedex.Items.item_attribute(1) # or "1"
iex(2)> {:ok,item_attribute = Pokedex.Items.item_attribute(:countable)
iex(3)> {:ok,item_attribute = Pokedex.Items.item_attribute("countable")
Item Category
iex(1)> {:ok, item_category} = Pokedex.Items.item_category(1) # or "1"
iex(2)> {:ok, item_category} = Pokedex.Items.item_category(:stat_boosts)
iex(3)> {:ok, item_category} = Pokedex.Items.item_category("stat-boosts")
Item Fling Effect
iex(1)> {:ok, item_fling_effect} = Pokedex.Items.item_fling_effect(1) # or "1"
iex(2)> {:ok, item_fling_effect} = Pokedex.Items.item_fling_effect(:badly_poison)
iex(3)> {:ok, item_fling_effect} = Pokedex.Items.item_fling_effect("badly-poison")
Item Pocket
iex(1)> {:ok, item_pocket} = Pokedex.Items.item_pocket(1) # or "1"
iex(2)> {:ok, item_pocket} = Pokedex.Items.item_pocket(:misc)
iex(3)> {:ok, item_pocket} = Pokedex.Items.item_pocket("misc")
For all resources related to locations, the parameter may be atom()
, number()
or string()
.
Location
iex(1)> {:ok, location} = Pokedex.Locations.location(1) # or "1"
iex(2)> {:ok, location} = Pokedex.Locations.location(:canalave_city)
iex(3)> {:ok, location} = Pokedex.Locations.location("canalave_city")
Location Area
iex(1)> {:ok, location_area} = Pokedex.Locations.location_area(1) # or "1"
iex(2)> {:ok, location_area} = Pokedex.Locations.location_area(:canalave_city_area)
iex(3)> {:ok, location_area} = Pokedex.Locations.location_area("canalave-city-area")
Pal Park Area
iex(1)> {:ok, pal_park_area} = Pokedex.Locations.pal_park_area(1) # or "1"
iex(2)> {:ok, pal_park_area} = Pokedex.Locations.pal_park_area(:forest)
iex(3)> {:ok, pal_park_area} = Pokedex.Locations.pal_park_area("forest")
Region
iex(1)> {:ok, region} = Pokedex.Locations.region(1) # or "1"
iex(2)> {:ok, region} = Pokedex.Locations.region(:kanto)
iex(3)> {:ok, region} = Pokedex.Locations.region("kanto")
For the only resource related to machines, the parameter may be number()
or string()
.
Machine
iex(1)> {:ok, machine} = Pokedex.Machines.machine(1)
iex(2)> {:ok, machine} = Pokedex.Machines.machine("1")
All resources related to moves, with the exception of the move categories, may be atom()
, number()
or string()
. Move categories cannot be atoms.
Move
iex(1)> {:ok, move} = Pokedex.Moves.move(1) # or "1"
iex(2)> {:ok, move} = Pokedex.Moves.move(:pound)
iex(3)> {:ok, move} = Pokedex.Moves.move("pound")
Move Ailment
iex(1)> {:ok, move_ailment} = Pokedex.Moves.move_ailment(1) # or "1"
iex(2)> {:ok, move_ailment} = Pokedex.Moves.move_ailment(:paralysis)
iex(3)> {:ok, move_ailment} = Pokedex.Moves.move_ailment("paralysis")
Move Battle Style
iex(1)> {:ok, move_battle_style} = Pokedex.Moves.move_battle_style(1) # or "1"
iex(2)> {:ok, move_battle_style} = Pokedex.Moves.move_battle_style(:attack)
iex(3)> {:ok, move_battle_style} = Pokedex.Moves.move_battle_style("attack")
Move Category
iex(1)> {:ok,move_category = Pokedex.Moves.move_category(1) # or "1"
iex(2)> {:ok,move_category = Pokedex.Moves.move_category("ailment")
Move Damage Class
iex(1)> {:ok, move_damage_class} = Pokedex.Moves.move_damage_class(2) # or "2"
iex(2)> {:ok, move_damage_class} = Pokedex.Moves.move_damage_class(:physical)
iex(3)> {:ok, move_damage_class} = Pokedex.Moves.move_damage_class("physical")
Move Learn Method
iex(1)> {:ok, move_learn_method} = Pokedex.Moves.move_learn_method(1) # or "1"
iex(2)> {:ok, move_learn_method} = Pokedex.Moves.move_learn_method(:level_up)
iex(3)> {:ok, move_learn_method} = Pokedex.Moves.move_learn_method("leve-up")
Move Target
iex(1)> {:ok, move_target} = Pokedex.Moves.move_target(1) # or "1"
iex(2)> {:ok, move_target} = Pokedex.Moves.move_target(:specific_move)
iex(3)> {:ok, move_target} = Pokedex.Moves.move_target("specific-move")
All resources related to pokemon, with the exception of the characteristics, may be atom()
, number()
or string()
. Characteristics cannot be atoms.
Ability
iex(1)> {:ok, ability} = Pokedex.Pokemon.ability(1) # or "1"
iex(2)> {:ok, ability} = Pokedex.Pokemon.ability(:stench)
iex(3)> {:ok, ability} = Pokedex.Pokemon.ability("stench")
Characteristic
iex(1)> {:ok, characteristic} = Pokedex.Pokemon.characteristic(1)
iex(2)> {:ok, characteristic} = Pokedex.Pokemon.characteristic("1")
Egg Group
iex(1)> {:ok, egg_group} = Pokedex.Pokemon.egg_group(1) # or "1"
iex(2)> {:ok, egg_group} = Pokedex.Pokemon.egg_group(:monster)
iex(3)> {:ok, egg_group} = Pokedex.Pokemon.egg_group("monster")
Gender
iex(1)> {:ok, gender} = Pokedex.Pokemon.gender(1) # or "1"
iex(2)> {:ok, gender} = Pokedex.Pokemon.gender(:female)
iex(3)> {:ok, gender} = Pokedex.Pokemon.gender("female")
Growth Rate
iex(1)> {:ok, growth_rate} = Pokedex.Pokemon.growth_rate(1) # or "1"
iex(2)> {:ok, growth_rate} = Pokedex.Pokemon.growth_rate(:slow)
iex(3)> {:ok, growth_rate} = Pokedex.Pokemon.growth_rate("slow")
Nature
iex(1)> {:ok, nature} = Pokedex.Pokemon.nature(1) # or "1"
iex(2)> {:ok, nature} = Pokedex.Pokemon.nature(:hardy)
iex(3)> {:ok, nature} = Pokedex.Pokemon.nature("hardy")
Pokeathlon Stat
iex(1)> {:ok, pokeathlon_stat} = Pokedex.Pokemon.pokeathlon_stat(1) # or "1"
iex(2)> {:ok, pokeathlon_stat} = Pokedex.Pokemon.pokeathlon_stat(:speed)
iex(3)> {:ok, pokeathlon_stat} = Pokedex.Pokemon.pokeathlon_stat("speed")
Pokemon
iex(1)> {:ok, pokemon} = Pokedex.Pokemon.pokemon(1) # or "1"
iex(2)> {:ok, pokemon} = Pokedex.Pokemon.pokemon(:bulbasaur)
iex(3)> {:ok, pokemon} = Pokedex.Pokemon.pokemon("bulbasaur")
Pokemon Color
iex(1)> {:ok, pokemon_color} = Pokedex.Pokemon.pokemon_color(1) # or "1"
iex(2)> {:ok, pokemon_color} = Pokedex.Pokemon.pokemon_color(:black)
iex(3)> {:ok, pokemon_color} = Pokedex.Pokemon.pokemon_color("black")
Pokemon Form
iex(1)> {:ok, pokemon_form} = Pokedex.Pokemon.pokemon_form(1) # or "1"
iex(2)> {:ok, pokemon_form} = Pokedex.Pokemon.pokemon_form(:bulbasaur)
iex(3)> {:ok, pokemon_form} = Pokedex.Pokemon.pokemon_form("bulbasaur")
Pokemon Habitat
iex(1)> {:ok, pokemon_habitat} = Pokedex.Pokemon.pokemon_habitat(1) # or "1"
iex(2)> {:ok, pokemon_habitat} = Pokedex.Pokemon.pokemon_habitat(:cave)
iex(3)> {:ok, pokemon_habitat} = Pokedex.Pokemon.pokemon_habitat("cave")
Pokemon Shape
iex(1)> {:ok, pokemon_shape} = Pokedex.Pokemon.pokemon_shape(1) # or "1"
iex(2)> {:ok, pokemon_shape} = Pokedex.Pokemon.pokemon_shape(:ball)
iex(3)> {:ok, pokemon_shape} = Pokedex.Pokemon.pokemon_shape("ball")
Pokemon Species
iex(1)> {:ok, pokemon_species} = Pokedex.Pokemon.pokemon_species(1) # or "1"
iex(2)> {:ok, pokemon_species} = Pokedex.Pokemon.pokemon_species(:bulbasaur)
iex(3)> {:ok, pokemon_species} = Pokedex.Pokemon.pokemon_species("bulbasaur")
Stat
iex(1)> {:ok, stat} = Pokedex.Pokemon.stat(1) # or "1"
iex(2)> {:ok, stat} = Pokedex.Pokemon.stat(:hp)
iex(3)> {:ok, stat} = Pokedex.Pokemon.stat("hp")
Type
iex(1)> {:ok, type} = Pokedex.Pokemon.type(1) # or "1"
iex(2)> {:ok, type} = Pokedex.Pokemon.type(:normal)
iex(3)> {:ok, type} = Pokedex.Pokemon.type("normal")
The only resource related to utility may be atom()
, number()
or string()
. Common Models are not
supported.
Language
iex(1)> {:ok, language} = Pokedex.Utility.language(7) # or "7"
iex(2)> {:ok, language} = Pokedex.Utility.language(:es)
iex(3)> {:ok, language} = Pokedex.Utility.language("es")