use graph::{DriveEntry, DriveFolder, UploadDestination, UploadedFile}; use crate::engine::{Conversation, SyncEngine}; use crate::error::{Error, Result}; use crate::remote::Remote; impl SyncEngine { pub async fn channel_library_root(&self, channel_id: &str) -> Result { let Conversation::Channel { team_id } = self.resolve(channel_id).await? else { return Err(Error::Unsupported("a library for a chat")); }; self.remote.channel_files_root(&team_id, channel_id).await } pub async fn channel_tab_web_url( &self, channel_id: &str, tab_id: &str, ) -> Result> { let Conversation::Channel { team_id } = self.resolve(channel_id).await? else { return Err(Error::Unsupported("a tab link for a chat")); }; self.remote .channel_tab_web_url(&team_id, channel_id, tab_id) .await } pub async fn channel_member_count(&self, channel_id: &str) -> Result { let Conversation::Channel { team_id } = self.resolve(channel_id).await? else { return Err(Error::Unsupported("a member count for a chat")); }; self.remote.channel_member_count(&team_id, channel_id).await } pub async fn library_children(&self, folder: &DriveFolder) -> Result> { self.remote.list_children(folder).await } pub async fn create_library_folder( &self, parent: &DriveFolder, name: &str, ) -> Result { self.remote.create_folder(parent, name).await } pub async fn upload_to_library( &self, folder: &DriveFolder, file_name: &str, bytes: &[u8], progress: impl Fn(u8) + Send + Sync, ) -> Result { self.remote .upload_file( &UploadDestination::Folder(folder.clone()), file_name, bytes, &progress, ) .await } }