hey-sdk 0.30.0

Rust client for the HEY API, generated from a Smithy model of the API
Documentation
// Generated by hey-sdk-generator from openapi.json and behavior-model.json. DO NOT EDIT.

#![allow(clippy::too_many_arguments)]

use crate::client::Client;
use crate::error::Error;
use crate::generated::routes;

/// Optional query parameters for `DeleteCalendarEventOccurrence`.
#[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 }
    }

    /// The client this service sends through.
    pub fn client(&self) -> &'a Client {
        self.client
    }

    /// Delete a calendar event, cancelling it for every attendee. Answers 204.
    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
    }

    /// Delete one day of a repeating event, or that day and every one after it.
    /// Answers 204. A single day becomes an exception in the series' schedule; with
    /// apply_to_future the series is truncated at the day before, or destroyed if this
    /// was its first day.
    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
    }
}