lark-billing 0.0.6__py3-none-any.whl → 0.0.8__py3-none-any.whl

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.

Potentially problematic release.


This version of lark-billing might be problematic. Click here for more details.

Files changed (154) hide show
  1. lark/__init__.py +92 -369
  2. lark/checkout/client.py +20 -79
  3. lark/checkout/raw_client.py +18 -102
  4. lark/client.py +112 -27
  5. lark/core/client_wrapper.py +2 -2
  6. lark/core/http_sse/__init__.py +42 -0
  7. lark/core/http_sse/_api.py +112 -0
  8. lark/core/http_sse/_decoders.py +61 -0
  9. lark/{types/credit_grant.py → core/http_sse/_exceptions.py} +4 -2
  10. lark/core/http_sse/_models.py +17 -0
  11. lark/core/pydantic_utilities.py +3 -1
  12. lark/{feature_access → customer_access}/client.py +30 -24
  13. lark/{feature_access → customer_access}/raw_client.py +22 -17
  14. lark/{types/rate_card.py → customer_portal/__init__.py} +1 -2
  15. lark/customer_portal/client.py +115 -0
  16. lark/customer_portal/raw_client.py +134 -0
  17. lark/environment.py +7 -0
  18. lark/{types/dimension.py → invoices/__init__.py} +1 -2
  19. lark/invoices/client.py +136 -0
  20. lark/invoices/raw_client.py +147 -0
  21. lark/pricing_metrics/__init__.py +38 -0
  22. lark/pricing_metrics/client.py +288 -0
  23. lark/pricing_metrics/raw_client.py +369 -0
  24. lark/pricing_metrics/types/__init__.py +42 -0
  25. lark/{types/credit_grant_resource_input_schedule.py → pricing_metrics/types/pricing_metric_aggregation.py} +7 -8
  26. lark/rate_cards/__init__.py +0 -15
  27. lark/rate_cards/client.py +30 -542
  28. lark/rate_cards/raw_client.py +34 -370
  29. lark/rate_cards/types/__init__.py +0 -17
  30. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +3 -29
  31. lark/subjects/client.py +18 -54
  32. lark/subjects/raw_client.py +14 -24
  33. lark/subscriptions/client.py +104 -80
  34. lark/subscriptions/raw_client.py +186 -53
  35. lark/types/__init__.py +63 -379
  36. lark/types/aggregation.py +1 -43
  37. lark/types/amount.py +5 -1
  38. lark/types/{credit_grant_date_time_expiration_interface.py → billing_state_response.py} +3 -2
  39. lark/types/{credit_grant_schedule_one_time_resource.py → count_aggregation_pricing_metric_resource.py} +1 -1
  40. lark/types/{create_dimension_interface.py → create_customer_portal_session_response.py} +3 -3
  41. lark/types/{create_dimension_coordinate_interface.py → create_fixed_rate_request.py} +5 -3
  42. lark/types/{pricing_metric_interface.py → create_pricing_metric_response.py} +2 -5
  43. lark/types/{create_simple_usage_based_rate_interface.py → create_simple_usage_based_rate_request.py} +6 -9
  44. lark/types/create_subject_response.py +30 -6
  45. lark/types/create_subscription_checkout_session_response.py +1 -2
  46. lark/types/create_usage_event_summary_response.py +1 -1
  47. lark/types/fixed_rate_interface.py +0 -6
  48. lark/types/{create_pricing_metric_interface.py → get_pricing_metric_response.py} +3 -5
  49. lark/types/{complete_subscription_checkout_response.py → invoice_line_item_resource.py} +4 -2
  50. lark/types/invoice_resource.py +31 -0
  51. lark/types/invoice_status.py +5 -0
  52. lark/types/{check_feature_access_response.py → list_invoices_response.py} +4 -4
  53. lark/types/{check_feature_access_request.py → list_pricing_metrics_response.py} +4 -7
  54. lark/types/package_price.py +2 -2
  55. lark/types/package_price_input_rounding_behavior.py +5 -0
  56. lark/types/package_price_output_rounding_behavior.py +5 -0
  57. lark/types/period_resource.py +23 -0
  58. lark/types/price.py +39 -1
  59. lark/types/pricing_metric_resource.py +24 -0
  60. lark/types/rate_card_resource.py +0 -6
  61. lark/types/rate_card_resource_usage_based_rates_item.py +2 -29
  62. lark/types/simple_usage_based_rate_interface.py +1 -7
  63. lark/types/subject_resource.py +30 -6
  64. lark/types/subscription_resource.py +6 -4
  65. lark/types/subscription_status.py +5 -0
  66. lark/types/{credit_grant_date_time_expiration_resource.py → sum_aggregation_pricing_metric_resource.py} +2 -2
  67. lark/types/{subject.py → value.py} +1 -1
  68. lark/usage_events/client.py +8 -21
  69. lark/usage_events/raw_client.py +6 -6
  70. {lark_billing-0.0.6.dist-info → lark_billing-0.0.8.dist-info}/METADATA +4 -3
  71. lark_billing-0.0.8.dist-info/RECORD +107 -0
  72. lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +0 -58
  73. lark/rate_cards/types/create_rate_card_version_request_version_type.py +0 -5
  74. lark/types/create_credit_grant_interface.py +0 -27
  75. lark/types/create_credit_grant_interface_expiration.py +0 -27
  76. lark/types/create_credit_pool_request.py +0 -5
  77. lark/types/create_dimensional_usage_based_rate_interface.py +0 -32
  78. lark/types/create_fixed_rate_interface.py +0 -28
  79. lark/types/create_pricing_matrix_cell_interface.py +0 -22
  80. lark/types/create_pricing_matrix_interface.py +0 -20
  81. lark/types/create_pricing_plan_request.py +0 -5
  82. lark/types/create_rate_card_response.py +0 -36
  83. lark/types/create_rate_card_response_billing_interval.py +0 -5
  84. lark/types/create_rate_card_response_usage_based_rates_item.py +0 -58
  85. lark/types/create_rate_card_version_response.py +0 -36
  86. lark/types/create_rate_card_version_response_billing_interval.py +0 -5
  87. lark/types/create_rate_card_version_response_usage_based_rates_item.py +0 -59
  88. lark/types/credit_grant_duration_expiration_interface.py +0 -21
  89. lark/types/credit_grant_duration_expiration_resource.py +0 -21
  90. lark/types/credit_grant_interface.py +0 -28
  91. lark/types/credit_grant_interface_input_expiration.py +0 -27
  92. lark/types/credit_grant_interface_output_expiration.py +0 -43
  93. lark/types/credit_grant_interface_output_schedule.py +0 -41
  94. lark/types/credit_grant_resource.py +0 -28
  95. lark/types/credit_grant_resource_input_expiration.py +0 -27
  96. lark/types/credit_grant_resource_output_expiration.py +0 -43
  97. lark/types/credit_grant_resource_output_schedule.py +0 -39
  98. lark/types/credit_grant_schedule.py +0 -5
  99. lark/types/credit_grant_schedule_one_time_interface.py +0 -19
  100. lark/types/credit_grant_schedule_rate_cycle_start_interface.py +0 -19
  101. lark/types/credit_grant_schedule_rate_cycle_start_resource.py +0 -17
  102. lark/types/credit_grant_subject_granting_config_interface.py +0 -20
  103. lark/types/credit_pool.py +0 -5
  104. lark/types/credit_pool_rollover_config.py +0 -5
  105. lark/types/custom_aggregation_pricing_metric_interface.py +0 -22
  106. lark/types/custom_pricing_metric.py +0 -5
  107. lark/types/custom_unit.py +0 -5
  108. lark/types/custom_unit_amount.py +0 -5
  109. lark/types/dimension_coordinate.py +0 -5
  110. lark/types/dimension_coordinate_interface.py +0 -20
  111. lark/types/dimension_coordinate_set.py +0 -5
  112. lark/types/dimension_interface.py +0 -20
  113. lark/types/dimensional_rate_matrix.py +0 -5
  114. lark/types/dimensional_rate_matrix_cell.py +0 -5
  115. lark/types/dimensional_usage_based_rate.py +0 -5
  116. lark/types/dimensional_usage_based_rate_input.py +0 -5
  117. lark/types/dimensional_usage_based_rate_interface.py +0 -33
  118. lark/types/feature_access_resource.py +0 -21
  119. lark/types/get_rate_card_response.py +0 -36
  120. lark/types/get_rate_card_response_billing_interval.py +0 -5
  121. lark/types/get_rate_card_response_usage_based_rates_item.py +0 -58
  122. lark/types/grant_credits_request.py +0 -5
  123. lark/types/last_aggregation_pricing_metric_interface.py +0 -22
  124. lark/types/license_based_rate.py +0 -5
  125. lark/types/license_based_rate_input.py +0 -5
  126. lark/types/max_aggregation_pricing_metric_interface.py +0 -22
  127. lark/types/monetary_amount.py +0 -5
  128. lark/types/package_price_rounding_behavior.py +0 -5
  129. lark/types/package_price_wrapper.py +0 -5
  130. lark/types/pricing_matrix_cell_interface.py +0 -22
  131. lark/types/pricing_matrix_interface.py +0 -20
  132. lark/types/pricing_metric.py +0 -5
  133. lark/types/pricing_plan.py +0 -5
  134. lark/types/pricing_plan_subscription.py +0 -5
  135. lark/types/pricing_tier.py +0 -5
  136. lark/types/rate_card_version.py +0 -5
  137. lark/types/rate_card_version_input.py +0 -5
  138. lark/types/simple_usage_based_rate.py +0 -5
  139. lark/types/simple_usage_based_rate_input.py +0 -5
  140. lark/types/status.py +0 -5
  141. lark/types/subject_granting_config.py +0 -5
  142. lark/types/subject_granting_config_resource.py +0 -20
  143. lark/types/tiered_price.py +0 -5
  144. lark/types/tiered_price_wrapper.py +0 -5
  145. lark/types/unit.py +0 -5
  146. lark/types/update_pricing_plan_request.py +0 -5
  147. lark/types/update_rate_card_request.py +0 -5
  148. lark/types/update_subscription_request.py +0 -5
  149. lark/types/usage_based_rate.py +0 -5
  150. lark/types/usage_based_rate_input.py +0 -5
  151. lark/types/usage_unit.py +0 -5
  152. lark_billing-0.0.6.dist-info/RECORD +0 -167
  153. /lark/{feature_access → customer_access}/__init__.py +0 -0
  154. {lark_billing-0.0.6.dist-info → lark_billing-0.0.8.dist-info}/WHEEL +0 -0
