#![allow(clippy::too_many_arguments)]
use crate::client::Client;
use crate::error::Error;
use crate::generated::routes;
#[derive(Debug, Clone, Default, PartialEq)]
pub struct DeleteCalendarEventOccurrenceParams {
pub apply_to_future: Option<bool>,
}
pub struct CalendarEvents<'a> {
client: &'a Client,
}
impl<'a> CalendarEvents<'a> {
pub(crate) fn new(client: &'a Client) -> Self {
Self { client }
}
pub fn client(&self) -> &'a Client {
self.client
}
pub async fn delete(&self, event_id: i64) -> Result<(), Error> {
let mut operation = self
.client
.operation(&routes::DELETE_CALENDAR_EVENT, &[&event_id]);
operation.resource_id(event_id);
self.client.send_unit(operation).await
}
pub async fn delete_occurrence(
&self,
event_id: i64,
occurrence: &str,
params: &DeleteCalendarEventOccurrenceParams,
) -> Result<(), Error> {
let mut operation = self.client.operation(
&routes::DELETE_CALENDAR_EVENT_OCCURRENCE,
&[&event_id, &occurrence],
);
operation.resource_id(event_id);
operation.query_optional("apply_to_future", params.apply_to_future.as_ref());
self.client.send_unit(operation).await
}
}