client-api: Use new owned ID types
This commit is contained in:
parent
f1c168175b
commit
efc869ce9d
@ -71,13 +71,13 @@ pub mod v1 {
|
||||
next_batch: impl Into<String>,
|
||||
) -> serde_json::Result<ruma_client_api::sync::sync_events::v3::Response> {
|
||||
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<Box<RoomId>>,
|
||||
room_id: Option<OwnedRoomId>,
|
||||
}
|
||||
|
||||
let mut response = sync_events::v3::Response::new(next_batch.into());
|
||||
|
@ -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<String>,
|
||||
|
||||
/// The fully-qualified Matrix ID that has been registered.
|
||||
pub user_id: Box<UserId>,
|
||||
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<Box<DeviceId>>,
|
||||
pub device_id: Option<OwnedDeviceId>,
|
||||
}
|
||||
|
||||
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<UserId>) -> Self {
|
||||
pub fn new(user_id: OwnedUserId) -> Self {
|
||||
Self { access_token: None, user_id, device_id: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<SessionId>,
|
||||
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<SessionId>) -> Self {
|
||||
pub fn new(sid: OwnedSessionId) -> Self {
|
||||
Self { sid, submit_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<SessionId>,
|
||||
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<SessionId>) -> Self {
|
||||
pub fn new(sid: OwnedSessionId) -> Self {
|
||||
Self { sid, submit_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<ServerName>,
|
||||
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<ServerName>,
|
||||
matrix_server_name: OwnedServerName,
|
||||
expires_in: Duration,
|
||||
) -> Self {
|
||||
Self { access_token, token_type, matrix_server_name, expires_in }
|
||||
|
@ -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<SessionId>,
|
||||
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<SessionId>) -> Self {
|
||||
pub fn new(sid: OwnedSessionId) -> Self {
|
||||
Self { sid, submit_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<SessionId>,
|
||||
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<SessionId>) -> Self {
|
||||
pub fn new(sid: OwnedSessionId) -> Self {
|
||||
Self { sid, submit_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<SessionId>,
|
||||
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<SessionId>) -> Self {
|
||||
pub fn new(sid: OwnedSessionId) -> Self {
|
||||
Self { sid, submit_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<SessionId>,
|
||||
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<SessionId>) -> Self {
|
||||
pub fn new(sid: OwnedSessionId) -> Self {
|
||||
Self { sid, submit_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<UserId>,
|
||||
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<Box<DeviceId>>,
|
||||
pub device_id: Option<OwnedDeviceId>,
|
||||
|
||||
/// 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<UserId>, is_guest: bool) -> Self {
|
||||
pub fn new(user_id: OwnedUserId, is_guest: bool) -> Self {
|
||||
Self { user_id, device_id: None, is_guest }
|
||||
}
|
||||
}
|
||||
|
@ -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<RoomId>,
|
||||
pub room_id: OwnedRoomId,
|
||||
|
||||
/// A list of servers that are aware of this room ID.
|
||||
pub servers: Vec<Box<ServerName>>,
|
||||
pub servers: Vec<OwnedServerName>,
|
||||
}
|
||||
|
||||
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<RoomId>, servers: Vec<Box<ServerName>>) -> Self {
|
||||
pub fn new(room_id: OwnedRoomId, servers: Vec<OwnedServerName>) -> Self {
|
||||
Self { room_id, servers }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<UserId>, BTreeMap<Box<DeviceKeyId>, String>>,
|
||||
signatures: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceKeyId, String>>,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -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<Box<RoomId>, RoomKeyBackup>,
|
||||
pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
|
||||
}
|
||||
|
||||
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<Box<RoomId>, RoomKeyBackup>) -> Self {
|
||||
pub fn new(version: &'a str, rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>) -> Self {
|
||||
Self { version, rooms }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<RoomId>, RoomKeyBackup>,
|
||||
pub rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>,
|
||||
}
|
||||
|
||||
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<Box<RoomId>, RoomKeyBackup>) -> Self {
|
||||
pub fn new(rooms: BTreeMap<OwnedRoomId, RoomKeyBackup>) -> Self {
|
||||
Self { rooms }
|
||||
}
|
||||
}
|
||||
|
@ -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<DeviceId>,
|
||||
pub device_id: OwnedDeviceId,
|
||||
|
||||
/// Public display name of the device.
|
||||
pub display_name: Option<String>,
|
||||
@ -29,7 +29,7 @@ pub struct Device {
|
||||
|
||||
impl Device {
|
||||
/// 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 }
|
||||
}
|
||||
}
|
||||
|
@ -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<DeviceId>],
|
||||
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<DeviceId>]) -> Self {
|
||||
pub fn new(devices: &'a [OwnedDeviceId]) -> Self {
|
||||
Self { devices, auth: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<UserId>],
|
||||
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<UserId>]>,
|
||||
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<UserId>],
|
||||
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<RoomId>],
|
||||
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<RoomId>]>,
|
||||
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<UserId>]>,
|
||||
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<UserId>],
|
||||
pub not_senders: &'a [OwnedUserId],
|
||||
}
|
||||
|
||||
impl<'a> Filter<'a> {
|
||||
|
@ -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<Duration>,
|
||||
|
||||
/// 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: {
|
||||
@ -45,7 +45,7 @@ pub mod v3 {
|
||||
pub failures: BTreeMap<String, JsonValue>,
|
||||
|
||||
/// 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
|
||||
@ -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<Box<UserId>, BTreeMap<Box<DeviceId>, DeviceKeyAlgorithm>>,
|
||||
one_time_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, DeviceKeyAlgorithm>>,
|
||||
) -> 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<Box<UserId>, OneTimeKeys>) -> Self {
|
||||
pub fn new(one_time_keys: BTreeMap<OwnedUserId, OneTimeKeys>) -> Self {
|
||||
Self { failures: BTreeMap::new(), one_time_keys }
|
||||
}
|
||||
}
|
||||
|
||||
/// 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>>>;
|
||||
}
|
||||
|
@ -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<Box<UserId>>,
|
||||
pub changed: Vec<OwnedUserId>,
|
||||
|
||||
/// 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<Box<UserId>>,
|
||||
pub left: Vec<OwnedUserId>,
|
||||
}
|
||||
|
||||
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<Box<UserId>>, left: Vec<Box<UserId>>) -> Self {
|
||||
pub fn new(changed: Vec<OwnedUserId>, left: Vec<OwnedUserId>) -> Self {
|
||||
Self { changed, left }
|
||||
}
|
||||
}
|
||||
|
@ -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<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
|
||||
/// 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<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.
|
||||
#[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.
|
||||
#[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.
|
||||
#[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
|
||||
|
@ -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<Box<DeviceKeyId>, Raw<OneTimeKey>>,
|
||||
pub one_time_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>,
|
||||
|
||||
/// 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<Box<DeviceKeyId>, Raw<OneTimeKey>>,
|
||||
pub fallback_keys: BTreeMap<OwnedDeviceKeyId, Raw<OneTimeKey>>,
|
||||
}
|
||||
|
||||
response: {
|
||||
|
@ -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<Box<UserId>, SignedKeys>,
|
||||
pub signed_keys: BTreeMap<OwnedUserId, SignedKeys>,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
response: {
|
||||
/// Signature processing failures.
|
||||
pub failures: BTreeMap<Box<UserId>, BTreeMap<String, Failure>>,
|
||||
pub failures: BTreeMap<OwnedUserId, BTreeMap<String, Failure>>,
|
||||
}
|
||||
|
||||
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<Box<UserId>, SignedKeys>) -> Self {
|
||||
pub fn new(signed_keys: BTreeMap<OwnedUserId, SignedKeys>) -> 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<DeviceId>, device_keys: Raw<DeviceKeys>) {
|
||||
self.0.insert(device_id.into(), device_keys.into_json());
|
||||
pub fn add_device_keys(&mut self, device_id: OwnedDeviceId, device_keys: Raw<DeviceKeys>) {
|
||||
self.0.insert(device_id.as_str().into(), device_keys.into_json());
|
||||
}
|
||||
|
||||
/// Add the given cross signing keys.
|
||||
|
@ -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<ServerName>],
|
||||
pub server_name: &'a [OwnedServerName],
|
||||
}
|
||||
|
||||
response: {
|
||||
/// 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 {
|
||||
/// 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 }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<ServerName>, BTreeMap<Box<ServerSigningKeyId>, String>>,
|
||||
pub signatures: BTreeMap<OwnedServerName, BTreeMap<Box<ServerSigningKeyId>, String>>,
|
||||
}
|
||||
|
||||
impl<'a> ThirdPartySigned<'a> {
|
||||
@ -42,7 +44,7 @@ impl<'a> ThirdPartySigned<'a> {
|
||||
sender: &'a UserId,
|
||||
mxid: &'a UserId,
|
||||
token: &'a str,
|
||||
signatures: BTreeMap<Box<ServerName>, BTreeMap<Box<ServerSigningKeyId>, String>>,
|
||||
signatures: BTreeMap<OwnedServerName, BTreeMap<Box<ServerSigningKeyId>, String>>,
|
||||
) -> Self {
|
||||
Self { sender, mxid, token, signatures }
|
||||
}
|
||||
|
@ -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<RoomId>,
|
||||
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<RoomId>) -> Self {
|
||||
pub fn new(room_id: OwnedRoomId) -> Self {
|
||||
Self { room_id }
|
||||
}
|
||||
}
|
||||
|
@ -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<ServerName>],
|
||||
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<RoomId>,
|
||||
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<RoomId>) -> Self {
|
||||
pub fn new(room_id: OwnedRoomId) -> Self {
|
||||
Self { room_id }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<UserId>, RoomMember>,
|
||||
pub joined: BTreeMap<OwnedUserId, RoomMember>,
|
||||
}
|
||||
|
||||
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<Box<UserId>, RoomMember>) -> Self {
|
||||
pub fn new(joined: BTreeMap<OwnedUserId, RoomMember>) -> Self {
|
||||
Self { joined }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<RoomId>>,
|
||||
pub joined_rooms: Vec<OwnedRoomId>,
|
||||
}
|
||||
|
||||
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<Box<RoomId>>) -> Self {
|
||||
pub fn new(joined_rooms: Vec<OwnedRoomId>) -> Self {
|
||||
Self { joined_rooms }
|
||||
}
|
||||
}
|
||||
|
@ -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<EventId>,
|
||||
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<EventId>) -> Self {
|
||||
pub fn new(event_id: OwnedEventId) -> Self {
|
||||
Self { event_id }
|
||||
}
|
||||
}
|
||||
|
@ -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<RoomId>,
|
||||
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<Action>,
|
||||
event: Raw<AnySyncRoomEvent>,
|
||||
read: bool,
|
||||
room_id: Box<RoomId>,
|
||||
room_id: OwnedRoomId,
|
||||
ts: MilliSecondsSinceUnixEpoch,
|
||||
) -> Self {
|
||||
Self { actions, event, profile_tag: None, read, room_id, ts }
|
||||
|
@ -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<EventId>,
|
||||
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<EventId>) -> Self {
|
||||
pub fn new(event_id: OwnedEventId) -> Self {
|
||||
Self { event_id }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<RoomAliasId>>,
|
||||
pub aliases: Vec<OwnedRoomAliasId>,
|
||||
}
|
||||
|
||||
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<Box<RoomAliasId>>) -> Self {
|
||||
pub fn new(aliases: Vec<OwnedRoomAliasId>) -> Self {
|
||||
Self { aliases }
|
||||
}
|
||||
}
|
||||
|
@ -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<UserId>],
|
||||
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<RoomId>,
|
||||
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<RoomId>) -> Self {
|
||||
pub fn new(room_id: OwnedRoomId) -> Self {
|
||||
Self { room_id }
|
||||
}
|
||||
}
|
||||
|
@ -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<RoomId>,
|
||||
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<RoomId>) -> Self {
|
||||
pub fn new(replacement_room: OwnedRoomId) -> Self {
|
||||
Self { replacement_room }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<UserId>, UserProfile>,
|
||||
pub profile_info: BTreeMap<OwnedUserId, UserProfile>,
|
||||
|
||||
/// 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<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`
|
||||
/// 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<Box<RoomId>, Vec<Raw<AnyStateEvent>>>,
|
||||
pub state: BTreeMap<OwnedRoomId, Vec<Raw<AnyStateEvent>>>,
|
||||
|
||||
/// 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<Box<EventId>>,
|
||||
pub results: Vec<OwnedEventId>,
|
||||
}
|
||||
|
||||
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>),
|
||||
RoomId(OwnedRoomId),
|
||||
|
||||
/// Represents a user ID.
|
||||
UserId(Box<UserId>),
|
||||
UserId(OwnedUserId),
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<UserId>>,
|
||||
pub user_id: Option<OwnedUserId>,
|
||||
|
||||
/// A map of the user's device identifiers to information about that device.
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
|
@ -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<UserId>,
|
||||
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<Box<ServerName>>,
|
||||
pub home_server: Option<OwnedServerName>,
|
||||
|
||||
/// 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<DeviceId>,
|
||||
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<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 }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<RoomAliasId>>,
|
||||
pub canonical_alias: Option<OwnedRoomAliasId>,
|
||||
|
||||
/// 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<RoomId>,
|
||||
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<RoomId>,
|
||||
pub room_id: OwnedRoomId,
|
||||
|
||||
/// Whether the room may be viewed by guest users without joining.
|
||||
pub world_readable: bool,
|
||||
|
@ -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<EventId>,
|
||||
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<EventId>) -> Self {
|
||||
pub fn new(event_id: OwnedEventId) -> Self {
|
||||
Self { event_id }
|
||||
}
|
||||
}
|
||||
|
@ -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<Box<RoomId>, LeftRoom>,
|
||||
pub leave: BTreeMap<OwnedRoomId, LeftRoom>,
|
||||
|
||||
/// The rooms that the user has joined.
|
||||
#[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.
|
||||
#[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.
|
||||
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
|
||||
pub knock: BTreeMap<Box<RoomId>, KnockedRoom>,
|
||||
pub knock: BTreeMap<OwnedRoomId, KnockedRoom>,
|
||||
}
|
||||
|
||||
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<Box<UserId>>,
|
||||
pub changed: Vec<OwnedUserId>,
|
||||
|
||||
/// 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<Box<UserId>>,
|
||||
pub left: Vec<OwnedUserId>,
|
||||
}
|
||||
|
||||
impl DeviceLists {
|
||||
|
@ -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<Box<UserId>, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>;
|
||||
BTreeMap<OwnedUserId, BTreeMap<DeviceIdOrAllDevices, Raw<AnyToDeviceEventContent>>>;
|
||||
}
|
||||
|
@ -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<SessionId>,
|
||||
pub sid: OwnedSessionId,
|
||||
|
||||
/// Identity server client secret.
|
||||
pub client_secret: Box<ClientSecret>,
|
||||
@ -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<SessionId>,
|
||||
sid: OwnedSessionId,
|
||||
client_secret: Box<ClientSecret>,
|
||||
id_server: String,
|
||||
id_access_token: String,
|
||||
|
@ -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<UserId>,
|
||||
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<UserId>) -> Self {
|
||||
pub fn new(user_id: OwnedUserId) -> Self {
|
||||
Self { user_id, display_name: None, avatar_url: None }
|
||||
}
|
||||
}
|
||||
|
@ -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<Option<State>> {
|
||||
|
||||
struct Config {
|
||||
homeserver: String,
|
||||
username: Box<UserId>,
|
||||
username: OwnedUserId,
|
||||
password: Option<String>,
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user