chore: bump ruma

master
Johannes Becker 2021-04-16 12:45:21 +02:00
parent 4713af6aac
commit 3414a59b91
9 changed files with 33 additions and 24 deletions

View File

@ -2391,7 +2391,7 @@ mod test {
.unwrap()
.flows
.iter()
.any(|flow| flow == &LoginType::Password);
.any(|flow| matches!(flow, LoginType::Password(_)));
assert!(can_password);
let _m_login = mock("POST", "/_matrix/client/r0/login")
@ -2465,7 +2465,7 @@ mod test {
.unwrap()
.flows
.iter()
.any(|flow| flow == &LoginType::Sso);
.any(|flow| matches!(flow, LoginType::Sso(_)));
assert!(can_sso);
let sso_url = client.get_sso_login_url("http://127.0.0.1:3030");

View File

@ -27,7 +27,7 @@ use url::Url;
use matrix_sdk_common::{
api::r0::media::create_content, async_trait, locks::RwLock, AsyncTraitDeps, AuthScheme,
FromHttpResponseError,
FromHttpResponseError, IncomingResponse,
};
use crate::{error::HttpError, ClientConfig, OutgoingRequest, RequestConfig, Session};
@ -140,7 +140,7 @@ impl HttpClient {
let response = self
.send_request(request, self.session.clone(), config)
.await?;
Ok(create_content::Response::try_from(response)?)
Ok(create_content::Response::try_from_http_response(response)?)
}
pub async fn send<Request>(
@ -158,7 +158,7 @@ impl HttpClient {
trace!("Got response: {:?}", response);
let response = Request::IncomingResponse::try_from(response)?;
let response = Request::IncomingResponse::try_from_http_response(response)?;
Ok(response)
}

View File

@ -22,7 +22,7 @@ async-trait = "0.1.42"
[dependencies.ruma]
version = "0.0.2"
git = "https://github.com/ruma/ruma"
rev = "e2728a70812412aade9322f6ad832731978a4240"
rev = "47d6b458574247545f8836b9421800f0089f3008"
features = ["client-api", "compat", "unstable-pre-spec"]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@ -4,7 +4,7 @@ pub use ruma::{
api::{
client as api,
error::{FromHttpRequestError, FromHttpResponseError, IntoHttpError, ServerError},
AuthScheme, EndpointError, OutgoingRequest,
AuthScheme, EndpointError, IncomingResponse, OutgoingRequest,
},
assign, directory, encryption, events, identifiers, int, presence, push,
serde::{CanonicalJsonValue, Raw},

View File

@ -1,7 +1,7 @@
#[cfg(target_os = "linux")]
mod perf;
use std::{convert::TryFrom, sync::Arc};
use std::sync::Arc;
use criterion::*;
@ -12,6 +12,7 @@ use matrix_sdk_common::{
},
identifiers::{room_id, user_id, DeviceIdBox, UserId},
uuid::Uuid,
IncomingResponse,
};
use matrix_sdk_crypto::{EncryptionSettings, OlmMachine};
use matrix_sdk_test::response_from_file;
@ -30,21 +31,22 @@ fn keys_query_response() -> get_keys::Response {
let data = include_bytes!("./keys_query.json");
let data: Value = serde_json::from_slice(data).unwrap();
let data = response_from_file(&data);
get_keys::Response::try_from(data).expect("Can't parse the keys upload response")
get_keys::Response::try_from_http_response(data).expect("Can't parse the keys upload response")
}
fn keys_claim_response() -> claim_keys::Response {
let data = include_bytes!("./keys_claim.json");
let data: Value = serde_json::from_slice(data).unwrap();
let data = response_from_file(&data);
claim_keys::Response::try_from(data).expect("Can't parse the keys upload response")
claim_keys::Response::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
fn huge_keys_query_resopnse() -> get_keys::Response {
let data = include_bytes!("./keys_query_2000_members.json");
let data: Value = serde_json::from_slice(data).unwrap();
let data = response_from_file(&data);
get_keys::Response::try_from(data).expect("Can't parse the keys query response")
get_keys::Response::try_from_http_response(data).expect("Can't parse the keys query response")
}
pub fn keys_query(c: &mut Criterion) {

View File

@ -416,12 +416,13 @@ impl IdentityManager {
#[cfg(test)]
pub(crate) mod test {
use std::{convert::TryFrom, sync::Arc};
use std::sync::Arc;
use matrix_sdk_common::{
api::r0::keys::get_keys::Response as KeyQueryResponse,
identifiers::{user_id, DeviceIdBox, UserId},
locks::Mutex,
IncomingResponse,
};
use matrix_sdk_test::async_test;
@ -518,7 +519,8 @@ pub(crate) mod test {
},
"user_signing_keys": {}
}));
KeyQueryResponse::try_from(data).expect("Can't parse the keys upload response")
KeyQueryResponse::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
pub(crate) fn own_key_query() -> KeyQueryResponse {
@ -618,7 +620,8 @@ pub(crate) mod test {
}
}
}));
KeyQueryResponse::try_from(data).expect("Can't parse the keys upload response")
KeyQueryResponse::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
#[async_test]

View File

@ -1217,7 +1217,7 @@ pub(crate) mod test {
identifiers::{
event_id, room_id, user_id, DeviceId, DeviceKeyAlgorithm, DeviceKeyId, UserId,
},
Raw,
IncomingResponse, Raw,
};
use matrix_sdk_test::test_json;
@ -1247,12 +1247,14 @@ pub(crate) mod test {
fn keys_upload_response() -> upload_keys::Response {
let data = response_from_file(&test_json::KEYS_UPLOAD);
upload_keys::Response::try_from(data).expect("Can't parse the keys upload response")
upload_keys::Response::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
fn keys_query_response() -> get_keys::Response {
let data = response_from_file(&test_json::KEYS_QUERY);
get_keys::Response::try_from(data).expect("Can't parse the keys upload response")
get_keys::Response::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
fn to_device_requests_to_content(requests: Vec<Arc<ToDeviceRequest>>) -> EncryptedEventContent {

View File

@ -536,12 +536,11 @@ impl GroupSessionManager {
#[cfg(test)]
mod test {
use std::convert::TryFrom;
use matrix_sdk_common::{
api::r0::keys::{claim_keys, get_keys},
identifiers::{room_id, user_id, DeviceIdBox, UserId},
uuid::Uuid,
IncomingResponse,
};
use matrix_sdk_test::response_from_file;
use serde_json::Value;
@ -560,14 +559,16 @@ mod test {
let data = include_bytes!("../../benches/keys_query.json");
let data: Value = serde_json::from_slice(data).unwrap();
let data = response_from_file(&data);
get_keys::Response::try_from(data).expect("Can't parse the keys upload response")
get_keys::Response::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
fn keys_claim_response() -> claim_keys::Response {
let data = include_bytes!("../../benches/keys_claim.json");
let data: Value = serde_json::from_slice(data).unwrap();
let data = response_from_file(&data);
claim_keys::Response::try_from(data).expect("Can't parse the keys upload response")
claim_keys::Response::try_from_http_response(data)
.expect("Can't parse the keys upload response")
}
async fn machine() -> OlmMachine {

View File

@ -1,4 +1,4 @@
use std::{collections::HashMap, convert::TryFrom, panic};
use std::{collections::HashMap, panic};
use http::Response;
@ -9,6 +9,7 @@ use matrix_sdk_common::{
AnySyncStateEvent,
},
identifiers::{room_id, RoomId},
IncomingResponse,
};
use serde_json::Value as JsonValue;
@ -330,7 +331,7 @@ impl EventBuilder {
// Clear state so that the next sync response will be empty if nothing was added.
self.clear();
SyncResponse::try_from(response).unwrap()
SyncResponse::try_from_http_response(response).unwrap()
}
fn generate_sync_token(&self) -> String {
@ -372,7 +373,7 @@ pub fn sync_response(kind: SyncResponseFile) -> SyncResponse {
let response = Response::builder()
.body(data.to_string().as_bytes().to_vec())
.unwrap();
SyncResponse::try_from(response).unwrap()
SyncResponse::try_from_http_response(response).unwrap()
}
pub fn response_from_file(json: &serde_json::Value) -> Response<Vec<u8>> {