ruma_client_api/config/
get_room_account_data.rs1pub mod v3 {
6 use ruma_common::{
11 api::{request, response, Metadata},
12 metadata,
13 serde::Raw,
14 OwnedRoomId, OwnedUserId,
15 };
16 use ruma_events::{AnyRoomAccountDataEventContent, RoomAccountDataEventType};
17
18 const METADATA: Metadata = metadata! {
19 method: GET,
20 rate_limited: false,
21 authentication: AccessToken,
22 history: {
23 1.0 => "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type",
24 1.1 => "/_matrix/client/v3/user/:user_id/rooms/:room_id/account_data/:event_type",
25 }
26 };
27
28 #[request(error = crate::Error)]
30 pub struct Request {
31 #[ruma_api(path)]
33 pub user_id: OwnedUserId,
34
35 #[ruma_api(path)]
37 pub room_id: OwnedRoomId,
38
39 #[ruma_api(path)]
41 pub event_type: RoomAccountDataEventType,
42 }
43
44 #[response(error = crate::Error)]
46 pub struct Response {
47 #[ruma_api(body)]
52 pub account_data: Raw<AnyRoomAccountDataEventContent>,
53 }
54
55 impl Request {
56 pub fn new(
58 user_id: OwnedUserId,
59 room_id: OwnedRoomId,
60 event_type: RoomAccountDataEventType,
61 ) -> Self {
62 Self { user_id, room_id, event_type }
63 }
64 }
65
66 impl Response {
67 pub fn new(account_data: Raw<AnyRoomAccountDataEventContent>) -> Self {
69 Self { account_data }
70 }
71 }
72}