From 171a762768aabd799a1012d2fb939d869ff53f7b Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 28 May 2024 13:59:40 +0200 Subject: implement sync multistatus extension --- aero-dav/src/syncencoder.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'aero-dav/src/syncencoder.rs') diff --git a/aero-dav/src/syncencoder.rs b/aero-dav/src/syncencoder.rs index 59ad6cc..8badc92 100644 --- a/aero-dav/src/syncencoder.rs +++ b/aero-dav/src/syncencoder.rs @@ -32,6 +32,12 @@ impl QWrite for ReportTypeName { } } +impl QWrite for Multistatus { + async fn qwrite(&self, xml: &mut Writer) -> Result<(), QError> { + self.sync_token.qwrite(xml).await + } +} + impl QWrite for SyncCollection { async fn qwrite(&self, xml: &mut Writer) -> Result<(), QError> { let start = xml.create_dav_element("sync-collection"); @@ -196,4 +202,24 @@ mod tests { ])) .await; } + + #[tokio::test] + async fn multistatus_ext() { + serialize_deserialize(&dav::Multistatus:: { + responses: vec![dav::Response { + status_or_propstat: dav::StatusOrPropstat::Status( + vec![dav::Href("/".into())], + dav::Status(http::status::StatusCode::OK), + ), + error: None, + location: None, + responsedescription: None, + }], + responsedescription: None, + extension: Some(realization::Multistatus::Sync(Multistatus { + sync_token: SyncToken("http://example.com/ns/sync/1232".into()), + })), + }) + .await; + } } -- cgit v1.2.3