diff --git a/src/data/client.rs b/src/data/client.rs
index 7d6dd6b..c26f727 100644
--- a/src/data/client.rs
+++ b/src/data/client.rs
@@ -40,6 +40,28 @@ static CAL_BODY: &str = r#"
"#;
+static TASKS_BODY: &str = r#"
+
+
+
+
+
+
+
+
+
+
+
+
+ CANCELLED
+
+
+
+
+
+"#;
+
pub struct Client {
url: Url,
username: String,
@@ -192,12 +214,38 @@ impl Client {
self.calendars = Some(calendars.clone());
Ok(calendars)
}
+
+ async fn get_tasks(&mut self, calendar: &Url) -> Result<(), Box> {
+ let method = Method::from_bytes(b"REPORT")
+ .expect("cannot create REPORT method.");
+
+ let res = reqwest::Client::new()
+ .request(method, calendar.as_str())
+ .header("Depth", 1)
+ .header(CONTENT_TYPE, "application/xml")
+ .basic_auth(self.username.clone(), Some(self.password.clone()))
+ .body(TASKS_BODY)
+ .send()
+ .await?;
+ let text = res.text().await?;
+
+ let el: Element = text.parse().unwrap();
+ let responses = find_elems(&el, "response");
+
+ for response in responses {
+ crate::print_xml(response);
+ println!("\n");
+ }
+
+ Ok(())
+ }
}
+
#[cfg(test)]
mod test {
use super::*;