lol

package module
v0.0.0-...-a574d32 Latest Latest
Warning

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

Go to latest
Published: May 6, 2016 License: GPL-3.0 Imports: 20 Imported by: 5

README

go-lol

GoDoc

Go binding for the official Riot Games League of Legend API

License

This software is Licensed under GPL version 3. A copy of the license can be found in the file LICENSE

Disclaimer

go-lol isn’t endorsed by Riot Games and doesn’t reflect the views or opinions of Riot Games or anyone officially involved in producing or managing League of Legends. League of Legends and Riot Games are trademarks or registered trademarks of Riot Games, Inc. League of Legends (c) Riot Games, Inc.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIEndpoint

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

An APIEndpoint represents an endpoint that can fetch dynamic data about League of Legend

func NewAPIEndpoint

func NewAPIEndpoint(region *Region, key APIKey) (*APIEndpoint, error)

NewAPIEndpoint creates a new APIEndpoint from a Region and an APIKey

func (*APIEndpoint) GetChampionMasteries

func (a *APIEndpoint) GetChampionMasteries(playerID SummonerID) ([]ChampionMastery, error)

GetChampionMasteries returns all of the ChampionMastery of a given player, ordered by decreasing points

func (*APIEndpoint) GetChampionMastery

func (a *APIEndpoint) GetChampionMastery(playerID SummonerID, championID ChampionID) (*ChampionMastery, error)

GetChampionMastery returns the champion mastery of a given player for a given champion, ni

func (*APIEndpoint) GetChampionMasteryScore

func (a *APIEndpoint) GetChampionMasteryScore(playerID SummonerID) (int, error)

GetChampionMasteryScore return sthe total score of a player

func (*APIEndpoint) GetChampionMasteryTopChampions

func (a *APIEndpoint) GetChampionMasteryTopChampions(playerID SummonerID, count int) ([]ChampionMastery, error)

GetChampionMasteryTopChampions returns the count top champion of a player

func (*APIEndpoint) GetCurrentGame

func (a *APIEndpoint) GetCurrentGame(id SummonerID) (*CurrentGameInfo, error)

GetCurrentGame return the CurrentGame of a Summoner identified by its SummonerID. It returns nil,nil if the user is not currently playing a game.

func (*APIEndpoint) GetFeaturedGames

func (a *APIEndpoint) GetFeaturedGames() (*FeaturedGames, error)

GetFeaturedGames returns the currently played FeaturedGame on the region

func (*APIEndpoint) GetSummonerByName

func (a *APIEndpoint) GetSummonerByName(names []string) ([]Summoner, error)

GetSummonerByName returns Summoner data identified by their names

func (*APIEndpoint) GetSummonerNames

func (a *APIEndpoint) GetSummonerNames(ids []SummonerID) (map[SummonerID]string, error)

GetSummonerNames returns the name of Summoner identified by their IDs

func (*APIEndpoint) GetSummonerRecentGames

func (a *APIEndpoint) GetSummonerRecentGames(id SummonerID) ([]Game, error)

GetSummonerRecentGames returns the list of game recently played by a Summoner identified by its SummonerID

type APIKey

type APIKey string

An APIKey is used to authenticate access to Riot Game API

func (APIKey) Check

func (k APIKey) Check() error

Check returns an error if the APIKey is not valid, nil otherwise

type APIKeyStorer

type APIKeyStorer interface {
	Get() (APIKey, bool)
	Store(k APIKey) error
}

An APIKeyStorer is used to safely Store and Get an APIKey for the user

type Champion

