lark-billing 0.0.6__py3-none-any.whl → 0.0.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of lark-billing might be problematic. Click here for more details.
- lark/__init__.py +92 -369
- lark/checkout/client.py +20 -79
- lark/checkout/raw_client.py +18 -102
- lark/client.py +112 -27
- lark/core/client_wrapper.py +2 -2
- lark/core/http_sse/__init__.py +42 -0
- lark/core/http_sse/_api.py +112 -0
- lark/core/http_sse/_decoders.py +61 -0
- lark/{types/credit_grant.py → core/http_sse/_exceptions.py} +4 -2
- lark/core/http_sse/_models.py +17 -0
- lark/core/pydantic_utilities.py +3 -1
- lark/{feature_access → customer_access}/client.py +30 -24
- lark/{feature_access → customer_access}/raw_client.py +22 -17
- lark/{types/rate_card.py → customer_portal/__init__.py} +1 -2
- lark/customer_portal/client.py +115 -0
- lark/customer_portal/raw_client.py +134 -0
- lark/environment.py +7 -0
- lark/{types/dimension.py → invoices/__init__.py} +1 -2
- lark/invoices/client.py +136 -0
- lark/invoices/raw_client.py +147 -0
- lark/pricing_metrics/__init__.py +38 -0
- lark/pricing_metrics/client.py +288 -0
- lark/pricing_metrics/raw_client.py +369 -0
- lark/pricing_metrics/types/__init__.py +42 -0
- lark/{types/credit_grant_resource_input_schedule.py → pricing_metrics/types/pricing_metric_aggregation.py} +7 -8
- lark/rate_cards/__init__.py +0 -15
- lark/rate_cards/client.py +30 -542
- lark/rate_cards/raw_client.py +34 -370
- lark/rate_cards/types/__init__.py +0 -17
- lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +3 -29
- lark/subjects/client.py +18 -54
- lark/subjects/raw_client.py +14 -24
- lark/subscriptions/client.py +104 -80
- lark/subscriptions/raw_client.py +186 -53
- lark/types/__init__.py +63 -379
- lark/types/aggregation.py +1 -43
- lark/types/amount.py +5 -1
- lark/types/{credit_grant_date_time_expiration_interface.py → billing_state_response.py} +3 -2
- lark/types/{credit_grant_schedule_one_time_resource.py → count_aggregation_pricing_metric_resource.py} +1 -1
- lark/types/{create_dimension_interface.py → create_customer_portal_session_response.py} +3 -3
- lark/types/{create_dimension_coordinate_interface.py → create_fixed_rate_request.py} +5 -3
- lark/types/{pricing_metric_interface.py → create_pricing_metric_response.py} +2 -5
- lark/types/{create_simple_usage_based_rate_interface.py → create_simple_usage_based_rate_request.py} +6 -9
- lark/types/create_subject_response.py +30 -6
- lark/types/create_subscription_checkout_session_response.py +1 -2
- lark/types/create_usage_event_summary_response.py +1 -1
- lark/types/fixed_rate_interface.py +0 -6
- lark/types/{create_pricing_metric_interface.py → get_pricing_metric_response.py} +3 -5
- lark/types/{complete_subscription_checkout_response.py → invoice_line_item_resource.py} +4 -2
- lark/types/invoice_resource.py +31 -0
- lark/types/invoice_status.py +5 -0
- lark/types/{check_feature_access_response.py → list_invoices_response.py} +4 -4
- lark/types/{check_feature_access_request.py → list_pricing_metrics_response.py} +4 -7
- lark/types/package_price.py +2 -2
- lark/types/package_price_input_rounding_behavior.py +5 -0
- lark/types/package_price_output_rounding_behavior.py +5 -0
- lark/types/period_resource.py +23 -0
- lark/types/price.py +39 -1
- lark/types/pricing_metric_resource.py +24 -0
- lark/types/rate_card_resource.py +0 -6
- lark/types/rate_card_resource_usage_based_rates_item.py +2 -29
- lark/types/simple_usage_based_rate_interface.py +1 -7
- lark/types/subject_resource.py +30 -6
- lark/types/subscription_resource.py +6 -4
- lark/types/subscription_status.py +5 -0
- lark/types/{credit_grant_date_time_expiration_resource.py → sum_aggregation_pricing_metric_resource.py} +2 -2
- lark/types/{subject.py → value.py} +1 -1
- lark/usage_events/client.py +8 -21
- lark/usage_events/raw_client.py +6 -6
- {lark_billing-0.0.6.dist-info → lark_billing-0.0.8.dist-info}/METADATA +4 -3
- lark_billing-0.0.8.dist-info/RECORD +107 -0
- lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +0 -58
- lark/rate_cards/types/create_rate_card_version_request_version_type.py +0 -5
- lark/types/create_credit_grant_interface.py +0 -27
- lark/types/create_credit_grant_interface_expiration.py +0 -27
- lark/types/create_credit_pool_request.py +0 -5
- lark/types/create_dimensional_usage_based_rate_interface.py +0 -32
- lark/types/create_fixed_rate_interface.py +0 -28
- lark/types/create_pricing_matrix_cell_interface.py +0 -22
- lark/types/create_pricing_matrix_interface.py +0 -20
- lark/types/create_pricing_plan_request.py +0 -5
- lark/types/create_rate_card_response.py +0 -36
- lark/types/create_rate_card_response_billing_interval.py +0 -5
- lark/types/create_rate_card_response_usage_based_rates_item.py +0 -58
- lark/types/create_rate_card_version_response.py +0 -36
- lark/types/create_rate_card_version_response_billing_interval.py +0 -5
- lark/types/create_rate_card_version_response_usage_based_rates_item.py +0 -59
- lark/types/credit_grant_duration_expiration_interface.py +0 -21
- lark/types/credit_grant_duration_expiration_resource.py +0 -21
- lark/types/credit_grant_interface.py +0 -28
- lark/types/credit_grant_interface_input_expiration.py +0 -27
- lark/types/credit_grant_interface_output_expiration.py +0 -43
- lark/types/credit_grant_interface_output_schedule.py +0 -41
- lark/types/credit_grant_resource.py +0 -28
- lark/types/credit_grant_resource_input_expiration.py +0 -27
- lark/types/credit_grant_resource_output_expiration.py +0 -43
- lark/types/credit_grant_resource_output_schedule.py +0 -39
- lark/types/credit_grant_schedule.py +0 -5
- lark/types/credit_grant_schedule_one_time_interface.py +0 -19
- lark/types/credit_grant_schedule_rate_cycle_start_interface.py +0 -19
- lark/types/credit_grant_schedule_rate_cycle_start_resource.py +0 -17
- lark/types/credit_grant_subject_granting_config_interface.py +0 -20
- lark/types/credit_pool.py +0 -5
- lark/types/credit_pool_rollover_config.py +0 -5
- lark/types/custom_aggregation_pricing_metric_interface.py +0 -22
- lark/types/custom_pricing_metric.py +0 -5
- lark/types/custom_unit.py +0 -5
- lark/types/custom_unit_amount.py +0 -5
- lark/types/dimension_coordinate.py +0 -5
- lark/types/dimension_coordinate_interface.py +0 -20
- lark/types/dimension_coordinate_set.py +0 -5
- lark/types/dimension_interface.py +0 -20
- lark/types/dimensional_rate_matrix.py +0 -5
- lark/types/dimensional_rate_matrix_cell.py +0 -5
- lark/types/dimensional_usage_based_rate.py +0 -5
- lark/types/dimensional_usage_based_rate_input.py +0 -5
- lark/types/dimensional_usage_based_rate_interface.py +0 -33
- lark/types/feature_access_resource.py +0 -21
- lark/types/get_rate_card_response.py +0 -36
- lark/types/get_rate_card_response_billing_interval.py +0 -5
- lark/types/get_rate_card_response_usage_based_rates_item.py +0 -58
- lark/types/grant_credits_request.py +0 -5
- lark/types/last_aggregation_pricing_metric_interface.py +0 -22
- lark/types/license_based_rate.py +0 -5
- lark/types/license_based_rate_input.py +0 -5
- lark/types/max_aggregation_pricing_metric_interface.py +0 -22
- lark/types/monetary_amount.py +0 -5
- lark/types/package_price_rounding_behavior.py +0 -5
- lark/types/package_price_wrapper.py +0 -5
- lark/types/pricing_matrix_cell_interface.py +0 -22
- lark/types/pricing_matrix_interface.py +0 -20
- lark/types/pricing_metric.py +0 -5
- lark/types/pricing_plan.py +0 -5
- lark/types/pricing_plan_subscription.py +0 -5
- lark/types/pricing_tier.py +0 -5
- lark/types/rate_card_version.py +0 -5
- lark/types/rate_card_version_input.py +0 -5
- lark/types/simple_usage_based_rate.py +0 -5
- lark/types/simple_usage_based_rate_input.py +0 -5
- lark/types/status.py +0 -5
- lark/types/subject_granting_config.py +0 -5
- lark/types/subject_granting_config_resource.py +0 -20
- lark/types/tiered_price.py +0 -5
- lark/types/tiered_price_wrapper.py +0 -5
- lark/types/unit.py +0 -5
- lark/types/update_pricing_plan_request.py +0 -5
- lark/types/update_rate_card_request.py +0 -5
- lark/types/update_subscription_request.py +0 -5
- lark/types/usage_based_rate.py +0 -5
- lark/types/usage_based_rate_input.py +0 -5
- lark/types/usage_unit.py +0 -5
- lark_billing-0.0.6.dist-info/RECORD +0 -167
- /lark/{feature_access → customer_access}/__init__.py +0 -0
- {lark_billing-0.0.6.dist-info → lark_billing-0.0.8.dist-info}/WHEEL +0 -0
lark/rate_cards/client.py
CHANGED
|
@@ -4,22 +4,12 @@ import typing
|
|
|
4
4
|
|
|
5
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
6
6
|
from ..core.request_options import RequestOptions
|
|
7
|
-
from ..types.
|
|
8
|
-
from ..types.create_fixed_rate_interface import CreateFixedRateInterface
|
|
9
|
-
from ..types.create_rate_card_response import CreateRateCardResponse
|
|
10
|
-
from ..types.create_rate_card_version_response import CreateRateCardVersionResponse
|
|
11
|
-
from ..types.credit_grant_resource import CreditGrantResource
|
|
12
|
-
from ..types.feature_access_resource import FeatureAccessResource
|
|
13
|
-
from ..types.fixed_rate_interface import FixedRateInterface
|
|
14
|
-
from ..types.get_rate_card_response import GetRateCardResponse
|
|
7
|
+
from ..types.create_fixed_rate_request import CreateFixedRateRequest
|
|
15
8
|
from ..types.list_rate_cards_response import ListRateCardsResponse
|
|
9
|
+
from ..types.rate_card_resource import RateCardResource
|
|
16
10
|
from .raw_client import AsyncRawRateCardsClient, RawRateCardsClient
|
|
17
11
|
from .types.create_rate_card_request_billing_interval import CreateRateCardRequestBillingInterval
|
|
18
12
|
from .types.create_rate_card_request_usage_based_rates_item import CreateRateCardRequestUsageBasedRatesItem
|
|
19
|
-
from .types.create_rate_card_version_request_usage_based_rates_item import (
|
|
20
|
-
CreateRateCardVersionRequestUsageBasedRatesItem,
|
|
21
|
-
)
|
|
22
|
-
from .types.create_rate_card_version_request_version_type import CreateRateCardVersionRequestVersionType
|
|
23
13
|
|
|
24
14
|
# this is used as the default value for optional parameters
|
|
25
15
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -41,19 +31,13 @@ class RateCardsClient:
|
|
|
41
31
|
return self._raw_client
|
|
42
32
|
|
|
43
33
|
def list_rate_cards(
|
|
44
|
-
self,
|
|
45
|
-
*,
|
|
46
|
-
limit: typing.Optional[int] = None,
|
|
47
|
-
offset: typing.Optional[int] = None,
|
|
48
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
34
|
+
self, *, limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
49
35
|
) -> ListRateCardsResponse:
|
|
50
36
|
"""
|
|
51
37
|
Parameters
|
|
52
38
|
----------
|
|
53
39
|
limit : typing.Optional[int]
|
|
54
40
|
|
|
55
|
-
offset : typing.Optional[int]
|
|
56
|
-
|
|
57
41
|
request_options : typing.Optional[RequestOptions]
|
|
58
42
|
Request-specific configuration.
|
|
59
43
|
|
|
@@ -68,45 +52,37 @@ class RateCardsClient:
|
|
|
68
52
|
|
|
69
53
|
client = Lark(
|
|
70
54
|
api_key="YOUR_API_KEY",
|
|
71
|
-
base_url="https://yourhost.com/path/to/api",
|
|
72
55
|
)
|
|
73
56
|
client.rate_cards.list_rate_cards(
|
|
74
57
|
limit=1,
|
|
75
|
-
offset=1,
|
|
76
58
|
)
|
|
77
59
|
"""
|
|
78
|
-
_response = self._raw_client.list_rate_cards(limit=limit,
|
|
60
|
+
_response = self._raw_client.list_rate_cards(limit=limit, request_options=request_options)
|
|
79
61
|
return _response.data
|
|
80
62
|
|
|
81
63
|
def create_rate_card(
|
|
82
64
|
self,
|
|
83
65
|
*,
|
|
84
66
|
name: str,
|
|
85
|
-
description: str,
|
|
86
|
-
usage_based_rates: typing.Sequence[CreateRateCardRequestUsageBasedRatesItem],
|
|
87
67
|
billing_interval: CreateRateCardRequestBillingInterval,
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
68
|
+
description: typing.Optional[str] = OMIT,
|
|
69
|
+
usage_based_rates: typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]] = OMIT,
|
|
70
|
+
fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateRequest]] = OMIT,
|
|
91
71
|
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
92
72
|
request_options: typing.Optional[RequestOptions] = None,
|
|
93
|
-
) ->
|
|
73
|
+
) -> RateCardResource:
|
|
94
74
|
"""
|
|
95
75
|
Parameters
|
|
96
76
|
----------
|
|
97
77
|
name : str
|
|
98
78
|
|
|
99
|
-
description : str
|
|
100
|
-
|
|
101
|
-
usage_based_rates : typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]
|
|
102
|
-
|
|
103
79
|
billing_interval : CreateRateCardRequestBillingInterval
|
|
104
80
|
|
|
105
|
-
|
|
81
|
+
description : typing.Optional[str]
|
|
106
82
|
|
|
107
|
-
|
|
83
|
+
usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
|
|
108
84
|
|
|
109
|
-
|
|
85
|
+
fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
|
|
110
86
|
|
|
111
87
|
metadata : typing.Optional[typing.Dict[str, str]]
|
|
112
88
|
|
|
@@ -115,77 +91,27 @@ class RateCardsClient:
|
|
|
115
91
|
|
|
116
92
|
Returns
|
|
117
93
|
-------
|
|
118
|
-
|
|
94
|
+
RateCardResource
|
|
119
95
|
Successful Response
|
|
120
96
|
|
|
121
97
|
Examples
|
|
122
98
|
--------
|
|
123
|
-
from lark import
|
|
124
|
-
Aggregation_Count,
|
|
125
|
-
CreateDimensionCoordinateInterface,
|
|
126
|
-
CreateDimensionInterface,
|
|
127
|
-
CreatePricingMatrixCellInterface,
|
|
128
|
-
CreatePricingMatrixInterface,
|
|
129
|
-
CreatePricingMetricInterface,
|
|
130
|
-
Lark,
|
|
131
|
-
)
|
|
132
|
-
from lark.rate_cards import CreateRateCardRequestUsageBasedRatesItem_Dimensional
|
|
99
|
+
from lark import Lark
|
|
133
100
|
|
|
134
101
|
client = Lark(
|
|
135
102
|
api_key="YOUR_API_KEY",
|
|
136
|
-
base_url="https://yourhost.com/path/to/api",
|
|
137
103
|
)
|
|
138
104
|
client.rate_cards.create_rate_card(
|
|
139
105
|
name="name",
|
|
140
|
-
description="description",
|
|
141
|
-
usage_based_rates=[
|
|
142
|
-
CreateRateCardRequestUsageBasedRatesItem_Dimensional(
|
|
143
|
-
code="code",
|
|
144
|
-
name="name",
|
|
145
|
-
pricing_metric=CreatePricingMetricInterface(
|
|
146
|
-
name="name",
|
|
147
|
-
event_name="event_name",
|
|
148
|
-
aggregation=Aggregation_Count(),
|
|
149
|
-
unit="unit",
|
|
150
|
-
),
|
|
151
|
-
dimensions=[
|
|
152
|
-
CreateDimensionInterface(
|
|
153
|
-
key="key",
|
|
154
|
-
values=["values"],
|
|
155
|
-
)
|
|
156
|
-
],
|
|
157
|
-
pricing_matrix=CreatePricingMatrixInterface(
|
|
158
|
-
cells=[
|
|
159
|
-
CreatePricingMatrixCellInterface(
|
|
160
|
-
dimension_coordinates=[
|
|
161
|
-
CreateDimensionCoordinateInterface(
|
|
162
|
-
dimension_key="dimension_key",
|
|
163
|
-
value="value",
|
|
164
|
-
)
|
|
165
|
-
],
|
|
166
|
-
price={
|
|
167
|
-
"amount": {
|
|
168
|
-
"value": 1,
|
|
169
|
-
"currency_code": "currency_code",
|
|
170
|
-
},
|
|
171
|
-
"price_type": "flat",
|
|
172
|
-
},
|
|
173
|
-
)
|
|
174
|
-
],
|
|
175
|
-
),
|
|
176
|
-
)
|
|
177
|
-
],
|
|
178
106
|
billing_interval="monthly",
|
|
179
107
|
)
|
|
180
108
|
"""
|
|
181
109
|
_response = self._raw_client.create_rate_card(
|
|
182
110
|
name=name,
|
|
111
|
+
billing_interval=billing_interval,
|
|
183
112
|
description=description,
|
|
184
113
|
usage_based_rates=usage_based_rates,
|
|
185
|
-
billing_interval=billing_interval,
|
|
186
114
|
fixed_rates=fixed_rates,
|
|
187
|
-
credit_grants=credit_grants,
|
|
188
|
-
feature_access=feature_access,
|
|
189
115
|
metadata=metadata,
|
|
190
116
|
request_options=request_options,
|
|
191
117
|
)
|
|
@@ -193,7 +119,7 @@ class RateCardsClient:
|
|
|
193
119
|
|
|
194
120
|
def get_rate_card(
|
|
195
121
|
self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
196
|
-
) ->
|
|
122
|
+
) -> RateCardResource:
|
|
197
123
|
"""
|
|
198
124
|
Parameters
|
|
199
125
|
----------
|
|
@@ -204,7 +130,7 @@ class RateCardsClient:
|
|
|
204
130
|
|
|
205
131
|
Returns
|
|
206
132
|
-------
|
|
207
|
-
|
|
133
|
+
RateCardResource
|
|
208
134
|
Successful Response
|
|
209
135
|
|
|
210
136
|
Examples
|
|
@@ -213,7 +139,6 @@ class RateCardsClient:
|
|
|
213
139
|
|
|
214
140
|
client = Lark(
|
|
215
141
|
api_key="YOUR_API_KEY",
|
|
216
|
-
base_url="https://yourhost.com/path/to/api",
|
|
217
142
|
)
|
|
218
143
|
client.rate_cards.get_rate_card(
|
|
219
144
|
rate_card_id="rate_card_id",
|
|
@@ -222,178 +147,6 @@ class RateCardsClient:
|
|
|
222
147
|
_response = self._raw_client.get_rate_card(rate_card_id, request_options=request_options)
|
|
223
148
|
return _response.data
|
|
224
149
|
|
|
225
|
-
def delete_rate_card(self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
226
|
-
"""
|
|
227
|
-
Parameters
|
|
228
|
-
----------
|
|
229
|
-
rate_card_id : str
|
|
230
|
-
|
|
231
|
-
request_options : typing.Optional[RequestOptions]
|
|
232
|
-
Request-specific configuration.
|
|
233
|
-
|
|
234
|
-
Returns
|
|
235
|
-
-------
|
|
236
|
-
None
|
|
237
|
-
|
|
238
|
-
Examples
|
|
239
|
-
--------
|
|
240
|
-
from lark import Lark
|
|
241
|
-
|
|
242
|
-
client = Lark(
|
|
243
|
-
api_key="YOUR_API_KEY",
|
|
244
|
-
base_url="https://yourhost.com/path/to/api",
|
|
245
|
-
)
|
|
246
|
-
client.rate_cards.delete_rate_card(
|
|
247
|
-
rate_card_id="rate_card_id",
|
|
248
|
-
)
|
|
249
|
-
"""
|
|
250
|
-
_response = self._raw_client.delete_rate_card(rate_card_id, request_options=request_options)
|
|
251
|
-
return _response.data
|
|
252
|
-
|
|
253
|
-
def update_rate_card(self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
254
|
-
"""
|
|
255
|
-
Parameters
|
|
256
|
-
----------
|
|
257
|
-
rate_card_id : str
|
|
258
|
-
|
|
259
|
-
request_options : typing.Optional[RequestOptions]
|
|
260
|
-
Request-specific configuration.
|
|
261
|
-
|
|
262
|
-
Returns
|
|
263
|
-
-------
|
|
264
|
-
None
|
|
265
|
-
|
|
266
|
-
Examples
|
|
267
|
-
--------
|
|
268
|
-
from lark import Lark
|
|
269
|
-
|
|
270
|
-
client = Lark(
|
|
271
|
-
api_key="YOUR_API_KEY",
|
|
272
|
-
base_url="https://yourhost.com/path/to/api",
|
|
273
|
-
)
|
|
274
|
-
client.rate_cards.update_rate_card(
|
|
275
|
-
rate_card_id="rate_card_id",
|
|
276
|
-
)
|
|
277
|
-
"""
|
|
278
|
-
_response = self._raw_client.update_rate_card(rate_card_id, request_options=request_options)
|
|
279
|
-
return _response.data
|
|
280
|
-
|
|
281
|
-
def create_rate_card_version(
|
|
282
|
-
self,
|
|
283
|
-
rate_card_id: str,
|
|
284
|
-
*,
|
|
285
|
-
name: str,
|
|
286
|
-
description: str,
|
|
287
|
-
usage_based_rates: typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem],
|
|
288
|
-
version_type: CreateRateCardVersionRequestVersionType,
|
|
289
|
-
fixed_rates: typing.Optional[typing.Sequence[FixedRateInterface]] = OMIT,
|
|
290
|
-
credit_grants: typing.Optional[typing.Sequence[CreditGrantResource]] = OMIT,
|
|
291
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
292
|
-
) -> CreateRateCardVersionResponse:
|
|
293
|
-
"""
|
|
294
|
-
Parameters
|
|
295
|
-
----------
|
|
296
|
-
rate_card_id : str
|
|
297
|
-
|
|
298
|
-
name : str
|
|
299
|
-
|
|
300
|
-
description : str
|
|
301
|
-
|
|
302
|
-
usage_based_rates : typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem]
|
|
303
|
-
|
|
304
|
-
version_type : CreateRateCardVersionRequestVersionType
|
|
305
|
-
|
|
306
|
-
fixed_rates : typing.Optional[typing.Sequence[FixedRateInterface]]
|
|
307
|
-
|
|
308
|
-
credit_grants : typing.Optional[typing.Sequence[CreditGrantResource]]
|
|
309
|
-
|
|
310
|
-
request_options : typing.Optional[RequestOptions]
|
|
311
|
-
Request-specific configuration.
|
|
312
|
-
|
|
313
|
-
Returns
|
|
314
|
-
-------
|
|
315
|
-
CreateRateCardVersionResponse
|
|
316
|
-
Successful Response
|
|
317
|
-
|
|
318
|
-
Examples
|
|
319
|
-
--------
|
|
320
|
-
from lark import (
|
|
321
|
-
Aggregation_Count,
|
|
322
|
-
DimensionCoordinateInterface,
|
|
323
|
-
DimensionInterface,
|
|
324
|
-
Lark,
|
|
325
|
-
PricingMatrixCellInterface,
|
|
326
|
-
PricingMatrixInterface,
|
|
327
|
-
PricingMetricInterface,
|
|
328
|
-
)
|
|
329
|
-
from lark.rate_cards import (
|
|
330
|
-
CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional,
|
|
331
|
-
)
|
|
332
|
-
|
|
333
|
-
client = Lark(
|
|
334
|
-
api_key="YOUR_API_KEY",
|
|
335
|
-
base_url="https://yourhost.com/path/to/api",
|
|
336
|
-
)
|
|
337
|
-
client.rate_cards.create_rate_card_version(
|
|
338
|
-
rate_card_id="rate_card_id",
|
|
339
|
-
name="name",
|
|
340
|
-
description="description",
|
|
341
|
-
usage_based_rates=[
|
|
342
|
-
CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional(
|
|
343
|
-
id="id",
|
|
344
|
-
code="code",
|
|
345
|
-
name="name",
|
|
346
|
-
description="description",
|
|
347
|
-
included_units=1,
|
|
348
|
-
pricing_metric=PricingMetricInterface(
|
|
349
|
-
id="id",
|
|
350
|
-
name="name",
|
|
351
|
-
event_name="event_name",
|
|
352
|
-
aggregation=Aggregation_Count(),
|
|
353
|
-
unit="unit",
|
|
354
|
-
),
|
|
355
|
-
dimensions=[
|
|
356
|
-
DimensionInterface(
|
|
357
|
-
key="key",
|
|
358
|
-
values=["values"],
|
|
359
|
-
)
|
|
360
|
-
],
|
|
361
|
-
pricing_matrix=PricingMatrixInterface(
|
|
362
|
-
cells=[
|
|
363
|
-
PricingMatrixCellInterface(
|
|
364
|
-
dimension_coordinates=[
|
|
365
|
-
DimensionCoordinateInterface(
|
|
366
|
-
dimension_key="dimension_key",
|
|
367
|
-
value="value",
|
|
368
|
-
)
|
|
369
|
-
],
|
|
370
|
-
price={
|
|
371
|
-
"amount": {
|
|
372
|
-
"value": 1,
|
|
373
|
-
"currency_code": "currency_code",
|
|
374
|
-
},
|
|
375
|
-
"price_type": "flat",
|
|
376
|
-
},
|
|
377
|
-
)
|
|
378
|
-
],
|
|
379
|
-
),
|
|
380
|
-
)
|
|
381
|
-
],
|
|
382
|
-
version_type="major",
|
|
383
|
-
)
|
|
384
|
-
"""
|
|
385
|
-
_response = self._raw_client.create_rate_card_version(
|
|
386
|
-
rate_card_id,
|
|
387
|
-
name=name,
|
|
388
|
-
description=description,
|
|
389
|
-
usage_based_rates=usage_based_rates,
|
|
390
|
-
version_type=version_type,
|
|
391
|
-
fixed_rates=fixed_rates,
|
|
392
|
-
credit_grants=credit_grants,
|
|
393
|
-
request_options=request_options,
|
|
394
|
-
)
|
|
395
|
-
return _response.data
|
|
396
|
-
|
|
397
150
|
|
|
398
151
|
class AsyncRateCardsClient:
|
|
399
152
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -411,19 +164,13 @@ class AsyncRateCardsClient:
|
|
|
411
164
|
return self._raw_client
|
|
412
165
|
|
|
413
166
|
async def list_rate_cards(
|
|
414
|
-
self,
|
|
415
|
-
*,
|
|
416
|
-
limit: typing.Optional[int] = None,
|
|
417
|
-
offset: typing.Optional[int] = None,
|
|
418
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
167
|
+
self, *, limit: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
419
168
|
) -> ListRateCardsResponse:
|
|
420
169
|
"""
|
|
421
170
|
Parameters
|
|
422
171
|
----------
|
|
423
172
|
limit : typing.Optional[int]
|
|
424
173
|
|
|
425
|
-
offset : typing.Optional[int]
|
|
426
|
-
|
|
427
174
|
request_options : typing.Optional[RequestOptions]
|
|
428
175
|
Request-specific configuration.
|
|
429
176
|
|
|
@@ -440,51 +187,43 @@ class AsyncRateCardsClient:
|
|
|
440
187
|
|
|
441
188
|
client = AsyncLark(
|
|
442
189
|
api_key="YOUR_API_KEY",
|
|
443
|
-
base_url="https://yourhost.com/path/to/api",
|
|
444
190
|
)
|
|
445
191
|
|
|
446
192
|
|
|
447
193
|
async def main() -> None:
|
|
448
194
|
await client.rate_cards.list_rate_cards(
|
|
449
195
|
limit=1,
|
|
450
|
-
offset=1,
|
|
451
196
|
)
|
|
452
197
|
|
|
453
198
|
|
|
454
199
|
asyncio.run(main())
|
|
455
200
|
"""
|
|
456
|
-
_response = await self._raw_client.list_rate_cards(limit=limit,
|
|
201
|
+
_response = await self._raw_client.list_rate_cards(limit=limit, request_options=request_options)
|
|
457
202
|
return _response.data
|
|
458
203
|
|
|
459
204
|
async def create_rate_card(
|
|
460
205
|
self,
|
|
461
206
|
*,
|
|
462
207
|
name: str,
|
|
463
|
-
description: str,
|
|
464
|
-
usage_based_rates: typing.Sequence[CreateRateCardRequestUsageBasedRatesItem],
|
|
465
208
|
billing_interval: CreateRateCardRequestBillingInterval,
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
209
|
+
description: typing.Optional[str] = OMIT,
|
|
210
|
+
usage_based_rates: typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]] = OMIT,
|
|
211
|
+
fixed_rates: typing.Optional[typing.Sequence[CreateFixedRateRequest]] = OMIT,
|
|
469
212
|
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
470
213
|
request_options: typing.Optional[RequestOptions] = None,
|
|
471
|
-
) ->
|
|
214
|
+
) -> RateCardResource:
|
|
472
215
|
"""
|
|
473
216
|
Parameters
|
|
474
217
|
----------
|
|
475
218
|
name : str
|
|
476
219
|
|
|
477
|
-
description : str
|
|
478
|
-
|
|
479
|
-
usage_based_rates : typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]
|
|
480
|
-
|
|
481
220
|
billing_interval : CreateRateCardRequestBillingInterval
|
|
482
221
|
|
|
483
|
-
|
|
222
|
+
description : typing.Optional[str]
|
|
484
223
|
|
|
485
|
-
|
|
224
|
+
usage_based_rates : typing.Optional[typing.Sequence[CreateRateCardRequestUsageBasedRatesItem]]
|
|
486
225
|
|
|
487
|
-
|
|
226
|
+
fixed_rates : typing.Optional[typing.Sequence[CreateFixedRateRequest]]
|
|
488
227
|
|
|
489
228
|
metadata : typing.Optional[typing.Dict[str, str]]
|
|
490
229
|
|
|
@@ -493,71 +232,23 @@ class AsyncRateCardsClient:
|
|
|
493
232
|
|
|
494
233
|
Returns
|
|
495
234
|
-------
|
|
496
|
-
|
|
235
|
+
RateCardResource
|
|
497
236
|
Successful Response
|
|
498
237
|
|
|
499
238
|
Examples
|
|
500
239
|
--------
|
|
501
240
|
import asyncio
|
|
502
241
|
|
|
503
|
-
from lark import
|
|
504
|
-
Aggregation_Count,
|
|
505
|
-
AsyncLark,
|
|
506
|
-
CreateDimensionCoordinateInterface,
|
|
507
|
-
CreateDimensionInterface,
|
|
508
|
-
CreatePricingMatrixCellInterface,
|
|
509
|
-
CreatePricingMatrixInterface,
|
|
510
|
-
CreatePricingMetricInterface,
|
|
511
|
-
)
|
|
512
|
-
from lark.rate_cards import CreateRateCardRequestUsageBasedRatesItem_Dimensional
|
|
242
|
+
from lark import AsyncLark
|
|
513
243
|
|
|
514
244
|
client = AsyncLark(
|
|
515
245
|
api_key="YOUR_API_KEY",
|
|
516
|
-
base_url="https://yourhost.com/path/to/api",
|
|
517
246
|
)
|
|
518
247
|
|
|
519
248
|
|
|
520
249
|
async def main() -> None:
|
|
521
250
|
await client.rate_cards.create_rate_card(
|
|
522
251
|
name="name",
|
|
523
|
-
description="description",
|
|
524
|
-
usage_based_rates=[
|
|
525
|
-
CreateRateCardRequestUsageBasedRatesItem_Dimensional(
|
|
526
|
-
code="code",
|
|
527
|
-
name="name",
|
|
528
|
-
pricing_metric=CreatePricingMetricInterface(
|
|
529
|
-
name="name",
|
|
530
|
-
event_name="event_name",
|
|
531
|
-
aggregation=Aggregation_Count(),
|
|
532
|
-
unit="unit",
|
|
533
|
-
),
|
|
534
|
-
dimensions=[
|
|
535
|
-
CreateDimensionInterface(
|
|
536
|
-
key="key",
|
|
537
|
-
values=["values"],
|
|
538
|
-
)
|
|
539
|
-
],
|
|
540
|
-
pricing_matrix=CreatePricingMatrixInterface(
|
|
541
|
-
cells=[
|
|
542
|
-
CreatePricingMatrixCellInterface(
|
|
543
|
-
dimension_coordinates=[
|
|
544
|
-
CreateDimensionCoordinateInterface(
|
|
545
|
-
dimension_key="dimension_key",
|
|
546
|
-
value="value",
|
|
547
|
-
)
|
|
548
|
-
],
|
|
549
|
-
price={
|
|
550
|
-
"amount": {
|
|
551
|
-
"value": 1,
|
|
552
|
-
"currency_code": "currency_code",
|
|
553
|
-
},
|
|
554
|
-
"price_type": "flat",
|
|
555
|
-
},
|
|
556
|
-
)
|
|
557
|
-
],
|
|
558
|
-
),
|
|
559
|
-
)
|
|
560
|
-
],
|
|
561
252
|
billing_interval="monthly",
|
|
562
253
|
)
|
|
563
254
|
|
|
@@ -566,12 +257,10 @@ class AsyncRateCardsClient:
|
|
|
566
257
|
"""
|
|
567
258
|
_response = await self._raw_client.create_rate_card(
|
|
568
259
|
name=name,
|
|
260
|
+
billing_interval=billing_interval,
|
|
569
261
|
description=description,
|
|
570
262
|
usage_based_rates=usage_based_rates,
|
|
571
|
-
billing_interval=billing_interval,
|
|
572
263
|
fixed_rates=fixed_rates,
|
|
573
|
-
credit_grants=credit_grants,
|
|
574
|
-
feature_access=feature_access,
|
|
575
264
|
metadata=metadata,
|
|
576
265
|
request_options=request_options,
|
|
577
266
|
)
|
|
@@ -579,7 +268,7 @@ class AsyncRateCardsClient:
|
|
|
579
268
|
|
|
580
269
|
async def get_rate_card(
|
|
581
270
|
self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
582
|
-
) ->
|
|
271
|
+
) -> RateCardResource:
|
|
583
272
|
"""
|
|
584
273
|
Parameters
|
|
585
274
|
----------
|
|
@@ -590,7 +279,7 @@ class AsyncRateCardsClient:
|
|
|
590
279
|
|
|
591
280
|
Returns
|
|
592
281
|
-------
|
|
593
|
-
|
|
282
|
+
RateCardResource
|
|
594
283
|
Successful Response
|
|
595
284
|
|
|
596
285
|
Examples
|
|
@@ -601,7 +290,6 @@ class AsyncRateCardsClient:
|
|
|
601
290
|
|
|
602
291
|
client = AsyncLark(
|
|
603
292
|
api_key="YOUR_API_KEY",
|
|
604
|
-
base_url="https://yourhost.com/path/to/api",
|
|
605
293
|
)
|
|
606
294
|
|
|
607
295
|
|
|
@@ -615,203 +303,3 @@ class AsyncRateCardsClient:
|
|
|
615
303
|
"""
|
|
616
304
|
_response = await self._raw_client.get_rate_card(rate_card_id, request_options=request_options)
|
|
617
305
|
return _response.data
|
|
618
|
-
|
|
619
|
-
async def delete_rate_card(
|
|
620
|
-
self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
621
|
-
) -> None:
|
|
622
|
-
"""
|
|
623
|
-
Parameters
|
|
624
|
-
----------
|
|
625
|
-
rate_card_id : str
|
|
626
|
-
|
|
627
|
-
request_options : typing.Optional[RequestOptions]
|
|
628
|
-
Request-specific configuration.
|
|
629
|
-
|
|
630
|
-
Returns
|
|
631
|
-
-------
|
|
632
|
-
None
|
|
633
|
-
|
|
634
|
-
Examples
|
|
635
|
-
--------
|
|
636
|
-
import asyncio
|
|
637
|
-
|
|
638
|
-
from lark import AsyncLark
|
|
639
|
-
|
|
640
|
-
client = AsyncLark(
|
|
641
|
-
api_key="YOUR_API_KEY",
|
|
642
|
-
base_url="https://yourhost.com/path/to/api",
|
|
643
|
-
)
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
async def main() -> None:
|
|
647
|
-
await client.rate_cards.delete_rate_card(
|
|
648
|
-
rate_card_id="rate_card_id",
|
|
649
|
-
)
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
asyncio.run(main())
|
|
653
|
-
"""
|
|
654
|
-
_response = await self._raw_client.delete_rate_card(rate_card_id, request_options=request_options)
|
|
655
|
-
return _response.data
|
|
656
|
-
|
|
657
|
-
async def update_rate_card(
|
|
658
|
-
self, rate_card_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
659
|
-
) -> None:
|
|
660
|
-
"""
|
|
661
|
-
Parameters
|
|
662
|
-
----------
|
|
663
|
-
rate_card_id : str
|
|
664
|
-
|
|
665
|
-
request_options : typing.Optional[RequestOptions]
|
|
666
|
-
Request-specific configuration.
|
|
667
|
-
|
|
668
|
-
Returns
|
|
669
|
-
-------
|
|
670
|
-
None
|
|
671
|
-
|
|
672
|
-
Examples
|
|
673
|
-
--------
|
|
674
|
-
import asyncio
|
|
675
|
-
|
|
676
|
-
from lark import AsyncLark
|
|
677
|
-
|
|
678
|
-
client = AsyncLark(
|
|
679
|
-
api_key="YOUR_API_KEY",
|
|
680
|
-
base_url="https://yourhost.com/path/to/api",
|
|
681
|
-
)
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
async def main() -> None:
|
|
685
|
-
await client.rate_cards.update_rate_card(
|
|
686
|
-
rate_card_id="rate_card_id",
|
|
687
|
-
)
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
asyncio.run(main())
|
|
691
|
-
"""
|
|
692
|
-
_response = await self._raw_client.update_rate_card(rate_card_id, request_options=request_options)
|
|
693
|
-
return _response.data
|
|
694
|
-
|
|
695
|
-
async def create_rate_card_version(
|
|
696
|
-
self,
|
|
697
|
-
rate_card_id: str,
|
|
698
|
-
*,
|
|
699
|
-
name: str,
|
|
700
|
-
description: str,
|
|
701
|
-
usage_based_rates: typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem],
|
|
702
|
-
version_type: CreateRateCardVersionRequestVersionType,
|
|
703
|
-
fixed_rates: typing.Optional[typing.Sequence[FixedRateInterface]] = OMIT,
|
|
704
|
-
credit_grants: typing.Optional[typing.Sequence[CreditGrantResource]] = OMIT,
|
|
705
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
706
|
-
) -> CreateRateCardVersionResponse:
|
|
707
|
-
"""
|
|
708
|
-
Parameters
|
|
709
|
-
----------
|
|
710
|
-
rate_card_id : str
|
|
711
|
-
|
|
712
|
-
name : str
|
|
713
|
-
|
|
714
|
-
description : str
|
|
715
|
-
|
|
716
|
-
usage_based_rates : typing.Sequence[CreateRateCardVersionRequestUsageBasedRatesItem]
|
|
717
|
-
|
|
718
|
-
version_type : CreateRateCardVersionRequestVersionType
|
|
719
|
-
|
|
720
|
-
fixed_rates : typing.Optional[typing.Sequence[FixedRateInterface]]
|
|
721
|
-
|
|
722
|
-
credit_grants : typing.Optional[typing.Sequence[CreditGrantResource]]
|
|
723
|
-
|
|
724
|
-
request_options : typing.Optional[RequestOptions]
|
|
725
|
-
Request-specific configuration.
|
|
726
|
-
|
|
727
|
-
Returns
|
|
728
|
-
-------
|
|
729
|
-
CreateRateCardVersionResponse
|
|
730
|
-
Successful Response
|
|
731
|
-
|
|
732
|
-
Examples
|
|
733
|
-
--------
|
|
734
|
-
import asyncio
|
|
735
|
-
|
|
736
|
-
from lark import (
|
|
737
|
-
Aggregation_Count,
|
|
738
|
-
AsyncLark,
|
|
739
|
-
DimensionCoordinateInterface,
|
|
740
|
-
DimensionInterface,
|
|
741
|
-
PricingMatrixCellInterface,
|
|
742
|
-
PricingMatrixInterface,
|
|
743
|
-
PricingMetricInterface,
|
|
744
|
-
)
|
|
745
|
-
from lark.rate_cards import (
|
|
746
|
-
CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional,
|
|
747
|
-
)
|
|
748
|
-
|
|
749
|
-
client = AsyncLark(
|
|
750
|
-
api_key="YOUR_API_KEY",
|
|
751
|
-
base_url="https://yourhost.com/path/to/api",
|
|
752
|
-
)
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
async def main() -> None:
|
|
756
|
-
await client.rate_cards.create_rate_card_version(
|
|
757
|
-
rate_card_id="rate_card_id",
|
|
758
|
-
name="name",
|
|
759
|
-
description="description",
|
|
760
|
-
usage_based_rates=[
|
|
761
|
-
CreateRateCardVersionRequestUsageBasedRatesItem_Dimensional(
|
|
762
|
-
id="id",
|
|
763
|
-
code="code",
|
|
764
|
-
name="name",
|
|
765
|
-
description="description",
|
|
766
|
-
included_units=1,
|
|
767
|
-
pricing_metric=PricingMetricInterface(
|
|
768
|
-
id="id",
|
|
769
|
-
name="name",
|
|
770
|
-
event_name="event_name",
|
|
771
|
-
aggregation=Aggregation_Count(),
|
|
772
|
-
unit="unit",
|
|
773
|
-
),
|
|
774
|
-
dimensions=[
|
|
775
|
-
DimensionInterface(
|
|
776
|
-
key="key",
|
|
777
|
-
values=["values"],
|
|
778
|
-
)
|
|
779
|
-
],
|
|
780
|
-
pricing_matrix=PricingMatrixInterface(
|
|
781
|
-
cells=[
|
|
782
|
-
PricingMatrixCellInterface(
|
|
783
|
-
dimension_coordinates=[
|
|
784
|
-
DimensionCoordinateInterface(
|
|
785
|
-
dimension_key="dimension_key",
|
|
786
|
-
value="value",
|
|
787
|
-
)
|
|
788
|
-
],
|
|
789
|
-
price={
|
|
790
|
-
"amount": {
|
|
791
|
-
"value": 1,
|
|
792
|
-
"currency_code": "currency_code",
|
|
793
|
-
},
|
|
794
|
-
"price_type": "flat",
|
|
795
|
-
},
|
|
796
|
-
)
|
|
797
|
-
],
|
|
798
|
-
),
|
|
799
|
-
)
|
|
800
|
-
],
|
|
801
|
-
version_type="major",
|
|
802
|
-
)
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
asyncio.run(main())
|
|
806
|
-
"""
|
|
807
|
-
_response = await self._raw_client.create_rate_card_version(
|
|
808
|
-
rate_card_id,
|
|
809
|
-
name=name,
|
|
810
|
-
description=description,
|
|
811
|
-
usage_based_rates=usage_based_rates,
|
|
812
|
-
version_type=version_type,
|
|
813
|
-
fixed_rates=fixed_rates,
|
|
814
|
-
credit_grants=credit_grants,
|
|
815
|
-
request_options=request_options,
|
|
816
|
-
)
|
|
817
|
-
return _response.data
|