lol

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChampionURL = "/lol/platform/v3/champion-rotations"

	ChampionMasteriesURL           = "/lol/champion-mastery/v4/champion-masteries/by-summoner/%s"
	ChampionMasteriesByChampionURL = "/lol/champion-mastery/v4/champion-masteries/by-summoner/%s/by-champion/%d"
	ChampionMasteriesScoresURL     = "/lol/champion-mastery/v4/scores/by-summoner/%s"

	ClashURL                   = "/lol/clash/v1/tournaments"
	ClashTournamentTeamByIDURL = "/lol/clash/v1/teams/%s"
	ClashSummonerEntriesURL    = "/lol/clash/v1/players/by-summoner/%s"
	ClashByTeamIDURL           = "/lol/clash/v1/tournaments/by-team/%s"
	ClashByIDURL               = "/lol/clash/v1/tournaments/%s"

	StatusURL = "/lol/status/v4/platform-data"

	MatchListURL     = "/lol/match/v5/matches/by-puuid/%s/ids"
	MatchURL         = "/lol/match/v5/matches/%s"
	MatchTimelineURL = "/lol/match/v5/matches/%s/timeline"

	SpectatorFeaturedGamesURL = "/lol/spectator/v4/featured-games"
	SpectatorCurrentGameURL   = "/lol/spectator/v4/active-games/by-summoner/%s"

	SummonerByID           = "/lol/summoner/v4/summoners/%s"
	SummonerByNameURL      = "/lol/summoner/v4/summoners/by-name/%s"
	SummonerByPUUIDURL     = "/lol/summoner/v4/summoners/by-puuid/%s"
	SummonerByAccountIDURL = "/lol/summoner/v4/summoners/by-account/%s"

	LeagueEntriesURL           = "/lol/league/v4/entries/%s/%s/%s"
	LeagueEntriesBySummonerURL = "/lol/league/v4/entries/by-summoner/%s"
	LeagueByID                 = "/lol/league/v4/leagues/%s"
	LeagueChallengerURL        = "/lol/league/v4/challengerleagues/by-queue/%s"
	LeagueGrandmasterURL       = "/lol/league/v4/grandmasterleagues/by-queue/%s"
	LeagueMasterURL            = "/lol/league/v4/masterleagues/by-queue/%s"

	TournamentStubLobbyEventsURL = "/lol/tournament-stub/v4/lobby-events/by-code/%s"
	TournamentStubCodesURL       = "/lol/tournament-stub/v4/codes"
	TournamentStubProvidersURL   = "/lol/tournament-stub/v4/providers"
	TournamentStubURL            = "/lol/tournament-stub/v4/tournaments"
)

League of Legends endpoints URLs

Variables

This section is empty.

Functions

This section is empty.

Types

type BannedChampionDTO added in v0.6.0

type BannedChampionDTO struct {
	// The ID of the banned champion.
	ChampionID int `json:"championId"`
	// The ID of the team that banned the champion.
	TeamID int `json:"teamId"`
	// The turn during which the champion was banned.
	PickTurn int `json:"pickTurn"`
}

type ChampionEndpoint

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

func (*ChampionEndpoint) Rotations added in v0.4.0

func (c *ChampionEndpoint) Rotations(region Region) (*ChampionRotationsDTO, error)

Get champion rotations, including free-to-play and low-level free-to-play rotations.

type ChampionMasteryDTO added in v0.4.0

type ChampionMasteryDTO struct {
	// Champion ID for this entry.
	ChampionID int `json:"championId"`
	// Champion level for specified player and champion combination.
	ChampionLevel int `json:"championLevel"`
	// Total number of champion points for this player and champion combination - they are used to determine championLevel.
	ChampionPoints int `json:"championPoints"`
	// Last time this champion was played by this player - in Unix milliseconds time format.
	LastPlayTime int64 `json:"lastPlayTime"`
	// Number of points earned since current level has been achieved.
	ChampionPointsSinceLastLevel int `json:"championPointsSinceLastLevel"`
	// Number of points needed to achieve next level. Zero if player reached maximum champion level for this champion.
	ChampionPointsUntilNextLevel int `json:"championPointsUntilNextLevel"`
	// Is chest granted for this champion or not in current season.
	ChestGranted bool `json:"chestGranted"`
	// The token earned for this champion at the current championLevel. When the championLevel is advanced the tokensEarned resets to 0.
	TokensEarned int `json:"tokensEarned"`
	// Summoner ID for this entry. (Encrypted)
	SummonerID string `json:"summonerId"`
}

