pub mod v3 {
use ruma_common::{
api::{request, response, Metadata},
metadata, OwnedMxcUri, OwnedUserId,
};
const METADATA: Metadata = metadata! {
method: GET,
rate_limited: false,
authentication: None,
history: {
1.0 => "/_matrix/client/r0/profile/:user_id/avatar_url",
1.1 => "/_matrix/client/v3/profile/:user_id/avatar_url",
}
};
#[request(error = crate::Error)]
pub struct Request {
#[ruma_api(path)]
pub user_id: OwnedUserId,
}
#[response(error = crate::Error)]
#[derive(Default)]
pub struct Response {
#[serde(skip_serializing_if = "Option::is_none")]
#[cfg_attr(
feature = "compat",
serde(default, deserialize_with = "ruma_common::serde::empty_string_as_none")
)]
pub avatar_url: Option<OwnedMxcUri>,
#[cfg(feature = "unstable-msc2448")]
#[serde(rename = "xyz.amorgan.blurhash", skip_serializing_if = "Option::is_none")]
pub blurhash: Option<String>,
}
impl Request {
pub fn new(user_id: OwnedUserId) -> Self {
Self { user_id }
}
}
impl Response {
pub fn new(avatar_url: Option<OwnedMxcUri>) -> Self {
Self {
avatar_url,
#[cfg(feature = "unstable-msc2448")]
blurhash: None,
}
}
}
}