ServerEndpoint

abstract class ServerEndpoint[-R, F[_]] extends EndpointInfoOps[R] with EndpointMetaOps

An Endpoint together with functions implementing the endpoint's security and main logic.

Type parameters:
F

The effect type constructor used in the provided server logic.

R

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

Companion:
object
class Object
trait Matchable
class Any

Type members

Types

Error output parameter types (abbreviated as E).

Error output parameter types (abbreviated as E).

type INPUT

Input parameter types (abbreviated as I).

Input parameter types (abbreviated as I).

type OUTPUT

Output parameter types (abbreviated as O).

Output parameter types (abbreviated as O).

The type of the value returned by the security logic, e.g. a user (abbreviated as U).

The type of the value returned by the security logic, e.g. a user (abbreviated as U).

Security input parameter types (abbreviated as A).

Security input parameter types (abbreviated as A).

override type ThisType[-_R] = Full[SECURITY_INPUT, PRINCIPAL, INPUT, ERROR_OUTPUT, OUTPUT, _R, F]

Value members

Abstract methods

def logic: MonadError[F] => PRINCIPAL => INPUT => F[Either[ERROR_OUTPUT, OUTPUT]]
def securityLogic: MonadError[F] => SECURITY_INPUT => F[Either[ERROR_OUTPUT, PRINCIPAL]]

Concrete methods

Definition Classes
override def info: EndpointInfo
Definition Classes
override def input: EndpointInput[INPUT]
Definition Classes
Definition Classes
def prependSecurity[A2, E2 : ErasureSameAsType](additionalSecurityInput: EndpointInput[A2], securityErrorOutput: EndpointOutput[E2])(additionalSecurityLogic: A2 => F[Either[E2, Unit]]): ServerEndpoint[R, F]

Prepends additional security logic to this endpoint. This is useful when adding security to file/resource-serving endpoints. The additional security logic should return a Right(()) to indicate success, or a Left(E2) to indicate failure; in this case, the given error output will be used to create the response.

Prepends additional security logic to this endpoint. This is useful when adding security to file/resource-serving endpoints. The additional security logic should return a Right(()) to indicate success, or a Left(E2) to indicate failure; in this case, the given error output will be used to create the response.

The security inputs will become a tuple, containing first additionalSecurityInput combined with the current endpoint.securityInput.

The error output will consist of two variants: either the securityErrorOutput (the ClassTag requirement for E2 is used to create the oneOfVariant). In the absence of sum types, the resulting errors are typed as Any.

The security logic is modified so that first additionalSecurityLogic is run, followed by the security logic defined so far.

The type of the value returned by the combined security logic, or the regular logic remains unchanged.

Type parameters:
A2

Type of the additional security input.

E2

Type of the error output for the security logic.

def prependSecurityIn(additionalInput: EndpointInput[Unit]): ServerEndpoint[R, F]

Prepends an additional input to this endpoint. This is useful when adding a context path to endpoints, e.g. serverEndpoint.prependSecurityIn("api" / "v1").

Prepends an additional input to this endpoint. This is useful when adding a context path to endpoints, e.g. serverEndpoint.prependSecurityIn("api" / "v1").

The given input can't map to any values in the request, hence its type is EndpointInput[Unit]; it has to be "netural" so that the server logic function can remain unchanged.

The input is prepended to the security inputs, so that it is decoded before any other path-related inputs (either security or regular).

def prependSecurityPure[A2, E2 : ErasureSameAsType](additionalSecurityInput: EndpointInput[A2], securityErrorOutput: EndpointOutput[E2])(additionalSecurityLogic: A2 => Either[E2, Unit]): ServerEndpoint[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
Inherited from:
EndpointInfoOps
def description(d: String): ThisType[R]
Inherited from:
EndpointInfoOps
Inherited from:
EndpointInfoOps
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 name(n: String): ThisType[R]
Inherited from:
EndpointInfoOps
def show: String

Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.). E.g.: POST /books /add {header Authorization} {body as application/json (UTF-8)} -> {body as text/plain (UTF-8)}/-

Basic information about the endpoint, excluding mapping information, with inputs sorted (first the method, then path, etc.). E.g.: POST /books /add {header Authorization} {body as application/json (UTF-8)} -> {body as text/plain (UTF-8)}/-

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. E.g.:

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

Endpoint(securityin: -, in: /books POST /add {body as application/json (UTF-8)} {header Authorization}, errout: {body as text/plain (UTF-8)}, out: -)
Inherited from:
EndpointMetaOps
def showPathTemplate(showPathParam: (Int, PathCapture[_]) => String, showQueryParam: Option[(Int, Query[_]) => String], includeAuth: Boolean, showNoPathAs: String, showPathsAs: Option[String], showQueryParamsAs: Option[String]): String

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

Shows 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 parameters:
includeAuth

Should authentication inputs be included in the result.

showNoPathAs

How to show the path if the endpoint does not define any path inputs.

showPathsAs

How to show Tapir.paths inputs (if at all), which capture multiple paths segments

showQueryParamsAs

How to show Tapir.queryParams inputs (if at all), which capture multiple query parameters

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 showShort: String

Shortened information about the endpoint. If the endpoint is named, returns the name, e.g. [my endpoint]. Otherwise, returns the string representation of the method (if any) and path, e.g. POST /books/add

Shortened information about the endpoint. If the endpoint is named, returns the name, e.g. [my endpoint]. Otherwise, returns the string representation of the method (if any) and path, e.g. POST /books/add

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