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/subscriptions/client.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
import datetime as dt
|
|
4
3
|
import typing
|
|
5
4
|
|
|
6
5
|
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
@@ -32,7 +31,8 @@ class SubscriptionsClient:
|
|
|
32
31
|
self,
|
|
33
32
|
*,
|
|
34
33
|
limit: typing.Optional[int] = None,
|
|
35
|
-
|
|
34
|
+
subject_id: typing.Optional[str] = None,
|
|
35
|
+
rate_card_id: typing.Optional[str] = None,
|
|
36
36
|
request_options: typing.Optional[RequestOptions] = None,
|
|
37
37
|
) -> ListSubscriptionsResponse:
|
|
38
38
|
"""
|
|
@@ -40,7 +40,11 @@ class SubscriptionsClient:
|
|
|
40
40
|
----------
|
|
41
41
|
limit : typing.Optional[int]
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
subject_id : typing.Optional[str]
|
|
44
|
+
The ID of the subject to list subscriptions for. Cannot be used with rate_card_id.
|
|
45
|
+
|
|
46
|
+
rate_card_id : typing.Optional[str]
|
|
47
|
+
The ID of the rate card to list subscriptions for. Cannot be used with subject_id.
|
|
44
48
|
|
|
45
49
|
request_options : typing.Optional[RequestOptions]
|
|
46
50
|
Request-specific configuration.
|
|
@@ -56,14 +60,16 @@ class SubscriptionsClient:
|
|
|
56
60
|
|
|
57
61
|
client = Lark(
|
|
58
62
|
api_key="YOUR_API_KEY",
|
|
59
|
-
base_url="https://yourhost.com/path/to/api",
|
|
60
63
|
)
|
|
61
64
|
client.subscriptions.list_subscriptions(
|
|
62
65
|
limit=1,
|
|
63
|
-
|
|
66
|
+
subject_id="subject_id",
|
|
67
|
+
rate_card_id="rate_card_id",
|
|
64
68
|
)
|
|
65
69
|
"""
|
|
66
|
-
_response = self._raw_client.list_subscriptions(
|
|
70
|
+
_response = self._raw_client.list_subscriptions(
|
|
71
|
+
limit=limit, subject_id=subject_id, rate_card_id=rate_card_id, request_options=request_options
|
|
72
|
+
)
|
|
67
73
|
return _response.data
|
|
68
74
|
|
|
69
75
|
def create_subscription(
|
|
@@ -71,23 +77,20 @@ class SubscriptionsClient:
|
|
|
71
77
|
*,
|
|
72
78
|
rate_card_id: str,
|
|
73
79
|
subject_id: str,
|
|
74
|
-
|
|
75
|
-
variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
76
|
-
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
80
|
+
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
77
81
|
request_options: typing.Optional[RequestOptions] = None,
|
|
78
82
|
) -> SubscriptionResource:
|
|
79
83
|
"""
|
|
80
84
|
Parameters
|
|
81
85
|
----------
|
|
82
86
|
rate_card_id : str
|
|
87
|
+
The ID of the rate card to use for the subscription.
|
|
83
88
|
|
|
84
89
|
subject_id : str
|
|
90
|
+
The ID of the subject to create the subscription for.
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
89
|
-
|
|
90
|
-
metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
92
|
+
metadata : typing.Optional[typing.Dict[str, str]]
|
|
93
|
+
Additional metadata about the subscription. You may use this to store any custom data about the subscription.
|
|
91
94
|
|
|
92
95
|
request_options : typing.Optional[RequestOptions]
|
|
93
96
|
Request-specific configuration.
|
|
@@ -99,29 +102,18 @@ class SubscriptionsClient:
|
|
|
99
102
|
|
|
100
103
|
Examples
|
|
101
104
|
--------
|
|
102
|
-
import datetime
|
|
103
|
-
|
|
104
105
|
from lark import Lark
|
|
105
106
|
|
|
106
107
|
client = Lark(
|
|
107
108
|
api_key="YOUR_API_KEY",
|
|
108
|
-
base_url="https://yourhost.com/path/to/api",
|
|
109
109
|
)
|
|
110
110
|
client.subscriptions.create_subscription(
|
|
111
|
-
rate_card_id="
|
|
112
|
-
subject_id="
|
|
113
|
-
effective_at=datetime.datetime.fromisoformat(
|
|
114
|
-
"2024-01-15 09:30:00+00:00",
|
|
115
|
-
),
|
|
111
|
+
rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
112
|
+
subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
116
113
|
)
|
|
117
114
|
"""
|
|
118
115
|
_response = self._raw_client.create_subscription(
|
|
119
|
-
rate_card_id=rate_card_id,
|
|
120
|
-
subject_id=subject_id,
|
|
121
|
-
effective_at=effective_at,
|
|
122
|
-
variables=variables,
|
|
123
|
-
metadata=metadata,
|
|
124
|
-
request_options=request_options,
|
|
116
|
+
rate_card_id=rate_card_id, subject_id=subject_id, metadata=metadata, request_options=request_options
|
|
125
117
|
)
|
|
126
118
|
return _response.data
|
|
127
119
|
|
|
@@ -147,7 +139,6 @@ class SubscriptionsClient:
|
|
|
147
139
|
|
|
148
140
|
client = Lark(
|
|
149
141
|
api_key="YOUR_API_KEY",
|
|
150
|
-
base_url="https://yourhost.com/path/to/api",
|
|
151
142
|
)
|
|
152
143
|
client.subscriptions.get_subscription(
|
|
153
144
|
subscription_id="subscription_id",
|
|
@@ -157,19 +148,31 @@ class SubscriptionsClient:
|
|
|
157
148
|
return _response.data
|
|
158
149
|
|
|
159
150
|
def cancel_subscription(
|
|
160
|
-
self,
|
|
161
|
-
|
|
151
|
+
self,
|
|
152
|
+
subscription_id: str,
|
|
153
|
+
*,
|
|
154
|
+
reason: typing.Optional[str] = OMIT,
|
|
155
|
+
cancel_at_end_of_cycle: typing.Optional[bool] = OMIT,
|
|
156
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
157
|
+
) -> SubscriptionResource:
|
|
162
158
|
"""
|
|
163
159
|
Parameters
|
|
164
160
|
----------
|
|
165
161
|
subscription_id : str
|
|
166
162
|
|
|
163
|
+
reason : typing.Optional[str]
|
|
164
|
+
The reason for cancelling the subscription.
|
|
165
|
+
|
|
166
|
+
cancel_at_end_of_cycle : typing.Optional[bool]
|
|
167
|
+
Whether to cancel the subscription at end of cycle.
|
|
168
|
+
|
|
167
169
|
request_options : typing.Optional[RequestOptions]
|
|
168
170
|
Request-specific configuration.
|
|
169
171
|
|
|
170
172
|
Returns
|
|
171
173
|
-------
|
|
172
|
-
|
|
174
|
+
SubscriptionResource
|
|
175
|
+
Successful Response
|
|
173
176
|
|
|
174
177
|
Examples
|
|
175
178
|
--------
|
|
@@ -177,29 +180,36 @@ class SubscriptionsClient:
|
|
|
177
180
|
|
|
178
181
|
client = Lark(
|
|
179
182
|
api_key="YOUR_API_KEY",
|
|
180
|
-
base_url="https://yourhost.com/path/to/api",
|
|
181
183
|
)
|
|
182
184
|
client.subscriptions.cancel_subscription(
|
|
183
185
|
subscription_id="subscription_id",
|
|
184
186
|
)
|
|
185
187
|
"""
|
|
186
|
-
_response = self._raw_client.cancel_subscription(
|
|
188
|
+
_response = self._raw_client.cancel_subscription(
|
|
189
|
+
subscription_id,
|
|
190
|
+
reason=reason,
|
|
191
|
+
cancel_at_end_of_cycle=cancel_at_end_of_cycle,
|
|
192
|
+
request_options=request_options,
|
|
193
|
+
)
|
|
187
194
|
return _response.data
|
|
188
195
|
|
|
189
|
-
def
|
|
190
|
-
self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
191
|
-
) ->
|
|
196
|
+
def change_subscription_rate_card(
|
|
197
|
+
self, subscription_id: str, *, rate_card_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
198
|
+
) -> SubscriptionResource:
|
|
192
199
|
"""
|
|
193
200
|
Parameters
|
|
194
201
|
----------
|
|
195
202
|
subscription_id : str
|
|
196
203
|
|
|
204
|
+
rate_card_id : str
|
|
205
|
+
|
|
197
206
|
request_options : typing.Optional[RequestOptions]
|
|
198
207
|
Request-specific configuration.
|
|
199
208
|
|
|
200
209
|
Returns
|
|
201
210
|
-------
|
|
202
|
-
|
|
211
|
+
SubscriptionResource
|
|
212
|
+
Successful Response
|
|
203
213
|
|
|
204
214
|
Examples
|
|
205
215
|
--------
|
|
@@ -207,13 +217,15 @@ class SubscriptionsClient:
|
|
|
207
217
|
|
|
208
218
|
client = Lark(
|
|
209
219
|
api_key="YOUR_API_KEY",
|
|
210
|
-
base_url="https://yourhost.com/path/to/api",
|
|
211
220
|
)
|
|
212
|
-
client.subscriptions.
|
|
221
|
+
client.subscriptions.change_subscription_rate_card(
|
|
213
222
|
subscription_id="subscription_id",
|
|
223
|
+
rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
214
224
|
)
|
|
215
225
|
"""
|
|
216
|
-
_response = self._raw_client.
|
|
226
|
+
_response = self._raw_client.change_subscription_rate_card(
|
|
227
|
+
subscription_id, rate_card_id=rate_card_id, request_options=request_options
|
|
228
|
+
)
|
|
217
229
|
return _response.data
|
|
218
230
|
|
|
219
231
|
|
|
@@ -236,7 +248,8 @@ class AsyncSubscriptionsClient:
|
|
|
236
248
|
self,
|
|
237
249
|
*,
|
|
238
250
|
limit: typing.Optional[int] = None,
|
|
239
|
-
|
|
251
|
+
subject_id: typing.Optional[str] = None,
|
|
252
|
+
rate_card_id: typing.Optional[str] = None,
|
|
240
253
|
request_options: typing.Optional[RequestOptions] = None,
|
|
241
254
|
) -> ListSubscriptionsResponse:
|
|
242
255
|
"""
|
|
@@ -244,7 +257,11 @@ class AsyncSubscriptionsClient:
|
|
|
244
257
|
----------
|
|
245
258
|
limit : typing.Optional[int]
|
|
246
259
|
|
|
247
|
-
|
|
260
|
+
subject_id : typing.Optional[str]
|
|
261
|
+
The ID of the subject to list subscriptions for. Cannot be used with rate_card_id.
|
|
262
|
+
|
|
263
|
+
rate_card_id : typing.Optional[str]
|
|
264
|
+
The ID of the rate card to list subscriptions for. Cannot be used with subject_id.
|
|
248
265
|
|
|
249
266
|
request_options : typing.Optional[RequestOptions]
|
|
250
267
|
Request-specific configuration.
|
|
@@ -262,21 +279,21 @@ class AsyncSubscriptionsClient:
|
|
|
262
279
|
|
|
263
280
|
client = AsyncLark(
|
|
264
281
|
api_key="YOUR_API_KEY",
|
|
265
|
-
base_url="https://yourhost.com/path/to/api",
|
|
266
282
|
)
|
|
267
283
|
|
|
268
284
|
|
|
269
285
|
async def main() -> None:
|
|
270
286
|
await client.subscriptions.list_subscriptions(
|
|
271
287
|
limit=1,
|
|
272
|
-
|
|
288
|
+
subject_id="subject_id",
|
|
289
|
+
rate_card_id="rate_card_id",
|
|
273
290
|
)
|
|
274
291
|
|
|
275
292
|
|
|
276
293
|
asyncio.run(main())
|
|
277
294
|
"""
|
|
278
295
|
_response = await self._raw_client.list_subscriptions(
|
|
279
|
-
limit=limit,
|
|
296
|
+
limit=limit, subject_id=subject_id, rate_card_id=rate_card_id, request_options=request_options
|
|
280
297
|
)
|
|
281
298
|
return _response.data
|
|
282
299
|
|
|
@@ -285,23 +302,20 @@ class AsyncSubscriptionsClient:
|
|
|
285
302
|
*,
|
|
286
303
|
rate_card_id: str,
|
|
287
304
|
subject_id: str,
|
|
288
|
-
|
|
289
|
-
variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
290
|
-
metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
|
|
305
|
+
metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
|
|
291
306
|
request_options: typing.Optional[RequestOptions] = None,
|
|
292
307
|
) -> SubscriptionResource:
|
|
293
308
|
"""
|
|
294
309
|
Parameters
|
|
295
310
|
----------
|
|
296
311
|
rate_card_id : str
|
|
312
|
+
The ID of the rate card to use for the subscription.
|
|
297
313
|
|
|
298
314
|
subject_id : str
|
|
315
|
+
The ID of the subject to create the subscription for.
|
|
299
316
|
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
303
|
-
|
|
304
|
-
metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
|
|
317
|
+
metadata : typing.Optional[typing.Dict[str, str]]
|
|
318
|
+
Additional metadata about the subscription. You may use this to store any custom data about the subscription.
|
|
305
319
|
|
|
306
320
|
request_options : typing.Optional[RequestOptions]
|
|
307
321
|
Request-specific configuration.
|
|
@@ -314,35 +328,25 @@ class AsyncSubscriptionsClient:
|
|
|
314
328
|
Examples
|
|
315
329
|
--------
|
|
316
330
|
import asyncio
|
|
317
|
-
import datetime
|
|
318
331
|
|
|
319
332
|
from lark import AsyncLark
|
|
320
333
|
|
|
321
334
|
client = AsyncLark(
|
|
322
335
|
api_key="YOUR_API_KEY",
|
|
323
|
-
base_url="https://yourhost.com/path/to/api",
|
|
324
336
|
)
|
|
325
337
|
|
|
326
338
|
|
|
327
339
|
async def main() -> None:
|
|
328
340
|
await client.subscriptions.create_subscription(
|
|
329
|
-
rate_card_id="
|
|
330
|
-
subject_id="
|
|
331
|
-
effective_at=datetime.datetime.fromisoformat(
|
|
332
|
-
"2024-01-15 09:30:00+00:00",
|
|
333
|
-
),
|
|
341
|
+
rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
342
|
+
subject_id="subj_VyX6Q96h5avMho8O7QWlKeXE",
|
|
334
343
|
)
|
|
335
344
|
|
|
336
345
|
|
|
337
346
|
asyncio.run(main())
|
|
338
347
|
"""
|
|
339
348
|
_response = await self._raw_client.create_subscription(
|
|
340
|
-
rate_card_id=rate_card_id,
|
|
341
|
-
subject_id=subject_id,
|
|
342
|
-
effective_at=effective_at,
|
|
343
|
-
variables=variables,
|
|
344
|
-
metadata=metadata,
|
|
345
|
-
request_options=request_options,
|
|
349
|
+
rate_card_id=rate_card_id, subject_id=subject_id, metadata=metadata, request_options=request_options
|
|
346
350
|
)
|
|
347
351
|
return _response.data
|
|
348
352
|
|
|
@@ -370,7 +374,6 @@ class AsyncSubscriptionsClient:
|
|
|
370
374
|
|
|
371
375
|
client = AsyncLark(
|
|
372
376
|
api_key="YOUR_API_KEY",
|
|
373
|
-
base_url="https://yourhost.com/path/to/api",
|
|
374
377
|
)
|
|
375
378
|
|
|
376
379
|
|
|
@@ -386,19 +389,31 @@ class AsyncSubscriptionsClient:
|
|
|
386
389
|
return _response.data
|
|
387
390
|
|
|
388
391
|
async def cancel_subscription(
|
|
389
|
-
self,
|
|
390
|
-
|
|
392
|
+
self,
|
|
393
|
+
subscription_id: str,
|
|
394
|
+
*,
|
|
395
|
+
reason: typing.Optional[str] = OMIT,
|
|
396
|
+
cancel_at_end_of_cycle: typing.Optional[bool] = OMIT,
|
|
397
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
398
|
+
) -> SubscriptionResource:
|
|
391
399
|
"""
|
|
392
400
|
Parameters
|
|
393
401
|
----------
|
|
394
402
|
subscription_id : str
|
|
395
403
|
|
|
404
|
+
reason : typing.Optional[str]
|
|
405
|
+
The reason for cancelling the subscription.
|
|
406
|
+
|
|
407
|
+
cancel_at_end_of_cycle : typing.Optional[bool]
|
|
408
|
+
Whether to cancel the subscription at end of cycle.
|
|
409
|
+
|
|
396
410
|
request_options : typing.Optional[RequestOptions]
|
|
397
411
|
Request-specific configuration.
|
|
398
412
|
|
|
399
413
|
Returns
|
|
400
414
|
-------
|
|
401
|
-
|
|
415
|
+
SubscriptionResource
|
|
416
|
+
Successful Response
|
|
402
417
|
|
|
403
418
|
Examples
|
|
404
419
|
--------
|
|
@@ -408,7 +423,6 @@ class AsyncSubscriptionsClient:
|
|
|
408
423
|
|
|
409
424
|
client = AsyncLark(
|
|
410
425
|
api_key="YOUR_API_KEY",
|
|
411
|
-
base_url="https://yourhost.com/path/to/api",
|
|
412
426
|
)
|
|
413
427
|
|
|
414
428
|
|
|
@@ -420,23 +434,31 @@ class AsyncSubscriptionsClient:
|
|
|
420
434
|
|
|
421
435
|
asyncio.run(main())
|
|
422
436
|
"""
|
|
423
|
-
_response = await self._raw_client.cancel_subscription(
|
|
437
|
+
_response = await self._raw_client.cancel_subscription(
|
|
438
|
+
subscription_id,
|
|
439
|
+
reason=reason,
|
|
440
|
+
cancel_at_end_of_cycle=cancel_at_end_of_cycle,
|
|
441
|
+
request_options=request_options,
|
|
442
|
+
)
|
|
424
443
|
return _response.data
|
|
425
444
|
|
|
426
|
-
async def
|
|
427
|
-
self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
428
|
-
) ->
|
|
445
|
+
async def change_subscription_rate_card(
|
|
446
|
+
self, subscription_id: str, *, rate_card_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
447
|
+
) -> SubscriptionResource:
|
|
429
448
|
"""
|
|
430
449
|
Parameters
|
|
431
450
|
----------
|
|
432
451
|
subscription_id : str
|
|
433
452
|
|
|
453
|
+
rate_card_id : str
|
|
454
|
+
|
|
434
455
|
request_options : typing.Optional[RequestOptions]
|
|
435
456
|
Request-specific configuration.
|
|
436
457
|
|
|
437
458
|
Returns
|
|
438
459
|
-------
|
|
439
|
-
|
|
460
|
+
SubscriptionResource
|
|
461
|
+
Successful Response
|
|
440
462
|
|
|
441
463
|
Examples
|
|
442
464
|
--------
|
|
@@ -446,17 +468,19 @@ class AsyncSubscriptionsClient:
|
|
|
446
468
|
|
|
447
469
|
client = AsyncLark(
|
|
448
470
|
api_key="YOUR_API_KEY",
|
|
449
|
-
base_url="https://yourhost.com/path/to/api",
|
|
450
471
|
)
|
|
451
472
|
|
|
452
473
|
|
|
453
474
|
async def main() -> None:
|
|
454
|
-
await client.subscriptions.
|
|
475
|
+
await client.subscriptions.change_subscription_rate_card(
|
|
455
476
|
subscription_id="subscription_id",
|
|
477
|
+
rate_card_id="rc_AJWMxR81jxoRlli6p13uf3JB",
|
|
456
478
|
)
|
|
457
479
|
|
|
458
480
|
|
|
459
481
|
asyncio.run(main())
|
|
460
482
|
"""
|
|
461
|
-
_response = await self._raw_client.
|
|
483
|
+
_response = await self._raw_client.change_subscription_rate_card(
|
|
484
|
+
subscription_id, rate_card_id=rate_card_id, request_options=request_options
|
|
485
|
+
)
|
|
462
486
|
return _response.data
|