lol

package
v0.0.0-...-7a420e3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueueRankedSolo            queue = "RANKED_SOLO_5x5"
	QueueRankedFlex                  = "RANKED_FLEX_SR"
	QueueRankedTwistedTreeline       = "RANKED_FLEX_TT"
)

All possible queues

View Source
const (
	TierIron     tier = "IRON"
	TierBronze        = "BRONZE"
	TierSilver        = "SILVER"
	TierGold          = "GOLD"
	TierPlatinum      = "PLATINUM"
	TierDiamond       = "DIAMOND"
)

All possible Tiers

View Source
const (
	DivisionOne   division = "I"
	DivisionTwo            = "II"
	DivisionThree          = "III"
	DivisionFour           = "IV"
)

All possible divisions

View Source
const (
	MatchEventTypeChampionKill     MatchEventType = "CHAMPION_KILL"
	MatchEventTypeWardPlaced                      = "WARD_PLACED"
	MatchEventTypeWardKill                        = "WARD_KILL"
	MatchEventTypeBuildingKill                    = "BUILDING_KILL"
	MatchEventTypeEliteMonsterKill                = "ELITE_MONSTER_KILL"
	MatchEventTypeItemPurchased                   = "ITEM_PURCHASED"
	MatchEventTypeItemSold                        = "ITEM_SOLD"
	MatchEventTypeItemDestroyed                   = "ITEM_DESTROYED"
	MatchEventTypeItemUndo                        = "ITEM_UNDO"
	MatchEventTypeSkillLevelUp                    = "SKILL_LEVEL_UP"
	MatchEventTypeAscendedEvent                   = "ASCENDED_EVENT"
	MatchEventTypeCapturePoint                    = "CAPTURE_POINT"
	MatchEventTypePoroKingSummon                  = "PORO_KING_SUMMON"
)

All legal value for match event types

Variables

View Source
var (
	// Queues is a list of all available queue types
	Queues = []queue{
		QueueRankedSolo,
		QueueRankedFlex,
		QueueRankedTwistedTreeline,
	}

	// Tiers is a list of all available tiers
	Tiers = []tier{
		TierIron,
		TierBronze,
		TierSilver,
		TierGold,
		TierPlatinum,
		TierDiamond,
	}

	// Divisions is a list of all available divisions
	Divisions = []division{
		DivisionOne,
		DivisionTwo,
		DivisionThree,
		DivisionFour,
	}
)

Functions

This section is empty.

Types

type BannedChampion

type BannedChampion struct {
	PickTurn   int `json:"pickTurn"`
	ChampionID int `json:"championId"`
	TeamID     int `json:"teamId"`
}

BannedChampion represents a champion ban during pack/ban phase

func (*BannedChampion) GetChampion

GetChampion returns the banned champion

type ChampionClient

type ChampionClient struct {
	// contains filtered or unexported fields
}

ChampionClient provides methods for the champions endpoints of the League of Legends API.

func (*ChampionClient) GetFreeRotation

func (c *ChampionClient) GetFreeRotation() (*ChampionInfo, error)

GetFreeRotation returns information about the current free champion rotation

type ChampionInfo

type ChampionInfo struct {
	FreeChampionIDsForNewPlayers []int `json:"freeChampionIDsForNewPlayers"`
	FreeChampionIDs              []int `json:"freeChampionIDs"`
	MaxNewPlayerLevel            int   `json:"maxNewPlayerLevel"`
}

ChampionInfo contains information about the free champion rotation

func (*ChampionInfo) GetChampions

func (i *ChampionInfo) GetChampions(client *datadragon.Client) ([]datadragon.ChampionDataExtended, error)

GetChampions returns data for champions available for free

func (*ChampionInfo) GetChampionsForNewPlayers

func (i *ChampionInfo) GetChampionsForNewPlayers(client *datadragon.Client) ([]datadragon.ChampionDataExtended, error)

GetChampionsForNewPlayers returns data for champions available for free to new players

type ChampionMastery

type ChampionMastery struct {
	ChestGranted                 bool   `json:"chestGranted"`
	ChampionLevel                int    `json:"championLevel"`
	ChampionPoints               int    `json:"championPoints"`
	ChampionID                   int    `json:"championId"`
	ChampionPointsUntilNextLevel int    `json:"championPointsUntilNextLevel"`
	LastPlayTime                 int    `json:"lastPlayTime"`
	TokensEarned                 int    `json:"tokensEarned"`
	ChampionPointsSinceLastLevel int    `json:"championPointsSinceLastLevel"`
	SummonerID                   string `json:"summonerId"`
}

ChampionMastery represents the mastery of a champion in the mastery system for a summoner

func (*ChampionMastery) GetChampion

GetChampion returns the champion of this mastery

func (*ChampionMastery) GetSummoner

