Plumber Endpoint
Plumber Endpoint
plumber::Hookable -> plumber::PlumberStep -> PlumberEndpoint
verbsa character vector. http methods. For historical reasons we have to accept multiple verbs for a single path. Now it's simpler to just parse each separate verb/path into its own endpoint, so we just do that.
patha character string. endpoint path
commentsendpoint comments
descriptionendpoint description
responsesendpoint responses
paramsendpoint parameters
tagsendpoint tags
parsersstep allowed parsers
getTypedParams()retrieve endpoint typed parameters
PlumberEndpoint$getTypedParams()
canServe()ability to serve request
PlumberEndpoint$canServe(req)reqa request object
a logical. TRUE when endpoint can serve request.
matchesPath()determines if route matches requested path
PlumberEndpoint$matchesPath(path)patha url path
a logical. TRUE when endpoint matches the requested path.
new()Create a new PlumberEndpoint object
PlumberEndpoint$new(
verbs,
path,
expr,
envir,
serializer,
parsers,
lines,
params,
comments,
description,
responses,
tags,
srcref
)verbsEndpoint verb Ex: "GET", "POST"
pathEndpoint path. Ex: "/index.html", "/foo/bar/baz"
exprEndpoint function or expression that evaluates to a function.
envirEndpoint environment
serializerEndpoint serializer. Ex: serializer_json()
parsersCan be one of:
If the parser name "all" is found in any character value or list name, all remaining parsers will be added.
When using a list, parser information already defined will maintain their existing argument values. All remaining parsers will use their default arguments.
Example:
# provide a character string
parsers = "json"# provide a named list with no arguments
parsers = list(json = list())
# provide a named list with arguments; include `rds`
parsers = list(json = list(simplifyVector = FALSE), rds = list())
# default plumber parsers
parsers = c("json", "form", "text", "octet", "multi")
linesEndpoint block
paramsEndpoint params
comments, description, responses, tagsValues to be used within the OpenAPI Spec
srcrefsrcref attribute from block
A new PlumberEndpoint object
getPathParams()retrieve endpoint path parameters
PlumberEndpoint$getPathParams(path)pathendpoint path
getFunc()retrieve endpoint function
PlumberEndpoint$getFunc()
getFuncParams()retrieve endpoint expression parameters
PlumberEndpoint$getFuncParams()
getEndpointParams()retrieve endpoint defined parameters
PlumberEndpoint$getEndpointParams()
setPath()Updates $path with a sanitized path and updates the internal path meta-data
PlumberEndpoint$setPath(path)pathPath to set $path. If missing a beginning slash, one will be added.
clone()The objects of this class are cloneable with this method.
PlumberEndpoint$clone(deep = FALSE)deepWhether to make a deep clone.
Defines a terminal handler in a Plumber router.
Parameters values are obtained from parsing blocks of lines in a plumber file. They can also be provided manually for historical reasons.