base: Move the deserialized responses types into the common crate

This commit is contained in:
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 matrix_sdk_base::{
responses::SyncResponse, BaseClient, BaseClientConfig, EventEmitter, InvitedRoom, JoinedRoom,
LeftRoom, Session, Store,
deserialized_responses::SyncResponse, BaseClient, BaseClientConfig, EventEmitter, InvitedRoom,
JoinedRoom, LeftRoom, Session, Store,
};
#[cfg(feature = "encryption")]

View file

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

View file

@ -41,6 +41,10 @@ use matrix_sdk_common::{
#[cfg(feature = "encryption")]
use matrix_sdk_common::{
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},
identifiers::DeviceId,
locks::Mutex,
@ -58,10 +62,6 @@ use zeroize::Zeroizing;
use crate::{
error::Result,
event_emitter::Emitter,
responses::{
AccountData, Ephemeral, InviteState, InvitedRoom, JoinedRoom, LeftRoom, MemberEvent,
Presence, Rooms, State, StrippedMemberEvent, SyncResponse, Timeline,
},
rooms::{RoomInfo, RoomType, StrippedRoomInfo},
session::Session,
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 crate::{
deserialized_responses::SyncResponse,
events::{
call::{
answer::AnswerEventContent, candidates::CandidatesEventContent,
@ -46,7 +47,6 @@ use crate::{
AnySyncStateEvent, BasicEvent, StrippedStateEvent, SyncEphemeralRoomEvent,
SyncMessageEvent, SyncStateEvent,
},
responses::SyncResponse,
rooms::RoomState,
Store,
};

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, convert::TryFrom, time::SystemTime};
use matrix_sdk_common::{
use super::{
api::r0::sync::sync_events::{
DeviceLists, UnreadNotificationsCount as RumaUnreadNotificationsCount,
},
@ -228,7 +228,7 @@ pub struct 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> {
Ok(MemberEvent {
@ -244,7 +244,7 @@ impl TryFrom<SyncStateEvent<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> {
Ok(MemberEvent {
@ -285,7 +285,7 @@ pub struct 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> {
Ok(StrippedMemberEvent {

View file

@ -13,6 +13,7 @@ pub use ruma::{
pub use uuid;
pub mod deserialized_responses;
pub mod locks;
/// 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"] }
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"
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-test-macros = { version = "0.1.0", path = "../matrix_sdk_test_macros" }
lazy_static = "1.4.0"
serde = "1.0.118"
serde = "1.0.119"