From 98da341a4679ff35536c3599987e1f5cc0227495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 21 Feb 2020 16:33:08 +0100 Subject: [PATCH] Cargo.toml: Bump the dependency versions. --- Cargo.toml | 16 ++++++++-------- src/async_client.rs | 21 +++++++++++---------- src/error.rs | 22 ++++++++++++++++------ 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index bf145122a..e456397ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,17 +12,17 @@ version = "0.1.0" [dependencies] js_int = "0.1.2" -futures = "0.3.1" +futures = "0.3.4" reqwest = "0.10.1" http = "0.2.0" -async-std = "1.4.0" -ruma-api = "0.12.0" -ruma-client-api = "0.5.0" -ruma-events = "0.15.1" +async-std = "1.5.0" +ruma-api = "0.13.0" +ruma-client-api = "0.6.0" +ruma-events = "0.15.0" log = "0.4.8" ruma-identifiers = "0.14.1" -serde_json = "1.0.44" +serde_json = "1.0.48" serde_urlencoded = "0.6.1" url = "2.1.1" @@ -31,6 +31,6 @@ version = "1.0.104" features = ["derive"] [dev-dependencies] -tokio = { version = "0.2.9", features = ["full"] } +tokio = { version = "0.2.11", features = ["full"] } url = "2.1.1" -mockito = "0.22.0" +mockito = "0.23.3" diff --git a/src/async_client.rs b/src/async_client.rs index 14e1916bf..8309eea27 100644 --- a/src/async_client.rs +++ b/src/async_client.rs @@ -158,7 +158,7 @@ impl SyncSettings { } } -use api::r0::send::send_message_event; +use api::r0::message::create_message_event; use api::r0::session::login; use api::r0::sync::sync_events; @@ -305,12 +305,12 @@ impl AsyncClient { device_id: Option, ) -> Result { let request = login::Request { - address: None, - login_type: login::LoginType::Password, - medium: None, + user: login::UserInfo::MatrixId(user.into()), + login_info: login::LoginInfo::Password { + password: password.into(), + }, device_id: device_id.map(|d| d.into()), - password: password.into(), - user: user.into(), + initial_device_display_name: None, }; let response = self.send(request).await?; @@ -456,9 +456,10 @@ impl AsyncClient { request: Request, ) -> Result<::Incoming, Error> where - Request::Incoming: TryFrom>, Error = ruma_api::Error>, + Request::Incoming: + TryFrom>, Error = ruma_api::error::FromHttpRequestError>, ::Incoming: - TryFrom>, Error = ruma_api::Error>, + TryFrom>, Error = ruma_api::error::FromHttpResponseError>, { let request: http::Request> = request.try_into()?; let url = request.uri(); @@ -520,8 +521,8 @@ impl AsyncClient { &mut self, room_id: &str, data: MessageEventContent, - ) -> Result { - let request = send_message_event::Request { + ) -> Result { + let request = create_message_event::Request { room_id: RoomId::try_from(room_id).unwrap(), event_type: EventType::RoomMessage, txn_id: self.transaction_id().to_string(), diff --git a/src/error.rs b/src/error.rs index 36088ab68..fe501df19 100644 --- a/src/error.rs +++ b/src/error.rs @@ -4,7 +4,8 @@ use std::error::Error as StdError; use std::fmt::{Display, Formatter, Result as FmtResult}; use reqwest::Error as ReqwestError; -use ruma_api::Error as RumaApiError; +use ruma_api::error::FromHttpResponseError as RumaResponseError; +use ruma_api::error::IntoHttpError as RumaIntoHttpError; use serde_json::Error as SerdeJsonError; use serde_urlencoded::ser::Error as SerdeUrlEncodedSerializeError; use url::ParseError; @@ -19,7 +20,8 @@ impl Display for Error { InnerError::AuthenticationRequired => "The queried endpoint requires authentication but was called with an anonymous client.", InnerError::Reqwest(_) => "An HTTP error occurred.", InnerError::Uri(_) => "Provided string could not be converted into a URI.", - InnerError::RumaApi(_) => "An error occurred converting between ruma_client_api and hyper types.", + InnerError::RumaResponseError(_) => "An error occurred converting between ruma_client_api and hyper types.", + InnerError::IntoHttpError(_) => "An error occurred converting between ruma_client_api and hyper types.", InnerError::SerdeJson(_) => "A serialization error occurred.", InnerError::SerdeUrlEncodedSerialize(_) => "An error occurred serializing data to a query string.", }; @@ -40,7 +42,9 @@ pub(crate) enum InnerError { /// An error when parsing a string as a URI. Uri(ParseError), /// An error converting between ruma_client_api types and Hyper types. - RumaApi(RumaApiError), + RumaResponseError(RumaResponseError), + /// An error converting between ruma_client_api types and Hyper types. + IntoHttpError(RumaIntoHttpError), /// An error when serializing or deserializing a JSON value. SerdeJson(SerdeJsonError), /// An error when serializing a query string value. @@ -53,9 +57,15 @@ impl From for Error { } } -impl From for Error { - fn from(error: RumaApiError) -> Self { - Self(InnerError::RumaApi(error)) +impl From for Error { + fn from(error: RumaResponseError) -> Self { + Self(InnerError::RumaResponseError(error)) + } +} + +impl From for Error { + fn from(error: RumaIntoHttpError) -> Self { + Self(InnerError::IntoHttpError(error)) } }