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
lark/__init__.py CHANGED
@@ -9,6 +9,8 @@ if typing.TYPE_CHECKING:
9
9
  from .types import (
10
10
  Aggregation,
11
11
  Aggregation_Count,
12
+ Aggregation_Last,
13
+ Aggregation_Max,
12
14
  Aggregation_Sum,
13
15
  Amount,
14
16
  BillingStateResponse,
@@ -16,23 +18,25 @@ if typing.TYPE_CHECKING:
16
18
  CountAggregationPricingMetricResource,
17
19
  CreateCustomerPortalSessionResponse,
18
20
  CreateFixedRateRequest,
19
- CreatePricingMetricResponse,
20
21
  CreateSimpleUsageBasedRateRequest,
21
22
  CreateSubjectResponse,
22
23
  CreateSubscriptionCheckoutSessionResponse,
23
- CreateUsageEventSummaryResponse,
24
+ CustomAggregationPricingMetricInterface,
24
25
  FixedRateInterface,
25
26
  FlatPrice,
26
- GetPricingMetricResponse,
27
27
  HttpValidationError,
28
28
  InvoiceLineItemResource,
29
29
  InvoiceResource,
30
30
  InvoiceStatus,
31
+ LastAggregationPricingMetricInterface,
32
+ LastAggregationPricingMetricResource,
31
33
  ListInvoicesResponse,
32
34
  ListPricingMetricsResponse,
33
35
  ListRateCardsResponse,
34
36
  ListSubjectsResponse,
35
37
  ListSubscriptionsResponse,
38
+ MaxAggregationPricingMetricInterface,
39
+ MaxAggregationPricingMetricResource,
36
40
  PackagePrice,
37
41
  PackagePriceInputRoundingBehavior,
38
42
  PackagePriceOutputRoundingBehavior,
@@ -42,6 +46,7 @@ if typing.TYPE_CHECKING:
42
46
  Price_Flat,
43
47
  Price_Package,
44
48
  PricingMetricResource,
49
+ PricingMetricSummaryResource,
45
50
  RateCardResource,
46
51
  RateCardResourceBillingInterval,
47
52
  RateCardResourceUsageBasedRatesItem,
@@ -54,7 +59,6 @@ if typing.TYPE_CHECKING:
54
59
  SumAggregationPricingMetricResource,
55
60
  ValidationError,
56
61
  ValidationErrorLocItem,
57
- Value,
58
62
  )
59
63
  from .errors import UnprocessableEntityError
60
64
  from . import (
@@ -70,17 +74,26 @@ if typing.TYPE_CHECKING:
70
74
  )
71
75
  from .client import AsyncLark, Lark
72
76
  from .environment import LarkEnvironment
73
- from .pricing_metrics import PricingMetricAggregation, PricingMetricAggregation_Count, PricingMetricAggregation_Sum
77
+ from .pricing_metrics import (
78
+ PricingMetricAggregation,
79
+ PricingMetricAggregation_Count,
80
+ PricingMetricAggregation_Custom,
81
+ PricingMetricAggregation_Last,
82
+ PricingMetricAggregation_Max,
83
+ PricingMetricAggregation_Sum,
84
+ )
74
85
  from .rate_cards import (
75
86
  CreateRateCardRequestBillingInterval,
76
87
  CreateRateCardRequestUsageBasedRatesItem,
77
88
  CreateRateCardRequestUsageBasedRatesItem_Simple,
78
89
  )
79
- from .usage_events import CreateUsageEventSummaryRequestAggregationType
90
+ from .usage_events import CreateUsageEventRequestDataValue
80
91
  from .version import __version__
