internal

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger added in v0.2.0

func NewLogger(config *api.EquinoxConfig) *zap.SugaredLogger

Creates a new zap.Logger from the configuration parameters provided.

func NewTestEquinoxConfig added in v0.5.0

func NewTestEquinoxConfig() *api.EquinoxConfig

Creates an EquinoxConfig for tests.

Types

type Cache added in v0.9.0

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache added in v0.9.0

func NewCache() *Cache

func (*Cache) Clear added in v0.10.0

func (c *Cache) Clear()

Clears the cache

func (*Cache) Get added in v0.9.0

func (c *Cache) Get(url string) (*CacheItem, error)

Gets a http.Response from the cache

func (*Cache) Set added in v0.9.0

func (c *Cache) Set(url string, res []byte, ttl int64) error

Adds a http.Response in the cache

type CacheItem added in v0.9.0

type CacheItem struct {
	// contains filtered or unexported fields
}

type InternalClient

type InternalClient struct {
	Cluster api.Cluster
	// contains filtered or unexported fields
}

func NewInternalClient added in v0.2.0

func NewInternalClient(config *api.EquinoxConfig) *InternalClient

Returns a new InternalClient using configuration object provided.

func (*InternalClient) ClearInternalClientCache added in v0.10.0

func (c *InternalClient) ClearInternalClientCache()

func (*InternalClient) Get added in v0.9.0

func (c *InternalClient) Get(route interface{}, endpoint string, object interface{}, endpointName string, method string, authorizationHeader string) error

Performs a GET request, authorizationHeader can be blank

func (*InternalClient) Logger added in v0.7.0

func (c *InternalClient) Logger(client string, endpoint string, method string) *zap.SugaredLogger

Used to access the logger from the InternalClient, this is used to log events from other clients (RiotClient, LOLClient...)

func (*InternalClient) Post added in v0.9.0

func (c *InternalClient) Post(route interface{}, endpoint string, requestBody interface{}, object interface{}, endpointName string, method string, authorizationHeader string) error

Performs a POST request, authorizationHeader can be blank

func (*InternalClient) Put added in v0.9.0

func (c *InternalClient) Put(route interface{}, endpoint string, requestBody interface{}, endpointName string, method string) error

Performs a PUT request

type Methods added in v0.10.0

type Methods struct {
	// contains filtered or unexported fields
}

type Rate added in v0.10.0

type Rate struct {
	Seconds *RateTiming
	Minutes *RateTiming
}

func ParseHeaders added in v0.10.0

func ParseHeaders(headers http.Header, limitHeader string, countHeader string) *Rate

type RateLimit added in v0.10.0

type RateLimit struct {
	// contains filtered or unexported fields
}

func NewRateLimit added in v0.10.0

func NewRateLimit() *RateLimit

func (*RateLimit) Get added in v0.10.0

func (r *RateLimit) Get(endpointName string, methodName string) *Rate

func (*RateLimit) IsRateLimited added in v0.10.0

func (r *RateLimit) IsRateLimited(rate *Rate) bool

Checks if the *Rate is currently rate limited

func (*RateLimit) Set added in v0.10.0

func (r *RateLimit) Set(endpointName string, methodName string, rate *Rate)

func (*RateLimit) SetAppRate added in v0.10.0

func (r *RateLimit) SetAppRate(rate *Rate)

type RateTiming added in v0.10.0

type RateTiming struct {
	// The amount in seconds the rate limit should reset
	Time int
	// Maximum amount of requests in n seconds
	Limit int
	// Current count of requests made in n seconds
	Count int

	Ticker *time.Ticker
	Mutex  *sync.Mutex
}

Jump to

Keyboard shortcuts

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