Skip to content

Commit 7d78f5a

Browse files
committed
reflow docs for messenger, nano and ncurl
1 parent f6b2c8d commit 7d78f5a

File tree

9 files changed

+173
-179
lines changed

9 files changed

+173
-179
lines changed

R/messenger.R

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,32 @@
2222
#' Messenger
2323
#'
2424
#' Multi-threaded, console-based, 2-way instant messaging system with
25-
#' authentication, based on NNG scalability protocols.
25+
#' authentication, based on NNG scalability protocols.
2626
#'
27-
#' @param url a URL to connect to, specifying the transport and address as
28-
#' a character string e.g. 'tcp://127.0.0.1:5555' (see \link{transports}).
27+
#' @param url a URL to connect to, specifying the transport and address as a
28+
#' character string e.g. 'tcp://127.0.0.1:5555' (see \link{transports}).
2929
#' @param auth [default NULL] an R object (possessed by both parties) which
30-
#' serves as a pre-shared key on which to authenticate the communication.
31-
#' Note: the object is never sent, only a random subset of its md5 hash
32-
#' after serialization.
30+
#' serves as a pre-shared key on which to authenticate the communication.
31+
#' Note: the object is never sent, only a random subset of its md5 hash after
32+
#' serialization.
3333
#'
3434
#' @return Invisible NULL.
3535
#'
3636
#' @note The authentication protocol is an experimental proof of concept which
37-
#' is not secure, and should not be used for critical applications.
37+
#' is not secure, and should not be used for critical applications.
3838
#'
3939
#' @section Usage:
4040
#'
41-
#' Type outgoing messages and hit return to send.
41+
#' Type outgoing messages and hit return to send.
4242
#'
43-
#' The timestamps of outgoing messages are prefixed by \code{>} and that of
44-
#' incoming messages by \code{<}.
43+
#' The timestamps of outgoing messages are prefixed by \code{>} and that of
44+
#' incoming messages by \code{<}.
4545
#'
46-
#' \code{:q} is the command to quit.
46+
#' \code{:q} is the command to quit.
4747
#'
48-
#' Both parties must supply the same argument for \sQuote{auth}, otherwise
49-
#' the party trying to connect will receive an \sQuote{authentication error}
50-
#' and be immediately disconnected.
48+
#' Both parties must supply the same argument for \sQuote{auth}, otherwise the
49+
#' party trying to connect will receive an \sQuote{authentication error} and be
50+
#' immediately disconnected.
5151
#'
5252
#' @export
5353
#'

R/nano.R