@@ -0,0 +1,134 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
12
+ from ..types.create_customer_portal_session_response import CreateCustomerPortalSessionResponse
13
+ from ..types.http_validation_error import HttpValidationError
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class RawCustomerPortalClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def create_customer_portal_session(
24
+ self, *, subject_id: str, request_options: typing.Optional[RequestOptions] = None
25
+ ) -> HttpResponse[CreateCustomerPortalSessionResponse]:
26
+ """
27
+ Parameters
28
+ ----------
29
+ subject_id : str
30
+
31
+ request_options : typing.Optional[RequestOptions]
32
+ Request-specific configuration.
33
+
34
+ Returns
35
+ -------
36
+ HttpResponse[CreateCustomerPortalSessionResponse]
37
+ Successful Response
38
+ """
39
+ _response = self._client_wrapper.httpx_client.request(
40
+ "customer-portal/sessions",
41
+ method="POST",
42
+ json={
43
+ "subject_id": subject_id,
44
+ },
45
+ headers={
46
+ "content-type": "application/json",
47
+ },
48
+ request_options=request_options,
49
+ omit=OMIT,
50
+ )
51
+ try:
52
+ if 200 <= _response.status_code < 300:
53
+ _data = typing.cast(
54
+ CreateCustomerPortalSessionResponse,
55
+ parse_obj_as(
56
+ type_=CreateCustomerPortalSessionResponse, # type: ignore
57
+ object_=_response.json(),
58
+ ),
59
+ )
60
+ return HttpResponse(response=_response, data=_data)
61
+ if _response.status_code == 422:
62
+ raise UnprocessableEntityError(
63
+ headers=dict(_response.headers),
64
+ body=typing.cast(
65
+ HttpValidationError,
66
+ parse_obj_as(
67
+ type_=HttpValidationError, # type: ignore
68
+ object_=_response.json(),
69
+ ),
70
+ ),
71
+ )
72
+ _response_json = _response.json()
73
+ except JSONDecodeError:
74
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
75
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
76
+
77
+
78
+ class AsyncRawCustomerPortalClient:
79
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
80
+ self._client_wrapper = client_wrapper
81
+
82
+ async def create_customer_portal_session(
83
+ self, *, subject_id: str, request_options: typing.Optional[RequestOptions] = None
84
+ ) -> AsyncHttpResponse[CreateCustomerPortalSessionResponse]:
85
+ """
86
+ Parameters
87
+ ----------
88
+ subject_id : str
89
+
90
+ request_options : typing.Optional[RequestOptions]
91
+ Request-specific configuration.
92
+
93
+ Returns
94
+ -------
95
+ AsyncHttpResponse[CreateCustomerPortalSessionResponse]
96
+ Successful Response
97
+ """
98
+ _response = await self._client_wrapper.httpx_client.request(
99
+ "customer-portal/sessions",
100
+ method="POST",
101
+ json={
102
+ "subject_id": subject_id,
103
+ },
104
+ headers={
105
+ "content-type": "application/json",
106
+ },
107
+ request_options=request_options,
108
+ omit=OMIT,
109
+ )
110
+ try:
111
+ if 200 <= _response.status_code < 300:
112
+ _data = typing.cast(
113
+ CreateCustomerPortalSessionResponse,
114
+ parse_obj_as(
115
+ type_=CreateCustomerPortalSessionResponse, # type: ignore
116
+ object_=_response.json(),
117
+ ),
118
+ )
119
+ return AsyncHttpResponse(response=_response, data=_data)
120
+ if _response.status_code == 422:
121
+ raise UnprocessableEntityError(
122
+ headers=dict(_response.headers),
123
+ body=typing.cast(
124
+ HttpValidationError,
125
+ parse_obj_as(
126
+ type_=HttpValidationError, # type: ignore
127
+ object_=_response.json(),
128
+ ),
129
+ ),
130
+ )
131
+ _response_json = _response.json()
132
+ except JSONDecodeError:
133
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
134
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
lark/environment.py ADDED
@@ -0,0 +1,7 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import enum
4
+
5
+
6
+ class LarkEnvironment(enum.Enum):
7
+ DEFAULT = "https://api.uselark.ai"
@@ -1,5 +1,4 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- import typing
3
+ # isort: skip_file
4
4
 
