goriot

package module
v0.0.0-...-1ea8efb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 8 Imported by: 3

README

goriot

Go bindings for official Riot/League of legends REST API

Add any requests to issues.

For help using the libary look at the goriot_test.go file

TODO: Improve Readme, improve error handling, improve date handling, rate handling, improved testing (all will be filed as issues)

To install just use

go get github.com/TrevorSStone/goriot

To run tests successfully change the RIOTAPIKEY_TEST environment variable to your key. Key's can be obtained through https://developer.riotgames.com/

Tests will take upwards of 130s if ran together due to the default rate limiting settings. This is because it has to block for 10s after each 10 requests. If you have different rate limits, change the tests to have them run faster.

The way rate limiting works is semi-experimental. I believe it works under all conditions, but if you get a 429 error please report it.

If you are interested in using RTMPS to connect to League of Legends instead of the official API, my other library sets the groundwork for you. https://github.com/TrevorSStone/golol

http://godoc.org/github.com/TrevorSStone/goriot

Documentation

Overview

Package goriot is a library that provides a means of connecting and recieving data from Riot's League of Legend API

Index

Examples

Constants

This section is empty.

Variables

View Source
var (

	//BaseURL is the base of the url used by Riot's API service
	BaseURL = "api.pvp.net"
	//BaseURL is the base of the url used by Riot's API service
	BaseAPIURL = BaseURL + "/api"
	//BaseURL is the base of the url used by Riot's API service
	BaseObserverURL = BaseURL + "/observer-mode/rest"
	//BR represents the string for the Brazilian League of Legends Servers,
	//only used as a helper to prevent typos
	BR = "br"
	//EUNE represents the string for the North Eastern European League of Legends Servers,
	//only used as a helper to prevent typos
	EUNE = "eune"
	//EUW represents the string for the West European League of Legends Servers,
	//only used as a helper to prevent typos
	EUW = "euw"
	//KR represents the string for the Korean League of Legends Servers,
	//only used as a helper to prevent typos
	KR = "kr"
	//LAN represents the string for the Latin America North League of Legends Servers,
	//only used as a helper to prevent typos
	LAN = "lan"
	//LAS represents the string for the Latin America South League of Legends Servers,
	//only used as a helper to prevent typos
	LAS = "las"
	//NA represents the string for the North American League of Legends Servers,
	//only used as a helper to prevent typos
	NA = "na"
	//OCE represents the string for the Oceanic League of Legends Servers,
	//only used as a helper to prevent typos
	OCE = "oce"
	//RU represents the string for the Russian League of Legends Servers,
	//only used as a helper to prevent typos
	RU = "ru"
	//TR represents the string for the Turkish League of Legends Servers,
	//only used as a helper to prevent typos
	TR = "tr"
	//SEASON3 is the string of "SEASON3". Used to help prevent typos
	SEASON3 = "SEASON3"
	//SEASON4 is the string of "SEASON4". Used to help prevent typos
	SEASON4 = "SEASON4"
	//Ranked Solo 5s
	RANKED_SOLO_5x5 = "RANKED_SOLO_5x5"
	//Ranked Team 3s
	RANKED_TEAM_3x3 = "RANKED_TEAM_3x3"
	//Ranked Team 5s
	RANKED_TEAM_5x5 = "RANKED_TEAM_5x5"
	//ErrAPIKeyNotSet is the error returned when no global API key has been set
	ErrAPIKeyNotSet = errors.New("goriot: API key has not been set. If you need a key visit https://developer.riotgames.com/")
)
View Source
var (
	RegionToPlatformId = map[string]string{
		"br":   "BR1",
		"eune": "EUN1",
		"euw":  "EUW1",
		"kr":   "KR",
		"lan":  "LA1",
		"las":  "LA2",
		"na":   "NA1",
		"oce":  "OC1",
		"ru":   "RU",
		"tr":   "TR1",
	}
)

Functions

func IsKeySet

func IsKeySet() bool

IsKeySet returns a bool of if the global API key has been set

func LeagueBySummoner

func LeagueBySummoner(region string, summonerID ...int64) (leagues map[int64][]League, err error)

LeagueBySummoner retrieves the league of the supplied summonerID(s) from Riot Games API. It returns a League and any errors that occured from the server The global API key must be set before use

func LeagueByTeam

func LeagueByTeam(region string, teamID ...string) (leagues map[string][]League, err error)

LeagueByTeam retrieves all leagues for passed in Team(s) It returns a map of TeamID to slice of League and any errors The global API key must be set before use

func LeagueEntryBySummoner

func LeagueEntryBySummoner(region string, summonerID ...int64) (leagues map[int64][]League, err error)

LeagueEntryBySummoner retrieves the league entry of the supplied summonerID. The difference from LeagueBySummoner is that LeagueEntryBySummoner only returns data for the given summonerID vs everyone in that summoner's league

func LeagueEntryByTeam

func LeagueEntryByTeam(region string, teamID ...string) (leagues map[string][]League, err error)

LeagueEntryByTeam retrieves all entries for a Team It returns a League and any errors that occured from the server The global API key must be set before use