func (m *ChampionMastery) GetSummoner(client *Client) (*Summoner, error)

GetSummoner returns the summoner of this mastery

type ChampionMasteryClient

type ChampionMasteryClient struct {
	// contains filtered or unexported fields
}

ChampionMasteryClient provides methods for the champion mastery endpoints of the League of Legends API.

func (*ChampionMasteryClient) Get

func (c *ChampionMasteryClient) Get(summonerID, championID string) (*ChampionMastery, error)

Get returns information about the mastery of the champion with the given ID the summoner with the given ID has

func (*ChampionMasteryClient) GetTotal

func (c *ChampionMasteryClient) GetTotal(summonerID string) (int, error)

GetTotal returns the accumulated mastery score of all champions played by the summoner with the given ID

func (*ChampionMasteryClient) List

func (c *ChampionMasteryClient) List(summonerID string) ([]*ChampionMastery, error)

List returns information about masteries for the summoner with the given ID

type Client

type Client struct {
	ChampionMastery *ChampionMasteryClient
	Champion        *ChampionClient
	League          *LeagueClient
	Status          *StatusClient
	Match           *MatchClient
	Spectator       *SpectatorClient
	Summoner        *SummonerClient
	ThirdPartyCode  *ThirdPartyCodeClient
	Tournament      *TournamentClient
}

Client pools all methods for endpoints of the League of Legends API.

func NewClient

func NewClient(base *internal.Client) *Client

NewClient returns a new instance of a League of Legends client.

type CurrentGameParticipant

type CurrentGameParticipant struct {
	ProfileIconID            int                        `json:"profileIconId"`
	ChampionID               int                        `json:"championId"`
	SummonerName             string                     `json:"summonerName"`
	GameCustomizationObjects []*GameCustomizationObject `json:"gameCustomizationObjects"`
	Bot                      bool                       `json:"bot"`
	Perks                    *Perks                     `json:"perks"`
	Spell2ID                 int                        `json:"spell2Id"`
	Spell1ID                 int                        `json:"spell1Id"`
	TeamID                   int                        `json:"teamId"`
	SummonerID               string                     `json:"summonerId"`
}

CurrentGameParticipant represents a player in an ongoing game

func (*CurrentGameParticipant) GetChampion

GetChampion returns the champion played by this participant

func (*CurrentGameParticipant) GetSpell1

GetSpell1 returns the first summoner spell of this participant

func (*CurrentGameParticipant) GetSpell2

GetSpell2 returns the second summoner spell of this participant

type FeaturedGames

type FeaturedGames struct {
	ClientRefreshInterval int         `json:"clientRefreshInterval"`
	GameList              []*GameInfo `json:"gameList"`
}

FeaturedGames represents a list of featured games

type GameCustomizationObject

type GameCustomizationObject struct {
	Category string `json:"category"`
	Content  string `json:"content"`
}

GameCustomizationObject contains information specific to an ongoing game

type GameInfo

type GameInfo struct {
	GameID            int                       `json:"gameId"`
	GameStartTime     int                       `json:"gameStartTime"`
	PlatformID        string                    `json:"platformId"`
	GameMode          string                    `json:"gameMode"`
	MapID             int                       `json:"mapId"`
	GameType          string                    `json:"gameType"`
	BannedChampions   []*BannedChampion         `json:"bannedChampions"`
	Observers         *Observer                 `json:"observers"`
	Participants      []*CurrentGameParticipant `json:"participants"`
	GameLength        int                       `json:"gameLength"`
	GameQueueConfigID int                       `json:"gameQueueConfigId"`
}

GameInfo contains information about an ongoing game

func (*GameInfo) GetMatch

func (i *GameInfo) GetMatch(client *Client) (*Match, error)

GetMatch returns information about the finished match

type Incident

type Incident struct {
	Active    bool             `json:"active"`
	CreatedAt string           `json:"created_at"`
	ID        int              `json:"id"`
	Updates   []*StatusMessage `json:"updates"`
}

Incident contains information about an incident

type LeagueClient

type LeagueClient struct {
	// contains filtered or unexported fields
}

LeagueClient provides methods for league endpoints of the League of Legends API.

func (*LeagueClient) Get

func (l *LeagueClient) Get(leagueID string) (*LeagueList, error)

Get returns a ranked league with the specified ID

func (*LeagueClient) GetChallenger

func (l *LeagueClient) GetChallenger(queue queue) (*LeagueList, error)

GetChallenger returns the current Challenger league for the Region

func (*LeagueClient) GetGrandmaster

func (l *LeagueClient) GetGrandmaster(queue queue) (*LeagueList, error)

GetGrandmaster returns the current Grandmaster league for the Region

func (*LeagueClient) GetMaster

func (l *LeagueClient) GetMaster(queue queue) (*LeagueList, error)

