client-api: Add m.get_login_token capability
According to a clarification in the spec.
This commit is contained in:
parent
85b412ffed
commit
12a2e9342b
@ -34,6 +34,8 @@ Improvements:
|
||||
- Change types of `SyncRequestListFilters::{room_types,not_room_types}` to
|
||||
`Vec<RoomTypeFilter>` instead of a vector of strings
|
||||
- This is a breaking change, but only for users of `unstable-msc3575`
|
||||
- Add the `get_login_token` field to `Capabilities`, according to a
|
||||
clarification in the spec.
|
||||
|
||||
Bug fixes:
|
||||
|
||||
|
@ -63,6 +63,15 @@ pub struct Capabilities {
|
||||
)]
|
||||
pub thirdparty_id_changes: ThirdPartyIdChangesCapability,
|
||||
|
||||
/// Capability to indicate if the user can generate tokens to log further clients into their
|
||||
/// account.
|
||||
#[serde(
|
||||
rename = "m.get_login_token",
|
||||
default,
|
||||
skip_serializing_if = "GetLoginTokenCapability::is_default"
|
||||
)]
|
||||
pub get_login_token: GetLoginTokenCapability,
|
||||
|
||||
/// Any other custom capabilities that the server supports outside of the specification,
|
||||
/// labeled using the Java package naming convention and stored as arbitrary JSON values.
|
||||
#[serde(flatten)]
|
||||
@ -292,6 +301,26 @@ impl Default for ThirdPartyIdChangesCapability {
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about the `m.get_login_token` capability.
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
#[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)]
|
||||
pub struct GetLoginTokenCapability {
|
||||
/// Whether the user can request a login token.
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
impl GetLoginTokenCapability {
|
||||
/// Creates a new `GetLoginTokenCapability` with the given enabled flag.
|
||||
pub fn new(enabled: bool) -> Self {
|
||||
Self { enabled }
|
||||
}
|
||||
|
||||
/// Returns whether all fields have their default value.
|
||||
pub fn is_default(&self) -> bool {
|
||||
!self.enabled
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::borrow::Cow;
|
||||
|
Loading…
x
Reference in New Issue
Block a user