diff --git a/R/http_helpers.R b/R/http_helpers.R index 20fe2db..fa2d28c 100644 --- a/R/http_helpers.R +++ b/R/http_helpers.R @@ -4,7 +4,7 @@ #' @param method A string containing the HTTP method to match #' @param path A string containing the path to match #' @param handler A function to call when the layer is matched -#' @value The tower with the added route +#' @return The tower with the added route #' @export add_route <- function(tower, method = "GET", path, handler) { handler <- compiler::cmpfun(handler) @@ -22,7 +22,7 @@ add_route <- function(tower, method = "GET", path, handler) { #' @param tower A tower object #' @param path A string containing the path to match #' @param handler A function to call when the route is matched -#' @value The tower with the added GET route +#' @return The tower with the added GET route #' @export add_get_route <- function(tower, path, handler) { add_route(tower, "GET", path, handler) @@ -33,7 +33,7 @@ add_get_route <- function(tower, path, handler) { #' @param tower A tower object #' @param path A string containing the path to match #' @param handler A function to call when the route is matched -#' @value The tower with the added POST route +#' @return The tower with the added POST route #' @export add_post_route <- function(tower, path, handler) { add_route(tower, "POST", path, handler) @@ -44,7 +44,7 @@ add_post_route <- function(tower, path, handler) { #' @param tower A tower object #' @param path A string containing the path to match #' @param handler A function to call when the route is matched -#' @value The tower with the added PUT route +#' @return The tower with the added PUT route #' @export add_put_route <- function(tower, path, handler) { add_route(tower, "PUT", path, handler) @@ -55,7 +55,7 @@ add_put_route <- function(tower, path, handler) { #' @param tower A tower object #' @param path A string containing the path to match #' @param handler A function to call when the route is matched -#' @value The tower with the added DELETE route +#' @return The tower with the added DELETE route #' @export add_delete_route <- function(tower, path, handler) { add_route(tower, "DELETE", path, handler) @@ -66,7 +66,7 @@ add_delete_route <- function(tower, path, handler) { #' @param tower A tower object #' @param path A string containing the path to match #' @param handler A function to call when the route is matched -#' @value The tower with the added PATCH route +#' @return The tower with the added PATCH route #' @export add_patch_route <- function(tower, path, handler) { add_route(tower, "PATCH", path, handler) @@ -78,7 +78,7 @@ add_patch_route <- function(tower, path, handler) { #' @param ... Additional arguments to pass to \code{\link[jsonlite]{fromJSON}} #' when parsing the request body. This will only be used the first time the #' request body is parsed. Subsequent calls will return the cached result. -#' @value The R object representation of the body's JSON content +#' @return The R object representation of the body's JSON content #' @export req_body_json <- function(req, ...) { if (!is.null(req[[".parsed.body.json"]])) { @@ -100,7 +100,7 @@ req_body_json <- function(req, ...) { #' @title Extract form data from a request #' @description Extracts form data from a request #' @param req A request object -#' @value A list containing the form data in the body +#' @return A list containing the form data in the body #' @export req_body_form <- function(req) { if (!is.null(req[[".parsed.body.form"]])) { @@ -120,7 +120,7 @@ req_body_form <- function(req) { #' @title Extract query parameters from a request #' @description Extracts query parameters from a request #' @param req A request object -#' @value A list containing the query parameters +#' @return A list containing the query parameters #' @export req_query <- function(req) { if (!is.null(req[[".parsed.query"]])) { @@ -152,7 +152,7 @@ cookie_unescape <- function(.x) { #' #' @param x A string containing the cookies #' -#' @value A list containing the HTTP cookies +#' @return A list containing the HTTP cookies #' @keywords internal parse_cookies <- function(x) { if (is.null(x)) { @@ -178,7 +178,7 @@ cookie_to_header <- function(.x, .y) { #' @param key A string containing the cookie key #' @param value A string containing the cookie value #' -#' @value A string containing the formated cookie +#' @return A string containing the formated cookie #' @export build_http_cookie <- function(key, value) { glue::glue("{key}={value}; path=/; SameSite=Lax; HttpOnly") @@ -187,7 +187,7 @@ build_http_cookie <- function(key, value) { #' @title Extract cookies from a request #' @description Extracts cookies from a request #' @param req A request object -#' @value A list containing the cookies +#' @return A list containing the cookies #' @export req_cookies <- function(req) { if (!is.null(req[[".parsed.cookies"]])) { diff --git a/R/response_builder.R b/R/response_builder.R index 271bf8f..ef50f56 100644 --- a/R/response_builder.R +++ b/R/response_builder.R @@ -1,6 +1,6 @@ #' @title Create a response builder #' @description Creates a response builder -#' @value A response builder object +#' @return A response builder object #' @export response_builder <- function() { resp <- new.env(parent = emptyenv()) @@ -20,7 +20,7 @@ response_builder <- function() { #' @param res A response builder object #' @param name The name of the header #' @param value The value of the header -#' @value The response builder object +#' @return The response builder object #' @export set_header <- function(res, name, value) { res$headers[[name]] <- value @@ -31,7 +31,7 @@ set_header <- function(res, name, value) { #' @description Sets the status of a response #' @param res A response builder object #' @param status The status to set -#' @value The response builder object +#' @return The response builder object #' @export set_status <- function(res, status) { res$status <- status @@ -43,7 +43,7 @@ set_status <- function(res, status) { #' @param res A response builder object #' @param name The name of the cookie #' @param value The value of the cookie -#' @value The response builder object +#' @return The response builder object #' @export add_cookie <- function(res, name, value) { res$cookies[[name]] <- value @@ -54,7 +54,7 @@ add_cookie <- function(res, name, value) { #' @description Sets the content type of a response #' @param res A response builder object #' @param content_type The content type to set -#' @value The response builder object +#' @return The response builder object #' @export set_content_type <- function(res, content_type) { res$content_type <- content_type @@ -111,7 +111,7 @@ serialize_body <- function(body, content_type) { #' @description Adds a body to a response, if no content type is set, it will be detected #' @param res A response builder object #' @param body The body to add -#' @value The response builder object +#' @return The response builder object #' @export add_body <- function(res, body) { if (is.null(res$content_type)) { @@ -125,7 +125,7 @@ add_body <- function(res, body) { #' @description Adds a body to a response as JSON #' @param res A response builder object #' @param body The body to add -#' @value The response builder object +#' @return The response builder object #' @export add_body_json <- function(res, body) { set_content_type(res, "application/json") @@ -136,7 +136,7 @@ add_body_json <- function(res, body) { #' @title Build a response #' @description Builds a response #' @param res A response builder object -#' @value A 'shiny' response object +#' @return A 'shiny' response object #' @export build_response <- function(res) { content_type <- ifelse( diff --git a/R/service.R b/R/service.R index 4688f02..d66d84a 100644 --- a/R/service.R +++ b/R/service.R @@ -4,7 +4,7 @@ compiler_options <- list(optimize = 3L) #' @title Create a new tower #' @description Create a new tower to build upon. #' @param app A 'shiny' app object -#' @value A new tower object to add more layers to +#' @return A new tower object to add more layers to #' @export create_tower <- function(app) { structure( @@ -21,7 +21,7 @@ create_tower <- function(app) { #' @description Print a tower #' @param x A tower #' @param ... Ignored arguments (for compatibility with print) -#' @value No return value, called for side effects +#' @return No return value, called for side effects #' @export print.tower <- function(x, ...) { cat( @@ -38,7 +38,7 @@ print.tower <- function(x, ...) { #' a response. A layer can short circuit by returning a response #' directly or call the next layer will `req$NEXT(req)` which #' will call the next layer in the middleware. -#' @value The tower with the added layer +#' @return The tower with the added layer #' @export add_http_layer <- function(tower, layer) { tower$http_layers <- c( @@ -58,7 +58,7 @@ add_http_layer <- function(tower, layer) { #' and has no return value. This function will be called before #' the original server function. If you want to short-circuit #' the server use an exception. -#' @value The tower with the added layer +#' @return The tower with the added layer #' @export add_server_layer <- function(tower, layer) { tower$server_layers <- c( @@ -138,7 +138,7 @@ build_server <- function(tower) { #' @description Build a 'shiny' app from a tower. This will create #' a new 'shiny' app with the specified layers added. #' @param tower A tower -#' @value A 'shiny' app object that can be started +#' @return A 'shiny' app object that can be started #' @export build_tower <- function(tower) { app <- tower$app @@ -150,7 +150,7 @@ build_tower <- function(tower) { #' @title Into parts #' @description Splits a shiny.appobj into its parts, the ui and server #' @param app A shiny.appobj -#' @value A list with the ui and server handlers +#' @return A list with the ui and server handlers #' @export app_into_parts <- function(app) { ui <- app$httpHandler diff --git a/man/add_delete_route.Rd b/man/add_delete_route.Rd index ae71fec..f47a95c 100644 --- a/man/add_delete_route.Rd +++ b/man/add_delete_route.Rd @@ -14,7 +14,7 @@ add_delete_route(tower, path, handler) \item{handler}{A function to call when the route is matched} } \value{ -A tower object with the route added +The tower with the added DELETE route } \description{ Adds a DELETE route to a tower diff --git a/man/add_get_route.Rd b/man/add_get_route.Rd index 591cf30..36300af 100644 --- a/man/add_get_route.Rd +++ b/man/add_get_route.Rd @@ -14,7 +14,7 @@ add_get_route(tower, path, handler) \item{handler}{A function to call when the route is matched} } \value{ -A tower object with the route added +The tower with the added GET route } \description{ Adds a GET route to a tower diff --git a/man/add_http_layer.Rd b/man/add_http_layer.Rd index b2dd219..98d6dc3 100644 --- a/man/add_http_layer.Rd +++ b/man/add_http_layer.Rd @@ -15,7 +15,7 @@ directly or call the next layer will \code{req$NEXT(req)} which will call the next layer in the middleware.} } \value{ -The tower with the layer added +The tower with the added layer } \description{ Add an HTTP layer to a tower. This layer diff --git a/man/add_patch_route.Rd b/man/add_patch_route.Rd index 02ab140..ec8da4a 100644 --- a/man/add_patch_route.Rd +++ b/man/add_patch_route.Rd @@ -14,7 +14,7 @@ add_patch_route(tower, path, handler) \item{handler}{A function to call when the route is matched} } \value{ -A tower object with the route added +The tower with the added PATCH route } \description{ Adds a PATCH route to a tower diff --git a/man/add_post_route.Rd b/man/add_post_route.Rd index 7ef6354..9fd4d16 100644 --- a/man/add_post_route.Rd +++ b/man/add_post_route.Rd @@ -14,7 +14,7 @@ add_post_route(tower, path, handler) \item{handler}{A function to call when the route is matched} } \value{ -A tower object with the route added +The tower with the added POST route } \description{ Adds a POST route to a tower diff --git a/man/add_put_route.Rd b/man/add_put_route.Rd index e9115ce..b1ec397 100644 --- a/man/add_put_route.Rd +++ b/man/add_put_route.Rd @@ -14,7 +14,7 @@ add_put_route(tower, path, handler) \item{handler}{A function to call when the route is matched} } \value{ -A tower object with the route added +The tower with the added PUT route } \description{ Adds a PUT route to a tower diff --git a/man/add_route.Rd b/man/add_route.Rd index c4e493f..b1daffc 100644 --- a/man/add_route.Rd +++ b/man/add_route.Rd @@ -16,7 +16,7 @@ add_route(tower, method = "GET", path, handler) \item{handler}{A function to call when the layer is matched} } \value{ -A tower object with the layer added +The tower with the added route } \description{ Adds an HTTP layer to a tower diff --git a/man/add_server_layer.Rd b/man/add_server_layer.Rd index 0d1a056..8a9fc1d 100644 --- a/man/add_server_layer.Rd +++ b/man/add_server_layer.Rd @@ -15,7 +15,7 @@ the original server function. If you want to short-circuit the server use an exception.} } \value{ -The tower with the layer added +The tower with the added layer } \description{ Add a server layer to a tower. This layer diff --git a/man/build_http_cookie.Rd b/man/build_http_cookie.Rd index fc31a06..7942bdd 100644 --- a/man/build_http_cookie.Rd +++ b/man/build_http_cookie.Rd @@ -12,7 +12,7 @@ build_http_cookie(key, value) \item{value}{A string containing the cookie value} } \value{ -A string containing the cookie +A string containing the formated cookie } \description{ Builds an HttpOnly cookie from a key and value diff --git a/man/build_response.Rd b/man/build_response.Rd index 5a61f31..7be8f62 100644 --- a/man/build_response.Rd +++ b/man/build_response.Rd @@ -10,7 +10,7 @@ build_response(res) \item{res}{A response builder object} } \value{ -A response object +A 'shiny' response object } \description{ Builds a response diff --git a/man/create_tower.Rd b/man/create_tower.Rd index a680bb9..7faff26 100644 --- a/man/create_tower.Rd +++ b/man/create_tower.Rd @@ -10,7 +10,7 @@ create_tower(app) \item{app}{A 'shiny' app object} } \value{ -A new tower +A new tower object to add more layers to } \description{ Create a new tower to build upon. diff --git a/man/parse_cookies.Rd b/man/parse_cookies.Rd index ea6df0f..284fd71 100644 --- a/man/parse_cookies.Rd +++ b/man/parse_cookies.Rd @@ -10,7 +10,7 @@ parse_cookies(x) \item{x}{A string containing the cookies} } \value{ -A list containing the cookies +A list containing the HTTP cookies } \description{ Parses cookies from a string diff --git a/man/print.tower.Rd b/man/print.tower.Rd index 6983cc1..95e2abc 100644 --- a/man/print.tower.Rd +++ b/man/print.tower.Rd @@ -11,6 +11,9 @@ \item{...}{Ignored arguments (for compatibility with print)} } +\value{ +No return value, called for side effects +} \description{ Print a tower } diff --git a/man/req_body_form.Rd b/man/req_body_form.Rd index 4046c92..695e26b 100644 --- a/man/req_body_form.Rd +++ b/man/req_body_form.Rd @@ -10,7 +10,7 @@ req_body_form(req) \item{req}{A request object} } \value{ -A list containing the form data +A list containing the form data in the body } \description{ Extracts form data from a request diff --git a/man/req_body_json.Rd b/man/req_body_json.Rd index 4986fd0..c7992d9 100644 --- a/man/req_body_json.Rd +++ b/man/req_body_json.Rd @@ -14,7 +14,7 @@ when parsing the request body. This will only be used the first time the request body is parsed. Subsequent calls will return the cached result.} } \value{ -A list containing the request body +The R object representation of the body's JSON content } \description{ Extracts the request body from a JSON request