GetApiResponse¶
GetApiResponse<T> converts the internal transport-level JsonResponse into the public SAIF.Web.API.Core ApiResponse<T> envelope that consumers actually receive.
| Field | Value |
|---|---|
| Operation ID | OP-06 |
| Trigger | GetResponse\<T> step 2; PostJson/PutJson/PatchJson/DeleteJson step 2. |
| Inputs | Internal JsonResponse. |
| Outputs | ApiResponse<T>. |
| Primary components | JsonHttpClient.GetApiResponse<T>(JsonResponse) (private) |
| Entry point | src/SAIF.Web.API.Clients/JsonHttpClient.cs |
Steps¶
Results = GetContentArray<T>(jsonResponse.Content, DateTimeZoneHandling)(BR-CLI-012).- Embedded logic: normalize the JSON payload (array, object, or scalar) into
T[].
Origin: This step is implemented in GetContentArray\<T> (
SAIF.Web.API.Clients) and executed on behalf of this operation. 2.Server= value of the first response header namedServer-Name, elsenull(BR-CLI-014). - The header-name match is case-sensitive ordinal (x.Name == "Server-Name"). 3.StatusCode= the transport status. - Copied verbatim, including0for transport failures whenEnsureSuccessfulResponseisfalse. 4.Version=jsonResponse.Version. - Alwaysnull, becauseGetJsonResponsenever populates it.
Process flow¶
flowchart TD
Start(["GetApiResponse<T><br>called"]) --> Results["Results =<br>GetContentArray<T>"]
Results --> Server["Server = Server-Name<br>header, else null"]
Server --> Status["StatusCode = transport<br>status"]
Status --> Version["Version =<br>jsonResponse.Version,<br>always null"]
Version --> EndOk(["Return<br>ApiResponse<T>"])
Failure and edge-case behavior¶
ApiResponse<T>.Versionis alwaysnull.ApiResponse<T>.Serverisnullwhenever the response does not include aServer-Nameheader, or when the header name's casing differs from the expected literal.
Related documentation¶
Sources¶
src/SAIF.Web.API.Clients/JsonHttpClient.cs