pub async fn save_event(&self, event: icalendar::Event) -> CalDavResult<EventPointer> {
        let mut calendar = icalendar::Calendar::new();
        calendar.push(event);
        let uid = Uuid::new_v4().to_string();
        let req = self
            .client
            .request(Method::PUT, format!("{}/{}.ics", self.url, &uid))
            .await?
            .header("If-None-Match", "Match")
            .header("Content-Type", "text/calendar")
            .header("Content-Length", "xxxx")
            .body(calendar.to_string());
        let res = req.send().await?;
        if res.status().as_u16() != 201 && res.status() != 200 && res.status().as_u16() != 207 {
            return Err(CalDavError::OtherError);
        }
        Ok(EventPointer {
            data: AtomicRefCell::new(EventPointerData::CreatedEventResponse { uid }),
            url: self.url.clone(),
            client: self.client.clone(),
        })
    }
/// Saves a new event in the calendar.
Saves a new event in the calendar.
Saves a new event in the calendar .
pub async fn save_event(&self, event: icalendar::Event) -> CalDavResult<EventPointer> {
        let mut calendar = icalendar::Calendar::new();
        calendar.push(event);
        let uid = Uuid::new_v4().to_string();
        let req = self
            .client
            .request(Method::PUT, format!("{}/{}.ics", self.url, &uid))
            .await?
            .header("If-None-Match", "Match")
            .header("Content-Type", "text/calendar")
            .header("Content-Length", "xxxx")
            .body(calendar.to_string());
        let res = req.send().await?;
        if res.status().as_u16() != 201 && res.status() != 200 && res.status().as_u16() != 207 {
            return Err(CalDavError::OtherError);
        }
        Ok(EventPointer {
            data: AtomicRefCell::new(EventPointerData::CreatedEventResponse { uid }),
            url: self.url.clone(),
            client: self.client.clone(),
        })
    }
pub async fn save_event ( & self , event : icalendar :: Event ) -> CalDavResult < EventPointer > { let mut calendar = icalendar :: Calendar :: new ( ) ; calendar . push ( event ) ; let uid = Uuid :: new_v4 ( ) . to_string ( ) ; let req = self . client . request ( Method :: PUT , format ! ( " " self url uid ) ) . await ? . header ( " " , " " ) . header ( " " , " " ) . header ( " " , " " ) . body ( calendar . to_string ( ) ) ; let res = req . send ( ) . await ? ; if res . status ( ) . as_u16 ( ) != 201 && res . status ( ) != 200 && res . status ( ) . as_u16 ( ) != 207 { return Err ( CalDavError :: OtherError ) ; } Ok ( EventPointer { data : AtomicRefCell :: new ( EventPointerData :: CreatedEventResponse { uid } ) , url : self . url . clone ( ) , client : self . client . clone ( ) , } ) }
Saves a new event in the calendar.
Saves a new event in the calendar .
&self
event
icalendar::Event