From 7ecbed03ad5d466719cb51ba90e23d8f98b2c2c2 Mon Sep 17 00:00:00 2001 From: Renam Philippi Antunes Date: Fri, 26 Apr 2024 11:15:06 -0300 Subject: [PATCH 1/2] Adds an object for the uid of the user object --- .../kotlin/com/adsbynimbus/openrtb/request/User.kt | 10 +++++++++- .../DeserializationTest.kt | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt b/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt index 1437c9a..8240006 100644 --- a/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt +++ b/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt @@ -70,9 +70,17 @@ public class User( @Serializable public class EID( @JvmField @SerialName("source") public val source: String, - @JvmField @SerialName("uids") public var uids: Set, + @JvmField @SerialName("uids") public var uids: Set, ) { override fun equals(other: Any?): Boolean = other is EID && other.source == source override fun hashCode(): Int = source.hashCode() } + +/** Object representing the extended ID UID */ +@Serializable +public class UID( + @JvmField @SerialName("id") public var id: String, + @JvmField @SerialName("atype") public var atype: Int? = null, + @JvmField @SerialName("ext") public var ext: Map = mutableMapOf() +) diff --git a/kotlin/src/commonTest/kotlin/com.adsbynimbus.openrtb.request/DeserializationTest.kt b/kotlin/src/commonTest/kotlin/com.adsbynimbus.openrtb.request/DeserializationTest.kt index a24b4ec..3d1e9d6 100644 --- a/kotlin/src/commonTest/kotlin/com.adsbynimbus.openrtb.request/DeserializationTest.kt +++ b/kotlin/src/commonTest/kotlin/com.adsbynimbus.openrtb.request/DeserializationTest.kt @@ -160,6 +160,7 @@ const val testJson = """ "uids": [ { "id": "6bca7f6b-a98a-46c0-be05-6020f7604598", + "atype": 1, "ext": { "rtiPartner": "TDID" } @@ -246,6 +247,7 @@ class DeserializationTest : StringSpec({ val eid2 = first { it.source == "adserver.org" }.uids.first() eid2.id shouldBe "6bca7f6b-a98a-46c0-be05-6020f7604598" + eid2.atype shouldBe 1 eid2.ext.shouldContain("rtiPartner", "TDID") } } From f908ef5f20d6bec9dcbe1a26a015041d2bd422b7 Mon Sep 17 00:00:00 2001 From: Renam Philippi Antunes Date: Fri, 26 Apr 2024 11:26:10 -0300 Subject: [PATCH 2/2] makes atype not nullable --- .../commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt b/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt index 8240006..2ebd667 100644 --- a/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt +++ b/kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt @@ -81,6 +81,6 @@ public class EID( @Serializable public class UID( @JvmField @SerialName("id") public var id: String, - @JvmField @SerialName("atype") public var atype: Int? = null, + @JvmField @SerialName("atype") public var atype: Int = 0, @JvmField @SerialName("ext") public var ext: Map = mutableMapOf() )