
com.pubnub.internal.endpoints.objects.internal.IncludeQueryParam.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin-impl Show documentation
Show all versions of pubnub-kotlin-impl Show documentation
PubNub is a cross-platform client-to-client (1:1 and 1:many) push service in the cloud, capable of broadcasting real-time messages to millions of web and mobile clients simultaneously, in less than a quarter second!
package com.pubnub.internal.endpoints.objects.internal
import com.pubnub.api.models.consumer.objects.member.PNUUIDDetailsLevel
import com.pubnub.api.models.consumer.objects.membership.PNChannelDetailsLevel
data class IncludeQueryParam(
private val includeCustom: Boolean = false,
private val includeChannelDetails: PNChannelDetailsLevel? = null,
private val includeUUIDDetails: PNUUIDDetailsLevel? = null,
private val includeType: Boolean = true,
private val includeStatus: Boolean = true,
private val includeChannelType: Boolean = false,
private val includeUuidType: Boolean = false
) {
internal fun createIncludeQueryParams(): Map {
val includeList = mutableListOf()
if (includeCustom) {
includeList.add("custom")
}
when (includeChannelDetails) {
PNChannelDetailsLevel.CHANNEL -> includeList.add("channel")
PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM -> includeList.add("channel.custom")
null -> {}
}
when (includeUUIDDetails) {
PNUUIDDetailsLevel.UUID -> includeList.add("uuid")
PNUUIDDetailsLevel.UUID_WITH_CUSTOM -> includeList.add("uuid.custom")
null -> {}
}
if (includeType) {
includeList.add("type")
}
if (includeChannelType) {
includeList.add("channel.type")
}
if (includeUuidType) {
includeList.add("uuid.type")
}
if (includeStatus) {
includeList.add("status")
}
return if (includeList.isNotEmpty()) {
mapOf("include" to includeList.joinToString(","))
} else {
mapOf()
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy