tallgrass/pokemon/color
Types
pub type PokemonColor {
PokemonColor(
id: Int,
name: String,
names: List(Name),
pokemon_species: List(Resource),
)
}
Constructors
-
PokemonColor( 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 pokemon color resources.
Example
let result = color.new() |> color.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(PokemonColor, Error)
Fetches a pokemon color given the pokemon color ID.
Example
let result = color.new() |> color.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(PokemonColor, Error)
Fetches a pokemon color given the pokemon color name.
Example
let result = color.new() |> color.fetch_by_name("black")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(PokemonColor, Error)
Fetches a pokemon color given a pokemon color resource.
Example
let client = color.new()
use res <- result.try(client |> color.fetch())
let assert Ok(first) = res.results |> list.first
client |> color.fetch_resource(first)