PushRule

@JsonClass(generateAdapter = true)
data class PushRule(    @Json(name = "actions") val actions: List<Any>,     @Json(name = "default") val default: Boolean? = false,     @Json(name = "enabled") val enabled: Boolean,     @Json(name = "rule_id") val ruleId: String,     @Json(name = "conditions") val conditions: List<PushCondition>? = null,     @Json(name = "pattern") val pattern: String? = null)

Ref: https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-pushrules

Constructors

Link copied to clipboard
fun PushRule(    @Json(name = "actions") actions: List<Any>,     @Json(name = "default") default: Boolean? = false,     @Json(name = "enabled") enabled: Boolean,     @Json(name = "rule_id") ruleId: String,     @Json(name = "conditions") conditions: List<PushCondition>? = null,     @Json(name = "pattern") pattern: String? = null)

Functions

Link copied to clipboard
fun getHighlight(): Boolean

Get the highlight status. As spec mentions assume false if no tweak present.

Link copied to clipboard
fun getNotificationSound(): String?
Link copied to clipboard
fun removeNotificationSound(): PushRule

Remove the notification sound.

Link copied to clipboard
fun setHighlight(highlight: Boolean): PushRule

Set the highlight status.

Link copied to clipboard
fun setNotificationSound(): PushRule

Add the default notification sound.

fun setNotificationSound(sound: String): PushRule

Set the notification sound.

Link copied to clipboard
fun setNotify(notify: Boolean): PushRule

Set the notification status.

Link copied to clipboard
fun shouldNotify(): Boolean

Return true if the rule should highlight the event.

Link copied to clipboard
fun shouldNotNotify(): Boolean

Return true if the rule should not highlight the event.

Properties

Link copied to clipboard
val actions: List<Any>

Required. The actions to perform when this rule is matched.

Link copied to clipboard
val conditions: List<PushCondition>? = null

The conditions that must hold true for an event in order for a rule to be applied to an event.

Link copied to clipboard
val default: Boolean? = false

Required. Whether this is a default rule, or has been set explicitly.

Link copied to clipboard
val enabled: Boolean

Required. Whether the push rule is enabled or not.

Link copied to clipboard
val pattern: String? = null

The glob-style pattern to match against. Only applicable to content rules.

Link copied to clipboard
val ruleId: String

Required. The ID of this rule.

Extensions

Link copied to clipboard
fun PushRule.getActions(): List<Action>