Skip to content

Kyagara/equinox

Repository files navigation

equinox

WikiExampleTodoVersioning

Features

  • Riot APIs implemented:
    • Riot Account
    • League of Legends
    • Teamfight Tactics
    • Valorant
    • Legends of Runeterra
  • Rate limit (Internal)
  • Caching with BigCache or Redis
  • Logging with zerolog
  • Exponential backoff

Note

equinox currently uses the proposed jsonv2, read more about it here.

Check the Wiki for more information about the library.

Example

For a slightly more advanced example, check out lol-match-crawler.

package main

import (
	"fmt"

	"github.com/Kyagara/equinox/v2/"
	"github.com/Kyagara/equinox/v2/clients/lol"
)

func main() {
	client, err := equinox.NewClient("RIOT_API_KEY")
	if err != nil {
		fmt.Println("error creating client: ", err)
		return
	}
	// Get this week's champion rotation.
	ctx := context.Background()
	rotation, err := client.LOL.ChampionV3.Rotation(ctx, lol.BR1)
	if err != nil {
		fmt.Println("error retrieving champion rotation: ", err)
		return
	}
	fmt.Printf("%+v\n", rotation)
	// &{FreeChampionIDs:[17 43 56 62 67 79 85 90 133 145 147 157 201 203 245 518]
	// FreeChampionIDsForNewPlayers:[222 254 427 82 131 147 54 17 18 37]
	// MaxNewPlayerLevel:10}
}

Todo

  • Maybe the context usage throughout the project could be improved
  • Maybe add and move logging to the Cache and RateLimit interfaces, instead of passing them around
  • Add checks for duration of tests that include any WaitN/any blocking
  • Add more integration tests
  • RateLimit
    • Add Redis store, using a lua script
    • Maybe add more options (presets?) to customize the rate limiter
    • Try to reduce amount of method arguments

Versioning

Breaking changes in the library itself (client reworks, removal/rename of internal methods) will require a major version (n.x.x) bump, fixes will occur in a patch (x.x.n).

The Riot API does not follow semver and changes often, breaking changes such as removal of endpoints methods or even entire endpoints will require a minor version (x.n.x) bump.

In go, new major versions of a library are an annoyance, requiring adding/changing every import path to the new version, so I want to keep them to a minimum. For example, github.com/Kyagara/equinox/internal/client will be github.com/Kyagara/equinox/v2/internal/client, then github.com/Kyagara/equinox/v3/internal/client...

Older versions are not supported (versions before v1 are outright broken and shouldn't be used), always keep the library up-to-date with the latest version.

Disclaimer

equinox 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 Riot Games properties. Riot Games, and all associated properties are trademarks or registered trademarks of Riot Games, Inc.