|
2 | 2 |
|
3 | 3 | [](https://goreportcard.com/report/github.com/gofri/go-github-ratelimit) |
4 | 4 |
|
5 | | -Package `go-github-ratelimit` provides http.RoundTripper implementation that handles both [primary rate limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-primary-rate-limits) and [secondary rate limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-secondary-rate-limits) for the GitHub API. |
| 5 | +Package `go-github-ratelimit` providesa middleware (http.RoundTripper) that handles both [Primary Rate Limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-primary-rate-limits) and [Secondary Rate Limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-secondary-rate-limits) for the GitHub API. |
6 | 6 |
|
7 | | -Primary rate limits are handled by returning a detailed error. |
8 | | -Secondary rate limits are handled by waiting in blocking mode (sleep) and then issuing/retrying requests. |
9 | | -There is support for callbacks to be triggered when rate limits are detected/exceeded/etc. - see below. |
| 7 | +* Primary rate limits are handled by returning a detailed error. |
| 8 | +* Secondary rate limits are handled by waiting in blocking mode (sleep) and then issuing/retrying requests. |
| 9 | +* There is support for callbacks to be triggered when rate limits are detected/exceeded/etc. - see below. |
10 | 10 |
|
11 | | -`go-github-ratelimit` can be used with any HTTP client communicating with GitHub API. |
12 | | -It is meant to complement [go-github](https://github.com/google/go-github), but there is no association between this repository and the go-github repository nor Google. |
13 | | - |
14 | | -If you like this package, please check out [go-github-pagination!](https://github.com/gofri/go-github-pagination) |
| 11 | +The module can be used with any HTTP client communicating with GitHub API. It is designed to have low overhead during good path. |
| 12 | +It is meant to complement [go-github](https://github.com/google/go-github), but there is no association between this repository and the go-github repository nor Google. |
15 | 13 |
|
16 | 14 | ## Recommended: Pagination Handling |
17 | 15 |
|
18 | | -If you like this package, please checkout [go-github-pagination](https://github.com/gofri/go-github-pagination). |
| 16 | +If you like this package, please check out [go-github-pagination](https://github.com/gofri/go-github-pagination). |
19 | 17 | It supports pagination out of the box, and plays well with the rate limit round-tripper. |
20 | 18 | It is best to stack the pagination round-tripper on top of the rate limit round-tripper. |
21 | 19 |
|
22 | 20 |
|
23 | 21 | ## Installation |
24 | 22 |
|
25 | | -```go get github.com/gofri/go-github-ratelimit``` |
| 23 | +```go get github.com/gofri/go-github-ratelimit/v2``` |
26 | 24 |
|
27 | 25 | ## Usage Example (with [go-github](https://github.com/google/go-github)) |
28 | 26 |
|
29 | 27 | ```go |
30 | 28 | import "github.com/google/go-github/v68/github" |
31 | | -import "github.com/gofri/go-github-ratelimit/github_ratelimit" |
| 29 | +import "github.com/gofri/go-github-ratelimit/v2/github_ratelimit" |
32 | 30 |
|
33 | 31 | func main() { |
34 | 32 | // use the plain ratelimiter, without options / callbacks / underlying http.RoundTripper. |
@@ -76,7 +74,7 @@ as well as fine-grained policy control (e.g., for a sophisticated pagination mec |
76 | 74 |
|
77 | 75 | ```go |
78 | 76 | import "github.com/google/go-github/v68/github" |
79 | | -import "github.com/gofri/go-github-ratelimit/github_ratelimit" |
| 77 | +import "github.com/gofri/go-github-ratelimit/v2/github_ratelimit" |
80 | 78 | import "github.com/gofri/go-github-pagination/githubpagination" |
81 | 79 |
|
82 | 80 | func main() { |
|
0 commit comments