tallgrass/move
Types
pub type Move {
Move(
id: Int,
name: String,
accuracy: Int,
effect_chance: Option(Int),
pp: Int,
priority: Int,
power: Int,
contest_type: Resource,
contest_effect: Resource,
damage_class: Resource,
effect_entries: List(VerboseEffect),
generation: Resource,
names: List(Name),
super_contest_effect: Resource,
target: Resource,
pokemon_type: Resource,
learned_by_pokemon: List(Resource),
flavor_text_entries: List(FlavorTextVersionGroup),
)
}
Constructors
-
Move( id: Int, name: String, accuracy: Int, effect_chance: Option(Int), pp: Int, priority: Int, power: Int, contest_type: Resource, contest_effect: Resource, damage_class: Resource, effect_entries: List(VerboseEffect), generation: Resource, names: List(Name), super_contest_effect: Resource, target: Resource, pokemon_type: Resource, learned_by_pokemon: List(Resource), flavor_text_entries: List(FlavorTextVersionGroup), )
Functions
pub fn fetch(client: Client) -> Result(PaginatedResource, Error)
Fetches a paginated list of move resources.
Example
let result = move.new() |> move.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(Move, Error)
Fetches a move given the move ID.
Example
let result = move.new() |> move.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(Move, Error)
Fetches a move given the move name.
Example
let result = move.new() |> move.fetch_by_name("pound")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(Move, Error)
Fetches a move given a move resource.
Example
let client = move.new()
use res <- result.try(client |> move.fetch())
let assert Ok(first) = res.results |> list.first
client |> move.fetch_resource(first)