Documentation
¶
Overview ¶
Package githublimit reads GitHub's rate-limit answers, for every package that reaches GitHub's API: the github client and the creds package's App mint (https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api).
Index ¶
- func DocumentLimited(status int, header http.Header, said bool) (limited, secondaryLimit bool)
- func Message(body []byte) string
- func Pool(header http.Header) (name string, limit int)
- func SecondaryMessage(message string) bool
- func Signal(header http.Header) (remaining int, reset time.Time, ok bool)
- type Limit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DocumentLimited ¶
DocumentLimited is Read's Limited and Secondary for a document answer carrying errors and no data, which GitHub answers a limit with at 200 too: a primary limit with the remaining figure at zero, a secondary limit with its message (https://docs.github.com/en/graphql/overview/rate-limits-and-query-limits-for-the-graphql-api#exceeding-the-rate-limit).
func Message ¶
Message is the message member of a GitHub refusal's JSON body, empty where the body carries none or is not JSON. It is GitHub's text, so a caller quotes it before showing it.
func Pool ¶
Pool names the rate-limit pool an answer drew on, core for REST and graphql for documents among them, and that pool's whole limit, zero where the answer states none (https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api#checking-the-status-of-your-rate-limit).
func SecondaryMessage ¶
SecondaryMessage reports whether a message is the one GitHub answers a secondary limit with: it carries [secondaryTerm] in any case.
func Signal ¶
Signal reads the budget signal riding every answer on both of GitHub's surfaces: the remaining units of the pool the answer drew on, ok false where none is readable, and the instant that window renews, as epoch seconds, whatever ok reads, the zero time where the answer carries no reset. It is read from the answer and never from the rate-limit endpoint, which is measured to report a full pool with a fresh window while the same credential's document budget was demonstrably drawn down.