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