type ChampionMasteryEndpoint added in v0.4.0

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

func (*ChampionMasteryEndpoint) ChampionScore added in v0.4.0

func (c *ChampionMasteryEndpoint) ChampionScore(region Region, summonerID string, championID int) (*ChampionMasteryDTO, error)

Get a champion mastery by player ID and champion ID.

func (*ChampionMasteryEndpoint) MasteryScoreSum added in v0.6.0

func (c *ChampionMasteryEndpoint) MasteryScoreSum(region Region, summonerID string) (int, error)

Get a player's total champion mastery score, which is the sum of individual champion mastery levels.

func (*ChampionMasteryEndpoint) SummonerMasteries added in v0.6.0

func (c *ChampionMasteryEndpoint) SummonerMasteries(region Region, summonerID string) (*[]ChampionMasteryDTO, error)

Get all champion mastery entries sorted by number of champion points descending.

type ChampionRotationsDTO added in v0.4.0

type ChampionRotationsDTO struct {
	// List of free champions IDs
	FreeChampionIDs []int `json:"freeChampionIds"`
	// List of free champions IDs for new players
	FreeChampionIDsForNewPlayers []int `json:"freeChampionIdsForNewPlayers"`
	// Max new player level
	MaxNewPlayerLevel int `json:"maxNewPlayerLevel"`
}

type ClashEndpoint added in v0.6.0

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

func (*ClashEndpoint) ByID added in v0.6.0

func (c *ClashEndpoint) ByID(region Region, tournamentID string) (*TournamentDTO, error)

Get tournament by ID.

func (*ClashEndpoint) ByTeamID added in v0.6.0

func (c *ClashEndpoint) ByTeamID(region Region, teamID string) (*TournamentDTO, error)

Get tournament by team ID.

func (*ClashEndpoint) SummonerEntries added in v0.6.0

func (c *ClashEndpoint) SummonerEntries(region Region, summonerID string) (*[]TournamentPlayerDTO, error)

Get players by summoner ID.

This endpoint returns a list of active Clash players for a given summoner ID. If a summoner registers for multiple tournaments at the same time (e.g., Saturday and Sunday) then both registrations would appear in this list.

func (*ClashEndpoint) TournamentTeamByID added in v0.6.0

func (c *ClashEndpoint) TournamentTeamByID(region Region, teamID string) (*TournamentTeamDto, error)

Get team by ID.

func (*ClashEndpoint) Tournaments added in v0.6.0

func (c *ClashEndpoint) Tournaments(region Region) (*[]TournamentDTO, error)

Get all active or upcoming tournaments.

type ContentDTO added in v0.6.0

type ContentDTO struct {
	Content string `json:"content"`
	Locale  string `json:"locale"`
}

type CurrentGameInfoDTO added in v0.4.0

type CurrentGameInfoDTO struct {
	// The ID of the game.
	GameID int `json:"gameId"`
	// The ID of the map.
	MapID int `json:"mapId"`
	// The game mode (Legal values: CLASSIC, ODIN, ARAM, TUTORIAL, ONEFORALL, ASCENSION, FIRSTBLOOD, KINGPORO).
	GameMode string `json:"gameMode"`
	// The game type (Legal values: CUSTOM_GAME, MATCHED_GAME, TUTORIAL_GAME).
	GameType string `json:"gameType"`
	// The queue type (queue types are documented on the Game Constants page).
	GameQueueConfigID int `json:"gameQueueConfigId"`
	// The participant information.
	Participants []CurrentGameParticipantDTO `json:"participants"`
	// The observer information.
	Observers ObserverDTO `json:"observers"`
	// The ID of the platform on which the game is being played.
	PlatformID string `json:"platformId"`
	// Banned champion information.
	BannedChampions []BannedChampionDTO `json:"bannedChampions"`
	// The game start time represented in epoch milliseconds.
	GameStartTime int `json:"gameStartTime"`
	// The amount of time in seconds that has passed since the game started.
	GameLength int `json:"gameLength"`
}

type CurrentGameParticipantDTO added in v0.6.0