func MasteriesBySummoner

func MasteriesBySummoner(region string, summonerID ...int64) (masteries map[int64][]MasteryPage, err error)

MasteriesBySummoner retrieves the mastery pages of the supplied summonerIDs from Riot Games API. It returns a map of array pf MasteryPage with the key being the summonerID and any errors that occured from the server The global API key must be set before use

func NormalizeSummonerName

func NormalizeSummonerName(summonerNames ...string) []string

NormalizeSummonerName takes an arbitrary number of strings and returns a string array containing the strings standardized to league of legends internal standard (lowecase and strings removed)

func RunesBySummoner

func RunesBySummoner(region string, summonerID ...int64) (runes map[int64][]RunePage, err error)

RunesBySummoner retrieves the rune pages of the supplied summonerIDs from Riot Games API. It returns a map of array of RunePage with the key being the summonerID and any errors that occured from the server The global API key must be set before use

func SetAPIKey

func SetAPIKey(key string)

SetAPIKey sets the global key for the Riot Games API. If you do not have one you can get one for free at https://developer.riotgames.com/

func SetLongRateLimit

func SetLongRateLimit(numrequests int, pertime time.Duration)

SetLongRateLimit allows a custom rate limit to be set. For at the time of this writing the default for a development API key is 500 requests every 10 minutes

Example

ExampleSetLongRateLimit shows the default way to set the larger rate limit for developers

SetLongRateLimit(500, 10*time.Minute)
Output:

func SetSmallRateLimit

func SetSmallRateLimit(numrequests int, pertime time.Duration)

SetSmallRateLimit allows a custom rate limit to be set. For at the time of this writing the default for a development API key is 10 requests every 10 seconds

Example

ExampleSetSmallRateLimit shows the default way to set the smaller rate limit for developers

SetSmallRateLimit(10, 10*time.Second)
Output:

func SummonerByID

func SummonerByID(region string, summonerID ...int64) (summoners map[int64]Summoner, err error)

SummonerByID retrieves the summoner information of the provided summoner IDs from Riot Games API. It returns a map of Summoner with the key being summonerID and any errors that occured from the server The global API key must be set before use

func SummonerByName

func SummonerByName(region string, name ...string) (summoners map[string]Summoner, err error)

SummonerByName retrieves the summoner information of the provided summoner names from Riot Games API. It returns a Map of Summoner with the key being the summoner name and any errors that occured from the server The global API key must be set before use WARNING: The map's key is not necessarily the same string used in the request. It is recommended to use NormalizeSummonerName before calling this function

func SummonerNamesByID

func SummonerNamesByID(region string, summonerID ...int64) (summoners map[int64]string, err error)

SummonerNamesByID retrieves multiple summoner's information of the provided summoner IDs from Riot Games API. It returns an map of string with the key being the summonerID and any errors that occured from the server The global API key must be set before use

func TeamBySummonerID

func TeamBySummonerID(region string, summonerID ...int64) (teams map[int64][]Team, err error)

TeamBySummonerID retrieves a summoner's assosiated teams from Riot Games API. It returns an array of Team and any errors that occured from the server The global API key must be set before use

func TeamByTeamID

func TeamByTeamID(region string, teamID ...string) (teams map[string]Team, err error)

Search for Team information using Team ID Returns Team match history and information or errors from server Global API key must be set prior to use

Types

type AggregatedStats

