Replace Box<MxcUri> with OwnedMxcUri
This commit is contained in:
parent
e136f486db
commit
4014e6959f
@ -5,7 +5,7 @@ pub mod v3 {
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#post_matrixmediav3upload
|
||||
|
||||
use ruma_common::{api::ruma_api, MxcUri};
|
||||
use ruma_common::{api::ruma_api, OwnedMxcUri};
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
@ -50,7 +50,7 @@ pub mod v3 {
|
||||
|
||||
response: {
|
||||
/// The MXC URI for the uploaded content.
|
||||
pub content_uri: Box<MxcUri>,
|
||||
pub content_uri: OwnedMxcUri,
|
||||
|
||||
/// The [BlurHash](https://blurha.sh) for the uploaded content.
|
||||
///
|
||||
@ -83,7 +83,7 @@ pub mod v3 {
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given MXC URI.
|
||||
pub fn new(content_uri: Box<MxcUri>) -> Self {
|
||||
pub fn new(content_uri: OwnedMxcUri) -> Self {
|
||||
Self {
|
||||
content_uri,
|
||||
#[cfg(feature = "unstable-msc2448")]
|
||||
|
@ -7,7 +7,7 @@ pub mod v3 {
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use ruma_common::{api::ruma_api, MxcUri, OwnedUserId, RoomId};
|
||||
use ruma_common::{api::ruma_api, OwnedMxcUri, OwnedUserId, RoomId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
@ -68,7 +68,7 @@ pub mod v3 {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
}
|
||||
|
||||
impl RoomMember {
|
||||
|
@ -5,7 +5,7 @@ pub mod v3 {
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3profileuseridavatar_url
|
||||
|
||||
use ruma_common::{api::ruma_api, MxcUri, UserId};
|
||||
use ruma_common::{api::ruma_api, OwnedMxcUri, UserId};
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
@ -36,7 +36,7 @@ pub mod v3 {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
||||
///
|
||||
@ -63,7 +63,7 @@ pub mod v3 {
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given avatar URL.
|
||||
pub fn new(avatar_url: Option<Box<MxcUri>>) -> Self {
|
||||
pub fn new(avatar_url: Option<OwnedMxcUri>) -> Self {
|
||||
Self {
|
||||
avatar_url,
|
||||
#[cfg(feature = "unstable-msc2448")]
|
||||
|
@ -5,7 +5,7 @@ pub mod v3 {
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3profileuserid
|
||||
|
||||
use ruma_common::{api::ruma_api, MxcUri, UserId};
|
||||
use ruma_common::{api::ruma_api, OwnedMxcUri, UserId};
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
@ -36,7 +36,7 @@ pub mod v3 {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The user's display name, if set.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -67,7 +67,7 @@ pub mod v3 {
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given avatar URL and display name.
|
||||
pub fn new(avatar_url: Option<Box<MxcUri>>, displayname: Option<String>) -> Self {
|
||||
pub fn new(avatar_url: Option<OwnedMxcUri>, displayname: Option<String>) -> Self {
|
||||
Self {
|
||||
avatar_url,
|
||||
displayname,
|
||||
|
@ -12,7 +12,7 @@ pub mod v3 {
|
||||
api::ruma_api,
|
||||
events::{AnyRoomEvent, AnyStateEvent},
|
||||
serde::{Incoming, Raw, StringEnum},
|
||||
MxcUri, OwnedEventId, OwnedRoomId, OwnedUserId,
|
||||
OwnedEventId, OwnedMxcUri, OwnedRoomId, OwnedUserId,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -489,7 +489,7 @@ pub mod v3 {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The user's display name, if set.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -10,7 +10,7 @@ pub mod v3 {
|
||||
use ruma_common::{
|
||||
api::ruma_api,
|
||||
serde::{JsonObject, StringEnum},
|
||||
MxcUri,
|
||||
OwnedMxcUri,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use serde_json::Value as JsonValue;
|
||||
@ -177,7 +177,7 @@ pub mod v3 {
|
||||
pub name: String,
|
||||
|
||||
/// The icon for the provider.
|
||||
pub icon: Option<Box<MxcUri>>,
|
||||
pub icon: Option<OwnedMxcUri>,
|
||||
|
||||
/// The brand identifier for the provider.
|
||||
pub brand: Option<IdentityProviderBrand>,
|
||||
|
@ -9,7 +9,7 @@ use ruma_common::{
|
||||
events::space::child::HierarchySpaceChildEvent,
|
||||
room::RoomType,
|
||||
serde::{Raw, StringEnum},
|
||||
MxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
||||
OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -63,7 +63,7 @@ pub struct SpaceHierarchyRoomsChunk {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The join rule of the room.
|
||||
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
||||
|
@ -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, OwnedUserId};
|
||||
use ruma_common::{api::ruma_api, OwnedMxcUri, OwnedUserId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
ruma_api! {
|
||||
@ -93,7 +93,7 @@ pub mod v3 {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
}
|
||||
|
||||
impl User {
|
||||
|
@ -14,7 +14,7 @@ use serde::{
|
||||
};
|
||||
use serde_json::Value as JsonValue;
|
||||
|
||||
use crate::{MxcUri, PrivOwnedStr, RoomName};
|
||||
use crate::{OwnedMxcUri, PrivOwnedStr, RoomName};
|
||||
|
||||
/// A chunk of a room list response, describing one room.
|
||||
///
|
||||
@ -62,7 +62,7 @@ pub struct PublicRoomsChunk {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "crate::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The join rule of the room.
|
||||
#[serde(default, skip_serializing_if = "crate::serde::is_default")]
|
||||
|
@ -7,7 +7,7 @@ use ruma_macros::EventContent;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use super::ThumbnailInfo;
|
||||
use crate::{events::EmptyStateKey, MxcUri};
|
||||
use crate::{events::EmptyStateKey, OwnedMxcUri};
|
||||
|
||||
/// The content of an `m.room.avatar` event.
|
||||
///
|
||||
@ -23,7 +23,7 @@ pub struct RoomAvatarEventContent {
|
||||
pub info: Option<Box<ImageInfo>>,
|
||||
|
||||
/// URL of the avatar image.
|
||||
pub url: Option<Box<MxcUri>>,
|
||||
pub url: Option<OwnedMxcUri>,
|
||||
}
|
||||
|
||||
impl RoomAvatarEventContent {
|
||||
@ -59,7 +59,7 @@ pub struct ImageInfo {
|
||||
|
||||
/// The URL to the thumbnail of the image.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub thumbnail_url: Option<Box<MxcUri>>,
|
||||
pub thumbnail_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The [BlurHash](https://blurha.sh) for this image.
|
||||
///
|
||||
|
@ -14,7 +14,8 @@ use crate::{
|
||||
StateEventType,
|
||||
},
|
||||
serde::StringEnum,
|
||||
MxcUri, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, PrivOwnedStr, RoomVersionId,
|
||||
OwnedMxcUri, OwnedServerName, OwnedServerSigningKeyId, OwnedUserId, PrivOwnedStr,
|
||||
RoomVersionId,
|
||||
};
|
||||
|
||||
mod change;
|
||||
@ -55,7 +56,7 @@ pub struct RoomMemberEventContent {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "crate::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The display name for this user, if any.
|
||||
///
|
||||
|
@ -65,7 +65,7 @@ mod tests {
|
||||
|
||||
use ruma_identifiers_validation::error::MxcUriError;
|
||||
|
||||
use super::MxcUri;
|
||||
use super::{MxcUri, OwnedMxcUri};
|
||||
|
||||
#[test]
|
||||
fn parse_mxc_uri() {
|
||||
@ -102,7 +102,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn deserialize_mxc_uri() {
|
||||
let mxc = serde_json::from_str::<Box<MxcUri>>(r#""mxc://server/1234id""#)
|
||||
let mxc = serde_json::from_str::<OwnedMxcUri>(r#""mxc://server/1234id""#)
|
||||
.expect("Failed to convert JSON to MxcUri");
|
||||
|
||||
assert_eq!(mxc.as_str(), "mxc://server/1234id");
|
||||
|
@ -7,7 +7,7 @@ pub mod v1 {
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/v1.2/server-server-api/#get_matrixfederationv1queryprofile
|
||||
|
||||
use ruma_common::{api::ruma_api, serde::StringEnum, MxcUri, UserId};
|
||||
use ruma_common::{api::ruma_api, serde::StringEnum, OwnedMxcUri, UserId};
|
||||
|
||||
use crate::PrivOwnedStr;
|
||||
|
||||
@ -48,7 +48,7 @@ pub mod v1 {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The [BlurHash](https://blurha.sh) for the avatar pointed to by `avatar_url`.
|
||||
///
|
||||
|
@ -3,7 +3,7 @@
|
||||
use js_int::UInt;
|
||||
use ruma_common::{
|
||||
directory::PublicRoomJoinRule, events::space::child::HierarchySpaceChildEvent, room::RoomType,
|
||||
serde::Raw, MxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
||||
serde::Raw, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId, RoomName,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
@ -55,7 +55,7 @@ pub struct SpaceHierarchyParentSummary {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The join rule of the room.
|
||||
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
||||
@ -184,7 +184,7 @@ pub struct SpaceHierarchyChildSummary {
|
||||
feature = "compat",
|
||||
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
|
||||
)]
|
||||
pub avatar_url: Option<Box<MxcUri>>,
|
||||
pub avatar_url: Option<OwnedMxcUri>,
|
||||
|
||||
/// The join rule of the room.
|
||||
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user