client-api: Replace String with MxcUri for avatar_url

This commit is contained in:
Kévin Commaille 2021-04-04 09:10:33 +02:00 committed by Kévin Commaille
parent 3be1ac702c
commit 62929ce5d1
2 changed files with 14 additions and 3 deletions

View File

@ -67,6 +67,17 @@ Breaking changes:
* `r0::session::login::Request::new` takes only `login_info: LoginInfo` as a param
* Change `ruma_events::AnyEvent` to `ruma_events::AnySyncRoomEvent` in
`push::get_notifications::Notification`
* Use `ruma_identifiers::MxcUri` instead of `String` for `avatar_url` fields in the following
endpoints:
```rust
r0::{
directory,
media::create_content,
membership::joined_members,
profile::{get_avatar_url, get_profile, set_avatar_url},
search::{search_events, search_users}
}
```
Improvements:

View File

@ -1,7 +1,7 @@
//! [GET /_matrix/client/r0/profile/{userId}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-profile-userid)
use ruma_api::ruma_api;
use ruma_identifiers::UserId;
use ruma_identifiers::{MxcUri, UserId};
ruma_api! {
metadata: {
@ -30,7 +30,7 @@ ruma_api! {
feature = "compat",
serde(default, deserialize_with = "ruma_serde::empty_string_as_none")
)]
pub avatar_url: Option<String>,
pub avatar_url: Option<MxcUri>,
/// The user's display name, if set.
#[serde(skip_serializing_if = "Option::is_none")]
@ -49,7 +49,7 @@ impl<'a> Request<'a> {
impl Response {
/// Creates a new `Response` with the given avatar URL and display name.
pub fn new(avatar_url: Option<String>, displayname: Option<String>) -> Self {
pub fn new(avatar_url: Option<MxcUri>, displayname: Option<String>) -> Self {
Self { avatar_url, displayname }
}
}