LiveParamsCodec
trait LiveParamsCodec[PathParams, Params] extends LiveParamsDecoder[PathParams, Params]Bidirectionally maps route path/query values and typed routed parameters.
Decoding supplies Params to Routed. Encoding produces the path and query values
used to construct a checked LiveLocation, so codecs should obey a round-trip law for every
parameter value accepted by the application.
Type parameters
PathParamsthe values decoded and encoded by the route's path codec
Paramsthe application-facing routed parameter type
Defined by scalive.LiveParamsCodec. View source (scalive/api/src/scalive/LiveParamsCodec.scala:65-96)
Methods2
encode
def encode(params: Params): Either[LiveLocation.EncodeError, LiveParamsCodec.Encoded[PathParams]]Encodes typed parameters into the route's path and query portions.
Parameters
paramsthe parameters to encode
Returns
- Returns
encoded path/query values, or a location encoding error
Defined by scalive.LiveParamsCodec.encode. View source (scalive/api/src/scalive/LiveParamsCodec.scala:73-75)
imap
def imap[Params2](decodeParams: Params => Params2)(encodeParams: Params2 => Params): LiveParamsCodec[PathParams, Params2]Invariantly maps this codec to an application-facing parameter type.
Parameters
decodeParamsmaps decoded base parameters to the new type; thrown exceptions become effect defects
encodeParamsmaps the new type back before encoding; thrown exceptions escape the checked encoding API
Returns
- Returns
a bidirectional codec for
Params2
Defined by scalive.LiveParamsCodec.imap. View source (scalive/api/src/scalive/LiveParamsCodec.scala:86-95)