lago-python-client 1.43.0__tar.gz → 1.45.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/PKG-INFO +1 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/clients.py +25 -3
- lago_python_client-1.45.0/lago_python_client/customers/wallet_client.py +42 -0
- lago_python_client-1.45.0/lago_python_client/customers/wallets/alert_client.py +64 -0
- lago_python_client-1.45.0/lago_python_client/customers/wallets/metadata_client.py +74 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/wallets_client.py +1 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/mixins.py +176 -6
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/__init__.py +9 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/alert.py +7 -4
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/customer.py +2 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/error_detail.py +1 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/invoice.py +4 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/invoice_custom_section.py +17 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/payment.py +1 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/subscription.py +3 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/wallet.py +5 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/wallet_transaction.py +25 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/subscriptions/clients.py +43 -6
- lago_python_client-1.45.0/lago_python_client/version.py +1 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/wallets/clients.py +41 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client.egg-info/PKG-INFO +1 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client.egg-info/SOURCES.txt +14 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_client.py +28 -0
- lago_python_client-1.45.0/tests/test_customer_wallet_alert_client.py +279 -0
- lago_python_client-1.45.0/tests/test_customer_wallet_client.py +335 -0
- lago_python_client-1.45.0/tests/test_customer_wallet_metadata_client.py +72 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_invoice_client.py +21 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_payment_client.py +2 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_subscription_client.py +324 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_wallet_client.py +99 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_wallet_transaction_client.py +99 -1
- lago_python_client-1.45.0/tests/utils/__init__.py +0 -0
- lago_python_client-1.43.0/lago_python_client/version.py +0 -1
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/LICENSE +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/README.md +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/activity_logs/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/activity_logs/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/add_ons/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/add_ons/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/api_logs/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/api_logs/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/base_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/base_model.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/billable_metrics/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/billable_metrics/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/billing_entities/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/billing_entities/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/coupons/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/coupons/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/credit_notes/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/credit_notes/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/applied_coupons_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/credit_notes_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/invoices_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/payment_methods_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/payment_requests_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/payments_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/subscriptions_client.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/events → lago_python_client-1.45.0/lago_python_client/customers/wallets}/__init__.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/fees → lago_python_client-1.45.0/lago_python_client/events}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/events/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/exceptions.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/gross_revenues → lago_python_client-1.45.0/lago_python_client/fees}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/fees/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/functools_ext.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/invoice_collections → lago_python_client-1.45.0/lago_python_client/gross_revenues}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/gross_revenues/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/invoiced_usages → lago_python_client-1.45.0/lago_python_client/invoice_collections}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/invoice_collections/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/invoices → lago_python_client-1.45.0/lago_python_client/invoiced_usages}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/invoiced_usages/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/mrrs → lago_python_client-1.45.0/lago_python_client/invoices}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/invoices/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/activity_log.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/add_on.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/api_log.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/applied_coupon.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/billable_metric.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/billing_entity.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/billing_period.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/charge.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/coupon.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/credit.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/credit_note.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/customer_projected_usage.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/customer_usage.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/event.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/fee.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/fixed_charge.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/gross_revenue.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/invoice_collection.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/invoice_item.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/invoiced_usage.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/lifetime_usage.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/minimum_commitment.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/mrr.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/organization.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/overdue_balance.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/payment_method.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/payment_receipt.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/payment_request.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/plan.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/tax.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/usage.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/usage_threshold.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/webhook_endpoint.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/organizations → lago_python_client-1.45.0/lago_python_client/mrrs}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/mrrs/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/overdue_balances → lago_python_client-1.45.0/lago_python_client/organizations}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/organizations/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/payment_receipts → lago_python_client-1.45.0/lago_python_client/overdue_balances}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/overdue_balances/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/payment_requests → lago_python_client-1.45.0/lago_python_client/payment_receipts}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/payment_receipts/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/payments → lago_python_client-1.45.0/lago_python_client/payment_requests}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/payment_requests/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/plans → lago_python_client-1.45.0/lago_python_client/payments}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/payments/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/services → lago_python_client-1.45.0/lago_python_client/plans}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/plans/charges_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/plans/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/plans/fixed_charges_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/py.typed +0 -0
- {lago_python_client-1.43.0/lago_python_client/subscriptions → lago_python_client-1.45.0/lago_python_client/services}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/services/json.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/services/request.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/services/response.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/taxes → lago_python_client-1.45.0/lago_python_client/subscriptions}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/subscriptions/charges_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/subscriptions/fixed_charges_client.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/usages → lago_python_client-1.45.0/lago_python_client/taxes}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/taxes/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/wallets → lago_python_client-1.45.0/lago_python_client/usages}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/usages/clients.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/webhook_endpoints → lago_python_client-1.45.0/lago_python_client/wallets}/__init__.py +0 -0
- {lago_python_client-1.43.0/lago_python_client/webhooks → lago_python_client-1.45.0/lago_python_client/webhook_endpoints}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
- {lago_python_client-1.43.0/tests → lago_python_client-1.45.0/lago_python_client/webhooks}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/webhooks/clients.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client.egg-info/requires.txt +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client.egg-info/top_level.txt +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/pyproject.toml +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/setup.cfg +0 -0
- {lago_python_client-1.43.0/tests/utils → lago_python_client-1.45.0/tests}/__init__.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_activity_logs_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_add_on_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_api_logs_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_applied_coupon_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_billable_metric_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_billing_entity_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_coupon_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_credit_note_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_applied_coupons_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_credit_notes_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_invoices_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_payment_methods_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_payment_requests_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_payments_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_sbscriptions_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_customer_wallets_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_event_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_fee_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_functools_ext.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_gross_revenue_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_invoice_collection_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_invoiced_usage_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_json_services.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_mrr_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_organization_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_overdue_balance_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_payment_receipt_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_payment_request_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_plan_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_request_services.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_response_services.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_tax_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_usage_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_webhook_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/test_webhook_endpoint_client.py +0 -0
- {lago_python_client-1.43.0 → lago_python_client-1.45.0}/tests/utils/mixin.py +0 -0
{lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/customers/clients.py
RENAMED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import json
|
|
1
2
|
from collections.abc import Mapping
|
|
2
|
-
from typing import Any, ClassVar, Optional, Type
|
|
3
|
+
from typing import Any, ClassVar, Optional, Type, Union
|
|
3
4
|
|
|
4
5
|
from ..base_client import BaseClient
|
|
6
|
+
from ..functools_ext import callable_cached_property
|
|
5
7
|
from ..mixins import (
|
|
6
8
|
CreateCommandMixin,
|
|
7
9
|
DestroyCommandMixin,
|
|
@@ -18,6 +20,7 @@ from ..services.response import (
|
|
|
18
20
|
prepare_index_response,
|
|
19
21
|
prepare_object_response,
|
|
20
22
|
)
|
|
23
|
+
from .wallet_client import CustomerWalletClient
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
class CustomerClient(
|
|
@@ -31,12 +34,31 @@ class CustomerClient(
|
|
|
31
34
|
RESPONSE_MODEL: ClassVar[Type[CustomerResponse]] = CustomerResponse
|
|
32
35
|
ROOT_NAME: ClassVar[str] = "customer"
|
|
33
36
|
|
|
37
|
+
@callable_cached_property
|
|
38
|
+
def wallets(self) -> CustomerWalletClient:
|
|
39
|
+
return CustomerWalletClient(self.base_url, self.api_key)
|
|
40
|
+
|
|
34
41
|
def current_usage(
|
|
35
|
-
self,
|
|
42
|
+
self,
|
|
43
|
+
resource_id: str,
|
|
44
|
+
external_subscription_id: str,
|
|
45
|
+
apply_taxes: Optional[str] = None,
|
|
46
|
+
filter_by_charge_id: Optional[str] = None,
|
|
47
|
+
filter_by_charge_code: Optional[str] = None,
|
|
48
|
+
filter_by_group: Optional[dict] = None,
|
|
49
|
+
full_usage: Optional[bool] = None,
|
|
36
50
|
) -> CustomerUsageResponse:
|
|
37
|
-
query_params = {"external_subscription_id": external_subscription_id}
|
|
51
|
+
query_params: dict[str, Union[str, bool]] = {"external_subscription_id": external_subscription_id}
|
|
38
52
|
if apply_taxes is not None:
|
|
39
53
|
query_params["apply_taxes"] = apply_taxes
|
|
54
|
+
if filter_by_charge_id is not None:
|
|
55
|
+
query_params["filter_by_charge_id"] = filter_by_charge_id
|
|
56
|
+
if filter_by_charge_code is not None:
|
|
57
|
+
query_params["filter_by_charge_code"] = filter_by_charge_code
|
|
58
|
+
if filter_by_group is not None:
|
|
59
|
+
query_params["filter_by_group"] = json.dumps(filter_by_group)
|
|
60
|
+
if full_usage is not None:
|
|
61
|
+
query_params["full_usage"] = str(full_usage).lower()
|
|
40
62
|
|
|
41
63
|
api_response: Response = send_get_request(
|
|
42
64
|
url=make_url(
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..functools_ext import callable_cached_property
|
|
5
|
+
from ..mixins import (
|
|
6
|
+
NestedCreateCommandMixin,
|
|
7
|
+
NestedDestroyCommandMixin,
|
|
8
|
+
NestedFindAllCommandMixin,
|
|
9
|
+
NestedFindCommandMixin,
|
|
10
|
+
NestedUpdateCommandMixin,
|
|
11
|
+
)
|
|
12
|
+
from ..models.wallet import WalletResponse
|
|
13
|
+
from .wallets.alert_client import CustomerWalletAlertClient
|
|
14
|
+
from .wallets.metadata_client import CustomerWalletMetadataClient
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CustomerWalletClient(
|
|
18
|
+
NestedCreateCommandMixin[WalletResponse],
|
|
19
|
+
NestedUpdateCommandMixin[WalletResponse],
|
|
20
|
+
NestedDestroyCommandMixin[WalletResponse],
|
|
21
|
+
NestedFindCommandMixin[WalletResponse],
|
|
22
|
+
NestedFindAllCommandMixin[WalletResponse],
|
|
23
|
+
BaseClient,
|
|
24
|
+
):
|
|
25
|
+
API_RESOURCE: ClassVar[str] = "wallets"
|
|
26
|
+
RESPONSE_MODEL: ClassVar[Type[WalletResponse]] = WalletResponse
|
|
27
|
+
ROOT_NAME: ClassVar[str] = "wallet"
|
|
28
|
+
|
|
29
|
+
def api_resource(self, customer_id: str) -> tuple[str]:
|
|
30
|
+
return (
|
|
31
|
+
"customers",
|
|
32
|
+
customer_id,
|
|
33
|
+
"wallets",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
@callable_cached_property
|
|
37
|
+
def metadata(self) -> CustomerWalletMetadataClient:
|
|
38
|
+
return CustomerWalletMetadataClient(self.base_url, self.api_key)
|
|
39
|
+
|
|
40
|
+
@callable_cached_property
|
|
41
|
+
def alerts(self) -> CustomerWalletAlertClient:
|
|
42
|
+
return CustomerWalletAlertClient(self.base_url, self.api_key)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from typing import ClassVar, Type
|
|
2
|
+
|
|
3
|
+
from ...base_client import BaseClient
|
|
4
|
+
from ...mixins import (
|
|
5
|
+
NestedCreateCommandMixin,
|
|
6
|
+
NestedDestroyCommandMixin,
|
|
7
|
+
NestedFindAllCommandMixin,
|
|
8
|
+
NestedFindCommandMixin,
|
|
9
|
+
NestedUpdateCommandMixin,
|
|
10
|
+
)
|
|
11
|
+
from ...models.alert import AlertResponse, AlertsList
|
|
12
|
+
from ...services.json import to_json
|
|
13
|
+
from ...services.request import (
|
|
14
|
+
make_headers,
|
|
15
|
+
make_url,
|
|
16
|
+
send_delete_request,
|
|
17
|
+
send_post_request,
|
|
18
|
+
)
|
|
19
|
+
from ...services.response import (
|
|
20
|
+
Response,
|
|
21
|
+
get_response_data,
|
|
22
|
+
prepare_index_response,
|
|
23
|
+
verify_response,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class CustomerWalletAlertClient(
|
|
28
|
+
NestedCreateCommandMixin[AlertResponse],
|
|
29
|
+
NestedUpdateCommandMixin[AlertResponse],
|
|
30
|
+
NestedDestroyCommandMixin[AlertResponse],
|
|
31
|
+
NestedFindCommandMixin[AlertResponse],
|
|
32
|
+
NestedFindAllCommandMixin[AlertResponse],
|
|
33
|
+
BaseClient,
|
|
34
|
+
):
|
|
35
|
+
API_RESOURCE: ClassVar[str] = "alerts"
|
|
36
|
+
RESPONSE_MODEL: ClassVar[Type[AlertResponse]] = AlertResponse
|
|
37
|
+
ROOT_NAME: ClassVar[str] = "alert"
|
|
38
|
+
|
|
39
|
+
def api_resource(self, customer_id: str, wallet_code: str) -> tuple[str]:
|
|
40
|
+
return ("customers", customer_id, "wallets", wallet_code, "alerts")
|
|
41
|
+
|
|
42
|
+
def create_batch(self, customer_id: str, wallet_code: str, input_object: AlertsList) -> None:
|
|
43
|
+
api_response: Response = send_post_request(
|
|
44
|
+
url=make_url(origin=self.base_url, path_parts=self.api_resource(customer_id, wallet_code)),
|
|
45
|
+
content=to_json(input_object.dict()),
|
|
46
|
+
headers=make_headers(api_key=self.api_key),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
return prepare_index_response(
|
|
50
|
+
api_resource="alerts",
|
|
51
|
+
response_model=AlertResponse,
|
|
52
|
+
data=get_response_data(response=api_response),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
def destroy_all(self, customer_id: str, wallet_code: str) -> None:
|
|
56
|
+
api_response: Response = send_delete_request(
|
|
57
|
+
url=make_url(
|
|
58
|
+
origin=self.base_url,
|
|
59
|
+
path_parts=self.api_resource(customer_id, wallet_code),
|
|
60
|
+
),
|
|
61
|
+
headers=make_headers(api_key=self.api_key),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
verify_response(api_response)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
from typing import ClassVar, Dict, Optional
|
|
2
|
+
|
|
3
|
+
from ...base_client import BaseClient
|
|
4
|
+
from ...services.json import to_json
|
|
5
|
+
from ...services.request import (
|
|
6
|
+
make_headers,
|
|
7
|
+
make_url,
|
|
8
|
+
send_delete_request,
|
|
9
|
+
send_patch_request,
|
|
10
|
+
send_post_request,
|
|
11
|
+
)
|
|
12
|
+
from ...services.response import (
|
|
13
|
+
Response,
|
|
14
|
+
get_response_data,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class CustomerWalletMetadataClient(BaseClient):
|
|
19
|
+
API_RESOURCE: ClassVar[str] = "metadata"
|
|
20
|
+
RESPONSE_MODEL: ClassVar[Dict] = Dict[str, Optional[str]]
|
|
21
|
+
ROOT_NAME: ClassVar[str] = "metadata"
|
|
22
|
+
|
|
23
|
+
def api_resource(self, customer_id: str, wallet_code: str) -> tuple:
|
|
24
|
+
return ("customers", customer_id, "wallets", wallet_code, "metadata")
|
|
25
|
+
|
|
26
|
+
def replace(
|
|
27
|
+
self, customer_id: str, wallet_code: str, metadata: Dict[str, Optional[str]]
|
|
28
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
29
|
+
api_response: Response = send_post_request(
|
|
30
|
+
url=make_url(
|
|
31
|
+
origin=self.base_url,
|
|
32
|
+
path_parts=self.api_resource(customer_id, wallet_code),
|
|
33
|
+
),
|
|
34
|
+
content=to_json({"metadata": metadata}),
|
|
35
|
+
headers=make_headers(api_key=self.api_key),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return get_response_data(response=api_response, key="metadata")
|
|
39
|
+
|
|
40
|
+
def merge(
|
|
41
|
+
self, customer_id: str, wallet_code: str, metadata: Dict[str, Optional[str]]
|
|
42
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
43
|
+
api_response: Response = send_patch_request(
|
|
44
|
+
url=make_url(
|
|
45
|
+
origin=self.base_url,
|
|
46
|
+
path_parts=self.api_resource(customer_id, wallet_code),
|
|
47
|
+
),
|
|
48
|
+
content=to_json({"metadata": metadata}),
|
|
49
|
+
headers=make_headers(api_key=self.api_key),
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return get_response_data(response=api_response, key="metadata")
|
|
53
|
+
|
|
54
|
+
def delete_all(self, customer_id: str, wallet_code: str) -> Optional[Dict[str, Optional[str]]]:
|
|
55
|
+
api_response: Response = send_delete_request(
|
|
56
|
+
url=make_url(
|
|
57
|
+
origin=self.base_url,
|
|
58
|
+
path_parts=self.api_resource(customer_id, wallet_code),
|
|
59
|
+
),
|
|
60
|
+
headers=make_headers(api_key=self.api_key),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return get_response_data(response=api_response, key="metadata")
|
|
64
|
+
|
|
65
|
+
def delete_key(self, customer_id: str, wallet_code: str, key: str) -> Optional[Dict[str, Optional[str]]]:
|
|
66
|
+
api_response: Response = send_delete_request(
|
|
67
|
+
url=make_url(
|
|
68
|
+
origin=self.base_url,
|
|
69
|
+
path_parts=self.api_resource(customer_id, wallet_code) + (key,),
|
|
70
|
+
),
|
|
71
|
+
headers=make_headers(api_key=self.api_key),
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
return get_response_data(response=api_response, key="metadata")
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
from typing import ClassVar, Type
|
|
2
2
|
|
|
3
3
|
from ..base_client import BaseClient
|
|
4
|
+
from ..client import CustomerClient
|
|
4
5
|
from ..mixins import FindAllChildrenCommandMixin
|
|
5
6
|
from ..models.wallet import WalletResponse
|
|
6
|
-
from .clients import CustomerClient
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class CustomerWalletsClient(FindAllChildrenCommandMixin, BaseClient):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Generic, Optional, Type, TypeVar
|
|
1
|
+
from typing import Any, Generic, Optional, Type, TypeVar, Union
|
|
2
2
|
|
|
3
3
|
import httpx
|
|
4
4
|
|
|
@@ -31,6 +31,8 @@ from .services.response import (
|
|
|
31
31
|
_PM_co = TypeVar("_PM_co", covariant=True)
|
|
32
32
|
_M = TypeVar("_M", bound=BaseModel)
|
|
33
33
|
|
|
34
|
+
DEFAULT_TIMEOUT = httpx.Timeout(10.0)
|
|
35
|
+
|
|
34
36
|
|
|
35
37
|
class _ClientMixin(Protocol[_PM_co]):
|
|
36
38
|
@property
|
|
@@ -53,7 +55,7 @@ class CreateCommandMixin(Generic[_M]):
|
|
|
53
55
|
def create(
|
|
54
56
|
self: _ClientMixin[_M],
|
|
55
57
|
input_object: BaseModel,
|
|
56
|
-
timeout: Optional[httpx.Timeout] =
|
|
58
|
+
timeout: Optional[httpx.Timeout] = DEFAULT_TIMEOUT,
|
|
57
59
|
) -> Optional[_M]:
|
|
58
60
|
"""Execute `create` command."""
|
|
59
61
|
# Send request and save response
|
|
@@ -89,7 +91,7 @@ class DestroyCommandMixin(Generic[_M]):
|
|
|
89
91
|
self: _ClientMixin[_M],
|
|
90
92
|
resource_id: str,
|
|
91
93
|
options: QueryPairs = None,
|
|
92
|
-
timeout: Optional[httpx.Timeout] =
|
|
94
|
+
timeout: Optional[httpx.Timeout] = DEFAULT_TIMEOUT,
|
|
93
95
|
) -> BaseModel:
|
|
94
96
|
"""Execute `destroy` command."""
|
|
95
97
|
# Send request and save response
|
|
@@ -118,7 +120,7 @@ class FindAllCommandMixin(Generic[_M]):
|
|
|
118
120
|
def find_all(
|
|
119
121
|
self: _ClientMixin[_M],
|
|
120
122
|
options: QueryPairs = None,
|
|
121
|
-
timeout: Optional[httpx.Timeout] =
|
|
123
|
+
timeout: Optional[httpx.Timeout] = DEFAULT_TIMEOUT,
|
|
122
124
|
) -> Mapping[str, Any]:
|
|
123
125
|
"""Execute `find all` command."""
|
|
124
126
|
# Send request and save response
|
|
@@ -181,8 +183,11 @@ class FindChildCommandMixin(Generic[_M]):
|
|
|
181
183
|
self: _ClientMixin[_M],
|
|
182
184
|
parent_id: str,
|
|
183
185
|
child_id: str,
|
|
186
|
+
options: QueryPairs = None,
|
|
184
187
|
) -> _M:
|
|
185
188
|
"""Execute `find` child command."""
|
|
189
|
+
if options is None:
|
|
190
|
+
options = {}
|
|
186
191
|
api_response: Response = send_get_request(
|
|
187
192
|
url=make_url(
|
|
188
193
|
origin=self.base_url,
|
|
@@ -192,6 +197,7 @@ class FindChildCommandMixin(Generic[_M]):
|
|
|
192
197
|
self.API_RESOURCE,
|
|
193
198
|
child_id,
|
|
194
199
|
),
|
|
200
|
+
query_pairs=options,
|
|
195
201
|
),
|
|
196
202
|
headers=make_headers(api_key=self.api_key),
|
|
197
203
|
)
|
|
@@ -209,8 +215,11 @@ class CreateChildCommandMixin(Generic[_M]):
|
|
|
209
215
|
self: _ClientMixin[_M],
|
|
210
216
|
parent_id: str,
|
|
211
217
|
input_object: BaseModel,
|
|
218
|
+
options: QueryPairs = None,
|
|
212
219
|
) -> _M:
|
|
213
220
|
"""Execute `create` child command."""
|
|
221
|
+
if options is None:
|
|
222
|
+
options = {}
|
|
214
223
|
api_response: Response = send_post_request(
|
|
215
224
|
url=make_url(
|
|
216
225
|
origin=self.base_url,
|
|
@@ -219,6 +228,7 @@ class CreateChildCommandMixin(Generic[_M]):
|
|
|
219
228
|
parent_id,
|
|
220
229
|
self.API_RESOURCE,
|
|
221
230
|
),
|
|
231
|
+
query_pairs=options,
|
|
222
232
|
),
|
|
223
233
|
content=to_json({self.ROOT_NAME: input_object.dict(exclude_none=True)}),
|
|
224
234
|
headers=make_headers(api_key=self.api_key),
|
|
@@ -238,8 +248,11 @@ class UpdateChildCommandMixin(Generic[_M]):
|
|
|
238
248
|
parent_id: str,
|
|
239
249
|
child_id: str,
|
|
240
250
|
input_object: BaseModel,
|
|
251
|
+
options: QueryPairs = None,
|
|
241
252
|
) -> _M:
|
|
242
253
|
"""Execute `update` child command."""
|
|
254
|
+
if options is None:
|
|
255
|
+
options = {}
|
|
243
256
|
api_response: Response = send_put_request(
|
|
244
257
|
url=make_url(
|
|
245
258
|
origin=self.base_url,
|
|
@@ -249,6 +262,7 @@ class UpdateChildCommandMixin(Generic[_M]):
|
|
|
249
262
|
self.API_RESOURCE,
|
|
250
263
|
child_id,
|
|
251
264
|
),
|
|
265
|
+
query_pairs=options,
|
|
252
266
|
),
|
|
253
267
|
content=to_json({self.ROOT_NAME: input_object.dict(exclude_none=True)}),
|
|
254
268
|
headers=make_headers(api_key=self.api_key),
|
|
@@ -267,8 +281,11 @@ class DestroyChildCommandMixin(Generic[_M]):
|
|
|
267
281
|
self: _ClientMixin[_M],
|
|
268
282
|
parent_id: str,
|
|
269
283
|
child_id: str,
|
|
284
|
+
options: QueryPairs = None,
|
|
270
285
|
) -> _M:
|
|
271
286
|
"""Execute `destroy` child command."""
|
|
287
|
+
if options is None:
|
|
288
|
+
options = {}
|
|
272
289
|
api_response: Response = send_delete_request(
|
|
273
290
|
url=make_url(
|
|
274
291
|
origin=self.base_url,
|
|
@@ -278,6 +295,7 @@ class DestroyChildCommandMixin(Generic[_M]):
|
|
|
278
295
|
self.API_RESOURCE,
|
|
279
296
|
child_id,
|
|
280
297
|
),
|
|
298
|
+
query_pairs=options,
|
|
281
299
|
),
|
|
282
300
|
headers=make_headers(api_key=self.api_key),
|
|
283
301
|
)
|
|
@@ -295,7 +313,7 @@ class FindCommandMixin(Generic[_M]):
|
|
|
295
313
|
self: _ClientMixin[_M],
|
|
296
314
|
resource_id: str,
|
|
297
315
|
params: QueryPairs = None,
|
|
298
|
-
timeout: Optional[httpx.Timeout] =
|
|
316
|
+
timeout: Optional[httpx.Timeout] = DEFAULT_TIMEOUT,
|
|
299
317
|
) -> _M:
|
|
300
318
|
"""Execute `find` command."""
|
|
301
319
|
# Send request and save response
|
|
@@ -325,7 +343,7 @@ class UpdateCommandMixin(Generic[_M]):
|
|
|
325
343
|
self: _ClientMixin[_M],
|
|
326
344
|
input_object: BaseModel,
|
|
327
345
|
identifier: Optional[str] = None,
|
|
328
|
-
timeout: Optional[httpx.Timeout] =
|
|
346
|
+
timeout: Optional[httpx.Timeout] = DEFAULT_TIMEOUT,
|
|
329
347
|
) -> _M:
|
|
330
348
|
"""Execute `update` command."""
|
|
331
349
|
# Send request and save response
|
|
@@ -348,3 +366,155 @@ class UpdateCommandMixin(Generic[_M]):
|
|
|
348
366
|
response_model=self.RESPONSE_MODEL,
|
|
349
367
|
data=get_response_data(response=api_response, key=self.ROOT_NAME),
|
|
350
368
|
)
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
class NestedCreateCommandMixin(Generic[_M]):
|
|
372
|
+
"""Client mixin with `create` command."""
|
|
373
|
+
|
|
374
|
+
def create(
|
|
375
|
+
self: _ClientMixin[_M],
|
|
376
|
+
*args: Union[str, BaseModel],
|
|
377
|
+
timeout: Optional[httpx.Timeout] = None,
|
|
378
|
+
) -> Optional[_M]:
|
|
379
|
+
"""Execute `create` command."""
|
|
380
|
+
*parent_ids, input_object = args
|
|
381
|
+
|
|
382
|
+
# Send request and save response
|
|
383
|
+
api_response: Response = send_post_request(
|
|
384
|
+
url=make_url(origin=self.base_url, path_parts=self.api_resource(*parent_ids)),
|
|
385
|
+
content=to_json(
|
|
386
|
+
{
|
|
387
|
+
self.ROOT_NAME: input_object.dict(exclude_none=True),
|
|
388
|
+
}
|
|
389
|
+
),
|
|
390
|
+
headers=make_headers(api_key=self.api_key),
|
|
391
|
+
timeout=timeout,
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
# Process response data
|
|
395
|
+
response_data = get_response_data(response=api_response, key=self.ROOT_NAME)
|
|
396
|
+
if not response_data:
|
|
397
|
+
return None
|
|
398
|
+
|
|
399
|
+
return prepare_object_response(
|
|
400
|
+
response_model=self.RESPONSE_MODEL,
|
|
401
|
+
data=response_data,
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class NestedUpdateCommandMixin(Generic[_M]):
|
|
406
|
+
"""Client mixin with `update` command."""
|
|
407
|
+
|
|
408
|
+
def update(
|
|
409
|
+
self: _ClientMixin[_M],
|
|
410
|
+
*args: Union[str, BaseModel],
|
|
411
|
+
timeout: Optional[httpx.Timeout] = None,
|
|
412
|
+
) -> _M:
|
|
413
|
+
"""Execute `update` command."""
|
|
414
|
+
*parent_ids, resource_id, input_object = args
|
|
415
|
+
|
|
416
|
+
# Send request and save response
|
|
417
|
+
api_response: Response = send_put_request(
|
|
418
|
+
url=make_url(
|
|
419
|
+
origin=self.base_url,
|
|
420
|
+
path_parts=self.api_resource(*parent_ids) + (resource_id,),
|
|
421
|
+
),
|
|
422
|
+
content=to_json(
|
|
423
|
+
{
|
|
424
|
+
self.ROOT_NAME: input_object.dict(exclude_none=True),
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
headers=make_headers(api_key=self.api_key),
|
|
428
|
+
timeout=timeout,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
# Process response data
|
|
432
|
+
return prepare_object_response(
|
|
433
|
+
response_model=self.RESPONSE_MODEL,
|
|
434
|
+
data=get_response_data(response=api_response, key=self.ROOT_NAME),
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
class NestedDestroyCommandMixin(Generic[_M]):
|
|
439
|
+
"""Client mixin with `destroy` command."""
|
|
440
|
+
|
|
441
|
+
def destroy(
|
|
442
|
+
self: _ClientMixin[_M],
|
|
443
|
+
*args: str,
|
|
444
|
+
timeout: Optional[httpx.Timeout] = None,
|
|
445
|
+
) -> BaseModel:
|
|
446
|
+
"""Execute `destroy` command."""
|
|
447
|
+
*parent_ids, resource_id = args
|
|
448
|
+
|
|
449
|
+
# Send request and save response
|
|
450
|
+
api_response: Response = send_delete_request(
|
|
451
|
+
url=make_url(
|
|
452
|
+
origin=self.base_url,
|
|
453
|
+
path_parts=self.api_resource(*parent_ids) + (resource_id,),
|
|
454
|
+
),
|
|
455
|
+
headers=make_headers(api_key=self.api_key),
|
|
456
|
+
timeout=timeout,
|
|
457
|
+
)
|
|
458
|
+
|
|
459
|
+
# Process response data
|
|
460
|
+
return prepare_object_response(
|
|
461
|
+
response_model=self.RESPONSE_MODEL,
|
|
462
|
+
data=get_response_data(response=api_response, key=self.ROOT_NAME),
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class NestedFindCommandMixin(Generic[_M]):
|
|
467
|
+
"""Client mixin with `find` command."""
|
|
468
|
+
|
|
469
|
+
def find(
|
|
470
|
+
self: _ClientMixin[_M],
|
|
471
|
+
*args: str,
|
|
472
|
+
timeout: Optional[httpx.Timeout] = None,
|
|
473
|
+
) -> _M:
|
|
474
|
+
"""Execute `find` command."""
|
|
475
|
+
*parent_ids, resource_id = args
|
|
476
|
+
|
|
477
|
+
# Send request and save response
|
|
478
|
+
api_response: Response = send_get_request(
|
|
479
|
+
url=make_url(
|
|
480
|
+
origin=self.base_url,
|
|
481
|
+
path_parts=self.api_resource(*parent_ids) + (resource_id,),
|
|
482
|
+
),
|
|
483
|
+
headers=make_headers(api_key=self.api_key),
|
|
484
|
+
timeout=timeout,
|
|
485
|
+
)
|
|
486
|
+
|
|
487
|
+
# Process response data
|
|
488
|
+
return prepare_object_response(
|
|
489
|
+
response_model=self.RESPONSE_MODEL,
|
|
490
|
+
data=get_response_data(response=api_response, key=self.ROOT_NAME),
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
class NestedFindAllCommandMixin(Generic[_M]):
|
|
495
|
+
"""Client mixin with `find_all` command."""
|
|
496
|
+
|
|
497
|
+
def find_all(
|
|
498
|
+
self: _ClientMixin[_M],
|
|
499
|
+
*parent_ids: str,
|
|
500
|
+
options: QueryPairs = None,
|
|
501
|
+
timeout: Optional[httpx.Timeout] = None,
|
|
502
|
+
) -> Mapping[str, Any]:
|
|
503
|
+
"""Execute `find all` command."""
|
|
504
|
+
# Send request and save response
|
|
505
|
+
api_response: Response = send_get_request(
|
|
506
|
+
url=make_url(
|
|
507
|
+
origin=self.base_url,
|
|
508
|
+
path_parts=self.api_resource(*parent_ids),
|
|
509
|
+
query_pairs=options,
|
|
510
|
+
),
|
|
511
|
+
headers=make_headers(api_key=self.api_key),
|
|
512
|
+
timeout=timeout,
|
|
513
|
+
)
|
|
514
|
+
|
|
515
|
+
# Process response data
|
|
516
|
+
return prepare_index_response(
|
|
517
|
+
api_resource=self.API_RESOURCE,
|
|
518
|
+
response_model=self.RESPONSE_MODEL,
|
|
519
|
+
data=get_response_data(response=api_response),
|
|
520
|
+
)
|
{lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/__init__.py
RENAMED
|
@@ -189,6 +189,15 @@ from .invoice import (
|
|
|
189
189
|
from .invoice import (
|
|
190
190
|
OneOffInvoice as OneOffInvoice,
|
|
191
191
|
)
|
|
192
|
+
from .invoice_custom_section import (
|
|
193
|
+
AppliedInvoiceCustomSection as AppliedInvoiceCustomSection,
|
|
194
|
+
)
|
|
195
|
+
from .invoice_custom_section import (
|
|
196
|
+
AppliedInvoiceCustomSections as AppliedInvoiceCustomSections,
|
|
197
|
+
)
|
|
198
|
+
from .invoice_custom_section import (
|
|
199
|
+
InvoiceCustomSectionInput as InvoiceCustomSectionInput,
|
|
200
|
+
)
|
|
192
201
|
from .invoice_custom_section import (
|
|
193
202
|
InvoiceCustomSectionResponse as InvoiceCustomSectionResponse,
|
|
194
203
|
)
|
|
@@ -15,11 +15,11 @@ class AlertThresholdList(BaseModel):
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
class Alert(BaseModel):
|
|
18
|
-
alert_type: str
|
|
19
|
-
code: str
|
|
18
|
+
alert_type: Optional[str]
|
|
19
|
+
code: Optional[str]
|
|
20
20
|
name: Optional[str]
|
|
21
|
+
thresholds: Optional[AlertThresholdList]
|
|
21
22
|
billable_metric_code: Optional[str]
|
|
22
|
-
thresholds: AlertThresholdList
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class AlertsList(BaseModel):
|
|
@@ -39,10 +39,13 @@ class AlertThresholdResponseList(BaseResponseModel):
|
|
|
39
39
|
class AlertResponse(BaseResponseModel):
|
|
40
40
|
lago_id: str
|
|
41
41
|
lago_organization_id: str
|
|
42
|
-
external_subscription_id: str
|
|
42
|
+
external_subscription_id: Optional[str]
|
|
43
|
+
lago_wallet_id: Optional[str]
|
|
44
|
+
wallet_code: Optional[str]
|
|
43
45
|
alert_type: str
|
|
44
46
|
code: str
|
|
45
47
|
name: Optional[str]
|
|
48
|
+
direction: Optional[str]
|
|
46
49
|
previous_value: Optional[str]
|
|
47
50
|
last_processed_at: Optional[str]
|
|
48
51
|
thresholds: AlertThresholdResponseList
|
{lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/customer.py
RENAMED
|
@@ -3,6 +3,7 @@ from typing import List, Optional
|
|
|
3
3
|
from lago_python_client.base_model import BaseModel
|
|
4
4
|
|
|
5
5
|
from ..base_model import BaseResponseModel
|
|
6
|
+
from .error_detail import ErrorDetailsResponse
|
|
6
7
|
from .invoice_custom_section import InvoiceCustomSectionsResponseList
|
|
7
8
|
from .tax import TaxesResponse
|
|
8
9
|
|
|
@@ -145,3 +146,4 @@ class CustomerResponse(BaseResponseModel):
|
|
|
145
146
|
skip_invoice_custom_sections: Optional[bool]
|
|
146
147
|
applicable_invoice_custom_sections: Optional[InvoiceCustomSectionsResponseList]
|
|
147
148
|
billing_entity_code: Optional[str]
|
|
149
|
+
error_details: Optional[ErrorDetailsResponse]
|
{lago_python_client-1.43.0 → lago_python_client-1.45.0}/lago_python_client/models/invoice.py
RENAMED
|
@@ -9,6 +9,7 @@ from .credit import CreditsResponse
|
|
|
9
9
|
from .customer import Customer, CustomerResponse
|
|
10
10
|
from .error_detail import ErrorDetailsResponse
|
|
11
11
|
from .fee import FeesResponse
|
|
12
|
+
from .invoice_custom_section import InvoiceCustomSectionInput
|
|
12
13
|
from .payment_method import PaymentMethod
|
|
13
14
|
from .subscription import Subscriptions, SubscriptionsResponse
|
|
14
15
|
from .usage_threshold import UsageThreshold
|
|
@@ -55,6 +56,7 @@ class OneOffInvoice(BaseModel):
|
|
|
55
56
|
fees: Optional[InvoiceFeesList]
|
|
56
57
|
error_details: Optional[ErrorDetailsResponse]
|
|
57
58
|
payment_method: Optional[PaymentMethod]
|
|
59
|
+
invoice_custom_section: Optional[InvoiceCustomSectionInput]
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
class InvoicePreview(BaseModel):
|
|
@@ -131,6 +133,8 @@ class InvoiceResponse(BaseResponseModel):
|
|
|
131
133
|
total_amount_cents: int
|
|
132
134
|
total_due_amount_cents: int
|
|
133
135
|
prepaid_credit_amount_cents: int
|
|
136
|
+
prepaid_granted_credit_amount_cents: Optional[int]
|
|
137
|
+
prepaid_purchased_credit_amount_cents: Optional[int]
|
|
134
138
|
|
|
135
139
|
file_url: Optional[str]
|
|
136
140
|
customer: Optional[CustomerResponse]
|
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
from typing import List, Optional
|
|
2
2
|
|
|
3
|
+
from lago_python_client.base_model import BaseModel
|
|
4
|
+
|
|
3
5
|
from ..base_model import BaseResponseModel
|
|
4
6
|
|
|
5
7
|
|
|
8
|
+
class InvoiceCustomSectionInput(BaseModel):
|
|
9
|
+
skip_invoice_custom_sections: Optional[bool]
|
|
10
|
+
invoice_custom_section_codes: Optional[List[str]]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AppliedInvoiceCustomSection(BaseResponseModel):
|
|
14
|
+
lago_id: Optional[str]
|
|
15
|
+
invoice_custom_section_id: Optional[str]
|
|
16
|
+
created_at: Optional[str]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class AppliedInvoiceCustomSections(BaseResponseModel):
|
|
20
|
+
__root__: List[AppliedInvoiceCustomSection]
|
|
21
|
+
|
|
22
|
+
|
|
6
23
|
class InvoiceCustomSectionResponse(BaseResponseModel):
|
|
7
24
|
lago_id: Optional[str]
|
|
8
25
|
code: Optional[str]
|