All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy