PartialServerEndpoint

case
class PartialServerEndpoint[A, U, I, E, O, -R, F[_]](endpoint: Endpoint[A, I, E, O, R], securityLogic: MonadError[F] => A => F[Either[E, U]]) extends EndpointInputsOps[A, I, E, O, R] with EndpointOutputsOps[A, I, E, O, R] with EndpointErrorOutputVariantsOps[A, I, E, O, R] with EndpointInfoOps[R] with EndpointMetaOps

An endpoint with the security logic provided, and the main logic yet unspecified. See Endpoint.serverSecurityLogic.

The provided security part of the server logic transforms inputs of type A, either to an error of type E, or value of type U.

The part of the server logic which is not provided, will have to transform both U and the rest of the input I either into an error, or a value of type O.

Inputs/outputs can be added to partial endpoints as to regular endpoints. The shape of the error outputs can be adjusted in a limited way, by adding new error output variants, similar as if they were defined using Tapir.oneOf; the variants and the existing error outputs should usually have a common supertype (other than Any). Hence, it's possible to create a base, secured input, and then specialise it with inputs, outputs and logic as needed.

Type Params
A

"Auth": Security input parameter types, which the security logic accepts and returns a U or an error E.

E

Error output parameter types.

F

The effect type used in the provided partial server logic.

I

Input parameter types.

O

Output parameter types.

R

The capabilities that are required by this endpoint's inputs/outputs. Any, if no requirements.

U

"User": The type of the value returned by the security logic.

trait Serializable
trait Product
trait Equals
trait EndpointErrorOutputVariantsOps[A, I, E, O, R]
trait EndpointOutputsOps[A, I, E, O, R]
trait EndpointOutputsMacros[A, I, E, O, R]
trait EndpointInputsOps[A, I, E, O, R]
trait EndpointInputsMacros[A, I, E, O, R]
class Object
trait Matchable
class Any
PartialServerEndpoint[A, U, I, E, O, R, F]

Type members

Types

override
type EndpointType[_A, _I, _E, _O, -_R] = PartialServerEndpoint[_A, U, _I, _E, _O, _R, F]
override
type ThisType[-_R] = PartialServerEndpoint[A, U, I, E, O, _R, F]

Value members

Concrete methods

override
Definition Classes
override
Definition Classes
override
Definition Classes
override
Definition Classes
def serverLogic(f: U => I => F[Either[E, O]]): Full[A, U, I, E, O, R, F]
def serverLogicError(f: U => I => F[E]): Full[A, U, I, E, O, R, F]
def serverLogicPure(f: U => I => Either[E, O]): Full[A, U, I, E, O, R, F]
def serverLogicRecoverErrors(f: U => I => F[O])(implicit eIsThrowable: E <:< Throwable, eClassTag: ClassTag[E]): Full[A, U, I, E, O, R, F]
def serverLogicSuccess(f: U => I => F[O]): Full[A, U, I, E, O, R, F]

Inherited methods

def attribute[T](k: AttributeKey[T], v: T): ThisType[R]
Inherited from
EndpointInfoOps
def attribute[T](k: AttributeKey[T]): Option[T]
Inherited from
EndpointInfoOps
def connect: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def delete: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
Inherited from
EndpointInfoOps
def description(d: String): ThisType[R]
Inherited from
EndpointInfoOps
def errorOutEither[E2](o: EndpointOutput[E2]): EndpointType[A, I, Either[E, E2], O, R]

Adds a new error variant, where the current error output is represented as a Left, and the given one as a Right.

Adds a new error variant, where the current error output is represented as a Left, and the given one as a Right.

Inherited from
EndpointErrorOutputVariantsOps
def errorOutVariant[E2 >: E](o: OneOfVariant[_ <: E2])(implicit ct: ClassTag[E], eEqualToErasure: ErasureSameAsType[E]): EndpointType[A, I, E2, O, R]

Appends a new error output variant.

Appends a new error output variant.

A variant for the current endpoint output will be created using the given Tapir.oneOfVariant. This is needed to capture the logic which allows deciding if a run-time value is applicable to a variant. If the erasure of the E type is different from E, there will be a compile-time failure, as no such run-time check is possible. In this case, use errorOutVariantsFromCurrent and create a variant using one of the other variant factory methods (e.g. Tapir.oneOfVariantValueMatcher).

