All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pubnub.api.models.consumer.history.PNFetchMessage.kt Maven / Gradle / Ivy

Go to download

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!

There is a newer version: 10.2.0
Show newest version
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.FetchMessages
import com.pubnub.api.models.consumer.PNBoundedPage

/**
 * Result of the [PubNub.fetchMessages] operation.
 *
 * @property channels Map of channels and their respective lists of [PNFetchMessageItem].
 */
data class PNFetchMessagesResult(
    val channels: Map>,
    val page: PNBoundedPage?
)

/**
 * Encapsulates a message in terms of a batch history entry.
 *
 * @property uuid Publisher uuid. Is `null` if not requested.
 * @property message The actual message content.
 * @property timetoken Publish timetoken of the message.
 * @property meta Metadata of the message, if requested via [FetchMessages.includeMeta].
 * Is `null` if not requested, otherwise an empty string if requested but no associated metadata.
 * @property actions The message actions associated with the message.
 * Is `null` if not requested via [FetchMessages.includeMessageActions].
 * The key of the map is the action type. The value is another map,
 * which key is the actual value of the message action,
 * and the key being a list of actions, ie. a list of UUIDs which have posted such a message action.
 * @see [Action]
 * @property messageType The message type associated with the item.
 * @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 PNFetchMessageItem(
    val uuid: String?,
    val message: JsonElement,
    val meta: JsonElement?,
    val timetoken: Long,
    val actions: Map>>? = null,
    val messageType: HistoryMessageType?,
    val error: PubNubError? = null
)

/**
 * Encapsulates a message action in terms of batch history.
 *
 * @property uuid The UUID of the publisher.
 * @property actionTimetoken The publish timetoken of the message action.
 */
data class Action(
    val uuid: String,
    val actionTimetoken: String
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy