using System.IO; namespace BotSharp.Abstraction.Files; public interface IFileStorageService { #region Common string GetDirectory(string conversationId); byte[] GetFileBytes(string fileStorageUrl); bool SaveFileStreamToPath(string filePath, Stream stream); bool SaveFileBytesToPath(string filePath, byte[] bytes); string GetParentDir(string dir, int level = 1); bool ExistDirectory(string? dir); void CreateDirectory(string dir); void DeleteDirectory(string dir); string BuildDirectory(params string[] segments); #endregion #region Conversation /// /// Get the message file screenshots for specific content types, e.g., pdf /// /// /// /// Task> GetMessageFileScreenshots(string conversationId, IEnumerable messageIds); /// /// Get the files that have been uploaded in the chat. No screenshot images are included. /// /// /// /// /// /// IEnumerable GetMessageFiles(string conversationId, IEnumerable messageIds, string source, IEnumerable? contentTypes = null); string GetMessageFile(string conversationId, string messageId, string source, string index, string fileName); IEnumerable GetMessagesWithFile(string conversationId, IEnumerable messageIds); bool SaveMessageFiles(string conversationId, string messageId, string source, List files); /// /// Delete files under messages /// /// Conversation Id /// Files in these messages will be deleted /// The starting message to delete /// If not null, delete messages while input a new message; otherwise, delete messages only /// bool DeleteMessageFiles(string conversationId, IEnumerable messageIds, string targetMessageId, string? newMessageId = null); bool DeleteConversationFiles(IEnumerable conversationIds); #endregion #region User string GetUserAvatar(); bool SaveUserAvatar(BotSharpFile file); #endregion #region Speech Task SaveSpeechFileAsync(string conversationId, string fileName, BinaryData data); Task RetrieveSpeechFileAsync(string conversationId, string fileName); #endregion }