porcelain_returning: Support for endpoint return types

View source: R/returning.R

porcelain_returningR Documentation

Support for endpoint return types

Description

Support for describing and controlling expected return types. The high-level functions (porcelain_returning_json and porcelain_returning_binary) should be generally used.

Usage

porcelain_returning(content_type, process, validate, status_code = 200L)

porcelain_returning_json(schema = NULL, root = NULL, status_code = 200L)

porcelain_returning_binary(status_code = 200L)

porcelain_returning_text(status_code = 200L)

Arguments

content_type

The MIME content type for the endpoint, e.g. text/plain, application/json.

process

A processing function that will convert the output of the handler function into something of the type content_type. This should be independent of arguments passed to the endpoint, so practically this is the final stage of serialisation.

validate

A function that validates the return value and throws an error if the output is not expected. This will only be used if the endpoint is created with validate = TRUE.

status_code

The HTTP status code that the endpoint will use on a successful return. The default of 200 should be reasonable.

schema

The name of the json schema to use

root

The root of the schema directory.


reside-ic/porcelain documentation built on March 4, 2024, 11:11 p.m.