Skip to main content

WebdavClientStd

Struct WebdavClientStd 

Source
pub struct WebdavClientStd {
    pub stream: Box<dyn WebdavStream>,
    pub base_url: Url,
    pub user_agent: String,
    pub principal_url: Option<Url>,
    pub calendar_home_set: Option<Url>,
    pub addressbook_home_set: Option<Url>,
    /* private fields */
}
Available on crate feature client only.
Expand description

Std-blocking WebDAV client wrapping a single blocking stream.

Fields§

§stream: Box<dyn WebdavStream>

The active blocking stream. Public so higher-level crates can pump their own WebdavCoroutines through it (as io-jmap exposes its stream), reusing this client’s discovery cache.

§base_url: Url

Base URL prepended to every request path.

§user_agent: String

User-Agent header value.

§principal_url: Option<Url>

Cached principal URL (RFC 5397).

§calendar_home_set: Option<Url>

Cached CalDAV home-set URL (RFC 4791 §6.2.1).

§addressbook_home_set: Option<Url>

Cached CardDAV home-set URL (RFC 6352 §7.1.1).

Implementations§

Source§

impl WebdavClientStd

Source

pub fn new<S: Read + Write + Send + 'static>( stream: S, auth: WebdavAuth, base_url: Url, ) -> Self

Builds a client around stream. The caller is responsible for opening the connection (TCP, TLS handshake if needed).

Source

pub fn from_parts<S: Read + Write + Send + 'static>( stream: S, auth: WebdavAuth, base_url: Url, principal_url: Option<Url>, calendar_home_set: Option<Url>, addressbook_home_set: Option<Url>, ) -> Self

Builds a client from a pre-connected stream and the full discovery state already in hand. Skips every discovery step.

Source

pub fn connect( url: &Url, tls: &Tls, auth: WebdavAuth, ) -> Result<Self, WebdavClientStdError>

Available on crate features native-tls or rustls-aws or rustls-ring only.

Connects to url’s host and runs the TLS handshake when the scheme is https. http goes through plain TCP. ALPN is set to http/1.1.

Source

pub fn set_stream<S: Read + Write + Send + 'static>(&mut self, stream: S)

Replaces the underlying stream; useful when discovery surfaces a new authority and the caller has to reconnect.

Source

pub fn auth(&self) -> &WebdavAuth

Returns the active authentication scheme.

Source

pub fn current_user_principal(&mut self) -> Result<Url, WebdavClientStdError>

Discovers the current user principal URL (RFC 5397) and caches it in principal_url. Subsequent calls return the cached value without hitting the network.

Source

pub fn calendar_home_set(&mut self) -> Result<Url, WebdavClientStdError>

Discovers the CalDAV home-set URL (RFC 4791 §6.2.1) and caches it in calendar_home_set. Resolves principal_url first when it is not cached.

Source

pub fn list_calendars( &mut self, ) -> Result<BTreeSet<Calendar>, WebdavClientStdError>

Lists every calendar under the cached calendar_home_set.

Source

pub fn create_calendar( &mut self, calendar: &Calendar, ) -> Result<(), WebdavClientStdError>

Creates a calendar collection under the cached calendar_home_set.

Source

pub fn update_calendar( &mut self, calendar: &Calendar, ) -> Result<(), WebdavClientStdError>

Updates a calendar collection’s properties.

Source

pub fn delete_calendar( &mut self, calendar_id: &str, ) -> Result<(), WebdavClientStdError>

Deletes a calendar collection.

Source

pub fn list_items( &mut self, calendar_id: &str, comp_filter: &str, ) -> Result<BTreeSet<ItemEntry>, WebdavClientStdError>

Lists every iCalendar item inside calendar_id. comp_filter is the optional VCALENDAR child filter (e.g. <C:comp-filter name=\"VEVENT\" />); pass an empty string to list every component type.

Source

pub fn read_item( &mut self, calendar_id: &str, item_id: &str, ) -> Result<ItemBody, WebdavClientStdError>

Reads a single calendar item’s raw iCalendar bytes plus its ETag.

Source

pub fn create_item( &mut self, calendar_id: &str, id: &str, ical: Vec<u8>, ) -> Result<CreateItemOk, WebdavClientStdError>

Creates a calendar item by id.

Source

pub fn update_item( &mut self, calendar_id: &str, id: &str, ical: Vec<u8>, if_match: Option<&str>, ) -> Result<UpdateItemOk, WebdavClientStdError>

Updates an existing calendar item.

Source

pub fn delete_item( &mut self, calendar_id: &str, item_id: &str, if_match: Option<&str>, ) -> Result<(), WebdavClientStdError>

Deletes a calendar item.

Source

pub fn addressbook_home_set(&mut self) -> Result<Url, WebdavClientStdError>

Discovers the CardDAV home-set URL (RFC 6352 §7.1.1) and caches it in addressbook_home_set.

Source

pub fn list_addressbooks( &mut self, ) -> Result<BTreeSet<Addressbook>, WebdavClientStdError>

Lists every addressbook under the cached addressbook_home_set.

Source

pub fn create_addressbook( &mut self, addressbook: &Addressbook, ) -> Result<(), WebdavClientStdError>

Creates an addressbook collection under the cached addressbook_home_set.

Source

pub fn update_addressbook( &mut self, addressbook: &Addressbook, ) -> Result<(), WebdavClientStdError>

Updates an addressbook collection’s properties.

Source

pub fn delete_addressbook( &mut self, addressbook_id: &str, ) -> Result<(), WebdavClientStdError>

Deletes an addressbook collection.

Source

pub fn list_cards( &mut self, addressbook_id: &str, ) -> Result<BTreeSet<CardEntry>, WebdavClientStdError>

Lists every card inside addressbook_id.

Source

pub fn enum_cards( &mut self, addressbook_id: &str, ) -> Result<BTreeSet<CardRef>, WebdavClientStdError>

Enumerates card references (id plus ETag, no bodies) inside addressbook_id.

Source

pub fn multiget_cards( &mut self, addressbook_id: &str, ids: &[&str], ) -> Result<Vec<CardEntry>, WebdavClientStdError>

Batch-fetches cards by id inside addressbook_id in a single round-trip.

Source

pub fn sync_cards( &mut self, addressbook_id: &str, sync_token: Option<&str>, ) -> Result<SyncDelta, WebdavClientStdError>

Runs an incremental sync-collection REPORT (RFC 6578) against addressbook_id, requesting ETags only. Pass None as sync_token for an initial sync.

Source

pub fn read_card( &mut self, addressbook_id: &str, card_id: &str, ) -> Result<CardBody, WebdavClientStdError>

Reads a single card’s raw vCard bytes plus its ETag.

Source

pub fn create_card( &mut self, addressbook_id: &str, id: &str, vcard: Vec<u8>, ) -> Result<CreateCardOk, WebdavClientStdError>

Creates a card by id.

Source

pub fn update_card( &mut self, addressbook_id: &str, id: &str, vcard: Vec<u8>, if_match: Option<&str>, ) -> Result<UpdateCardOk, WebdavClientStdError>

Updates an existing card.

Source

pub fn delete_card( &mut self, addressbook_id: &str, card_id: &str, if_match: Option<&str>, ) -> Result<(), WebdavClientStdError>

Deletes a card.

Trait Implementations§

Source§

impl Debug for WebdavClientStd

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.