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