Improved Network Handling and Added New Method sendRequest
Description
This PR introduces significant improvements to the Vexana package, focusing on enhancing network handling and ensuring backward compatibility. The key changes include:
1. New Method sendRequest
Reason: The current send method, while functional, lacks the flexibility and robustness needed for more complex HTTP requests and responses.
Introduced a new method sendRequest to provide a more robust and flexible way to send HTTP requests and handle responses. This method supports various HTTP methods, progress handling, cancellation, and caching.
The sendRequest method aims to replace the older send method, offering enhanced functionality and cleaner code.
2. Deprecation of send Method
Reason: To ensure backward compatibility while encouraging users to migrate to the new and improved method.
The send method has been marked as deprecated to encourage users to migrate to the new sendRequest method.
The send method is still available for backward compatibility but will be removed in future versions.
3. NetworkResult Improvements
Reason: Enhance error handling and reduce unnecessary null checks, making the codebase cleaner and more maintainable.
Changed INetworkModel from an abstract to a sealed class to facilitate pattern matching and reduce unnecessary null checks.
Introduced NetworkSuccessResult and NetworkErrorResult to encapsulate success and error responses, respectively.
Added utility methods for better handling of network responses.
4. Additional Methods
Reason: Provide utility methods to streamline response handling and error management, improving overall code quality and maintainability.
Added helper methods like fetchSuccessResponse, fetchErrorResponse, handleErrorResponse, and loadFromCache to streamline response handling and error management.
5. Documentation
Reason: Ensure that users have clear guidance on how to use the new and modified methods.
Updated documentation for all new and modified methods, providing clear guidance on their usage and parameters.
6. Unit Tests
Reason: Ensure code reliability and functionality by thoroughly testing new and modified methods.
Added comprehensive unit tests for all new methods and significant changes, ensuring code reliability and functionality.
Changes
Added sendRequest method.
Deprecated send method with clear documentation.
Refactored INetworkModel to a sealed class.
Implemented NetworkSuccessResult and NetworkErrorResult.
Added utility methods for response and error handling.
Updated and added new unit tests.
Testing
Comprehensive unit tests have been written and passed for all new and modified methods.
Verified backward compatibility with existing code using the deprecated send method.
Migration Guide
Users are encouraged to start using the sendRequest method. The send method is deprecated but still available for use. It will be removed in future versions, so migrating to sendRequest is recommended.
Closing
These changes aim to enhance the functionality and maintainability of the Vexana package. Feedback and suggestions are welcome to further improve the package.
Improved Network Handling and Added New Method
sendRequest
Description
This PR introduces significant improvements to the Vexana package, focusing on enhancing network handling and ensuring backward compatibility. The key changes include:
1. New Method
sendRequest
Reason: The current
send
method, while functional, lacks the flexibility and robustness needed for more complex HTTP requests and responses.sendRequest
to provide a more robust and flexible way to send HTTP requests and handle responses. This method supports various HTTP methods, progress handling, cancellation, and caching.sendRequest
method aims to replace the oldersend
method, offering enhanced functionality and cleaner code.2. Deprecation of
send
MethodReason: To ensure backward compatibility while encouraging users to migrate to the new and improved method.
send
method has been marked as deprecated to encourage users to migrate to the newsendRequest
method.send
method is still available for backward compatibility but will be removed in future versions.3. NetworkResult Improvements
Reason: Enhance error handling and reduce unnecessary null checks, making the codebase cleaner and more maintainable.
INetworkModel
from an abstract to a sealed class to facilitate pattern matching and reduce unnecessary null checks.NetworkSuccessResult
andNetworkErrorResult
to encapsulate success and error responses, respectively.4. Additional Methods
Reason: Provide utility methods to streamline response handling and error management, improving overall code quality and maintainability.
fetchSuccessResponse
,fetchErrorResponse
,handleErrorResponse
, andloadFromCache
to streamline response handling and error management.5. Documentation
Reason: Ensure that users have clear guidance on how to use the new and modified methods.
6. Unit Tests
Reason: Ensure code reliability and functionality by thoroughly testing new and modified methods.
Changes
sendRequest
method.send
method with clear documentation.INetworkModel
to a sealed class.NetworkSuccessResult
andNetworkErrorResult
.Testing
send
method.Migration Guide
Users are encouraged to start using the
sendRequest
method. Thesend
method is deprecated but still available for use. It will be removed in future versions, so migrating tosendRequest
is recommended.Closing
These changes aim to enhance the functionality and maintainability of the Vexana package. Feedback and suggestions are welcome to further improve the package.
Thank you for considering this PR!