Endpoints

class Endpoints[R[_]](val host: String, val backend: SttpBackend[R, Any]) extends Endpoints with EndpointsWithCustomErrors[R] with BuiltInErrors[R]

An interpreter for endpoints4s.algebra.Endpoints that builds a client issuing requests using a sttp’s com.softwaremill.sttp.SttpBackend, and uses algebra.BuiltInErrors to model client and server errors.

Doest not support streaming responses for now

Type parameters:
R

The monad wrapping the response. It is defined by the backend

Value parameters:
backend

The underlying backend to use

host

Base of the URL of the service that implements the endpoints (e.g. "http://foo.com")

Type members

Inherited classlikes

final class CallbackDocs extends Serializable
Value parameters:
entity

Contents of the callback message

method

HTTP method used for the callback

response

Expected response

Inherited from:
EndpointsWithCustomErrors
case class Endpoint[A, B](request: () => A, response: Response[B]) extends A => R[B]

A function that, given an A, eventually attempts to decode the B response.

A function that, given an A, eventually attempts to decode the B response.

Inherited from:
EndpointsWithCustomErrors
final class EndpointDocs extends Serializable
Value parameters:
callbacks

Callbacks indexed by event name

deprecated

Indicates whether this endpoint is deprecated or not

description

Detailed description

operationId

A unique identifier which identifies this operation

summary

Short description

tags

OpenAPI tags

Inherited from:
EndpointsWithCustomErrors
final implicit class EndpointSyntax[A, B](endpoint: Endpoint[A, B])

Extension methods for Endpoint.

Extension methods for Endpoint.

Inherited from:
EndpointsWithCustomErrors
implicit class InvariantFunctorSyntax[A, F[_]](val fa: F[A])(implicit ev: InvariantFunctor[F])

Extension methods for values of type F[A] for which there is an implicit InvariantFunctor[F] instance.

Extension methods for values of type F[A] for which there is an implicit InvariantFunctor[F] instance.

Inherited from:
InvariantFunctorSyntax
implicit class PartialInvariantFunctorSyntax[A, F[_]](val fa: F[A])(implicit ev: PartialInvariantFunctor[F])
trait Path[A] extends Url[A]
Inherited from:
Urls
implicit class PathOps[A](first: Path[A])

Convenient methods for Paths.

Convenient methods for Paths.

Inherited from:
Urls
trait QueryString[A]
Inherited from:
Urls
implicit class QueryStringSyntax[A](first: QueryString[A])

Extension methods on QueryString.

Extension methods on QueryString.

Inherited from:
Urls
implicit class RequestEntitySyntax[A](requestEntity: RequestEntity[A])
Inherited from:
Requests
final implicit class RequestSyntax[A](request: Request[A])

Extension methods for Request.

Extension methods for Request.

Inherited from:
Requests
trait Response[A]

Trait that indicates how a response should be interpreted

Trait that indicates how a response should be interpreted

Inherited from:
EndpointsWithCustomErrors
implicit class ResponseSyntax[A](response: Response[A])

Extension methods for Response.

Extension methods for Response.

Inherited from:
Responses
trait Segment[A]
Inherited from:
Urls
implicit class SemigroupalSyntax[A, F[_]](val f: F[A])(implicit ev: Semigroupal[F])
Inherited from:
SemigroupalSyntax
trait Url[A]
Inherited from:
Urls

Inherited types

Callbacks indexed by URL pattern

Callbacks indexed by URL pattern

See also:
Inherited from:
EndpointsWithCustomErrors
Inherited from:
BuiltInErrors
type Method = RequestT[Identity, _, Any] => RequestT[Identity, _, Any]
Inherited from:
Methods
type QueryStringParam[A] = A => List[String]

a query string parameter can have zero or several values

a query string parameter can have zero or several values

Inherited from:
Urls
type Request[A] = A => SttpRequest

A function that takes an A information and returns a SttpRequest

A function that takes an A information and returns a SttpRequest

Inherited from:
EndpointsWithCustomErrors

A function that, given an A information and a SttpRequest, eventually returns a SttpRequest

A function that, given an A information and a SttpRequest, eventually returns a SttpRequest

Inherited from:
EndpointsWithCustomErrors

A function that, given an A and a request model, returns an updated request containing additional headers

A function that, given an A and a request model, returns an updated request containing additional headers

