Packages

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) extends Product with Serializable

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.

Self Type
Endpoint[Input, Err, Output, Middleware]
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Endpoint
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Endpoint(input: HttpCodec[RequestType, Input], output: HttpCodec[ResponseType, Output], error: HttpCodec[ResponseType, Err], doc: Doc, middleware: Middleware)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. 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.

  5. def @@[M2 <: EndpointMiddleware](that: M2)(implicit inCombiner: Combiner[Middleware.In, @@.M2.In], outCombiner: Combiner[Middleware.Out, @@.M2.Out], errAlternator: Alternator[Middleware.Err, @@.M2.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.

  6. 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]
  7. 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]
  8. 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]
  9. 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]
  10. 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]
  11. 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]
  12. 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]
  13. 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]
  14. 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]
  15. def apply[A, B, C](a: A, b: B, c: C)(implicit ev: <:<[(A, B, C), Input]): Invocation[Input, Err, Output, Middleware]
  16. def apply[A, B](a: A, b: B)(implicit ev: <:<[(A, B), Input]): Invocation[Input, Err, Output, Middleware]
  17. def apply(input: Input): Invocation[Input, Err, Output, Middleware]
  18. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  19. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  20. val doc: Doc
  21. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. val error: HttpCodec[ResponseType, Err]
  23. def examplesIn: Chunk[Input]
  24. def examplesIn(examples: Input*): Endpoint[Input, Err, Output, Middleware]
  25. def examplesOut: Chunk[Output]
  26. def examplesOut(examples: Output*): Endpoint[Input, Err, Output, Middleware]
  27. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  28. 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.

  29. 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.

    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.

  30. 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.

    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.

  31. 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.

    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.

  32. 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.

    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.

  33. 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.

  34. 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.

  35. 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.

  36. 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.

  37. 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.

  38. def inStream[Input2](name: String, doc: Doc)(implicit arg0: 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.

  39. def inStream[Input2](name: String)(implicit arg0: 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.

  40. def inStream[Input2](doc: Doc)(implicit arg0: 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.

  41. def inStream[Input2](implicit arg0: 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.

  42. val input: HttpCodec[RequestType, Input]
  43. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  44. val middleware: Middleware
  45. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  46. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  47. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  48. def out[Output2](status: Status, mediaType: MediaType)(implicit arg0: 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.

  49. def out[Output2](status: Status, mediaType: MediaType, doc: Doc)(implicit arg0: 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.

  50. def out[Output2](mediaType: MediaType, doc: Doc)(implicit arg0: 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.

  51. def out[Output2](status: Status, doc: Doc)(implicit arg0: 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.

  52. def out[Output2](status: Status)(implicit arg0: 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.

  53. def out[Output2](mediaType: MediaType)(implicit arg0: 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.

  54. def out[Output2](doc: Doc)(implicit arg0: 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.

  55. def out[Output2](implicit arg0: 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.

  56. 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.

  57. 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.

  58. 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.

  59. def outErrors[Err2]: OutErrors[Input, Err, Output, Middleware, Err2]
  60. def outStream[Output2](status: Status, mediaType: MediaType, doc: Doc)(implicit arg0: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
  61. def outStream[Output2](status: Status, mediaType: MediaType)(implicit arg0: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
  62. def outStream[Output2](mediaType: MediaType, doc: Doc)(implicit arg0: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
  63. def outStream[Output2](mediaType: MediaType)(implicit arg0: Schema[Output2], alt: Alternator[Output, ZStream[Any, Nothing, Output2]]): Endpoint[Input, Err, Out, Middleware]
  64. def outStream[Output2](status: Status, doc: Doc)(implicit arg0: 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.

  65. def outStream[Output2](doc: Doc)(implicit arg0: 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.

  66. def outStream[Output2](implicit arg0: 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.

  67. val output: HttpCodec[ResponseType, Output]
  68. 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.

  69. def productElementNames: Iterator[String]
    Definition Classes
    Product
  70. 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.

  71. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  72. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  73. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  74. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped