-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add paginate_req_perform_continue()
#306
Conversation
@@ -15,3 +15,8 @@ the$cache_throttle <- list() | |||
the$token_cache <- new_environment() | |||
the$last_response <- NULL | |||
the$last_request <- NULL | |||
the$last_pagination_request <- NULL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this should go into a list variable?
the$last_pagination <- list(
request = NULL,
responses = NULL,
page = NULL,
n_pages = NULL,
max_pages = NULL
)
cli::cli_progress_bar( | ||
"Paginate", | ||
total = n_pages, | ||
format = "{cli::pb_spin} Page {cli::pb_current}/{cli::pb_total} | ETA: {cli::pb_eta}", | ||
current = 1L |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current
is actually not the current page as I though but whether this is the current progress bar or not.
|
||
#' @export | ||
#' @rdname last_response | ||
last_pagination_responses <- function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also export last_pagination_page()
?
@@ -56,6 +56,11 @@ req_paginate <- function(req, | |||
|
|||
#' Perform a paginated request | |||
#' | |||
#' After preparing a paginated request with [req_paginate()] perform it with | |||
#' [paginate_req_perform()]. In case the requests were interrupted, you can |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to copy the multi_req_perform()
interface here? i.e. paginate_req_perform()
should always succeed but sometimes return an error object? Or maybe in this case it's sufficient to return a shorter list than expected with a warning.
You could use the same technique as in pool_run()
to handle user interrupts.
Superseded by #353 |
Closes #298.
Created on 2023-09-05 with reprex v2.0.2