MESK.ResponseEntity is a lightweight and generic response wrapper for .NET projects.
It provides a standardized way to return API responses with success/failure states, messages, validation errors, status codes, and optional data payloads.
- ✅ Generic type support → return any type as response
Data. - ✅ Factory methods →
Success,Failure,ValidationError. - ✅ Fluent API → e.g.
.WithValidationErrors(...),.WithMessage(...). - ✅ HttpStatusCode integration for consistent responses.
- ✅ System.Text.Json support →
[JsonConstructor]andToString()override. - ✅ Easy to unit test and integrate with Web APIs.
Add via NuGet:
dotnet add package MESK.ResponseEntity
var result = ResponseEntity<string>.Succeeded()
.WithData("Hello World!")
.WithMessage("Testing from MESK.ResponseEntity!");
var result = ResponseEntity<string>.Failure()
.WithValidationErrors(validationErrors);
Contributions are welcome! Please open issues or submit pull requests for bug fixes, new features, or improvements. Make sure to follow the existing code style and include relevant tests.
This project is licensed under the MIT License. See the LICENSE file for details.