Add namespaces

This commit is contained in:
Lennart
2024-12-31 20:12:03 +01:00
parent b7f090e467
commit 6b8af308ed
2 changed files with 6 additions and 8 deletions

View File

@@ -1,14 +1,13 @@
use rustical_xml::XmlSerialize; use rustical_xml::{XmlDeserialize, XmlSerialize};
#[derive(Debug, Clone, XmlSerialize, PartialEq)] #[derive(Debug, Clone, XmlDeserialize, XmlSerialize, PartialEq)]
pub struct SupportedCalendarComponent { pub struct SupportedCalendarComponent {
#[xml(ty = "attr")] #[xml(ty = "attr")]
pub name: String, pub name: String,
} }
#[derive(Debug, Clone, XmlSerialize, PartialEq)] #[derive(Debug, Clone, XmlDeserialize, XmlSerialize, PartialEq)]
pub struct SupportedCalendarComponentSet { pub struct SupportedCalendarComponentSet {
// #[serde(rename = "C:comp")]
#[xml(flatten)] #[xml(flatten)]
pub comp: Vec<SupportedCalendarComponent>, pub comp: Vec<SupportedCalendarComponent>,
} }
@@ -32,7 +31,7 @@ impl Default for CalendarData {
#[derive(Debug, Clone, XmlSerialize, Default, PartialEq)] #[derive(Debug, Clone, XmlSerialize, Default, PartialEq)]
pub struct SupportedCalendarData { pub struct SupportedCalendarData {
// #[serde(rename = "C:calendar-data", alias = "calendar-data")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
calendar_data: CalendarData, calendar_data: CalendarData,
} }
@@ -75,7 +74,7 @@ impl Default for SupportedReportSet {
#[derive(Debug, Clone, XmlSerialize, PartialEq)] #[derive(Debug, Clone, XmlSerialize, PartialEq)]
pub enum Transport { pub enum Transport {
// #[serde(rename = "P:web-push")] #[xml(ns = "rustical_dav::namespace::NS_DAVPUSH")]
WebPush, WebPush,
} }
@@ -90,8 +89,8 @@ pub struct Transports {
// NOTE: Here we implement an older version of the spec since the new property name is not reflected // NOTE: Here we implement an older version of the spec since the new property name is not reflected
// in DAVx5 yet // in DAVx5 yet
// https://github.com/bitfireAT/webdav-push/commit/461259a2f2174454b2b00033419b11fac52b79e3 // https://github.com/bitfireAT/webdav-push/commit/461259a2f2174454b2b00033419b11fac52b79e3
// #[serde(rename = "P:transport")]
#[xml(flatten, rename = b"transport")] #[xml(flatten, rename = b"transport")]
#[xml(ns = "rustical_dav::namespace::NS_DAVPUSH")]
transports: Vec<TransportWrapper>, transports: Vec<TransportWrapper>,
} }

View File

@@ -64,7 +64,6 @@ pub enum CalendarProp {
CalendarOrder(Option<i64>), CalendarOrder(Option<i64>),
// TODO: Re-add // TODO: Re-add
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
#[xml(skip_deserializing)]
SupportedCalendarComponentSet(SupportedCalendarComponentSet), SupportedCalendarComponentSet(SupportedCalendarComponentSet),
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]