type AggregatedStats struct {
	AverageAssists              int `json:"averageAssists"`
	AverageChampionsKilled      int `json:"averageChampionsKilled"`
	AverageCombatPlayerScore    int `json:"averageCombatPlayerScore"`
	AverageNodeCapture          int `json:"averageNodeCapture"`
	AverageNodeCaptureAssist    int `json:"averageNodeCaptureAssist"`
	AverageNodeNeutralize       int `json:"averageNodeNeutralize"`
	AverageNodeNeutralizeAssist int `json:"averageNodeNeutralizeAssist"`
	AverageNumDeaths            int `json:"averageNumDeaths"`
	AverageObjectivePlayerScore int `json:"averageObjectivePlayerScore"`
	AverageTeamObjective        int `json:"averageTeamObjective"`
	AverageTotalPlayerScore     int `json:"averageTotalPlayerScore"`
	BotGamesPlayed              int `json:"botGamesPlayed"`
	KillingSpree                int `json:"killingSpree"`
	MaxAssists                  int `json:"maxAssists"`
	MaxChampionsKilled          int `json:"maxChampionsKilled"`
	MaxCombatPlayerScore        int `json:"maxCombatPlayerScore"`
	MaxLargestCriticalStrike    int `json:"maxLargestCriticalStrike"`
	MaxLargestKillingSpree      int `json:"maxLargestKillingSpree"`
	MaxNodeCapture              int `json:"maxNodeCapture"`
	MaxNodeCaptureAssist        int `json:"maxNodeCaptureAssist"`
	MaxNodeNeutralize           int `json:"maxNodeNeutralize"`
	MaxNodeNeutralizeAssist     int `json:"maxNodeNeutralizeAssist"`
	MaxObjectivePlayerScore     int `json:"maxObjectivePlayerScore"`
	MaxTeamObjective            int `json:"maxTeamObjective"`
	MaxTimePlayed               int `json:"maxTimePlayed"`
	MaxTimeSpentLiving          int `json:"maxTimeSpentLiving"`
	MaxTotalPlayerScore         int `json:"maxTotalPlayerScore"`
	MostChampionKillsPerSession int `json:"mostChampionKillsPerSession"`
	MostSpellsCast              int `json:"mostSpellsCast"`
	NormalGamesPlayed           int `json:"normalGamesPlayed"`
	RankedPremadeGamesPlayed    int `json:"rankedPremadeGamesPlayed"`
	RankedSoloGamesPlayed       int `json:"rankedSoloGamesPlayed"`
	TotalAssists                int `json:"totalAssists"`
	TotalChampionKills          int `json:"totalChampionKills"`
	TotalDamageDealt            int `json:"totalDamageDealt"`
	TotalDamageTaken            int `json:"totalDamageTaken"`
	TotalDeathsPerSession       int `json:"totalDeathsPerSession"`
	TotalDoubleKills            int `json:"totalDoubleKills"`
	TotalFirstBlood             int `json:"totalFirstBlood"`
	TotalGoldEarned             int `json:"totalGoldEarned"`
	TotalHeal                   int `json:"totalHeal"`
	TotalMagicDamageDealt       int `json:"totalMagicDamageDealt"`
	TotalMinionKills            int `json:"totalMinionKills"`
	TotalNeutralMinionsKilled   int `json:"totalNeutralMinionsKilled"`
	TotalNodeCapture            int `json:"totalNodeCapture"`
	TotalNodeNeutralize         int `json:"totalNodeNeutralize"`
	TotalPentaKills             int `json:"totalPentaKills"`
	TotalPhysicalDamageDealt    int `json:"totalPhysicalDamageDealt"`
	TotalQuadraKills            int `json:"totalQuadraKills"`
	TotalSessionsLost           int `json:"totalSessionsLost"`
	TotalSessionsPlayed         int `json:"totalSessionsPlayed"`
	TotalSessionsWon            int `json:"totalSessionsWon"`
	TotalTripleKills            int `json:"totalTripleKills"`
	TotalTurretsKilled          int `json:"totalTurretsKilled"`
	TotalUnrealKills            int `json:"totalUnrealKills"`
}

AggregatedStats contain all values for a player's game stat values

type BannedChampion

type BannedChampion struct {
	ChampionId int `json:"championId"`
	PickTurn   int `json:"pickTurn"`
}

type Champion

type Champion struct {
	Active            bool `json:"active"`
	BotEnabled        bool `json:"botEnabled"`
	BotMmEnabled      bool `json:"botMmEnabled"`
	FreeToPlay        bool `json:"freeToPlay"`
	ID                int  `json:"id"`
	RankedPlayEnabled bool `json:"rankedPlayEnabled"`
}

Champion represents a League of Legends champion

func ChampionByID

func ChampionByID(region string, id int) (champion Champion, err error)

ChampsionByID retrieves the champion from the Riot Games API. It returns a single Champion and any errors that occured from the server The global API key must be set before use

func ChampionList

func ChampionList(region string, freetoplay bool) (champions []Champion, err error)

ChampionList retrieves the current list of champions from the Riot Games API. If freetoplay is set to true, only champions currently free to play are returned It returns an array of Champion(s) and any errors that occured from the server The global API key must be set before use

type ChampionStats

type ChampionStats struct {
	ID    int             `json:"id"`
	Stats AggregatedStats `json:"stats"`
}

ChampionStats are the stats for a League of Legends player's champion in ranked

type Event

type Event struct {
	AssistingParticipantIDs []int    `json:"assistingParticipantIds"`
	BuildingType            string   `json:"buildingType"`
	CreatorID               int      `json:"creatorId"`
	EventType               string   `json:"eventType"`
	ItemAfter               int      `json:"itemAfter"`
	ItemBefore              int      `json:"itemBefore"`
	ItemID                  int      `json:"itemId"`
	KillerID                int      `json:"killerId"`
	LaneType                string   `json:"laneType"`
	LevelUpType             string   `json:"levelUpType"`
	MonsterType             string   `json:"monsterType"`
	ParticipantID           int      `json:"participantId"`
	Position                Position `json:"position"`
	SkillSlot               int      `json:"skillSlot"`
	TeamID                  int      `json:"teamId"`
	Timestamp               int64    `json:"timestamp"`
	TowerType               string   `json:"towerType"`
	VictimId                int      `json:"victimId"`
	WardType                string   `json:"wardType"`
}

type FeaturedGame

type FeaturedGame struct {
	GameID            int           `json:"gameId"`
	MapID             int           `json:"mapId"`
	GameMode          string        `json:"gameMode"`
	GameType          string        `json:"gameType"`
	GameQueueConfigID int           `json:"gameQueueConfigId"`
	Participants      []Participant `json:"participants"`
	Observers         struct {
		EncryptionKey string `json:"encryptionKey"`
	} `json:"observers"`
	PlatformID      string `json:"platformId"`
	BannedChampions []struct {
		ChampionID int `json:"championId"`
		TeamID     int `json:"teamId"`
		PickTurn   int `json:"pickTurn"`
	} `json:"bannedChampions"`
	GameStartTime int64 `json:"gameStartTime"`
	GameLength    int   `json:"gameLength"`
}

