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