Skip to content

Commit c9173bf

Browse files
Migrate to Spectator v5 (#63)
* use spectator v5 endpoint * add puuid field to spectator response
1 parent d942e20 commit c9173bf

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

riot/lol/constants.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const (
3535
endpointSummonerBase = endpointBase + "/summoner/v4"
3636
endpointGetSummonerBySummonerID = endpointSummonerBase + "/summoners/%s"
3737
endpointGetSummonerBy = endpointSummonerBase + "/summoners/by-%s/%s"
38-
endpointSpectatorBase = endpointBase + "/spectator/v4"
38+
endpointSpectatorBase = endpointBase + "/spectator/v5"
3939
endpointGetCurrentGame = endpointSpectatorBase + "/active-games/by-summoner/%s"
4040
endpointGetFeaturedGames = endpointSpectatorBase + "/featured-games"
4141
endpointTournamentStubBase = endpointBase + "/tournament-stub/v4"

riot/lol/model.go

+1
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ type CurrentGameParticipant struct {
604604
Spell1ID int `json:"spell1Id"`
605605
TeamID int `json:"teamId"`
606606
SummonerID string `json:"summonerId"`
607+
PUUID string `json:"puuid"`
607608
}
608609

609610
// GetChampion returns the champion played by this participant

riot/lol/spectator.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ type SpectatorClient struct {
1414
}
1515

1616
// GetCurrent returns a currently running game for a summoner
17-
func (s *SpectatorClient) GetCurrent(summonerID string) (*GameInfo, error) {
17+
func (s *SpectatorClient) GetCurrent(puuid string) (*GameInfo, error) {
1818
logger := s.logger().WithField("method", "GetCurrent")
1919
var games GameInfo
20-
if err := s.c.GetInto(fmt.Sprintf(endpointGetCurrentGame, summonerID), &games); err != nil {
20+
if err := s.c.GetInto(fmt.Sprintf(endpointGetCurrentGame, puuid), &games); err != nil {
2121
logger.Debug(err)
2222
return nil, err
2323
}

0 commit comments

Comments
 (0)