|
|
|
@@ -33,36 +33,42 @@ pub enum StateTestEvent {
|
|
|
|
|
Custom(JsonValue),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl StateTestEvent {
|
|
|
|
|
/// Get the JSON representation of this test event.
|
|
|
|
|
pub fn into_json_value(self) -> JsonValue {
|
|
|
|
|
match self {
|
|
|
|
|
Self::Alias => test_json::sync_events::ALIAS.to_owned(),
|
|
|
|
|
Self::Aliases => test_json::sync_events::ALIASES.to_owned(),
|
|
|
|
|
Self::Create => test_json::sync_events::CREATE.to_owned(),
|
|
|
|
|
Self::Encryption => test_json::sync_events::ENCRYPTION.to_owned(),
|
|
|
|
|
Self::HistoryVisibility => test_json::sync_events::HISTORY_VISIBILITY.to_owned(),
|
|
|
|
|
Self::JoinRules => test_json::sync_events::JOIN_RULES.to_owned(),
|
|
|
|
|
Self::Member => test_json::sync_events::MEMBER.to_owned(),
|
|
|
|
|
Self::MemberAdditional => test_json::sync_events::MEMBER_ADDITIONAL.to_owned(),
|
|
|
|
|
Self::MemberBan => test_json::sync_events::MEMBER_BAN.to_owned(),
|
|
|
|
|
Self::MemberInvite => test_json::sync_events::MEMBER_INVITE.to_owned(),
|
|
|
|
|
Self::MemberLeave => test_json::sync_events::MEMBER_LEAVE.to_owned(),
|
|
|
|
|
Self::MemberNameChange => test_json::sync_events::MEMBER_NAME_CHANGE.to_owned(),
|
|
|
|
|
Self::PowerLevels => test_json::sync_events::POWER_LEVELS.to_owned(),
|
|
|
|
|
Self::RedactedInvalid => test_json::sync_events::REDACTED_INVALID.to_owned(),
|
|
|
|
|
Self::RedactedState => test_json::sync_events::REDACTED_STATE.to_owned(),
|
|
|
|
|
Self::RoomAvatar => test_json::sync_events::ROOM_AVATAR.to_owned(),
|
|
|
|
|
Self::RoomName => test_json::sync_events::NAME.to_owned(),
|
|
|
|
|
Self::RoomPinnedEvents => test_json::sync_events::PINNED_EVENTS.to_owned(),
|
|
|
|
|
Self::RoomTopic => test_json::sync_events::TOPIC.to_owned(),
|
|
|
|
|
Self::Custom(json) => json,
|
|
|
|
|
impl From<StateTestEvent> for JsonValue {
|
|
|
|
|
fn from(val: StateTestEvent) -> Self {
|
|
|
|
|
match val {
|
|
|
|
|
StateTestEvent::Alias => test_json::sync_events::ALIAS.to_owned(),
|
|
|
|
|
StateTestEvent::Aliases => test_json::sync_events::ALIASES.to_owned(),
|
|
|
|
|
StateTestEvent::Create => test_json::sync_events::CREATE.to_owned(),
|
|
|
|
|
StateTestEvent::Encryption => test_json::sync_events::ENCRYPTION.to_owned(),
|
|
|
|
|
StateTestEvent::HistoryVisibility => {
|
|
|
|
|
test_json::sync_events::HISTORY_VISIBILITY.to_owned()
|
|
|
|
|
}
|
|
|
|
|
StateTestEvent::JoinRules => test_json::sync_events::JOIN_RULES.to_owned(),
|
|
|
|
|
StateTestEvent::Member => test_json::sync_events::MEMBER.to_owned(),
|
|
|
|
|
StateTestEvent::MemberAdditional => {
|
|
|
|
|
test_json::sync_events::MEMBER_ADDITIONAL.to_owned()
|
|
|
|
|
}
|
|
|
|
|
StateTestEvent::MemberBan => test_json::sync_events::MEMBER_BAN.to_owned(),
|
|
|
|
|
StateTestEvent::MemberInvite => test_json::sync_events::MEMBER_INVITE.to_owned(),
|
|
|
|
|
StateTestEvent::MemberLeave => test_json::sync_events::MEMBER_LEAVE.to_owned(),
|
|
|
|
|
StateTestEvent::MemberNameChange => {
|
|
|
|
|
test_json::sync_events::MEMBER_NAME_CHANGE.to_owned()
|
|
|
|
|
}
|
|
|
|
|
StateTestEvent::PowerLevels => test_json::sync_events::POWER_LEVELS.to_owned(),
|
|
|
|
|
StateTestEvent::RedactedInvalid => test_json::sync_events::REDACTED_INVALID.to_owned(),
|
|
|
|
|
StateTestEvent::RedactedState => test_json::sync_events::REDACTED_STATE.to_owned(),
|
|
|
|
|
StateTestEvent::RoomAvatar => test_json::sync_events::ROOM_AVATAR.to_owned(),
|
|
|
|
|
StateTestEvent::RoomName => test_json::sync_events::NAME.to_owned(),
|
|
|
|
|
StateTestEvent::RoomPinnedEvents => test_json::sync_events::PINNED_EVENTS.to_owned(),
|
|
|
|
|
StateTestEvent::RoomTopic => test_json::sync_events::TOPIC.to_owned(),
|
|
|
|
|
StateTestEvent::Custom(json) => json,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get the typed JSON representation of this test event.
|
|
|
|
|
pub fn into_raw_event(self) -> Raw<AnySyncStateEvent> {
|
|
|
|
|
from_json_value(self.into_json_value()).unwrap()
|
|
|
|
|
impl From<StateTestEvent> for Raw<AnySyncStateEvent> {
|
|
|
|
|
fn from(val: StateTestEvent) -> Self {
|
|
|
|
|
from_json_value(val.into()).unwrap()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -73,19 +79,19 @@ pub enum StrippedStateTestEvent {
|
|
|
|
|
Custom(JsonValue),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl StrippedStateTestEvent {
|
|
|
|
|
/// Get the JSON representation of this test event.
|
|
|
|
|
pub fn into_json_value(self) -> JsonValue {
|
|
|
|
|
match self {
|
|
|
|
|
Self::Member => test_json::sync_events::MEMBER_STRIPPED.to_owned(),
|
|
|
|
|
Self::RoomName => test_json::sync_events::NAME_STRIPPED.to_owned(),
|
|
|
|
|
Self::Custom(json) => json,
|
|
|
|
|
impl From<StrippedStateTestEvent> for JsonValue {
|
|
|
|
|
fn from(val: StrippedStateTestEvent) -> Self {
|
|
|
|
|
match val {
|
|
|
|
|
StrippedStateTestEvent::Member => test_json::sync_events::MEMBER_STRIPPED.to_owned(),
|
|
|
|
|
StrippedStateTestEvent::RoomName => test_json::sync_events::NAME_STRIPPED.to_owned(),
|
|
|
|
|
StrippedStateTestEvent::Custom(json) => json,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get the typed JSON representation of this test event.
|
|
|
|
|
pub fn into_raw_event(self) -> Raw<AnyStrippedStateEvent> {
|
|
|
|
|
from_json_value(self.into_json_value()).unwrap()
|
|
|
|
|
impl From<StrippedStateTestEvent> for Raw<AnyStrippedStateEvent> {
|
|
|
|
|
fn from(val: StrippedStateTestEvent) -> Self {
|
|
|
|
|
from_json_value(val.into()).unwrap()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -97,20 +103,22 @@ pub enum RoomAccountDataTestEvent {
|
|
|
|
|
Custom(JsonValue),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl RoomAccountDataTestEvent {
|
|
|
|
|
/// Get the JSON representation of this test event.
|
|
|
|
|
pub fn into_json_value(self) -> JsonValue {
|
|
|
|
|
match self {
|
|
|
|
|
Self::FullyRead => test_json::sync_events::FULLY_READ.to_owned(),
|
|
|
|
|
Self::Tags => test_json::sync_events::TAG.to_owned(),
|
|
|
|
|
Self::MarkedUnread => test_json::sync_events::MARKED_UNREAD.to_owned(),
|
|
|
|
|
Self::Custom(json) => json,
|
|
|
|
|
impl From<RoomAccountDataTestEvent> for JsonValue {
|
|
|
|
|
fn from(val: RoomAccountDataTestEvent) -> Self {
|
|
|
|
|
match val {
|
|
|
|
|
RoomAccountDataTestEvent::FullyRead => test_json::sync_events::FULLY_READ.to_owned(),
|
|
|
|
|
RoomAccountDataTestEvent::Tags => test_json::sync_events::TAG.to_owned(),
|
|
|
|
|
RoomAccountDataTestEvent::MarkedUnread => {
|
|
|
|
|
test_json::sync_events::MARKED_UNREAD.to_owned()
|
|
|
|
|
}
|
|
|
|
|
RoomAccountDataTestEvent::Custom(json) => json,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get the typed JSON representation of this test event.
|
|
|
|
|
pub fn into_raw_event(self) -> Raw<AnyRoomAccountDataEvent> {
|
|
|
|
|
from_json_value(self.into_json_value()).unwrap()
|
|
|
|
|
impl From<RoomAccountDataTestEvent> for Raw<AnyRoomAccountDataEvent> {
|
|
|
|
|
fn from(val: RoomAccountDataTestEvent) -> Self {
|
|
|
|
|
from_json_value(val.into()).unwrap()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -120,18 +128,18 @@ pub enum PresenceTestEvent {
|
|
|
|
|
Custom(JsonValue),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl PresenceTestEvent {
|
|
|
|
|
/// Get the JSON representation of this test event.
|
|
|
|
|
pub fn into_json_value(self) -> JsonValue {
|
|
|
|
|
match self {
|
|
|
|
|
Self::Presence => test_json::sync_events::PRESENCE.to_owned(),
|
|
|
|
|
Self::Custom(json) => json,
|
|
|
|
|
impl From<PresenceTestEvent> for JsonValue {
|
|
|
|
|
fn from(val: PresenceTestEvent) -> Self {
|
|
|
|
|
match val {
|
|
|
|
|
PresenceTestEvent::Presence => test_json::sync_events::PRESENCE.to_owned(),
|
|
|
|
|
PresenceTestEvent::Custom(json) => json,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get the typed JSON representation of this test event.
|
|
|
|
|
pub fn into_raw_event(self) -> Raw<PresenceEvent> {
|
|
|
|
|
from_json_value(self.into_json_value()).unwrap()
|
|
|
|
|
impl From<PresenceTestEvent> for Raw<PresenceEvent> {
|
|
|
|
|
fn from(val: PresenceTestEvent) -> Self {
|
|
|
|
|
from_json_value(val.into()).unwrap()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -142,18 +150,18 @@ pub enum GlobalAccountDataTestEvent {
|
|
|
|
|
Custom(JsonValue),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl GlobalAccountDataTestEvent {
|
|
|
|
|
/// Get the JSON representation of this test event.
|
|
|
|
|
pub fn into_json_value(self) -> JsonValue {
|
|
|
|
|
match self {
|
|
|
|
|
Self::Direct => test_json::sync_events::DIRECT.to_owned(),
|
|
|
|
|
Self::PushRules => test_json::sync_events::PUSH_RULES.to_owned(),
|
|
|
|
|
Self::Custom(json) => json,
|
|
|
|
|
impl From<GlobalAccountDataTestEvent> for JsonValue {
|
|
|
|
|
fn from(val: GlobalAccountDataTestEvent) -> Self {
|
|
|
|
|
match val {
|
|
|
|
|
GlobalAccountDataTestEvent::Direct => test_json::sync_events::DIRECT.to_owned(),
|
|
|
|
|
GlobalAccountDataTestEvent::PushRules => test_json::sync_events::PUSH_RULES.to_owned(),
|
|
|
|
|
GlobalAccountDataTestEvent::Custom(json) => json,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Get the typed JSON representation of this test event.
|
|
|
|
|
pub fn into_raw_event(self) -> Raw<AnyGlobalAccountDataEvent> {
|
|
|
|
|
from_json_value(self.into_json_value()).unwrap()
|
|
|
|
|
impl From<GlobalAccountDataTestEvent> for Raw<AnyGlobalAccountDataEvent> {
|
|
|
|
|
fn from(val: GlobalAccountDataTestEvent) -> Self {
|
|
|
|
|
from_json_value(val.into()).unwrap()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|