type CurrentGameParticipantDTO struct {
	// The team ID of this participant, indicating the participant's team.
	TeamID int `json:"teamId"`
	// The ID of the first summoner spell used by this participant.
	Spell1ID int `json:"spell1Id"`
	// The ID of the second summoner spell used by this participant.
	Spell2ID int `json:"spell2Id"`
	// The ID of the champion played by this participant.
	ChampionID int `json:"championId"`
	// The ID of the profile icon used by this participant.
	ProfileIconID int `json:"profileIconId"`
	// The encrypted summoner ID of this participant.
	SummonerID string `json:"summonerId"`
	// The summoner name of this participant.
	SummonerName string `json:"summonerName"`
	// Flag indicating whether or not this participant is a bot.
	Bot bool `json:"bot"`
	// List of Game Customizations.
	GameCustomizationObjects []GameCustomizationObject `json:"gameCustomizationObjects"`
	// Perks/Runes Reforged Information.
	Perks `json:"perks"`
}

type FeaturedGameInfoDTO added in v0.6.0

type FeaturedGameInfoDTO struct {
	// The ID of the game.
	GameID int `json:"gameId"`
	// The ID of the map.
	MapID int `json:"mapId"`
	// The game mode (Legal values: CLASSIC, ODIN, ARAM, TUTORIAL, ONEFORALL, ASCENSION, FIRSTBLOOD, KINGPORO).
	GameMode string `json:"gameMode"`
	// The game type (Legal values: CUSTOM_GAME, MATCHED_GAME, TUTORIAL_GAME).
	GameType string `json:"gameType"`
	// The queue type (queue types are documented on the Game Constants page).
	GameQueueConfigID int `json:"gameQueueConfigId"`
	// The participant information.
	Participants []ParticipantDTO `json:"participants"`
	// The observer information.
	Observers ObserverDTO `json:"observers"`
	// The ID of the platform on which the game is being played.
	PlatformID string `json:"platformId"`
	// Banned champion information.
	BannedChampions []BannedChampionDTO `json:"bannedChampions"`
	// The game start time represented in epoch milliseconds.
	GameStartTime int `json:"gameStartTime"`
	// The amount of time in seconds that has passed since the game started.
	GameLength int `json:"gameLength"`
}

type FeaturedGamesDTO added in v0.3.0

type FeaturedGamesDTO struct {
	// The list of featured games.
	GameList []FeaturedGameInfoDTO `json:"gameList"`
	// The suggested interval to wait before requesting FeaturedGames again.
	ClientRefreshInterval int `json:"clientRefreshInterval"`
}

type GameCustomizationObject added in v0.6.0

type GameCustomizationObject struct {
	// Category identifier for Game Customization.
	Category string `json:"category"`
	// Game Customization content.
	Content string `json:"content"`
}

type LOLClient

type LOLClient struct {
	Champion          *ChampionEndpoint
	ChampionMasteries *ChampionMasteryEndpoint
	Clash             *ClashEndpoint
	Match             *MatchEndpoint
	Status            *StatusEndpoint
	Spectator         *SpectatorEndpoint
	Summoner          *SummonerEndpoint
	League            *LeagueEndpoint
	TournamentStub    *TournamentStubEndpoint
	// contains filtered or unexported fields
}

func NewLOLClient

func NewLOLClient(client *internal.InternalClient) *LOLClient

Creates a new LOLClient using an InternalClient provided.

type LeagueEndpoint added in v0.6.0

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

func (*LeagueEndpoint) ByID added in v0.6.0

func (c *LeagueEndpoint) ByID(region Region, leagueID string) (*LeagueListDTO, error)

Get league with given ID, including inactive entries.

func (*LeagueEndpoint) ChallengerByQueue added in v0.6.0

func (c *LeagueEndpoint) ChallengerByQueue(region Region, queueType QueueType) (*LeagueListDTO, error)

Get the challenger league for given queue.

func (*LeagueEndpoint) Entries added in v0.6.0

func (c *LeagueEndpoint) Entries(region Region, division api.Division, tier Tier, queue QueueType, page int) (*[]LeagueEntryDTO, error)

Get all the league entries. Page defaults to 1.

func (*LeagueEndpoint) GrandmasterByQueue added in v0.6.0

func (c *LeagueEndpoint) GrandmasterByQueue(region Region, queueType QueueType) (*LeagueListDTO, error)

