Package-level declarations

Types

Link copied to clipboard

Encodes and decodes the opaque cursor tokens used by the wire protocol — the cursor envelope's cursor and the pagination envelope's nextCursor.

Link copied to clipboard

Declares the fields of a route's request body (DebugRoute.body): the members of a JSON object, or the fields of a form when DebugRoute.acceptsForm is on.

Link copied to clipboard
class DebugCall

One request to a declared route, with the values of the route's parameters, which the router has already checked against their declarations.

Link copied to clipboard
fun interface DebugHandler

Answers a declared route: DebugRoute.handle sets it. A Kotlin lambda converts to it: handle { call -> ... }.

Link copied to clipboard

The options of a whole-number parameter.

Link copied to clipboard

The options of a decimal parameter.

Link copied to clipboard
class DebugParam<T>

The handle of a declared parameter. The handler reads the parameter's value with DebugCall.get: call[param]. T is nullable for an optional parameter.

Link copied to clipboard
open class DebugParams

Declares the query parameters of a route (DebugRoute.query), and is the base of its body fields (DebugRoute.body). Each function adds one parameter and returns its handle, which the handler gives to DebugCall.get.

Link copied to clipboard
open class DebugParamSpec

What a parameter declaration can say about any parameter.

Link copied to clipboard

Declares the parameters in a route's path (DebugRoute.path): one for each segment in braces, with the name in the braces. A path parameter is always present, so its value is never null. For the route's own method, a segment that the parameter does not take, such as x for an int, or a value that is not one of DebugStringSpec.values, matches no route: the path names a resource that does not exist, so the client gets 404, not 400. The router checks the method first, so another method gets 405 with an Allow header.

Link copied to clipboard
class DebugRequest @JvmOverloads constructor(val path: String, val method: String, val queryParams: Map<String, List<String>> = emptyMap(), val headers: Headers = Headers.EMPTY, val body: ByteArray? = null, val contentType: MediaType? = null)

An incoming debug API request handed to DebugTab.handle.

Link copied to clipboard
interface DebugResponse

A response produced by a DebugTab and served by the Lustro runtime.

Link copied to clipboard

Carries response out of the code of a route to the client. A declared route answers with response when its handler throws this, and so does the server for the DebugTab.handle of any tab, so a helper deep in a handler can end the request with an error, such as throw DebugResponseException(DebugResponse.error("No such file", 404, field = "file")).

Link copied to clipboard

The success response of a route, for the OpenAPI document: DebugRoute.response declares it. Its bodies, one for each content type, and its headers are in the order of the declarations.

Link copied to clipboard

One route of a tab: its documentation, its parameters, its body, its response, and the handler that answers it. DebugRoutes.get and the other methods of DebugRoutes declare it.

Link copied to clipboard

The routes of a tab, as DebugTab.routes declares them. From the declarations, the tab's default DebugTab.handle routes each request, answers 405 for a declared path with another method and 400 with field for a missing or wrong parameter, and calls the route's handler. The tab's default DebugTab.schema returns an OpenAPI document made from the same declarations, so GET /api/v1/_meta lists the tab and the server can name the query parameters that a route does not declare.

Link copied to clipboard

The options of a string parameter.

Link copied to clipboard
abstract class DebugTab

The single public extension point for adding a tab to the Lustro debug UI.

Link copied to clipboard

Marks the API that declares a tab's routes: DebugTab.routes, DebugRoutes, and the types that a declaration uses.

Link copied to clipboard

Marks API that enables capture of platform HttpURLConnection traffic.

Link copied to clipboard
class Headers

Library-owned, immutable collection of HTTP header name/value pairs.

Link copied to clipboard
class MediaType

Library-owned MIME media type, e.g. application/json; charset=utf-8.

Link copied to clipboard

Tells whether a name, such as a JSON key, a query parameter, a header, or a SharedPreferences key, looks like it holds a secret.

Functions

Link copied to clipboard

Escapes this string for safe inclusion inside a JSON string literal.

Link copied to clipboard

Escapes this string for safe inclusion in HTML text and inside a quoted attribute value, by replacing &, <, >, ", and ' with their entity references.