zio.http.endpoint

Members list

Type members

Classlikes

sealed trait AuthType

Describes the authentication type for an Endpoint.

Describes the authentication type for an Endpoint.

When authentication fails at runtime, the endpoint responds with unauthorizedStatus, which defaults to Status.NotFound (404). This is an intentional security pattern (information hiding) that prevents attackers from discovering protected resources. To use a different status:

Endpoint(Method.GET / "secret")
 .auth(AuthType.Bearer)
 .unauthorizedStatus(Status.Unauthorized) // respond with 401 instead

Attributes

Companion
object
Source
AuthType.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Basic
object Bearer
class Custom[ClientReq]
object Digest
object None
class Or[ClientReq1, ClientReq2, ClientReq]
class ScopedAuth[ClientReq]
class WithStatus[ClientReq]
Show all
Self type
object AuthType

Attributes

Companion
trait
Source
AuthType.scala
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
AuthType.type
final case class Endpoint[PathInput, Input, Err, Output, Auth <: AuthType](route: RoutePattern[PathInput], input: HttpCodec[RequestType, Input], output: HttpCodec[ResponseType, Output], error: HttpCodec[ResponseType, Err], codecError: HttpCodec[ResponseType, HttpCodecError], documentation: Doc, authType: Auth) extends EndpointPlatformSpecific[PathInput, Input, Err, Output, Auth]

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 route, query string parameters, and headers, and an output, which is the data computed by the handler of the API.

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 route, 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.Route (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
Source
Endpoint.scala
Supertypes
trait Serializable
trait Product
trait Equals
trait EndpointPlatformSpecific[PathInput, Input, Err, Output, Auth]
class Object
trait Matchable
class Any
Show all
Self type
Endpoint[PathInput, Input, Err, Output, Auth]
object Endpoint

Attributes

Companion
class
Source
Endpoint.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Endpoint.type
final case class EndpointExecutor[R, Auth, ReqEnv](client: ZClient[Any, ReqEnv, Body, Throwable, Response], locator: EndpointLocator, authProvider: ZIO[R, Nothing, Auth])

A zio.http.endpoint.EndpointExecutor is responsible for taking an endpoint invocation, and executing the invocation, returning the final result, or failing with a pre-defined RPC error.

A zio.http.endpoint.EndpointExecutor is responsible for taking an endpoint invocation, and executing the invocation, returning the final result, or failing with a pre-defined RPC error.

Attributes

Companion
object
Source
EndpointExecutor.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Source
EndpointExecutor.scala
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Attributes

Companion
trait
Source
EndpointLocator.scala
Supertypes
class Object
trait Matchable
class Any
Self type
final case class EndpointNotFound(message: String, api: Endpoint[_, _, _, _, _]) extends Exception

Attributes

Source
EndpointNotFound.scala
Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait EndpointPlatformSpecific[PathInput, Input, Err, Output, Auth]

Attributes

Source
EndpointPlatformSpecific.scala
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Endpoint[PathInput, Input, Err, Output, Auth]
final case class Invocation[P, I, E, O, A <: AuthType](endpoint: Endpoint[P, I, E, O, A], input: I)

An invocation represents a single invocation of an endpoint through provision of the input that the endpoint requires.

An invocation represents a single invocation of an endpoint through provision of the input that the endpoint requires.

Invocations are pure data. In order to be useful, you must execute an invocation with an EndpointExecutor.

Attributes

Source
Invocation.scala
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Deprecated classlikes

An endpoint locator is responsible for locating endpoints.

An endpoint locator is responsible for locating endpoints.

Attributes

Companion
object
Deprecated
[Since version 3.6.0] EndpointLocator will be removed in a future release. Please use URLs directly to create an EndpointExecutor
Source
EndpointLocator.scala
Supertypes
class Object
trait Matchable
class Any
Self type

Extensions

Extensions

extension [A](e: Either[A, A])
inline def mergeOpt: A

Attributes

Source
extensions.scala
extension [AtomTypes, Value <: Res, Value2 <: Res, Res](self: HttpCodec[AtomTypes, Value])
transparent inline def ||[AtomTypes1 <: AtomTypes](that: HttpCodec[AtomTypes1, Value2])(implicit alternator: Alternator[Value, Value2]): HttpCodec[AtomTypes1, Res]

Attributes

Source
extensions.scala
extension [PathInput, Input, Err <: ErrorRes, Output <: Res, Auth <: AuthType, Res, ErrorRes](self: Endpoint[PathInput, Input, Err, Output, Auth])
transparent inline def orOut[Output2 <: Res : HttpContentCodec](implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](doc: Doc)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](mediaType: MediaType)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](status: Status)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](status: Status, doc: Doc)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](mediaType: MediaType, doc: Doc)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](status: Status, mediaType: MediaType, doc: Doc)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOut[Output2 <: Res : HttpContentCodec](status: Status, mediaType: MediaType)(implicit evidence$1: HttpContentCodec[Output2], alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOutCodec[Output2 <: Res](codec: HttpCodec[ResponseType, Output2])(implicit alt: Alternator[Output2, Output]): Endpoint[PathInput, Input, Err, Res, Auth]

Attributes

Source
extensions.scala
transparent inline def orOutError[Err2 <: ErrorRes : HttpContentCodec](status: Status)(implicit evidence$1: HttpContentCodec[Err2], alt: Alternator[Err2, Err]): Endpoint[PathInput, Input, ErrorRes, Output, Auth]

Attributes

Source
extensions.scala
transparent inline def orOutError[Err2 <: ErrorRes : HttpContentCodec](status: Status, doc: Doc)(implicit evidence$1: HttpContentCodec[Err2], alt: Alternator[Err2, Err]): Endpoint[PathInput, Input, ErrorRes, Output, Auth]

Attributes

Source
extensions.scala