sbt-graphql.GetDisplayProperties.scala Maven / Gradle / Ivy
package graphql.codegen
import java.util.UUID
import java.time.ZonedDateTime
import java.time.LocalDateTime
import io.circe.{ Decoder, Encoder }
import io.circe.generic.semiauto.{ deriveDecoder, deriveEncoder }
import sangria.macros._
import types._
object GetDisplayProperties {
object displayProperties extends GraphQLQuery {
val document: sangria.ast.Document = graphql"""query displayProperties($$consignmentId: UUID!) {
displayProperties(consignmentid: $$consignmentId) {
propertyName
attributes {
attribute
value
type
}
}
}"""
case class Variables(consignmentId: UUID)
object Variables { implicit val jsonEncoder: Encoder[Variables] = deriveEncoder[Variables] }
case class Data(displayProperties: List[DisplayProperties])
object Data { implicit val jsonDecoder: Decoder[Data] = deriveDecoder[Data] }
case class DisplayProperties(propertyName: String, attributes: List[DisplayProperties.Attributes])
object DisplayProperties {
implicit val jsonDecoder: Decoder[DisplayProperties] = deriveDecoder[DisplayProperties]
implicit val jsonEncoder: Encoder[DisplayProperties] = deriveEncoder[DisplayProperties]
case class Attributes(attribute: String, value: Option[String], `type`: DataType)
object Attributes {
implicit val jsonDecoder: Decoder[Attributes] = deriveDecoder[Attributes]
implicit val jsonEncoder: Encoder[Attributes] = deriveEncoder[Attributes]
}
}
}
}