lark-billing 0.0.8__py3-none-any.whl → 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.

Potentially problematic release.


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

Files changed (51) hide show
  1. lark/__init__.py +41 -16
  2. lark/checkout/client.py +8 -4
  3. lark/checkout/raw_client.py +4 -0
  4. lark/core/client_wrapper.py +2 -2
  5. lark/customer_portal/client.py +4 -2
  6. lark/customer_portal/raw_client.py +2 -0
  7. lark/pricing_metrics/__init__.py +19 -2
  8. lark/pricing_metrics/client.py +148 -22
  9. lark/pricing_metrics/raw_client.py +159 -20
  10. lark/pricing_metrics/types/__init__.py +14 -1
  11. lark/pricing_metrics/types/pricing_metric_aggregation.py +69 -1
  12. lark/rate_cards/client.py +74 -12
  13. lark/rate_cards/raw_client.py +24 -14
  14. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +1 -1
  15. lark/subjects/client.py +12 -2
  16. lark/subscriptions/client.py +4 -2
  17. lark/subscriptions/raw_client.py +2 -0
  18. lark/types/__init__.py +23 -13
  19. lark/types/aggregation.py +45 -1
  20. lark/types/amount.py +4 -1
  21. lark/types/billing_state_response.py +9 -2
  22. lark/types/count_aggregation_pricing_metric_interface.py +4 -0
  23. lark/types/create_customer_portal_session_response.py +9 -2
  24. lark/types/create_fixed_rate_request.py +10 -2
  25. lark/types/create_simple_usage_based_rate_request.py +15 -3
  26. lark/types/create_subscription_checkout_session_response.py +14 -3
  27. lark/types/custom_aggregation_pricing_metric_interface.py +26 -0
  28. lark/types/fixed_rate_interface.py +1 -1
  29. lark/types/invoice_resource.py +34 -9
  30. lark/types/last_aggregation_pricing_metric_interface.py +26 -0
  31. lark/types/{get_pricing_metric_response.py → last_aggregation_pricing_metric_resource.py} +5 -7
  32. lark/types/{create_usage_event_summary_response.py → max_aggregation_pricing_metric_interface.py} +9 -6
  33. lark/types/{create_pricing_metric_response.py → max_aggregation_pricing_metric_resource.py} +5 -7
  34. lark/types/period.py +3 -2
  35. lark/types/pricing_metric_resource.py +24 -5
  36. lark/types/pricing_metric_summary_resource.py +43 -0
  37. lark/types/rate_card_resource.py +36 -7
  38. lark/types/rate_card_resource_usage_based_rates_item.py +1 -1
  39. lark/types/simple_usage_based_rate_interface.py +1 -1
  40. lark/types/subscription_resource.py +39 -8
  41. lark/types/sum_aggregation_pricing_metric_interface.py +4 -0
  42. lark/types/sum_aggregation_pricing_metric_resource.py +4 -1
  43. lark/usage_events/__init__.py +3 -3
  44. lark/usage_events/client.py +40 -131
  45. lark/usage_events/raw_client.py +21 -147
  46. lark/usage_events/types/__init__.py +3 -5
  47. lark/{types/value.py → usage_events/types/create_usage_event_request_data_value.py} +1 -1
  48. {lark_billing-0.0.8.dist-info → lark_billing-0.1.0.dist-info}/METADATA +5 -5
  49. {lark_billing-0.0.8.dist-info → lark_billing-0.1.0.dist-info}/RECORD +50 -48
  50. lark/usage_events/types/create_usage_event_summary_request_aggregation_type.py +0 -5
  51. {lark_billing-0.0.8.dist-info → lark_billing-0.1.0.dist-info}/WHEEL +0 -0
@@ -11,7 +11,7 @@ from ...types.price import Price
11
11
 
12
12
  class CreateRateCardRequestUsageBasedRatesItem_Simple(UniversalBaseModel):
13
13
  usage_based_rate_type: typing.Literal["simple"] = "simple"
14
- name: typing.Optional[str] = None
14
+ name: str
15
15
  description: typing.Optional[str] = None
16
16
  price: Price
17
17
  included_units: typing.Optional[int] = None
lark/subjects/client.py CHANGED
@@ -104,7 +104,12 @@ class SubjectsClient:
104
104
  client = Lark(
105
105
  api_key="YOUR_API_KEY",
106
106
  )
107
- client.subjects.create_subject()
107
+ client.subjects.create_subject(
108
+ external_id="user_1234567890",
109
+ name="John Doe",
110
+ email="john.doe@example.com",
111
+ metadata={"key": "value"},
112
+ )
108
113
  """
109
114
  _response = self._raw_client.create_subject(
110
115
  external_id=external_id, name=name, email=email, metadata=metadata, request_options=request_options
@@ -323,7 +328,12 @@ class AsyncSubjectsClient:
323
328
 
324
329
 
325
330
  async def main() -> None:
326
- await client.subjects.create_subject()
331
+ await client.subjects.create_subject(
332
+ external_id="user_1234567890",
333
+ name="John Doe",
334
+ email="john.doe@example.com",
335
+ metadata={"key": "value"},
336
+ )
327
337
 
328
338
 
329
339
  asyncio.run(main())
@@ -202,6 +202,7 @@ class SubscriptionsClient:
202
202
  subscription_id : str
203
203
 
204
204
  rate_card_id : str
205
+ The ID of the rate card to change the subscription to.
205
206
 
206
207
  request_options : typing.Optional[RequestOptions]
207
208
  Request-specific configuration.
@@ -220,7 +221,7 @@ class SubscriptionsClient:
220
221
  )
221
222
  client.subscriptions.change_subscription_rate_card(
222
223
  subscription_id="subscription_id",
223
- rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
224
+ rate_card_id="rc_jQK2n0wutCj6bBcAIrL6o07g",
224
225
  )
225
226
  """
