pub async fn date_search(
        &self,
        start: DateTime<Utc>,
        end: DateTime<Utc>,
    ) -> CalDavResult<Vec<EventPointer>> {
        let start = start.format(DATETIME_FORMAT).to_string();
        let end = end.format(DATETIME_FORMAT).to_string();
        let body_string = xml! {
            <?xml version="1.0" encoding="utf-8" ?>
            <C:calendar-query xmlns:D="DAV:"
                          xmlns:C="urn:ietf:params:xml:ns:caldav">
              <D:prop>
                <D:getetag/>
                <C:calendar-data/>
              </D:prop>
              <C:filter>
                <C:comp-filter name="VCALENDAR">
                  <C:comp-filter name="VEVENT">
                    <C:time-range start={start}
                                  end={end}/>
                  </C:comp-filter>
                </C:comp-filter>
              </C:filter>
            </C:calendar-query>
        }
        .to_string();
        let res = self
            .client
            .request(Method::from_bytes(REPORT).unwrap(), self.url.as_str())
            .await?
            .body(body_string)
            .header("Content-Type", "application/xml; charset=\"utf-8\"")
            .header("Depth", "1")
            .send()
            .await?;
        let text = res.text().await.unwrap();
        let tree = Document::parse(&text).unwrap();
        let res = get_calendar_data(tree.descendants());
        Ok(res
            .map(|item| item.events)
            .flatten()
            .map(|event| EventPointer {
                data: AtomicRefCell::new(EventPointerData::FetchedEvent(event)),
                url: self.url.clone(),
                client: self.client.clone(),
            })
            .collect())
    }
/// Searches for all the events in a specific time period.
Searches for all the events in a specific time period.
Searches for all the events in a specific time period .
pub async fn date_search(
        &self,
        start: DateTime<Utc>,
        end: DateTime<Utc>,
    ) -> CalDavResult<Vec<EventPointer>> {
        let start = start.format(DATETIME_FORMAT).to_string();
        let end = end.format(DATETIME_FORMAT).to_string();
        let body_string = xml! {
            <?xml version="1.0" encoding="utf-8" ?>
            <C:calendar-query xmlns:D="DAV:"
                          xmlns:C="urn:ietf:params:xml:ns:caldav">
              <D:prop>
                <D:getetag/>
                <C:calendar-data/>
              </D:prop>
              <C:filter>
                <C:comp-filter name="VCALENDAR">
                  <C:comp-filter name="VEVENT">
                    <C:time-range start={start}
                                  end={end}/>
                  </C:comp-filter>
                </C:comp-filter>
              </C:filter>
            </C:calendar-query>
        }
        .to_string();
        let res = self
            .client
            .request(Method::from_bytes(REPORT).unwrap(), self.url.as_str())
            .await?
            .body(body_string)
            .header("Content-Type", "application/xml; charset=\"utf-8\"")
            .header("Depth", "1")
            .send()
            .await?;
        let text = res.text().await.unwrap();
        let tree = Document::parse(&text).unwrap();
        let res = get_calendar_data(tree.descendants());
        Ok(res
            .map(|item| item.events)
            .flatten()
            .map(|event| EventPointer {
                data: AtomicRefCell::new(EventPointerData::FetchedEvent(event)),
                url: self.url.clone(),
                client: self.client.clone(),
            })
            .collect())
    }
pub async fn date_search ( & self , start : DateTime < Utc > , end : DateTime < Utc > , ) -> CalDavResult < Vec < EventPointer > > { let start = start . format ( DATETIME_FORMAT ) . to_string ( ) ; let end = end . format ( DATETIME_FORMAT ) . to_string ( ) ; let body_string = xml ! { xml version " " encoding " " C calendar query xmlns D " " xmlns C " " D prop D getetag C calendar data D prop C filter C comp filter name " " C comp filter name " " C time range start { start } end { end } C comp filter C comp filter C filter C calendar query } . to_string ( ) ; let res = self . client . request ( Method :: from_bytes ( REPORT ) . unwrap ( ) , self . url . as_str ( ) ) . await ? . body ( body_string ) . header ( " " , " \" \" " ) . header ( " " , " " ) . send ( ) . await ? ; let text = res . text ( ) . await . unwrap ( ) ; let tree = Document :: parse ( & text ) . unwrap ( ) ; let res = get_calendar_data ( tree . descendants ( ) ) ; Ok ( res . map ( | item | item . events ) . flatten ( ) . map ( | event | EventPointer { data : AtomicRefCell :: new ( EventPointerData :: FetchedEvent ( event ) ) , url : self . url . clone ( ) , client : self . client . clone ( ) , } ) . collect ( ) ) }
Searches for all the events in a specific time period.
Searches for all the events in a specific time period .
&self
start
DateTime<Utc>
end
DateTime<Utc>