pub use self::{models::*, rooms::models::*};
use super::{client::errors::DracoonClientError, models::ListAllParams};
use async_trait::async_trait;
use tokio::io::{AsyncRead, AsyncWrite, BufReader};
pub mod download;
pub mod folders;
pub mod models;
pub mod nodes;
pub mod rooms;
pub mod upload;
#[async_trait]
pub trait Nodes {
async fn get_nodes(
&self,
parent_id: Option<u64>,
room_manager: Option<bool>,
params: Option<ListAllParams>,
) -> Result<NodeList, DracoonClientError>;
async fn get_node_from_path(&self, path: &str) -> Result<Option<Node>, DracoonClientError>;
async fn search_nodes(
&self,
search_string: &str,
parent_id: Option<u64>,
depth_level: Option<i8>,
params: Option<ListAllParams>,
) -> Result<NodeList, DracoonClientError>;
async fn get_node(&self, node_id: u64) -> Result<Node, DracoonClientError>;
async fn delete_node(&self, node_id: u64) -> Result<(), DracoonClientError>;
async fn delete_nodes(&self, req: DeleteNodesRequest) -> Result<(), DracoonClientError>;
async fn move_nodes(
&self,
req: TransferNodesRequest,
target_parent_id: u64,
) -> Result<Node, DracoonClientError>;
async fn copy_nodes(
&self,
req: TransferNodesRequest,
target_parent_id: u64,
) -> Result<Node, DracoonClientError>;
}
#[async_trait]
pub trait MissingFileKeys {
async fn distribute_missing_keys(
&self,
room_id: Option<u64>,
file_id: Option<u64>,
user_id: Option<u64>,
) -> Result<u64, DracoonClientError>;
}
#[async_trait]
pub trait Folders {
async fn create_folder(&self, req: CreateFolderRequest) -> Result<Node, DracoonClientError>;
async fn update_folder(
&self,
folder_id: u64,
req: UpdateFolderRequest,
) -> Result<Node, DracoonClientError>;
}
#[async_trait]
pub trait Rooms {
async fn create_room(
&self,
create_room_req: CreateRoomRequest,
) -> Result<Node, DracoonClientError>;
async fn update_room(
&self,
room_id: u64,
update_room_req: UpdateRoomRequest,
) -> Result<Node, DracoonClientError>;
async fn config_room(
&self,
room_id: u64,
config_room_req: ConfigRoomRequest,
) -> Result<Node, DracoonClientError>;
async fn get_room_policies(&self, room_id: u64) -> Result<RoomPolicies, DracoonClientError>;
async fn update_room_policies(
&self,
room_id: u64,
policy_room_req: RoomPoliciesRequest,
) -> Result<(), DracoonClientError>;
async fn encrypt_room(
&self,
room_id: u64,
encrypt_room_req: EncryptRoomRequest,
) -> Result<Node, DracoonClientError>;
async fn get_room_groups(
&self,
room_id: u64,
params: Option<ListAllParams>,
) -> Result<RoomGroupList, DracoonClientError>;
async fn update_room_groups(
&self,
room_id: u64,
room_groups_update_req: RoomGroupsAddBatchRequest,
) -> Result<(), DracoonClientError>;
async fn delete_room_groups(
&self,
room_id: u64,
room_groups_del_req: RoomGroupsDeleteBatchRequest,
) -> Result<(), DracoonClientError>;
async fn get_room_users(
&self,
room_id: u64,
params: Option<ListAllParams>,
) -> Result<RoomUserList, DracoonClientError>;
async fn update_room_users(
&self,
room_id: u64,
room_users_update_req: RoomUsersAddBatchRequest,
) -> Result<(), DracoonClientError>;
async fn delete_room_users(
&self,
room_id: u64,
room_users_del_req: RoomUsersDeleteBatchRequest,
) -> Result<(), DracoonClientError>;
async fn invite_guest_users(
&self,
room_id: u64,
invite_req: RoomGuestUserAddRequest,
) -> Result<(), DracoonClientError>;
}
#[async_trait]
pub trait Download {
async fn download<'w>(
&'w self,
node: &Node,
writer: &'w mut (dyn AsyncWrite + Send + Unpin),
mut callback: Option<DownloadProgressCallback>,
chunksize: Option<usize>,
) -> Result<(), DracoonClientError>;
}
#[async_trait]
pub trait Upload<R: AsyncRead> {
async fn upload<'r>(
&'r self,
parent_node: &Node,
upload_options: UploadOptions,
mut reader: BufReader<R>,
mut callback: Option<UploadProgressCallback>,
chunk_size: Option<usize>,
) -> Result<Node, DracoonClientError>;
}