func FeaturedGameBySummonerID

func FeaturedGameBySummonerID(region, summonerId string) (FeaturedGame, error)

FeaturedGameBySummonerID requests a FeaturedGame from Riot API key needs to be set prior to use

func FeaturedGames

func FeaturedGames(region string) ([]FeaturedGame, error)

FeaturedGames requests a list of FeaturedGames from Riot API key needs to be set prior to use

type Frame

type Frame struct {
	Events            []Event                     `json:"events"`
	ParticipantFrames map[string]ParticipantFrame `json:"participantsFrames"`
	Timestamp         int64                       `json:"timestamp"`
}

type Game

type Game struct {
	ChampionID    int      `json:"championId"`
	CreateDate    int64    `json:"createDate"`
	FellowPlayers []Player `json:"fellowPlayers"`
	GameID        int64    `json:"gameId"`
	GameMode      string   `json:"gameMode"`
	GameType      string   `json:"gameType"`
	Invalid       bool     `json:"invalid"`
	IPEarned      int      `json:"ipEarned"`
	Level         int      `json:"level"`
	MapID         int      `json:"mapId"`
	Spell1        int      `json:"spell1"`
	Spell2        int      `json:"spell2"`
	Statistics    GameStat `json:"stats"`
	SubType       string   `json:"subType"`
	TeamID        int      `json:"teamId"`
}

Game represents a League of Legends game

func RecentGameBySummoner

func RecentGameBySummoner(region string, summonerID int64) (games []Game, err error)

RecentGameBySummoner retrieves the current list of recent games from the Riot Games API. It returns an array of Game(s) and any errors that occured from the server The global API key must be set before use

type GameStat

type GameStat struct {
	Assists                         int  `json:"assists"`
	BarracksKilled                  int  `json:"barracksKilled"`
	ChampionsKilled                 int  `json:"championsKilled"`
	CombatPlayerScore               int  `json:"combatPlayerScore"`
	ConsumablesPurchased            int  `json:"consumablesPurchased"`
	DamageDealtPlayer               int  `json:"damageDealtPlayer"`
	DoubleKills                     int  `json:"doubleKills"`
	FirstBlood                      int  `json:"firstBlood"`
	Gold                            int  `json:"gold"`
	GoldEarned                      int  `json:"goldEarned"`
	GoldSpent                       int  `json:"goldSpent"`
	Item0                           int  `json:"item0"`
	Item1                           int  `json:"item1"`
	Item2                           int  `json:"item2"`
	Item3                           int  `json:"item3"`
	Item4                           int  `json:"item4"`
	Item5                           int  `json:"item5"`
	Item6                           int  `json:"item6"`
	ItemsPurchased                  int  `json:"itemsPurchased"`
	KillingSprees                   int  `json:"killingSprees"`
	LargestCriticalStrike           int  `json:"largestCriticalStrike"`
	LargestKillingSpree             int  `json:"largestKillingSpree"`
	LargestMultiKill                int  `json:"largestMultiKill"`
	LegendaryItemsCreated           int  `json:"legendaryItemsCreated"`
	Level                           int  `json:"level"`
	MagicDamageDealtPlayer          int  `json:"magicDamageDealtPlayer"`
	MagicDamageDealtToChampions     int  `json:"magicDamageDealtToChampions"`
	MagicDamageTaken                int  `json:"magicDamageTaken"`
	MinionsDenied                   int  `json:"minionsDenied"`
	MinionsKilled                   int  `json:"minionsKilled"`
	NeutralMinionsKilled            int  `json:"neutralMinionsKilled"`
	NeutralMinionsKilledEnemyJungle int  `json:"neutralMinionsKilledEnemyJungle"`
	NeutralMinionsKilledYourJungle  int  `json:"neutralMinionsKilledYourJungle"`
	NexusKilled                     bool `json:"nexusKilled"`
	NodeCapture                     int  `json:"nodeCapture"`
	NodeCaptureAssist               int  `json:"nodeCaptureAssist"`
	NodeNeutralize                  int  `json:"nodeNeutralize"`
	NodeNeutralizeAssist            int  `json:"nodeNeutralizeAssist"`
	NumDeaths                       int  `json:"numDeaths"`
	NumItemsBought                  int  `json:"numItemsBought"`
	ObjectivePlayerScore            int  `json:"objectivePlayerScore"`
	PentaKills                      int  `json:"pentaKills"`
	PhysicalDamageDealtPlayer       int  `json:"physicalDamageDealtPlayer"`
	PhysicalDamageDealtToChampions  int  `json:"physicalDamageDealtToChampions"`
	PhysicalDamageTaken             int  `json:"physicalDamageTaken"`
	QuadraKills                     int  `json:"quadraKills"`
	SightWardsBought                int  `json:"sightWardsBought"`
	Spell1Cast                      int  `json:"spell1Cast"`
	Spell2Cast                      int  `json:"spell2Cast"`
	Spell3Cast                      int  `json:"spell3Cast"`
	Spell4Cast                      int  `json:"spell4Cast"`
	SummonSpell1Cast                int  `json:"summonSpell1Cast"`
	SummonSpell2Cast                int  `json:"summonSpell2Cast"`
	SuperMonsterKilled              int  `json:"superMonsterKilled"`
	Team                            int  `json:"team"`
	TeamObjective                   int  `json:"teamObjective"`
	TimePlayed                      int  `json:"timePlayed"`
	TotalDamageDealt                int  `json:"totalDamageDealt"`
	TotalDamageDealtToChampions     int  `json:"totalDamageDealtToChampions"`
	TotalDamageTaken                int  `json:"totalDamageTaken"`
	TotalHeal                       int  `json:"totalHeal"`
	TotalPlayerScore                int  `json:"totalPlayerScore"`
	TotalScoreRank                  int  `json:"totalScoreRank"`
	TotalTimeCrowdControlDealt      int  `json:"totalTimeCrowdControlDealt"`
	TotalUnitsHealed                int  `json:"totalUnitsHealed"`
	TripleKills                     int  `json:"tripleKills"`
	TrueDamageDealtPlayer           int  `json:"trueDamageDealtPlayer"`
	TrueDamageDealtToChampions      int  `json:"trueDamageDealtToChampions"`
	TrueDamageTaken                 int  `json:"trueDamageTaken"`
	TurretsKilled                   int  `json:"turretsKilled"`
	UnrealKills                     int  `json:"unrealKills"`
	VictoryPointTotal               int  `json:"victoryPointTotal"`
	VisionWardsBought               int  `json:"visionWardsBought"`
	WardKilled                      int  `json:"wardKilled"`
	WardPlaced                      int  `json:"wardPlaced"`
	Win                             bool `json:"win"`
}

