api: Add MatrixVersion::V1_13

This commit is contained in:
Kévin Commaille 2024-12-19 18:27:04 +01:00 committed by strawberry
parent cbad1a414a
commit ea0cdc6318
2 changed files with 17 additions and 1 deletions

View File

@ -1,5 +1,11 @@
# [unreleased]
Improvements:
- Add `MatrixVersion::V1_13`.
# 0.15.0
Breaking changes:
- `#[serde(flatten)]` on the only body field of a `#[request]` or `#[response]`

View File

@ -553,6 +553,11 @@ pub enum MatrixVersion {
///
/// See <https://spec.matrix.org/v1.12/>.
V1_12,
/// Version 1.13 of the Matrix specification, released in Q4 2024.
///
/// See <https://spec.matrix.org/v1.13/>.
V1_13,
}
impl TryFrom<&str> for MatrixVersion {
@ -578,6 +583,7 @@ impl TryFrom<&str> for MatrixVersion {
"v1.10" => V1_10,
"v1.11" => V1_11,
"v1.12" => V1_12,
"v1.13" => V1_13,
_ => return Err(UnknownVersionError),
})
}
@ -629,6 +635,7 @@ impl MatrixVersion {
MatrixVersion::V1_10 => (1, 10),
MatrixVersion::V1_11 => (1, 11),
MatrixVersion::V1_12 => (1, 12),
MatrixVersion::V1_13 => (1, 13),
}
}
@ -648,6 +655,7 @@ impl MatrixVersion {
(1, 10) => Ok(MatrixVersion::V1_10),
(1, 11) => Ok(MatrixVersion::V1_11),
(1, 12) => Ok(MatrixVersion::V1_12),
(1, 13) => Ok(MatrixVersion::V1_13),
_ => Err(UnknownVersionError),
}
}
@ -746,7 +754,9 @@ impl MatrixVersion {
// <https://spec.matrix.org/v1.11/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_11
// <https://spec.matrix.org/v1.12/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_12 => RoomVersionId::V10,
| MatrixVersion::V1_12
// <https://spec.matrix.org/v1.13/rooms/#complete-list-of-room-versions>
| MatrixVersion::V1_13 => RoomVersionId::V10,
}
}
}