riotapi

package
v0.0.0-...-9bf2a32 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIHosts = map[string]string{
	"br":   "br1.api.riotgames.com",
	"eune": "eun1.api.riotgames.com",
	"euw":  "euw1.api.riotgames.com",
	"jp":   "jp1.api.riotgames.com",
	"kr":   "kr.api.riotgames.com",
	"lan":  "la1.api.riotgames.com",
	"las":  "la2.api.riotgames.com",
	"na":   "na1.api.riotgames.com",
	"oce":  "oc1.api.riotgames.com",
	"tr":   "tr1.api.riotgames.com",
	"ru":   "ru.api.riotgames.com",
	"pbe":  "pbe1.api.riotgames.com",
}

APIHosts is a map from regions to Riot hosts

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Msg        string
	RetryAfter int
}

APIError wraps http error messages

func (APIError) Error

func (err APIError) Error() string

type BannedChampion

type BannedChampion struct {
	PickTurn   int
	ChampionID int
	TeamID     int
}

BannedChampion contains information about banned champions

type Champion

type Champion struct {
	ID    int    `json:"id,omitempty"`
	Name  string `json:"name,omitempty"`
	Title string `json:"title,omitempty"`
	Key   string `json:"key,omitempty"`
}

Champion is the League of Legends champion

type Champions

type Champions struct {
	Data map[int]Champion
}

Champions contains the Champions indexed by their id's

type ChampionsDTO

type ChampionsDTO struct {
	Type    string              `json:"type,omitempty"`
	Version string              `json:"version,omitempty"`
	Data    map[string]Champion `json:"data,omitempty"`
}

ChampionsDTO contains the Champions data

type Client

type Client struct {
	Summoner   SummonerAPI
	Spectator  SpectatorAPI
	StaticData LoLStaticDataAPI
	Match      MatchAPI
	// contains filtered or unexported fields
}

Client is the http client used for sending the requests

func New

func New(apiKey, region string, requestsPerMinute, maxBurst int) (*Client, error)

New creates a new riot API client

func (*Client) Request

func (c *Client) Request(api, apiMethod string, data interface{}) error

Request sends a new request to the given api endpoint and unmarshalls the response to given data

type CurrentGameInfo

type CurrentGameInfo struct {
	GameID            int
	GameStartTime     int
	PlatformID        string
	GameMode          string
	MapID             int
	GameType          string
	BannedChampions   []BannedChampion
	Observers         Observer
	Participants      []CurrentGameParticipant
	GameLength        int
	GameQueueConfigID int
}

CurrentGameInfo represents a game in progress

type CurrentGameParticipant

type CurrentGameParticipant struct {
	ProfileIconID            int
	ChampionID               int
	SummonerName             string
	GameCustomizationObjects []GameCustomizationObject
	Bot                      bool
	Perks                    Perks
	Spell1ID                 int
	Spell2ID                 int
	TeamID                   int
	SummonerID               int
}

CurrentGameParticipant contains information about a participant

type DDragonClient

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

DDragonClient fetches data from the ddragon

func NewDDragonClient

func NewDDragonClient() *DDragonClient

NewDDragonClient creates a new client for DDragon

func (*DDragonClient) GetProfileIconURL

func (c *DDragonClient) GetProfileIconURL(id int) string

GetProfileIconURL returns url to given profile icon

func (*DDragonClient) GetRunesReforged

func (c *DDragonClient) GetRunesReforged() (*RunesReforged, error)

GetRunesReforged returns runes data

func (*DDragonClient) Request

func (c *DDragonClient) Request(dataPath string, data interface{}) error

Request sends a new request to the given api endpoint and unmarshalls the response to given data

type GameCustomizationObject

type GameCustomizationObject struct {
	Category string
	Content  string
}

GameCustomizationObject contains information about game customization

type LoLStaticDataAPI

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

LoLStaticDataAPI implements the Riot LoL Static Data API methods

func (*LoLStaticDataAPI) Champions

func (api *LoLStaticDataAPI) Champions() (*Champions, error)

Champions retrieves champion list lol/static-data/v3/champions

type MasteryDTO

type MasteryDTO struct {
	MasteryID int
	Rank      int
}

MasteryDTO contains information about layer masteries

type MatchAPI

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

MatchAPI implements the Riot Match API methods