Get the grandmaster league for given queue.

func (*LeagueEndpoint) MasterByQueue added in v0.6.0

func (c *LeagueEndpoint) MasterByQueue(region Region, queueType QueueType) (*LeagueListDTO, error)

Get the master league for given queue.

func (*LeagueEndpoint) SummonerEntries added in v0.6.0

func (c *LeagueEndpoint) SummonerEntries(region Region, summonerID string) (*[]LeagueEntryDTO, error)

Get league entries in all queues for a given summoner ID.

type LeagueEntryDTO added in v0.6.0

type LeagueEntryDTO struct {
	LeagueID  string `json:"leagueId"`
	QueueType string `json:"queueType"`
	Tier      string `json:"tier"`
	// The player's division within a tier.
	Rank string `json:"rank"`
	// Player's encrypted summonerId.
	SummonerID   string `json:"summonerId"`
	SummonerName string `json:"summonerName"`
	LeaguePoints int    `json:"leaguePoints"`
	// Winning team on Summoners Rift.
	Wins int `json:"wins"`
	// Losing team on Summoners Rift.
	Losses     int           `json:"losses"`
	Veteran    bool          `json:"veteran"`
	Inactive   bool          `json:"inactive"`
	FreshBlood bool          `json:"freshBlood"`
	HotStreak  bool          `json:"hotStreak"`
	MiniSeries MiniSeriesDTO `json:"miniSeries,omitempty"`
}

type LeagueListDTO added in v0.6.0

type LeagueListDTO struct {
	Tier     string           `json:"tier"`
	LeagueID string           `json:"leagueId"`
	Queue    string           `json:"queue"`
	Name     string           `json:"name"`
	Entries  []LeagueEntryDTO `json:"entries"`
}

type LobbyEventDTO added in v0.6.0

type LobbyEventDTO struct {
	// The summonerId that triggered the event (Encrypted)
	SummonerID string `json:"summonerId"`
	// The type of event that was triggered
	EventType string `json:"eventType"`
	// Timestamp from the event
	Timestamp time.Time `json:"timestamp"`
}

type LobbyEventDTOWrapper added in v0.6.0

type LobbyEventDTOWrapper struct {
	EventList []LobbyEventDTO `json:"eventList"`
}

type MapType added in v0.6.0

type MapType string
const (
	SummonersRiftMap   MapType = "SUMMONERS_RIFT"
	TwistedTreelineMap MapType = "TWISTED_TREELINE"
	HowlingAbyssMap    MapType = "HOWLING_ABYSS"
)

type MatchDTO added in v0.4.0

type MatchDTO struct {
	// Match metadata.
	Metadata struct {
		// Match data version.
		DataVersion string `json:"dataVersion"`
		// Match id.
		MatchID string `json:"matchId"`
		// A list of participant PUUIDs.
		Participants []string `json:"participants"`
	} `json:"metadata"`
	// Match info.
	Info 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           int   `json:"gameId"`
		// 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"`
		GameType           string `json:"gameType"`
		// The first two parts can be used to determine the patch a game was played on.
		GameVersion string `json:"gameVersion"`
		// Refer to the Game Constants documentation.
		MapID        int `json:"mapId"`
		Participants []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"`
			EligibleForProgression    bool `json:"eligibleForProgression"`
			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                       struct {
				StatPerks struct {
					Defense int `json:"defense"`
					Flex    int `json:"flex"`
					Offense int `json:"offense"`
				} `json:"statPerks"`
				Styles []struct {
					Description string `json:"description"`
					Selections  []struct {
						Perk int `json:"perk"`
						Var1 int `json:"var1"`
						Var2 int `json:"var2"`
						Var3 int `json:"var3"`
					} `json:"selections"`
					Style int `json:"style"`
				} `json:"styles"`
			} `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"`
		} `json:"participants"`
		// Platform where the match was played.
		PlatformID string `json:"platformId"`
		// Refer to the Game Constants documentation.
		QueueID int `json:"queueId"`
		Teams   []struct {
			Bans       []interface{} `json:"bans"`
			Objectives struct {
				Baron struct {
					First bool `json:"first"`
					Kills int  `json:"kills"`
				} `json:"baron"`
				Champion struct {
					First bool `json:"first"`
					Kills int  `json:"kills"`
				} `json:"champion"`
				Dragon struct {
					First bool `json:"first"`
					Kills int  `json:"kills"`
				} `json:"dragon"`
				Inhibitor struct {
					First bool `json:"first"`
					Kills int  `json:"kills"`
				} `json:"inhibitor"`
				RiftHerald struct {
					First bool `json:"first"`
					Kills int  `json:"kills"`
				} `json:"riftHerald"`
				Tower struct {
					First bool `json:"first"`
					Kills int  `json:"kills"`
				} `json:"tower"`
			} `json:"objectives"`
			TeamID int  `json:"teamId"`
			Win    bool `json:"win"`
		} `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"`
	} `json:"info"`
}

