FIXED #3: Parse XML Response

This commit is contained in:
Adam Cooper 2022-01-08 16:51:20 -05:00
parent aed09ac9d8
commit 22f3ea6353
1 changed files with 9 additions and 26 deletions

View File

@ -11,7 +11,6 @@ use yaserde_derive::{YaDeserialize, YaSerialize};
#[allow(unused)]
fn publicise() {}
// <d:multistatus xmlns:d="DAV:" xmlns:nc="http://nextcloud.org/ns" xmlns:oc="http://owncloud.org/ns" xmlns:s="http://sabredav.org/ns">
#[derive(Default, PartialEq, Debug, YaDeserialize)]
#[yaserde(
rename = "multistatus",
@ -44,29 +43,6 @@ pub struct Propstat {
status: Option<String>,
}
/*
<d:response>
<d:href>/nextcloud/remote.php/dav/files/adam/test_public/2021_test_public/</d:href>
<d:propstat>
<d:prop>
<d:getlastmodified>Tue, 14 Dec 2021 03:46:36 GMT</d:getlastmodified>
<oc:permissions>RGDNVCK</oc:permissions>
<d:resourcetype>
<d:collection />
</d:resourcetype>
<d:getetag>"61b8139c1beb0"</d:getetag>
</d:prop>
<d:status>HTTP/1.1 200 OK</d:status>
</d:propstat>
<d:propstat>
<d:prop>
<d:getcontentlength />
<d:getcontenttype />
</d:prop>
<d:status>HTTP/1.1 404 Not Found</d:status>
</d:propstat>
</d:response>
*/
#[derive(Default, PartialEq, Debug, YaDeserialize)]
#[yaserde(rename = "prop", namespace = "d: DAV:", namespace = "oc: http://owncloud.org/ns")]
pub struct Prop {
@ -82,6 +58,15 @@ pub struct Prop {
get_content_length: Option<u32>,
#[yaserde(prefix = "d", rename = "getcontenttype")]
get_content_type: Option<String>,
#[yaserde(prefix = "oc", rename = "share-types")]
share_types: Vec<ShareType>,
}
#[derive(Default, PartialEq, Debug, YaDeserialize)]
#[yaserde(rename = "share-types", namespace = "oc: http://owncloud.org/ns")]
pub struct ShareType {
#[yaserde(rename = "share-type", prefix = "oc")]
share_type: u8,
}
#[derive(Default, PartialEq, Debug, YaDeserialize)]
@ -174,5 +159,3 @@ async fn main() -> std::io::Result<()> {
println!("{:?}", result);
Ok(())
}
// TO_BE_DELETED: Testing removal of SSH password.