Class PushApi.Condition

  • Enclosing interface:
    PushApi

    public static class PushApi.Condition
    extends Object
    Override, Underride and Default Rules MAY have a list of 'conditions'. All conditions must hold true for an event in order to apply the action for the event. A rule with no conditions always matches. Room, Sender, User and Content rules do not have conditions in the same way, but instead have predefined conditions. These conditions can be configured using the parameters outlined below. In the cases of room and sender rules, the rule_id of the rule determines its behaviour.
    • Field Detail

      • EVENT_MATCH

        public static final String EVENT_MATCH
        This is a glob pattern match on a field of the event. Parameters:
        • key: The dot-separated field of the event to match, e.g. content.body
        • pattern: The glob-style pattern to match against. Patterns with no special glob characters should be treated as having asterisks prepended and appended when testing the condition.
        See Also:
        Constant Field Values
      • CONTAINS_DISPLAY_NAME

        public static final String CONTAINS_DISPLAY_NAME
        This matches unencrypted messages where content.body contains the owner's display name in that room. This is a separate rule because display names may change and as such it would be hard to maintain a rule that matched the user's display name. This condition has no parameters.
        See Also:
        Constant Field Values
      • ROOM_MEMBER_COUNT

        public static final String ROOM_MEMBER_COUNT
        This matches the current number of members in the room. Parameters:
        • is: A decimal integer optionally prefixed by one of, ==, <, >, >= or <=. A prefix of < matches rooms where the member count is strictly less than the given number and so forth. If no prefix is present, this parameter defaults to ==.
        See Also:
        Constant Field Values
      • SENDER_NOTIFICATION_PERMISSION

        public static final String SENDER_NOTIFICATION_PERMISSION
        This takes into account the current power levels in the room, ensuring the sender of the event has high enough power to trigger the notification. Parameters:
        • key: A string that determines the power level the sender must have to trigger notifications of a given type, such as room. Refer to the m.room.power_levels event schema for information about what the defaults are and how to interpret the event. The key is used to look up the power level required to send a notification type from the notifications object in the power level event content.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Condition

        protected Condition()