Trait

endpoints.play.routing

Endpoints

Related Doc: package routing

Permalink

trait Endpoints extends algebra.Endpoints with Urls with Methods

Interpreter for algebra.Endpoints that performs routing using Play framework.

Consider the following endpoints definition:

trait MyEndpoints extends algebra.Endpoints with algebra.JsonEntities {
  val inc = endpoint(get(path / "inc" ? qs[Int]("x")), jsonResponse[Int])
}

You can get a router for them as follows:

object MyRouter extends MyEndpoints with play.routing.Endpoints with play.routing.JsonEntities {

  val routes = routesFromEndpoints(
    inc.implementedBy(x => x + 1)
  )

}

Then MyRouter.routes can be used to define a proper Play router as follows:

val router = play.api.routing.Router.from(MyRouter.routes)
Source
Endpoints.scala
Linear Supertypes
Methods, Urls, algebra.Endpoints, algebra.Methods, algebra.Urls, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Endpoints
  2. Methods
  3. Urls
  4. Endpoints
  5. Methods
  6. Urls
  7. AnyRef
  8. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

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

    Permalink
    Definition Classes
    Urls
  2. case class Endpoint[A, B](request: Request[A], response: Response[B]) extends Product with Serializable

    Permalink

    Concrete representation of an Endpoint for routing purpose.

  3. case class EndpointWithHandler[A, B](endpoint: Endpoint[A, B], service: (A) ⇒ Future[B]) extends ToPlayHandler with Product with Serializable

    Permalink

    An endpoint from which we can get a Play request handler.

  4. case class Method(value: String) extends Product with Serializable

    Permalink
    Definition Classes
    Methods
  5. class MuxEndpoint[Req <: MuxRequest, Resp, Transport] extends AnyRef

    Permalink
  6. trait Path[A] extends PathOps[A] with Url[A]

    Permalink
    Definition Classes
    Urls
  7. trait PathOps[A] extends AnyRef

    Permalink
    Definition Classes
    Urls
  8. trait QueryString[A] extends QueryStringOps[A]

    Permalink

    Query string encoding and decoding

    Query string encoding and decoding

    Definition Classes
    Urls
  9. trait QueryStringOps[A] extends AnyRef

    Permalink
    Definition Classes
    Urls
  10. trait QueryStringParam[A] extends AnyRef

    Permalink
    Definition Classes
    Urls
  11. trait Request[A] extends AnyRef

    Permalink

    An HTTP request.

    An HTTP request.

    Has an instance of InvariantFunctor.

  12. type RequestEntity[A] = BodyParser[A]

    Permalink

    Decodes a request entity

    Decodes a request entity

    Definition Classes
    Endpoints → Endpoints
  13. type RequestExtractor[A] = (RequestHeader) ⇒ Option[A]

    Permalink

    Convenient type alias modeling the extraction of an A information from request headers.

    Convenient type alias modeling the extraction of an A information from request headers.

    This type has an instance of Applicative.

    Definition Classes
    Urls
  14. type RequestHeaders[A] = (Headers) ⇒ Either[Result, A]

    Permalink

    An attempt to extract an A from a request headers.

    An attempt to extract an A from a request headers.

    Models failure by returning a Left(result). That makes it possible to early return an HTTP response if a header is wrong (e.g. if an authentication information is missing)

    Definition Classes
    Endpoints → Endpoints
  15. type Response[A] = (A) ⇒ Result

    Permalink

    Turns the A information into a proper Play Result

    Turns the A information into a proper Play Result

    Definition Classes
    Endpoints → Endpoints
  16. trait Segment[A] extends AnyRef

    Permalink

    Defines how to decode and encode path segments

    Defines how to decode and encode path segments

    Definition Classes
    Urls
  17. trait ToPlayHandler extends AnyRef

    Permalink

    Something that can be used as a Play request handler

  18. trait Url[A] extends AnyRef

    Permalink
    Definition Classes
    Urls
  19. trait UrlAndHeaders[A] extends AnyRef

    Permalink

    The URL and HTTP headers of a request.

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def Delete: Method

    Permalink
    Definition Classes
    Methods → Methods
  5. def Get: Method

    Permalink
    Definition Classes
    Methods → Methods
  6. def Post: Method

    Permalink
    Definition Classes
    Methods → Methods
  7. def Put: Method

    Permalink
    Definition Classes
    Methods → Methods
  8. implicit lazy val applicativeRequestExtractor: Applicative[RequestExtractor]

    Permalink
    Definition Classes
    Urls
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def chainPaths[A, B](first: Path[A], second: Path[B])(implicit tupler: Tupler[A, B]): Path[Out]

    Permalink
    Definition Classes
    Urls → Urls
  11. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  12. def combineQueryStrings[A, B](first: QueryString[A], second: QueryString[B])(implicit tupler: Tupler[A, B]): QueryString[Out]

    Permalink
    Definition Classes
    Urls → Urls
  13. lazy val emptyHeaders: RequestHeaders[Unit]

    Permalink

    Always succeeds in extracting no information from the headers

    Always succeeds in extracting no information from the headers

    Definition Classes
    Endpoints → Endpoints
  14. lazy val emptyRequest: BodyParser[Unit]

    Permalink
    Definition Classes
    Endpoints → Endpoints
  15. lazy val emptyResponse: Response[Unit]

    Permalink

    A successful HTTP response (status code 200) with no entity

    A successful HTTP response (status code 200) with no entity

    Definition Classes
    Endpoints → Endpoints
  16. def endpoint[A, B](request: Request[A], response: Response[B]): Endpoint[A, B]

    Permalink
    Definition Classes
    Endpoints → Endpoints
  17. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. implicit lazy val functorRequestExtractor: Functor[RequestExtractor]

    Permalink
    Definition Classes
    Urls
  21. final def get[A, B](url: Url[A], headers: RequestHeaders[B])(implicit tuplerAC: Tupler[A, B]): Request[Out]

    Permalink
    Definition Classes
    Endpoints
  22. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. lazy val htmlResponse: Response[Html]

    Permalink

    A successful HTTP response (status code 200) with an HTML entity

  25. implicit def intQueryString: QueryStringParam[Int]

    Permalink
    Definition Classes
    Urls → Urls
  26. implicit def intSegment: Segment[Int]

    Permalink
    Definition Classes
    Urls → Urls
  27. implicit lazy val invariantFunctorRequest: InvariantFunctor[Request]

    Permalink
  28. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  29. implicit def longQueryString: QueryStringParam[Long]

    Permalink
    Definition Classes
    Urls → Urls
  30. implicit def longSegment: Segment[Long]

    Permalink
    Definition Classes
    Urls → Urls
  31. def muxEndpoint[Req <: MuxRequest, Resp, Transport](request: Request[Transport], response: (Transport) ⇒ Result): MuxEndpoint[Req, Resp, Transport]

    Permalink
    Definition Classes
    Endpoints → Endpoints
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. def optQs[A](name: String)(implicit value: QueryStringParam[A]): QueryString[Option[A]]

    Permalink
    Definition Classes
    Urls → Urls
  36. val path: Path[Unit]

    Permalink
    Definition Classes
    Urls
  37. final def post[A, B, C, AB](url: Url[A], entity: RequestEntity[B], headers: RequestHeaders[C])(implicit tuplerAB: Tupler.Aux[A, B, AB], tuplerABC: Tupler[AB, C]): Request[Out]

    Permalink
    Definition Classes
    Endpoints
  38. def qs[A](name: String)(implicit value: QueryStringParam[A]): QueryString[A]

    Permalink
    Definition Classes
    Urls → Urls
  39. def request[A, B, C, AB](method: Method, url: Url[A], entity: RequestEntity[B], headers: RequestHeaders[C])(implicit tuplerAB: Tupler.Aux[A, B, AB], tuplerABC: Tupler[AB, C]): Request[Out]

    Permalink

    Decodes a request that uses the POST HTTP verb.

    Decodes a request that uses the POST HTTP verb.

    url

    Request URL

    entity

    Request entity

    headers

    Request headers

    Definition Classes
    Endpoints → Endpoints
  40. def routesFromEndpoints(endpoints: ToPlayHandler*): PartialFunction[RequestHeader, Handler]

    Permalink

    Builds a Play router out of endpoint definitions.

    Builds a Play router out of endpoint definitions.

    val routes = routesFromEndpoints(
      inc.implementedBy(x => x + 1)
    )
  41. def segment[A](implicit A: Segment[A]): Path[A]

    Permalink
    Definition Classes
    Urls → Urls
  42. def staticPathSegment(segment: String): Path[Unit]

    Permalink
    Definition Classes
    Urls → Urls
  43. implicit def stringQueryString: QueryStringParam[String]

    Permalink
    Definition Classes
    Urls → Urls
  44. implicit def stringSegment: Segment[String]

    Permalink
    Definition Classes
    Urls → Urls
  45. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  46. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  47. def urlWithQueryString[A, B](path: Path[A], qs: QueryString[B])(implicit tupler: Tupler[A, B]): Url[Out]

    Permalink
    Definition Classes
    Urls → Urls
  48. val utf8Name: String

    Permalink
    Definition Classes
    Urls
  49. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  50. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  51. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Methods

Inherited from Urls

Inherited from algebra.Endpoints

Inherited from algebra.Methods

Inherited from algebra.Urls

Inherited from AnyRef

Inherited from Any

Ungrouped