type MatchEndpoint added in v0.4.0

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

func (*MatchEndpoint) ByID added in v0.4.0

func (c *MatchEndpoint) ByID(region api.RiotRoute, matchID string) (*MatchDTO, error)

Get a match by match ID.

func (*MatchEndpoint) List added in v0.4.0

func (c *MatchEndpoint) List(region api.RiotRoute, PUUID string, options *MatchlistOptions) ([]string, error)

Get a list of match IDs by PUUID. Default query: start: 0, count: 20

func (*MatchEndpoint) Timeline added in v0.4.0

func (c *MatchEndpoint) Timeline(region api.RiotRoute, matchID string) (*MatchTimelineDTO, error)

Get a match timeline by match ID.

type MatchTimelineDTO added in v0.4.0

type MatchTimelineDTO struct {
	// Match metadata.
	Metadata struct {
		// Match data version.
		DataVersion string `json:"dataVersion"`
		// Match id.
		MatchID string `json:"matchId"`
		// A list of participant PUUIDs.
		Participants []string `json:"participants"`
	} `json:"metadata"`
	// Match info.
	Info struct {
		FrameInterval int `json:"frameInterval"`
		Frames        []struct {
			Events []struct {
				RealTimestamp int64  `json:"realTimestamp"`
				Timestamp     int    `json:"timestamp"`
				Type          string `json:"type"`
			} `json:"events"`
			ParticipantFrames struct {
				Num1 struct {
					ChampionStats struct {
						AbilityHaste         int `json:"abilityHaste"`
						AbilityPower         int `json:"abilityPower"`
						Armor                int `json:"armor"`
						ArmorPen             int `json:"armorPen"`
						ArmorPenPercent      int `json:"armorPenPercent"`
						AttackDamage         int `json:"attackDamage"`
						AttackSpeed          int `json:"attackSpeed"`
						BonusArmorPenPercent int `json:"bonusArmorPenPercent"`
						BonusMagicPenPercent int `json:"bonusMagicPenPercent"`
						CcReduction          int `json:"ccReduction"`
						CooldownReduction    int `json:"cooldownReduction"`
						Health               int `json:"health"`
						HealthMax            int `json:"healthMax"`
						HealthRegen          int `json:"healthRegen"`
						Lifesteal            int `json:"lifesteal"`
						MagicPen             int `json:"magicPen"`
						MagicPenPercent      int `json:"magicPenPercent"`
						MagicResist          int `json:"magicResist"`
						MovementSpeed        int `json:"movementSpeed"`
						Omnivamp             int `json:"omnivamp"`
						PhysicalVamp         int `json:"physicalVamp"`
						Power                int `json:"power"`
						PowerMax             int `json:"powerMax"`
						PowerRegen           int `json:"powerRegen"`
						SpellVamp            int `json:"spellVamp"`
					} `json:"championStats"`
					CurrentGold int `json:"currentGold"`
					DamageStats struct {
						MagicDamageDone               int `json:"magicDamageDone"`
						MagicDamageDoneToChampions    int `json:"magicDamageDoneToChampions"`
						MagicDamageTaken              int `json:"magicDamageTaken"`
						PhysicalDamageDone            int `json:"physicalDamageDone"`
						PhysicalDamageDoneToChampions int `json:"physicalDamageDoneToChampions"`
						PhysicalDamageTaken           int `json:"physicalDamageTaken"`
						TotalDamageDone               int `json:"totalDamageDone"`
						TotalDamageDoneToChampions    int `json:"totalDamageDoneToChampions"`
						TotalDamageTaken              int `json:"totalDamageTaken"`
						TrueDamageDone                int `json:"trueDamageDone"`
						TrueDamageDoneToChampions     int `json:"trueDamageDoneToChampions"`
						TrueDamageTaken               int `json:"trueDamageTaken"`
					} `json:"damageStats"`
					GoldPerSecond       int `json:"goldPerSecond"`
					JungleMinionsKilled int `json:"jungleMinionsKilled"`
					Level               int `json:"level"`
					MinionsKilled       int `json:"minionsKilled"`
					ParticipantID       int `json:"participantId"`
					Position            struct {
						X int `json:"x"`
						Y int `json:"y"`
					} `json:"position"`
					TimeEnemySpentControlled int `json:"timeEnemySpentControlled"`
					TotalGold                int `json:"totalGold"`
					Xp                       int `json:"xp"`
				} `json:"1"`
			} `json:"participantFrames"`
			Timestamp int `json:"timestamp"`
		} `json:"frames"`
		GameID       int `json:"gameId"`
		Participants []struct {
			ParticipantID int    `json:"participantId"`
			PUUID         string `json:"puuid"`
		} `json:"participants"`
	} `json:"info"`
}

type MatchType added in v0.4.0

type MatchType string
const (
	RankedMatch   MatchType = "ranked"
	NormalMatch   MatchType = "normal"
	TourneyMatch  MatchType = "tourney"
	TutorialMatch MatchType = "tutorial"
)

type MatchlistOptions added in v0.4.0

type MatchlistOptions struct {
	// 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 int `json:"startTime"`
	// Epoch timestamp in seconds.
	EndTime int `json:"endTime"`
	// 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 `json:"queue"`
	// 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.
	Type MatchType `json:"type"`
	// Defaults to 0. Start index.
	Start int `json:"start"`
	// Defaults to 20. Valid values: 0 to 100. Number of match ids to return.
	Count int `json:"count"`
}

type MiniSeriesDTO added in v0.6.0

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

type ObserverDTO added in v0.6.0

type ObserverDTO struct {
	// Key used to decrypt the spectator grid game data for playback.
	EncryptionKey string `json:"encryptionKey"`
}

type ParticipantDTO added in v0.6.0

type ParticipantDTO struct {
	// The team ID of this participant, indicating the participant's team.
	TeamID int `json:"teamId"`
	// The ID of the first summoner spell used by this participant.
	Spell1ID int `json:"spell1Id"`
	// The ID of the second summoner spell used by this participant.
	Spell2ID int `json:"spell2Id"`
	// The ID of the champion played by this participant.
	ChampionID int `json:"championId"`
	// The ID of the profile icon used by this participant.
	ProfileIconID int `json:"profileIconId"`
	// The summoner name of this participant.
	SummonerName string `json:"summonerName"`
	// Flag indicating whether or not this participant is a bot.
	Bot bool `json:"bot"`
}

type Perks added in v0.6.0

type Perks struct {
	// IDs of the perks/runes assigned.
	PerkIDs []int `json:"perkIds"`
	// Primary runes path.
	PerkStyle int `json:"perkStyle"`
	// Secondary runes path.
	PerkSubStyle int `json:"perkSubStyle"`
}

type PickType added in v0.6.0

type PickType string
const (
	BlindPick           PickType = "BLIND_PICK"
	DraftModePick       PickType = "DRAFT_MODE"
	AllRandomPick       PickType = "ALL_RANDOM"
	TournamentDraftPick PickType = "TOURNAMENT_DRAFT"
)

type PlatformDataDTO added in v0.3.0

type PlatformDataDTO struct {
	ID           string      `json:"id"`
	Name         string      `json:"name"`
	Locales      []string    `json:"locales"`
	Maintenances []StatusDTO `json:"maintenances"`
	Incidents    []StatusDTO `json:"incidents"`
}

type QueueType added in v0.6.0

type QueueType string
const (
	Solo5x5Queue QueueType = "RANKED_SOLO_5x5"
	FlexSRQueue  QueueType = "RANKED_FLEX_SR"
	FlexTTQueue  QueueType = "RANKED_FLEX_TT"
)

type Region

type Region string
const (
	BR1  Region = "br1"
	EUN1 Region = "eun1"
	EUW1 Region = "euw1"
	JP1  Region = "jp1"
	KR   Region = "kr"
	LA1  Region = "la1"
	LA2  Region = "la2"
	NA1  Region = "na1"
	OC1  Region = "oc1"
	RU   Region = "ru"
	TR1  Region = "tr1"
)

