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

scala.googleapis.storage.Channel.scala Maven / Gradle / Ivy

The newest version!
package googleapis.storage

import JsonInstances._
import io.circe._
import io.circe.syntax._
import scala.concurrent.duration.FiniteDuration

final case class Channel(
    /** An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
      */
    resourceId: Option[String] = None,
    /** A Boolean value to indicate whether payload is wanted. Optional.
      */
    payload: Option[Boolean] = None,
    /** Additional parameters controlling delivery channel behavior. Optional.
      */
    params: Option[Map[String, String]] = None,
    /** A UUID or similar unique string that identifies this channel.
      */
    id: Option[String] = None,
    /** An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
      */
    token: Option[String] = None,
    /** A version-specific identifier for the watched resource.
      */
    resourceUri: Option[String] = None,
    /** The address where notifications are delivered for this channel.
      */
    address: Option[String] = None,
    /** Identifies this as a notification channel used to watch for changes to a resource, which is "api#channel".
      */
    kind: Option[String] = None,
    /** The type of delivery mechanism used for this channel.
      */
    `type`: Option[String] = None,
    /** Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
      */
    expiration: Option[FiniteDuration] = None,
)
object Channel {
  implicit val encoder: Encoder[Channel] = Encoder.instance { x =>
    Json.obj(
      "resourceId" := x.resourceId,
      "payload" := x.payload,
      "params" := x.params,
      "id" := x.id,
      "token" := x.token,
      "resourceUri" := x.resourceUri,
      "address" := x.address,
      "kind" := x.kind,
      "type" := x.`type`,
      "expiration"
        := x.expiration,
    )
  }
  implicit val decoder: Decoder[Channel] = Decoder.instance { c =>
    for {
      v0 <- c.get[Option[String]]("resourceId")
      v1 <- c.get[Option[Boolean]]("payload")
      v2 <- c.get[Option[Map[String, String]]]("params")
      v3 <- c.get[Option[String]]("id")
      v4 <- c.get[Option[String]]("token")
      v5 <- c.get[Option[String]]("resourceUri")
      v6 <- c.get[Option[String]]("address")
      v7 <- c.get[Option[String]]("kind")
      v8 <- c.get[Option[String]]("type")
      v9 <- c.get[Option[FiniteDuration]]("expiration")
    } yield Channel(v0, v1, v2, v3, v4, v5, v6, v7, v8, v9)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy