ruma_client_api/directory/set_room_visibility.rs
1//! `PUT /_matrix/client/*/directory/list/room/{roomId}`
2//!
3//! Set the visibility of a public room on a directory.
4
5pub mod v3 {
6 //! `/v3/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/client-server-api/#put_matrixclientv3directorylistroomroomid
9
10 use ruma_common::{
11 api::{request, response},
12 metadata, OwnedRoomId,
13 };
14
15 use crate::room::Visibility;
16
17 metadata! {
18 method: PUT,
19 rate_limited: false,
20 authentication: AccessToken,
21 history: {
22 1.0 => "/_matrix/client/r0/directory/list/room/{room_id}",
23 1.1 => "/_matrix/client/v3/directory/list/room/{room_id}",
24 }
25 }
26
27 /// Request type for the `set_room_visibility` endpoint.
28 #[request(error = crate::Error)]
29 pub struct Request {
30 /// The ID of the room of which to set the visibility.
31 #[ruma_api(path)]
32 pub room_id: OwnedRoomId,
33
34 /// New visibility setting for the room.
35 pub visibility: Visibility,
36 }
37
38 /// Response type for the `set_room_visibility` endpoint.
39 #[response(error = crate::Error)]
40 #[derive(Default)]
41 pub struct Response {}
42
43 impl Request {
44 /// Creates a new `Request` with the given room ID and visibility.
45 pub fn new(room_id: OwnedRoomId, visibility: Visibility) -> Self {
46 Self { room_id, visibility }
47 }
48 }
49
50 impl Response {
51 /// Creates an empty `Response`.
52 pub fn new() -> Self {
53 Self {}
54 }
55 }
56}