com.pubnub.api.models.consumer.access_manager.v3.PNToken.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.access_manager.v3
import com.pubnub.api.models.TokenBitmask
data class PNToken(
val version: Int = 0,
val timestamp: Long = 0,
val ttl: Long = 0,
val authorizedUUID: String? = null,
val resources: PNTokenResources,
val patterns: PNTokenResources,
val meta: Any? = null
) {
data class PNTokenResources(
val channels: Map = emptyMap(),
val channelGroups: Map = emptyMap(),
val uuids: Map = emptyMap()
)
data class PNResourcePermissions(
val read: Boolean = false,
val write: Boolean = false,
val manage: Boolean = false,
val delete: Boolean = false,
val get: Boolean = false,
val update: Boolean = false,
val join: Boolean = false
) {
constructor(grant: Int) : this(
grant and TokenBitmask.READ != 0,
grant and TokenBitmask.WRITE != 0,
grant and TokenBitmask.MANAGE != 0,
grant and TokenBitmask.DELETE != 0,
grant and TokenBitmask.GET != 0,
grant and TokenBitmask.UPDATE != 0,
grant and TokenBitmask.JOIN != 0
)
}
}