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.

Files changed (154) hide show
  1. lark/__init__.py +92 -369
  2. lark/checkout/client.py +20 -79
  3. lark/checkout/raw_client.py +18 -102
  4. lark/client.py +112 -27
  5. lark/core/client_wrapper.py +2 -2
  6. lark/core/http_sse/__init__.py +42 -0
  7. lark/core/http_sse/_api.py +112 -0
  8. lark/core/http_sse/_decoders.py +61 -0
  9. lark/{types/credit_grant.py → core/http_sse/_exceptions.py} +4 -2
  10. lark/core/http_sse/_models.py +17 -0
  11. lark/core/pydantic_utilities.py +3 -1
  12. lark/{feature_access → customer_access}/client.py +30 -24
  13. lark/{feature_access → customer_access}/raw_client.py +22 -17
  14. lark/{types/rate_card.py → customer_portal/__init__.py} +1 -2
  15. lark/customer_portal/client.py +115 -0
  16. lark/customer_portal/raw_client.py +134 -0
  17. lark/environment.py +7 -0
  18. lark/{types/dimension.py → invoices/__init__.py} +1 -2
  19. lark/invoices/client.py +136 -0
  20. lark/invoices/raw_client.py +147 -0
  21. lark/pricing_metrics/__init__.py +38 -0
  22. lark/pricing_metrics/client.py +288 -0
  23. lark/pricing_metrics/raw_client.py +369 -0
  24. lark/pricing_metrics/types/__init__.py +42 -0
  25. lark/{types/credit_grant_resource_input_schedule.py → pricing_metrics/types/pricing_metric_aggregation.py} +7 -8
  26. lark/rate_cards/__init__.py +0 -15
  27. lark/rate_cards/client.py +30 -542
  28. lark/rate_cards/raw_client.py +34 -370
  29. lark/rate_cards/types/__init__.py +0 -17
  30. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +3 -29
  31. lark/subjects/client.py +18 -54
  32. lark/subjects/raw_client.py +14 -24
  33. lark/subscriptions/client.py +104 -80
  34. lark/subscriptions/raw_client.py +186 -53
  35. lark/types/__init__.py +63 -379
  36. lark/types/aggregation.py +1 -43
  37. lark/types/amount.py +5 -1
  38. lark/types/{credit_grant_date_time_expiration_interface.py → billing_state_response.py} +3 -2
  39. lark/types/{credit_grant_schedule_one_time_resource.py → count_aggregation_pricing_metric_resource.py} +1 -1
  40. lark/types/{create_dimension_interface.py → create_customer_portal_session_response.py} +3 -3
  41. lark/types/{create_dimension_coordinate_interface.py → create_fixed_rate_request.py} +5 -3
  42. lark/types/{pricing_metric_interface.py → create_pricing_metric_response.py} +2 -5
  43. lark/types/{create_simple_usage_based_rate_interface.py → create_simple_usage_based_rate_request.py} +6 -9
  44. lark/types/create_subject_response.py +30 -6
  45. lark/types/create_subscription_checkout_session_response.py +1 -2
  46. lark/types/create_usage_event_summary_response.py +1 -1
  47. lark/types/fixed_rate_interface.py +0 -6
  48. lark/types/{create_pricing_metric_interface.py → get_pricing_metric_response.py} +3 -5
  49. lark/types/{complete_subscription_checkout_response.py → invoice_line_item_resource.py} +4 -2
  50. lark/types/invoice_resource.py +31 -0
  51. lark/types/invoice_status.py +5 -0
  52. lark/types/{check_feature_access_response.py → list_invoices_response.py} +4 -4
  53. lark/types/{check_feature_access_request.py → list_pricing_metrics_response.py} +4 -7
  54. lark/types/package_price.py +2 -2
  55. lark/types/package_price_input_rounding_behavior.py +5 -0
  56. lark/types/package_price_output_rounding_behavior.py +5 -0
  57. lark/types/period_resource.py +23 -0
  58. lark/types/price.py +39 -1
  59. lark/types/pricing_metric_resource.py +24 -0
  60. lark/types/rate_card_resource.py +0 -6
  61. lark/types/rate_card_resource_usage_based_rates_item.py +2 -29
  62. lark/types/simple_usage_based_rate_interface.py +1 -7
  63. lark/types/subject_resource.py +30 -6
  64. lark/types/subscription_resource.py +6 -4
  65. lark/types/subscription_status.py +5 -0
  66. lark/types/{credit_grant_date_time_expiration_resource.py → sum_aggregation_pricing_metric_resource.py} +2 -2
  67. lark/types/{subject.py → value.py} +1 -1
  68. lark/usage_events/client.py +8 -21
  69. lark/usage_events/raw_client.py +6 -6
  70. {lark_billing-0.0.6.dist-info → lark_billing-0.0.8.dist-info}/METADATA +4 -3
  71. lark_billing-0.0.8.dist-info/RECORD +107 -0
  72. lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +0 -58
  73. lark/rate_cards/types/create_rate_card_version_request_version_type.py +0 -5
  74. lark/types/create_credit_grant_interface.py +0 -27
  75. lark/types/create_credit_grant_interface_expiration.py +0 -27
  76. lark/types/create_credit_pool_request.py +0 -5
  77. lark/types/create_dimensional_usage_based_rate_interface.py +0 -32
  78. lark/types/create_fixed_rate_interface.py +0 -28
  79. lark/types/create_pricing_matrix_cell_interface.py +0 -22
  80. lark/types/create_pricing_matrix_interface.py +0 -20
  81. lark/types/create_pricing_plan_request.py +0 -5
  82. lark/types/create_rate_card_response.py +0 -36
  83. lark/types/create_rate_card_response_billing_interval.py +0 -5
  84. lark/types/create_rate_card_response_usage_based_rates_item.py +0 -58
  85. lark/types/create_rate_card_version_response.py +0 -36
  86. lark/types/create_rate_card_version_response_billing_interval.py +0 -5
  87. lark/types/create_rate_card_version_response_usage_based_rates_item.py +0 -59
  88. lark/types/credit_grant_duration_expiration_interface.py +0 -21
  89. lark/types/credit_grant_duration_expiration_resource.py +0 -21
  90. lark/types/credit_grant_interface.py +0 -28
  91. lark/types/credit_grant_interface_input_expiration.py +0 -27
  92. lark/types/credit_grant_interface_output_expiration.py +0 -43
  93. lark/types/credit_grant_interface_output_schedule.py +0 -41
  94. lark/types/credit_grant_resource.py +0 -28
  95. lark/types/credit_grant_resource_input_expiration.py +0 -27
  96. lark/types/credit_grant_resource_output_expiration.py +0 -43
  97. lark/types/credit_grant_resource_output_schedule.py +0 -39
  98. lark/types/credit_grant_schedule.py +0 -5
  99. lark/types/credit_grant_schedule_one_time_interface.py +0 -19
  100. lark/types/credit_grant_schedule_rate_cycle_start_interface.py +0 -19
  101. lark/types/credit_grant_schedule_rate_cycle_start_resource.py +0 -17
  102. lark/types/credit_grant_subject_granting_config_interface.py +0 -20
  103. lark/types/credit_pool.py +0 -5
  104. lark/types/credit_pool_rollover_config.py +0 -5
  105. lark/types/custom_aggregation_pricing_metric_interface.py +0 -22
  106. lark/types/custom_pricing_metric.py +0 -5
  107. lark/types/custom_unit.py +0 -5
  108. lark/types/custom_unit_amount.py +0 -5
  109. lark/types/dimension_coordinate.py +0 -5
  110. lark/types/dimension_coordinate_interface.py +0 -20
  111. lark/types/dimension_coordinate_set.py +0 -5
  112. lark/types/dimension_interface.py +0 -20
  113. lark/types/dimensional_rate_matrix.py +0 -5
  114. lark/types/dimensional_rate_matrix_cell.py +0 -5
  115. lark/types/dimensional_usage_based_rate.py +0 -5
  116. lark/types/dimensional_usage_based_rate_input.py +0 -5
  117. lark/types/dimensional_usage_based_rate_interface.py +0 -33
  118. lark/types/feature_access_resource.py +0 -21
  119. lark/types/get_rate_card_response.py +0 -36
  120. lark/types/get_rate_card_response_billing_interval.py +0 -5
  121. lark/types/get_rate_card_response_usage_based_rates_item.py +0 -58
  122. lark/types/grant_credits_request.py +0 -5
  123. lark/types/last_aggregation_pricing_metric_interface.py +0 -22
  124. lark/types/license_based_rate.py +0 -5
  125. lark/types/license_based_rate_input.py +0 -5
  126. lark/types/max_aggregation_pricing_metric_interface.py +0 -22
  127. lark/types/monetary_amount.py +0 -5
  128. lark/types/package_price_rounding_behavior.py +0 -5
  129. lark/types/package_price_wrapper.py +0 -5
  130. lark/types/pricing_matrix_cell_interface.py +0 -22
  131. lark/types/pricing_matrix_interface.py +0 -20
  132. lark/types/pricing_metric.py +0 -5
  133. lark/types/pricing_plan.py +0 -5
  134. lark/types/pricing_plan_subscription.py +0 -5
  135. lark/types/pricing_tier.py +0 -5
  136. lark/types/rate_card_version.py +0 -5
  137. lark/types/rate_card_version_input.py +0 -5
  138. lark/types/simple_usage_based_rate.py +0 -5
  139. lark/types/simple_usage_based_rate_input.py +0 -5
  140. lark/types/status.py +0 -5
  141. lark/types/subject_granting_config.py +0 -5
  142. lark/types/subject_granting_config_resource.py +0 -20
  143. lark/types/tiered_price.py +0 -5
  144. lark/types/tiered_price_wrapper.py +0 -5
  145. lark/types/unit.py +0 -5
  146. lark/types/update_pricing_plan_request.py +0 -5
  147. lark/types/update_rate_card_request.py +0 -5
  148. lark/types/update_subscription_request.py +0 -5
  149. lark/types/usage_based_rate.py +0 -5
  150. lark/types/usage_based_rate_input.py +0 -5
  151. lark/types/usage_unit.py +0 -5
  152. lark_billing-0.0.6.dist-info/RECORD +0 -167
  153. /lark/{feature_access → customer_access}/__init__.py +0 -0
  154. {lark_billing-0.0.6.dist-info → lark_billing-0.0.8.dist-info}/WHEEL +0 -0