GetMaster returns the current Master league for the Region

func (*LeagueClient) ListBySummoner

func (l *LeagueClient) ListBySummoner(summonerID string) ([]*LeagueItem, error)

ListBySummoner returns all leagues a summoner with the given ID is in

func (*LeagueClient) ListPlayers

func (l *LeagueClient) ListPlayers(queue queue, tier tier, division division) ([]*LeagueItem, error)

ListPlayers returns all players with a league specified by its queue, tier and division

type LeagueItem

type LeagueItem struct {
	QueueType    string      `json:"queueType"`
	SummonerName string      `json:"summonerName"`
	HotStreak    bool        `json:"hotStreak"`
	MiniSeries   *MiniSeries `json:"miniSeries"`
	Wins         int         `json:"wins"`
	Veteran      bool        `json:"veteran"`
	Losses       int         `json:"losses"`
	FreshBlood   bool        `json:"freshBlood"`
	Inactive     bool        `json:"inactive"`
	Tier         string      `json:"tier"`
	Rank         string      `json:"rank"`
	SummonerID   string      `json:"summonerId"`
	LeaguePoints int         `json:"leaguePoints"`
}

LeagueItem represents a summoners ranked position in a league

func (*LeagueItem) GetSummoner

func (i *LeagueItem) GetSummoner(client *Client) (*Summoner, error)

GetSummoner returns the summoner of this league item

type LeagueList

type LeagueList struct {
	LeagueID string        `json:"leagueId"`
	Tier     string        `json:"tier"`
	Entries  []*LeagueItem `json:"entries"`
	Queue    string        `json:"queue"`
	Name     string        `json:"name"`
	// contains filtered or unexported fields
}

LeagueList represents a league containing all player entries in it

func (*LeagueList) GetRank

func (l *LeagueList) GetRank(i int) *LeagueItem

GetRank returns the entry at the given rank, sorted by league points

type LobbyEvent

type LobbyEvent struct {
	EventType  string `json:"eventType"`
	SummonerID string `json:"summonerId"`
	Timestamp  string `json:"timestamp"`
}

LobbyEvent represents an event that happened in a tournament lobby

type LobbyEventList

type LobbyEventList struct {
	EventList []*LobbyEvent `json:"eventList"`
}

LobbyEventList is a wrapper for a list of lobby events in a tournament

type Match

type Match struct {
	// Match metadata
	Metadata *MatchMetadata `json:"metadata"`
	// Match info
	Info *MatchInfo `json:"info"`
}

Match contains information about a match

type MatchClient

type MatchClient struct {
	// contains filtered or unexported fields
}

MatchClient provides methods for the match endpoints of the League of Legends API.

func (*MatchClient) Get

func (m *MatchClient) Get(id string) (*Match, error)

Get returns a match specified by its ID

func (*MatchClient) GetTimeline

func (m *MatchClient) GetTimeline(id string) (*MatchTimeline, error)

GetTimeline returns the timeline for the given match NOTE: timelines are not available for every match TODO: update to v5 when struct is documented

func (*MatchClient) List

func (m *MatchClient) List(puuid string, start, count int, options ...*MatchListOptions) (
	[]string, error)

List returns a list of match ids by puuid

func (*MatchClient) ListStream

func (m *MatchClient) ListStream(puuid string, options ...*MatchListOptions) <-chan MatchStreamValue

ListStream returns all matches played on this account as a stream, requesting new until there are no more new games

type MatchEvent

