tallgrass/pokemon/nature

Types

pub type MoveBattleStylePreference {
  MoveBattleStylePreference(
    low_hp_preference: Int,
    high_hp_preference: Int,
    move_battle_style: Resource,
  )
}

Constructors

  • MoveBattleStylePreference(
      low_hp_preference: Int,
      high_hp_preference: Int,
      move_battle_style: Resource,
    )
pub type Nature {
  Nature(
    id: Int,
    name: String,
    decreased_stat: Option(Resource),
    increased_stat: Option(Resource),
    likes_flavor: Option(Resource),
    hates_flavor: Option(Resource),
    pokeathlon_stat_changes: List(NatureStatChange),
    move_battle_style_preferences: List(
      MoveBattleStylePreference,
    ),
    names: List(Name),
  )
}

Constructors

  • Nature(
      id: Int,
      name: String,
      decreased_stat: Option(Resource),
      increased_stat: Option(Resource),
      likes_flavor: Option(Resource),
      hates_flavor: Option(Resource),
      pokeathlon_stat_changes: List(NatureStatChange),
      move_battle_style_preferences: List(MoveBattleStylePreference),
      names: List(Name),
    )
pub type NatureStatChange {
  NatureStatChange(max_change: Int, pokeathlon_stat: Resource)
}

Constructors

  • NatureStatChange(max_change: Int, pokeathlon_stat: Resource)

Functions

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

Fetches a paginated list of pokemon nature resources.

Example

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

Fetches a pokemon nature given the pokemon nature ID.

Example

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

Fetches a pokemon nature given the pokemon nature name.

Example

let result = nature.new() |> nature.fetch_by_name("bold")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(Nature, Error)

Fetches a pokemon nature given a pokemon nature resource.

Example

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