pokeapi

package module
v0.0.0-...-6fcebff Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2022 License: MIT Imports: 11 Imported by: 0

README

pokeapi

An API client for pokeapi implemented in Golang.

Installation

go get github.com/atselvan/pokeapi

Go Mod

require github.com/atselvan/pokeapi 

Example

Make a new Client then use the clients methods to access the resources.

package main

import (
	"github.com/atselvan/pokeapi"
)

func main() {
	client := pokeapi.NewClient()
	
	// Get all the berry records.
	result, restErr := client.Resource.Berries()
	if restErr != nil {
		// do something
	}

	// Get a single berry record.
	berry, restErr := client.Berry.Get("1") // Can also be the name of the berry "cheri"
	if restErr != nil {
		// do something
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ability

type Ability struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	IsMainSeries bool   `json:"is_main_series"`
	Generation   struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"generation"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	EffectEntries []struct {
		Effect      string `json:"effect"`
		ShortEffect string `json:"short_effect"`
		Language    struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"effect_entries"`
	EffectChanges []struct {
		VersionGroup struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"version_group"`
		EffectEntries []struct {
			Effect   string `json:"effect"`
			Language struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"language"`
		} `json:"effect_entries"`
	} `json:"effect_changes"`
	FlavorTextEntries []struct {
		FlavorText string `json:"flavor_text"`
		Language   struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
		VersionGroup struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"version_group"`
	} `json:"flavor_text_entries"`
	Pokemon []struct {
		IsHidden bool `json:"is_hidden"`
		Slot     int  `json:"slot"`
		Pokemon  struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokemon"`
	} `json:"pokemon"`
}

Ability provide passive effects for Pokémon in battle or in the over-world. Pokémon have multiple possible abilities but can have only one ability at a time.

type BerriesClient

type BerriesClient interface {
	Get(id ID) (*Berry, *errors.RestErr)
	GetFirmness(id ID) (*BerryFirmness, *errors.RestErr)
	GetFlavour(id ID) (*BerryFlavour, *errors.RestErr)
}

BerriesClient represents the interface that needs to be implemented to perform actions on the berries endpoint.

type Berry

type Berry struct {
	Id               int    `json:"id"`
	Name             string `json:"name"`
	GrowthTime       int    `json:"growth_time"`
	MaxHarvest       int    `json:"max_harvest"`
	NaturalGiftPower int    `json:"natural_gift_power"`
	Size             int    `json:"size"`
	Smoothness       int    `json:"smoothness"`
	SoilDryness      int    `json:"soil_dryness"`
	Firmness         struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"firmness"`
	Flavors []struct {
		Potency int `json:"potency"`
		Flavor  struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"flavor"`
	} `json:"flavors"`
	Item struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"item"`
	NaturalGiftType struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"natural_gift_type"`
}

Berry Berries are small fruits that can provide HP and status condition restoration, stat enhancement, and even damage negation when eaten by Pokémon.

type BerryFirmness

type BerryFirmness struct {
	Id      int    `json:"id"`
	Name    string `json:"name"`
	Berries []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"berries"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

BerryFirmness is the firmness of a berry. Berries can be soft or hard.

type BerryFlavour

type BerryFlavour struct {
	Id      int    `json:"id"`
	Name    string `json:"name"`
	Berries []struct {
		Potency int `json:"potency"`
		Berry   struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"berry"`
	} `json:"berries"`
	ContestType struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"contest_type"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

BerryFlavour determine whether a Pokémon will benefit or suffer from eating a berry based on their nature.

type Characteristic

type Characteristic struct {
	Id             int   `json:"id"`
	GeneModulo     int   `json:"gene_modulo"`
	PossibleValues []int `json:"possible_values"`
	HighestStat    struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"highest_stat"`
	Descriptions []struct {
		Description string `json:"description"`
		Language    struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"descriptions"`
}

Characteristic indicate which stat contains a Pokémon's highest IV. A Pokémon's Characteristic is determined by the remainder of its highest IV divided by 5 (gene_modulo).

type Client

type Client struct {
	CacheSize int

	Resource ResourcesClient
	Berry    BerriesClient
	// contains filtered or unexported fields
}

Client represents the pokeapi client.

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient configures and returns a new pokeapi client. You can override some default configuration using ClientOption.

type ClientOption

type ClientOption func(*Client)

ClientOption to configure API client

func WithCacheSize

func WithCacheSize(cacheSize int) ClientOption

WithCacheSize overrides the default cacheSize

func WithHTTPClient

func WithHTTPClient(client *resty.Client) ClientOption

WithHTTPClient overrides the default http.Client

type ContestEffect

type ContestEffect struct {
	Id            int `json:"id"`
	Appeal        int `json:"appeal"`
	Jam           int `json:"jam"`
	EffectEntries []struct {
		Effect   string `json:"effect"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"effect_entries"`
	FlavorTextEntries []struct {
		FlavorText string `json:"flavor_text"`
		Language   struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"flavor_text_entries"`
}

ContestEffect refer to the effects of moves when used in contests.

type ContestType

type ContestType struct {
	Id          int    `json:"id"`
	Name        string `json:"name"`
	BerryFlavor struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"berry_flavor"`
	Names []struct {
		Name     string `json:"name"`
		Color    string `json:"color"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

ContestType is a category judges used to weigh a Pokémon's condition in Pokémon contests.

type EggGroup

type EggGroup struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
}

EggGroup is a category which determine which Pokémon are able to interbreed. Pokémon may belong to either one or two Egg Groups.

type EncounterCondition

type EncounterCondition struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	Values []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"values"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

EncounterCondition is a condition which affect what Pokémon might appear in the wild, e.g., day or night.

type EncounterConditionValue

type EncounterConditionValue struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	Condition struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"condition"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

EncounterConditionValue is the states that an encounter condition can have, i.e., time of day can be either day or night.

type EncounterMethod

type EncounterMethod struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Order int    `json:"order"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

EncounterMethod is a method by which the player might can encounter Pokémon in the wild, e.g., walking in tall grass.

type EvolutionChain

type EvolutionChain struct {
	Id              int         `json:"id"`
	BabyTriggerItem interface{} `json:"baby_trigger_item"`
	Chain           struct {
		IsBaby  bool `json:"is_baby"`
		Species struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"species"`
		EvolutionDetails interface{} `json:"evolution_details"`
		EvolvesTo        []struct {
			IsBaby  bool `json:"is_baby"`
			Species struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"species"`
			EvolutionDetails []struct {
				Item    interface{} `json:"item"`
				Trigger struct {
					Name string `json:"name"`
					Url  string `json:"url"`
				} `json:"trigger"`
				Gender                interface{} `json:"gender"`
				HeldItem              interface{} `json:"held_item"`
				KnownMove             interface{} `json:"known_move"`
				KnownMoveType         interface{} `json:"known_move_type"`
				Location              interface{} `json:"location"`
				MinLevel              int         `json:"min_level"`
				MinHappiness          interface{} `json:"min_happiness"`
				MinBeauty             interface{} `json:"min_beauty"`
				MinAffection          interface{} `json:"min_affection"`
				NeedsOverworldRain    bool        `json:"needs_overworld_rain"`
				PartySpecies          interface{} `json:"party_species"`
				PartyType             interface{} `json:"party_type"`
				RelativePhysicalStats interface{} `json:"relative_physical_stats"`
				TimeOfDay             string      `json:"time_of_day"`
				TradeSpecies          interface{} `json:"trade_species"`
				TurnUpsideDown        bool        `json:"turn_upside_down"`
			} `json:"evolution_details"`
			EvolvesTo []interface{} `json:"evolves_to"`
		} `json:"evolves_to"`
	} `json:"chain"`
}

EvolutionChain is essentially the family tree of a Pokémon. They start with the lowest stage within a family and detail evolution conditions for each as well as Pokémon they can evolve into up through the hierarchy.

type EvolutionTrigger

type EvolutionTrigger struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
}

EvolutionTrigger is the events and conditions that cause a Pokémon to evolve.

type Gender

type Gender struct {
	Id                    int    `json:"id"`
	Name                  string `json:"name"`
	PokemonSpeciesDetails []struct {
		Rate           int `json:"rate"`
		PokemonSpecies struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokemon_species"`
	} `json:"pokemon_species_details"`
	RequiredForEvolution []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"required_for_evolution"`
}

Gender of a pokemon. Gender was introduced in Generation II for the purposes of breeding Pokémon but can also result in visual differences or even different evolutionary lines.

type Generation

type Generation struct {
	Id         int           `json:"id"`
	Name       string        `json:"name"`
	Abilities  []interface{} `json:"abilities"`
	MainRegion struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"main_region"`
	Moves []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"moves"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
	Types []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"types"`
	VersionGroups []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"version_groups"`
}

Generation is a grouping of the Pokémon games that separates them based on the Pokémon they include. In each generation, a new set of Pokémon, Moves, Abilities and Types that did not exist in the previous generation are released.

type GrowthRate

type GrowthRate struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Formula      string `json:"formula"`
	Descriptions []struct {
		Description string `json:"description"`
		Language    struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"descriptions"`
	Levels []struct {
		Level      int `json:"level"`
		Experience int `json:"experience"`
	} `json:"levels"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
}

GrowthRate is the speed with which Pokémon gain levels through experience.

type HTTPRequestOption

type HTTPRequestOption func(interface{})

HTTPRequestOption to configure API client

type ID

type ID string

func (ID) String

func (id ID) String() string

func (ID) Validate

func (id ID) Validate() *errors.RestErr

type Nature

type Nature struct {
	Id            int    `json:"id"`
	Name          string `json:"name"`
	DecreasedStat struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"decreased_stat"`
	IncreasedStat struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"increased_stat"`
	LikesFlavor struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"likes_flavor"`
	HatesFlavor struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"hates_flavor"`
	PokeathlonStatChanges []struct {
		MaxChange      int `json:"max_change"`
		PokeathlonStat struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokeathlon_stat"`
	} `json:"pokeathlon_stat_changes"`
	MoveBattleStylePreferences []struct {
		LowHpPreference  int `json:"low_hp_preference"`
		HighHpPreference int `json:"high_hp_preference"`
		MoveBattleStyle  struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"move_battle_style"`
	} `json:"move_battle_style_preferences"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

Nature influence how a Pokémon's stats grow.

type PokeathlonStat

type PokeathlonStat struct {
	Id               int    `json:"id"`
	Name             string `json:"name"`
	AffectingNatures struct {
		Increase []struct {
			MaxChange int `json:"max_change"`
			Nature    struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"nature"`
		} `json:"increase"`
		Decrease []struct {
			MaxChange int `json:"max_change"`
			Nature    struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"nature"`
		} `json:"decrease"`
	} `json:"affecting_natures"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

PokeathlonStat is the different attributes of a Pokémon's performance in Pentathlons. In Pentathlons, competitions happen on different courses; one for each of the different Pentathlon stats.

type Pokemon

type Pokemon struct {
	Id             int    `json:"id"`
	Name           string `json:"name"`
	BaseExperience int    `json:"base_experience"`
	Height         int    `json:"height"`
	IsDefault      bool   `json:"is_default"`
	Order          int    `json:"order"`
	Weight         int    `json:"weight"`
	Abilities      []struct {
		IsHidden bool `json:"is_hidden"`
		Slot     int  `json:"slot"`
		Ability  struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"ability"`
	} `json:"abilities"`
	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"`
	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"`
	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"`
			VersionGroup   struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"version_group"`
			MoveLearnMethod struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"move_learn_method"`
		} `json:"version_group_details"`
	} `json:"moves"`
	Species struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"species"`
	Sprites struct {
		BackDefault      string      `json:"back_default"`
		BackFemale       interface{} `json:"back_female"`
		BackShiny        string      `json:"back_shiny"`
		BackShinyFemale  interface{} `json:"back_shiny_female"`
		FrontDefault     string      `json:"front_default"`
		FrontFemale      interface{} `json:"front_female"`
		FrontShiny       string      `json:"front_shiny"`
		FrontShinyFemale interface{} `json:"front_shiny_female"`
		Other            struct {
			DreamWorld struct {
				FrontDefault string      `json:"front_default"`
				FrontFemale  interface{} `json:"front_female"`
			} `json:"dream_world"`
			Home struct {
				FrontDefault     string      `json:"front_default"`
				FrontFemale      interface{} `json:"front_female"`
				FrontShiny       string      `json:"front_shiny"`
				FrontShinyFemale interface{} `json:"front_shiny_female"`
			} `json:"home"`
			OfficialArtwork struct {
				FrontDefault string `json:"front_default"`
			} `json:"official-artwork"`
		} `json:"other"`
		Versions struct {
			GenerationI struct {
				RedBlue struct {
					BackDefault  string `json:"back_default"`
					BackGray     string `json:"back_gray"`
					FrontDefault string `json:"front_default"`
					FrontGray    string `json:"front_gray"`
				} `json:"red-blue"`
				Yellow struct {
					BackDefault  string `json:"back_default"`
					BackGray     string `json:"back_gray"`
					FrontDefault string `json:"front_default"`
					FrontGray    string `json:"front_gray"`
				} `json:"yellow"`
			} `json:"generation-i"`
			GenerationIi struct {
				Crystal struct {
					BackDefault  string `json:"back_default"`
					BackShiny    string `json:"back_shiny"`
					FrontDefault string `json:"front_default"`
					FrontShiny   string `json:"front_shiny"`
				} `json:"crystal"`
				Gold struct {
					BackDefault  string `json:"back_default"`
					BackShiny    string `json:"back_shiny"`
					FrontDefault string `json:"front_default"`
					FrontShiny   string `json:"front_shiny"`
				} `json:"gold"`
				Silver struct {
					BackDefault  string `json:"back_default"`
					BackShiny    string `json:"back_shiny"`
					FrontDefault string `json:"front_default"`
					FrontShiny   string `json:"front_shiny"`
				} `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       interface{} `json:"back_female"`
					BackShiny        string      `json:"back_shiny"`
					BackShinyFemale  interface{} `json:"back_shiny_female"`
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"diamond-pearl"`
				HeartgoldSoulsilver struct {
					BackDefault      string      `json:"back_default"`
					BackFemale       interface{} `json:"back_female"`
					BackShiny        string      `json:"back_shiny"`
					BackShinyFemale  interface{} `json:"back_shiny_female"`
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"heartgold-soulsilver"`
				Platinum struct {
					BackDefault      string      `json:"back_default"`
					BackFemale       interface{} `json:"back_female"`
					BackShiny        string      `json:"back_shiny"`
					BackShinyFemale  interface{} `json:"back_shiny_female"`
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"platinum"`
			} `json:"generation-iv"`
			GenerationV struct {
				BlackWhite struct {
					Animated struct {
						BackDefault      string      `json:"back_default"`
						BackFemale       interface{} `json:"back_female"`
						BackShiny        string      `json:"back_shiny"`
						BackShinyFemale  interface{} `json:"back_shiny_female"`
						FrontDefault     string      `json:"front_default"`
						FrontFemale      interface{} `json:"front_female"`
						FrontShiny       string      `json:"front_shiny"`
						FrontShinyFemale interface{} `json:"front_shiny_female"`
					} `json:"animated"`
					BackDefault      string      `json:"back_default"`
					BackFemale       interface{} `json:"back_female"`
					BackShiny        string      `json:"back_shiny"`
					BackShinyFemale  interface{} `json:"back_shiny_female"`
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"black-white"`
			} `json:"generation-v"`
			GenerationVi struct {
				OmegarubyAlphasapphire struct {
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"omegaruby-alphasapphire"`
				XY struct {
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"x-y"`
			} `json:"generation-vi"`
			GenerationVii struct {
				Icons struct {
					FrontDefault string      `json:"front_default"`
					FrontFemale  interface{} `json:"front_female"`
				} `json:"icons"`
				UltraSunUltraMoon struct {
					FrontDefault     string      `json:"front_default"`
					FrontFemale      interface{} `json:"front_female"`
					FrontShiny       string      `json:"front_shiny"`
					FrontShinyFemale interface{} `json:"front_shiny_female"`
				} `json:"ultra-sun-ultra-moon"`
			} `json:"generation-vii"`
			GenerationViii struct {
				Icons struct {
					FrontDefault string      `json:"front_default"`
					FrontFemale  interface{} `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"`
	PastTypes []struct {
		Generation struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"generation"`
		Types []struct {
			Slot int `json:"slot"`
			Type struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"type"`
		} `json:"types"`
	} `json:"past_types"`
}

Pokemon the creatures that inhabit the world of the Pokemon games. They can be caught using Pokéballs and trained by battling with other Pokemon. Each Pokemon belongs to a specific species but may take on a variant which makes it differ from other Pokemon of the same species, such as base stats, available abilities and typings.

type PokemonColor

type PokemonColor struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
}

PokemonColor is used for sorting Pokémon in a Pokédex. The color listed in the Pokédex is usually the color most apparent or covering each Pokémon's body. No orange category exists; Pokémon that are primarily orange are listed as red or brown.

type PokemonForm

type PokemonForm struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	Order        int    `json:"order"`
	FormOrder    int    `json:"form_order"`
	IsDefault    bool   `json:"is_default"`
	IsBattleOnly bool   `json:"is_battle_only"`
	IsMega       bool   `json:"is_mega"`
	FormName     string `json:"form_name"`
	Pokemon      struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon"`
	Sprites struct {
		BackDefault      string      `json:"back_default"`
		BackFemale       interface{} `json:"back_female"`
		BackShiny        string      `json:"back_shiny"`
		BackShinyFemale  interface{} `json:"back_shiny_female"`
		FrontDefault     string      `json:"front_default"`
		FrontFemale      interface{} `json:"front_female"`
		FrontShiny       string      `json:"front_shiny"`
		FrontShinyFemale interface{} `json:"front_shiny_female"`
	} `json:"sprites"`
	Types []struct {
		Slot int `json:"slot"`
		Type struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"type"`
	} `json:"types"`
	VersionGroup struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"version_group"`
}

PokemonForm Some Pokémon may appear in one of multiple, visually different forms. These differences are purely cosmetic. For variations within a Pokémon species, which do differ in more than just visuals, the 'Pokémon' entity is used to represent such a variety.

type PokemonHabitat

type PokemonHabitat struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
}

PokemonHabitat is generally different terrain Pokémon can be found in but can also be areas designated for rare or legendary Pokémon.

type PokemonShape

type PokemonShape struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	AwesomeNames []struct {
		AwesomeName string `json:"awesome_name"`
		Language    struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"awesome_names"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonSpecies []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokemon_species"`
}

PokemonShape used for sorting Pokémon in a Pokédex.

type PokemonSpecies

type PokemonSpecies struct {
	Id                   int    `json:"id"`
	Name                 string `json:"name"`
	Order                int    `json:"order"`
	GenderRate           int    `json:"gender_rate"`
	CaptureRate          int    `json:"capture_rate"`
	BaseHappiness        int    `json:"base_happiness"`
	IsBaby               bool   `json:"is_baby"`
	IsLegendary          bool   `json:"is_legendary"`
	IsMythical           bool   `json:"is_mythical"`
	HatchCounter         int    `json:"hatch_counter"`
	HasGenderDifferences bool   `json:"has_gender_differences"`
	FormsSwitchable      bool   `json:"forms_switchable"`
	GrowthRate           struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"growth_rate"`
	PokedexNumbers []struct {
		EntryNumber int `json:"entry_number"`
		Pokedex     struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokedex"`
	} `json:"pokedex_numbers"`
	EggGroups []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"egg_groups"`
	Color struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"color"`
	Shape struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"shape"`
	EvolvesFromSpecies struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"evolves_from_species"`
	EvolutionChain struct {
		Url string `json:"url"`
	} `json:"evolution_chain"`
	Habitat    interface{} `json:"habitat"`
	Generation struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"generation"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	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 []struct {
		Description string `json:"description"`
		Language    struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"form_descriptions"`
	Genera []struct {
		Genus    string `json:"genus"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"genera"`
	Varieties []struct {
		IsDefault bool `json:"is_default"`
		Pokemon   struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokemon"`
	} `json:"varieties"`
}

PokemonSpecies is the basis for at least one Pokémon. Attributes of a Pokémon species are shared across all varieties of Pokémon within the species. A good example is Wormadam; Wormadam is the species which can be found in three different varieties, Wormadam-Trash, Wormadam-Sandy and Wormadam-Plant.

type Pokédex

type Pokédex struct {
	Id           int    `json:"id"`
	Name         string `json:"name"`
	IsMainSeries bool   `json:"is_main_series"`
	Descriptions []struct {
		Description string `json:"description"`
		Language    struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"descriptions"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	PokemonEntries []struct {
		EntryNumber    int `json:"entry_number"`
		PokemonSpecies struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokemon_species"`
	} `json:"pokemon_entries"`
	Region struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"region"`
	VersionGroups []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"version_groups"`
}

Pokédex is a handheld electronic encyclopedia device; one which is capable of recording and retaining information of the various Pokémon in a given region except the national dex and some smaller dexes related to portion of a region.

type Resource

type Resource struct {
	Name string `json:"name"`
	Url  string `json:"url"`
}

Resource is a pokeapi resource.

type ResourceApiResp

type ResourceApiResp struct {
	Count    int         `json:"count"`
	Next     interface{} `json:"next"`
	Previous interface{} `json:"previous"`
	Results  []Resource  `json:"results"`
}

ResourceApiResp represents the response received by the pokeapi.

type ResourcesClient

type ResourcesClient interface {
	Berries() (*[]Resource, *errors.RestErr)
	BerryFirmness() (*[]Resource, *errors.RestErr)
	BerryFlavours() (*[]Resource, *errors.RestErr)
	ContestTypes() (*[]Resource, *errors.RestErr)
	ContestEffects() (*[]Resource, *errors.RestErr)
	SuperContestEffects() (*[]Resource, *errors.RestErr)
	EncounterMethods() (*[]Resource, *errors.RestErr)
	EncounterConditions() (*[]Resource, *errors.RestErr)
	EncounterConditionValues() (*[]Resource, *errors.RestErr)
	EvolutionChains() (*[]Resource, *errors.RestErr)
	EvolutionTriggers() (*[]Resource, *errors.RestErr)
	Generations() (*[]Resource, *errors.RestErr)
	Pokedexes() (*[]Resource, *errors.RestErr)
	Version() (*[]Resource, *errors.RestErr)
	VersionGroups() (*[]Resource, *errors.RestErr)
	Abilities() (*[]Resource, *errors.RestErr)
	Characteristics() (*[]Resource, *errors.RestErr)
	EggGroups() (*[]Resource, *errors.RestErr)
	Genders() (*[]Resource, *errors.RestErr)
	GrowthRates() (*[]Resource, *errors.RestErr)
	Natures() (*[]Resource, *errors.RestErr)
	PokeathlonStats() (*[]Resource, *errors.RestErr)
	Pokemons() (*[]Resource, *errors.RestErr)
	PokemonColors() (*[]Resource, *errors.RestErr)
	PokemonForms() (*[]Resource, *errors.RestErr)
	PokemonHabitats() (*[]Resource, *errors.RestErr)
	PokemonShapes() (*[]Resource, *errors.RestErr)
	PokemonSpecies() (*[]Resource, *errors.RestErr)
	Stats() (*[]Resource, *errors.RestErr)
	Types() (*[]Resource, *errors.RestErr)
}

ResourcesClient describes the interface that needs to be implemented in order to fetch various resources from the pokeapi.

type Stat

type Stat struct {
	Id             int    `json:"id"`
	Name           string `json:"name"`
	GameIndex      int    `json:"game_index"`
	IsBattleOnly   bool   `json:"is_battle_only"`
	AffectingMoves struct {
		Increase []struct {
			Change int `json:"change"`
			Move   struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"move"`
		} `json:"increase"`
		Decrease []struct {
			Change int `json:"change"`
			Move   struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"move"`
		} `json:"decrease"`
	} `json:"affecting_moves"`
	AffectingNatures struct {
		Increase []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"increase"`
		Decrease []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"decrease"`
	} `json:"affecting_natures"`
	Characteristics []struct {
		Url string `json:"url"`
	} `json:"characteristics"`
	MoveDamageClass struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"move_damage_class"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
}

Stat determines certain aspects of battles. Each Pokémon has a value for each stat which grows as they gain levels and can be altered momentarily by effects in battles.

type SupperContestEffect

type SupperContestEffect struct {
	Id                int `json:"id"`
	Appeal            int `json:"appeal"`
	FlavorTextEntries []struct {
		FlavorText string `json:"flavor_text"`
		Language   struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"flavor_text_entries"`
	Moves []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"moves"`
}

SupperContestEffect refer to the effects of moves when used in super contests.

type Type

type Type struct {
	Id              int    `json:"id"`
	Name            string `json:"name"`
	DamageRelations struct {
		NoDamageTo []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"no_damage_to"`
		HalfDamageTo []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"half_damage_to"`
		DoubleDamageTo []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"double_damage_to"`
		NoDamageFrom []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"no_damage_from"`
		HalfDamageFrom []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"half_damage_from"`
		DoubleDamageFrom []struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"double_damage_from"`
	} `json:"damage_relations"`
	PastDamageRelations []struct {
		Generation struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"generation"`
		DamageRelations struct {
			NoDamageTo []struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"no_damage_to"`
			HalfDamageTo []struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"half_damage_to"`
			DoubleDamageTo []struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"double_damage_to"`
			NoDamageFrom []struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"no_damage_from"`
			HalfDamageFrom []struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"half_damage_from"`
			DoubleDamageFrom []struct {
				Name string `json:"name"`
				Url  string `json:"url"`
			} `json:"double_damage_from"`
		} `json:"damage_relations"`
	} `json:"past_damage_relations"`
	GameIndices []struct {
		GameIndex  int `json:"game_index"`
		Generation struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"generation"`
	} `json:"game_indices"`
	Generation struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"generation"`
	MoveDamageClass struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"move_damage_class"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	Pokemon []struct {
		Slot    int `json:"slot"`
		Pokemon struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"pokemon"`
	} `json:"pokemon"`
	Moves []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"moves"`
}

Type is the property for Pokémon and their moves. Each type has three properties: which types of Pokémon it is super effective against, which types of Pokémon it is not very effective against, and which types of Pokémon it is completely ineffective against.

type Version

type Version struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Names []struct {
		Name     string `json:"name"`
		Language struct {
			Name string `json:"name"`
			Url  string `json:"url"`
		} `json:"language"`
	} `json:"names"`
	VersionGroup struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"version_group"`
}

Version of the game. e.g., Red, Blue or Yellow.

type VersionGroup

type VersionGroup struct {
	Id         int    `json:"id"`
	Name       string `json:"name"`
	Order      int    `json:"order"`
	Generation struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"generation"`
	MoveLearnMethods []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"move_learn_methods"`
	Pokedexes []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"pokedexes"`
	Regions []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"regions"`
	Versions []struct {
		Name string `json:"name"`
		Url  string `json:"url"`
	} `json:"versions"`
}

VersionGroup categorize highly similar versions of the games.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL