lago-python-client 1.36.0__tar.gz → 1.41.4__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.36.0 → lago_python_client-1.41.4}/PKG-INFO +1 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/credit_notes/clients.py +53 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/__init__.py +20 -0
- lago_python_client-1.41.4/lago_python_client/models/alert.py +54 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/charge.py +2 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/credit_note.py +8 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/customer_usage.py +1 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/event.py +2 -2
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/fee.py +1 -0
- lago_python_client-1.41.4/lago_python_client/models/fixed_charge.py +80 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/plan.py +14 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/subscription.py +2 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/wallet.py +6 -0
- lago_python_client-1.41.4/lago_python_client/plans/clients.py +83 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/services/request.py +1 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/subscriptions/clients.py +48 -1
- lago_python_client-1.41.4/lago_python_client/version.py +1 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/wallets/clients.py +60 -2
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client.egg-info/PKG-INFO +1 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client.egg-info/SOURCES.txt +4 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_credit_note_client.py +81 -4
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_event_client.py +24 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_fee_client.py +21 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_plan_client.py +122 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_subscription_client.py +197 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_wallet_client.py +70 -0
- lago_python_client-1.36.0/lago_python_client/plans/clients.py +0 -24
- lago_python_client-1.36.0/lago_python_client/version.py +0 -1
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/LICENSE +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/README.md +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/activity_logs/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/activity_logs/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/add_ons/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/add_ons/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/api_logs/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/api_logs/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/base_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/base_model.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/billable_metrics/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/billable_metrics/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/billing_entities/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/billing_entities/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/coupons/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/coupons/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/credit_notes/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/applied_coupons_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/credit_notes_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/invoices_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/payment_requests_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/payments_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/subscriptions_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/customers/wallets_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/events/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/events/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/exceptions.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/fees/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/fees/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/functools_ext.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/gross_revenues/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/gross_revenues/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/invoice_collections/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/invoice_collections/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/invoiced_usages/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/invoiced_usages/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/invoices/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/invoices/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/mixins.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/activity_log.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/add_on.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/api_log.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/applied_coupon.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/billable_metric.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/billing_entity.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/billing_period.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/coupon.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/credit.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/customer.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/customer_projected_usage.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/error_detail.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/gross_revenue.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/invoice.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/invoice_collection.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/invoice_custom_section.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/invoice_item.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/invoiced_usage.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/lifetime_usage.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/minimum_commitment.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/mrr.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/organization.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/overdue_balance.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/payment.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/payment_receipt.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/payment_request.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/tax.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/usage.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/usage_threshold.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/wallet_transaction.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/webhook_endpoint.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/mrrs/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/mrrs/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/organizations/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/organizations/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/overdue_balances/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/overdue_balances/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/payment_receipts/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/payment_receipts/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/payment_requests/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/payment_requests/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/payments/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/payments/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/plans/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/py.typed +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/services/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/services/json.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/services/response.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/subscriptions/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/taxes/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/taxes/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/usages/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/usages/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/wallets/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/webhook_endpoints/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/webhook_endpoints/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/webhooks/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/webhooks/clients.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client.egg-info/dependency_links.txt +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client.egg-info/requires.txt +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client.egg-info/top_level.txt +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/pyproject.toml +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/setup.cfg +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_activity_logs_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_add_on_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_api_logs_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_applied_coupon_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_billable_metric_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_billing_entity_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_coupon_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_applied_coupons_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_credit_notes_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_invoices_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_payment_requests_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_payments_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_sbscriptions_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_customer_wallets_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_functools_ext.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_gross_revenue_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_invoice_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_invoice_collection_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_invoiced_usage_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_json_services.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_mrr_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_organization_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_overdue_balance_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_payment_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_payment_receipt_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_payment_request_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_request_services.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_response_services.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_tax_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_usage_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_wallet_transaction_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_webhook_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/test_webhook_endpoint_client.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/utils/__init__.py +0 -0
- {lago_python_client-1.36.0 → lago_python_client-1.41.4}/tests/utils/mixin.py +0 -0
{lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/credit_notes/clients.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar, Optional, Type
|
|
1
|
+
from typing import ClassVar, Dict, Optional, Type
|
|
2
2
|
|
|
3
3
|
from ..base_client import BaseClient
|
|
4
4
|
from ..mixins import (
|
|
@@ -16,6 +16,8 @@ from ..services.json import to_json
|
|
|
16
16
|
from ..services.request import (
|
|
17
17
|
make_headers,
|
|
18
18
|
make_url,
|
|
19
|
+
send_delete_request,
|
|
20
|
+
send_patch_request,
|
|
19
21
|
send_post_request,
|
|
20
22
|
send_put_request,
|
|
21
23
|
)
|
|
@@ -84,3 +86,53 @@ class CreditNoteClient(
|
|
|
84
86
|
response_model=CreditNoteEstimatedResponse,
|
|
85
87
|
data=get_response_data(response=api_response, key=self.ESTIMATE_API_RESOURCE),
|
|
86
88
|
)
|
|
89
|
+
|
|
90
|
+
def replace_metadata(
|
|
91
|
+
self, resource_id: str, metadata: Dict[str, Optional[str]]
|
|
92
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
93
|
+
api_response: Response = send_post_request(
|
|
94
|
+
url=make_url(
|
|
95
|
+
origin=self.base_url,
|
|
96
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
97
|
+
),
|
|
98
|
+
content=to_json({"metadata": metadata}),
|
|
99
|
+
headers=make_headers(api_key=self.api_key),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
return get_response_data(response=api_response, key="metadata")
|
|
103
|
+
|
|
104
|
+
def merge_metadata(
|
|
105
|
+
self, resource_id: str, metadata: Dict[str, Optional[str]]
|
|
106
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
107
|
+
api_response: Response = send_patch_request(
|
|
108
|
+
url=make_url(
|
|
109
|
+
origin=self.base_url,
|
|
110
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
111
|
+
),
|
|
112
|
+
content=to_json({"metadata": metadata}),
|
|
113
|
+
headers=make_headers(api_key=self.api_key),
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return get_response_data(response=api_response, key="metadata")
|
|
117
|
+
|
|
118
|
+
def delete_all_metadata(self, resource_id: str) -> Optional[Dict[str, Optional[str]]]:
|
|
119
|
+
api_response: Response = send_delete_request(
|
|
120
|
+
url=make_url(
|
|
121
|
+
origin=self.base_url,
|
|
122
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
123
|
+
),
|
|
124
|
+
headers=make_headers(api_key=self.api_key),
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
return get_response_data(response=api_response, key="metadata")
|
|
128
|
+
|
|
129
|
+
def delete_metadata_key(self, resource_id: str, key: str) -> Optional[Dict[str, Optional[str]]]:
|
|
130
|
+
api_response: Response = send_delete_request(
|
|
131
|
+
url=make_url(
|
|
132
|
+
origin=self.base_url,
|
|
133
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata", key),
|
|
134
|
+
),
|
|
135
|
+
headers=make_headers(api_key=self.api_key),
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
return get_response_data(response=api_response, key="metadata")
|
{lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/__init__.py
RENAMED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
from .activity_log import ActivityLog as ActivityLog, ActivityLogResponse as ActivityLogResponse
|
|
2
|
+
from .alert import (
|
|
3
|
+
Alert as Alert,
|
|
4
|
+
AlertsList as AlertsList,
|
|
5
|
+
AlertThreshold as AlertThreshold,
|
|
6
|
+
AlertThresholdList as AlertThresholdList,
|
|
7
|
+
AlertResponse as AlertResponse,
|
|
8
|
+
AlertsResponseList as AlertsResponseList,
|
|
9
|
+
AlertThresholdResponse as AlertThresholdResponse,
|
|
10
|
+
AlertThresholdResponseList as AlertThresholdResponseList,
|
|
11
|
+
)
|
|
2
12
|
from .api_log import ApiLog as ApiLog, ApiLogResponse as ApiLogResponse
|
|
3
13
|
from .applied_coupon import AppliedCoupon as AppliedCoupon
|
|
4
14
|
from .billable_metric import (
|
|
@@ -27,6 +37,16 @@ from .charge import (
|
|
|
27
37
|
ChargeFilter as ChargeFilter,
|
|
28
38
|
)
|
|
29
39
|
from .coupon import Coupon as Coupon, CouponsList as CouponsList, LimitationConfiguration as LimitationConfiguration
|
|
40
|
+
from .fixed_charge import (
|
|
41
|
+
FixedCharge as FixedCharge,
|
|
42
|
+
FixedCharges as FixedCharges,
|
|
43
|
+
FixedChargeResponse as FixedChargeResponse,
|
|
44
|
+
FixedChargesResponse as FixedChargesResponse,
|
|
45
|
+
FixedChargeProperties as FixedChargeProperties,
|
|
46
|
+
FixedChargeGraduatedRange as FixedChargeGraduatedRange,
|
|
47
|
+
FixedChargeOverrides as FixedChargeOverrides,
|
|
48
|
+
FixedChargesOverrides as FixedChargesOverrides,
|
|
49
|
+
)
|
|
30
50
|
from .credit import CreditResponse as CreditResponse, CreditsResponse as CreditsResponse
|
|
31
51
|
from .credit_note import (
|
|
32
52
|
Item as Item,
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
|
|
3
|
+
from ..base_model import BaseModel, BaseResponseModel
|
|
4
|
+
from .billable_metric import BillableMetricResponse
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AlertThreshold(BaseModel):
|
|
8
|
+
code: Optional[str]
|
|
9
|
+
value: str
|
|
10
|
+
recurring: Optional[bool]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class AlertThresholdList(BaseModel):
|
|
14
|
+
__root__: List[AlertThreshold]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class Alert(BaseModel):
|
|
18
|
+
alert_type: str
|
|
19
|
+
code: str
|
|
20
|
+
name: Optional[str]
|
|
21
|
+
billable_metric_code: Optional[str]
|
|
22
|
+
thresholds: AlertThresholdList
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class AlertsList(BaseModel):
|
|
26
|
+
alerts: List[Alert]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class AlertThresholdResponse(BaseResponseModel):
|
|
30
|
+
code: Optional[str]
|
|
31
|
+
value: str
|
|
32
|
+
recurring: bool
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class AlertThresholdResponseList(BaseResponseModel):
|
|
36
|
+
__root__: List[AlertThresholdResponse]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class AlertResponse(BaseResponseModel):
|
|
40
|
+
lago_id: str
|
|
41
|
+
lago_organization_id: str
|
|
42
|
+
external_subscription_id: str
|
|
43
|
+
alert_type: str
|
|
44
|
+
code: str
|
|
45
|
+
name: Optional[str]
|
|
46
|
+
previous_value: Optional[str]
|
|
47
|
+
last_processed_at: Optional[str]
|
|
48
|
+
thresholds: AlertThresholdResponseList
|
|
49
|
+
created_at: str
|
|
50
|
+
billable_metric: Optional[BillableMetricResponse]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class AlertsResponseList(BaseResponseModel):
|
|
54
|
+
alerts: List[AlertResponse]
|
|
@@ -35,6 +35,7 @@ class Charge(BaseModel):
|
|
|
35
35
|
filters: Optional[ChargeFilters]
|
|
36
36
|
tax_codes: Optional[List[str]]
|
|
37
37
|
applied_pricing_unit: Optional[AppliedPricingUnit]
|
|
38
|
+
accepts_target_wallet: Optional[bool]
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
class Charges(BaseModel):
|
|
@@ -55,6 +56,7 @@ class ChargeResponse(BaseResponseModel):
|
|
|
55
56
|
properties: Optional[Dict[str, Any]]
|
|
56
57
|
filters: Optional[ChargeFilters]
|
|
57
58
|
taxes: Optional[TaxesResponse]
|
|
59
|
+
accepts_target_wallet: Optional[bool]
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
class ChargesResponse(BaseResponseModel):
|
{lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/credit_note.py
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
1
|
+
from typing import Dict, List, Optional
|
|
2
2
|
|
|
3
3
|
from lago_python_client.base_model import BaseModel
|
|
4
|
+
from .customer import CustomerResponse
|
|
4
5
|
|
|
5
6
|
from .fee import FeeResponse
|
|
6
7
|
from ..base_model import BaseResponseModel
|
|
@@ -49,6 +50,7 @@ class CreditNoteResponse(BaseResponseModel):
|
|
|
49
50
|
credit_amount_cents: int
|
|
50
51
|
balance_amount_cents: int
|
|
51
52
|
refund_amount_cents: int
|
|
53
|
+
offset_amount_cents: int
|
|
52
54
|
taxes_amount_cents: str
|
|
53
55
|
taxes_rate: float
|
|
54
56
|
sub_total_excluding_taxes_amount_cents: int
|
|
@@ -58,6 +60,8 @@ class CreditNoteResponse(BaseResponseModel):
|
|
|
58
60
|
updated_at: Optional[str]
|
|
59
61
|
items: Optional[ItemsResponse]
|
|
60
62
|
applied_taxes: Optional[CreditNoteAppliedTaxes]
|
|
63
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
64
|
+
customer: Optional[CustomerResponse]
|
|
61
65
|
|
|
62
66
|
|
|
63
67
|
class Item(BaseModel):
|
|
@@ -72,10 +76,12 @@ class Items(BaseModel):
|
|
|
72
76
|
class CreditNote(BaseModel):
|
|
73
77
|
reason: Optional[str]
|
|
74
78
|
items: Optional[Items]
|
|
79
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
75
80
|
|
|
76
81
|
|
|
77
82
|
class CreditNoteUpdate(BaseModel):
|
|
78
83
|
refund_status: Optional[str]
|
|
84
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
79
85
|
|
|
80
86
|
|
|
81
87
|
class EstimatedItemResponse(BaseResponseModel):
|
|
@@ -108,6 +114,7 @@ class CreditNoteEstimatedResponse(BaseResponseModel):
|
|
|
108
114
|
currency: str
|
|
109
115
|
max_creditable_amount_cents: int
|
|
110
116
|
max_refundable_amount_cents: int
|
|
117
|
+
max_offsettable_amount_cents: int
|
|
111
118
|
taxes_amount_cents: str
|
|
112
119
|
taxes_rate: float
|
|
113
120
|
sub_total_excluding_taxes_amount_cents: int
|
|
@@ -19,7 +19,7 @@ class BatchEvent(BaseModel):
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class EventResponse(BaseResponseModel):
|
|
22
|
-
lago_id: str
|
|
22
|
+
lago_id: Optional[str]
|
|
23
23
|
transaction_id: str
|
|
24
24
|
lago_customer_id: Optional[str]
|
|
25
25
|
lago_subscription_id: Optional[str]
|
|
@@ -28,7 +28,7 @@ class EventResponse(BaseResponseModel):
|
|
|
28
28
|
timestamp: str
|
|
29
29
|
precise_total_amount_cents: Optional[str]
|
|
30
30
|
properties: Optional[Dict[str, Any]]
|
|
31
|
-
created_at: str
|
|
31
|
+
created_at: Optional[str]
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class BatchEventResponse(BaseResponseModel):
|
|
@@ -41,6 +41,7 @@ class FeeResponse(BaseResponseModel):
|
|
|
41
41
|
lago_id: Optional[str]
|
|
42
42
|
lago_charge_id: Optional[str]
|
|
43
43
|
lago_charge_filter_id: Optional[str]
|
|
44
|
+
lago_fixed_charge_id: Optional[str]
|
|
44
45
|
lago_invoice_id: Optional[str]
|
|
45
46
|
lago_true_up_fee_id: Optional[str]
|
|
46
47
|
lago_true_up_parent_fee_id: Optional[str]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
|
|
3
|
+
from lago_python_client.base_model import BaseModel
|
|
4
|
+
|
|
5
|
+
from .tax import TaxesResponse
|
|
6
|
+
from ..base_model import BaseResponseModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class FixedChargeGraduatedRange(BaseModel):
|
|
10
|
+
from_value: Optional[int]
|
|
11
|
+
to_value: Optional[int]
|
|
12
|
+
flat_amount: Optional[str]
|
|
13
|
+
per_unit_amount: Optional[str]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class FixedChargeGraduatedRanges(BaseModel):
|
|
17
|
+
__root__: List[FixedChargeGraduatedRange]
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class FixedChargeProperties(BaseModel):
|
|
21
|
+
amount: Optional[str]
|
|
22
|
+
graduated_ranges: Optional[List[FixedChargeGraduatedRange]]
|
|
23
|
+
volume_ranges: Optional[List[FixedChargeGraduatedRange]]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class FixedCharge(BaseModel):
|
|
27
|
+
id: Optional[str]
|
|
28
|
+
add_on_id: Optional[str]
|
|
29
|
+
charge_model: Optional[str]
|
|
30
|
+
code: Optional[str]
|
|
31
|
+
invoice_display_name: Optional[str]
|
|
32
|
+
units: Optional[float]
|
|
33
|
+
pay_in_advance: Optional[bool]
|
|
34
|
+
prorated: Optional[bool]
|
|
35
|
+
properties: Optional[FixedChargeProperties]
|
|
36
|
+
tax_codes: Optional[List[str]]
|
|
37
|
+
apply_units_immediately: Optional[bool]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class FixedCharges(BaseModel):
|
|
41
|
+
__root__: List[FixedCharge]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class FixedChargePropertiesResponse(BaseResponseModel):
|
|
45
|
+
amount: Optional[str]
|
|
46
|
+
graduated_ranges: Optional[List[FixedChargeGraduatedRange]]
|
|
47
|
+
volume_ranges: Optional[List[FixedChargeGraduatedRange]]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class FixedChargeResponse(BaseResponseModel):
|
|
51
|
+
lago_id: str
|
|
52
|
+
lago_add_on_id: str
|
|
53
|
+
invoice_display_name: str
|
|
54
|
+
add_on_code: str
|
|
55
|
+
created_at: str
|
|
56
|
+
code: Optional[str]
|
|
57
|
+
charge_model: str
|
|
58
|
+
pay_in_advance: bool
|
|
59
|
+
prorated: bool
|
|
60
|
+
properties: Optional[FixedChargePropertiesResponse]
|
|
61
|
+
units: Optional[float]
|
|
62
|
+
lago_parent_id: Optional[str]
|
|
63
|
+
taxes: Optional[TaxesResponse]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class FixedChargesResponse(BaseResponseModel):
|
|
67
|
+
__root__: List[FixedChargeResponse]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class FixedChargeOverrides(BaseModel):
|
|
71
|
+
id: Optional[str]
|
|
72
|
+
invoice_display_name: Optional[str]
|
|
73
|
+
units: Optional[float]
|
|
74
|
+
apply_units_immediately: Optional[bool]
|
|
75
|
+
properties: Optional[FixedChargeProperties]
|
|
76
|
+
tax_codes: Optional[List[str]]
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class FixedChargesOverrides(BaseModel):
|
|
80
|
+
__root__: List[FixedChargeOverrides]
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
from typing import List, Optional
|
|
1
|
+
from typing import Dict, List, Optional
|
|
2
2
|
|
|
3
3
|
from lago_python_client.base_model import BaseModel
|
|
4
4
|
|
|
5
5
|
from .charge import Charges, ChargesResponse, ChargesOverrides
|
|
6
|
+
from .fixed_charge import (
|
|
7
|
+
FixedCharges,
|
|
8
|
+
FixedChargesResponse,
|
|
9
|
+
FixedChargesOverrides,
|
|
10
|
+
)
|
|
6
11
|
from .usage_threshold import (
|
|
7
12
|
UsageThresholds,
|
|
8
13
|
UsageThresholdsResponse,
|
|
@@ -28,11 +33,14 @@ class Plan(BaseModel):
|
|
|
28
33
|
trial_period: Optional[float]
|
|
29
34
|
pay_in_advance: Optional[bool]
|
|
30
35
|
bill_charges_monthly: Optional[bool]
|
|
36
|
+
bill_fixed_charges_monthly: Optional[bool]
|
|
31
37
|
charges: Optional[Charges]
|
|
38
|
+
fixed_charges: Optional[FixedCharges]
|
|
32
39
|
minimum_commitment: Optional[MinimumCommitment]
|
|
33
40
|
usage_thresholds: Optional[UsageThresholds]
|
|
34
41
|
tax_codes: Optional[List[str]]
|
|
35
42
|
cascade_updates: Optional[bool]
|
|
43
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
36
44
|
|
|
37
45
|
|
|
38
46
|
class PlanResponse(BaseResponseModel):
|
|
@@ -48,10 +56,13 @@ class PlanResponse(BaseResponseModel):
|
|
|
48
56
|
trial_period: Optional[float]
|
|
49
57
|
pay_in_advance: Optional[bool]
|
|
50
58
|
bill_charges_monthly: Optional[bool]
|
|
59
|
+
bill_fixed_charges_monthly: Optional[bool]
|
|
51
60
|
charges: Optional[ChargesResponse]
|
|
61
|
+
fixed_charges: Optional[FixedChargesResponse]
|
|
52
62
|
minimum_commitment: Optional[MinimumCommitmentResponse]
|
|
53
63
|
usage_thresholds: Optional[UsageThresholdsResponse]
|
|
54
64
|
taxes: Optional[TaxesResponse]
|
|
65
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
55
66
|
|
|
56
67
|
|
|
57
68
|
class PlanOverrides(BaseModel):
|
|
@@ -62,6 +73,8 @@ class PlanOverrides(BaseModel):
|
|
|
62
73
|
amount_currency: Optional[str]
|
|
63
74
|
trial_period: Optional[float]
|
|
64
75
|
charges: Optional[ChargesOverrides]
|
|
76
|
+
fixed_charges: Optional[FixedChargesOverrides]
|
|
65
77
|
minimum_commitment: Optional[MinimumCommitmentOverrides]
|
|
66
78
|
usage_thresholds: Optional[UsageThresholdsOverrides]
|
|
67
79
|
tax_codes: Optional[List[str]]
|
|
80
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
{lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/models/subscription.py
RENAMED
|
@@ -29,6 +29,8 @@ class SubscriptionResponse(BaseResponseModel):
|
|
|
29
29
|
canceled_at: Optional[str]
|
|
30
30
|
created_at: Optional[str]
|
|
31
31
|
plan_code: Optional[str]
|
|
32
|
+
plan_amount_cents: Optional[str]
|
|
33
|
+
plan_amount_currency: Optional[str]
|
|
32
34
|
started_at: Optional[str]
|
|
33
35
|
status: Optional[str]
|
|
34
36
|
name: Optional[str]
|
|
@@ -56,6 +56,8 @@ class Wallet(BaseModel):
|
|
|
56
56
|
external_customer_id: Optional[str]
|
|
57
57
|
rate_amount: Optional[str]
|
|
58
58
|
name: Optional[str]
|
|
59
|
+
code: Optional[str]
|
|
60
|
+
priority: Optional[int]
|
|
59
61
|
paid_credits: Optional[str]
|
|
60
62
|
granted_credits: Optional[str]
|
|
61
63
|
expiration_at: Optional[str]
|
|
@@ -68,6 +70,7 @@ class Wallet(BaseModel):
|
|
|
68
70
|
paid_top_up_max_amount_cents: Optional[int]
|
|
69
71
|
paid_top_up_min_amount_cents: Optional[int]
|
|
70
72
|
ignore_paid_top_up_limits_on_creation: Optional[bool]
|
|
73
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
71
74
|
|
|
72
75
|
|
|
73
76
|
class WalletResponse(BaseResponseModel):
|
|
@@ -77,6 +80,8 @@ class WalletResponse(BaseResponseModel):
|
|
|
77
80
|
status: str
|
|
78
81
|
currency: str
|
|
79
82
|
name: Optional[str]
|
|
83
|
+
code: Optional[str]
|
|
84
|
+
priority: Optional[int]
|
|
80
85
|
rate_amount: str
|
|
81
86
|
credits_balance: str
|
|
82
87
|
balance_cents: int
|
|
@@ -95,3 +100,4 @@ class WalletResponse(BaseResponseModel):
|
|
|
95
100
|
invoice_requires_successful_payment: Optional[bool]
|
|
96
101
|
paid_top_up_max_amount_cents: Optional[int]
|
|
97
102
|
paid_top_up_min_amount_cents: Optional[int]
|
|
103
|
+
metadata: Optional[Dict[str, Optional[str]]]
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
from typing import ClassVar, Dict, Optional, Type
|
|
2
|
+
|
|
3
|
+
from ..base_client import BaseClient
|
|
4
|
+
from ..mixins import (
|
|
5
|
+
CreateCommandMixin,
|
|
6
|
+
DestroyCommandMixin,
|
|
7
|
+
FindAllCommandMixin,
|
|
8
|
+
FindCommandMixin,
|
|
9
|
+
UpdateCommandMixin,
|
|
10
|
+
)
|
|
11
|
+
from ..models.plan import PlanResponse
|
|
12
|
+
from ..services.json import to_json
|
|
13
|
+
from ..services.request import (
|
|
14
|
+
make_headers,
|
|
15
|
+
make_url,
|
|
16
|
+
send_delete_request,
|
|
17
|
+
send_patch_request,
|
|
18
|
+
send_post_request,
|
|
19
|
+
)
|
|
20
|
+
from ..services.response import get_response_data, Response
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class PlanClient(
|
|
24
|
+
CreateCommandMixin[PlanResponse],
|
|
25
|
+
DestroyCommandMixin[PlanResponse],
|
|
26
|
+
FindAllCommandMixin[PlanResponse],
|
|
27
|
+
FindCommandMixin[PlanResponse],
|
|
28
|
+
UpdateCommandMixin[PlanResponse],
|
|
29
|
+
BaseClient,
|
|
30
|
+
):
|
|
31
|
+
API_RESOURCE: ClassVar[str] = "plans"
|
|
32
|
+
RESPONSE_MODEL: ClassVar[Type[PlanResponse]] = PlanResponse
|
|
33
|
+
ROOT_NAME: ClassVar[str] = "plan"
|
|
34
|
+
|
|
35
|
+
def replace_metadata(
|
|
36
|
+
self, resource_id: str, metadata: Dict[str, Optional[str]]
|
|
37
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
38
|
+
api_response: Response = send_post_request(
|
|
39
|
+
url=make_url(
|
|
40
|
+
origin=self.base_url,
|
|
41
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
42
|
+
),
|
|
43
|
+
content=to_json({"metadata": metadata}),
|
|
44
|
+
headers=make_headers(api_key=self.api_key),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
return get_response_data(response=api_response, key="metadata")
|
|
48
|
+
|
|
49
|
+
def merge_metadata(
|
|
50
|
+
self, resource_id: str, metadata: Dict[str, Optional[str]]
|
|
51
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
52
|
+
api_response: Response = send_patch_request(
|
|
53
|
+
url=make_url(
|
|
54
|
+
origin=self.base_url,
|
|
55
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
56
|
+
),
|
|
57
|
+
content=to_json({"metadata": metadata}),
|
|
58
|
+
headers=make_headers(api_key=self.api_key),
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
return get_response_data(response=api_response, key="metadata")
|
|
62
|
+
|
|
63
|
+
def delete_all_metadata(self, resource_id: str) -> Optional[Dict[str, Optional[str]]]:
|
|
64
|
+
api_response: Response = send_delete_request(
|
|
65
|
+
url=make_url(
|
|
66
|
+
origin=self.base_url,
|
|
67
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
68
|
+
),
|
|
69
|
+
headers=make_headers(api_key=self.api_key),
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
return get_response_data(response=api_response, key="metadata")
|
|
73
|
+
|
|
74
|
+
def delete_metadata_key(self, resource_id: str, key: str) -> Optional[Dict[str, Optional[str]]]:
|
|
75
|
+
api_response: Response = send_delete_request(
|
|
76
|
+
url=make_url(
|
|
77
|
+
origin=self.base_url,
|
|
78
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata", key),
|
|
79
|
+
),
|
|
80
|
+
headers=make_headers(api_key=self.api_key),
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return get_response_data(response=api_response, key="metadata")
|
{lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/subscriptions/clients.py
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import ClassVar, Type
|
|
1
|
+
from typing import Any, ClassVar, Mapping, Type
|
|
2
2
|
|
|
3
3
|
from ..base_client import BaseClient
|
|
4
4
|
from ..mixins import (
|
|
@@ -8,18 +8,24 @@ from ..mixins import (
|
|
|
8
8
|
FindCommandMixin,
|
|
9
9
|
UpdateCommandMixin,
|
|
10
10
|
)
|
|
11
|
+
from ..models.alert import AlertResponse, AlertsList
|
|
12
|
+
from ..models.fixed_charge import FixedChargeResponse
|
|
11
13
|
from ..models.lifetime_usage import LifetimeUsageResponse
|
|
12
14
|
from ..models.subscription import SubscriptionResponse
|
|
13
15
|
from ..services.request import (
|
|
14
16
|
make_headers,
|
|
15
17
|
make_url,
|
|
18
|
+
send_delete_request,
|
|
16
19
|
send_get_request,
|
|
20
|
+
send_post_request,
|
|
17
21
|
send_put_request,
|
|
18
22
|
)
|
|
19
23
|
from ..services.response import (
|
|
20
24
|
Response,
|
|
21
25
|
get_response_data,
|
|
26
|
+
prepare_index_response,
|
|
22
27
|
prepare_object_response,
|
|
28
|
+
verify_response,
|
|
23
29
|
)
|
|
24
30
|
from ..services.json import to_json
|
|
25
31
|
|
|
@@ -68,3 +74,44 @@ class SubscriptionClient(
|
|
|
68
74
|
response_model=LifetimeUsageResponse,
|
|
69
75
|
data=get_response_data(response=api_response, key="lifetime_usage"),
|
|
70
76
|
)
|
|
77
|
+
|
|
78
|
+
def create_alerts(self, external_id: str, input_object: AlertsList) -> Mapping[str, Any]:
|
|
79
|
+
api_response: Response = send_post_request(
|
|
80
|
+
url=make_url(
|
|
81
|
+
origin=self.base_url,
|
|
82
|
+
path_parts=(self.API_RESOURCE, external_id, "alerts"),
|
|
83
|
+
),
|
|
84
|
+
content=to_json(input_object.dict()),
|
|
85
|
+
headers=make_headers(api_key=self.api_key),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
return prepare_index_response(
|
|
89
|
+
api_resource="alerts",
|
|
90
|
+
response_model=AlertResponse,
|
|
91
|
+
data=get_response_data(response=api_response),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
def delete_alerts(self, external_id: str) -> None:
|
|
95
|
+
api_response: Response = send_delete_request(
|
|
96
|
+
url=make_url(
|
|
97
|
+
origin=self.base_url,
|
|
98
|
+
path_parts=(self.API_RESOURCE, external_id, "alerts"),
|
|
99
|
+
),
|
|
100
|
+
headers=make_headers(api_key=self.api_key),
|
|
101
|
+
)
|
|
102
|
+
verify_response(api_response)
|
|
103
|
+
|
|
104
|
+
def find_all_fixed_charges(self, external_id: str) -> Mapping[str, Any]:
|
|
105
|
+
api_response: Response = send_get_request(
|
|
106
|
+
url=make_url(
|
|
107
|
+
origin=self.base_url,
|
|
108
|
+
path_parts=(self.API_RESOURCE, external_id, "fixed_charges"),
|
|
109
|
+
),
|
|
110
|
+
headers=make_headers(api_key=self.api_key),
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return prepare_index_response(
|
|
114
|
+
api_resource="fixed_charges",
|
|
115
|
+
response_model=FixedChargeResponse,
|
|
116
|
+
data=get_response_data(response=api_response),
|
|
117
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
LAGO_VERSION = "1.41.4"
|
{lago_python_client-1.36.0 → lago_python_client-1.41.4}/lago_python_client/wallets/clients.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import sys
|
|
2
|
-
from typing import Any, ClassVar, Type
|
|
2
|
+
from typing import Any, ClassVar, Dict, Optional, Type
|
|
3
3
|
|
|
4
4
|
from lago_python_client.base_model import BaseModel
|
|
5
5
|
|
|
@@ -14,7 +14,15 @@ from ..mixins import (
|
|
|
14
14
|
from ..models.wallet import WalletResponse
|
|
15
15
|
from ..models.wallet_transaction import WalletTransactionResponse
|
|
16
16
|
from ..services.json import to_json
|
|
17
|
-
from ..services.request import
|
|
17
|
+
from ..services.request import (
|
|
18
|
+
make_headers,
|
|
19
|
+
make_url,
|
|
20
|
+
send_delete_request,
|
|
21
|
+
send_get_request,
|
|
22
|
+
send_patch_request,
|
|
23
|
+
send_post_request,
|
|
24
|
+
QueryPairs,
|
|
25
|
+
)
|
|
18
26
|
from ..services.response import (
|
|
19
27
|
get_response_data,
|
|
20
28
|
prepare_object_list_response,
|
|
@@ -40,6 +48,56 @@ class WalletClient(
|
|
|
40
48
|
RESPONSE_MODEL: ClassVar[Type[WalletResponse]] = WalletResponse
|
|
41
49
|
ROOT_NAME: ClassVar[str] = "wallet"
|
|
42
50
|
|
|
51
|
+
def replace_metadata(
|
|
52
|
+
self, resource_id: str, metadata: Dict[str, Optional[str]]
|
|
53
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
54
|
+
api_response: Response = send_post_request(
|
|
55
|
+
url=make_url(
|
|
56
|
+
origin=self.base_url,
|
|
57
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
58
|
+
),
|
|
59
|
+
content=to_json({"metadata": metadata}),
|
|
60
|
+
headers=make_headers(api_key=self.api_key),
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
return get_response_data(response=api_response, key="metadata")
|
|
64
|
+
|
|
65
|
+
def merge_metadata(
|
|
66
|
+
self, resource_id: str, metadata: Dict[str, Optional[str]]
|
|
67
|
+
) -> Optional[Dict[str, Optional[str]]]:
|
|
68
|
+
api_response: Response = send_patch_request(
|
|
69
|
+
url=make_url(
|
|
70
|
+
origin=self.base_url,
|
|
71
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
72
|
+
),
|
|
73
|
+
content=to_json({"metadata": metadata}),
|
|
74
|
+
headers=make_headers(api_key=self.api_key),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
return get_response_data(response=api_response, key="metadata")
|
|
78
|
+
|
|
79
|
+
def delete_all_metadata(self, resource_id: str) -> Optional[Dict[str, Optional[str]]]:
|
|
80
|
+
api_response: Response = send_delete_request(
|
|
81
|
+
url=make_url(
|
|
82
|
+
origin=self.base_url,
|
|
83
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata"),
|
|
84
|
+
),
|
|
85
|
+
headers=make_headers(api_key=self.api_key),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
return get_response_data(response=api_response, key="metadata")
|
|
89
|
+
|
|
90
|
+
def delete_metadata_key(self, resource_id: str, key: str) -> Optional[Dict[str, Optional[str]]]:
|
|
91
|
+
api_response: Response = send_delete_request(
|
|
92
|
+
url=make_url(
|
|
93
|
+
origin=self.base_url,
|
|
94
|
+
path_parts=(self.API_RESOURCE, resource_id, "metadata", key),
|
|
95
|
+
),
|
|
96
|
+
headers=make_headers(api_key=self.api_key),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
return get_response_data(response=api_response, key="metadata")
|
|
100
|
+
|
|
43
101
|
|
|
44
102
|
class WalletTransactionClient(BaseClient):
|
|
45
103
|
API_RESOURCE: ClassVar[str] = "wallet_transactions"
|