- Companion:
- object
Value members
Abstract methods
Generate a map of parameters representing the argument q
.
Generate a map of parameters representing the argument q
.
matchParams
and createParams
should be (functional) inverse of each other. That is,
this.matchParams(this.createParams(q)) == Right(ParamMathOutput(q, Map()))
(this property is called
"LeftInverse" in the tests)
Tries to match the map of urldsl.vocabulary.Params to create an instance of Q
.
If it can not, it returns an error indicating the reason of the failure.
If it could, it returns the value of Q
, as well as the list of unused parameters.
Tries to match the map of urldsl.vocabulary.Params to create an instance of Q
.
If it can not, it returns an error indicating the reason of the failure.
If it could, it returns the value of Q
, as well as the list of unused parameters.
- Value parameters:
- params
The map of urldsl.vocabulary.Param to match this path segment again.
- Returns:
The "de-serialized" element with unused parameters, if successful.
- Example:
For example, if you try to match a param "name" as String and "age" as Int, calling matchParams on Map("name" -> Param(List("Alice")), "age" -> Param(List("24"), "year" -> Param(List("2020"))) will return Right(ParamMatchOutput(("Alice", 24), Map("year" -> Param(List("2020")))
Concrete methods
Adds that
QueryParameters to this
one, "tupling" the returned type with the implicit urldsl.language.Tupler
Adds that
QueryParameters to this
one, "tupling" the returned type with the implicit urldsl.language.Tupler
The matching and writing of strings is functionally commutative under &
, but the returned type Q
is not. So,
if you have two parameters, one matching an Int and the other one a String, depending on the order in which &
is
called, you can end up with "Q = (Int, String)" or "Q = (String, Int)". This property is called
"QuasiCommutativity" in the tests.
When these query parameters return an error, transform it to None instead.
When these query parameters return an error, transform it to None instead.
This should be used to represent (possibly) missing parameters.
Casts this QueryParameters to the new type R. Note that the urldsl.vocabulary.Codec must be an exception-free bijection between Q and R.
Casts this QueryParameters to the new type R. Note that the urldsl.vocabulary.Codec must be an exception-free bijection between Q and R.
Generates a Map of parameters representing the argument q
. The keys are not encoded, but the values are lists of
encoded strings.
Generates a Map of parameters representing the argument q
. The keys are not encoded, but the values are lists of
encoded strings.
Generates the query string representing the argument q
. This String can be used to be part of a URL.
Generates the query string representing the argument q
. This String can be used to be part of a URL.
Takes an instance of T and generate the part of the URL contained in this T
Takes an instance of T and generate the part of the URL contained in this T
Adds an extra satisfying criteria to the output of this QueryParameters.
If the output satisfies the given predicate
, then it is left unchanged. Otherwise, it returns the given
error
.
Adds an extra satisfying criteria to the output of this QueryParameters.
If the output satisfies the given predicate
, then it is left unchanged. Otherwise, it returns the given
error
.
Note that it doesn't check that arguments given to createParams
satisfy this predicate
// todo[behaviour]: should that change?
- Value parameters:
- error
the generated error in case it does not satisfy it
- predicate
the additional predicate that the output must satisfy
- Returns:
a new QueryParameters instance with the same types
- Example:
param[Int]("age").filter(_ >= 0, (params: Map[String, Param]) => someError(params))
Sugar for when A =:= DummyError
.
Sugar for when A =:= DummyError
.
Associates this QueryParameters with the given Fragment in order to match raw urls satisfying both conditions, and returning the outputs from both.
Associates this QueryParameters with the given Fragment in order to match raw urls satisfying both conditions, and returning the outputs from both.
The path part of the url will be ignored (and will return Unit).