Skip to content

Commit

Permalink
Migrate to Spectator v5 (#63)
Browse files Browse the repository at this point in the history
* use spectator v5 endpoint

* add puuid field to spectator response
  • Loading branch information
harmonherring authored May 15, 2024
1 parent d942e20 commit c9173bf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion riot/lol/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const (
endpointSummonerBase = endpointBase + "/summoner/v4"
endpointGetSummonerBySummonerID = endpointSummonerBase + "/summoners/%s"
endpointGetSummonerBy = endpointSummonerBase + "/summoners/by-%s/%s"
endpointSpectatorBase = endpointBase + "/spectator/v4"
endpointSpectatorBase = endpointBase + "/spectator/v5"
endpointGetCurrentGame = endpointSpectatorBase + "/active-games/by-summoner/%s"
endpointGetFeaturedGames = endpointSpectatorBase + "/featured-games"
endpointTournamentStubBase = endpointBase + "/tournament-stub/v4"
Expand Down
1 change: 1 addition & 0 deletions riot/lol/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ type CurrentGameParticipant struct {
Spell1ID int `json:"spell1Id"`
TeamID int `json:"teamId"`
SummonerID string `json:"summonerId"`
PUUID string `json:"puuid"`
}

// GetChampion returns the champion played by this participant
Expand Down
4 changes: 2 additions & 2 deletions riot/lol/spectator.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ type SpectatorClient struct {
}

// GetCurrent returns a currently running game for a summoner
func (s *SpectatorClient) GetCurrent(summonerID string) (*GameInfo, error) {
func (s *SpectatorClient) GetCurrent(puuid string) (*GameInfo, error) {
logger := s.logger().WithField("method", "GetCurrent")
var games GameInfo
if err := s.c.GetInto(fmt.Sprintf(endpointGetCurrentGame, summonerID), &games); err != nil {
if err := s.c.GetInto(fmt.Sprintf(endpointGetCurrentGame, puuid), &games); err != nil {
logger.Debug(err)
return nil, err
}
Expand Down

0 comments on commit c9173bf

Please sign in to comment.