From 4ab4614ef0b31f6d2a47b042a506f2670b4d7174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Tue, 22 Feb 2022 18:36:04 +0100 Subject: [PATCH] client-api: Add device_id to account::whoami::Response According to MSC2033 --- crates/ruma-client-api/src/account/whoami.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ruma-client-api/src/account/whoami.rs b/crates/ruma-client-api/src/account/whoami.rs index 687d3527..37512205 100644 --- a/crates/ruma-client-api/src/account/whoami.rs +++ b/crates/ruma-client-api/src/account/whoami.rs @@ -6,7 +6,7 @@ pub mod v3 { //! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3accountwhoami use ruma_api::ruma_api; - use ruma_identifiers::UserId; + use ruma_identifiers::{DeviceId, UserId}; ruma_api! { metadata: { @@ -26,6 +26,10 @@ pub mod v3 { response: { /// The id of the user that owns the access token. pub user_id: Box, + + /// The device ID associated with the access token, if any. + #[serde(skip_serializing_if = "Option::is_none")] + pub device_id: Option>, } error: crate::Error @@ -41,7 +45,7 @@ pub mod v3 { impl Response { /// Creates a new `Response` with the given user ID. pub fn new(user_id: Box) -> Self { - Self { user_id } + Self { user_id, device_id: None } } } }