GameStat represents a stat for the assosiated Game

type Games

type Games struct {
	ClientRefreshInterval int64          `json:"clientRefreshInterval"`
	GameList              []FeaturedGame `json:"gameList"`
}

type League

type League struct {
	Entries       []LeagueItem `json:"entries"`
	Name          string       `json:"name"`
	ParticipantId string       `json:"participantId"`
	Queue         string       `json:"queue"`
	Tier          string       `json:"tier"`
}

League represents a League of Legends league

func LeagueByChallenger

func LeagueByChallenger(region string, queueType string) (league League, err error)

LeagueByChallenger retrieves all the league entries for the Challenger group It returns a League and any errors that occured from the server The global API key must be set before use

type LeagueItem

type LeagueItem struct {
	Division         string     `json:"division"`
	IsFreshBlood     bool       `json:"isFreshBlood"`
	IsHotStreak      bool       `json:"isHotStreak"`
	IsInactive       bool       `json:"isInactive"`
	IsVeteran        bool       `json:"isVeteran"`
	LeaguePoints     int        `json:"leaguePoints"`
	MiniSeries       MiniSeries `json:"miniSeries"`
	PlayerOrTeamID   string     `json:"playerOrTeamId"`
	PlayerOrTeamName string     `json:"playerOrTeamName"`
	Wins             int        `json:"wins"`
}

LeagueItem is an entry in a League. It represents a player or team

type Mastery

type Mastery struct {
	ID   int `json:"id"`
	Rank int `json:"rank"`
}

Mastery located inside a page

type MasteryPage

type MasteryPage struct {
	Current   bool      `json:"current"`
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Masteries []Mastery `json:"masteries"`
}

MasteryPage represents a League of Legends mastery page

type MatchDetail

type MatchDetail struct {
	MapID                 int                   `json:"mapId"`
	MatchCreation         int64                 `json:"matchCreation"`
	MatchDuration         int64                 `json:"matchDuration"`
	MatchID               int64                 `json:"matchId"`
	MatchVersion          string                `json:"matchVersion"`
	ParticipantIdentities []ParticipantIdentity `json:"participantIdentities"`
	Participants          []Participant         `json:"participants"`
	QueueType             string                `json:"queueType"`
	Region                string                `json:"region"`
	Season                string                `json:"season"`
	Teams                 []TeamGameDetails     `json:"teams"`
	Timeline              Timeline              `json:"timeline"`
}

func MatchByMatchID

func MatchByMatchID(region string, includeTimeline bool, matchID int64) (match MatchDetail, err error)

MatchByMatchID requests the MatchDetails from Riot You can optionally include the timeline of events if needed API key needs to be set prior to use

type MatchHistorySummary

type MatchHistorySummary struct {
	Assists           int    `json:"assists"`
	Date              int64  `json:"date"`
	Deaths            int    `json:"deaths"`
	GameID            int64  `json:"gameId"`
	GameMode          string `json:"gameMode"`
	Invalid           bool   `json:"invalid"`
	Kills             int    `json:"kills"`
	MapID             int    `json:"mapId"`
	OpposingTeamKills int    `json:"opposingTeamKills"`
	OpposingTeamName  string `json:"opposingTeamName"`
	Win               bool   `json:"win"`
}