type Champion struct {
	AllyTips  []string `json:"allytips"`
	Blurb     string   `json:"blurb"`
	EnemyTips []string `json:"enemytips"`
	ID        int      `json:"id"`
	Image     ImageDto `json:"image"`
	Info      struct {
		Attack     int
		Defense    int
		Difficulty int
		Magic      int
	} `json:"info"`
	Key     string `json:"key"`
	Lore    string `json:"lore"`
	Name    string `json:"name"`
	Partype string `json:"partype"`
	Passive struct {
		Description          string   `json:"description"`
		Image                ImageDto `json:"image"`
		Name                 string   `json:"name"`
		SanitizedDescription string   `json:"sanitizedDescription"`
	} `json:"passive"`
	Recommended []struct{} `json:"recommended"`
	Skins       []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
		Num  int    `json:"num"`
	} `json:"skins"`
	Spells []struct{} `json:"spells"`
	Stats  struct{}   `json:"stats"`
	Tags   []string   `json:"tags"`
	Title  string     `json:"title"`
}

A Champion can be controlled by a Summoner in a Game

type ChampionID

type ChampionID int //for sure there will never even be more than a thousand champions/

ChampionID is a unique identifier for a Champion

type ChampionMastery

type ChampionMastery struct {
	Champion             ChampionID       `json:"championID"`
	Level                int              `json:"championLevel"`
	Points               int              `json:"championPoints"`
	PointsSinceLastLevel int              `json:"championPointsSinceLastLevel"`
	PointsUntilNextLevel int              `json:"championPointsUntilNextLevel"`
	ChestGranted         bool             `json:"chestGranted"`
	HighestGrade         string           `json:"highestGrade"`
	LastPlayTime         EpochMillisecond `json:"lastPlayTime"`
	Player               SummonerID       `json:"playerId"`
}

A ChampionMastery represents the mastery level of a payer with a given champion

type CurrentGameInfo

type CurrentGameInfo struct {
	BannedChampion []struct {
		Champion ChampionID `json:"championId"`
		PickTurn int        `json:"pickTurn"`
		Team     int        `json:"teamID"`
	} `json:"bannedChampions"`

	ID            GameID           `json:"gameId"`
	GameLength    int64            `json:"GameLength"`
	GameMode      string           `json:"gameMode"`
	GameQueue     QueueID          `json:"gameQueueConfigId"`
	GameStartTime EpochMillisecond `json:"gameStartTime"`
	GameType      string           `json:"gameType"`
	Map           MapID            `json:"mapId"`

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

	Participants []struct {
		ID          SummonerID    `json:"summonerId"`
		Name        string        `json:"summonerName"`
		Bot         bool          `json:"bot"`
		Champion    ChampionID    `json:"championId"`
		ProfileIcon ProfileIconID `json:"profileIconId"`

		Masteries []struct {
			ID   MasteryID `json:"matseryId"`
			Rank int       `json:"rank"`
		} `json:"masteries"`
		Runes []struct {
			ID    RuneID `json:"runeId"`
			Count int    `json:"count"`
		} `json:"runes"`

		SummonerSpell1 SummonerSpellID `json:"spell1Id"`
		SummonerSpell2 SummonerSpellID `json:"spell2Id"`

		TeamID int64 `json:"teamId"`
	} `json:"participants"`

	Platform string `json:"platformId"`
}

CurrentGameInfo represent a Game that a Summoner is currently playing

func (CurrentGameInfo) String

func (g CurrentGameInfo) String() string

type EpochMillisecond

type EpochMillisecond uint64

EpochMillisecond represents a point in time by the number of milliseconds since EPOCH

func (EpochMillisecond) Time

func (s EpochMillisecond) Time() time.Time

Time converts EpochMillisecond to time.Time

type FeaturedGameInfo

type FeaturedGameInfo struct {
	BannedChampion []struct {
		Champion ChampionID `json:"championId"`
		PickTurn int        `json:"pickTurn"`
		Team     int        `json:"teamID"`
	} `json:"bannedChampions"`

	ID            GameID           `json:"gameId"`
	GameLength    int64            `json:"GameLength"`
	GameMode      string           `json:"gameMode"`
	GameQueue     QueueID          `json:"gameQueueConfigId"`
	GameStartTime EpochMillisecond `json:"gameStartTime"`
	GameType      string           `json:"gameType"`
	Map           MapID            `json:"mapId"`

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

	Participants []struct {
		ID          SummonerID `json:"summonerId"`
		Name        string     `json:"summonerName"`
		Bot         bool       `json:"bot"`
		Champion    ChampionID `json:"championId"`
		ProfileIcon int64      `json:"profileIconId"`

		SummonerSpell1 SummonerSpellID `json:"spell1Id"`
		SummonerSpell2 SummonerSpellID `json:"spell2Id"`

		TeamID int64 `json:"teamId"`
	} `json:"participants"`

	Platform string `json:"platformId"`
}

