diff --git a/ruma-client-api/src/r0/push.rs b/ruma-client-api/src/r0/push.rs index e46ce2f3..7f9833ec 100644 --- a/ruma-client-api/src/r0/push.rs +++ b/ruma-client-api/src/r0/push.rs @@ -181,36 +181,6 @@ pub enum RuleKind { _Custom(String), } -/// Defines a pusher. -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct Pusher { - /// This is a unique identifier for this pusher. Max length, 512 bytes. - pub pushkey: String, - - /// The kind of the pusher. If set to None in a call to set_pusher, this - /// will delete the pusher - pub kind: Option, - - /// This is a reverse-DNS style identifier for the application. Max length, 64 chars. - pub app_id: String, - - /// A string that will allow the user to identify what application owns this pusher. - pub app_display_name: String, - - /// A string that will allow the user to identify what device owns this pusher. - pub device_display_name: String, - - /// This string determines which set of device specific rules this pusher executes. - #[serde(skip_serializing_if = "Option::is_none")] - pub profile_tag: Option, - - /// The preferred language for receiving notifications (e.g. 'en' or 'en-US') - pub lang: String, - - /// Information for the pusher implementation itself. - pub data: PusherData, -} - /// Which kind a pusher is. #[derive(Clone, Debug, PartialEq, Eq, StringEnum)] #[ruma_enum(rename_all = "snake_case")] diff --git a/ruma-client-api/src/r0/push/get_pushers.rs b/ruma-client-api/src/r0/push/get_pushers.rs index 5ae38466..927ea305 100644 --- a/ruma-client-api/src/r0/push/get_pushers.rs +++ b/ruma-client-api/src/r0/push/get_pushers.rs @@ -1,8 +1,9 @@ //! [GET /_matrix/client/r0/pushers](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-pushers) use ruma_api::ruma_api; +use serde::{Deserialize, Serialize}; -use super::Pusher; +use super::{PusherData, PusherKind}; ruma_api! { metadata: { @@ -38,3 +39,32 @@ impl Response { Self { pushers } } } + +/// Defines a pusher. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Pusher { + /// This is a unique identifier for this pusher. Max length, 512 bytes. + pub pushkey: String, + + /// The kind of the pusher. + pub kind: PusherKind, + + /// This is a reverse-DNS style identifier for the application. Max length, 64 chars. + pub app_id: String, + + /// A string that will allow the user to identify what application owns this pusher. + pub app_display_name: String, + + /// A string that will allow the user to identify what device owns this pusher. + pub device_display_name: String, + + /// This string determines which set of device specific rules this pusher executes. + #[serde(skip_serializing_if = "Option::is_none")] + pub profile_tag: Option, + + /// The preferred language for receiving notifications (e.g. 'en' or 'en-US') + pub lang: String, + + /// Information for the pusher implementation itself. + pub data: PusherData, +} diff --git a/ruma-client-api/src/r0/push/set_pusher.rs b/ruma-client-api/src/r0/push/set_pusher.rs index 8dd999bf..3b80ffa1 100644 --- a/ruma-client-api/src/r0/push/set_pusher.rs +++ b/ruma-client-api/src/r0/push/set_pusher.rs @@ -1,8 +1,9 @@ //! [POST /_matrix/client/r0/pushers/set](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-pushers-set) use ruma_api::ruma_api; +use serde::{Deserialize, Serialize}; -use super::Pusher; +use super::{PusherData, PusherKind}; ruma_api! { metadata: { @@ -45,3 +46,32 @@ impl Response { Self } } + +/// Defines a pusher. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Pusher { + /// This is a unique identifier for this pusher. Max length, 512 bytes. + pub pushkey: String, + + /// The kind of the pusher. `None` deletes the pusher. + pub kind: Option, + + /// This is a reverse-DNS style identifier for the application. Max length, 64 chars. + pub app_id: String, + + /// A string that will allow the user to identify what application owns this pusher. + pub app_display_name: String, + + /// A string that will allow the user to identify what device owns this pusher. + pub device_display_name: String, + + /// This string determines which set of device specific rules this pusher executes. + #[serde(skip_serializing_if = "Option::is_none")] + pub profile_tag: Option, + + /// The preferred language for receiving notifications (e.g. 'en' or 'en-US') + pub lang: String, + + /// Information for the pusher implementation itself. + pub data: PusherData, +}