Giter Club home page Giter Club logo

equinox's Introduction

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
  • Maybe endpoint methods int32/int64 parameters should be changed to just int
  • 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.

equinox's People

Contributors

kyagara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

medalha01 f1w

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.