tallgrass/pokemon/egg_group

Types

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

Constructors

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

Functions

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

Fetches a paginated list of egg group resources.

Example

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

Fetches a egg group given the egg group ID.

Example

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

Fetches a egg group given the egg group name.

Example

let result = egg_group.new() |> egg_group.fetch_by_name("monster")
pub fn fetch_resource(
  client: Client,
  resource: Resource,
) -> Result(EggGroup, Error)

Fetches a egg group given a egg group resource.

Example

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