type MatchEvent 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                    *MatchEventType `json:"type"`
	SkillSlot               int             `json:"skillSlot"`
	VictimID                int             `json:"victimId"`
	Timestamp               int             `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                *MatchPosition  `json:"position"`
	BeforeID                int             `json:"beforeId"`
}

MatchEvent is an event in a match at a certain timestamp

func (*MatchEvent) GetItem

func (e *MatchEvent) GetItem(client *datadragon.Client) (datadragon.Item, error)

GetItem returns the item for this event

type MatchEventType

type MatchEventType string

MatchEventType is the type of an event

type MatchFrame

type MatchFrame struct {
	Timestamp         int                          `json:"timestamp"`
	ParticipantFrames map[string]*ParticipantFrame `json:"participantFrames"`
	Events            []*MatchEvent                `json:"events"`
}

MatchFrame is a single frame in the timeline of a game

type MatchInfo

type MatchInfo struct {
	// Unix timestamp for when the game is created on the game server (i.e., the loading screen).
	GameCreation int64 `json:"gameCreation"`
	// Prior to patch 11.20, this field returns the game length in milliseconds calculated
	// from gameEndTimestamp - gameStartTimestamp. Post patch 11.20, this field returns the max
	// timePlayed of any participant in the game in seconds, which makes the behavior of this
	// field consistent with that of match-v4. The best way to handling the change in this field
	// is to treat the value as milliseconds if the gameEndTimestamp field isn't in the response
	// and to treat the value as seconds if gameEndTimestamp is in the response.
	GameDuration int `json:"gameDuration"`
	// Unix timestamp for when match ends on the game server. This timestamp can occasionally
	// be significantly longer than when the match "ends". The most reliable way of determining
	// the timestamp for the end of the match would be to add the max time played of any
	// participant to the gameStartTimestamp. This field was added to match-v5 in patch 11.20 on Oct 5th, 2021.
	GameEndTimestamp int64 `json:"gameEndTimestamp"`
	GameID           int64 `json:"gameId"`
	// Please refer to the Game Constants documentation.
	GameMode string `json:"gameMode"`
	GameName string `json:"gameName"`
	// Unix timestamp for when match starts on the game server.
	GameStartTimestamp int64 `json:"gameStartTimestamp"`
	// Please refer to the Game Constants documentation.
	GameType string `json:"gameType"`
	// The first two parts can be used to determine the patch a game was played on.
	GameVersion string `json:"gameVersion"`
	// Please refer to the Game Constants documentation.
	MapID int `json:"mapId"`
	// Participant information.
	Participants []*Participant `json:"participants"`
	// Platform where the match was played.
	PlatformID string `json:"platformId"`
	// Please refer to the Game Constants documentation.
	QueueID int `json:"queueId"`
	// Team information.
	Teams []*Team `json:"teams"`
	// Tournament code used to generate the match. This field was added to match-v5 in patch 11.13 on June 23rd, 2021.
	TournamentCode string `json:"tournamentCode"`
}

MatchInfo contains the data for a specific match

func (*MatchInfo) GetGameMode

func (m *MatchInfo) GetGameMode(client *static.Client) (static.GameMode, error)

GetGameMode returns the gameMode this match was played in

func (*MatchInfo) GetGameType

func (m *MatchInfo) GetGameType(client *static.Client) (static.GameType, error)

GetGameType returns the gameType this match was played in

func (*MatchInfo) GetMap

func (m *MatchInfo) GetMap(client *static.Client) (static.Map, error)

GetMap returns the map this match was played on

func (*MatchInfo) GetQueue

func (m *MatchInfo) GetQueue(client *static.Client) (static.Queue, error)

GetQueue returns the queue this match was played in

type MatchListOptions

type MatchListOptions struct {
	// Filter the list of match ids by a specific queue id. This filter is mutually inclusive
	// of the type filter meaning any match ids returned must match both the queue and type filters.
	Queue *int
	// Filter the list of match ids by the type of match. This filter is mutually inclusive of
	// the queue filter meaning any match ids returned must match both the queue and type
	// filters. (see static.GameType.Type).
	Type string

	// Filter the list of matches by start and/or end time. The matchlist started storing timestamps
	// on June 16th, 2021. Any matches played before June 16th, 2021 won't be included in the results
	// if the StartTime filter is set.
	StartTime, EndTime time.Time
}

MatchListOptions providing additional options for List

type MatchMetadata

type MatchMetadata struct {
	// Match data version
	DataVersion string `json:"dataVersion"`
	// Match ID
	MatchID string `json:"matchId"`
	// List of participant PUUIDs
	Participants []string `json:"participants"`
}

MatchMetadata contains metadata for a specific match

type MatchPosition

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

MatchPosition is a position on the map in a game

type MatchStreamValue

type MatchStreamValue struct {
	MatchID string
	Error   error
}

MatchStreamValue value returned by ListStream, containing either a reference to a match or an error

type MatchTimeline

type MatchTimeline struct {
	Frames   []*MatchFrame `json:"frames"`
	Interval int           `json:"frameInterval"`
}

MatchTimeline contains timeline frames for a match

type MiniSeries

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

MiniSeries represents a mini series when playing to ascend to the next ranked tier

type Objective

type Objective struct {
	First bool `json:"first"`
	Kills int  `json:"kills"`
}

Objective holds information for a single objective

type Objectives

type Objectives struct {
	Baron      Objective `json:"baron"`
	Champion   Objective `json:"champion"`
	Dragon     Objective `json:"dragon"`
	Inhibitor  Objective `json:"inhibitor"`
	RiftHerald Objective `json:"riftHerald"`
	Tower      Objective `json:"tower"`
}

Objectives holds info for a teeam's objeectives

type Observer

type Observer struct {
	EncryptionKey string `json:"encryptionKey"`
}

Observer is an observer of an ongoing game

type Participant

type Participant struct {
	Assists         int `json:"assists"`
	BaronKills      int `json:"baronKills"`
	BountyLevel     int `json:"bountyLevel"`
	ChampExperience int `json:"champExperience"`
	ChampLevel      int `json:"champLevel"`
	// Prior to patch 11.4, on Feb 18th, 2021, this field returned invalid championIds.
	// We recommend determining the champion based on the championName field for matches played prior to patch 11.4.
	ChampionID   int    `json:"championId"`
	ChampionName string `json:"championName"`
	// This field is currently only utilized for Kayn's transformations.
	// (Legal values: 0 - None, 1 - Slayer, 2 - Assassin)
	ChampionTransform         int  `json:"championTransform"`
	ConsumablesPurchased      int  `json:"consumablesPurchased"`
	DamageDealtToBuildings    int  `json:"damageDealtToBuildings"`
	DamageDealtToObjectives   int  `json:"damageDealtToObjectives"`
	DamageDealtToTurrets      int  `json:"damageDealtToTurrets"`
	DamageSelfMitigated       int  `json:"damageSelfMitigated"`
	Deaths                    int  `json:"deaths"`
	DetectorWardsPlaced       int  `json:"detectorWardsPlaced"`
	DoubleKills               int  `json:"doubleKills"`
	DragonKills               int  `json:"dragonKills"`
	FirstBloodAssist          bool `json:"firstBloodAssist"`
	FirstBloodKill            bool `json:"firstBloodKill"`
	FirstTowerAssist          bool `json:"firstTowerAssist"`
	FirstTowerKill            bool `json:"firstTowerKill"`
	GameEndedInEarlySurrender bool `json:"gameEndedInEarlySurrender"`
	GameEndedInSurrender      bool `json:"gameEndedInSurrender"`
	GoldEarned                int  `json:"goldEarned"`
	GoldSpent                 int  `json:"goldSpent"`
	// Both individualPosition and teamPosition are computed by the game server and are
	// different versions of the most likely position played by a player. The individualPosition
	// is the best guess for which position the player actually played in isolation of
	// anything else. The teamPosition is the best guess for which position the player
	// actually played if we add the constraint that each team must have one top player, one
	// jungle, one middle, etc. Generally the recommendation is to use the teamPosition field
	// over the individualPosition field.
	IndividualPosition             string            `json:"individualPosition"`
	InhibitorKills                 int               `json:"inhibitorKills"`
	InhibitorTakedowns             int               `json:"inhibitorTakedowns"`
	InhibitorsLost                 int               `json:"inhibitorsLost"`
	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"`
	Kills                          int               `json:"kills"`
	Lane                           string            `json:"lane"`
	LargestCriticalStrike          int               `json:"largestCriticalStrike"`
	LargestKillingSpree            int               `json:"largestKillingSpree"`
	LargestMultiKill               int               `json:"largestMultiKill"`
	LongestTimeSpentLiving         int               `json:"longestTimeSpentLiving"`
	MagicDamageDealt               int               `json:"magicDamageDealt"`
	MagicDamageDealtToChampions    int               `json:"magicDamageDealtToChampions"`
	MagicDamageTaken               int               `json:"magicDamageTaken"`
	NeutralMinionsKilled           int               `json:"neutralMinionsKilled"`
	NexusKills                     int               `json:"nexusKills"`
	NexusLost                      int               `json:"nexusLost"`
	NexusTakedowns                 int               `json:"nexusTakedowns"`
	ObjectivesStolen               int               `json:"objectivesStolen"`
	ObjectivesStolenAssists        int               `json:"objectivesStolenAssists"`
	ParticipantID                  int               `json:"participantId"`
	PentaKills                     int               `json:"pentaKills"`
	Perks                          *ParticipantPerks `json:"perks"`
	PhysicalDamageDealt            int               `json:"physicalDamageDealt"`
	PhysicalDamageDealtToChampions int               `json:"physicalDamageDealtToChampions"`
	PhysicalDamageTaken            int               `json:"physicalDamageTaken"`
	ProfileIcon                    int               `json:"profileIcon"`
	PUUID                          string            `json:"puuid"`
	QuadraKills                    int               `json:"quadraKills"`
	RiotIDName                     string            `json:"riotIdName"`
	RiotIDTagline                  string            `json:"riotIdTagline"`
	Role                           string            `json:"role"`
	SightWardsBoughtInGame         int               `json:"sightWardsBoughtInGame"`
	Spell1Casts                    int               `json:"spell1Casts"`
	Spell2Casts                    int               `json:"spell2Casts"`
	Spell3Casts                    int               `json:"spell3Casts"`
	Spell4Casts                    int               `json:"spell4Casts"`
	Summoner1Casts                 int               `json:"summoner1Casts"`
	Summoner1ID                    int               `json:"summoner1Id"`
	Summoner2Casts                 int               `json:"summoner2Casts"`
	Summoner2ID                    int               `json:"summoner2Id"`
	SummonerID                     string            `json:"summonerId"`
	SummonerLevel                  int               `json:"summonerLevel"`
	SummonerName                   string            `json:"summonerName"`
	TeamEarlySurrendered           bool              `json:"teamEarlySurrendered"`
	TeamID                         int               `json:"teamId"`
	// Both individualPosition and teamPosition are computed by the game server and are
	// different versions of the most likely position played by a player. The individualPosition
	// is the best guess for which position the player actually played in isolation of
	// anything else. The teamPosition is the best guess for which position the player
	// actually played if we add the constraint that each team must have one top player, one
	// jungle, one middle, etc. Generally the recommendation is to use the teamPosition field
	// over the individualPosition field.
	TeamPosition                   string `json:"teamPosition"`
	TimeCCingOthers                int    `json:"timeCCingOthers"`
	TimePlayed                     int    `json:"timePlayed"`
	TotalDamageDealt               int    `json:"totalDamageDealt"`
	TotalDamageDealtToChampions    int    `json:"totalDamageDealtToChampions"`
	TotalDamageShieldedOnTeammates int    `json:"totalDamageShieldedOnTeammates"`
	TotalDamageTaken               int    `json:"totalDamageTaken"`
	TotalHeal                      int    `json:"totalHeal"`
	TotalHealsOnTeammates          int    `json:"totalHealsOnTeammates"`
	TotalMinionsKilled             int    `json:"totalMinionsKilled"`
	TotalTimeCCDealt               int    `json:"totalTimeCCDealt"`
	TotalTimeSpentDead             int    `json:"totalTimeSpentDead"`
	TotalUnitsHealed               int    `json:"totalUnitsHealed"`
	TripleKills                    int    `json:"tripleKills"`
	TrueDamageDealt                int    `json:"trueDamageDealt"`
	TrueDamageDealtToChampions     int    `json:"trueDamageDealtToChampions"`
	TrueDamageTaken                int    `json:"trueDamageTaken"`
	TurretKills                    int    `json:"turretKills"`
	TurretTakedowns                int    `json:"turretTakedowns"`
	TurretsLost                    int    `json:"turretsLost"`
	UnrealKills                    int    `json:"unrealKills"`
	VisionScore                    int    `json:"visionScore"`
	VisionWardsBoughtInGame        int    `json:"visionWardsBoughtInGame"`
	WardsKilled                    int    `json:"wardsKilled"`
	WardsPlaced                    int    `json:"wardsPlaced"`
	Win                            bool   `json:"win"`
}