226
227
  _response = self._raw_client.change_subscription_rate_card(
@@ -451,6 +452,7 @@ class AsyncSubscriptionsClient:
451
452
  subscription_id : str
452
453
 
453
454
  rate_card_id : str
455
+ The ID of the rate card to change the subscription to.
454
456
 
455
457
  request_options : typing.Optional[RequestOptions]
456
458
  Request-specific configuration.
@@ -474,7 +476,7 @@ class AsyncSubscriptionsClient:
474
476
  async def main() -> None:
475
477
  await client.subscriptions.change_subscription_rate_card(
476
478
  subscription_id="subscription_id",
477
- rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
479
+ rate_card_id="rc_jQK2n0wutCj6bBcAIrL6o07g",
478
480
  )
479
481
 
480
482
 
@@ -275,6 +275,7 @@ class RawSubscriptionsClient:
275
275
  subscription_id : str
276
276
 
277
277
  rate_card_id : str
278
+ The ID of the rate card to change the subscription to.
278
279
 
279
280
  request_options : typing.Optional[RequestOptions]
280
281
  Request-specific configuration.
@@ -580,6 +581,7 @@ class AsyncRawSubscriptionsClient:
580
581
  subscription_id : str
581
582
 
582
583
  rate_card_id : str
584
+ The ID of the rate card to change the subscription to.
583
585
 
584
586
  request_options : typing.Optional[RequestOptions]
585
587
  Request-specific configuration.
lark/types/__init__.py CHANGED
@@ -6,30 +6,32 @@ import typing
6
6
  from importlib import import_module
7
7
 
8
8
  if typing.TYPE_CHECKING:
9
- from .aggregation import Aggregation, Aggregation_Count, Aggregation_Sum
9
+ from .aggregation import Aggregation, Aggregation_Count, Aggregation_Last, Aggregation_Max, Aggregation_Sum
10
10
  from .amount import Amount
11
11
  from .billing_state_response import BillingStateResponse
12
12
  from .count_aggregation_pricing_metric_interface import CountAggregationPricingMetricInterface
13
13
  from .count_aggregation_pricing_metric_resource import CountAggregationPricingMetricResource
14
14
  from .create_customer_portal_session_response import CreateCustomerPortalSessionResponse
15
15
  from .create_fixed_rate_request import CreateFixedRateRequest
16
- from .create_pricing_metric_response import CreatePricingMetricResponse
17
16
  from .create_simple_usage_based_rate_request import CreateSimpleUsageBasedRateRequest
18
17
  from .create_subject_response import CreateSubjectResponse
19
18
  from .create_subscription_checkout_session_response import CreateSubscriptionCheckoutSessionResponse
20
- from .create_usage_event_summary_response import CreateUsageEventSummaryResponse
19
+ from .custom_aggregation_pricing_metric_interface import CustomAggregationPricingMetricInterface
21
20
  from .fixed_rate_interface import FixedRateInterface
22
21
  from .flat_price import FlatPrice
23
- from .get_pricing_metric_response import GetPricingMetricResponse
24
22
  from .http_validation_error import HttpValidationError
25
23
  from .invoice_line_item_resource import InvoiceLineItemResource
26
24
  from .invoice_resource import InvoiceResource
27
25
  from .invoice_status import InvoiceStatus
26
+ from .last_aggregation_pricing_metric_interface import LastAggregationPricingMetricInterface
27
+ from .last_aggregation_pricing_metric_resource import LastAggregationPricingMetricResource
28
28
  from .list_invoices_response import ListInvoicesResponse
29
29
  from .list_pricing_metrics_response import ListPricingMetricsResponse
30
30
  from .list_rate_cards_response import ListRateCardsResponse
31
31
  from .list_subjects_response import ListSubjectsResponse
32
32
  from .list_subscriptions_response import ListSubscriptionsResponse
33
+ from .max_aggregation_pricing_metric_interface import MaxAggregationPricingMetricInterface
34
+ from .max_aggregation_pricing_metric_resource import MaxAggregationPricingMetricResource
33
35
  from .package_price import PackagePrice
34
36
  from .package_price_input_rounding_behavior import PackagePriceInputRoundingBehavior
35
37
  from .package_price_output_rounding_behavior import PackagePriceOutputRoundingBehavior
@@ -37,6 +39,7 @@ if typing.TYPE_CHECKING:
37
39
  from .period_resource import PeriodResource
38
40
  from .price import Price, Price_Flat, Price_Package
39
41
  from .pricing_metric_resource import PricingMetricResource
42
+ from .pricing_metric_summary_resource import PricingMetricSummaryResource
40
43
  from .rate_card_resource import RateCardResource
41
44
  from .rate_card_resource_billing_interval import RateCardResourceBillingInterval
42
45
  from .rate_card_resource_usage_based_rates_item import (
@@ -51,10 +54,11 @@ if typing.TYPE_CHECKING:
51
54
  from .sum_aggregation_pricing_metric_resource import SumAggregationPricingMetricResource
52
55
  from .validation_error import ValidationError
53
56
  from .validation_error_loc_item import ValidationErrorLocItem
54
- from .value import Value
55
57
  _dynamic_imports: typing.Dict[str, str] = {
56
58
  "Aggregation": ".aggregation",
57
59
  "Aggregation_Count": ".aggregation",
60
+ "Aggregation_Last": ".aggregation",
61
+ "Aggregation_Max": ".aggregation",
58
62
  "Aggregation_Sum": ".aggregation",
59
63
  "Amount": ".amount",
60
64
  "BillingStateResponse": ".billing_state_response",
@@ -62,23 +66,25 @@ _dynamic_imports: typing.Dict[str, str] = {
62
66
  "CountAggregationPricingMetricResource": ".count_aggregation_pricing_metric_resource",
63
67
  "CreateCustomerPortalSessionResponse": ".create_customer_portal_session_response",
64
68
  "CreateFixedRateRequest": ".create_fixed_rate_request",
65
- "CreatePricingMetricResponse": ".create_pricing_metric_response",
66
69
  "CreateSimpleUsageBasedRateRequest": ".create_simple_usage_based_rate_request",
67
70
  "CreateSubjectResponse": ".create_subject_response",
68
71
  "CreateSubscriptionCheckoutSessionResponse": ".create_subscription_checkout_session_response",
69
- "CreateUsageEventSummaryResponse": ".create_usage_event_summary_response",
72
+ "CustomAggregationPricingMetricInterface": ".custom_aggregation_pricing_metric_interface",
70
73
  "FixedRateInterface": ".fixed_rate_interface",
71
74
  "FlatPrice": ".flat_price",
72
- "GetPricingMetricResponse": ".get_pricing_metric_response",
73
75
  "HttpValidationError": ".http_validation_error",
74
76
  "InvoiceLineItemResource": ".invoice_line_item_resource",
75
77
  "InvoiceResource": ".invoice_resource",
76
78
  "InvoiceStatus": ".invoice_status",
79
+ "LastAggregationPricingMetricInterface": ".last_aggregation_pricing_metric_interface",
80
+ "LastAggregationPricingMetricResource": ".last_aggregation_pricing_metric_resource",
77
81
  "ListInvoicesResponse": ".list_invoices_response",
78
82
  "ListPricingMetricsResponse": ".list_pricing_metrics_response",
79
83
  "ListRateCardsResponse": ".list_rate_cards_response",
80
84
  "ListSubjectsResponse": ".list_subjects_response",
81
85
  "ListSubscriptionsResponse": ".list_subscriptions_response",
86
+ "MaxAggregationPricingMetricInterface": ".max_aggregation_pricing_metric_interface",
87
+ "MaxAggregationPricingMetricResource": ".max_aggregation_pricing_metric_resource",
82
88
  "PackagePrice": ".package_price",
83
89
  "PackagePriceInputRoundingBehavior": ".package_price_input_rounding_behavior",
84
90
  "PackagePriceOutputRoundingBehavior": ".package_price_output_rounding_behavior",
@@ -88,6 +94,7 @@ _dynamic_imports: typing.Dict[str, str] = {
88
94
  "Price_Flat": ".price",
89
95
  "Price_Package": ".price",
90
96
  "PricingMetricResource": ".pricing_metric_resource",
97
+ "PricingMetricSummaryResource": ".pricing_metric_summary_resource",
91
98
  "RateCardResource": ".rate_card_resource",
92
99
  "RateCardResourceBillingInterval": ".rate_card_resource_billing_interval",
93
100
  "RateCardResourceUsageBasedRatesItem": ".rate_card_resource_usage_based_rates_item",
@@ -100,7 +107,6 @@ _dynamic_imports: typing.Dict[str, str] = {
100
107
  "SumAggregationPricingMetricResource": ".sum_aggregation_pricing_metric_resource",
101
108
  "ValidationError": ".validation_error",
102
109
  "ValidationErrorLocItem": ".validation_error_loc_item",
103
- "Value": ".value",
104
110
  }
105
111
 
106
112
 
@@ -128,6 +134,8 @@ def __dir__():
128
134
  __all__ = [
129
135
  "Aggregation",
130
136
  "Aggregation_Count",
137
+ "Aggregation_Last",
138
+ "Aggregation_Max",
131
139
  "Aggregation_Sum",
132
140
  "Amount",
133
141
  "BillingStateResponse",
@@ -135,23 +143,25 @@ __all__ = [
135
143
  "CountAggregationPricingMetricResource",
136
144
  "CreateCustomerPortalSessionResponse",
137
145
  "CreateFixedRateRequest",
138
- "CreatePricingMetricResponse",
139
146
  "CreateSimpleUsageBasedRateRequest",
140
147
  "CreateSubjectResponse",
141
148
  "CreateSubscriptionCheckoutSessionResponse",
142
- "CreateUsageEventSummaryResponse",
149
+ "CustomAggregationPricingMetricInterface",
143
150
  "FixedRateInterface",
144
151
  "FlatPrice",
145
- "GetPricingMetricResponse",
146
152
  "HttpValidationError",
147
153
  "InvoiceLineItemResource",
148
154
  "InvoiceResource",
149
155
  "InvoiceStatus",
156
+ "LastAggregationPricingMetricInterface",
157
+ "LastAggregationPricingMetricResource",
150
158
  "ListInvoicesResponse",
151
159
  "ListPricingMetricsResponse",
152
160
  "ListRateCardsResponse",
153
161
  "ListSubjectsResponse",
154
162
  "ListSubscriptionsResponse",
163
+ "MaxAggregationPricingMetricInterface",
164
+ "MaxAggregationPricingMetricResource",
155
165
  "PackagePrice",
156
166
  "PackagePriceInputRoundingBehavior",
157
167
  "PackagePriceOutputRoundingBehavior",
@@ -161,6 +171,7 @@ __all__ = [
161
171
  "Price_Flat",
162
172
  "Price_Package",
163
173
  "PricingMetricResource",
174
+ "PricingMetricSummaryResource",
164
175
  "RateCardResource",
165
176
  "RateCardResourceBillingInterval",
166
177
  "RateCardResourceUsageBasedRatesItem",
@@ -173,5 +184,4 @@ __all__ = [
173
184
  "SumAggregationPricingMetricResource",
174
185
  "ValidationError",
175
186
  "ValidationErrorLocItem",
176
- "Value",
177
187
  ]
lark/types/aggregation.py CHANGED
@@ -9,6 +9,10 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
9
 
10
10
 
11
11
  class Aggregation_Count(UniversalBaseModel):
12
+ """
13
+ The aggregation function used to compute the value of the pricing metric.
14
+ """
15
+
12
16
  aggregation_type: typing.Literal["count"] = "count"
13
17
 
14
18
  if IS_PYDANTIC_V2:
@@ -21,7 +25,47 @@ class Aggregation_Count(UniversalBaseModel):
21
25
  extra = pydantic.Extra.allow
22
26
 
23
27
 
28
+ class Aggregation_Last(UniversalBaseModel):
29
+ """
30
+ The aggregation function used to compute the value of the pricing metric.
31
+ """
32
+
33
+ aggregation_type: typing.Literal["last"] = "last"
34
+ value_field: str
35
+
36
+ if IS_PYDANTIC_V2:
37
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38
+ else:
39
+
40
+ class Config:
41
+ frozen = True
42
+ smart_union = True
43
+ extra = pydantic.Extra.allow
44
+
45
+
46
+ class Aggregation_Max(UniversalBaseModel):
47
+ """
48
+ The aggregation function used to compute the value of the pricing metric.
49
+ """
50
+
51
+ aggregation_type: typing.Literal["max"] = "max"
52
+ value_field: str
53
+
54
+ if IS_PYDANTIC_V2:
55
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
56
+ else:
57
+
58
+ class Config:
59
+ frozen = True
60
+ smart_union = True
61
+ extra = pydantic.Extra.allow
62
+
63
+
24
64
  class Aggregation_Sum(UniversalBaseModel):
65
+ """
66
+ The aggregation function used to compute the value of the pricing metric.
67
+ """
68
+
25
69
  aggregation_type: typing.Literal["sum"] = "sum"
26
70
  value_field: str
27
71
 
@@ -35,4 +79,4 @@ class Aggregation_Sum(UniversalBaseModel):
35
79
  extra = pydantic.Extra.allow
36
80
 
37
81
 
38
- Aggregation = typing.Union[Aggregation_Count, Aggregation_Sum]
82
+ Aggregation = typing.Union[Aggregation_Count, Aggregation_Last, Aggregation_Max, Aggregation_Sum]
lark/types/amount.py CHANGED
@@ -12,7 +12,10 @@ class Amount(UniversalBaseModel):
12
12
  The value of the amount in the smallest unit of the currency.
13
13
  """
14
14
 
15
- currency_code: str
15
+ currency_code: str = pydantic.Field()
16
+ """
17
+ The currency code of the amount.
18
+ """
16
19
 
17
20
  if IS_PYDANTIC_V2:
18
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -7,8 +7,15 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
 
8
8
 
9
9
  class BillingStateResponse(UniversalBaseModel):
10
- has_active_subscription: bool
11
- has_overage_for_usage: bool
10
+ has_active_subscription: bool = pydantic.Field()
11
+ """
12
+ Whether the subject has an active subscription.
13
+ """
14
+
15
+ has_overage_for_usage: bool = pydantic.Field()
16
+ """
17
+ Whether the subject has exceeded the included usage (if any) on a usage-based rate they are subscribed to.
18
+ """
12
19
 
13
20
  if IS_PYDANTIC_V2:
14
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -7,6 +7,10 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
 
8
8
 
9
9
  class CountAggregationPricingMetricInterface(UniversalBaseModel):
10
+ """
11
+ Computes the number of usage events with the specified `event_name`.
12
+ """
13
+
10
14
  if IS_PYDANTIC_V2:
11
15
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
12
16
  else:
@@ -7,8 +7,15 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
7
 
8
8
 
9
9
  class CreateCustomerPortalSessionResponse(UniversalBaseModel):
10
- subject_id: str
11
- url: str
10
+ subject_id: str = pydantic.Field()
11
+ """
12
+ The ID of the subject for the customer portal session.
13
+ """
14
+
15
+ url: str = pydantic.Field()
16
+ """
17
+ The URL to redirect to the customer portal session.
18
+ """
12
19
 
13
20
  if IS_PYDANTIC_V2:
14
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -8,8 +8,16 @@ from .price import Price
8
8
 
9
9
 
10
10
  class CreateFixedRateRequest(UniversalBaseModel):
11
- name: typing.Optional[str] = None
12
- description: typing.Optional[str] = None
11
+ name: str = pydantic.Field()
12
+ """
13
+ The name of the rate displayed to the customer.
14
+ """
15
+
16
+ description: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ The description of the rate displayed to the customer.
19
+ """
20
+
13
21
  price: Price
14
22
 
15
23
  if IS_PYDANTIC_V2:
@@ -8,10 +8,22 @@ from .price import Price
8
8
 
9
9
 
10
10
  class CreateSimpleUsageBasedRateRequest(UniversalBaseModel):
11
- name: typing.Optional[str] = None
12
- description: typing.Optional[str] = None
11
+ name: str = pydantic.Field()
12
+ """
13
+ The name of the rate displayed to the customer.
14
+ """
15
+
16
+ description: typing.Optional[str] = pydantic.Field(default=None)
17
+ """
18
+ The description of the rate displayed to the customer.
19
+ """
20
+
13
21
  price: Price
14
- included_units: typing.Optional[int] = None
22
+ included_units: typing.Optional[int] = pydantic.Field(default=None)
23
+ """
24
+ The number of units included in the rate before the price is applied.
25
+ """
26
+
15
27
  pricing_metric_id: str = pydantic.Field()
16
28
  """
17
29
  The ID of the pricing metric to use for this rate.
@@ -8,9 +8,20 @@ from .amount import Amount
8
8
 
9
9
 
10
10
  class CreateSubscriptionCheckoutSessionResponse(UniversalBaseModel):
11
- id: str
12
- amount: Amount
13
- url: str
11
+ id: str = pydantic.Field()
12
+ """
13
+ The ID of the checkout session.
14
+ """
15
+
16
+ amount: Amount = pydantic.Field()
17
+ """
18
+ The amount of the checkout session.
19
+ """
20
+
21
+ url: str = pydantic.Field()
22
+ """
23
+ The URL to redirect to the checkout session.
24
+ """
14
25
 
15
26
  if IS_PYDANTIC_V2:
16
27
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,26 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+
8
+
9
+ class CustomAggregationPricingMetricInterface(UniversalBaseModel):
10
+ """
11
+ Custom aggregation for use cases not supported by the other aggregation types. Please email team@uselark.ai to enable this feature.
12
+ """
13
+
14
+ custom_expression: str = pydantic.Field()
15
+ """
16
+ Custom expression to compute the pricing metric. Please email team@uselark.ai to enable this feature.
17
+ """
18
+
19
+ if IS_PYDANTIC_V2:
20
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
21
+ else:
22
+
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ extra = pydantic.Extra.allow
@@ -10,7 +10,7 @@ from .price import Price
10
10
  class FixedRateInterface(UniversalBaseModel):
11
11
  id: str
12
12
  name: str
13
- description: str
13
+ description: typing.Optional[str] = None
14
14
  price: Price
15
15
 
16
16
  if IS_PYDANTIC_V2:
@@ -11,15 +11,40 @@ from .invoice_status import InvoiceStatus
11
11
 
12
12
 
13
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]
14
+ id: str = pydantic.Field()
15
+ """
16
+ The ID of the invoice.
17
+ """
18
+
19
+ total_amount: Amount = pydantic.Field()
20
+ """
21
+ The total amount of the invoice.
22
+ """
23
+
24
+ subject_id: str = pydantic.Field()
25
+ """
26
+ The ID of the subject for the invoice.
27
+ """
28
+
29
+ created_at: dt.datetime = pydantic.Field()
30
+ """
31
+ The date and time the invoice was created.
32
+ """
33
+
34
+ status: InvoiceStatus = pydantic.Field()
35
+ """
36
+ The status of the invoice.
37
+ """
38
+
39
+ hosted_url: typing.Optional[str] = pydantic.Field(default=None)
40
+ """
41
+ The URL of the hosted invoice.
42
+ """
43
+
44
+ line_items: typing.List[InvoiceLineItemResource] = pydantic.Field()
45
+ """
46
+ The line items of the invoice.
47
+ """
23
48
 
24
49
  if IS_PYDANTIC_V2:
25
50
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,26 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ import pydantic
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
+
8
+
9
+ class LastAggregationPricingMetricInterface(UniversalBaseModel):
10
+ """
11
+ Computes the last value of the `value_field` over all usage events with the specified `event_name`.
12
+ """
13
+
14
+ value_field: str = pydantic.Field()
15
+ """
16
+ Field to get the last value of.
17
+ """
18
+
19
+ if IS_PYDANTIC_V2:
20
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
21
+ else:
22
+
23
+ class Config:
24
+ frozen = True
25
+ smart_union = True
26
+ extra = pydantic.Extra.allow
@@ -4,15 +4,13 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from .aggregation import Aggregation
8
7
 
9
8
 
10
- class GetPricingMetricResponse(UniversalBaseModel):
11
- id: str
12
- name: str
13
- event_name: str
14
- aggregation: Aggregation
15
- unit: str
9
+ class LastAggregationPricingMetricResource(UniversalBaseModel):
10
+ value_field: str = pydantic.Field()
11
+ """
12
+ The field to get the last value of.
13
+ """
16
14
 
17
15
  if IS_PYDANTIC_V2:
18
16
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -4,14 +4,17 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from .period import Period
8
7
 
9
8
 
10
- class CreateUsageEventSummaryResponse(UniversalBaseModel):
11
- event_name: str
12
- subject_id: str
13
- value: typing.Optional[str] = None
14
- period: Period
9
+ class MaxAggregationPricingMetricInterface(UniversalBaseModel):
10
+ """
11
+ Computes the max value of the `value_field` over all usage events with the specified `event_name`.
12
+ """
13
+
14
+ value_field: str = pydantic.Field()
15
+ """
16
+ Field to get the max value of.
17
+ """
15
18
 
16
19
  if IS_PYDANTIC_V2:
17
20
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -4,15 +4,13 @@ import typing
4
4
 
5
5
  import pydantic
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
7
- from .aggregation import Aggregation
8
7
 
9
8
 
10
- class CreatePricingMetricResponse(UniversalBaseModel):
11
- id: str
12
- name: str
13
- event_name: str
14
- aggregation: Aggregation
15
- unit: str
9
+ class MaxAggregationPricingMetricResource(UniversalBaseModel):
10
+ value_field: str = pydantic.Field()
11
+ """
12
+ The field to get the max value of.
13
+ """
16
14
 
17
15
  if IS_PYDANTIC_V2:
18
16
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
lark/types/period.py CHANGED
@@ -1,5 +1,6 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
+ import datetime as dt
3
4
  import typing
4
5
 
5
6
  import pydantic
@@ -9,8 +10,8 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
9
10
  class Period(UniversalBaseModel):
10
11
  inclusive_start: typing.Optional[bool] = None
11
12
  inclusive_end: typing.Optional[bool] = None
12
- start: str
13
- end: str
13
+ start: dt.datetime
14
+ end: dt.datetime
14
15
 
15
16
  if IS_PYDANTIC_V2:
16
17
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2