pub mod v3 {
use http::header::LOCATION;
use ruma_common::{
api::{request, response, Metadata},
metadata,
};
const METADATA: Metadata = metadata! {
method: GET,
rate_limited: false,
authentication: None,
history: {
1.0 => "/_matrix/client/r0/auth/:auth_type/fallback/web",
1.1 => "/_matrix/client/v3/auth/:auth_type/fallback/web",
}
};
#[request(error = crate::Error)]
pub struct Request {
#[ruma_api(path)]
pub auth_type: String,
#[ruma_api(query)]
pub session: String,
}
#[response(error = crate::Error)]
#[derive(Default)]
pub struct Response {
#[ruma_api(header = LOCATION)]
pub redirect_url: Option<String>,
#[ruma_api(raw_body)]
pub body: Vec<u8>,
}
impl Request {
pub fn new(auth_type: String, session: String) -> Self {
Self { auth_type, session }
}
}
impl Response {
pub fn new(body: Vec<u8>) -> Self {
Self { redirect_url: None, body }
}
pub fn redirect(url: String) -> Self {
Self { redirect_url: Some(url), body: Vec::new() }
}
}
}