tallgrass/pokemon/stat
Types
pub type MoveStatAffect {
MoveStatAffect(change: Int, move: Resource)
}
Constructors
-
MoveStatAffect(change: Int, move: Resource)
pub type MoveStatAffectSets {
MoveStatAffectSets(
increase: List(MoveStatAffect),
decrease: List(MoveStatAffect),
)
}
Constructors
-
MoveStatAffectSets( increase: List(MoveStatAffect), decrease: List(MoveStatAffect), )
pub type NatureStatAffectSets {
NatureStatAffectSets(
increase: List(Resource),
decrease: List(Resource),
)
}
Constructors
-
NatureStatAffectSets( increase: List(Resource), decrease: List(Resource), )
pub type Stat {
Stat(
id: Int,
name: String,
game_index: Int,
is_battle_only: Bool,
affecting_moves: MoveStatAffectSets,
affecting_natures: NatureStatAffectSets,
move_damage_class: Resource,
names: List(Name),
)
}
Constructors
-
Stat( id: Int, name: String, game_index: Int, is_battle_only: Bool, affecting_moves: MoveStatAffectSets, affecting_natures: NatureStatAffectSets, move_damage_class: Resource, names: List(Name), )
Functions
pub fn fetch(client: Client) -> Result(PaginatedResource, Error)
Fetches a paginated list of pokemon stat resources.
Example
let result = stat.new() |> stat.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(Stat, Error)
Fetches a pokemon stat given the pokemon stat ID.
Example
let result = stat.new() |> stat.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(Stat, Error)
Fetches a pokemon stat given the pokemon stat name.
Example
let result = stat.new() |> stat.fetch_by_name("attack")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(Stat, Error)
Fetches a pokemon stat given a pokemon stat resource.
Example
let client = stat.new()
use res <- result.try(client |> stat.fetch())
let assert Ok(first) = res.results |> list.first
client |> stat.fetch_resource(first)