equinox

package module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2022 License: MIT Imports: 4 Imported by: 1

README

Equinox

GoDoc Test Status

This library is NOT production ready, expect breaking changes.

Only some League of Legends endpoints are currently implemented.

This project is a first for me since I don't have much experience in publishing a library, this is pretty much a practice tool for me to improve my knowledge in CI/CD using Github Actions, golang and tests.

I am avoiding using other packages like resty instead of the net/http package go provides to improve my golang knowledge, currently using testify and gock for tests.

Example

package main

import (
	"fmt"

	"github.com/Kyagara/equinox"
	"github.com/Kyagara/equinox/api"
)

func main() {
	// For custom configurations, you can use NewClientWithConfig(),
	// you will need to provide an api.EquinoxConfig{} object.
	client, err := equinox.NewClient("RIOT_API_KEY")

	if err != nil {
		fmt.Println("error creating client", err)
		return
	}

	// Get champion rotations.
	rotation, err := client.LOL.Champion.Rotations(api.LOLRegionBR1)

	if err != nil {
		fmt.Println("error retrieving champion rotations", err)
		return
	}

	fmt.Printf("%+v\n", rotation)
}

TODO

DTOs

DTOs are found inside their respective endpoint implementation, however, in some cases where an endpoint has multiple methods, the files quickly become a mess as the DTOs occupy a large portion of the file, maybe they could be implemented in another module, however I am not sure on how to organize them since I plan to support other endpoints from other Riot games.

Improve tests

First time doings mocks so I decided to use gock just to get things out of the ground, not sure if this implementation of tests with mocks is good.

Tests could benefit from using Parallel().

Improve Logging

I don't believe the current logging and 'debugging mode' is done right or that its 'done' at all to be honest, there might be places where I should be logging something but I am not.

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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Equinox

type Equinox struct {
	LOL *lol.LOLClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(key string) (*Equinox, error)

Creates a new Equinox client with a default configuration

  • `Debug` : false
  • `Timeout` : 10
  • `Retry` : true

func NewClientWithConfig added in v0.3.0

func NewClientWithConfig(config *api.EquinoxConfig) (*Equinox, error)

Creates a new Equinox client using a custom configuration.

If you don't specify a Timeout this will disable the timeout for the http.Client.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL