trait Urls extends PartialInvariantFunctorSyntax
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"))
- Source
- Urls.scala
- Alphabetic
- By Inheritance
- Urls
- PartialInvariantFunctorSyntax
- InvariantFunctorSyntax
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
implicit
class
InvariantFunctorSyntax[A, F[_]] extends AnyRef
- Definition Classes
- InvariantFunctorSyntax
-
implicit
class
PartialInvariantFunctorSyntax[A, F[_]] extends AnyRef
- Definition Classes
- PartialInvariantFunctorSyntax
-
abstract
type
Path[A] <: Url[A]
An URL path carrying an
AinformationAn URL path carrying an
Ainformation- Note
This type has implicit methods provided by the PathOps, InvariantFunctorSyntax, and the PartialInvariantFunctorSyntax classes.
-
implicit
class
PathOps[A] extends AnyRef
Convenient methods for Paths.
-
abstract
type
QueryString[A]
A query string carrying an
AinformationA query string carrying an
AinformationQueryString values can be created with the qs operation, and can be combined with the
&operation:val queryPageAndLang: QueryString[(Int, Option[String])] = qs[Int]("page") & qs[Option[String]]("lang")
- Note
This type has implicit methods provided by the QueryStringSyntax, InvariantFunctorSyntax, and the PartialInvariantFunctorSyntax classes.
-
abstract
type
QueryStringParam[A]
A query string parameter codec for type
A.A query string parameter codec for type
A.- Note
This type has implicit methods provided by the PartialInvariantFunctorSyntax and the InvariantFunctorSyntax classes.
-
implicit
class
QueryStringSyntax[A] extends AnyRef
Extension methods on QueryString.
-
abstract
type
Segment[A]
An URL path segment codec for type
A.An URL path segment codec for type
A.- Note
This type has implicit methods provided by the PartialInvariantFunctorSyntax and the InvariantFunctorSyntax classes.
-
abstract
type
Url[A]
An URL carrying an
AinformationAn URL carrying an
Ainformation- Note
This type has implicit methods provided by the PartialInvariantFunctorSyntax and InvariantFunctorSyntax classes.
Abstract Value Members
-
abstract
def
chainPaths[A, B](first: Path[A], second: Path[B])(implicit tupler: Tupler[A, B]): Path[Out]
Chains the two paths
-
abstract
def
combineQueryStrings[A, B](first: QueryString[A], second: QueryString[B])(implicit tupler: Tupler[A, B]): QueryString[Out]
Concatenates two
QueryStrings -
implicit abstract
def
optionalQueryStringParam[A](implicit arg0: QueryStringParam[A]): QueryStringParam[Option[A]]
Make a query string parameter optional:
Make a query string parameter optional:
path / "articles" /? qs[Option[Int]]("page")
Client interpreters must omit optional query string parameters that are empty. Server interpreters must accept incoming requests whose optional query string parameters are missing. Server interpreters must report a failure for incoming requests whose optional query string parameters are present, but malformed.
-
implicit abstract
def
pathPartialInvariantFunctor: PartialInvariantFunctor[Path]
Provides
xmapandxmapPartialoperations.Provides
xmapandxmapPartialoperations.- See also
-
abstract
def
qs[A](name: String, docs: Documentation = None)(implicit value: QueryStringParam[A]): QueryString[A]
Builds a
QueryStringwith one parameter.Builds a
QueryStringwith one parameter.Examples:
qs[Int]("page") // mandatory `page` parameter qs[Option[String]]("lang") // optional `lang` parameter qs[List[Long]]("id") // repeated `id` parameter
- A
Type of the value carried by the parameter
- name
Parameter’s name
-
implicit abstract
def
queryStringParamPartialInvFunctor: PartialInvariantFunctor[QueryStringParam]
Provides
xmapandxmapPartialoperations.Provides
xmapandxmapPartialoperations.- See also
-
implicit abstract
def
queryStringPartialInvFunctor: PartialInvariantFunctor[QueryString]
Provides
xmapandxmapPartialoperations.Provides
xmapandxmapPartialoperations.- See also
-
abstract
def
remainingSegments(name: String = "", docs: Documentation = None): Path[String]
The remaining segments of the path.
The remaining segments of the path. The
Stringvalue carried by thisPathis still URL-encoded. -
implicit abstract
def
repeatedQueryStringParam[A, CC[X] <: Iterable[X]](implicit arg0: QueryStringParam[A], factory: scala.collection.compat.Factory[A, CC[A]]): QueryStringParam[CC[A]]
Support query string parameters with multiple values:
Support query string parameters with multiple values:
path / "articles" /? qs[List[Long]]("id")
Server interpreters must accept incoming requests where such parameters are missing (in such a case, its value is an empty collection), and report a failure if at least one value is malformed.
-
abstract
def
segment[A](name: String = "", docs: Documentation = None)(implicit s: Segment[A]): Path[A]
A path segment carrying an
Ainformation -
implicit abstract
def
segmentPartialInvFunctor: PartialInvariantFunctor[Segment]
Provides
xmapandxmapPartialoperations.Provides
xmapandxmapPartialoperations.- See also
-
abstract
def
staticPathSegment(segment: String): Path[Unit]
A path segment whose value is the given
segment -
implicit abstract
def
stringQueryString: QueryStringParam[String]
Ability to define
Stringquery string parameters -
implicit abstract
def
stringSegment: Segment[String]
Ability to define
Stringpath segments Servers should return an URL-decoded string value, and clients should take an URL-decoded string value. -
implicit abstract
def
urlPartialInvFunctor: PartialInvariantFunctor[Url]
Provides
xmapandxmapPartialoperationsProvides
xmapandxmapPartialoperations- See also
-
abstract
def
urlWithQueryString[A, B](path: Path[A], qs: QueryString[B])(implicit tupler: Tupler[A, B]): Url[Out]
Builds an URL from the given path and query string
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
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
implicit
def
booleanQueryString: QueryStringParam[Boolean]
Query string parameter containing a
Booleanvalue -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
implicit
def
doubleQueryString: QueryStringParam[Double]
Codec for query string parameters of type
Double -
implicit
def
doubleSegment: Segment[Double]
Segment codec for type
Double -
implicit
def
dummyPathToUrl[A](p: Path[A]): Url[A]
Implicit conversion to get rid of intellij errors when defining paths.
Implicit conversion to get rid of intellij errors when defining paths. Effectively should not be called.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
implicit
def
intQueryString: QueryStringParam[Int]
Ability to define
Intquery string parameters -
implicit
def
intSegment: Segment[Int]
Ability to define
Intpath segments -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
implicit
def
longQueryString: QueryStringParam[Long]
Query string parameter containing a
Longvalue -
implicit
def
longSegment: Segment[Long]
Segment containing a
Longvalue -
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
path: Path[Unit]
An empty path.
An empty path.
Useful to begin a path definition:
path / "foo" / segment[Int] /? qs[String]("bar")
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
- def tryParseString[A](type: String)(parse: (String) ⇒ A): (String) ⇒ Validated[A]
-
implicit
def
uuidQueryString: QueryStringParam[UUID]
Ability to define
UUIDquery string parameters -
implicit
def
uuidSegment: Segment[UUID]
Ability to define
UUIDpath segments -
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
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()
Inherited from endpoints.PartialInvariantFunctorSyntax
Inherited from endpoints.InvariantFunctorSyntax
Inherited from AnyRef
Inherited from Any
Types
Types introduced by the algebra
Operations
Operations creating and transforming values