@@ -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
  from json.decoder import JSONDecodeError
6
5
 
@@ -27,7 +26,8 @@ class RawSubscriptionsClient:
27
26
  self,
28
27
  *,
29
28
  limit: typing.Optional[int] = None,
30
- offset: typing.Optional[int] = None,
29
+ subject_id: typing.Optional[str] = None,
30
+ rate_card_id: typing.Optional[str] = None,
31
31
  request_options: typing.Optional[RequestOptions] = None,
32
32
  ) -> HttpResponse[ListSubscriptionsResponse]:
33
33
  """
@@ -35,7 +35,11 @@ class RawSubscriptionsClient:
35
35
  ----------
36
36
  limit : typing.Optional[int]
37
37
 
38
- offset : typing.Optional[int]
38
+ subject_id : typing.Optional[str]
39
+ The ID of the subject to list subscriptions for. Cannot be used with rate_card_id.
40
+
41
+ rate_card_id : typing.Optional[str]
42
+ The ID of the rate card to list subscriptions for. Cannot be used with subject_id.
39
43
 
40
44
  request_options : typing.Optional[RequestOptions]
41
45
  Request-specific configuration.
@@ -50,7 +54,8 @@ class RawSubscriptionsClient:
50
54
  method="GET",
51
55
  params={
52
56
  "limit": limit,
53
- "offset": offset,
57
+ "subject_id": subject_id,
58
+ "rate_card_id": rate_card_id,
54
59
  },
55
60
  request_options=request_options,
56
61
  )
@@ -85,23 +90,20 @@ class RawSubscriptionsClient:
85
90
  *,
86
91
  rate_card_id: str,
87
92
  subject_id: str,
88
- effective_at: dt.datetime,
89
- variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
90
- metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
93
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
91
94
  request_options: typing.Optional[RequestOptions] = None,
92
95
  ) -> HttpResponse[SubscriptionResource]:
93
96
  """
