|
|
@ -1,4 +1,7 @@
|
|
|
|
use crate::api_core::common::{FileIdentifier, FileMetadataInfo, FileRecord, OptionalStringNumber};
|
|
|
|
use crate::api_core::common::{
|
|
|
|
|
|
|
|
FileIdentifier, FileMetadataInfo, FileRecord, FileSelection, FileServiceSelection,
|
|
|
|
|
|
|
|
OptionalStringNumber,
|
|
|
|
|
|
|
|
};
|
|
|
|
use crate::api_core::endpoints::access_management::{
|
|
|
|
use crate::api_core::endpoints::access_management::{
|
|
|
|
ApiVersion, ApiVersionResponse, GetServices, GetServicesResponse, SessionKey,
|
|
|
|
ApiVersion, ApiVersionResponse, GetServices, GetServicesResponse, SessionKey,
|
|
|
|
SessionKeyResponse, VerifyAccessKey, VerifyAccessKeyResponse,
|
|
|
|
SessionKeyResponse, VerifyAccessKey, VerifyAccessKeyResponse,
|
|
|
@ -110,16 +113,33 @@ impl Client {
|
|
|
|
|
|
|
|
|
|
|
|
/// Moves files with matching hashes to the trash
|
|
|
|
/// Moves files with matching hashes to the trash
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
pub async fn delete_files(&self, request: DeleteFilesRequest) -> Result<()> {
|
|
|
|
pub async fn delete_files(
|
|
|
|
self.post::<DeleteFiles>(request).await?;
|
|
|
|
&self,
|
|
|
|
|
|
|
|
files: FileSelection,
|
|
|
|
|
|
|
|
service: FileServiceSelection,
|
|
|
|
|
|
|
|
reason: Option<String>,
|
|
|
|
|
|
|
|
) -> Result<()> {
|
|
|
|
|
|
|
|
self.post::<DeleteFiles>(DeleteFilesRequest {
|
|
|
|
|
|
|
|
file_selection: files,
|
|
|
|
|
|
|
|
service_selection: service,
|
|
|
|
|
|
|
|
reason,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Pulls files out of the trash by hash
|
|
|
|
/// Pulls files out of the trash by hash
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
pub async fn undelete_files(&self, hashes: Vec<String>) -> Result<()> {
|
|
|
|
pub async fn undelete_files(
|
|
|
|
self.post::<UndeleteFiles>(UndeleteFilesRequest { hashes })
|
|
|
|
&self,
|
|
|
|
|
|
|
|
files: FileSelection,
|
|
|
|
|
|
|
|
service: FileServiceSelection,
|
|
|
|
|
|
|
|
) -> Result<()> {
|
|
|
|
|
|
|
|
self.post::<UndeleteFiles>(UndeleteFilesRequest {
|
|
|
|
|
|
|
|
file_selection: files,
|
|
|
|
|
|
|
|
service_selection: service,
|
|
|
|
|
|
|
|
})
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
@ -127,8 +147,15 @@ impl Client {
|
|
|
|
|
|
|
|
|
|
|
|
/// Moves files from the inbox into the archive
|
|
|
|
/// Moves files from the inbox into the archive
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
pub async fn archive_files(&self, hashes: Vec<String>) -> Result<()> {
|
|
|
|
pub async fn archive_files(
|
|
|
|
self.post::<ArchiveFiles>(ArchiveFilesRequest { hashes })
|
|
|
|
&self,
|
|
|
|
|
|
|
|
files: FileSelection,
|
|
|
|
|
|
|
|
service: FileServiceSelection,
|
|
|
|
|
|
|
|
) -> Result<()> {
|
|
|
|
|
|
|
|
self.post::<ArchiveFiles>(ArchiveFilesRequest {
|
|
|
|
|
|
|
|
file_selection: files,
|
|
|
|
|
|
|
|
service_selection: service,
|
|
|
|
|
|
|
|
})
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
@ -136,8 +163,15 @@ impl Client {
|
|
|
|
|
|
|
|
|
|
|
|
/// Moves files from the archive into the inbox
|
|
|
|
/// Moves files from the archive into the inbox
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
#[tracing::instrument(skip(self), level = "debug")]
|
|
|
|
pub async fn unarchive_files(&self, hashes: Vec<String>) -> Result<()> {
|
|
|
|
pub async fn unarchive_files(
|
|
|
|
self.post::<UnarchiveFiles>(UnarchiveFilesRequest { hashes })
|
|
|
|
&self,
|
|
|
|
|
|
|
|
files: FileSelection,
|
|
|
|
|
|
|
|
service: FileServiceSelection,
|
|
|
|
|
|
|
|
) -> Result<()> {
|
|
|
|
|
|
|
|
self.post::<UnarchiveFiles>(UnarchiveFilesRequest {
|
|
|
|
|
|
|
|
file_selection: files,
|
|
|
|
|
|
|
|
service_selection: service,
|
|
|
|
|
|
|
|
})
|
|
|
|
.await?;
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|