FeaturedGameInfo is an information about a featured game

type FeaturedGames

type FeaturedGames struct {
	Games          []FeaturedGameInfo `json:"gameList"`
	RefrehInterval int64              `json:"clientRefreshInterval"`
}

FeaturedGames is a list of games that Riot Game considers worth spectating

type Game

type Game struct {
	ID         GameID           `json:"gameId"`
	Invalid    bool             `json:"invalid"`
	Mode       string           `json:"gameMode"`
	Type       string           `json:"gameType"`
	SubType    string           `json:"subType"`
	MapID      int              `json:"mapId"`
	Team       int              `json:"teamId"`
	Champion   ChampionID       `json:"championId"`
	Spell1     int              `json:"spell1"`
	Spell2     int              `json:"spell2"`
	Level      int              `json:"level"`
	IPEarned   int              `json:"ipEarned"`
	CreateDate EpochMillisecond `json:"createDate"`

	Fellows []struct {
		Summoner SummonerID `json:"summonerID"`
		Team     int        `json:"teamID"`
		Champion ChampionID `json:"championID"`
	} `json:"fellowPlayers"`

	Stats struct {
		Level                          int  `json:"level,omitempty"`
		GoldEarned                     int  `json:"goldEarned,omitempty"`
		Death                          int  `json:"numDeaths,omitempty"`
		TurretsKilled                  int  `json:"turretsKilled,omitempty"`
		MinionsKilled                  int  `json:"minionsKilled,omitempty"`
		Kills                          int  `json:"championsKilled,omitempty"`
		GoldSpent                      int  `json:"goldSpent,omitempty"`
		TotalDamageDealt               int  `json:"totalDamageDealt,omitempty"`
		TotalDamageTaken               int  `json:"totalDamageTaken,omitempty"`
		KillingSprees                  int  `json:"killingSprees,omitempty"`
		LargestKillingSpree            int  `json:"largestKillingSpree,omitempty"`
		Team                           int  `json:"team,omitempty"`
		Win                            bool `json:"win"`
		NeutralMinionsKilled           int  `json:"neutralMinionsKilled,omitempty"`
		LargestMultiKill               int  `json:"largestMultiKill,omitempty"`
		PhysicalDamageDealtPlayer      int  `json:"physicalDamageDealtPlayer,omitempty"`
		MagicDamageDealtPlayer         int  `json:"magicDamageDealtPlayer,omitempty"`
		PhysicalDamageTaken            int  `json:"physicalDamageTaken,omitempty"`
		MagicDamageTaken               int  `json:"magicDamageTaken,omitempty"`
		TimePlayed                     int  `json:"timePlayed,omitempty"`
		TotalHeal                      int  `json:"totalHeal,omitempty"`
		TotalUnitsHealed               int  `json:"totalUnitsHealed,omitempty"`
		Assists                        int  `json:"assists,omitempty"`
		Item0                          int  `json:"item0,omitempty"`
		Item1                          int  `json:"item1,omitempty"`
		Item2                          int  `json:"item2,omitempty"`
		Item3                          int  `json:"item3,omitempty"`
		Item4                          int  `json:"item4,omitempty"`
		Item5                          int  `json:"item5,omitempty"`
		Item6                          int  `json:"item6,omitempty"`
		MagicDamageDealtToChampions    int  `json:"magicDamageDealtToChampions,omitempty"`
		PhysicalDamageDealtToChampions int  `json:"physicalDamageDealtToChampions,omitempty"`
		TotalDamageDealtToChampions    int  `json:"totalDamageDealtToChampions,omitempty"`
		TrueDamageDealtPlayer          int  `json:"trueDamageDealtPlayer,omitempty"`
		TrueDamageDealtToChampions     int  `json:"trueDamageDealtToChampions,omitempty"`
		TrueDamageTaken                int  `json:"trueDamageTaken,omitempty"`
		WardKilled                     int  `json:"wardKilled,omitempty"`
		WardPlaced                     int  `json:"wardPlaced,omitempty"`
		NeutralMinionsKilledYourJungle int  `json:"neutralMinionsKilledYourJungle,omitempty"`
		TotalTimeCrowdControlDealt     int  `json:"totalTimeCrowdControlDealt,omitempty"`
		PlayerPosition                 int  `json:"playerPosition,omitempty"`
		PlayerRole                     int  `json:"playerRole,omitempty"`

		Barrackskilled                  int  `json:"barrackskilled,omitempty"`
		Combatplayerscore               int  `json:"combatPlayerScore,omitempty"`
		Consumablespurchased            int  `json:"consumablesPurchased,omitempty"`
		Damagedealtplayer               int  `json:"damageDealtPlayer,omitempty"`
		Doublekills                     int  `json:"doubleKills,omitempty"`
		Firstblood                      int  `json:"firstBlood,omitempty"`
		Gold                            int  `json:"gold,omitempty"`
		Itemspurchased                  int  `json:"itemsPurchased,omitempty"`
		Largestcriticalstrike           int  `json:"largestCriticalStrike,omitempty"`
		Legendaryitemscreated           int  `json:"legendaryItemsCreated,omitempty"`
		Minionsdenied                   int  `json:"minionsDenied,omitempty"`
		Neutralminionskilledenemyjungle int  `json:"neutralMinionsKilledEnemyJungle,omitempty"`
		Nexuskilled                     bool `json:"nexusKilled,omitempty"`
		Nodecapture                     int  `json:"nodeCapture,omitempty"`
		Nodecaptureassist               int  `json:"nodeCaptureAssist,omitempty"`
		Nodeneutralize                  int  `json:"nodeNeutralize,omitempty"`
		Nodeneutralizeassist            int  `json:"nodeNeutralizeAssist,omitempty"`
		Numitemsbought                  int  `json:"numItemsBought,omitempty"`
		Objectiveplayerscore            int  `json:"objectivePlayerScore,omitempty"`
		Pentakills                      int  `json:"pentaKills,omitempty"`
		Quadrakills                     int  `json:"quadraKills,omitempty"`
		Sightwardsbought                int  `json:"sightWardsBought,omitempty"`
		Spell1cast                      int  `json:"spell1Cast,omitempty"`
		Spell2cast                      int  `json:"spell2Cast,omitempty"`
		Spell3cast                      int  `json:"spell3Cast,omitempty"`
		Spell4cast                      int  `json:"spell4Cast,omitempty"`
		Summonspell1cast                int  `json:"summonSpell1Cast,omitempty"`
		Summonspell2cast                int  `json:"summonSpell2Cast,omitempty"`
		Supermonsterkilled              int  `json:"superMonsterKilled,omitempty"`
		Teamobjective                   int  `json:"teamObjective,omitempty"`
		Totalplayerscore                int  `json:"totalPlayerScore,omitempty"`
		Totalscorerank                  int  `json:"totalScoreRank,omitempty"`
		Triplekills                     int  `json:"tripleKills,omitempty"`
		Unrealkills                     int  `json:"unrealKills,omitempty"`
		Victorypointtotal               int  `json:"victoryPointTotal,omitempty"`
		Visionwardsbought               int  `json:"visionWardsBought,omitempty"`
	} `json:"stats"`
}

