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