trait Responses extends StatusCodes with InvariantFunctorSyntax
- Alphabetic
- By Inheritance
- Responses
- InvariantFunctorSyntax
- StatusCodes
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
implicit
class
InvariantFunctorSyntax[A, F[_]] extends AnyRef
- Definition Classes
- InvariantFunctorSyntax
-
abstract
type
Response[A]
An HTTP response (status, headers, and entity) carrying an information of type A
An HTTP response (status, headers, and entity) carrying an information of type A
Values of type
Response[A]
can be constructed by using the operations ok, badRequest, internalServerError, or the more general operation response.- Note
This type has implicit methods provided by the InvariantFunctorSyntax and ResponseSyntax classes
-
abstract
type
ResponseEntity[A]
An HTTP response entity carrying an information of type A
An HTTP response entity carrying an information of type A
Values of type ResponseEntity can be constructed by using the operations emptyResponse or textResponse. Additional types of response entities are provided by other algebra modules, such as JsonEntities or ChunkedEntities.
- Note
This type has implicit methods provided by the InvariantFunctorSyntax class
-
abstract
type
ResponseHeaders[A]
Information carried by responses’ headers.
Information carried by responses’ headers.
You can construct values of type
ResponseHeaders
by using the operations responseHeader, optResponseHeader, or emptyResponseHeaders.- Note
This type has implicit methods provided by the SemigroupalSyntax and InvariantFunctorSyntax classes.
-
implicit
class
ResponseSyntax[A] extends AnyRef
Extension methods for Response.
-
abstract
type
StatusCode
HTTP Status Code
HTTP Status Code
- Definition Classes
- StatusCodes
Abstract Value Members
-
abstract
def
Accepted: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
BadRequest: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
- Note
You should use the
badRequest
constructor provided by the endpoints4s.algebra.Responses trait to ensure that errors produced by endpoints4s are consistently handled by interpreters.
-
abstract
def
Created: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
Forbidden: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
InternalServerError: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
- Note
You should use the
internalServerError
constructor provided by the endpoints4s.algebra.Responses trait to ensure that errors produced by endpoints4s are consistently handled by interpreters.
-
abstract
def
NoContent: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
NotFound: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
NotImplemented: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
OK: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
PayloadTooLarge: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
TooManyRequests: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
Unauthorized: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
abstract
def
choiceResponse[A, B](responseA: (Responses.this)#Response[A], responseB: (Responses.this)#Response[B]): (Responses.this)#Response[Either[A, B]]
Alternative between two possible choices of responses.
Alternative between two possible choices of responses.
Server interpreters construct either one or the other response. Client interpreters accept either one or the other response. Documentation interpreters list all the possible responses.
-
abstract
def
emptyResponse: (Responses.this)#ResponseEntity[Unit]
Empty response entity
Empty response entity
- Server interpreters produce no response entity,
- Client interpreters ignore the response entity.
-
abstract
def
emptyResponseHeaders: (Responses.this)#ResponseHeaders[Unit]
No particular response header.
No particular response header.
- Client interpreters should ignore information carried by response headers.
-
abstract
def
optResponseHeader(name: String, docs: Documentation = None): (Responses.this)#ResponseHeaders[Option[String]]
Response headers optionally containing a header with the given
name
.Response headers optionally containing a header with the given
name
.- Client interpreters should model the header value as
Some[String]
, orNone
if the response header is missing. - Server interpreters should produce such a response header.
- Documentation interpreters should document this header.
- Client interpreters should model the header value as
-
abstract
def
response[A, B, R](statusCode: (Responses.this)#StatusCode, entity: (Responses.this)#ResponseEntity[A], docs: Documentation = None, headers: (Responses.this)#ResponseHeaders[B] = emptyResponseHeaders)(implicit tupler: Tupler.Aux[A, B, R]): (Responses.this)#Response[R]
Define an HTTP response
Define an HTTP response
- Server interpreters construct a response with the given status and entity.
- Client interpreters accept a response only if it has a corresponding status code.
- statusCode
Response status code
- entity
Response entity
- docs
Response documentation
- headers
Response headers
- implicit abstract def responseEntityInvariantFunctor: InvariantFunctor[(Responses.this)#ResponseEntity]
-
abstract
def
responseHeader(name: String, docs: Documentation = None): (Responses.this)#ResponseHeaders[String]
Response headers containing a header with the given
name
.Response headers containing a header with the given
name
.- Client interpreters should model the header value as
String
, or fail if the response header is missing. - Server interpreters should produce such a response header.
- Documentation interpreters should document this header.
Example:
val versionedResource: Endpoint[Unit, (SomeResource, String)] = endpoint( get(path / "versioned-resource"), ok( jsonResponse[SomeResource], headers = responseHeader("ETag") ) )
- Client interpreters should model the header value as
-
implicit abstract
def
responseHeadersInvariantFunctor: InvariantFunctor[(Responses.this)#ResponseHeaders]
Provides
xmap
operation.Provides
xmap
operation.- See also
-
implicit abstract
def
responseHeadersSemigroupal: Semigroupal[(Responses.this)#ResponseHeaders]
Provides
++
operation.Provides
++
operation.- See also
-
implicit abstract
def
responseInvariantFunctor: InvariantFunctor[(Responses.this)#Response]
Provides the operation
xmap
to the typeResponse
Provides the operation
xmap
to the typeResponse
- See also
-
abstract
def
textResponse: (Responses.this)#ResponseEntity[String]
Text response entity
Text response entity
- Server interpreters produce an HTTP response with a
text/plain
content type.
- Server interpreters produce an HTTP response with a
Concrete 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
AlreadyReported: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
Conflict: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
ExpectationFailed: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
FailedDependency: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
Gone: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
IMUsed: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
LengthRequired: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
Locked: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
MethodNotAllowed: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
MisdirectedRequest: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
MultiStatus: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
NonAuthoritativeInformation: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
NotAcceptable: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
NotModified: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
PartialContent: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
PaymentRequired: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
PermanentRedirect: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
PreconditionFailed: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
PreconditionRequired: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
ProxyAuthenticationRequired: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
RangeNotSatisfiable: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
RequestHeaderFieldsTooLarge: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
RequestTimeout: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
ResetContent: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
TemporaryRedirect: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
TooEarly: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
UnavailableForLegalReasons: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
UnprocessableEntity: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
UnsupportedMediaType: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
UpgradeRequired: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
UriTooLong: (Responses.this)#StatusCode
- Definition Classes
- StatusCodes
-
def
addResponseHeaders[A, H](response: (Responses.this)#Response[A], headers: (Responses.this)#ResponseHeaders[H])(implicit tupler: Tupler[A, H]): (Responses.this)#Response[Out]
Add the provided
headers
to theresponse
.Add the provided
headers
to theresponse
.Note that if the
response
describes a choice of several possible responses (resulting from theorElse
operation), theheaders
will be added to all the possible responses. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
badRequest[A, R](docs: Documentation = None, headers: (Responses.this)#ResponseHeaders[A] = emptyResponseHeaders)(implicit tupler: Tupler.Aux[(Responses.this)#ClientErrors, A, R]): (Responses.this)#Response[R]
Bad Request (400) response, with an entity of type
ClientErrors
.Bad Request (400) response, with an entity of type
ClientErrors
. -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
internalServerError[A, R](docs: Documentation = None, headers: (Responses.this)#ResponseHeaders[A] = emptyResponseHeaders)(implicit tupler: Tupler.Aux[(Responses.this)#ServerError, A, R]): (Responses.this)#Response[R]
Internal Server Error (500) response, with an entity of type
ServerError
.Internal Server Error (500) response, with an entity of type
ServerError
. -
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()
-
final
def
ok[A, B, R](entity: (Responses.this)#ResponseEntity[A], docs: Documentation = None, headers: (Responses.this)#ResponseHeaders[B] = emptyResponseHeaders)(implicit tupler: Tupler.Aux[A, B, R]): (Responses.this)#Response[R]
OK (200) Response with the given entity
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wheneverFound[A](responseA: (Responses.this)#Response[A], notFoundDocs: Documentation = None): (Responses.this)#Response[Option[A]]
Turns a
Response[A]
into aResponse[Option[A]]
.Turns a
Response[A]
into aResponse[Option[A]]
.Interpreters represent
None
with an empty HTTP response whose status code is 404 (Not Found).
Inherited from endpoints4s.InvariantFunctorSyntax
Inherited from StatusCodes
Inherited from AnyRef
Inherited from Any
Types
Types introduced by the algebra
Operations
Operations creating and transforming values