libmatrix-client/src/api/methods/login.rs

42 lines
1.2 KiB
Rust

use serde::{Deserialize, Serialize};
// 5.4.1 GET /_matrix/client/r0/login
/// Response for 5.4.1: GET /_matrix/client/r0/login
#[derive(Deserialize)]
pub struct ValidLoginFlows {
pub flows: Option<LoginFlow>,
}
#[derive(Deserialize)]
pub struct LoginFlow {
pub r#type: Option<String>,
}
// 5.4.2 POST /_matrix/client/r0/login
/// Known identifier types for authentication methods. See [Section 5.3.6](https://matrix.org/docs/spec/client_server/r0.5.0#identifier-types)
/// for more details.
#[derive(Deserialize, Serialize)]
#[serde(tag = "type")]
pub enum IdentifierType {
#[serde(rename = "m.id.user")]
User { user: String },
#[serde(rename = "m.id.thirdparty")]
ThirdParty { medium: String, address: String },
#[serde(rename = "m.id.phone")]
Phone { country: String, phone: String },
}
/// Response for a valid login from 5.4.2: POST /_matrix/client/r0/login
#[derive(Deserialize)]
pub struct LoginResponse {
pub user_id: Option<String>,
pub access_token: Option<String>,
pub home_server: Option<String>,
pub device_id: Option<String>,
pub well_known: Option<DiscoveryInformation>,
}
#[derive(Deserialize)]
pub struct DiscoveryInformation {}