ApiResponse\<T>¶
ApiResponse<T> is the generic response-envelope DTO used to represent a single API call's results: it carries the server/version identity of the responding service, the resolved HttpStatusCode, and a typed array of result items. It has no constructor logic beyond the implicit default and no methods — it is a pure data holder consumed by SAIF.Web.API.Clients's JsonHttpClient to deserialize and return API responses to callers.
Purpose¶
- Provide a uniform, generic shape for API responses so that any consumer of a SAIF Web API can deserialize results of any type
Tthrough one envelope type, rather than a bespoke response class per endpoint. - Carry the responding server's identity (
Server,Version) and the resolvedHttpStatusCodealongside the typedResultsarray, so callers have both the payload and its transport-level status available together.
Context¶
- Namespace:
SAIF.API.Responses - Assembly/package:
SAIF.Web.API.Core(bundled into theSAIF.Web.API.ClientsNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
Server |
string Server { get; set; } |
Identifies the server that produced the response. |
Version |
string Version { get; set; } |
Identifies the API/service version that produced the response. |
StatusCode |
HttpStatusCode StatusCode { get; set; } |
Carries the resolved HTTP status code associated with this response. |
Results |
T[] Results { get; set; } |
Holds the typed array of result items returned by the API call. |
Behavioral notes¶
- This type has no constructor logic beyond the implicit parameterless default, and no methods — every member is a plain settable property populated by the caller (e.g., during deserialization).
JsonHttpClient.GetApiResponse<T>(inSAIF.Web.API.Clients) is an observed caller: it constructsnew ApiResponse<T>()and explicitly populatesResults,Server,StatusCode, andVersionfrom the deserialized JSON response before returning the instance to its own callers (GetResponse<T>,PostJson<T>,PutJson<T>,PatchJson<T>,DeleteJson<T>).
Constraints and usage notes¶
Resultsis a plain array (T[]), not a collection interface — callers should not assume list-mutation semantics.
Sources¶
src/SAIF.Web.API.Core/ApiResponse.cssrc/SAIF.Web.API.Clients/JsonHttpClient.cs