A Game is a game played on the LoL servers

func (Game) String

func (g Game) String() string

String returns a textual (brief) representation of the Game

type GameID

type GameID uint64 //this is a 64 bit, EUW reached limit of int32 EUW > NA !

GameID uinquely identifies a Game on a Region. It is a uint64, as EUW as already reached 2^31 games ... EUW > NA !

func (GameID) String

func (g GameID) String() string

String return a string representation of the GameID

type ImageDto

type ImageDto struct {
	Full   string `json:"full"`
	Group  string `json:"group"`
	Sprite string `json:"sprite"`
	H      int    `json:"h"`
	W      int    `json:"w"`
	X      int    `json:"x"`
	Y      int    `json:"y"`
}

An ImageDto describe how to get an image from a Realm

type MapID

type MapID int64

A MapID uniquely represents a Map

type MasteryID

type MasteryID int64

A MasteryID uniquely identifies a Mastery

type ProfileIconID

type ProfileIconID int64

A ProfileIconID uniquely identifies a Profile Icon

type QueueID

type QueueID int64

QueueID uniquely represents a Queue

const (
	// CUSTOM represents Custom games
	CUSTOM QueueID = 0
	// NORMAL5x5BLIND represents Normal 5v5 Blind Pick games
	NORMAL5x5BLIND QueueID = 2
	// BOT5x5 represents Historical Summoner's Rift Coop vs AI games
	BOT5x5 QueueID = 7
	// BOT5x5INTRO represents Summoner's Rift Coop vs AI Intro Bot
	// games
	BOT5x5INTRO QueueID = 31
	// BOT5x5BEGINNER represents Summoner's Rift Coop vs AI Beginner
	// Bot games
	BOT5x5BEGINNER QueueID = 32
	// BOT5x5INTERMEDIATE represents Historical Summoner's Rift Coop
	// vs AI Intermediate Bot games
	BOT5x5INTERMEDIATE QueueID = 33
	// NORMAL3x3 represents Normal 3v3 games
	NORMAL3x3 QueueID = 8
	// NORMAL5x5DRAFT represents Normal 5v5 Draft Pick games
	NORMAL5x5DRAFT QueueID = 14
	// ODIN5x5BLIND represents Dominion 5v5 Blind Pick games
	ODIN5x5BLIND QueueID = 16
	// ODIN5x5DRAFT represents Dominion 5v5 Draft Pick games
	ODIN5x5DRAFT QueueID = 17
	// BOTODIN5x5 represents Dominion Coop vs AI games
	BOTODIN5x5 QueueID = 25
	// RANKEDSOLO5x5 represents Ranked Solo 5v5 games
	RANKEDSOLO5x5 QueueID = 4
	// RANKEDPREMADE3x3 represents Ranked Premade 3v3 games
	RANKEDPREMADE3x3 QueueID = 9
	// RANKEDPREMADE5x5 represents Ranked Premade 5v5 games
	RANKEDPREMADE5x5 QueueID = 6
	// RANKEDTEAM3x3 represents Ranked Team 3v3 games
	RANKEDTEAM3x3 QueueID = 41
	// RANKEDTEAM5x5 represents Ranked Team 5v5 games
	RANKEDTEAM5x5 QueueID = 42
	// BOTTT3x3 represents Twisted Treeline Coop vs AI games
	BOTTT3x3 QueueID = 52
	// GROUPFINDER5x5 represents Team Builder games
	GROUPFINDER5x5 QueueID = 61
	// ARAM5x5 represents ARAM games
	ARAM5x5 QueueID = 65
	// ONEFORALL5x5 represents One for All games
	ONEFORALL5x5 QueueID = 70
	// FIRSTBLOOD1x1 represents Snowdown Showdown 1v1 games
	FIRSTBLOOD1x1 QueueID = 72
	// FIRSTBLOOD2x2 represents Snowdown Showdown 2v2 games
	FIRSTBLOOD2x2 QueueID = 73
	// SR6x6 represents Summoner's Rift 6x6 Hexakill games
	SR6x6 QueueID = 75
	// URF5x5 represents Ultra Rapid Fire games
	URF5x5 QueueID = 76
	// BOTURF5x5 represents Ultra Rapid Fire games played against AI
	// games
	BOTURF5x5 QueueID = 83
	// NIGHTMAREBOT5x5RANK1 represents Doom Bots Rank 1 games
	NIGHTMAREBOT5x5RANK1 QueueID = 91
	// NIGHTMAREBOT5x5RANK2 represents Doom Bots Rank 2 games
	NIGHTMAREBOT5x5RANK2 QueueID = 92
	// NIGHTMAREBOT5x5RANK5 represents Doom Bots Rank 5 games
	NIGHTMAREBOT5x5RANK5 QueueID = 93
	// ASCENSION5x5 represents Ascension games
	ASCENSION5x5 QueueID = 96
	// HEXAKILL represents Twisted Treeline 6x6 Hexakill games
	HEXAKILL QueueID = 98
	// KINGPORO5x5 represents King Poro games
	KINGPORO5x5 QueueID = 300
	// COUNTERPICK represents Nemesis games
	COUNTERPICK QueueID = 310
)