During encoding/decoding, the new o variant will be checked after the current variant.

More specifically, the current error output is replaced with a Tapir.oneOf output, where:

  • the first output variant is the current variant: oneOfVariant(errorOutput)
  • the second output variant is the given o

Usage example:

 sealed trait Parent
 case class Child1(v: String) extends Parent
 case class Child2(v: String) extends Parent

 val e: PublicEndpoint[Unit, Parent, Unit, Any] = endpoint
   .errorOut(stringBody.mapTo[Child1])
   .errorOutVariant[Parent](oneOfVariant(stringBody.mapTo[Child2]))

Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using EndpointServerLogicOps.serverSecurityLogic.

Type Params
E2

A common supertype of the new variant and the current output E.

Value Params
o

The variant to add. Can be created given an output with one of the Tapir.oneOfVariant methods.

Inherited from
EndpointErrorOutputVariantsOps
def errorOutVariants[E2 >: E](first: OneOfVariant[_ <: E2], other: OneOfVariant[_ <: E2]*)(implicit ct: ClassTag[E], eEqualToErasure: ErasureSameAsType[E]): EndpointType[A, I, E2, O, R]

Same as errorOutVariant, but allows appending multiple variants in one go.

Same as errorOutVariant, but allows appending multiple variants in one go.

Inherited from
EndpointErrorOutputVariantsOps
def errorOutVariantsFromCurrent[E2 >: E](variants: EndpointOutput[E] => List[OneOfVariant[_ <: E2]]): EndpointType[A, I, E2, O, R]

Replace the error output with a Tapir.oneOf output, using the variants returned by variants. The current output should be included in one of the returned variants.

Replace the error output with a Tapir.oneOf output, using the variants returned by variants. The current output should be included in one of the returned variants.

Allows creating the variant list in a custom order, placing the current variant in an arbitrary position, and using default variants if necessary.

Adding error output variants is useful when extending the error outputs in a PartialServerEndpoint, created using EndpointServerLogicOps.serverSecurityLogic.

Type Params
E2

A common supertype of the new variant and the current output E.

Inherited from
EndpointErrorOutputVariantsOps
def get: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def head: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def in[BS, J, IJ, R2](i: StreamBodyIO[BS, J, R2])(implicit concat: Aux[I, J, IJ]): EndpointType[A, IJ, E, O, R & R2]
Inherited from
EndpointInputsOps
def in[J, IJ](i: EndpointInput[J])(implicit concat: Aux[I, J, IJ]): EndpointType[A, IJ, E, O, R]
Inherited from
EndpointInputsOps
Inherited from
EndpointInfoOps
def mapErrorOut[EE](f: E => EE)(g: EE => E): EndpointType[A, I, EE, O, R]
def mapIn[II](f: I => II)(g: II => I): EndpointType[A, II, E, O, R]
Inherited from
EndpointInputsOps
def mapIn[II](m: Mapping[I, II]): EndpointType[A, II, E, O, R]
Inherited from
EndpointInputsOps
def mapInDecode[II](f: I => DecodeResult[II])(g: II => I): EndpointType[A, II, E, O, R]
Inherited from
EndpointInputsOps
inline
def mapInTo[CASE_CLASS <: Product](using mc: ProductOf[CASE_CLASS]): EndpointType[A, CASE_CLASS, E, O, R]
Inherited from
EndpointInputsMacros
def mapOut[OO](f: O => OO)(g: OO => O): EndpointType[A, I, E, OO, R]
Inherited from
EndpointOutputsOps
def mapOut[OO](m: Mapping[O, OO]): EndpointType[A, I, E, OO, R]
Inherited from
EndpointOutputsOps
def mapOutDecode[OO](f: O => DecodeResult[OO])(g: OO => O): EndpointType[A, I, E, OO, R]
Inherited from
EndpointOutputsOps
inline
def mapOutTo[CASE_CLASS <: Product](using mc: ProductOf[CASE_CLASS]): EndpointType[A, I, E, CASE_CLASS, R]
Inherited from
EndpointOutputsMacros
def method: Option[Method]

