com.pubnub.api.models.consumer.history.PNHistoryResult.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.history
import com.google.gson.JsonElement
import com.pubnub.api.PubNub
import com.pubnub.api.PubNubError
import com.pubnub.api.endpoints.History
/**
* Result of the [PubNub.history] operation.
*
* @property messages List of messages as instances of [PNHistoryItemResult].
* @property startTimetoken Start timetoken of the returned list of messages.
* @property endTimetoken End timetoken of the returned list of messages.
*/
class PNHistoryResult internal constructor(
val messages: List,
val startTimetoken: Long,
val endTimetoken: Long
)
/**
* Encapsulates a message in terms of a history entry.
*
* @property entry The actual message content.
* @property timetoken Publish timetoken of the message, if requested via [History.includeTimetoken]
* @property meta Metadata of the message, if requested via [History.includeMeta].
* Is `null` if not requested, otherwise an empty string if requested but no associated metadata.
* @property error The error associated with message retrieval, if any.
* e.g. a message is unencrypted but PubNub instance is configured with the Crypto
* so PubNub can't decrypt the unencrypted message and return the message.
*/
data class PNHistoryItemResult(
val entry: JsonElement,
val timetoken: Long? = null,
val meta: JsonElement? = null,
val error: PubNubError? = null
)