matrix_sdk: Use the internal types crate.
parent
c5d833a14b
commit
4c760fca02
|
@ -24,18 +24,11 @@ url = "2.1.1"
|
|||
async-trait = "0.1.30"
|
||||
serde = "1.0.106"
|
||||
serde_json = "1.0.51"
|
||||
uuid = { version = "0.8.1", features = ["v4"] }
|
||||
|
||||
matrix-sdk-types = { path = "../matrix_sdk_types" }
|
||||
matrix-sdk-crypto = { path = "../matrix_sdk_crypto", optional = true }
|
||||
|
||||
# Ruma dependencies
|
||||
js_int = "0.1.5"
|
||||
ruma-api = "0.16.0-rc.2"
|
||||
ruma-client-api = { version = "0.8.0-rc.5" }
|
||||
ruma-events = { version = "0.21.0-beta.1" }
|
||||
ruma-identifiers = "0.16.0"
|
||||
uuid = { version = "0.8.1", features = ["v4"] }
|
||||
|
||||
# Misc dependencies
|
||||
thiserror = "1.0.14"
|
||||
tracing = "0.1.13"
|
||||
|
|
|
@ -36,14 +36,13 @@ use http::Response as HttpResponse;
|
|||
use reqwest::header::{HeaderValue, InvalidHeaderValue};
|
||||
use url::Url;
|
||||
|
||||
use ruma_api::Endpoint;
|
||||
use ruma_events::room::message::MessageEventContent;
|
||||
use ruma_events::EventJson;
|
||||
pub use ruma_events::EventType;
|
||||
use ruma_identifiers::{RoomId, RoomIdOrAliasId, UserId};
|
||||
use crate::events::room::message::MessageEventContent;
|
||||
use crate::events::{EventJson, EventType};
|
||||
use crate::identifiers::{RoomId, RoomIdOrAliasId, UserId};
|
||||
use crate::Endpoint;
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_identifiers::DeviceId;
|
||||
use crate::identifiers::DeviceId;
|
||||
|
||||
use crate::api;
|
||||
use crate::base_client::Client as BaseClient;
|
||||
|
@ -589,7 +588,7 @@ impl AsyncClient {
|
|||
/// # use matrix_sdk::api::r0::filter::RoomEventFilter;
|
||||
/// # use matrix_sdk::api::r0::message::get_message_events::Direction;
|
||||
/// # use url::Url;
|
||||
/// # use js_int::UInt;
|
||||
/// # use matrix_sdk::js_int::UInt;
|
||||
///
|
||||
/// # let homeserver = Url::parse("http://example.com").unwrap();
|
||||
/// let mut builder = MessagesRequestBuilder::new();
|
||||
|
@ -870,7 +869,7 @@ impl AsyncClient {
|
|||
}
|
||||
}
|
||||
|
||||
async fn send<Request: Endpoint<ResponseError = ruma_client_api::Error> + std::fmt::Debug>(
|
||||
async fn send<Request: Endpoint<ResponseError = crate::api::Error> + std::fmt::Debug>(
|
||||
&self,
|
||||
request: Request,
|
||||
) -> Result<Request::Response> {
|
||||
|
@ -1285,15 +1284,15 @@ mod test {
|
|||
let client = AsyncClient::new(homeserver, None).unwrap();
|
||||
|
||||
if let Err(err) = client.login("example", "wordpass", None, None).await {
|
||||
if let crate::Error::RumaResponse(ruma_api::error::FromHttpResponseError::Http(
|
||||
ruma_api::error::ServerError::Known(ruma_client_api::error::Error {
|
||||
if let crate::Error::RumaResponse(crate::FromHttpResponseError::Http(
|
||||
crate::ServerError::Known(crate::api::Error {
|
||||
kind,
|
||||
message,
|
||||
status_code,
|
||||
}),
|
||||
)) = err
|
||||
{
|
||||
if let ruma_client_api::error::ErrorKind::Forbidden = kind {
|
||||
if let crate::api::error::ErrorKind::Forbidden = kind {
|
||||
} else {
|
||||
panic!(
|
||||
"found the wrong `ErrorKind` {:?}, expected `Forbidden",
|
||||
|
|
|
@ -42,18 +42,18 @@ use tokio::sync::Mutex;
|
|||
use tokio::sync::RwLock;
|
||||
|
||||
#[cfg(feature = "encryption")]
|
||||
use matrix_sdk_crypto::{OlmMachine, OneTimeKeys};
|
||||
use crate::api::r0::client_exchange::send_event_to_device;
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_client_api::r0::client_exchange::send_event_to_device;
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_client_api::r0::keys::{
|
||||
use crate::api::r0::keys::{
|
||||
claim_keys::Response as KeysClaimResponse, get_keys::Response as KeysQueryResponse,
|
||||
upload_keys::Response as KeysUploadResponse, DeviceKeys, KeyAlgorithm,
|
||||
};
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_events::room::message::MessageEventContent;
|
||||
use crate::events::room::message::MessageEventContent;
|
||||
#[cfg(feature = "encryption")]
|
||||
use ruma_identifiers::DeviceId;
|
||||
use crate::identifiers::DeviceId;
|
||||
#[cfg(feature = "encryption")]
|
||||
use matrix_sdk_crypto::{OlmMachine, OneTimeKeys};
|
||||
|
||||
pub type Token = String;
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
use std::io::Error as IoError;
|
||||
|
||||
use crate::api::Error as RumaClientError;
|
||||
use crate::FromHttpResponseError as RumaResponseError;
|
||||
use crate::IntoHttpError as RumaIntoHttpError;
|
||||
use reqwest::Error as ReqwestError;
|
||||
use ruma_api::error::FromHttpResponseError as RumaResponseError;
|
||||
use ruma_api::error::IntoHttpError as RumaIntoHttpError;
|
||||
use ruma_client_api::Error as RumaClientError;
|
||||
use serde_json::Error as JsonError;
|
||||
use thiserror::Error;
|
||||
use url::ParseError;
|
||||
|
|
|
@ -27,11 +27,8 @@
|
|||
#![deny(missing_docs)]
|
||||
|
||||
pub use crate::{error::Error, error::Result, session::Session};
|
||||
pub use matrix_sdk_types::*;
|
||||
pub use reqwest::header::InvalidHeaderValue;
|
||||
pub use ruma_api;
|
||||
pub use ruma_client_api as api;
|
||||
pub use ruma_events as events;
|
||||
pub use ruma_identifiers as identifiers;
|
||||
|
||||
mod async_client;
|
||||
mod base_client;
|
||||
|
|
|
@ -33,7 +33,7 @@ use crate::events::room::{
|
|||
use crate::events::EventType;
|
||||
use crate::identifiers::{RoomAliasId, RoomId, UserId};
|
||||
|
||||
use js_int::{Int, UInt};
|
||||
use crate::js_int::{Int, UInt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
/// `RoomName` allows the calculation of a text room name.
|
||||
|
@ -527,13 +527,16 @@ mod test {
|
|||
assert!(room.power_levels.is_some());
|
||||
assert_eq!(
|
||||
room.power_levels.as_ref().unwrap().kick,
|
||||
js_int::Int::new(50).unwrap()
|
||||
crate::js_int::Int::new(50).unwrap()
|
||||
);
|
||||
let admin = room
|
||||
.members
|
||||
.get(&UserId::try_from("@example:localhost").unwrap())
|
||||
.unwrap();
|
||||
assert_eq!(admin.power_level.unwrap(), js_int::Int::new(100).unwrap());
|
||||
assert_eq!(
|
||||
admin.power_level.unwrap(),
|
||||
crate::js_int::Int::new(100).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -23,7 +23,7 @@ use crate::events::room::{
|
|||
};
|
||||
use crate::identifiers::UserId;
|
||||
|
||||
use js_int::{Int, UInt};
|
||||
use crate::js_int::{Int, UInt};
|
||||
use serde::{Deserialize, Serialize};
|
||||
// Notes: if Alice invites Bob into a room we will get an event with the sender as Alice and the state key as Bob.
|
||||
|
||||
|
@ -205,7 +205,7 @@ mod test {
|
|||
use crate::identifiers::{RoomId, UserId};
|
||||
use crate::test_builder::EventBuilder;
|
||||
|
||||
use js_int::{Int, UInt};
|
||||
use crate::js_int::{Int, UInt};
|
||||
|
||||
use std::convert::TryFrom;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use api::r0::room::{
|
|||
Visibility,
|
||||
};
|
||||
|
||||
use js_int::UInt;
|
||||
use crate::js_int::UInt;
|
||||
|
||||
/// A builder used to create rooms.
|
||||
///
|
||||
|
@ -293,11 +293,11 @@ mod test {
|
|||
use std::collections::BTreeMap;
|
||||
|
||||
use super::*;
|
||||
use crate::api::r0::filter::{LazyLoadOptions, RoomEventFilter};
|
||||
use crate::events::room::power_levels::NotificationPowerLevels;
|
||||
use crate::js_int::Int;
|
||||
use crate::{identifiers::RoomId, AsyncClient, Session};
|
||||
use api::r0::filter::{LazyLoadOptions, RoomEventFilter};
|
||||
|
||||
use js_int::Int;
|
||||
use mockito::{mock, Matcher};
|
||||
use std::convert::TryFrom;
|
||||
use url::Url;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
//! User sessions.
|
||||
|
||||
use ruma_identifiers::UserId;
|
||||
use crate::identifiers::UserId;
|
||||
/// A user session, containing an access token and information about the associated user account.
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct Session {
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
pub use js_int;
|
||||
pub use ruma_api::Endpoint;
|
||||
pub use ruma_api::{
|
||||
error::{FromHttpResponseError, IntoHttpError, ServerError},
|
||||
Endpoint,
|
||||
};
|
||||
pub use ruma_client_api as api;
|
||||
pub use ruma_events as events;
|
||||
pub use ruma_identifiers as identifiers;
|
||||
|
|
Loading…
Reference in New Issue