trait Responses extends StatusCodes with InvariantFunctorSyntax

Self Type
Responses with Errors
Source
Responses.scala
Known Subclasses
Assets, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, ChunkedJsonRequestEntities, ChunkedJsonResponseEntities, Endpoints, EndpointsWithCustomErrors, JsonCodecs, JsonEntities, JsonEntitiesFromCodecs, JsonEntitiesFromSchemas, LowLevelEndpoints, MuxEndpoints, JsonEntitiesFromCodecs, JsonEntitiesFromCodecs, Assets, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, ChunkedJsonRequestEntities, ChunkedJsonResponseEntities, ChunkedRequestEntities, ChunkedResponseEntities, Endpoints, EndpointsWithCustomErrors, JsonEntitiesFromCodecs, JsonEntitiesFromSchemas, JsonEntities, Endpoints, EndpointsWithCustomErrors, Endpoints, EndpointsWithCustomErrors, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, Endpoints, EndpointsWithCustomErrors, JsonEntitiesFromCodecs, JsonEntitiesFromSchemas, MuxEndpoints, Assets, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, Endpoints, EndpointsWithCustomErrors, JsonEntitiesFromCodecs, JsonEntitiesFromEncodersAndDecoders, JsonEntitiesFromSchemas, MuxEndpoints, Assets, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, Endpoints, EndpointsWithCustomErrors, JsonEntities, JsonEntitiesFromSchemas, MuxEndpoints, Responses, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, Endpoints, EndpointsWithCustomErrors, JsonEntitiesFromCodecs, JsonEntitiesFromSchemas, MuxEndpoints, BasicAuthentication, ChunkedEntities, ChunkedJsonEntities, Endpoints, EndpointsWithCustomErrors, JsonEntities, JsonEntitiesFromCodecs, JsonEntitiesFromEncodersAndDecoders, JsonEntitiesFromSchemas, MuxEndpoints, BasicAuthentication, Endpoints, EndpointsWithCustomErrors, JsonEntitiesFromCodecs, MuxEndpoints
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. Responses
  2. InvariantFunctorSyntax
  3. StatusCodes
  4. AnyRef
  5. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. implicit class InvariantFunctorSyntax[A, F[_]] extends AnyRef

    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.

    Definition Classes
    InvariantFunctorSyntax
  2. 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

  3. 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

  4. 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.

  5. implicit class ResponseSyntax[A] extends AnyRef

    Extension methods for Response.

  6. abstract type StatusCode

    HTTP Status Code

    HTTP Status Code

    Definition Classes
    StatusCodes

Abstract Value Members

  1. abstract def Accepted: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  2. 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.

  3. abstract def Created: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  4. abstract def Forbidden: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  5. 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.

  6. abstract def NoContent: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  7. abstract def NotFound: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  8. abstract def NotImplemented: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  9. abstract def OK: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  10. abstract def PayloadTooLarge: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  11. abstract def TooManyRequests: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  12. abstract def Unauthorized: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  13. 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.

  14. 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.
  15. abstract def emptyResponseHeaders: (Responses.this)#ResponseHeaders[Unit]

    No particular response header.

    No particular response header.

    • Client interpreters should ignore information carried by response headers.
  16. 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], or None if the response header is missing.
    • Server interpreters should produce such a response header.
    • Documentation interpreters should document this header.
  17. 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

  18. implicit abstract def responseEntityInvariantFunctor: InvariantFunctor[(Responses.this)#ResponseEntity]
  19. 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")
        )
      )
  20. implicit abstract def responseHeadersInvariantFunctor: InvariantFunctor[(Responses.this)#ResponseHeaders]

    Provides xmap operation.

    Provides xmap operation.

    See also

    InvariantFunctorSyntax

  21. implicit abstract def responseHeadersSemigroupal: Semigroupal[(Responses.this)#ResponseHeaders]

    Provides ++ operation.

    Provides ++ operation.

    See also

    SemigroupalSyntax

  22. implicit abstract def responseInvariantFunctor: InvariantFunctor[(Responses.this)#Response]

    Provides the operation xmap to the type Response

    Provides the operation xmap to the type Response

    See also

    InvariantFunctorSyntax

  23. 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.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from Responses toany2stringadd[Responses] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Responses, B)
    Implicit
    This member is added by an implicit conversion from Responses toArrowAssoc[Responses] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. def AlreadyReported: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  7. def Conflict: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  8. def ExpectationFailed: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  9. def FailedDependency: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  10. def Gone: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  11. def IMUsed: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  12. def LengthRequired: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  13. def Locked: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  14. def MethodNotAllowed: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  15. def MisdirectedRequest: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  16. def MultiStatus: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  17. def NonAuthoritativeInformation: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  18. def NotAcceptable: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  19. def NotModified: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  20. def PartialContent: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  21. def PaymentRequired: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  22. def PermanentRedirect: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  23. def PreconditionFailed: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  24. def PreconditionRequired: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  25. def ProxyAuthenticationRequired: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  26. def RangeNotSatisfiable: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  27. def RequestHeaderFieldsTooLarge: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  28. def RequestTimeout: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  29. def ResetContent: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  30. def TemporaryRedirect: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  31. def TooEarly: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  32. def UnavailableForLegalReasons: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  33. def UnprocessableEntity: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  34. def UnsupportedMediaType: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  35. def UpgradeRequired: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  36. def UriTooLong: (Responses.this)#StatusCode

    Definition Classes
    StatusCodes
  37. 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 the response.

    Add the provided headers to the response.

    Note that if the response describes a choice of several possible responses (resulting from the orElse operation), the headers will be added to all the possible responses.

  38. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  39. 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.

    See also

    endpoints4s.algebra.Errors and endpoints4s.algebra.BuiltInErrors

  40. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  41. def ensuring(cond: (Responses) => Boolean, msg: => Any): Responses
    Implicit
    This member is added by an implicit conversion from Responses toEnsuring[Responses] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  42. def ensuring(cond: (Responses) => Boolean): Responses
    Implicit
    This member is added by an implicit conversion from Responses toEnsuring[Responses] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  43. def ensuring(cond: Boolean, msg: => Any): Responses
    Implicit
    This member is added by an implicit conversion from Responses toEnsuring[Responses] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  44. def ensuring(cond: Boolean): Responses
    Implicit
    This member is added by an implicit conversion from Responses toEnsuring[Responses] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  45. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  46. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  47. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  48. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  49. 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.

    See also

    endpoints4s.algebra.Errors and endpoints4s.algebra.BuiltInErrors

  50. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  51. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  52. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  53. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  54. 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

  55. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  56. def toString(): String
    Definition Classes
    AnyRef → Any
  57. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  58. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  59. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  60. final def wheneverFound[A](responseA: (Responses.this)#Response[A], notFoundDocs: Documentation = None): (Responses.this)#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).

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

  2. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Responses toStringFormat[Responses] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  3. def [B](y: B): (Responses, B)
    Implicit
    This member is added by an implicit conversion from Responses toArrowAssoc[Responses] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from StatusCodes

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromResponses to any2stringadd[Responses]

Inherited by implicit conversion StringFormat fromResponses to StringFormat[Responses]

Inherited by implicit conversion Ensuring fromResponses to Ensuring[Responses]

Inherited by implicit conversion ArrowAssoc fromResponses to ArrowAssoc[Responses]

Types

Types introduced by the algebra

Operations

Operations creating and transforming values

Ungrouped