tallgrass/machine

Types

pub type Machine {
  Machine(
    id: Int,
    item: Resource,
    move: Resource,
    version_group: Resource,
  )
}

Constructors

  • Machine(
      id: Int,
      item: Resource,
      move: Resource,
      version_group: Resource,
    )

Functions

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

Fetches a paginated list of machine resources.

Example

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

Fetches a machine given the machine ID.

Example

let result = machine.new() |> machine.fetch_by_id(1)
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(Machine, Error)

Fetches a machine given a machine resource.

Example

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