94
97
  Parameters
95
98
  ----------
96
99
  rate_card_id : str
100
+ The ID of the rate card to use for the subscription.
97
101
 
98
102
  subject_id : str
103
+ The ID of the subject to create the subscription for.
99
104
 
100
- effective_at : dt.datetime
101
-
102
- variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
103
-
104
- metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
105
+ metadata : typing.Optional[typing.Dict[str, str]]
106
+ Additional metadata about the subscription. You may use this to store any custom data about the subscription.
105
107
 
106
108
  request_options : typing.Optional[RequestOptions]
107
109
  Request-specific configuration.
@@ -117,8 +119,6 @@ class RawSubscriptionsClient:
117
119
  json={
118
120
  "rate_card_id": rate_card_id,
119
121
  "subject_id": subject_id,
120
- "effective_at": effective_at,
121
- "variables": variables,
122
122
  "metadata": metadata,
123
123
  },
124
124
  headers={
@@ -201,56 +201,122 @@ class RawSubscriptionsClient:
201
201
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
202
202
 
203
203
  def cancel_subscription(
204
- self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
205
- ) -> HttpResponse[None]:
204
+ self,
205
+ subscription_id: str,
206
+ *,
207
+ reason: typing.Optional[str] = OMIT,
208
+ cancel_at_end_of_cycle: typing.Optional[bool] = OMIT,
209
+ request_options: typing.Optional[RequestOptions] = None,
210
+ ) -> HttpResponse[SubscriptionResource]:
206
211
  """
207
212
  Parameters
208
213
  ----------
209
214
  subscription_id : str
210
215
 
216
+ reason : typing.Optional[str]
217
+ The reason for cancelling the subscription.
218
+
219
+ cancel_at_end_of_cycle : typing.Optional[bool]
220
+ Whether to cancel the subscription at end of cycle.
221
+
211
222
  request_options : typing.Optional[RequestOptions]
212
223
  Request-specific configuration.
213
224
 
214
225
  Returns
215
226
  -------
216
- HttpResponse[None]
227
+ HttpResponse[SubscriptionResource]
228
+ Successful Response
217
229
  """
