Add namespaces to props

This commit is contained in:
Lennart
2024-12-31 18:25:55 +01:00
parent 098e374e4d
commit 09239dba7e
7 changed files with 31 additions and 13 deletions

View File

@@ -39,7 +39,9 @@ pub struct CalendarResourceService<C: CalendarStore + ?Sized> {
)] )]
pub enum CalendarProp { pub enum CalendarProp {
// WebDAV (RFC 2518) // WebDAV (RFC 2518)
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Displayname(Option<String>), Displayname(Option<String>),
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Getcontenttype(String), Getcontenttype(String),
// WebDav Push // WebDav Push
@@ -47,24 +49,24 @@ pub enum CalendarProp {
// in DAVx5 yet // in DAVx5 yet
// https://github.com/bitfireAT/webdav-push/commit/461259a2f2174454b2b00033419b11fac52b79e3 // https://github.com/bitfireAT/webdav-push/commit/461259a2f2174454b2b00033419b11fac52b79e3
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
// #[serde(rename = "P:push-transports", alias = "push-transports")] #[xml(ns = "rustical_dav::namespace::NS_DAVPUSH")]
Transports(Transports), Transports(Transports),
Topic(String), Topic(String),
// CalDAV (RFC 4791) // CalDAV (RFC 4791)
// #[serde(rename = "IC:calendar-color", alias = "calendar-color")] #[xml(ns = "rustical_dav::namespace::NS_ICAL")]
CalendarColor(Option<String>), CalendarColor(Option<String>),
// #[serde(rename = "C:calendar-description", alias = "calendar-description")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
CalendarDescription(Option<String>), CalendarDescription(Option<String>),
// #[serde(rename = "C:calendar-timezone", alias = "calendar-timezone")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
CalendarTimezone(Option<String>), CalendarTimezone(Option<String>),
// #[serde(rename = "IC:calendar-order", alias = "calendar-order")] #[xml(ns = "rustical_dav::namespace::NS_ICAL")]
CalendarOrder(Option<i64>), CalendarOrder(Option<i64>),
// #[serde(rename = "C:supported-calendar-component-set")]
// TODO: Re-add // TODO: Re-add
#[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
SupportedCalendarComponentSet(SupportedCalendarComponentSet), SupportedCalendarComponentSet(SupportedCalendarComponentSet),
// #[serde(rename = "C:supported-calendar-data")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
SupportedCalendarData(SupportedCalendarData), SupportedCalendarData(SupportedCalendarData),
MaxResourceSize(i64), MaxResourceSize(i64),
@@ -72,12 +74,13 @@ pub enum CalendarProp {
SupportedReportSet(SupportedReportSet), SupportedReportSet(SupportedReportSet),
// Collection Synchronization (RFC 6578) // Collection Synchronization (RFC 6578)
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
SyncToken(String), SyncToken(String),
// CalendarServer // CalendarServer
// #[serde(rename = "CS:getctag", alias = "getctag")] #[xml(ns = "rustical_dav::namespace::NS_CALENDARSERVER")]
Getctag(String), Getctag(String),
// #[serde(rename = "CS:source", alias = "source")] #[xml(ns = "rustical_dav::namespace::NS_CALENDARSERVER")]
Source(Option<HrefElement>), Source(Option<HrefElement>),
} }

View File

@@ -28,11 +28,13 @@ pub struct CalendarObjectResourceService<C: CalendarStore + ?Sized> {
)] )]
pub enum CalendarObjectProp { pub enum CalendarObjectProp {
// WebDAV (RFC 2518) // WebDAV (RFC 2518)
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Getetag(String), Getetag(String),
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Getcontenttype(String), Getcontenttype(String),
// CalDAV (RFC 4791) // CalDAV (RFC 4791)
// #[serde(rename = "C:calendar-data")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
CalendarData(String), CalendarData(String),
} }

View File

@@ -32,12 +32,13 @@ pub struct PrincipalResource {
pub enum PrincipalProp { pub enum PrincipalProp {
// WebDAV Access Control (RFC 3744) // WebDAV Access Control (RFC 3744)
#[strum_discriminants(strum(serialize = "principal-URL"))] #[strum_discriminants(strum(serialize = "principal-URL"))]
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
PrincipalUrl(HrefElement), PrincipalUrl(HrefElement),
// CalDAV (RFC 4791) // CalDAV (RFC 4791)
// #[serde(rename = "C:calendar-home-set")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
CalendarHomeSet(HrefElement), CalendarHomeSet(HrefElement),
// #[serde(rename = "C:calendar-user-address-set")] #[xml(ns = "rustical_dav::namespace::NS_CALDAV")]
CalendarUserAddressSet(HrefElement), CalendarUserAddressSet(HrefElement),
} }

View File

@@ -29,7 +29,9 @@ pub struct AddressObjectResourceService<AS: AddressbookStore + ?Sized> {
)] )]
pub enum AddressObjectProp { pub enum AddressObjectProp {
// WebDAV (RFC 2518) // WebDAV (RFC 2518)
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Getetag(String), Getetag(String),
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Getcontenttype(String), Getcontenttype(String),
// CalDAV (RFC 4791) // CalDAV (RFC 4791)

View File

@@ -33,7 +33,9 @@ pub struct AddressbookResourceService<AS: AddressbookStore + ?Sized> {
)] )]
pub enum AddressbookProp { pub enum AddressbookProp {
// WebDAV (RFC 2518) // WebDAV (RFC 2518)
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Displayname(Option<String>), Displayname(Option<String>),
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
Getcontenttype(String), Getcontenttype(String),
// CardDAV (RFC 6352) // CardDAV (RFC 6352)
@@ -43,10 +45,13 @@ pub enum AddressbookProp {
#[xml(ns = "rustical_dav::namespace::NS_CARDDAV")] #[xml(ns = "rustical_dav::namespace::NS_CARDDAV")]
SupportedAddressData(SupportedAddressData), SupportedAddressData(SupportedAddressData),
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
#[xml(ns = "rustical_dav::namespace::NS_CARDDAV")]
SupportedReportSet(SupportedReportSet), SupportedReportSet(SupportedReportSet),
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
MaxResourceSize(i64), MaxResourceSize(i64),
// Collection Synchronization (RFC 6578) // Collection Synchronization (RFC 6578)
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
SyncToken(String), SyncToken(String),
// Didn't find the spec // Didn't find the spec

View File

@@ -31,8 +31,9 @@ pub struct PrincipalResource {
)] )]
pub enum PrincipalProp { pub enum PrincipalProp {
// WebDAV Access Control (RFC 3744) // WebDAV Access Control (RFC 3744)
#[xml(rename = b"principal-URL")]
#[strum_discriminants(strum(serialize = "principal-URL"))] #[strum_discriminants(strum(serialize = "principal-URL"))]
#[xml(rename = b"principal-URL")]
#[xml(ns = "rustical_dav::namespace::NS_DAV")]
PrincipalUrl(HrefElement), PrincipalUrl(HrefElement),
// CardDAV (RFC 6352) // CardDAV (RFC 6352)

View File

@@ -27,14 +27,18 @@ impl<T: FromStr + VariantNames> ResourcePropName for T {}
pub enum CommonPropertiesProp { pub enum CommonPropertiesProp {
// WebDAV (RFC 2518) // WebDAV (RFC 2518)
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
#[xml(ns = "crate::namespace::NS_DAV")]
Resourcetype(Resourcetype), Resourcetype(Resourcetype),
// WebDAV Current Principal Extension (RFC 5397) // WebDAV Current Principal Extension (RFC 5397)
#[xml(ns = "crate::namespace::NS_DAV")]
CurrentUserPrincipal(HrefElement), CurrentUserPrincipal(HrefElement),
// WebDAV Access Control Protocol (RFC 3477) // WebDAV Access Control Protocol (RFC 3477)
#[xml(skip_deserializing)] #[xml(skip_deserializing)]
#[xml(ns = "crate::namespace::NS_DAV")]
CurrentUserPrivilegeSet(UserPrivilegeSet), CurrentUserPrivilegeSet(UserPrivilegeSet),
#[xml(ns = "crate::namespace::NS_DAV")]
Owner(Option<HrefElement>), Owner(Option<HrefElement>),
} }