-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlol.go
743 lines (672 loc) · 28.7 KB
/
lol.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
package lol
import (
"fmt"
"io/ioutil"
"net/http"
"strconv"
"github.com/dghubble/sling"
)
// LOL provides methods to interface with lol resource
type LOL struct {
sling *sling.Sling
}
type ChampionInfo struct {
FreeChampionIDs []int `json:"freeChampionIds"`
FreeChampionIDsForNewPlayers []int `json:"freeChampionIdsForNewPlayers"`
MaxNewPlayerLevel int `json:"maxNewPlayerLevel"`
}
type ChampionMasteryDTO struct {
ChampionLevel int `json:"championLevel"`
ChestGranted bool `json:"chestGranted"`
ChampionPoints int `json:"championPoints"`
ChampionPointsSinceLastLevel int `json:"championPointsSinceLastLevel"`
ChampionPointsUntilNextLevel int `json:"championPointsUntilNextLevel"`
SummonerID string `json:"summonerId"`
TokensEarned int `json:"tokensEarned"`
ChampionID int `json:"championId"`
LastPlayTime int64 `json:"lastPlayTime"`
}
type CurrentGameInfo struct {
GameID int64 `json:"gameId"`
GameStartTime int64 `json:"gameStartTime"`
PlatformID string `json:"platformId"`
GameMode string `json:"gameMode"`
MapID int64 `json:"mapId"`
GameType string `json:"gameType"`
BannedChampions []BannedChampion `json:"bannedChampions"`
Observers Observer `json:"observers"`
Participants []CurrentGameParticipant `json:"participants"`
GameLength int64 `json:"gameLength"`
GameQueueConfigID int64 `json:"gameQueueConfigId"`
}
type BannedChampion struct {
PickTurn int `json:"pickTurn"`
ChampionID int64 `json:"championId"`
TeamID int64 `json:"teamId"`
}
type Observer struct {
EncryptionKey string `json:"encryptionKey"`
}
type CurrentGameParticipant struct {
ProfileIconID int64 `json:"profileIconId"`
ChampionID int64 `json:"championId"`
SummonerName string `json:"summonerName"`
GameCustomizationObjects []GameCustomizationObject `json:"gameCustomizationObjects"`
Bot bool `json:"bot"`
Perks Perks `json:"perks"`
Spell2ID int64 `json:"spell2Id"`
Spell1ID int64 `json:"spell1Id"`
TeamID int64 `json:"teamId"`
SummonerID string `json:"summonerId"`
}
type Participant struct {
ProfileIconID int64 `json:"profileIconId"`
ChampionID int64 `json:"championId"`
SummonerName string `json:"summonerName"`
Bot bool `json:"bot"`
Spell2ID int64 `json:"spell2Id"`
Spell1ID int64 `json:"spell1Id"`
TeamID int64 `json:"teamId"`
SummonerID string `json:"summonerId"`
}
type GameCustomizationObject struct {
Category string `json:"category"`
Content string `json:"content"`
}
type Perks struct {
PerkStyle int64 `json:"perkStyle"`
PerkIDs []int64 `json:"perkIds"`
PerkSubStyle int64 `json:"perkSubStyle"`
}
type EntriesParams struct {
Page string `url:"page,omitempty"`
}
type FeaturedGames struct {
ClientRefreshInterval int64 `json:"clientRefreshInterval"`
GameList []FeaturedGameInfo `json:"gameList"`
}
type FeaturedGameInfo struct {
GameID int64 `json:"gameId"`
GameStartTime int64 `json:"gameStartTime"`
PlatformID string `json:"platformId"`
GameMode string `json:"gameMode"`
MapID int64 `json:"mapId"`
GameType string `json:"gameType"`
BannedChampions []BannedChampion `json:"bannedChampions"`
Observers Observer `json:"observers"`
Participants []CurrentGameParticipant `json:"participants"`
GameLength int64 `json:"gameLength"`
GameQueueConfigID int64 `json:"gameQueueConfigId"`
}
type Incident struct {
Active bool `json:"active"`
CreatedAt string `json:"created_at"`
ID int `json:"id"`
Updates []Message `json:"updates"`
}
type LeagueEntryDTO struct {
QueueType string `json:"queueType"`
SummonerName string `json:"summonerName"`
HotStreak bool `json:"hotStreak"`
MiniSeries MiniSeriesDTO `json:"miniSeries"`
Wins int `json:"wins"`
Veteran bool `json:"veteran"`
Losses int `json:"losses"`
Rank string `json:"rank"`
Tier string `json:"tier"`
Inactive bool `json:"inactive"`
FreshBlood bool `json:"freshBlood"`
LeagueID string `json:"leagueId"`
SummonerID string `json:"summonerId"`
LeaguePoints int `json:"leaguePoints"`
}
type LeagueExpEntriesParams struct {
Page string `url:"page,omitempty"`
}
type LeagueItemDTO struct {
SummonerName string `json:"summonerName"`
HotStreak bool `json:"hotStreak"`
MiniSeries MiniSeriesDTO `json:"miniSeries"`
Wins int `json:"wins"`
Veteran bool `json:"veteran"`
Losses int `json:"losses"`
FreshBlood bool `json:"freshBlood"`
Inactive bool `json:"inactive"`
Rank string `json:"rank"`
SummonerID string `json:"summonerId"`
LeaguePoints int `json:"leaguePoints"`
}
type LeagueListDTO struct {
LeagueID string `json:"leagueId"`
Tier string `json:"tier"`
Entries []LeagueItemDTO `json:"entries"`
Queue string `json:"queue"`
Name string `json:"name"`
}
type PlayerDTO struct {
CurrentPlatformID string `json:"currentPlatformId"`
SummonerName string `json:"summonerName"`
MatchHistoryURI string `json:"matchHistoryUri"`
PlatformID string `json:"platformId"`
CurrentAccountID string `json:"currentAccountId"`
ProfileIcon int `json:"profileIcon"`
SummonerID string `json:"summonerId"`
AccountID string `json:"accountId"`
}
type ParticipantIdentityDTO struct {
Player PlayerDTO `json:"player"`
ParticipantID int `json:"participantId"`
}
type TeamBansDTO struct {
PickTurn int `json:"pickTurn"`
ChampionID int `json:"championId"`
}
type TeamStatsDTO struct {
FirstDragon bool `json:"firstDragon"`
Bans []TeamBansDTO `json:"bans"`
FirstInhibitor bool `json:"firstInhibitor"`
Win string `json:"win"`
FirstRiftHerald bool `json:"firstRiftHerald"`
FirstBaron bool `json:"firstBaron"`
BaronKills int `json:"baronKills"`
RiftHeraldKills int `json:"riftHeraldKills"`
FirstBlood bool `json:"firstBlood"`
TeamID int `json:"teamId"`
FirstTower bool `json:"firstTower"`
VilemawKills int `json:"vilemawKills"`
InhibitorKills int `json:"inhibitorKills"`
TowerKills int `json:"towerKills"`
DominionVictoryScore int `json:"dominionVictoryScore"`
DragonKills int `json:"dragonKills"`
}
type ParticipantTimelineDTO struct {
Lane string `json:"lane"`
ParticipantID int `json:"participantId"`
CsDiffPerMinDeltas map[string]float64 `json:"csDiffPerMinDeltas"`
GoldPerMinDeltas map[string]float64 `json:"goldPerMinDeltas"`
XpDiffPerMinDeltas map[string]float64 `json:"xpDiffPerMinDeltas"`
CreepsPerMinDeltas map[string]float64 `json:"creepsPerMinDeltas"`
XpPerMinDeltas map[string]float64 `json:"xpPerMinDeltas"`
Role string `json:"role"`
DamageTakenDiffPerMinDeltas map[string]float64 `json:"damageTakenDiffPerMinDeltas"`
DamageTakenPerMinDeltas map[string]float64 `json:"damageTakenPerMinDeltas"`
}
type ParticipantStatsDTO struct {
NeutralMinionsKilledTeamJungle int `json:"neutralMinionsKilledTeamJungle"`
VisionScore int `json:"visionScore"`
MagicDamageDealtToChampions int `json:"magicDamageDealtToChampions"`
LargestMultiKill int `json:"largestMultiKill"`
TotalTimeCrowdControlDealt int `json:"totalTimeCrowdControlDealt"`
LongestTimeSpentLiving int `json:"longestTimeSpentLiving"`
Perk1Var1 int `json:"perk1Var1"`
Perk1Var3 int `json:"perk1Var3"`
Perk1Var2 int `json:"perk1Var2"`
TripleKills int `json:"tripleKills"`
Perk5 int `json:"perk5"`
Perk4 int `json:"perk4"`
PlayerScore9 int `json:"playerScore9"`
PlayerScore8 int `json:"playerScore8"`
Kills int `json:"kills"`
PlayerScore1 int `json:"playerScore1"`
PlayerScore0 int `json:"playerScore0"`
PlayerScore3 int `json:"playerScore3"`
PlayerScore2 int `json:"playerScore2"`
PlayerScore5 int `json:"playerScore5"`
PlayerScore4 int `json:"playerScore4"`
PlayerScore7 int `json:"playerScore7"`
PlayerScore6 int `json:"playerScore6"`
Perk5Var1 int `json:"perk5Var1"`
Perk5Var3 int `json:"perk5Var3"`
Perk5Var2 int `json:"perk5Var2"`
TotalScoreRank int `json:"totalScoreRank"`
NeutralMinionsKilled int `json:"neutralMinionsKilled"`
StatPerk1 int `json:"statPerk1"`
StatPerk0 int `json:"statPerk0"`
DamageDealtToTurrets int `json:"damageDealtToTurrets"`
PhysicalDamageDealtToChampions int `json:"physicalDamageDealtToChampions"`
DamageDealtToObjectives int `json:"damageDealtToObjectives"`
Perk2Var2 int `json:"perk2Var2"`
Perk2Var3 int `json:"perk2Var3"`
TotalUnitsHealed int `json:"totalUnitsHealed"`
Perk2Var1 int `json:"perk2Var1"`
Perk4Var1 int `json:"perk4Var1"`
TotalDamageTaken int `json:"totalDamageTaken"`
Perk4Var3 int `json:"perk4Var3"`
WardsKilled int `json:"wardsKilled"`
LargestCriticalStrike int `json:"largestCriticalStrike"`
LargestKillingSpree int `json:"largestKillingSpree"`
QuadraKills int `json:"quadraKills"`
MagicDamageDealt int `json:"magicDamageDealt"`
FirstBloodAssist bool `json:"firstBloodAssist"`
Item2 int `json:"item2"`
Item3 int `json:"item3"`
Item0 int `json:"item0"`
Item1 int `json:"item1"`
Item6 int `json:"item6"`
Item4 int `json:"item4"`
Item5 int `json:"item5"`
Perk1 int `json:"perk1"`
Perk0 int `json:"perk0"`
Perk3 int `json:"perk3"`
Perk2 int `json:"perk2"`
Perk3Var3 int `json:"perk3Var3"`
Perk3Var2 int `json:"perk3Var2"`
Perk3Var1 int `json:"perk3Var1"`
DamageSelfMitigated int `json:"damageSelfMitigated"`
MagicalDamageTaken int `json:"magicalDamageTaken"`
Perk0Var2 int `json:"perk0Var2"`
FirstInhibitorKill bool `json:"firstInhibitorKill"`
TrueDamageTaken int `json:"trueDamageTaken"`
Assists int `json:"assists"`
Perk4Var2 int `json:"perk4Var2"`
GoldSpent int `json:"goldSpent"`
TrueDamageDealt int `json:"trueDamageDealt"`
ParticipantID int `json:"participantId"`
PhysicalDamageDealt int `json:"physicalDamageDealt"`
SightWardsBoughtInGame int `json:"sightWardsBoughtInGame"`
TotalDamageDealtToChampions int `json:"totalDamageDealtToChampions"`
PhysicalDamageTaken int `json:"physicalDamageTaken"`
TotalPlayerScore int `json:"totalPlayerScore"`
Win bool `json:"win"`
ObjectivePlayerScore int `json:"objectivePlayerScore"`
TotalDamageDealt int `json:"totalDamageDealt"`
NeutralMinionsKilledEnemyJungle int `json:"neutralMinionsKilledEnemyJungle"`
Deaths int `json:"deaths"`
WardsPlaced int `json:"wardsPlaced"`
PerkPrimaryStyle int `json:"perkPrimaryStyle"`
PerkSubStyle int `json:"perkSubStyle"`
TurretKills int `json:"turretKills"`
FirstBloodKill bool `json:"firstBloodKill"`
TrueDamageDealtToChampions int `json:"trueDamageDealtToChampions"`
GoldEarned int `json:"goldEarned"`
KillingSprees int `json:"killingSprees"`
UnrealKills int `json:"unrealKills"`
FirstTowerAssist bool `json:"firstTowerAssist"`
FirstTowerKill bool `json:"firstTowerKill"`
ChampLevel int `json:"champLevel"`
DoubleKills int `json:"doubleKills"`
InhibitorKills int `json:"inhibitorKills"`
FirstInhibitorAssist bool `json:"firstInhibitorAssist"`
Perk0Var1 int `json:"perk0Var1"`
CombatPlayerScore int `json:"combatPlayerScore"`
Perk0Var3 int `json:"perk0Var3"`
VisionWardsBoughtInGame int `json:"visionWardsBoughtInGame"`
PentaKills int `json:"pentaKills"`
TotalHeal int `json:"totalHeal"`
TotalMinionsKilled int `json:"totalMinionsKilled"`
TimeCCingOthers int `json:"timeCCingOthers"`
StatPerk2 int `json:"statPerk2"`
}
type ParticipantDTO struct {
Spell1ID int `json:"spell1Id"`
ParticipantID int `json:"participantId"`
Timeline ParticipantTimelineDTO `json:"timeline,omitempty"`
Spell2ID int `json:"spell2Id"`
TeamID int `json:"teamId"`
Stats ParticipantStatsDTO `json:"stats"`
ChampionID int `json:"championId"`
Masteries []MasteryDTO `json:"masteries"`
}
type MasteryDTO struct {
MasteryID int
Rank int
}
type MatchDTO struct {
SeasonID int `json:"seasonId"`
QueueID int `json:"queueId"`
GameID int64 `json:"gameId"`
ParticipantIdentities []ParticipantIdentityDTO `json:"participantIdentities"`
GameVersion string `json:"gameVersion"`
PlatformID string `json:"platformId"`
GameMode string `json:"gameMode"`
MapID int `json:"mapId"`
GameType string `json:"gameType"`
Teams []TeamStatsDTO `json:"teams"`
Participants []ParticipantDTO `json:"participants"`
GameDuration int `json:"gameDuration"`
GameCreation int64 `json:"gameCreation"`
}
type MatchTimelineDTO struct {
Frames []MatchFrameDTO `json:"frames"`
FrameInterval int
}
type MatchFrameDTO struct {
Timestamp int `json:"timestamp"`
ParticipantFrames map[string]MatchParicipantDTO `json:"participantFrames"`
Events []MatchEventDTO `json:"events"`
}
type MatchParicipantDTO struct {
TotalGold int `json:"totalGold"`
TeamScore int `json:"teamScore"`
ParticipantID int `json:"participantId"`
Level int `json:"level"`
CurrentGold int `json:"currentGold"`
MinionsKilled int `json:"minionsKilled"`
DominionScore int `json:"dominionScore"`
Position MatchPositionDTO `json:"position"`
XP int `json:"xp"`
JungleMinionsKilled int `json:"jungleMinionsKilled"`
}
type MatchPositionDTO struct {
Y int `json:"y"`
X int `json:"x"`
}
type MatchEventDTO struct {
EventType string `json:"eventType"`
TowerType string `json:"towerType"`
TeamID int `json:"teamId"`
AscendedType string `json:"ascendedType"`
KillerID int `json:"killerId"`
LevelUpType string `json:"levelUpType"`
PointCaptured string `json:"pointCaptured"`
AssistingParticipantIDs []int `json:"assistingParticipantIDs"`
WardType string `json:"wardType"`
MonsterType string `json:"monsterType"`
Type string `json:"type"`
SkillSlot int `json:"skillSlot"`
VictimID int `json:"victimId"`
Timestamp int64 `json:"timestamp"`
AfterID int `json:"afterId"`
MonsterSubType string `json:"monsterSubType"`
LaneType string `json:"laneType"`
ItemID int `json:"itemId"`
ParticipantID int `json:"participantId"`
BuildingType string `json:"buildingType"`
CreatorID int `json:"creatorId"`
Position MatchPositionDTO `json:"position"`
BeforeID int `json:"beforeId"`
}
type MatchlistDTO struct {
Matches []MatchReferenceDTO `json:"matches"`
TotalGames int `json:"totalGames"`
StartIndex int `json:"startIndex"`
EndIndex int `json:"endIndex"`
}
type MatchlistsParams struct {
Champion []int `url:"champion"`
Queue []int `url:"queue"`
Season []int `url:"season"`
EndTime int `url:"endTime"`
BeginTime int `url:"beginTime"`
EndIndex int `url:"endIndex"`
BeginIndex int `url:"beginIndex"`
}
type MatchReferenceDTO struct {
Lane string `json:"lane"`
GameID int `json:"gameId"`
Champion int `json:"champion"`
PlatformID string `json:"platformId"`
Season int `json:"season"`
Queue int `json:"queue"`
Role string `json:"role"`
Timestamp int `json:"timestamp"`
}
type Message struct {
Severity string `json:"severity"`
Author string `json:"author"`
CreatedAt string `json:"created_at"`
Translations []Translation `json:"translations"`
UpdatedAt string `json:"updated_at"`
Content string `json:"content"`
ID string `json:"id"`
}
type MiniSeriesDTO struct {
Progress string `json:"progress"`
Losses int `json:"losses"`
Target int `json:"target"`
Wins int `json:"wins"`
}
type Service struct {
Status string `json:"status"`
Incidents []Incident `json:"incidents"`
Name string `json:"name"`
Slug string `json:"slug"`
}
type ShardStatus struct {
Name string `json:"name"`
RegionTag string `json:"region_tag"`
Hostname string `json:"hostname"`
Services []Service `json:"services"`
Slug string `json:"slug"`
Locales []string `json:"locales"`
}
type SummonerDTO struct {
ProfileIconID int `json:"profileIconId"`
Name string `json:"name"`
Puuid string `json:"puuid"`
SummonerLevel int `json:"summonerLevel"`
AccountID string `json:"accountId"`
ID string `json:"id"`
RevisionDate int64 `json:"revisionDate"`
}
type Translation struct {
Locale string `json:"locale"`
Content string `json:"content"`
UpdatedAt string `json:"updated_at"`
}
// NewLOL returns a new LOL
func NewLOL(sling *sling.Sling) *LOL {
return &LOL{sling: sling.New().Path("lol/")}
}
// AllChampionMastery GET /lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerID}
func (l *LOL) AllChampionMastery(encryptedSummonerID string) (*[]ChampionMasteryDTO, *http.Response, error) {
dtos := new([]ChampionMasteryDTO)
var reqErr error
resp, err := l.sling.Get("champion-mastery/v4/champion-masteries/by-summoner/"+encryptedSummonerID).Receive(dtos, reqErr)
if err != nil {
return nil, resp, err
}
return dtos, resp, reqErr
}
// ChampionMastery GET /lol/champion-mastery/v4/champion-masteries/by-summoner/{encryptedSummonerID}/by-champion/{championID}
func (l *LOL) ChampionMastery(encryptedSummonerID, championID string) (*ChampionMasteryDTO, *http.Response, error) {
dto := new(ChampionMasteryDTO)
var reqErr error
resp, err := l.sling.Get("champion-mastery/v4/champion-masteries/by-summoner/"+encryptedSummonerID+"/by-champion/"+championID).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// MasteryScore GET /lol/champion-mastery/v4/scores/by-summoner/{encryptedSummonerID}
func (l *LOL) MasteryScore(encryptedSummonerID string) (int, *http.Response, error) {
req, err := l.sling.Get("champion-mastery/v4/scores/by-summoner/" + encryptedSummonerID).Request()
if err != nil {
return 0, nil, err
}
resp, err := l.sling.Do(req, nil, nil)
if err != nil {
return 0, resp, err
}
bodyBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return 0, resp, err
}
score, err := strconv.Atoi(string(bodyBytes))
if err != nil {
return 0, resp, err
}
return score, resp, err
}
// ChampionRotations GET /lol/platform/v3/champion-rotations
func (l *LOL) ChampionRotations() (*ChampionInfo, *http.Response, error) {
ci := new(ChampionInfo)
var reqErr error
resp, err := l.sling.Get("platform/v3/champion-rotations").Receive(ci, reqErr)
if err != nil {
return nil, resp, err
}
return ci, resp, reqErr
}
// LeagueExpEntries GET /lol/league-exp/v4/entries/{queue}/{tier}/{division}
func (l *LOL) LeagueExpEntries(queue, tier, division string, params *LeagueExpEntriesParams) ([]LeagueEntryDTO, *http.Response, error) {
dtos := new([]LeagueEntryDTO)
var reqErr error
endpoint := fmt.Sprintf("league-exp/v4/entries/%s/%s/%s", queue, tier, division)
resp, err := l.sling.Get(endpoint).QueryStruct(params).Receive(dtos, reqErr)
if err != nil {
return nil, resp, err
}
return *dtos, resp, reqErr
}
// ChallengerLeagues GET /lol/league/v4/challengerleagues/by-queue/{queue}
func (l *LOL) ChallengerLeagues(queue string) (*LeagueListDTO, *http.Response, error) {
dto := new(LeagueListDTO)
var reqErr error
resp, err := l.sling.Get("league/v4/challengerleagues/by-queue/"+queue).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// EntriesBySummoner GET /lol/league/v4/entries/by-summoner/{encryptedSummonerId}
func (l *LOL) EntriesBySummoner(encryptedSummonerID string) ([]LeagueEntryDTO, *http.Response, error) {
dtos := new([]LeagueEntryDTO)
var reqErr error
resp, err := l.sling.Get("league/v4/entries/by-summoner/"+encryptedSummonerID).Receive(dtos, reqErr)
if err != nil {
return nil, resp, err
}
return *dtos, resp, reqErr
}
// Entries GET /lol/league/v4/entries/{queue}/{tier}/{division}
func (l *LOL) Entries(queue, tier, division string, params *EntriesParams) ([]LeagueEntryDTO, *http.Response, error) {
dtos := new([]LeagueEntryDTO)
var reqErr error
endpoint := fmt.Sprintf("league/v4/entries/%s/%s/%s", queue, tier, division)
resp, err := l.sling.Get(endpoint).QueryStruct(params).Receive(dtos, reqErr)
if err != nil {
return nil, resp, err
}
return *dtos, resp, reqErr
}
// GrandmasterLeagues GET /lol/league/v4/grandmasterleagues/by-queue/{queue}
func (l *LOL) GrandmasterLeagues(queue string) (*LeagueListDTO, *http.Response, error) {
dto := new(LeagueListDTO)
var reqErr error
resp, err := l.sling.Get("league/v4/grandmasterleagues/by-queue/"+queue).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// Leagues GET /lol/league/v4/leagues/{leagueId}
func (l *LOL) Leagues(leagueID string) (*LeagueListDTO, *http.Response, error) {
dto := new(LeagueListDTO)
var reqErr error
resp, err := l.sling.Get("league/v4/leagues/"+leagueID).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// MasterLeagues GET /lol/league/v4/masterleagues/by-queue/{queue}
func (l *LOL) MasterLeagues(queue string) (*LeagueListDTO, *http.Response, error) {
dto := new(LeagueListDTO)
var reqErr error
resp, err := l.sling.Get("league/v4/masterleagues/by-queue/"+queue).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// Status GET /lol/status/v3/shard-data
func (l *LOL) Status() (*ShardStatus, *http.Response, error) {
shardStatus := new(ShardStatus)
var reqErr error
resp, err := l.sling.Get("status/v3/shard-data").Receive(shardStatus, reqErr)
if err != nil {
return nil, resp, err
}
return shardStatus, resp, reqErr
}
// Matches GET /lol/match/v4/matches/{matchID}
func (l *LOL) Matches(matchID string) (*MatchDTO, *http.Response, error) {
dto := new(MatchDTO)
var reqErr error
resp, err := l.sling.Get("match/v4/matches/"+matchID).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// Matchlists GET /lol/match/v4/matchlists/by-account/{encryptedAccountID}
func (l *LOL) Matchlists(encryptedAccountID string, params *MatchlistsParams) (*MatchlistDTO, *http.Response, error) {
dto := new(MatchlistDTO)
var reqErr error
resp, err := l.sling.Get("match/v4/matchlists/by-account/"+encryptedAccountID).QueryStruct(params).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// Timelines GET /lol/match/v4/timelines/by-match/{matchID}
func (l *LOL) Timelines(matchID string) (*MatchTimelineDTO, *http.Response, error) {
dto := new(MatchTimelineDTO)
var reqErr error
resp, err := l.sling.Get("match/v4/timelines/by-match/"+matchID).Receive(dto, reqErr)
if err != nil {
return nil, resp, err
}
return dto, resp, reqErr
}
// ActiveGames GET /lol/spectator/v4/active-games/by-summoner/{encryptedSummonerId}
func (l *LOL) ActiveGames(encryptedSummonerID string) (*CurrentGameInfo, *http.Response, error) {
info := new(CurrentGameInfo)
var reqErr error
resp, err := l.sling.Get("spectator/v4/active-games/by-summoner/"+encryptedSummonerID).Receive(info, reqErr)
if err != nil {
return nil, resp, err
}
return info, resp, reqErr
}
// FeaturedGames GET /lol/spectator/v4/featured-games
func (l *LOL) FeaturedGames() (*FeaturedGames, *http.Response, error) {
info := new(FeaturedGames)
var reqErr error
resp, err := l.sling.Get("spectator/v4/featured-games").Receive(info, reqErr)
if err != nil {
return nil, resp, err
}
return info, resp, reqErr
}
// SummonerByAccount GET /lol/summoner/v4/summoners/by-account/{encryptedAccountID}
func (l *LOL) SummonerByAccount(encryptedAccountID string) (*SummonerDTO, *http.Response, error) {
sd := new(SummonerDTO)
var reqErr error
resp, err := l.sling.Get("summoner/v4/summoners/by-account/"+encryptedAccountID).Receive(sd, reqErr)
if err != nil {
return nil, resp, err
}
return sd, resp, reqErr
}
// SummonerByName GET /lol/summoner/v4/summoners/by-name/{summonerName}
func (l *LOL) SummonerByName(summonerName string) (*SummonerDTO, *http.Response, error) {
sd := new(SummonerDTO)
var reqErr error
resp, err := l.sling.Get("summoner/v4/summoners/by-name/"+summonerName).Receive(sd, reqErr)
if err != nil {
return nil, resp, err
}
return sd, resp, reqErr
}
// SummonerByPUUID GET /lol/summoner/v4/summoners/by-puuid/{encryptedPUUID}
func (l *LOL) SummonerByPUUID(encryptedPUUID string) (*SummonerDTO, *http.Response, error) {
sd := new(SummonerDTO)
var reqErr error
resp, err := l.sling.Get("summoner/v4/summoners/by-puuid/"+encryptedPUUID).Receive(sd, reqErr)
if err != nil {
return nil, resp, err
}
return sd, resp, reqErr
}
// SummonerByID GET /lol/summoner/v4/summoners/{encryptedID}
func (l *LOL) SummonerByID(encryptedID string) (*SummonerDTO, *http.Response, error) {
sd := new(SummonerDTO)
var reqErr error
resp, err := l.sling.Get("summoner/v4/summoners/"+encryptedID).Receive(sd, reqErr)
if err != nil {
return nil, resp, err
}
return sd, resp, reqErr
}