A porcelain object. This extends (via
inheritance) a plumber object, and so only changes to the
plumber API are documented here.
plumber::Hookable -> plumber::Plumber -> porcelain
Inherited methods
plumber::Hookable$registerHooks()plumber::Plumber$addAssets()plumber::Plumber$addEndpoint()plumber::Plumber$addFilter()plumber::Plumber$addGlobalProcessor()plumber::Plumber$call()plumber::Plumber$filter()plumber::Plumber$getApiSpec()plumber::Plumber$getDebug()plumber::Plumber$mount()plumber::Plumber$onHeaders()plumber::Plumber$onWSOpen()plumber::Plumber$openAPIFile()plumber::Plumber$print()plumber::Plumber$registerHook()plumber::Plumber$removeHandle()plumber::Plumber$route()plumber::Plumber$run()plumber::Plumber$serve()plumber::Plumber$set404Handler()plumber::Plumber$setApiSpec()plumber::Plumber$setDebug()plumber::Plumber$setDocs()plumber::Plumber$setDocsCallback()plumber::Plumber$setErrorHandler()plumber::Plumber$setParsers()plumber::Plumber$setSerializer()plumber::Plumber$swaggerFile()plumber::Plumber$unmount()
new()Create a porcelain object
porcelain$new(..., validate = FALSE, logger = NULL)...Parameters passed to plumber
validateLogical, indicating if any validation
(implemented by the validate_response argument) should
be enabled. This should be set to FALSE in production
environments. By default (if validate is NULL),
we look at the value of the environment PORCELAIN_VALIDATE -
if true (case insensitive) then we will validate.
This is intended to support easy use of validation on
continuous integration systems.
loggerOptional logger, from the lgr package, perhaps
created with porcelain_logger. If given, then we
will log at the beginning and end of the request.
include_package_endpoints()Include package endpoints
stateA named list of state, if your package requires any state-binding endpoints. Typically these will be mutable state (database connections, job queues, or similar). You must provide all states as required by the combination of all endpoints.
packageEither a package name or environment (optional, usually we'll find the right thing)
handle()Handle an endpoint
...Either a single argument, being a
porcelain_endpoint object representing an endpoint, or
arguments to pass through to plumber.
request()Send a request to plumber for debugging
Sends a request to plumber so that the API can be easily
tested without running the whole API. The interface here will
probably change, and may end up using the interface of httr.
porcelain$request(
method,
path,
query = NULL,
body = NULL,
content_type = NULL,
request_id = NULL
)methodName of HTTP method to use (e.g., GET)
pathPath to send the request to
queryOptional query parameters as a named list or character vector.
bodyOptional body (only valid with PUT, POST,
etc).
content_typeOptional content type (mime) which can be
provided alongside body. If not provided it is set to
application/octet-stream if body is raw, or
application/json otherwise.
request_idOptional request ID. An ID which is attached to every log raised by this request. Used for tracing purposes.