zio.http.api

package zio.http.api

Type members

Classlikes

sealed trait CodecType
Companion:
object
object CodecType
Companion:
class
sealed trait Combiner[L, R]

A combiner is a type class responsible for combining invariant type parameters. It is used to compose the parameters of the zio.http.api.HttpCodec data type.

A combiner is a type class responsible for combining invariant type parameters. It is used to compose the parameters of the zio.http.api.HttpCodec data type.

Companion:
object
Companion:
class
sealed trait Doc

A Doc models documentation for an endpoint or input.

A Doc models documentation for an endpoint or input.

Companion:
object
object Doc
Companion:
class
sealed trait EndpointError extends Exception
Companion:
object
Companion:
class
trait EndpointExecutor[+MI, +MO, +Ids]

A zio.http.api.EndpointExecutor is responsible for taking an endpoint invocation, and executing this invocation, returning the final result, or failing with some kind of RPC error.

A zio.http.api.EndpointExecutor is responsible for taking an endpoint invocation, and executing this invocation, returning the final result, or failing with some kind of RPC error.

Companion:
object
Companion:
class
final case class EndpointRegistry[-MI, +MO, +Ids] extends EndpointLocator
Companion:
object
Companion:
class
final case class EndpointSpec[Input, Output](input: HttpCodec[RequestType, Input], output: HttpCodec[ResponseType, Output], doc: Doc)

An zio.http.api.EndpointSpec represents an API endpoint for the HTTP protocol. Every API has an input, which comes from a combination of the HTTP path, query string parameters, and headers, and an output, which is the data computed by the handler of the API.

An zio.http.api.EndpointSpec represents an API endpoint for the HTTP protocol. Every API has an input, which comes from a combination of the HTTP path, query string parameters, and headers, and an output, which is the data computed by the handler of the API.

MiddlewareInput : Example: A subset of HttpCodec[Input] that doesn't give access to Input MiddlewareOutput: Example: A subset of Out[Output] that doesn't give access to Output Input: Example: Int Output: Example: User

As zio.http.api.EndpointSpec is a purely declarative encoding of an endpoint, it is possible to use this model to generate a zio.http.HttpApp (by supplying a handler for the endpoint), to generate OpenAPI documentation, to generate a type-safe Scala client for the endpoint, and possibly, to generate client libraries in other programming languages.

Companion:
object
Companion:
class
sealed trait Endpoints[-R, +E, AllIds]

Represents a collection of API endpoints that all have handlers.

Represents a collection of API endpoints that all have handlers.

Companion:
object
object Endpoints
Companion:
class
object HeaderCodec extends HeaderCodecs
sealed trait HttpCodec[-AtomTypes, Value]

A zio.http.api.HttpCodec represents a codec for a part of an HTTP request. HttpCodec the HTTP protocol, these parts may be the unconsumed portion of the HTTP path (a route codec), the query string parameters (a query codec), the request headers (a header codec), or the request body (a body codec).

A zio.http.api.HttpCodec represents a codec for a part of an HTTP request. HttpCodec the HTTP protocol, these parts may be the unconsumed portion of the HTTP path (a route codec), the query string parameters (a query codec), the request headers (a header codec), or the request body (a body codec).

A HttpCodec is a purely declarative description of an input, and therefore, it can be used to generate documentation, clients, and client libraries.

HttpCodecs are a bit like invertible multi-channel parsers.

Companion:
object
object HttpCodec extends HeaderCodecs
Companion:
class
final case class Invocation[Id, A, B](api: EndpointSpec[A, B], input: A)
sealed trait Middleware[-R, I, O]

A Middleware represents the implementation of a MiddlewareSpec, intercepting parts of the request, and appending to the response.

A Middleware represents the implementation of a MiddlewareSpec, intercepting parts of the request, and appending to the response.

Companion:
object
object Middleware
Companion:
class
final case class MiddlewareSpec[MiddlewareIn, MiddlewareOut](middlewareIn: HttpCodec[Header & Query & Method, MiddlewareIn], middlewareOut: HttpCodec[Header, MiddlewareOut])
Companion:
object
Companion:
class
object QueryCodec
object RouteCodec
sealed trait ServiceSpec[MI, MO, -AllIds]
Companion:
object
Companion:
class

Types

type BodyCodec[A] = HttpCodec[Body, A]
type QueryCodec[A] = HttpCodec[Query, A]
type RouteCodec[A] = HttpCodec[Route, A]

Implicits

Implicits

implicit def string2HttpCodec(string: String): RouteCodec[Unit]