type RESTError

type RESTError struct {
	Code int
}

RESTError represents an error when trying to GET the URL api (i.e. non 200 return code)

func (RESTError) Error

func (e RESTError) Error() string

Error return a textual represenation of the RESTError (to implements error interface)

type RESTGetter

type RESTGetter interface {
	Get(url string, v interface{}) error
}

RESTGetter is an interface for object able to Get JSON data from lol REST Api

type RESTStaticData

type RESTStaticData struct {
	TeamIDs           []string
	SummonerNames     []string
	SummonerIDs       []string
	ChampionIDs       []string
	GameIDs           []string
	RegionCode        string
	Key               APIKey
	ResponseByRequest map[string][]byte
}

RESTStaticData represent some data statically fetch from Riot API. It has no other purpose than having some data for unit testing

type RateLimitedRESTGetter

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

A RateLimitedRESTGetter performs the same than a SimpleRESTGetter, but limits the amount of request it does overtime, not to reach Riot Games imposed Request limitations

func NewRateLimitedRESTGetter

func NewRateLimitedRESTGetter(limit uint, window time.Duration) *RateLimitedRESTGetter

NewRateLimitedRESTGetter creates a RateLimitedRESTGetter, that limits its request to no more than limit request over a time.Duration window

func (*RateLimitedRESTGetter) Get

