lots of changes

This commit is contained in:
Lennart
2024-03-15 20:53:41 +01:00
parent b89c954752
commit ebf826f5b0
8 changed files with 97 additions and 80 deletions

View File

@@ -37,14 +37,16 @@ pub struct SupportedCalendarComponentSet {
#[derive(Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct CalendarData {
#[serde(rename = "@content-type")]
content_type: &'static str,
#[serde(rename = "@version")]
version: &'static str,
}
impl Default for CalendarData {
fn default() -> Self {
Self {
content_type: "text/calendar;charset=utf-8",
content_type: "text/calendar",
version: "2.0",
}
}
@@ -121,13 +123,13 @@ pub enum CalendarProp {
CurrentUserPrincipal,
Owner,
Displayname,
#[strum(props(tagname = "IC:calendar-color"))]
// #[strum(props(tagname = "IC:calendar-color"))]
CalendarColor,
#[strum(props(tagname = "C:calendar-description"))]
// #[strum(props(tagname = "C:calendar-description"))]
CalendarDescription,
#[strum(props(tagname = "C:supported-calendar-component-set"))]
// #[strum(props(tagname = "C:supported-calendar-component-set"))]
SupportedCalendarComponentSet,
#[strum(props(tagname = "C:supported-calendar-data"))]
// #[strum(props(tagname = "C:supported-calendar-data"))]
SupportedCalendarData,
Getcontenttype,
CurrentUserPrivilegeSet,
@@ -141,9 +143,19 @@ pub enum CalendarPropResponse {
CurrentUserPrincipal(HrefElement),
Owner(HrefElement),
Displayname(TextNode),
#[serde(rename = "IC:calendar-color", alias = "calendar-color")]
CalendarColor(TextNode),
#[serde(rename = "C:calendar-description", alias = "calendar-description")]
CalendarDescription(TextNode),
#[serde(
rename = "C:supported-calendar-component-set",
alias = "supported-calendar-component-set"
)]
SupportedCalendarComponentSet(SupportedCalendarComponentSet),
#[serde(
rename = "C:supported-calendar-data",
alias = "supported-calendar-data"
)]
SupportedCalendarData(SupportedCalendarData),
Getcontenttype(TextNode),
MaxResourceSize(TextNode),

View File

@@ -29,7 +29,7 @@ pub struct Resourcetype {
#[serde(rename_all = "kebab-case")]
pub enum RootPropResponse {
Resourcetype(Resourcetype),
CurrentUser(HrefElement),
CurrentUserPrincipal(HrefElement),
}
#[async_trait(?Send)]
@@ -63,9 +63,9 @@ impl Resource for RootResource {
fn get_prop(&self, prop: Self::PropType) -> Result<Self::PropResponse> {
match prop {
RootProp::Resourcetype => Ok(RootPropResponse::Resourcetype(Resourcetype::default())),
RootProp::CurrentUserPrincipal => Ok(RootPropResponse::CurrentUser(HrefElement::new(
format!("{}/{}/", self.prefix, self.principal),
))),
RootProp::CurrentUserPrincipal => Ok(RootPropResponse::CurrentUserPrincipal(
HrefElement::new(format!("{}/{}/", self.prefix, self.principal)),
)),
}
}
}