print method for Paginator
objects
Usage
Paginator$print(x, ...)
...
ignored
Method new()
Create a new Paginator
object
Usage
Paginator$new(
client,
by = "limit_offset",
limit_param = NULL,
offset_param = NULL,
limit = NULL,
chunk = NULL,
page_param = NULL,
per_page_param = NULL,
progress = FALSE
)
Arguments
client
an object of class HttpClient
, from a call to HttpClient
by
(character) how to paginate. Only 'limit_offset' supported for
now. In the future will support 'link_headers' and 'cursor'. See Details.
limit_param
(character) the name of the limit parameter.
Default: limit
offset_param
(character) the name of the offset parameter.
Default: offset
limit
(numeric/integer) the maximum records wanted
chunk
(numeric/integer) the number by which to chunk requests,
e.g., 10 would be be each request gets 10 records
page_param
(character) the name of the page parameter.
per_page_param
(character) the name of the per page parameter.
progress
(logical) print a progress bar, using utils::txtProgressBar.
Default: FALSE
.
Returns
A new Paginator
object
make a paginated GET request
Usage
Paginator$get(path = NULL, query = list(), ...)
Arguments
path
URL path, appended to the base URL
query
query terms, as a named list. any numeric values are
passed through format()
to prevent larger numbers from being
scientifically formatted
...
For retry
, the options to be passed on to the method
implementing the requested verb, including curl options. Otherwise,
curl options, only those in the acceptable set from curl::curl_options()
except the following: httpget, httppost, post, postfields, postfieldsize,
and customrequest
Method post()
make a paginated POST request
Usage
Paginator$post(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
...
)
Arguments
path
URL path, appended to the base URL
query
query terms, as a named list. any numeric values are
passed through format()
to prevent larger numbers from being
scientifically formatted
body
body as an R list
encode
one of form, multipart, json, or raw
...
For retry
, the options to be passed on to the method
implementing the requested verb, including curl options. Otherwise,
curl options, only those in the acceptable set from curl::curl_options()
except the following: httpget, httppost, post, postfields, postfieldsize,
and customrequest
Method put()
make a paginated PUT request
Usage
Paginator$put(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
...
)
Arguments
path
URL path, appended to the base URL
query
query terms, as a named list. any numeric values are
passed through format()
to prevent larger numbers from being
scientifically formatted
body
body as an R list
encode
one of form, multipart, json, or raw
...
For retry
, the options to be passed on to the method
implementing the requested verb, including curl options. Otherwise,
curl options, only those in the acceptable set from curl::curl_options()
except the following: httpget, httppost, post, postfields, postfieldsize,
and customrequest
Method patch()
make a paginated PATCH request
Usage
Paginator$patch(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
...
)
Arguments
path
URL path, appended to the base URL
query
query terms, as a named list. any numeric values are
passed through format()
to prevent larger numbers from being
scientifically formatted
body
body as an R list
encode
one of form, multipart, json, or raw
...
For retry
, the options to be passed on to the method
implementing the requested verb, including curl options. Otherwise,
curl options, only those in the acceptable set from curl::curl_options()
except the following: httpget, httppost, post, postfields, postfieldsize,
and customrequest
Method delete()
make a paginated DELETE request
Usage
Paginator$delete(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
...
)
Arguments
path
URL path, appended to the base URL
query
query terms, as a named list. any numeric values are
passed through format()
to prevent larger numbers from being
scientifically formatted
body
body as an R list
encode
one of form, multipart, json, or raw
...
For retry
, the options to be passed on to the method
implementing the requested verb, including curl options. Otherwise,
curl options, only those in the acceptable set from curl::curl_options()
except the following: httpget, httppost, post, postfields, postfieldsize,
and customrequest
make a paginated HEAD request
Usage
Paginator$head(path = NULL, ...)
Arguments
path
URL path, appended to the base URL
...
For retry
, the options to be passed on to the method
implementing the requested verb, including curl options. Otherwise,
curl options, only those in the acceptable set from curl::curl_options()
except the following: httpget, httppost, post, postfields, postfieldsize,
and customrequest
Details
not sure if this makes any sense or not yet
Method responses()
list responses
Usage
Paginator$responses()
Returns
a list of HttpResponse
objects, empty list before requests made
Method status_code()
Get HTTP status codes for each response
Usage
Paginator$status_code()
Returns
numeric vector, empty numeric vector before requests made
Method status()
List HTTP status objects
Returns
a list of http_code
objects, empty list before requests made
parse content
Usage
Paginator$parse(encoding = "UTF-8")
Arguments
encoding
(character) the encoding to use in parsing.
default:"UTF-8"
Returns
character vector, empty character vector before
requests made
Method content()
Get raw content for each response
Usage
Paginator$content()
Returns
raw list, empty list before requests made
Method times()
curl request times
Returns
list of named numeric vectors, empty list before requests made
Method url_fetch()
get the URL that would be sent (i.e., before executing
the request) the only things that change the URL are path and query
parameters; body and any curl options don't change the URL
Usage
Paginator$url_fetch(path = NULL, query = list())
Arguments
path
URL path, appended to the base URL
query
query terms, as a named list. any numeric values are
passed through format()
to prevent larger numbers from being
scientifically formatted
Examples
\dontrun{
cli <- HttpClient$new(url = "https://api.crossref.org")
cc <- Paginator$new(client = cli, limit_param = "rows",
offset_param = "offset", limit = 50, chunk = 10)
cc$url_fetch('works')
cc$url_fetch('works', query = list(query = "NSF"))
}
Method clone()
The objects of this class are cloneable with this method.
Usage
Paginator$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.