Documentation ¶
Index ¶
- type Cache
- type Client
- func (c *Client) GetJSON(url string, v any) error
- func (c *Client) GetLocation(name string) (Location, error)
- func (c *Client) GetLocationArea(areaName string) (LocationArea, error)
- func (c *Client) GetLocations(pageURL *string) (LocationResponse, error)
- func (c *Client) GetPokemon(name string) (Pokemon, error)
- func (c *Client) GetPokemonList(pageURL *string) (PokemonList, error)
- func (c *Client) GetPokemonSpecies(name string) (PokemonSpecies, error)
- func (c *Client) GetSprite(spriteURL string) (image.Image, error)
- func (c *Client) ListLocationAreas(pageURL *string) (LocationAreaResponse, error)
- type Location
- type LocationArea
- type LocationAreaResponse
- type LocationResponse
- type Pokemon
- type PokemonList
- type PokemonSpecies
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) GetJSON ¶
GetJSON is a generic method to make a GET request to the pokeapi and unmarshal the response into the provided interface it also will return cached responses if a http request has already been made
func (*Client) GetLocationArea ¶
func (c *Client) GetLocationArea(areaName string) (LocationArea, error)
func (*Client) GetLocations ¶
func (c *Client) GetLocations(pageURL *string) (LocationResponse, error)
func (*Client) GetPokemonList ¶
func (c *Client) GetPokemonList(pageURL *string) (PokemonList, error)
func (*Client) GetPokemonSpecies ¶
func (c *Client) GetPokemonSpecies(name string) (PokemonSpecies, error)
func (*Client) ListLocationAreas ¶
func (c *Client) ListLocationAreas(pageURL *string) (LocationAreaResponse, error)
type Location ¶
type Location struct { Areas []struct { Name string `json:"name"` URL string `json:"url"` } `json:"areas"` GameIndices []struct { GameIndex int `json:"game_index"` Generation struct { Name string `json:"name"` URL string `json:"url"` } `json:"generation"` } `json:"game_indices"` ID int `json:"id"` Name string `json:"name"` Names []struct { Language struct { Name string `json:"name"` URL string `json:"url"` } `json:"language"` Name string `json:"name"` } `json:"names"` Region struct { Name string `json:"name"` URL string `json:"url"` } `json:"region"` }
type LocationArea ¶
type LocationArea struct { EncounterMethodRates []struct { EncounterMethod struct { Name string `json:"name"` URL string `json:"url"` } `json:"encounter_method"` VersionDetails []struct { Rate int `json:"rate"` Version struct { Name string `json:"name"` URL string `json:"url"` } `json:"version"` } `json:"version_details"` } `json:"encounter_method_rates"` GameIndex int `json:"game_index"` ID int `json:"id"` Location struct { Name string `json:"name"` URL string `json:"url"` } `json:"location"` Name string `json:"name"` Names []struct { Language struct { Name string `json:"name"` URL string `json:"url"` } `json:"language"` Name string `json:"name"` } `json:"names"` PokemonEncounters []struct { Pokemon struct { Name string `json:"name"` URL string `json:"url"` } `json:"pokemon"` VersionDetails []struct { EncounterDetails []struct { Chance int `json:"chance"` ConditionValues []any `json:"condition_values"` MaxLevel int `json:"max_level"` Method struct { Name string `json:"name"` URL string `json:"url"` } `json:"method"` MinLevel int `json:"min_level"` } `json:"encounter_details"` MaxChance int `json:"max_chance"` Version struct { Name string `json:"name"` URL string `json:"url"` } `json:"version"` } `json:"version_details"` } `json:"pokemon_encounters"` }
type LocationAreaResponse ¶
type LocationResponse ¶
type Pokemon ¶
type Pokemon struct { Abilities []struct { Ability struct { Name string `json:"name"` URL string `json:"url"` } `json:"ability"` IsHidden bool `json:"is_hidden"` Slot int `json:"slot"` } `json:"abilities"` BaseExperience int `json:"base_experience"` Cries struct { Latest string `json:"latest"` Legacy string `json:"legacy"` } `json:"cries"` Forms []struct { Name string `json:"name"` URL string `json:"url"` } `json:"forms"` GameIndices []struct { GameIndex int `json:"game_index"` Version struct { Name string `json:"name"` URL string `json:"url"` } `json:"version"` } `json:"game_indices"` Height int `json:"height"` HeldItems []struct { Item struct { Name string `json:"name"` URL string `json:"url"` } `json:"item"` VersionDetails []struct { Rarity int `json:"rarity"` Version struct { Name string `json:"name"` URL string `json:"url"` } `json:"version"` } `json:"version_details"` } `json:"held_items"` ID int `json:"id"` IsDefault bool `json:"is_default"` LocationAreaEncounters string `json:"location_area_encounters"` Moves []struct { Move struct { Name string `json:"name"` URL string `json:"url"` } `json:"move"` VersionGroupDetails []struct { LevelLearnedAt int `json:"level_learned_at"` MoveLearnMethod struct { Name string `json:"name"` URL string `json:"url"` } `json:"move_learn_method"` VersionGroup struct { Name string `json:"name"` URL string `json:"url"` } `json:"version_group"` } `json:"version_group_details"` } `json:"moves"` Name string `json:"name"` Order int `json:"order"` PastAbilities []any `json:"past_abilities"` PastTypes []any `json:"past_types"` Species struct { Name string `json:"name"` URL string `json:"url"` } `json:"species"` Sprites struct { BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale string `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` Other struct { DreamWorld struct { FrontDefault string `json:"front_default"` FrontFemale any `json:"front_female"` } `json:"dream_world"` Home struct { FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"home"` OfficialArtwork struct { FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` } `json:"official-artwork"` Showdown struct { BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale any `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"showdown"` } `json:"other"` Versions struct { GenerationI struct { RedBlue struct { BackDefault string `json:"back_default"` BackGray string `json:"back_gray"` BackTransparent string `json:"back_transparent"` FrontDefault string `json:"front_default"` FrontGray string `json:"front_gray"` FrontTransparent string `json:"front_transparent"` } `json:"red-blue"` Yellow struct { BackDefault string `json:"back_default"` BackGray string `json:"back_gray"` BackTransparent string `json:"back_transparent"` FrontDefault string `json:"front_default"` FrontGray string `json:"front_gray"` FrontTransparent string `json:"front_transparent"` } `json:"yellow"` } `json:"generation-i"` GenerationIi struct { Crystal struct { BackDefault string `json:"back_default"` BackShiny string `json:"back_shiny"` BackShinyTransparent string `json:"back_shiny_transparent"` BackTransparent string `json:"back_transparent"` FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` FrontShinyTransparent string `json:"front_shiny_transparent"` FrontTransparent string `json:"front_transparent"` } `json:"crystal"` Gold struct { BackDefault string `json:"back_default"` BackShiny string `json:"back_shiny"` FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` FrontTransparent string `json:"front_transparent"` } `json:"gold"` Silver struct { BackDefault string `json:"back_default"` BackShiny string `json:"back_shiny"` FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` FrontTransparent string `json:"front_transparent"` } `json:"silver"` } `json:"generation-ii"` GenerationIii struct { Emerald struct { FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` } `json:"emerald"` FireredLeafgreen struct { BackDefault string `json:"back_default"` BackShiny string `json:"back_shiny"` FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` } `json:"firered-leafgreen"` RubySapphire struct { BackDefault string `json:"back_default"` BackShiny string `json:"back_shiny"` FrontDefault string `json:"front_default"` FrontShiny string `json:"front_shiny"` } `json:"ruby-sapphire"` } `json:"generation-iii"` GenerationIv struct { DiamondPearl struct { BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale string `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"diamond-pearl"` HeartgoldSoulsilver struct { BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale string `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"heartgold-soulsilver"` Platinum struct { BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale string `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"platinum"` } `json:"generation-iv"` GenerationV struct { BlackWhite struct { Animated struct { BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale string `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"animated"` BackDefault string `json:"back_default"` BackFemale string `json:"back_female"` BackShiny string `json:"back_shiny"` BackShinyFemale string `json:"back_shiny_female"` FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"black-white"` } `json:"generation-v"` GenerationVi struct { OmegarubyAlphasapphire struct { FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"omegaruby-alphasapphire"` XY struct { FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"x-y"` } `json:"generation-vi"` GenerationVii struct { Icons struct { FrontDefault string `json:"front_default"` FrontFemale any `json:"front_female"` } `json:"icons"` UltraSunUltraMoon struct { FrontDefault string `json:"front_default"` FrontFemale string `json:"front_female"` FrontShiny string `json:"front_shiny"` FrontShinyFemale string `json:"front_shiny_female"` } `json:"ultra-sun-ultra-moon"` } `json:"generation-vii"` GenerationViii struct { Icons struct { FrontDefault string `json:"front_default"` FrontFemale any `json:"front_female"` } `json:"icons"` } `json:"generation-viii"` } `json:"versions"` } `json:"sprites"` Stats []struct { BaseStat int `json:"base_stat"` Effort int `json:"effort"` Stat struct { Name string `json:"name"` URL string `json:"url"` } `json:"stat"` } `json:"stats"` Types []struct { Slot int `json:"slot"` Type struct { Name string `json:"name"` URL string `json:"url"` } `json:"type"` } `json:"types"` Weight int `json:"weight"` }
type PokemonList ¶
type PokemonSpecies ¶
type PokemonSpecies struct { BaseHappiness int `json:"base_happiness"` CaptureRate int `json:"capture_rate"` Color struct { Name string `json:"name"` URL string `json:"url"` } `json:"color"` EggGroups []struct { Name string `json:"name"` URL string `json:"url"` } `json:"egg_groups"` EvolutionChain struct { URL string `json:"url"` } `json:"evolution_chain"` EvolvesFromSpecies any `json:"evolves_from_species"` FlavorTextEntries []struct { FlavorText string `json:"flavor_text"` Language struct { Name string `json:"name"` URL string `json:"url"` } `json:"language"` Version struct { Name string `json:"name"` URL string `json:"url"` } `json:"version"` } `json:"flavor_text_entries"` FormDescriptions []any `json:"form_descriptions"` FormsSwitchable bool `json:"forms_switchable"` GenderRate int `json:"gender_rate"` Genera []struct { Genus string `json:"genus"` Language struct { Name string `json:"name"` URL string `json:"url"` } `json:"language"` } `json:"genera"` Generation struct { Name string `json:"name"` URL string `json:"url"` } `json:"generation"` GrowthRate struct { Name string `json:"name"` URL string `json:"url"` } `json:"growth_rate"` Habitat struct { Name string `json:"name"` URL string `json:"url"` } `json:"habitat"` HasGenderDifferences bool `json:"has_gender_differences"` HatchCounter int `json:"hatch_counter"` ID int `json:"id"` IsBaby bool `json:"is_baby"` IsLegendary bool `json:"is_legendary"` IsMythical bool `json:"is_mythical"` Name string `json:"name"` Names []struct { Language struct { Name string `json:"name"` URL string `json:"url"` } `json:"language"` Name string `json:"name"` } `json:"names"` Order int `json:"order"` PalParkEncounters []struct { Area struct { Name string `json:"name"` URL string `json:"url"` } `json:"area"` BaseScore int `json:"base_score"` Rate int `json:"rate"` } `json:"pal_park_encounters"` PokedexNumbers []struct { EntryNumber int `json:"entry_number"` Pokedex struct { Name string `json:"name"` URL string `json:"url"` } `json:"pokedex"` } `json:"pokedex_numbers"` Shape struct { Name string `json:"name"` URL string `json:"url"` } `json:"shape"` Varieties []struct { IsDefault bool `json:"is_default"` Pokemon struct { Name string `json:"name"` URL string `json:"url"` } `json:"pokemon"` } `json:"varieties"` }
Click to show internal directories.
Click to hide internal directories.