Documentation
¶
Index ¶
Constants ¶
View Source
const Day = 24 * time.Hour
Day represents the duration of exactly 24 hours.
View Source
const (
// Version represents ghrcooldown version
Version = "v0.2.1"
)
Variables ¶
This section is empty.
Functions ¶
func GetDefaultUserAgent ¶
func GetDefaultUserAgent() string
GetDefaultUserAgent returns the default User-Agent.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a client for interacting with the GitHub API with cooldown support.
func NewClient ¶
func NewClient(params *ClientParams) (*Client, error)
NewClient creates and returns a new Client instance using the provided parameters.
type ClientParams ¶
type ClientParams struct {
// Token is the personal access token used for authenticating with the GitHub API.
// It is optional, but if omitted, the API request will be subject to IP-based rate limiting.
// c.f. https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api
Token string
// BaseURL specifies the custom base URL for the GitHub API.
// It is primarily used for GitHub Enterprise Server.
BaseURL string
// UserAgent specifies the User-Agent header used in API requests.
// If omitted, a default User-Agent will be used.
UserAgent string
// CurrentTime is the reference time used to evaluate the cooldown period.
// It is mainly used for mocking the current time in unit tests.
CurrentTime *time.Time
}
ClientParams contains the configuration parameters required to initialize a new Client.
Click to show internal directories.
Click to hide internal directories.