Implemented get_item_version_tags for RemoteCalendar
This commit is contained in:
parent
e622ec0f7e
commit
078b650c00
1 changed files with 30 additions and 2 deletions
|
@ -66,8 +66,36 @@ impl BaseCalendar for RemoteCalendar {
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
impl DavCalendar for RemoteCalendar {
|
impl DavCalendar for RemoteCalendar {
|
||||||
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>> {
|
async fn get_item_version_tags(&self) -> Result<HashMap<ItemId, VersionTag>, Box<dyn Error>> {
|
||||||
log::error!("Not implemented");
|
let responses = crate::client::sub_request_and_extract_elems(&self.resource, "REPORT", TASKS_BODY.to_string(), "response").await?;
|
||||||
Ok(HashMap::new())
|
|
||||||
|
let mut items = HashMap::new();
|
||||||
|
for response in responses {
|
||||||
|
let item_url = crate::utils::find_elem(&response, "href")
|
||||||
|
.map(|elem| self.resource.combine(&elem.text()));
|
||||||
|
let item_id = match item_url {
|
||||||
|
None => {
|
||||||
|
log::warn!("Unable to extract HREF");
|
||||||
|
continue;
|
||||||
|
},
|
||||||
|
Some(resource) => {
|
||||||
|
ItemId::from(&resource)
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
let version_tag = match crate::utils::find_elem(&response, "getetag") {
|
||||||
|
None => {
|
||||||
|
log::warn!("Unable to extract ETAG for item {}, ignoring it", item_id);
|
||||||
|
continue;
|
||||||
|
},
|
||||||
|
Some(etag) => {
|
||||||
|
VersionTag::from(etag.text())
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
items.insert(item_id, version_tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(items)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn delete_item(&mut self, _item_id: &ItemId) -> Result<(), Box<dyn Error>> {
|
async fn delete_item(&mut self, _item_id: &ItemId) -> Result<(), Box<dyn Error>> {
|
||||||
|
|
Loading…
Add table
Reference in a new issue