ruma_client_api/threads/get_thread_subscription.rs
1//! `GET /_matrix/client/*/rooms/{roomId}/thread/{eventId}/subscription`
2//!
3//! Gets 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 OwnedEventId, OwnedRoomId,
12 api::{auth_scheme::AccessToken, request, response},
13 metadata,
14 };
15
16 metadata! {
17 method: GET,
18 rate_limited: true,
19 authentication: AccessToken,
20 history: {
21 unstable("org.matrix.msc4306") => "/_matrix/client/unstable/io.element.msc4306/rooms/{room_id}/thread/{thread_root}/subscription",
22 }
23 }
24
25 /// Request type for the `get_thread_subscription` endpoint.
26 #[request(error = crate::Error)]
27 pub struct Request {
28 /// The room ID where the thread is located.
29 #[ruma_api(path)]
30 pub room_id: OwnedRoomId,
31
32 /// The event ID of the thread root to get the status for.
33 #[ruma_api(path)]
34 pub thread_root: OwnedEventId,
35 }
36
37 /// Response type for the `get_thread_subscription` endpoint.
38 #[response(error = crate::Error)]
39 pub struct Response {
40 /// Whether the subscription was made automatically by a client, not by manual user choice.
41 pub automatic: bool,
42 }
43
44 impl Request {
45 /// Creates a new `Request` for the given room and thread IDs.
46 pub fn new(room_id: OwnedRoomId, thread_root: OwnedEventId) -> Self {
47 Self { room_id, thread_root }
48 }
49 }
50
51 impl Response {
52 /// Creates a new `Response`.
53 pub fn new(automatic: bool) -> Self {
54 Self { automatic }
55 }
56 }
57}