218
230
  _response = self._client_wrapper.httpx_client.request(
219
- f"subscriptions/{jsonable_encoder(subscription_id)}",
220
- method="DELETE",
231
+ f"subscriptions/{jsonable_encoder(subscription_id)}/cancel",
232
+ method="POST",
233
+ json={
234
+ "reason": reason,
235
+ "cancel_at_end_of_cycle": cancel_at_end_of_cycle,
236
+ },
237
+ headers={
238
+ "content-type": "application/json",
239
+ },
221
240
  request_options=request_options,
241
+ omit=OMIT,
222
242
  )
223
243
  try:
224
244
  if 200 <= _response.status_code < 300:
225
- return HttpResponse(response=_response, data=None)
245
+ _data = typing.cast(
246
+ SubscriptionResource,
247
+ parse_obj_as(
248
+ type_=SubscriptionResource, # type: ignore
249
+ object_=_response.json(),
250
+ ),
251
+ )
252
+ return HttpResponse(response=_response, data=_data)
253
+ if _response.status_code == 422:
254
+ raise UnprocessableEntityError(
255
+ headers=dict(_response.headers),
256
+ body=typing.cast(
257
+ HttpValidationError,
258
+ parse_obj_as(
259
+ type_=HttpValidationError, # type: ignore
260
+ object_=_response.json(),
261
+ ),
262
+ ),
263
+ )
226
264
  _response_json = _response.json()
227
265
  except JSONDecodeError:
228
266
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
229
267
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
230
268
 
231
- def update_subscription(
232
- self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
233
- ) -> HttpResponse[None]:
269
+ def change_subscription_rate_card(
270
+ self, subscription_id: str, *, rate_card_id: str, request_options: typing.Optional[RequestOptions] = None
271
+ ) -> HttpResponse[SubscriptionResource]:
234
272
  """
235
273
  Parameters
236
274
  ----------
237
275
  subscription_id : str
238
276
 
277
+ rate_card_id : str
278
+
239
279
  request_options : typing.Optional[RequestOptions]
240
280
  Request-specific configuration.
241
281
 
242
282
  Returns
243
283
  -------
244
- HttpResponse[None]
284
+ HttpResponse[SubscriptionResource]
285
+ Successful Response
245
286
  """
246
287
  _response = self._client_wrapper.httpx_client.request(
247
- f"subscriptions/{jsonable_encoder(subscription_id)}",
248
- method="PATCH",
288
+ f"subscriptions/{jsonable_encoder(subscription_id)}/change-rate-card",
289
+ method="POST",
290
+ json={
291
+ "rate_card_id": rate_card_id,
292
+ },
293
+ headers={
294
+ "content-type": "application/json",
295
+ },
249
296
  request_options=request_options,
297
+ omit=OMIT,
250
298
  )
251
299
  try:
252
300
  if 200 <= _response.status_code < 300:
253
- return HttpResponse(response=_response, data=None)
301
+ _data = typing.cast(
302
+ SubscriptionResource,
303
+ parse_obj_as(
304
+ type_=SubscriptionResource, # type: ignore
305
+ object_=_response.json(),
306
+ ),
307
+ )
308
+ return HttpResponse(response=_response, data=_data)
309
+ if _response.status_code == 422:
310
+ raise UnprocessableEntityError(
311
+ headers=dict(_response.headers),
312
+ body=typing.cast(
313
+ HttpValidationError,
314
+ parse_obj_as(
315
+ type_=HttpValidationError, # type: ignore
316
+ object_=_response.json(),
317
+ ),
318
+ ),
319
+ )
254
320
  _response_json = _response.json()
255
321
  except JSONDecodeError:
256
322
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
@@ -265,7 +331,8 @@ class AsyncRawSubscriptionsClient:
265
331
  self,
266
332
  *,
267
333
  limit: typing.Optional[int] = None,
268
- offset: typing.Optional[int] = None,
334
+ subject_id: typing.Optional[str] = None,
335
+ rate_card_id: typing.Optional[str] = None,
269
336
  request_options: typing.Optional[RequestOptions] = None,
270
337
  ) -> AsyncHttpResponse[ListSubscriptionsResponse]:
271
338
  """
@@ -273,7 +340,11 @@ class AsyncRawSubscriptionsClient:
273
340
  ----------
274
341
  limit : typing.Optional[int]
275
342
 
276
- offset : typing.Optional[int]
343
+ subject_id : typing.Optional[str]
344
+ The ID of the subject to list subscriptions for. Cannot be used with rate_card_id.
345
+
346
+ rate_card_id : typing.Optional[str]
347
+ The ID of the rate card to list subscriptions for. Cannot be used with subject_id.
277
348
 
278
349
  request_options : typing.Optional[RequestOptions]
279
350
  Request-specific configuration.
@@ -288,7 +359,8 @@ class AsyncRawSubscriptionsClient:
288
359
  method="GET",
289
360
  params={
290
361
  "limit": limit,
291
- "offset": offset,
362
+ "subject_id": subject_id,
363
+ "rate_card_id": rate_card_id,
292
364
  },
293
365
  request_options=request_options,
294
366
  )
@@ -323,23 +395,20 @@ class AsyncRawSubscriptionsClient:
323
395
  *,
324
396
  rate_card_id: str,
325
397
  subject_id: str,
326
- effective_at: dt.datetime,
327
- variables: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
328
- metadata: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
398
+ metadata: typing.Optional[typing.Dict[str, str]] = OMIT,
329
399
  request_options: typing.Optional[RequestOptions] = None,
330
400
  ) -> AsyncHttpResponse[SubscriptionResource]:
331
401
  """
332
402
  Parameters
333
403
  ----------
334
404
  rate_card_id : str
405
+ The ID of the rate card to use for the subscription.
335
406
 
336
407
  subject_id : str
408
+ The ID of the subject to create the subscription for.
337
409
 
338
- effective_at : dt.datetime
339
-
340
- variables : typing.Optional[typing.Dict[str, typing.Optional[str]]]
341
-
342
- metadata : typing.Optional[typing.Dict[str, typing.Optional[str]]]
410
+ metadata : typing.Optional[typing.Dict[str, str]]
411
+ Additional metadata about the subscription. You may use this to store any custom data about the subscription.
343
412
 
344
413
  request_options : typing.Optional[RequestOptions]
345
414
  Request-specific configuration.
@@ -355,8 +424,6 @@ class AsyncRawSubscriptionsClient:
355
424
  json={
356
425
  "rate_card_id": rate_card_id,
357
426
  "subject_id": subject_id,
358
- "effective_at": effective_at,
359
- "variables": variables,
360
427
  "metadata": metadata,
361
428
  },
