racket-github-api icon indicating copy to clipboard operation
racket-github-api copied to clipboard

Pagination & Ratelimiting

Open winny- opened this issue 7 years ago • 4 comments

It appears the Link (for pagination) and X-RateLimit-* headers are discarded and not inserted into github-response structs. I'm not sure if you're still maintaining this repo, but figured I'd open a ticket anyway :)

My first thought would be to extend the struct with two more fields, but unfortunately that'd probably break some existing code - such as using the struct match expander on github-response structs.

Another option could be to make a new struct that inherits from github-response, but this could get messy.

Finally the backwards compatibility could be ignored :skull_and_crossbones: - but I don't think this is the best bet.

winny- avatar May 21 '18 05:05 winny-

Hey, thanks for letting me know about this. I'll take a look at it soon. Sorry about the wait.

eu90h avatar Sep 11 '18 04:09 eu90h

I noticed this as well. While displaying all the issues for racket/racket you only get 30 results and no way to find next page. @eu90h will you have time to look into this?

pmatos avatar Jan 23 '19 09:01 pmatos

In case it helps @pmatos or anyone else until a more permanent fix is in place, I was able to get around the pagination problem by calling the function returned by github-api with my own API request and adding the pagination parameters manually:

(define G-API (github-api my-github-id))
(define request
  (format "/repos/OWNER/REPO/issues/ISSUE#/comments?page=~a&per_page=100" page))
(define response
  (github-response-data (G-API request #:media-type "")))

You can keep incrementing page until (length response) is 0.

otherjoel avatar Aug 30 '19 04:08 otherjoel

@otherjoel thanks for the suggestion

pmatos avatar Sep 04 '19 15:09 pmatos