client-api: Add missing sync::sync_events::v4::Response::txn_id field

In the [specification], if the request contains a `txn_id` value, the response
must echo the same `txn_id`. Unfortunately, this field is missing from
`sync::sync_events::v4::Response::txn_id`. This patch addresses that problem by
adding the missing field.

[specification]: 89cf0341b5/proposals/3575-sync.md
This commit is contained in:
Ivan Enderlin 2023-03-01 10:02:53 +01:00 committed by GitHub
parent bcb97b139d
commit 2edfe5bc5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,6 +97,10 @@ pub struct Response {
#[serde(default, skip_serializing_if = "ruma_common::serde::is_default")] #[serde(default, skip_serializing_if = "ruma_common::serde::is_default")]
pub initial: bool, pub initial: bool,
/// Matches the `txn_id` sent by the request. Please see [`Request::txn_id`].
#[serde(skip_serializing_if = "Option::is_none")]
pub txn_id: Option<String>,
/// The token to supply in the `pos` param of the next `/sync` request. /// The token to supply in the `pos` param of the next `/sync` request.
pub pos: String, pub pos: String,
@ -142,6 +146,7 @@ impl Response {
pub fn new(pos: String) -> Self { pub fn new(pos: String) -> Self {
Self { Self {
initial: Default::default(), initial: Default::default(),
txn_id: None,
pos, pos,
delta_token: Default::default(), delta_token: Default::default(),
lists: Default::default(), lists: Default::default(),