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

commonMain.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!

The newest version!
package com.pubnub.api.models.consumer

import com.pubnub.api.PubNubException
import com.pubnub.api.enums.PNStatusCategory
import kotlin.jvm.JvmName

class PNStatus(
    val category: PNStatusCategory,
    val exception: PubNubException? = null,
    val currentTimetoken: Long? = null,
    val affectedChannels: Collection = emptySet(),
    val affectedChannelGroups: Collection = emptySet(),
) {
    @get:JvmName("isError")
    val error: Boolean = exception != null

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        }
        if (other !is PNStatus) {
            return false
        }

        if (category != other.category) {
            return false
        }
        if (exception != other.exception) {
            return false
        }
        if (currentTimetoken != other.currentTimetoken) {
            return false
        }
        if (affectedChannels != other.affectedChannels) {
            return false
        }
        if (affectedChannelGroups != other.affectedChannelGroups) {
            return false
        }

        return true
    }

    override fun hashCode(): Int {
        var result = category.hashCode()
        result = 31 * result + (exception?.hashCode() ?: 0)
        result = 31 * result + (currentTimetoken?.hashCode() ?: 0)
        result = 31 * result + affectedChannels.hashCode()
        result = 31 * result + affectedChannelGroups.hashCode()
        return result
    }

    override fun toString(): String {
        return "PNStatus(error=$error, affectedChannelGroups=$affectedChannelGroups, affectedChannels=$affectedChannels, currentTimetoken=$currentTimetoken, exception=$exception, category=$category)"
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy