mirror of
https://github.com/lennart-k/rustical.git
synced 2025-12-14 18:52:26 +00:00
Refactoring
This commit is contained in:
@@ -1,8 +1,11 @@
|
||||
pub mod multistatus;
|
||||
mod propfind;
|
||||
mod resourcetype;
|
||||
pub mod tag_list;
|
||||
pub mod tag_name;
|
||||
|
||||
pub use propfind::{PropElement, PropfindType};
|
||||
|
||||
use derive_more::derive::From;
|
||||
pub use multistatus::MultistatusElement;
|
||||
pub use tag_list::TagList;
|
||||
|
||||
@@ -37,7 +37,7 @@ pub struct ResponseElement<PropstatType: Serialize> {
|
||||
pub href: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub status: Option<String>,
|
||||
pub propstat: Vec<PropstatType>,
|
||||
pub propstat: Vec<PropstatWrapper<PropstatType>>,
|
||||
}
|
||||
|
||||
impl<PT: Serialize> Default for ResponseElement<PT> {
|
||||
@@ -55,11 +55,11 @@ impl<PT: Serialize> Default for ResponseElement<PT> {
|
||||
// Extended by sync-token as specified in RFC 6578
|
||||
#[derive(Serialize)]
|
||||
#[serde(rename = "multistatus", rename_all = "kebab-case")]
|
||||
pub struct MultistatusElement<T1: Serialize, T2: Serialize> {
|
||||
pub struct MultistatusElement<PropType: Serialize, MemberPropType: Serialize> {
|
||||
#[serde(rename = "response")]
|
||||
pub responses: Vec<ResponseElement<T1>>,
|
||||
pub responses: Vec<ResponseElement<PropType>>,
|
||||
#[serde(rename = "response")]
|
||||
pub member_responses: Vec<ResponseElement<T2>>,
|
||||
pub member_responses: Vec<ResponseElement<MemberPropType>>,
|
||||
#[serde(rename = "@xmlns")]
|
||||
pub ns_dav: &'static str,
|
||||
#[serde(rename = "@xmlns:C")]
|
||||
|
||||
17
crates/dav/src/xml/propfind.rs
Normal file
17
crates/dav/src/xml/propfind.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use super::TagList;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub struct PropElement {
|
||||
#[serde(flatten)]
|
||||
pub prop: TagList,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone, Debug)]
|
||||
#[serde(rename_all = "kebab-case")]
|
||||
pub enum PropfindType {
|
||||
Propname,
|
||||
Allprop,
|
||||
Prop(PropElement),
|
||||
}
|
||||
Reference in New Issue
Block a user