base: Move the deserialized responses types into the common crate

master
Damir Jelić 2021-01-19 12:29:46 +01:00
parent 4f4ba831c1
commit 6a30514d40
13 changed files with 20 additions and 19 deletions

View File

@ -41,8 +41,8 @@ use tracing::{debug, warn};
use tracing::{error, info, instrument}; use tracing::{error, info, instrument};
use matrix_sdk_base::{ use matrix_sdk_base::{
responses::SyncResponse, BaseClient, BaseClientConfig, EventEmitter, InvitedRoom, JoinedRoom, deserialized_responses::SyncResponse, BaseClient, BaseClientConfig, EventEmitter, InvitedRoom,
LeftRoom, Session, Store, JoinedRoom, LeftRoom, Session, Store,
}; };
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]

View File

@ -25,7 +25,7 @@ docs = ["encryption", "sled_cryptostore", "messages"]
[dependencies] [dependencies]
dashmap= "4.0.1" dashmap= "4.0.1"
serde = { version = "1.0.118", features = ["rc"]} serde = { version = "1.0.119", features = ["rc"] }
serde_json = "1.0.61" serde_json = "1.0.61"
zeroize = "1.2.0" zeroize = "1.2.0"
tracing = "0.1.22" tracing = "0.1.22"

View File

@ -41,6 +41,10 @@ use matrix_sdk_common::{
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::keys::claim_keys::Request as KeysClaimRequest, api::r0::keys::claim_keys::Request as KeysClaimRequest,
deserialized_responses::{
AccountData, Ephemeral, InviteState, InvitedRoom, JoinedRoom, LeftRoom, MemberEvent,
Presence, Rooms, State, StrippedMemberEvent, SyncResponse, Timeline,
},
events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent, AnySyncMessageEvent}, events::{room::encrypted::EncryptedEventContent, AnyMessageEventContent, AnySyncMessageEvent},
identifiers::DeviceId, identifiers::DeviceId,
locks::Mutex, locks::Mutex,
@ -58,10 +62,6 @@ use zeroize::Zeroizing;
use crate::{ use crate::{
error::Result, error::Result,
event_emitter::Emitter, event_emitter::Emitter,
responses::{
AccountData, Ephemeral, InviteState, InvitedRoom, JoinedRoom, LeftRoom, MemberEvent,
Presence, Rooms, State, StrippedMemberEvent, SyncResponse, Timeline,
},
rooms::{RoomInfo, RoomType, StrippedRoomInfo}, rooms::{RoomInfo, RoomType, StrippedRoomInfo},
session::Session, session::Session,
store::{Result as StoreResult, SledStore, StateChanges, Store}, store::{Result as StoreResult, SledStore, StateChanges, Store},

View File

@ -18,6 +18,7 @@ use matrix_sdk_common::{events::AnySyncRoomEvent, identifiers::RoomId};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
use crate::{ use crate::{
deserialized_responses::SyncResponse,
events::{ events::{
call::{ call::{
answer::AnswerEventContent, candidates::CandidatesEventContent, answer::AnswerEventContent, candidates::CandidatesEventContent,
@ -46,7 +47,6 @@ use crate::{
AnySyncStateEvent, BasicEvent, StrippedStateEvent, SyncEphemeralRoomEvent, AnySyncStateEvent, BasicEvent, StrippedStateEvent, SyncEphemeralRoomEvent,
SyncMessageEvent, SyncStateEvent, SyncMessageEvent, SyncStateEvent,
}, },
responses::SyncResponse,
rooms::RoomState, rooms::RoomState,
Store, Store,
}; };

View File

@ -45,7 +45,6 @@ pub use matrix_sdk_common::*;
mod client; mod client;
mod error; mod error;
mod event_emitter; mod event_emitter;
pub mod responses;
mod rooms; mod rooms;
mod session; mod session;
mod store; mod store;

View File

@ -23,7 +23,7 @@ use matrix_sdk_common::{
identifiers::UserId, identifiers::UserId,
}; };
use crate::responses::MemberEvent; use crate::deserialized_responses::MemberEvent;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct RoomMember { pub struct RoomMember {

View File

@ -37,7 +37,7 @@ use serde::{Deserialize, Serialize};
use tracing::info; use tracing::info;
use crate::{ use crate::{
responses::UnreadNotificationsCount, deserialized_responses::UnreadNotificationsCount,
store::{Result as StoreResult, SledStore}, store::{Result as StoreResult, SledStore},
}; };

View File

@ -21,7 +21,7 @@ use sled::{
use tracing::info; use tracing::info;
use crate::{ use crate::{
responses::{MemberEvent, StrippedMemberEvent}, deserialized_responses::{MemberEvent, StrippedMemberEvent},
rooms::{RoomInfo, RoomType, StrippedRoom}, rooms::{RoomInfo, RoomType, StrippedRoom},
InvitedRoom, JoinedRoom, LeftRoom, Room, RoomState, Session, InvitedRoom, JoinedRoom, LeftRoom, Room, RoomState, Session,
}; };
@ -610,7 +610,7 @@ mod test {
use matrix_sdk_test::async_test; use matrix_sdk_test::async_test;
use super::{SledStore, StateChanges}; use super::{SledStore, StateChanges};
use crate::responses::MemberEvent; use crate::deserialized_responses::MemberEvent;
fn user_id() -> UserId { fn user_id() -> UserId {
user_id!("@example:localhost") user_id!("@example:localhost")

View File

@ -15,6 +15,7 @@ unstable-synapse-quirks = ["ruma/unstable-synapse-quirks"]
[dependencies] [dependencies]
instant = { version = "0.1.9", features = ["wasm-bindgen", "now"] } instant = { version = "0.1.9", features = ["wasm-bindgen", "now"] }
serde = "1.0.119"
async-trait = "0.1.42" async-trait = "0.1.42"
[dependencies.ruma] [dependencies.ruma]

View File

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, convert::TryFrom, time::SystemTime}; use std::{collections::BTreeMap, convert::TryFrom, time::SystemTime};
use matrix_sdk_common::{ use super::{
api::r0::sync::sync_events::{ api::r0::sync::sync_events::{
DeviceLists, UnreadNotificationsCount as RumaUnreadNotificationsCount, DeviceLists, UnreadNotificationsCount as RumaUnreadNotificationsCount,
}, },
@ -228,7 +228,7 @@ pub struct MemberEvent {
} }
impl TryFrom<SyncStateEvent<MemberEventContent>> for MemberEvent { impl TryFrom<SyncStateEvent<MemberEventContent>> for MemberEvent {
type Error = matrix_sdk_common::identifiers::Error; type Error = super::identifiers::Error;
fn try_from(event: SyncStateEvent<MemberEventContent>) -> Result<Self, Self::Error> { fn try_from(event: SyncStateEvent<MemberEventContent>) -> Result<Self, Self::Error> {
Ok(MemberEvent { Ok(MemberEvent {
@ -244,7 +244,7 @@ impl TryFrom<SyncStateEvent<MemberEventContent>> for MemberEvent {
} }
impl TryFrom<StateEvent<MemberEventContent>> for MemberEvent { impl TryFrom<StateEvent<MemberEventContent>> for MemberEvent {
type Error = matrix_sdk_common::identifiers::Error; type Error = super::identifiers::Error;
fn try_from(event: StateEvent<MemberEventContent>) -> Result<Self, Self::Error> { fn try_from(event: StateEvent<MemberEventContent>) -> Result<Self, Self::Error> {
Ok(MemberEvent { Ok(MemberEvent {
@ -285,7 +285,7 @@ pub struct StrippedMemberEvent {
} }
impl TryFrom<StrippedStateEvent<MemberEventContent>> for StrippedMemberEvent { impl TryFrom<StrippedStateEvent<MemberEventContent>> for StrippedMemberEvent {
type Error = matrix_sdk_common::identifiers::Error; type Error = super::identifiers::Error;
fn try_from(event: StrippedStateEvent<MemberEventContent>) -> Result<Self, Self::Error> { fn try_from(event: StrippedStateEvent<MemberEventContent>) -> Result<Self, Self::Error> {
Ok(StrippedMemberEvent { Ok(StrippedMemberEvent {

View File

@ -13,6 +13,7 @@ pub use ruma::{
pub use uuid; pub use uuid;
pub mod deserialized_responses;
pub mod locks; pub mod locks;
/// Super trait that is used for our store traits, this trait will differ if /// Super trait that is used for our store traits, this trait will differ if

View File

@ -25,7 +25,7 @@ matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
olm-rs = { version = "1.0.0", features = ["serde"] } olm-rs = { version = "1.0.0", features = ["serde"] }
getrandom = "0.2.1" getrandom = "0.2.1"
serde = { version = "1.0.118", features = ["derive", "rc"] } serde = { version = "1.0.119", features = ["derive", "rc"] }
serde_json = "1.0.61" serde_json = "1.0.61"
zeroize = { version = "1.2.0", features = ["zeroize_derive"] } zeroize = { version = "1.2.0", features = ["zeroize_derive"] }

View File

@ -16,4 +16,4 @@ http = "0.2.2"
matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" } matrix-sdk-common = { version = "0.2.0", path = "../matrix_sdk_common" }
matrix-sdk-test-macros = { version = "0.1.0", path = "../matrix_sdk_test_macros" } matrix-sdk-test-macros = { version = "0.1.0", path = "../matrix_sdk_test_macros" }
lazy_static = "1.4.0" lazy_static = "1.4.0"
serde = "1.0.118" serde = "1.0.119"