Inherited from:
EndpointsWithCustomErrors
Inherited from:
BuiltInErrors
type StatusCode = StatusCode
Inherited from:
StatusCodes
type SttpRequest = RequestT[Identity, _, Any]
type WithDefault[A] = Option[A]
Inherited from:
Urls

Value members

Inherited methods

Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
override def Conflict: StatusCode
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
Inherited from:
Methods
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
def Get: Method
Inherited from:
Methods
override def Gone: StatusCode
Definition Classes
Inherited from:
StatusCodes
override def IMUsed: StatusCode
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
override def Locked: StatusCode
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
override def MultiStatus: StatusCode
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
override def NotModified: StatusCode
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
Inherited from:
Methods
Definition Classes
Inherited from:
StatusCodes
Inherited from:
Methods
Definition Classes
Inherited from:
StatusCodes
Inherited from:
Methods
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
def Put: Method
Inherited from:
Methods
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
override def ResetContent: StatusCode
Definition Classes
Inherited from:
StatusCodes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
Definition Classes
Inherited from:
StatusCodes
override def UriTooLong: StatusCode
Definition Classes
Inherited from:
StatusCodes
override def addRequestHeaders[A, H](request: () => A, headers: () => H)(implicit tupler: Tupler[A, H]): () => Out
override def addRequestQueryString[A, Q](request: () => A, qs: QueryString[Q])(implicit tupler: Tupler[A, Q]): () => Out
override def addResponseHeaders[A, H](response: Response[A], headers: () => H)(implicit tupler: Tupler[A, H]): Response[Out]
final def badRequest[A, R](docs: Documentation, headers: () => A)(implicit tupler: Aux[ClientErrors, A, R]): Response[R]

Bad Request (400) response, with an entity of type ClientErrors.

Bad Request (400) response, with an entity of type ClientErrors.

See also:
Inherited from:
Responses
def chainPaths[A, B](first: Path[A], second: Path[B])(implicit tupler: Tupler[A, B]): Path[Out]
Inherited from:
Urls
def choiceRequestEntity[A, B](requestEntityA: () => A, requestEntityB: () => B): () => Either[A, B]
def choiceResponse[A, B](responseA: Response[A], responseB: Response[B]): Response[Either[A, B]]
final def clientErrorsToInvalid(clientErrors: ClientErrors): Invalid
Inherited from:
BuiltInErrors
def combineQueryStrings[A, B](first: QueryString[A], second: QueryString[B])(implicit tupler: Tupler[A, B]): QueryString[Out]
Inherited from:
Urls
final def delete[UrlP, HeadersP, Out](url: Url[UrlP], docs: Documentation, headers: () => HeadersP)(implicit tuplerUH: Aux[UrlP, HeadersP, Out]): () => Out

Helper method to perform DELETE request

Helper method to perform DELETE request

Type parameters:
HeadersP

Payload carried by headers

UrlP

Payload carried by url

Inherited from:
Requests

Successfully decodes no information from a response

Successfully decodes no information from a response

Inherited from:
EndpointsWithCustomErrors
def endpoint[A, B](request: () => A, response: Response[B], docs: EndpointDocs): Endpoint[A, B]
final def get[UrlP, HeadersP, Out](url: Url[UrlP], docs: Documentation, headers: () => HeadersP)(implicit tuplerUH: Aux[UrlP, HeadersP, Out]): () => Out

Helper method to perform GET request

Helper method to perform GET request

Type parameters:
HeadersP

Payload carried by headers

UrlP

Payload carried by url

Inherited from:
Requests
final def internalServerError[A, R](docs: Documentation, headers: () => A)(implicit tupler: Aux[ServerError, A, R]): Response[R]

Internal Server Error (500) response, with an entity of type ServerError.

Internal Server Error (500) response, with an entity of type ServerError.

See also:
Inherited from:
Responses
Inherited from:
BuiltInErrors
override def mapEndpointDocs[A, B](endpoint: Endpoint[A, B], f: EndpointDocs => EndpointDocs): Endpoint[A, B]
override def mapEndpointRequest[A, B, C](endpoint: Endpoint[A, B], f: (() => A) => () => C): Endpoint[C, B]
override def mapEndpointResponse[A, B, C](endpoint: Endpoint[A, B], f: Response[B] => Response[C]): Endpoint[A, C]
final def ok[A, B, R](entity: ResponseEntity[A], docs: Documentation, headers: () => B)(implicit tupler: Aux[A, B, R]): Response[R]

