Skip to content

League of Legends, Legends of Runeterra and Valorant API client library for Go

License

Notifications You must be signed in to change notification settings

KnutZuidema/golio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

648c8e1 · Mar 15, 2025
Nov 6, 2023
Aug 29, 2024
Jun 18, 2024
Oct 16, 2024
Mar 15, 2025
Nov 6, 2023
May 10, 2019
Dec 27, 2019
Nov 23, 2021
Nov 20, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023
Nov 6, 2023

Repository files navigation

Documentation CI Go Report Card codecov

Golio

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

package main

import (
	"fmt"

	"github.com/KnutZuidema/golio"
	"github.com/KnutZuidema/golio/api"
	"github.com/KnutZuidema/golio/riot/lol"
	"github.com/sirupsen/logrus"
)

func main() {
	client := golio.NewClient("API KEY",
		golio.WithRegion(api.RegionEuropeWest),
		golio.WithLogger(logrus.New().WithField("foo", "bar")))
	summoner, _ := client.Riot.LoL.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.LoL.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.LoL.League.GetChallenger(lol.QueueRankedSolo)
	rank1 := challengers.GetRank(0)
	fmt.Printf("%s is the highest ranked player with %d league points\n", rank1.SummonerName, rank1.LeaguePoints)
}