type SpectatorEndpoint added in v0.3.0

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

func (*SpectatorEndpoint) CurrentGame added in v0.4.0

func (c *SpectatorEndpoint) CurrentGame(region Region, summonerID string) (*CurrentGameInfoDTO, error)

Get the current game information for the given summoner ID.

func (*SpectatorEndpoint) FeaturedGames added in v0.3.0

func (c *SpectatorEndpoint) FeaturedGames(region Region) (*FeaturedGamesDTO, error)

Get featured games in a region.

type SpectatorType added in v0.6.0

type SpectatorType string
const (
	NoneSpectator      SpectatorType = "NONE"
	LobbyOnlySpectator SpectatorType = "LOBBYONLY"
	AllSpectator       SpectatorType = "ALL"
)

type StatusDTO added in v0.6.0

type StatusDTO struct {
	ArchiveAt time.Time    `json:"archive_at"`
	Titles    []ContentDTO `json:"titles"`
	UpdatedAt time.Time    `json:"updated_at"`
	// (Legal values: info, warning, critical)
	IncidentSeverity string `json:"incident_severity"`
	// (Legal values: windows, macos, android, ios, ps4, xbone, switch)
	Platforms         []string    `json:"platforms"`
	Updates           []UpdateDTO `json:"updates"`
	CreatedAt         time.Time   `json:"created_at"`
	ID                int         `json:"id"`
	MaintenanceStatus string      `json:"maintenance_status"`
}

type StatusEndpoint added in v0.2.2

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

func (*StatusEndpoint) PlatformStatus added in v0.4.0

func (c *StatusEndpoint) PlatformStatus(region Region) (*PlatformDataDTO, error)

Get League of Legends status for the given platform.

type SummonerDTO added in v0.5.0

type SummonerDTO struct {
	// Encrypted summoner ID. Max length 63 characters.
	ID string `json:"id"`
	// Encrypted account ID. Max length 56 characters.
	AccountID string `json:"accountId"`
	// Encrypted PUUID. Exact length of 78 characters.
	PUUID string `json:"puuid"`
	// Summoner name.
	Name string `json:"name"`
	// ID of the summoner icon associated with the summoner.
	ProfileIconID int `json:"profileIconId"`
	// Date summoner was last modified specified as epoch milliseconds. The following events will update this timestamp: summoner name change, summoner level change, or profile icon change.
	RevisionDate int64 `json:"revisionDate"`
	// Summoner level associated with the summoner.
	SummonerLevel int `json:"summonerLevel"`
}

type SummonerEndpoint added in v0.5.0

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

func (*SummonerEndpoint) ByAccountID added in v0.5.0

func (c *SummonerEndpoint) ByAccountID(region Region, accountID string) (*SummonerDTO, error)

Get a summoner by summoner account ID.

func (*SummonerEndpoint) ByID added in v0.5.0

func (c *SummonerEndpoint) ByID(region Region, PUUID string) (*SummonerDTO, error)

Get a summoner by summoner ID.

func (*SummonerEndpoint) ByName added in v0.5.0

func (c *SummonerEndpoint) ByName(region Region, summonerName string) (*SummonerDTO, error)

Get a summoner by summoner name.

func (*SummonerEndpoint) ByPUUID added in v0.5.0

func (c *SummonerEndpoint) ByPUUID(region Region, PUUID string) (*SummonerDTO, error)

Get a summoner by summoner PUUID.

type Tier added in v0.6.0

type Tier string
const (
	IronTier     Tier = "IRON"
	BronzeTier   Tier = "BRONZE"
	SilverTier   Tier = "SILVER"
	GoldTier     Tier = "GOLD"
	PlatinumTier Tier = "PLATINUM"
	DiamondTier  Tier = "DIAMOND"
)

type TournamentCodeParameters added in v0.6.0

type TournamentCodeParameters struct {
	// 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 MapType `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,omitempty"`
	// The pick type of the game. (Legal values: BLIND_PICK, DRAFT_MODE, ALL_RANDOM, TOURNAMENT_DRAFT)
	PickType PickType `json:"pickType"`
	// The spectator type of the game. (Legal values: NONE, LOBBYONLY, ALL)
	SpectatorType SpectatorType `json:"spectatorType"`
	// The team size of the game. Valid values are 1-5.
	TeamSize int `json:"teamSize"`
}

