pub struct DavClient<'a, T: Transport, A: AuthProvider> { /* private fields */ }Expand description
WebDAV client generic over the transport and the credential source.
Both are held by reference, so a client can be borrowed into several spawned tasks and share one connection pool and one token.
Implementations§
Source§impl<'a, T: Transport, A: AuthProvider> DavClient<'a, T, A>
impl<'a, T: Transport, A: AuthProvider> DavClient<'a, T, A>
Sourcepub const fn new(transport: &'a T, auth: &'a A) -> Self
pub const fn new(transport: &'a T, auth: &'a A) -> Self
Binds a client to a transport and a credential source.
Sourcepub async fn propfind(
&self,
path: &DavPath,
depth: Depth,
body: &PropfindBody,
) -> Result<Vec<DavResource>, Error>
pub async fn propfind( &self, path: &DavPath, depth: Depth, body: &PropfindBody, ) -> Result<Vec<DavResource>, Error>
Asks path for the properties in body, depth levels deep.
The answer must be 207 Multi-Status; any other status becomes
Error::Status with the response body retained for diagnosis. A
body that is not a multistatus becomes Error::Decode.
Sourcepub async fn get(&self, path: &DavPath) -> Result<Vec<u8>, Error>
pub async fn get(&self, path: &DavPath) -> Result<Vec<u8>, Error>
Downloads the content of the resource at path.
Any non-2xx status returns Error::Status with the response body
retained for diagnosis.
Sourcepub async fn put(
&self,
path: &DavPath,
body: impl Into<Vec<u8>>,
content_type: Option<&str>,
) -> Result<(), Error>
pub async fn put( &self, path: &DavPath, body: impl Into<Vec<u8>>, content_type: Option<&str>, ) -> Result<(), Error>
Uploads body to path, optionally specifying the Content-Type header.
Any non-2xx status returns Error::Status with the response body
retained for diagnosis.
Sourcepub async fn mkcol(&self, path: &DavPath) -> Result<(), Error>
pub async fn mkcol(&self, path: &DavPath) -> Result<(), Error>
Creates a collection (folder) at path.
Any non-2xx status returns Error::Status with the response body
retained for diagnosis.
Sourcepub async fn delete(&self, path: &DavPath) -> Result<(), Error>
pub async fn delete(&self, path: &DavPath) -> Result<(), Error>
Deletes the resource or collection at path.
Any non-2xx status returns Error::Status with the response body
retained for diagnosis.
Sourcepub async fn copy(
&self,
source: &DavPath,
destination: &DavPath,
overwrite: bool,
) -> Result<(), Error>
pub async fn copy( &self, source: &DavPath, destination: &DavPath, overwrite: bool, ) -> Result<(), Error>
Copies a resource from source to destination.
When overwrite is true, an existing destination is replaced;
otherwise the call fails with a status error if the destination exists.
Any non-2xx status returns Error::Status with the response body
retained for diagnosis.
Sourcepub async fn move_(
&self,
source: &DavPath,
destination: &DavPath,
overwrite: bool,
) -> Result<(), Error>
pub async fn move_( &self, source: &DavPath, destination: &DavPath, overwrite: bool, ) -> Result<(), Error>
Moves a resource from source to destination.
When overwrite is true, an existing destination is replaced;
otherwise the call fails with a status error if the destination exists.
Any non-2xx status returns Error::Status with the response body
retained for diagnosis.