Participant hold information for a participant of a match

func (*Participant) GetChampion

GetChampion returns the champion played by this participant

func (*Participant) GetItem0

func (p *Participant) GetItem0(client *datadragon.Client) (datadragon.Item, error)

GetItem0 returns the item in slot 0

func (*Participant) GetItem1

func (p *Participant) GetItem1(client *datadragon.Client) (datadragon.Item, error)

GetItem1 returns the item in slot 1

func (*Participant) GetItem2

func (p *Participant) GetItem2(client *datadragon.Client) (datadragon.Item, error)

GetItem2 returns the item in slot 2

func (*Participant) GetItem3

func (p *Participant) GetItem3(client *datadragon.Client) (datadragon.Item, error)

GetItem3 returns the item in slot 3

func (*Participant) GetItem4

func (p *Participant) GetItem4(client *datadragon.Client) (datadragon.Item, error)

GetItem4 returns the item in slot 4

func (*Participant) GetItem5

func (p *Participant) GetItem5(client *datadragon.Client) (datadragon.Item, error)

GetItem5 returns the item in slot 5

func (*Participant) GetItem6

func (p *Participant) GetItem6(client *datadragon.Client) (datadragon.Item, error)

GetItem6 returns the item in slot 6

func (*Participant) GetProfileIcon

