calternal_plugin_calendar::client
CalDAV discovery, collection synchronization, and conditional event writes.
Service clients send credentials only to the account’s HTTPS origin and disable redirects. Setup discovery may follow a short same-origin chain while pinning that host to its validated public DNS answers.
Source: crates/plugins/calendar/src/client/mod.rs
Structs
Section titled “Structs”CalDavClient
Section titled “CalDavClient”pub struct CalDavClientNo doc comment.
Implements: Clone, fmt::Debug
CalDavClient::new
Section titled “CalDavClient::new”pub fn new(endpoint: &str, credential: &Credential) -> Result<Self, ClientError>Build the compatibility client for a pre-Integration Calendar account. New Integration accounts must use a pinned constructor so DNS rebinding cannot redirect their credentials to a private address (#407, DESIGN §49).
CalDavClient::new_pinned
Section titled “CalDavClient::new_pinned”pub async fn new_pinned(endpoint: &str, credential: &Credential) -> Result<Self, ClientError>Build a client for an Integration account. Resolve and pin its public DNS answers before each sync or request so DNS changes cannot redirect the credential to a private address (#407, DESIGN §49).
CalDavClient::new_for_discovery
Section titled “CalDavClient::new_for_discovery”pub async fn new_for_discovery( endpoint: &str, credential: &Credential, ) -> Result<Self, ClientError>Build a pinned client for account setup. It follows only a short chain of same-origin redirects, so providers can resolve their well-known URLs without sending Basic credentials to another host (#407, DESIGN §49).
CalDavClient::validate_endpoint
Section titled “CalDavClient::validate_endpoint”pub fn validate_endpoint(endpoint: &str) -> Result<(), ClientError>No doc comment.
CalDavClient::endpoint
Section titled “CalDavClient::endpoint”pub fn endpoint(&self) -> &UrlNo doc comment.
CalDavClient::collection_url
Section titled “CalDavClient::collection_url”pub fn collection_url(&self, href: &str) -> Result<Url, ClientError>No doc comment.
CalDavClient::discover
Section titled “CalDavClient::discover”pub async fn discover(&self) -> Result<Discovery, ClientError>Discover the principal, calendar Home, and calendar collections with bounded PROPFIND responses (#928; DESIGN §30). Resolve each href on the same origin, clean labels and colours, and reject an empty result or more than the collection limit. No provider files are written.
CalDavClient::discover_address_books
Section titled “CalDavClient::discover_address_books”pub async fn discover_address_books(&self) -> Result<String, ClientError>Discover the CardDAV address-book home while Contacts stays hidden. The returned same-origin URL is kept with the Integration account for #297.
CalDavClient::sync_collection
Section titled “CalDavClient::sync_collection”pub async fn sync_collection( &self, calendar_href: &str, sync_token: Option<&str>, ) -> Result<SyncResponse, ClientError>Read bounded collection changes with RFC 6578 REPORT (#928; DESIGN §30). A missing token requests the full state. Retry once without a rejected token; use a full scan when REPORT is unsupported. Validate same-origin object hrefs and reject truncated or oversized results rather than returning an incomplete collection.
CalDavClient::create_event
Section titled “CalDavClient::create_event”pub async fn create_event( &self, calendar_href: &str, icalendar: &str, ) -> Result<RemoteObject, ClientError>No doc comment.
CalDavClient::replace_event
Section titled “CalDavClient::replace_event”pub async fn replace_event( &self, calendar_href: &str, event_href: &str, etag: &str, icalendar: &str, ) -> Result<RemoteObject, ClientError>No doc comment.
CalDavClient::delete_event
Section titled “CalDavClient::delete_event”pub async fn delete_event( &self, calendar_href: &str, event_href: &str, etag: &str, ) -> Result<(), ClientError>No doc comment.
CalDavClient::move_event
Section titled “CalDavClient::move_event”pub async fn move_event( &self, source_calendar_href: &str, event_href: &str, destination_calendar_href: &str, etag: &str, ) -> Result<RemoteObject, ClientError>Move an Event between collections owned by this CalDAV provider.
The server uses a new opaque destination href and requires the source ETag so a provider never moves a revision the user did not see.
CalDavClient::get_object
Section titled “CalDavClient::get_object”pub async fn get_object( &self, calendar: &Url, event_href: &str, etag: Option<&str>, ) -> Result<RemoteObject, ClientError>No doc comment.
Source: crates/plugins/calendar/src/client/mod.rs:125
Discovery
Section titled “Discovery”pub struct DiscoveryNo doc comment.
Fields
pub endpoint: String: Canonical same-origin endpoint returned after safe setup redirects.pub principal_href: Stringpub calendar_home_href: Stringpub calendars: Vec<RemoteCalendar>
Implements: Clone, Debug
Source: crates/plugins/calendar/src/client/mod.rs:88
EventMetadata
Section titled “EventMetadata”pub struct EventMetadataNo doc comment.
Fields
pub uid: Option<String>pub summary: Stringpub categories: Vec<String>: Provider categories in their iCalendar order. Calendar uses the first visible category for an Event’s shared tag tint.pub start: Option<String>pub end: Option<String>pub timezone: Option<String>pub location: Option<String>pub all_day: bool
Implements: Clone, Debug, Default, PartialEq, Eq
Source: crates/plugins/calendar/src/client/mod.rs:111
RemoteCalendar
Section titled “RemoteCalendar”pub struct RemoteCalendarNo doc comment.
Fields
pub href: Stringpub name: Stringpub color: Option<String>pub sync_token: Option<String>
Implements: Clone, Debug
Source: crates/plugins/calendar/src/client/mod.rs:80
RemoteObject
Section titled “RemoteObject”pub struct RemoteObjectNo doc comment.
Fields
pub href: Stringpub etag: Stringpub icalendar: String
Implements: Clone, Debug
Source: crates/plugins/calendar/src/client/mod.rs:104
SyncResponse
Section titled “SyncResponse”pub struct SyncResponseNo doc comment.
Fields
pub changes: Vec<CalendarChange>pub sync_token: Option<String>pub full_snapshot: bool
Implements: Clone, Debug
Source: crates/plugins/calendar/src/client/mod.rs:97
ClientError
Section titled “ClientError”pub enum ClientErrorNo doc comment.
Variants
InvalidUrlInvalidCredentialUnsupportedCredentialUnauthorizedProviderStatus(u16)RateLimited(u64)TransportResponseTooLargeInvalidXmlInvalidCalendarInvalidHrefMissingPropertyNoCalendarsTooManyItemsConflictNotFound
Implements: Clone, Debug, PartialEq, Eq, fmt::Display, std::error::Error
Source: crates/plugins/calendar/src/client/mod.rs:33
Functions
Section titled “Functions”event_metadata
Section titled “event_metadata”pub fn event_metadata(value: &str) -> Result<EventMetadata, ClientError>No doc comment.
Source: crates/plugins/calendar/src/client/mod.rs:1008
validate_icalendar
Section titled “validate_icalendar”pub fn validate_icalendar(value: &str) -> Result<ICalendar, ClientError>Parse one bounded CalDAV iCalendar object without changing its two-MiB limit.