MatchHistorySummary is a summary of a matches played by a Team

type MatchPlayer

type MatchPlayer struct {
	MatchHistoryURI string `json:"matchHistoryUri"`
	ProfileIcon     int    `json:"profileIcon"`
	SummonerName    string `json:"summonerName"`
	SummonerId      int    `json:"summonerId"`
}

type MatchSummary

type MatchSummary struct {
	MapID                 int                   `json:"mapId"`
	MatchCreation         int64                 `json:"matchCreation"`
	MatchDuration         int64                 `json:"matchDuration"`
	MatchVersion          string                `json:"matchVersion"`
	ParticipantIdentities []ParticipantIdentity `json:"participantIdentities"`
	Participants          []Participant         `json:"participants"`
	QueueType             string                `json:"queueType"`
	Region                string                `json:"region"`
	Season                string                `json:"season"`
}

type MiniSeries

type MiniSeries struct {
	Losses   int    `json:"losses"`
	Progress string `json:"progress"`
	Target   int    `json:"target"`
	Wins     int    `json:"wins"`
}

MiniSeries shows if a player is in their Series and how far they are within it

type Participant

type Participant struct {
	ChampionID    int                 `json:"championId"`
	ParticipantID int                 `json:"participantId"`
	Spell1ID      int                 `json:"spell1Id"`
	Spell2ID      int                 `json:"spell2Id"`
	Stats         ParticipantStats    `json:"stats"`
	TeamID        int                 `json:"teamId"`
	Timeline      ParticipantTimeline `json:"timeline"`
	ProfileIconID int                 `json:"profileIconId"`
	SummonerName  string              `json:"summonerName"`
	Bot           bool                `json:"bot"`
}

type ParticipantFrame

type ParticipantFrame struct {
	CurrentGold         int      `json:"currentGold"`
	JungleMinionsKilled int      `json:"jungleMinionsKilled"`
	Level               int      `json:"level"`
	MinionsKilled       int      `json:"minionsKilled"`
	ParticipantID       int      `json:"participantId"`
	Position            Position `json:"position"`
	TotalGold           int      `json:"totalGold"`
	Xp                  int      `json:"xp"`
}

type ParticipantIdentity

type ParticipantIdentity struct {
	ParticipantId int         `json:"participantId"`
	Player        MatchPlayer `json:"player"`
}

type ParticipantStats

