io.hackle.sdk.internal.user.HackleUserResolver.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hackle-server-sdk Show documentation
Show all versions of hackle-server-sdk Show documentation
Hackle SDK for Java and Kotlin
The newest version!
package io.hackle.sdk.internal.user
import io.hackle.sdk.common.User
import io.hackle.sdk.core.user.HackleUser
import io.hackle.sdk.core.user.IdentifierType
internal class HackleUserResolver {
fun resolveOrNull(user: User): HackleUser? {
val hackleUser = HackleUser.builder()
.identifiers(user.identifiers)
.identifier(IdentifierType.ID, user.id)
.identifier(IdentifierType.USER, user.userId)
.identifier(IdentifierType.DEVICE, user.deviceId)
.properties(user.properties)
.hackleProperties(user.hackleProperties)
.build()
if (hackleUser.identifiers.isEmpty()) {
return null
}
return hackleUser
}
}