ruma_federation_api/directory/
get_public_rooms.rs
1pub mod v1 {
6 use js_int::UInt;
11 use ruma_common::{
12 api::{request, response, Metadata},
13 directory::{PublicRoomsChunk, RoomNetwork},
14 metadata,
15 };
16
17 const METADATA: Metadata = metadata! {
18 method: GET,
19 rate_limited: false,
20 authentication: ServerSignatures,
21 history: {
22 1.0 => "/_matrix/federation/v1/publicRooms",
23 }
24 };
25
26 #[request]
28 #[derive(Default)]
29 pub struct Request {
30 #[serde(skip_serializing_if = "Option::is_none")]
32 #[ruma_api(query)]
33 pub limit: Option<UInt>,
34
35 #[serde(skip_serializing_if = "Option::is_none")]
37 #[ruma_api(query)]
38 pub since: Option<String>,
39
40 #[serde(flatten, skip_serializing_if = "ruma_common::serde::is_default")]
42 #[ruma_api(query)]
43 pub room_network: RoomNetwork,
44 }
45
46 #[response]
48 #[derive(Default)]
49 pub struct Response {
50 pub chunk: Vec<PublicRoomsChunk>,
52
53 #[serde(skip_serializing_if = "Option::is_none")]
55 pub next_batch: Option<String>,
56
57 #[serde(skip_serializing_if = "Option::is_none")]
59 pub prev_batch: Option<String>,
60
61 pub total_room_count_estimate: Option<UInt>,
63 }
64
65 impl Request {
66 pub fn new() -> Self {
68 Default::default()
69 }
70 }
71
72 impl Response {
73 pub fn new() -> Self {
75 Default::default()
76 }
77 }
78}