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