tallgrass/move/target

Types

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

Constructors

  • MoveTarget(
      id: Int,
      name: String,
      descriptions: List(Description),
      moves: List(Resource),
      names: List(Name),
    )

Functions

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

Fetches a paginated list of move target resources.

Example

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

Fetches a move target given the move target ID.

Example

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

Fetches a move target given the move target name.

Example

let result = target.new() |> target.fetch_by_name("specific-move")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(MoveTarget, Error)

Fetches a move target given a move target resource.

Example

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