Releases: payload-code/payload-python
v0.5.1
Release v0.5.1
🎉 Major Features
Query Builder Methods
This release adds Django-inspired query builder methods for more intuitive data retrieval.
Order results:
# Single field (ascending)
payments = Payment.order_by('created_at').all()
# Multiple fields with descending (use 'desc()')
payments = Payment.order_by('dect(created_at)', 'amount').all()Limit and offset:
# Limit results
payments = Payment.limit(10).all()
# Offset (skip) results
payments = Payment.offset(20).all()
# Chain them together
payments = (Payment
.filter_by(status='paid')
.order_by('dect(created_at)')
.limit(10)
.offset(20)
.all())Python Slice Syntax for Pagination
Use familiar Python slice syntax for pagination:
# Get items 10-20
results = Payment.filter_by(status='paid')[10:20]
# Get first 20 items
results = Payment.filter_by(status='paid')[:20]
# Get everything after item 10
results = Payment.filter_by(status='paid')[10:]
# Get all items (equivalent to .all())
results = Payment.filter_by(status='paid')[:]Slice behavior:
[10:20]→ offset=10, limit=10[:20]→ offset=None, limit=20 (first 20 items)[10:]→ offset=10, limit=None (from item 10 onwards)[:]→ offset=None, limit=None (all items)[0:10]→ offset=None, limit=10 (treats 0 as "from beginning")
Direct Iteration Support
Iterate directly over query results:
# Iterate directly over request
for payment in Payment.filter_by(status='paid').limit(10):
print(payment.id)
# List comprehension support
ids = [p.id for p in Payment.filter_by(status='paid')]Dot Notation for Nested Objects
Access nested JSON fields using dot notation:
txn = pl.Transaction.get('txn_3w8Z....')
txn.sender.method # Access nested fields via dot notation✨ New Features
Filter Combination with OR Operator
# Combine filters with | operator
filter1 = Attr.status == 'active'
filter2 = Attr.status == 'pending'
combined = filter1 | filter2 # status=active|pending
Payment.filter_by(combined).all()Star Operator in Select
# Expand all fields from an object
pl.Transaction.select(*p.Transaction, pl.attr.invoice_allocations)New API V2 Objects
WebhookLog- Webhook event logsInvoiceAttachment- Invoice attachments
🐛 Bug Fixes
- Fixed
Filter.__or__()to return properEqualinstance instead of baseFilter - Fixed endpoint paths for
EntityandProcessingSettingsto handle pluralization correctly - Fixed all pre-existing broken tests due to
response.textvsresponse.json()changes
🔧 Improvements
- Comprehensive test coverage: Added 219 unit tests (100% passing) covering:
- Attribute filtering and operators
- Object wrapper functionality
- Request builder methods (order_by, limit, offset, slice syntax)
- Iteration support
- DotDict functionality
- Better code organization: Improved PEP 8 compliance and code formatting throughout
- Enhanced API: Methods are chainable for fluent query building
- Better error handling: Proper validation for edge cases (e.g., negative slice indices)
🔄 Breaking Changes
None - this release is fully backward compatible. All new features are additive.
📦 Dependencies
- Updated
pdm.lockwith latest dependency resolutions
Full Changelog: v0.5.0...v0.5.1
v0.5.0
Release v0.5.0
🎉 Major Features
Payload API V2 Support
This release adds full support for Payload API V2, allowing you to specify which API version to use when making requests.
Configure API version globally:
import payload as pl
pl.api_key = 'secret_key_3bW9JMZtPVDOfFNzwRdfE'
pl.api_version = 'v2' # Use API v2Or per-session:
import payload
pl = payload.Session(
'secret_key_3bW9JMZtPVDOfFNzwRdfE',
api_version='v2'
)✨ New API V2 Objects
The following new object types are now available (introduced in API v2):
Profile- User profilesIntent- Payment intentsEntity- Business entitiesTransfer- Fund transfersProcessingAgreement- Processing agreementsStakeholder- Entity stakeholdersBillingItem- Billing line itemsInvoiceItem- Invoice line itemsPaymentAllocation- Payment allocationsTransactionOperation- Transaction operationsCheckFront/CheckBack- Check imagesProcessingSettings- Processing configuration
See the Payload API Documentation for details on using these objects.
🔧 Improvements
- Enhanced exports: All objects, exceptions, and functions are now explicitly exported from the main
payloadmodule with proper__all__definition - Better test organization: Tests are now organized into
tests/int/(integration tests) andtests/unit/(unit tests) - Improved test data generation: Added Faker library for generating realistic test data (e.g., card expiration dates)
- Comprehensive unit tests: Added extensive unit tests for API version header functionality across all HTTP methods (GET, POST, PUT, DELETE)
- Code formatting: Improved code consistency with standardized string quotes and formatting throughout the codebase
📚 Documentation
- Updated README with API versioning examples
- Improved testing documentation with separate commands for unit and integration tests
- Fixed heading hierarchy in installation section
🔄 Breaking Changes
None - this release is fully backward compatible. If you don't specify an api_version, the SDK will continue to work with your current API version.
📦 Dependencies
- Added
fakerto development dependencies for test data generation
PRs
- Upgrade SDK to support Payload API V2 by @ianhalpern in #18
Full Changelog
v0.4.11
What's Changed
- Add importlib.metadata backport by @ianhalpern in #17
Full Changelog: v0.4.10...v0.4.11
v0.4.10
v0.4.9
What's Changed
- add client key by @bkhattak in #12
- add oauth token by @NathanYearout in #13
New Contributors
- @NathanYearout made their first contribution in #13
Full Changelog: v0.4.6...v0.4.9
v0.4.7
What's Changed
- Added
pl.ClientToken. See the new documentation on temporary client token authentication - Added
pylint,black, andprecommitfor local development
Full Changelog: v0.4.6...v0.4.7
v0.4.6
- added unit tests for request class
- migrated from pipenv to pdm for local dev
- fixed typos in error messages