# sengolda/aio-swapi architecture

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

- Interactive diagram: https://gitdiagram.com/sengolda/aio-swapi
- Repository: https://github.com/sengolda/aio-swapi

## Overview

aio-swapi is a small async Python wrapper for the Star Wars API. A caller uses Client to fetch individual resources, enumerate paginated collections, or search cached collections; Client turns responses into typed resource objects. Resource objects can then resolve related API URLs into other objects. HTTPClient owns network requests and response decoding. The README documents context-manager and explicit-close usage. Edges reflect the sampled code and README; no unsampled subsystem connections are assumed.

Main entry points: [`aioswapi/http.py`](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/http.py) (HTTP client), [`aioswapi/client.py`](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/client.py) (Client), [`aioswapi/objects.py`](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/objects.py) (Resource objects), [`aioswapi/utils.py`](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/utils.py) (Response decoding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Client API"]
  node_client["Client<br/>[client.py]"]
end

subgraph group_resources["Resources"]
  node_objects["Resource objects<br/>[objects.py]"]
end

subgraph group_transport["HTTP transport"]
  node_http["HTTP client<br/>[http.py]"]
  node_decode["Response decoding<br/>[utils.py]"]
end

node_caller(("Library caller"))
node_swapi["SWAPI"]

node_caller -->|"uses"| node_client
node_client -->|"requests data"| node_http
node_client -->|"creates resources"| node_objects
node_http -->|"sends requests"| node_swapi
node_http -->|"decodes responses"| node_decode
node_objects -->|"fetches relations"| node_http

click node_client "https://github.com/sengolda/aio-swapi/blob/master/aioswapi/client.py"
click node_objects "https://github.com/sengolda/aio-swapi/blob/master/aioswapi/objects.py"
click node_http "https://github.com/sengolda/aio-swapi/blob/master/aioswapi/http.py"
click node_decode "https://github.com/sengolda/aio-swapi/blob/master/aioswapi/utils.py"

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_client toneBlue
class node_objects toneAmber
class node_http,node_decode,node_swapi toneMint
class node_caller toneIndigo
```

## Components

### Client API

- [Client](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/client.py): `aioswapi/client.py`

### Resources

- [Resource objects](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/objects.py): `aioswapi/objects.py`

### HTTP transport

- [HTTP client](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/http.py): `aioswapi/http.py`
- [Response decoding](https://github.com/sengolda/aio-swapi/blob/master/aioswapi/utils.py): `aioswapi/utils.py`

### Other components

- **Library caller**
- **SWAPI**

## Connections

- Library caller → Client: uses (evidence: `README.md`)
- Client → HTTP client: requests data (evidence: `aioswapi/client.py`)
- Client → Resource objects: creates resources (evidence: `aioswapi/client.py`)
- HTTP client → SWAPI: sends requests (evidence: `aioswapi/http.py`)
- HTTP client → Response decoding: decodes responses (evidence: `aioswapi/http.py`)
- Resource objects → HTTP client: fetches relations (evidence: `aioswapi/objects.py`)