OK (200) Response with the given entity

OK (200) Response with the given entity

Inherited from:
Responses
override def optQsWithDefault[A](name: String, default: A, docs: Documentation)(implicit value: () => A): QueryString[Option[A]]
Definition Classes
Inherited from:
Urls
final def patch[UrlP, BodyP, HeadersP, UrlAndBodyPTupled, Out](url: Url[UrlP], entity: () => BodyP, docs: Documentation, headers: () => HeadersP)(implicit tuplerUB: Aux[UrlP, BodyP, UrlAndBodyPTupled], tuplerUBH: Aux[UrlAndBodyPTupled, HeadersP, Out]): () => Out

Helper method to perform PATCH request

Helper method to perform PATCH request

Type parameters:
BodyP

Payload carried by body

HeadersP

Payload carried by headers

UrlAndBodyPTupled

Payloads of Url and Body tupled together by Tupler

UrlP

Payload carried by url

Value parameters:
docs

Request documentation

Inherited from:
Requests
final def post[UrlP, BodyP, HeadersP, UrlAndBodyPTupled, Out](url: Url[UrlP], entity: () => BodyP, docs: Documentation, headers: () => HeadersP)(implicit tuplerUB: Aux[UrlP, BodyP, UrlAndBodyPTupled], tuplerUBH: Aux[UrlAndBodyPTupled, HeadersP, Out]): () => Out

Helper method to perform POST request

Helper method to perform POST request

Type parameters:
BodyP

Payload carried by body

HeadersP

Payload carried by headers

UrlAndBodyPTupled

Payloads of Url and Body tupled together by Tupler

UrlP

Payload carried by url

Value parameters:
docs

Request documentation

Inherited from:
Requests
final def put[UrlP, BodyP, HeadersP, UrlAndBodyPTupled, Out](url: Url[UrlP], entity: () => BodyP, docs: Documentation, headers: () => HeadersP)(implicit tuplerUB: Aux[UrlP, BodyP, UrlAndBodyPTupled], tuplerUBH: Aux[UrlAndBodyPTupled, HeadersP, Out]): () => Out

Helper method to perform PUT request

Helper method to perform PUT request

Type parameters:
BodyP

Payload carried by body

HeadersP

Payload carried by headers

UrlAndBodyPTupled

Payloads of Url and Body tupled together by Tupler

UrlP

Payload carried by url

Inherited from:
Requests
def qs[A](name: String, docs: Documentation)(implicit param: () => A): QueryString[A]
Inherited from:
Urls
Inherited from:
Urls
def request[A, B, C, AB, Out](method: Method, url: Url[A], entity: () => B, docs: Documentation, headers: () => C)(implicit tuplerAB: Aux[A, B, AB], tuplerABC: Aux[AB, C, Out]): () => Out
def requestHeader(name: String, docs: Documentation): () => String
def response[A, B, Res](statusCode: StatusCode, entity: ResponseEntity[A], docs: Documentation, headers: () => B)(implicit tupler: Aux[A, B, Res]): Response[Res]
def responseHeader(name: String, docs: Documentation): () => String
def segment[A](name: String, docs: Documentation)(implicit s: Segment[A]): Path[A]
Inherited from:
Urls
Inherited from:
BuiltInErrors
Inherited from:
Urls
def stringCodecResponse[A](implicit codec: Codec[String, A]): ResponseEntity[A]

Successfully decodes string information from a response

Successfully decodes string information from a response

Inherited from:
EndpointsWithCustomErrors
Inherited from:
BuiltInErrors
def urlWithQueryString[A, B](path: Path[A], qs: QueryString[B])(implicit tupler: Tupler[A, B]): Url[Out]
Inherited from:
Urls
final def wheneverFound[A](responseA: Response[A], notFoundDocs: Documentation): Response[Option[A]]

Turns a Response[A] into a Response[Option[A]].

Turns a Response[A] into a Response[Option[A]].

Interpreters represent None with an empty HTTP response whose status code is 404 (Not Found).

Inherited from:
Responses

Concrete fields

val backend: SttpBackend[R, Any]

Inherited fields