func (MatchAPI) MatchByID

func (api MatchAPI) MatchByID(ID int) (*MatchDTO, error)

MatchByID returns match by given id

func (MatchAPI) RecentMatchesByAccountID

func (api MatchAPI) RecentMatchesByAccountID(ID int) (*MatchListDTO, error)

RecentMatchesByAccountID gets matchlist for last 20 matches played on given account ID and platform ID.

type MatchDTO

type MatchDTO struct {
	QueueID               int
	GameID                int
	ParticipantIdentities []ParticipantIdentityDTO
	GameVersion           string
	PlatformID            string
	GameMode              string
	MapID                 int
	GameType              string
	Teams                 []TeamStatsDTO
	Participants          []ParticipantDTO
	GameDuration          int
	GameCreation          int
	// contains filtered or unexported fields
}

MatchDTO contais all information of one match

type MatchListDTO

type MatchListDTO struct {
	Matches []MatchReferenceDTO
	// contains filtered or unexported fields
}

MatchListDTO contains list of match references

type MatchReferenceDTO

type MatchReferenceDTO struct {
	Lane       string
	GameID     int
	Champion   int
	PlatformID string
	Season     int
	Queue      int
	Role       string
	TimeStamp  int
}

MatchReferenceDTO contains reference information about a match

type Observer

type Observer struct {
	EncryptionKey string
}

Observer information

type ParticipantDTO

type ParticipantDTO struct {
	Stats                     ParticipantStatsDTO
	ParticipantID             int
	Runes                     []RuneDTO
	Timeline                  ParticipantTimelineDTO
	TeamID                    int
	Spell1ID                  int
	Spell2ID                  int
	Masteries                 []MasteryDTO
	HighestAchievedSeasonTier string
	ChampionID                int
}

ParticipantDTO contains information about a game participant

type ParticipantIdentityDTO

type ParticipantIdentityDTO struct {
	Player        PlayerDTO
	ParticipantID int
}

ParticipantIdentityDTO contains information about a participant

type ParticipantStatsDTO

type ParticipantStatsDTO struct {
	PhysicalDamageDealt             int
	NeutralMinionsKilledTeamJungle  int
	MagicDamageDealt                int
	TotalPlayerScore                int
	Deaths                          int
	Win                             bool
	NeutralMinionsKilledEnemyJungle int
	AltarsCaptured                  int
	LargestCriticalStrike           int
	TotalDamageDealt                int
	MagicDamageDealtToChampion      int
	VisionWardsBoughtInGame         int
	DamageDealtToObjectives         int
	LargestKillingSpree             int
	Item                            int
	Item1                           int
	Item2                           int
	Item3                           int
	Item4                           int
	Item5                           int
	Item6                           int
	FirstBloodAssist                bool
	VisionScore                     int
	WardsPlaced                     int
	TurretKills                     int
	TripleKills                     int
	DamageSelfMitigated             int
	ChampLevel                      int
	NodeNeutralizeAssist            int
	FirstInhibitorKill              bool
	GoldEarned                      int
	MagicalDamageTaken              int
	Kills                           int
	DoubleKills                     int
	NodeCaptureAssist               bool
	TrueDamageTaken                 int
	NodeNeutralize                  int
	FirstInhibitorAssist            bool
	Assists                         int
	UnrealKills                     int
	NeutralMinionsKilled            int
	ObjectivePlayerScore            int
	CombatPlayerScore               int
	DamageDealtToTurrets            int
	AltarsNeutralized               int
	PhysicalDamageDealtToChampions  int
	GoldSpent                       int
	TrueDamageDealt                 int
	TrueDamageDealtToChampions      int
	ParticipantID                   int
	PentaKills                      int
	TotalHeal                       int
	TotalMinionsKilled              int
	FirstBloodKill                  bool
	NodeCapture                     int
	LargestMultiKill                int
	SightWardsBoughtInGame          int
	TotalDamageDealtToChampions     int
	TotalUnitsHealed                int
	InhibitorKills                  int
	TotalScoreRank                  int
	TotalDamageTaken                int
	KillingSprees                   int
	TimeCCingOthers                 int
	PhysicalDamageTaken             int
}

ParticipantStatsDTO contains information about the participants stats

type ParticipantTimelineDTO

