lark-billing 0.5.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.
- lark/__init__.py +92 -0
- lark/_base_client.py +1995 -0
- lark/_client.py +459 -0
- lark/_compat.py +219 -0
- lark/_constants.py +14 -0
- lark/_exceptions.py +108 -0
- lark/_files.py +123 -0
- lark/_models.py +857 -0
- lark/_qs.py +150 -0
- lark/_resource.py +43 -0
- lark/_response.py +830 -0
- lark/_streaming.py +333 -0
- lark/_types.py +261 -0
- lark/_utils/__init__.py +64 -0
- lark/_utils/_compat.py +45 -0
- lark/_utils/_datetime_parse.py +136 -0
- lark/_utils/_logs.py +25 -0
- lark/_utils/_proxy.py +65 -0
- lark/_utils/_reflection.py +42 -0
- lark/_utils/_resources_proxy.py +24 -0
- lark/_utils/_streams.py +12 -0
- lark/_utils/_sync.py +58 -0
- lark/_utils/_transform.py +457 -0
- lark/_utils/_typing.py +156 -0
- lark/_utils/_utils.py +421 -0
- lark/_version.py +4 -0
- lark/lib/.keep +4 -0
- lark/py.typed +0 -0
- lark/resources/__init__.py +117 -0
- lark/resources/customer_access.py +167 -0
- lark/resources/customer_portal.py +187 -0
- lark/resources/invoices.py +191 -0
- lark/resources/pricing_metrics.py +499 -0
- lark/resources/rate_cards.py +395 -0
- lark/resources/subjects.py +579 -0
- lark/resources/subscriptions.py +647 -0
- lark/resources/usage_events.py +221 -0
- lark/types/__init__.py +53 -0
- lark/types/amount_input_param.py +16 -0
- lark/types/amount_output.py +13 -0
- lark/types/checkout_callback_param.py +15 -0
- lark/types/customer_access_retrieve_billing_state_response.py +40 -0
- lark/types/customer_portal_create_session_params.py +18 -0
- lark/types/customer_portal_create_session_response.py +18 -0
- lark/types/flat_price_input_param.py +17 -0
- lark/types/flat_price_output.py +17 -0
- lark/types/invoice_list_params.py +16 -0
- lark/types/invoice_list_response.py +49 -0
- lark/types/package_price_input_param.py +24 -0
- lark/types/package_price_output.py +24 -0
- lark/types/period.py +18 -0
- lark/types/period_param.py +21 -0
- lark/types/pricing_metric_create_params.py +98 -0
- lark/types/pricing_metric_create_summary_params.py +25 -0
- lark/types/pricing_metric_create_summary_response.py +36 -0
- lark/types/pricing_metric_list_params.py +11 -0
- lark/types/pricing_metric_list_response.py +14 -0
- lark/types/pricing_metric_resource.py +72 -0
- lark/types/rate_card_create_params.py +148 -0
- lark/types/rate_card_list_params.py +13 -0
- lark/types/rate_card_list_response.py +14 -0
- lark/types/rate_card_resource.py +141 -0
- lark/types/subject_create_params.py +29 -0
- lark/types/subject_create_response.py +34 -0
- lark/types/subject_list_params.py +13 -0
- lark/types/subject_list_response.py +14 -0
- lark/types/subject_resource.py +34 -0
- lark/types/subject_update_params.py +22 -0
- lark/types/subscription_cancel_params.py +16 -0
- lark/types/subscription_change_rate_card_params.py +29 -0
- lark/types/subscription_change_rate_card_response.py +55 -0
- lark/types/subscription_create_params.py +38 -0
- lark/types/subscription_create_response.py +55 -0
- lark/types/subscription_list_params.py +26 -0
- lark/types/subscription_list_response.py +14 -0
- lark/types/subscription_resource.py +49 -0
- lark/types/usage_event_create_params.py +41 -0
- lark_billing-0.5.0.dist-info/METADATA +431 -0
- lark_billing-0.5.0.dist-info/RECORD +81 -0
- lark_billing-0.5.0.dist-info/WHEEL +4 -0
- lark_billing-0.5.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,499 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
from typing_extensions import Literal
|
|
7
|
+
|
|
8
|
+
import httpx
|
|
9
|
+
|
|
10
|
+
from ..types import (
|
|
11
|
+
pricing_metric_list_params,
|
|
12
|
+
pricing_metric_create_params,
|
|
13
|
+
pricing_metric_create_summary_params,
|
|
14
|
+
)
|
|
15
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
|
|
16
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
17
|
+
from .._compat import cached_property
|
|
18
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
19
|
+
from .._response import (
|
|
20
|
+
to_raw_response_wrapper,
|
|
21
|
+
to_streamed_response_wrapper,
|
|
22
|
+
async_to_raw_response_wrapper,
|
|
23
|
+
async_to_streamed_response_wrapper,
|
|
24
|
+
)
|
|
25
|
+
from .._base_client import make_request_options
|
|
26
|
+
from ..types.period_param import PeriodParam
|
|
27
|
+
from ..types.pricing_metric_resource import PricingMetricResource
|
|
28
|
+
from ..types.pricing_metric_list_response import PricingMetricListResponse
|
|
29
|
+
from ..types.pricing_metric_create_summary_response import PricingMetricCreateSummaryResponse
|
|
30
|
+
|
|
31
|
+
__all__ = ["PricingMetricsResource", "AsyncPricingMetricsResource"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class PricingMetricsResource(SyncAPIResource):
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_raw_response(self) -> PricingMetricsResourceWithRawResponse:
|
|
37
|
+
"""
|
|
38
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
39
|
+
the raw response object instead of the parsed content.
|
|
40
|
+
|
|
41
|
+
For more information, see https://www.github.com/uselark/lark-billing-python#accessing-raw-response-data-eg-headers
|
|
42
|
+
"""
|
|
43
|
+
return PricingMetricsResourceWithRawResponse(self)
|
|
44
|
+
|
|
45
|
+
@cached_property
|
|
46
|
+
def with_streaming_response(self) -> PricingMetricsResourceWithStreamingResponse:
|
|
47
|
+
"""
|
|
48
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
49
|
+
|
|
50
|
+
For more information, see https://www.github.com/uselark/lark-billing-python#with_streaming_response
|
|
51
|
+
"""
|
|
52
|
+
return PricingMetricsResourceWithStreamingResponse(self)
|
|
53
|
+
|
|
54
|
+
def create(
|
|
55
|
+
self,
|
|
56
|
+
*,
|
|
57
|
+
aggregation: pricing_metric_create_params.Aggregation,
|
|
58
|
+
event_name: str,
|
|
59
|
+
name: str,
|
|
60
|
+
unit: str,
|
|
61
|
+
dimensions: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
62
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
63
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
64
|
+
extra_headers: Headers | None = None,
|
|
65
|
+
extra_query: Query | None = None,
|
|
66
|
+
extra_body: Body | None = None,
|
|
67
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
68
|
+
) -> PricingMetricResource:
|
|
69
|
+
"""
|
|
70
|
+
Create Pricing Metric
|
|
71
|
+
|
|
72
|
+
Args:
|
|
73
|
+
aggregation: The aggregation function used to compute the value of the pricing metric.
|
|
74
|
+
|
|
75
|
+
event_name: The name of the event that the pricing metric is computed on.
|
|
76
|
+
|
|
77
|
+
name: The name of the pricing metric.
|
|
78
|
+
|
|
79
|
+
unit: Unit of measurement for the pricing metric.
|
|
80
|
+
|
|
81
|
+
dimensions: The dimensions by which the events are grouped to compute the pricing metric.
|
|
82
|
+
|
|
83
|
+
extra_headers: Send extra headers
|
|
84
|
+
|
|
85
|
+
extra_query: Add additional query parameters to the request
|
|
86
|
+
|
|
87
|
+
extra_body: Add additional JSON properties to the request
|
|
88
|
+
|
|
89
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
90
|
+
"""
|
|
91
|
+
return self._post(
|
|
92
|
+
"/pricing-metrics",
|
|
93
|
+
body=maybe_transform(
|
|
94
|
+
{
|
|
95
|
+
"aggregation": aggregation,
|
|
96
|
+
"event_name": event_name,
|
|
97
|
+
"name": name,
|
|
98
|
+
"unit": unit,
|
|
99
|
+
"dimensions": dimensions,
|
|
100
|
+
},
|
|
101
|
+
pricing_metric_create_params.PricingMetricCreateParams,
|
|
102
|
+
),
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=PricingMetricResource,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def retrieve(
|
|
110
|
+
self,
|
|
111
|
+
pricing_metric_id: str,
|
|
112
|
+
*,
|
|
113
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
114
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
115
|
+
extra_headers: Headers | None = None,
|
|
116
|
+
extra_query: Query | None = None,
|
|
117
|
+
extra_body: Body | None = None,
|
|
118
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
119
|
+
) -> PricingMetricResource:
|
|
120
|
+
"""
|
|
121
|
+
Get Pricing Metric
|
|
122
|
+
|
|
123
|
+
Args:
|
|
124
|
+
extra_headers: Send extra headers
|
|
125
|
+
|
|
126
|
+
extra_query: Add additional query parameters to the request
|
|
127
|
+
|
|
128
|
+
extra_body: Add additional JSON properties to the request
|
|
129
|
+
|
|
130
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
131
|
+
"""
|
|
132
|
+
if not pricing_metric_id:
|
|
133
|
+
raise ValueError(f"Expected a non-empty value for `pricing_metric_id` but received {pricing_metric_id!r}")
|
|
134
|
+
return self._get(
|
|
135
|
+
f"/pricing-metrics/{pricing_metric_id}",
|
|
136
|
+
options=make_request_options(
|
|
137
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
138
|
+
),
|
|
139
|
+
cast_to=PricingMetricResource,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def list(
|
|
143
|
+
self,
|
|
144
|
+
*,
|
|
145
|
+
limit: int | Omit = omit,
|
|
146
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
147
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
148
|
+
extra_headers: Headers | None = None,
|
|
149
|
+
extra_query: Query | None = None,
|
|
150
|
+
extra_body: Body | None = None,
|
|
151
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
152
|
+
) -> PricingMetricListResponse:
|
|
153
|
+
"""
|
|
154
|
+
List Pricing Metrics
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
extra_headers: Send extra headers
|
|
158
|
+
|
|
159
|
+
extra_query: Add additional query parameters to the request
|
|
160
|
+
|
|
161
|
+
extra_body: Add additional JSON properties to the request
|
|
162
|
+
|
|
163
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
164
|
+
"""
|
|
165
|
+
return self._get(
|
|
166
|
+
"/pricing-metrics",
|
|
167
|
+
options=make_request_options(
|
|
168
|
+
extra_headers=extra_headers,
|
|
169
|
+
extra_query=extra_query,
|
|
170
|
+
extra_body=extra_body,
|
|
171
|
+
timeout=timeout,
|
|
172
|
+
query=maybe_transform({"limit": limit}, pricing_metric_list_params.PricingMetricListParams),
|
|
173
|
+
),
|
|
174
|
+
cast_to=PricingMetricListResponse,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
def create_summary(
|
|
178
|
+
self,
|
|
179
|
+
pricing_metric_id: str,
|
|
180
|
+
*,
|
|
181
|
+
period: PeriodParam,
|
|
182
|
+
subject_id: str,
|
|
183
|
+
dimensions: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
184
|
+
period_granularity: Optional[Literal["hour", "day", "week"]] | Omit = omit,
|
|
185
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
186
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
187
|
+
extra_headers: Headers | None = None,
|
|
188
|
+
extra_query: Query | None = None,
|
|
189
|
+
extra_body: Body | None = None,
|
|
190
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
191
|
+
) -> PricingMetricCreateSummaryResponse:
|
|
192
|
+
"""
|
|
193
|
+
Create Pricing Metric Summary
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
period: The period that the summary should be computed over.
|
|
197
|
+
|
|
198
|
+
subject_id: The ID or external ID of the subject that the summary should be computed for.
|
|
199
|
+
|
|
200
|
+
dimensions: The dimensions by which the events are grouped to compute the pricing metric.
|
|
201
|
+
|
|
202
|
+
period_granularity: The granularity of the period that the summary should be computed over.
|
|
203
|
+
|
|
204
|
+
extra_headers: Send extra headers
|
|
205
|
+
|
|
206
|
+
extra_query: Add additional query parameters to the request
|
|
207
|
+
|
|
208
|
+
extra_body: Add additional JSON properties to the request
|
|
209
|
+
|
|
210
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
211
|
+
"""
|
|
212
|
+
if not pricing_metric_id:
|
|
213
|
+
raise ValueError(f"Expected a non-empty value for `pricing_metric_id` but received {pricing_metric_id!r}")
|
|
214
|
+
return self._post(
|
|
215
|
+
f"/pricing-metrics/{pricing_metric_id}/summary",
|
|
216
|
+
body=maybe_transform(
|
|
217
|
+
{
|
|
218
|
+
"period": period,
|
|
219
|
+
"subject_id": subject_id,
|
|
220
|
+
"dimensions": dimensions,
|
|
221
|
+
"period_granularity": period_granularity,
|
|
222
|
+
},
|
|
223
|
+
pricing_metric_create_summary_params.PricingMetricCreateSummaryParams,
|
|
224
|
+
),
|
|
225
|
+
options=make_request_options(
|
|
226
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
227
|
+
),
|
|
228
|
+
cast_to=PricingMetricCreateSummaryResponse,
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class AsyncPricingMetricsResource(AsyncAPIResource):
|
|
233
|
+
@cached_property
|
|
234
|
+
def with_raw_response(self) -> AsyncPricingMetricsResourceWithRawResponse:
|
|
235
|
+
"""
|
|
236
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
237
|
+
the raw response object instead of the parsed content.
|
|
238
|
+
|
|
239
|
+
For more information, see https://www.github.com/uselark/lark-billing-python#accessing-raw-response-data-eg-headers
|
|
240
|
+
"""
|
|
241
|
+
return AsyncPricingMetricsResourceWithRawResponse(self)
|
|
242
|
+
|
|
243
|
+
@cached_property
|
|
244
|
+
def with_streaming_response(self) -> AsyncPricingMetricsResourceWithStreamingResponse:
|
|
245
|
+
"""
|
|
246
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
247
|
+
|
|
248
|
+
For more information, see https://www.github.com/uselark/lark-billing-python#with_streaming_response
|
|
249
|
+
"""
|
|
250
|
+
return AsyncPricingMetricsResourceWithStreamingResponse(self)
|
|
251
|
+
|
|
252
|
+
async def create(
|
|
253
|
+
self,
|
|
254
|
+
*,
|
|
255
|
+
aggregation: pricing_metric_create_params.Aggregation,
|
|
256
|
+
event_name: str,
|
|
257
|
+
name: str,
|
|
258
|
+
unit: str,
|
|
259
|
+
dimensions: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
260
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
261
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
262
|
+
extra_headers: Headers | None = None,
|
|
263
|
+
extra_query: Query | None = None,
|
|
264
|
+
extra_body: Body | None = None,
|
|
265
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
266
|
+
) -> PricingMetricResource:
|
|
267
|
+
"""
|
|
268
|
+
Create Pricing Metric
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
aggregation: The aggregation function used to compute the value of the pricing metric.
|
|
272
|
+
|
|
273
|
+
event_name: The name of the event that the pricing metric is computed on.
|
|
274
|
+
|
|
275
|
+
name: The name of the pricing metric.
|
|
276
|
+
|
|
277
|
+
unit: Unit of measurement for the pricing metric.
|
|
278
|
+
|
|
279
|
+
dimensions: The dimensions by which the events are grouped to compute the pricing metric.
|
|
280
|
+
|
|
281
|
+
extra_headers: Send extra headers
|
|
282
|
+
|
|
283
|
+
extra_query: Add additional query parameters to the request
|
|
284
|
+
|
|
285
|
+
extra_body: Add additional JSON properties to the request
|
|
286
|
+
|
|
287
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
288
|
+
"""
|
|
289
|
+
return await self._post(
|
|
290
|
+
"/pricing-metrics",
|
|
291
|
+
body=await async_maybe_transform(
|
|
292
|
+
{
|
|
293
|
+
"aggregation": aggregation,
|
|
294
|
+
"event_name": event_name,
|
|
295
|
+
"name": name,
|
|
296
|
+
"unit": unit,
|
|
297
|
+
"dimensions": dimensions,
|
|
298
|
+
},
|
|
299
|
+
pricing_metric_create_params.PricingMetricCreateParams,
|
|
300
|
+
),
|
|
301
|
+
options=make_request_options(
|
|
302
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
303
|
+
),
|
|
304
|
+
cast_to=PricingMetricResource,
|
|
305
|
+
)
|
|
306
|
+
|
|
307
|
+
async def retrieve(
|
|
308
|
+
self,
|
|
309
|
+
pricing_metric_id: str,
|
|
310
|
+
*,
|
|
311
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
312
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
313
|
+
extra_headers: Headers | None = None,
|
|
314
|
+
extra_query: Query | None = None,
|
|
315
|
+
extra_body: Body | None = None,
|
|
316
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
317
|
+
) -> PricingMetricResource:
|
|
318
|
+
"""
|
|
319
|
+
Get Pricing Metric
|
|
320
|
+
|
|
321
|
+
Args:
|
|
322
|
+
extra_headers: Send extra headers
|
|
323
|
+
|
|
324
|
+
extra_query: Add additional query parameters to the request
|
|
325
|
+
|
|
326
|
+
extra_body: Add additional JSON properties to the request
|
|
327
|
+
|
|
328
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
329
|
+
"""
|
|
330
|
+
if not pricing_metric_id:
|
|
331
|
+
raise ValueError(f"Expected a non-empty value for `pricing_metric_id` but received {pricing_metric_id!r}")
|
|
332
|
+
return await self._get(
|
|
333
|
+
f"/pricing-metrics/{pricing_metric_id}",
|
|
334
|
+
options=make_request_options(
|
|
335
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
336
|
+
),
|
|
337
|
+
cast_to=PricingMetricResource,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
async def list(
|
|
341
|
+
self,
|
|
342
|
+
*,
|
|
343
|
+
limit: int | Omit = omit,
|
|
344
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
345
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
346
|
+
extra_headers: Headers | None = None,
|
|
347
|
+
extra_query: Query | None = None,
|
|
348
|
+
extra_body: Body | None = None,
|
|
349
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
350
|
+
) -> PricingMetricListResponse:
|
|
351
|
+
"""
|
|
352
|
+
List Pricing Metrics
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
extra_headers: Send extra headers
|
|
356
|
+
|
|
357
|
+
extra_query: Add additional query parameters to the request
|
|
358
|
+
|
|
359
|
+
extra_body: Add additional JSON properties to the request
|
|
360
|
+
|
|
361
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
362
|
+
"""
|
|
363
|
+
return await self._get(
|
|
364
|
+
"/pricing-metrics",
|
|
365
|
+
options=make_request_options(
|
|
366
|
+
extra_headers=extra_headers,
|
|
367
|
+
extra_query=extra_query,
|
|
368
|
+
extra_body=extra_body,
|
|
369
|
+
timeout=timeout,
|
|
370
|
+
query=await async_maybe_transform({"limit": limit}, pricing_metric_list_params.PricingMetricListParams),
|
|
371
|
+
),
|
|
372
|
+
cast_to=PricingMetricListResponse,
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
async def create_summary(
|
|
376
|
+
self,
|
|
377
|
+
pricing_metric_id: str,
|
|
378
|
+
*,
|
|
379
|
+
period: PeriodParam,
|
|
380
|
+
subject_id: str,
|
|
381
|
+
dimensions: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
382
|
+
period_granularity: Optional[Literal["hour", "day", "week"]] | Omit = omit,
|
|
383
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
384
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
385
|
+
extra_headers: Headers | None = None,
|
|
386
|
+
extra_query: Query | None = None,
|
|
387
|
+
extra_body: Body | None = None,
|
|
388
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
389
|
+
) -> PricingMetricCreateSummaryResponse:
|
|
390
|
+
"""
|
|
391
|
+
Create Pricing Metric Summary
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
period: The period that the summary should be computed over.
|
|
395
|
+
|
|
396
|
+
subject_id: The ID or external ID of the subject that the summary should be computed for.
|
|
397
|
+
|
|
398
|
+
dimensions: The dimensions by which the events are grouped to compute the pricing metric.
|
|
399
|
+
|
|
400
|
+
period_granularity: The granularity of the period that the summary should be computed over.
|
|
401
|
+
|
|
402
|
+
extra_headers: Send extra headers
|
|
403
|
+
|
|
404
|
+
extra_query: Add additional query parameters to the request
|
|
405
|
+
|
|
406
|
+
extra_body: Add additional JSON properties to the request
|
|
407
|
+
|
|
408
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
409
|
+
"""
|
|
410
|
+
if not pricing_metric_id:
|
|
411
|
+
raise ValueError(f"Expected a non-empty value for `pricing_metric_id` but received {pricing_metric_id!r}")
|
|
412
|
+
return await self._post(
|
|
413
|
+
f"/pricing-metrics/{pricing_metric_id}/summary",
|
|
414
|
+
body=await async_maybe_transform(
|
|
415
|
+
{
|
|
416
|
+
"period": period,
|
|
417
|
+
"subject_id": subject_id,
|
|
418
|
+
"dimensions": dimensions,
|
|
419
|
+
"period_granularity": period_granularity,
|
|
420
|
+
},
|
|
421
|
+
pricing_metric_create_summary_params.PricingMetricCreateSummaryParams,
|
|
422
|
+
),
|
|
423
|
+
options=make_request_options(
|
|
424
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
425
|
+
),
|
|
426
|
+
cast_to=PricingMetricCreateSummaryResponse,
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
class PricingMetricsResourceWithRawResponse:
|
|
431
|
+
def __init__(self, pricing_metrics: PricingMetricsResource) -> None:
|
|
432
|
+
self._pricing_metrics = pricing_metrics
|
|
433
|
+
|
|
434
|
+
self.create = to_raw_response_wrapper(
|
|
435
|
+
pricing_metrics.create,
|
|
436
|
+
)
|
|
437
|
+
self.retrieve = to_raw_response_wrapper(
|
|
438
|
+
pricing_metrics.retrieve,
|
|
439
|
+
)
|
|
440
|
+
self.list = to_raw_response_wrapper(
|
|
441
|
+
pricing_metrics.list,
|
|
442
|
+
)
|
|
443
|
+
self.create_summary = to_raw_response_wrapper(
|
|
444
|
+
pricing_metrics.create_summary,
|
|
445
|
+
)
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
class AsyncPricingMetricsResourceWithRawResponse:
|
|
449
|
+
def __init__(self, pricing_metrics: AsyncPricingMetricsResource) -> None:
|
|
450
|
+
self._pricing_metrics = pricing_metrics
|
|
451
|
+
|
|
452
|
+
self.create = async_to_raw_response_wrapper(
|
|
453
|
+
pricing_metrics.create,
|
|
454
|
+
)
|
|
455
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
456
|
+
pricing_metrics.retrieve,
|
|
457
|
+
)
|
|
458
|
+
self.list = async_to_raw_response_wrapper(
|
|
459
|
+
pricing_metrics.list,
|
|
460
|
+
)
|
|
461
|
+
self.create_summary = async_to_raw_response_wrapper(
|
|
462
|
+
pricing_metrics.create_summary,
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
class PricingMetricsResourceWithStreamingResponse:
|
|
467
|
+
def __init__(self, pricing_metrics: PricingMetricsResource) -> None:
|
|
468
|
+
self._pricing_metrics = pricing_metrics
|
|
469
|
+
|
|
470
|
+
self.create = to_streamed_response_wrapper(
|
|
471
|
+
pricing_metrics.create,
|
|
472
|
+
)
|
|
473
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
474
|
+
pricing_metrics.retrieve,
|
|
475
|
+
)
|
|
476
|
+
self.list = to_streamed_response_wrapper(
|
|
477
|
+
pricing_metrics.list,
|
|
478
|
+
)
|
|
479
|
+
self.create_summary = to_streamed_response_wrapper(
|
|
480
|
+
pricing_metrics.create_summary,
|
|
481
|
+
)
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
class AsyncPricingMetricsResourceWithStreamingResponse:
|
|
485
|
+
def __init__(self, pricing_metrics: AsyncPricingMetricsResource) -> None:
|
|
486
|
+
self._pricing_metrics = pricing_metrics
|
|
487
|
+
|
|
488
|
+
self.create = async_to_streamed_response_wrapper(
|
|
489
|
+
pricing_metrics.create,
|
|
490
|
+
)
|
|
491
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
492
|
+
pricing_metrics.retrieve,
|
|
493
|
+
)
|
|
494
|
+
self.list = async_to_streamed_response_wrapper(
|
|
495
|
+
pricing_metrics.list,
|
|
496
|
+
)
|
|
497
|
+
self.create_summary = async_to_streamed_response_wrapper(
|
|
498
|
+
pricing_metrics.create_summary,
|
|
499
|
+
)
|