From 15bd7d2641745637fc755dede87b30461a0fe3fe Mon Sep 17 00:00:00 2001 From: tilpner Date: Thu, 28 Sep 2017 20:28:24 +0200 Subject: [PATCH 1/2] Pass sync request as query parameters instead of data Before, it would silently ignore them for defaults, so long-polling was not possible because no timeout was passed --- src/r0/sync.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/r0/sync.rs b/src/r0/sync.rs index b698d6ec..5b897fdc 100644 --- a/src/r0/sync.rs +++ b/src/r0/sync.rs @@ -219,18 +219,23 @@ pub mod sync_events { request { /// A filter represented either as its full JSON definition or the ID of a saved filter. #[serde(skip_serializing_if = "Option::is_none")] + #[ruma_api(query)] pub filter: Option, /// A point in time to continue a sync from. #[serde(skip_serializing_if = "Option::is_none")] + #[ruma_api(query)] pub since: Option, /// Controls whether to include the full state for all rooms the user is a member of. #[serde(skip_serializing_if = "Option::is_none")] + #[ruma_api(query)] pub full_state: Option, /// Controls whether the client is automatically marked as online by polling this API. #[serde(skip_serializing_if = "Option::is_none")] + #[ruma_api(query)] pub set_presence: Option, /// The maximum time to poll in milliseconds before returning this request. #[serde(skip_serializing_if = "Option::is_none")] + #[ruma_api(query)] pub timeout: Option, } From 478106fd427ed695db5a2c2cc7429295ce3a36e7 Mon Sep 17 00:00:00 2001 From: tilpner Date: Thu, 28 Sep 2017 20:30:28 +0200 Subject: [PATCH 2/2] Serialize sync_events::Filter untagged This is to make Filter::FilterId(String::from("0")) serialize as "0", instead of to a JSON object that cannot be passed as a query paramater --- src/r0/sync.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/r0/sync.rs b/src/r0/sync.rs index 5b897fdc..7a45c35b 100644 --- a/src/r0/sync.rs +++ b/src/r0/sync.rs @@ -260,6 +260,7 @@ pub mod sync_events { /// A filter represented either as its full JSON definition or the ID of a saved filter. #[derive(Clone, Debug, Deserialize, Serialize)] + #[serde(untagged)] pub enum Filter { /// A complete filter definition serialized to JSON. FilterDefinition(FilterDefinition),