Package-level declarations

Types

Link copied to clipboard
abstract class ApiContract<Req, Res, ReqH, ResH, PathP, QueryP, CookieP>(val path: String, val httpMethod: HttpMethod = HttpMethod.POST, val requestHeaderDecoder: HeaderField<ReqH> = Empty as HeaderField<ReqH>, val responseHeaderDecoder: HeaderField<ResH> = Empty as HeaderField<ResH>, val pathDecoder: PathField<PathP> = Empty as PathField<PathP>, val queryDecoder: QueryField<QueryP> = Empty as QueryField<QueryP>, val cookieDecoder: CookieField<CookieP> = Empty as CookieField<CookieP>, val requestFormat: BodyFormat<Req>, val responseFormat: BodyFormat<Res>, val isProtected: Boolean = false)

A contract for an API endpoint shared between the client and server.

Link copied to clipboard
class ApiContractBuilder<Req, Res, ReqH, ResH, PathP, QueryP, CookieP>(path: String, httpMethod: HttpMethod = HttpMethod.POST, requestHeaderDecoder: HeaderField<ReqH>, responseHeaderDecoder: HeaderField<ResH>, pathDecoder: PathField<PathP>, queryDecoder: QueryField<QueryP>, cookieDecoder: CookieField<CookieP>, requestFormat: BodyFormat<Req>, responseFormat: BodyFormat<Res>, isProtected: Boolean = false)

A builder for ApiContract types.

Link copied to clipboard
data class ApiResponse<Res, ResH>(val status: Int = 200, val body: Res, val headers: ResH, val cookies: List<Cookie> = emptyList())

A wrapper for the response body and its header(s).

Link copied to clipboard

A BodyFormat for binary bodies.

Link copied to clipboard
interface BodyFormat<T>

Defines how a type T is transformed for transmission.

Link copied to clipboard

A BodyFormat for application/x-www-form-urlencoded bodies.

Link copied to clipboard

A BodyFormat for HTML bodies.

Link copied to clipboard

Common HTTP methods for API contracts.

Link copied to clipboard
class JsonFormat<T>(serializer: KSerializer<T>) : BodyFormat<T>

A BodyFormat that uses JsonSerializer to encode and decode values.

Link copied to clipboard

A BodyFormat for plain text bodies.

Link copied to clipboard
class ProtoBufFormat<T>(serializer: KSerializer<T>) : BodyFormat<T>

A BodyFormat that uses ProtoBufSerializer to encode and decode values.

Link copied to clipboard

A BodyFormat for Unit bodies.

Link copied to clipboard

A BodyFormat for XML bodies.

Properties

Link copied to clipboard

A contract for the common "health" endpoint.

Link copied to clipboard

A contract for the common "ping" endpoint.

Link copied to clipboard

A contract for an example "auth/ping" endpoint.

Functions

Link copied to clipboard

Entry point for creating an ApiContract via builder.

Link copied to clipboard

Creates an ApiResponse for this contract with a DSL-type Builder.