tallgrass/berry/flavor

Types

pub type BerryFlavor {
  BerryFlavor(
    id: Int,
    name: String,
    berries: List(FlavorBerryMap),
    contest_type: Resource,
    names: List(Name),
  )
}

Constructors

  • BerryFlavor(
      id: Int,
      name: String,
      berries: List(FlavorBerryMap),
      contest_type: Resource,
      names: List(Name),
    )
pub type FlavorBerryMap {
  FlavorBerryMap(potency: Int, berry: Resource)
}

Constructors

  • FlavorBerryMap(potency: Int, berry: Resource)

Functions

pub fn fetch(client: Client) -> Result(PaginatedResource, Error)

Fetches a paginated list of berry flavor resources.

Example

let result = flavor.new() |> flavor.fetch()
pub fn fetch_by_id(
  client: Client,
  id: Int,
) -> Result(BerryFlavor, Error)

Fetches a berry flavor given the berry flavor ID.

Example

let result = flavor.new() |> flavor.fetch_by_id(1)
pub fn fetch_by_name(
  client: Client,
  name: String,
) -> Result(BerryFlavor, Error)

Fetches a berry flavor given the berry flavor name.

Example

let result = flavor.new() |> flavor.fetch_by_name("spicy")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(BerryFlavor, Error)

Fetches a berry flavor given a berry flavor resource.

Example

let client = flavor.new()
use res <- result.try(client |> flavor.fetch())
let assert Ok(first) = res.results |> list.first
client |> flavor.fetch_resource(first)
pub fn new() -> Client

Creates a new Client. This is a re-export of client.new, for the sake of convenience.

Search Document