/// The global ruleset. class PushRules { final GlobalPushRules global; PushRules.fromJson(Map json) : this.global = GlobalPushRules.fromJson(json["global"]); } /// The global ruleset. class GlobalPushRules { final List content; final List override; final List room; final List sender; final List underride; GlobalPushRules.fromJson(Map json) : this.content = json.containsKey("content") ? PushRule.fromJsonList(json["content"]) : null, this.override = json.containsKey("override") ? PushRule.fromJsonList(json["content"]) : null, this.room = json.containsKey("room") ? PushRule.fromJsonList(json["room"]) : null, this.sender = json.containsKey("sender") ? PushRule.fromJsonList(json["sender"]) : null, this.underride = json.containsKey("underride") ? PushRule.fromJsonList(json["underride"]) : null; } /// A single pushrule. class PushRule { final List actions; final bool isDefault; final bool enabled; final String ruleId; final List conditions; final String pattern; static List fromJsonList(List list) { List objList = []; list.forEach((json) { objList.add(PushRule.fromJson(json)); }); return objList; } PushRule.fromJson(Map json) : this.actions = json["actions"], this.isDefault = json["default"], this.enabled = json["enabled"], this.ruleId = json["rule_id"], this.conditions = json.containsKey("conditions") ? PushRuleConditions.fromJsonList(json["conditions"]) : null, this.pattern = json["pattern"]; } /// Conditions when this pushrule should be active. class PushRuleConditions { final String kind; final String key; final String pattern; final String is_; static List fromJsonList(List list) { List objList = []; list.forEach((json) { objList.add(PushRuleConditions.fromJson(json)); }); return objList; } PushRuleConditions.fromJson(Map json) : this.kind = json["kind"], this.key = json["key"], this.pattern = json["pattern"], this.is_ = json["is"]; }