client-api: Add device_id to account::whoami::Response

According to MSC2033
This commit is contained in:
Kévin Commaille 2022-02-22 18:36:04 +01:00
parent 04cfc7c12d
commit 4ab4614ef0
No known key found for this signature in database
GPG Key ID: DD507DAE96E8245C

View File

@ -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<UserId>,
/// The device ID associated with the access token, if any.
#[serde(skip_serializing_if = "Option::is_none")]
pub device_id: Option<Box<DeviceId>>,
}
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<UserId>) -> Self {
Self { user_id }
Self { user_id, device_id: None }
}
}
}