githuberrors

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SecondaryRateLimitMessage                 = `You have exceeded a secondary rate limit`
	SecondaryRateLimitDocumentationPathSuffix = `secondary-rate-limits`
	HeaderXRateLimitRemaining                 = "x-ratelimit-remaining"
	HeaderRetryAfter                          = "retry-after"
	HeaderXRateLimitReset                     = "x-ratelimit-reset"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type SecondaryRateLimitBody

type SecondaryRateLimitBody struct {
	Message     string `json:"message"`
	DocumentURL string `json:"documentation_url"`
}

func (SecondaryRateLimitBody) IsSecondaryRateLimit

func (s SecondaryRateLimitBody) IsSecondaryRateLimit() bool

IsSecondaryRateLimit checks whether the response is a legitimate secondary rate limit. It checks the prefix of the message and the suffix of the documentation URL in the response body in case the message or documentation URL is modified in the future. https://docs.github.com/en/rest/overview/rate-limits-for-the-rest-api#about-secondary-rate-limits

type SecondaryRateLimitError

type SecondaryRateLimitError struct {
	Response   http.Response
	Body       *SecondaryRateLimitBody
	RetryAfter *time.Time
}

func IsSecondaryRateLimitError

func IsSecondaryRateLimitError(r *github.Response) (bool, *SecondaryRateLimitError)

func (*SecondaryRateLimitError) Error

func (s *SecondaryRateLimitError) Error() string

Jump to

Keyboard shortcuts

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