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

com.pubnub.api.models.consumer.PNStatus.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

import com.pubnub.api.Endpoint
import com.pubnub.api.PubNubException
import com.pubnub.api.endpoints.remoteaction.ExtendedRemoteAction
import com.pubnub.api.enums.PNOperationType
import com.pubnub.api.enums.PNStatusCategory
import okhttp3.Request

/**
 * Metadata related to executed PubNub API operations.
 *
 * @property category The [PNStatusCategory] of an executed operation.
 * @property error Is `true` if the operation didn't succeed. Always check for it in [async][Endpoint.async] blocks.
 * @property operation The concrete API operation type that's been executed.
 * @property exception Error information if the request didn't succeed.
 * @property statusCode HTTP status code.
 * @property tlsEnabled Whether the API operation was executed over HTTPS.
 * @property origin Origin of the HTTP request. See more at [PNConfiguration.origin].
 * @property uuid The UUID which requested the API operation to be executed. See more at [PNConfiguration.uuid].
 * @property authKey The authentication key attached to the request, if needed. See more at [PNConfiguration.authKey].
 * @property affectedChannels List of channels affected by the this API operation.
 * @property affectedChannelGroups List of channel groups affected by the this API operation.
 */
data class PNStatus(
    var category: PNStatusCategory,
    var error: Boolean,
    val operation: PNOperationType,

    val exception: PubNubException? = null,

    var statusCode: Int? = null,
    var tlsEnabled: Boolean? = null,
    var origin: String? = null,
    var uuid: String? = null,
    var authKey: String? = null,

    var affectedChannels: List = emptyList(),
    var affectedChannelGroups: List = emptyList()

) {
    internal var executedEndpoint: ExtendedRemoteAction<*>? = null

    var clientRequest: Request? = null

    /**
     * Execute the API operation again.
     */
    fun retry() {
        executedEndpoint?.retry()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy