ResultsKit.Http
1.0.2
dotnet add package ResultsKit.Http --version 1.0.2
NuGet\Install-Package ResultsKit.Http -Version 1.0.2
<PackageReference Include="ResultsKit.Http" Version="1.0.2" />
<PackageVersion Include="ResultsKit.Http" Version="1.0.2" />
<PackageReference Include="ResultsKit.Http" />
paket add ResultsKit.Http --version 1.0.2
#r "nuget: ResultsKit.Http, 1.0.2"
#:package ResultsKit.Http@1.0.2
#addin nuget:?package=ResultsKit.Http&version=1.0.2
#tool nuget:?package=ResultsKit.Http&version=1.0.2
ResultsKit
ResultsKit provides a simple result pattern for application code.
ResultsKit.Http maps those results to ASP.NET Core HTTP responses.
ResultsKit
Use Result when an operation only needs success or failure.
using ResultsKit;
public class UserService
{
public Result DeleteUser(int id)
{
var exists = id > 0;
if (!exists)
{
return new NotFoundError("user", id);
}
return Result.Ok();
}
}
Use Result<T> when an operation returns data on success.
using ResultsKit;
public class UserService
{
public Result<UserDto> GetUser(int id)
{
if (id <= 0)
{
return new ValidationError(["A valid user id is required."]);
}
if (id == 404)
{
return new NotFoundError("user", id);
}
return new UserDto(id, "Alex");
}
}
public record UserDto(int Id, string Name);
Available error types:
Error(code, message)for a custom failureNotFoundError(resource, reference)when a resource does not existConflictError(resource, reference, conflictingReference)when a request conflicts with an existing resourceUnauthorizedError(action)when the caller is not allowed to perform an actionValidationError(messages)when validation fails
You can also create results explicitly:
using ResultsKit;
var success = Result.Ok();
var successWithValue = Result.OkResult(new UserDto(1, "Alex"));
var failure = Result.Fail(new Error("user_disabled", "The user is disabled."));
var partial = Result.Partial(new Error("warning", "The operation completed with warnings."));
ResultsKit.Http
Use ResultsKit.Http.Process to translate a Result or Result<T> into an HTTP response.
Minimal APIs
using ResultsKit.Http;
app.MapGet("/users/{id:int}", (int id, UserService service) =>
{
var result = service.GetUser(id);
return Process.ApiResult(result);
});
ApiResult(...) returns:
200 OKfor successful results400 Bad Requestfor generic and validation failures401 UnauthorizedforUnauthorizedError404 Not FoundforNotFoundError409 ConflictforConflictError
Error responses are returned as problem details payloads with neutral extension fields such as resource, reference, conflictingReference, messages, and action.
MVC / Controllers
using Microsoft.AspNetCore.Mvc;
using ResultsKit.Http;
[ApiController]
[Route("users")]
public class UsersController : ControllerBase
{
[HttpGet("{id:int}")]
public ActionResult<UserDto> Get(int id, [FromServices] UserService service)
{
var result = service.GetUser(id);
return Process.MvcResult(result);
}
}
MvcResult(...) applies the same status-code mapping and returns ASP.NET Core ActionResult / ActionResult<T> values.
Typical Pattern
Keep business logic in your service layer and return Result or Result<T> there.
using ResultsKit;
public class OrderService
{
public Result<OrderDto> CreateOrder(CreateOrderRequest request)
{
if (string.IsNullOrWhiteSpace(request.CustomerCode))
{
return new ValidationError(["Customer code is required."]);
}
if (request.CustomerCode == "blocked")
{
return new UnauthorizedError("create-order");
}
return new OrderDto(123, request.CustomerCode);
}
}
public record CreateOrderRequest(string CustomerCode);
public record OrderDto(int Id, string CustomerCode);
Then translate that result at the API boundary with Process.ApiResult(...) or Process.MvcResult(...).
| 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
- ResultsKit (>= 1.0.2)
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 |
|---|---|---|
| 1.0.2 | 111 | 3/29/2026 |