Skip to content

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

  1. Results = GetContentArray<T>(jsonResponse.Content, DateTimeZoneHandling) (BR-CLI-012).
  2. 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 named Server-Name, else null (BR-CLI-014). - The header-name match is case-sensitive ordinal (x.Name == "Server-Name"). 3. StatusCode = the transport status. - Copied verbatim, including 0 for transport failures when EnsureSuccessfulResponse is false. 4. Version = jsonResponse.Version. - Always null, because GetJsonResponse never populates it.

Process flow

flowchart TD
    Start(["GetApiResponse&lt;T&gt;<br>called"]) --> Results["Results =<br>GetContentArray&lt;T&gt;"]
    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&lt;T&gt;"])

Failure and edge-case behavior

  • ApiResponse<T>.Version is always null.
  • ApiResponse<T>.Server is null whenever the response does not include a Server-Name header, or when the header name's casing differs from the expected literal.

Sources

  • src/SAIF.Web.API.Clients/JsonHttpClient.cs