81
92
  _dynamic_imports: typing.Dict[str, str] = {
82
93
  "Aggregation": ".types",
83
94
  "Aggregation_Count": ".types",
95
+ "Aggregation_Last": ".types",
96
+ "Aggregation_Max": ".types",
84
97
  "Aggregation_Sum": ".types",
85
98
  "Amount": ".types",
86
99
  "AsyncLark": ".client",
@@ -89,29 +102,31 @@ _dynamic_imports: typing.Dict[str, str] = {
89
102
  "CountAggregationPricingMetricResource": ".types",
90
103
  "CreateCustomerPortalSessionResponse": ".types",
91
104
  "CreateFixedRateRequest": ".types",
92
- "CreatePricingMetricResponse": ".types",
93
105
  "CreateRateCardRequestBillingInterval": ".rate_cards",
94
106
  "CreateRateCardRequestUsageBasedRatesItem": ".rate_cards",
95
107
  "CreateRateCardRequestUsageBasedRatesItem_Simple": ".rate_cards",
96
108
  "CreateSimpleUsageBasedRateRequest": ".types",
97
109
  "CreateSubjectResponse": ".types",
98
110
  "CreateSubscriptionCheckoutSessionResponse": ".types",
99
- "CreateUsageEventSummaryRequestAggregationType": ".usage_events",
100
- "CreateUsageEventSummaryResponse": ".types",
111
+ "CreateUsageEventRequestDataValue": ".usage_events",
112
+ "CustomAggregationPricingMetricInterface": ".types",
101
113
  "FixedRateInterface": ".types",
102
114
  "FlatPrice": ".types",
103
- "GetPricingMetricResponse": ".types",
104
115
  "HttpValidationError": ".types",
105
116
  "InvoiceLineItemResource": ".types",
106
117
  "InvoiceResource": ".types",
107
118
  "InvoiceStatus": ".types",
108
119
  "Lark": ".client",
109
120
  "LarkEnvironment": ".environment",
121
+ "LastAggregationPricingMetricInterface": ".types",
122
+ "LastAggregationPricingMetricResource": ".types",
110
123
  "ListInvoicesResponse": ".types",
111
124
  "ListPricingMetricsResponse": ".types",
112
125
  "ListRateCardsResponse": ".types",
113
126
  "ListSubjectsResponse": ".types",
114
127
  "ListSubscriptionsResponse": ".types",
128
+ "MaxAggregationPricingMetricInterface": ".types",
129
+ "MaxAggregationPricingMetricResource": ".types",
115
130
  "PackagePrice": ".types",
116
131
  "PackagePriceInputRoundingBehavior": ".types",
117
132
  "PackagePriceOutputRoundingBehavior": ".types",
@@ -122,8 +137,12 @@ _dynamic_imports: typing.Dict[str, str] = {
122
137
  "Price_Package": ".types",
123
138
  "PricingMetricAggregation": ".pricing_metrics",
124
139
  "PricingMetricAggregation_Count": ".pricing_metrics",
140
+ "PricingMetricAggregation_Custom": ".pricing_metrics",
141
+ "PricingMetricAggregation_Last": ".pricing_metrics",
142
+ "PricingMetricAggregation_Max": ".pricing_metrics",
125
143
  "PricingMetricAggregation_Sum": ".pricing_metrics",
126
144
  "PricingMetricResource": ".types",
145
+ "PricingMetricSummaryResource": ".types",
127
146
  "RateCardResource": ".types",
128
147
  "RateCardResourceBillingInterval": ".types",
129
148
  "RateCardResourceUsageBasedRatesItem": ".types",
@@ -137,7 +156,6 @@ _dynamic_imports: typing.Dict[str, str] = {
137
156
  "UnprocessableEntityError": ".errors",
138
157
  "ValidationError": ".types",
139
158
  "ValidationErrorLocItem": ".types",
140
- "Value": ".types",
141
159
  "__version__": ".version",
142
160
  "checkout": ".checkout",
143
161
  "customer_access": ".customer_access",
@@ -175,6 +193,8 @@ def __dir__():
175
193
  __all__ = [
176
194
  "Aggregation",
177
195
  "Aggregation_Count",
196
+ "Aggregation_Last",
197
+ "Aggregation_Max",
178
198
  "Aggregation_Sum",
179
199
  "Amount",
180
200
  "AsyncLark",
@@ -183,29 +203,31 @@ __all__ = [
183
203
  "CountAggregationPricingMetricResource",
184
204
  "CreateCustomerPortalSessionResponse",
185
205
  "CreateFixedRateRequest",
186
- "CreatePricingMetricResponse",
187
206
  "CreateRateCardRequestBillingInterval",
188
207
  "CreateRateCardRequestUsageBasedRatesItem",
189
208
  "CreateRateCardRequestUsageBasedRatesItem_Simple",
190
209
  "CreateSimpleUsageBasedRateRequest",
191
210
  "CreateSubjectResponse",
192
211
  "CreateSubscriptionCheckoutSessionResponse",
193
- "CreateUsageEventSummaryRequestAggregationType",
194
- "CreateUsageEventSummaryResponse",
212
+ "CreateUsageEventRequestDataValue",
213
+ "CustomAggregationPricingMetricInterface",
195
214
  "FixedRateInterface",
196
215
  "FlatPrice",
197
- "GetPricingMetricResponse",
198
216
  "HttpValidationError",
199
217
  "InvoiceLineItemResource",
200
218
  "InvoiceResource",
201
219
  "InvoiceStatus",
202
220
  "Lark",
203
221
  "LarkEnvironment",
222
+ "LastAggregationPricingMetricInterface",
223
+ "LastAggregationPricingMetricResource",
204
224
  "ListInvoicesResponse",
205
225
  "ListPricingMetricsResponse",
206
226
  "ListRateCardsResponse",
207
227
  "ListSubjectsResponse",
208
228
  "ListSubscriptionsResponse",
229
+ "MaxAggregationPricingMetricInterface",
230
+ "MaxAggregationPricingMetricResource",
209
231
  "PackagePrice",
210
232
  "PackagePriceInputRoundingBehavior",
211
233
  "PackagePriceOutputRoundingBehavior",
@@ -216,8 +238,12 @@ __all__ = [
216
238
  "Price_Package",
217
239
  "PricingMetricAggregation",
218
240
  "PricingMetricAggregation_Count",
241
+ "PricingMetricAggregation_Custom",
242
+ "PricingMetricAggregation_Last",
243
+ "PricingMetricAggregation_Max",
219
244
  "PricingMetricAggregation_Sum",
220
245
  "PricingMetricResource",
246
+ "PricingMetricSummaryResource",
221
247
  "RateCardResource",
222
248
  "RateCardResourceBillingInterval",
223
249
  "RateCardResourceUsageBasedRatesItem",
@@ -231,7 +257,6 @@ __all__ = [
231
257
  "UnprocessableEntityError",
232
258
  "ValidationError",
233
259
  "ValidationErrorLocItem",
234
- "Value",
235
260
  "__version__",
236
261
  "checkout",
237
262
  "customer_access",
lark/checkout/client.py CHANGED
@@ -39,8 +39,10 @@ class CheckoutClient:
39
39
  Parameters
40
40
  ----------
41
41
  subject_id : str
42
+ The ID of the subject to create the checkout for.
42
43
 
43
44
  rate_card_id : str
45
+ The ID of the rate card to subscribe to.
44
46
 
45
47
  success_callback_url : str
46
48
  The URL to redirect to after the checkout is successful.
@@ -64,8 +66,8 @@ class CheckoutClient:
64
66
  api_key="YOUR_API_KEY",
65
67
  )
66
68
  client.checkout.create_subscription_checkout_session(
67
- subject_id="subject_id",
68
- rate_card_id="rate_card_id",
69
+ subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
70
+ rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
69
71
  success_callback_url="https://example.com/callback",
70
72
  )
71
73
  """
@@ -107,8 +109,10 @@ class AsyncCheckoutClient:
107
109
  Parameters
108
110
  ----------
109
111
  subject_id : str
112
+ The ID of the subject to create the checkout for.
110
113
 
111
114
  rate_card_id : str
115
+ The ID of the rate card to subscribe to.
112
116
 
113
117
  success_callback_url : str
114
118
  The URL to redirect to after the checkout is successful.
@@ -137,8 +141,8 @@ class AsyncCheckoutClient:
137
141
 
138
142
  async def main() -> None:
139
143
  await client.checkout.create_subscription_checkout_session(
140
- subject_id="subject_id",
141
- rate_card_id="rate_card_id",
144
+ subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
145
+ rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
142
146
  success_callback_url="https://example.com/callback",
143
147
  )
144
148
 
@@ -33,8 +33,10 @@ class RawCheckoutClient:
33
33
  Parameters
34
34
  ----------
35
35
  subject_id : str
36
+ The ID of the subject to create the checkout for.
36
37
 
37
38
  rate_card_id : str
39
+ The ID of the rate card to subscribe to.
38
40
 
39
41
  success_callback_url : str
40
42
  The URL to redirect to after the checkout is successful.
@@ -109,8 +111,10 @@ class AsyncRawCheckoutClient:
109
111
  Parameters
110
112
  ----------
111
113
  subject_id : str
114
+ The ID of the subject to create the checkout for.
112
115
 
113
116
  rate_card_id : str
117
+ The ID of the rate card to subscribe to.
114
118
 
115
119
  success_callback_url : str
116
120
  The URL to redirect to after the checkout is successful.
@@ -22,10 +22,10 @@ class BaseClientWrapper:
22
22
 
23
23
  def get_headers(self) -> typing.Dict[str, str]:
24
24
  headers: typing.Dict[str, str] = {
25
- "User-Agent": "lark-billing/0.0.8",
25
+ "User-Agent": "lark-billing/0.1.0",
26
26
  "X-Fern-Language": "Python",
27
27
  "X-Fern-SDK-Name": "lark-billing",
28
- "X-Fern-SDK-Version": "0.0.8",
28
+ "X-Fern-SDK-Version": "0.1.0",
29
29
  **(self.get_custom_headers() or {}),
30
30
  }
31
31
  headers["X-API-Key"] = self.api_key
@@ -33,6 +33,7 @@ class CustomerPortalClient:
33
33
  Parameters
34
34
  ----------
35
35
  subject_id : str
36
+ The ID of the subject to create the customer portal session for.
36
37
 
37
38
  request_options : typing.Optional[RequestOptions]
38
39
  Request-specific configuration.
@@ -50,7 +51,7 @@ class CustomerPortalClient:
50
51
  api_key="YOUR_API_KEY",
51
52
  )
52
53
  client.customer_portal.create_customer_portal_session(
53
- subject_id="subject_id",
54
+ subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
54
55
  )
55
56
  """
56
57
  _response = self._raw_client.create_customer_portal_session(
@@ -81,6 +82,7 @@ class AsyncCustomerPortalClient:
81
82
  Parameters
82
83
  ----------
83
84
  subject_id : str
85
+ The ID of the subject to create the customer portal session for.
84
86
 
85
87
  request_options : typing.Optional[RequestOptions]
86
88
  Request-specific configuration.
@@ -103,7 +105,7 @@ class AsyncCustomerPortalClient:
103
105
 
104
106
  async def main() -> None:
105
107
  await client.customer_portal.create_customer_portal_session(
106
- subject_id="subject_id",
108
+ subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
107
109
  )
108
110
 
109
111
 
@@ -27,6 +27,7 @@ class RawCustomerPortalClient:
27
27
  Parameters
28
28
  ----------
29
29
  subject_id : str
30
+ The ID of the subject to create the customer portal session for.
30
31
 
31
32
  request_options : typing.Optional[RequestOptions]
32
33
  Request-specific configuration.
@@ -86,6 +87,7 @@ class AsyncRawCustomerPortalClient:
86
87
  Parameters
87
88
  ----------
88
89
  subject_id : str
90
+ The ID of the subject to create the customer portal session for.
89
91
 
90
92
  request_options : typing.Optional[RequestOptions]
91
93
  Request-specific configuration.
@@ -6,10 +6,20 @@ import typing
6
6
  from importlib import import_module
7
7
 
8
8
  if typing.TYPE_CHECKING:
9
- from .types import PricingMetricAggregation, PricingMetricAggregation_Count, PricingMetricAggregation_Sum
9
+ from .types import (
10
+ PricingMetricAggregation,
11
+ PricingMetricAggregation_Count,
12
+ PricingMetricAggregation_Custom,
13
+ PricingMetricAggregation_Last,
14
+ PricingMetricAggregation_Max,
15
+ PricingMetricAggregation_Sum,
16
+ )
10
17
  _dynamic_imports: typing.Dict[str, str] = {
11
18
  "PricingMetricAggregation": ".types",
12
19
  "PricingMetricAggregation_Count": ".types",
20
+ "PricingMetricAggregation_Custom": ".types",
21
+ "PricingMetricAggregation_Last": ".types",
22
+ "PricingMetricAggregation_Max": ".types",
13
23
  "PricingMetricAggregation_Sum": ".types",
14
24
  }
15
25
 
@@ -35,4 +45,11 @@ def __dir__():
35
45
  return sorted(lazy_attrs)
36
46
 
37
47
 
38
- __all__ = ["PricingMetricAggregation", "PricingMetricAggregation_Count", "PricingMetricAggregation_Sum"]
48
+ __all__ = [
49
+ "PricingMetricAggregation",
50
+ "PricingMetricAggregation_Count",
51
+ "PricingMetricAggregation_Custom",
52
+ "PricingMetricAggregation_Last",
53
+ "PricingMetricAggregation_Max",
54
+ "PricingMetricAggregation_Sum",
55
+ ]
@@ -4,9 +4,10 @@ import typing
4
4
 
5
5
  from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
6
  from ..core.request_options import RequestOptions
7
- from ..types.create_pricing_metric_response import CreatePricingMetricResponse
8
- from ..types.get_pricing_metric_response import GetPricingMetricResponse
9
7
  from ..types.list_pricing_metrics_response import ListPricingMetricsResponse
8
+ from ..types.period import Period
9
+ from ..types.pricing_metric_resource import PricingMetricResource
10
+ from ..types.pricing_metric_summary_resource import PricingMetricSummaryResource
10
11
  from .raw_client import AsyncRawPricingMetricsClient, RawPricingMetricsClient
11
12
  from .types.pricing_metric_aggregation import PricingMetricAggregation
12
13
 
@@ -67,40 +68,45 @@ class PricingMetricsClient:
67
68
  aggregation: PricingMetricAggregation,
68
69
  unit: str,
69
70
  request_options: typing.Optional[RequestOptions] = None,
70
- ) -> CreatePricingMetricResponse:
71
+ ) -> PricingMetricResource:
71
72
  """
72
73
  Parameters
73
74
  ----------
74
75
  name : str
76
+ The name of the pricing metric.
75
77
 
76
78
  event_name : str
79
+ The name of the event that the pricing metric is computed on.
77
80
 
78
81
  aggregation : PricingMetricAggregation
82
+ The aggregation function used to compute the value of the pricing metric.
79
83
 
80
84
  unit : str
81
- Unit of measurement for the pricing metric
85
+ Unit of measurement for the pricing metric.
82
86
 
83
87
  request_options : typing.Optional[RequestOptions]
84
88
  Request-specific configuration.
85
89
 
86
90
  Returns
87
91
  -------
88
- CreatePricingMetricResponse
92
+ PricingMetricResource
89
93
  Successful Response
90
94
 
91
95
  Examples
92
96
  --------
93
97
  from lark import Lark
94
- from lark.pricing_metrics import PricingMetricAggregation_Count
98
+ from lark.pricing_metrics import PricingMetricAggregation_Sum
95
99
 
96
100
  client = Lark(
97
101
  api_key="YOUR_API_KEY",
98
102
  )
99
103
  client.pricing_metrics.create_pricing_metric(
100
- name="name",
101
- event_name="event_name",
102
- aggregation=PricingMetricAggregation_Count(),
103
- unit="unit",
104
+ name="Compute Hours",
105
+ event_name="job_completed",
106
+ aggregation=PricingMetricAggregation_Sum(
107
+ value_field="value_field",
108
+ ),
109
+ unit="hours",
104
110
  )
105
111
  """
106
112
  _response = self._raw_client.create_pricing_metric(
@@ -110,7 +116,7 @@ class PricingMetricsClient:
110
116
 
111
117
  def get_pricing_metric(
112
118
  self, pricing_metric_id: str, *, request_options: typing.Optional[RequestOptions] = None
113
- ) -> GetPricingMetricResponse:
119
+ ) -> PricingMetricResource:
114
120
  """
115
121
  Parameters
116
122
  ----------
@@ -121,7 +127,7 @@ class PricingMetricsClient:
121
127
 
122
128
  Returns
123
129
  -------
124
- GetPricingMetricResponse
130
+ PricingMetricResource
125
131
  Successful Response
126
132
 
127
133
  Examples
@@ -138,6 +144,60 @@ class PricingMetricsClient:
138
144
  _response = self._raw_client.get_pricing_metric(pricing_metric_id, request_options=request_options)
139
145
  return _response.data
140
146
 
147
+ def create_pricing_metric_summary(
148
+ self,
149
+ pricing_metric_id: str,
150
+ *,
151
+ subject_id: str,
152
+ period: Period,
153
+ request_options: typing.Optional[RequestOptions] = None,
154
+ ) -> PricingMetricSummaryResource:
155
+ """
156
+ Parameters
157
+ ----------
158
+ pricing_metric_id : str
159
+
160
+ subject_id : str
161
+ The ID of the subject that the summary should be computed for.
162
+
163
+ period : Period
164
+ The period that the summary should be computed over.
165
+
166
+ request_options : typing.Optional[RequestOptions]
167
+ Request-specific configuration.
168
+
169
+ Returns
170
+ -------
171
+ PricingMetricSummaryResource
172
+ Successful Response
173
+
174
+ Examples
175
+ --------
176
+ import datetime
177
+
178
+ from lark import Lark, Period
179
+
180
+ client = Lark(
181
+ api_key="YOUR_API_KEY",
182
+ )
183
+ client.pricing_metrics.create_pricing_metric_summary(
184
+ pricing_metric_id="pricing_metric_id",
185
+ subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
186
+ period=Period(
187
+ start=datetime.datetime.fromisoformat(
188
+ "2025-10-01 00:00:00+00:00",
189
+ ),
190
+ end=datetime.datetime.fromisoformat(
191
+ "2025-11-01 00:00:00+00:00",
192
+ ),
193
+ ),
194
+ )
195
+ """
196
+ _response = self._raw_client.create_pricing_metric_summary(
197
+ pricing_metric_id, subject_id=subject_id, period=period, request_options=request_options
198
+ )
199
+ return _response.data
200
+
141
201
 
142
202
  class AsyncPricingMetricsClient:
143
203
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
@@ -200,25 +260,28 @@ class AsyncPricingMetricsClient:
200
260
  aggregation: PricingMetricAggregation,
201
261
  unit: str,
202
262
  request_options: typing.Optional[RequestOptions] = None,
203
- ) -> CreatePricingMetricResponse:
263
+ ) -> PricingMetricResource:
204
264
  """
205
265
  Parameters
206
266
  ----------
207
267
  name : str
268
+ The name of the pricing metric.
208
269
 
209
270
  event_name : str
271
+ The name of the event that the pricing metric is computed on.
210
272
 
211
273
  aggregation : PricingMetricAggregation
274
+ The aggregation function used to compute the value of the pricing metric.
212
275
 
213
276
  unit : str
214
- Unit of measurement for the pricing metric
277
+ Unit of measurement for the pricing metric.
215
278
 
216
279
  request_options : typing.Optional[RequestOptions]
217
280
  Request-specific configuration.
218
281
 
219
282
  Returns
220
283
  -------
221
- CreatePricingMetricResponse
284
+ PricingMetricResource
222
285
  Successful Response
223
286
 
224
287
  Examples
@@ -226,7 +289,7 @@ class AsyncPricingMetricsClient:
226
289
  import asyncio
227
290
 
228
291
  from lark import AsyncLark
229
- from lark.pricing_metrics import PricingMetricAggregation_Count
292
+ from lark.pricing_metrics import PricingMetricAggregation_Sum
230
293
 
231
294
  client = AsyncLark(
232
295
  api_key="YOUR_API_KEY",
@@ -235,10 +298,12 @@ class AsyncPricingMetricsClient:
235
298
 
236
299
  async def main() -> None:
237
300
  await client.pricing_metrics.create_pricing_metric(
238
- name="name",
239
- event_name="event_name",
240
- aggregation=PricingMetricAggregation_Count(),
241
- unit="unit",
301
+ name="Compute Hours",
302
+ event_name="job_completed",
303
+ aggregation=PricingMetricAggregation_Sum(
304
+ value_field="value_field",
305
+ ),
306
+ unit="hours",
242
307
  )
243
308
 
244
309
 
@@ -251,7 +316,7 @@ class AsyncPricingMetricsClient:
251
316
 
252
317
  async def get_pricing_metric(
253
318
  self, pricing_metric_id: str, *, request_options: typing.Optional[RequestOptions] = None
254
- ) -> GetPricingMetricResponse:
319
+ ) -> PricingMetricResource:
255
320
  """
256
321
  Parameters
257
322
  ----------
@@ -262,7 +327,7 @@ class AsyncPricingMetricsClient:
262
327
 
263
328
  Returns
264
329
  -------
265
- GetPricingMetricResponse
330
+ PricingMetricResource
266
331
  Successful Response
267
332
 
268
333
  Examples
@@ -286,3 +351,64 @@ class AsyncPricingMetricsClient:
286
351
  """
287
352
  _response = await self._raw_client.get_pricing_metric(pricing_metric_id, request_options=request_options)
288
353
  return _response.data
354
+
355
+ async def create_pricing_metric_summary(
356
+ self,
357
+ pricing_metric_id: str,
358
+ *,
359
+ subject_id: str,
360
+ period: Period,
361
+ request_options: typing.Optional[RequestOptions] = None,
362
+ ) -> PricingMetricSummaryResource:
363
+ """
364
+ Parameters
365
+ ----------
366
+ pricing_metric_id : str
367
+
368
+ subject_id : str
369
+ The ID of the subject that the summary should be computed for.
370
+
371
+ period : Period
372
+ The period that the summary should be computed over.
373
+
374
+ request_options : typing.Optional[RequestOptions]
375
+ Request-specific configuration.
376
+
377
+ Returns
378
+ -------
379
+ PricingMetricSummaryResource
380
+ Successful Response
381
+
382
+ Examples
383
+ --------
384
+ import asyncio
385
+ import datetime
386
+
387
+ from lark import AsyncLark, Period
388
+
389
+ client = AsyncLark(
390
+ api_key="YOUR_API_KEY",
391
+ )
392
+
393
+
394
+ async def main() -> None:
395
+ await client.pricing_metrics.create_pricing_metric_summary(
396
+ pricing_metric_id="pricing_metric_id",
397
+ subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
398
+ period=Period(
399
+ start=datetime.datetime.fromisoformat(
400
+ "2025-10-01 00:00:00+00:00",
401
+ ),
402
+ end=datetime.datetime.fromisoformat(
403
+ "2025-11-01 00:00:00+00:00",
404
+ ),
405
+ ),
406
+ )
407
+
408
+
409
+ asyncio.run(main())
410
+ """
411
+ _response = await self._raw_client.create_pricing_metric_summary(
412
+ pricing_metric_id, subject_id=subject_id, period=period, request_options=request_options
413
+ )
414
+ return _response.data