Add endpoint for getting supported login types

This commit is contained in:
Karl Linderhed 2020-01-03 14:02:07 +01:00
parent bc03dc6f2e
commit a35f8a7f85
2 changed files with 33 additions and 0 deletions

View File

@ -1,5 +1,6 @@
//! Endpoints for user session management.
pub mod get_login_types;
pub mod login;
pub mod logout;
pub mod logout_all;

View File

@ -0,0 +1,32 @@
//! [GET /_matrix/client/r0/login](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-login)
use ruma_api::ruma_api;
use serde::{Deserialize, Serialize};
use super::login::LoginType;
ruma_api! {
metadata {
description: "Gets the homeserver's supported login types to authenticate users. Clients should pick one of these and supply it as the type when logging in.",
method: GET,
name: "get_login_types",
path: "/_matrix/client/r0/login",
rate_limited: true,
requires_authentication: false,
}
request {}
response {
/// The homeserver's supported login types.
pub flows: Vec<LoginFlow>
}
}
/// A supported login type in a homeserver
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
pub struct LoginFlow {
/// The login type.
#[serde(rename = "type")]
pub login_type: LoginType,
}