# robertsklv/unityfetch architecture

> Architecture diagram of the GitHub repository robertsklv/unityfetch, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/robertsklv/unityfetch
- Repository: https://github.com/robertsklv/unityfetch

## Overview

UnityFetch is a UnityWebRequest wrapper for making HTTP requests, handling responses, and optionally organizing endpoints as service clients. The main workflow is a caller invoking the async or coroutine client API; the client configures and dispatches a request, selects payload and response handling, then returns a typed response. ServiceClient adds attribute-driven route and parameter mapping. The README also documents an editor request inspector; its runtime recording connection is not visible in the sampled excerpts, so that link is shown as unverified.

Main entry points: [`Runtime/UnityFetchClient.cs`](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchClient.cs) (HTTP Client), [`Runtime/UnityFetchRequestOptions.cs`](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchRequestOptions.cs) (Request Options), [`Runtime/ServiceClient.cs`](https://github.com/robertsklv/unityfetch/blob/main/Runtime/ServiceClient.cs) (Service Client), [`Editor/Scripts/NetworkSO.cs`](https://github.com/robertsklv/unityfetch/blob/main/Editor/Scripts/NetworkSO.cs) (Captured Requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Request APIs"]
  node_uf["Convenience API<br/>[UF.cs]"]
  node_client["HTTP Client"]
  node_coroutine["Coroutine Client"]
  node_wrapper["Coroutine Wrapper"]
end

subgraph group_dispatch["Request Dispatch"]
  node_options["Request Options"]
  node_context["Request Context<br/>[RequestContext.cs]"]
  node_abort["Abort Control<br/>[AbortController.cs]"]
end

subgraph group_handling["Payload And Responses"]
  node_strategies["Payload Strategies"]
  node_processors["Response Processors"]
  node_serializer["JSON Serializer<br/>[IJsonSerializer.cs]"]
  node_response["Typed Response"]
  node_response_handlers["Response Callbacks"]
end

subgraph group_service["Service Abstraction"]
  node_service_client["Service Client<br/>[ServiceClient.cs]"]
  node_action_attributes["Action Attributes<br/>[ActionAttribute.cs]"]
  node_request_method["HTTP Methods<br/>[RequestMethod.cs]"]
end

subgraph group_inspector["Editor Inspector"]
  node_inspector["Network Inspector"]
  node_network_state[("Captured Requests<br/>[NetworkSO.cs]")]
  node_inspector_settings["Inspector Settings"]
  node_request_info["Request Details"]
end

node_caller(("Unity Caller"))
node_transport["UnityWebRequest"]
node_http_service(("HTTP Service"))

node_caller -->|"invokes"| node_uf
node_caller -->|"invokes"| node_client
node_caller -->|"starts coroutine"| node_coroutine
node_uf -.->|"uses defaults"| node_client
node_service_client -->|"dispatches through"| node_client
node_service_client -->|"reads metadata"| node_action_attributes
node_service_client -->|"selects method"| node_request_method
node_client -->|"configures"| node_options
node_client -->|"builds"| node_context
node_client -->|"selects payload"| node_strategies
node_client -->|"selects processor"| node_processors
node_client -->|"dispatches request"| node_transport
node_transport -->|"sends HTTP"| node_http_service
node_options -->|"configures"| node_serializer
node_options -->|"accepts controller"| node_abort
node_client -->|"returns"| node_response
node_options -->|"stores callbacks"| node_response_handlers
node_client -->|"wraps coroutine"| node_wrapper
node_inspector -->|"reads requests"| node_network_state
node_inspector -->|"reads settings"| node_inspector_settings
node_network_state -->|"stores details"| node_request_info
node_client -.->|"records requests"| node_network_state

click node_uf "https://github.com/robertsklv/unityfetch/blob/main/Runtime/UF.cs"
click node_client "https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchClient.cs"
click node_coroutine "https://github.com/robertsklv/unityfetch/blob/main/Runtime/CoroutineRestClient.cs"
click node_wrapper "https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchCoroutineRequestWrapper.cs"
click node_options "https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchRequestOptions.cs"
click node_context "https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestContext.cs"
click node_abort "https://github.com/robertsklv/unityfetch/blob/main/Runtime/AbortController.cs"
click node_strategies "https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestStrategies/RequestStrategyFactory.cs"
click node_processors "https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestProcessing/RequestProcessorFactory.cs"
click node_serializer "https://github.com/robertsklv/unityfetch/blob/main/Runtime/IJsonSerializer.cs"
click node_response "https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchResponse.cs"
click node_response_handlers "https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchResponseHandler.cs"
click node_service_client "https://github.com/robertsklv/unityfetch/blob/main/Runtime/ServiceClient.cs"
click node_action_attributes "https://github.com/robertsklv/unityfetch/blob/main/Runtime/Attributes/ActionAttribute.cs"
click node_request_method "https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestMethod.cs"
click node_inspector "https://github.com/robertsklv/unityfetch/blob/main/Editor/NetworkInspectorWindow.cs"
click node_network_state "https://github.com/robertsklv/unityfetch/blob/main/Editor/Scripts/NetworkSO.cs"
click node_inspector_settings "https://github.com/robertsklv/unityfetch/blob/main/Editor/Scripts/NetworkInspectorSettingsSO.cs"
click node_request_info "https://github.com/robertsklv/unityfetch/blob/main/Runtime/Debugging/UnityFetchRequestInfo.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_uf,node_client,node_coroutine,node_wrapper toneBlue
class node_options,node_context,node_abort toneAmber
class node_strategies,node_processors,node_serializer,node_response,node_response_handlers,node_transport toneMint
class node_service_client,node_action_attributes,node_request_method toneRose
class node_inspector,node_network_state,node_inspector_settings,node_request_info,node_caller,node_http_service toneIndigo
```

## Components

### Request APIs

- [Convenience API](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UF.cs): `Runtime/UF.cs`
- [HTTP Client](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchClient.cs): `Runtime/UnityFetchClient.cs`
- [Coroutine Client](https://github.com/robertsklv/unityfetch/blob/main/Runtime/CoroutineRestClient.cs): `Runtime/CoroutineRestClient.cs`
- [Coroutine Wrapper](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchCoroutineRequestWrapper.cs): `Runtime/UnityFetchCoroutineRequestWrapper.cs`

### Request Dispatch

- [Request Options](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchRequestOptions.cs): `Runtime/UnityFetchRequestOptions.cs`
- [Request Context](https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestContext.cs): `Runtime/RequestContext.cs`
- [Abort Control](https://github.com/robertsklv/unityfetch/blob/main/Runtime/AbortController.cs): `Runtime/AbortController.cs`

### Payload And Responses

- [Payload Strategies](https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestStrategies/RequestStrategyFactory.cs): `Runtime/RequestStrategies/RequestStrategyFactory.cs`
- [Response Processors](https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestProcessing/RequestProcessorFactory.cs): `Runtime/RequestProcessing/RequestProcessorFactory.cs`
- [JSON Serializer](https://github.com/robertsklv/unityfetch/blob/main/Runtime/IJsonSerializer.cs): `Runtime/IJsonSerializer.cs`
- [Typed Response](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchResponse.cs): `Runtime/UnityFetchResponse.cs`
- [Response Callbacks](https://github.com/robertsklv/unityfetch/blob/main/Runtime/UnityFetchResponseHandler.cs): `Runtime/UnityFetchResponseHandler.cs`

### Service Abstraction

- [Service Client](https://github.com/robertsklv/unityfetch/blob/main/Runtime/ServiceClient.cs): `Runtime/ServiceClient.cs`
- [Action Attributes](https://github.com/robertsklv/unityfetch/blob/main/Runtime/Attributes/ActionAttribute.cs): `Runtime/Attributes/ActionAttribute.cs`
- [HTTP Methods](https://github.com/robertsklv/unityfetch/blob/main/Runtime/RequestMethod.cs): `Runtime/RequestMethod.cs`

### Editor Inspector

- [Network Inspector](https://github.com/robertsklv/unityfetch/blob/main/Editor/NetworkInspectorWindow.cs): `Editor/NetworkInspectorWindow.cs`
- [Captured Requests](https://github.com/robertsklv/unityfetch/blob/main/Editor/Scripts/NetworkSO.cs): `Editor/Scripts/NetworkSO.cs`
- [Inspector Settings](https://github.com/robertsklv/unityfetch/blob/main/Editor/Scripts/NetworkInspectorSettingsSO.cs): `Editor/Scripts/NetworkInspectorSettingsSO.cs`
- [Request Details](https://github.com/robertsklv/unityfetch/blob/main/Runtime/Debugging/UnityFetchRequestInfo.cs): `Runtime/Debugging/UnityFetchRequestInfo.cs`

### Other components

- **Unity Caller**
- **UnityWebRequest**
- **HTTP Service**

## Connections

- Unity Caller → Convenience API: invokes
- Unity Caller → HTTP Client: invokes
- Unity Caller → Coroutine Client: starts coroutine
- Convenience API → HTTP Client: uses defaults
- Service Client → HTTP Client: dispatches through (evidence: `Runtime/ServiceClient.cs`)
- Service Client → Action Attributes: reads metadata (evidence: `Runtime/ServiceClient.cs`)
- Service Client → HTTP Methods: selects method (evidence: `Runtime/ServiceClient.cs`)
- HTTP Client → Request Options: configures (evidence: `Runtime/UnityFetchClient.cs`)
- HTTP Client → Request Context: builds (evidence: `Runtime/UnityFetchClient.cs`)
- HTTP Client → Payload Strategies: selects payload (evidence: `Runtime/UnityFetchClient.cs`)
- HTTP Client → Response Processors: selects processor (evidence: `Runtime/UnityFetchClient.cs`)
- HTTP Client → UnityWebRequest: dispatches request (evidence: `Runtime/UnityFetchClient.cs`)
- UnityWebRequest → HTTP Service: sends HTTP
- Request Options → JSON Serializer: configures (evidence: `Runtime/UnityFetchRequestOptions.cs`)
- Request Options → Abort Control: accepts controller (evidence: `Runtime/UnityFetchRequestOptions.cs`)
- HTTP Client → Typed Response: returns (evidence: `Runtime/UnityFetchClient.cs`)
- Request Options → Response Callbacks: stores callbacks (evidence: `Runtime/UnityFetchRequestOptions.cs`)
- HTTP Client → Coroutine Wrapper: wraps coroutine (evidence: `Runtime/CoroutineRestClient.cs`)
- Network Inspector → Captured Requests: reads requests (evidence: `Editor/NetworkInspectorWindow.cs`)
- Network Inspector → Inspector Settings: reads settings (evidence: `Editor/NetworkInspectorWindow.cs`)
- Captured Requests → Request Details: stores details (evidence: `Editor/Scripts/NetworkSO.cs`)
- HTTP Client → Captured Requests: records requests
