PowerLevelsContent

@JsonClass(generateAdapter = true)
data class PowerLevelsContent(    @Json(name = "ban") val ban: Int? = null,     @Json(name = "kick") val kick: Int? = null,     @Json(name = "invite") val invite: Int? = null,     @Json(name = "redact") val redact: Int? = null,     @Json(name = "events_default") val eventsDefault: Int? = null,     @Json(name = "events") val events: Map<String, Int>? = null,     @Json(name = "users_default") val usersDefault: Int? = null,     @Json(name = "users") val users: Map<String, Int>? = null,     @Json(name = "state_default") val stateDefault: Int? = null,     @Json(name = "notifications") val notifications: Map<String, Any>? = null)

Class representing the EventType.EVENT_TYPE_STATE_ROOM_POWER_LEVELS state event content.

Constructors

Link copied to clipboard
fun PowerLevelsContent(    @Json(name = "ban") ban: Int? = null,     @Json(name = "kick") kick: Int? = null,     @Json(name = "invite") invite: Int? = null,     @Json(name = "redact") redact: Int? = null,     @Json(name = "events_default") eventsDefault: Int? = null,     @Json(name = "events") events: Map<String, Int>? = null,     @Json(name = "users_default") usersDefault: Int? = null,     @Json(name = "users") users: Map<String, Int>? = null,     @Json(name = "state_default") stateDefault: Int? = null,     @Json(name = "notifications") notifications: Map<String, Any>? = null)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun notificationLevel(key: String): Int

Get the notification level for a dedicated key.

Link copied to clipboard
fun setUserPowerLevel(userId: String, powerLevel: Int?): PowerLevelsContent

Return a copy of this content with a new power level for the specified user.

Properties

Link copied to clipboard
val ban: Int? = null

The level required to ban a user. Defaults to 50 if unspecified.

Link copied to clipboard
val events: Map<String, Int>? = null

The level required to send specific event types. This is a mapping from event type to power level required.

Link copied to clipboard
val eventsDefault: Int? = null

The default level required to send message events. Can be overridden by the events key. Defaults to 0 if unspecified.

Link copied to clipboard
val invite: Int? = null

The level required to invite a user. Defaults to 50 if unspecified.

Link copied to clipboard
val kick: Int? = null

The level required to kick a user. Defaults to 50 if unspecified.

Link copied to clipboard
val notifications: Map<String, Any>? = null

The power level requirements for specific notification types. This is a mapping from key to power level for that notifications key.

Link copied to clipboard
val redact: Int? = null

The level required to redact an event. Defaults to 50 if unspecified.

Link copied to clipboard
val stateDefault: Int? = null

The default level required to send state events. Can be overridden by the events key. Defaults to 50 if unspecified.

Link copied to clipboard
val users: Map<String, Int>? = null

The power levels for specific users. This is a mapping from user_id to power level for that user.

Link copied to clipboard
val usersDefault: Int? = null

The default power level for every user in the room, unless their user_id is mentioned in the users key. Defaults to 0 if unspecified.

Extensions

Link copied to clipboard
fun PowerLevelsContent.banOrDefault(): Int
Link copied to clipboard
fun PowerLevelsContent.eventsDefaultOrDefault(): Int
Link copied to clipboard
fun PowerLevelsContent.inviteOrDefault(): Int
Link copied to clipboard
fun PowerLevelsContent.kickOrDefault(): Int
Link copied to clipboard
fun PowerLevelsContent.redactOrDefault(): Int
Link copied to clipboard
fun PowerLevelsContent.stateDefaultOrDefault(): Int
Link copied to clipboard
fun PowerLevelsContent.usersDefaultOrDefault(): Int