I would like to create a custom decoder for AWS API Gateway using circe-core
. I have the following code:
case class APIGatewayInput(body:Result[Body], queryParams: Map[String,String], pathParams: Map[String,String])
object ApiGatewayInput {
implicit val decodeApiGatewayInput = Decoder.instance { c =>
val body:Result[Body] = c.get[Body]("body")
val queryParams = c.field("queryStringParameters").as[Map[String,String]](decoder???)
APIGatewayInput(body, queryParams, similarForPathParams)
}
}
I know that Result
has methods to parse data to Map[K,V]
and as
requires a Decoder
(which is a little confusing) and I can convert it to a Map[String, String]
How can I use the API to convert to an existing scala collection type with the HCursor
instead of a custom type.