client-api: Use new owned ID types

This commit is contained in:
Jonas Platte 2022-04-08 13:31:06 +02:00 committed by Jonas Platte
parent f1c168175b
commit efc869ce9d
44 changed files with 163 additions and 161 deletions

View File

@ -71,13 +71,13 @@ pub mod v1 {
next_batch: impl Into<String>, next_batch: impl Into<String>,
) -> serde_json::Result<ruma_client_api::sync::sync_events::v3::Response> { ) -> serde_json::Result<ruma_client_api::sync::sync_events::v3::Response> {
use ruma_client_api::sync::sync_events; use ruma_client_api::sync::sync_events;
use ruma_common::RoomId; use ruma_common::OwnedRoomId;
use serde::Deserialize; use serde::Deserialize;
use tracing::warn; use tracing::warn;
#[derive(Debug, Deserialize)] #[derive(Debug, Deserialize)]
struct EventDeHelper { struct EventDeHelper {
room_id: Option<Box<RoomId>>, room_id: Option<OwnedRoomId>,
} }
let mut response = sync_events::v3::Response::new(next_batch.into()); let mut response = sync_events::v3::Response::new(next_batch.into());

View File

@ -7,7 +7,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3register //! [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 super::{LoginType, RegistrationKind};
use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse}; use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
@ -91,12 +91,12 @@ pub mod v3 {
pub access_token: Option<String>, pub access_token: Option<String>,
/// The fully-qualified Matrix ID that has been registered. /// The fully-qualified Matrix ID that has been registered.
pub user_id: Box<UserId>, pub user_id: OwnedUserId,
/// ID of the registered device. /// ID of the registered device.
/// ///
/// Will be the same as the corresponding parameter in the request, if one was specified. /// Will be the same as the corresponding parameter in the request, if one was specified.
pub device_id: Option<Box<DeviceId>>, pub device_id: Option<OwnedDeviceId>,
} }
error: UiaaResponse error: UiaaResponse
@ -111,7 +111,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given user ID. /// Creates a new `Response` with the given user ID.
pub fn new(user_id: Box<UserId>) -> Self { pub fn new(user_id: OwnedUserId) -> Self {
Self { access_token: None, user_id, device_id: None } Self { access_token: None, user_id, device_id: None }
} }
} }

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3account3pidemailrequesttoken //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3account3pidemailrequesttoken
use js_int::UInt; 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}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
@ -45,7 +45,7 @@ pub mod v3 {
response: { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// URL to submit validation token to. /// URL to submit validation token to.
/// ///
@ -73,7 +73,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given session identifier. /// Creates a new `Response` with the given session identifier.
pub fn new(sid: Box<SessionId>) -> Self { pub fn new(sid: OwnedSessionId) -> Self {
Self { sid, submit_url: None } Self { sid, submit_url: None }
} }
} }

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3account3pidmsisdnrequesttoken //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3account3pidmsisdnrequesttoken
use js_int::UInt; 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}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
@ -48,7 +48,7 @@ pub mod v3 {
response: { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// URL to submit validation token to. /// URL to submit validation token to.
/// ///
@ -88,7 +88,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given session identifier. /// Creates a new `Response` with the given session identifier.
pub fn new(sid: Box<SessionId>) -> Self { pub fn new(sid: OwnedSessionId) -> Self {
Self { sid, submit_url: None } Self { sid, submit_url: None }
} }
} }

View File

