rgapi

package
v0.0.0-...-165beb6 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2022 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	SoloQueue = 420
	FlexQueue = 440
)

Variables

View Source
var (
	BaseURL string = "api.riotgames.com/lol"

	//ErrAPIKeyNotSet is the error returned when no global API key has been set
	ErrAPIKeyNotSet = errors.New("rgapi: API key has not been set. If you need a key visit https://developer.riotgames.com/")
)

Functions

func GetRankedQueues

func GetRankedQueues() []int

func NormalizeGameName

func NormalizeGameName(summonerName string) string

NormalizeGameName 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 NormalizeGameNames

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

NormalizeGameName 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 SetAPIKey

func SetAPIKey(key string)

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

func SetShortRateLimit

func SetShortRateLimit(numrequests int, pertime time.Duration)

SetShortRateLimit 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

Types

type HttpError

type HttpError struct {
	StatusCode int
}

HttpError contains the http status code of the erro

func (HttpError) Error

func (err HttpError) Error() string

Error prints the error message for a HttpError

type Mastery

type Mastery struct {
	MasteryId int `json:"masteryId"`
	Rank      int `json:"rank"`
}

type Match

type Match struct {
	SeasonId              int                   `json:"seasonId"`
	QueueId               int                   `json:"queueId"`
	GameId                int64                 `json:"gameId"`
	ParticipantIdentities []ParticipantIdentity `json:"participantIdentities"`
	GameVersion           string                `json:"gameVersion"`
	PlatformId            string                `json:"platformId"`
	GameMode              string                `json:"gameMode"`
	MapId                 int                   `json:"mapId"`
	GameType              string                `json:"gameType"`
	Teams                 []TeamStats           `json:"teams"`
	Participants          []Participant         `json:"participants"`
	GameDuration          int64                 `json:"gameDuration"`
	GameCreation          int64                 `json:"gameCreation"`
}

func MatchDetails

func MatchDetails(region string, matchId int64) (match *Match, err error)

MatchDetails gets specific stats on a match

type MatchReference

type MatchReference struct {
	Lane       string `json:"lane"`
	GameId     int64  `json:"gameId"`
	Champion   int    `json:"champion"`
	PlatformId string `json:"platformId"`
	Timestamp  int64  `json:"timestamp"`
	Queue      int    `json:"queue"`
	Role       string `json:"role"`
	Season     int    `json:"season"`
}

type Matchlist

type Matchlist struct {
	Matches    []MatchReference `json:"matches"`
	TotalGames int              `json:"totalGames"`
	StartIndex int              `json:"startIndex"`
	EndIndex   int              `json:"endIndex"`
}

func FilterMatchlist

func FilterMatchlist(region string, accountId int64, numGames int, queues []int) (matchlist Matchlist, err error)

FilterMatchlist pulls your 100 most recent games that fulfill the given constraints; unfortunately lane isn't one

func RecentMatchlist

func RecentMatchlist(region string, accountId int64) (matchlist Matchlist, err error)

RecentMatchlist pulls your 20 most recent games

type Participant

type Participant struct {
	Stats                     ParticipantStats    `json:"stats"`
	ParticipantId             int                 `json:"participantId"`
	Runes                     []Rune              `json:"runes"`
	Timeline                  ParticipantTimeline `json:"timeline"`
	TeamId                    int                 `json:"teamId"`
	Spell2Id                  int                 `json:"spell2Id"`
	Masteries                 []Mastery           `json:"masteries"`
	HighestAchievedSeasonTier string              `json:"highestAchievedSeasonTier"`
	Spell1Id                  int                 `json:"spell1Id"`
	ChampionId                int                 `json:"championId"`
}

type ParticipantIdentity

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

type ParticipantStats

