tallgrass/game/version_group
Types
pub type VersionGroup {
VersionGroup(
id: Int,
name: String,
order: Int,
generation: Resource,
move_learn_methods: List(Resource),
pokedexes: List(Resource),
regions: List(Resource),
versions: List(Resource),
)
}
Constructors
-
VersionGroup( id: Int, name: String, order: Int, generation: Resource, move_learn_methods: List(Resource), pokedexes: List(Resource), regions: List(Resource), versions: List(Resource), )
Functions
pub fn fetch(client: Client) -> Result(PaginatedResource, Error)
Fetches a paginated list of version group resources.
Example
let result = version_group.new() |> version_group.fetch()
pub fn fetch_by_id(
client: Client,
id: Int,
) -> Result(VersionGroup, Error)
Fetches a version group given the version group ID.
Example
let result = version_group.new() |> version_group.fetch_by_id(1)
pub fn fetch_by_name(
client: Client,
name: String,
) -> Result(VersionGroup, Error)
Fetches a version group given the version group name.
Example
let result = version_group.new() |> version_group.fetch_by_name("red-blue")
pub fn fetch_resource(
client: Client,
resource: Resource,
) -> Result(VersionGroup, Error)
Fetches a version group given a version group resource.
Example
let client = version_group.new()
use res <- result.try(client |> version_group.fetch())
let assert Ok(first) = res.results |> list.first
client |> version_group.fetch_resource(first)