Skip to content

Commit c91f5c7

Browse files
fixing pokemon-species call 404 error (#182)
1 parent d635796 commit c91f5c7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

cmd/pokemon/pokemon.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func PokemonCommand() (string, error) {
7676
return output.String(), err
7777
}
7878

79-
pokemonSpeciesStruct, err := connections.PokemonSpeciesApiCall("pokemon-species", pokemonName, connections.APIURL)
79+
pokemonSpeciesStruct, err := connections.PokemonSpeciesApiCall("pokemon-species", pokemonStruct.Species.Name, connections.APIURL)
8080
if err != nil {
8181
output.WriteString(err.Error())
8282
return output.String(), err

structs/structs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ type PokemonJSONStruct struct {
141141
Name string `json:"name"`
142142
} `json:"stat"`
143143
} `json:"stats"`
144+
Species struct {
145+
Name string `json:"name"`
146+
URL string `json:"url"`
147+
} `json:"species"`
144148
}
145149

146150
// PokemonSpeciesJSONStruct pokemon-species endpoint from API

0 commit comments

Comments
 (0)