Skip to content

Commit

Permalink
refactor: change to complex objects instead of raw dictionaries
Browse files Browse the repository at this point in the history
This commit introduces a significant architectural change in how we handle API responses.
Instead of working with raw dictionaries, we now use proper model classes (Charge,
CardToken, Refund, etc.) to represent API resources.

Key changes:
- Created new models.py file with proper data classes for all API resources
- Updated client methods to return typed objects instead of dictionaries
- Modified examples to demonstrate usage with new object-oriented approach
- Updated tests to work with new model classes
- Added type hints throughout the codebase

This change brings several benefits:
1. Better type safety and IDE support
2. More intuitive API with proper object methods
3. Easier validation and data manipulation
4. Improved code maintainability
5. Better documentation through type hints

The change is backwards compatible as the model classes can still be accessed as
dictionaries through their attributes.

Signed-off-by: Avelino <[email protected]>
  • Loading branch information
avelino committed Jan 8, 2025
1 parent 17a1e7c commit a8d43a6
Show file tree
Hide file tree
Showing 7 changed files with 497 additions and 639 deletions.
1 change: 1 addition & 0 deletions barte/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .client import BarteClient
from .models import Charge, CardToken, Refund, InstallmentOptions, PixCharge, Customer, InstallmentSimulation

__version__ = "0.1.0"
Loading

0 comments on commit a8d43a6

Please sign in to comment.