362
429
  headers={
@@ -439,56 +506,122 @@ class AsyncRawSubscriptionsClient:
439
506
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
440
507
 
441
508
  async def cancel_subscription(
442
- self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
443
- ) -> AsyncHttpResponse[None]:
509
+ self,
510
+ subscription_id: str,
511
+ *,
512
+ reason: typing.Optional[str] = OMIT,
513
+ cancel_at_end_of_cycle: typing.Optional[bool] = OMIT,
514
+ request_options: typing.Optional[RequestOptions] = None,
515
+ ) -> AsyncHttpResponse[SubscriptionResource]:
444
516
  """
445
517
  Parameters
446
518
  ----------
447
519
  subscription_id : str
448
520
 
521
+ reason : typing.Optional[str]
522
+ The reason for cancelling the subscription.
523
+
524
+ cancel_at_end_of_cycle : typing.Optional[bool]
525
+ Whether to cancel the subscription at end of cycle.
526
+
449
527
  request_options : typing.Optional[RequestOptions]
450
528
  Request-specific configuration.
451
529
 
452
530
  Returns
453
531
  -------
454
- AsyncHttpResponse[None]
532
+ AsyncHttpResponse[SubscriptionResource]
533
+ Successful Response
455
534
  """
456
535
  _response = await self._client_wrapper.httpx_client.request(
457
- f"subscriptions/{jsonable_encoder(subscription_id)}",
458
- method="DELETE",
536
+ f"subscriptions/{jsonable_encoder(subscription_id)}/cancel",
537
+ method="POST",
538
+ json={
539
+ "reason": reason,
540
+ "cancel_at_end_of_cycle": cancel_at_end_of_cycle,
541
+ },
542
+ headers={
543
+ "content-type": "application/json",
544
+ },
459
545
  request_options=request_options,
546
+ omit=OMIT,
460
547
  )
461
548
  try:
462
549
  if 200 <= _response.status_code < 300:
463
- return AsyncHttpResponse(response=_response, data=None)
550
+ _data = typing.cast(
551
+ SubscriptionResource,
552
+ parse_obj_as(
553
+ type_=SubscriptionResource, # type: ignore
554
+ object_=_response.json(),
555
+ ),
556
+ )
557
+ return AsyncHttpResponse(response=_response, data=_data)
558
+ if _response.status_code == 422:
559
+ raise UnprocessableEntityError(
560
+ headers=dict(_response.headers),
561
+ body=typing.cast(
562
+ HttpValidationError,
563
+ parse_obj_as(
564
+ type_=HttpValidationError, # type: ignore
565
+ object_=_response.json(),
566
+ ),
567
+ ),
568
+ )
464
569
  _response_json = _response.json()
465
570
  except JSONDecodeError:
466
571
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
467
572
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
468
573
 
469
- async def update_subscription(
470
- self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
471
- ) -> AsyncHttpResponse[None]:
574
+ async def change_subscription_rate_card(
575
+ self, subscription_id: str, *, rate_card_id: str, request_options: typing.Optional[RequestOptions] = None
576
+ ) -> AsyncHttpResponse[SubscriptionResource]:
472
577
  """
473
578
  Parameters
474
579
  ----------
475
580
  subscription_id : str
476
581
 
582
+ rate_card_id : str
583
+
477
584
  request_options : typing.Optional[RequestOptions]
478
585
  Request-specific configuration.
479
586
 
480
587
  Returns
481
588
  -------
482
- AsyncHttpResponse[None]
589
+ AsyncHttpResponse[SubscriptionResource]
590
+ Successful Response
483
591
  """
484
592
  _response = await self._client_wrapper.httpx_client.request(
485
- f"subscriptions/{jsonable_encoder(subscription_id)}",
486
- method="PATCH",
593
+ f"subscriptions/{jsonable_encoder(subscription_id)}/change-rate-card",
594
+ method="POST",
595
+ json={
596
+ "rate_card_id": rate_card_id,
597
+ },
598
+ headers={
599
+ "content-type": "application/json",
600
+ },
487
601
  request_options=request_options,
602
+ omit=OMIT,
488
603
  )
489
604
  try:
490
605
  if 200 <= _response.status_code < 300:
491
- return AsyncHttpResponse(response=_response, data=None)
606
+ _data = typing.cast(
607
+ SubscriptionResource,
608
+ parse_obj_as(
609
+ type_=SubscriptionResource, # type: ignore
610
+ object_=_response.json(),
611
+ ),
612
+ )
613
+ return AsyncHttpResponse(response=_response, data=_data)
614
+ if _response.status_code == 422:
615
+ raise UnprocessableEntityError(
616
+ headers=dict(_response.headers),
617
+ body=typing.cast(
618
+ HttpValidationError,
619
+ parse_obj_as(
620
+ type_=HttpValidationError, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ ),
624
+ )
492
625
  _response_json = _response.json()
493
626
  except JSONDecodeError:
494
627
  raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)