API Reference IResultStatus - ulfbou/Zentient.Results GitHub Wiki

๐Ÿ“˜ API Reference: interface โ€“ Zentient.Results.IResultStatus

Namespace: Zentient.Results Assembly: Zentient.Results.dll Available 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

  • IResultStatus does 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)
    • IResultStatusMapper for dynamic protocol translation
    • ProblemDetails generation and observability correlation

๐Ÿ” 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