com.cognite.sdk.scala.v1.fdm.common.Usage.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cognite-sdk-scala_2.13 Show documentation
Show all versions of cognite-sdk-scala_2.13 Show documentation
Scala SDK for Cognite Data Fusion.
The newest version!
// Copyright 2020 Cognite AS
// SPDX-License-Identifier: Apache-2.0
package com.cognite.sdk.scala.v1.fdm.common
import io.circe.{Decoder, Encoder}
import java.util.Locale
sealed abstract class Usage extends Product with Serializable
object Usage {
case object Node extends Usage
case object Edge extends Usage
case object All extends Usage
implicit val containerUsageEncoder: Encoder[Usage] =
Encoder.instance[Usage](p => io.circe.Json.fromString(p.productPrefix.toLowerCase(Locale.US)))
implicit val containerUsageDecoder: Decoder[Usage] =
Decoder[String].emap {
case "node" => Right(Node)
case "edge" => Right(Edge)
case "all" => Right(All)
case other => Left(s"Invalid Container Usage: $other")
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy