scala.googleapis.storage.JsonInstances.scala Maven / Gradle / Ivy
The newest version!
package googleapis.storage
import io.circe._
import scala.concurrent.duration._
import scodec.bits._
private[storage] object JsonInstances {
implicit val durationEncoder: Encoder[FiniteDuration] = Encoder[Long].contramap(_.toMillis)
implicit val durationDecoder: Decoder[FiniteDuration] = Decoder[Long].map(_.millis)
implicit val byteVectorEncoder: Encoder[ByteVector] = Encoder[String].contramap(_.toBase64)
implicit val byteVectorDecoder: Decoder[ByteVector] =
Decoder[String].emap(bv => ByteVector.fromBase64Descriptive(bv))
}