ruma_identity_service_api/association/msisdn/
validate_msisdn_by_phone_number.rs

1//! `GET /_matrix/identity/*/validate/msisdn/submitToken`
2//!
3//! Validate the ownership of a phone number by the end user.
4
5pub mod v2 {
6    //! `/v2/` ([spec])
7    //!
8    //! [spec]: https://spec.matrix.org/latest/identity-service-api/#get_matrixidentityv2validatemsisdnsubmittoken
9
10    use ruma_common::{
11        OwnedClientSecret, OwnedSessionId,
12        api::{auth_scheme::AccessToken, request, response},
13        metadata,
14    };
15
16    metadata! {
17        method: GET,
18        rate_limited: false,
19        authentication: AccessToken,
20        history: {
21            1.0 => "/_matrix/identity/v2/validate/msisdn/submitToken",
22        }
23    }
24
25    /// Request type for the `validate_email_by_end_user` endpoint.
26    #[request]
27    pub struct Request {
28        /// The session ID, generated by the `requestToken` call.
29        #[ruma_api(query)]
30        pub sid: OwnedSessionId,
31
32        /// The client secret that was supplied to the `requestToken` call.
33        #[ruma_api(query)]
34        pub client_secret: OwnedClientSecret,
35
36        /// The token generated by the `requestToken` call and sent to the user.
37        #[ruma_api(query)]
38        pub token: String,
39    }
40
41    /// Response type for the `validate_email_by_end_user` endpoint.
42    #[response]
43    #[derive(Default)]
44    pub struct Response {}
45
46    impl Request {
47        /// Create a new `Request` with the given session ID, client secret and token.
48        pub fn new(sid: OwnedSessionId, client_secret: OwnedClientSecret, token: String) -> Self {
49            Self { sid, client_secret, token }
50        }
51    }
52
53    impl Response {
54        /// Create a new empty `Response`.
55        pub fn new() -> Self {
56            Self {}
57        }
58    }
59}