Add event handler support for file uploads and update dependencies#6
Merged
Merged
Conversation
- Introduced `IFtpServerEventHandler` to handle server events. - Updated `StorCommand` to invoke `OnFileUploadedAsync` on file upload. - Enhanced dependency injection to register event handlers. - Modified `README` and tests to include event handler configuration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new event handler system for the FTP server, allowing custom logic to be executed after file uploads. It adds the
IFtpServerEventHandlerinterface, updates the server and dependency injection infrastructure to support event handlers, and ensures handlers are called after successful file uploads. The changes are designed to be extensible and maintainable, and include updates to tests and documentation.Event Handler System:
IFtpServerEventHandlerinterface inFmiSrl.FtpServer.Server.Abstractions, allowing developers to define custom logic for FTP server events, such as file uploads.FtpCommandContextrecord to include an optionalEventHandlersproperty, which holds the registered event handlers.StorCommandto invoke all registered event handlers'OnFileUploadedAsyncmethods after a file is uploaded, with error logging for handler failures.Dependency Injection and Server Construction:
IFtpServerBuilderinterface and implementation to support registration of event handlers via the newAddEventHandler<TEventHandler>()method. [1] [2]FtpServerclass to accept and store event handlers, and to pass them into theFtpCommandContextduring command execution. [1] [2] [3]Documentation, Tests, and Miscellaneous:
FtpServer, which now requires event handlers as a parameter. [1] [2]global.json. [1] [2]