@ -7,7 +7,7 @@ pub mod v3 {
use std::time::Duration; 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! { ruma_api! {
metadata: { metadata: {
@ -35,7 +35,7 @@ pub mod v3 {
pub token_type: TokenType, pub token_type: TokenType,
/// Homeserver domain for verification of user's identity. /// Homeserver domain for verification of user's identity.
pub matrix_server_name: Box<ServerName>, pub matrix_server_name: OwnedServerName,
/// Seconds until token expiration. /// Seconds until token expiration.
#[serde(with = "ruma_common::serde::duration::secs")] #[serde(with = "ruma_common::serde::duration::secs")]
@ -58,7 +58,7 @@ pub mod v3 {
pub fn new( pub fn new(
access_token: String, access_token: String,
token_type: TokenType, token_type: TokenType,
matrix_server_name: Box<ServerName>, matrix_server_name: OwnedServerName,
expires_in: Duration, expires_in: Duration,
) -> Self { ) -> Self {
Self { access_token, token_type, matrix_server_name, expires_in } Self { access_token, token_type, matrix_server_name, expires_in }

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3accountpasswordemailrequesttoken //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3accountpasswordemailrequesttoken
use js_int::UInt; 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}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
@ -45,7 +45,7 @@ pub mod v3 {
response: { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// URL to submit validation token to. /// URL to submit validation token to.
/// ///
@ -74,7 +74,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given session identifier. /// Creates a new `Response` with the given session identifier.
pub fn new(sid: Box<SessionId>) -> Self { pub fn new(sid: OwnedSessionId) -> Self {
Self { sid, submit_url: None } Self { sid, submit_url: None }
} }
} }

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3accountpasswordmsisdnrequesttoken //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3accountpasswordmsisdnrequesttoken
use js_int::UInt; use js_int::UInt;
use ruma_common::{api::ruma_api, ClientSecret, SessionId}; use ruma_common::{api::ruma_api, ClientSecret, OwnedSessionId};
ruma_api! { ruma_api! {
metadata: { metadata: {
@ -40,7 +40,7 @@ pub mod v3 {
response: { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// URL to submit validation token to. /// URL to submit validation token to.
/// ///
@ -74,7 +74,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given session identifier. /// Creates a new `Response` with the given session identifier.
pub fn new(sid: Box<SessionId>) -> Self { pub fn new(sid: OwnedSessionId) -> Self {
Self { sid, submit_url: None } Self { sid, submit_url: None }
} }
} }

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3registeremailrequesttoken //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3registeremailrequesttoken
use js_int::UInt; 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}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
@ -45,7 +45,7 @@ pub mod v3 {
response: { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// URL to submit validation token to. /// URL to submit validation token to.
/// ///
@ -74,7 +74,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given session identifier. /// Creates a new `Response` with the given session identifier.
pub fn new(sid: Box<SessionId>) -> Self { pub fn new(sid: OwnedSessionId) -> Self {
Self { sid, submit_url: None } Self { sid, submit_url: None }
} }
} }

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3registermsisdnrequesttoken //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3registermsisdnrequesttoken
use js_int::UInt; 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}; use crate::account::{IdentityServerInfo, IncomingIdentityServerInfo};
@ -48,7 +48,7 @@ pub mod v3 {
response: { response: {
/// The session identifier given by the identity server. /// The session identifier given by the identity server.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// URL to submit validation token to. /// URL to submit validation token to.
/// ///
@ -89,7 +89,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given session identifier. /// Creates a new `Response` with the given session identifier.
pub fn new(sid: Box<SessionId>) -> Self { pub fn new(sid: OwnedSessionId) -> Self {
Self { sid, submit_url: None } Self { sid, submit_url: None }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3accountwhoami //! [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! { ruma_api! {
metadata: { metadata: {
@ -24,11 +24,11 @@ pub mod v3 {
response: { response: {
/// The id of the user that owns the access token. /// The id of the user that owns the access token.
pub user_id: Box<UserId>, pub user_id: OwnedUserId,
/// The device ID associated with the access token, if any. /// The device ID associated with the access token, if any.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub device_id: Option<Box<DeviceId>>, pub device_id: Option<OwnedDeviceId>,
/// If `true`, the user is a guest user. /// If `true`, the user is a guest user.
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
@ -47,7 +47,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given user ID. /// Creates a new `Response` with the given user ID.
pub fn new(user_id: Box<UserId>, is_guest: bool) -> Self { pub fn new(user_id: OwnedUserId, is_guest: bool) -> Self {
Self { user_id, device_id: None, is_guest } Self { user_id, device_id: None, is_guest }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3directoryroomroomalias //! [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! { ruma_api! {
metadata: { metadata: {
@ -27,10 +27,10 @@ pub mod v3 {
response: { response: {
/// The room ID for this room alias. /// The room ID for this room alias.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
/// A list of servers that are aware of this room ID. /// A list of servers that are aware of this room ID.
pub servers: Vec<Box<ServerName>>, pub servers: Vec<OwnedServerName>,
} }
error: crate::Error error: crate::Error
@ -45,7 +45,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room id and servers /// Creates a new `Response` with the given room id and servers
pub fn new(room_id: Box<RoomId>, servers: Vec<Box<ServerName>>) -> Self { pub fn new(room_id: OwnedRoomId, servers: Vec<OwnedServerName>) -> Self {
Self { room_id, servers } Self { room_id, servers }
} }
} }

View File

@ -20,7 +20,7 @@ use std::collections::BTreeMap;
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
serde::{Base64, Raw}, serde::{Base64, Raw},
DeviceKeyId, UserId, OwnedDeviceKeyId, OwnedUserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -51,7 +51,7 @@ pub enum BackupAlgorithm {
public_key: Base64, public_key: Base64,
/// Signatures of the auth_data as Signed JSON. /// Signatures of the auth_data as Signed JSON.
signatures: BTreeMap<Box<UserId>, BTreeMap<Box<DeviceKeyId>, String>>, signatures: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceKeyId, String>>,
}, },
} }

View File

@ -8,7 +8,7 @@ pub mod v3 {
use std::collections::BTreeMap; use std::collections::BTreeMap;
use js_int::UInt; use js_int::UInt;
use ruma_common::{api::ruma_api, RoomId}; use ruma_common::{api::ruma_api, OwnedRoomId};
use crate::backup::RoomKeyBackup; use crate::backup::RoomKeyBackup;
@ -32,7 +32,7 @@ pub mod v3 {
pub version: &'a str, pub version: &'a str,
/// A map of room IDs to session IDs to key data to store. /// A map of room IDs to session IDs to key data to store.
pub rooms: BTreeMap<Box<RoomId>, RoomKeyBackup>, pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
} }
response: { response: {
@ -51,7 +51,7 @@ pub mod v3 {
impl<'a> Request<'a> { impl<'a> Request<'a> {
/// Creates a new `Request` with the given version and room key backups. /// Creates a new `Request` with the given version and room key backups.
pub fn new(version: &'a str, rooms: BTreeMap<Box<RoomId>, RoomKeyBackup>) -> Self { pub fn new(version: &'a str, rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>) -> Self {
Self { version, rooms } Self { version, rooms }
} }
} }

View File

@ -9,7 +9,7 @@ pub mod v3 {
use std::collections::BTreeMap; use std::collections::BTreeMap;
use ruma_common::{api::ruma_api, RoomId}; use ruma_common::{api::ruma_api, OwnedRoomId};
use crate::backup::RoomKeyBackup; use crate::backup::RoomKeyBackup;
@ -34,7 +34,7 @@ pub mod v3 {
response: { response: {
/// A map from room IDs to session IDs to key data. /// A map from room IDs to session IDs to key data.
pub rooms: BTreeMap<Box<RoomId>, RoomKeyBackup>, pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
} }
error: crate::Error error: crate::Error
@ -49,7 +49,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room key backups. /// Creates a new `Response` with the given room key backups.
pub fn new(rooms: BTreeMap<Box<RoomId>, RoomKeyBackup>) -> Self { pub fn new(rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>) -> Self {
Self { rooms } Self { rooms }
} }
} }

View File

@ -1,6 +1,6 @@
//! Endpoints for managing devices. //! Endpoints for managing devices.
use ruma_common::{DeviceId, MilliSecondsSinceUnixEpoch}; use ruma_common::{MilliSecondsSinceUnixEpoch, OwnedDeviceId};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
pub mod delete_device; pub mod delete_device;
@ -14,7 +14,7 @@ pub mod update_device;
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct Device { pub struct Device {
/// Device ID /// Device ID
pub device_id: Box<DeviceId>, pub device_id: OwnedDeviceId,
/// Public display name of the device. /// Public display name of the device.
pub display_name: Option<String>, pub display_name: Option<String>,
@ -29,7 +29,7 @@ pub struct Device {
impl Device { impl Device {
/// Creates a new `Device` with the given device ID. /// Creates a new `Device` with the given device ID.
pub fn new(device_id: Box<DeviceId>) -> Self { pub fn new(device_id: OwnedDeviceId) -> Self {
Self { device_id, display_name: None, last_seen_ip: None, last_seen_ts: None } Self { device_id, display_name: None, last_seen_ip: None, last_seen_ts: None }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3delete_devices //! [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}; use crate::uiaa::{AuthData, IncomingAuthData, UiaaResponse};
@ -23,7 +23,7 @@ pub mod v3 {
request: { request: {
/// List of devices to delete. /// List of devices to delete.
pub devices: &'a [Box<DeviceId>], pub devices: &'a [OwnedDeviceId],
/// Additional authentication information for the user-interactive authentication API. /// Additional authentication information for the user-interactive authentication API.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -38,7 +38,7 @@ pub mod v3 {
impl<'a> Request<'a> { impl<'a> Request<'a> {
/// Creates a new `Request` with the given device list. /// Creates a new `Request` with the given device list.
pub fn new(devices: &'a [Box<DeviceId>]) -> Self { pub fn new(devices: &'a [OwnedDeviceId]) -> Self {
Self { devices, auth: None } Self { devices, auth: None }
} }
} }

View File

@ -9,7 +9,7 @@ mod url;
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
serde::{Incoming, StringEnum}, serde::{Incoming, StringEnum},
OwnedRoomId, RoomId, UserId, OwnedRoomId, OwnedUserId,
}; };
use serde::Serialize; 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 /// 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. /// even if it is listed in the 'senders' filter.
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub not_senders: &'a [Box<UserId>], pub not_senders: &'a [OwnedUserId],
/// A list of senders IDs to include. /// A list of senders IDs to include.
/// ///
/// If this list is absent then all senders are included. /// If this list is absent then all senders are included.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub senders: Option<&'a [Box<UserId>]>, pub senders: Option<&'a [OwnedUserId]>,
/// A list of event types to include. /// A list of event types to include.
/// ///
@ -169,7 +169,7 @@ pub struct RoomEventFilter<'a> {
default, default,
skip_serializing_if = "<[_]>::is_empty" skip_serializing_if = "<[_]>::is_empty"
)] )]
pub related_by_senders: &'a [Box<UserId>], pub related_by_senders: &'a [OwnedUserId],
} }
impl<'a> RoomEventFilter<'a> { 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 /// it is listed in the 'rooms' filter. This filter is applied before the filters in
/// `ephemeral`, `state`, `timeline` or `account_data`. /// `ephemeral`, `state`, `timeline` or `account_data`.
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub not_rooms: &'a [Box<RoomId>], pub not_rooms: &'a [OwnedRoomId],
/// A list of room IDs to include. /// A list of room IDs to include.
/// ///
/// If this list is absent then all rooms are included. This filter is applied before the /// If this list is absent then all rooms are included. This filter is applied before the
/// filters in `ephemeral`, `state`, `timeline` or `account_data`. /// filters in `ephemeral`, `state`, `timeline` or `account_data`.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub rooms: Option<&'a [Box<RoomId>]>, pub rooms: Option<&'a [OwnedRoomId]>,
} }
impl<'a> RoomFilter<'a> { impl<'a> RoomFilter<'a> {
@ -329,7 +329,7 @@ pub struct Filter<'a> {
/// ///
/// If this list is absent then all senders are included. /// If this list is absent then all senders are included.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub senders: Option<&'a [Box<UserId>]>, pub senders: Option<&'a [OwnedUserId]>,
/// A list of event types to include. /// 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 /// 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. /// even if it is listed in the 'senders' filter.
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub not_senders: &'a [Box<UserId>], pub not_senders: &'a [OwnedUserId],
} }
impl<'a> Filter<'a> { impl<'a> Filter<'a> {

View File

@ -8,8 +8,8 @@ pub mod v3 {
use std::{collections::BTreeMap, time::Duration}; use std::{collections::BTreeMap, time::Duration};
use ruma_common::{ use ruma_common::{
api::ruma_api, encryption::OneTimeKey, serde::Raw, DeviceId, DeviceKeyAlgorithm, api::ruma_api, encryption::OneTimeKey, serde::Raw, DeviceKeyAlgorithm, OwnedDeviceId,
DeviceKeyId, UserId, OwnedDeviceKeyId, OwnedUserId,
}; };
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
@ -36,7 +36,7 @@ pub mod v3 {
pub timeout: Option<Duration>, pub timeout: Option<Duration>,
/// The keys to be claimed. /// The keys to be claimed.
pub one_time_keys: BTreeMap<Box<UserId>, BTreeMap<Box<DeviceId>, DeviceKeyAlgorithm>>, pub one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>,
} }
response: { response: {
@ -45,7 +45,7 @@ pub mod v3 {
pub failures: BTreeMap<String, JsonValue>, pub failures: BTreeMap<String, JsonValue>,
/// One-time keys for the queried devices. /// One-time keys for the queried devices.
pub one_time_keys: BTreeMap<Box<UserId>, OneTimeKeys>, pub one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>,
} }
error: crate::Error error: crate::Error
@ -54,7 +54,7 @@ pub mod v3 {
impl Request { impl Request {
/// Creates a new `Request` with the given key claims and the recommended 10 second timeout. /// Creates a new `Request` with the given key claims and the recommended 10 second timeout.
pub fn new( pub fn new(
one_time_keys: BTreeMap<Box<UserId>, BTreeMap<Box<DeviceId>, DeviceKeyAlgorithm>>, one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>,
) -> Self { ) -> Self {
Self { timeout: Some(Duration::from_secs(10)), one_time_keys } Self { timeout: Some(Duration::from_secs(10)), one_time_keys }
} }
@ -62,11 +62,11 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given keys and no failures. /// Creates a new `Response` with the given keys and no failures.
pub fn new(one_time_keys: BTreeMap<Box<UserId>, OneTimeKeys>) -> Self { pub fn new(one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>) -> Self {
Self { failures: BTreeMap::new(), one_time_keys } Self { failures: BTreeMap::new(), one_time_keys }
} }
} }
/// The one-time keys for a given device. /// The one-time keys for a given device.
pub type OneTimeKeys = BTreeMap<Box<DeviceId>, BTreeMap<Box<DeviceKeyId>, Raw<OneTimeKey>>>; pub type OneTimeKeys = BTreeMap<OwnedDeviceId, BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>>;
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3keyschanges //! [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! { ruma_api! {
metadata: { metadata: {
@ -36,11 +36,11 @@ pub mod v3 {
response: { response: {
/// The Matrix User IDs of all users who updated their device identity keys. /// The Matrix User IDs of all users who updated their device identity keys.
pub changed: Vec<Box<UserId>>, pub changed: Vec<OwnedUserId>,
/// The Matrix User IDs of all users who may have left all the end-to-end /// The Matrix User IDs of all users who may have left all the end-to-end
/// encrypted rooms they previously shared with the user. /// encrypted rooms they previously shared with the user.
pub left: Vec<Box<UserId>>, pub left: Vec<OwnedUserId>,
} }
error: crate::Error error: crate::Error
@ -55,7 +55,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given changed and left user ID lists. /// Creates a new `Response` with the given changed and left user ID lists.
pub fn new(changed: Vec<Box<UserId>>, left: Vec<Box<UserId>>) -> Self { pub fn new(changed: Vec<OwnedUserId>, left: Vec<OwnedUserId>) -> Self {
Self { changed, left } Self { changed, left }
} }
} }

View File

@ -11,7 +11,7 @@ pub mod v3 {
api::ruma_api, api::ruma_api,
encryption::{CrossSigningKey, DeviceKeys}, encryption::{CrossSigningKey, DeviceKeys},
serde::Raw, serde::Raw,
DeviceId, UserId, OwnedDeviceId, OwnedUserId,
}; };
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
@ -42,7 +42,7 @@ pub mod v3 {
/// The keys to be downloaded. /// The keys to be downloaded.
/// ///
/// An empty list indicates all devices for the corresponding user. /// An empty list indicates all devices for the corresponding user.
pub device_keys: BTreeMap<Box<UserId>, Vec<Box<DeviceId>>>, pub device_keys: BTreeMap<OwnedUserId, Vec<OwnedDeviceId>>,
/// If the client is fetching keys as a result of a device update received in a sync /// 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. /// 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. /// Information on the queried devices.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub device_keys: BTreeMap<Box<UserId>, BTreeMap<Box<DeviceId>, Raw<DeviceKeys>>>, pub device_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, Raw<DeviceKeys>>>,
/// Information on the master cross-signing keys of the queried users. /// Information on the master cross-signing keys of the queried users.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub master_keys: BTreeMap<Box<UserId>, Raw<CrossSigningKey>>, pub master_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
/// Information on the self-signing keys of the queried users. /// Information on the self-signing keys of the queried users.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub self_signing_keys: BTreeMap<Box<UserId>, Raw<CrossSigningKey>>, pub self_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
/// Information on the user-signing keys of the queried users. /// Information on the user-signing keys of the queried users.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub user_signing_keys: BTreeMap<Box<UserId>, Raw<CrossSigningKey>>, pub user_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
} }
error: crate::Error error: crate::Error

View File

@ -12,7 +12,7 @@ pub mod v3 {
api::ruma_api, api::ruma_api,
encryption::{DeviceKeys, OneTimeKey}, encryption::{DeviceKeys, OneTimeKey},
serde::Raw, serde::Raw,
DeviceKeyAlgorithm, DeviceKeyId, DeviceKeyAlgorithm, OwnedDeviceKeyId,
}; };
ruma_api! { ruma_api! {
@ -37,11 +37,11 @@ pub mod v3 {
/// One-time public keys for "pre-key" messages. /// One-time public keys for "pre-key" messages.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub one_time_keys: BTreeMap<Box<DeviceKeyId>, Raw<OneTimeKey>>, pub one_time_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>,
/// Fallback public keys for "pre-key" messages. /// Fallback public keys for "pre-key" messages.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty", rename = "org.matrix.msc2732.fallback_keys")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty", rename = "org.matrix.msc2732.fallback_keys")]
pub fallback_keys: BTreeMap<Box<DeviceKeyId>, Raw<OneTimeKey>>, pub fallback_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>,
} }
response: { response: {

View File

@ -11,7 +11,7 @@ pub mod v3 {
api::ruma_api, api::ruma_api,
encryption::{CrossSigningKey, DeviceKeys}, encryption::{CrossSigningKey, DeviceKeys},
serde::{Raw, StringEnum}, serde::{Raw, StringEnum},
DeviceId, UserId, OwnedDeviceId, OwnedUserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::value::RawValue as RawJsonValue; use serde_json::value::RawValue as RawJsonValue;
@ -35,13 +35,13 @@ pub mod v3 {
request: { request: {
/// Signed keys. /// Signed keys.
#[ruma_api(body)] #[ruma_api(body)]
pub signed_keys: BTreeMap<Box<UserId>, SignedKeys>, pub signed_keys: BTreeMap<OwnedUserId, SignedKeys>,
} }
#[derive(Default)] #[derive(Default)]
response: { response: {
/// Signature processing failures. /// Signature processing failures.
pub failures: BTreeMap<Box<UserId>, BTreeMap<String, Failure>>, pub failures: BTreeMap<OwnedUserId, BTreeMap<String, Failure>>,
} }
error: crate::Error error: crate::Error
@ -49,7 +49,7 @@ pub mod v3 {
impl Request { impl Request {
/// Creates a new `Request` with the given signed keys. /// Creates a new `Request` with the given signed keys.
pub fn new(signed_keys: BTreeMap<Box<UserId>, SignedKeys>) -> Self { pub fn new(signed_keys: BTreeMap<OwnedUserId, SignedKeys>) -> Self {
Self { signed_keys } Self { signed_keys }
} }
} }
@ -73,8 +73,8 @@ pub mod v3 {
} }
/// Add the given device keys. /// Add the given device keys.
pub fn add_device_keys(&mut self, device_id: Box<DeviceId>, device_keys: Raw<DeviceKeys>) { pub fn add_device_keys(&mut self, device_id: OwnedDeviceId, device_keys: Raw<DeviceKeys>) {
self.0.insert(device_id.into(), device_keys.into_json()); self.0.insert(device_id.as_str().into(), device_keys.into_json());
} }
/// Add the given cross signing keys. /// Add the given cross signing keys.

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3knockroomidoralias //! [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! { ruma_api! {
metadata: { metadata: {
@ -33,12 +33,12 @@ pub mod v3 {
/// One of the servers must be participating in the room. /// One of the servers must be participating in the room.
#[ruma_api(query)] #[ruma_api(query)]
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub server_name: &'a [Box<ServerName>], pub server_name: &'a [OwnedServerName],
} }
response: { response: {
/// The room that the user knocked on. /// The room that the user knocked on.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
} }
} }
@ -51,7 +51,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room ID. /// Creates a new `Response` with the given room ID.
pub fn new(room_id: Box<RoomId>) -> Self { pub fn new(room_id: OwnedRoomId) -> Self {
Self { room_id } Self { room_id }
} }
} }

View File

@ -14,7 +14,9 @@ pub mod unban_user;
use std::collections::BTreeMap; 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; use serde::Serialize;
/// A signature of an `m.third_party_invite` token to prove that this user owns a third party /// 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, pub token: &'a str,
/// A signatures object containing a signature of the entire signed object. /// A signatures object containing a signature of the entire signed object.
pub signatures: BTreeMap<Box<ServerName>, BTreeMap<Box<ServerSigningKeyId>, String>>, pub signatures: BTreeMap<OwnedServerName, BTreeMap<Box<ServerSigningKeyId>, String>>,
} }
impl<'a> ThirdPartySigned<'a> { impl<'a> ThirdPartySigned<'a> {
@ -42,7 +44,7 @@ impl<'a> ThirdPartySigned<'a> {
sender: &'a UserId, sender: &'a UserId,
mxid: &'a UserId, mxid: &'a UserId,
token: &'a str, token: &'a str,
signatures: BTreeMap<Box<ServerName>, BTreeMap<Box<ServerSigningKeyId>, String>>, signatures: BTreeMap<OwnedServerName, BTreeMap<Box<ServerSigningKeyId>, String>>,
) -> Self { ) -> Self {
Self { sender, mxid, token, signatures } Self { sender, mxid, token, signatures }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3roomsroomidjoin //! [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}; use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned};
@ -38,7 +38,7 @@ pub mod v3 {
response: { response: {
/// The room that the user joined. /// The room that the user joined.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
} }
error: crate::Error error: crate::Error
@ -53,7 +53,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room id. /// Creates a new `Response` with the given room id.
pub fn new(room_id: Box<RoomId>) -> Self { pub fn new(room_id: OwnedRoomId) -> Self {
Self { room_id } Self { room_id }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3joinroomidoralias //! [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}; use crate::membership::{IncomingThirdPartySigned, ThirdPartySigned};
@ -31,7 +31,7 @@ pub mod v3 {
/// One of the servers must be participating in the room. /// One of the servers must be participating in the room.
#[ruma_api(query)] #[ruma_api(query)]
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub server_name: &'a [Box<ServerName>], pub server_name: &'a [OwnedServerName],
/// The signature of a `m.third_party_invite` token to prove that this user owns a third /// 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. /// party identity which has been invited to the room.
@ -45,7 +45,7 @@ pub mod v3 {
response: { response: {
/// The room that the user joined. /// The room that the user joined.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
} }
error: crate::Error error: crate::Error
@ -60,7 +60,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room ID. /// Creates a new `Response` with the given room ID.
pub fn new(room_id: Box<RoomId>) -> Self { pub fn new(room_id: OwnedRoomId) -> Self {
Self { room_id } Self { room_id }
} }
} }

View File

@ -7,7 +7,7 @@ pub mod v3 {
use std::collections::BTreeMap; 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}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
@ -31,7 +31,7 @@ pub mod v3 {
response: { response: {
/// A list of the rooms the user is in, i.e. /// A list of the rooms the user is in, i.e.
/// the ID of each room in which the user has joined membership. /// the ID of each room in which the user has joined membership.
pub joined: BTreeMap<Box<UserId>, RoomMember>, pub joined: BTreeMap<OwnedUserId, RoomMember>,
} }
error: crate::Error error: crate::Error
@ -46,7 +46,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given joined rooms. /// Creates a new `Response` with the given joined rooms.
pub fn new(joined: BTreeMap<Box<UserId>, RoomMember>) -> Self { pub fn new(joined: BTreeMap<OwnedUserId, RoomMember>) -> Self {
Self { joined } Self { joined }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3joined_rooms //! [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! { ruma_api! {
metadata: { metadata: {
@ -25,7 +25,7 @@ pub mod v3 {
response: { response: {
/// A list of the rooms the user is in, i.e. the ID of each room in /// A list of the rooms the user is in, i.e. the ID of each room in
/// which the user has joined membership. /// which the user has joined membership.
pub joined_rooms: Vec<Box<RoomId>>, pub joined_rooms: Vec<OwnedRoomId>,
} }
error: crate::Error error: crate::Error
@ -40,7 +40,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given joined rooms. /// Creates a new `Response` with the given joined rooms.
pub fn new(joined_rooms: Vec<Box<RoomId>>) -> Self { pub fn new(joined_rooms: Vec<OwnedRoomId>) -> Self {
Self { joined_rooms } Self { joined_rooms }
} }
} }

View File

@ -9,7 +9,7 @@ pub mod v3 {
api::ruma_api, api::ruma_api,
events::{AnyMessageLikeEventContent, MessageLikeEventContent, MessageLikeEventType}, events::{AnyMessageLikeEventContent, MessageLikeEventContent, MessageLikeEventType},
serde::Raw, serde::Raw,
EventId, RoomId, TransactionId, OwnedEventId, RoomId, TransactionId,
}; };
use serde_json::value::to_raw_value as to_raw_json_value; use serde_json::value::to_raw_value as to_raw_json_value;
@ -49,7 +49,7 @@ pub mod v3 {
response: { response: {
/// A unique identifier for the event. /// A unique identifier for the event.
pub event_id: Box<EventId>, pub event_id: OwnedEventId,
} }
error: crate::Error error: crate::Error
@ -92,7 +92,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given event id. /// Creates a new `Response` with the given event id.
pub fn new(event_id: Box<EventId>) -> Self { pub fn new(event_id: OwnedEventId) -> Self {
Self { event_id } Self { event_id }
} }
} }

View File

@ -8,7 +8,7 @@ pub mod v3 {
use js_int::UInt; use js_int::UInt;
use ruma_common::{ use ruma_common::{
api::ruma_api, events::AnySyncRoomEvent, push::Action, serde::Raw, api::ruma_api, events::AnySyncRoomEvent, push::Action, serde::Raw,
MilliSecondsSinceUnixEpoch, RoomId, MilliSecondsSinceUnixEpoch, OwnedRoomId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -94,7 +94,7 @@ pub mod v3 {
pub read: bool, pub read: bool,
/// The ID of the room in which the event was posted. /// The ID of the room in which the event was posted.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
/// The time at which the event notification was sent. /// The time at which the event notification was sent.
pub ts: MilliSecondsSinceUnixEpoch, pub ts: MilliSecondsSinceUnixEpoch,
@ -107,7 +107,7 @@ pub mod v3 {
actions: Vec<Action>, actions: Vec<Action>,
event: Raw<AnySyncRoomEvent>, event: Raw<AnySyncRoomEvent>,
read: bool, read: bool,
room_id: Box<RoomId>, room_id: OwnedRoomId,
ts: MilliSecondsSinceUnixEpoch, ts: MilliSecondsSinceUnixEpoch,
) -> Self { ) -> Self {
Self { actions, event, profile_tag: None, read, room_id, ts } Self { actions, event, profile_tag: None, read, room_id, ts }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#put_matrixclientv3roomsroomidredacteventidtxnid //! [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! { ruma_api! {
metadata: { metadata: {
@ -42,7 +42,7 @@ pub mod v3 {
response: { response: {
/// The ID of the redacted event. /// The ID of the redacted event.
pub event_id: Box<EventId>, pub event_id: OwnedEventId,
} }
error: crate::Error error: crate::Error
@ -57,7 +57,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given event ID. /// Creates a new `Response` with the given event ID.
pub fn new(event_id: Box<EventId>) -> Self { pub fn new(event_id: OwnedEventId) -> Self {
Self { event_id } Self { event_id }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3roomsroomidaliases //! [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! { ruma_api! {
metadata: { metadata: {
@ -28,7 +28,7 @@ pub mod v3 {
response: { response: {
/// The server's local aliases on the room. /// The server's local aliases on the room.
pub aliases: Vec<Box<RoomAliasId>>, pub aliases: Vec<OwnedRoomAliasId>,
} }
error: crate::Error error: crate::Error
@ -43,7 +43,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given aliases. /// Creates a new `Response` with the given aliases.
pub fn new(aliases: Vec<Box<RoomAliasId>>) -> Self { pub fn new(aliases: Vec<OwnedRoomAliasId>) -> Self {
Self { aliases } Self { aliases }
} }
} }

View File

@ -17,7 +17,7 @@ pub mod v3 {
}, },
room::RoomType, room::RoomType,
serde::{Raw, StringEnum}, serde::{Raw, StringEnum},
OwnedUserId, RoomId, RoomName, RoomVersionId, UserId, OwnedRoomId, OwnedUserId, RoomName, RoomVersionId,
}; };
use serde::{Deserialize, Serialize}; 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. /// This will tell the server to invite everyone in the list to the newly created room.
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
pub invite: &'a [Box<UserId>], pub invite: &'a [OwnedUserId],
/// List of third party IDs of users to invite. /// List of third party IDs of users to invite.
#[serde(default, skip_serializing_if = "<[_]>::is_empty")] #[serde(default, skip_serializing_if = "<[_]>::is_empty")]
@ -103,7 +103,7 @@ pub mod v3 {
response: { response: {
/// The created room's ID. /// The created room's ID.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
} }
error: crate::Error error: crate::Error
@ -118,7 +118,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room id. /// Creates a new `Response` with the given room id.
pub fn new(room_id: Box<RoomId>) -> Self { pub fn new(room_id: OwnedRoomId) -> Self {
Self { room_id } Self { room_id }
} }
} }

View File

@ -5,7 +5,7 @@ pub mod v3 {
//! //!
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3roomsroomidupgrade //! [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! { ruma_api! {
metadata: { metadata: {
@ -30,7 +30,7 @@ pub mod v3 {
response: { response: {
/// ID of the new room. /// ID of the new room.
pub replacement_room: Box<RoomId>, pub replacement_room: OwnedRoomId,
} }
error: crate::Error error: crate::Error
@ -45,7 +45,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given room ID. /// Creates a new `Response` with the given room ID.
pub fn new(replacement_room: Box<RoomId>) -> Self { pub fn new(replacement_room: OwnedRoomId) -> Self {
Self { replacement_room } Self { replacement_room }
} }
} }

View File

@ -12,7 +12,7 @@ pub mod v3 {
api::ruma_api, api::ruma_api,
events::{AnyRoomEvent, AnyStateEvent}, events::{AnyRoomEvent, AnyStateEvent},
serde::{Incoming, Raw, StringEnum}, serde::{Incoming, Raw, StringEnum},
EventId, MxcUri, RoomId, UserId, MxcUri, OwnedEventId, OwnedRoomId, OwnedUserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -206,7 +206,7 @@ pub mod v3 {
/// The historic profile information of the users that sent the events returned. /// The historic profile information of the users that sent the events returned.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub profile_info: BTreeMap<Box<UserId>, UserProfile>, pub profile_info: BTreeMap<OwnedUserId, UserProfile>,
/// Pagination token for the start of the chunk. /// Pagination token for the start of the chunk.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -371,7 +371,7 @@ pub mod v3 {
/// Any groups that were requested. /// Any groups that were requested.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub groups: BTreeMap<GroupingKey, BTreeMap<Box<RoomIdOrUserId>, ResultGroup>>, pub groups: BTreeMap<GroupingKey, BTreeMap<OwnedRoomIdOrUserId, ResultGroup>>,
/// Token that can be used to get the next batch of results, by passing as the `next_batch` /// Token that can be used to get the next batch of results, by passing as the `next_batch`
/// parameter to the next call. /// 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`. /// 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")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub state: BTreeMap<Box<RoomId>, Vec<Raw<AnyStateEvent>>>, pub state: BTreeMap<OwnedRoomId, Vec<Raw<AnyStateEvent>>>,
/// List of words which should be highlighted, useful for stemming which may /// List of words which should be highlighted, useful for stemming which may
/// change the query terms. /// change the query terms.
@ -430,7 +430,7 @@ pub mod v3 {
/// Which results are in this group. /// Which results are in this group.
#[serde(default, skip_serializing_if = "Vec::is_empty")] #[serde(default, skip_serializing_if = "Vec::is_empty")]
pub results: Vec<Box<EventId>>, pub results: Vec<OwnedEventId>,
} }
impl ResultGroup { impl ResultGroup {
@ -511,11 +511,11 @@ pub mod v3 {
/// Represents either a room or user ID for returning grouped search results. /// Represents either a room or user ID for returning grouped search results.
#[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)] #[derive(Clone, Debug, Deserialize, Eq, Ord, PartialEq, PartialOrd, Serialize)]
#[allow(clippy::exhaustive_enums)] #[allow(clippy::exhaustive_enums)]
pub enum RoomIdOrUserId { pub enum OwnedRoomIdOrUserId {
/// Represents a room ID. /// Represents a room ID.
RoomId(Box<RoomId>), RoomId(OwnedRoomId),
/// Represents a user ID. /// Represents a user ID.
UserId(Box<UserId>), UserId(OwnedUserId),
} }
} }

View File

@ -7,7 +7,7 @@ pub mod v3 {
use std::collections::BTreeMap; 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}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
@ -32,7 +32,7 @@ pub mod v3 {
response: { response: {
/// The Matrix user ID of the user. /// The Matrix user ID of the user.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub user_id: Option<Box<UserId>>, pub user_id: Option<OwnedUserId>,
/// A map of the user's device identifiers to information about that device. /// A map of the user's device identifiers to information about that device.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]

View File

@ -8,7 +8,7 @@ pub mod v3 {
use ruma_common::{ use ruma_common::{
api::ruma_api, api::ruma_api,
serde::{Incoming, JsonObject}, serde::{Incoming, JsonObject},
DeviceId, ServerName, UserId, DeviceId, OwnedDeviceId, OwnedServerName, OwnedUserId,
}; };
use serde::{ use serde::{
de::{self, DeserializeOwned}, de::{self, DeserializeOwned},
@ -48,7 +48,7 @@ pub mod v3 {
response: { response: {
/// The fully-qualified Matrix ID that has been registered. /// The fully-qualified Matrix ID that has been registered.
pub user_id: Box<UserId>, pub user_id: OwnedUserId,
/// An access token for the account. /// An access token for the account.
pub access_token: String, pub access_token: String,
@ -58,13 +58,13 @@ pub mod v3 {
/// Deprecated: Clients should instead use the `user_id.server_name()` /// Deprecated: Clients should instead use the `user_id.server_name()`
/// method if they require it. /// method if they require it.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub home_server: Option<Box<ServerName>>, pub home_server: Option<OwnedServerName>,
/// ID of the logged-in device. /// ID of the logged-in device.
/// ///
/// Will be the same as the corresponding parameter in the request, if one was /// Will be the same as the corresponding parameter in the request, if one was
/// specified. /// specified.
pub device_id: Box<DeviceId>, pub device_id: OwnedDeviceId,
/// Client configuration provided by the server. /// Client configuration provided by the server.
/// ///
@ -85,7 +85,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given user ID, access token and device ID. /// Creates a new `Response` with the given user ID, access token and device ID.
pub fn new(user_id: Box<UserId>, access_token: String, device_id: Box<DeviceId>) -> 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 } Self { user_id, access_token, home_server: None, device_id, well_known: None }
} }
} }

View File

@ -9,7 +9,7 @@ use ruma_common::{
events::space::child::HierarchySpaceChildEvent, events::space::child::HierarchySpaceChildEvent,
room::RoomType, room::RoomType,
serde::{Raw, StringEnum}, serde::{Raw, StringEnum},
MxcUri, RoomAliasId, RoomId, RoomName, MxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -30,7 +30,7 @@ pub struct SpaceHierarchyRoomsChunk {
feature = "compat", feature = "compat",
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none") serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
)] )]
pub canonical_alias: Option<Box<RoomAliasId>>, pub canonical_alias: Option<OwnedRoomAliasId>,
/// The name of the room, if any. /// The name of the room, if any.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -40,7 +40,7 @@ pub struct SpaceHierarchyRoomsChunk {
pub num_joined_members: UInt, pub num_joined_members: UInt,
/// The ID of the room. /// The ID of the room.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
/// The topic of the room, if any. /// The topic of the room, if any.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -89,7 +89,7 @@ pub struct SpaceHierarchyRoomsChunkInit {
pub num_joined_members: UInt, pub num_joined_members: UInt,
/// The ID of the room. /// The ID of the room.
pub room_id: Box<RoomId>, pub room_id: OwnedRoomId,
/// Whether the room may be viewed by guest users without joining. /// Whether the room may be viewed by guest users without joining.
pub world_readable: bool, pub world_readable: bool,

View File

@ -9,7 +9,7 @@ pub mod v3 {
api::ruma_api, api::ruma_api,
events::{AnyStateEventContent, StateEventContent, StateEventType}, events::{AnyStateEventContent, StateEventContent, StateEventType},
serde::{Incoming, Raw}, serde::{Incoming, Raw},
EventId, RoomId, OwnedEventId, RoomId,
}; };
use serde_json::value::to_raw_value as to_raw_json_value; use serde_json::value::to_raw_value as to_raw_json_value;
@ -27,7 +27,7 @@ pub mod v3 {
response: { response: {
/// A unique identifier for the event. /// A unique identifier for the event.
pub event_id: Box<EventId>, pub event_id: OwnedEventId,
} }
error: crate::Error error: crate::Error
@ -90,7 +90,7 @@ pub mod v3 {
impl Response { impl Response {
/// Creates a new `Response` with the given event id. /// Creates a new `Response` with the given event id.
pub fn new(event_id: Box<EventId>) -> Self { pub fn new(event_id: OwnedEventId) -> Self {
Self { event_id } Self { event_id }
} }
} }

View File

@ -17,7 +17,7 @@ pub mod v3 {
}, },
presence::PresenceState, presence::PresenceState,
serde::{Incoming, Raw}, serde::{Incoming, Raw},
DeviceKeyAlgorithm, RoomId, UserId, DeviceKeyAlgorithm, OwnedRoomId, OwnedUserId,
}; };
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -179,19 +179,19 @@ pub mod v3 {
pub struct Rooms { pub struct Rooms {
/// The rooms that the user has left or been banned from. /// The rooms that the user has left or been banned from.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub leave: BTreeMap<Box<RoomId>, LeftRoom>, pub leave: BTreeMap<OwnedRoomId, LeftRoom>,
/// The rooms that the user has joined. /// The rooms that the user has joined.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub join: BTreeMap<Box<RoomId>, JoinedRoom>, pub join: BTreeMap<OwnedRoomId, JoinedRoom>,
/// The rooms that the user has been invited to. /// The rooms that the user has been invited to.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub invite: BTreeMap<Box<RoomId>, InvitedRoom>, pub invite: BTreeMap<OwnedRoomId, InvitedRoom>,
/// The rooms that the user has knocked on. /// The rooms that the user has knocked on.
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub knock: BTreeMap<Box<RoomId>, KnockedRoom>, pub knock: BTreeMap<OwnedRoomId, KnockedRoom>,
} }
impl Rooms { impl Rooms {
@ -590,12 +590,12 @@ pub mod v3 {
/// List of users who have updated their device identity keys or who now /// List of users who have updated their device identity keys or who now
/// share an encrypted room with the client since the previous sync /// share an encrypted room with the client since the previous sync
#[serde(default, skip_serializing_if = "Vec::is_empty")] #[serde(default, skip_serializing_if = "Vec::is_empty")]
pub changed: Vec<Box<UserId>>, pub changed: Vec<OwnedUserId>,
/// List of users who no longer share encrypted rooms since the previous sync /// List of users who no longer share encrypted rooms since the previous sync
/// response. /// response.
#[serde(default, skip_serializing_if = "Vec::is_empty")] #[serde(default, skip_serializing_if = "Vec::is_empty")]
pub left: Vec<Box<UserId>>, pub left: Vec<OwnedUserId>,
} }
impl DeviceLists { impl DeviceLists {

View File

@ -9,7 +9,7 @@ pub mod v3 {
use ruma_common::{ use ruma_common::{
api::ruma_api, events::AnyToDeviceEventContent, serde::Raw, api::ruma_api, events::AnyToDeviceEventContent, serde::Raw,
to_device::DeviceIdOrAllDevices, TransactionId, UserId, to_device::DeviceIdOrAllDevices, OwnedUserId, TransactionId,
}; };
ruma_api! { ruma_api! {
@ -64,5 +64,5 @@ pub mod v3 {
/// ///
/// Represented as a map of `{ user-ids => { device-ids => message-content } }`. /// Represented as a map of `{ user-ids => { device-ids => message-content } }`.
pub type Messages = pub type Messages =
BTreeMap<Box<UserId>, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>; BTreeMap<OwnedUserId, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>;
} }

View File

@ -12,7 +12,7 @@ use ruma_common::{
}, },
serde::{from_raw_json_value, Incoming, JsonObject, StringEnum}, serde::{from_raw_json_value, Incoming, JsonObject, StringEnum},
thirdparty::Medium, thirdparty::Medium,
ClientSecret, SessionId, ClientSecret, OwnedSessionId,
}; };
use serde::{ use serde::{
de::{self, DeserializeOwned}, de::{self, DeserializeOwned},
@ -607,7 +607,7 @@ impl IncomingUserIdentifier {
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct ThirdpartyIdCredentials { pub struct ThirdpartyIdCredentials {
/// Identity server session ID. /// Identity server session ID.
pub sid: Box<SessionId>, pub sid: OwnedSessionId,
/// Identity server client secret. /// Identity server client secret.
pub client_secret: Box<ClientSecret>, pub client_secret: Box<ClientSecret>,
@ -623,7 +623,7 @@ impl ThirdpartyIdCredentials {
/// Creates a new `ThirdpartyIdCredentials` with the given session ID, client secret, identity /// Creates a new `ThirdpartyIdCredentials` with the given session ID, client secret, identity
/// server address and access token. /// server address and access token.
pub fn new( pub fn new(
sid: Box<SessionId>, sid: OwnedSessionId,
client_secret: Box<ClientSecret>, client_secret: Box<ClientSecret>,
id_server: String, id_server: String,
id_access_token: String, id_access_token: String,

View File

@ -6,7 +6,7 @@ pub mod v3 {
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3user_directorysearch //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixclientv3user_directorysearch
use js_int::{uint, UInt}; 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}; use serde::{Deserialize, Serialize};
ruma_api! { ruma_api! {
@ -78,7 +78,7 @@ pub mod v3 {
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
pub struct User { pub struct User {
/// The user's matrix user ID. /// The user's matrix user ID.
pub user_id: Box<UserId>, pub user_id: OwnedUserId,
/// The display name of the user, if one exists. /// The display name of the user, if one exists.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -98,7 +98,7 @@ pub mod v3 {
impl User { impl User {
/// Create a new `User` with the given `UserId`. /// Create a new `User` with the given `UserId`.
pub fn new(user_id: Box<UserId>) -> Self { pub fn new(user_id: OwnedUserId) -> Self {
Self { user_id, display_name: None, avatar_url: None } Self { user_id, display_name: None, avatar_url: None }
} }
} }

View File

@ -13,7 +13,7 @@ use ruma::{
}, },
presence::PresenceState, presence::PresenceState,
serde::Raw, serde::Raw,
RoomId, TransactionId, UserId, OwnedUserId, RoomId, TransactionId, UserId,
}; };
use serde_json::Value as JsonValue; use serde_json::Value as JsonValue;
use tokio::fs; use tokio::fs;
@ -223,7 +223,7 @@ async fn read_state() -> io::Result<Option<State>> {
struct Config { struct Config {
homeserver: String, homeserver: String,
username: Box<UserId>, username: OwnedUserId,
password: Option<String>, password: Option<String>,
} }