The method defined in a fixed method input in this endpoint, if any (using e.g. EndpointInputsOps.get or EndpointInputsOps.post).

The method defined in a fixed method input in this endpoint, if any (using e.g. EndpointInputsOps.get or EndpointInputsOps.post).

Inherited from
EndpointMetaOps
def method(m: Method): EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def name(n: String): ThisType[R]
Inherited from
EndpointInfoOps
def options: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def out[PIPE_REQ_RESP, P, OP, R2](i: WebSocketBodyOutput[PIPE_REQ_RESP, _, _, P, R2])(implicit ts: Aux[O, P, OP]): EndpointType[A, I, E, OP, R & R2 & WebSockets]
Inherited from
EndpointOutputsOps
def out[BS, P, OP, R2](i: StreamBodyIO[BS, P, R2])(implicit ts: Aux[O, P, OP]): EndpointType[A, I, E, OP, R & R2]
Inherited from
EndpointOutputsOps
def out[P, OP](i: EndpointOutput[P])(implicit ts: Aux[O, P, OP]): EndpointType[A, I, E, OP, R]
Inherited from
EndpointOutputsOps
def patch: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def post: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def prependIn[BS, J, JI, R2](i: StreamBodyIO[BS, J, R2])(implicit concat: Aux[J, I, JI]): EndpointType[A, JI, E, O, R & R2]
Inherited from
EndpointInputsOps
def prependIn[J, JI](i: EndpointInput[J])(implicit concat: Aux[J, I, JI]): EndpointType[A, JI, E, O, R]
Inherited from
EndpointInputsOps
def prependOut[PIPE_REQ_RESP, P, PO, R2](i: WebSocketBodyOutput[PIPE_REQ_RESP, _, _, P, R2])(implicit ts: Aux[P, O, PO]): EndpointType[A, I, E, PO, R & R2 & WebSockets]
Inherited from
EndpointOutputsOps
def prependOut[BS, P, PO, R2](i: StreamBodyIO[BS, P, R2])(implicit ts: Aux[P, O, PO]): EndpointType[A, I, E, PO, R]
Inherited from
EndpointOutputsOps
def prependOut[P, PO](i: EndpointOutput[P])(implicit ts: Aux[P, O, PO]): EndpointType[A, I, E, PO, R]
Inherited from
EndpointOutputsOps
def productElementNames: Iterator[String]
Inherited from
Product
def productIterator: Iterator[Any]
Inherited from
Product
def put: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps
def renderPathTemplate(renderPathParam: RenderPathParam, renderQueryParam: Option[RenderQueryParam], includeAuth: Boolean): String

Renders endpoint path, by default all parametrised path and query components are replaced by {param_name} or {paramN}, e.g. for

Renders endpoint path, by default all parametrised path and query components are replaced by {param_name} or {paramN}, e.g. for

endpoint.in("p1" / path[String] / query[String]("par2"))

returns /p1/{param1}?par2={par2}

Value Params
includeAuth

Should authentication inputs be included in the result.

Inherited from
EndpointMetaOps
def show: String

Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.)

Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.)

Inherited from
EndpointMetaOps
def showDetail: String

Detailed description of the endpoint, with inputs/outputs represented in the same order as originally defined, including mapping information.

Detailed description of the endpoint, with inputs/outputs represented in the same order as originally defined, including mapping information.

Inherited from
EndpointMetaOps
def showRaw: String

Equivalent to .toString, shows the whole case class structure.

Equivalent to .toString, shows the whole case class structure.

Inherited from
EndpointMetaOps
def summary(s: String): ThisType[R]
Inherited from
EndpointInfoOps
def tag(t: String): ThisType[R]
Inherited from
EndpointInfoOps
def tags(ts: List[String]): ThisType[R]
Inherited from
EndpointInfoOps
def trace: EndpointType[A, I, E, O, R]
Inherited from
EndpointInputsOps

Deprecated and Inherited methods

@deprecated("Use method", since = "0.19.0")
def httpMethod: Option[Method]
Deprecated
[Since version 0.19.0]
Inherited from
EndpointMetaOps