Replaces the Python fetch_pokeapi.py script with a Go tool that crawls a local PokeAPI instance and writes seed JSON files. Supports caching and special encounter definitions via JSON config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
47 lines
1.4 KiB
Go
47 lines
1.4 KiB
Go
package main
|
|
|
|
// Output JSON structs — identical schema to current Python output.
|
|
|
|
type GameOutput struct {
|
|
Name string `json:"name"`
|
|
Slug string `json:"slug"`
|
|
Generation int `json:"generation"`
|
|
Region string `json:"region"`
|
|
ReleaseYear int `json:"release_year"`
|
|
Color *string `json:"color"`
|
|
}
|
|
|
|
type PokemonOutput struct {
|
|
PokeAPIID int `json:"pokeapi_id"`
|
|
NationalDex int `json:"national_dex"`
|
|
Name string `json:"name"`
|
|
Types []string `json:"types"`
|
|
SpriteURL string `json:"sprite_url"`
|
|
}
|
|
|
|
type EvolutionOutput struct {
|
|
FromPokeAPIID int `json:"from_pokeapi_id"`
|
|
ToPokeAPIID int `json:"to_pokeapi_id"`
|
|
Trigger string `json:"trigger"`
|
|
MinLevel *int `json:"min_level"`
|
|
Item *string `json:"item"`
|
|
HeldItem *string `json:"held_item"`
|
|
Condition *string `json:"condition"`
|
|
}
|
|
|
|
type RouteOutput struct {
|
|
Name string `json:"name"`
|
|
Order int `json:"order"`
|
|
Encounters []EncounterOutput `json:"encounters"`
|
|
Children []RouteOutput `json:"children,omitempty"`
|
|
}
|
|
|
|
type EncounterOutput struct {
|
|
PokeAPIID int `json:"pokeapi_id"`
|
|
PokemonName string `json:"pokemon_name"`
|
|
Method string `json:"method"`
|
|
EncounterRate int `json:"encounter_rate"`
|
|
MinLevel int `json:"min_level"`
|
|
MaxLevel int `json:"max_level"`
|
|
}
|