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://github.com/matrix-org/matrix-spec-proposals/pull/4133
9
10    use ruma_common::{
11        api::{request, response, Metadata},
12        metadata, OwnedUserId,
13    };
14
15    use crate::profile::ProfileFieldName;
16
17    const METADATA: Metadata = metadata! {
18        method: DELETE,
19        rate_limited: true,
20        authentication: AccessToken,
21        history: {
22            unstable("uk.tcpip.msc4133") => "/_matrix/client/unstable/uk.tcpip.msc4133/profile/{user_id}/{field}",
23            // 1.15 => "/_matrix/client/v3/profile/{user_id}/{field}",
24        }
25    };
26
27    /// Request type for the `delete_profile_field` endpoint.
28    #[request(error = crate::Error)]
29    pub struct Request {
30        /// The user whose profile will be updated.
31        #[ruma_api(path)]
32        pub user_id: OwnedUserId,
33
34        /// The profile field to delete.
35        #[ruma_api(path)]
36        pub field: ProfileFieldName,
37    }
38
39    impl Request {
40        /// Creates a new `Request` with the given user ID and field.
41        pub fn new(user_id: OwnedUserId, field: ProfileFieldName) -> Self {
42            Self { user_id, field }
43        }
44    }
45
46    /// Response type for the `delete_profile_field` endpoint.
47    #[response(error = crate::Error)]
48    #[derive(Default)]
49    pub struct Response {}
50
51    impl Response {
52        /// Creates an empty `Response`.
53        pub fn new() -> Self {
54            Self {}
55        }
56    }
57}