Lines changed: 42 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,53 @@
1919
#' Create Nano Object
2020
#'
2121
#' Create a nano object, encapsulating a Socket, Dialers/Listeners and
22-
#' associated methods.
22+
#' associated methods.
23+
#'
24+
#' This function encapsulates a Socket, Dialer and/or Listener, and its
25+
#' associated methods.
26+
#'
27+
#' The Socket may be accessed by \code{$socket}, and the Dialer or Listener by
28+
#' \code{$dialer[[1]]} or \code{$listener[[1]]} respectively.
29+
#'
30+
#' The object's methods may be accessed by \code{$} e.g. \code{$send()} or
31+
#' \code{$recv()}. These methods mirror their functional equivalents, with the
32+
#' same arguments and defaults, apart from that the first argument of the
33+
#' functional equivalent is mapped to the object's encapsulated socket (or
34+
#' context, if active) and does not need to be supplied.
35+
#'
36+
#' More complex network topologies may be created by binding further dialers or
37+
#' listeners using the object's \code{$dial()} and \code{$listen()} methods. The
38+
#' new dialer/listener will be attached to the object e.g. if the object already
39+
#' has a dialer, then at \code{$dialer[[2]]} etc.
40+
#'
41+
#' Note that \code{$dialer_opt()} and \code{$listener_opt()} methods will be
42+
#' available once dialers/listeners are attached to the object. These methods
43+
#' get or apply settings for all dialers or listeners equally. To get or apply
44+
#' settings for individual dialers/listeners, access them directly via
45+
#' \code{$dialer[[2]]} or \code{$listener[[2]]} etc.
46+
#'
47+
#' The methods \code{$opt()}, and also \code{$dialer_opt()} or
48+
#' \code{$listener_opt()} as may be applicable, will get the requested option if
49+
#' a single argument 'name' is provided, and will set the value for the option
50+
#' if both arguments 'name' and 'value' are provided.
51+
#'
52+
#' For Dialers or Listeners not automatically started, the
53+
#' \code{$dialer_start()} or \code{$listener_start()} methods will be
54+
#' available. These act on the most recently created Dialer or Listener
55+
#' respectively.
56+
#'
57+
#' For applicable protocols, new contexts may be created by using the
58+
#' \code{$context_open()} method. This will attach a new context at
59+
#' \code{$context} as well as a \code{$context_close()} method. While a context
60+
#' is active, all object methods use the context rather than the socket. A new
61+
#' context may be created by calling \code{$context_open()}, which will replace
62+
#' any existing context. It is only necessary to use \code{$context_close()} to
63+
#' close the existing context and revert to using the socket.
2364
#'
2465
#' @inheritParams socket
2566
#'
2667
#' @return A nano object of class \sQuote{nanoObject}.
2768
#'
28-
#' @details This function encapsulates a Socket, Dialer and/or Listener, and its
29-
#' associated methods.
30-
#'
31-
#' The Socket may be accessed by \code{$socket}, and the Dialer or
32-
#' Listener by \code{$dialer[[1]]} or \code{$listener[[1]]} respectively.
33-
#'
34-
#' The object's methods may be accessed by \code{$} e.g. \code{$send()} or
35-
#' \code{$recv()}. These methods mirror their functional equivalents, with
36-
#' the same arguments and defaults, apart from that the first argument of the
37-
#' functional equivalent is mapped to the object's encapsulated socket (or
38-
#' context, if active) and does not need to be supplied.
39-
#'
40-
#' More complex network topologies may be created by binding further
41-
#' dialers or listeners using the object's \code{$dial()} and \code{$listen()}
42-
#' methods. The new dialer/listener will be attached to the object e.g. if
43-
#' the object already has a dialer, then at \code{$dialer[[2]]} etc.
44-
#'
45-
#' Note that \code{$dialer_opt()} and \code{$listener_opt()} methods
46-
#' will be available once dialers/listeners are attached to the object.
47-
#' These methods get or apply settings for all dialers or listeners equally.
48-
#' To get or apply settings for individual dialers/listeners, access them
49-
#' directly via \code{$dialer[[2]]} or \code{$listener[[2]]} etc.
50-
#'
51-
#' The methods \code{$opt()}, and also \code{$dialer_opt()} or
52-
#' \code{$listener_opt()} as may be applicable, will get the requested option
53-
#' if a single argument 'name' is provided, and will set the value for the
54-
#' option if both arguments 'name' and 'value' are provided.
55-
#'
56-
#' For Dialers or Listeners not automatically started, the
57-
#' \code{$dialer_start()} or \code{$listener_start()} methods will be
58-
#' available. These act on the most recently created Dialer or Listener
59-
#' respectively.
60-
#'
61-
#' For applicable protocols, new contexts may be created by using the
62-
#' \code{$context_open()} method. This will attach a new context at
63-
#' \code{$context} as well as a \code{$context_close()} method. While a
64-
#' context is active, all object methods use the context rather than the
65-
#' socket. A new context may be created by calling \code{$context_open()},
66-
#' which will replace any existing context. It is only necessary to use
67-
#' \code{$context_close()} to close the existing context and revert to using
68-
#' the socket.
69-
#'
7069
#' @examples
7170
#' nano <- nano("bus", listen = "inproc://nanonext")
7271
#' nano

R/ncurl.R

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@
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
@@ -57,10 +57,10 @@
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
#'

man/as.promise.ncurlAio.Rd

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/messenger.Rd

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)