tallgrass/pokemon/gender

Types

pub type Gender {
  Gender(
    id: Int,
    name: String,
    pokemon_species_details: List(PokemonSpeciesGender),
    required_for_evolution: List(Resource),
  )
}

Constructors

  • Gender(
      id: Int,
      name: String,
      pokemon_species_details: List(PokemonSpeciesGender),
      required_for_evolution: List(Resource),
    )
pub type PokemonSpeciesGender {
  PokemonSpeciesGender(rate: Int, pokemon_species: Resource)
}

Constructors

  • PokemonSpeciesGender(rate: Int, pokemon_species: Resource)

Functions

pub fn fetch(client: Client) -> Result(PaginatedResource, Error)

Fetches a paginated list of pokemon gender resources.

Example

let result = gender.new() |> gender.fetch()
pub fn fetch_by_id(
  client: Client,
  id: Int,
) -> Result(Gender, Error)

Fetches a pokemon gender given the pokemon gender ID.

Example

let result = gender.new() |> gender.fetch_by_id(1)
pub fn fetch_by_name(
  client: Client,
  name: String,
) -> Result(Gender, Error)

Fetches a pokemon gender given the pokemon gender name.

Example

let result = gender.new() |> gender.fetch_by_name("genderless")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(Gender, Error)

Fetches a pokemon gender given a pokemon gender resource.

Example

let client = gender.new()
use res <- result.try(client |> gender.fetch())
let assert Ok(first) = res.results |> list.first
client |> gender.fetch_resource(first)
pub fn new() -> Client

Creates a new Client. This is a re-export of client.new, for the sake of convenience.

Search Document