Back to godoc.org
github.com/KnutZuidema/golio

package golio

v0.0.0 (181b8e8)
Latest Go to latest
Published: May 27, 2020 | License: MIT | Module: github.com/KnutZuidema/golio

Overview

Package golio is a wrapper for the Riot API and the Data Dragon service. It is written purely in Go and provides idiomatic access to all API endpoints.

Example:

client := golio.NewClient("API KEY",
              golio.WithRegion(api.RegionNorthAmerica),
              golio.WithLogger(logrus.New().WithField("foo", "bar")))
summoner, _ := client.Riot.Summoner.GetByName("SK Jenax")
fmt.Printf("%s is a level %d summoner\n", summoner.Name, summoner.SummonerLevel)
champion, _ := client.DataDragon.GetChampion("Ashe")
mastery, err := client.Riot.ChampionMastery.Get(summoner.ID, champion.Key)
if err != nil {
fmt.Printf("%s has not played any games on %s\n", summoner.Name, champion.Name)
} else {
fmt.Printf("%s has mastery level %d with %d points on %s\n", summoner.Name, mastery.ChampionLevel,
mastery.ChampionPoints, champion.Name)
}
challengers, _ := client.Riot.League.GetChallenger(api.QueueRankedSolo)
rank1 := challengers.GetRank(0)
fmt.Printf("%s is the highest ranked player with %d league points\n", rank1.SummonerName, rank1.LeaguePoints)

Index

type Client

type Client struct {
	Riot       *riot.Client
	DataDragon *datadragon.Client
	Static     *static.Client
	// contains filtered or unexported fields
}

Client is a client for both the Riot API and the Data Dragon service

func NewClient

func NewClient(apiKey string, options ...Option) *Client

NewClient returns a new client for both the Riot API and the Data Dragon service

type Option

type Option func(*Client)

Option is used to alter the attributes of a client

func WithClient

func WithClient(c internal.Doer) Option

WithClient sets the given http client for the golio client

func WithLogger

func WithLogger(l log.FieldLogger) Option

WithLogger sets the given logger for the golio client

func WithRegion

func WithRegion(r api.Region) Option

WithRegion sets the given region for the golio client

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier