ruma_client_api/rendezvous/
update_rendezvous_session.rs

1//! `PUT /_matrix/client/*/rendezvous/{id}`
2//!
3//! Update a rendezvous session.
4
5pub mod unstable {
6    //! `unstable/io.element.msc4388` ([MSC])
7    //!
8    //! [MSC]: https://github.com/matrix-org/matrix-spec-proposals/pull/4388
9
10    use ruma_common::{
11        api::{auth_scheme::NoAuthentication, request, response},
12        metadata,
13    };
14
15    metadata! {
16        method: PUT,
17        rate_limited: true,
18        authentication: NoAuthentication,
19        history: {
20            unstable("io.element.msc4388") => "/_matrix/client/unstable/io.element.msc4388/rendezvous/{id}",
21        }
22    }
23
24    /// Request type for the `PUT` `rendezvous` endpoint.
25    #[request(error = crate::Error)]
26    pub struct Request {
27        /// The ID of the rendezvous session to update.
28        #[ruma_api(path)]
29        pub id: String,
30
31        /// The expected sequence token for the session. If it doesn't match the server state then
32        /// an error is returned.
33        pub sequence_token: String,
34
35        /// Data up to maximum size allowed by the server.
36        pub data: String,
37    }
38
39    impl Request {
40        /// Creates a new `Request` with the given id, sequence token and data.
41        pub fn new(id: String, sequence_token: String, data: String) -> Self {
42            Self { id, sequence_token, data }
43        }
44    }
45
46    /// Response type for the `PUT` `rendezvous` endpoint.
47    #[response(error = crate::Error)]
48    #[derive(Default)]
49    pub struct Response {
50        /// The new sequence token for the session.
51        pub sequence_token: String,
52    }
53
54    impl Response {
55        /// Creates a new `Response` with the given sequence token.
56        pub fn new(sequence_token: String) -> Self {
57            Self { sequence_token }
58        }
59    }
60}