Skip to content

SAIF.Web.API.Clients.35 operations and processes

This page is the operation catalog and cross-operation hub for this library. Each operation's detailed, step-by-step logic lives in its own page under operations/. The library exposes one core workflow with seven public entry points; no database, message queue, or file-system operations exist in any path.

Operation catalog

Operation Intent Trigger Inputs Outputs Rules
Execute JSON API request and return typed envelope Issue a JSON HTTP request to a SAIF Web API and return the full response envelope, or throw a typed exception. Caller invokes GetResponse<T>, PostJson<T>, PutJson<T>, PatchJson<T>, or DeleteJson<T>. methodUriSegment, optional requestBody; instance state (_serviceBaseUri, _clientInfo, _authenticator, TimeoutOverride, SetOnBehalfOfUserHeaders, RetryOnStatusCodes, RetryDelayInMs, EnsureSuccessfulResponse, DateTimeZoneHandling). ApiResponse<T>, or a thrown SAIFException subtype. BR-01, BR-05, BR-06
Get single typed result Return one scalar/object value rather than a full envelope. Caller invokes GetResult<T> (or the GetResults<T> wrapper). methodUriSegment. T, or default(T). BR-11, BR-14, BR-15
Translate HTTP failure to typed exception Map an unsuccessful HTTP response to a typed SAIFException subtype. Step 9 of the request operation, when EnsureSuccessfulResponse is true; also callable directly as ToKnownError. IRestResponse. A thrown SAIFException subtype, or a normal return for 200–399. BR-16, BR-20
Serialize request body Serialize an outbound request body to JSON honoring configured serializer settings. RestSharp invokes AddJsonBody, which calls JsonSerializer.Serialize. Request body object. Indented JSON string. BR-07, BR-21

Process flow diagram

The following diagram visualizes the primary operational flow for a request/response cycle.

flowchart TD
    Start(["Caller invokes verb<br>method"]) --> Build["Build<br>RestClient/RestRequest +<br>identity headers"]
    Build --> Execute["Execute request via<br>RestSharp"]
    Execute --> Retry{"Retryable status and<br>retries remain?"}
    Retry -->|Yes| Sleep["Sleep RetryDelayInMs,<br>retry"]
    Sleep --> Execute
    Retry -->|No| Gate{"EnsureSuccessfulResponse<br>?"}
    Gate -->|Yes, status 200-399| Deserialize["Deserialize payload into<br>ApiResponse"]
    Gate -->|"Yes, status outside<br>200-399"| ThrowEx(["Throw typed<br>SAIFException"])
    Gate -->|No| Deserialize
    Deserialize --> EndOk(["Return ApiResponse/typed<br>result"])

Failure and edge-case behavior

  • An exception thrown while translating an HTTP failure (BR-06, BR-20) propagates to the caller; envelope construction is skipped.
  • Retry (BR-05) happens before the error gate, so retryable failures (502/503/401/transport-failure 0) are re-attempted up to 3 times before any exception is raised.
  • A cast failure on a complex GetResult<T> value returns default(T) (BR-15); an empty result array instead surfaces as IndexOutOfRangeException to the caller, since only InvalidCastException is caught.*
  • Deserialization failures for T = string return the exception message as the result instead of throwing (BR-09).

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

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