func (g *RateLimitedRESTGetter) Get(url string, v interface{}) error

Get acts like SimpleRESTGetter.Get, but will try not to exceed the number of request over time defined by NewRateLimitedRESTGetter

type Realm

type Realm struct {
	// Base URL to get data for the realm
	Cdn        string `json:"cdn"`
	CSSVersion string `json:"css"`
	// Current versio for Data Dragon
	DataDragonVersion string `json:"dd"`
	// Default language for thsi realm
	Locale string `json:"l"`

	LegacyIE6       string            `json:"lg"`
	DataSetsVersion map[string]string `json:"n"`
	Version         string            `json:"v"`
	ProfileIconMax  int               `json:"profileiconmax"`
	Store           string            `json:"store"`
	// contains filtered or unexported fields
}

A Realm represents dataset of data for a game.

func (*Realm) GetImage

func (r *Realm) GetImage(d ImageDto) (image.Image, error)

GetImage gets the image from the name/full group

func (*Realm) GetImageFromSprite

func (r *Realm) GetImageFromSprite(d ImageDto) (image.Image, error)

GetImageFromSprite gets the image from cutting a sprite

type RecentGames

type RecentGames struct {
	// ID of the Summoner who played the Game
	ID SummonerID `json:"summonerId"`
	// Games recently played
	Games []Game `json:"games"`
}

RecentGames represent the up to 15 last Game played by a Summoner

type Region

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

A Region defines a set of severs where people can play together

func AllDynamicRegion

func AllDynamicRegion() []*Region

AllDynamicRegion returns the list of all Dynamic Region. i.e. region where you can play and observe games.

func NewRegion

func NewRegion(id RegionID) (*Region, error)

NewRegion returns a region identified by its RegionID

func NewRegionByCode

func NewRegionByCode(code string) (*Region, error)

NewRegionByCode returns a region identified by its code (i.e. "euw" for EUW)

func NewRegionByPlatformID

func NewRegionByPlatformID(id string) (*Region, error)

NewRegionByPlatformID returns a region from its PlatformID