func (p *Participant) GetProfileIcon(client *datadragon.Client) (datadragon.ProfileIcon, error)

GetProfileIcon returns the profile icon data for this player

func (*Participant) GetSpell1

func (p *Participant) GetSpell1(client *datadragon.Client) (datadragon.SummonerSpell, error)

GetSpell1 returns the first summoner spell of this participant

func (*Participant) GetSpell2

func (p *Participant) GetSpell2(client *datadragon.Client) (datadragon.SummonerSpell, error)

GetSpell2 returns the second summoner spell of this participant

func (*Participant) GetSummoner

func (p *Participant) GetSummoner(client *Client) (*Summoner, error)

GetSummoner returns the summoner info for this player

type ParticipantFrame

type ParticipantFrame 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            *MatchPosition `json:"position"`
	XP                  int            `json:"xp"`
	JungleMinionsKilled int            `json:"jungleMinionsKilled"`
}

ParticipantFrame contains information about a participant in a game at a single timestamp

type ParticipantPerks

type ParticipantPerks struct {
	StatPerks *StatPerks `json:"statPerks"`
	Styles    []Styles   `json:"styles"`
}

ParticipantPerks holds the perks for a participant in a match

type Perks

type Perks struct {
	PerkStyle    int   `json:"perkStyle"`
	PerksIDs     []int `json:"perkIds"`
	PerkSubStyle int   `json:"perkSubStyle"`
}

