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