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 */
}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: UrlBase URL prepended to every request path.
user_agent: StringUser-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
impl WebdavClientStd
Sourcepub fn new<S: Read + Write + Send + 'static>(
stream: S,
auth: WebdavAuth,
base_url: Url,
) -> Self
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).
Sourcepub 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
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.
Sourcepub fn connect(
url: &Url,
tls: &Tls,
auth: WebdavAuth,
) -> Result<Self, WebdavClientStdError>
Available on crate features native-tls or rustls-aws or rustls-ring only.
pub fn connect( url: &Url, tls: &Tls, auth: WebdavAuth, ) -> Result<Self, WebdavClientStdError>
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.
Sourcepub fn set_stream<S: Read + Write + Send + 'static>(&mut self, stream: S)
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.
Sourcepub fn auth(&self) -> &WebdavAuth
pub fn auth(&self) -> &WebdavAuth
Returns the active authentication scheme.
Sourcepub fn current_user_principal(&mut self) -> Result<Url, WebdavClientStdError>
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.
Sourcepub fn calendar_home_set(&mut self) -> Result<Url, WebdavClientStdError>
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.
Sourcepub fn list_calendars(
&mut self,
) -> Result<BTreeSet<Calendar>, WebdavClientStdError>
pub fn list_calendars( &mut self, ) -> Result<BTreeSet<Calendar>, WebdavClientStdError>
Lists every calendar under the cached
calendar_home_set.
Sourcepub fn create_calendar(
&mut self,
calendar: &Calendar,
) -> Result<(), WebdavClientStdError>
pub fn create_calendar( &mut self, calendar: &Calendar, ) -> Result<(), WebdavClientStdError>
Creates a calendar collection under the cached
calendar_home_set.
Sourcepub fn update_calendar(
&mut self,
calendar: &Calendar,
) -> Result<(), WebdavClientStdError>
pub fn update_calendar( &mut self, calendar: &Calendar, ) -> Result<(), WebdavClientStdError>
Updates a calendar collection’s properties.
Sourcepub fn delete_calendar(
&mut self,
calendar_id: &str,
) -> Result<(), WebdavClientStdError>
pub fn delete_calendar( &mut self, calendar_id: &str, ) -> Result<(), WebdavClientStdError>
Deletes a calendar collection.
Sourcepub fn list_items(
&mut self,
calendar_id: &str,
comp_filter: &str,
) -> Result<BTreeSet<ItemEntry>, WebdavClientStdError>
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.
Sourcepub fn read_item(
&mut self,
calendar_id: &str,
item_id: &str,
) -> Result<ItemBody, WebdavClientStdError>
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.
Sourcepub fn create_item(
&mut self,
calendar_id: &str,
id: &str,
ical: Vec<u8>,
) -> Result<CreateItemOk, WebdavClientStdError>
pub fn create_item( &mut self, calendar_id: &str, id: &str, ical: Vec<u8>, ) -> Result<CreateItemOk, WebdavClientStdError>
Creates a calendar item by id.
Sourcepub fn update_item(
&mut self,
calendar_id: &str,
id: &str,
ical: Vec<u8>,
if_match: Option<&str>,
) -> Result<UpdateItemOk, WebdavClientStdError>
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.
Sourcepub fn delete_item(
&mut self,
calendar_id: &str,
item_id: &str,
if_match: Option<&str>,
) -> Result<(), WebdavClientStdError>
pub fn delete_item( &mut self, calendar_id: &str, item_id: &str, if_match: Option<&str>, ) -> Result<(), WebdavClientStdError>
Deletes a calendar item.
Sourcepub fn addressbook_home_set(&mut self) -> Result<Url, WebdavClientStdError>
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.
Sourcepub fn list_addressbooks(
&mut self,
) -> Result<BTreeSet<Addressbook>, WebdavClientStdError>
pub fn list_addressbooks( &mut self, ) -> Result<BTreeSet<Addressbook>, WebdavClientStdError>
Lists every addressbook under the cached
addressbook_home_set.
Sourcepub fn create_addressbook(
&mut self,
addressbook: &Addressbook,
) -> Result<(), WebdavClientStdError>
pub fn create_addressbook( &mut self, addressbook: &Addressbook, ) -> Result<(), WebdavClientStdError>
Creates an addressbook collection under the cached
addressbook_home_set.
Sourcepub fn update_addressbook(
&mut self,
addressbook: &Addressbook,
) -> Result<(), WebdavClientStdError>
pub fn update_addressbook( &mut self, addressbook: &Addressbook, ) -> Result<(), WebdavClientStdError>
Updates an addressbook collection’s properties.
Sourcepub fn delete_addressbook(
&mut self,
addressbook_id: &str,
) -> Result<(), WebdavClientStdError>
pub fn delete_addressbook( &mut self, addressbook_id: &str, ) -> Result<(), WebdavClientStdError>
Deletes an addressbook collection.
Sourcepub fn list_cards(
&mut self,
addressbook_id: &str,
) -> Result<BTreeSet<CardEntry>, WebdavClientStdError>
pub fn list_cards( &mut self, addressbook_id: &str, ) -> Result<BTreeSet<CardEntry>, WebdavClientStdError>
Lists every card inside addressbook_id.
Sourcepub fn enum_cards(
&mut self,
addressbook_id: &str,
) -> Result<BTreeSet<CardRef>, WebdavClientStdError>
pub fn enum_cards( &mut self, addressbook_id: &str, ) -> Result<BTreeSet<CardRef>, WebdavClientStdError>
Enumerates card references (id plus ETag, no bodies) inside
addressbook_id.
Sourcepub fn multiget_cards(
&mut self,
addressbook_id: &str,
ids: &[&str],
) -> Result<Vec<CardEntry>, WebdavClientStdError>
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.
Sourcepub fn sync_cards(
&mut self,
addressbook_id: &str,
sync_token: Option<&str>,
) -> Result<SyncDelta, WebdavClientStdError>
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.
Sourcepub fn read_card(
&mut self,
addressbook_id: &str,
card_id: &str,
) -> Result<CardBody, WebdavClientStdError>
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.
Sourcepub fn create_card(
&mut self,
addressbook_id: &str,
id: &str,
vcard: Vec<u8>,
) -> Result<CreateCardOk, WebdavClientStdError>
pub fn create_card( &mut self, addressbook_id: &str, id: &str, vcard: Vec<u8>, ) -> Result<CreateCardOk, WebdavClientStdError>
Creates a card by id.
Sourcepub fn update_card(
&mut self,
addressbook_id: &str,
id: &str,
vcard: Vec<u8>,
if_match: Option<&str>,
) -> Result<UpdateCardOk, WebdavClientStdError>
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.
Sourcepub fn delete_card(
&mut self,
addressbook_id: &str,
card_id: &str,
if_match: Option<&str>,
) -> Result<(), WebdavClientStdError>
pub fn delete_card( &mut self, addressbook_id: &str, card_id: &str, if_match: Option<&str>, ) -> Result<(), WebdavClientStdError>
Deletes a card.