ruma_client_api/threads/
unsubscribe_thread.rs

1//! `DELETE /_matrix/client/*/rooms/{roomId}/thread/{eventId}/subscription`
2//!
3//! Removes the subscription state of the current user to a thread in a room.
4
5pub mod unstable {
6    //! `/unstable/` ([spec])
7    //!
8    //! [spec]: https://github.com/matrix-org/matrix-spec-proposals/pull/4306
9
10    use ruma_common::{
11        api::{request, response, Metadata},
12        metadata, OwnedEventId, OwnedRoomId,
13    };
14
15    const METADATA: Metadata = metadata! {
16        method: DELETE,
17        rate_limited: true,
18        authentication: AccessToken,
19        history: {
20            unstable("org.matrix.msc4306") => "/_matrix/client/unstable/io.element.msc4306/rooms/{room_id}/thread/{thread_root}/subscription",
21        }
22    };
23
24    /// Request type for the `unsubscribe_thread` endpoint.
25    #[request(error = crate::Error)]
26    pub struct Request {
27        /// The room ID where the thread is located.
28        #[ruma_api(path)]
29        pub room_id: OwnedRoomId,
30
31        /// The event ID of the thread root to unsubscribe to.
32        #[ruma_api(path)]
33        pub thread_root: OwnedEventId,
34    }
35
36    /// Response type for the `unsubscribe_thread` endpoint.
37    #[response(error = crate::Error)]
38    pub struct Response {}
39
40    impl Request {
41        /// Creates a new `Request` for the given room and thread IDs.
42        pub fn new(room_id: OwnedRoomId, thread_root: OwnedEventId) -> Self {
43            Self { room_id, thread_root }
44        }
45    }
46
47    impl Response {
48        /// Creates a new `Response`.
49        pub fn new() -> Self {
50            Self {}
51        }
52    }
53}