How respawnsive/apizr works
Main Building Blocks and External Dependencies
a. API Interface Layer – at the top layer, the user defines their API contracts (using attributes like [Get], [Post], etc.). These interfaces will later be implemented dynamically via Refit.
b. Apizr Manager / Facade – the central piece that clients interact with. It exposes methods (e.g., ExecuteAsync) to process API calls.
c. Core Handlers – chained components that process the API request. This chain includes:
• Caching Handlers (with integrations for Akavache, MonkeyCache, or MS Extensions Caching)
• Resilience / Retry Handler – built using Polly (and optionally Microsoft Resilience) that provides retries, circuit breakers, and other error handling mechanisms.
• Logging Handler – that logs http traffic (via Microsoft.Extensions.Logging) and traces requests.
• Connectivity Handler – optionally checking the network connectivity before executing the API call.
• Mapping Handler – which uses tools like AutoMapper or Mapster to map data transfer objects to domain models and vice versa.
• (Optionally) Additional handlers for file transfers or priority management (using Fusillade, MediatR, etc.)
d. Apizr Builder – the “static” or “extended” registration components that configure and compose the above pieces either via static builder methods or by using the DI container extension (AddApizrManagerFor<T>, etc.).
e. External Libraries – key dependencies such as Refit, Polly, Microsoft.Extensions.Logging, and other integration packages.
Relationships & Flow
• The consumer calls the Apizr Manager.
• The manager (configured via ApizrBuilder) processes the call: first the request goes through the resilience pipeline which applies retry/cancellation/error handling policies.
• Next, the caching handler determines whether to serve a cached result or fetch a new one.
• Concurrently, logging and connectivity handlers are engaged, wrapping the actual HTTP call.
• The actual HTTP request is dispatched via the Refit-generated implementation.
• On response receipt, the mapping handler may perform any necessary transformations, and the result is returned back up the chain.
– Use annotations to show how the DI container (IServiceCollection) registers and composes the various integration pieces.
Details
– Make sure key patterns such as “decorator” or “chain-of-responsibility” are highlighted in the design.
– Explicitly annotate integration points (logging, caching, resilience) with the names of external packages (Polly, Akavache, MediatR, Fusillade, etc.).