final case class EndpointSpec[Input, Output](input: HttpCodec[RequestType, Input], output: HttpCodec[ResponseType, Output], doc: Doc) extends Product with Serializable
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.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
- EndpointSpec[Input, Output]
- Alphabetic
- By Inheritance
- EndpointSpec
- Serializable
- Product
- Equals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new EndpointSpec(input: HttpCodec[RequestType, Input], output: HttpCodec[ResponseType, Output], doc: Doc)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ??(that: Doc): EndpointSpec[Input, Output]
Returns a new API that is derived from this one, but which includes additional documentation that will be included in OpenAPI generation.
- 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[EndpointSpec.this.type, Input, Output]
- 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[EndpointSpec.this.type, Input, Output]
- 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[EndpointSpec.this.type, Input, Output]
- 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[EndpointSpec.this.type, Input, Output]
- 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[EndpointSpec.this.type, Input, Output]
- def apply[A, B, C, D](a: A, b: B, c: C, d: D)(implicit ev: <:<[(A, B, C, D), Input]): Invocation[EndpointSpec.this.type, Input, Output]
- def apply[A, B, C](a: A, b: B, c: C)(implicit ev: <:<[(A, B, C), Input]): Invocation[EndpointSpec.this.type, Input, Output]
- def apply[A, B](a: A, b: B)(implicit ev: <:<[(A, B), Input]): Invocation[EndpointSpec.this.type, Input, Output]
- def apply(input: Input): Invocation[EndpointSpec.this.type, Input, Output]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- val doc: Doc
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def header[A](codec: HeaderCodec[A])(implicit combiner: Combiner[Input, A]): EndpointSpec[Out, Output]
- def implement[R, E](f: (Input) => ZIO[R, E, Output]): Endpoints[R, E, EndpointSpec.this.type]
Converts this API, which is an abstract description of an endpoint, into a service, which is a concrete implementation of the endpoint.
Converts this API, which is an abstract description of an endpoint, into a service, which is a concrete implementation of the endpoint. In order to convert an API into a service, you must specify a function which handles the input, and returns the output.
- def in[Input2](in2: HttpCodec[RequestType, Input2])(implicit combiner: Combiner[Input, Input2]): EndpointSpec[Out, Output]
Adds a new element of input to the API, which can come from the portion of the HTTP path not yet consumed, the query string parameters, or the HTTP headers of the request.
- val input: HttpCodec[RequestType, Input]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def out[Output2](out2: HttpCodec[ResponseType, Output2])(implicit combiner: Combiner[Output, Output2]): EndpointSpec[Input, Out]
- def out[Output2](implicit arg0: Schema[Output2]): EndpointSpec[Input, Output2]
Changes the output type of the endpoint to the specified output type.
- def outStream[Output2](implicit arg0: Schema[Output2]): EndpointSpec[Input, ZStream[Any, Throwable, Output2]]
Changes the output type of the endpoint to be a stream of the specified output type.
- val output: HttpCodec[ResponseType, Output]
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- def query[A](codec: QueryCodec[A])(implicit combiner: Combiner[Input, A]): EndpointSpec[Out, Output]
- def route[A](codec: RouteCodec[A])(implicit combiner: Combiner[Input, A]): EndpointSpec[Out, Output]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toServiceSpec: ServiceSpec[Unit, Unit, EndpointSpec.this.type]
Convert API to a ServiceSpec.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])