pub mod v2 {
use ruma_common::{
MilliSecondsSinceUnixEpoch, OwnedServerName,
api::{auth_scheme::NoAuthentication, request, response},
metadata,
serde::Raw,
};
use crate::discovery::ServerSigningKeys;
metadata! {
method: GET,
rate_limited: false,
authentication: NoAuthentication,
path: "/_matrix/key/v2/query/{server_name}",
}
#[request]
pub struct Request {
#[ruma_api(path)]
pub server_name: OwnedServerName,
#[ruma_api(query)]
#[serde(default = "MilliSecondsSinceUnixEpoch::now")]
pub minimum_valid_until_ts: MilliSecondsSinceUnixEpoch,
}
#[response]
pub struct Response {
pub server_keys: Vec<Raw<ServerSigningKeys>>,
}
impl Request {
pub fn new(
server_name: OwnedServerName,
minimum_valid_until_ts: MilliSecondsSinceUnixEpoch,
) -> Self {
Self { server_name, minimum_valid_until_ts }
}
}
impl Response {
pub fn new(server_keys: Vec<Raw<ServerSigningKeys>>) -> Self {
Self { server_keys }
}
}
}