pub struct VersionsClient<'a, T: Transport, A: AuthProvider> { /* private fields */ }Expand description
Client for Nextcloud’s WebDAV file versions endpoint.
Interacts with /remote.php/dav/versions/{user}/... to list, download, and restore
previous versions of a file.
Generic over the Transport and AuthProvider, both held by reference so that
connection pools and credentials can be shared across tasks.
Implementations§
Source§impl<'a, T: Transport, A: AuthProvider> VersionsClient<'a, T, A>
impl<'a, T: Transport, A: AuthProvider> VersionsClient<'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 versions client to a transport and credential provider.
Sourcepub async fn list(
&self,
user_id: &str,
file_id: u64,
) -> Result<Vec<FileVersion>, Error>
pub async fn list( &self, user_id: &str, file_id: u64, ) -> Result<Vec<FileVersion>, Error>
Lists all available revisions of a file.
Sends a PROPFIND request to /remote.php/dav/versions/{user_id}/versions/{file_id}
requesting revision metadata (getlastmodified, getcontentlength, and getetag).
Sourcepub async fn get(
&self,
user_id: &str,
file_id: u64,
revision_id: &str,
) -> Result<Vec<u8>, Error>
pub async fn get( &self, user_id: &str, file_id: u64, revision_id: &str, ) -> Result<Vec<u8>, Error>
Downloads the content of a specific revision.
Sends a GET request to /remote.php/dav/versions/{user_id}/versions/{file_id}/{revision_id}.
Sourcepub async fn restore(
&self,
user_id: &str,
file_id: u64,
revision_id: &str,
) -> Result<(), Error>
pub async fn restore( &self, user_id: &str, file_id: u64, revision_id: &str, ) -> Result<(), Error>
Restores a past revision to be the current file content.
Sends a MOVE request from /remote.php/dav/versions/{user_id}/versions/{file_id}/{revision_id}
to /remote.php/dav/versions/{user_id}/restore/{file_id}.