Package

endpoints

algebra

Permalink

package algebra

Source
package.scala
Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. algebra
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. trait Assets extends EndpointsWithCustomErrors

    Permalink

    Describes endpoints related to static assets (e.g.

    Describes endpoints related to static assets (e.g. medias, scripts, stylesheets, etc.)

  2. trait BasicAuthentication extends EndpointsWithCustomErrors

    Permalink

    Provides vocabulary to describe endpoints that use Basic HTTP authentication.

    Provides vocabulary to describe endpoints that use Basic HTTP authentication.

    This trait works fine, but developers are likely to implement their own authentication mechanism, specific to their application.

  3. trait BuiltInErrors extends Errors

    Permalink

    Uses endpoints built-in error types:

    Uses endpoints built-in error types:

    - Invalid for client errors,

    - and Throwable for server error.

    Both types of errors are serialized into a JSON array containing string error values.

  4. trait Codec[E, D] extends Decoder[E, D] with Encoder[D, E]

    Permalink

    A way to encode and decode values

    A way to encode and decode values

    E

    Type of encoded values

    D

    Type of decoded values

  5. trait Decoder[-From, +To] extends AnyRef

    Permalink

    A way to decode a From value into a To value.

  6. type Documentation = Option[String]

    Permalink
  7. trait Encoder[-From, +To] extends AnyRef

    Permalink

    A way to encode a From value into a To value

  8. trait Endpoints extends EndpointsWithCustomErrors with BuiltInErrors

    Permalink

    Algebra interface for describing endpoints made of requests and responses.

    Algebra interface for describing endpoints made of requests and responses.

    Requests and responses contain headers and entity.

    /**
      * Describes an HTTP endpoint whose:
      *  - request uses verb “GET”,
      *  - URL is made of path “/foo”,
      *  - response has no entity
      */
    val example = endpoint(get(path / "foo"), emptyResponse)

    This trait uses BuiltInErrors to model client and server errors.

  9. trait EndpointsWithCustomErrors extends Requests with Responses with Errors

    Permalink

    Algebra interface for describing endpoints made of requests and responses.

  10. trait Errors extends AnyRef

    Permalink

    Defines the error types used to model client and server errors.

    Defines the error types used to model client and server errors.

    The ClientErrors type is used by endpoints to model errors coming from the client (missing query parameter, invalid entity, etc.).

    The ServerError type is used by endpoints to model errors coming from the server business logic.

    The badRequest and internalServerError operations defined in Responses define responses carrying entities of type ClientErrors and ServerError, respectively.

    Interpreters are expected to use the clientErrorsResponse and serverErrorResponse operations defined here to handle client and server errors, respectively.

    See also

    BuiltInErrors

  11. trait JsonEntities extends EndpointsWithCustomErrors

    Permalink

    Algebra interface for describing JSON entities in requests and responses.

    Algebra interface for describing JSON entities in requests and responses.

    /**
      * Describes an HTTP endpoint whose:
      *  - request uses verb “GET”,
      *  - URL is made of the segment “/user” followed by a `String` segment,
      *  - response content type is JSON and contains a `User`
      */
    val example = endpoint(get(path / "user" / segment[UUID]), jsonResponse[User])
  12. trait JsonEntitiesFromCodec extends JsonEntities

    Permalink

    Fixes both the JsonRequest and JsonResponse types to be Codec.

  13. trait JsonSchemaEntities extends JsonEntities with JsonSchemas

    Permalink

    Partially applies the endpoints.algebra.JsonEntities algebra interface to fix the JsonRequest and JsonResponse types to be JsonSchema.

  14. trait LowLevelEndpoints extends EndpointsWithCustomErrors

    Permalink

    Provides a way to define endpoints that directly expose the low level APIs of the interpreters.

    Provides a way to define endpoints that directly expose the low level APIs of the interpreters.

    Using this trait is not recommended because endpoints defined using these methods miss the opportunity to share a consistent protocol between client and server interpreters. However, it can be useful for transitioning legacy code.

    Example of endpoint definition:

    val someEndpoint = endpoint(post(path, rawRequestEntity), rawResponseEntity)

    Endpoint implementation:

    someEndpoint.implementedBy { request =>
      Ok(request.body.asText.getOrElse("Unable to decode request entity"))
    }

    XMLHttpRequest call:

    someEndpoint(xhr => "Foo")
      .map(response => println(response.responseText))
  15. trait Methods extends AnyRef

    Permalink

  16. trait MuxEndpoints extends EndpointsWithCustomErrors

    Permalink

    Algebra interface for describing endpoints such that one endpoint can handle several types of requests and responses.

  17. trait MuxRequest extends AnyRef

    Permalink

    Multiplexed request type

  18. trait Requests extends Urls with Methods with SemigroupalSyntax

    Permalink

  19. trait Responses extends StatusCodes with InvariantFunctorSyntax

    Permalink

  20. trait StatusCodes extends AnyRef

    Permalink

  21. trait Urls extends PartialInvariantFunctorSyntax

    Permalink

    Algebra interface for describing URLs made of a path and a query string.

    Algebra interface for describing URLs made of a path and a query string.

    A path is itself made of segments chained together.

    A query string is made of named parameters.

    /**
      * Describes an URL starting with a segment containing “articles”, followed
      * by another `String` segment, and a query string containing
      * a mandatory `Lang` parameter named “lang”, and an
      * optional `Int` parameter named “page”.
      *
      * Examples of matching URLs:
      *
      * - /articles/kitchen?lang=fr
      * - /articles/garden?lang=en&page=2
      */
    val example = path / "articles" / segment[String]() /? (qs[Lang]("lang") & qs[Option[Int]]("page"))

Value Members

  1. object BasicAuthentication

    Permalink
  2. object InvalidCodec

    Permalink

Inherited from AnyRef

Inherited from Any

Algebras

Ungrouped