ruma_client_api/account/
request_openid_token.rs1pub mod v3 {
6 use std::time::Duration;
11
12 use ruma_common::{
13 OwnedServerName, OwnedUserId,
14 api::{auth_scheme::AccessToken, request, response},
15 authentication::TokenType,
16 metadata,
17 };
18
19 metadata! {
20 method: POST,
21 rate_limited: true,
22 authentication: AccessToken,
23 history: {
24 1.0 => "/_matrix/client/r0/user/{user_id}/openid/request_token",
25 1.1 => "/_matrix/client/v3/user/{user_id}/openid/request_token",
26 }
27 }
28
29 #[request(error = crate::Error)]
31 pub struct Request {
32 #[ruma_api(path)]
34 pub user_id: OwnedUserId,
35 }
36
37 #[response(error = crate::Error)]
39 pub struct Response {
40 pub access_token: String,
42
43 pub token_type: TokenType,
45
46 pub matrix_server_name: OwnedServerName,
48
49 #[serde(with = "ruma_common::serde::duration::secs")]
51 pub expires_in: Duration,
52 }
53
54 impl Request {
55 pub fn new(user_id: OwnedUserId) -> Self {
57 Self { user_id }
58 }
59 }
60
61 impl Response {
62 pub fn new(
65 access_token: String,
66 token_type: TokenType,
67 matrix_server_name: OwnedServerName,
68 expires_in: Duration,
69 ) -> Self {
70 Self { access_token, token_type, matrix_server_name, expires_in }
71 }
72 }
73}