type TournamentDTO added in v0.6.0

type TournamentDTO struct {
	ID               int    `json:"id"`
	ThemeID          int    `json:"themeId"`
	NameKey          string `json:"nameKey"`
	NameKeySecondary string `json:"nameKeySecondary"`
	// Tournament phase.
	Schedule []TournamentPhaseDto `json:"schedule"`
}

type TournamentPhaseDto added in v0.6.0

type TournamentPhaseDto struct {
	ID               int   `json:"id"`
	RegistrationTime int64 `json:"registrationTime"`
	StartTime        int64 `json:"startTime"`
	Cancelled        bool  `json:"cancelled"`
}

type TournamentPlayerDTO added in v0.6.0

type TournamentPlayerDTO struct {
	SummonerID string `json:"summonerId"`
	TeamID     string `json:"teamId,omitempty"`
	// (Legal values: UNSELECTED, FILL, TOP, JUNGLE, MIDDLE, BOTTOM, UTILITY).
	Position string `json:"position"`
	// (Legal values: CAPTAIN, MEMBER)
	Role string `json:"role"`
}

type TournamentRegion added in v0.6.0

type TournamentRegion string
const (
	BR     TournamentRegion = "BR"
	EUN    TournamentRegion = "EUNE"
	EUW    TournamentRegion = "EUW"
	JP     TournamentRegion = "JP"
	LAN    TournamentRegion = "LAN"
	LAS    TournamentRegion = "LAS"
	NA     TournamentRegion = "NA"
	OC     TournamentRegion = "OCE"
	PBE    TournamentRegion = "PBE"
	RUSSIA TournamentRegion = "RU"
	TR     TournamentRegion = "TR"
)

type TournamentStubEndpoint added in v0.6.0

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

func (*TournamentStubEndpoint) CreateCodes added in v0.6.0

func (c *TournamentStubEndpoint) CreateCodes(tournamentID int64, count int, options TournamentCodeParameters) ([]string, error)

Create a mock tournament code for the given tournament. Count defaults to 20 (max 1000).

func (*TournamentStubEndpoint) CreateTournament added in v0.6.0

func (c *TournamentStubEndpoint) CreateTournament(providerID int, name string) (int, error)

Creates a mock tournament and returns its ID.

The provider ID to specify the regional registered provider data to associate this tournament.

The optional name of the tournament.

func (*TournamentStubEndpoint) CreateTournamentProvider added in v0.6.0

func (c *TournamentStubEndpoint) CreateTournamentProvider(region TournamentRegion, callbackURL string) (int, error)

Creates a mock tournament provider and returns its ID.

Providers will need to call this endpoint first to register their callback URL and their API key with the tournament system before any other tournament provider endpoints will work.

The region in which the provider will be running tournaments. (Legal values: BR, EUNE, EUW, JP, LAN, LAS, NA, OCE, PBE, RU, TR)

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).

func (*TournamentStubEndpoint) LobbyEvents added in v0.6.0

func (c *TournamentStubEndpoint) LobbyEvents(tournamentCode string) (*LobbyEventDTOWrapper, error)

Gets a mock list of lobby events by tournament code.

type TournamentTeamDto added in v0.6.0

type TournamentTeamDto struct {
	ID           string `json:"id"`
	TournamentID int    `json:"tournamentId"`
	Name         string `json:"name"`
	IconID       int    `json:"iconId"`
	Tier         int    `json:"tier"`
	// Summoner ID of the team captain.
	Captain      string `json:"captain"`
	Abbreviation string `json:"abbreviation"`
	// Team members.
	Players []TournamentPlayerDTO `json:"players"`
}

type UpdateDTO added in v0.6.0

type UpdateDTO struct {
	UpdatedAt    time.Time    `json:"updated_at"`
	Translations []ContentDTO `json:"translations"`
	Author       string       `json:"author"`
	Publish      bool         `json:"publish"`
	CreatedAt    time.Time    `json:"created_at"`
	ID           int          `json:"id"`
	// (Legal values: riotclient, riotstatus, game)
	PublishLocations []string `json:"publish_locations"`
}

Jump to

Keyboard shortcuts

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