Skip to content

Commit

Permalink
Adds an object for the uid of the user object (#153)
Browse files Browse the repository at this point in the history
* Adds an object for the uid of the user object
  • Loading branch information
renam authored Apr 26, 2024
1 parent 1ca042e commit 2883f9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Segment>,
@JvmField @SerialName("uids") public var uids: Set<UID>,
) {
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 = 0,
@JvmField @SerialName("ext") public var ext: Map<String, String> = mutableMapOf()
)
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ const val testJson = """
"uids": [
{
"id": "6bca7f6b-a98a-46c0-be05-6020f7604598",
"atype": 1,
"ext": {
"rtiPartner": "TDID"
}
Expand Down Expand Up @@ -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")
}
}
Expand Down

0 comments on commit 2883f9a

Please sign in to comment.