Perks represents the runes for a player in an ongoing game

type ProviderRegistrationParameters

type ProviderRegistrationParameters struct {
	// The provider's callback URL to which tournament game results in this region should be posted. The URL must be
	// well-formed, use the http or https protocol, and use the default port for the protocol (http URLs must use port
	// 80, https URLs must use port 443).
	URL string `json:"url"`
	// The region in which the provider will be running tournaments.
	// (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)
	Region string `json:"region"`
}

ProviderRegistrationParameters parameters required for registering a provider with tournaments for a region

type Selections

type Selections struct {
	Perk int `json:"perk"`
	Var1 int `json:"var1"`
	Var2 int `json:"var2"`
	Var3 int `json:"var3"`
}

Selections contains information about perk selections

type Service

type Service struct {
	Status    string      `json:"status"`
	Incidents []*Incident `json:"incidents"`
	Name      string      `json:"name"`
	Slug      string      `json:"slug"`
}

Service is a service provided by Riot with its status

type SpectatorClient

type SpectatorClient struct {
	// contains filtered or unexported fields
}

SpectatorClient provides methods for the spectator endpoints of the League of Legends API.

func (*SpectatorClient) GetCurrent

func (s *SpectatorClient) GetCurrent(summonerID string) (*GameInfo, error)

GetCurrent returns a currently running game for a summoner

func (*SpectatorClient) ListFeatured

func (s *SpectatorClient) ListFeatured() (*FeaturedGames, error)

ListFeatured returns the currently featured games

type StatPerks

type StatPerks struct {
	Defense int `json:"defense"`
	Flex    int `json:"flex"`
	Offense int `json:"offense"`
}

StatPerks hold stats for a perk

type Status

type Status 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"`
}

Status contains information about all services in a certain region

type StatusClient

type StatusClient struct {
	// contains filtered or unexported fields
}

StatusClient provides methods for the status endpoints of the League of Legends API.

func (*StatusClient) Get

func (s *StatusClient) Get() (*Status, error)

Get returns the current status of the services for the Region

type StatusMessage

type StatusMessage struct {
	Severity     string               `json:"severity"`
	Author       string               `json:"author"`
	CreatedAt    string               `json:"created_at"`
	Translations []*StatusTranslation `json:"translations"`
	UpdatedAt    string               `json:"updated_at"`
	Content      string               `json:"content"`
	ID           string               `json:"id"`
}

StatusMessage contains information about a status message

type StatusTranslation

type StatusTranslation struct {
	Locale    string `json:"locale"`
	Content   string `json:"content"`
	UpdatedAt string `json:"updated_at"`
}

StatusTranslation contains the status message content in a certain language

type Styles

type Styles struct {
	Description string       `json:"description"`
	Selections  []Selections `json:"selections"`
	Style       int          `json:"style"`
}

Styles holds perk style information

type Summoner

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

Summoner represents a summoner with several related IDs

type SummonerClient

type SummonerClient struct {
	// contains filtered or unexported fields
}

SummonerClient provides methods for the summoner endpoints of the League of Legends API.

func (*SummonerClient) GetByAccountID

func (s *SummonerClient) GetByAccountID(id string) (*Summoner, error)

GetByAccountID returns the summoner with the given account ID

func (*SummonerClient) GetByID

func (s *SummonerClient) GetByID(summonerID string) (*Summoner, error)

GetByID returns the summoner with the given ID

func (*SummonerClient) GetByName

func (s *SummonerClient) GetByName(name string) (*Summoner, error)

GetByName returns the summoner with the given summoner name

func (*SummonerClient) GetByPUUID

func (s *SummonerClient) GetByPUUID(puuid string) (*Summoner, error)

GetByPUUID returns the summoner with the given PUUID

type Team

type Team struct {
	Bans       []*TeamBan `json:"bans"`
	Objectives Objectives `json:"objectives"`
	TeamID     int        `json:"teamId"`
	Win        bool       `json:"win"`
}

Team holds information for a team in a match

type TeamBan

type TeamBan struct {
	// Turn during which the champion was banned.
	PickTurn int `json:"pickTurn"`
	// Banned championId.
	ChampionID int `json:"championId"`
}

TeamBan is a champion banned by a team

func (*TeamBan) GetChampion

func (b *TeamBan) GetChampion(client *datadragon.Client) (datadragon.ChampionDataExtended, error)

GetChampion returns the champion that was banned

type ThirdPartyCodeClient

