pub async fn make_calendar(&'_ self, cal: MakeCalendar) -> CalDavResult<Calendar> {
        let url = format!(
            "{}/{}",
            self.url,
            cal.id.unwrap_or_else(|| Uuid::new_v4().to_string())
        );
        let name = if let Some(name) = cal.name {
            name
        } else {
            Uuid::new_v4().to_string()
        };
        let body_string = xml! {
            <?xml version="1.0" encoding="utf-8" ?>
            <C:mkcalendar xmlns:D="DAV"
                          xmlns:C="url:ietf:params:xml:ns:caldav">
                <D:set>
                    <D:prop>
                        <D:displayname>{name}</D:displayname>
                    </D:prop>
                </D:set>
            </C:mkcalendar>
        }
        .to_string();
        self.client
            .request(Method::from_bytes(MKCALENDAR).unwrap(), &url)
            .body(body_string)
            .send()
            .await
            .map(|_| Calendar {
                client: Arc::new(self.clone()),
                url: Arc::new(self.url.to_string()),
            })
            .map_err(CalDavError::RequestError)
    }
/// Creates a new calendar from the provided `MakeCalendar` struct. If any of the fields on the
/// `MkCalendar` struct are `None` a uuid will be used in their place.
Creates a new calendar from the provided `MakeCalendar` struct. If any of the fields on the
`MkCalendar` struct are `None` a uuid will be used in their place.
Creates a new calendar from the provided ` MakeCalendar ` struct . If any of the fields on the ` MkCalendar ` struct are ` None ` a uuid will be used in their place .
pub async fn make_calendar(&'_ self, cal: MakeCalendar) -> CalDavResult<Calendar> {
        let url = format!(
            "{}/{}",
            self.url,
            cal.id.unwrap_or_else(|| Uuid::new_v4().to_string())
        );
        let name = if let Some(name) = cal.name {
            name
        } else {
            Uuid::new_v4().to_string()
        };
        let body_string = xml! {
            <?xml version="1.0" encoding="utf-8" ?>
            <C:mkcalendar xmlns:D="DAV"
                          xmlns:C="url:ietf:params:xml:ns:caldav">
                <D:set>
                    <D:prop>
                        <D:displayname>{name}</D:displayname>
                    </D:prop>
                </D:set>
            </C:mkcalendar>
        }
        .to_string();
        self.client
            .request(Method::from_bytes(MKCALENDAR).unwrap(), &url)
            .body(body_string)
            .send()
            .await
            .map(|_| Calendar {
                client: Arc::new(self.clone()),
                url: Arc::new(self.url.to_string()),
            })
            .map_err(CalDavError::RequestError)
    }
pub async fn make_calendar ( & ' _ self , cal : MakeCalendar ) -> CalDavResult < Calendar > { let url = format ! ( " " self url cal id unwrap_or_else ( Uuid new_v4 ( ) to_string ( ) ) ) ; let name = if let Some ( name ) = cal . name { name } else { Uuid :: new_v4 ( ) . to_string ( ) } ; let body_string = xml ! { xml version " " encoding " " C mkcalendar xmlns D " " xmlns C " " D set D prop D displayname { name } D displayname D prop D set C mkcalendar } . to_string ( ) ; self . client . request ( Method :: from_bytes ( MKCALENDAR ) . unwrap ( ) , & url ) . body ( body_string ) . send ( ) . await . map ( | _ | Calendar { client : Arc :: new ( self . clone ( ) ) , url : Arc :: new ( self . url . to_string ( ) ) , } ) . map_err ( CalDavError :: RequestError ) }
Creates a new calendar from the provided `MakeCalendar` struct.
Creates a new calendar from the provided ` MakeCalendar ` struct .
&'_ self
cal
MakeCalendar