From bedffcd45aab5e32abfbcee7725e9f5a27e9c1cf Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Tue, 1 Sep 2020 16:51:41 -0400 Subject: [PATCH] Move PusherData to ruma-common --- ruma-client-api/src/r0/push.rs | 24 +----------------------- ruma-common/src/push.rs | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/ruma-client-api/src/r0/push.rs b/ruma-client-api/src/r0/push.rs index e459222a..76d5bc96 100644 --- a/ruma-client-api/src/r0/push.rs +++ b/ruma-client-api/src/r0/push.rs @@ -2,6 +2,7 @@ use std::convert::TryFrom; +use ruma_common::push::PusherData; use serde::{Deserialize, Serialize}; use strum::{Display, EnumString}; @@ -90,26 +91,3 @@ pub enum PusherKind { /// A pusher that emails the user with unread notifications. Email, } - -/// Information for the pusher implementation itself. -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct PusherData { - /// Required if the pusher's kind is http. The URL to use to send notifications to. - #[serde(skip_serializing_if = "Option::is_none")] - pub url: Option, - - /// The format to use when sending notifications to the Push Gateway. - #[serde(skip_serializing_if = "Option::is_none")] - pub format: Option, -} - -/// A special format that the homeserver should use when sending notifications to a Push Gateway. -/// Currently, only "event_id_only" is supported as of [Push Gateway API r0.1.1][spec]. -/// -/// [spec]: https://matrix.org/docs/spec/push_gateway/r0.1.1#homeserver-behaviour -#[derive(Clone, Copy, Debug, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum PushFormat { - /// Require the homeserver to only send a reduced set of fields in the push. - EventIdOnly, -} diff --git a/ruma-common/src/push.rs b/ruma-common/src/push.rs index 5687cc3d..364bb17c 100644 --- a/ruma-common/src/push.rs +++ b/ruma-common/src/push.rs @@ -212,3 +212,26 @@ impl From for PatternedPushRule { Self { actions, default, enabled, rule_id, pattern } } } + +/// Information for the pusher implementation itself. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct PusherData { + /// Required if the pusher's kind is http. The URL to use to send notifications to. + #[serde(skip_serializing_if = "Option::is_none")] + pub url: Option, + + /// The format to use when sending notifications to the Push Gateway. + #[serde(skip_serializing_if = "Option::is_none")] + pub format: Option, +} + +/// A special format that the homeserver should use when sending notifications to a Push Gateway. +/// Currently, only "event_id_only" is supported as of [Push Gateway API r0.1.1][spec]. +/// +/// [spec]: https://matrix.org/docs/spec/push_gateway/r0.1.1#homeserver-behaviour +#[derive(Clone, Copy, Debug, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +pub enum PushFormat { + /// Require the homeserver to only send a reduced set of fields in the push. + EventIdOnly, +}