1 /*
2  *  Make.org Core API
3  *  Copyright (C) 2018 Make.org
4  *
5  * This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU Affero General Public License as
7  *  published by the Free Software Foundation, either version 3 of the
8  *  License, or (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU Affero General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Affero General Public License
16  *  along with this program.  If not, see <https://www.gnu.org/licenses/>.
17  *
18  */
19 
20 package org.make.api.technical
21 
22 import io.circe.{Decoder, Encoder}
23 import io.circe.generic.semiauto.{deriveDecoder, deriveEncoder}
24 import io.swagger.annotations.ApiModelProperty
25 import org.make.core.StringValue
26 
27 import scala.annotation.meta.field
28 
29 final case class IdResponse(
30   @(ApiModelProperty @field)(dataType = "string", example = "11111111-2222-3333-4444-555555555555")
31   id: String
32 )
33 
34 object IdResponse {
35   def apply[T <: StringValue](id: T): IdResponse = IdResponse(id = id.value)
36 
37   implicit val encoder: Encoder[IdResponse] = deriveEncoder[IdResponse]
38   implicit val decoder: Decoder[IdResponse] = deriveDecoder[IdResponse]
39 }
Line Stmt Id Pos Tree Symbol Tests Code
35 42161 1225 - 1233 Select org.make.core.StringValue.value id.value
35 38274 1209 - 1234 Apply org.make.api.technical.IdResponse.apply IdResponse.apply(id.value)
37 50767 1282 - 1307 ApplyToImplicitArgs io.circe.generic.semiauto.deriveEncoder io.circe.generic.semiauto.deriveEncoder[org.make.api.technical.IdResponse]({ val inst$macro$8: io.circe.generic.encoding.DerivedAsObjectEncoder[org.make.api.technical.IdResponse] = { final class anon$lazy$macro$7 extends AnyRef with Serializable { def <init>(): anon$lazy$macro$7 = { anon$lazy$macro$7.super.<init>(); () }; <stable> <accessor> lazy val inst$macro$1: io.circe.generic.encoding.DerivedAsObjectEncoder[org.make.api.technical.IdResponse] = encoding.this.DerivedAsObjectEncoder.deriveEncoder[org.make.api.technical.IdResponse, shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out](shapeless.this.LabelledGeneric.materializeProduct[org.make.api.technical.IdResponse, (Symbol @@ String("id")) :: shapeless.HNil, String :: shapeless.HNil, shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out](DefaultSymbolicLabelling.instance[org.make.api.technical.IdResponse, (Symbol @@ String("id")) :: shapeless.HNil](::.apply[Symbol @@ String("id"), shapeless.HNil.type](scala.Symbol.apply("id").asInstanceOf[Symbol @@ String("id")], HNil)), Generic.instance[org.make.api.technical.IdResponse, String :: shapeless.HNil](((x0$3: org.make.api.technical.IdResponse) => x0$3 match { case (id: String): org.make.api.technical.IdResponse((id$macro$5 @ _)) => ::.apply[String, shapeless.HNil.type](id$macro$5, HNil).asInstanceOf[String :: shapeless.HNil] }), ((x0$4: String :: shapeless.HNil) => x0$4 match { case (head: String, tail: shapeless.HNil): String :: shapeless.HNil((id$macro$4 @ _), HNil) => technical.this.IdResponse.apply(id$macro$4) })), hlist.this.ZipWithKeys.hconsZipWithKeys[Symbol @@ String("id"), String, shapeless.HNil, shapeless.HNil, shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out](hlist.this.ZipWithKeys.hnilZipWithKeys, Witness.mkWitness[Symbol with shapeless.tag.Tagged[String("id")]](scala.Symbol.apply("id").asInstanceOf[Symbol @@ String("id")].asInstanceOf[Symbol with shapeless.tag.Tagged[String("id")]])), scala.this.<:<.refl[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]), shapeless.Lazy.apply[io.circe.generic.encoding.ReprAsObjectEncoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]](anon$lazy$macro$7.this.inst$macro$6)).asInstanceOf[io.circe.generic.encoding.DerivedAsObjectEncoder[org.make.api.technical.IdResponse]]; <stable> <accessor> lazy val inst$macro$6: io.circe.generic.encoding.ReprAsObjectEncoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out] = ({ final class $anon extends io.circe.generic.encoding.ReprAsObjectEncoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out] { def <init>(): <$anon: io.circe.generic.encoding.ReprAsObjectEncoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]> = { $anon.super.<init>(); () }; private[this] val circeGenericEncoderForid: io.circe.Encoder[String] = circe.this.Encoder.encodeString; final def encodeObject(a: shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out): io.circe.JsonObject = a match { case (head: shapeless.labelled.FieldType[Symbol @@ String("id"),String], tail: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out): shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out((circeGenericHListBindingForid @ _), shapeless.HNil) => io.circe.JsonObject.fromIterable(scala.collection.immutable.Vector.apply[(String, io.circe.Json)](scala.Tuple2.apply[String, io.circe.Json]("id", $anon.this.circeGenericEncoderForid.apply(circeGenericHListBindingForid)))) } }; new $anon() }: io.circe.generic.encoding.ReprAsObjectEncoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]).asInstanceOf[io.circe.generic.encoding.ReprAsObjectEncoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]] }; new anon$lazy$macro$7().inst$macro$1 }; shapeless.Lazy.apply[io.circe.generic.encoding.DerivedAsObjectEncoder[org.make.api.technical.IdResponse]](inst$macro$8) })
38 43181 1354 - 1379 ApplyToImplicitArgs io.circe.generic.semiauto.deriveDecoder io.circe.generic.semiauto.deriveDecoder[org.make.api.technical.IdResponse]({ val inst$macro$16: io.circe.generic.decoding.DerivedDecoder[org.make.api.technical.IdResponse] = { final class anon$lazy$macro$15 extends AnyRef with Serializable { def <init>(): anon$lazy$macro$15 = { anon$lazy$macro$15.super.<init>(); () }; <stable> <accessor> lazy val inst$macro$9: io.circe.generic.decoding.DerivedDecoder[org.make.api.technical.IdResponse] = decoding.this.DerivedDecoder.deriveDecoder[org.make.api.technical.IdResponse, shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out](shapeless.this.LabelledGeneric.materializeProduct[org.make.api.technical.IdResponse, (Symbol @@ String("id")) :: shapeless.HNil, String :: shapeless.HNil, shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out](DefaultSymbolicLabelling.instance[org.make.api.technical.IdResponse, (Symbol @@ String("id")) :: shapeless.HNil](::.apply[Symbol @@ String("id"), shapeless.HNil.type](scala.Symbol.apply("id").asInstanceOf[Symbol @@ String("id")], HNil)), Generic.instance[org.make.api.technical.IdResponse, String :: shapeless.HNil](((x0$7: org.make.api.technical.IdResponse) => x0$7 match { case (id: String): org.make.api.technical.IdResponse((id$macro$13 @ _)) => ::.apply[String, shapeless.HNil.type](id$macro$13, HNil).asInstanceOf[String :: shapeless.HNil] }), ((x0$8: String :: shapeless.HNil) => x0$8 match { case (head: String, tail: shapeless.HNil): String :: shapeless.HNil((id$macro$12 @ _), HNil) => technical.this.IdResponse.apply(id$macro$12) })), hlist.this.ZipWithKeys.hconsZipWithKeys[Symbol @@ String("id"), String, shapeless.HNil, shapeless.HNil, shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out](hlist.this.ZipWithKeys.hnilZipWithKeys, Witness.mkWitness[Symbol with shapeless.tag.Tagged[String("id")]](scala.Symbol.apply("id").asInstanceOf[Symbol @@ String("id")].asInstanceOf[Symbol with shapeless.tag.Tagged[String("id")]])), scala.this.<:<.refl[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]), shapeless.Lazy.apply[io.circe.generic.decoding.ReprDecoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]](anon$lazy$macro$15.this.inst$macro$14)).asInstanceOf[io.circe.generic.decoding.DerivedDecoder[org.make.api.technical.IdResponse]]; <stable> <accessor> lazy val inst$macro$14: io.circe.generic.decoding.ReprDecoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out] = ({ final class $anon extends io.circe.generic.decoding.ReprDecoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out] { def <init>(): <$anon: io.circe.generic.decoding.ReprDecoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]> = { $anon.super.<init>(); () }; private[this] val circeGenericDecoderForid: io.circe.Decoder[String] = circe.this.Decoder.decodeString; final def apply(c: io.circe.HCursor): io.circe.Decoder.Result[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out] = ReprDecoder.consResults[io.circe.Decoder.Result, Symbol @@ String("id"), String, shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]($anon.this.circeGenericDecoderForid.tryDecode(c.downField("id")), ReprDecoder.hnilResult)(io.circe.Decoder.resultInstance); final override def decodeAccumulating(c: io.circe.HCursor): io.circe.Decoder.AccumulatingResult[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out] = ReprDecoder.consResults[io.circe.Decoder.AccumulatingResult, Symbol @@ String("id"), String, shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]($anon.this.circeGenericDecoderForid.tryDecodeAccumulating(c.downField("id")), ReprDecoder.hnilResultAccumulating)(io.circe.Decoder.accumulatingResultInstance) }; new $anon() }: io.circe.generic.decoding.ReprDecoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]).asInstanceOf[io.circe.generic.decoding.ReprDecoder[shapeless.labelled.FieldType[Symbol @@ String("id"),String] :: shapeless.ops.hlist.ZipWithKeys.hnilZipWithKeys.Out]] }; new anon$lazy$macro$15().inst$macro$9 }; shapeless.Lazy.apply[io.circe.generic.decoding.DerivedDecoder[org.make.api.technical.IdResponse]](inst$macro$16) })