Skip to content

Commit 2883f9a

Browse files
author
Renam Philippi Antunes
authored
Adds an object for the uid of the user object (#153)
* Adds an object for the uid of the user object
1 parent 1ca042e commit 2883f9a

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

kotlin/src/commonMain/kotlin/com/adsbynimbus/openrtb/request/User.kt

+9-1
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,17 @@ public class User(
7070
@Serializable
7171
public class EID(
7272
@JvmField @SerialName("source") public val source: String,
73-
@JvmField @SerialName("uids") public var uids: Set<Segment>,
73+
@JvmField @SerialName("uids") public var uids: Set<UID>,
7474
) {
7575
override fun equals(other: Any?): Boolean = other is EID && other.source == source
7676

7777
override fun hashCode(): Int = source.hashCode()
7878
}
79+
80+
/** Object representing the extended ID UID */
81+
@Serializable
82+
public class UID(
83+
@JvmField @SerialName("id") public var id: String,
84+
@JvmField @SerialName("atype") public var atype: Int = 0,
85+
@JvmField @SerialName("ext") public var ext: Map<String, String> = mutableMapOf()
86+
)

kotlin/src/commonTest/kotlin/com.adsbynimbus.openrtb.request/DeserializationTest.kt

+2
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ const val testJson = """
160160
"uids": [
161161
{
162162
"id": "6bca7f6b-a98a-46c0-be05-6020f7604598",
163+
"atype": 1,
163164
"ext": {
164165
"rtiPartner": "TDID"
165166
}
@@ -246,6 +247,7 @@ class DeserializationTest : StringSpec({
246247

247248
val eid2 = first { it.source == "adserver.org" }.uids.first()
248249
eid2.id shouldBe "6bca7f6b-a98a-46c0-be05-6020f7604598"
250+
eid2.atype shouldBe 1
249251
eid2.ext.shouldContain("rtiPartner", "TDID")
250252
}
251253
}

0 commit comments

Comments
 (0)