lago-python-client 1.9.0__tar.gz → 1.10.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.
Files changed (152) hide show
  1. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/PKG-INFO +1 -1
  2. lago-python-client-1.10.0/lago_python_client/__init__.py +2 -0
  3. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/add_ons/clients.py +9 -3
  4. lago-python-client-1.10.0/lago_python_client/billable_metrics/clients.py +24 -0
  5. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/client.py +3 -3
  6. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/coupons/clients.py +22 -7
  7. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/credit_notes/clients.py +29 -13
  8. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/customers/clients.py +36 -17
  9. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/events/clients.py +18 -11
  10. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/fees/clients.py +8 -3
  11. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/functools_ext.py +10 -5
  12. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/gross_revenues/clients.py +3 -3
  13. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/invoice_collections/clients.py +3 -3
  14. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/invoiced_usages/clients.py +3 -3
  15. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/invoices/clients.py +23 -13
  16. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/mixins.py +55 -16
  17. lago-python-client-1.10.0/lago_python_client/models/__init__.py +84 -0
  18. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/add_on.py +1 -0
  19. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/billable_metric.py +1 -1
  20. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/customer_usage.py +2 -0
  21. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/event.py +2 -0
  22. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/fee.py +2 -1
  23. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/gross_revenue.py +1 -1
  24. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/invoice.py +14 -0
  25. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/invoice_collection.py +1 -1
  26. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/invoiced_usage.py +1 -1
  27. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/minimum_commitment.py +2 -2
  28. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/mrr.py +1 -1
  29. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/overdue_balance.py +2 -2
  30. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/payment_request.py +2 -1
  31. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/plan.py +15 -2
  32. lago-python-client-1.10.0/lago_python_client/models/usage_threshold.py +39 -0
  33. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/mrrs/clients.py +3 -3
  34. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/organizations/clients.py +2 -2
  35. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/overdue_balances/clients.py +11 -5
  36. lago-python-client-1.10.0/lago_python_client/payment_requests/clients.py +14 -0
  37. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/plans/clients.py +9 -3
  38. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/services/json.py +14 -3
  39. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/services/request.py +16 -8
  40. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/services/response.py +13 -14
  41. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/subscriptions/clients.py +9 -3
  42. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/taxes/clients.py +9 -3
  43. lago-python-client-1.10.0/lago_python_client/version.py +1 -0
  44. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/wallets/clients.py +26 -12
  45. lago-python-client-1.10.0/lago_python_client/webhook_endpoints/clients.py +24 -0
  46. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/webhooks/clients.py +12 -7
  47. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client.egg-info/PKG-INFO +1 -1
  48. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client.egg-info/SOURCES.txt +3 -0
  49. lago-python-client-1.10.0/pyproject.toml +10 -0
  50. lago-python-client-1.10.0/tests/__init__.py +0 -0
  51. lago-python-client-1.10.0/tests/test_add_on_client.py +200 -0
  52. lago-python-client-1.10.0/tests/test_applied_coupon_client.py +136 -0
  53. lago-python-client-1.10.0/tests/test_billable_metric_client.py +206 -0
  54. lago-python-client-1.10.0/tests/test_client.py +13 -0
  55. lago-python-client-1.10.0/tests/test_coupon_client.py +201 -0
  56. lago-python-client-1.10.0/tests/test_credit_note_client.py +194 -0
  57. lago-python-client-1.10.0/tests/test_customer_client.py +234 -0
  58. lago-python-client-1.10.0/tests/test_event_client.py +158 -0
  59. lago-python-client-1.10.0/tests/test_fee_client.py +31 -0
  60. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/tests/test_functools_ext.py +3 -1
  61. lago-python-client-1.10.0/tests/test_gross_revenue_client.py +29 -0
  62. lago-python-client-1.10.0/tests/test_invoice_client.py +257 -0
  63. lago-python-client-1.10.0/tests/test_invoice_collection_client.py +30 -0
  64. lago-python-client-1.10.0/tests/test_invoiced_usage_client.py +29 -0
  65. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/tests/test_json_services.py +4 -3
  66. lago-python-client-1.10.0/tests/test_mrr_client.py +28 -0
  67. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/tests/test_organization_client.py +23 -16
  68. lago-python-client-1.10.0/tests/test_overdue_balance_client.py +29 -0
  69. lago-python-client-1.10.0/tests/test_payment_request_client.py +57 -0
  70. lago-python-client-1.10.0/tests/test_plan_client.py +330 -0
  71. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/tests/test_request_services.py +23 -12
  72. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/tests/test_response_services.py +36 -31
  73. lago-python-client-1.10.0/tests/test_subscription_client.py +212 -0
  74. lago-python-client-1.10.0/tests/test_tax_client.py +194 -0
  75. lago-python-client-1.10.0/tests/test_wallet_client.py +207 -0
  76. lago-python-client-1.10.0/tests/test_wallet_transaction_client.py +70 -0
  77. lago-python-client-1.10.0/tests/test_webhook_client.py +42 -0
  78. lago-python-client-1.10.0/tests/test_webhook_endpoint_client.py +170 -0
  79. lago-python-client-1.9.0/lago_python_client/__init__.py +0 -2
  80. lago-python-client-1.9.0/lago_python_client/billable_metrics/clients.py +0 -26
  81. lago-python-client-1.9.0/lago_python_client/models/__init__.py +0 -25
  82. lago-python-client-1.9.0/lago_python_client/version.py +0 -1
  83. lago-python-client-1.9.0/lago_python_client/webhook_endpoints/clients.py +0 -29
  84. lago-python-client-1.9.0/pyproject.toml +0 -6
  85. lago-python-client-1.9.0/tests/test_add_on_client.py +0 -152
  86. lago-python-client-1.9.0/tests/test_applied_coupon_client.py +0 -108
  87. lago-python-client-1.9.0/tests/test_billable_metric_client.py +0 -153
  88. lago-python-client-1.9.0/tests/test_client.py +0 -14
  89. lago-python-client-1.9.0/tests/test_coupon_client.py +0 -152
  90. lago-python-client-1.9.0/tests/test_credit_note_client.py +0 -165
  91. lago-python-client-1.9.0/tests/test_customer_client.py +0 -205
  92. lago-python-client-1.9.0/tests/test_event_client.py +0 -116
  93. lago-python-client-1.9.0/tests/test_fee_client.py +0 -27
  94. lago-python-client-1.9.0/tests/test_gross_revenue_client.py +0 -28
  95. lago-python-client-1.9.0/tests/test_invoice_client.py +0 -195
  96. lago-python-client-1.9.0/tests/test_invoice_collection_client.py +0 -29
  97. lago-python-client-1.9.0/tests/test_invoiced_usage_client.py +0 -28
  98. lago-python-client-1.9.0/tests/test_mrr_client.py +0 -27
  99. lago-python-client-1.9.0/tests/test_overdue_balance_client.py +0 -28
  100. lago-python-client-1.9.0/tests/test_payment_request_client.py +0 -45
  101. lago-python-client-1.9.0/tests/test_plan_client.py +0 -247
  102. lago-python-client-1.9.0/tests/test_subscription_client.py +0 -162
  103. lago-python-client-1.9.0/tests/test_tax_client.py +0 -145
  104. lago-python-client-1.9.0/tests/test_wallet_client.py +0 -158
  105. lago-python-client-1.9.0/tests/test_wallet_transaction_client.py +0 -62
  106. lago-python-client-1.9.0/tests/test_webhook_client.py +0 -33
  107. lago-python-client-1.9.0/tests/test_webhook_endpoint_client.py +0 -127
  108. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/LICENSE +0 -0
  109. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/README.md +0 -0
  110. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/add_ons/__init__.py +0 -0
  111. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/base_client.py +0 -0
  112. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/base_model.py +0 -0
  113. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/billable_metrics/__init__.py +0 -0
  114. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/coupons/__init__.py +0 -0
  115. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/credit_notes/__init__.py +0 -0
  116. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/customers/__init__.py +0 -0
  117. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/events/__init__.py +0 -0
  118. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/exceptions.py +0 -0
  119. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/fees/__init__.py +0 -0
  120. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/gross_revenues/__init__.py +0 -0
  121. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/invoice_collections/__init__.py +0 -0
  122. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/invoiced_usages/__init__.py +0 -0
  123. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/invoices/__init__.py +0 -0
  124. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/applied_coupon.py +0 -0
  125. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/charge.py +0 -0
  126. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/coupon.py +0 -0
  127. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/credit.py +0 -0
  128. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/credit_note.py +0 -0
  129. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/customer.py +0 -0
  130. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/invoice_item.py +0 -0
  131. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/organization.py +0 -0
  132. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/subscription.py +0 -0
  133. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/tax.py +0 -0
  134. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/wallet.py +0 -0
  135. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/wallet_transaction.py +0 -0
  136. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/models/webhook_endpoint.py +0 -0
  137. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/mrrs/__init__.py +0 -0
  138. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/organizations/__init__.py +0 -0
  139. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/overdue_balances/__init__.py +0 -0
  140. {lago-python-client-1.9.0/lago_python_client/plans → lago-python-client-1.10.0/lago_python_client/payment_requests}/__init__.py +0 -0
  141. {lago-python-client-1.9.0/lago_python_client/services → lago-python-client-1.10.0/lago_python_client/plans}/__init__.py +0 -0
  142. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client/py.typed +0 -0
  143. {lago-python-client-1.9.0/lago_python_client/subscriptions → lago-python-client-1.10.0/lago_python_client/services}/__init__.py +0 -0
  144. {lago-python-client-1.9.0/lago_python_client/taxes → lago-python-client-1.10.0/lago_python_client/subscriptions}/__init__.py +0 -0
  145. {lago-python-client-1.9.0/lago_python_client/wallets → lago-python-client-1.10.0/lago_python_client/taxes}/__init__.py +0 -0
  146. {lago-python-client-1.9.0/lago_python_client/webhook_endpoints → lago-python-client-1.10.0/lago_python_client/wallets}/__init__.py +0 -0
  147. {lago-python-client-1.9.0/lago_python_client/webhooks → lago-python-client-1.10.0/lago_python_client/webhook_endpoints}/__init__.py +0 -0
  148. {lago-python-client-1.9.0/tests → lago-python-client-1.10.0/lago_python_client/webhooks}/__init__.py +0 -0
  149. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
  150. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client.egg-info/requires.txt +0 -0
  151. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/lago_python_client.egg-info/top_level.txt +0 -0
  152. {lago-python-client-1.9.0 → lago-python-client-1.10.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lago-python-client
3
- Version: 1.9.0
3
+ Version: 1.10.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -0,0 +1,2 @@
1
+ from lago_python_client.client import Client as Client
2
+ from lago_python_client.version import LAGO_VERSION as LAGO_VERSION
@@ -1,7 +1,13 @@
1
1
  from typing import ClassVar, Type
2
2
 
3
3
  from ..base_client import BaseClient
4
- from ..mixins import CreateCommandMixin, DestroyCommandMixin, FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin
4
+ from ..mixins import (
5
+ CreateCommandMixin,
6
+ DestroyCommandMixin,
7
+ FindAllCommandMixin,
8
+ FindCommandMixin,
9
+ UpdateCommandMixin,
10
+ )
5
11
  from ..models.add_on import AddOnResponse
6
12
 
7
13
 
@@ -13,6 +19,6 @@ class AddOnClient(
13
19
  UpdateCommandMixin[AddOnResponse],
14
20
  BaseClient,
15
21
  ):
16
- API_RESOURCE: ClassVar[str] = 'add_ons'
22
+ API_RESOURCE: ClassVar[str] = "add_ons"
17
23
  RESPONSE_MODEL: ClassVar[Type[AddOnResponse]] = AddOnResponse
18
- ROOT_NAME: ClassVar[str] = 'add_on'
24
+ ROOT_NAME: ClassVar[str] = "add_on"
@@ -0,0 +1,24 @@
1
+ from typing import ClassVar, 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.billable_metric import BillableMetricResponse
12
+
13
+
14
+ class BillableMetricClient(
15
+ CreateCommandMixin[BillableMetricResponse],
16
+ DestroyCommandMixin[BillableMetricResponse],
17
+ FindAllCommandMixin[BillableMetricResponse],
18
+ FindCommandMixin[BillableMetricResponse],
19
+ UpdateCommandMixin[BillableMetricResponse],
20
+ BaseClient,
21
+ ):
22
+ API_RESOURCE: ClassVar[str] = "billable_metrics"
23
+ RESPONSE_MODEL: ClassVar[Type[BillableMetricResponse]] = BillableMetricResponse
24
+ ROOT_NAME: ClassVar[str] = "billable_metric"
@@ -30,10 +30,10 @@ except ImportError: # Python 3.7
30
30
 
31
31
 
32
32
  class Client:
33
- BASE_URL: Final[str] = 'https://api.getlago.com/'
34
- API_PATH: Final[str] = 'api/v1/'
33
+ BASE_URL: Final[str] = "https://api.getlago.com/"
34
+ API_PATH: Final[str] = "api/v1/"
35
35
 
36
- def __init__(self, api_key: str = '', api_url: str = '') -> None:
36
+ def __init__(self, api_key: str = "", api_url: str = "") -> None:
37
37
  self.api_key: str = api_key
38
38
  self.api_url: str = api_url
39
39
 
@@ -1,7 +1,13 @@
1
1
  from typing import ClassVar, Type
2
2
 
3
3
  from ..base_client import BaseClient
4
- from ..mixins import CreateCommandMixin, DestroyCommandMixin, FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin
4
+ from ..mixins import (
5
+ CreateCommandMixin,
6
+ DestroyCommandMixin,
7
+ FindAllCommandMixin,
8
+ FindCommandMixin,
9
+ UpdateCommandMixin,
10
+ )
5
11
  from ..models.coupon import CouponResponse
6
12
  from ..models.applied_coupon import AppliedCouponResponse
7
13
  from ..services.request import make_headers, make_url, send_delete_request
@@ -16,21 +22,30 @@ class CouponClient(
16
22
  UpdateCommandMixin[CouponResponse],
17
23
  BaseClient,
18
24
  ):
19
- API_RESOURCE: ClassVar[str] = 'coupons'
25
+ API_RESOURCE: ClassVar[str] = "coupons"
20
26
  RESPONSE_MODEL: ClassVar[Type[CouponResponse]] = CouponResponse
21
- ROOT_NAME: ClassVar[str] = 'coupon'
27
+ ROOT_NAME: ClassVar[str] = "coupon"
22
28
 
23
29
 
24
- class AppliedCouponClient(CreateCommandMixin[AppliedCouponResponse], FindAllCommandMixin[AppliedCouponResponse], BaseClient):
25
- API_RESOURCE: ClassVar[str] = 'applied_coupons'
30
+ class AppliedCouponClient(
31
+ CreateCommandMixin[AppliedCouponResponse],
32
+ FindAllCommandMixin[AppliedCouponResponse],
33
+ BaseClient,
34
+ ):
35
+ API_RESOURCE: ClassVar[str] = "applied_coupons"
26
36
  RESPONSE_MODEL: ClassVar[Type[AppliedCouponResponse]] = AppliedCouponResponse
27
- ROOT_NAME: ClassVar[str] = 'applied_coupon'
37
+ ROOT_NAME: ClassVar[str] = "applied_coupon"
28
38
 
29
39
  def destroy(self, external_customer_id: str, applied_coupon_id: str) -> AppliedCouponResponse:
30
40
  api_response: Response = send_delete_request(
31
41
  url=make_url(
32
42
  origin=self.base_url,
33
- path_parts=('customers', external_customer_id, self.API_RESOURCE, applied_coupon_id),
43
+ path_parts=(
44
+ "customers",
45
+ external_customer_id,
46
+ self.API_RESOURCE,
47
+ applied_coupon_id,
48
+ ),
34
49
  ),
35
50
  headers=make_headers(api_key=self.api_key),
36
51
  )
@@ -1,10 +1,24 @@
1
- from typing import ClassVar, Optional, Type, Union
1
+ from typing import ClassVar, Optional, Type
2
2
 
3
3
  from ..base_client import BaseClient
4
- from ..mixins import CreateCommandMixin, FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin
5
- from ..models.credit_note import CreditNoteResponse, CreditNoteEstimatedResponse, CreditNoteEstimate
4
+ from ..mixins import (
5
+ CreateCommandMixin,
6
+ FindAllCommandMixin,
7
+ FindCommandMixin,
8
+ UpdateCommandMixin,
9
+ )
10
+ from ..models.credit_note import (
11
+ CreditNoteResponse,
12
+ CreditNoteEstimatedResponse,
13
+ CreditNoteEstimate,
14
+ )
6
15
  from ..services.json import to_json
7
- from ..services.request import make_headers, make_url, send_post_request, send_put_request
16
+ from ..services.request import (
17
+ make_headers,
18
+ make_url,
19
+ send_post_request,
20
+ send_put_request,
21
+ )
8
22
  from ..services.response import get_response_data, prepare_object_response, Response
9
23
 
10
24
 
@@ -15,16 +29,16 @@ class CreditNoteClient(
15
29
  UpdateCommandMixin[CreditNoteResponse],
16
30
  BaseClient,
17
31
  ):
18
- API_RESOURCE: ClassVar[str] = 'credit_notes'
19
- ESTIMATE_API_RESOURCE: ClassVar[str] = 'estimated_credit_note'
32
+ API_RESOURCE: ClassVar[str] = "credit_notes"
33
+ ESTIMATE_API_RESOURCE: ClassVar[str] = "estimated_credit_note"
20
34
  RESPONSE_MODEL: ClassVar[Type[CreditNoteResponse]] = CreditNoteResponse
21
- ROOT_NAME: ClassVar[str] = 'credit_note'
35
+ ROOT_NAME: ClassVar[str] = "credit_note"
22
36
 
23
37
  def download(self, resource_id: str) -> Optional[CreditNoteResponse]:
24
38
  api_response: Response = send_post_request(
25
39
  url=make_url(
26
40
  origin=self.base_url,
27
- path_parts=(self.API_RESOURCE, resource_id, 'download'),
41
+ path_parts=(self.API_RESOURCE, resource_id, "download"),
28
42
  ),
29
43
  headers=make_headers(api_key=self.api_key),
30
44
  )
@@ -42,7 +56,7 @@ class CreditNoteClient(
42
56
  api_response: Response = send_put_request(
43
57
  url=make_url(
44
58
  origin=self.base_url,
45
- path_parts=(self.API_RESOURCE, resource_id, 'void'),
59
+ path_parts=(self.API_RESOURCE, resource_id, "void"),
46
60
  ),
47
61
  headers=make_headers(api_key=self.api_key),
48
62
  )
@@ -56,11 +70,13 @@ class CreditNoteClient(
56
70
  api_response: Response = send_post_request(
57
71
  url=make_url(
58
72
  origin=self.base_url,
59
- path_parts=(self.API_RESOURCE, 'estimate'),
73
+ path_parts=(self.API_RESOURCE, "estimate"),
74
+ ),
75
+ content=to_json(
76
+ {
77
+ self.ROOT_NAME: input_object.dict(),
78
+ }
60
79
  ),
61
- content=to_json({
62
- self.ROOT_NAME: input_object.dict(),
63
- }),
64
80
  headers=make_headers(api_key=self.api_key),
65
81
  )
66
82
 
@@ -2,11 +2,26 @@ import sys
2
2
  from typing import Any, Mapping, ClassVar, Type, Union
3
3
 
4
4
  from ..base_client import BaseClient
5
- from ..mixins import CreateCommandMixin, DestroyCommandMixin, FindAllCommandMixin, FindCommandMixin
5
+ from ..mixins import (
6
+ CreateCommandMixin,
7
+ DestroyCommandMixin,
8
+ FindAllCommandMixin,
9
+ FindCommandMixin,
10
+ )
6
11
  from ..models.customer import CustomerResponse
7
12
  from ..models.customer_usage import CustomerUsageResponse
8
- from ..services.request import make_headers, make_url, send_get_request, send_post_request
9
- from ..services.response import get_response_data, prepare_index_response, prepare_object_response, Response
13
+ from ..services.request import (
14
+ make_headers,
15
+ make_url,
16
+ send_get_request,
17
+ send_post_request,
18
+ )
19
+ from ..services.response import (
20
+ get_response_data,
21
+ prepare_index_response,
22
+ prepare_object_response,
23
+ Response,
24
+ )
10
25
 
11
26
  if sys.version_info >= (3, 9):
12
27
  from collections.abc import Mapping
@@ -21,17 +36,17 @@ class CustomerClient(
21
36
  FindCommandMixin[CustomerResponse],
22
37
  BaseClient,
23
38
  ):
24
- API_RESOURCE: ClassVar[str] = 'customers'
39
+ API_RESOURCE: ClassVar[str] = "customers"
25
40
  RESPONSE_MODEL: ClassVar[Type[CustomerResponse]] = CustomerResponse
26
- ROOT_NAME: ClassVar[str] = 'customer'
41
+ ROOT_NAME: ClassVar[str] = "customer"
27
42
 
28
43
  def current_usage(self, resource_id: str, external_subscription_id: str) -> CustomerUsageResponse:
29
44
  api_response: Response = send_get_request(
30
45
  url=make_url(
31
46
  origin=self.base_url,
32
- path_parts=(self.API_RESOURCE, resource_id, 'current_usage'),
47
+ path_parts=(self.API_RESOURCE, resource_id, "current_usage"),
33
48
  query_pairs={
34
- 'external_subscription_id': external_subscription_id,
49
+ "external_subscription_id": external_subscription_id,
35
50
  },
36
51
  ),
37
52
  headers=make_headers(api_key=self.api_key),
@@ -39,16 +54,21 @@ class CustomerClient(
39
54
 
40
55
  return prepare_object_response(
41
56
  response_model=CustomerUsageResponse,
42
- data=get_response_data(response=api_response, key='customer_usage'),
57
+ data=get_response_data(response=api_response, key="customer_usage"),
43
58
  )
44
59
 
45
- def past_usage(self, resource_id: str, external_subscription_id: str, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
60
+ def past_usage(
61
+ self,
62
+ resource_id: str,
63
+ external_subscription_id: str,
64
+ options: Mapping[str, Union[int, str]] = {},
65
+ ) -> Mapping[str, Any]:
46
66
  api_response: Response = send_get_request(
47
67
  url=make_url(
48
68
  origin=self.base_url,
49
- path_parts=(self.API_RESOURCE, resource_id, 'past_usage'),
69
+ path_parts=(self.API_RESOURCE, resource_id, "past_usage"),
50
70
  query_pairs={
51
- 'external_subscription_id': external_subscription_id,
71
+ "external_subscription_id": external_subscription_id,
52
72
  **options,
53
73
  },
54
74
  ),
@@ -56,32 +76,31 @@ class CustomerClient(
56
76
  )
57
77
 
58
78
  return prepare_index_response(
59
- api_resource='usage_periods',
79
+ api_resource="usage_periods",
60
80
  response_model=CustomerUsageResponse,
61
81
  data=get_response_data(response=api_response),
62
82
  )
63
83
 
64
-
65
84
  def portal_url(self, resource_id: str) -> str:
66
85
  api_response: Response = send_get_request(
67
86
  url=make_url(
68
87
  origin=self.base_url,
69
- path_parts=(self.API_RESOURCE, resource_id, 'portal_url'),
88
+ path_parts=(self.API_RESOURCE, resource_id, "portal_url"),
70
89
  ),
71
90
  headers=make_headers(api_key=self.api_key),
72
91
  )
73
92
 
74
93
  response_data = get_response_data(response=api_response, key=self.ROOT_NAME)
75
- return response_data.get('portal_url', '') if isinstance(response_data, Mapping) else ''
94
+ return response_data.get("portal_url", "") if isinstance(response_data, Mapping) else ""
76
95
 
77
96
  def checkout_url(self, resource_id: str) -> str:
78
97
  api_response: Response = send_post_request(
79
98
  url=make_url(
80
99
  origin=self.base_url,
81
- path_parts=(self.API_RESOURCE, resource_id, 'checkout_url'),
100
+ path_parts=(self.API_RESOURCE, resource_id, "checkout_url"),
82
101
  ),
83
102
  headers=make_headers(api_key=self.api_key),
84
103
  )
85
104
 
86
105
  response_data = get_response_data(response=api_response, key=self.ROOT_NAME)
87
- return response_data.get('checkout_url', '') if isinstance(response_data, Mapping) else ''
106
+ return response_data.get("checkout_url", "") if isinstance(response_data, Mapping) else ""
@@ -1,5 +1,5 @@
1
1
  import sys
2
- from typing import Any, ClassVar, Optional, Type
2
+ from typing import Any, ClassVar, Type
3
3
 
4
4
  from lago_python_client.base_model import BaseModel
5
5
 
@@ -10,7 +10,12 @@ from ..models.event import EventResponse
10
10
  from ..models.fee import FeeResponse
11
11
  from ..services.json import to_json
12
12
  from ..services.request import make_headers, make_url, send_post_request
13
- from ..services.response import get_response_data, prepare_object_list_response, verify_response, Response
13
+ from ..services.response import (
14
+ get_response_data,
15
+ prepare_object_list_response,
16
+ verify_response,
17
+ Response,
18
+ )
14
19
 
15
20
  if sys.version_info >= (3, 9):
16
21
  from collections.abc import Mapping
@@ -19,15 +24,15 @@ else:
19
24
 
20
25
 
21
26
  class EventClient(CreateCommandMixin[EventResponse], FindCommandMixin[EventResponse], BaseClient):
22
- API_RESOURCE: ClassVar[str] = 'events'
27
+ API_RESOURCE: ClassVar[str] = "events"
23
28
  RESPONSE_MODEL: ClassVar[Type[EventResponse]] = EventResponse
24
- ROOT_NAME: ClassVar[str] = 'event'
29
+ ROOT_NAME: ClassVar[str] = "event"
25
30
 
26
31
  def batch_create(self, input_object: BaseModel) -> None:
27
32
  api_response: Response = send_post_request(
28
33
  url=make_url(
29
34
  origin=self.base_url,
30
- path_parts=(self.API_RESOURCE, 'batch'),
35
+ path_parts=(self.API_RESOURCE, "batch"),
31
36
  ),
32
37
  content=to_json(input_object.dict()),
33
38
  headers=make_headers(api_key=self.api_key),
@@ -38,18 +43,20 @@ class EventClient(CreateCommandMixin[EventResponse], FindCommandMixin[EventRespo
38
43
 
39
44
  def estimate_fees(self, input_object: BaseModel) -> Mapping[str, Any]:
40
45
  api_response: Response = send_post_request(
41
- url= make_url(
46
+ url=make_url(
42
47
  origin=self.base_url,
43
- path_parts=(self.API_RESOURCE, 'estimate_fees'),
48
+ path_parts=(self.API_RESOURCE, "estimate_fees"),
49
+ ),
50
+ content=to_json(
51
+ {
52
+ self.ROOT_NAME: input_object.dict(),
53
+ }
44
54
  ),
45
- content=to_json({
46
- self.ROOT_NAME: input_object.dict(),
47
- }),
48
55
  headers=make_headers(api_key=self.api_key),
49
56
  )
50
57
 
51
58
  return prepare_object_list_response(
52
59
  api_resource=FeeClient.API_RESOURCE,
53
60
  response_model=FeeResponse,
54
- data=get_response_data(response=api_response, key='fees'),
61
+ data=get_response_data(response=api_response, key="fees"),
55
62
  )
@@ -1,7 +1,12 @@
1
1
  from typing import ClassVar, Type
2
2
 
3
3
  from ..base_client import BaseClient
4
- from ..mixins import FindCommandMixin, FindAllCommandMixin, UpdateCommandMixin, DestroyCommandMixin
4
+ from ..mixins import (
5
+ FindCommandMixin,
6
+ FindAllCommandMixin,
7
+ UpdateCommandMixin,
8
+ DestroyCommandMixin,
9
+ )
5
10
  from ..models.fee import FeeResponse
6
11
 
7
12
 
@@ -12,6 +17,6 @@ class FeeClient(
12
17
  DestroyCommandMixin[FeeResponse],
13
18
  BaseClient,
14
19
  ):
15
- API_RESOURCE: ClassVar[str] = 'fees'
20
+ API_RESOURCE: ClassVar[str] = "fees"
16
21
  RESPONSE_MODEL: ClassVar[Type[FeeResponse]] = FeeResponse
17
- ROOT_NAME: ClassVar[str] = 'fee'
22
+ ROOT_NAME: ClassVar[str] = "fee"
@@ -1,6 +1,7 @@
1
1
  import sys
2
2
  from typing import Any, TypeVar
3
3
  import warnings
4
+
4
5
  try:
5
6
  from functools import cached_property
6
7
  except ImportError:
@@ -30,11 +31,13 @@ class Proxy(object):
30
31
 
31
32
  def __call__(self) -> Any:
32
33
  warnings.warn(
33
- ''.join((
34
- 'We are going to deprecate callable properties (`client.<your_tag_name>()`) in future. ',
35
- 'Please, remove braces. ',
36
- 'Use `client.<your_tag_name>.<your_operation_name>(...)` instead of `client.<your_tag_name>().<your_operation_name>(...)`',
37
- )),
34
+ "".join(
35
+ (
36
+ "We are going to deprecate callable properties (`client.<your_tag_name>()`) in future. ",
37
+ "Please, remove braces. ",
38
+ "Use `client.<your_tag_name>.<your_operation_name>(...)` instead of `client.<your_tag_name>().<your_operation_name>(...)`",
39
+ )
40
+ ),
38
41
  PendingDeprecationWarning,
39
42
  )
40
43
  return self._obj
@@ -53,8 +56,10 @@ class Proxy(object):
53
56
 
54
57
 
55
58
  if sys.version_info >= (3, 9):
59
+
56
60
  def callable_cached_property(func: Callable[P, T]) -> cached_property[T]:
57
61
  return cached_property(lambda s: Proxy(func(s))) # type: ignore
58
62
  else:
63
+
59
64
  def callable_cached_property(func):
60
65
  return cached_property(lambda s: Proxy(func(s)))
@@ -17,15 +17,15 @@ class GrossRevenueClient(
17
17
  FindAllCommandMixin[GrossRevenueResponse],
18
18
  BaseClient,
19
19
  ):
20
- API_RESOURCE: ClassVar[str] = 'gross_revenues'
20
+ API_RESOURCE: ClassVar[str] = "gross_revenues"
21
21
  RESPONSE_MODEL: ClassVar[Type[GrossRevenueResponse]] = GrossRevenueResponse
22
- ROOT_NAME: ClassVar[str] = 'gross_revenue'
22
+ ROOT_NAME: ClassVar[str] = "gross_revenue"
23
23
 
24
24
  def find_all(self, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
25
25
  api_response: Response = send_get_request(
26
26
  url=make_url(
27
27
  origin=self.base_url,
28
- path_parts=('analytics', 'gross_revenue'),
28
+ path_parts=("analytics", "gross_revenue"),
29
29
  query_pairs=options,
30
30
  ),
31
31
  headers=make_headers(api_key=self.api_key),
@@ -17,15 +17,15 @@ class InvoiceCollectionClient(
17
17
  FindAllCommandMixin[InvoiceCollectionResponse],
18
18
  BaseClient,
19
19
  ):
20
- API_RESOURCE: ClassVar[str] = 'invoice_collections'
20
+ API_RESOURCE: ClassVar[str] = "invoice_collections"
21
21
  RESPONSE_MODEL: ClassVar[Type[InvoiceCollectionResponse]] = InvoiceCollectionResponse
22
- ROOT_NAME: ClassVar[str] = 'invoice_collection'
22
+ ROOT_NAME: ClassVar[str] = "invoice_collection"
23
23
 
24
24
  def find_all(self, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
25
25
  api_response: Response = send_get_request(
26
26
  url=make_url(
27
27
  origin=self.base_url,
28
- path_parts=('analytics', 'invoice_collection'),
28
+ path_parts=("analytics", "invoice_collection"),
29
29
  query_pairs=options,
30
30
  ),
31
31
  headers=make_headers(api_key=self.api_key),
@@ -17,15 +17,15 @@ class InvoicedUsageClient(
17
17
  FindAllCommandMixin[InvoicedUsageResponse],
18
18
  BaseClient,
19
19
  ):
20
- API_RESOURCE: ClassVar[str] = 'invoiced_usages'
20
+ API_RESOURCE: ClassVar[str] = "invoiced_usages"
21
21
  RESPONSE_MODEL: ClassVar[Type[InvoicedUsageResponse]] = InvoicedUsageResponse
22
- ROOT_NAME: ClassVar[str] = 'invoiced_usage'
22
+ ROOT_NAME: ClassVar[str] = "invoiced_usage"
23
23
 
24
24
  def find_all(self, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
25
25
  api_response: Response = send_get_request(
26
26
  url=make_url(
27
27
  origin=self.base_url,
28
- path_parts=('analytics', 'invoiced_usage'),
28
+ path_parts=("analytics", "invoiced_usage"),
29
29
  query_pairs=options,
30
30
  ),
31
31
  headers=make_headers(api_key=self.api_key),
@@ -1,9 +1,19 @@
1
- from typing import ClassVar, Optional, Type, Union, Mapping
1
+ from typing import ClassVar, Optional, Type, Mapping
2
2
 
3
3
  from ..base_client import BaseClient
4
- from ..mixins import FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin, CreateCommandMixin
4
+ from ..mixins import (
5
+ FindAllCommandMixin,
6
+ FindCommandMixin,
7
+ UpdateCommandMixin,
8
+ CreateCommandMixin,
9
+ )
5
10
  from ..models.invoice import InvoiceResponse
6
- from ..services.request import make_headers, make_url, send_post_request, send_put_request
11
+ from ..services.request import (
12
+ make_headers,
13
+ make_url,
14
+ send_post_request,
15
+ send_put_request,
16
+ )
7
17
  from ..services.response import get_response_data, prepare_object_response, Response
8
18
 
9
19
 
@@ -14,15 +24,15 @@ class InvoiceClient(
14
24
  CreateCommandMixin[InvoiceResponse],
15
25
  BaseClient,
16
26
  ):
17
- API_RESOURCE: ClassVar[str] = 'invoices'
27
+ API_RESOURCE: ClassVar[str] = "invoices"
18
28
  RESPONSE_MODEL: ClassVar[Type[InvoiceResponse]] = InvoiceResponse
19
- ROOT_NAME: ClassVar[str] = 'invoice'
29
+ ROOT_NAME: ClassVar[str] = "invoice"
20
30
 
21
31
  def download(self, resource_id: str) -> Optional[InvoiceResponse]:
22
32
  api_response: Response = send_post_request(
23
33
  url=make_url(
24
34
  origin=self.base_url,
25
- path_parts=(self.API_RESOURCE, resource_id, 'download'),
35
+ path_parts=(self.API_RESOURCE, resource_id, "download"),
26
36
  ),
27
37
  headers=make_headers(api_key=self.api_key),
28
38
  )
@@ -40,7 +50,7 @@ class InvoiceClient(
40
50
  api_response: Response = send_post_request(
41
51
  url=make_url(
42
52
  origin=self.base_url,
43
- path_parts=(self.API_RESOURCE, resource_id, 'retry_payment'),
53
+ path_parts=(self.API_RESOURCE, resource_id, "retry_payment"),
44
54
  ),
45
55
  headers=make_headers(api_key=self.api_key),
46
56
  )
@@ -58,7 +68,7 @@ class InvoiceClient(
58
68
  api_response: Response = send_put_request(
59
69
  url=make_url(
60
70
  origin=self.base_url,
61
- path_parts=(self.API_RESOURCE, resource_id, 'refresh'),
71
+ path_parts=(self.API_RESOURCE, resource_id, "refresh"),
62
72
  ),
63
73
  headers=make_headers(api_key=self.api_key),
64
74
  )
@@ -72,7 +82,7 @@ class InvoiceClient(
72
82
  api_response: Response = send_put_request(
73
83
  url=make_url(
74
84
  origin=self.base_url,
75
- path_parts=(self.API_RESOURCE, resource_id, 'finalize'),
85
+ path_parts=(self.API_RESOURCE, resource_id, "finalize"),
76
86
  ),
77
87
  headers=make_headers(api_key=self.api_key),
78
88
  )
@@ -86,7 +96,7 @@ class InvoiceClient(
86
96
  api_response: Response = send_put_request(
87
97
  url=make_url(
88
98
  origin=self.base_url,
89
- path_parts=(self.API_RESOURCE, resource_id, 'lose_dispute'),
99
+ path_parts=(self.API_RESOURCE, resource_id, "lose_dispute"),
90
100
  ),
91
101
  headers=make_headers(api_key=self.api_key),
92
102
  )
@@ -100,10 +110,10 @@ class InvoiceClient(
100
110
  api_response: Response = send_post_request(
101
111
  url=make_url(
102
112
  origin=self.base_url,
103
- path_parts=(self.API_RESOURCE, resource_id, 'payment_url'),
113
+ path_parts=(self.API_RESOURCE, resource_id, "payment_url"),
104
114
  ),
105
115
  headers=make_headers(api_key=self.api_key),
106
116
  )
107
117
 
108
- response_data = get_response_data(response=api_response, key='invoice_payment_details')
109
- return response_data.get('payment_url', '') if isinstance(response_data, Mapping) else ''
118
+ response_data = get_response_data(response=api_response, key="invoice_payment_details")
119
+ return response_data.get("payment_url", "") if isinstance(response_data, Mapping) else ""