### Folder Item Retrieval Extension Methods (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IFolder Provides extension methods for retrieving files, folders, and general items within an IFolder. Includes methods for getting specific items or all items. ```csharp public static class FolderExtensions { public static Task GetFileAsync(this IFolder folder, string name); public static Task> GetFilesAsync(this IFolder folder); public static Task GetFolderAsync(this IFolder folder, string name); public static Task> GetFoldersAsync(this IFolder folder); public static Task GetItemAsync(this IFolder folder, string name); public static Task> GetItemsAsync(this IFolder folder); public static Task TryGetItemAsync(this IFolder folder, string name); } ``` -------------------------------- ### Get Items Asynchronously from Folder Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously retrieves all storage items (files and folders) from a specified folder. It returns a task that completes with a read-only list of IStorageItem objects. ```csharp Task> GetItemsAsync(IFolder folder) ``` -------------------------------- ### Folder Parent and Rename Extension Methods (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IFolder Provides extension methods for getting the parent folder of an IFolder and for renaming an IFolder. Supports name collision options for renaming. ```csharp public static class FolderExtensions { public static Task GetParentAsync(this IFolder folder); public static Task RenameAsync(this IFolder folder, string newName); public static Task RenameAsync(this IFolder folder, string newName, NameCollisionOption collisionOption); } ``` -------------------------------- ### Get Parent Folder Asynchronously (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously retrieves the parent folder of a given file. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task GetParentAsync(this IFile file) ``` -------------------------------- ### Define IFileOpenPicker Interface (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Pickers.IFileOpenPicker Defines the contract for a file open picker, specifying properties for commit button text, file type filtering, suggested start location, and view mode, along with asynchronous methods for picking single or multiple files. ```csharp public interface IFileOpenPicker { string CommitButtonText { get; set; } IList FileTypeFilter { get; } PickerLocationId SuggestedStartLocation { get; set; } PickerViewMode ViewMode { get; set; } Task> PickMultipleFilesAsync(); Task PickSingleFileAsync(); } ``` -------------------------------- ### Get File Size Asynchronously (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IFile Asynchronously retrieves the size of the file in bytes. This method is part of the IFile interface and returns a Task containing the file size. ```csharp Task GetSizeAsync() ``` -------------------------------- ### Try Get Item Asynchronously by Name Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously attempts to retrieve a storage item from a specified folder by its name. It returns a task that completes with the storage item if found, or null if not found, without throwing an exception. ```csharp Task TryGetItemAsync(IFolder folder, string name) ``` -------------------------------- ### Get Path Property (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IStorageItem Retrieves the full file system path of the storage item. This string property provides the complete, absolute path to the file or folder. ```csharp string Path { get; } ``` -------------------------------- ### Get Folders Asynchronously from Parent Folder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves all subfolders within a specified parent folder. The result is a Task that resolves to a read-only list of IFolder objects. This extension method operates on IFolder instances. ```csharp public static Task> GetFoldersAsync(this IFolder folder) ``` -------------------------------- ### Get Folder Asynchronously from Parent Folder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves a subfolder from a parent folder by its name. The method returns a Task that, when completed, provides an IFolder object representing the requested subfolder. This is an extension method for the IFolder interface. ```csharp public static Task GetFolderAsync(this IFolder folder, string name) ``` -------------------------------- ### Get Files Asynchronously from Folder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves all files contained within a specified folder. The operation returns a Task that resolves to a read-only list of IFile objects. This is an extension method applicable to IFolder instances. ```csharp public static Task> GetFilesAsync(this IFolder folder) ``` -------------------------------- ### Define IFileSavePicker Interface Contract (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Pickers.IFileSavePicker Defines the contract for a file save picker, allowing users to select a location and name for saving a file. It includes properties for commit button text, file type choices, suggested file name, suggested file, and suggested start location, along with an asynchronous method to initiate the save file picking process. ```csharp public interface IFileSavePicker { string CommitButtonText { get; set; } IDictionary> FileTypeChoices { get; } string SuggestedFileName { get; set; } IFile SuggestedSaveFile { get; set; } PickerLocationId SuggestedStartLocation { get; set; } Task PickSaveFileAsync(); } ``` -------------------------------- ### CyclotronLogger ModuleName Property (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Logging.CyclotronLogger Gets the name of the module associated with this logger instance. This property is read-only and is typically set during logger initialization. ```csharp public string ModuleName { get; } ``` -------------------------------- ### Initialize FileSystemProvider with Services (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Initializes the FileSystemProvider with necessary WinUI file system services. It validates the presence of required services in the provided IServiceCollection and builds the internal service provider. Throws InvalidOperationException if required services are missing. ```csharp public static void Initialize(IServiceCollection services) ``` -------------------------------- ### Initialize(IServiceCollection) Method Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Initializes the FileSystemProvider with the required WinUI file system services. ```APIDOC ## POST /FileSystemProvider/Initialize ### Description Initializes the FileSystemProvider with the required WinUI file system services. This method validates that all necessary services are registered and builds the internal service provider. ### Method POST ### Endpoint /FileSystemProvider/Initialize ### Parameters #### Request Body - **services** (IServiceCollection) - Required - The service collection to initialize. If null, a new ServiceCollection is created. ### Request Example ```csharp var services = new ServiceCollection(); // Add required file system services here... FileSystemProvider.Initialize(services); ``` ### Response #### Success Response (200) - **Status** (string) - Indicates successful initialization. #### Error Response (400) - **Error** (string) - Description of the error if required services are missing. #### Response Example ```json { "Status": "Initialized successfully" } ``` ``` -------------------------------- ### Get Parent Folder Asynchronously Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously retrieves the parent folder of a given folder. The operation returns a task that completes with the parent IFolder object. ```csharp Task GetParentAsync(IFolder folder) ``` -------------------------------- ### Folder Creation Extension Methods (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IFolder Provides extension methods for creating files and folders within an IFolder. Supports specifying creation collision options. ```csharp public static class FolderExtensions { public static Task CreateFileAsync(this IFolder folder, string name); public static Task CreateFileAsync(this IFolder folder, string name, CreationCollisionOption collisionOption); public static Task CreateFolderAsync(this IFolder folder, string name); public static Task CreateFolderAsync(this IFolder folder, string name, CreationCollisionOption collisionOption); } ``` -------------------------------- ### PickerLocationId Enum Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.PickerLocationId The PickerLocationId enum specifies the location for the picker's suggested start directory. It includes predefined locations like Documents, Desktop, Downloads, and more. ```APIDOC ## Enum PickerLocationId ### Description Specifies the location for the picker's suggested start directory. ### Namespace Cyclotron.FileSystemAdapter.Abstractions.Models ### Assembly Cyclotron.FileSystemAdapter.dll ### Fields - **DocumentsLibrary** (int) - `0` - The Documents library. - **ComputerFolder** (int) - `1` - The Computer folder (shows all drives). - **Desktop** (int) - `2` - The Desktop folder. - **Downloads** (int) - `3` - The Downloads folder. - **HomeGroup** (int) - `4` - The HomeGroup folder. - **MusicLibrary** (int) - `5` - The Music library. - **PicturesLibrary** (int) - `6` - The Pictures library. - **VideosLibrary** (int) - `7` - The Videos library. - **Objects3D** (int) - `8` - The 3D Objects folder. - **Unspecified** (int) - `9` - An unspecified location. ``` -------------------------------- ### FolderExtensions - AsIFolder Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.WinUI.FolderExtensions Converts a StorageFolder to an IFolder instance. ```APIDOC ## AsIFolder(StorageFolder) ### Description Converts a StorageFolder to an IFolder instance. ### Method GET ### Endpoint /websites/cyclotron-docs_kumarakrishnan_me/FolderExtensions/AsIFolder ### Parameters #### Path Parameters - **storageFolder** (StorageFolder) - Required - The StorageFolder to convert. ### Response #### Success Response (200) - **IFolder** (IFolder) - An IFolder instance wrapping the storage folder. #### Response Example { "example": "IFolder instance" } ``` -------------------------------- ### UsecaseRequest Constructor Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseRequest Initializes a new instance of the UsecaseRequest class with the specified request type, user ID, and an optional cancellation token. This constructor is protected, indicating it's intended for use within derived classes. ```csharp protected UsecaseRequest(RequestType requestType, string userId, CancellationToken cancellationToken = default) ``` -------------------------------- ### Get ModuleName Property Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Logging.ICyclotronLogger Retrieves the module name associated with the current logger instance. This property is part of the ICyclotronLogger interface and helps in categorizing log entries by their originating module. ```csharp string ModuleName { get; } ``` -------------------------------- ### CreateFileAsync(IFolder, string) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously creates a file in the specified folder with a desired name. ```APIDOC ## POST /folders/{folderId}/files ### Description Asynchronously creates a file in the specified folder with a desired name. ### Method POST ### Endpoint /folders/{folderId}/files ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder in which to create the file. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new file. ### Request Body (Not applicable for this endpoint, parameters are in query) ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "File created successfully" } ``` ``` -------------------------------- ### Get Name Property (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IStorageItem Retrieves the name of the storage item. This string property represents the actual name of the file or folder as it appears in the file system. ```csharp string Name { get; } ``` -------------------------------- ### CreateFileAsync(IFolder, string, CreationCollisionOption) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously creates a file in the specified folder with a desired name and a collision option. ```APIDOC ## POST /folders/{folderId}/files/with-options ### Description Asynchronously creates a file in the specified folder with a desired name and a collision option. ### Method POST ### Endpoint /folders/{folderId}/files/with-options ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder in which to create the file. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new file. - **options** (CreationCollisionOption) - Required - The collision option if a file with the same name already exists. ### Request Body (Not applicable for this endpoint, parameters are in query) ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "File created successfully with collision option" } ``` ``` -------------------------------- ### UsecaseBase Constructor (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseBase-2 Initializes a new instance of the UsecaseBase class. This protected constructor takes a request object and a callback handler, setting up the necessary components for use case execution. ```csharp protected UsecaseBase(TRequest request, ICallback callback) ``` -------------------------------- ### FileSystemProvider Singleton Instance Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Access the singleton instance of the FileSystemProvider to interact with file system services. ```APIDOC ## GET /FileSystemProvider/Instance ### Description Gets the singleton instance of the FileSystemProvider. This instance provides access to registered file and folder handlers, as well as picker services. ### Method GET ### Endpoint /FileSystemProvider/Instance ### Parameters None ### Request Example None ### Response #### Success Response (200) - **Instance** (FileSystemProvider) - The singleton instance of FileSystemProvider. #### Response Example ```json { "Instance": "" } ``` ``` -------------------------------- ### Convert StorageFile to IFile (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.WinUI.FileExtensions This method extends the StorageFile class to provide a convenient way to convert a WinUI StorageFile object into an IFile instance. It takes a StorageFile as input and returns an IFile that wraps the original storage file. ```csharp public static class FileExtensions { public static IFile AsIFile(this StorageFile storageFile) { // Implementation details to convert StorageFile to IFile throw new NotImplementedException(); } } ``` -------------------------------- ### Define PickerLocationId Enum Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.PickerLocationId Defines the PickerLocationId enumeration, used to specify the location for a picker's suggested start directory. This enum includes fields representing common user folders and libraries. ```csharp public enum PickerLocationId__ { DocumentsLibrary = 0, ComputerFolder = 1, Desktop = 2, Downloads = 3, HomeGroup = 4, MusicLibrary = 5, PicturesLibrary = 6, VideosLibrary = 7, Objects3D = 8, Unspecified = 9 } ``` -------------------------------- ### FileExtensions.AsIFile Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.WinUI.FileExtensions Converts a StorageFile to an IFile instance, providing a convenient way to adapt WinUI's StorageFile to a more abstract IFile interface. ```APIDOC ## AsIFile(StorageFile) ### Description Converts a StorageFile to an IFile instance. ### Method GET ### Endpoint `/websites/cyclotron-docs_kumarakrishnan_me/FileExtensions/AsIFile` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "storageFile": "" } ``` ### Response #### Success Response (200) - **IFile** (IFile) - An IFile instance wrapping the storage file. #### Response Example ```json { "file": "" } ``` ``` -------------------------------- ### CreateFileAsync Method (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously creates a file in the specified folder with a desired name. Overloads exist to handle collision options. ```csharp Task CreateFileAsync(IFolder folder, string desiredName) ``` ```csharp Task CreateFileAsync(IFolder folder, string desiredName, CreationCollisionOption options) ``` -------------------------------- ### Get FolderRelativeId Property (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IStorageItem Retrieves the folder-relative ID of a storage item. This string property provides a unique identifier relative to the containing folder, useful for internal referencing and comparisons. ```csharp string FolderRelativeId { get; } ``` -------------------------------- ### CreateFolderAsync(IFolder, string) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously creates a subfolder in the specified folder with a desired name. ```APIDOC ## POST /folders/{folderId}/subfolders ### Description Asynchronously creates a subfolder in the specified folder with a desired name. ### Method POST ### Endpoint /folders/{folderId}/subfolders ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder in which to create the subfolder. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new subfolder. ### Request Body (Not applicable for this endpoint, parameters are in query) ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder created successfully" } ``` ``` -------------------------------- ### GetFilesAsync(IFolder) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves all files from the specified folder. ```APIDOC ## GET /folders/{folderId}/files ### Description Asynchronously retrieves all files from the specified folder. ### Method GET ### Endpoint /folders/{folderId}/files ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to search. ### Request Body (Not applicable for this endpoint) ### Response #### Success Response (200) - **files** (array[IFile]) - A read-only list of files in the folder. #### Response Example ```json { "files": [ { "name": "file1.txt", "size": 512, "lastModified": "2023-10-27T10:00:00Z" }, { "name": "file2.txt", "size": 1024, "lastModified": "2023-10-27T10:05:00Z" } ] } ``` ``` -------------------------------- ### Open File Asynchronously with Options (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously opens a file with the specified access mode and additional storage options. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task OpenAsync(this IFile file, FileAcessMode accessMode, StorageOpenOptions options) ``` -------------------------------- ### CreateFolderAsync(IFolder, string, CreationCollisionOption) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously creates a subfolder in the specified folder with a desired name and a collision option. ```APIDOC ## POST /folders/{folderId}/subfolders/with-options ### Description Asynchronously creates a subfolder in the specified folder with a desired name and a collision option. ### Method POST ### Endpoint /folders/{folderId}/subfolders/with-options ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder in which to create the subfolder. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new subfolder. - **options** (CreationCollisionOption) - Required - The collision option if a folder with the same name already exists. ### Request Body (Not applicable for this endpoint, parameters are in query) ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder created successfully with collision option" } ``` ``` -------------------------------- ### Declare FileSystemProvider Class (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Defines the FileSystemProvider class, which implements the singleton pattern for accessing file system services. This class is sealed and resides in the Cyclotron.FileSystemAdapter namespace. ```csharp public sealed class FileSystemProvider ``` -------------------------------- ### Get File Asynchronously from Folder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves a file from a specified folder by its name. This method returns a Task that, upon completion, yields an IFile object representing the found file. It's an extension method for the IFolder interface. ```csharp public static Task GetFileAsync(this IFolder folder, string name) ``` -------------------------------- ### Attempt to Serve from Cache (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseBase-2 Defines the virtual TryServeFromCache method, allowing derived classes to implement custom caching logic for local requests. If caching is successful, it prevents the ActionAsync method from being called. ```csharp protected virtual bool TryServeFromCache() ``` -------------------------------- ### Copy File Asynchronously with Options (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously copies a source file to a destination folder, allowing a new name and specifying how to handle name collisions. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task CopyAsync(this IFile sourceFile, IFolder destinationFolder, string desiredNewName, NameCollisionOption option) ``` -------------------------------- ### FileLoggingOptions Configuration Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Configuration.FileLoggingOptions This section details the properties for configuring file-based logging. These options allow fine-grained control over how logs are written to files, including size limits, retention, and minimum log levels. ```APIDOC ## FileLoggingOptions ### Description Configuration options for file-based logging. ### Properties - **BufferSize** (int) - Gets or sets the buffer size for async logging. - **Enabled** (bool) - Gets or sets whether file logging is enabled. - **FileSizeLimitBytes** (long) - Gets or sets the maximum file size in bytes before rolling. Default is 100MB. - **FlushInterval** (TimeSpan) - Gets or sets the flush interval for buffered logs. - **MinimumLevel** (LogLevel) - Gets or sets the minimum log level for file logging. Can be different from the global minimum level. - **Path** (string) - Gets or sets the log file path. Supports placeholders like {LocalAppData}. - **RetainedFileCountLimit** (int) - Gets or sets the number of log files to retain. - **RollOnFileSizeLimit** (bool) - Gets or sets whether to roll on file size limit. - **RollingInterval** (RollingInterval) - Gets or sets the rolling interval for log files. ``` -------------------------------- ### Open File Asynchronously with Access Mode and Storage Options Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFileHandler Asynchronously opens a file with the specified access mode and additional storage options. This method is part of the IFileHandler interface. ```csharp Task OpenAsync(IFile file, FileAcessMode accessMode, StorageOpenOptions options) ``` -------------------------------- ### Convert StorageFolder to IFolder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.WinUI.FolderExtensions Converts a StorageFolder object to an IFolder instance. This method is an extension method for StorageFolder and requires no additional dependencies beyond the Cyclotron.FileSystemAdapter.dll assembly. ```csharp public static IFolder AsIFolder(this StorageFolder storageFolder) { // Implementation details would go here throw new NotImplementedException(); } ``` -------------------------------- ### Retrieve Service by Type from FileSystemProvider (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Retrieves a service of a specified generic type T from the internal service provider. Returns an instance of the service if registered, otherwise returns null. ```csharp public T GetService() ``` -------------------------------- ### CyclotronLogger Constructor (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Logging.CyclotronLogger Initializes a new instance of the CyclotronLogger class. It requires options for telemetry configuration, a Serilog logger instance, and a Microsoft.Extensions.Logging logger instance. ```csharp public CyclotronLogger(IOptions options, ILogger serilogLogger, ILogger msLogger) ``` -------------------------------- ### CreateFolderAsync Method (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously creates a subfolder in the specified folder with a desired name. Overloads exist to handle collision options. ```csharp Task CreateFolderAsync(IFolder folder, string desiredName) ``` ```csharp Task CreateFolderAsync(IFolder folder, string desiredName, CreationCollisionOption options) ``` -------------------------------- ### Folder Handler API Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler This API provides methods for interacting with folders and files within the Cyclotron FileSystemAdapter. ```APIDOC ## CreateFileAsync(IFolder, string) ### Description Asynchronously creates a file in the specified folder with a desired name. ### Method POST ### Endpoint /folders/{folderId}/files ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder in which to create the file. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new file. ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "File created successfully" } ``` ``` ```APIDOC ## CreateFileAsync(IFolder, string, CreationCollisionOption) ### Description Asynchronously creates a file in the specified folder with a desired name and collision option. ### Method POST ### Endpoint /folders/{folderId}/files ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder in which to create the file. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new file. - **options** (CreationCollisionOption) - Required - The collision option to apply if a file with the same name already exists. ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "File created successfully with collision option" } ``` ``` ```APIDOC ## CreateFolderAsync(IFolder, string) ### Description Asynchronously creates a subfolder in the specified folder with a desired name. ### Method POST ### Endpoint /folders/{folderId}/folders ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder in which to create the subfolder. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new subfolder. ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder created successfully" } ``` ``` ```APIDOC ## CreateFolderAsync(IFolder, string, CreationCollisionOption) ### Description Asynchronously creates a subfolder in the specified folder with a desired name and collision option. ### Method POST ### Endpoint /folders/{folderId}/folders ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder in which to create the subfolder. #### Query Parameters - **desiredName** (string) - Required - The desired name for the new subfolder. - **options** (CreationCollisionOption) - Required - The collision option to apply if a folder with the same name already exists. ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder created successfully with collision option" } ``` ``` ```APIDOC ## DeleteAsync(IFolder) ### Description Asynchronously deletes a folder. ### Method DELETE ### Endpoint /folders/{folderId} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to delete. ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder deleted successfully" } ``` ``` ```APIDOC ## DeleteAsync(IFolder, StorageDeletionOption) ### Description Asynchronously deletes a folder with a deletion option. ### Method DELETE ### Endpoint /folders/{folderId} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to delete. #### Query Parameters - **option** (StorageDeletionOption) - Required - The deletion option (move to recycle bin or permanent delete). ### Request Body None ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder deleted successfully with option" } ``` ``` ```APIDOC ## GetFileAsync(IFolder) ### Description Asynchronously retrieves all files from the specified folder. ### Method GET ### Endpoint /folders/{folderId}/files ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to search. ### Request Body None ### Response #### Success Response (200) - **files** (array) - A list of files in the folder. - **fileName** (string) - The name of the file. - **fileId** (string) - The ID of the file. #### Response Example ```json { "files": [ { "fileName": "document.txt", "fileId": "file-123" } ] } ``` ``` ```APIDOC ## GetFileAsync(IFolder, string) ### Description Asynchronously retrieves a file from the specified folder by name. ### Method GET ### Endpoint /folders/{folderId}/files/{fileName} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to search. - **fileName** (string) - Required - The name of the file to retrieve. ### Request Body None ### Response #### Success Response (200) - **file** (object) - The retrieved file. - **fileName** (string) - The name of the file. - **fileId** (string) - The ID of the file. #### Response Example ```json { "file": { "fileName": "document.txt", "fileId": "file-123" } } ``` ``` ```APIDOC ## GetFolderAsync(IFolder, string) ### Description Asynchronously retrieves a subfolder from the specified folder by name. ### Method GET ### Endpoint /folders/{folderId}/folders/{subFolderName} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder to search. - **subFolderName** (string) - Required - The name of the subfolder to retrieve. ### Request Body None ### Response #### Success Response (200) - **folder** (object) - The retrieved subfolder. - **folderName** (string) - The name of the subfolder. - **folderId** (string) - The ID of the subfolder. #### Response Example ```json { "folder": { "folderName": "subfolder", "folderId": "folder-abc" } } ``` ``` ```APIDOC ## GetFolderFromPathAsync(string) ### Description Asynchronously retrieves a folder from the specified path. ### Method GET ### Endpoint /folders/path ### Parameters #### Query Parameters - **path** (string) - Required - The folder path. ### Request Body None ### Response #### Success Response (200) - **folder** (object) - The retrieved folder. - **folderName** (string) - The name of the folder. - **folderId** (string) - The ID of the folder. #### Response Example ```json { "folder": { "folderName": "root/documents", "folderId": "folder-xyz" } } ``` ``` ```APIDOC ## GetFoldersAsync(IFolder) ### Description Asynchronously retrieves all subfolders from the specified folder. ### Method GET ### Endpoint /folders/{folderId}/folders ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder to search. ### Request Body None ### Response #### Success Response (200) - **folders** (array) - A list of subfolders in the parent folder. - **folderName** (string) - The name of the subfolder. - **folderId** (string) - The ID of the subfolder. #### Response Example ```json { "folders": [ { "folderName": "subfolder1", "folderId": "folder-abc" }, { "folderName": "subfolder2", "folderId": "folder-def" } ] } ``` ``` ```APIDOC ## GetItemAsync(IFolder, string) ### Description Asynchronously retrieves a storage item (file or folder) from the specified folder by name. ### Method GET ### Endpoint /folders/{folderId}/items/{itemName} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to search. - **itemName** (string) - Required - The name of the item to retrieve. ### Request Body None ### Response #### Success Response (200) - **item** (object) - The retrieved storage item. - **itemName** (string) - The name of the item. - **itemId** (string) - The ID of the item. - **itemType** (string) - The type of the item (file or folder). #### Response Example ```json { "item": { "itemName": "document.txt", "itemId": "file-123", "itemType": "file" } } ``` ``` -------------------------------- ### GetFoldersAsync(IFolder) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves all subfolders from the specified parent folder. ```APIDOC ## GET /folders/{folderId}/subfolders ### Description Asynchronously retrieves all subfolders from the specified parent folder. ### Method GET ### Endpoint /folders/{folderId}/subfolders ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the parent folder to search. ### Request Body (Not applicable for this endpoint) ### Response #### Success Response (200) - **folders** (array[IFolder]) - A read-only list of subfolders in the parent folder. #### Response Example ```json { "folders": [ { "id": "subfolder-123", "name": "Documents" }, { "id": "subfolder-456", "name": "Images" } ] } ``` ``` -------------------------------- ### Access Singleton Instance of FileSystemProvider (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Provides access to the singleton instance of the FileSystemProvider. This static property ensures that only one instance of the provider is available throughout the application. ```csharp public static FileSystemProvider Instance { get; } ``` -------------------------------- ### Move File Asynchronously with Options (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously moves a file to a destination folder with a new name and handles potential name collisions. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task MoveAsync(this IFile sourceFile, IFolder destinationFolder, string desiredNewName, NameCollisionOption option) ``` -------------------------------- ### Folder Deletion Extension Methods (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IFolder Provides extension methods for deleting an IFolder. Supports specifying storage deletion options. ```csharp public static class FolderExtensions { public static Task DeleteAsync(this IFolder folder); public static Task DeleteAsync(this IFolder folder, StorageDeletionOption deletionOption); } ``` -------------------------------- ### Copy and Replace File Asynchronously (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously copies a source file and replaces the destination file. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task CopyAndReplaceAsync(this IFile sourceFile, IFile file) ``` -------------------------------- ### TryGetItemAsync Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously attempts to retrieve a storage item from the folder by name, returning null if not found. ```APIDOC ## GET /folders/{folderId}/items/try/{itemName} ### Description Asynchronously attempts to retrieve a storage item (file or folder) from the specified folder by its name. Returns null if the item is not found, instead of throwing an exception. ### Method GET ### Endpoint /folders/{folderId}/items/try/{itemName} ### Parameters #### Path Parameters - **folderId** (string) - Required - The identifier of the folder to search within. - **itemName** (string) - Required - The name of the item to retrieve. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **IStorageItem** (object) - The retrieved storage item (file or folder), or null if not found. #### Response Example ```json { "name": "config.json", "type": "file", "size": 512, "lastModified": "2023-10-27T10:10:00Z" } ``` Or if not found: ```json null ``` ``` -------------------------------- ### GetService() Method Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileSystemProvider Retrieves a service of a specified type from the service provider managed by FileSystemProvider. ```APIDOC ## GET /FileSystemProvider/GetService ### Description Retrieves a service of the specified type from the service provider. This method is generic and can be used to fetch any registered service. ### Method GET ### Endpoint /FileSystemProvider/GetService ### Parameters #### Type Parameters - **T** - The type of the service to retrieve. ### Request Example ```csharp var fileHandler = FileSystemProvider.Instance.GetService(); ``` ### Response #### Success Response (200) - **T** - An instance of the requested service type, or null if the service is not registered. #### Response Example ```json { "serviceInstance": "" } ``` ``` -------------------------------- ### GetItemsAsync Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves all storage items (files and folders) from the folder. ```APIDOC ## GET /folders/{folderId}/items ### Description Asynchronously retrieves all storage items (files and folders) contained within the specified folder. ### Method GET ### Endpoint /folders/{folderId}/items ### Parameters #### Path Parameters - **folderId** (string) - Required - The identifier of the folder whose items are to be retrieved. #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **IReadOnlyList** (array) - A read-only list of storage items (files and folders) within the folder. #### Response Example ```json [ { "name": "document.pdf", "type": "file", "size": 2048, "lastModified": "2023-10-27T10:05:00Z" }, { "name": "images", "type": "folder", "lastModified": "2023-10-27T09:55:00Z" } ] ``` ``` -------------------------------- ### GetFileAsync(IFolder, string) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously retrieves a file from the specified folder by name. ```APIDOC ## GET /folders/{folderId}/files/{fileName} ### Description Asynchronously retrieves a file from the specified folder by name. ### Method GET ### Endpoint /folders/{folderId}/files/{fileName} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to search. - **fileName** (string) - Required - The name of the file to retrieve. ### Request Body (Not applicable for this endpoint) ### Response #### Success Response (200) - **file** (IFile) - The retrieved file object. #### Response Example ```json { "file": { "name": "example.txt", "size": 1024, "lastModified": "2023-10-27T10:00:00Z" } } ``` ``` -------------------------------- ### Open File Asynchronously (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously opens a file with the specified access mode (read or read-write). This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task OpenAsync(this IFile file, FileAcessMode accessMode) ``` -------------------------------- ### GetFolderAsync Methods (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously retrieves subfolders from the specified folder. One overload retrieves all subfolders, while another retrieves a specific subfolder by name. ```csharp Task GetFolderAsync(IFolder folder, string name) ``` ```csharp Task> GetFoldersAsync(IFolder folder) ``` -------------------------------- ### Create Module-Scoped Logger with ForModule Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Logging.ICyclotronLogger Creates a child logger instance that is scoped to a specific module. This method takes a module name as input and returns a new ICyclotronLogger instance tagged with that module name, aiding in log organization. ```csharp ICyclotronLogger ForModule(string moduleName) ``` -------------------------------- ### Move and Replace File Asynchronously (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously moves a source file and replaces the destination file. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task MoveAndReplaceAsync(this IFile sourceFile, IFile fileToReplace) ``` -------------------------------- ### GetFileAsync Methods (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFolderHandler Asynchronously retrieves files from the specified folder. One overload retrieves all files, while another retrieves a specific file by name. ```csharp Task> GetFileAsync(IFolder folder) ``` ```csharp Task GetFileAsync(IFolder folder, string name) ``` -------------------------------- ### Move File Asynchronously to Folder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously moves a file to a specified destination folder. This method is part of the FileExtensions class and operates on IFile objects. ```csharp public static Task MoveAsync(this IFile sourceFile, IFolder destinationFolder) ``` -------------------------------- ### Asynchronously Rename File (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FileExtensions Asynchronously renames a file using the IFile interface. It accepts the desired new name and an option to handle name collisions if a file with the same name already exists. The method returns a Task representing the asynchronous operation. ```csharp public static Task RenameAsync(this IFile file, string desiredName, NameCollisionOption option) ``` -------------------------------- ### UsecaseRequest Class Definition Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseRequest Defines the abstract base class UsecaseRequest, which implements the IUsecaseRequest interface. It establishes the fundamental structure for requests within the system. ```csharp public abstract class UsecaseRequest : IUsecaseRequest__ ``` -------------------------------- ### IUsecaseResponse Interface Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.IUsecaseResponse Details the IUsecaseResponse interface, representing a response for a use case operation. ```APIDOC ## Interface IUsecaseResponse ### Description Represents a response for a use case operation. ### Namespace Cyclotron.Utilities.CleanArchitecture ### Assembly Cyclotron.Utilities.dll ### Properties #### Request Gets the request associated with this response. - **Type**: IUsecaseRequest #### ResponseType Gets the type of the response. - **Type**: ResponseType ``` -------------------------------- ### UsecaseRequest Properties Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseRequest Provides access to the CancellationToken, RequestType, and UserId associated with a UsecaseRequest instance. These properties are read-only after initialization. ```csharp public CancellationToken CancellationToken { get; } ``` ```csharp public RequestType RequestType { get; } ``` ```csharp public string UserId { get; } ``` -------------------------------- ### Implement Asynchronous Action (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseBase-2 Defines the abstract ActionAsync method, which must be overridden by derived classes to implement the core business logic of a use case. This method represents the asynchronous operation of the use case. ```csharp protected abstract Task ActionAsync() ``` -------------------------------- ### Configure Buffer Size for File Logging (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Configuration.FileLoggingOptions Sets the buffer size for asynchronous file logging operations. A larger buffer size can improve performance by reducing the frequency of disk writes, but may increase memory usage. ```csharp public int BufferSize { get; set; } ``` -------------------------------- ### Copy and Replace File Asynchronously Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Handlers.IFileHandler Asynchronously copies a source file and replaces the destination file. This method is part of the IFileHandler interface and requires IFile objects for source and destination. ```csharp Task CopyAndReplaceAsync(IFile sourceFile, IFile file) ``` -------------------------------- ### PickFolderAsync Method for IFolderPicker Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Pickers.IFolderPicker Asynchronously displays a dialog to pick a single folder using the IFolderPicker interface. Returns a Task representing the operation, with the result being the selected folder or null. ```csharp Task PickFolderAsync() ``` -------------------------------- ### Specify Log File Path (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Configuration.FileLoggingOptions Sets the directory and filename pattern for log files. Supports environment-specific placeholders like {LocalAppData}. ```csharp public string Path { get; set; } ``` -------------------------------- ### DeleteAsync(IFolder) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously deletes the specified folder. ```APIDOC ## DELETE /folders/{folderId} ### Description Asynchronously deletes the specified folder. ### Method DELETE ### Endpoint /folders/{folderId} ### Parameters #### Path Parameters - **folderId** (string) - Required - The ID of the folder to delete. ### Request Body (Not applicable for this endpoint) ### Response #### Success Response (200) - **status** (string) - Indicates the operation was successful. #### Response Example ```json { "status": "Folder deleted successfully" } ``` ``` -------------------------------- ### Define ICallback Interface (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.ICallback-1 Defines the generic ICallback interface for handling use case responses. It specifies methods for OnSuccess, OnFailed, OnCanceled, OnError, and OnProgress, with the response type R constrained to implement IUsecaseResponse. ```csharp public interface ICallback where R : IUsecaseResponse ``` -------------------------------- ### Create Folder Asynchronously in Folder (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.FolderExtensions Asynchronously creates a subfolder within a specified parent folder. This method supports handling existing folders with the same name through the CreationCollisionOption parameter. It is an extension method for the IFolder interface. ```csharp public static Task CreateFolderAsync(this IFolder folder, string desiredName) public static Task CreateFolderAsync(this IFolder folder, string desiredName, CreationCollisionOption options) ``` -------------------------------- ### Execute Use Case Operation (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Utilities.CleanArchitecture.UsecaseBase-2 Provides the public Execute method for initiating the use case operation. This method orchestrates the execution flow, including cache checks, asynchronous action execution, and exception handling. ```csharp public void Execute() ``` -------------------------------- ### CyclotronLogger BeginScope Method (C#) Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.Telemetry.Logging.CyclotronLogger Begins a logical operation scope for logging. This method delegates to the underlying Microsoft.Extensions.Logging ILogger implementation and returns an IDisposable that ends the scope when disposed. ```csharp public IDisposable? BeginScope(TState state) where TState : notnull ``` -------------------------------- ### IStorageItem Interface Properties Source: https://cyclotron-docs.kumarakrishnan.me/api/Cyclotron.FileSystemAdapter.Abstractions.Models.IStorageItem This section details the properties available on the IStorageItem interface, which represents base storage items like files and folders. ```APIDOC ## Interface IStorageItem ### Description Defines the base contract for storage items (files and folders) in the file system. ### Properties #### FolderRelativeId Gets the folder relative ID of the storage item. - **Type**: string - **Description**: A unique identifier relative to the containing folder, used for identification and comparison purposes across different API calls. #### Name Gets the name of the storage item. - **Type**: string - **Description**: The name of the file or folder. #### Path Gets the full path of the storage item. - **Type**: string - **Description**: The complete file system path. ```