tallgrass/berry/firmness

Types

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

Constructors

  • BerryFirmness(
      id: Int,
      name: String,
      berries: List(Resource),
      names: List(Name),
    )

Functions

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

Fetches a paginated list of berry firmness resources.

Example

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

Fetches a berry firmness given the berry firmness ID.

Example

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

Fetches a berry firmness given the berry firmness name.

Example

let result = firmness.new() |> firmness.fetch_by_name("very-soft")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(BerryFirmness, Error)

Fetches a berry firmness given a berry firmness resource.

Example

let client = firmness.new()
use res <- result.try(client |> firmness.fetch())
let assert Ok(first) = res.results |> list.first
client |> firmness.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