Upgrade Ruma after api::Error breaking change

Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
Kévin Commaille
2026-04-05 14:37:25 +02:00
committed by Damir Jelić
parent ba451b67c9
commit 30de5372eb
24 changed files with 108 additions and 120 deletions

20
Cargo.lock generated
View File

@@ -4917,7 +4917,7 @@ dependencies = [
[[package]]
name = "ruma"
version = "0.14.1"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"assign",
"js_int",
@@ -4935,12 +4935,11 @@ dependencies = [
[[package]]
name = "ruma-client-api"
version = "0.22.1"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"as_variant",
"assign",
"bytes",
"date_header",
"http",
"js_int",
"js_option",
@@ -4958,11 +4957,12 @@ dependencies = [
[[package]]
name = "ruma-common"
version = "0.17.1"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"as_variant",
"base64",
"bytes",
"date_header",
"form_urlencoded",
"getrandom 0.2.15",
"http",
@@ -4990,7 +4990,7 @@ dependencies = [
[[package]]
name = "ruma-events"
version = "0.32.1"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"as_variant",
"indexmap",
@@ -5013,7 +5013,7 @@ dependencies = [
[[package]]
name = "ruma-federation-api"
version = "0.13.1"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"headers",
"http",
@@ -5034,7 +5034,7 @@ dependencies = [
[[package]]
name = "ruma-html"
version = "0.6.0"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"as_variant",
"html5ever",
@@ -5045,7 +5045,7 @@ dependencies = [
[[package]]
name = "ruma-identifiers-validation"
version = "0.12.0"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"js_int",
"thiserror 2.0.17",
@@ -5054,7 +5054,7 @@ dependencies = [
[[package]]
name = "ruma-macros"
version = "0.17.1"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"as_variant",
"cfg-if",
@@ -5070,7 +5070,7 @@ dependencies = [
[[package]]
name = "ruma-signatures"
version = "0.19.0"
source = "git+https://github.com/ruma/ruma?rev=390d07ba915003fb8c5c625cf461d4c43370fa6a#390d07ba915003fb8c5c625cf461d4c43370fa6a"
source = "git+https://github.com/ruma/ruma?rev=7680eebd9586669e1a4e5b1fd1c2c691221369d4#7680eebd9586669e1a4e5b1fd1c2c691221369d4"
dependencies = [
"base64",
"ed25519-dalek",

View File

@@ -71,7 +71,7 @@ rand = { version = "0.10.0", default-features = false, features = ["std", "std_r
regex = { version = "1.12.2", default-features = false }
reqwest = { version = "0.13.1", default-features = false }
rmp-serde = { version = "1.3.0", default-features = false }
ruma = { git = "https://github.com/ruma/ruma", rev = "390d07ba915003fb8c5c625cf461d4c43370fa6a", features = [
ruma = { git = "https://github.com/ruma/ruma", rev = "7680eebd9586669e1a4e5b1fd1c2c691221369d4", features = [
"client-api-c",
"compat-unset-avatar",
"compat-upload-signatures",

View File

@@ -71,15 +71,17 @@ use matrix_sdk_ui::{
use mime::Mime;
use oauth2::Scope;
use ruma::{
api::client::{
alias::get_alias,
discovery::get_authorization_server_metadata::v1::{
AccountManagementActionData, DeviceDeleteData, DeviceViewData,
api::{
client::{
alias::get_alias,
discovery::get_authorization_server_metadata::v1::{
AccountManagementActionData, DeviceDeleteData, DeviceViewData,
},
profile::{AvatarUrl, DisplayName},
room::create_room::{v3::CreationContent, RoomPowerLevelsContentOverride},
uiaa::{EmailUserIdentifier, UserIdentifier},
},
error::ErrorKind,
profile::{AvatarUrl, DisplayName},
room::create_room::{v3::CreationContent, RoomPowerLevelsContentOverride},
uiaa::{EmailUserIdentifier, UserIdentifier},
},
events::{
direct::DirectEventContent,

View File

@@ -26,7 +26,7 @@ use matrix_sdk::{
};
use matrix_sdk_ui::{encryption_sync_service, notification_client, spaces, sync_service, timeline};
use ruma::{
api::client::error::{ErrorBody, ErrorKind as RumaApiErrorKind, RetryAfter, StandardErrorBody},
api::error::{ErrorBody, ErrorKind as RumaApiErrorKind, RetryAfter, StandardErrorBody},
MilliSecondsSinceUnixEpoch,
};
use tracing::warn;

View File

@@ -742,8 +742,7 @@ impl TerminationReport {
match &self.error {
Some(Error::RoomList(room_list_service::Error::SlidingSync(error)))
| Some(Error::EncryptionSync(encryption_sync_service::Error::SlidingSync(error))) => {
error.client_api_error_kind()
== Some(&ruma::api::client::error::ErrorKind::UnknownPos)
error.client_api_error_kind() == Some(&ruma::api::error::ErrorKind::UnknownPos)
}
_ => false,
}

View File

@@ -315,7 +315,7 @@ async fn test_reloaded_failed_local_echoes_are_marked_as_failed() {
// And it's properly pattern-matched as an HTTP error.
assert_matches!(
error.as_client_api_error().unwrap().error_kind(),
Some(ruma::api::client::error::ErrorKind::TooLarge)
Some(ruma::api::error::ErrorKind::TooLarge)
);
assert_pending!(timeline_stream);

View File

@@ -40,13 +40,13 @@ use ruma::{
request_3pid_management_token_via_email, request_3pid_management_token_via_msisdn,
},
config::{get_global_account_data, set_global_account_data},
error::ErrorKind,
profile::{
DisplayName, StaticProfileField, delete_profile_field, get_avatar_url, get_profile,
get_profile_field, set_avatar_url, set_display_name, set_profile_field,
},
uiaa::AuthData,
},
error::ErrorKind,
},
assign,
events::{
@@ -379,7 +379,7 @@ impl Account {
/// response, which would result in `Ok(None)`. Note that this error code
/// might also mean that the given user ID doesn't exist.
///
/// [`ErrorCode::NotFound`]: ruma::api::client::error::ErrorCode::NotFound
/// [`ErrorCode::NotFound`]: ruma::api::error::ErrorCode::NotFound
pub async fn fetch_profile_field_of(
&self,
user_id: OwnedUserId,
@@ -411,7 +411,7 @@ impl Account {
/// response, which would result in `Ok(None)`. Note that this error code
/// might also mean that the given user ID doesn't exist.
///
/// [`ErrorCode::NotFound`]: ruma::api::client::error::ErrorCode::NotFound
/// [`ErrorCode::NotFound`]: ruma::api::error::ErrorCode::NotFound
pub async fn fetch_profile_field_of_static<F>(
&self,
user_id: OwnedUserId,
@@ -517,7 +517,7 @@ impl Account {
/// ```
/// [uiaa]: https://spec.matrix.org/v1.2/client-server-api/#user-interactive-authentication-api
/// [`UiaaResponse`]: ruma::api::client::uiaa::UiaaResponse
/// [`ErrorKind::WeakPassword`]: ruma::api::client::error::ErrorKind::WeakPassword
/// [`ErrorKind::WeakPassword`]: ruma::api::error::ErrorKind::WeakPassword
pub async fn change_password(
&self,
new_password: &str,
@@ -668,8 +668,8 @@ impl Account {
/// # anyhow::Ok(()) };
/// ```
/// [3pid]: https://spec.matrix.org/v1.2/appendices/#3pid-types
/// [`ErrorKind::ThreepidInUse`]: ruma::api::client::error::ErrorKind::ThreepidInUse
/// [`ErrorKind::ThreepidDenied`]: ruma::api::client::error::ErrorKind::ThreepidDenied
/// [`ErrorKind::ThreepidInUse`]: ruma::api::error::ErrorKind::ThreepidInUse
/// [`ErrorKind::ThreepidDenied`]: ruma::api::error::ErrorKind::ThreepidDenied
pub async fn request_3pid_email_token(
&self,
client_secret: &ClientSecret,
@@ -743,8 +743,8 @@ impl Account {
/// # anyhow::Ok(()) };
/// ```
/// [3pid]: https://spec.matrix.org/v1.2/appendices/#3pid-types
/// [`ErrorKind::ThreepidInUse`]: ruma::api::client::error::ErrorKind::ThreepidInUse
/// [`ErrorKind::ThreepidDenied`]: ruma::api::client::error::ErrorKind::ThreepidDenied
/// [`ErrorKind::ThreepidInUse`]: ruma::api::error::ErrorKind::ThreepidInUse
/// [`ErrorKind::ThreepidDenied`]: ruma::api::error::ErrorKind::ThreepidDenied
pub async fn request_3pid_msisdn_token(
&self,
client_secret: &ClientSecret,

View File

@@ -504,7 +504,7 @@ impl MatrixAuth {
/// ```
///
/// [refreshing access tokens]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens
/// [`UnknownToken`]: ruma::api::client::error::ErrorKind::UnknownToken
/// [`UnknownToken`]: ruma::api::error::ErrorKind::UnknownToken
/// [restore the session]: Client::restore_session
/// [`ClientBuilder::handle_refresh_tokens()`]: crate::ClientBuilder::handle_refresh_tokens
pub async fn refresh_access_token(&self) -> Result<(), RefreshTokenError> {

View File

@@ -155,8 +155,8 @@
//! [MSC4108]: https://github.com/matrix-org/matrix-spec-proposals/pull/4108
//! [RFC 8628]: https://datatracker.ietf.org/doc/html/rfc8628
//! [`ClientBuilder::handle_refresh_tokens()`]: crate::ClientBuilder::handle_refresh_tokens()
//! [`Error`]: ruma::api::client::error::Error
//! [`ErrorKind::UnknownToken`]: ruma::api::client::error::ErrorKind::UnknownToken
//! [`Error`]: ruma::api::error::Error
//! [`ErrorKind::UnknownToken`]: ruma::api::error::ErrorKind::UnknownToken
//! [`examples/oauth_cli`]: https://github.com/matrix-org/matrix-rust-sdk/tree/main/examples/oauth_cli
#[cfg(feature = "e2e-encryption")]

View File

@@ -33,7 +33,7 @@ pub use oauth2::{
RequestTokenError, StandardErrorResponse,
basic::{BasicErrorResponse, BasicRequestTokenError},
};
use ruma::api::{client::error::ErrorKind, error::FromHttpResponseError};
use ruma::api::error::{ErrorKind, FromHttpResponseError};
use thiserror::Error;
use tokio::sync::Mutex;
use url::Url;

View File

@@ -56,7 +56,7 @@ fn response_to_error(status: StatusCode, body: Vec<u8>) -> HttpError {
match http::Response::builder().status(status).body(body).map_err(IntoHttpError::from) {
Ok(response) => {
let error = FromHttpResponseError::<RumaApiError>::Server(RumaApiError::ClientApi(
ruma::api::client::Error::from_http_response(response),
ruma::api::error::Error::from_http_response(response),
));
error.into()

View File

@@ -446,7 +446,7 @@ impl ClientBuilder {
/// to be able to [restore the session] later.
///
/// [refreshing access tokens]: https://spec.matrix.org/v1.3/client-server-api/#refreshing-access-tokens
/// [`UnknownToken`]: ruma::api::client::error::ErrorKind::UnknownToken
/// [`UnknownToken`]: ruma::api::error::ErrorKind::UnknownToken
/// [restore the session]: Client::restore_session
pub fn handle_refresh_tokens(mut self) -> Self {
self.handle_refresh_tokens = true;

View File

@@ -22,8 +22,8 @@ use matrix_sdk_common::{SendOutsideWasm, SyncOutsideWasm, boxed_into_future};
use oauth2::{RequestTokenError, basic::BasicErrorResponseType};
use ruma::api::{
OutgoingRequest,
client::{error::ErrorKind, media},
error::FromHttpResponseError,
client::media,
error::{ErrorKind, FromHttpResponseError},
path_builder::PathBuilder,
};
use tracing::{error, trace};

View File

@@ -61,7 +61,6 @@ use ruma::{
discover_homeserver::{self, RtcFocusInfo},
get_supported_versions,
},
error::{ErrorKind, UnknownTokenErrorData},
filter::{FilterDefinition, create_filter::v3::Request as FilterUploadRequest},
knock::knock_room,
media,
@@ -73,7 +72,7 @@ use ruma::{
uiaa,
user_directory::search_users,
},
error::FromHttpResponseError,
error::{ErrorKind, FromHttpResponseError, UnknownTokenErrorData},
path_builder::PathBuilder,
},
assign,

View File

@@ -36,8 +36,8 @@ use matrix_sdk_base::crypto::{
use ruma::serde::JsonCastable;
use ruma::{
OwnedRoomId, RoomId, TransactionId,
api::client::{
backup::{
api::{
client::backup::{
RoomKeyBackup, add_backup_keys, create_backup_version, get_backup_keys,
get_backup_keys_for_room, get_backup_keys_for_session, get_latest_backup_info,
},

View File

@@ -59,17 +59,19 @@ use matrix_sdk_base::{
use matrix_sdk_common::{executor::spawn, locks::Mutex as StdMutex};
use ruma::{
DeviceId, MilliSecondsSinceUnixEpoch, OwnedDeviceId, OwnedUserId, TransactionId, UserId,
api::client::{
api::{
client::{
keys::{
get_keys, upload_keys, upload_signatures::v3::Request as UploadSignaturesRequest,
upload_signing_keys::v3::Request as UploadSigningKeysRequest,
},
message::send_message_event,
to_device::send_event_to_device::v3::{
Request as RumaToDeviceRequest, Response as ToDeviceResponse,
},
uiaa::{AuthData, AuthType, OAuthParams, UiaaInfo},
},
error::{ErrorBody, StandardErrorBody},
keys::{
get_keys, upload_keys, upload_signatures::v3::Request as UploadSignaturesRequest,
upload_signing_keys::v3::Request as UploadSigningKeysRequest,
},
message::send_message_event,
to_device::send_event_to_device::v3::{
Request as RumaToDeviceRequest, Response as ToDeviceResponse,
},
uiaa::{AuthData, AuthType, OAuthParams, UiaaInfo},
},
assign,
events::room::{

View File

@@ -33,11 +33,8 @@ use reqwest::Error as ReqwestError;
use ruma::{
IdParseError,
api::{
client::{
error::{ErrorKind, RetryAfter},
uiaa::{UiaaInfo, UiaaResponse},
},
error::{FromHttpResponseError, IntoHttpError},
client::uiaa::{UiaaInfo, UiaaResponse},
error::{ErrorKind, FromHttpResponseError, IntoHttpError, RetryAfter},
},
events::{room::power_levels::PowerLevelsError, tag::InvalidUserTagName},
push::{InsertPushRuleError, RemovePushRuleError},
@@ -66,7 +63,7 @@ pub type HttpResult<T> = std::result::Result<T, HttpError>;
pub enum RumaApiError {
/// A client API response error.
#[error(transparent)]
ClientApi(ruma::api::client::Error),
ClientApi(ruma::api::error::Error),
/// A user-interactive authentication API error.
///
@@ -76,17 +73,13 @@ pub enum RumaApiError {
/// authenticate the user.
#[error("User-Interactive Authentication required.")]
Uiaa(UiaaInfo),
/// Another API response error.
#[error(transparent)]
Other(ruma::api::error::MatrixError),
}
impl RumaApiError {
/// If `self` is `ClientApi(e)`, returns `Some(e)`.
///
/// Otherwise, returns `None`.
pub fn as_client_api_error(&self) -> Option<&ruma::api::client::Error> {
pub fn as_client_api_error(&self) -> Option<&ruma::api::error::Error> {
as_variant!(self, Self::ClientApi)
}
}
@@ -137,7 +130,7 @@ impl HttpError {
/// Shorthand for
/// <code>.[as_ruma_api_error](Self::as_ruma_api_error)().[and_then](Option::and_then)([RumaApiError::as_client_api_error])</code>.
pub fn as_client_api_error(&self) -> Option<&ruma::api::client::Error> {
pub fn as_client_api_error(&self) -> Option<&ruma::api::error::Error> {
self.as_ruma_api_error().and_then(RumaApiError::as_client_api_error)
}
}
@@ -147,7 +140,7 @@ impl HttpError {
/// If `self` is a server error in the `errcode` + `error` format expected
/// for client-API endpoints, returns the error kind (`errcode`).
pub fn client_api_error_kind(&self) -> Option<&ErrorKind> {
self.as_client_api_error().and_then(ruma::api::client::Error::error_kind)
self.as_client_api_error().and_then(ruma::api::error::Error::error_kind)
}
/// Try to destructure the error into an universal interactive auth info.
@@ -224,7 +217,6 @@ impl RetryKind {
Some(ErrorKind::Unrecognized) => RetryKind::Permanent,
_ => RetryKind::from_status_code(client_error.status_code),
},
RumaApiError::Other(e) => RetryKind::from_status_code(e.status_code),
RumaApiError::Uiaa(_) => RetryKind::Permanent,
}
}
@@ -437,14 +429,14 @@ impl Error {
/// Shorthand for
/// <code>.[as_ruma_api_error](Self::as_ruma_api_error)().[and_then](Option::and_then)([RumaApiError::as_client_api_error])</code>.
pub fn as_client_api_error(&self) -> Option<&ruma::api::client::Error> {
pub fn as_client_api_error(&self) -> Option<&ruma::api::error::Error> {
self.as_ruma_api_error().and_then(RumaApiError::as_client_api_error)
}
/// If `self` is a server error in the `errcode` + `error` format expected
/// for client-API endpoints, returns the error kind (`errcode`).
pub fn client_api_error_kind(&self) -> Option<&ErrorKind> {
self.as_client_api_error().and_then(ruma::api::client::Error::error_kind)
self.as_client_api_error().and_then(ruma::api::error::Error::error_kind)
}
/// Try to destructure the error into an universal interactive auth info.
@@ -579,8 +571,8 @@ pub enum RoomKeyImportError {
Export(#[from] KeyExportError),
}
impl From<FromHttpResponseError<ruma::api::client::Error>> for HttpError {
fn from(err: FromHttpResponseError<ruma::api::client::Error>) -> Self {
impl From<FromHttpResponseError<ruma::api::error::Error>> for HttpError {
fn from(err: FromHttpResponseError<ruma::api::error::Error>) -> Self {
Self::Api(Box::new(err.map(RumaApiError::ClientApi)))
}
}
@@ -594,12 +586,6 @@ impl From<FromHttpResponseError<UiaaResponse>> for HttpError {
}
}
impl From<FromHttpResponseError<ruma::api::error::MatrixError>> for HttpError {
fn from(err: FromHttpResponseError<ruma::api::error::MatrixError>) -> Self {
Self::Api(Box::new(err.map(RumaApiError::Other)))
}
}
impl From<SdkBaseError> for Error {
fn from(e: SdkBaseError) -> Self {
match e {

View File

@@ -30,7 +30,8 @@ use ruma::{
MilliSecondsSinceUnixEpoch, MxcUri, OwnedMxcUri, TransactionId, UInt,
api::{
Metadata,
client::{authenticated_media, error::ErrorKind, media},
client::{authenticated_media, media},
error::ErrorKind,
},
assign,
events::room::{MediaSource, ThumbnailInfo},

View File

@@ -78,31 +78,33 @@ use ruma::events::{
use ruma::{
EventId, Int, MatrixToUri, MatrixUri, MxcUri, OwnedEventId, OwnedRoomId, OwnedServerName,
OwnedTransactionId, OwnedUserId, RoomId, TransactionId, UInt, UserId,
api::client::{
config::{set_global_account_data, set_room_account_data},
context,
error::ErrorKind,
filter::LazyLoadOptions,
membership::{
Invite3pid, ban_user, forget_room, get_member_events,
invite_user::{
self,
v3::{InvitationRecipient, InviteUserId},
api::{
client::{
config::{set_global_account_data, set_room_account_data},
context,
filter::LazyLoadOptions,
membership::{
Invite3pid, ban_user, forget_room, get_member_events,
invite_user::{
self,
v3::{InvitationRecipient, InviteUserId},
},
kick_user, leave_room, unban_user,
},
message::send_message_event,
read_marker::set_read_marker,
receipt::create_receipt,
redact::redact_event,
room::{get_room_event, report_content, report_room},
state::{get_state_event_for_key, send_state_event},
tag::{create_tag, delete_tag},
threads::{get_thread_subscription, subscribe_thread, unsubscribe_thread},
typing::create_typing_event::{
self,
v3::{Typing, TypingInfo},
},
kick_user, leave_room, unban_user,
},
message::send_message_event,
read_marker::set_read_marker,
receipt::create_receipt,
redact::redact_event,
room::{get_room_event, report_content, report_room},
state::{get_state_event_for_key, send_state_event},
tag::{create_tag, delete_tag},
threads::{get_thread_subscription, subscribe_thread, unsubscribe_thread},
typing::create_typing_event::{
self,
v3::{Typing, TypingInfo},
},
error::ErrorKind,
},
assign,
events::{

View File

@@ -24,7 +24,7 @@ use matrix_sdk_base::{
};
use ruma::{
OwnedUserId, UserId,
api::client::error::ErrorKind,
api::error::ErrorKind,
events::room::{MediaSource, history_visibility::HistoryVisibility},
};
use tracing::{debug, info, instrument, warn};

View File

@@ -38,7 +38,7 @@ use matrix_sdk_common::executor::JoinHandleExt as _;
use matrix_sdk_common::{executor::spawn, timer};
use ruma::{
OwnedRoomId, RoomId,
api::client::{error::ErrorKind, sync::sync_events::v5 as http},
api::{client::sync::sync_events::v5 as http, error::ErrorKind},
assign,
};
use tokio::{

View File

@@ -17,8 +17,10 @@ use std::collections::BTreeMap;
use as_variant::as_variant;
use ruma::{
OwnedEventId, OwnedRoomId,
api::client::{
delayed_events::{delayed_message_event, delayed_state_event, update_delayed_event},
api::{
client::delayed_events::{
delayed_message_event, delayed_state_event, update_delayed_event,
},
error::{ErrorBody, StandardErrorBody},
},
events::AnyTimelineEvent,

View File

@@ -12,15 +12,14 @@ use matrix_sdk_test::{async_test, test_json};
use ruma::{
OwnedUserId,
api::{
MatrixVersion,
self, MatrixVersion,
client::{
self as client_api,
account::register::{RegistrationKind, v3::Request as RegistrationRequest},
error::StandardErrorBody,
keys::upload_signatures::v3::SignedKeys,
session::get_login_types::v3::LoginType,
uiaa::{self, AuthData, MatrixUserIdentifier, UserIdentifier},
},
error::StandardErrorBody,
},
assign,
encryption::CrossSigningKey,
@@ -128,7 +127,7 @@ async fn test_login_with_sso() {
.mount(&server)
.await;
let idp = ruma::api::client::session::get_login_types::v3::IdentityProvider::new(
let idp = api::client::session::get_login_types::v3::IdentityProvider::new(
"some-id".to_owned(),
"idp-name".to_owned(),
);
@@ -237,11 +236,10 @@ async fn test_login_error() {
if let Some(RumaApiError::ClientApi(api_err)) = err.as_ruma_api_error() {
assert_eq!(api_err.status_code, http::StatusCode::from_u16(403).unwrap());
if let client_api::error::ErrorBody::Standard(StandardErrorBody {
kind, message, ..
}) = &api_err.body
if let api::error::ErrorBody::Standard(StandardErrorBody { kind, message, .. }) =
&api_err.body
{
if !matches!(*kind, client_api::error::ErrorKind::Forbidden) {
if !matches!(*kind, api::error::ErrorKind::Forbidden) {
panic!("found the wrong `ErrorKind` {kind:?}, expected `Forbidden");
}
@@ -281,11 +279,10 @@ async fn test_register_error() {
if let Err(err) = client.matrix_auth().register(user).await {
if let Some(api_err) = err.as_client_api_error() {
assert_eq!(api_err.status_code, http::StatusCode::from_u16(403).unwrap());
if let client_api::error::ErrorBody::Standard(StandardErrorBody {
kind, message, ..
}) = &api_err.body
if let api::error::ErrorBody::Standard(StandardErrorBody { kind, message, .. }) =
&api_err.body
{
if !matches!(*kind, client_api::error::ErrorKind::Forbidden) {
if !matches!(*kind, api::error::ErrorKind::Forbidden) {
panic!("found the wrong `ErrorKind` {kind:?}, expected `Forbidden");
}

View File

@@ -25,10 +25,8 @@ use matrix_sdk_test::{async_test, test_json};
use ruma::{
api::{
MatrixVersion,
client::{
account::register,
error::{ErrorKind, UnknownTokenErrorData},
},
client::account::register,
error::{ErrorKind, UnknownTokenErrorData},
},
assign, owned_device_id, owned_user_id,
};