type ParticipantStats struct {
	PhysicalDamageDealt             int64 `json:"physicalDamageDealt"`
	NeutralMinionsKilledTeamJungle  int   `json:"neutralMinionsKilledTeamJungle"`
	MagicDamageDealt                int64 `json:"magicDamageDealt"`
	TotalPlayerScore                int   `json:"totalPlayerScore"`
	Deaths                          int   `json:"deaths"`
	Win                             bool  `json:"win"`
	NeutralMinionsKilledEnemyJungle int   `json:"neutralMinionsKilledEnemyJungle"`
	AltarsCaptured                  int   `json:"altarsCaptured"`
	LargestCriticalStrike           int   `json:"largestCriticalStrike"`
	TotalDamageDealt                int64 `json:"totalDamageDealt"`
	MagicDamageDealtToChampions     int64 `json:"magicDamageDealtToChampions"`
	VisionWardsBoughtInGame         int   `json:"visionWardsBoughtInGame"`
	DamageDealtToObjectives         int64 `json:"damageDealtToObjectives"`
	LargestKillingSpree             int   `json:"largestKillingSpree"`
	Item1                           int   `json:"item1"`
	QuadraKills                     int   `json:"quadraKills"`
	TeamObjective                   int   `json:"teamObjective"`
	TotalTimeCrowdControlDealt      int   `json:"totalTimeCrowdControlDealt"`
	LongestTimeSpentLiving          int   `json:"longestTimeSpentLiving"`
	WardsKilled                     int   `json:"wardsKilled"`
	FirstTowerAssist                bool  `json:"firstTowerAssist"`
	FirstTowerKill                  bool  `json:"firstTowerKill"`
	Item2                           int   `json:"item2"`
	Item3                           int   `json:"item3"`
	Item0                           int   `json:"item0"`
	FirstBloodAssist                bool  `json:"firstBloodAssist"`
	VisionScore                     int64 `json:"visionScore"`
	WardsPlaced                     int   `json:"wardsPlaced"`
	Item4                           int   `json:"item4"`
	Item5                           int   `json:"item5"`
	Item6                           int   `json:"item6"`
	TurretKills                     int   `json:"turretKills"`
	TripleKills                     int   `json:"tripleKills"`
	DamageSelfMitigated             int64 `json:"damageSelfMitigated"`
	ChampLevel                      int   `json:"champLevel"`
	NodeNeutralizeAssist            int   `json:"nodeNeutralizeAssist"`
	FirstInhibitorKill              bool  `json:"firstInhibitorKill"`
	GoldEarned                      int   `json:"goldEarned"`
	MagicalDamageTaken              int64 `json:"magicalDamageTaken"`
	Kills                           int   `json:"kills"`
	DoubleKills                     int   `json:"doubleKills"`
	NodeCaptureAssist               int   `json:"nodeCaptureAssist"`
	TrueDamageTaken                 int64 `json:"trueDamageTaken"`
	NodeNeutralize                  int   `json:"nodeNeutralize"`
	FirstInhibitorAssist            bool  `json:"firstInhibitorAssist"`
	Assists                         int   `json:"assists"`
	UnrealKills                     int   `json:"unrealKills"`
	NeutralMinionsKilled            int   `json:"neutralMinionsKilled"`
	ObjectivePlayerScore            int   `json:"objectivePlayerScore"`
	CombatPlayerScore               int   `json:"combatPlayerScore"`
	DamageDealtToTurrets            int64 `json:"damageDealtToTurrets"`
	AltarsNeutralized               int   `json:"altarsNeutralized"`
	PhysicalDamageDealtToChampions  int64 `json:"physicalDamageDealtToChampions"`
	GoldSpent                       int   `json:"goldSpent"`
	TrueDamageDealt                 int64 `json:"trueDamageDealt"`
	TrueDamageDealtToChampions      int64 `json:"trueDamageDealtToChampions"`
	ParticipantId                   int   `json:"participantId"`
	PentaKills                      int   `json:"pentaKills"`
	TotalHeal                       int64 `json:"totalHeal"`
	TotalMinionsKilled              int   `json:"totalMinionsKilled"`
	FirstBloodKill                  bool  `json:"firstBloodKill"`
	NodeCapture                     int   `json:"nodeCapture"`
	LargestMultiKill                int   `json:"largestMultiKill"`
	SightWardsBoughtInGame          int   `json:"sightWardsBoughtInGame"`
	TotalDamageDealtToChampions     int64 `json:"totalDamageDealtToChampions"`
	TotalUnitsHealed                int   `json:"totalUnitsHealed"`
	InhibitorKills                  int   `json:"inhibitorKills"`
	TotalScoreRank                  int   `json:"totalScoreRank"`
	TotalDamageTaken                int64 `json:"totalDamageTaken"`
	KillingSprees                   int   `json:"killingSprees"`
	TimeCCingOthers                 int64 `json:"timeCCingOthers"`
	PhysicalDamageTaken             int64 `json:"physicalDamageTaken"`
}

