lago-python-client 1.6.0__tar.gz → 1.7.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 (121) hide show
  1. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/PKG-INFO +1 -1
  2. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/billable_metrics/clients.py +0 -23
  3. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/client.py +6 -5
  4. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/__init__.py +2 -2
  5. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/applied_coupon.py +1 -1
  6. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/billable_metric.py +0 -7
  7. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/charge.py +0 -13
  8. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/credit.py +1 -1
  9. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/customer.py +11 -0
  10. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/customer_usage.py +0 -9
  11. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/event.py +2 -4
  12. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/fee.py +0 -1
  13. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/gross_revenue.py +1 -0
  14. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/invoice_item.py +0 -2
  15. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/organization.py +0 -1
  16. lago-python-client-1.7.0/lago_python_client/models/overdue_balance.py +14 -0
  17. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/subscription.py +2 -2
  18. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/wallet.py +0 -1
  19. lago-python-client-1.7.0/lago_python_client/overdue_balances/clients.py +39 -0
  20. lago-python-client-1.7.0/lago_python_client/version.py +1 -0
  21. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client.egg-info/PKG-INFO +1 -1
  22. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client.egg-info/SOURCES.txt +5 -3
  23. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client.egg-info/requires.txt +1 -1
  24. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/setup.cfg +1 -1
  25. lago-python-client-1.7.0/tests/__init__.py +0 -0
  26. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_billable_metric_client.py +5 -5
  27. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_customer_client.py +17 -4
  28. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_event_client.py +3 -3
  29. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_gross_revenue_client.py +1 -0
  30. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_organization_client.py +0 -1
  31. lago-python-client-1.7.0/tests/test_overdue_balance_client.py +28 -0
  32. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_plan_client.py +7 -6
  33. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_subscription_client.py +3 -3
  34. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_wallet_transaction_client.py +1 -1
  35. lago-python-client-1.6.0/lago_python_client/models/group.py +0 -17
  36. lago-python-client-1.6.0/lago_python_client/version.py +0 -1
  37. lago-python-client-1.6.0/tests/test_group_client.py +0 -27
  38. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/LICENSE +0 -0
  39. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/README.md +0 -0
  40. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/__init__.py +0 -0
  41. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/add_ons/__init__.py +0 -0
  42. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/add_ons/clients.py +0 -0
  43. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/base_client.py +0 -0
  44. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/base_model.py +0 -0
  45. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/billable_metrics/__init__.py +0 -0
  46. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/coupons/__init__.py +0 -0
  47. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/coupons/clients.py +0 -0
  48. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/credit_notes/__init__.py +0 -0
  49. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/credit_notes/clients.py +0 -0
  50. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/customers/__init__.py +0 -0
  51. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/customers/clients.py +0 -0
  52. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/events/__init__.py +0 -0
  53. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/events/clients.py +0 -0
  54. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/exceptions.py +0 -0
  55. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/fees/__init__.py +0 -0
  56. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/fees/clients.py +0 -0
  57. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/functools_ext.py +0 -0
  58. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/gross_revenues/__init__.py +0 -0
  59. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/gross_revenues/clients.py +0 -0
  60. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/invoice_collections/__init__.py +0 -0
  61. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/invoice_collections/clients.py +0 -0
  62. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/invoiced_usages/__init__.py +0 -0
  63. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/invoiced_usages/clients.py +0 -0
  64. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/invoices/__init__.py +0 -0
  65. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/invoices/clients.py +0 -0
  66. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/mixins.py +0 -0
  67. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/add_on.py +0 -0
  68. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/coupon.py +0 -0
  69. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/credit_note.py +0 -0
  70. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/invoice.py +0 -0
  71. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/invoice_collection.py +0 -0
  72. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/invoiced_usage.py +0 -0
  73. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/minimum_commitment.py +0 -0
  74. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/mrr.py +0 -0
  75. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/plan.py +0 -0
  76. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/tax.py +0 -0
  77. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/wallet_transaction.py +0 -0
  78. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/models/webhook_endpoint.py +0 -0
  79. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/mrrs/__init__.py +0 -0
  80. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/mrrs/clients.py +0 -0
  81. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/organizations/__init__.py +0 -0
  82. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/organizations/clients.py +0 -0
  83. {lago-python-client-1.6.0/lago_python_client/plans → lago-python-client-1.7.0/lago_python_client/overdue_balances}/__init__.py +0 -0
  84. {lago-python-client-1.6.0/lago_python_client/services → lago-python-client-1.7.0/lago_python_client/plans}/__init__.py +0 -0
  85. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/plans/clients.py +0 -0
  86. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/py.typed +0 -0
  87. {lago-python-client-1.6.0/lago_python_client/subscriptions → lago-python-client-1.7.0/lago_python_client/services}/__init__.py +0 -0
  88. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/services/json.py +0 -0
  89. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/services/request.py +0 -0
  90. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/services/response.py +0 -0
  91. {lago-python-client-1.6.0/lago_python_client/taxes → lago-python-client-1.7.0/lago_python_client/subscriptions}/__init__.py +0 -0
  92. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/subscriptions/clients.py +0 -0
  93. {lago-python-client-1.6.0/lago_python_client/wallets → lago-python-client-1.7.0/lago_python_client/taxes}/__init__.py +0 -0
  94. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/taxes/clients.py +0 -0
  95. {lago-python-client-1.6.0/lago_python_client/webhook_endpoints → lago-python-client-1.7.0/lago_python_client/wallets}/__init__.py +0 -0
  96. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/wallets/clients.py +0 -0
  97. {lago-python-client-1.6.0/lago_python_client/webhooks → lago-python-client-1.7.0/lago_python_client/webhook_endpoints}/__init__.py +0 -0
  98. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/webhook_endpoints/clients.py +0 -0
  99. {lago-python-client-1.6.0/tests → lago-python-client-1.7.0/lago_python_client/webhooks}/__init__.py +0 -0
  100. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client/webhooks/clients.py +0 -0
  101. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client.egg-info/dependency_links.txt +0 -0
  102. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/lago_python_client.egg-info/top_level.txt +0 -0
  103. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/pyproject.toml +0 -0
  104. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_add_on_client.py +0 -0
  105. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_applied_coupon_client.py +0 -0
  106. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_client.py +0 -0
  107. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_coupon_client.py +0 -0
  108. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_credit_note_client.py +0 -0
  109. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_fee_client.py +0 -0
  110. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_functools_ext.py +0 -0
  111. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_invoice_client.py +0 -0
  112. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_invoice_collection_client.py +0 -0
  113. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_invoiced_usage_client.py +0 -0
  114. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_json_services.py +0 -0
  115. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_mrr_client.py +0 -0
  116. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_request_services.py +0 -0
  117. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_response_services.py +0 -0
  118. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_tax_client.py +0 -0
  119. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_wallet_client.py +0 -0
  120. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_webhook_client.py +0 -0
  121. {lago-python-client-1.6.0 → lago-python-client-1.7.0}/tests/test_webhook_endpoint_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lago-python-client
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -4,7 +4,6 @@ from typing import Any, ClassVar, Type, Union
4
4
  from ..base_client import BaseClient
5
5
  from ..mixins import CreateCommandMixin, DestroyCommandMixin, FindAllCommandMixin, FindCommandMixin, UpdateCommandMixin
6
6
  from ..models.billable_metric import BillableMetricResponse
7
- from ..models.group import GroupResponse
8
7
  from ..services.request import make_headers, make_url, send_get_request
9
8
  from ..services.response import get_response_data, prepare_index_response, Response
10
9
 
@@ -25,25 +24,3 @@ class BillableMetricClient(
25
24
  API_RESOURCE: ClassVar[str] = 'billable_metrics'
26
25
  RESPONSE_MODEL: ClassVar[Type[BillableMetricResponse]] = BillableMetricResponse
27
26
  ROOT_NAME: ClassVar[str] = 'billable_metric'
28
-
29
-
30
- class GroupClient(BaseClient):
31
- API_RESOURCE: ClassVar[str] = 'groups'
32
- RESPONSE_MODEL: ClassVar[Type[GroupResponse]] = GroupResponse
33
- ROOT_NAME: ClassVar[str] = 'group'
34
-
35
- def find_all(self, metric_code: str, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
36
- api_response: Response = send_get_request(
37
- url=make_url(
38
- origin=self.base_url,
39
- path_parts=('billable_metrics', metric_code, self.API_RESOURCE),
40
- query_pairs=options,
41
- ),
42
- headers=make_headers(api_key=self.api_key),
43
- )
44
-
45
- return prepare_index_response(
46
- api_resource=self.API_RESOURCE,
47
- response_model=self.RESPONSE_MODEL,
48
- data=get_response_data(response=api_response),
49
- )
@@ -1,7 +1,7 @@
1
1
  from urllib.parse import urljoin
2
2
 
3
3
  from .add_ons.clients import AddOnClient
4
- from .billable_metrics.clients import BillableMetricClient, GroupClient
4
+ from .billable_metrics.clients import BillableMetricClient
5
5
  from .coupons.clients import AppliedCouponClient, CouponClient
6
6
  from .credit_notes.clients import CreditNoteClient
7
7
  from .customers.clients import CustomerClient
@@ -13,6 +13,7 @@ from .invoices.clients import InvoiceClient
13
13
  from .invoiced_usages.clients import InvoicedUsageClient
14
14
  from .mrrs.clients import MrrClient
15
15
  from .organizations.clients import OrganizationClient
16
+ from .overdue_balances.clients import OverdueBalanceClient
16
17
  from .invoice_collections.clients import InvoiceCollectionClient
17
18
  from .plans.clients import PlanClient
18
19
  from .subscriptions.clients import SubscriptionClient
@@ -47,10 +48,6 @@ class Client:
47
48
  def billable_metrics(self) -> BillableMetricClient:
48
49
  return BillableMetricClient(self.base_api_url, self.api_key)
49
50
 
50
- @callable_cached_property
51
- def groups(self) -> GroupClient:
52
- return GroupClient(self.base_api_url, self.api_key)
53
-
54
51
  @callable_cached_property
55
52
  def coupons(self) -> CouponClient:
56
53
  return CouponClient(self.base_api_url, self.api_key)
@@ -95,6 +92,10 @@ class Client:
95
92
  def organizations(self) -> OrganizationClient:
96
93
  return OrganizationClient(self.base_api_url, self.api_key)
97
94
 
95
+ @callable_cached_property
96
+ def overdue_balances(self) -> OverdueBalanceClient:
97
+ return OverdueBalanceClient(self.base_api_url, self.api_key)
98
+
98
99
  @callable_cached_property
99
100
  def invoice_collections(self) -> InvoiceCollectionClient:
100
101
  return InvoiceCollectionClient(self.base_api_url, self.api_key)
@@ -1,5 +1,5 @@
1
1
  from .applied_coupon import AppliedCoupon
2
- from .billable_metric import BillableMetric, BillableMetricGroup
2
+ from .billable_metric import BillableMetric, BillableMetricFilter, BillableMetricFilters
3
3
  from .charge import Charge, Charges, ChargesResponse
4
4
  from .coupon import Coupon, LimitationConfiguration
5
5
  from .credit import CreditResponse, CreditsResponse
@@ -11,7 +11,7 @@ from .event import Event, BatchEvent
11
11
  from .fee import Fee
12
12
  from .customer import Customer, CustomerBillingConfiguration, Metadata, MetadataList,\
13
13
  MetadataResponse, MetadataResponseList, IntegrationCustomer, IntegrationCustomerResponse,\
14
- IntegrationCustomersResponseList, IntegrationCustomersList
14
+ IntegrationCustomersResponseList, IntegrationCustomersList, Address
15
15
  from .invoice import InvoicePaymentStatusChange, Invoice, InvoiceMetadata, InvoiceMetadataList,\
16
16
  OneOffInvoice, InvoiceFeesList, InvoiceFee
17
17
  from .invoice_item import InvoiceItemResponse
@@ -26,7 +26,7 @@ class AppliedCouponResponse(BaseResponseModel):
26
26
  amount_cents: Optional[int]
27
27
  amount_cents_remaining: Optional[int]
28
28
  amount_currency: Optional[str]
29
- expiration_date: Optional[str]
29
+ expiration_at: Optional[str]
30
30
  created_at: str
31
31
  terminated_at: Optional[str]
32
32
  percentage_rate: Optional[float]
@@ -5,11 +5,6 @@ from lago_python_client.base_model import BaseModel
5
5
  from ..base_model import BaseResponseModel
6
6
 
7
7
 
8
- class BillableMetricGroup(BaseModel):
9
- key: Optional[str]
10
- values: Optional[List[Union[str, Dict[str, Any]]]]
11
-
12
-
13
8
  class BillableMetricFilter(BaseModel):
14
9
  key: Optional[str]
15
10
  values: Optional[List[str]]
@@ -27,7 +22,6 @@ class BillableMetric(BaseModel):
27
22
  aggregation_type: Optional[str]
28
23
  weighted_interval: Optional[str]
29
24
  field_name: Optional[str]
30
- group: Optional[BillableMetricGroup]
31
25
  filters: Optional[BillableMetricFilters]
32
26
 
33
27
 
@@ -41,7 +35,6 @@ class BillableMetricResponse(BaseResponseModel):
41
35
  weighted_interval: Optional[str]
42
36
  field_name: Optional[str]
43
37
  created_at: str
44
- group: BillableMetricGroup
45
38
  filters: BillableMetricFilters
46
39
  active_subscriptions_count: int
47
40
  draft_invoices_count: int
@@ -6,16 +6,6 @@ from .tax import TaxesResponse
6
6
  from ..base_model import BaseResponseModel
7
7
 
8
8
 
9
- class GroupProperties(BaseModel):
10
- group_id: Optional[str]
11
- values: Optional[Dict[str, Any]]
12
- invoice_display_name: Optional[str]
13
-
14
-
15
- class GroupPropertiesList(BaseModel):
16
- __root__: List[GroupProperties]
17
-
18
-
19
9
  class ChargeFilter(BaseModel):
20
10
  invoice_display_name: Optional[str]
21
11
  properties: Optional[Dict[str, Any]]
@@ -36,7 +26,6 @@ class Charge(BaseModel):
36
26
  invoice_display_name: Optional[str]
37
27
  min_amount_cents: Optional[int]
38
28
  properties: Optional[Dict[str, Any]]
39
- group_properties: Optional[GroupPropertiesList]
40
29
  filters: Optional[ChargeFilters]
41
30
  tax_codes: Optional[List[str]]
42
31
 
@@ -56,7 +45,6 @@ class ChargeResponse(BaseResponseModel):
56
45
  invoice_display_name: Optional[str]
57
46
  min_amount_cents: Optional[int]
58
47
  properties: Optional[Dict[str, Any]]
59
- group_properties: Optional[GroupPropertiesList]
60
48
  filters: Optional[ChargeFilters]
61
49
  taxes: Optional[TaxesResponse]
62
50
 
@@ -70,7 +58,6 @@ class ChargeOverrides(BaseModel):
70
58
  invoice_display_name: Optional[str]
71
59
  min_amount_cents: Optional[int]
72
60
  properties: Optional[Dict[str, Any]]
73
- group_properties: Optional[GroupPropertiesList]
74
61
  filters: Optional[ChargeFilters]
75
62
  tax_codes: Optional[List[str]]
76
63
 
@@ -15,7 +15,7 @@ class CreditResponse(BaseResponseModel):
15
15
  lago_id: Optional[str]
16
16
  amount_cents: Optional[int]
17
17
  amount_currency: Optional[str]
18
- before_vat: bool
18
+ before_taxes: bool
19
19
  item: Optional[InvoiceItemResponse]
20
20
  invoice: Optional[InvoiceShortDetails]
21
21
 
@@ -18,6 +18,15 @@ class CustomerBillingConfiguration(BaseModel):
18
18
  provider_payment_methods: Optional[List[str]]
19
19
 
20
20
 
21
+ class Address(BaseModel):
22
+ address_line1: Optional[str]
23
+ address_line2: Optional[str]
24
+ city: Optional[str]
25
+ zipcode: Optional[str]
26
+ state: Optional[str]
27
+ country: Optional[str]
28
+
29
+
21
30
  class IntegrationCustomer(BaseModel):
22
31
  id: Optional[str]
23
32
  external_customer_id: Optional[str]
@@ -87,6 +96,7 @@ class Customer(BaseModel):
87
96
  zipcode: Optional[str]
88
97
  metadata: Optional[MetadataList]
89
98
  billing_configuration: Optional[CustomerBillingConfiguration]
99
+ shipping_address: Optional[Address]
90
100
  integration_customers: Optional[IntegrationCustomersList]
91
101
  tax_codes: Optional[List[str]]
92
102
 
@@ -116,5 +126,6 @@ class CustomerResponse(BaseResponseModel):
116
126
  zipcode: Optional[str]
117
127
  metadata: Optional[MetadataResponseList]
118
128
  billing_configuration: Optional[CustomerBillingConfiguration]
129
+ shipping_address: Optional[Address]
119
130
  integration_customers: Optional[IntegrationCustomersResponseList]
120
131
  taxes: Optional[TaxesResponse]
@@ -11,13 +11,6 @@ class Metric(BaseModel):
11
11
  code: str
12
12
  aggregation_type: str
13
13
 
14
- class Group(BaseModel):
15
- lago_id: str
16
- key: Optional[str]
17
- value: str
18
- units: str
19
- amount_cents: int
20
-
21
14
 
22
15
  class ChargeFilterUsage(BaseModel):
23
16
  invoice_display_name: Optional[str]
@@ -37,7 +30,6 @@ class GroupedUsage(BaseModel):
37
30
  events_count: int
38
31
  units: float
39
32
  grouped_by: Dict[str, str]
40
- groups: List[Group]
41
33
  filters: List[ChargeFilterUsage]
42
34
 
43
35
  class ChargeUsage(BaseModel):
@@ -47,7 +39,6 @@ class ChargeUsage(BaseModel):
47
39
  amount_currency: str
48
40
  charge: ChargeObject
49
41
  billable_metric: Metric
50
- groups: List[Group]
51
42
  filters: List[ChargeFilterUsage]
52
43
  grouped_usage: Optional[List[GroupedUsage]]
53
44
 
@@ -7,8 +7,7 @@ from ..base_model import BaseResponseModel
7
7
 
8
8
  class Event(BaseModel):
9
9
  transaction_id: str
10
- external_customer_id: Optional[str]
11
- external_subscription_id: Optional[str]
10
+ external_subscription_id: str
12
11
  code: str
13
12
  timestamp: Optional[Union[int, str]]
14
13
  properties: Optional[Dict[str, Any]]
@@ -20,10 +19,9 @@ class BatchEvent(BaseModel):
20
19
  class EventResponse(BaseResponseModel):
21
20
  lago_id: str
22
21
  transaction_id: str
23
- external_customer_id: Optional[str]
24
22
  lago_customer_id: Optional[str]
25
23
  lago_subscription_id: Optional[str]
26
- external_subscription_id: Optional[str]
24
+ external_subscription_id: str
27
25
  code: str
28
26
  timestamp: str
29
27
  properties: Optional[Dict[str, Any]]
@@ -27,7 +27,6 @@ class FeeAppliedTaxes(BaseResponseModel):
27
27
 
28
28
  class FeeResponse(BaseResponseModel):
29
29
  lago_id: Optional[str]
30
- lago_group_id: Optional[str]
31
30
  lago_charge_filter_id: Optional[str]
32
31
  lago_invoice_id: Optional[str]
33
32
  lago_true_up_fee_id: Optional[str]
@@ -7,6 +7,7 @@ class GrossRevenueResponse(BaseResponseModel):
7
7
  amount_cents: Optional[int]
8
8
  currency: Optional[str]
9
9
  month: str
10
+ invoices_count: int
10
11
 
11
12
 
12
13
  class GrossRevenuesResponse(BaseResponseModel):
@@ -7,9 +7,7 @@ class InvoiceItemResponse(BaseResponseModel):
7
7
  type: Optional[str]
8
8
  code: Optional[str]
9
9
  name: Optional[str]
10
- lago_id: Optional[str]
11
10
  invoice_display_name: Optional[str]
12
- group_invoice_display_name: Optional[str]
13
11
  filter_invoice_display_name: Optional[str]
14
12
  filters: Optional[Dict[str, List[str]]]
15
13
  lago_item_id: Optional[str]
@@ -8,7 +8,6 @@ from ..base_model import BaseResponseModel
8
8
  class OrganizationBillingConfiguration(BaseModel):
9
9
  invoice_footer: Optional[str]
10
10
  invoice_grace_period: Optional[int]
11
- vat_rate: Optional[float]
12
11
  document_locale: Optional[str]
13
12
 
14
13
 
@@ -0,0 +1,14 @@
1
+ from typing import List, Optional
2
+
3
+ from ..base_model import BaseModel, BaseResponseModel
4
+
5
+
6
+ class OverdueBalanceResponse(BaseResponseModel):
7
+ amount_cents: int
8
+ currency: str
9
+ month: str
10
+ lago_invoice_ids: List[str]
11
+
12
+
13
+ class OverdueBalancesResponse(BaseResponseModel):
14
+ __root__: List[OverdueBalanceResponse]
@@ -10,7 +10,7 @@ class Subscription(BaseModel):
10
10
  external_customer_id: Optional[str]
11
11
  name: Optional[str]
12
12
  external_id: Optional[str]
13
- subscription_date: Optional[str]
13
+ subscription_at: Optional[str]
14
14
  billing_time: Optional[str]
15
15
  ending_at: Optional[str]
16
16
  plan_overrides: Optional[PlanOverrides]
@@ -30,7 +30,7 @@ class SubscriptionResponse(BaseResponseModel):
30
30
  billing_time: Optional[str]
31
31
  terminated_at: Optional[str]
32
32
  ending_at: Optional[str]
33
- subscription_date: Optional[str]
33
+ subscription_at: Optional[str]
34
34
  previous_plan_code: Optional[str]
35
35
  next_plan_code: Optional[str]
36
36
  downgrade_plan_date: Optional[str]
@@ -70,4 +70,3 @@ class WalletResponse(BaseResponseModel):
70
70
  ongoing_usage_balance_cents: int
71
71
  credits_ongoing_balance: str
72
72
  credits_ongoing_usage_balance: str
73
- balance: str # NOTE(legacy)
@@ -0,0 +1,39 @@
1
+ import sys
2
+ from typing import Any, ClassVar, Type, Union
3
+
4
+ from ..base_client import BaseClient
5
+ from ..mixins import FindAllCommandMixin
6
+ from ..models.overdue_balance import OverdueBalanceResponse
7
+ from ..services.request import make_headers, make_url, send_get_request
8
+ from ..services.response import get_response_data, prepare_index_response, Response
9
+
10
+ if sys.version_info >= (3, 9):
11
+ from collections.abc import Mapping
12
+ else:
13
+ from typing import Mapping
14
+
15
+
16
+ class OverdueBalanceClient(
17
+ FindAllCommandMixin[OverdueBalanceResponse],
18
+ BaseClient,
19
+ ):
20
+ API_RESOURCE: ClassVar[str] = 'overdue_balances'
21
+ RESPONSE_MODEL: ClassVar[Type[OverdueBalanceResponse]] = OverdueBalanceResponse
22
+ ROOT_NAME: ClassVar[str] = 'overdue_balance'
23
+
24
+ def find_all(self, options: Mapping[str, Union[int, str]] = {}) -> Mapping[str, Any]:
25
+ api_response: Response = send_get_request(
26
+ url=make_url(
27
+ origin=self.base_url,
28
+ path_parts=('analytics', 'overdue_balance'),
29
+ query_pairs=options,
30
+ ),
31
+ headers=make_headers(api_key=self.api_key),
32
+ )
33
+
34
+ # Process response data
35
+ return prepare_index_response(
36
+ api_resource=self.API_RESOURCE,
37
+ response_model=self.RESPONSE_MODEL,
38
+ data=get_response_data(response=api_response),
39
+ )
@@ -0,0 +1 @@
1
+ LAGO_VERSION = '1.7.0'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lago-python-client
3
- Version: 1.6.0
3
+ Version: 1.7.0
4
4
  Summary: Lago Python API Client
5
5
  Home-page: https://github.com/getlago/lago-python-client
6
6
  Author: Lovro Colic
@@ -46,7 +46,6 @@ setup.cfg
46
46
  ./lago_python_client/models/event.py
47
47
  ./lago_python_client/models/fee.py
48
48
  ./lago_python_client/models/gross_revenue.py
49
- ./lago_python_client/models/group.py
50
49
  ./lago_python_client/models/invoice.py
51
50
  ./lago_python_client/models/invoice_collection.py
52
51
  ./lago_python_client/models/invoice_item.py
@@ -54,6 +53,7 @@ setup.cfg
54
53
  ./lago_python_client/models/minimum_commitment.py
55
54
  ./lago_python_client/models/mrr.py
56
55
  ./lago_python_client/models/organization.py
56
+ ./lago_python_client/models/overdue_balance.py
57
57
  ./lago_python_client/models/plan.py
58
58
  ./lago_python_client/models/subscription.py
59
59
  ./lago_python_client/models/tax.py
@@ -64,6 +64,8 @@ setup.cfg
64
64
  ./lago_python_client/mrrs/clients.py
65
65
  ./lago_python_client/organizations/__init__.py
66
66
  ./lago_python_client/organizations/clients.py
67
+ ./lago_python_client/overdue_balances/__init__.py
68
+ ./lago_python_client/overdue_balances/clients.py
67
69
  ./lago_python_client/plans/__init__.py
68
70
  ./lago_python_client/plans/clients.py
69
71
  ./lago_python_client/services/__init__.py
@@ -92,13 +94,13 @@ setup.cfg
92
94
  ./tests/test_fee_client.py
93
95
  ./tests/test_functools_ext.py
94
96
  ./tests/test_gross_revenue_client.py
95
- ./tests/test_group_client.py
96
97
  ./tests/test_invoice_client.py
97
98
  ./tests/test_invoice_collection_client.py
98
99
  ./tests/test_invoiced_usage_client.py
99
100
  ./tests/test_json_services.py
100
101
  ./tests/test_mrr_client.py
101
102
  ./tests/test_organization_client.py
103
+ ./tests/test_overdue_balance_client.py
102
104
  ./tests/test_plan_client.py
103
105
  ./tests/test_request_services.py
104
106
  ./tests/test_response_services.py
@@ -124,13 +126,13 @@ tests/test_event_client.py
124
126
  tests/test_fee_client.py
125
127
  tests/test_functools_ext.py
126
128
  tests/test_gross_revenue_client.py
127
- tests/test_group_client.py
128
129
  tests/test_invoice_client.py
129
130
  tests/test_invoice_collection_client.py
130
131
  tests/test_invoiced_usage_client.py
131
132
  tests/test_json_services.py
132
133
  tests/test_mrr_client.py
133
134
  tests/test_organization_client.py
135
+ tests/test_overdue_balance_client.py
134
136
  tests/test_plan_client.py
135
137
  tests/test_request_services.py
136
138
  tests/test_response_services.py
@@ -1,5 +1,5 @@
1
1
  classes~=0.4.1
2
- httpx~=0.24.0
2
+ httpx<1.0.0,>=0.24.0
3
3
  orjson~=3.8
4
4
  pydantic<3,>=1.10
5
5
  typeguard~=3.0.2
@@ -28,7 +28,7 @@ packages = find:
28
28
  python_requires = >3.6
29
29
  install_requires =
30
30
  classes~=0.4.1 # bugfix auto updates allowed
31
- httpx~=0.24.0 # bugfix auto updates allowed
31
+ httpx>=0.24.0,<1.0.0 # minor auto updates allowed
32
32
  orjson~=3.8 # minor auto updates allowed
33
33
  pydantic>=1.10,<3 # minor auto updates allowed
34
34
  typeguard~=3.0.2 # bugfix auto updates allowed
File without changes
@@ -5,7 +5,7 @@ from pytest_httpx import HTTPXMock
5
5
 
6
6
  from lago_python_client.client import Client
7
7
  from lago_python_client.exceptions import LagoApiError
8
- from lago_python_client.models import BillableMetric, BillableMetricGroup
8
+ from lago_python_client.models import BillableMetric, BillableMetricFilter, BillableMetricFilters
9
9
 
10
10
 
11
11
  def billable_metric_object():
@@ -16,13 +16,13 @@ def billable_metric_object():
16
16
  aggregation_type='sum_agg',
17
17
  field_name='amount_sum',
18
18
  recurring=False,
19
- group=group(),
19
+ filters=filters(),
20
20
  weighted_interval='seconds'
21
21
  )
22
22
 
23
23
 
24
- def group():
25
- return BillableMetricGroup(key='country', values=['france', 'italy', 'spain'])
24
+ def filters():
25
+ return BillableMetricFilters(__root__=[BillableMetricFilter(key='country', values=['france', 'italy', 'spain'])])
26
26
 
27
27
 
28
28
  def mock_response():
@@ -49,7 +49,7 @@ def test_valid_create_billable_metric_request(httpx_mock: HTTPXMock):
49
49
 
50
50
  assert response.lago_id == 'b7ab2926-1de8-4428-9bcd-779314ac129b'
51
51
  assert response.code == 'bm_code'
52
- assert response.group == group()
52
+ assert response.filters == filters()
53
53
 
54
54
 
55
55
  def test_invalid_create_billable_metric_request(httpx_mock: HTTPXMock):
@@ -6,7 +6,7 @@ from pytest_httpx import HTTPXMock
6
6
  from lago_python_client.client import Client
7
7
  from lago_python_client.exceptions import LagoApiError
8
8
  from lago_python_client.models import Customer, IntegrationCustomer, IntegrationCustomersList,\
9
- CustomerBillingConfiguration, Metadata, MetadataList
9
+ CustomerBillingConfiguration, Metadata, MetadataList, Address
10
10
 
11
11
 
12
12
  def create_customer():
@@ -40,6 +40,13 @@ def create_customer():
40
40
  document_locale="fr",
41
41
  provider_payment_methods=["card", "sepa_debit"],
42
42
  ),
43
+ shipping_address=Address(
44
+ city='Paris',
45
+ zipcode='123',
46
+ country='FR',
47
+ address_line1='Test Ave',
48
+ state='XZ'
49
+ , ),
43
50
  integration_customers=integration_customers_list,
44
51
  metadata=metadata_list
45
52
  )
@@ -71,6 +78,12 @@ def test_valid_create_customers_request(httpx_mock: HTTPXMock):
71
78
  assert response.billing_configuration.provider_customer_id == 'cus_12345'
72
79
  assert response.billing_configuration.sync_with_provider == True
73
80
  assert response.billing_configuration.document_locale == "fr"
81
+ assert response.shipping_address.city == 'Paris'
82
+ assert response.shipping_address.country == 'FR'
83
+ assert response.shipping_address.zipcode == '123'
84
+ assert response.shipping_address.address_line1 == 'Test Ave'
85
+ assert response.shipping_address.address_line2 == None
86
+ assert response.shipping_address.state == 'XZ'
74
87
  assert response.integration_customers.__root__[0].external_customer_id == 'test-12345'
75
88
  assert response.integration_customers.__root__[0].type == "netsuite"
76
89
  assert response.metadata.__root__[0].lago_id == '12345'
@@ -100,8 +113,8 @@ def test_valid_current_usage(httpx_mock: HTTPXMock):
100
113
  assert response.from_datetime == '2022-07-01T00:00:00Z'
101
114
  assert len(response.charges_usage) == 1
102
115
  assert response.charges_usage[0].units == 1.0
103
- assert len(response.charges_usage[0].groups) == 1
104
- assert response.charges_usage[0].groups[0].key == 'google'
116
+ assert len(response.charges_usage[0].filters) == 1
117
+ assert response.charges_usage[0].filters[0].values['country'] == ['france']
105
118
 
106
119
 
107
120
  def test_invalid_current_usage(httpx_mock: HTTPXMock):
@@ -132,7 +145,7 @@ def test_valid_past_usage(httpx_mock: HTTPXMock):
132
145
  assert response['usage_periods'][0].from_datetime == '2022-07-01T00:00:00Z'
133
146
  assert len(response['usage_periods'][0].charges_usage) == 1
134
147
  assert response['usage_periods'][0].charges_usage[0].units == 1.0
135
- assert len(response['usage_periods'][0].charges_usage[0].groups) == 0
148
+ assert len(response['usage_periods'][0].charges_usage[0].filters) == 1
136
149
 
137
150
 
138
151
  def test_invalid_past_usage(httpx_mock: HTTPXMock):
@@ -9,17 +9,17 @@ from lago_python_client.models.event import BatchEvent, Event
9
9
 
10
10
 
11
11
  def create_event():
