lark-billing 0.0.7__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 (46) hide show
  1. lark/__init__.py +42 -28
  2. lark/checkout/client.py +26 -8
  3. lark/checkout/raw_client.py +18 -6
  4. lark/client.py +19 -0
  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/core/http_sse/_exceptions.py +7 -0
  10. lark/core/http_sse/_models.py +17 -0
  11. lark/core/pydantic_utilities.py +3 -1
  12. lark/invoices/__init__.py +4 -0
  13. lark/invoices/client.py +136 -0
  14. lark/invoices/raw_client.py +147 -0
  15. lark/pricing_metrics/client.py +69 -0
  16. lark/pricing_metrics/raw_client.py +101 -0
  17. lark/rate_cards/__init__.py +15 -3
  18. lark/rate_cards/client.py +10 -10
  19. lark/rate_cards/raw_client.py +14 -14
  20. lark/rate_cards/types/__init__.py +12 -2
  21. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +30 -0
  22. lark/subjects/client.py +16 -18
  23. lark/subjects/raw_client.py +14 -8
  24. lark/subscriptions/client.py +192 -8
  25. lark/subscriptions/raw_client.py +254 -4
  26. lark/types/__init__.py +31 -32
  27. lark/types/aggregation.py +1 -43
  28. lark/types/{create_fixed_rate_interface.py → create_fixed_rate_request.py} +1 -1
  29. lark/types/{create_simple_usage_based_rate_interface.py → create_simple_usage_based_rate_request.py} +5 -3
  30. lark/types/create_subject_response.py +29 -6
  31. lark/types/{custom_pricing_metric_resource.py → invoice_line_item_resource.py} +6 -2
  32. lark/types/invoice_resource.py +31 -0
  33. lark/types/invoice_status.py +5 -0
  34. lark/types/{max_aggregation_pricing_metric_resource.py → list_invoices_response.py} +4 -2
  35. lark/types/list_pricing_metrics_response.py +21 -0
  36. lark/types/period_resource.py +23 -0
  37. lark/types/{last_aggregation_pricing_metric_resource.py → pricing_metric_resource.py} +7 -2
  38. lark/types/rate_card_resource_usage_based_rates_item.py +0 -1
  39. lark/types/simple_usage_based_rate_interface.py +0 -5
  40. lark/types/subject_resource.py +29 -6
  41. lark/types/subscription_resource.py +6 -3
  42. lark/types/subscription_status.py +5 -0
  43. {lark_billing-0.0.7.dist-info → lark_billing-0.0.8.dist-info}/METADATA +4 -3
  44. {lark_billing-0.0.7.dist-info → lark_billing-0.0.8.dist-info}/RECORD +45 -32
  45. lark/types/status.py +0 -5
  46. {lark_billing-0.0.7.dist-info → lark_billing-0.0.8.dist-info}/WHEEL +0 -0
@@ -90,17 +90,20 @@ class RawSubscriptionsClient:
90
90
  *,
91
91
  rate_card_id: str,
92
92
  subject_id: str,
93
- metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
93
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
94
94
  request_options: typing.Optional[RequestOptions] = None,
95
95
  ) -> HttpResponse[SubscriptionResource]:
