API Reference IResultStatus - ulfbou/Zentient.Results GitHub Wiki
๐ API Reference: interface โ Zentient.Results.IResultStatus
Namespace:
Zentient.ResultsAssembly:Zentient.Results.dllAvailable since:v0.1.0
๐ Summary
Defines a transport-agnostic semantic status abstraction, representing the intended meaning of a result outcome via a numeric Code and a human-readable Description.
Enables mapping result semantics across protocols (e.g., HTTP 400, gRPC Code 3) without binding core logic to any specific transport layer. Central to observability, adapter interoperability, and consistent client behavior.
๐ Type Signature
public interface IResultStatus
๐ก Design Philosophy / Rationale
IResultStatus encapsulates a lightweight, protocol-neutral model for communicating result semantics across layers and systems.
Key Principles:
- ๐งญ Semantic Clarity: Communicates what the outcome means, not just whether it succeeded or failed.
- ๐ฆ Protocol Neutrality: Abstracts status semantics without assuming HTTP, gRPC, or messaging conventions.
- ๐ Mappable to Transport: Can be safely translated to HTTP codes, gRPC statuses, NACKs, etc.
- ๐ Observability Integration: Used in structured logging, telemetry, and problem diagnostics.
๐ฆ Members
| Property | Type | Description |
|---|---|---|
Code |
int |
Integer identifier for the result status (e.g., 200, 400, 409, etc.). |
Description |
string |
Human-readable semantic label (e.g., "OK", "Not Found", "Conflict"). |
๐งช Usage Example
IResult result = userService.DeleteUser(userId);
if (result.Status.Code == 404)
{
Console.WriteLine($"Not Found: {result.Status.Description}");
}
โ ๏ธ Remarks
-
IResultStatusdoes not impose transport-specific meaning but is frequently mapped to:- HTTP status codes (e.g., 400, 404, 409)
- gRPC status codes (e.g.,
InvalidArgument,NotFound) - Messaging outcomes (e.g., NACKs, retries, dead-letter)
-
Common usage includes:
- Adapter surface layers (
HttpResultStatus,GrpcResultStatus) IResultStatusMapperfor dynamic protocol translation- ProblemDetails generation and observability correlation
- Adapter surface layers (
๐ Implementations
| Type | Description |
|---|---|
HttpResultStatus |
Predefined status constants for HTTP mappings. |
GrpcResultStatus |
gRPC-compatible status abstraction with trailer support. |
InMemoryResultStatus |
Lightweight status used for testing and in-memory pipelines. |
๐งฉ Integration and Interoperability
| Layer | Role |
|---|---|
| Result Binding | Used as the Status property in IResult and IResult<T>. |
| Adapters | Consumed by result mappers in Zentient.Endpoints (Http, Grpc, Messaging). |
| Telemetry | Captured and enriched via ITelemetryObserver and span tagging. |
| CQRS / Services | Facilitates standardization of domain outcomes for UI and external clients. |
๐ See Also
๐ท๏ธ Tags
#API #ResultStatus #SemanticOutcome #TransportNeutral #ErrorMapping #Observability #ZentientCore