12
- return Event(external_customer_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123')
12
+ return Event(external_subscription_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123')
13
13
 
14
14
 
15
15
  def create_event_with_string_timestamp():
16
- return Event(external_customer_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123', timestamp='1651240791.123')
16
+ return Event(external_subscription_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123', timestamp='1651240791.123')
17
17
 
18
18
 
19
19
  def create_batch_event():
20
20
  return BatchEvent(
21
21
  events=[
22
- Event(external_customer_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123'),
22
+ Event(external_subscription_id='5eb02857-a71e-4ea2-bcf9-57d8885990ba', code='123', transaction_id='123'),
23
23
  ],
24
24
  )
25
25
 
@@ -25,3 +25,4 @@ def test_valid_find_all_gross_revenues_request(httpx_mock: HTTPXMock):
25
25
  assert response['gross_revenues'][0].currency == 'EUR'
26
26
  assert response['gross_revenues'][0].amount_cents == 100
27
27
  assert response['gross_revenues'][0].month == '2023-11-01T00:00:00.000Z'
28
+ assert response['gross_revenues'][0].invoices_count == 1
@@ -19,7 +19,6 @@ def organization_object():
19
19
  billing_configuration=OrganizationBillingConfiguration(
20
20
  invoice_footer='footer',
21
21
  invoice_grace_period=3,
22
- vat_rate=20,
23
22
  document_locale="fr"
24
23
  )
25
24
  )
@@ -0,0 +1,28 @@
1
+ import os
2
+
3
+ import pytest
4
+ from pytest_httpx import HTTPXMock
5
+
6
+ from lago_python_client.client import Client
7
+ from lago_python_client.exceptions import LagoApiError
8
+ from lago_python_client.models.overdue_balance import OverdueBalanceResponse
9
+
10
+
11
+ def mock_collection_response():
12
+ current_dir = os.path.dirname(os.path.abspath(__file__))
13
+ data_path = os.path.join(current_dir, 'fixtures/overdue_balance_index.json')
14
+
15
+ with open(data_path, 'rb') as overdue_balances_response:
16
+ return overdue_balances_response.read()
17
+
18
+
19
+ def test_valid_find_all_overdue_balances_request(httpx_mock: HTTPXMock):
20
+ client = Client(api_key='886fe239-927d-4072-ab72-6dd345e8dd0d')
21
+
22
+ httpx_mock.add_response(method='GET', url='https://api.getlago.com/api/v1/analytics/overdue_balance', content=mock_collection_response())
23
+ response = client.overdue_balances.find_all()
24
+
25
+ assert response['overdue_balances'][0].currency == 'EUR'
26
+ assert response['overdue_balances'][0].amount_cents == 100
27
+ assert response['overdue_balances'][0].month == '2023-11-01T00:00:00.000Z'
28
+ assert response['overdue_balances'][0].lago_invoice_ids == ['1a901a90-1a90-1a90-1a90-1a901a901a90']
@@ -17,12 +17,14 @@ def plan_object():
17
17
  invoiceable=False,
18
18
  prorated=False,
19
19
  min_amount_cents=0,
20
- group_properties = [
20
+ filters = [
21
21
  {
22
- 'group_id': 'id',
23
- 'values': {
22
+ 'properties': {
24
23
  'amount': '0.22'
25
24
  },
25
+ 'values': {
26
+ 'country': ['france', 'italy', 'spain']
27
+ },
26
28
  'invoice_display_name': 'Europe'
27
29
  }
28
30
  ]
@@ -221,9 +223,8 @@ def test_valid_find_all_plan_request(httpx_mock: HTTPXMock):
221
223
  assert response['plans'][0].invoice_display_name == 'test plan 1'
222
224
  assert response['plans'][0].minimum_commitment.invoice_display_name == 'Minimum commitment (C2)'
223
225
  assert response['plans'][0].charges.__root__[0].lago_id == '51c1e851-5be6-4343-a0ee-39a81d8b4ee1'
224
- assert response['plans'][0].charges.__root__[0].group_properties.__root__[0].group_id == 'gfc1e851-5be6-4343-a0ee-39a81d8b4ee1'
225
- assert response['plans'][0].charges.__root__[0].group_properties.__root__[0].values['amount'] == '0.22'
226
- assert response['plans'][0].charges.__root__[0].group_properties.__root__[0].invoice_display_name == 'Europe'
226
+ assert response['plans'][0].charges.__root__[0].filters.__root__[0].properties['amount'] == '0.22'
227
+ assert response['plans'][0].charges.__root__[0].filters.__root__[0].invoice_display_name == 'Europe'
227
228
  assert response['meta']['current_page'] == 1
228
229
 
229
230
 
@@ -10,7 +10,7 @@ from lago_python_client.models import Subscription
10
10
 
11
11
  def create_subscription():
12
12
  return Subscription(external_customer_id='5eb02857-a71e-4ea2-bcf9-57d3a41bc6ba', plan_code='eartha lynch',
13
- external_id='code', billing_time='anniversary', subscription_date='2022-04-29',
13
+ external_id='code', billing_time='anniversary', subscription_at='2022-04-29T08:59:51Z',
14
14
  ending_at='2022-08-29T08:59:51Z')
15
15
 
16
16
 
@@ -46,7 +46,7 @@ def test_valid_create_subscriptions_request(httpx_mock: HTTPXMock):
46
46
  assert response.status == 'active'
47
47
  assert response.plan_code == 'eartha lynch'
48
48
  assert response.billing_time == 'anniversary'
49
- assert response.subscription_date == '2022-04-29'
49
+ assert response.subscription_at == '2022-04-29T08:59:51Z'
50
50
  assert response.ending_at == '2022-08-29T08:59:51Z'
51
51
 
52
52
 
@@ -70,7 +70,7 @@ def test_valid_update_subscription_request(httpx_mock: HTTPXMock):
70
70
  assert response.status == 'active'
71
71
  assert response.plan_code == 'eartha lynch'
72
72
  assert response.billing_time == 'anniversary'
73
- assert response.subscription_date == '2022-04-29'
73
+ assert response.subscription_at == '2022-04-29T08:59:51Z'
74
74
 
75
75
 
76
76
  def test_invalid_update_subscription_request(httpx_mock: HTTPXMock):
@@ -52,7 +52,7 @@ def test_invalid_create_wallet_transaction_request(httpx_mock: HTTPXMock):
52
52
  client.wallet_transactions.create(wallet_transaction_object())
53
53
 
54
54
 
55
- def test_valid_find_all_groups_request(httpx_mock: HTTPXMock):
55
+ def test_valid_find_all_wallet_transactions_request(httpx_mock: HTTPXMock):
56
56
  client = Client(api_key='886fe239-927d-4072-ab72-6dd345e8dd0d')
57
57
 
58
58
  httpx_mock.add_response(method='GET', url='https://api.getlago.com/api/v1/wallets/555/wallet_transactions', content=mock_collection_response())
@@ -1,17 +0,0 @@
1
- from typing import Optional
2
-
3
- from lago_python_client.base_model import BaseModel
4
-
5
- from ..base_model import BaseResponseModel
6
-
7
-
8
- class Group(BaseModel):
9
- lago_id: Optional[str]
10
- key: Optional[str]
11
- value: Optional[str]
12
-
13
-
14
- class GroupResponse(BaseResponseModel):
15
- lago_id: str
16
- key: str
17
- value: str
@@ -1 +0,0 @@
1
- LAGO_VERSION = '1.6.0'
@@ -1,27 +0,0 @@
1
- import os
2
-
3
- from pytest_httpx import HTTPXMock
4
-
5
- from lago_python_client.client import Client
6
-
7
-
8
- def mock_collection_response():
9
- current_dir = os.path.dirname(os.path.abspath(__file__))
10
- data_path = os.path.join(current_dir, 'fixtures/group_index.json')
11
-
12
- with open(data_path, 'rb') as groups_response:
13
- return groups_response.read()
14
-
15
-
16
- def test_valid_find_all_groups_request(httpx_mock: HTTPXMock):
17
- client = Client(api_key='886fe239-927d-4072-ab72-6dd345e8dd0d')
18
-
19
- httpx_mock.add_response(
20
- method='GET',
21
- url='https://api.getlago.com/api/v1/billable_metrics/bm_code/groups?per_page=2&page=1',
22
- content=mock_collection_response(),
23
- )
24
- response = client.groups.find_all('bm_code', {'per_page': 2, 'page': 1})
25
-
26
- assert response['groups'][0].lago_id == '12345678-1de8-4428-9bcd-779314ac1111'
27
- assert response['meta']['current_page'] == 1