type ParticipantStats struct {
	Assists                         int64 `json:"assists"`
	ChampLevel                      int64 `json:"champLevel"`
	CombatPlayerScore               int64 `json:"combatPlayerScore"`
	Deaths                          int64 `json:"deaths"`
	DoubleKills                     int64 `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                      int64 `json:"goldEarned"`
	GoldSpent                       int64 `json:"goldSpent"`
	InhibitorKills                  int64 `json:"inhibitorKills"`
	Item0                           int64 `json:"item0"`
	Item1                           int64 `json:"item1"`
	Item2                           int64 `json:"item2"`
	Item3                           int64 `json:"item3"`
	Item4                           int64 `json:"item4"`
	Item5                           int64 `json:"item5"`
	Item6                           int64 `json:"item6"`
	KillingSprees                   int64 `json:"killingSprees"`
	Kills                           int64 `json:"kills"`
	LargestCriticalStrike           int64 `json:"largestCriticalStrike"`
	LargestKillingSpree             int64 `json:"largestKillingSpree"`
	LargestMultiKill                int64 `json:"largestMultiKill"`
	MagicDamageDealt                int64 `json:"magicDamageDealt"`
	MagicDamageDealtToChampions     int64 `json:"magicDamageDealtToChampions"`
	MagicDamageTaken                int64 `json:"magicDamageTaken"`
	MinionsKilled                   int64 `json:"minionsKilled"`
	NeutralMinionsKilled            int64 `json:"neutralMinionsKilled"`
	NeutralMinionsKilledEnemyJungle int64 `json:"neutralMinionsKilledEnemyJungle"`
	NeutralMinionsKilledTeamJungle  int64 `json:"neutralMinionsKilledTeamJungle"`
	NodeCapture                     int64 `json:"nodeCapture"`
	NodeCaptureAssist               int64 `json:"nodeCaptureAssist"`
	NodeNeutralize                  int64 `json:"nodeNeutralize"`
	NodeNeutralizeAssist            int64 `json:"nodeNeutralizeAssist"`
	ObjectivePlayerScore            int64 `json:"objectivePlayerScore"`
	PentaKills                      int64 `json:"pentaKills"`
	PhysicalDamageDealt             int64 `json:"physicalDamageDealt"`
	PhysicalDamageDealtToChampions  int64 `json:"physicalDamageDealtToChampions"`
	PhysicalDamageTaken             int64 `json:"physicalDamageTaken"`
	QuadraKills                     int64 `json:"quadraKills"`
	SightWardsBoughtInGame          int64 `json:"sightWardsBoughtInGame"`
	TeamObjective                   int64 `json:"teamObjective"`
	TotalDamageDealt                int64 `json:"totalDamageDealt"`
	TotalDamageDealtToChampions     int64 `json:"totalDamageDealtToChampions"`
	TotalDamageTaken                int64 `json:"totalDamageTaken"`
	TotalHeal                       int64 `json:"totalHeal"`
	TotalPlayerScore                int64 `json:"totalPlayerScore"`
	TotalScoreRank                  int64 `json:"totalScoreRank"`
	TotalTimeCrowdControlDealt      int64 `json:"totalTimeCrowdControlDealt"`
	TotalUnitsHealed                int64 `json:"totalUnitsHealed"`
	TowerKills                      int64 `json:"towerKills"`
	TripleKills                     int64 `json:"tripleKills"`
	TrueDamageDealt                 int64 `json:"trueDamageDealt"`
	TrueDamageDealtToChampions      int64 `json:"trueDamageDealtToChampions"`
	TrueDamageTaken                 int64 `json:"trueDamageTaken"`
	UnrealKills                     int64 `json:"unrealKills"`
	VisionWardsBoughtInGame         int64 `json:"visionWardsBoughtInGame"`
	WardsKilled                     int64 `json:"wardsKilled"`
	WardsPlaced                     int64 `json:"wardsPlaced"`
	Winner                          bool  `json:"winner"`
}

type ParticipantTimeline

type ParticipantTimeline struct {
	AncientGolemAssistsPerMinCounts ParticipantTimelineData `json:"ancientGolemAssistsPerMinCounts"`
	AncientGolemKillsPerMinCounts   ParticipantTimelineData `json:"ancientGolemKillsPerMinCounts"`
	AssistedLaneDeathsPerMinDeltas  ParticipantTimelineData `json:"assistedLaneDeathsPerMinDeltas"`
	BaronAssistsPerMinCounts        ParticipantTimelineData `json:"baronAssistsPerMinCounts"`
	BaronKillsPerMinCounts          ParticipantTimelineData `json:"baronKillsPerMinCounts"`
	CreepsPerMinDeltas              ParticipantTimelineData `json:"creepsPerMinDeltas"`
	CsDiffPerMinDeltas              ParticipantTimelineData `json:"csDiffPerMinDeltas"`
	DamageTakenDiffPerMinDeltas     ParticipantTimelineData `json:"damageTakenDiffPerMinDeltas"`
	DamageTakenPerMinDeltas         ParticipantTimelineData `json:"damageTakenPerMinDeltas"`
	DragonAssistsPerMinCounts       ParticipantTimelineData `json:"dragonAssistsPerMinCounts"`
	DragonKillsPerMinCounts         ParticipantTimelineData `json:"dragonKillsPerMinCounts"`
	ElderLizardAssistsPerMinCounts  ParticipantTimelineData `json:"elderLizardAssistsPerMinCounts"`
	ElderLizardKillsPerMinCounts    ParticipantTimelineData `json:"elderLizardKillsPerMinCounts"`
	GoldPerMinDeltas                ParticipantTimelineData `json:"goldPerMinDeltas"`
	InhibitorAssistsPerMinCounts    ParticipantTimelineData `json:"inhibitorAssistsPerMinCounts"`
	InhibitorKillsPerMinCounts      ParticipantTimelineData `json:"inhibitorKillsPerMinCounts"`
	Lane                            string                  `json:"lane"`
	Role                            string                  `json:"role"`
	TowerAssistsPerMinCounts        ParticipantTimelineData `json:"towerAssistsPerMinCounts"`
	TowerKillsPerMinCounts          ParticipantTimelineData `json:"towerKillsPerMinCounts"`
	TowerKillsPerMinDeltas          ParticipantTimelineData `json:"towerKillsPerMinDeltas"`
	VilemawAssistsPerMinCounts      ParticipantTimelineData `json:"vilemawAssistsPerMinCounts"`
	VilemawKillsPerMinCounts        ParticipantTimelineData `json:"vilemawKillsPerMinCounts"`
	WardsPerMinDeltas               ParticipantTimelineData `json:"wardsPerMinDeltas"`
	XpDiffPerMinDeltas              ParticipantTimelineData `json:"xpDiffPerMinDeltas"`
	XpPerMinDeltas                  ParticipantTimelineData `json:"xpPerMinDeltas"`
}

type ParticipantTimelineData

type ParticipantTimelineData struct {
	TenToTwenty    float64 `json:"tenToTwenty"`
	ThirtyToEnd    float64 `json:"thirtyToEnd"`
	TwentyToThirty float64 `json:"twentyToThirty"`
	ZeroToTen      float64 `json:"zeroToTen"`
}

type Player

type Player struct {
	ChampionID int   `json:"championId"`
	SummonerID int64 `json:"summonerId"`
	TeamID     int   `json:"teamId"`
}

Player represents a League of Legends player that was in the requested game

type PlayerHistory

type PlayerHistory struct {
	Matches []MatchSummary `json:"matches"`
}

func MatchHistoryBySummonerID

func MatchHistoryBySummonerID(
	region string,
	summonerID int64,
	championIDs []int64,
	rankedQueues []string,
	beginIndex int,
	endIndex int) (
	playerHistory PlayerHistory, err error)

type PlayerStatsSummary

type PlayerStatsSummary struct {
	AggregatedStats       AggregatedStats `json:"aggregatedStats"`
	Losses                int             `json:"losses"`
	ModifyDate            int64           `json:"modifyDate"`
	PlayerStatSummaryType string          `json:"playerStatSummaryType"`
	Wins                  int             `json:"wins"`
}

PlayerStatsSummary represents a summary of a League of Legends player's game stats

func StatSummariesBySummoner

func StatSummariesBySummoner(region string, summonerID int64, season string) (stats []PlayerStatsSummary, err error)

StatSummariesBySummoner retrieves the statistics of the supplied summonerID from Riot Games API. It returns an array of PlayerStatsSummary and any errors that occured from the server The global API key must be set before use

type Position

type Position struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type RankedStats

type RankedStats struct {
	Champions  []ChampionStats `json:"champions"`
	ModifyDate int64           `json:"modifyDate"`
	SummonerID int64           `json:"summonerId"`
}

RankedStats represents a League of Legends player's statistics for ranked play

func RankedStatsBySummoner

func RankedStatsBySummoner(region string, summonerID int64, season string) (stats RankedStats, err error)

RankedStatsBySummoner retrieves the ranked statistics of the supplied summonerID from Riot Games API. It returns a RankedStats and any errors that occured from the server The global API key must be set before use

type RiotError

type RiotError struct {
	StatusCode int
}

RiotError contains the http status code of the erro

func (RiotError) Error

func (err RiotError) Error() string

Error prints the error message for a RiotError

type Roster

type Roster struct {
	MemberList []TeamMemberInfo `json:"memberList"`
	OwnerID    int64            `json:"ownerId"`
}

Roster represents the roster of a League of Legends ranked team

type RunePage

type RunePage struct {
	Current bool       `json:"current"`
	ID      int64      `json:"id"`
	Name    string     `json:"name"`
	Slots   []RuneSlot `json:"slots"`
}

RunePage is a League of Legends rune page

type RuneSlot

type RuneSlot struct {
	RuneId     int `json:"runeId"`
	RuneSlotID int `json:"runeSlotId"`
}

RuneSlot is a slot for a Rune to go on a RunePage

type Summoner

type Summoner struct {
	ProfileIconID int    `json:"profileIconId"`
	SummonerLevel int    `json:"summonerLevel"`
	ID            int64  `json:"id"`
	Name          string `json:"name"`
	RevisionDate  int64  `json:"revisionDate"`
}

Summoner is a player of League of Legends

type Team

type Team struct {
	CreateDate                    int64                 `json:"createDate"`
	FullID                        string                `json:"fullId"`
	LastGameDate                  int64                 `json:"lastGameDate"`
	LastJoinDate                  int64                 `json:"lastJoinDate"`
	LastJoinedRankedTeamQueueDate int64                 `json:"lastJoinedRankedTeamQueueDate"`
	MatchHistory                  []MatchHistorySummary `json:"matchHistory"`
	ModifyDate                    int64                 `json:"modifyDate"`
	Name                          string                `json:"name"`
	Roster                        Roster                `json:"roster"`
	SecondLastJoinDate            int64                 `json:"secondLastJoinDate"`
	Status                        string                `json:"status"`
	Tag                           string                `json:"tag"`
	TeamStatDetails               []TeamStatDetail      `json:"teamStatDetails"`
	ThirdJoinDate                 int64                 `json:"thirdLastJoinDate"`
}

Team is a League of Legends Ranked Team

type TeamGameDetails

type TeamGameDetails struct {
	Bans           []BannedChampion `json:"bans"`
	BaronKills     int              `json:"baronKills"`
	DragonKills    int              `json:"dragonKills"`
	FirstBaron     bool             `json:"firstBaron"`
	FirstBlood     bool             `json:"firstBlood"`
	FirstDragon    bool             `json:"firstDragon"`
	FirstInhibitor bool             `json:"firstInhibitor"`
	FirstTower     bool             `json:"firstTower"`
	InhibitorKills int              `json:"inhibitorKills"`
	TeamID         int              `json:"teamId"`
	TowerKills     int              `json:"towerKills"`
	VilemawKills   int              `json:"vilemawKills"`
	Winner         bool             `json:"winner"`
}

type TeamMemberInfo

type TeamMemberInfo struct {
	InviteDate int64  `json:"inviteDate"`
	JoinDate   int64  `json:"joinDate"`
	PlayerID   int64  `json:"playerId"`
	Status     string `json:"status"`
}

TeamMemberInfo is the individual information for a player on a ranked team

type TeamStatDetail

type TeamStatDetail struct {
	AverageGamesPlayed int    `json:"averageGamesPlayed"`
	Losses             int    `json:"losses"`
	TeamStatType       string `json:"teamStatType"`
	Wins               int    `json:"wins"`
}

TeamStatDetail is the statistics for a ranked team

type Timeline

type Timeline struct {
	FrameInterval int64   `json:"frameInterval"`
	Frames        []Frame `json:"frames"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL