pub mod v3 {
use std::time::Duration;
use ruma_common::{
api::{request, response, Metadata},
metadata,
};
const METADATA: Metadata = metadata! {
method: POST,
rate_limited: true,
authentication: None,
history: {
unstable => "/_matrix/client/unstable/org.matrix.msc2918/refresh",
1.3 => "/_matrix/client/v3/refresh",
}
};
#[request(error = crate::Error)]
pub struct Request {
pub refresh_token: String,
}
#[response(error = crate::Error)]
pub struct Response {
pub access_token: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub refresh_token: Option<String>,
#[serde(
with = "ruma_common::serde::duration::opt_ms",
default,
skip_serializing_if = "Option::is_none"
)]
pub expires_in_ms: Option<Duration>,
}
impl Request {
pub fn new(refresh_token: String) -> Self {
Self { refresh_token }
}
}
impl Response {
pub fn new(access_token: String) -> Self {
Self { access_token, refresh_token: None, expires_in_ms: None }
}
}
}