Skip to content

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

pub struct CalDavClient

No doc comment.

Implements: Clone, fmt::Debug

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).

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).

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).

pub fn validate_endpoint(endpoint: &str) -> Result<(), ClientError>

No doc comment.

pub fn endpoint(&self) -> &Url

No doc comment.

pub fn collection_url(&self, href: &str) -> Result<Url, ClientError>

No doc comment.

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.

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.

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.

pub async fn create_event(
&self,
calendar_href: &str,
icalendar: &str,
) -> Result<RemoteObject, ClientError>

No doc comment.

pub async fn replace_event(
&self,
calendar_href: &str,
event_href: &str,
etag: &str,
icalendar: &str,
) -> Result<RemoteObject, ClientError>

No doc comment.

pub async fn delete_event(
&self,
calendar_href: &str,
event_href: &str,
etag: &str,
) -> Result<(), ClientError>

No doc comment.

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.

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

pub struct Discovery

No doc comment.

Fields

  • pub endpoint: String: Canonical same-origin endpoint returned after safe setup redirects.
  • pub principal_href: String
  • pub calendar_home_href: String
  • pub calendars: Vec<RemoteCalendar>

Implements: Clone, Debug

Source: crates/plugins/calendar/src/client/mod.rs:88

pub struct EventMetadata

No doc comment.

Fields

  • pub uid: Option<String>
  • pub summary: String
  • pub 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

pub struct RemoteCalendar

No doc comment.

Fields

  • pub href: String
  • pub name: String
  • pub color: Option<String>
  • pub sync_token: Option<String>

Implements: Clone, Debug

Source: crates/plugins/calendar/src/client/mod.rs:80

pub struct RemoteObject

No doc comment.

Fields

  • pub href: String
  • pub etag: String
  • pub icalendar: String

Implements: Clone, Debug

Source: crates/plugins/calendar/src/client/mod.rs:104

pub struct SyncResponse

No 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

pub enum ClientError

No doc comment.

Variants

  • InvalidUrl
  • InvalidCredential
  • UnsupportedCredential
  • Unauthorized
  • ProviderStatus(u16)
  • RateLimited(u64)
  • Transport
  • ResponseTooLarge
  • InvalidXml
  • InvalidCalendar
  • InvalidHref
  • MissingProperty
  • NoCalendars
  • TooManyItems
  • Conflict
  • NotFound

Implements: Clone, Debug, PartialEq, Eq, fmt::Display, std::error::Error

Source: crates/plugins/calendar/src/client/mod.rs:33

pub fn event_metadata(value: &str) -> Result<EventMetadata, ClientError>

No doc comment.

Source: crates/plugins/calendar/src/client/mod.rs:1008

pub fn validate_icalendar(value: &str) -> Result<ICalendar, ClientError>

Parse one bounded CalDAV iCalendar object without changing its two-MiB limit.

Source: crates/plugins/calendar/src/client/mod.rs:948