Response used by endpoints4s when decoding a request fails.

Response used by endpoints4s when decoding a request fails.

The provided implementation forwards to badRequest.

Inherited from:
Errors
lazy val emptyRequest: () => Unit
lazy val emptyRequestHeaders: () => Unit

Does not modify the request

Does not modify the request

Inherited from:
EndpointsWithCustomErrors
val path: Path[Unit]

An empty path.

An empty path.

Useful to begin a path definition:

 path / "foo" / segment[Int] /? qs[String]("bar")
Inherited from:
Urls

Response used by endpoints4s when the business logic of an endpoint fails.

Response used by endpoints4s when the business logic of an endpoint fails.

The provided implementation forwards to internalServerError

Inherited from:
Errors
lazy val textRequest: () => String
val utf8Name: String
Inherited from:
Urls

Implicits

Inherited implicits

final implicit def EndpointSyntax[A, B](endpoint: Endpoint[A, B]): EndpointSyntax[A, B]

Extension methods for Endpoint.

Extension methods for Endpoint.

Inherited from:
EndpointsWithCustomErrors
final implicit def InvariantFunctorSyntax[A, F[_]](fa: F[A])(implicit ev: InvariantFunctor[F]): InvariantFunctorSyntax[A, F]

Extension methods for values of type F[A] for which there is an implicit InvariantFunctor[F] instance.

Extension methods for values of type F[A] for which there is an implicit InvariantFunctor[F] instance.

Inherited from:
InvariantFunctorSyntax
final implicit def PartialInvariantFunctorSyntax[A, F[_]](fa: F[A])(implicit ev: PartialInvariantFunctor[F]): PartialInvariantFunctorSyntax[A, F]
final implicit def PathOps[A](first: Path[A]): PathOps[A]

Convenient methods for Paths.

Convenient methods for Paths.

Inherited from:
Urls
final implicit def QueryStringSyntax[A](first: QueryString[A]): QueryStringSyntax[A]

Extension methods on QueryString.

Extension methods on QueryString.

Inherited from:
Urls
final implicit def RequestEntitySyntax[A](requestEntity: () => A): RequestEntitySyntax[A]
Inherited from:
Requests
final implicit def RequestSyntax[A](request: () => A): RequestSyntax[A]

Extension methods for Request.

Extension methods for Request.

Inherited from:
Requests
final implicit def ResponseSyntax[A](response: Response[A]): ResponseSyntax[A]

Extension methods for Response.

Extension methods for Response.

Inherited from:
Responses
final implicit def SemigroupalSyntax[A, F[_]](f: F[A])(implicit ev: Semigroupal[F]): SemigroupalSyntax[A, F]
Inherited from:
SemigroupalSyntax
implicit def booleanQueryString: () => Boolean

Query string parameter containing a Boolean value

Query string parameter containing a Boolean value

Inherited from:
Urls
implicit def doubleQueryString: () => Double

Codec for query string parameters of type Double

Codec for query string parameters of type Double

Inherited from:
Urls

Path segment codec for type Double

Path segment codec for type Double

Inherited from:
Urls
implicit def intQueryString: () => Int

Ability to define Int query string parameters

Ability to define Int query string parameters

Inherited from:
Urls
implicit def intSegment: Segment[Int]

Path segment codec for type Int

Path segment codec for type Int

Inherited from:
Urls
implicit def longQueryString: () => Long

Query string parameter containing a Long value

Query string parameter containing a Long value

Inherited from:
Urls
implicit def longSegment: Segment[Long]

Path segment codec for type Long

Path segment codec for type Long

Inherited from:
Urls
implicit def optionalQueryStringParam[A](implicit param: () => A): () => Option[A]
Inherited from:
Urls
implicit def repeatedQueryStringParam[A, CC <: (Iterable)](implicit param: () => A, factory: Factory[A, CC[A]]): () => CC[A]
Inherited from:
Urls
implicit lazy val stringQueryString: () => String
Inherited from:
Urls
implicit lazy val stringSegment: Segment[String]
Inherited from:
Urls
implicit def uuidQueryString: () => UUID

Ability to define UUID query string parameters

Ability to define UUID query string parameters

Inherited from:
Urls
implicit def uuidSegment: Segment[UUID]

Path segment codec for type UUID

Path segment codec for type UUID

Inherited from:
Urls