Hi,
We are building multiples End-Points in lagom with equivalent query parameters, which we use to filtering.
It is boring to put every filter parameter on every End-Point all the time
def getStuff(offset:Option[Int], limit:Option[Int],
status:Option[List[Status.Value]],
id:Option[String],
createdOnFrom:Option[LocalDateTime], createdOnTo:Option[LocalDateTime],
modifiedOnFrom:Option[LocalDateTime], modifiedOnTo:Option[LocalDateTime]
):ServiceCall[NotUsed, DataList[Stuff]]
override def descriptor: Descriptor =
named("roast-order").withCalls(
restCall(Method.GET, "/api/stuff?offset&limit&status&id&createdOnFrom&createdOnTo&modifiedOnFrom&modifiedOnTo", getStuff _),
)
I would like to have something like this:
case class Filters(offset:Option[Int], limit:Option[Int],
status:Option[List[Status.Value]],
id:Option[String],
createdOnFrom:Option[LocalDateTime], createdOnTo:Option[LocalDateTime],
modifiedOnFrom:Option[LocalDateTime], modifiedOnTo:Option[LocalDateTime])
def getStuff(filters:Filters):ServiceCall[NotUsed, DataList[Stuff]]
So that I could use the class Filter in the multiple End-Points
But I see some problems:
- How could we map the query parameters name in the restCall ?
Perhaps it could use the field name as query parameter name… - The interface ‘PathParamSerializer’ only serialize values from one query parameter,
I cant just implement aPathParamSerializer[Filters]
since that needs to be related with one query parameter
I would love to implement it and do a Pull request, since I never done it before if someone could help I would be grateful