ruma_client_api/profile/
delete_profile_field.rs

1//! `DELETE /_matrix/client/*/profile/{userId}/{key_name}`
2//!
3//! Delete a field on the profile of the user.
4
5pub mod v3 {
6    //! `/v3/` ([spec])
7    //!
8    //! [spec]: https://spec.matrix.org/latest/client-server-api/#delete_matrixclientv3profileuseridkeyname
9
10    use ruma_common::{
11        OwnedUserId,
12        api::{auth_scheme::AccessToken, request, response},
13        metadata,
14    };
15
16    use crate::profile::ProfileFieldName;
17
18    metadata! {
19        method: DELETE,
20        rate_limited: true,
21        authentication: AccessToken,
22        history: {
23            unstable("uk.tcpip.msc4133") => "/_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/{field}",
24            1.16 => "/_matrix/client/v3/profile/{user_id}/{field}",
25        }
26    }
27
28    /// Request type for the `delete_profile_field` endpoint.
29    #[request(error = crate::Error)]
30    pub struct Request {
31        /// The user whose profile will be updated.
32        #[ruma_api(path)]
33        pub user_id: OwnedUserId,
34
35        /// The profile field to delete.
36        #[ruma_api(path)]
37        pub field: ProfileFieldName,
38    }
39
40    impl Request {
41        /// Creates a new `Request` with the given user ID and field.
42        pub fn new(user_id: OwnedUserId, field: ProfileFieldName) -> Self {
43            Self { user_id, field }
44        }
45    }
46
47    /// Response type for the `delete_profile_field` endpoint.
48    #[response(error = crate::Error)]
49    #[derive(Default)]
50    pub struct Response {}
51
52    impl Response {
53        /// Creates an empty `Response`.
54        pub fn new() -> Self {
55            Self {}
56        }
57    }
58}