96
96
  """
97
97
  Parameters
98
98
  ----------
99
99
  rate_card_id : str
100
+ The ID of the rate card to use for the subscription.
100
101
 
101
102
  subject_id : str
103
+ The ID of the subject to create the subscription for.
102
104
 
103
- metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
105
+ metadata : typing.Optional[typing.Dict[str, str]]
106
+ Additional metadata about the subscription. You may use this to store any custom data about the subscription.
104
107
 
105
108
  request_options : typing.Optional[RequestOptions]
106
109
  Request-specific configuration.
@@ -197,6 +200,128 @@ class RawSubscriptionsClient:
197
200
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
198
201
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
199
202
 
203
+ def cancel_subscription(
204
+ self,
205
+ subscription_id: str,
206
+ *,
207
+ reason: typing.Optional[str] = OMIT,
208
+ cancel_at_end_of_cycle: typing.Optional[bool] = OMIT,
209
+ request_options: typing.Optional[RequestOptions] = None,
210
+ ) -> HttpResponse[SubscriptionResource]:
211
+ """
212
+ Parameters
213
+ ----------
214
+ subscription_id : str
215
+
216
+ reason : typing.Optional[str]
217
+ The reason for cancelling the subscription.
218
+
219
+ cancel_at_end_of_cycle : typing.Optional[bool]
220
+ Whether to cancel the subscription at end of cycle.
221
+
222
+ request_options : typing.Optional[RequestOptions]
223
+ Request-specific configuration.
224
+
225
+ Returns
226
+ -------
227
+ HttpResponse[SubscriptionResource]
228
+ Successful Response
229
+ """
230
+ _response = self._client_wrapper.httpx_client.request(
231
+ f"subscriptions/{jsonable_encoder(subscription_id)}/cancel",
232
+ method="POST",
233
+ json={
234
+ "reason": reason,
235
+ "cancel_at_end_of_cycle": cancel_at_end_of_cycle,
236
+ },
237
+ headers={
238
+ "content-type": "application/json",
239
+ },
240
+ request_options=request_options,
241
+ omit=OMIT,
242
+ )
243
+ try:
244
+ if 200 <= _response.status_code < 300:
245
+ _data = typing.cast(
246
+ SubscriptionResource,
247
+ parse_obj_as(
248
+ type_=SubscriptionResource, # type: ignore
249
+ object_=_response.json(),
250
+ ),
251
+ )
252
+ return HttpResponse(response=_response, data=_data)
253
+ if _response.status_code == 422:
254
+ raise UnprocessableEntityError(
255
+ headers=dict(_response.headers),
256
+ body=typing.cast(
257
+ HttpValidationError,
258
+ parse_obj_as(
259
+ type_=HttpValidationError, # type: ignore
260
+ object_=_response.json(),
261
+ ),
262
+ ),
263
+ )
264
+ _response_json = _response.json()
265
+ except JSONDecodeError:
266
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
267
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
268
+
269
+ def change_subscription_rate_card(
270
+ self, subscription_id: str, *, rate_card_id: str, request_options: typing.Optional[RequestOptions] = None
271
+ ) -> HttpResponse[SubscriptionResource]:
272
+ """
273
+ Parameters
274
+ ----------
275
+ subscription_id : str
276
+
277
+ rate_card_id : str
278
+
279
+ request_options : typing.Optional[RequestOptions]
280
+ Request-specific configuration.
281
+
282
+ Returns
283
+ -------
284
+ HttpResponse[SubscriptionResource]
285
+ Successful Response
286
+ """
287
+ _response = self._client_wrapper.httpx_client.request(
288
+ f"subscriptions/{jsonable_encoder(subscription_id)}/change-rate-card",
289
+ method="POST",
290
+ json={
291
+ "rate_card_id": rate_card_id,
292
+ },
293
+ headers={
294
+ "content-type": "application/json",
295
+ },
296
+ request_options=request_options,
297
+ omit=OMIT,
298
+ )
299
+ try:
300
+ if 200 <= _response.status_code < 300:
301
+ _data = typing.cast(
302
+ SubscriptionResource,
303
+ parse_obj_as(
304
+ type_=SubscriptionResource, # type: ignore
305
+ object_=_response.json(),
306
+ ),
307
+ )
308
+ return HttpResponse(response=_response, data=_data)
309
+ if _response.status_code == 422:
310
+ raise UnprocessableEntityError(
311
+ headers=dict(_response.headers),
312
+ body=typing.cast(
313
+ HttpValidationError,
314
+ parse_obj_as(
315
+ type_=HttpValidationError, # type: ignore
316
+ object_=_response.json(),
317
+ ),
318
+ ),
319
+ )
320
+ _response_json = _response.json()
321
+ except JSONDecodeError:
322
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
323
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
324
+
200
325
 
201
326
  class AsyncRawSubscriptionsClient:
202
327
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -270,17 +395,20 @@ class AsyncRawSubscriptionsClient:
270
395
  *,
271
396
  rate_card_id: str,
272
397
  subject_id: str,
273
- metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
398
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
274
399
  request_options: typing.Optional[RequestOptions] = None,
275
400
  ) -> AsyncHttpResponse[SubscriptionResource]:
276
401
  """
277
402
  Parameters
278
403
  ----------
279
404
  rate_card_id : str
405
+ The ID of the rate card to use for the subscription.
280
406
 
281
407
  subject_id : str
