golio: github.com/KnutZuidema/golio/api Index | Files

package api

import "github.com/KnutZuidema/golio/api"

Package api contains the implementation for all Riot API and Data Dragon endpoints, as well as constant values used throughout the API and error values for known error return codes from the Riot API


Package Files

constants.go data_dragon.go docs.go doer.go error.go riot_api.go


const (
    LanguageCodeCzechRepublic            languageCode = "cs_CZ"
    LanguageCodeGreece                                = "el_GR"
    LanguageCodePoland                                = "pl_PL"
    LanguageCodeRomania                               = "ro_RO"
    LanguageCodeHungary                               = "hu_HU"
    LanguageCodeUnitedKingdom                         = "en_GB"
    LanguageCodeGermany                               = "de_DE"
    LanguageCodeSpain                                 = "es_ES"
    LanguageCodeItaly                                 = "it_IT"
    LanguageCodeFrance                                = "fr_FR"
    LanguageCodeJapan                                 = "ja_JP"
    LanguageCodeKorea                                 = "ko_KR"
    LanguageCodeMexico                                = "es_MX"
    LanguageCodeArgentina                             = "es_AR"
    LanguageCodeBrazil                                = "pt_BR"
    LanguageCodeUnitedStates                          = "en_US"
    LanguageCodeAustralia                             = "en_AU"
    LanguageCodeRussia                                = "ru_RU"
    LanguageCodeTurkey                                = "tr_TR"
    LanguageCodeMalaysia                              = "ms_MY"
    LanguageCodeRepublicOfThePhilippines              = "en_PH"
    LanguageCodeSingapore                             = "en_SG"
    LanguageCodeThailand                              = "th_TH"
    LanguageCodeVietNam                               = "vn_VN"
    LanguageCodeIndonesia                             = "id_ID"
    LanguageCodeMalaysiaChinese                       = "zh_MY"
    LanguageCodeChina                                 = "zh_CN"
    LanguageCodeTaiwan                                = "zh_TW"

All possible language codes

const (
    QueueRankedSolo            queue = "RANKED_SOLO_5x5"
    QueueRankedFlex                  = "RANKED_FLEX_SR"
    QueueRankedTwistedTreeline       = "RANKED_FLEX_TT"

All possible queues

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

All possible Tiers

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

All possible divisions

const (
    RegionBrasil            Region = "br1"
    RegionEuropeNorthEast          = "eun1"
    RegionEuropeWest               = "euw1"
    RegionJapan                    = "jp1"
    RegionKorea                    = "kr"
    RegionLatinAmericaNorth        = "la1"
    RegionLatinAmericaSouth        = "la2"
    RegionNorthAmerica             = "na1"
    RegionOceania                  = "oc1"
    RegionTurkey                   = "tr1"
    RegionRussia                   = "ru"
    RegionPBE                      = "pbe1"

All existing regions


var (
    // LanguageCodes is a list of all possible language codes
    LanguageCodes = []languageCode{

    // Queues is a list of all available queue types
    Queues = []queue{

    // Tiers is a list of all available tiers
    Tiers = []tier{

    // Divisions is a list of all available divisions
    Divisions = []division{

    // Regions is a list of all available regions
    Regions = []Region{
var (
    ErrBadRequest = Error{
        Message:    "bad request",
        StatusCode: http.StatusBadRequest,
    ErrUnauthorized = Error{
        Message:    "unauthorized",
        StatusCode: http.StatusUnauthorized,
    ErrForbidden = Error{
        Message:    "forbidden",
        StatusCode: http.StatusForbidden,
    ErrNotFound = Error{
        Message:    "not found",
        StatusCode: http.StatusNotFound,
    ErrMethodNotAllowed = Error{
        Message:    "method not allowed",
        StatusCode: http.StatusMethodNotAllowed,
    ErrUnsupportedMediaType = Error{
        Message:    "unsupported media type",
        StatusCode: http.StatusUnsupportedMediaType,
    ErrRateLimitExceeded = Error{
        Message:    "rate limit exceeded",
        StatusCode: http.StatusTooManyRequests,
    ErrInternalServerError = Error{
        Message:    "internal server error",
        StatusCode: http.StatusInternalServerError,
    ErrBadGateway = Error{
        Message:    "bad gateway",
        StatusCode: http.StatusBadGateway,
    ErrServiceUnavailable = Error{
        Message:    "service unavailable",
        StatusCode: http.StatusServiceUnavailable,
    ErrGatewayTimeout = Error{
        Message:    "gateway timeout",
        StatusCode: http.StatusGatewayTimeout,
    StatusToError = map[int]Error{
        http.StatusBadRequest:           ErrBadRequest,
        http.StatusUnauthorized:         ErrUnauthorized,
        http.StatusForbidden:            ErrForbidden,
        http.StatusNotFound:             ErrNotFound,
        http.StatusMethodNotAllowed:     ErrMethodNotAllowed,
        http.StatusUnsupportedMediaType: ErrUnsupportedMediaType,
        http.StatusTooManyRequests:      ErrRateLimitExceeded,
        http.StatusInternalServerError:  ErrInternalServerError,
        http.StatusBadGateway:           ErrBadGateway,
        http.StatusServiceUnavailable:   ErrServiceUnavailable,
        http.StatusGatewayTimeout:       ErrGatewayTimeout,

All regularly returned errors by the Riot API

type DataDragonClient Uses

type DataDragonClient struct {
    Version  string
    Language languageCode
    // contains filtered or unexported fields

DataDragonClient provides access to all data provided by the Data Dragon service

func NewDataDragonClient Uses

func NewDataDragonClient(client Doer, region Region, logger log.FieldLogger) *DataDragonClient

NewDataDragonClient returns a new client for the Data Dragon service.

func (DataDragonClient) GetChampion Uses

func (c DataDragonClient) GetChampion(name string) (*model.ChampionDataExtended, error)

GetChampion returns information about the champion with the given name

func (DataDragonClient) GetChampions Uses

func (c DataDragonClient) GetChampions() (map[string]model.ChampionData, error)

GetChampions returns all existing champions

func (DataDragonClient) GetItems Uses

func (c DataDragonClient) GetItems() (map[string]model.Item, error)

GetItems returns all existing items

func (DataDragonClient) GetMasteries Uses

func (c DataDragonClient) GetMasteries() (map[string]model.Mastery, error)

GetMasteries returns all existing masteries. Masteries were removed in patch 7.23.1. If any version higher than that is specified the last available version will be used instead.

func (DataDragonClient) GetProfileIcons Uses

func (c DataDragonClient) GetProfileIcons() (map[string]model.ProfileIcon, error)

GetProfileIcons returns all existing profile icons

func (DataDragonClient) GetSummonerSpells Uses

func (c DataDragonClient) GetSummonerSpells() (map[string]model.SummonerSpell, error)

GetSummonerSpells returns all existing summoner spells

type Doer Uses

type Doer interface {
    // Do processes an HTTP request and returns the response
    Do(r *http.Request) (*http.Response, error)

Doer is an interface for any client that can process an HTTP request and return a response. This will most commonly be a simple HTTP client.

type Error Uses

type Error struct {
    Message    string
    StatusCode int

Error is a custom error type used by the API to signal http error responses

func (Error) Error Uses

func (e Error) Error() string

type MatchStreamValue Uses

type MatchStreamValue struct {
    Error error

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

type Region Uses

type Region string

Region represents a server region

type RiotAPIClient Uses

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

RiotAPIClient provides access to all Riot API endpoints

func NewRiotAPIClient Uses

func NewRiotAPIClient(region Region, apiKey string, client Doer, logger log.FieldLogger) *RiotAPIClient

NewRiotAPIClient returns a new api client for the Riot API

func (RiotAPIClient) CreateTournament Uses

func (c RiotAPIClient) CreateTournament(parameters *model.TournamentRegistrationParameters, useStub bool) (int, error)

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

func (RiotAPIClient) CreateTournamentCodes Uses

func (c RiotAPIClient) CreateTournamentCodes(tournamentID, count int, parameters *model.TournamentCodeParameters,
    useStub bool) ([]string, error)

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

func (RiotAPIClient) CreateTournamentProvider Uses

func (c RiotAPIClient) CreateTournamentProvider(parameters *model.ProviderRegistrationParameters,
    useStub bool) (int, error)

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

func (RiotAPIClient) GetChallengerLeague Uses

func (c RiotAPIClient) GetChallengerLeague(queue queue) (*model.LeagueList, error)

GetChallengerLeague returns the current Challenger league for the Region

func (RiotAPIClient) GetChampionMasteries Uses

func (c RiotAPIClient) GetChampionMasteries(summonerID string) ([]*model.ChampionMastery, error)

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

func (RiotAPIClient) GetChampionMastery Uses

func (c RiotAPIClient) GetChampionMastery(summonerID, championID string) (*model.ChampionMastery, error)

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

func (RiotAPIClient) GetChampionMasteryTotalScore Uses

func (c RiotAPIClient) GetChampionMasteryTotalScore(summonerID string) (int, error)

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

func (RiotAPIClient) GetCurrentGame Uses

func (c RiotAPIClient) GetCurrentGame(summonerID string) (*model.CurrentGameInfo, error)

GetCurrentGame returns a currently running game for a summoner

func (RiotAPIClient) GetFeaturedGames Uses

func (c RiotAPIClient) GetFeaturedGames() (*model.FeaturedGames, error)

GetFeaturedGames returns the currently featured games

func (RiotAPIClient) GetFreeChampionRotation Uses

func (c RiotAPIClient) GetFreeChampionRotation() (*model.ChampionInfo, error)

GetFreeChampionRotation returns information about the current free champion rotation

func (RiotAPIClient) GetGrandmasterLeague Uses

func (c RiotAPIClient) GetGrandmasterLeague(queue queue) (*model.LeagueList, error)

GetGrandmasterLeague returns the current Grandmaster league for the Region

func (RiotAPIClient) GetLeague Uses

func (c RiotAPIClient) GetLeague(leagueID string) (*model.LeagueList, error)

GetLeague returns a ranked league with the specified ID

func (RiotAPIClient) GetLeagues Uses

func (c RiotAPIClient) GetLeagues(queue queue, tier tier, division division) ([]*model.LeagueEntry, error)

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

func (RiotAPIClient) GetLeaguesBySummoner Uses

func (c RiotAPIClient) GetLeaguesBySummoner(summonerID string) ([]*model.LeagueEntry, error)

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

func (RiotAPIClient) GetLobbyEvents Uses

func (c RiotAPIClient) GetLobbyEvents(code string, useStub bool) (*model.LobbyEventList, error)

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

func (RiotAPIClient) GetMasterLeague Uses

func (c RiotAPIClient) GetMasterLeague(queue queue) (*model.LeagueList, error)

GetMasterLeague returns the current Master league for the Region

func (RiotAPIClient) GetMatch Uses

func (c RiotAPIClient) GetMatch(id int) (*model.Match, error)

GetMatch returns a match specified by its ID

func (RiotAPIClient) GetMatchesByAccount Uses

func (c RiotAPIClient) GetMatchesByAccount(accountID string, beginIndex, endIndex int) (*model.Matchlist, error)

GetMatchesByAccount returns a specified range of matches played on the account

func (RiotAPIClient) GetMatchesByAccountStream Uses

func (c RiotAPIClient) GetMatchesByAccountStream(accountID string) <-chan MatchStreamValue

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

func (RiotAPIClient) GetStatus Uses

func (c RiotAPIClient) GetStatus() (*model.Status, error)

GetStatus returns the current status of the services for the Region

func (RiotAPIClient) GetSummonerByAccount Uses

func (c RiotAPIClient) GetSummonerByAccount(id string) (*model.Summoner, error)

GetSummonerByAccount returns the summoner with the given account ID

func (RiotAPIClient) GetSummonerByName Uses

func (c RiotAPIClient) GetSummonerByName(name string) (*model.Summoner, error)

GetSummonerByName returns the summoner with the given summoner name

func (RiotAPIClient) GetSummonerByPUUID Uses

func (c RiotAPIClient) GetSummonerByPUUID(puuid string) (*model.Summoner, error)

GetSummonerByPUUID returns the summoner with the given PUUID

func (RiotAPIClient) GetSummonerBySummonerID Uses

func (c RiotAPIClient) GetSummonerBySummonerID(summonerID string) (*model.Summoner, error)

GetSummonerBySummonerID returns the summoner with the given ID

func (RiotAPIClient) GetThirdPartyCode Uses

func (c RiotAPIClient) GetThirdPartyCode(id string) (string, error)

GetThirdPartyCode returns the third party code for the given summoner id

func (RiotAPIClient) GetTournament Uses

func (c RiotAPIClient) GetTournament(code string) (*model.Tournament, error)

GetTournament returns an existing tournament

func (RiotAPIClient) UpdateTournament Uses

func (c RiotAPIClient) UpdateTournament(code string, parameters model.TournamentUpdateParameters) error

UpdateTournament updates an existing tournament

Package api imports 10 packages (graph) and is imported by 1 packages. Updated 2019-07-21. Refresh now. Tools for package owners.