tallgrass/move/category

Types

pub type MoveCategory {
  MoveCategory(
    id: Int,
    name: String,
    descriptions: List(Description),
    moves: List(Resource),
  )
}

Constructors

  • MoveCategory(
      id: Int,
      name: String,
      descriptions: List(Description),
      moves: List(Resource),
    )

Functions

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

Fetches a paginated list of move category resources.

Example

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

Fetches a move category given the move category ID.

Example

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

Fetches a move category given the move category name.

Example

let result = category.new() |> category.fetch_by_name("ailment")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(MoveCategory, Error)

Fetches a move category given a move category resource.

Example

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