ratelimit

package
v0.0.0-...-9e75793 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimit

type RateLimit struct {
	Message    string  `json:"message"`
	Global     bool    `json:"global"`
	RetryAfter float64 `json:"retry_after"`
	Bucket     string  `json:"-"`

	CreatedAt time.Time `json:"-"`
}

func NewRateLimit

func NewRateLimit(resp *http.Response, data []byte) (*RateLimit, error)

func (*RateLimit) Wait

func (rl *RateLimit) Wait()

type RateLimiter

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

func NewRateLimiter

func NewRateLimiter() *RateLimiter

func (*RateLimiter) Clear

func (r *RateLimiter) Clear()

func (*RateLimiter) Get

func (r *RateLimiter) Get(bucket string) *RateLimit

func (*RateLimiter) Remove

func (r *RateLimiter) Remove(bucket string)

func (*RateLimiter) Set

func (r *RateLimiter) Set(bucket string, rl *RateLimit)

Jump to

Keyboard shortcuts

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