tallgrass/pokemon/pokemon_type

Types

pub type PokemonType {
  PokemonType(
    id: Int,
    name: String,
    damage_relations: PokemonTypeDamageRelations,
    past_damage_relations: List(PokemonTypeDamageRelationsPast),
    game_indices: List(GenerationGameIndex),
    generation: Resource,
    move_damage_class: Resource,
    names: List(Name),
    pokemon: List(TypePokemon),
    moves: List(Resource),
  )
}

Constructors

  • PokemonType(
      id: Int,
      name: String,
      damage_relations: PokemonTypeDamageRelations,
      past_damage_relations: List(PokemonTypeDamageRelationsPast),
      game_indices: List(GenerationGameIndex),
      generation: Resource,
      move_damage_class: Resource,
      names: List(Name),
      pokemon: List(TypePokemon),
      moves: List(Resource),
    )
pub type PokemonTypeDamageRelations {
  PokemonTypeDamageRelations(
    no_damage_to: List(Resource),
    half_damage_to: List(Resource),
    double_damage_to: List(Resource),
    no_damage_from: List(Resource),
    half_damage_from: List(Resource),
    double_damage_from: List(Resource),
  )
}

Constructors

  • PokemonTypeDamageRelations(
      no_damage_to: List(Resource),
      half_damage_to: List(Resource),
      double_damage_to: List(Resource),
      no_damage_from: List(Resource),
      half_damage_from: List(Resource),
      double_damage_from: List(Resource),
    )
pub type PokemonTypeDamageRelationsPast {
  PokemonTypeDamageRelationsPast(
    generation: Resource,
    damage_relations: PokemonTypeDamageRelations,
  )
}

Constructors

  • PokemonTypeDamageRelationsPast(
      generation: Resource,
      damage_relations: PokemonTypeDamageRelations,
    )
pub type TypePokemon {
  TypePokemon(slot: Int, pokemon: Resource)
}

Constructors

  • TypePokemon(slot: Int, pokemon: Resource)

Functions

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

Fetches a paginated list of pokemon type resources.

Example

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

Fetches a pokemon type given the pokemon type ID.

Example

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

Fetches a pokemon type given the pokemon type name.

Example

let result = pokemon_type.new() |> pokemon_type.fetch_by_name("fairy")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(PokemonType, Error)

Fetches a pokemon type given a pokemon type resource.

Example

let client = pokemon_type.new()
use res <- result.try(client |> pokemon_type.fetch())
let assert Ok(first) = res.results |> list.first
client |> pokemon_type.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