levelfour 0.1.0__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.
Files changed (208) hide show
  1. levelfour/__init__.py +495 -0
  2. levelfour/api_keys/__init__.py +34 -0
  3. levelfour/api_keys/client.py +337 -0
  4. levelfour/api_keys/raw_client.py +621 -0
  5. levelfour/api_keys/types/__init__.py +34 -0
  6. levelfour/api_keys/types/create_api_key_request_scope.py +5 -0
  7. levelfour/async_levelfour_client.py +39 -0
  8. levelfour/base_client.py +346 -0
  9. levelfour/client.py +54 -0
  10. levelfour/core/__init__.py +127 -0
  11. levelfour/core/api_error.py +23 -0
  12. levelfour/core/client_wrapper.py +105 -0
  13. levelfour/core/datetime_utils.py +70 -0
  14. levelfour/core/file.py +67 -0
  15. levelfour/core/force_multipart.py +18 -0
  16. levelfour/core/http_client.py +776 -0
  17. levelfour/core/http_response.py +59 -0
  18. levelfour/core/http_sse/__init__.py +42 -0
  19. levelfour/core/http_sse/_api.py +112 -0
  20. levelfour/core/http_sse/_decoders.py +61 -0
  21. levelfour/core/http_sse/_exceptions.py +7 -0
  22. levelfour/core/http_sse/_models.py +17 -0
  23. levelfour/core/jsonable_encoder.py +108 -0
  24. levelfour/core/logging.py +107 -0
  25. levelfour/core/pagination.py +82 -0
  26. levelfour/core/pydantic_utilities.py +577 -0
  27. levelfour/core/query_encoder.py +58 -0
  28. levelfour/core/remove_none_from_dict.py +11 -0
  29. levelfour/core/request_options.py +35 -0
  30. levelfour/core/serialization.py +276 -0
  31. levelfour/errors/__init__.py +40 -0
  32. levelfour/errors/forbidden_error.py +11 -0
  33. levelfour/errors/unauthorized_error.py +11 -0
  34. levelfour/errors/unprocessable_entity_error.py +11 -0
  35. levelfour/evaluation/__init__.py +4 -0
  36. levelfour/evaluation/client.py +102 -0
  37. levelfour/evaluation/raw_client.py +141 -0
  38. levelfour/exceptions.py +63 -0
  39. levelfour/health/__init__.py +4 -0
  40. levelfour/health/client.py +163 -0
  41. levelfour/health/raw_client.py +164 -0
  42. levelfour/integrations/__init__.py +0 -0
  43. levelfour/integrations/django.py +26 -0
  44. levelfour/integrations/fastapi.py +39 -0
  45. levelfour/integrations/telemetry.py +66 -0
  46. levelfour/levelfour_client.py +47 -0
  47. levelfour/pagination.py +84 -0
  48. levelfour/pr_analysis/__init__.py +4 -0
  49. levelfour/pr_analysis/client.py +408 -0
  50. levelfour/pr_analysis/raw_client.py +620 -0
  51. levelfour/pr_analysis_actions/__init__.py +4 -0
  52. levelfour/pr_analysis_actions/client.py +588 -0
  53. levelfour/pr_analysis_actions/raw_client.py +939 -0
  54. levelfour/pr_analysis_installations/__init__.py +4 -0
  55. levelfour/pr_analysis_installations/client.py +470 -0
  56. levelfour/pr_analysis_installations/raw_client.py +868 -0
  57. levelfour/providers/__init__.py +34 -0
  58. levelfour/providers/client.py +1504 -0
  59. levelfour/providers/raw_client.py +2398 -0
  60. levelfour/providers/types/__init__.py +36 -0
  61. levelfour/providers/types/list_spending_breakdown_providers_response.py +11 -0
  62. levelfour/py.typed +0 -0
  63. levelfour/recommendations/__init__.py +4 -0
  64. levelfour/recommendations/client.py +1018 -0
  65. levelfour/recommendations/raw_client.py +1810 -0
  66. levelfour/savings/__init__.py +4 -0
  67. levelfour/savings/client.py +401 -0
  68. levelfour/savings/raw_client.py +624 -0
  69. levelfour/spending/__init__.py +34 -0
  70. levelfour/spending/client.py +437 -0
  71. levelfour/spending/raw_client.py +684 -0
  72. levelfour/spending/types/__init__.py +34 -0
  73. levelfour/spending/types/list_breakdown_spending_response.py +12 -0
  74. levelfour/types/__init__.py +413 -0
  75. levelfour/types/accept_terms_data.py +25 -0
  76. levelfour/types/accept_terms_response.py +27 -0
  77. levelfour/types/action_request.py +42 -0
  78. levelfour/types/api_key_created_data.py +28 -0
  79. levelfour/types/api_key_data.py +27 -0
  80. levelfour/types/authentication_error.py +5 -0
  81. levelfour/types/authorization_error.py +5 -0
  82. levelfour/types/bad_request_error.py +5 -0
  83. levelfour/types/comparison_item.py +32 -0
  84. levelfour/types/complete_wizard_data.py +27 -0
  85. levelfour/types/complete_wizard_response.py +27 -0
  86. levelfour/types/conflict_error.py +5 -0
  87. levelfour/types/cost_breakdown_data.py +35 -0
  88. levelfour/types/cost_breakdown_item.py +71 -0
  89. levelfour/types/cost_breakdown_raw_data.py +37 -0
  90. levelfour/types/cost_breakdown_raw_response.py +27 -0
  91. levelfour/types/cost_breakdown_response.py +27 -0
  92. levelfour/types/costs_breakdown_chart_data.py +48 -0
  93. levelfour/types/costs_breakdown_chart_response.py +27 -0
  94. levelfour/types/costs_breakdown_data_point.py +46 -0
  95. levelfour/types/costs_breakdown_grouped_chart_data.py +52 -0
  96. levelfour/types/costs_breakdown_grouped_chart_response.py +27 -0
  97. levelfour/types/costs_breakdown_grouped_data_point.py +36 -0
  98. levelfour/types/costs_breakdown_totals.py +41 -0
  99. levelfour/types/create_api_key_response.py +23 -0
  100. levelfour/types/daily_spending_breakdown_data.py +42 -0
  101. levelfour/types/daily_spending_breakdown_response.py +27 -0
  102. levelfour/types/daily_spending_data_point.py +31 -0
  103. levelfour/types/dashboard_summary_data.py +72 -0
  104. levelfour/types/dashboard_summary_response.py +27 -0
  105. levelfour/types/delete_endpoint_data.py +20 -0
  106. levelfour/types/delete_endpoint_response.py +23 -0
  107. levelfour/types/endpoint_data.py +23 -0
  108. levelfour/types/error_response.py +23 -0
  109. levelfour/types/error_response_error.py +21 -0
  110. levelfour/types/evaluation_status_data.py +71 -0
  111. levelfour/types/evaluation_status_response.py +27 -0
  112. levelfour/types/execution_log_command.py +21 -0
  113. levelfour/types/execution_log_entry.py +23 -0
  114. levelfour/types/execution_step_schema.py +23 -0
  115. levelfour/types/http_validation_error.py +20 -0
  116. levelfour/types/implementation_method_data.py +25 -0
  117. levelfour/types/implementation_method_response.py +27 -0
  118. levelfour/types/implementation_step.py +27 -0
  119. levelfour/types/internal_server_error.py +5 -0
  120. levelfour/types/list_api_keys_data.py +21 -0
  121. levelfour/types/list_api_keys_response.py +23 -0
  122. levelfour/types/list_endpoints_response.py +23 -0
  123. levelfour/types/metric_data_point.py +27 -0
  124. levelfour/types/metric_series.py +40 -0
  125. levelfour/types/metric_series_entry.py +25 -0
  126. levelfour/types/monthly_spending_data.py +27 -0
  127. levelfour/types/monthly_spending_data_point.py +31 -0
  128. levelfour/types/monthly_spending_response.py +27 -0
  129. levelfour/types/not_found_error.py +5 -0
  130. levelfour/types/pagination_meta.py +51 -0
  131. levelfour/types/processing_recommendation_item.py +61 -0
  132. levelfour/types/processing_recommendations_data.py +28 -0
  133. levelfour/types/processing_recommendations_response.py +27 -0
  134. levelfour/types/provider.py +46 -0
  135. levelfour/types/provider_breakdown_data.py +31 -0
  136. levelfour/types/provider_breakdown_item.py +77 -0
  137. levelfour/types/provider_breakdown_response.py +27 -0
  138. levelfour/types/provider_filter_options_data.py +51 -0
  139. levelfour/types/provider_filter_options_response.py +27 -0
  140. levelfour/types/provider_potential_savings_summary_data.py +46 -0
  141. levelfour/types/provider_potential_savings_summary_response.py +27 -0
  142. levelfour/types/provider_recommendations_summary_data.py +37 -0
  143. levelfour/types/provider_recommendations_summary_response.py +27 -0
  144. levelfour/types/provider_saved_summary_data.py +56 -0
  145. levelfour/types/provider_saved_summary_response.py +27 -0
  146. levelfour/types/provider_service_breakdown_data.py +65 -0
  147. levelfour/types/provider_service_breakdown_item.py +72 -0
  148. levelfour/types/provider_service_breakdown_raw_data.py +62 -0
  149. levelfour/types/provider_service_breakdown_raw_response.py +27 -0
  150. levelfour/types/provider_service_breakdown_response.py +27 -0
  151. levelfour/types/provider_service_costs_breakdown_data.py +62 -0
  152. levelfour/types/provider_service_costs_breakdown_response.py +27 -0
  153. levelfour/types/provider_service_costs_data_point.py +36 -0
  154. levelfour/types/provider_spending.py +61 -0
  155. levelfour/types/provider_spending_summary_data.py +67 -0
  156. levelfour/types/provider_spending_summary_response.py +27 -0
  157. levelfour/types/provider_timeline_data.py +57 -0
  158. levelfour/types/provider_timeline_response.py +27 -0
  159. levelfour/types/provider_top_service.py +36 -0
  160. levelfour/types/providers_summary_data.py +24 -0
  161. levelfour/types/providers_summary_response.py +27 -0
  162. levelfour/types/rate_limit_error.py +5 -0
  163. levelfour/types/recommendation_actions.py +60 -0
  164. levelfour/types/recommendation_detail.py +42 -0
  165. levelfour/types/recommendation_detail_response.py +27 -0
  166. levelfour/types/recommendation_filter_options_data.py +41 -0
  167. levelfour/types/recommendation_filter_options_response.py +27 -0
  168. levelfour/types/recommendation_item.py +36 -0
  169. levelfour/types/recommendation_wizard_data.py +173 -0
  170. levelfour/types/recommendation_wizard_data_metrics.py +7 -0
  171. levelfour/types/recommendation_wizard_response.py +27 -0
  172. levelfour/types/recommendations_breakdown_data.py +26 -0
  173. levelfour/types/recommendations_breakdown_response.py +27 -0
  174. levelfour/types/recommendations_overview_data.py +51 -0
  175. levelfour/types/recommendations_overview_response.py +27 -0
  176. levelfour/types/register_endpoint_response.py +23 -0
  177. levelfour/types/resource_change.py +42 -0
  178. levelfour/types/resource_snapshot.py +21 -0
  179. levelfour/types/revoke_api_key_data.py +20 -0
  180. levelfour/types/revoke_api_key_response.py +23 -0
  181. levelfour/types/risk_assessment.py +29 -0
  182. levelfour/types/risk_factor.py +27 -0
  183. levelfour/types/saved_breakdown_data.py +31 -0
  184. levelfour/types/saved_breakdown_response.py +27 -0
  185. levelfour/types/saved_by_provider_breakdown_data.py +31 -0
  186. levelfour/types/saved_by_provider_breakdown_response.py +27 -0
  187. levelfour/types/saved_by_provider_item.py +76 -0
  188. levelfour/types/saved_item.py +35 -0
  189. levelfour/types/saved_provider_summary.py +36 -0
  190. levelfour/types/saved_summary_data.py +57 -0
  191. levelfour/types/saved_summary_response.py +27 -0
  192. levelfour/types/savings_decision_data.py +28 -0
  193. levelfour/types/savings_decision_response.py +27 -0
  194. levelfour/types/spending_by_date_item.py +36 -0
  195. levelfour/types/top_recommendation.py +56 -0
  196. levelfour/types/trigger_info.py +22 -0
  197. levelfour/types/update_tag_data.py +20 -0
  198. levelfour/types/update_tag_response.py +23 -0
  199. levelfour/types/validation_error.py +24 -0
  200. levelfour/types/validation_error_loc_item.py +5 -0
  201. levelfour/webhooks/__init__.py +4 -0
  202. levelfour/webhooks/client.py +273 -0
  203. levelfour/webhooks/raw_client.py +483 -0
  204. levelfour/webhooks/verifier.py +61 -0
  205. levelfour-0.1.0.dist-info/METADATA +12 -0
  206. levelfour-0.1.0.dist-info/RECORD +208 -0
  207. levelfour-0.1.0.dist-info/WHEEL +5 -0
  208. levelfour-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,437 @@
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.daily_spending_breakdown_response import DailySpendingBreakdownResponse
8
+ from ..types.dashboard_summary_response import DashboardSummaryResponse
9
+ from ..types.monthly_spending_response import MonthlySpendingResponse
10
+ from .raw_client import AsyncRawSpendingClient, RawSpendingClient
11
+ from .types.list_breakdown_spending_response import ListBreakdownSpendingResponse
12
+
13
+
14
+ class SpendingClient:
15
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
16
+ self._raw_client = RawSpendingClient(client_wrapper=client_wrapper)
17
+
18
+ @property
19
+ def with_raw_response(self) -> RawSpendingClient:
20
+ """
21
+ Retrieves a raw implementation of this client that returns raw responses.
22
+
23
+ Returns
24
+ -------
25
+ RawSpendingClient
26
+ """
27
+ return self._raw_client
28
+
29
+ def get_summary(self, *, request_options: typing.Optional[RequestOptions] = None) -> DashboardSummaryResponse:
30
+ """
31
+ Returns dashboard BigNumbers: overall costs, forecast, savings, and provider breakdown
32
+
33
+ Parameters
34
+ ----------
35
+ request_options : typing.Optional[RequestOptions]
36
+ Request-specific configuration.
37
+
38
+ Returns
39
+ -------
40
+ DashboardSummaryResponse
41
+ Successful Response
42
+
43
+ Examples
44
+ --------
45
+ from levelfour import BaseLevelFour
46
+
47
+ client = BaseLevelFour(
48
+ token="YOUR_TOKEN",
49
+ base_url="https://yourhost.com/path/to/api",
50
+ )
51
+ client.spending.get_summary()
52
+ """
53
+ _response = self._raw_client.get_summary(request_options=request_options)
54
+ return _response.data
55
+
56
+ def list_breakdown(
57
+ self,
58
+ *,
59
+ format: typing.Optional[str] = None,
60
+ period: typing.Optional[str] = None,
61
+ provider_id: typing.Optional[str] = None,
62
+ granularity: typing.Optional[str] = None,
63
+ group_by: typing.Optional[str] = None,
64
+ start: typing.Optional[str] = None,
65
+ end: typing.Optional[str] = None,
66
+ page: typing.Optional[int] = None,
67
+ page_size: typing.Optional[int] = None,
68
+ sort_by: typing.Optional[str] = None,
69
+ sort_order: typing.Optional[str] = None,
70
+ request_options: typing.Optional[RequestOptions] = None,
71
+ ) -> ListBreakdownSpendingResponse:
72
+ """
73
+ Returns cost breakdown in different formats: table (paginated), chart (aggregated), csv (export), raw (all records)
74
+
75
+ Parameters
76
+ ----------
77
+ format : typing.Optional[str]
78
+ Response format: table (paginated UI), chart (aggregated stacked bar), csv (export), raw (all records)
79
+
80
+ period : typing.Optional[str]
81
+ Period in YYYY-MM format (defaults to current month)
82
+
83
+ provider_id : typing.Optional[str]
84
+ Filter by provider: aws, gcp, azure, k8s
85
+
86
+ granularity : typing.Optional[str]
87
+ Granularity: 'daily' or 'monthly' (used for chart format)
88
+
89
+ group_by : typing.Optional[str]
90
+ Grouping dimension for chart format: 'provider' (default) or 'account_id'
91
+
92
+ start : typing.Optional[str]
93
+ Start date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Used for chart and table formats
94
+
95
+ end : typing.Optional[str]
96
+ End date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Used for chart and table formats
97
+
98
+ page : typing.Optional[int]
99
+ Page number (1-indexed, table format only)
100
+
101
+ page_size : typing.Optional[int]
102
+ Items per page (max 100, table format only)
103
+
104
+ sort_by : typing.Optional[str]
105
+ Sort field: cost, service, region, account_id, change_percentage
106
+
107
+ sort_order : typing.Optional[str]
108
+ Sort order: asc or desc
109
+
110
+ request_options : typing.Optional[RequestOptions]
111
+ Request-specific configuration.
112
+
113
+ Returns
114
+ -------
115
+ ListBreakdownSpendingResponse
116
+ Successful Response
117
+
118
+ Examples
119
+ --------
120
+ from levelfour import BaseLevelFour
121
+
122
+ client = BaseLevelFour(
123
+ token="YOUR_TOKEN",
124
+ base_url="https://yourhost.com/path/to/api",
125
+ )
126
+ client.spending.list_breakdown()
127
+ """
128
+ _response = self._raw_client.list_breakdown(
129
+ format=format,
130
+ period=period,
131
+ provider_id=provider_id,
132
+ granularity=granularity,
133
+ group_by=group_by,
134
+ start=start,
135
+ end=end,
136
+ page=page,
137
+ page_size=page_size,
138
+ sort_by=sort_by,
139
+ sort_order=sort_order,
140
+ request_options=request_options,
141
+ )
142
+ return _response.data
143
+
144
+ def get_daily_breakdown(
145
+ self,
146
+ *,
147
+ start: typing.Optional[str] = None,
148
+ end: typing.Optional[str] = None,
149
+ request_options: typing.Optional[RequestOptions] = None,
150
+ ) -> DailySpendingBreakdownResponse:
151
+ """
152
+ Returns daily spending aggregated per day for the given date range
153
+
154
+ Parameters
155
+ ----------
156
+ start : typing.Optional[str]
157
+ Start date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z)
158
+
159
+ end : typing.Optional[str]
160
+ End date in ISO 8601 format (e.g., 2026-02-28T00:00:00.000Z)
161
+
162
+ request_options : typing.Optional[RequestOptions]
163
+ Request-specific configuration.
164
+
165
+ Returns
166
+ -------
167
+ DailySpendingBreakdownResponse
168
+ Successful Response
169
+
170
+ Examples
171
+ --------
172
+ from levelfour import BaseLevelFour
173
+
174
+ client = BaseLevelFour(
175
+ token="YOUR_TOKEN",
176
+ base_url="https://yourhost.com/path/to/api",
177
+ )
178
+ client.spending.get_daily_breakdown()
179
+ """
180
+ _response = self._raw_client.get_daily_breakdown(start=start, end=end, request_options=request_options)
181
+ return _response.data
182
+
183
+ def get_monthly(self, *, request_options: typing.Optional[RequestOptions] = None) -> MonthlySpendingResponse:
184
+ """
185
+ Returns monthly spending aggregated per month
186
+
187
+ Parameters
188
+ ----------
189
+ request_options : typing.Optional[RequestOptions]
190
+ Request-specific configuration.
191
+
192
+ Returns
193
+ -------
194
+ MonthlySpendingResponse
195
+ Successful Response
196
+
197
+ Examples
198
+ --------
199
+ from levelfour import BaseLevelFour
200
+
201
+ client = BaseLevelFour(
202
+ token="YOUR_TOKEN",
203
+ base_url="https://yourhost.com/path/to/api",
204
+ )
205
+ client.spending.get_monthly()
206
+ """
207
+ _response = self._raw_client.get_monthly(request_options=request_options)
208
+ return _response.data
209
+
210
+
211
+ class AsyncSpendingClient:
212
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
213
+ self._raw_client = AsyncRawSpendingClient(client_wrapper=client_wrapper)
214
+
215
+ @property
216
+ def with_raw_response(self) -> AsyncRawSpendingClient:
217
+ """
218
+ Retrieves a raw implementation of this client that returns raw responses.
219
+
220
+ Returns
221
+ -------
222
+ AsyncRawSpendingClient
223
+ """
224
+ return self._raw_client
225
+
226
+ async def get_summary(self, *, request_options: typing.Optional[RequestOptions] = None) -> DashboardSummaryResponse:
227
+ """
228
+ Returns dashboard BigNumbers: overall costs, forecast, savings, and provider breakdown
229
+
230
+ Parameters
231
+ ----------
232
+ request_options : typing.Optional[RequestOptions]
233
+ Request-specific configuration.
234
+
235
+ Returns
236
+ -------
237
+ DashboardSummaryResponse
238
+ Successful Response
239
+
240
+ Examples
241
+ --------
242
+ import asyncio
243
+
244
+ from levelfour import AsyncBaseLevelFour
245
+
246
+ client = AsyncBaseLevelFour(
247
+ token="YOUR_TOKEN",
248
+ base_url="https://yourhost.com/path/to/api",
249
+ )
250
+
251
+
252
+ async def main() -> None:
253
+ await client.spending.get_summary()
254
+
255
+
256
+ asyncio.run(main())
257
+ """
258
+ _response = await self._raw_client.get_summary(request_options=request_options)
259
+ return _response.data
260
+
261
+ async def list_breakdown(
262
+ self,
263
+ *,
264
+ format: typing.Optional[str] = None,
265
+ period: typing.Optional[str] = None,
266
+ provider_id: typing.Optional[str] = None,
267
+ granularity: typing.Optional[str] = None,
268
+ group_by: typing.Optional[str] = None,
269
+ start: typing.Optional[str] = None,
270
+ end: typing.Optional[str] = None,
271
+ page: typing.Optional[int] = None,
272
+ page_size: typing.Optional[int] = None,
273
+ sort_by: typing.Optional[str] = None,
274
+ sort_order: typing.Optional[str] = None,
275
+ request_options: typing.Optional[RequestOptions] = None,
276
+ ) -> ListBreakdownSpendingResponse:
277
+ """
278
+ Returns cost breakdown in different formats: table (paginated), chart (aggregated), csv (export), raw (all records)
279
+
280
+ Parameters
281
+ ----------
282
+ format : typing.Optional[str]
283
+ Response format: table (paginated UI), chart (aggregated stacked bar), csv (export), raw (all records)
284
+
285
+ period : typing.Optional[str]
286
+ Period in YYYY-MM format (defaults to current month)
287
+
288
+ provider_id : typing.Optional[str]
289
+ Filter by provider: aws, gcp, azure, k8s
290
+
291
+ granularity : typing.Optional[str]
292
+ Granularity: 'daily' or 'monthly' (used for chart format)
293
+
294
+ group_by : typing.Optional[str]
295
+ Grouping dimension for chart format: 'provider' (default) or 'account_id'
296
+
297
+ start : typing.Optional[str]
298
+ Start date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Used for chart and table formats
299
+
300
+ end : typing.Optional[str]
301
+ End date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z). Used for chart and table formats
302
+
303
+ page : typing.Optional[int]
304
+ Page number (1-indexed, table format only)
305
+
306
+ page_size : typing.Optional[int]
307
+ Items per page (max 100, table format only)
308
+
309
+ sort_by : typing.Optional[str]
310
+ Sort field: cost, service, region, account_id, change_percentage
311
+
312
+ sort_order : typing.Optional[str]
313
+ Sort order: asc or desc
314
+
315
+ request_options : typing.Optional[RequestOptions]
316
+ Request-specific configuration.
317
+
318
+ Returns
319
+ -------
320
+ ListBreakdownSpendingResponse
321
+ Successful Response
322
+
323
+ Examples
324
+ --------
325
+ import asyncio
326
+
327
+ from levelfour import AsyncBaseLevelFour
328
+
329
+ client = AsyncBaseLevelFour(
330
+ token="YOUR_TOKEN",
331
+ base_url="https://yourhost.com/path/to/api",
332
+ )
333
+
334
+
335
+ async def main() -> None:
336
+ await client.spending.list_breakdown()
337
+
338
+
339
+ asyncio.run(main())
340
+ """
341
+ _response = await self._raw_client.list_breakdown(
342
+ format=format,
343
+ period=period,
344
+ provider_id=provider_id,
345
+ granularity=granularity,
346
+ group_by=group_by,
347
+ start=start,
348
+ end=end,
349
+ page=page,
350
+ page_size=page_size,
351
+ sort_by=sort_by,
352
+ sort_order=sort_order,
353
+ request_options=request_options,
354
+ )
355
+ return _response.data
356
+
357
+ async def get_daily_breakdown(
358
+ self,
359
+ *,
360
+ start: typing.Optional[str] = None,
361
+ end: typing.Optional[str] = None,
362
+ request_options: typing.Optional[RequestOptions] = None,
363
+ ) -> DailySpendingBreakdownResponse:
364
+ """
365
+ Returns daily spending aggregated per day for the given date range
366
+
367
+ Parameters
368
+ ----------
369
+ start : typing.Optional[str]
370
+ Start date in ISO 8601 format (e.g., 2026-02-01T00:00:00.000Z)
371
+
372
+ end : typing.Optional[str]
373
+ End date in ISO 8601 format (e.g., 2026-02-28T00:00:00.000Z)
374
+
375
+ request_options : typing.Optional[RequestOptions]
376
+ Request-specific configuration.
377
+
378
+ Returns
379
+ -------
380
+ DailySpendingBreakdownResponse
381
+ Successful Response
382
+
383
+ Examples
384
+ --------
385
+ import asyncio
386
+
387
+ from levelfour import AsyncBaseLevelFour
388
+
389
+ client = AsyncBaseLevelFour(
390
+ token="YOUR_TOKEN",
391
+ base_url="https://yourhost.com/path/to/api",
392
+ )
393
+
394
+
395
+ async def main() -> None:
396
+ await client.spending.get_daily_breakdown()
397
+
398
+
399
+ asyncio.run(main())
400
+ """
401
+ _response = await self._raw_client.get_daily_breakdown(start=start, end=end, request_options=request_options)
402
+ return _response.data
403
+
404
+ async def get_monthly(self, *, request_options: typing.Optional[RequestOptions] = None) -> MonthlySpendingResponse:
405
+ """
406
+ Returns monthly spending aggregated per month
407
+
408
+ Parameters
409
+ ----------
410
+ request_options : typing.Optional[RequestOptions]
411
+ Request-specific configuration.
412
+
413
+ Returns
414
+ -------
415
+ MonthlySpendingResponse
416
+ Successful Response
417
+
418
+ Examples
419
+ --------
420
+ import asyncio
421
+
422
+ from levelfour import AsyncBaseLevelFour
423
+
424
+ client = AsyncBaseLevelFour(
425
+ token="YOUR_TOKEN",
426
+ base_url="https://yourhost.com/path/to/api",
427
+ )
428
+
429
+
430
+ async def main() -> None:
431
+ await client.spending.get_monthly()
432
+
433
+
434
+ asyncio.run(main())
435
+ """
436
+ _response = await self._raw_client.get_monthly(request_options=request_options)
437
+ return _response.data