Endpoint

zio.http.endpoint.Endpoint
See theEndpoint companion object
final case class Endpoint[Input, Err, Output, Middleware <: EndpointMiddleware](input: HttpCodec[RequestType, Input], output: HttpCodec[ResponseType, Output], error: HttpCodec[ResponseType, Err], doc: Doc, middleware: Middleware)

An zio.http.endpoint.Endpoint 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.endpoint.Endpoint is a purely declarative encoding of an endpoint, it is possible to use this model to generate a zio.http.App (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.

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Self type
Endpoint[Input, Err, Output, Middleware]

Members list

Concise view

Value members

Concrete methods

def ??(that: Doc): Endpoint[Input, Err, Output, Middleware]

Returns a new API that is derived from this one, but which includes additional documentation that will be included in OpenAPI generation.

Returns a new API that is derived from this one, but which includes additional documentation that will be included in OpenAPI generation.

Attributes

def @@[M2 <: EndpointMiddleware](that: M2)(implicit inCombiner: Combiner[In, In], outCombiner: Combiner[Out, Out], errAlternator: Alternator[Err, Err]): Endpoint[Input, Err, Output, Typed[Out, Out, Out]]

Returns a new endpoint derived from this one whose middleware is composed from the existing middleware of this endpoint, and the specified middleware.

Returns a new endpoint derived from this one whose middleware is composed from the existing middleware of this endpoint, and the specified middleware.

Attributes

def apply(input: Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B](a: A, b: B)(implicit ev: (A, B) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C](a: A, b: B, c: C)(implicit ev: (A, B, C) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D](a: A, b: B, c: C, d: D)(implicit ev: (A, B, C, D) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E](a: A, b: B, c: C, d: D, e: E)(implicit ev: (A, B, C, D, E) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F](a: A, b: B, c: C, d: D, e: E, f: F)(implicit ev: (A, B, C, D, E, F) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F, G](a: A, b: B, c: C, d: D, e: E, f: F, g: G)(implicit ev: (A, B, C, D, E, F, G) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F, G, H](a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H)(implicit ev: (A, B, C, D, E, F, G, H) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F, G, H, I](a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I)(implicit ev: (A, B, C, D, E, F, G, H, I) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F, G, H, I, J](a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J)(implicit ev: (A, B, C, D, E, F, G, H, I, J) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F, G, H, I, J, K](a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K)(implicit ev: (A, B, C, D, E, F, G, H, I, J, K) <:< Input): Invocation[Input, Err, Output, Middleware]
def apply[A, B, C, D, E, F, G, H, I, J, K, L](a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, i: I, j: J, k: K, l: L)(implicit ev: (A, B, C, D, E, F, G, H, I, J, K, L) <:< Input): Invocation[Input, Err, Output, Middleware]
def examplesIn(examples: Input*): Endpoint[Input, Err, Output, Middleware]
def examplesIn: Chunk[Input]
def examplesOut(examples: Output*): Endpoint[Input, Err, Output, Middleware]
def examplesOut: Chunk[Output]
def header[A](codec: HeaderCodec[A])(implicit combiner: Combiner[Input, A]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint that requires the specified headers to be present.

Returns a new endpoint that requires the specified headers to be present.

Attributes

def implement[Env](f: Input => ZIO[Env, Err, Output]): Routes[Env, Err, Middleware]

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify a function which handles the input, and returns the output.

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify a function which handles the input, and returns the output.

Attributes

def implementAs[Env](f: => Output): Routes[Env, Err, Middleware]

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify the output, while the input is being ignored.

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify the output, while the input is being ignored.

Attributes

def implementAsError[Env](f: => Err): Routes[Env, Err, Middleware]

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify the error, while the input is being ignored.

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify the error, while the input is being ignored.

Attributes

def implementPurely[Env](f: Input => Output): Routes[Env, Err, Middleware]

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify a function which handles the input, and returns the output.

Converts this endpoint, which is an abstract description of an endpoint, into a path, which maps a path to a handler for that path. In order to convert an endpoint into a path, you must specify a function which handles the input, and returns the output.

Attributes

def in[Input2](implicit schema: Schema[Input2], combiner: Combiner[Input, Input2]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema.

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema.

Attributes

def in[Input2](doc: Doc)(implicit schema: Schema[Input2], combiner: Combiner[Input, Input2]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema and is documented.

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema and is documented.

Attributes

def in[Input2](name: String)(implicit schema: Schema[Input2], combiner: Combiner[Input, Input2]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema and is documented.

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema and is documented.

Attributes

def in[Input2](name: String, doc: Doc)(implicit schema: Schema[Input2], combiner: Combiner[Input, Input2]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema and is documented.

Returns a new endpoint derived from this one, whose request content must satisfy the specified schema and is documented.

Attributes

def inCodec[Input2](codec: HttpCodec[RequestType, Input2])(implicit combiner: Combiner[Input, Input2]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose request must satisfy the specified codec.

Returns a new endpoint derived from this one, whose request must satisfy the specified codec.

Attributes

def inStream[Input2 : Schema](implicit evidence$1: Schema[Input2], combiner: Combiner[Input, ZStream[Any, Nothing, Input2]]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose input type is a stream of the specified typ.

Returns a new endpoint derived from this one, whose input type is a stream of the specified typ.

Attributes

def inStream[Input2 : Schema](doc: Doc)(implicit evidence$2: Schema[Input2], combiner: Combiner[Input, ZStream[Any, Nothing, Input2]]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose input type is a stream of the specified type and is documented.

Returns a new endpoint derived from this one, whose input type is a stream of the specified type and is documented.

Attributes

def inStream[Input2 : Schema](name: String)(implicit evidence$3: Schema[Input2], combiner: Combiner[Input, ZStream[Any, Nothing, Input2]]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose input type is a stream of the specified type.

Returns a new endpoint derived from this one, whose input type is a stream of the specified type.

Attributes

def inStream[Input2 : Schema](name: String, doc: Doc)(implicit evidence$4: Schema[Input2], combiner: Combiner[Input, ZStream[Any, Nothing, Input2]]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint derived from this one, whose input type is a stream of the specified type and is documented.

Returns a new endpoint derived from this one, whose input type is a stream of the specified type and is documented.

Attributes

def out[Output2 : Schema](implicit evidence$5: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code.

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code.

Attributes

def out[Output2 : Schema](doc: Doc)(implicit evidence$6: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code and is documented.

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code and is documented.

Attributes

def out[Output2 : Schema](mediaType: MediaType)(implicit evidence$7: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code.

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code.

Attributes

def out[Output2 : Schema](status: Status)(implicit evidence$8: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code.

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code.

Attributes

def out[Output2 : Schema](status: Status, doc: Doc)(implicit evidence$9: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code and is documented.

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code and is documented.

Attributes

def out[Output2 : Schema](mediaType: MediaType, doc: Doc)(implicit evidence$10: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code and is documented.

Returns a new endpoint derived from this one, whose output type is the specified type for the ok status code and is documented.

Attributes

def out[Output2 : Schema](status: Status, mediaType: MediaType, doc: Doc)(implicit evidence$11: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code and is documented.

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code and is documented.

Attributes

def out[Output2 : Schema](status: Status, mediaType: MediaType)(implicit evidence$12: Schema[Output2], alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code.

Returns a new endpoint derived from this one, whose output type is the specified type for the specified status code.

Attributes

def outCodec[Output2](codec: HttpCodec[ResponseType, Output2])(implicit alt: Alternator[Output, Output2]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose response must satisfy the specified codec.

Returns a new endpoint derived from this one, whose response must satisfy the specified codec.

Attributes

def outError[Err2](status: Status)(implicit schema: Schema[Err2], alt: Alternator[Err, Err2]): Endpoint[Input, Out, Output, Middleware]

Returns a new endpoint that can fail with the specified error type for the specified status code.

Returns a new endpoint that can fail with the specified error type for the specified status code.

Attributes

def outError[Err2](status: Status, doc: Doc)(implicit schema: Schema[Err2], alt: Alternator[Err, Err2]): Endpoint[Input, Out, Output, Middleware]

Returns a new endpoint that can fail with the specified error type for the specified status code and is documented.

Returns a new endpoint that can fail with the specified error type for the specified status code and is documented.

Attributes

def outErrors[Err2]: OutErrors[Input, Err, Output, Middleware, Err2]
def outStream[Output2 : Schema](implicit evidence$13: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is a stream of the specified type for the ok status code.

Returns a new endpoint derived from this one, whose output type is a stream of the specified type for the ok status code.

Attributes

def outStream[Output2 : Schema](doc: Doc)(implicit evidence$14: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is a stream of the specified type for the ok status code.

Returns a new endpoint derived from this one, whose output type is a stream of the specified type for the ok status code.

Attributes

def outStream[Output2 : Schema](status: Status, doc: Doc)(implicit evidence$15: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]

Returns a new endpoint derived from this one, whose output type is a stream of the specified type for the specified status code and is documented.

Returns a new endpoint derived from this one, whose output type is a stream of the specified type for the specified status code and is documented.

Attributes

def outStream[Output2 : Schema](mediaType: MediaType)(implicit evidence$16: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
def outStream[Output2 : Schema](mediaType: MediaType, doc: Doc)(implicit evidence$17: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
def outStream[Output2 : Schema](status: Status, mediaType: MediaType)(implicit evidence$18: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
def outStream[Output2 : Schema](status: Status, mediaType: MediaType, doc: Doc)(implicit evidence$19: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
def path[A](codec: PathCodec[A])(implicit combiner: Combiner[Input, A]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint with the specified path appended.

Returns a new endpoint with the specified path appended.

Attributes

def query[A](codec: QueryCodec[A])(implicit combiner: Combiner[Input, A]): Endpoint[Out, Err, Output, Middleware]

Returns a new endpoint that requires the specified query.

Returns a new endpoint that requires the specified query.

Attributes

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product