Move PusherData to ruma-common
This commit is contained in:
parent
55a67fbcf4
commit
bedffcd45a
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
use std::convert::TryFrom;
|
use std::convert::TryFrom;
|
||||||
|
|
||||||
|
use ruma_common::push::PusherData;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use strum::{Display, EnumString};
|
use strum::{Display, EnumString};
|
||||||
|
|
||||||
@ -90,26 +91,3 @@ pub enum PusherKind {
|
|||||||
/// A pusher that emails the user with unread notifications.
|
/// A pusher that emails the user with unread notifications.
|
||||||
Email,
|
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<String>,
|
|
||||||
|
|
||||||
/// The format to use when sending notifications to the Push Gateway.
|
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
|
||||||
pub format: Option<PushFormat>,
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 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,
|
|
||||||
}
|
|
||||||
|
@ -212,3 +212,26 @@ impl From<PatternedPushRuleInit> for PatternedPushRule {
|
|||||||
Self { actions, default, enabled, rule_id, pattern }
|
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<String>,
|
||||||
|
|
||||||
|
/// The format to use when sending notifications to the Push Gateway.
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub format: Option<PushFormat>,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 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,
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user