ruma_client_api/rendezvous/update_rendezvous_session.rs
1//! `PUT /_matrix/client/*/rendezvous/{id}/{txnId}`
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 OwnedTransactionId,
12 api::{auth_scheme::NoAccessToken, request, response},
13 metadata,
14 };
15
16 metadata! {
17 method: PUT,
18 rate_limited: true,
19 authentication: NoAccessToken,
20 history: {
21 unstable => "/_matrix/client/unstable/io.element.msc4388/rendezvous/{id}/{txn_id}",
22 }
23 }
24
25 /// Request type for the `PUT` `rendezvous` endpoint.
26 #[request]
27 pub struct Request {
28 /// The ID of the rendezvous session to update.
29 #[ruma_api(path)]
30 pub id: String,
31
32 /// The transaction ID for this update.
33 ///
34 /// It is used by the server to ensure idempotency of requests: if the server has already
35 /// seen this transaction ID for this rendezvous session, it returns the recorded response
36 /// instead of evaluating the request again. A client that changes the `sequence_token` or
37 /// `data` it sends must use a new transaction ID.
38 #[ruma_api(path)]
39 pub txn_id: OwnedTransactionId,
40
41 /// The expected sequence token for the session. If it doesn't match the server state then
42 /// an error is returned.
43 pub sequence_token: String,
44
45 /// Data up to maximum size allowed by the server.
46 pub data: String,
47 }
48
49 impl Request {
50 /// Creates a new `Request` with the given id, transaction ID, sequence token and data.
51 pub fn new(
52 id: String,
53 txn_id: OwnedTransactionId,
54 sequence_token: String,
55 data: String,
56 ) -> Self {
57 Self { id, txn_id, sequence_token, data }
58 }
59 }
60
61 /// Response type for the `PUT` `rendezvous` endpoint.
62 #[response]
63 #[derive(Default)]
64 pub struct Response {
65 /// The new sequence token for the session.
66 pub sequence_token: String,
67 }
68
69 impl Response {
70 /// Creates a new `Response` with the given sequence token.
71 pub fn new(sequence_token: String) -> Self {
72 Self { sequence_token }
73 }
74 }
75}