type ParticipantTimelineDTO struct {
	Lane                        string
	ParticipantID               int
	CsDiffPerMinDeltas          map[string]float64
	GoldPerMinDeltas            map[string]float64
	XpDiffPerMinDelts           map[string]float64
	CreepsPerMinDeltas          map[string]float64
	XpPerMinDeltas              map[string]float64
	Role                        string
	DamageTakenDiffPerMinDeltas map[string]float64
	DamageTakenPerMinDeltas     map[string]float64
}

ParticipantTimelineDTO contains information about participants doings

type PerkStyle

type PerkStyle struct {
	ID    int
	Key   string
	Name  string
	Icon  string
	Runes map[int]Rune
}

PerkStyle contains information about a Rune

type Perks

type Perks struct {
	PerkStyle    int
	PerkIDs      []int
	PerkSubStyle int
}

Perks / runes reforged information

type PlayerDTO

type PlayerDTO struct {
	CurrentPlatformID string
	SummonerName      string
	MatchHistoryURI   string
	PlatformID        string
	CurrentAccountID  int
	ProfileIcon       int
	SummonerID        int
	AccountID         int
}

PlayerDTO contains information about the player

type Rune

type Rune struct {
	ID        int
	Key       string
	Name      string
	ShortDesc string
	LongDesc  string
	Icon      string
}

Rune contains information about one rune

type RuneDTO

type RuneDTO struct {
	RuneID int
	Rank   int
}

RuneDTO contains information about player runes

type RunesReforged

type RunesReforged struct {
	PerkStyles map[int]PerkStyle
}

RunesReforged contains the runes data in more usable form

func (*RunesReforged) AllRunes

func (rr *RunesReforged) AllRunes() map[int]Rune

AllRunes returns all runes in a single map

type RunesReforgedDTO

type RunesReforgedDTO []struct {
	ID    int    `json:"id"`
	Key   string `json:"key"`
	Name  string `json:"name"`
	Icon  string `json:"icon"`
	Slots []struct {
		Runes []struct {
			ID        int    `json:"id"`
			Key       string `json:"key"`
			Name      string `json:"name"`
			ShortDesc string `json:"shortDesc"`
			LongDesc  string `json:"longDesc"`
			Icon      string `json:"icon"`
		} `json:"runes"`
	} `json:"slots"`
}

RunesReforgedDTO contains the runes data as fetched from ddragon

func (RunesReforgedDTO) ToRunesReforged

func (dtos RunesReforgedDTO) ToRunesReforged() *RunesReforged

ToRunesReforged converts DTO to RunesReforged

type SpectatorAPI

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

SpectatorAPI implements the Riot Spectator API methods

func (SpectatorAPI) ActiveGamesBySummoner

func (api SpectatorAPI) ActiveGamesBySummoner(id int) (*CurrentGameInfo, error)

ActiveGamesBySummoner gets current game information for the given summoner ID or nil, if there is no game

type SummonerAPI

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

SummonerAPI implements the Riot Summoner API methods

func (SummonerAPI) SummonerByID

func (api SummonerAPI) SummonerByID(ID int) (*SummonerDTO, error)

SummonerByID gets a summoner by summoner id

func (SummonerAPI) SummonerByName

func (api SummonerAPI) SummonerByName(name string) (*SummonerDTO, error)

SummonerByName gets a summoner by summoner name

type SummonerDTO

type SummonerDTO struct {
	Name          string
	ID            int
	AccountID     int
	SummonerLevel int
	ProfileIconID int
	RevisionDate  int
}

SummonerDTO represents a summoner

type TeamBansDTO

type TeamBansDTO struct {
	PickTurn   int
	ChampionID int
}

TeamBansDTO contains the champion bans

type TeamStatsDTO

type TeamStatsDTO struct {
	FirstDragon          bool
	FirstInhibitor       bool
	Bans                 []TeamBansDTO
	BaronKills           int
	FirstRiftHerald      bool
	FirstBaron           bool
	RiftHeraldKills      int
	FirstBlood           bool
	TeamID               int
	FirstTower           bool
	VilemawKills         int
	InhibitorKills       int
	TowerKills           int
	DominionVictoryScore int
	Win                  string
	DragonKills          int
}

TeamStatsDTO contains information about the team stats

Jump to

Keyboard shortcuts

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