Documentation
¶
Index ¶
- type APIEndpoint
- func (a *APIEndpoint) GetChampionMasteries(playerID SummonerID) ([]ChampionMastery, error)
- func (a *APIEndpoint) GetChampionMastery(playerID SummonerID, championID ChampionID) (*ChampionMastery, error)
- func (a *APIEndpoint) GetChampionMasteryScore(playerID SummonerID) (int, error)
- func (a *APIEndpoint) GetChampionMasteryTopChampions(playerID SummonerID, count int) ([]ChampionMastery, error)
- func (a *APIEndpoint) GetCurrentGame(id SummonerID) (*CurrentGameInfo, error)
- func (a *APIEndpoint) GetFeaturedGames() (*FeaturedGames, error)
- func (a *APIEndpoint) GetMatch(matchId uint64, includeTimeline bool) (*Match, error)
- func (a *APIEndpoint) GetMatchlist(summonerID uint64, beginTime uint64) (*Matchlist, error)
- func (a *APIEndpoint) GetSummonerByID(ids []SummonerID) ([]Summoner, error)
- func (a *APIEndpoint) GetSummonerByName(names []string) ([]Summoner, error)
- func (a *APIEndpoint) GetSummonerNames(ids []SummonerID) (map[SummonerID]string, error)
- func (a *APIEndpoint) GetSummonerRecentGames(id SummonerID) ([]Game, error)
- type APIKey
- type APIKeyStorer
- type Champion
- type ChampionID
- type ChampionMastery
- type CurrentGameInfo
- type EpochMillisecond
- type FeaturedGameInfo
- type FeaturedGames
- type Game
- type GameID
- type ImageDto
- type MapID
- type MasteryID
- type Match
- type Matchlist
- type ProfileIconID
- type QueueID
- type RESTError
- type RESTGetter
- type RESTStaticData
- type RateLimitedRESTGetter
- type Realm
- type RecentGames
- type Region
- type RegionID
- type RuneID
- type SimpleRESTGetter
- type StaticAPIEndpoint
- type Summoner
- type SummonerID
- type SummonerSpellID
- type XdgAPIKeyStorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIEndpoint ¶
type APIEndpoint struct {
// contains filtered or unexported fields
}
An APIEndpoint represents an endpoint that can fetch dynamic data about League of Legend
func NewAPIEndpoint ¶
func NewAPIEndpoint(region *Region, key APIKey) (*APIEndpoint, error)
NewAPIEndpoint creates a new APIEndpoint from a Region and an APIKey
func (*APIEndpoint) GetChampionMasteries ¶
func (a *APIEndpoint) GetChampionMasteries(playerID SummonerID) ([]ChampionMastery, error)
GetChampionMasteries returns all of the ChampionMastery of a given player, ordered by decreasing points
func (*APIEndpoint) GetChampionMastery ¶
func (a *APIEndpoint) GetChampionMastery(playerID SummonerID, championID ChampionID) (*ChampionMastery, error)
GetChampionMastery returns the champion mastery of a given player for a given champion, ni
func (*APIEndpoint) GetChampionMasteryScore ¶
func (a *APIEndpoint) GetChampionMasteryScore(playerID SummonerID) (int, error)
GetChampionMasteryScore return sthe total score of a player
func (*APIEndpoint) GetChampionMasteryTopChampions ¶
func (a *APIEndpoint) GetChampionMasteryTopChampions(playerID SummonerID, count int) ([]ChampionMastery, error)
GetChampionMasteryTopChampions returns the count top champion of a player
func (*APIEndpoint) GetCurrentGame ¶
func (a *APIEndpoint) GetCurrentGame(id SummonerID) (*CurrentGameInfo, error)
GetCurrentGame return the CurrentGame of a Summoner identified by its SummonerID. It returns nil,nil if the user is not currently playing a game.
func (*APIEndpoint) GetFeaturedGames ¶
func (a *APIEndpoint) GetFeaturedGames() (*FeaturedGames, error)
GetFeaturedGames returns the currently played FeaturedGame on the region
func (*APIEndpoint) GetMatch ¶
func (a *APIEndpoint) GetMatch(matchId uint64, includeTimeline bool) (*Match, error)
func (*APIEndpoint) GetMatchlist ¶
func (a *APIEndpoint) GetMatchlist(summonerID uint64, beginTime uint64) (*Matchlist, error)
func (*APIEndpoint) GetSummonerByID ¶
func (a *APIEndpoint) GetSummonerByID(ids []SummonerID) ([]Summoner, error)
GetSummonerByID returns Summoner data identified by their ids
func (*APIEndpoint) GetSummonerByName ¶
func (a *APIEndpoint) GetSummonerByName(names []string) ([]Summoner, error)
GetSummonerByName returns Summoner data identified by their names
func (*APIEndpoint) GetSummonerNames ¶
func (a *APIEndpoint) GetSummonerNames(ids []SummonerID) (map[SummonerID]string, error)
GetSummonerNames returns the name of Summoner identified by their IDs
func (*APIEndpoint) GetSummonerRecentGames ¶
func (a *APIEndpoint) GetSummonerRecentGames(id SummonerID) ([]Game, error)
GetSummonerRecentGames returns the list of game recently played by a Summoner identified by its SummonerID
type APIKeyStorer ¶
An APIKeyStorer is used to safely Store and Get an APIKey for the user
type Champion ¶
type Champion struct {
AllyTips []string `json:"allytips"`
Blurb string `json:"blurb"`
EnemyTips []string `json:"enemytips"`
ID int `json:"id"`
Image ImageDto `json:"image"`
Info struct {
Attack int
Defense int
Difficulty int
Magic int
} `json:"info"`
Key string `json:"key"`
Lore string `json:"lore"`
Name string `json:"name"`
Partype string `json:"partype"`
Passive struct {
Description string `json:"description"`
Image ImageDto `json:"image"`
Name string `json:"name"`
SanitizedDescription string `json:"sanitizedDescription"`
} `json:"passive"`
Recommended []struct{} `json:"recommended"`
Skins []struct {
ID int `json:"id"`
Name string `json:"name"`
Num int `json:"num"`
} `json:"skins"`
Spells []struct{} `json:"spells"`
Stats struct{} `json:"stats"`
Tags []string `json:"tags"`
Title string `json:"title"`
}
A Champion can be controlled by a Summoner in a Game
type ChampionID ¶
type ChampionID int //for sure there will never even be more than a thousand champions/
ChampionID is a unique identifier for a Champion
type ChampionMastery ¶
type ChampionMastery struct {
Champion ChampionID `json:"championID"`
Level int `json:"championLevel"`
Points int `json:"championPoints"`
PointsSinceLastLevel int `json:"championPointsSinceLastLevel"`
PointsUntilNextLevel int `json:"championPointsUntilNextLevel"`
ChestGranted bool `json:"chestGranted"`
HighestGrade string `json:"highestGrade"`
LastPlayTime EpochMillisecond `json:"lastPlayTime"`
Player SummonerID `json:"playerId"`
}
A ChampionMastery represents the mastery level of a payer with a given champion
type CurrentGameInfo ¶
type CurrentGameInfo struct {
BannedChampion []struct {
Champion ChampionID `json:"championId"`
PickTurn int `json:"pickTurn"`
Team int `json:"teamID"`
} `json:"bannedChampions"`
ID GameID `json:"gameId"`
GameLength int64 `json:"GameLength"`
GameMode string `json:"gameMode"`
GameQueue QueueID `json:"gameQueueConfigId"`
GameStartTime EpochMillisecond `json:"gameStartTime"`
GameType string `json:"gameType"`
Map MapID `json:"mapId"`
Observer struct {
EncryptionKey string `json:"encryptionKey"`
} `json:"observers"`
Participants []struct {
ID SummonerID `json:"summonerId"`
Name string `json:"summonerName"`
Bot bool `json:"bot"`
Champion ChampionID `json:"championId"`
ProfileIcon ProfileIconID `json:"profileIconId"`
Masteries []struct {
ID MasteryID `json:"matseryId"`
Rank int `json:"rank"`
} `json:"masteries"`
Runes []struct {
ID RuneID `json:"runeId"`
Count int `json:"count"`
} `json:"runes"`
SummonerSpell1 SummonerSpellID `json:"spell1Id"`
SummonerSpell2 SummonerSpellID `json:"spell2Id"`
TeamID int64 `json:"teamId"`
} `json:"participants"`
Platform string `json:"platformId"`
}
CurrentGameInfo represent a Game that a Summoner is currently playing
func (CurrentGameInfo) String ¶
func (g CurrentGameInfo) String() string
type EpochMillisecond ¶
type EpochMillisecond uint64
EpochMillisecond represents a point in time by the number of milliseconds since EPOCH
func (EpochMillisecond) Time ¶
func (s EpochMillisecond) Time() time.Time
Time converts EpochMillisecond to time.Time
type FeaturedGameInfo ¶
type FeaturedGameInfo struct {
BannedChampion []struct {
Champion ChampionID `json:"championId"`
PickTurn int `json:"pickTurn"`
Team int `json:"teamID"`
} `json:"bannedChampions"`
ID GameID `json:"gameId"`
GameLength int64 `json:"GameLength"`
GameMode string `json:"gameMode"`
GameQueue QueueID `json:"gameQueueConfigId"`
GameStartTime EpochMillisecond `json:"gameStartTime"`
GameType string `json:"gameType"`
Map MapID `json:"mapId"`
Observer struct {
EncryptionKey string `json:"encryptionKey"`
} `json:"observers"`
Participants []struct {
ID SummonerID `json:"summonerId"`
Name string `json:"summonerName"`
Bot bool `json:"bot"`
Champion ChampionID `json:"championId"`
ProfileIcon int64 `json:"profileIconId"`
SummonerSpell1 SummonerSpellID `json:"spell1Id"`
SummonerSpell2 SummonerSpellID `json:"spell2Id"`
TeamID int64 `json:"teamId"`
} `json:"participants"`
Platform string `json:"platformId"`
}
FeaturedGameInfo is an information about a featured game
type FeaturedGames ¶
type FeaturedGames struct {
Games []FeaturedGameInfo `json:"gameList"`
RefrehInterval int64 `json:"clientRefreshInterval"`
}
FeaturedGames is a list of games that Riot Game considers worth spectating
type Game ¶
type Game struct {
ID GameID `json:"gameId"`
Invalid bool `json:"invalid"`
Mode string `json:"gameMode"`
Type string `json:"gameType"`
SubType string `json:"subType"`
MapID int `json:"mapId"`
Team int `json:"teamId"`
Champion ChampionID `json:"championId"`
Spell1 int `json:"spell1"`
Spell2 int `json:"spell2"`
Level int `json:"level"`
IPEarned int `json:"ipEarned"`
CreateDate EpochMillisecond `json:"createDate"`
Fellows []struct {
Summoner SummonerID `json:"summonerID"`
Team int `json:"teamID"`
Champion ChampionID `json:"championID"`
} `json:"fellowPlayers"`
Stats struct {
Level int `json:"level,omitempty"`
GoldEarned int `json:"goldEarned,omitempty"`
Death int `json:"numDeaths,omitempty"`
TurretsKilled int `json:"turretsKilled,omitempty"`
MinionsKilled int `json:"minionsKilled,omitempty"`
Kills int `json:"championsKilled,omitempty"`
GoldSpent int `json:"goldSpent,omitempty"`
TotalDamageDealt int `json:"totalDamageDealt,omitempty"`
TotalDamageTaken int `json:"totalDamageTaken,omitempty"`
KillingSprees int `json:"killingSprees,omitempty"`
LargestKillingSpree int `json:"largestKillingSpree,omitempty"`
Team int `json:"team,omitempty"`
Win bool `json:"win"`
NeutralMinionsKilled int `json:"neutralMinionsKilled,omitempty"`
LargestMultiKill int `json:"largestMultiKill,omitempty"`
PhysicalDamageDealtPlayer int `json:"physicalDamageDealtPlayer,omitempty"`
MagicDamageDealtPlayer int `json:"magicDamageDealtPlayer,omitempty"`
PhysicalDamageTaken int `json:"physicalDamageTaken,omitempty"`
MagicDamageTaken int `json:"magicDamageTaken,omitempty"`
TimePlayed int `json:"timePlayed,omitempty"`
TotalHeal int `json:"totalHeal,omitempty"`
TotalUnitsHealed int `json:"totalUnitsHealed,omitempty"`
Assists int `json:"assists,omitempty"`
Item0 int `json:"item0,omitempty"`
Item1 int `json:"item1,omitempty"`
Item2 int `json:"item2,omitempty"`
Item3 int `json:"item3,omitempty"`
Item4 int `json:"item4,omitempty"`
Item5 int `json:"item5,omitempty"`
Item6 int `json:"item6,omitempty"`
MagicDamageDealtToChampions int `json:"magicDamageDealtToChampions,omitempty"`
PhysicalDamageDealtToChampions int `json:"physicalDamageDealtToChampions,omitempty"`
TotalDamageDealtToChampions int `json:"totalDamageDealtToChampions,omitempty"`
TrueDamageDealtPlayer int `json:"trueDamageDealtPlayer,omitempty"`
TrueDamageDealtToChampions int `json:"trueDamageDealtToChampions,omitempty"`
TrueDamageTaken int `json:"trueDamageTaken,omitempty"`
WardKilled int `json:"wardKilled,omitempty"`
WardPlaced int `json:"wardPlaced,omitempty"`
NeutralMinionsKilledYourJungle int `json:"neutralMinionsKilledYourJungle,omitempty"`
TotalTimeCrowdControlDealt int `json:"totalTimeCrowdControlDealt,omitempty"`
PlayerPosition int `json:"playerPosition,omitempty"`
PlayerRole int `json:"playerRole,omitempty"`
Barrackskilled int `json:"barrackskilled,omitempty"`
Combatplayerscore int `json:"combatPlayerScore,omitempty"`
Consumablespurchased int `json:"consumablesPurchased,omitempty"`
Damagedealtplayer int `json:"damageDealtPlayer,omitempty"`
Doublekills int `json:"doubleKills,omitempty"`
Firstblood int `json:"firstBlood,omitempty"`
Gold int `json:"gold,omitempty"`
Itemspurchased int `json:"itemsPurchased,omitempty"`
Largestcriticalstrike int `json:"largestCriticalStrike,omitempty"`
Legendaryitemscreated int `json:"legendaryItemsCreated,omitempty"`
Minionsdenied int `json:"minionsDenied,omitempty"`
Neutralminionskilledenemyjungle int `json:"neutralMinionsKilledEnemyJungle,omitempty"`
Nexuskilled bool `json:"nexusKilled,omitempty"`
Nodecapture int `json:"nodeCapture,omitempty"`
Nodecaptureassist int `json:"nodeCaptureAssist,omitempty"`
Nodeneutralize int `json:"nodeNeutralize,omitempty"`
Nodeneutralizeassist int `json:"nodeNeutralizeAssist,omitempty"`
Numitemsbought int `json:"numItemsBought,omitempty"`
Objectiveplayerscore int `json:"objectivePlayerScore,omitempty"`
Pentakills int `json:"pentaKills,omitempty"`
Quadrakills int `json:"quadraKills,omitempty"`
Sightwardsbought int `json:"sightWardsBought,omitempty"`
Spell1cast int `json:"spell1Cast,omitempty"`
Spell2cast int `json:"spell2Cast,omitempty"`
Spell3cast int `json:"spell3Cast,omitempty"`
Spell4cast int `json:"spell4Cast,omitempty"`
Summonspell1cast int `json:"summonSpell1Cast,omitempty"`
Summonspell2cast int `json:"summonSpell2Cast,omitempty"`
Supermonsterkilled int `json:"superMonsterKilled,omitempty"`
Teamobjective int `json:"teamObjective,omitempty"`
Totalplayerscore int `json:"totalPlayerScore,omitempty"`
Totalscorerank int `json:"totalScoreRank,omitempty"`
Triplekills int `json:"tripleKills,omitempty"`
Unrealkills int `json:"unrealKills,omitempty"`
Victorypointtotal int `json:"victoryPointTotal,omitempty"`
Visionwardsbought int `json:"visionWardsBought,omitempty"`
} `json:"stats"`
}
A Game is a game played on the LoL servers
type GameID ¶
type GameID uint64 //this is a 64 bit, EUW reached limit of int32 EUW > NA !
GameID uinquely identifies a Game on a Region. It is a uint64, as EUW as already reached 2^31 games ... EUW > NA !
type ImageDto ¶
type ImageDto struct {
Full string `json:"full"`
Group string `json:"group"`
Sprite string `json:"sprite"`
H int `json:"h"`
W int `json:"w"`
X int `json:"x"`
Y int `json:"y"`
}
An ImageDto describe how to get an image from a Realm
type Match ¶
type Match struct {
MatchDuration uint64 `json:"matchDuration"`
MatchID uint64 `json:"matchId"`
MatchMode string `json:"matchMode"`
MatchType string `json:"matchType"`
MatchVersion string `josn:"matchVersion"`
ParticipantIdentities []struct {
Player struct {
MatchHistoryUri string `json:"matchHistoryUri"`
SummonerID uint64 `json:"summonerId"`
SummonerName string `json:"summonerName"`
}
ParticipantID int `json:"participantId"`
} `json:"participantIdentities"`
Participants []struct {
//TODO
ChampionID int `json:"championId"`
HighestAchievedSeasonTier string `json:"highestAchievedSeasonTier"`
Masteries []struct {
MasteryID uint64 `json:"masteryId"`
Rank uint64 `json:"rank"`
}
ParticipantID int `json:"participantId"`
Runes []struct {
Rank uint64 `json:"rank"`
RuneID uint64 `json:"runeId"`
}
Spell1ID int `json:"spell1Id"`
Spell2ID int `json:"spell2Id"`
ParticipantStats struct {
Assists uint64 `json:"assists"`
ChampLevel uint64 `json:"champLevel"`
// CombatPlayerScore uint64 `json:"combatPlayerScore"`
Deaths uint64 `json:"deaths"`
DoubleKills uint64 `json:"doubleKills"`
FirstBloodAssist bool `json:"firstBloodAssist"`
FirstBloodKill bool `json:"firstBloodKill"`
// FirstInhibitorAssist bool `json:"firstInhibitorAssist"`
// FirstInhibitorKill bool `json:"firstInhibitorKill"`
// FirstTowerAssist bool `json:"firstTowerAssist"`
// FirstTowerKill bool `json:"firstTowerKill"`
GoldEarned uint64 `json:"goldEarned"`
// GoldSpent uint64 `json:"goldSpent"`
// InhibitorKills uint64 `json:"inhibitorKills"`
Item0 uint64 `json:"item0"`
Item1 uint64 `json:"item1"`
Item2 uint64 `json:"item2"`
Item3 uint64 `json:"item3"`
Item4 uint64 `json:"item4"`
Item5 uint64 `json:"item5"`
Item6 uint64 `json:"item6"`
// KillingSprees uint64 `json:"killingSprees"`
Kills uint64 `json:"kills"`
// LargestCriticalStrike uint64 `json:"largestCriticalStrike"`
// LargestKillingSpree uint64 `json:"largestKillingSpree"`
LargestMultiKill uint64 `json:"largestMultiKill"`
// MagicDamageDealt uint64 `json:"magicDamageDealt"`
// MagicDamageDealtToChampions uint64 `json:"magicDamageDealtToChampions"`
// MagicDamageTaken uint64 `json:"magicDamageTaken"`
MinionsKilled uint64 `json:"minionsKilled"`
NeutralMinionsKilled uint64 `json:"neutralMinionsKilled"`
NeutralMinionsKilledEnemyJungle uint64 `json:"neutralMinionsKilledEnemyJungle"`
NeutralMinionsKilledTeamJungle uint64 `json:"neutralMinionsKilledTeamJungle"`
// NodeCapture uint64 `json:"nodeCapture"`
// NodeCaptureAssist uint64 `json:"nodeCaptureAssist"`
// NodeNeutralize uint64 `json:"nodeNeutralize"`
// NodeNeutralizeAssist uint64 `json:"nodeNeutralizeAssist"`
// ObjectivePlayerScore uint64 `json:"objectivePlayerScore"`
PentaKills uint64 `json:"pentaKills"`
// PhysicalDamageDealt uint64 `json:"physicalDamageDealt"`
// PhysicalDamageDealtToChampions uint64 `json:"physicalDamageDealtToChampions"`
// PhysicalDamageTaken uint64 `json:"physicalDamageTaken"`
QuadraKills uint64 `json:"quadraKills"`
SightWardsBoughtInGame uint64 `json:"sightWardsBoughtInGame"`
// TeamObjective uint64 `json:"teamObjective"`
// TotalDamageDealt uint64 `json:"totalDamageDealt"`
// TotalDamageDealtToChampions uint64 `json:"totalDamageDealtToChampions"`
// TotalDamageTaken uint64 `json:"totalDamageTaken"`
// TotalHeal uint64 `json:"totalHeal"`
// TotalPlayerScore uint64 `json:"totalPlayerScore"`
// TotalScoreRank uint64 `json:"totalScoreRank"`
// TotalTimeCrowdControlDealt uint64 `json:"totalTimeCrowdControlDealt"`
// TotalUnitsHealed uint64 `json:"totalUnitsHealed"`
// TowerKills uint64 `json:"towerKills"`
TripleKills uint64 `json:"tripleKills"`
// TrueDamageDealt uint64 `json:"trueDamageDealt"`
// TrueDamageDealtToChampions uint64 `json:"trueDamageDealtToChampions"`
// TrueDamageTaken uint64 `json:"trueDamageTaken"`
// UnrealKills uint64 `json:"unrealKills"`
VisionWardsBoughtInGame uint64 `json:"visionWardsBoughtInGame"`
WardsPlaced uint64 `json:"wardsPlaced"`
Winner bool `json:"winner"`
// contains filtered or unexported fields
} `json:"stats"`
TeamID int `json:"teamId"`
ParticipantTimeline struct {
// AncientGolemAssistsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"ancientGolemAssistsPerMinCounts"`
// AncientGolemKillsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"ancientGolemKillsPerMinCounts"`
// AssistedLaneDeathsPerMinDeltas struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"assistedLaneDeathsPerMinDeltas"`
// AssistedLaneKillsPerMinDeltas struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"assistedLaneKillsPerMinDeltas"`
// BaronAssistsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"baronAssistsPerMinCounts"`
// BaronKillsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"baronKillsPerMinCounts"`
CreepsPerMinDeltas struct {
TenToTwenty float64 `json:"tenToTwenty"`
ThirtyToEnd float64 `json:"thirtyToEnd"`
TwentyToThirty float64 `json:"twentyToThirty"`
ZeroToTen float64 `json:"zeroToTen"`
} `json:"creepsPerMinDeltas"`
CsDiffPerMinDeltas struct {
TenToTwenty float64 `json:"tenToTwenty"`
ThirtyToEnd float64 `json:"thirtyToEnd"`
TwentyToThirty float64 `json:"twentyToThirty"`
ZeroToTen float64 `json:"zeroToTen"`
} `json:"csDiffPerMinDeltas"`
// DamageTakenDiffPerMinDeltas struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"damageTakenDiffPerMinDeltas"`
// DamageTakenPerMinDeltas struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"damageTakenPerMinDeltas"`
// DragonAssistsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"dragonAssistsPerMinCounts"`
// DragonKillsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"dragonKillsPerMinCounts"`
// ElderLizardAssistsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"elderLizardAssistsPerMinCounts"`
// ElderLizardKillsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"elderLizardKillsPerMinCounts"`
GoldPerMinDeltas struct {
TenToTwenty float64 `json:"tenToTwenty"`
ThirtyToEnd float64 `json:"thirtyToEnd"`
TwentyToThirty float64 `json:"twentyToThirty"`
ZeroToTen float64 `json:"zeroToTen"`
} `json:"goldPerMinDeltas"`
// InhibitorAssistsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"inhibitorAssistsPerMinCounts"`
// InhibitorKillsPerMinCounts struct {
// TenToTwenty float64 `json:"tenToTwenty"`
// ThirtyToEnd float64 `json:"thirtyToEnd"`
// TwentyToThirty float64 `json:"twentyToThirty"`
// ZeroToTen float64 `json:"zeroToTen"`
// } `json:"inhibitorKillsPerMinCounts"`
Lane string `json:"lane"`
Role string `json:"role"`
} `json:"timeline"`
} `json:"participants"`
PlatformID string `json:"platformId"`
QueueType string `json:"queueType"`
Region string `json:"region"`
Season string `json:"season"`
Teams []struct {
Bans []struct {
ChampionID int `json:"championId"`
PickTurn int `json:"pickTurn"`
} `json:"bans"`
BaronKills int `json:"baronKills"`
// DominionVictoryScore uint64 `json:"dominionVictoryScore"`
DragonKills int `json:"dragonKills"`
FirstBaron bool `json:"firstBaron"`
FirstBlood bool `json:"firstBlood"`
FirstDragon bool `json:"firstDragon"`
FirstInhibitor bool `json:"firstInhibitor"`
FirstRiftHerald bool `json:"firstRiftHerald"`
FirstTower bool `json:"firstTower"`
InhibitorKills int `json:"inhibitorKills"`
RiftHeraldKills int `json:"riftHeraldKills"`
TeamID int `json:"teamId"`
TowerKills int `json:"towerKills"`
// VilemawKills int `json:"vilemawKills"`
Winner bool `json:"winner"`
} `json:"teams"`
}
type Matchlist ¶
type Matchlist struct {
EndIndex int `json:"endIndex"`
Matches []struct {
Champion uint64 `json:"champion"`
Lane string `json:"lane"` //Legal values: MID, MIDDLE, TOP, JUNGLE, BOT, BOTTOM
MatchID uint64 `json:"matchId"`
PlatformID string `json:"platformId"`
Queue string `json:"queue"` //Legal values: TEAM_BUILDER_DRAFT_RANKED_5x5, RANKED_SOLO_5x5, RANKED_TEAM_3x3, RANKED_TEAM_5x5
Region string `json:"region"`
Role string `json:"role` //Legal values: DUO, NONE, SOLO, DUO_CARRY, DUO_SUPPORT
Season string `json:"season"` //Legal values: PRESEASON3, SEASON3, PRESEASON2014, SEASON2014, PRESEASON2015, SEASON2015, PRESEASON2016, SEASON2016
Timestamp uint64 `json:"timestamp"`
} `json:"matches"`
StartIndex int `json:"startIndex"`
TotalGames int `json:"totalGames"`
}
type QueueID ¶
type QueueID int64
QueueID uniquely represents a Queue
const ( // CUSTOM represents Custom games CUSTOM QueueID = 0 // NORMAL5x5BLIND represents Normal 5v5 Blind Pick games NORMAL5x5BLIND QueueID = 2 // BOT5x5 represents Historical Summoner's Rift Coop vs AI games BOT5x5 QueueID = 7 // BOT5x5INTRO represents Summoner's Rift Coop vs AI Intro Bot // games BOT5x5INTRO QueueID = 31 // BOT5x5BEGINNER represents Summoner's Rift Coop vs AI Beginner // Bot games BOT5x5BEGINNER QueueID = 32 // BOT5x5INTERMEDIATE represents Historical Summoner's Rift Coop // vs AI Intermediate Bot games BOT5x5INTERMEDIATE QueueID = 33 // NORMAL3x3 represents Normal 3v3 games NORMAL3x3 QueueID = 8 // NORMAL5x5DRAFT represents Normal 5v5 Draft Pick games NORMAL5x5DRAFT QueueID = 14 // ODIN5x5BLIND represents Dominion 5v5 Blind Pick games ODIN5x5BLIND QueueID = 16 // ODIN5x5DRAFT represents Dominion 5v5 Draft Pick games ODIN5x5DRAFT QueueID = 17 // BOTODIN5x5 represents Dominion Coop vs AI games BOTODIN5x5 QueueID = 25 // RANKEDSOLO5x5 represents Ranked Solo 5v5 games RANKEDSOLO5x5 QueueID = 4 // RANKEDPREMADE3x3 represents Ranked Premade 3v3 games RANKEDPREMADE3x3 QueueID = 9 // RANKEDPREMADE5x5 represents Ranked Premade 5v5 games RANKEDPREMADE5x5 QueueID = 6 // RANKEDTEAM3x3 represents Ranked Team 3v3 games RANKEDTEAM3x3 QueueID = 41 // RANKEDTEAM5x5 represents Ranked Team 5v5 games RANKEDTEAM5x5 QueueID = 42 // BOTTT3x3 represents Twisted Treeline Coop vs AI games BOTTT3x3 QueueID = 52 // GROUPFINDER5x5 represents Team Builder games GROUPFINDER5x5 QueueID = 61 // ARAM5x5 represents ARAM games ARAM5x5 QueueID = 65 // ONEFORALL5x5 represents One for All games ONEFORALL5x5 QueueID = 70 // FIRSTBLOOD1x1 represents Snowdown Showdown 1v1 games FIRSTBLOOD1x1 QueueID = 72 // FIRSTBLOOD2x2 represents Snowdown Showdown 2v2 games FIRSTBLOOD2x2 QueueID = 73 // SR6x6 represents Summoner's Rift 6x6 Hexakill games SR6x6 QueueID = 75 // URF5x5 represents Ultra Rapid Fire games URF5x5 QueueID = 76 // BOTURF5x5 represents Ultra Rapid Fire games played against AI // games BOTURF5x5 QueueID = 83 // NIGHTMAREBOT5x5RANK1 represents Doom Bots Rank 1 games NIGHTMAREBOT5x5RANK1 QueueID = 91 // NIGHTMAREBOT5x5RANK2 represents Doom Bots Rank 2 games NIGHTMAREBOT5x5RANK2 QueueID = 92 // NIGHTMAREBOT5x5RANK5 represents Doom Bots Rank 5 games NIGHTMAREBOT5x5RANK5 QueueID = 93 // ASCENSION5x5 represents Ascension games ASCENSION5x5 QueueID = 96 // HEXAKILL represents Twisted Treeline 6x6 Hexakill games HEXAKILL QueueID = 98 // KINGPORO5x5 represents King Poro games KINGPORO5x5 QueueID = 300 // COUNTERPICK represents Nemesis games COUNTERPICK QueueID = 310 )
type RESTError ¶
type RESTError struct {
Code int
}
RESTError represents an error when trying to GET the URL api (i.e. non 200 return code)
type RESTGetter ¶
RESTGetter is an interface for object able to Get JSON data from lol REST Api
type RESTStaticData ¶
type RESTStaticData struct {
TeamIDs []string
SummonerNames []string
SummonerIDs []string
ChampionIDs []string
GameIDs []string
RegionCode string
Key APIKey
ResponseByRequest map[string][]byte
}
RESTStaticData represent some data statically fetch from Riot API. It has no other purpose than having some data for unit testing
type RateLimitedRESTGetter ¶
type RateLimitedRESTGetter struct {
// contains filtered or unexported fields
}
A RateLimitedRESTGetter performs the same than a SimpleRESTGetter, but limits the amount of request it does overtime, not to reach Riot Games imposed Request limitations
func NewRateLimitedRESTGetter ¶
func NewRateLimitedRESTGetter(limit uint, window time.Duration) *RateLimitedRESTGetter
NewRateLimitedRESTGetter creates a RateLimitedRESTGetter, that limits its request to no more than limit request over a time.Duration window
func (*RateLimitedRESTGetter) Get ¶
func (g *RateLimitedRESTGetter) Get(url string, v interface{}) error
Get acts like SimpleRESTGetter.Get, but will try not to exceed the number of request over time defined by NewRateLimitedRESTGetter
type Realm ¶
type Realm struct {
// Base URL to get data for the realm
Cdn string `json:"cdn"`
CSSVersion string `json:"css"`
// Current versio for Data Dragon
DataDragonVersion string `json:"dd"`
// Default language for thsi realm
Locale string `json:"l"`
LegacyIE6 string `json:"lg"`
DataSetsVersion map[string]string `json:"n"`
Version string `json:"v"`
ProfileIconMax int `json:"profileiconmax"`
Store string `json:"store"`
// contains filtered or unexported fields
}
A Realm represents dataset of data for a game.
type RecentGames ¶
type RecentGames struct {
// ID of the Summoner who played the Game
ID SummonerID `json:"summonerId"`
// Games recently played
Games []Game `json:"games"`
}
RecentGames represent the up to 15 last Game played by a Summoner
type Region ¶
type Region struct {
// contains filtered or unexported fields
}
A Region defines a set of severs where people can play together
func AllDynamicRegion ¶
func AllDynamicRegion() []*Region
AllDynamicRegion returns the list of all Dynamic Region. i.e. region where you can play and observe games.
func NewRegionByCode ¶
NewRegionByCode returns a region identified by its code (i.e. "euw" for EUW)
func NewRegionByPlatformID ¶
NewRegionByPlatformID returns a region from its PlatformID
func (*Region) IsDynamic ¶
IsDynamic returns true if the region is dynamic, i.e. you can play and spectate game on.
func (*Region) PlatformID ¶
PlatformID returns the ID used by observer mode to identifies the Region
func (*Region) SpectatorURL ¶
SpectatorURL returns the url that should be used to spectate game for the Region
type RegionID ¶
type RegionID uint
A RegionID is used to uniquely identifies a Region
const ( // BR represents Brazil region BR RegionID = iota // EUNE represents European Union North - East region EUNE // EUW represents European Union West region EUW // JP represents Japan region JP // KR represents Korea region KR // LAN represents Latin America North region LAN // LAS represents Latin America South region LAS // NA represents North America region NA // OCE represents Oceania region OCE // TR represents Turkish region TR // RU represents Russia region RU // PBE represents the Public Beta Environment region PBE // GLOBAL represents global static data access point GLOBAL )
type SimpleRESTGetter ¶
type SimpleRESTGetter struct{}
A SimpleRESTGetter is the simplest implementation of a RESTGetter, i.e. it will just GET the requested URL, and if the Status is 200, will decode the JSON data
func NewSimpleRESTGetter ¶
func NewSimpleRESTGetter() *SimpleRESTGetter
NewSimpleRESTGetter creates a new SimpleRESTGetter
func (*SimpleRESTGetter) Get ¶
func (g *SimpleRESTGetter) Get(url string, v interface{}) error
Get performs a GET HTTP request on the given URL, and if the Status is not an error, will decode the body of the response as JSON into the given object.
type StaticAPIEndpoint ¶
type StaticAPIEndpoint struct {
// contains filtered or unexported fields
}
StaticAPIEndpoint is used to access Riot REST API for static data.
func NewStaticAPIEndpoint ¶
func NewStaticAPIEndpoint(region *Region, key APIKey) (*StaticAPIEndpoint, error)
NewStaticAPIEndpoint is creeating a new Static endpoint. You have to pass the Dynamic (i.e. EUW, KR NA) region you are interested in fecthing data.
func (*StaticAPIEndpoint) GetChampion ¶
func (a *StaticAPIEndpoint) GetChampion(id ChampionID) (*Champion, error)
GetChampion returns the champion data for the current patch
func (*StaticAPIEndpoint) GetRealm ¶
func (a *StaticAPIEndpoint) GetRealm() (Realm, error)
GetRealm fetches the current Realm used for the selected region of the StaticAPIEndpoint. It also initializes the cache structure for the Realm data (images)
type Summoner ¶
type Summoner struct {
ID SummonerID `json:"id"`
Name string `json:"name"`
ProfileIconID int `json:"profileIconId"`
Level uint32 `json:"summonerLevel"`
RevisionDate EpochMillisecond `json:"revisionDate"`
}
A Summoner is a representation of a player on LoL servers
type SummonerSpellID ¶
type SummonerSpellID int64
SummonerSpellID uniquely represents a SummonerSpell
type XdgAPIKeyStorer ¶
type XdgAPIKeyStorer struct {
// contains filtered or unexported fields
}
XdgAPIKeyStorer Store and Get an APIkey from a file located in the $XDG_CONFIG_HOME directory
func NewXdgAPIKeyStorer ¶
func NewXdgAPIKeyStorer() (*XdgAPIKeyStorer, error)
NewXdgAPIKeyStorer creates a new XdgAPIKeyStorer
func (*XdgAPIKeyStorer) Get ¶
func (s *XdgAPIKeyStorer) Get() (APIKey, bool)
Get retrieve the APIKey from user's XDG_CONFIG_HOME
func (*XdgAPIKeyStorer) Store ¶
func (s *XdgAPIKeyStorer) Store(k APIKey) error
Store saves the new APIKey k to user's XDG_CONFIG_HOME