lark-billing 0.0.9__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.
- lark/__init__.py +39 -16
- lark/core/client_wrapper.py +2 -2
- lark/pricing_metrics/__init__.py +19 -2
- lark/pricing_metrics/client.py +148 -22
- lark/pricing_metrics/raw_client.py +159 -20
- lark/pricing_metrics/types/__init__.py +14 -1
- lark/pricing_metrics/types/pricing_metric_aggregation.py +69 -1
- lark/rate_cards/client.py +58 -2
- lark/rate_cards/raw_client.py +4 -0
- lark/subjects/client.py +12 -2
- lark/types/__init__.py +23 -13
- lark/types/aggregation.py +45 -1
- lark/types/billing_state_response.py +9 -2
- lark/types/count_aggregation_pricing_metric_interface.py +4 -0
- lark/types/custom_aggregation_pricing_metric_interface.py +26 -0
- lark/types/last_aggregation_pricing_metric_interface.py +26 -0
- lark/types/{get_pricing_metric_response.py → last_aggregation_pricing_metric_resource.py} +5 -7
- lark/types/{create_usage_event_summary_response.py → max_aggregation_pricing_metric_interface.py} +9 -6
- lark/types/{create_pricing_metric_response.py → max_aggregation_pricing_metric_resource.py} +5 -7
- lark/types/period.py +3 -2
- lark/types/pricing_metric_resource.py +24 -5
- lark/types/pricing_metric_summary_resource.py +43 -0
- lark/types/sum_aggregation_pricing_metric_interface.py +4 -0
- lark/types/sum_aggregation_pricing_metric_resource.py +4 -1
- lark/usage_events/__init__.py +3 -6
- lark/usage_events/client.py +25 -127
- lark/usage_events/raw_client.py +0 -141
- lark/usage_events/types/__init__.py +2 -6
- lark/usage_events/types/create_usage_event_request_data_value.py +1 -1
- {lark_billing-0.0.9.dist-info → lark_billing-0.1.0.dist-info}/METADATA +1 -1
- {lark_billing-0.0.9.dist-info → lark_billing-0.1.0.dist-info}/RECORD +32 -31
- lark/types/value.py +0 -5
- lark/usage_events/types/create_usage_event_summary_request_aggregation_type.py +0 -5
- {lark_billing-0.0.9.dist-info → lark_billing-0.1.0.dist-info}/WHEEL +0 -0
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 .
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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]
|
|
@@ -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
|
-
|
|
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:
|
|
@@ -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
|
|
@@ -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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
lark/types/{create_usage_event_summary_response.py → max_aggregation_pricing_metric_interface.py}
RENAMED
|
@@ -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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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:
|
|
13
|
-
end:
|
|
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
|
|
@@ -8,11 +8,30 @@ from .aggregation import Aggregation
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class PricingMetricResource(UniversalBaseModel):
|
|
11
|
-
id: str
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
id: str = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
The ID of the pricing metric.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
name: str = pydantic.Field()
|
|
17
|
+
"""
|
|
18
|
+
The name of the pricing metric.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
event_name: str = pydantic.Field()
|
|
22
|
+
"""
|
|
23
|
+
The event name that the pricing metric is computed on.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
aggregation: Aggregation = pydantic.Field()
|
|
27
|
+
"""
|
|
28
|
+
The aggregation function used to compute the value of the pricing metric.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
unit: str = pydantic.Field()
|
|
32
|
+
"""
|
|
33
|
+
The unit of the value computed by the pricing metric.
|
|
34
|
+
"""
|
|
16
35
|
|
|
17
36
|
if IS_PYDANTIC_V2:
|
|
18
37
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
from .period import Period
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class PricingMetricSummaryResource(UniversalBaseModel):
|
|
11
|
+
id: str = pydantic.Field()
|
|
12
|
+
"""
|
|
13
|
+
The ID of the pricing metric summary.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
pricing_metric_id: str = pydantic.Field()
|
|
17
|
+
"""
|
|
18
|
+
The ID of the pricing metric that the summary is for.
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
subject_id: str = pydantic.Field()
|
|
22
|
+
"""
|
|
23
|
+
The ID of the subject that the summary is for.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
period: Period = pydantic.Field()
|
|
27
|
+
"""
|
|
28
|
+
The period that the summary is computed over.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
value: typing.Optional[str] = pydantic.Field(default=None)
|
|
32
|
+
"""
|
|
33
|
+
The computed value of the pricing metric for the period. If the pricing metric does not have any usage events for the period, this will be `null`.
|
|
34
|
+
"""
|
|
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
|
|
@@ -7,6 +7,10 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class SumAggregationPricingMetricInterface(UniversalBaseModel):
|
|
10
|
+
"""
|
|
11
|
+
Computes the sum of the `value_field` over all usage events with the specified `event_name`.
|
|
12
|
+
"""
|
|
13
|
+
|
|
10
14
|
value_field: str = pydantic.Field()
|
|
11
15
|
"""
|
|
12
16
|
Field to sum over.
|
|
@@ -7,7 +7,10 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
class SumAggregationPricingMetricResource(UniversalBaseModel):
|
|
10
|
-
value_field: str
|
|
10
|
+
value_field: str = pydantic.Field()
|
|
11
|
+
"""
|
|
12
|
+
The field to sum over.
|
|
13
|
+
"""
|
|
11
14
|
|
|
12
15
|
if IS_PYDANTIC_V2:
|
|
13
16
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
lark/usage_events/__init__.py
CHANGED
|
@@ -6,11 +6,8 @@ import typing
|
|
|
6
6
|
from importlib import import_module
|
|
7
7
|
|
|
8
8
|
if typing.TYPE_CHECKING:
|
|
9
|
-
from .types import CreateUsageEventRequestDataValue
|
|
10
|
-
_dynamic_imports: typing.Dict[str, str] = {
|
|
11
|
-
"CreateUsageEventRequestDataValue": ".types",
|
|
12
|
-
"CreateUsageEventSummaryRequestAggregationType": ".types",
|
|
13
|
-
}
|
|
9
|
+
from .types import CreateUsageEventRequestDataValue
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"CreateUsageEventRequestDataValue": ".types"}
|
|
14
11
|
|
|
15
12
|
|
|
16
13
|
def __getattr__(attr_name: str) -> typing.Any:
|
|
@@ -34,4 +31,4 @@ def __dir__():
|
|
|
34
31
|
return sorted(lazy_attrs)
|
|
35
32
|
|
|
36
33
|
|
|
37
|
-
__all__ = ["CreateUsageEventRequestDataValue"
|
|
34
|
+
__all__ = ["CreateUsageEventRequestDataValue"]
|