2222# '
2323# ' @param url the URL address.
2424# ' @param convert [default TRUE] logical value whether to attempt conversion of
25- # ' the received raw bytes to a character vector. Set to FALSE if downloading
26- # ' non-text data.
25+ # ' the received raw bytes to a character vector. Set to FALSE if downloading
26+ # ' non-text data.
2727# ' @param follow [default FALSE] logical value whether to automatically follow
28- # ' redirects (not applicable for async requests). If FALSE, the redirect
29- # ' address is returned as response header 'Location'.
28+ # ' redirects (not applicable for async requests). If FALSE, the redirect
29+ # ' address is returned as response header 'Location'.
3030# ' @param method (optional) the HTTP method as a character string. Defaults to
31- # ' 'GET' if not specified, and could also be 'POST', 'PUT' etc.
31+ # ' 'GET' if not specified, and could also be 'POST', 'PUT' etc.
3232# ' @param headers (optional) a named character vector specifying the HTTP
33- # ' request headers, for example: \cr
34- # ' \code{c(Authorization = "Bearer APIKEY", `Content-Type` = "text/plain")}
35- # ' \cr A non-character or non-named vector will be ignored.
33+ # ' request headers, for example: \cr
34+ # ' \code{c(Authorization = "Bearer APIKEY", `Content-Type` = "text/plain")}
35+ # ' \cr A non-character or non-named vector will be ignored.
3636# ' @param data (optional) character string request data to be submitted. If a
37- # ' vector, only the first element is taken, and non-character objects are
38- # ' ignored.
37+ # ' vector, only the first element is taken, and non-character objects are
38+ # ' ignored.
3939# ' @param response (optional) a character vector specifying the response headers
40- # ' to return e.g. \code{c("date", "server")}. These are case-insensitive and
41- # ' will return NULL if not present. A non-character vector will be ignored.
40+ # ' to return e.g. \code{c("date", "server")}. These are case-insensitive and
41+ # ' will return NULL if not present. A non-character vector will be ignored.
4242# ' @param timeout (optional) integer value in milliseconds after which the
43- # ' transaction times out if not yet complete.
43+ # ' transaction times out if not yet complete.
4444# ' @param tls (optional) applicable to secure HTTPS sites only, a client TLS
45- # ' Configuration object created by \code{\link{tls_config}}. If missing or
46- # ' NULL, certificates are not validated.
45+ # ' Configuration object created by \code{\link{tls_config}}. If missing or
46+ # ' NULL, certificates are not validated.
4747# '
4848# ' @return Named list of 3 elements:
49- # ' \itemize{
49+ # ' \itemize{
5050# ' \item \code{$status} - integer HTTP repsonse status code (200 - OK).
5151# ' Use \code{\link{status_code}} for a translation of the meaning.
5252# ' \item \code{$headers} - named list of response headers supplied in
5757# ' 'convert' = TRUE (may be further parsed as html, json, xml etc. as
5858# ' required), or a raw byte vector if FALSE (use \code{\link{writeBin}} to
5959# ' save as a file).
60- # ' }
60+ # ' }
6161# '
6262# ' @seealso \code{\link{ncurl_aio}} for asynchronous http requests;
63- # ' \code{\link{ncurl_session}} for persistent connections.
63+ # ' \code{\link{ncurl_session}} for persistent connections.
6464# ' @examples
6565# ' ncurl("https://postman-echo.com/get",
6666# ' convert = FALSE,
@@ -97,8 +97,8 @@ ncurl <- function(url,
9797# ' @inheritParams ncurl
9898# '
9999# ' @return An 'ncurlAio' (object of class 'ncurlAio' and 'recvAio') (invisibly).
100- # ' The following elements may be accessed:
101- # ' \itemize{
100+ # ' The following elements may be accessed:
101+ # ' \itemize{
102102# ' \item \code{$status} - integer HTTP repsonse status code (200 - OK).
103103# ' Use \code{\link{status_code}} for a translation of the meaning.
104104# ' \item \code{$headers} - named list of response headers supplied in
@@ -109,19 +109,18 @@ ncurl <- function(url,
109109# ' 'convert' = TRUE (may be further parsed as html, json, xml etc. as
110110# ' required), or a raw byte vector if FALSE (use \code{\link{writeBin}} to
111111# ' save as a file).
112- # ' }
112+ # ' }
113113# '
114114# ' @section Promises:
115115# '
116- # ' \sQuote{ncurlAio} may be used anywhere that accepts a \sQuote{promise}
117- # ' from the \CRANpkg{promises} package through the included
118- # ' \code{as.promise} method.
116+ # ' \sQuote{ncurlAio} may be used anywhere that accepts a \sQuote{promise} from
117+ # ' the \CRANpkg{promises} package through the included \code{as.promise} method.
119118# '
120- # ' The promises created are completely event-driven and non-polling.
119+ # ' The promises created are completely event-driven and non-polling.
121120# '
122- # ' If a status code of 200 (OK) is returned then the promise is resolved
123- # ' with the reponse body, otherwise it is rejected with a translation of the
124- # ' status code or \sQuote{errorValue} as the case may be.
121+ # ' If a status code of 200 (OK) is returned then the promise is resolved with
122+ # ' the reponse body, otherwise it is rejected with a translation of the status
123+ # ' code or \sQuote{errorValue} as the case may be.
125124# '
126125# ' @seealso \code{\link{ncurl_session}} for persistent connections.
127126# ' @examples
@@ -159,16 +158,16 @@ ncurl_aio <- function(url,
159158# ' ncurl Session
160159# '
161160# ' nano cURL - a minimalist http(s) client. A session encapsulates a connection,
162- # ' along with all related parameters, and may be used to return data
163- # ' multiple times by repeatedly calling \code{transact}, which transacts
164- # ' once over the connection.
161+ # ' along with all related parameters, and may be used to return data multiple
162+ # ' times by repeatedly calling \code{transact}, which transacts once over the
163+ # ' connection.
165164# '
166165# ' @inheritParams ncurl
167166# ' @param timeout (optional) integer value in milliseconds after which the
168- # ' connection and subsequent transact attempts time out.
167+ # ' connection and subsequent transact attempts time out.
169168# '
170169# ' @return For \code{ncurl_session}: an 'ncurlSession' object if successful, or
171- # ' else an 'errorValue'.
170+ # ' else an 'errorValue'.
172171# '
173172# ' @seealso \code{\link{ncurl_aio}} for asynchronous http requests.
174173# ' @examples
@@ -194,7 +193,7 @@ ncurl_session <- function(url,
194193# ' @param session an 'ncurlSession' object.
195194# '
196195# ' @return For \code{transact}: a named list of 3 elements:
197- # ' \itemize{
196+ # ' \itemize{
198197# ' \item \code{$status} - integer HTTP repsonse status code (200 - OK).
199198# ' Use \code{\link{status_code}} for a translation of the meaning.
200199# ' \item \code{$headers} - named list of response headers (if specified in
@@ -205,7 +204,7 @@ ncurl_session <- function(url,
205204# ' 'convert = TRUE' was specified for the session), which may be further
206205# ' parsed as html, json, xml etc. as required, or else a raw byte vector,
207206# ' which may be saved as a file using \code{\link{writeBin}}.
208- # ' }
207+ # ' }
209208# '
210209# ' @rdname ncurl_session
211210# ' @export
@@ -222,18 +221,17 @@ close.ncurlSession <- function(con, ...) invisible(.Call(rnng_ncurl_session_clos
222221# '
223222# ' Creates a \sQuote{promise} from an \sQuote{ncurlAio} object.
224223# '
225- # ' @param x an object of class \sQuote{ncurlAio}.
224+ # ' This function is an S3 method for the generic \code{as.promise} for class
225+ # ' \sQuote{ncurlAio}.
226226# '
227- # ' @return A \sQuote{promise} object .
227+ # ' Requires the \pkg{promises} package .
228228# '
229- # ' @details This function is an S3 method for the generic \code{as.promise} for
230- # ' class \sQuote{ncurlAio} .
229+ # ' Allows an \sQuote{ncurlAio} to be used with the promise pipe \code{\%...>\%},
230+ # ' which schedules a function to run upon resolution of the Aio .
231231# '
232- # ' Requires the \pkg{promises} package .
232+ # ' @param x an object of class \sQuote{ncurlAio} .
233233# '
234- # ' Allows an \sQuote{ncurlAio} to be used with the promise pipe
235- # ' \code{\%...>\%}, which schedules a function to run upon resolution of the
236- # ' Aio.
234+ # ' @return A \sQuote{promise} object.
237235# '
238236# ' @exportS3Method promises::as.promise
239237# '
0 commit comments