5
- Dimension = typing.Optional[typing.Any]
@@ -0,0 +1,136 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.list_invoices_response import ListInvoicesResponse
8
+ from .raw_client import AsyncRawInvoicesClient, RawInvoicesClient
9
+
10
+
11
+ class InvoicesClient:
12
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
13
+ self._raw_client = RawInvoicesClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawInvoicesClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawInvoicesClient
23
+ """
24
+ return self._raw_client
25
+
26
+ def list_invoices(
27
+ self,
28
+ *,
29
+ subject_id: str,
30
+ limit: typing.Optional[int] = None,
31
+ offset: typing.Optional[int] = None,
32
+ request_options: typing.Optional[RequestOptions] = None,
33
+ ) -> ListInvoicesResponse:
34
+ """
35
+ Parameters
36
+ ----------
37
+ subject_id : str
38
+ The ID of the subject to list invoices for.
39
+
40
+ limit : typing.Optional[int]
41
+
42
+ offset : typing.Optional[int]
43
+
44
+ request_options : typing.Optional[RequestOptions]
45
+ Request-specific configuration.
46
+
47
+ Returns
48
+ -------
49
+ ListInvoicesResponse
50
+ Successful Response
51
+
52
+ Examples
53
+ --------
54
+ from lark import Lark
55
+
56
+ client = Lark(
57
+ api_key="YOUR_API_KEY",
58
+ )
59
+ client.invoices.list_invoices(
60
+ subject_id="subject_id",
61
+ limit=1,
62
+ offset=1,
63
+ )
64
+ """
65
+ _response = self._raw_client.list_invoices(
66
+ subject_id=subject_id, limit=limit, offset=offset, request_options=request_options
67
+ )
68
+ return _response.data
69
+
70
+
71
+ class AsyncInvoicesClient:
72
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
73
+ self._raw_client = AsyncRawInvoicesClient(client_wrapper=client_wrapper)
74
+
75
+ @property
76
+ def with_raw_response(self) -> AsyncRawInvoicesClient:
77
+ """
78
+ Retrieves a raw implementation of this client that returns raw responses.
79
+
80
+ Returns
81
+ -------
82
+ AsyncRawInvoicesClient
83
+ """
84
+ return self._raw_client
85
+
86
+ async def list_invoices(
87
+ self,
88
+ *,
89
+ subject_id: str,
90
+ limit: typing.Optional[int] = None,
91
+ offset: typing.Optional[int] = None,
92
+ request_options: typing.Optional[RequestOptions] = None,
93
+ ) -> ListInvoicesResponse:
94
+ """
95
+ Parameters
96
+ ----------
97
+ subject_id : str
98
+ The ID of the subject to list invoices for.
99
+
100
+ limit : typing.Optional[int]
101
+
102
+ offset : typing.Optional[int]
103
+
104
+ request_options : typing.Optional[RequestOptions]
105
+ Request-specific configuration.
106
+
107
+ Returns
108
+ -------
109
+ ListInvoicesResponse
110
+ Successful Response
111
+
112
+ Examples
113
+ --------
114
+ import asyncio
115
+
116
+ from lark import AsyncLark
117
+
118
+ client = AsyncLark(
119
+ api_key="YOUR_API_KEY",
120
+ )
121
+
122
+
123
+ async def main() -> None:
124
+ await client.invoices.list_invoices(
125
+ subject_id="subject_id",
126
+ limit=1,
127
+ offset=1,
128
+ )
129
+
130
+
131
+ asyncio.run(main())
132
+ """
133
+ _response = await self._raw_client.list_invoices(
134
+ subject_id=subject_id, limit=limit, offset=offset, request_options=request_options
135
+ )
136
+ return _response.data
@@ -0,0 +1,147 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.pydantic_utilities import parse_obj_as
10
+ from ..core.request_options import RequestOptions
11
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
12
+ from ..types.http_validation_error import HttpValidationError
13
+ from ..types.list_invoices_response import ListInvoicesResponse
14
+
15
+
16
+ class RawInvoicesClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def list_invoices(
21
+ self,
22
+ *,
23
+ subject_id: str,
24
+ limit: typing.Optional[int] = None,
25
+ offset: typing.Optional[int] = None,
26
+ request_options: typing.Optional[RequestOptions] = None,
27
+ ) -> HttpResponse[ListInvoicesResponse]:
28
+ """
29
+ Parameters
30
+ ----------
31
+ subject_id : str
32
+ The ID of the subject to list invoices for.
33
+
34
+ limit : typing.Optional[int]
35
+
36
+ offset : typing.Optional[int]
37
+
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ HttpResponse[ListInvoicesResponse]
44
+ Successful Response
45
+ """
46
+ _response = self._client_wrapper.httpx_client.request(
47
+ "invoices",
48
+ method="GET",
49
+ params={
50
+ "subject_id": subject_id,
51
+ "limit": limit,
52
+ "offset": offset,
53
+ },
54
+ request_options=request_options,
55
+ )
56
+ try:
57
+ if 200 <= _response.status_code < 300:
58
+ _data = typing.cast(
59
+ ListInvoicesResponse,
60
+ parse_obj_as(
61
+ type_=ListInvoicesResponse, # type: ignore
62
+ object_=_response.json(),
63
+ ),
64
+ )
65
+ return HttpResponse(response=_response, data=_data)
66
+ if _response.status_code == 422:
67
+ raise UnprocessableEntityError(
68
+ headers=dict(_response.headers),
69
+ body=typing.cast(
70
+ HttpValidationError,
71
+ parse_obj_as(
72
+ type_=HttpValidationError, # type: ignore
73
+ object_=_response.json(),
74
+ ),
75
+ ),
76
+ )
77
+ _response_json = _response.json()
78
+ except JSONDecodeError:
79
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
80
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
81
+
82
+
83
+ class AsyncRawInvoicesClient:
84
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
85
+ self._client_wrapper = client_wrapper
86
+
87
+ async def list_invoices(
88
+ self,
89
+ *,
90
+ subject_id: str,
91
+ limit: typing.Optional[int] = None,
92
+ offset: typing.Optional[int] = None,
93
+ request_options: typing.Optional[RequestOptions] = None,
94
+ ) -> AsyncHttpResponse[ListInvoicesResponse]:
95
+ """
96
+ Parameters
97
+ ----------
98
+ subject_id : str
99
+ The ID of the subject to list invoices for.
100
+
101
+ limit : typing.Optional[int]
102
+
103
+ offset : typing.Optional[int]
104
+
105
+ request_options : typing.Optional[RequestOptions]
106
+ Request-specific configuration.
107
+
108
+ Returns
109
+ -------
110
+ AsyncHttpResponse[ListInvoicesResponse]
111
+ Successful Response
112
+ """
113
+ _response = await self._client_wrapper.httpx_client.request(
114
+ "invoices",
115
+ method="GET",
116
+ params={
117
+ "subject_id": subject_id,
118
+ "limit": limit,
119
+ "offset": offset,
120
+ },
121
+ request_options=request_options,
122
+ )
123
+ try:
124
+ if 200 <= _response.status_code < 300:
125
+ _data = typing.cast(
126
+ ListInvoicesResponse,
127
+ parse_obj_as(
128
+ type_=ListInvoicesResponse, # type: ignore
129
+ object_=_response.json(),
130
+ ),
131
+ )
132
+ return AsyncHttpResponse(response=_response, data=_data)
133
+ if _response.status_code == 422:
134
+ raise UnprocessableEntityError(
135
+ headers=dict(_response.headers),
136
+ body=typing.cast(
137
+ HttpValidationError,
138
+ parse_obj_as(
139
+ type_=HttpValidationError, # type: ignore
140
+ object_=_response.json(),
141
+ ),
142
+ ),
143
+ )
144
+ _response_json = _response.json()
145
+ except JSONDecodeError:
146
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
147
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,38 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+
5
+ import typing
6
+ from importlib import import_module
7
+
8
+ if typing.TYPE_CHECKING:
9
+ from .types import PricingMetricAggregation, PricingMetricAggregation_Count, PricingMetricAggregation_Sum
10
+ _dynamic_imports: typing.Dict[str, str] = {
11
+ "PricingMetricAggregation": ".types",
12
+ "PricingMetricAggregation_Count": ".types",
13
+ "PricingMetricAggregation_Sum": ".types",
14
+ }
15
+
16
+
17
+ def __getattr__(attr_name: str) -> typing.Any:
18
+ module_name = _dynamic_imports.get(attr_name)
19
+ if module_name is None:
20
+ raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
21
+ try:
22
+ module = import_module(module_name, __package__)
23
+ if module_name == f".{attr_name}":
24
+ return module
25
+ else:
26
+ return getattr(module, attr_name)
27
+ except ImportError as e:
28
+ raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
29
+ except AttributeError as e:
30
+ raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
31
+
32
+
33
+ def __dir__():
34
+ lazy_attrs = list(_dynamic_imports.keys())
35
+ return sorted(lazy_attrs)
36
+
37
+
38
+ __all__ = ["PricingMetricAggregation", "PricingMetricAggregation_Count", "PricingMetricAggregation_Sum"]