tallgrass/pokemon/habitat
Types
Functions
pub fn fetch(client: Client) -> Result(PaginatedResource, Error)
Fetches a paginated list of pokemon habitat resources.
Example
let result = habitat.new() |> habitat.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(Habitat, Error)
Fetches a pokemon habitat given the pokemon habitat ID.
Example
let result = habitat.new() |> habitat.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(Habitat, Error)
Fetches a pokemon habitat given the pokemon habitat name.
Example
let result = habitat.new() |> habitat.fetch_by_name("cave")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(Habitat, Error)
Fetches a pokemon habitat given a pokemon habitat resource.
Example
let client = habitat.new()
use res <- result.try(client |> habitat.fetch())
let assert Ok(first) = res.results |> list.first
client |> habitat.fetch_resource(first)