tallgrass/move/ailment
Types
pub type MoveAilment {
MoveAilment(
id: Int,
name: String,
moves: List(Resource),
names: List(Name),
)
}
Constructors
-
MoveAilment( id: Int, name: String, moves: List(Resource), names: List(Name), )
Functions
pub fn fetch(client: Client) -> Result(PaginatedResource, Error)
Fetches a paginated list of move ailment resources.
Example
let result = ailment.new() |> ailment.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(MoveAilment, Error)
Fetches a move ailment given the move ailment ID.
Example
let result = ailment.new() |> ailment.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(MoveAilment, Error)
Fetches a move ailment given the move ailment name.
Example
let result = ailment.new() |> ailment.fetch_by_name("paralysis")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(MoveAilment, Error)
Fetches a move ailment given a move ailment resource.
Example
let client = ailment.new()
use res <- result.try(client |> ailment.fetch())
let assert Ok(first) = res.results |> list.first
client |> ailment.fetch_resource(first)