tallgrass/pokemon/shape

Types

pub type PokemonShape {
  PokemonShape(
    id: Int,
    name: String,
    names: List(Name),
    awesome_names: List(Name),
    pokemon_species: List(Resource),
  )
}

Constructors

  • PokemonShape(
      id: Int,
      name: String,
      names: List(Name),
      awesome_names: List(Name),
      pokemon_species: List(Resource),
    )

Functions

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

Fetches a paginated list of pokemon shape resources.

Example

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

Fetches a pokemon shape given the pokemon shape ID.

Example

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

Fetches a pokemon shape given the pokemon shape name.

Example

let result = shape.new() |> shape.fetch_by_name("ball")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(PokemonShape, Error)

Fetches a pokemon shape given a pokemon shape resource.

Example

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