com.pubnub.api.models.consumer.presence.PNHereNow.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pubnub-kotlin Show documentation
Show all versions of pubnub-kotlin 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.api.models.consumer.presence
import com.google.gson.JsonElement
import com.pubnub.api.PubNub
import com.pubnub.api.endpoints.presence.HereNow
/**
* Result of the [PubNub.hereNow] operation.
*
* @property totalChannels Total number channels matching the associated [PubNub.hereNow] call.
* @property totalOccupancy Total occupancy matching the associated [PubNub.hereNow] call.
* @property channels A map with values of [PNHereNowChannelData] for each channel.
*/
class PNHereNowResult internal constructor(
val totalChannels: Int,
val totalOccupancy: Int,
val channels: HashMap = hashMapOf()
)
/**
* Wrapper class representing 'here now' data for a given channel.
*
* @property channelName The channel name.
* @property occupancy Total number of UUIDs currently in the channel.
* @property occupants List of [PNHereNowOccupantData] (users) currently in the channel.
*/
class PNHereNowChannelData internal constructor(
val channelName: String,
val occupancy: Int,
var occupants: List = emptyList()
)
/**
* Wrapper class representing a UUID (user) within the means of [PubNub.hereNow] calls.
*
* @property uuid UUID of the user if requested via [HereNow.includeUUIDs].
* @property state Presence State of the user if requested via [HereNow.includeState].
*/
class PNHereNowOccupantData internal constructor(
val uuid: String,
val state: JsonElement? = null
)