Public methods
Method print()
print method for Async objects
Usage
Async$print(x, ...)
Arguments
x
self
...
ignored
Method new()
Create a new Async object
Usage
Async$new(urls, opts, proxies, auth, headers)
Arguments
urls
(character) one or more URLs
opts
any curl options
proxies
a proxy()
object
auth
an auth()
object
headers
named list of headers
Returns
A new Async
object.
Method get()
execute the GET
http verb for the urls
Usage
Async$get(path = NULL, query = list(), disk = NULL, stream = NULL, ...)
Arguments
path
(character) URL path, appended to the base URL
query
(list) query terms, as a named list
disk
a path to write to. if NULL (default), memory used.
See curl::curl_fetch_disk()
for help.
stream
an R function to determine how to stream data. if
NULL
(default), memory used. See curl::curl_fetch_stream()
for help
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Examples
\dontrun{
(cc <- Async$new(urls = c(
'https://httpbin.org/',
'https://httpbin.org/get?a=5',
'https://httpbin.org/get?foo=bar'
)))
(res <- cc$get())
}
Method post()
execute the POST
http verb for the urls
Usage
Async$post(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
disk = NULL,
stream = NULL,
...
)
Arguments
path
(character) URL path, appended to the base URL
query
(list) query terms, as a named list
body
body as an R list
encode
one of form, multipart, json, or raw
disk
a path to write to. if NULL (default), memory used.
See curl::curl_fetch_disk()
for help.
stream
an R function to determine how to stream data. if
NULL
(default), memory used. See curl::curl_fetch_stream()
for help
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Method put()
execute the PUT
http verb for the urls
Usage
Async$put(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
disk = NULL,
stream = NULL,
...
)
Arguments
path
(character) URL path, appended to the base URL
query
(list) query terms, as a named list
body
body as an R list
encode
one of form, multipart, json, or raw
disk
a path to write to. if NULL (default), memory used.
See curl::curl_fetch_disk()
for help.
stream
an R function to determine how to stream data. if
NULL
(default), memory used. See curl::curl_fetch_stream()
for help
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Method patch()
execute the PATCH
http verb for the urls
Usage
Async$patch(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
disk = NULL,
stream = NULL,
...
)
Arguments
path
(character) URL path, appended to the base URL
query
(list) query terms, as a named list
body
body as an R list
encode
one of form, multipart, json, or raw
disk
a path to write to. if NULL (default), memory used.
See curl::curl_fetch_disk()
for help.
stream
an R function to determine how to stream data. if
NULL
(default), memory used. See curl::curl_fetch_stream()
for help
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Method delete()
execute the DELETE
http verb for the urls
Usage
Async$delete(
path = NULL,
query = list(),
body = NULL,
encode = "multipart",
disk = NULL,
stream = NULL,
...
)
Arguments
path
(character) URL path, appended to the base URL
query
(list) query terms, as a named list
body
body as an R list
encode
one of form, multipart, json, or raw
disk
a path to write to. if NULL (default), memory used.
See curl::curl_fetch_disk()
for help.
stream
an R function to determine how to stream data. if
NULL
(default), memory used. See curl::curl_fetch_stream()
for help
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Method head()
execute the HEAD
http verb for the urls
Usage
Async$head(path = NULL, ...)
Arguments
path
(character) URL path, appended to the base URL
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Method verb()
execute any supported HTTP verb
Usage
Async$verb(verb, ...)
Arguments
verb
(character) a supported HTTP verb: get, post, put, patch, delete,
head.
...
curl options, only those in the acceptable set from
curl::curl_options()
except the following: httpget, httppost, post,
postfields, postfieldsize, and customrequest
Examples
\dontrun{
cc <- Async$new(
urls = c(
'https://httpbin.org/',
'https://httpbin.org/get?a=5',
'https://httpbin.org/get?foo=bar'
)
)
(res <- cc$verb('get'))
lapply(res, function(z) z$parse("UTF-8"))
}
Method clone()
The objects of this class are cloneable with this method.
Usage
Async$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.