Add typed Pydantic models for positions and document payments, enhance EasybillClient with pagination and retry handling, and implement unit tests for workflow helpers.

This commit is contained in:
claudi 2026-04-17 11:13:33 +02:00
parent b324671286
commit 57d6a49986
6 changed files with 375 additions and 5 deletions

View file

@ -9,6 +9,8 @@ The initial implementation is in place and includes:
- a project scaffold with packaging and tests
- sync and async wrapper clients
- authentication helpers for bearer and basic auth
- typed Pydantic facades for customers, documents, positions, and document payments
- pagination helpers and basic retry handling for HTTP 429 rate limits
- a webhook parser for JSON and form payloads
- a reproducible generation script based on the provided Swagger specification
@ -26,6 +28,20 @@ Generate the raw clients from the API description:
python scripts/generate_client.py --mode both
```
## Usage
```python
from easybill_client import EasybillClient
with EasybillClient(api_key="YOUR_API_TOKEN", max_retries=2, retry_backoff=1.0) as client:
customer_page = client.list_customers(limit=50)
position = client.get_position(5)
payment = client.create_document_payment(document_id=10, amount=1999, reference="INV-10")
for customer in client.iter_all_customers(limit=100):
print(customer.id, customer.company_name)
```
## Structure
- `src/easybill_client`: public package and middleware-friendly helpers