tallgrass/pokemon/species
Types
pub type PokemonSpecies {
PokemonSpecies(
id: Int,
name: String,
order: Int,
gender_rate: Int,
capture_rate: Int,
base_happiness: Int,
is_baby: Bool,
is_legendary: Bool,
is_mythical: Bool,
hatch_counter: Int,
has_gender_differences: Bool,
forms_switchable: Bool,
growth_rate: Resource,
egg_groups: List(Resource),
color: Resource,
shape: Resource,
evolves_from_species: Resource,
generation: Resource,
names: List(Name),
)
}
Constructors
-
PokemonSpecies( id: Int, name: String, order: Int, gender_rate: Int, capture_rate: Int, base_happiness: Int, is_baby: Bool, is_legendary: Bool, is_mythical: Bool, hatch_counter: Int, has_gender_differences: Bool, forms_switchable: Bool, growth_rate: Resource, egg_groups: List(Resource), color: Resource, shape: Resource, evolves_from_species: Resource, generation: Resource, names: List(Name), )
Functions
pub fn fetch(client: Client) -> Result(PaginatedResource, Error)
Fetches a paginated list of pokemon species resources.
Example
let result = species.new() |> species.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(PokemonSpecies, Error)
Fetches a pokemon species given the pokemon species ID.
Example
let result = species.new() |> species.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(PokemonSpecies, Error)
Fetches a pokemon species given the pokemon species name.
Example
let result = species.new() |> species.fetch_by_name("ditto")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(PokemonSpecies, Error)
Fetches a pokemon species given a pokemon species resource.
Example
let client = species.new()
use res <- result.try(client |> species.fetch())
let assert Ok(first) = res.results |> list.first
client |> species.fetch_resource(first)