diff --git a/crates/ruma-appservice-api/src/event/push_events.rs b/crates/ruma-appservice-api/src/event/push_events.rs index ed84bda3..99693bca 100644 --- a/crates/ruma-appservice-api/src/event/push_events.rs +++ b/crates/ruma-appservice-api/src/event/push_events.rs @@ -71,13 +71,13 @@ pub mod v1 { next_batch: impl Into, ) -> serde_json::Result { use ruma_client_api::sync::sync_events; - use ruma_common::RoomId; + use ruma_common::OwnedRoomId; use serde::Deserialize; use tracing::warn; #[derive(Debug, Deserialize)] struct EventDeHelper { - room_id: Option>, + room_id: Option, } let mut response = sync_events::v3::Response::new(next_batch.into()); diff --git a/crates/ruma-client-api/src/account/register.rs b/crates/ruma-client-api/src/account/register.rs index f4473e8c..77cd1d9d 100644 --- a/crates/ruma-client-api/src/account/register.rs +++ b/crates/ruma-client-api/src/account/register.rs @@ -7,7 +7,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3register - use ruma_common::{api::ruma_api, DeviceId, UserId}; + use ruma_common::{api::ruma_api, DeviceId, OwnedDeviceId, OwnedUserId}; use super::{LoginType, RegistrationKind}; use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse}; @@ -91,12 +91,12 @@ pub mod v3 { pub access_token: Option, /// The fully-qualified Matrix ID that has been registered. - pub user_id: Box, + pub user_id: OwnedUserId, /// ID of the registered device. /// /// Will be the same as the corresponding parameter in the request, if one was specified. - pub device_id: Option>, + pub device_id: Option, } error: UiaaResponse @@ -111,7 +111,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given user ID. - pub fn new(user_id: Box) -> Self { + pub fn new(user_id: OwnedUserId) -> Self { Self { access_token: None, user_id, device_id: None } } } diff --git a/crates/ruma-client-api/src/account/request_3pid_management_token_via_email.rs b/crates/ruma-client-api/src/account/request_3pid_management_token_via_email.rs index 439ea4c1..6fb3c2ef 100644 --- a/crates/ruma-client-api/src/account/request_3pid_management_token_via_email.rs +++ b/crates/ruma-client-api/src/account/request_3pid_management_token_via_email.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3account3pidemailrequesttoken use js_int::UInt; - use ruma_common::{api::ruma_api, ClientSecret, SessionId}; + use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo}; @@ -45,7 +45,7 @@ pub mod v3 { response: { /// The session identifier given by the identity server. - pub sid: Box, + pub sid: OwnedSessionId, /// URL to submit validation token to. /// @@ -73,7 +73,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given session identifier. - pub fn new(sid: Box) -> Self { + pub fn new(sid: OwnedSessionId) -> Self { Self { sid, submit_url: None } } } diff --git a/crates/ruma-client-api/src/account/request_3pid_management_token_via_msisdn.rs b/crates/ruma-client-api/src/account/request_3pid_management_token_via_msisdn.rs index e3087b15..2e86fc62 100644 --- a/crates/ruma-client-api/src/account/request_3pid_management_token_via_msisdn.rs +++ b/crates/ruma-client-api/src/account/request_3pid_management_token_via_msisdn.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3account3pidmsisdnrequesttoken use js_int::UInt; - use ruma_common::{api::ruma_api, ClientSecret, SessionId}; + use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo}; @@ -48,7 +48,7 @@ pub mod v3 { response: { /// The session identifier given by the identity server. - pub sid: Box, + pub sid: OwnedSessionId, /// URL to submit validation token to. /// @@ -88,7 +88,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given session identifier. - pub fn new(sid: Box) -> Self { + pub fn new(sid: OwnedSessionId) -> Self { Self { sid, submit_url: None } } } diff --git a/crates/ruma-client-api/src/account/request_openid_token.rs b/crates/ruma-client-api/src/account/request_openid_token.rs index 60e66829..f5163793 100644 --- a/crates/ruma-client-api/src/account/request_openid_token.rs +++ b/crates/ruma-client-api/src/account/request_openid_token.rs @@ -7,7 +7,7 @@ pub mod v3 { use std::time::Duration; - use ruma_common::{api::ruma_api, authentication::TokenType, ServerName, UserId}; + use ruma_common::{api::ruma_api, authentication::TokenType, OwnedServerName, UserId}; ruma_api! { metadata: { @@ -35,7 +35,7 @@ pub mod v3 { pub token_type: TokenType, /// Homeserver domain for verification of user's identity. - pub matrix_server_name: Box, + pub matrix_server_name: OwnedServerName, /// Seconds until token expiration. #[serde(with = "ruma_common::serde::duration::secs")] @@ -58,7 +58,7 @@ pub mod v3 { pub fn new( access_token: String, token_type: TokenType, - matrix_server_name: Box, + matrix_server_name: OwnedServerName, expires_in: Duration, ) -> Self { Self { access_token, token_type, matrix_server_name, expires_in } diff --git a/crates/ruma-client-api/src/account/request_password_change_token_via_email.rs b/crates/ruma-client-api/src/account/request_password_change_token_via_email.rs index 85e1fe99..0b80c5e3 100644 --- a/crates/ruma-client-api/src/account/request_password_change_token_via_email.rs +++ b/crates/ruma-client-api/src/account/request_password_change_token_via_email.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3accountpasswordemailrequesttoken use js_int::UInt; - use ruma_common::{api::ruma_api, ClientSecret, SessionId}; + use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo}; @@ -45,7 +45,7 @@ pub mod v3 { response: { /// The session identifier given by the identity server. - pub sid: Box, + pub sid: OwnedSessionId, /// URL to submit validation token to. /// @@ -74,7 +74,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given session identifier. - pub fn new(sid: Box) -> Self { + pub fn new(sid: OwnedSessionId) -> Self { Self { sid, submit_url: None } } } diff --git a/crates/ruma-client-api/src/account/request_password_change_token_via_msisdn.rs b/crates/ruma-client-api/src/account/request_password_change_token_via_msisdn.rs index 35c94ff8..a1b465c2 100644 --- a/crates/ruma-client-api/src/account/request_password_change_token_via_msisdn.rs +++ b/crates/ruma-client-api/src/account/request_password_change_token_via_msisdn.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3accountpasswordmsisdnrequesttoken use js_int::UInt; - use ruma_common::{api::ruma_api, ClientSecret, SessionId}; + use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId}; ruma_api! { metadata: { @@ -40,7 +40,7 @@ pub mod v3 { response: { /// The session identifier given by the identity server. - pub sid: Box, + pub sid: OwnedSessionId, /// URL to submit validation token to. /// @@ -74,7 +74,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given session identifier. - pub fn new(sid: Box) -> Self { + pub fn new(sid: OwnedSessionId) -> Self { Self { sid, submit_url: None } } } diff --git a/crates/ruma-client-api/src/account/request_registration_token_via_email.rs b/crates/ruma-client-api/src/account/request_registration_token_via_email.rs index 49dbcf11..13bc9927 100644 --- a/crates/ruma-client-api/src/account/request_registration_token_via_email.rs +++ b/crates/ruma-client-api/src/account/request_registration_token_via_email.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3registeremailrequesttoken use js_int::UInt; - use ruma_common::{api::ruma_api, ClientSecret, SessionId}; + use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo}; @@ -45,7 +45,7 @@ pub mod v3 { response: { /// The session identifier given by the identity server. - pub sid: Box, + pub sid: OwnedSessionId, /// URL to submit validation token to. /// @@ -74,7 +74,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given session identifier. - pub fn new(sid: Box) -> Self { + pub fn new(sid: OwnedSessionId) -> Self { Self { sid, submit_url: None } } } diff --git a/crates/ruma-client-api/src/account/request_registration_token_via_msisdn.rs b/crates/ruma-client-api/src/account/request_registration_token_via_msisdn.rs index 58506716..55b5bcf0 100644 --- a/crates/ruma-client-api/src/account/request_registration_token_via_msisdn.rs +++ b/crates/ruma-client-api/src/account/request_registration_token_via_msisdn.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3registermsisdnrequesttoken use js_int::UInt; - use ruma_common::{api::ruma_api, ClientSecret, SessionId}; + use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo}; @@ -48,7 +48,7 @@ pub mod v3 { response: { /// The session identifier given by the identity server. - pub sid: Box, + pub sid: OwnedSessionId, /// URL to submit validation token to. /// @@ -89,7 +89,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given session identifier. - pub fn new(sid: Box) -> Self { + pub fn new(sid: OwnedSessionId) -> Self { Self { sid, submit_url: None } } } diff --git a/crates/ruma-client-api/src/account/whoami.rs b/crates/ruma-client-api/src/account/whoami.rs index 4c7c2f0f..1adea7e0 100644 --- a/crates/ruma-client-api/src/account/whoami.rs +++ b/crates/ruma-client-api/src/account/whoami.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3accountwhoami - use ruma_common::{api::ruma_api, DeviceId, UserId}; + use ruma_common::{api::ruma_api, OwnedDeviceId, OwnedUserId}; ruma_api! { metadata: { @@ -24,11 +24,11 @@ pub mod v3 { response: { /// The id of the user that owns the access token. - pub user_id: Box, + pub user_id: OwnedUserId, /// The device ID associated with the access token, if any. #[serde(skip_serializing_if = "Option::is_none")] - pub device_id: Option>, + pub device_id: Option, /// If `true`, the user is a guest user. #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] @@ -47,7 +47,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given user ID. - pub fn new(user_id: Box, is_guest: bool) -> Self { + pub fn new(user_id: OwnedUserId, is_guest: bool) -> Self { Self { user_id, device_id: None, is_guest } } } diff --git a/crates/ruma-client-api/src/alias/get_alias.rs b/crates/ruma-client-api/src/alias/get_alias.rs index eda7c47b..786a24ff 100644 --- a/crates/ruma-client-api/src/alias/get_alias.rs +++ b/crates/ruma-client-api/src/alias/get_alias.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3directoryroomroomalias - use ruma_common::{api::ruma_api, RoomAliasId, RoomId, ServerName}; + use ruma_common::{api::ruma_api, OwnedRoomId, OwnedServerName, RoomAliasId}; ruma_api! { metadata: { @@ -27,10 +27,10 @@ pub mod v3 { response: { /// The room ID for this room alias. - pub room_id: Box, + pub room_id: OwnedRoomId, /// A list of servers that are aware of this room ID. - pub servers: Vec>, + pub servers: Vec, } error: crate::Error @@ -45,7 +45,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room id and servers - pub fn new(room_id: Box, servers: Vec>) -> Self { + pub fn new(room_id: OwnedRoomId, servers: Vec) -> Self { Self { room_id, servers } } } diff --git a/crates/ruma-client-api/src/backup.rs b/crates/ruma-client-api/src/backup.rs index ed1c2f63..edc30460 100644 --- a/crates/ruma-client-api/src/backup.rs +++ b/crates/ruma-client-api/src/backup.rs @@ -20,7 +20,7 @@ use std::collections::BTreeMap; use js_int::UInt; use ruma_common::{ serde::{Base64, Raw}, - DeviceKeyId, UserId, + OwnedDeviceKeyId, OwnedUserId, }; use serde::{Deserialize, Serialize}; @@ -51,7 +51,7 @@ pub enum BackupAlgorithm { public_key: Base64, /// Signatures of the auth_data as Signed JSON. - signatures: BTreeMap, BTreeMap, String>>, + signatures: BTreeMap>, }, } diff --git a/crates/ruma-client-api/src/backup/add_backup_keys.rs b/crates/ruma-client-api/src/backup/add_backup_keys.rs index 0776f67b..8859f5b5 100644 --- a/crates/ruma-client-api/src/backup/add_backup_keys.rs +++ b/crates/ruma-client-api/src/backup/add_backup_keys.rs @@ -8,7 +8,7 @@ pub mod v3 { use std::collections::BTreeMap; use js_int::UInt; - use ruma_common::{api::ruma_api, RoomId}; + use ruma_common::{api::ruma_api, OwnedRoomId}; use crate::backup::RoomKeyBackup; @@ -32,7 +32,7 @@ pub mod v3 { pub version: &'a str, /// A map of room IDs to session IDs to key data to store. - pub rooms: BTreeMap, RoomKeyBackup>, + pub rooms: BTreeMap, } response: { @@ -51,7 +51,7 @@ pub mod v3 { impl<'a> Request<'a> { /// Creates a new `Request` with the given version and room key backups. - pub fn new(version: &'a str, rooms: BTreeMap, RoomKeyBackup>) -> Self { + pub fn new(version: &'a str, rooms: BTreeMap) -> Self { Self { version, rooms } } } diff --git a/crates/ruma-client-api/src/backup/get_backup_keys.rs b/crates/ruma-client-api/src/backup/get_backup_keys.rs index b08d99cc..a607c6fa 100644 --- a/crates/ruma-client-api/src/backup/get_backup_keys.rs +++ b/crates/ruma-client-api/src/backup/get_backup_keys.rs @@ -9,7 +9,7 @@ pub mod v3 { use std::collections::BTreeMap; - use ruma_common::{api::ruma_api, RoomId}; + use ruma_common::{api::ruma_api, OwnedRoomId}; use crate::backup::RoomKeyBackup; @@ -34,7 +34,7 @@ pub mod v3 { response: { /// A map from room IDs to session IDs to key data. - pub rooms: BTreeMap, RoomKeyBackup>, + pub rooms: BTreeMap, } error: crate::Error @@ -49,7 +49,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room key backups. - pub fn new(rooms: BTreeMap, RoomKeyBackup>) -> Self { + pub fn new(rooms: BTreeMap) -> Self { Self { rooms } } } diff --git a/crates/ruma-client-api/src/device.rs b/crates/ruma-client-api/src/device.rs index 8ae251ca..387991cc 100644 --- a/crates/ruma-client-api/src/device.rs +++ b/crates/ruma-client-api/src/device.rs @@ -1,6 +1,6 @@ //! Endpoints for managing devices. -use ruma_common::{DeviceId, MilliSecondsSinceUnixEpoch}; +use ruma_common::{MilliSecondsSinceUnixEpoch, OwnedDeviceId}; use serde::{Deserialize, Serialize}; pub mod delete_device; @@ -14,7 +14,7 @@ pub mod update_device; #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct Device { /// Device ID - pub device_id: Box, + pub device_id: OwnedDeviceId, /// Public display name of the device. pub display_name: Option, @@ -29,7 +29,7 @@ pub struct Device { impl Device { /// Creates a new `Device` with the given device ID. - pub fn new(device_id: Box) -> Self { + pub fn new(device_id: OwnedDeviceId) -> Self { Self { device_id, display_name: None, last_seen_ip: None, last_seen_ts: None } } } diff --git a/crates/ruma-client-api/src/device/delete_devices.rs b/crates/ruma-client-api/src/device/delete_devices.rs index 2f120937..1b5ba652 100644 --- a/crates/ruma-client-api/src/device/delete_devices.rs +++ b/crates/ruma-client-api/src/device/delete_devices.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3delete_devices - use ruma_common::{api::ruma_api, DeviceId}; + use ruma_common::{api::ruma_api, OwnedDeviceId}; use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse}; @@ -23,7 +23,7 @@ pub mod v3 { request: { /// List of devices to delete. - pub devices: &'a [Box], + pub devices: &'a [OwnedDeviceId], /// Additional authentication information for the user-interactive authentication API. #[serde(skip_serializing_if = "Option::is_none")] @@ -38,7 +38,7 @@ pub mod v3 { impl<'a> Request<'a> { /// Creates a new `Request` with the given device list. - pub fn new(devices: &'a [Box]) -> Self { + pub fn new(devices: &'a [OwnedDeviceId]) -> Self { Self { devices, auth: None } } } diff --git a/crates/ruma-client-api/src/filter.rs b/crates/ruma-client-api/src/filter.rs index 0eefcbfe..ecce7847 100644 --- a/crates/ruma-client-api/src/filter.rs +++ b/crates/ruma-client-api/src/filter.rs @@ -9,7 +9,7 @@ mod url; use js_int::UInt; use ruma_common::{ serde::{Incoming, StringEnum}, - OwnedRoomId, RoomId, UserId, + OwnedRoomId, OwnedUserId, }; use serde::Serialize; @@ -116,13 +116,13 @@ pub struct RoomEventFilter<'a> { /// If this list is absent then no senders are excluded. A matching sender will be excluded /// even if it is listed in the 'senders' filter. #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub not_senders: &'a [Box], + pub not_senders: &'a [OwnedUserId], /// A list of senders IDs to include. /// /// If this list is absent then all senders are included. #[serde(skip_serializing_if = "Option::is_none")] - pub senders: Option<&'a [Box]>, + pub senders: Option<&'a [OwnedUserId]>, /// A list of event types to include. /// @@ -169,7 +169,7 @@ pub struct RoomEventFilter<'a> { default, skip_serializing_if = "<[_]>::is_empty" )] - pub related_by_senders: &'a [Box], + pub related_by_senders: &'a [OwnedUserId], } impl<'a> RoomEventFilter<'a> { @@ -260,14 +260,14 @@ pub struct RoomFilter<'a> { /// it is listed in the 'rooms' filter. This filter is applied before the filters in /// `ephemeral`, `state`, `timeline` or `account_data`. #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub not_rooms: &'a [Box], + pub not_rooms: &'a [OwnedRoomId], /// A list of room IDs to include. /// /// If this list is absent then all rooms are included. This filter is applied before the /// filters in `ephemeral`, `state`, `timeline` or `account_data`. #[serde(skip_serializing_if = "Option::is_none")] - pub rooms: Option<&'a [Box]>, + pub rooms: Option<&'a [OwnedRoomId]>, } impl<'a> RoomFilter<'a> { @@ -329,7 +329,7 @@ pub struct Filter<'a> { /// /// If this list is absent then all senders are included. #[serde(skip_serializing_if = "Option::is_none")] - pub senders: Option<&'a [Box]>, + pub senders: Option<&'a [OwnedUserId]>, /// A list of event types to include. /// @@ -343,7 +343,7 @@ pub struct Filter<'a> { /// If this list is absent then no senders are excluded. A matching sender will be excluded /// even if it is listed in the 'senders' filter. #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub not_senders: &'a [Box], + pub not_senders: &'a [OwnedUserId], } impl<'a> Filter<'a> { diff --git a/crates/ruma-client-api/src/keys/claim_keys.rs b/crates/ruma-client-api/src/keys/claim_keys.rs index d00467a4..baf642b5 100644 --- a/crates/ruma-client-api/src/keys/claim_keys.rs +++ b/crates/ruma-client-api/src/keys/claim_keys.rs @@ -8,8 +8,8 @@ pub mod v3 { use std::{collections::BTreeMap, time::Duration}; use ruma_common::{ - api::ruma_api, encryption::OneTimeKey, serde::Raw, DeviceId, DeviceKeyAlgorithm, - DeviceKeyId, UserId, + api::ruma_api, encryption::OneTimeKey, serde::Raw, DeviceKeyAlgorithm, OwnedDeviceId, + OwnedDeviceKeyId, OwnedUserId, }; use serde_json::Value as JsonValue; @@ -36,7 +36,7 @@ pub mod v3 { pub timeout: Option, /// The keys to be claimed. - pub one_time_keys: BTreeMap, BTreeMap, DeviceKeyAlgorithm>>, + pub one_time_keys: BTreeMap>, } response: { @@ -45,7 +45,7 @@ pub mod v3 { pub failures: BTreeMap, /// One-time keys for the queried devices. - pub one_time_keys: BTreeMap, OneTimeKeys>, + pub one_time_keys: BTreeMap, } error: crate::Error @@ -54,7 +54,7 @@ pub mod v3 { impl Request { /// Creates a new `Request` with the given key claims and the recommended 10 second timeout. pub fn new( - one_time_keys: BTreeMap, BTreeMap, DeviceKeyAlgorithm>>, + one_time_keys: BTreeMap>, ) -> Self { Self { timeout: Some(Duration::from_secs(10)), one_time_keys } } @@ -62,11 +62,11 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given keys and no failures. - pub fn new(one_time_keys: BTreeMap, OneTimeKeys>) -> Self { + pub fn new(one_time_keys: BTreeMap) -> Self { Self { failures: BTreeMap::new(), one_time_keys } } } /// The one-time keys for a given device. - pub type OneTimeKeys = BTreeMap, BTreeMap, Raw>>; + pub type OneTimeKeys = BTreeMap>>; } diff --git a/crates/ruma-client-api/src/keys/get_key_changes.rs b/crates/ruma-client-api/src/keys/get_key_changes.rs index 9c3aea7f..d5607dba 100644 --- a/crates/ruma-client-api/src/keys/get_key_changes.rs +++ b/crates/ruma-client-api/src/keys/get_key_changes.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3keyschanges - use ruma_common::{api::ruma_api, UserId}; + use ruma_common::{api::ruma_api, OwnedUserId}; ruma_api! { metadata: { @@ -36,11 +36,11 @@ pub mod v3 { response: { /// The Matrix User IDs of all users who updated their device identity keys. - pub changed: Vec>, + pub changed: Vec, /// The Matrix User IDs of all users who may have left all the end-to-end /// encrypted rooms they previously shared with the user. - pub left: Vec>, + pub left: Vec, } error: crate::Error @@ -55,7 +55,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given changed and left user ID lists. - pub fn new(changed: Vec>, left: Vec>) -> Self { + pub fn new(changed: Vec, left: Vec) -> Self { Self { changed, left } } } diff --git a/crates/ruma-client-api/src/keys/get_keys.rs b/crates/ruma-client-api/src/keys/get_keys.rs index 9eab924f..0e299489 100644 --- a/crates/ruma-client-api/src/keys/get_keys.rs +++ b/crates/ruma-client-api/src/keys/get_keys.rs @@ -11,7 +11,7 @@ pub mod v3 { api::ruma_api, encryption::{CrossSigningKey, DeviceKeys}, serde::Raw, - DeviceId, UserId, + OwnedDeviceId, OwnedUserId, }; use serde_json::Value as JsonValue; @@ -42,7 +42,7 @@ pub mod v3 { /// The keys to be downloaded. /// /// An empty list indicates all devices for the corresponding user. - pub device_keys: BTreeMap, Vec>>, + pub device_keys: BTreeMap>, /// If the client is fetching keys as a result of a device update received in a sync /// request, this should be the 'since' token of that sync request, or any later sync token. @@ -63,19 +63,19 @@ pub mod v3 { /// Information on the queried devices. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub device_keys: BTreeMap, BTreeMap, Raw>>, + pub device_keys: BTreeMap>>, /// Information on the master cross-signing keys of the queried users. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub master_keys: BTreeMap, Raw>, + pub master_keys: BTreeMap>, /// Information on the self-signing keys of the queried users. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub self_signing_keys: BTreeMap, Raw>, + pub self_signing_keys: BTreeMap>, /// Information on the user-signing keys of the queried users. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub user_signing_keys: BTreeMap, Raw>, + pub user_signing_keys: BTreeMap>, } error: crate::Error diff --git a/crates/ruma-client-api/src/keys/upload_keys.rs b/crates/ruma-client-api/src/keys/upload_keys.rs index a50c4ec8..a66907cf 100644 --- a/crates/ruma-client-api/src/keys/upload_keys.rs +++ b/crates/ruma-client-api/src/keys/upload_keys.rs @@ -12,7 +12,7 @@ pub mod v3 { api::ruma_api, encryption::{DeviceKeys, OneTimeKey}, serde::Raw, - DeviceKeyAlgorithm, DeviceKeyId, + DeviceKeyAlgorithm, OwnedDeviceKeyId, }; ruma_api! { @@ -37,11 +37,11 @@ pub mod v3 { /// One-time public keys for "pre-key" messages. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub one_time_keys: BTreeMap, Raw>, + pub one_time_keys: BTreeMap>, /// Fallback public keys for "pre-key" messages. #[serde(default, skip_serializing_if = "BTreeMap::is_empty", rename = "org.matrix.msc2732.fallback_keys")] - pub fallback_keys: BTreeMap, Raw>, + pub fallback_keys: BTreeMap>, } response: { diff --git a/crates/ruma-client-api/src/keys/upload_signatures.rs b/crates/ruma-client-api/src/keys/upload_signatures.rs index b0354ca5..a3417945 100644 --- a/crates/ruma-client-api/src/keys/upload_signatures.rs +++ b/crates/ruma-client-api/src/keys/upload_signatures.rs @@ -11,7 +11,7 @@ pub mod v3 { api::ruma_api, encryption::{CrossSigningKey, DeviceKeys}, serde::{Raw, StringEnum}, - DeviceId, UserId, + OwnedDeviceId, OwnedUserId, }; use serde::{Deserialize, Serialize}; use serde_json::value::RawValue as RawJsonValue; @@ -35,13 +35,13 @@ pub mod v3 { request: { /// Signed keys. #[ruma_api(body)] - pub signed_keys: BTreeMap, SignedKeys>, + pub signed_keys: BTreeMap, } #[derive(Default)] response: { /// Signature processing failures. - pub failures: BTreeMap, BTreeMap>, + pub failures: BTreeMap>, } error: crate::Error @@ -49,7 +49,7 @@ pub mod v3 { impl Request { /// Creates a new `Request` with the given signed keys. - pub fn new(signed_keys: BTreeMap, SignedKeys>) -> Self { + pub fn new(signed_keys: BTreeMap) -> Self { Self { signed_keys } } } @@ -73,8 +73,8 @@ pub mod v3 { } /// Add the given device keys. - pub fn add_device_keys(&mut self, device_id: Box, device_keys: Raw) { - self.0.insert(device_id.into(), device_keys.into_json()); + pub fn add_device_keys(&mut self, device_id: OwnedDeviceId, device_keys: Raw) { + self.0.insert(device_id.as_str().into(), device_keys.into_json()); } /// Add the given cross signing keys. diff --git a/crates/ruma-client-api/src/knock/knock_room.rs b/crates/ruma-client-api/src/knock/knock_room.rs index 610044bf..b596113b 100644 --- a/crates/ruma-client-api/src/knock/knock_room.rs +++ b/crates/ruma-client-api/src/knock/knock_room.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3knockroomidoralias - use ruma_common::{api::ruma_api, RoomId, RoomOrAliasId, ServerName}; + use ruma_common::{api::ruma_api, OwnedRoomId, OwnedServerName, RoomOrAliasId}; ruma_api! { metadata: { @@ -33,12 +33,12 @@ pub mod v3 { /// One of the servers must be participating in the room. #[ruma_api(query)] #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub server_name: &'a [Box], + pub server_name: &'a [OwnedServerName], } response: { /// The room that the user knocked on. - pub room_id: Box, + pub room_id: OwnedRoomId, } } @@ -51,7 +51,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room ID. - pub fn new(room_id: Box) -> Self { + pub fn new(room_id: OwnedRoomId) -> Self { Self { room_id } } } diff --git a/crates/ruma-client-api/src/membership.rs b/crates/ruma-client-api/src/membership.rs index e0fa2065..9e079394 100644 --- a/crates/ruma-client-api/src/membership.rs +++ b/crates/ruma-client-api/src/membership.rs @@ -14,7 +14,9 @@ pub mod unban_user; use std::collections::BTreeMap; -use ruma_common::{serde::Incoming, thirdparty::Medium, ServerName, ServerSigningKeyId, UserId}; +use ruma_common::{ + serde::Incoming, thirdparty::Medium, OwnedServerName, ServerSigningKeyId, UserId, +}; use serde::Serialize; /// A signature of an `m.third_party_invite` token to prove that this user owns a third party @@ -32,7 +34,7 @@ pub struct ThirdPartySigned<'a> { pub token: &'a str, /// A signatures object containing a signature of the entire signed object. - pub signatures: BTreeMap, BTreeMap, String>>, + pub signatures: BTreeMap, String>>, } impl<'a> ThirdPartySigned<'a> { @@ -42,7 +44,7 @@ impl<'a> ThirdPartySigned<'a> { sender: &'a UserId, mxid: &'a UserId, token: &'a str, - signatures: BTreeMap, BTreeMap, String>>, + signatures: BTreeMap, String>>, ) -> Self { Self { sender, mxid, token, signatures } } diff --git a/crates/ruma-client-api/src/membership/join_room_by_id.rs b/crates/ruma-client-api/src/membership/join_room_by_id.rs index 52d0c49e..b815597d 100644 --- a/crates/ruma-client-api/src/membership/join_room_by_id.rs +++ b/crates/ruma-client-api/src/membership/join_room_by_id.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3roomsroomidjoin - use ruma_common::{api::ruma_api, RoomId}; + use ruma_common::{api::ruma_api, OwnedRoomId, RoomId}; use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned}; @@ -38,7 +38,7 @@ pub mod v3 { response: { /// The room that the user joined. - pub room_id: Box, + pub room_id: OwnedRoomId, } error: crate::Error @@ -53,7 +53,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room id. - pub fn new(room_id: Box) -> Self { + pub fn new(room_id: OwnedRoomId) -> Self { Self { room_id } } } diff --git a/crates/ruma-client-api/src/membership/join_room_by_id_or_alias.rs b/crates/ruma-client-api/src/membership/join_room_by_id_or_alias.rs index cfa28463..8e770e69 100644 --- a/crates/ruma-client-api/src/membership/join_room_by_id_or_alias.rs +++ b/crates/ruma-client-api/src/membership/join_room_by_id_or_alias.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3joinroomidoralias - use ruma_common::{api::ruma_api, RoomId, RoomOrAliasId, ServerName}; + use ruma_common::{api::ruma_api, OwnedRoomId, OwnedServerName, RoomOrAliasId}; use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned}; @@ -31,7 +31,7 @@ pub mod v3 { /// One of the servers must be participating in the room. #[ruma_api(query)] #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub server_name: &'a [Box], + pub server_name: &'a [OwnedServerName], /// The signature of a `m.third_party_invite` token to prove that this user owns a third /// party identity which has been invited to the room. @@ -45,7 +45,7 @@ pub mod v3 { response: { /// The room that the user joined. - pub room_id: Box, + pub room_id: OwnedRoomId, } error: crate::Error @@ -60,7 +60,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room ID. - pub fn new(room_id: Box) -> Self { + pub fn new(room_id: OwnedRoomId) -> Self { Self { room_id } } } diff --git a/crates/ruma-client-api/src/membership/joined_members.rs b/crates/ruma-client-api/src/membership/joined_members.rs index 3e6c3f12..760ee62c 100644 --- a/crates/ruma-client-api/src/membership/joined_members.rs +++ b/crates/ruma-client-api/src/membership/joined_members.rs @@ -7,7 +7,7 @@ pub mod v3 { use std::collections::BTreeMap; - use ruma_common::{api::ruma_api, MxcUri, RoomId, UserId}; + use ruma_common::{api::ruma_api, MxcUri, OwnedUserId, RoomId}; use serde::{Deserialize, Serialize}; ruma_api! { @@ -31,7 +31,7 @@ pub mod v3 { response: { /// A list of the rooms the user is in, i.e. /// the ID of each room in which the user has joined membership. - pub joined: BTreeMap, RoomMember>, + pub joined: BTreeMap, } error: crate::Error @@ -46,7 +46,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given joined rooms. - pub fn new(joined: BTreeMap, RoomMember>) -> Self { + pub fn new(joined: BTreeMap) -> Self { Self { joined } } } diff --git a/crates/ruma-client-api/src/membership/joined_rooms.rs b/crates/ruma-client-api/src/membership/joined_rooms.rs index ce3082d7..490f4fdf 100644 --- a/crates/ruma-client-api/src/membership/joined_rooms.rs +++ b/crates/ruma-client-api/src/membership/joined_rooms.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3joined_rooms - use ruma_common::{api::ruma_api, RoomId}; + use ruma_common::{api::ruma_api, OwnedRoomId}; ruma_api! { metadata: { @@ -25,7 +25,7 @@ pub mod v3 { response: { /// A list of the rooms the user is in, i.e. the ID of each room in /// which the user has joined membership. - pub joined_rooms: Vec>, + pub joined_rooms: Vec, } error: crate::Error @@ -40,7 +40,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given joined rooms. - pub fn new(joined_rooms: Vec>) -> Self { + pub fn new(joined_rooms: Vec) -> Self { Self { joined_rooms } } } diff --git a/crates/ruma-client-api/src/message/send_message_event.rs b/crates/ruma-client-api/src/message/send_message_event.rs index 8ff5b9c3..714aa34e 100644 --- a/crates/ruma-client-api/src/message/send_message_event.rs +++ b/crates/ruma-client-api/src/message/send_message_event.rs @@ -9,7 +9,7 @@ pub mod v3 { api::ruma_api, events::{AnyMessageLikeEventContent, MessageLikeEventContent, MessageLikeEventType}, serde::Raw, - EventId, RoomId, TransactionId, + OwnedEventId, RoomId, TransactionId, }; use serde_json::value::to_raw_value as to_raw_json_value; @@ -49,7 +49,7 @@ pub mod v3 { response: { /// A unique identifier for the event. - pub event_id: Box, + pub event_id: OwnedEventId, } error: crate::Error @@ -92,7 +92,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given event id. - pub fn new(event_id: Box) -> Self { + pub fn new(event_id: OwnedEventId) -> Self { Self { event_id } } } diff --git a/crates/ruma-client-api/src/push/get_notifications.rs b/crates/ruma-client-api/src/push/get_notifications.rs index b4584540..14e9a2f4 100644 --- a/crates/ruma-client-api/src/push/get_notifications.rs +++ b/crates/ruma-client-api/src/push/get_notifications.rs @@ -8,7 +8,7 @@ pub mod v3 { use js_int::UInt; use ruma_common::{ api::ruma_api, events::AnySyncRoomEvent, push::Action, serde::Raw, - MilliSecondsSinceUnixEpoch, RoomId, + MilliSecondsSinceUnixEpoch, OwnedRoomId, }; use serde::{Deserialize, Serialize}; @@ -94,7 +94,7 @@ pub mod v3 { pub read: bool, /// The ID of the room in which the event was posted. - pub room_id: Box, + pub room_id: OwnedRoomId, /// The time at which the event notification was sent. pub ts: MilliSecondsSinceUnixEpoch, @@ -107,7 +107,7 @@ pub mod v3 { actions: Vec, event: Raw, read: bool, - room_id: Box, + room_id: OwnedRoomId, ts: MilliSecondsSinceUnixEpoch, ) -> Self { Self { actions, event, profile_tag: None, read, room_id, ts } diff --git a/crates/ruma-client-api/src/redact/redact_event.rs b/crates/ruma-client-api/src/redact/redact_event.rs index 47b2f59d..60e7ef2e 100644 --- a/crates/ruma-client-api/src/redact/redact_event.rs +++ b/crates/ruma-client-api/src/redact/redact_event.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#put_matrixclientv3roomsroomidredacteventidtxnid - use ruma_common::{api::ruma_api, EventId, RoomId, TransactionId}; + use ruma_common::{api::ruma_api, EventId, OwnedEventId, RoomId, TransactionId}; ruma_api! { metadata: { @@ -42,7 +42,7 @@ pub mod v3 { response: { /// The ID of the redacted event. - pub event_id: Box, + pub event_id: OwnedEventId, } error: crate::Error @@ -57,7 +57,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given event ID. - pub fn new(event_id: Box) -> Self { + pub fn new(event_id: OwnedEventId) -> Self { Self { event_id } } } diff --git a/crates/ruma-client-api/src/room/aliases.rs b/crates/ruma-client-api/src/room/aliases.rs index 971e3209..cf0a72f7 100644 --- a/crates/ruma-client-api/src/room/aliases.rs +++ b/crates/ruma-client-api/src/room/aliases.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3roomsroomidaliases - use ruma_common::{api::ruma_api, RoomAliasId, RoomId}; + use ruma_common::{api::ruma_api, OwnedRoomAliasId, RoomId}; ruma_api! { metadata: { @@ -28,7 +28,7 @@ pub mod v3 { response: { /// The server's local aliases on the room. - pub aliases: Vec>, + pub aliases: Vec, } error: crate::Error @@ -43,7 +43,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given aliases. - pub fn new(aliases: Vec>) -> Self { + pub fn new(aliases: Vec) -> Self { Self { aliases } } } diff --git a/crates/ruma-client-api/src/room/create_room.rs b/crates/ruma-client-api/src/room/create_room.rs index f87d0ded..1e91af34 100644 --- a/crates/ruma-client-api/src/room/create_room.rs +++ b/crates/ruma-client-api/src/room/create_room.rs @@ -17,7 +17,7 @@ pub mod v3 { }, room::RoomType, serde::{Raw, StringEnum}, - OwnedUserId, RoomId, RoomName, RoomVersionId, UserId, + OwnedRoomId, OwnedUserId, RoomName, RoomVersionId, }; use serde::{Deserialize, Serialize}; @@ -55,7 +55,7 @@ pub mod v3 { /// /// This will tell the server to invite everyone in the list to the newly created room. #[serde(default, skip_serializing_if = "<[_]>::is_empty")] - pub invite: &'a [Box], + pub invite: &'a [OwnedUserId], /// List of third party IDs of users to invite. #[serde(default, skip_serializing_if = "<[_]>::is_empty")] @@ -103,7 +103,7 @@ pub mod v3 { response: { /// The created room's ID. - pub room_id: Box, + pub room_id: OwnedRoomId, } error: crate::Error @@ -118,7 +118,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room id. - pub fn new(room_id: Box) -> Self { + pub fn new(room_id: OwnedRoomId) -> Self { Self { room_id } } } diff --git a/crates/ruma-client-api/src/room/upgrade_room.rs b/crates/ruma-client-api/src/room/upgrade_room.rs index 554675ac..9660f22e 100644 --- a/crates/ruma-client-api/src/room/upgrade_room.rs +++ b/crates/ruma-client-api/src/room/upgrade_room.rs @@ -5,7 +5,7 @@ pub mod v3 { //! //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3roomsroomidupgrade - use ruma_common::{api::ruma_api, RoomId, RoomVersionId}; + use ruma_common::{api::ruma_api, OwnedRoomId, RoomId, RoomVersionId}; ruma_api! { metadata: { @@ -30,7 +30,7 @@ pub mod v3 { response: { /// ID of the new room. - pub replacement_room: Box, + pub replacement_room: OwnedRoomId, } error: crate::Error @@ -45,7 +45,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given room ID. - pub fn new(replacement_room: Box) -> Self { + pub fn new(replacement_room: OwnedRoomId) -> Self { Self { replacement_room } } } diff --git a/crates/ruma-client-api/src/search/search_events.rs b/crates/ruma-client-api/src/search/search_events.rs index c9f14755..ccb231b6 100644 --- a/crates/ruma-client-api/src/search/search_events.rs +++ b/crates/ruma-client-api/src/search/search_events.rs @@ -12,7 +12,7 @@ pub mod v3 { api::ruma_api, events::{AnyRoomEvent, AnyStateEvent}, serde::{Incoming, Raw, StringEnum}, - EventId, MxcUri, RoomId, UserId, + MxcUri, OwnedEventId, OwnedRoomId, OwnedUserId, }; use serde::{Deserialize, Serialize}; @@ -206,7 +206,7 @@ pub mod v3 { /// The historic profile information of the users that sent the events returned. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub profile_info: BTreeMap, UserProfile>, + pub profile_info: BTreeMap, /// Pagination token for the start of the chunk. #[serde(skip_serializing_if = "Option::is_none")] @@ -371,7 +371,7 @@ pub mod v3 { /// Any groups that were requested. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub groups: BTreeMap, ResultGroup>>, + pub groups: BTreeMap>, /// Token that can be used to get the next batch of results, by passing as the `next_batch` /// parameter to the next call. @@ -388,7 +388,7 @@ pub mod v3 { /// /// This is included if the request had the `include_state` key set with a value of `true`. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub state: BTreeMap, Vec>>, + pub state: BTreeMap>>, /// List of words which should be highlighted, useful for stemming which may /// change the query terms. @@ -430,7 +430,7 @@ pub mod v3 { /// Which results are in this group. #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub results: Vec>, + pub results: Vec, } impl ResultGroup { @@ -511,11 +511,11 @@ pub mod v3 { /// Represents either a room or user ID for returning grouped search results. #[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[allow(clippy::exhaustive_enums)] - pub enum RoomIdOrUserId { + pub enum OwnedRoomIdOrUserId { /// Represents a room ID. - RoomId(Box), + RoomId(OwnedRoomId), /// Represents a user ID. - UserId(Box), + UserId(OwnedUserId), } } diff --git a/crates/ruma-client-api/src/server/get_user_info.rs b/crates/ruma-client-api/src/server/get_user_info.rs index f3fa0d25..18394c04 100644 --- a/crates/ruma-client-api/src/server/get_user_info.rs +++ b/crates/ruma-client-api/src/server/get_user_info.rs @@ -7,7 +7,7 @@ pub mod v3 { use std::collections::BTreeMap; - use ruma_common::{api::ruma_api, MilliSecondsSinceUnixEpoch, UserId}; + use ruma_common::{api::ruma_api, MilliSecondsSinceUnixEpoch, OwnedUserId, UserId}; use serde::{Deserialize, Serialize}; ruma_api! { @@ -32,7 +32,7 @@ pub mod v3 { response: { /// The Matrix user ID of the user. #[serde(skip_serializing_if = "Option::is_none")] - pub user_id: Option>, + pub user_id: Option, /// A map of the user's device identifiers to information about that device. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] diff --git a/crates/ruma-client-api/src/session/login.rs b/crates/ruma-client-api/src/session/login.rs index 7c48f0c9..7fdb53e9 100644 --- a/crates/ruma-client-api/src/session/login.rs +++ b/crates/ruma-client-api/src/session/login.rs @@ -8,7 +8,7 @@ pub mod v3 { use ruma_common::{ api::ruma_api, serde::{Incoming, JsonObject}, - DeviceId, ServerName, UserId, + DeviceId, OwnedDeviceId, OwnedServerName, OwnedUserId, }; use serde::{ de::{self, DeserializeOwned}, @@ -48,7 +48,7 @@ pub mod v3 { response: { /// The fully-qualified Matrix ID that has been registered. - pub user_id: Box, + pub user_id: OwnedUserId, /// An access token for the account. pub access_token: String, @@ -58,13 +58,13 @@ pub mod v3 { /// Deprecated: Clients should instead use the `user_id.server_name()` /// method if they require it. #[serde(skip_serializing_if = "Option::is_none")] - pub home_server: Option>, + pub home_server: Option, /// ID of the logged-in device. /// /// Will be the same as the corresponding parameter in the request, if one was /// specified. - pub device_id: Box, + pub device_id: OwnedDeviceId, /// Client configuration provided by the server. /// @@ -85,7 +85,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given user ID, access token and device ID. - pub fn new(user_id: Box, access_token: String, device_id: Box) -> Self { + pub fn new(user_id: OwnedUserId, access_token: String, device_id: OwnedDeviceId) -> Self { Self { user_id, access_token, home_server: None, device_id, well_known: None } } } diff --git a/crates/ruma-client-api/src/space.rs b/crates/ruma-client-api/src/space.rs index 51082a5b..f2039501 100644 --- a/crates/ruma-client-api/src/space.rs +++ b/crates/ruma-client-api/src/space.rs @@ -9,7 +9,7 @@ use ruma_common::{ events::space::child::HierarchySpaceChildEvent, room::RoomType, serde::{Raw, StringEnum}, - MxcUri, RoomAliasId, RoomId, RoomName, + MxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName, }; use serde::{Deserialize, Serialize}; @@ -30,7 +30,7 @@ pub struct SpaceHierarchyRoomsChunk { feature = "compat", serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") )] - pub canonical_alias: Option>, + pub canonical_alias: Option, /// The name of the room, if any. #[serde(skip_serializing_if = "Option::is_none")] @@ -40,7 +40,7 @@ pub struct SpaceHierarchyRoomsChunk { pub num_joined_members: UInt, /// The ID of the room. - pub room_id: Box, + pub room_id: OwnedRoomId, /// The topic of the room, if any. #[serde(skip_serializing_if = "Option::is_none")] @@ -89,7 +89,7 @@ pub struct SpaceHierarchyRoomsChunkInit { pub num_joined_members: UInt, /// The ID of the room. - pub room_id: Box, + pub room_id: OwnedRoomId, /// Whether the room may be viewed by guest users without joining. pub world_readable: bool, diff --git a/crates/ruma-client-api/src/state/send_state_event.rs b/crates/ruma-client-api/src/state/send_state_event.rs index 64260b5b..4c77090e 100644 --- a/crates/ruma-client-api/src/state/send_state_event.rs +++ b/crates/ruma-client-api/src/state/send_state_event.rs @@ -9,7 +9,7 @@ pub mod v3 { api::ruma_api, events::{AnyStateEventContent, StateEventContent, StateEventType}, serde::{Incoming, Raw}, - EventId, RoomId, + OwnedEventId, RoomId, }; use serde_json::value::to_raw_value as to_raw_json_value; @@ -27,7 +27,7 @@ pub mod v3 { response: { /// A unique identifier for the event. - pub event_id: Box, + pub event_id: OwnedEventId, } error: crate::Error @@ -90,7 +90,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given event id. - pub fn new(event_id: Box) -> Self { + pub fn new(event_id: OwnedEventId) -> Self { Self { event_id } } } diff --git a/crates/ruma-client-api/src/sync/sync_events.rs b/crates/ruma-client-api/src/sync/sync_events.rs index 6d1ddcc8..e5e7149f 100644 --- a/crates/ruma-client-api/src/sync/sync_events.rs +++ b/crates/ruma-client-api/src/sync/sync_events.rs @@ -17,7 +17,7 @@ pub mod v3 { }, presence::PresenceState, serde::{Incoming, Raw}, - DeviceKeyAlgorithm, RoomId, UserId, + DeviceKeyAlgorithm, OwnedRoomId, OwnedUserId, }; use serde::{Deserialize, Serialize}; @@ -179,19 +179,19 @@ pub mod v3 { pub struct Rooms { /// The rooms that the user has left or been banned from. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub leave: BTreeMap, LeftRoom>, + pub leave: BTreeMap, /// The rooms that the user has joined. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub join: BTreeMap, JoinedRoom>, + pub join: BTreeMap, /// The rooms that the user has been invited to. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub invite: BTreeMap, InvitedRoom>, + pub invite: BTreeMap, /// The rooms that the user has knocked on. #[serde(default, skip_serializing_if = "BTreeMap::is_empty")] - pub knock: BTreeMap, KnockedRoom>, + pub knock: BTreeMap, } impl Rooms { @@ -590,12 +590,12 @@ pub mod v3 { /// List of users who have updated their device identity keys or who now /// share an encrypted room with the client since the previous sync #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub changed: Vec>, + pub changed: Vec, /// List of users who no longer share encrypted rooms since the previous sync /// response. #[serde(default, skip_serializing_if = "Vec::is_empty")] - pub left: Vec>, + pub left: Vec, } impl DeviceLists { diff --git a/crates/ruma-client-api/src/to_device/send_event_to_device.rs b/crates/ruma-client-api/src/to_device/send_event_to_device.rs index 64ac3aa1..8cf40829 100644 --- a/crates/ruma-client-api/src/to_device/send_event_to_device.rs +++ b/crates/ruma-client-api/src/to_device/send_event_to_device.rs @@ -9,7 +9,7 @@ pub mod v3 { use ruma_common::{ api::ruma_api, events::AnyToDeviceEventContent, serde::Raw, - to_device::DeviceIdOrAllDevices, TransactionId, UserId, + to_device::DeviceIdOrAllDevices, OwnedUserId, TransactionId, }; ruma_api! { @@ -64,5 +64,5 @@ pub mod v3 { /// /// Represented as a map of `{ user-ids => { device-ids => message-content } }`. pub type Messages = - BTreeMap, BTreeMap>>; + BTreeMap>>; } diff --git a/crates/ruma-client-api/src/uiaa.rs b/crates/ruma-client-api/src/uiaa.rs index 98f7fa86..26f31e7a 100644 --- a/crates/ruma-client-api/src/uiaa.rs +++ b/crates/ruma-client-api/src/uiaa.rs @@ -12,7 +12,7 @@ use ruma_common::{ }, serde::{from_raw_json_value, Incoming, JsonObject, StringEnum}, thirdparty::Medium, - ClientSecret, SessionId, + ClientSecret, OwnedSessionId, }; use serde::{ de::{self, DeserializeOwned}, @@ -607,7 +607,7 @@ impl IncomingUserIdentifier { #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct ThirdpartyIdCredentials { /// Identity server session ID. - pub sid: Box, + pub sid: OwnedSessionId, /// Identity server client secret. pub client_secret: Box, @@ -623,7 +623,7 @@ impl ThirdpartyIdCredentials { /// Creates a new `ThirdpartyIdCredentials` with the given session ID, client secret, identity /// server address and access token. pub fn new( - sid: Box, + sid: OwnedSessionId, client_secret: Box, id_server: String, id_access_token: String, diff --git a/crates/ruma-client-api/src/user_directory/search_users.rs b/crates/ruma-client-api/src/user_directory/search_users.rs index 57f8c9bd..9e55783d 100644 --- a/crates/ruma-client-api/src/user_directory/search_users.rs +++ b/crates/ruma-client-api/src/user_directory/search_users.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3user_directorysearch use js_int::{uint, UInt}; - use ruma_common::{api::ruma_api, MxcUri, UserId}; + use ruma_common::{api::ruma_api, MxcUri, OwnedUserId}; use serde::{Deserialize, Serialize}; ruma_api! { @@ -78,7 +78,7 @@ pub mod v3 { #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct User { /// The user's matrix user ID. - pub user_id: Box, + pub user_id: OwnedUserId, /// The display name of the user, if one exists. #[serde(skip_serializing_if = "Option::is_none")] @@ -98,7 +98,7 @@ pub mod v3 { impl User { /// Create a new `User` with the given `UserId`. - pub fn new(user_id: Box) -> Self { + pub fn new(user_id: OwnedUserId) -> Self { Self { user_id, display_name: None, avatar_url: None } } } diff --git a/examples/joke_bot/src/main.rs b/examples/joke_bot/src/main.rs index a485981f..da241486 100644 --- a/examples/joke_bot/src/main.rs +++ b/examples/joke_bot/src/main.rs @@ -13,7 +13,7 @@ use ruma::{ }, presence::PresenceState, serde::Raw, - RoomId, TransactionId, UserId, + OwnedUserId, RoomId, TransactionId, UserId, }; use serde_json::Value as JsonValue; use tokio::fs; @@ -223,7 +223,7 @@ async fn read_state() -> io::Result> { struct Config { homeserver: String, - username: Box, + username: OwnedUserId, password: Option, }