BlogDoFT.Libs.Api
10.1.1
dotnet add package BlogDoFT.Libs.Api --version 10.1.1
NuGet\Install-Package BlogDoFT.Libs.Api -Version 10.1.1
<PackageReference Include="BlogDoFT.Libs.Api" Version="10.1.1" />
<PackageVersion Include="BlogDoFT.Libs.Api" Version="10.1.1" />
<PackageReference Include="BlogDoFT.Libs.Api" />
paket add BlogDoFT.Libs.Api --version 10.1.1
#r "nuget: BlogDoFT.Libs.Api, 10.1.1"
#:package BlogDoFT.Libs.Api@10.1.1
#addin nuget:?package=BlogDoFT.Libs.Api&version=10.1.1
#tool nuget:?package=BlogDoFT.Libs.Api&version=10.1.1
BlogDoFT.Libs.Api
Lightweight helpers and conventions for building HTTP APIs. This library contains small helpers and extension patterns used across BlogDoFT Web API projects.
This README describes common integration patterns rather than a complete API reference. See the repository for implementation details.
Common patterns
- Mapping domain
Result<T>to HTTP responses
// Example service method
public Result<UserDto> GetUser(Guid id) { ... }
// In controller action
var result = userService.GetUser(id);
if (result.IsFailure)
return result.Failure.Code switch
{
"NOT_FOUND" => Results.NotFound(new { code = result.Failure.Code, message = result.Failure.Message }),
_ => Results.BadRequest(new { code = result.Failure.Code, message = result.Failure.Message })
};
return Results.Ok(result.Value);
- Mapping
DomainNotificationBagto HTTP responses
if (notificationBag.HasNotifications)
{
var errors = notificationBag.Notifications
.Select(n => new { code = n.Code, message = n.Message });
return Results.BadRequest(new { errors });
}
- Middleware wiring suggestions
- Add a small middleware or filter that converts
Result/DomainNotificationBagto HTTP responses centrally to avoid repetitive controller code. - When returning validation-like problems, prefer 400/422 with a stable problem payload:
{ "errors": [{"code":"...","message":"..."}] }.
Examples and recommended payloads
{
"errors": [
{ "code": "INVALID_EMAIL", "message": "Email is invalid" }
]
}
Notes
- This project is intentionally small — prefer to keep API-layer concerns (presentation, HTTP mapping) decoupled from domain logic. Use
BlogDoFT.Libs.ResultPatternandBlogDoFT.Libs.DomainNotificationsto standardize domain results and notifications.
Versioning
Starting with v10.0.0, this library's version numbering follows the major version of the .NET runtime it targets. For example, this version is compatible with .NET 10, so the major version is 10 — this explains the jump from the previous 1.x version series.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Http (>= 2.3.13)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.1.1 | 139 | 9/24/2026 |
| 10.1.0 | 104 | 9/14/2026 |
| 10.0.1 | 101 | 9/14/2026 |
| 10.0.0 | 110 | 9/13/2026 |
| 1.14.0 | 109 | 9/13/2026 |
| 1.13.0 | 106 | 9/13/2026 |
| 1.12.0 | 123 | 8/27/2026 |
| 1.11.0 | 111 | 8/27/2026 |
| 1.10.0 | 368 | 11/16/2025 |
| 1.9.0 | 262 | 11/5/2025 |
| 1.8.0 | 262 | 11/3/2025 |
| 1.7.0 | 256 | 11/3/2025 |
| 1.6.3 | 234 | 10/21/2025 |
| 1.6.0 | 229 | 10/21/2025 |
| 1.5.0 | 243 | 10/8/2025 |