type ThirdPartyCodeClient struct {
	// contains filtered or unexported fields
}

ThirdPartyCodeClient provides methods for the third party code endpoints of the League of Legends API.

func (*ThirdPartyCodeClient) Get

func (t *ThirdPartyCodeClient) Get(summonerID string) (string, error)

Get returns the third party code for the given summoner id

type Tournament

type Tournament struct {
	Map          string   `json:"map"`
	Code         string   `json:"code"`
	Spectators   string   `json:"spectators"`
	Region       string   `json:"region"`
	ProviderID   int      `json:"providerId"`
	TeamSize     int      `json:"teamSize"`
	Participants []string `json:"participants"`
	PickType     string   `json:"pickType"`
	TournamentID int      `json:"tournamentId"`
	LobbyName    string   `json:"lobbyName"`
	Password     string   `json:"password"`
	ID           int      `json:"id"`
	MetaData     string   `json:"metaData"`
}

Tournament contains the settings of a previously created tournament

type TournamentClient

type TournamentClient struct {
	// contains filtered or unexported fields
}

TournamentClient provides methods for the tournament endpoints of the League of Legends API.

func (*TournamentClient) Create

func (t *TournamentClient) Create(parameters *TournamentRegistrationParameters, useStub bool) (int, error)

Create creates a tournament and returns the ID. For more information about the parameters see the documentation for TournamentRegistrationParameters. Set the useStub flag to true to use the stub endpoints for mocking an implementation

func (*TournamentClient) CreateCodes

func (t *TournamentClient) CreateCodes(id, count int, params *TournamentCodeParameters, stub bool) ([]string, error)

CreateCodes creates a specified amount of codes for a tournament. For more information about the parameters see the documentation for TournamentCodeParameters. Set the useStub flag to true to use the stub endpoints for mocking an implementation

func (*TournamentClient) CreateProvider

func (t *TournamentClient) CreateProvider(parameters *ProviderRegistrationParameters, useStub bool) (int, error)

CreateProvider creates a tournament provider and returns the ID. For more information about the parameters see the documentation for ProviderRegistrationParameters. Set the useStub flag to true to use the stub endpoints for mocking an implementation

func (*TournamentClient) Get

func (t *TournamentClient) Get(code string) (*Tournament, error)

Get returns an existing tournament

func (*TournamentClient) ListLobbyEvents

func (t *TournamentClient) ListLobbyEvents(code string, useStub bool) (*LobbyEventList, error)

ListLobbyEvents returns the lobby events for a lobby specified by the tournament code Set the useStub flag to true to use the stub endpoints for mocking an implementation

func (*TournamentClient) Update

func (t *TournamentClient) Update(code string, parameters TournamentUpdateParameters) error

Update updates an existing tournament

type TournamentCodeParameters

type TournamentCodeParameters struct {
	// The spectator type of the game. (Legal values: NONE, LOBBYONLY, ALL)
	SpectatorType string `json:"spectatorType"`
	// The team size of the game. Valid values are 1-5.
	TeamSize int `json:"teamSize"`
	// The pick type of the game. (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
	PickType string `json:"pickType"`
	// Optional list of encrypted summonerIds in order to validate the players eligible to join the lobby.
	// NOTE: We currently do not enforce participants at the team level, but rather the aggregate of teamOne and
	// teamTwo. We may add the ability to enforce at the team level in the future.
	AllowedSummonerIDs []string `json:"allowedSummonerIds,omitempty"`
	// The map type of the game. (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
	MapType string `json:"mapType"`
	// Optional string that may contain any data in any format, if specified at all. Used to denote any custom
	// information about the game.
	Metadata string `json:"metadata"`
}

TournamentCodeParameters parameters needed to create tournament codes

type TournamentRegistrationParameters

type TournamentRegistrationParameters struct {
	// The provider ID to specify the regional registered provider data to associate this tournament.
	ProviderID int `json:"providerId"`
	// The optional name of the tournament.
	Name string `json:"name"`
}

TournamentRegistrationParameters parameters required for creating a tournament

type TournamentUpdateParameters

type TournamentUpdateParameters struct {
	// The spectator type (Legal values: NONE, LOBBYONLY, ALL)
	SpectatorType string `json:"spectatorType"`
	// The pick type (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
	PickType string `json:"pickType"`
	// Optional list of encrypted summonerIds in order to validate the players eligible to join the lobby.
	// NOTE: Participants are not enforced at the team level, but rather the aggregate of teamOne and teamTwo.
	AllowedSummonerIDs []string `json:"allowedSummonerIds"`
	// The map type (Legal values: SUMMONERS_RIFT, TWISTED_TREELINE, HOWLING_ABYSS)
	MapType string `json:"mapType"`
}

TournamentUpdateParameters parameters needed to update an existing tournament

Jump to

Keyboard shortcuts

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