ruma_client_api/tag/
delete_tag.rs

1//! `DELETE /_matrix/client/*/user/{userId}/rooms/{roomId}/tags/{tag}`
2//!
3//! Remove a tag from a room.
4
5pub mod v3 {
6    //! `/v3/` ([spec])
7    //!
8    //! [spec]: https://spec.matrix.org/latest/client-server-api/#put_matrixclientv3useruseridroomsroomidtagstag
9
10    use ruma_common::{
11        OwnedRoomId, OwnedUserId,
12        api::{auth_scheme::AccessToken, request, response},
13        metadata,
14    };
15
16    metadata! {
17        method: DELETE,
18        rate_limited: false,
19        authentication: AccessToken,
20        history: {
21            1.0 => "/_matrix/client/r0/user/{user_id}/rooms/{room_id}/tags/{tag}",
22            1.1 => "/_matrix/client/v3/user/{user_id}/rooms/{room_id}/tags/{tag}",
23        }
24    }
25
26    /// Request type for the `delete_tag` endpoint.
27    #[request(error = crate::Error)]
28    pub struct Request {
29        /// The user whose tag will be deleted.
30        #[ruma_api(path)]
31        pub user_id: OwnedUserId,
32
33        /// The tagged room.
34        #[ruma_api(path)]
35        pub room_id: OwnedRoomId,
36
37        /// The name of the tag to delete.
38        #[ruma_api(path)]
39        pub tag: String,
40    }
41
42    /// Response type for the `delete_tag` endpoint.
43    #[response(error = crate::Error)]
44    #[derive(Default)]
45    pub struct Response {}
46
47    impl Request {
48        /// Creates a new `Request` with the given user ID, room ID and tag
49        pub fn new(user_id: OwnedUserId, room_id: OwnedRoomId, tag: String) -> Self {
50            Self { user_id, room_id, tag }
51        }
52    }
53
54    impl Response {
55        /// Creates an empty `Response`.
56        pub fn new() -> Self {
57            Self {}
58        }
59    }
60}