tallgrass/pokemon/growth_rate

Types

pub type GrowthRate {
  GrowthRate(
    id: Int,
    name: String,
    formula: String,
    descriptions: List(Description),
    levels: List(GrowthRateExperienceLevel),
    pokemon_species: List(Resource),
  )
}

Constructors

  • GrowthRate(
      id: Int,
      name: String,
      formula: String,
      descriptions: List(Description),
      levels: List(GrowthRateExperienceLevel),
      pokemon_species: List(Resource),
    )
pub type GrowthRateExperienceLevel {
  GrowthRateExperienceLevel(level: Int, experience: Int)
}

Constructors

  • GrowthRateExperienceLevel(level: Int, experience: Int)

Functions

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

Fetches a paginated list of pokemon growth rate resources.

Example

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

Fetches a pokemon growth rate given the pokemon growth rate ID.

Example

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

Fetches a pokemon growth rate given the pokemon growth rate name.

Example

let result = growth_rate.new() |> growth_rate.fetch_by_name("slow")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(GrowthRate, Error)

Fetches a pokemon growth rate given a pokemon growth rate resource.

Example

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