Skip to content

Conversation

@krlmlr
Copy link

@krlmlr krlmlr commented Mar 31, 2016

Rough draft for pagination as suggested by @jennybc.

  • Each response stores the original request
  • Extract "page" param of "next" link in URL
  • Update "page" parameter in original request, issue it

Use case:

p <- list(search.code("difftime user:cran", per_page = 100))
p <- c(p, list(next.page(p[[length(p)]])))
# rinse and repeat
items <- p %>% lapply("[[", "content") %>% lapply("[[", "items") %>% unlist(recursive = FALSE)

This is strictly in a "works for me" state. Possible extensions:

  • Documentation
  • Error handling
  • Rename to fetch.page(page = "next"), also allow specifying a page number
  • Implement fetch.all.pages() as straightforward extension (needs arg warn = FALSE in fetch.page())
  • Implement get.page.count(request) so that fetch.all.pages() can show a progress bar
  • Use all parameters from the link, not just "page" (needs discussion)
  • Cleanup

Do we want to follow the approach sketched here?

Fixes #30.

@cscheid
Copy link
Owner

cscheid commented Apr 2, 2016

This one requires a bit more careful of a review, and it's unlikely I'll get to it before thursday or so next week. Ok?

@krlmlr
Copy link
Author

krlmlr commented May 2, 2016

This needs a bit of work from me, I just wanted to know if you like the design or if you prefer something completely different.

@cscheid
Copy link
Owner

cscheid commented May 2, 2016

Oof, this completely fell off the radar for me. Thanks for the bump. I'll be looking at it this week.

@cscheid
Copy link
Owner

cscheid commented May 2, 2016

@jennybc, since you're a user of rgithub and a much better R developer than me, I'd love to hear your thoughts on this PR.

@krlmlr
Copy link
Author

krlmlr commented Feb 3, 2017

Just tried it again for pull requests, still works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants