diff --git a/ruma-client-api/src/r0/push.rs b/ruma-client-api/src/r0/push.rs index fefc20c5..e1c9fd90 100644 --- a/ruma-client-api/src/r0/push.rs +++ b/ruma-client-api/src/r0/push.rs @@ -53,31 +53,6 @@ impl TryFrom<&'_ str> for RuleKind { } } -/// A push rule -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct PushRule { - /// The actions to perform when this rule is matched. - pub actions: Vec, - - /// Whether this is a default rule, or has been set explicitly. - pub default: bool, - - /// Whether the push rule is enabled or not. - pub enabled: bool, - - /// The ID of this rule. - pub rule_id: String, - - /// The conditions that must hold true for an event in order for a rule to be applied to an event. A rule with no conditions always matches. - /// Only applicable to underride and override rules. - #[serde(skip_serializing_if = "Option::is_none")] - pub conditions: Option>, - - /// The glob-style pattern to match against. Only applicable to content rules. - #[serde(skip_serializing_if = "Option::is_none")] - pub pattern: Option, -} - /// Defines a pusher #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Pusher { diff --git a/ruma-client-api/src/r0/push/get_pushrule.rs b/ruma-client-api/src/r0/push/get_pushrule.rs index ad320350..56cb16cf 100644 --- a/ruma-client-api/src/r0/push/get_pushrule.rs +++ b/ruma-client-api/src/r0/push/get_pushrule.rs @@ -1,8 +1,9 @@ //! [GET /_matrix/client/r0/pushrules/{scope}/{kind}/{ruleId}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-pushrules-scope-kind-ruleid) use ruma_api::ruma_api; +use ruma_common::push::AnyPushRule; -use super::{PushRule, RuleKind}; +use super::RuleKind; ruma_api! { metadata: { @@ -31,7 +32,7 @@ ruma_api! { response: { /// The specific push rule. #[ruma_api(body)] - pub rule: PushRule + pub rule: AnyPushRule } error: crate::Error diff --git a/ruma-common/src/push.rs b/ruma-common/src/push.rs index 6b4c1f98..ba1cece5 100644 --- a/ruma-common/src/push.rs +++ b/ruma-common/src/push.rs @@ -103,6 +103,31 @@ pub struct PatternedPushRule { pub pattern: String, } +/// A push rule +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct AnyPushRule { + /// The actions to perform when this rule is matched. + pub actions: Vec, + + /// Whether this is a default rule, or has been set explicitly. + pub default: bool, + + /// Whether the push rule is enabled or not. + pub enabled: bool, + + /// The ID of this rule. + pub rule_id: String, + + /// The conditions that must hold true for an event in order for a rule to be applied to an event. A rule with no conditions always matches. + /// Only applicable to underride and override rules. + #[serde(skip_serializing_if = "Option::is_none")] + pub conditions: Option>, + + /// The glob-style pattern to match against. Only applicable to content rules. + #[serde(skip_serializing_if = "Option::is_none")] + pub pattern: Option, +} + /// This represents the different actions that should be taken when a rule is matched, and /// controls how notifications are delivered to the client. ///