lark-billing 0.0.6__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 (167) hide show
  1. lark/__init__.py +522 -0
  2. lark/checkout/__init__.py +4 -0
  3. lark/checkout/client.py +214 -0
  4. lark/checkout/raw_client.py +252 -0
  5. lark/client.py +240 -0
  6. lark/core/__init__.py +105 -0
  7. lark/core/api_error.py +23 -0
  8. lark/core/client_wrapper.py +79 -0
  9. lark/core/datetime_utils.py +28 -0
  10. lark/core/file.py +67 -0
  11. lark/core/force_multipart.py +18 -0
  12. lark/core/http_client.py +543 -0
  13. lark/core/http_response.py +55 -0
  14. lark/core/jsonable_encoder.py +100 -0
  15. lark/core/pydantic_utilities.py +258 -0
  16. lark/core/query_encoder.py +58 -0
  17. lark/core/remove_none_from_dict.py +11 -0
  18. lark/core/request_options.py +35 -0
  19. lark/core/serialization.py +276 -0
  20. lark/errors/__init__.py +34 -0
  21. lark/errors/unprocessable_entity_error.py +11 -0
  22. lark/feature_access/__init__.py +4 -0
  23. lark/feature_access/client.py +102 -0
  24. lark/feature_access/raw_client.py +113 -0
  25. lark/py.typed +0 -0
  26. lark/rate_cards/__init__.py +61 -0
  27. lark/rate_cards/client.py +817 -0
  28. lark/rate_cards/raw_client.py +728 -0
  29. lark/rate_cards/types/__init__.py +63 -0
  30. lark/rate_cards/types/create_rate_card_request_billing_interval.py +5 -0
  31. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +56 -0
  32. lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +58 -0
  33. lark/rate_cards/types/create_rate_card_version_request_version_type.py +5 -0
  34. lark/subjects/__init__.py +4 -0
  35. lark/subjects/client.py +501 -0
  36. lark/subjects/raw_client.py +633 -0
  37. lark/subscriptions/__init__.py +4 -0
  38. lark/subscriptions/client.py +462 -0
  39. lark/subscriptions/raw_client.py +495 -0
  40. lark/types/__init__.py +493 -0
  41. lark/types/aggregation.py +80 -0
  42. lark/types/amount.py +20 -0
  43. lark/types/check_feature_access_request.py +24 -0
  44. lark/types/check_feature_access_response.py +21 -0
  45. lark/types/complete_subscription_checkout_response.py +21 -0
  46. lark/types/count_aggregation_pricing_metric_interface.py +17 -0
  47. lark/types/create_credit_grant_interface.py +27 -0
  48. lark/types/create_credit_grant_interface_expiration.py +27 -0
  49. lark/types/create_credit_pool_request.py +5 -0
  50. lark/types/create_dimension_coordinate_interface.py +20 -0
  51. lark/types/create_dimension_interface.py +20 -0
  52. lark/types/create_dimensional_usage_based_rate_interface.py +32 -0
  53. lark/types/create_fixed_rate_interface.py +28 -0
  54. lark/types/create_pricing_matrix_cell_interface.py +22 -0
  55. lark/types/create_pricing_matrix_interface.py +20 -0
  56. lark/types/create_pricing_metric_interface.py +26 -0
  57. lark/types/create_pricing_plan_request.py +5 -0
  58. lark/types/create_rate_card_response.py +36 -0
  59. lark/types/create_rate_card_response_billing_interval.py +5 -0
  60. lark/types/create_rate_card_response_usage_based_rates_item.py +58 -0
  61. lark/types/create_rate_card_version_response.py +36 -0
  62. lark/types/create_rate_card_version_response_billing_interval.py +5 -0
  63. lark/types/create_rate_card_version_response_usage_based_rates_item.py +59 -0
  64. lark/types/create_simple_usage_based_rate_interface.py +30 -0
  65. lark/types/create_subject_response.py +24 -0
  66. lark/types/create_subscription_checkout_session_response.py +23 -0
  67. lark/types/create_usage_event_summary_response.py +23 -0
  68. lark/types/credit_grant.py +5 -0
  69. lark/types/credit_grant_date_time_expiration_interface.py +19 -0
  70. lark/types/credit_grant_date_time_expiration_resource.py +19 -0
  71. lark/types/credit_grant_duration_expiration_interface.py +21 -0
  72. lark/types/credit_grant_duration_expiration_resource.py +21 -0
  73. lark/types/credit_grant_interface.py +28 -0
  74. lark/types/credit_grant_interface_input_expiration.py +27 -0
  75. lark/types/credit_grant_interface_output_expiration.py +43 -0
  76. lark/types/credit_grant_interface_output_schedule.py +41 -0
  77. lark/types/credit_grant_resource.py +28 -0
  78. lark/types/credit_grant_resource_input_expiration.py +27 -0
  79. lark/types/credit_grant_resource_input_schedule.py +39 -0
  80. lark/types/credit_grant_resource_output_expiration.py +43 -0
  81. lark/types/credit_grant_resource_output_schedule.py +39 -0
  82. lark/types/credit_grant_schedule.py +5 -0
  83. lark/types/credit_grant_schedule_one_time_interface.py +19 -0
  84. lark/types/credit_grant_schedule_one_time_resource.py +17 -0
  85. lark/types/credit_grant_schedule_rate_cycle_start_interface.py +19 -0
  86. lark/types/credit_grant_schedule_rate_cycle_start_resource.py +17 -0
  87. lark/types/credit_grant_subject_granting_config_interface.py +20 -0
  88. lark/types/credit_pool.py +5 -0
  89. lark/types/credit_pool_rollover_config.py +5 -0
  90. lark/types/custom_aggregation_pricing_metric_interface.py +22 -0
  91. lark/types/custom_pricing_metric.py +5 -0
  92. lark/types/custom_unit.py +5 -0
  93. lark/types/custom_unit_amount.py +5 -0
  94. lark/types/dimension.py +5 -0
  95. lark/types/dimension_coordinate.py +5 -0
  96. lark/types/dimension_coordinate_interface.py +20 -0
  97. lark/types/dimension_coordinate_set.py +5 -0
  98. lark/types/dimension_interface.py +20 -0
  99. lark/types/dimensional_rate_matrix.py +5 -0
  100. lark/types/dimensional_rate_matrix_cell.py +5 -0
  101. lark/types/dimensional_usage_based_rate.py +5 -0
  102. lark/types/dimensional_usage_based_rate_input.py +5 -0
  103. lark/types/dimensional_usage_based_rate_interface.py +33 -0
  104. lark/types/feature_access_resource.py +21 -0
  105. lark/types/fixed_rate_interface.py +29 -0
  106. lark/types/flat_price.py +24 -0
  107. lark/types/get_rate_card_response.py +36 -0
  108. lark/types/get_rate_card_response_billing_interval.py +5 -0
  109. lark/types/get_rate_card_response_usage_based_rates_item.py +58 -0
  110. lark/types/grant_credits_request.py +5 -0
  111. lark/types/http_validation_error.py +20 -0
  112. lark/types/last_aggregation_pricing_metric_interface.py +22 -0
  113. lark/types/license_based_rate.py +5 -0
  114. lark/types/license_based_rate_input.py +5 -0
  115. lark/types/list_rate_cards_response.py +21 -0
  116. lark/types/list_subjects_response.py +21 -0
  117. lark/types/list_subscriptions_response.py +21 -0
  118. lark/types/max_aggregation_pricing_metric_interface.py +22 -0
  119. lark/types/monetary_amount.py +5 -0
  120. lark/types/package_price.py +27 -0
  121. lark/types/package_price_rounding_behavior.py +5 -0
  122. lark/types/package_price_wrapper.py +5 -0
  123. lark/types/period.py +22 -0
  124. lark/types/price.py +5 -0
  125. lark/types/pricing_matrix_cell_interface.py +22 -0
  126. lark/types/pricing_matrix_interface.py +20 -0
  127. lark/types/pricing_metric.py +5 -0
  128. lark/types/pricing_metric_interface.py +27 -0
  129. lark/types/pricing_plan.py +5 -0
  130. lark/types/pricing_plan_subscription.py +5 -0
  131. lark/types/pricing_tier.py +5 -0
  132. lark/types/rate_card.py +5 -0
  133. lark/types/rate_card_resource.py +36 -0
  134. lark/types/rate_card_resource_billing_interval.py +5 -0
  135. lark/types/rate_card_resource_usage_based_rates_item.py +58 -0
  136. lark/types/rate_card_version.py +5 -0
  137. lark/types/rate_card_version_input.py +5 -0
  138. lark/types/simple_usage_based_rate.py +5 -0
  139. lark/types/simple_usage_based_rate_input.py +5 -0
  140. lark/types/simple_usage_based_rate_interface.py +31 -0
  141. lark/types/status.py +5 -0
  142. lark/types/subject.py +5 -0
  143. lark/types/subject_granting_config.py +5 -0
  144. lark/types/subject_granting_config_resource.py +20 -0
  145. lark/types/subject_resource.py +24 -0
  146. lark/types/subscription_resource.py +28 -0
  147. lark/types/sum_aggregation_pricing_metric_interface.py +22 -0
  148. lark/types/tiered_price.py +5 -0
  149. lark/types/tiered_price_wrapper.py +5 -0
  150. lark/types/unit.py +5 -0
  151. lark/types/update_pricing_plan_request.py +5 -0
  152. lark/types/update_rate_card_request.py +5 -0
  153. lark/types/update_subscription_request.py +5 -0
  154. lark/types/usage_based_rate.py +5 -0
  155. lark/types/usage_based_rate_input.py +5 -0
  156. lark/types/usage_unit.py +5 -0
  157. lark/types/validation_error.py +22 -0
  158. lark/types/validation_error_loc_item.py +5 -0
  159. lark/usage_events/__init__.py +34 -0
  160. lark/usage_events/client.py +293 -0
  161. lark/usage_events/raw_client.py +318 -0
  162. lark/usage_events/types/__init__.py +36 -0
  163. lark/usage_events/types/create_usage_event_summary_request_aggregation_type.py +5 -0
  164. lark/version.py +3 -0
  165. lark_billing-0.0.6.dist-info/METADATA +188 -0
  166. lark_billing-0.0.6.dist-info/RECORD +167 -0
  167. lark_billing-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,817 @@
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.create_credit_grant_interface import CreateCreditGrantInterface
8
+ from ..types.create_fixed_rate_interface import CreateFixedRateInterface
9
+ from ..types.create_rate_card_response import CreateRateCardResponse
10
+ from ..types.create_rate_card_version_response import CreateRateCardVersionResponse
11
+ from ..types.credit_grant_resource import CreditGrantResource
12
+ from ..types.feature_access_resource import FeatureAccessResource
13
+ from ..types.fixed_rate_interface import FixedRateInterface
14
+ from ..types.get_rate_card_response import GetRateCardResponse
15
+ from ..types.list_rate_cards_response import ListRateCardsResponse
16
+ from .raw_client import AsyncRawRateCardsClient, RawRateCardsClient
17
+ from .types.create_rate_card_request_billing_interval import CreateRateCardRequestBillingInterval
18
+ from .types.create_rate_card_request_usage_based_rates_item import CreateRateCardRequestUsageBasedRatesItem
19
+ from .types.create_rate_card_version_request_usage_based_rates_item import (
20
+ CreateRateCardVersionRequestUsageBasedRatesItem,
21
+ )
22
+ from .types.create_rate_card_version_request_version_type import CreateRateCardVersionRequestVersionType
23
+
24
+ # this is used as the default value for optional parameters
25
+ OMIT = typing.cast(typing.Any, ...)
26
+
27
+
28
+ class RateCardsClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._raw_client = RawRateCardsClient(client_wrapper=client_wrapper)
31
+
32
+ @property
33
+ def with_raw_response(self) -> RawRateCardsClient:
34
+ """
35
+ Retrieves a raw implementation of this client that returns raw responses.
36
+
37
+ Returns
38
+ -------
39
+ RawRateCardsClient
40
+ """
41
+ return self._raw_client
42
+
43
+ def list_rate_cards(
44
+ self,
45
+ *,
46
+ limit: typing.Optional[int] = None,
47
+ offset: typing.Optional[int] = None,
48
+ request_options: typing.Optional[RequestOptions] = None,
49
+ ) -> ListRateCardsResponse:
50
+ """
51
+ Parameters
52
+ ----------
53
+ limit : typing.Optional[int]
54
+
55
+ offset : typing.Optional[int]
56
+
57
+ request_options : typing.Optional[RequestOptions]
58
+ Request-specific configuration.
59
+
60
+ Returns
61
+ -------
62
+ ListRateCardsResponse
63
+ Successful Response
64
+
65
+ Examples
66
+ --------
67
+ from lark import Lark
68
+
69
+ client = Lark(
70
+ api_key="YOUR_API_KEY",
71
+ base_url="https://yourhost.com/path/to/api",
72
+ )
73
+ client.rate_cards.list_rate_cards(
74
+ limit=1,
75
+ offset=1,
76
+ )
77
+ """
78
+ _response = self._raw_client.list_rate_cards(limit=limit, offset=offset, request_options=request_options)
79
+ return _response.data
80
+
81
+ def create_rate_card(
82
+ self,
83
+ *,
84
+ name: str,
85
+ description: str,
86
+ usage_based_rates: typing.Sequence[CreateRateCardRequestUsageBasedRatesItem],
87
+ billing_interval: CreateRateCardRequestBillingInterval,
88
+ fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateInterface]] = OMIT,
89
+ credit_grants: typing.Optional[typing.Sequence[CreateCreditGrantInterface]] = OMIT,
90
+ feature_access: typing.Optional[typing.Sequence[FeatureAccessResource]] = OMIT,
91
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
92
+ request_options: typing.Optional[RequestOptions] = None,
93
+ ) -> CreateRateCardResponse:
94
+ """
95
+ Parameters
96
+ ----------
97
+ name : str
98
+
99
+ description : str
100
+
101
+ usage_based_rates : typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]
102
+
103
+ billing_interval : CreateRateCardRequestBillingInterval
104
+
105
+ fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateInterface]]
106
+
107
+ credit_grants : typing.Optional[typing.Sequence[CreateCreditGrantInterface]]
108
+
109
+ feature_access : typing.Optional[typing.Sequence[FeatureAccessResource]]
110
+
111
+ metadata : typing.Optional[typing.Dict[str, str]]
112
+
113
+ request_options : typing.Optional[RequestOptions]
114
+ Request-specific configuration.
115
+
116
+ Returns
117
+ -------
118
+ CreateRateCardResponse
119
+ Successful Response
120
+
121
+ Examples
122
+ --------
123
+ from lark import (
124
+ Aggregation_Count,
125
+ CreateDimensionCoordinateInterface,
126
+ CreateDimensionInterface,
127
+ CreatePricingMatrixCellInterface,
128
+ CreatePricingMatrixInterface,
129
+ CreatePricingMetricInterface,
130
+ Lark,
131
+ )
132
+ from lark.rate_cards import CreateRateCardRequestUsageBasedRatesItem_Dimensional
133
+
134
+ client = Lark(
135
+ api_key="YOUR_API_KEY",
136
+ base_url="https://yourhost.com/path/to/api",
137
+ )
138
+ client.rate_cards.create_rate_card(
139
+ name="name",
140
+ description="description",
141
+ usage_based_rates=[
142
+ CreateRateCardRequestUsageBasedRatesItem_Dimensional(
143
+ code="code",
144
+ name="name",
145
+ pricing_metric=CreatePricingMetricInterface(
146
+ name="name",
147
+ event_name="event_name",
148
+ aggregation=Aggregation_Count(),
149
+ unit="unit",
150
+ ),
151
+ dimensions=[
152
+ CreateDimensionInterface(
153
+ key="key",
154
+ values=["values"],
155
+ )
156
+ ],
157
+ pricing_matrix=CreatePricingMatrixInterface(
158
+ cells=[
159
+ CreatePricingMatrixCellInterface(
160
+ dimension_coordinates=[
161
+ CreateDimensionCoordinateInterface(
162
+ dimension_key="dimension_key",
163
+ value="value",
164
+ )
165
+ ],
166
+ price={
167
+ "amount": {
168
+ "value": 1,
169
+ "currency_code": "currency_code",
170
+ },
171
+ "price_type": "flat",
172
+ },
173
+ )
174
+ ],
175
+ ),
176
+ )
177
+ ],
178
+ billing_interval="monthly",
179
+ )
180
+ """
181
+ _response = self._raw_client.create_rate_card(
182
+ name=name,
183
+ description=description,
184
+ usage_based_rates=usage_based_rates,
185
+ billing_interval=billing_interval,
186
+ fixed_rates=fixed_rates,
187
+ credit_grants=credit_grants,
188
+ feature_access=feature_access,
189
+ metadata=metadata,
190
+ request_options=request_options,
191
+ )
192
+ return _response.data
193
+
194
+ def get_rate_card(
195
+ self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
196
+ ) -> GetRateCardResponse:
197
+ """
198
+ Parameters
199
+ ----------
200
+ rate_card_id : str
201
+
202
+ request_options : typing.Optional[RequestOptions]
203
+ Request-specific configuration.
204
+
205
+ Returns
206
+ -------
207
+ GetRateCardResponse
208
+ Successful Response
209
+
210
+ Examples
211
+ --------
212
+ from lark import Lark
213
+
214
+ client = Lark(
215
+ api_key="YOUR_API_KEY",
216
+ base_url="https://yourhost.com/path/to/api",
217
+ )
218
+ client.rate_cards.get_rate_card(
219
+ rate_card_id="rate_card_id",
220
+ )
221
+ """
222
+ _response = self._raw_client.get_rate_card(rate_card_id, request_options=request_options)
223
+ return _response.data
224
+
225
+ def delete_rate_card(self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
226
+ """
227
+ Parameters
228
+ ----------
229
+ rate_card_id : str
230
+
231
+ request_options : typing.Optional[RequestOptions]
232
+ Request-specific configuration.
233
+
234
+ Returns
235
+ -------
236
+ None
237
+
238
+ Examples
239
+ --------
240
+ from lark import Lark
241
+
242
+ client = Lark(
243
+ api_key="YOUR_API_KEY",
244
+ base_url="https://yourhost.com/path/to/api",
245
+ )
246
+ client.rate_cards.delete_rate_card(
247
+ rate_card_id="rate_card_id",
248
+ )
249
+ """
250
+ _response = self._raw_client.delete_rate_card(rate_card_id, request_options=request_options)
251
+ return _response.data
252
+
253
+ def update_rate_card(self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
254
+ """
255
+ Parameters
256
+ ----------
257
+ rate_card_id : str
258
+
259
+ request_options : typing.Optional[RequestOptions]
260
+ Request-specific configuration.
261
+
262
+ Returns
263
+ -------
264
+ None
265
+
266
+ Examples
267
+ --------
268
+ from lark import Lark
269
+
270
+ client = Lark(
271
+ api_key="YOUR_API_KEY",
272
+ base_url="https://yourhost.com/path/to/api",
273
+ )
274
+ client.rate_cards.update_rate_card(
275
+ rate_card_id="rate_card_id",
276
+ )
277
+ """
278
+ _response = self._raw_client.update_rate_card(rate_card_id, request_options=request_options)
279
+ return _response.data
280
+
281
+ def create_rate_card_version(
282
+ self,
283
+ rate_card_id: str,
284
+ *,
285
+ name: str,
286
+ description: str,
287
+ usage_based_rates: typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem],
288
+ version_type: CreateRateCardVersionRequestVersionType,
289
+ fixed_rates: typing.Optional[typing.Sequence[FixedRateInterface]] = OMIT,
290
+ credit_grants: typing.Optional[typing.Sequence[CreditGrantResource]] = OMIT,
291
+ request_options: typing.Optional[RequestOptions] = None,
292
+ ) -> CreateRateCardVersionResponse:
293
+ """
294
+ Parameters
295
+ ----------
296
+ rate_card_id : str
297
+
298
+ name : str
299
+
300
+ description : str
301
+
302
+ usage_based_rates : typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem]
303
+
304
+ version_type : CreateRateCardVersionRequestVersionType
305
+
306
+ fixed_rates : typing.Optional[typing.Sequence[FixedRateInterface]]
307
+
308
+ credit_grants : typing.Optional[typing.Sequence[CreditGrantResource]]
309
+
310
+ request_options : typing.Optional[RequestOptions]
311
+ Request-specific configuration.
312
+
313
+ Returns
314
+ -------
315
+ CreateRateCardVersionResponse
316
+ Successful Response
317
+
318
+ Examples
319
+ --------
320
+ from lark import (
321
+ Aggregation_Count,
322
+ DimensionCoordinateInterface,
323
+ DimensionInterface,
324
+ Lark,
325
+ PricingMatrixCellInterface,
326
+ PricingMatrixInterface,
327
+ PricingMetricInterface,
328
+ )
329
+ from lark.rate_cards import (
330
+ CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional,
331
+ )
332
+
333
+ client = Lark(
334
+ api_key="YOUR_API_KEY",
335
+ base_url="https://yourhost.com/path/to/api",
336
+ )
337
+ client.rate_cards.create_rate_card_version(
338
+ rate_card_id="rate_card_id",
339
+ name="name",
340
+ description="description",
341
+ usage_based_rates=[
342
+ CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional(
343
+ id="id",
344
+ code="code",
345
+ name="name",
346
+ description="description",
347
+ included_units=1,
348
+ pricing_metric=PricingMetricInterface(
349
+ id="id",
350
+ name="name",
351
+ event_name="event_name",
352
+ aggregation=Aggregation_Count(),
353
+ unit="unit",
354
+ ),
355
+ dimensions=[
356
+ DimensionInterface(
357
+ key="key",
358
+ values=["values"],
359
+ )
360
+ ],
361
+ pricing_matrix=PricingMatrixInterface(
362
+ cells=[
363
+ PricingMatrixCellInterface(
364
+ dimension_coordinates=[
365
+ DimensionCoordinateInterface(
366
+ dimension_key="dimension_key",
367
+ value="value",
368
+ )
369
+ ],
370
+ price={
371
+ "amount": {
372
+ "value": 1,
373
+ "currency_code": "currency_code",
374
+ },
375
+ "price_type": "flat",
376
+ },
377
+ )
378
+ ],
379
+ ),
380
+ )
381
+ ],
382
+ version_type="major",
383
+ )
384
+ """
385
+ _response = self._raw_client.create_rate_card_version(
386
+ rate_card_id,
387
+ name=name,
388
+ description=description,
389
+ usage_based_rates=usage_based_rates,
390
+ version_type=version_type,
391
+ fixed_rates=fixed_rates,
392
+ credit_grants=credit_grants,
393
+ request_options=request_options,
394
+ )
395
+ return _response.data
396
+
397
+
398
+ class AsyncRateCardsClient:
399
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
400
+ self._raw_client = AsyncRawRateCardsClient(client_wrapper=client_wrapper)
401
+
402
+ @property
403
+ def with_raw_response(self) -> AsyncRawRateCardsClient:
404
+ """
405
+ Retrieves a raw implementation of this client that returns raw responses.
406
+
407
+ Returns
408
+ -------
409
+ AsyncRawRateCardsClient
410
+ """
411
+ return self._raw_client
412
+
413
+ async def list_rate_cards(
414
+ self,
415
+ *,
416
+ limit: typing.Optional[int] = None,
417
+ offset: typing.Optional[int] = None,
418
+ request_options: typing.Optional[RequestOptions] = None,
419
+ ) -> ListRateCardsResponse:
420
+ """
421
+ Parameters
422
+ ----------
423
+ limit : typing.Optional[int]
424
+
425
+ offset : typing.Optional[int]
426
+
427
+ request_options : typing.Optional[RequestOptions]
428
+ Request-specific configuration.
429
+
430
+ Returns
431
+ -------
432
+ ListRateCardsResponse
433
+ Successful Response
434
+
435
+ Examples
436
+ --------
437
+ import asyncio
438
+
439
+ from lark import AsyncLark
440
+
441
+ client = AsyncLark(
442
+ api_key="YOUR_API_KEY",
443
+ base_url="https://yourhost.com/path/to/api",
444
+ )
445
+
446
+
447
+ async def main() -> None:
448
+ await client.rate_cards.list_rate_cards(
449
+ limit=1,
450
+ offset=1,
451
+ )
452
+
453
+
454
+ asyncio.run(main())
455
+ """
456
+ _response = await self._raw_client.list_rate_cards(limit=limit, offset=offset, request_options=request_options)
457
+ return _response.data
458
+
459
+ async def create_rate_card(
460
+ self,
461
+ *,
462
+ name: str,
463
+ description: str,
464
+ usage_based_rates: typing.Sequence[CreateRateCardRequestUsageBasedRatesItem],
465
+ billing_interval: CreateRateCardRequestBillingInterval,
466
+ fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateInterface]] = OMIT,
467
+ credit_grants: typing.Optional[typing.Sequence[CreateCreditGrantInterface]] = OMIT,
468
+ feature_access: typing.Optional[typing.Sequence[FeatureAccessResource]] = OMIT,
469
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
470
+ request_options: typing.Optional[RequestOptions] = None,
471
+ ) -> CreateRateCardResponse:
472
+ """
473
+ Parameters
474
+ ----------
475
+ name : str
476
+
477
+ description : str
478
+
479
+ usage_based_rates : typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]
480
+
481
+ billing_interval : CreateRateCardRequestBillingInterval
482
+
483
+ fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateInterface]]
484
+
485
+ credit_grants : typing.Optional[typing.Sequence[CreateCreditGrantInterface]]
486
+
487
+ feature_access : typing.Optional[typing.Sequence[FeatureAccessResource]]
488
+
489
+ metadata : typing.Optional[typing.Dict[str, str]]
490
+
491
+ request_options : typing.Optional[RequestOptions]
492
+ Request-specific configuration.
493
+
494
+ Returns
495
+ -------
496
+ CreateRateCardResponse
497
+ Successful Response
498
+
499
+ Examples
500
+ --------
501
+ import asyncio
502
+
503
+ from lark import (
504
+ Aggregation_Count,
505
+ AsyncLark,
506
+ CreateDimensionCoordinateInterface,
507
+ CreateDimensionInterface,
508
+ CreatePricingMatrixCellInterface,
509
+ CreatePricingMatrixInterface,
510
+ CreatePricingMetricInterface,
511
+ )
512
+ from lark.rate_cards import CreateRateCardRequestUsageBasedRatesItem_Dimensional
513
+
514
+ client = AsyncLark(
515
+ api_key="YOUR_API_KEY",
516
+ base_url="https://yourhost.com/path/to/api",
517
+ )
518
+
519
+
520
+ async def main() -> None:
521
+ await client.rate_cards.create_rate_card(
522
+ name="name",
523
+ description="description",
524
+ usage_based_rates=[
525
+ CreateRateCardRequestUsageBasedRatesItem_Dimensional(
526
+ code="code",
527
+ name="name",
528
+ pricing_metric=CreatePricingMetricInterface(
529
+ name="name",
530
+ event_name="event_name",
531
+ aggregation=Aggregation_Count(),
532
+ unit="unit",
533
+ ),
534
+ dimensions=[
535
+ CreateDimensionInterface(
536
+ key="key",
537
+ values=["values"],
538
+ )
539
+ ],
540
+ pricing_matrix=CreatePricingMatrixInterface(
541
+ cells=[
542
+ CreatePricingMatrixCellInterface(
543
+ dimension_coordinates=[
544
+ CreateDimensionCoordinateInterface(
545
+ dimension_key="dimension_key",
546
+ value="value",
547
+ )
548
+ ],
549
+ price={
550
+ "amount": {
551
+ "value": 1,
552
+ "currency_code": "currency_code",
553
+ },
554
+ "price_type": "flat",
555
+ },
556
+ )
557
+ ],
558
+ ),
559
+ )
560
+ ],
561
+ billing_interval="monthly",
562
+ )
563
+
564
+
565
+ asyncio.run(main())
566
+ """
567
+ _response = await self._raw_client.create_rate_card(
568
+ name=name,
569
+ description=description,
570
+ usage_based_rates=usage_based_rates,
571
+ billing_interval=billing_interval,
572
+ fixed_rates=fixed_rates,
573
+ credit_grants=credit_grants,
574
+ feature_access=feature_access,
575
+ metadata=metadata,
576
+ request_options=request_options,
577
+ )
578
+ return _response.data
579
+
580
+ async def get_rate_card(
581
+ self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
582
+ ) -> GetRateCardResponse:
583
+ """
584
+ Parameters
585
+ ----------
586
+ rate_card_id : str
587
+
588
+ request_options : typing.Optional[RequestOptions]
589
+ Request-specific configuration.
590
+
591
+ Returns
592
+ -------
593
+ GetRateCardResponse
594
+ Successful Response
595
+
596
+ Examples
597
+ --------
598
+ import asyncio
599
+
600
+ from lark import AsyncLark
601
+
602
+ client = AsyncLark(
603
+ api_key="YOUR_API_KEY",
604
+ base_url="https://yourhost.com/path/to/api",
605
+ )
606
+
607
+
608
+ async def main() -> None:
609
+ await client.rate_cards.get_rate_card(
610
+ rate_card_id="rate_card_id",
611
+ )
612
+
613
+
614
+ asyncio.run(main())
615
+ """
616
+ _response = await self._raw_client.get_rate_card(rate_card_id, request_options=request_options)
617
+ return _response.data
618
+
619
+ async def delete_rate_card(
620
+ self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
621
+ ) -> None:
622
+ """
623
+ Parameters
624
+ ----------
625
+ rate_card_id : str
626
+
627
+ request_options : typing.Optional[RequestOptions]
628
+ Request-specific configuration.
629
+
630
+ Returns
631
+ -------
632
+ None
633
+
634
+ Examples
635
+ --------
636
+ import asyncio
637
+
638
+ from lark import AsyncLark
639
+
640
+ client = AsyncLark(
641
+ api_key="YOUR_API_KEY",
642
+ base_url="https://yourhost.com/path/to/api",
643
+ )
644
+
645
+
646
+ async def main() -> None:
647
+ await client.rate_cards.delete_rate_card(
648
+ rate_card_id="rate_card_id",
649
+ )
650
+
651
+
652
+ asyncio.run(main())
653
+ """
654
+ _response = await self._raw_client.delete_rate_card(rate_card_id, request_options=request_options)
655
+ return _response.data
656
+
657
+ async def update_rate_card(
658
+ self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
659
+ ) -> None:
660
+ """
661
+ Parameters
662
+ ----------
663
+ rate_card_id : str
664
+
665
+ request_options : typing.Optional[RequestOptions]
666
+ Request-specific configuration.
667
+
668
+ Returns
669
+ -------
670
+ None
671
+
672
+ Examples
673
+ --------
674
+ import asyncio
675
+
676
+ from lark import AsyncLark
677
+
678
+ client = AsyncLark(
679
+ api_key="YOUR_API_KEY",
680
+ base_url="https://yourhost.com/path/to/api",
681
+ )
682
+
683
+
684
+ async def main() -> None:
685
+ await client.rate_cards.update_rate_card(
686
+ rate_card_id="rate_card_id",
687
+ )
688
+
689
+
690
+ asyncio.run(main())
691
+ """
692
+ _response = await self._raw_client.update_rate_card(rate_card_id, request_options=request_options)
693
+ return _response.data
694
+
695
+ async def create_rate_card_version(
696
+ self,
697
+ rate_card_id: str,
698
+ *,
699
+ name: str,
700
+ description: str,
701
+ usage_based_rates: typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem],
702
+ version_type: CreateRateCardVersionRequestVersionType,
703
+ fixed_rates: typing.Optional[typing.Sequence[FixedRateInterface]] = OMIT,
704
+ credit_grants: typing.Optional[typing.Sequence[CreditGrantResource]] = OMIT,
705
+ request_options: typing.Optional[RequestOptions] = None,
706
+ ) -> CreateRateCardVersionResponse:
707
+ """
708
+ Parameters
709
+ ----------
710
+ rate_card_id : str
711
+
712
+ name : str
713
+
714
+ description : str
715
+
716
+ usage_based_rates : typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem]
717
+
718
+ version_type : CreateRateCardVersionRequestVersionType
719
+
720
+ fixed_rates : typing.Optional[typing.Sequence[FixedRateInterface]]
721
+
722
+ credit_grants : typing.Optional[typing.Sequence[CreditGrantResource]]
723
+
724
+ request_options : typing.Optional[RequestOptions]
725
+ Request-specific configuration.
726
+
727
+ Returns
728
+ -------
729
+ CreateRateCardVersionResponse
730
+ Successful Response
731
+
732
+ Examples
733
+ --------
734
+ import asyncio
735
+
736
+ from lark import (
737
+ Aggregation_Count,
738
+ AsyncLark,
739
+ DimensionCoordinateInterface,
740
+ DimensionInterface,
741
+ PricingMatrixCellInterface,
742
+ PricingMatrixInterface,
743
+ PricingMetricInterface,
744
+ )
745
+ from lark.rate_cards import (
746
+ CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional,
747
+ )
748
+
749
+ client = AsyncLark(
750
+ api_key="YOUR_API_KEY",
751
+ base_url="https://yourhost.com/path/to/api",
752
+ )
753
+
754
+
755
+ async def main() -> None:
756
+ await client.rate_cards.create_rate_card_version(
757
+ rate_card_id="rate_card_id",
758
+ name="name",
759
+ description="description",
760
+ usage_based_rates=[
761
+ CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional(
762
+ id="id",
763
+ code="code",
764
+ name="name",
765
+ description="description",
766
+ included_units=1,
767
+ pricing_metric=PricingMetricInterface(
768
+ id="id",
769
+ name="name",
770
+ event_name="event_name",
771
+ aggregation=Aggregation_Count(),
772
+ unit="unit",
773
+ ),
774
+ dimensions=[
775
+ DimensionInterface(
776
+ key="key",
777
+ values=["values"],
778
+ )
779
+ ],
780
+ pricing_matrix=PricingMatrixInterface(
781
+ cells=[
782
+ PricingMatrixCellInterface(
783
+ dimension_coordinates=[
784
+ DimensionCoordinateInterface(
785
+ dimension_key="dimension_key",
786
+ value="value",
787
+ )
788
+ ],
789
+ price={
790
+ "amount": {
791
+ "value": 1,
792
+ "currency_code": "currency_code",
793
+ },
794
+ "price_type": "flat",
795
+ },
796
+ )
797
+ ],
798
+ ),
799
+ )
800
+ ],
801
+ version_type="major",
802
+ )
803
+
804
+
805
+ asyncio.run(main())
806
+ """
807
+ _response = await self._raw_client.create_rate_card_version(
808
+ rate_card_id,
809
+ name=name,
810
+ description=description,
811
+ usage_based_rates=usage_based_rates,
812
+ version_type=version_type,
813
+ fixed_rates=fixed_rates,
814
+ credit_grants=credit_grants,
815
+ request_options=request_options,
816
+ )
817
+ return _response.data