func (*Region) Code

func (r *Region) Code() string

Code returns the code used to identifies a Region

func (*Region) IsDynamic

func (r *Region) IsDynamic() bool

IsDynamic returns true if the region is dynamic, i.e. you can play and spectate game on.

func (*Region) PlatformID

func (r *Region) PlatformID() string

PlatformID returns the ID used by observer mode to identifies the Region

func (*Region) SpectatorURL

func (r *Region) SpectatorURL() string

SpectatorURL returns the url that should be used to spectate game for the Region

type RegionID

type RegionID uint

A RegionID is used to uniquely identifies a Region

const (
	// BR represents Brazil region
	BR RegionID = iota
	// EUNE represents European Union North - East region
	EUNE
	// EUW represents European Union West region
	EUW
	// KR represents Korea region
	KR
	// LAN represents Latin America North region
	LAN
	// LAS represents Latin America South  region
	LAS
	// NA represents North America region
	NA
	// OCE represents Oceania region
	OCE
	// TR represents Turkish region
	TR
	// RU represents Russia region
	RU
	// PBE represents the Public Beta Environment region
	PBE
	// GLOBAL represents global static data access point
	GLOBAL
)

type RuneID

type RuneID int64

RuneID uniquely represents a Rune

type SimpleRESTGetter

type SimpleRESTGetter struct{}

A SimpleRESTGetter is the simplest implementation of a RESTGetter, i.e. it will just GET the requested URL, and if the Status is 200, will decode the JSON data

func NewSimpleRESTGetter

func NewSimpleRESTGetter() *SimpleRESTGetter

NewSimpleRESTGetter creates a new SimpleRESTGetter

func (*SimpleRESTGetter) Get

func (g *SimpleRESTGetter) Get(url string, v interface{}) error

Get performs a GET HTTP request on the given URL, and if the Status is not an error, will decode the body of the response as JSON into the given object.

type StaticAPIEndpoint

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

StaticAPIEndpoint is used to access Riot REST API for static data.

func NewStaticAPIEndpoint

func NewStaticAPIEndpoint(region *Region, key APIKey) (*StaticAPIEndpoint, error)

NewStaticAPIEndpoint is creeating a new Static endpoint. You have to pass the Dynamic (i.e. EUW, KR NA) region you are interested in fecthing data.

func (*StaticAPIEndpoint) GetChampion

func (a *StaticAPIEndpoint) GetChampion(id ChampionID) (*Champion, error)

GetChampion returns the champion data for the current patch

func (*StaticAPIEndpoint) GetRealm

func (a *StaticAPIEndpoint) GetRealm() (Realm, error)

GetRealm fetches the current Realm used for the selected region of the StaticAPIEndpoint. It also initializes the cache structure for the Realm data (images)

type Summoner

type Summoner struct {
	ID            SummonerID       `json:"id"`
	Name          string           `json:"name"`
	ProfileIconID int              `json:"profileIconId"`
	Level         uint32           `json:"summonerLevel"`
	RevisionDate  EpochMillisecond `json:"revisionDate"`
}

A Summoner is a representation of a player on LoL servers

type SummonerID

type SummonerID uint64

SummonerID uniquely identifies a Summoner

type SummonerSpellID

type SummonerSpellID int64

SummonerSpellID uniquely represents a SummonerSpell

type XdgAPIKeyStorer

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

XdgAPIKeyStorer Store and Get an APIkey from a file located in the $XDG_CONFIG_HOME directory

func NewXdgAPIKeyStorer

func NewXdgAPIKeyStorer() (*XdgAPIKeyStorer, error)

NewXdgAPIKeyStorer creates a new XdgAPIKeyStorer

func (*XdgAPIKeyStorer) Get

func (s *XdgAPIKeyStorer) Get() (APIKey, bool)

Get retrieve the APIKey from user's XDG_CONFIG_HOME

func (*XdgAPIKeyStorer) Store

func (s *XdgAPIKeyStorer) Store(k APIKey) error

Store saves the new APIKey k to user's XDG_CONFIG_HOME

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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