# dub1401/avitoapi architecture

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

- Interactive diagram: https://gitdiagram.com/dub1401/avitoapi
- Repository: https://github.com/dub1401/avitoapi

## Overview

AvitoAPI is a Python client library for selected Avito account and short-term-rental APIs. A caller creates a Profile with account credentials; it obtains and refreshes an access token, then exposes API modules that make authenticated requests and return typed account or booking data. Short-term-rental capabilities include base settings, availability dates, booking retrieval, and period pricing. The README lists many other planned API areas, but they are not implemented in the supplied source tree. Edges reflect shown calls and documented behavior; no storage subsystem is present.

Main entry points: [`src/AvitoAPI/Profile.py`](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py) (Profile client), [`src/AvitoAPI/Modules.py`](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Modules.py) (Account information), [`src/AvitoAPI/Types/ShortTermRent.py`](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/ShortTermRent.py) (Rental request data), [`src/AvitoAPI/Types/Info.py`](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/Info.py) (Balance model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client and authentication"]
  node_profile["Profile client<br/>[Profile.py]"]
  node_token["Token lifecycle<br/>[Profile.py]"]
  node_transport["Authenticated transport<br/>[Profile.py]"]
end

subgraph group_api["API capabilities"]
  node_account["Account information<br/>[Modules.py]"]
  node_rent["Short-term rental<br/>[Modules.py]"]
end

subgraph group_types["Request and response types"]
  node_balance["Balance model<br/>[Info.py]"]
  node_profileinfo["Profile info model<br/>[Info.py]"]
  node_booking["Booking model<br/>[ShortTermRent.py]"]
  node_rentinputs["Rental request data<br/>[ShortTermRent.py]"]
end

node_caller(("Library caller"))
node_avito{{"Avito API"}}

node_caller -->|"creates"| node_profile
node_profile -->|"obtains token"| node_token
node_profile -->|"exposes module"| node_account
node_profile -->|"exposes module"| node_rent
node_profile -->|"provides requests"| node_transport
node_token -->|"requests token"| node_avito
node_token -->|"refreshes periodically"| node_transport
node_transport -->|"sends authenticated calls"| node_avito
node_account -->|"makes account calls"| node_transport
node_rent -->|"makes rental calls"| node_transport
node_account -->|"builds balance"| node_balance
node_account -->|"builds profile data"| node_profileinfo
node_rent -->|"builds booking list"| node_booking
node_caller -->|"configures rental data"| node_rentinputs
node_rentinputs -->|"supplies settings"| node_rent

click node_profile "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py"
click node_token "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py"
click node_transport "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py"
click node_account "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Modules.py"
click node_rent "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Modules.py"
click node_balance "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/Info.py"
click node_profileinfo "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/Info.py"
click node_booking "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/ShortTermRent.py"
click node_rentinputs "https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/ShortTermRent.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_profile,node_token,node_transport toneBlue
class node_account,node_rent toneAmber
class node_balance,node_profileinfo,node_booking,node_rentinputs,node_avito toneMint
class node_caller toneIndigo
```

## Components

### Client and authentication

- [Profile client](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py): `src/AvitoAPI/Profile.py`
- [Token lifecycle](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py): `src/AvitoAPI/Profile.py`
- [Authenticated transport](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Profile.py): `src/AvitoAPI/Profile.py`

### API capabilities

- [Account information](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Modules.py): `src/AvitoAPI/Modules.py`
- [Short-term rental](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Modules.py): `src/AvitoAPI/Modules.py`

### Request and response types

- [Balance model](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/Info.py): `src/AvitoAPI/Types/Info.py`
- [Profile info model](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/Info.py): `src/AvitoAPI/Types/Info.py`
- [Booking model](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/ShortTermRent.py): `src/AvitoAPI/Types/ShortTermRent.py`
- [Rental request data](https://github.com/dub1401/avitoapi/blob/main/src/AvitoAPI/Types/ShortTermRent.py): `src/AvitoAPI/Types/ShortTermRent.py`

### Other components

- **Library caller**
- **Avito API**

## Connections

- Library caller → Profile client: creates (evidence: `README.md`)
- Profile client → Token lifecycle: obtains token (evidence: `src/AvitoAPI/Profile.py`)
- Profile client → Account information: exposes module (evidence: `src/AvitoAPI/Profile.py`)
- Profile client → Short-term rental: exposes module (evidence: `src/AvitoAPI/Profile.py`)
- Profile client → Authenticated transport: provides requests (evidence: `src/AvitoAPI/Profile.py`)
- Token lifecycle → Avito API: requests token (evidence: `src/AvitoAPI/Profile.py`)
- Token lifecycle → Authenticated transport: refreshes periodically (evidence: `src/AvitoAPI/Profile.py`)
- Authenticated transport → Avito API: sends authenticated calls (evidence: `src/AvitoAPI/Profile.py`)
- Account information → Authenticated transport: makes account calls (evidence: `src/AvitoAPI/Modules.py`)
- Short-term rental → Authenticated transport: makes rental calls (evidence: `src/AvitoAPI/Modules.py`)
- Account information → Balance model: builds balance (evidence: `src/AvitoAPI/Modules.py`)
- Account information → Profile info model: builds profile data (evidence: `src/AvitoAPI/Modules.py`)
- Short-term rental → Booking model: builds booking list (evidence: `src/AvitoAPI/Modules.py`)
- Library caller → Rental request data: configures rental data (evidence: `README.md`)
- Rental request data → Short-term rental: supplies settings (evidence: `src/AvitoAPI/Modules.py`)
