tallgrass/pokemon/form

Types

pub type PokemonForm {
  PokemonForm(
    id: Int,
    name: String,
    order: Int,
    form_order: Int,
    is_default: Bool,
    is_battle_only: Bool,
    is_mega: Bool,
    form_name: String,
    pokemon: Resource,
    types: List(PokemonType),
    version_group: Resource,
  )
}

Constructors

  • PokemonForm(
      id: Int,
      name: String,
      order: Int,
      form_order: Int,
      is_default: Bool,
      is_battle_only: Bool,
      is_mega: Bool,
      form_name: String,
      pokemon: Resource,
      types: List(PokemonType),
      version_group: Resource,
    )

Functions

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

Fetches a paginated list of pokemon form resources.

Example

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

Fetches a pokemon form given the pokemon form ID.

Example

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

Fetches a pokemon form given the pokemon form name.

Example

let result = form.new() |> form.fetch_by_name("arceus-bug")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(PokemonForm, Error)

Fetches a pokemon form given a pokemon form resource.

Example

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