Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientOptions ¶ added in v0.2.0
type ClientOptions struct {
// Delay is the minimum interval between requests. Zero disables pacing.
Delay time.Duration
// MaxWait caps a single rate-limit wait. Zero uses the package default.
MaxWait time.Duration
// Notify, when set, is called before each wait so a caller can show it.
Notify func(ratelimit.Wait)
}
ClientOptions tunes the rate limiting applied to every API request.
type NamedRateLimit ¶ added in v0.2.0
NamedRateLimit pairs a resource with its name for ordered rendering.
type RESTClient ¶
type RateLimit ¶ added in v0.2.0
type RateLimit struct {
Limit int `json:"limit"`
Used int `json:"used"`
Remaining int `json:"remaining"`
Reset int64 `json:"reset"`
}
RateLimit is one resource's budget as GitHub reports it.
type RateLimits ¶ added in v0.2.0
RateLimits is the whole rate_limit payload.
func (RateLimits) Ordered ¶ added in v0.2.0
func (l RateLimits) Ordered() []NamedRateLimit
Ordered lists core first, because it is the budget a sync spends, then the remaining resources alphabetically. Absent resources are simply not listed.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func NewAuthenticatedSource ¶
func NewAuthenticatedSource(host string, options ClientOptions) (*Source, *ratelimit.Transport, string, string, error)
NewAuthenticatedSource builds a source whose transport honours GitHub's rate limits. The transport is returned so a caller can read the current budget.
func NewSource ¶
func NewSource(client RESTClient) *Source
func (*Source) ListRepositories ¶
func (*Source) RateLimits ¶ added in v0.2.0
func (s *Source) RateLimits(ctx context.Context) (RateLimits, error)
RateLimits reads the authenticated account's remaining budget. The call does not itself consume the core budget.