408
+ The ID of the subject to create the subscription for.
282
409
 
283
- metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
410
+ metadata : typing.Optional[typing.Dict[str, str]]
411
+ Additional metadata about the subscription. You may use this to store any custom data about the subscription.
284
412
 
285
413
  request_options : typing.Optional[RequestOptions]
286
414
  Request-specific configuration.
@@ -376,3 +504,125 @@ class AsyncRawSubscriptionsClient:
376
504
  except JSONDecodeError:
377
505
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
378
506
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
507
+
508
+ async def cancel_subscription(
509
+ self,
510
+ subscription_id: str,
511
+ *,
512
+ reason: typing.Optional[str] = OMIT,
513
+ cancel_at_end_of_cycle: typing.Optional[bool] = OMIT,
514
+ request_options: typing.Optional[RequestOptions] = None,
515
+ ) -> AsyncHttpResponse[SubscriptionResource]:
516
+ """
517
+ Parameters
518
+ ----------
519
+ subscription_id : str
520
+
521
+ reason : typing.Optional[str]
522
+ The reason for cancelling the subscription.
523
+
524
+ cancel_at_end_of_cycle : typing.Optional[bool]
525
+ Whether to cancel the subscription at end of cycle.
526
+
527
+ request_options : typing.Optional[RequestOptions]
528
+ Request-specific configuration.
529
+
530
+ Returns
531
+ -------
532
+ AsyncHttpResponse[SubscriptionResource]
533
+ Successful Response
534
+ """
535
+ _response = await self._client_wrapper.httpx_client.request(
536
+ f"subscriptions/{jsonable_encoder(subscription_id)}/cancel",
537
+ method="POST",
538
+ json={
539
+ "reason": reason,
540
+ "cancel_at_end_of_cycle": cancel_at_end_of_cycle,
541
+ },
542
+ headers={
543
+ "content-type": "application/json",
544
+ },
545
+ request_options=request_options,
546
+ omit=OMIT,
547
+ )
548
+ try:
549
+ if 200 <= _response.status_code < 300:
550
+ _data = typing.cast(
551
+ SubscriptionResource,
552
+ parse_obj_as(
553
+ type_=SubscriptionResource, # type: ignore
554
+ object_=_response.json(),
555
+ ),
556
+ )
557
+ return AsyncHttpResponse(response=_response, data=_data)
558
+ if _response.status_code == 422:
559
+ raise UnprocessableEntityError(
560
+ headers=dict(_response.headers),
561
+ body=typing.cast(
562
+ HttpValidationError,
563
+ parse_obj_as(
564
+ type_=HttpValidationError, # type: ignore
565
+ object_=_response.json(),
566
+ ),
567
+ ),
568
+ )
569
+ _response_json = _response.json()
570
+ except JSONDecodeError:
571
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
572
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
573
+
574
+ async def change_subscription_rate_card(
575
+ self, subscription_id: str, *, rate_card_id: str, request_options: typing.Optional[RequestOptions] = None
576
+ ) -> AsyncHttpResponse[SubscriptionResource]:
577
+ """
578
+ Parameters
579
+ ----------
580
+ subscription_id : str
581
+
582
+ rate_card_id : str
583
+
584
+ request_options : typing.Optional[RequestOptions]
585
+ Request-specific configuration.
586
+
587
+ Returns
588
+ -------
589
+ AsyncHttpResponse[SubscriptionResource]
590
+ Successful Response
591
+ """
592
+ _response = await self._client_wrapper.httpx_client.request(
593
+ f"subscriptions/{jsonable_encoder(subscription_id)}/change-rate-card",
594
+ method="POST",
595
+ json={
596
+ "rate_card_id": rate_card_id,
597
+ },
598
+ headers={
599
+ "content-type": "application/json",
600
+ },
601
+ request_options=request_options,
602
+ omit=OMIT,
603
+ )
604
+ try:
605
+ if 200 <= _response.status_code < 300:
606
+ _data = typing.cast(
607
+ SubscriptionResource,
608
+ parse_obj_as(
609
+ type_=SubscriptionResource, # type: ignore
610
+ object_=_response.json(),
611
+ ),
612
+ )
613
+ return AsyncHttpResponse(response=_response, data=_data)
614
+ if _response.status_code == 422:
615
+ raise UnprocessableEntityError(
616
+ headers=dict(_response.headers),
617
+ body=typing.cast(
618
+ HttpValidationError,
619
+ parse_obj_as(
620
+ type_=HttpValidationError, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ ),
624
+ )
625
+ _response_json = _response.json()
626
+ except JSONDecodeError:
627
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
628
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
lark/types/__init__.py CHANGED
@@ -6,40 +6,37 @@ import typing
6
6
  from importlib import import_module
7
7
 
8
8
  if typing.TYPE_CHECKING:
9
- from .aggregation import (
10
- Aggregation,
11
- Aggregation_Count,
12
- Aggregation_Custom,
13
- Aggregation_Last,
14
- Aggregation_Max,
15
- Aggregation_Sum,
16
- )
9
+ from .aggregation import Aggregation, Aggregation_Count, Aggregation_Sum
17
10
  from .amount import Amount
18
11
  from .billing_state_response import BillingStateResponse
19
12
  from .count_aggregation_pricing_metric_interface import CountAggregationPricingMetricInterface
20
13
  from .count_aggregation_pricing_metric_resource import CountAggregationPricingMetricResource
21
14
  from .create_customer_portal_session_response import CreateCustomerPortalSessionResponse
22
- from .create_fixed_rate_interface import CreateFixedRateInterface
15
+ from .create_fixed_rate_request import CreateFixedRateRequest
23
16
  from .create_pricing_metric_response import CreatePricingMetricResponse
24
- from .create_simple_usage_based_rate_interface import CreateSimpleUsageBasedRateInterface
17
+ from .create_simple_usage_based_rate_request import CreateSimpleUsageBasedRateRequest
25
18
  from .create_subject_response import CreateSubjectResponse
26
19
  from .create_subscription_checkout_session_response import CreateSubscriptionCheckoutSessionResponse
27
20
  from .create_usage_event_summary_response import CreateUsageEventSummaryResponse
28
- from .custom_pricing_metric_resource import CustomPricingMetricResource
29
21
  from .fixed_rate_interface import FixedRateInterface
30
22
  from .flat_price import FlatPrice
31
23
  from .get_pricing_metric_response import GetPricingMetricResponse
32
24
  from .http_validation_error import HttpValidationError
33
- from .last_aggregation_pricing_metric_resource import LastAggregationPricingMetricResource
25
+ from .invoice_line_item_resource import InvoiceLineItemResource
26
+ from .invoice_resource import InvoiceResource
27
+ from .invoice_status import InvoiceStatus
28
+ from .list_invoices_response import ListInvoicesResponse
29
+ from .list_pricing_metrics_response import ListPricingMetricsResponse
34
30
  from .list_rate_cards_response import ListRateCardsResponse
35
31
  from .list_subjects_response import ListSubjectsResponse
36
32
  from .list_subscriptions_response import ListSubscriptionsResponse
37
- from .max_aggregation_pricing_metric_resource import MaxAggregationPricingMetricResource
38
33
  from .package_price import PackagePrice
39
34
  from .package_price_input_rounding_behavior import PackagePriceInputRoundingBehavior
40
35
  from .package_price_output_rounding_behavior import PackagePriceOutputRoundingBehavior
41
36
  from .period import Period
37
+ from .period_resource import PeriodResource
42
38
  from .price import Price, Price_Flat, Price_Package
39
+ from .pricing_metric_resource import PricingMetricResource
43
40
  from .rate_card_resource import RateCardResource
44
41
  from .rate_card_resource_billing_interval import RateCardResourceBillingInterval
45
42
  from .rate_card_resource_usage_based_rates_item import (
@@ -47,9 +44,9 @@ if typing.TYPE_CHECKING:
47
44
  RateCardResourceUsageBasedRatesItem_Simple,
48
45
  )
49
46
  from .simple_usage_based_rate_interface import SimpleUsageBasedRateInterface
50
- from .status import Status
51
47
  from .subject_resource import SubjectResource
52
48
  from .subscription_resource import SubscriptionResource
49
+ from .subscription_status import SubscriptionStatus
53
50
  from .sum_aggregation_pricing_metric_interface import SumAggregationPricingMetricInterface
54
51
  from .sum_aggregation_pricing_metric_resource import SumAggregationPricingMetricResource
55
52
  from .validation_error import ValidationError
@@ -58,46 +55,47 @@ if typing.TYPE_CHECKING:
58
55
  _dynamic_imports: typing.Dict[str, str] = {
59
56
  "Aggregation": ".aggregation",
60
57
  "Aggregation_Count": ".aggregation",
61
- "Aggregation_Custom": ".aggregation",
62
- "Aggregation_Last": ".aggregation",
63
- "Aggregation_Max": ".aggregation",
64
58
  "Aggregation_Sum": ".aggregation",
65
59
  "Amount": ".amount",
66
60
  "BillingStateResponse": ".billing_state_response",
67
61
  "CountAggregationPricingMetricInterface": ".count_aggregation_pricing_metric_interface",
68
62
  "CountAggregationPricingMetricResource": ".count_aggregation_pricing_metric_resource",
69
63
  "CreateCustomerPortalSessionResponse": ".create_customer_portal_session_response",
70
- "CreateFixedRateInterface": ".create_fixed_rate_interface",
64
+ "CreateFixedRateRequest": ".create_fixed_rate_request",
71
65
  "CreatePricingMetricResponse": ".create_pricing_metric_response",
72
- "CreateSimpleUsageBasedRateInterface": ".create_simple_usage_based_rate_interface",
66
+ "CreateSimpleUsageBasedRateRequest": ".create_simple_usage_based_rate_request",
73
67
  "CreateSubjectResponse": ".create_subject_response",
74
68
  "CreateSubscriptionCheckoutSessionResponse": ".create_subscription_checkout_session_response",
75
69
  "CreateUsageEventSummaryResponse": ".create_usage_event_summary_response",
76
- "CustomPricingMetricResource": ".custom_pricing_metric_resource",
77
70
  "FixedRateInterface": ".fixed_rate_interface",
78
71
  "FlatPrice": ".flat_price",
79
72
  "GetPricingMetricResponse": ".get_pricing_metric_response",
80
73
  "HttpValidationError": ".http_validation_error",
81
- "LastAggregationPricingMetricResource": ".last_aggregation_pricing_metric_resource",
74
+ "InvoiceLineItemResource": ".invoice_line_item_resource",
75
+ "InvoiceResource": ".invoice_resource",
76
+ "InvoiceStatus": ".invoice_status",
77
+ "ListInvoicesResponse": ".list_invoices_response",
78
+ "ListPricingMetricsResponse": ".list_pricing_metrics_response",
82
79
  "ListRateCardsResponse": ".list_rate_cards_response",
83
80
  "ListSubjectsResponse": ".list_subjects_response",
84
81
  "ListSubscriptionsResponse": ".list_subscriptions_response",
85
- "MaxAggregationPricingMetricResource": ".max_aggregation_pricing_metric_resource",
86
82
  "PackagePrice": ".package_price",
87
83
  "PackagePriceInputRoundingBehavior": ".package_price_input_rounding_behavior",
88
84
  "PackagePriceOutputRoundingBehavior": ".package_price_output_rounding_behavior",
89
85
  "Period": ".period",
86
+ "PeriodResource": ".period_resource",
90
87
  "Price": ".price",
91
88
  "Price_Flat": ".price",
92
89
  "Price_Package": ".price",
90
+ "PricingMetricResource": ".pricing_metric_resource",
93
91
  "RateCardResource": ".rate_card_resource",
94
92
  "RateCardResourceBillingInterval": ".rate_card_resource_billing_interval",
95
93
  "RateCardResourceUsageBasedRatesItem": ".rate_card_resource_usage_based_rates_item",
96
94
  "RateCardResourceUsageBasedRatesItem_Simple": ".rate_card_resource_usage_based_rates_item",
97
95
  "SimpleUsageBasedRateInterface": ".simple_usage_based_rate_interface",
98
- "Status": ".status",
99
96
  "SubjectResource": ".subject_resource",
100
97
  "SubscriptionResource": ".subscription_resource",
98
+ "SubscriptionStatus": ".subscription_status",
101
99
  "SumAggregationPricingMetricInterface": ".sum_aggregation_pricing_metric_interface",
102
100
  "SumAggregationPricingMetricResource": ".sum_aggregation_pricing_metric_resource",
103
101
  "ValidationError": ".validation_error",
@@ -130,46 +128,47 @@ def __dir__():
130
128
  __all__ = [
131
129
  "Aggregation",
132
130
  "Aggregation_Count",
133
- "Aggregation_Custom",
134
- "Aggregation_Last",
135
- "Aggregation_Max",
136
131
  "Aggregation_Sum",
137
132
  "Amount",
138
133
  "BillingStateResponse",
139
134
  "CountAggregationPricingMetricInterface",
140
135
  "CountAggregationPricingMetricResource",
141
136
  "CreateCustomerPortalSessionResponse",
142
- "CreateFixedRateInterface",
137
+ "CreateFixedRateRequest",
143
138
  "CreatePricingMetricResponse",
144
- "CreateSimpleUsageBasedRateInterface",
139
+ "CreateSimpleUsageBasedRateRequest",
145
140
  "CreateSubjectResponse",
146
141
  "CreateSubscriptionCheckoutSessionResponse",
147
142
  "CreateUsageEventSummaryResponse",
148
- "CustomPricingMetricResource",
149
143
  "FixedRateInterface",
150
144
  "FlatPrice",
151
145
  "GetPricingMetricResponse",
152
146
  "HttpValidationError",
153
- "LastAggregationPricingMetricResource",
147
+ "InvoiceLineItemResource",
148
+ "InvoiceResource",
149
+ "InvoiceStatus",
150
+ "ListInvoicesResponse",
151
+ "ListPricingMetricsResponse",
154
152
  "ListRateCardsResponse",
155
153
  "ListSubjectsResponse",
156
154
  "ListSubscriptionsResponse",
157
- "MaxAggregationPricingMetricResource",
158
155
  "PackagePrice",
159
156
  "PackagePriceInputRoundingBehavior",
160
157
  "PackagePriceOutputRoundingBehavior",
161
158
  "Period",
159
+ "PeriodResource",
162
160
  "Price",
163
161
  "Price_Flat",
164
162
  "Price_Package",
163
+ "PricingMetricResource",
165
164
  "RateCardResource",
166
165
  "RateCardResourceBillingInterval",
167
166
  "RateCardResourceUsageBasedRatesItem",
168
167
  "RateCardResourceUsageBasedRatesItem_Simple",
169
168
  "SimpleUsageBasedRateInterface",
170
- "Status",
171
169
  "SubjectResource",
172
170
  "SubscriptionResource",
171
+ "SubscriptionStatus",
173
172
  "SumAggregationPricingMetricInterface",
174
173
  "SumAggregationPricingMetricResource",
175
174
  "ValidationError",
lark/types/aggregation.py CHANGED
@@ -21,48 +21,6 @@ class Aggregation_Count(UniversalBaseModel):
21
21
  extra = pydantic.Extra.allow
22
22
 
23
23
 
24
- class Aggregation_Custom(UniversalBaseModel):
25
- aggregation_type: typing.Literal["custom"] = "custom"
26
- sql: str
27
-
28
- if IS_PYDANTIC_V2:
29
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
30
- else:
31
-
32
- class Config:
33
- frozen = True
34
- smart_union = True
35
- extra = pydantic.Extra.allow
36
-
37
-
38
- class Aggregation_Last(UniversalBaseModel):
39
- aggregation_type: typing.Literal["last"] = "last"
40
- value_field: str
41
-
42
- if IS_PYDANTIC_V2:
43
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
44
- else:
45
-
46
- class Config:
47
- frozen = True
48
- smart_union = True
49
- extra = pydantic.Extra.allow
50
-
51
-
52
- class Aggregation_Max(UniversalBaseModel):
53
- aggregation_type: typing.Literal["max"] = "max"
54
- value_field: str
55
-
56
- if IS_PYDANTIC_V2:
57
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
58
- else:
59
-
60
- class Config:
61
- frozen = True
62
- smart_union = True
63
- extra = pydantic.Extra.allow
64
-
65
-
66
24
  class Aggregation_Sum(UniversalBaseModel):
67
25
  aggregation_type: typing.Literal["sum"] = "sum"
68
26
  value_field: str
@@ -77,4 +35,4 @@ class Aggregation_Sum(UniversalBaseModel):
77
35
  extra = pydantic.Extra.allow
78
36
 
79
37
 
80
- Aggregation = typing.Union[Aggregation_Count, Aggregation_Custom, Aggregation_Last, Aggregation_Max, Aggregation_Sum]
38
+ Aggregation = typing.Union[Aggregation_Count, Aggregation_Sum]
@@ -7,7 +7,7 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
  from .price import Price
8
8
 
9
9
 
10
- class CreateFixedRateInterface(UniversalBaseModel):
10
+ class CreateFixedRateRequest(UniversalBaseModel):
11
11
  name: typing.Optional[str] = None
12
12
  description: typing.Optional[str] = None
13
13
  price: Price
@@ -7,13 +7,15 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
  from .price import Price
8
8
 
9
9
 
10
- class CreateSimpleUsageBasedRateInterface(UniversalBaseModel):
11
- usage_based_rate_type: typing.Optional[typing.Literal["simple"]] = None
10
+ class CreateSimpleUsageBasedRateRequest(UniversalBaseModel):
12
11
  name: typing.Optional[str] = None
13
12
  description: typing.Optional[str] = None
14
13
  price: Price
15
14
  included_units: typing.Optional[int] = None
16
- pricing_metric_id: str
15
+ pricing_metric_id: str = pydantic.Field()
16
+ """
17
+ The ID of the pricing metric to use for this rate.
18
+ """
17
19
 
18
20
  if IS_PYDANTIC_V2:
19
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -8,12 +8,35 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
8
 
9
9
 
10
10
  class CreateSubjectResponse(UniversalBaseModel):
11
- id: str
12
- external_id: typing.Optional[str] = None
13
- name: typing.Optional[str] = None
14
- email: typing.Optional[str] = None
15
- metadata: typing.Dict[str, str]
16
- created_at: dt.datetime
11
+ id: str = pydantic.Field()
12
+ """
13
+ The ID of the subject.
14
+ """
15
+
16
+ external_id: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ The ID of the subject in your system. You may pass it to the API in place of the subject ID.
19
+ """
20
+
21
+ name: typing.Optional[str] = pydantic.Field(default=None)
22
+ """
23
+ The name of the subject. Used for display in the dashboard.
24
+ """
25
+
26
+ email: typing.Optional[str] = pydantic.Field(default=None)
27
+ """
28
+ The email of the subject.
29
+ """
30
+
31
+ metadata: typing.Dict[str, str] = pydantic.Field()
32
+ """
33
+ Additional metadata about the subject. You may use this to store any custom data about the subject.
34
+ """
35
+
36
+ created_at: dt.datetime = pydantic.Field()
37
+ """
38
+ The date and time the subject was created.
39
+ """
17
40
 
18
41
  if IS_PYDANTIC_V2:
19
42
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -4,10 +4,14 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .amount import Amount
7
8
 
8
9
 
9
- class CustomPricingMetricResource(UniversalBaseModel):
10
- sql: str
10
+ class InvoiceLineItemResource(UniversalBaseModel):
11
+ amount: Amount
12
+ description: str
13
+ quantity: int
14
+ price_in_unit_amount: Amount
11
15
 
12
16
  if IS_PYDANTIC_V2:
13
17
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+
6
+ import pydantic
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
8
+ from .amount import Amount
9
+ from .invoice_line_item_resource import InvoiceLineItemResource
10
+ from .invoice_status import InvoiceStatus
11
+
12
+
13
+ class InvoiceResource(UniversalBaseModel):
14
+ id: str
15
+ merchant_id: str
16
+ bill_id: typing.Optional[str] = None
17
+ total_amount: Amount
18
+ subject_id: str
19
+ created_at: dt.datetime
20
+ status: InvoiceStatus
21
+ hosted_url: typing.Optional[str] = None
22
+ line_items: typing.List[InvoiceLineItemResource]
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,5 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ InvoiceStatus = typing.Union[typing.Literal["draft", "open", "paid", "uncollectible", "void"], typing.Any]
@@ -4,10 +4,12 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+ from .invoice_resource import InvoiceResource
7
8
 
8
9
 
9
- class MaxAggregationPricingMetricResource(UniversalBaseModel):
10
- value_field: str
10
+ class ListInvoicesResponse(UniversalBaseModel):
11
+ invoices: typing.List[InvoiceResource]
12
+ has_more: bool
11
13
 
12
14
  if IS_PYDANTIC_V2:
13
15
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2