ruma_identity_service_api/tos/
accept_terms_of_service.rs

1//! `POST /_matrix/identity/*/terms`
2//!
3//! Send acceptance of the terms of service of an identity server.
4
5pub mod v2 {
6    //! `/v2/` ([spec])
7    //!
8    //! [spec]: https://spec.matrix.org/latest/identity-service-api/#post_matrixidentityv2terms
9
10    use ruma_common::{
11        api::{request, response, Metadata},
12        metadata,
13    };
14
15    const METADATA: Metadata = metadata! {
16        method: POST,
17        rate_limited: false,
18        authentication: AccessToken,
19        history: {
20            1.0 => "/_matrix/identity/v2/terms",
21        }
22    };
23
24    /// Request type for the `accept_terms_of_service` endpoint.
25    #[request]
26    pub struct Request {
27        /// The URLs the user is accepting in this request.
28        ///
29        /// An example is `https://example.org/somewhere/terms-2.0-en.html`.
30        pub user_accepts: Vec<String>,
31    }
32
33    /// Response type for the `accept_terms_of_service` endpoint.
34    #[response]
35    #[derive(Default)]
36    pub struct Response {}
37
38    impl Request {
39        /// Creates a new `Request` with the given URLs which the user accepts.
40        pub fn new(user_accepts: Vec<String>) -> Self {
41            Self { user_accepts }
42        }
43    }
44
45    impl Response {
46        /// Creates an empty `Response`.
47        pub fn new() -> Self {
48            Self {}
49        }
50    }
51}