type ParticipantTimeline

type ParticipantTimeline struct {
	Lane                        string             `json:"lane"`
	ParticipantId               int                `json:"participantId"`
	CsDiffPerMinDeltas          map[string]float64 `json:"csDiffPerMinDeltas"`
	GoldPerMinDeltas            map[string]float64 `json:"goldPerMinDeltas"`
	XpDiffPerMinDeltas          map[string]float64 `json:"xpDiffPerMinDeltas"`
	CreepsPerMinDeltas          map[string]float64 `json:"creepsPerMinDeltas"`
	XpPerMinDeltas              map[string]float64 `json:"xpPerMinDeltas"`
	Role                        string             `json:"role"`
	DamageTakenDiffPerMinDeltas map[string]float64 `json:"damageTakenDiffPerMinDeltas"`
	DamageTakenPerMinDeltas     map[string]float64 `json:"damageTakenPerMinDeltas"`
}

type Player

type Player struct {
	CurrentPlatformId string `json:"currentPlatformId"`
	SummonerName      string `json:"summonerName"`
	MatchHistoryUri   string `json:"matchHistoryUri"`
	PlatformId        string `json:"platformId"`
	CurrentAccountId  int64  `json:"currentAccountId"`
	ProfileIcon       int    `json:"profileIcon"`
	SummonerId        int64  `json:"summonerId"`
	AccountId         int64  `json:"accountId"`
}

type Rune

type Rune struct {
	RuneId int `json:"rune"`
	Rank   int `json:"rank"`
}

type Summoner

type Summoner struct {
	ProfileIconId int    `json:"profileIconId"`
	Name          string `json:"name"`
	SummonerLevel int    `json:"summonerLevel"`
	AccountId     int64  `json:"accountId"`
	SummonerId    int64  `json:"id"`
	RevisionDate  int64  `json:"revisionDate"`
}

Summoner is a player of League of Legends

func SummonerByName

func SummonerByName(region string, name string) (summoner 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 NormalizeGameName before calling this function

type TeamBans

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

type TeamStats

type TeamStats struct {
	FirstDragon          bool       `json:"firstDragon"`
	FirstInhibitor       bool       `json:"firstInhibitor"`
	Bans                 []TeamBans `json:"bans"`
	BaronKills           int        `json:"baronKills"`
	FirstRiftHerald      bool       `json:"firstRiftHerald"`
	FirstBaron           bool       `json:"firstBaron"`
	RiftHeraldKills      int        `json:"riftHeraldKills"`
	FirstBlood           bool       `json:"firstBlood"`
	TeamId               int        `json:"teamId"`
	FirstTower           bool       `json:"firstTower"`
	VilemawKills         int        `json:"vilemawKills"`
	InhibitorKills       int        `json:"inhibitorKills"`
	TowerKills           int        `json:"towerKills"`
	DominionVictoryScore int        `json:"dominionVictoryScore"`
	Win                  string     `json:"win"`
	DragonKills          int        `json:"dragonKills"`
}

Jump to

Keyboard shortcuts

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