lark-billing 0.0.6__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 (167) hide show
  1. lark/__init__.py +522 -0
  2. lark/checkout/__init__.py +4 -0
  3. lark/checkout/client.py +214 -0
  4. lark/checkout/raw_client.py +252 -0
  5. lark/client.py +240 -0
  6. lark/core/__init__.py +105 -0
  7. lark/core/api_error.py +23 -0
  8. lark/core/client_wrapper.py +79 -0
  9. lark/core/datetime_utils.py +28 -0
  10. lark/core/file.py +67 -0
  11. lark/core/force_multipart.py +18 -0
  12. lark/core/http_client.py +543 -0
  13. lark/core/http_response.py +55 -0
  14. lark/core/jsonable_encoder.py +100 -0
  15. lark/core/pydantic_utilities.py +258 -0
  16. lark/core/query_encoder.py +58 -0
  17. lark/core/remove_none_from_dict.py +11 -0
  18. lark/core/request_options.py +35 -0
  19. lark/core/serialization.py +276 -0
  20. lark/errors/__init__.py +34 -0
  21. lark/errors/unprocessable_entity_error.py +11 -0
  22. lark/feature_access/__init__.py +4 -0
  23. lark/feature_access/client.py +102 -0
  24. lark/feature_access/raw_client.py +113 -0
  25. lark/py.typed +0 -0
  26. lark/rate_cards/__init__.py +61 -0
  27. lark/rate_cards/client.py +817 -0
  28. lark/rate_cards/raw_client.py +728 -0
  29. lark/rate_cards/types/__init__.py +63 -0
  30. lark/rate_cards/types/create_rate_card_request_billing_interval.py +5 -0
  31. lark/rate_cards/types/create_rate_card_request_usage_based_rates_item.py +56 -0
  32. lark/rate_cards/types/create_rate_card_version_request_usage_based_rates_item.py +58 -0
  33. lark/rate_cards/types/create_rate_card_version_request_version_type.py +5 -0
  34. lark/subjects/__init__.py +4 -0
  35. lark/subjects/client.py +501 -0
  36. lark/subjects/raw_client.py +633 -0
  37. lark/subscriptions/__init__.py +4 -0
  38. lark/subscriptions/client.py +462 -0
  39. lark/subscriptions/raw_client.py +495 -0
  40. lark/types/__init__.py +493 -0
  41. lark/types/aggregation.py +80 -0
  42. lark/types/amount.py +20 -0
  43. lark/types/check_feature_access_request.py +24 -0
  44. lark/types/check_feature_access_response.py +21 -0
  45. lark/types/complete_subscription_checkout_response.py +21 -0
  46. lark/types/count_aggregation_pricing_metric_interface.py +17 -0
  47. lark/types/create_credit_grant_interface.py +27 -0
  48. lark/types/create_credit_grant_interface_expiration.py +27 -0
  49. lark/types/create_credit_pool_request.py +5 -0
  50. lark/types/create_dimension_coordinate_interface.py +20 -0
  51. lark/types/create_dimension_interface.py +20 -0
  52. lark/types/create_dimensional_usage_based_rate_interface.py +32 -0
  53. lark/types/create_fixed_rate_interface.py +28 -0
  54. lark/types/create_pricing_matrix_cell_interface.py +22 -0
  55. lark/types/create_pricing_matrix_interface.py +20 -0
  56. lark/types/create_pricing_metric_interface.py +26 -0
  57. lark/types/create_pricing_plan_request.py +5 -0
  58. lark/types/create_rate_card_response.py +36 -0
  59. lark/types/create_rate_card_response_billing_interval.py +5 -0
  60. lark/types/create_rate_card_response_usage_based_rates_item.py +58 -0
  61. lark/types/create_rate_card_version_response.py +36 -0
  62. lark/types/create_rate_card_version_response_billing_interval.py +5 -0
  63. lark/types/create_rate_card_version_response_usage_based_rates_item.py +59 -0
  64. lark/types/create_simple_usage_based_rate_interface.py +30 -0
  65. lark/types/create_subject_response.py +24 -0
  66. lark/types/create_subscription_checkout_session_response.py +23 -0
  67. lark/types/create_usage_event_summary_response.py +23 -0
  68. lark/types/credit_grant.py +5 -0
  69. lark/types/credit_grant_date_time_expiration_interface.py +19 -0
  70. lark/types/credit_grant_date_time_expiration_resource.py +19 -0
  71. lark/types/credit_grant_duration_expiration_interface.py +21 -0
  72. lark/types/credit_grant_duration_expiration_resource.py +21 -0
  73. lark/types/credit_grant_interface.py +28 -0
  74. lark/types/credit_grant_interface_input_expiration.py +27 -0
  75. lark/types/credit_grant_interface_output_expiration.py +43 -0
  76. lark/types/credit_grant_interface_output_schedule.py +41 -0
  77. lark/types/credit_grant_resource.py +28 -0
  78. lark/types/credit_grant_resource_input_expiration.py +27 -0
  79. lark/types/credit_grant_resource_input_schedule.py +39 -0
  80. lark/types/credit_grant_resource_output_expiration.py +43 -0
  81. lark/types/credit_grant_resource_output_schedule.py +39 -0
  82. lark/types/credit_grant_schedule.py +5 -0
  83. lark/types/credit_grant_schedule_one_time_interface.py +19 -0
  84. lark/types/credit_grant_schedule_one_time_resource.py +17 -0
  85. lark/types/credit_grant_schedule_rate_cycle_start_interface.py +19 -0
  86. lark/types/credit_grant_schedule_rate_cycle_start_resource.py +17 -0
  87. lark/types/credit_grant_subject_granting_config_interface.py +20 -0
  88. lark/types/credit_pool.py +5 -0
  89. lark/types/credit_pool_rollover_config.py +5 -0
  90. lark/types/custom_aggregation_pricing_metric_interface.py +22 -0
  91. lark/types/custom_pricing_metric.py +5 -0
  92. lark/types/custom_unit.py +5 -0
  93. lark/types/custom_unit_amount.py +5 -0
  94. lark/types/dimension.py +5 -0
  95. lark/types/dimension_coordinate.py +5 -0
  96. lark/types/dimension_coordinate_interface.py +20 -0
  97. lark/types/dimension_coordinate_set.py +5 -0
  98. lark/types/dimension_interface.py +20 -0
  99. lark/types/dimensional_rate_matrix.py +5 -0
  100. lark/types/dimensional_rate_matrix_cell.py +5 -0
  101. lark/types/dimensional_usage_based_rate.py +5 -0
  102. lark/types/dimensional_usage_based_rate_input.py +5 -0
  103. lark/types/dimensional_usage_based_rate_interface.py +33 -0
  104. lark/types/feature_access_resource.py +21 -0
  105. lark/types/fixed_rate_interface.py +29 -0
  106. lark/types/flat_price.py +24 -0
  107. lark/types/get_rate_card_response.py +36 -0
  108. lark/types/get_rate_card_response_billing_interval.py +5 -0
  109. lark/types/get_rate_card_response_usage_based_rates_item.py +58 -0
  110. lark/types/grant_credits_request.py +5 -0
  111. lark/types/http_validation_error.py +20 -0
  112. lark/types/last_aggregation_pricing_metric_interface.py +22 -0
  113. lark/types/license_based_rate.py +5 -0
  114. lark/types/license_based_rate_input.py +5 -0
  115. lark/types/list_rate_cards_response.py +21 -0
  116. lark/types/list_subjects_response.py +21 -0
  117. lark/types/list_subscriptions_response.py +21 -0
  118. lark/types/max_aggregation_pricing_metric_interface.py +22 -0
  119. lark/types/monetary_amount.py +5 -0
  120. lark/types/package_price.py +27 -0
  121. lark/types/package_price_rounding_behavior.py +5 -0
  122. lark/types/package_price_wrapper.py +5 -0
  123. lark/types/period.py +22 -0
  124. lark/types/price.py +5 -0
  125. lark/types/pricing_matrix_cell_interface.py +22 -0
  126. lark/types/pricing_matrix_interface.py +20 -0
  127. lark/types/pricing_metric.py +5 -0
  128. lark/types/pricing_metric_interface.py +27 -0
  129. lark/types/pricing_plan.py +5 -0
  130. lark/types/pricing_plan_subscription.py +5 -0
  131. lark/types/pricing_tier.py +5 -0
  132. lark/types/rate_card.py +5 -0
  133. lark/types/rate_card_resource.py +36 -0
  134. lark/types/rate_card_resource_billing_interval.py +5 -0
  135. lark/types/rate_card_resource_usage_based_rates_item.py +58 -0
  136. lark/types/rate_card_version.py +5 -0
  137. lark/types/rate_card_version_input.py +5 -0
  138. lark/types/simple_usage_based_rate.py +5 -0
  139. lark/types/simple_usage_based_rate_input.py +5 -0
  140. lark/types/simple_usage_based_rate_interface.py +31 -0
  141. lark/types/status.py +5 -0
  142. lark/types/subject.py +5 -0
  143. lark/types/subject_granting_config.py +5 -0
  144. lark/types/subject_granting_config_resource.py +20 -0
  145. lark/types/subject_resource.py +24 -0
  146. lark/types/subscription_resource.py +28 -0
  147. lark/types/sum_aggregation_pricing_metric_interface.py +22 -0
  148. lark/types/tiered_price.py +5 -0
  149. lark/types/tiered_price_wrapper.py +5 -0
  150. lark/types/unit.py +5 -0
  151. lark/types/update_pricing_plan_request.py +5 -0
  152. lark/types/update_rate_card_request.py +5 -0
  153. lark/types/update_subscription_request.py +5 -0
  154. lark/types/usage_based_rate.py +5 -0
  155. lark/types/usage_based_rate_input.py +5 -0
  156. lark/types/usage_unit.py +5 -0
  157. lark/types/validation_error.py +22 -0
  158. lark/types/validation_error_loc_item.py +5 -0
  159. lark/usage_events/__init__.py +34 -0
  160. lark/usage_events/client.py +293 -0
  161. lark/usage_events/raw_client.py +318 -0
  162. lark/usage_events/types/__init__.py +36 -0
  163. lark/usage_events/types/create_usage_event_summary_request_aggregation_type.py +5 -0
  164. lark/version.py +3 -0
  165. lark_billing-0.0.6.dist-info/METADATA +188 -0
  166. lark_billing-0.0.6.dist-info/RECORD +167 -0
  167. lark_billing-0.0.6.dist-info/WHEEL +4 -0
@@ -0,0 +1,495 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
14
+ from ..types.http_validation_error import HttpValidationError
15
+ from ..types.list_subscriptions_response import ListSubscriptionsResponse
16
+ from ..types.subscription_resource import SubscriptionResource
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class RawSubscriptionsClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def list_subscriptions(
27
+ self,
28
+ *,
29
+ limit: typing.Optional[int] = None,
30
+ offset: typing.Optional[int] = None,
31
+ request_options: typing.Optional[RequestOptions] = None,
32
+ ) -> HttpResponse[ListSubscriptionsResponse]:
33
+ """
34
+ Parameters
35
+ ----------
36
+ limit : typing.Optional[int]
37
+
38
+ offset : typing.Optional[int]
39
+
40
+ request_options : typing.Optional[RequestOptions]
41
+ Request-specific configuration.
42
+
43
+ Returns
44
+ -------
45
+ HttpResponse[ListSubscriptionsResponse]
46
+ Successful Response
47
+ """
48
+ _response = self._client_wrapper.httpx_client.request(
49
+ "subscriptions",
50
+ method="GET",
51
+ params={
52
+ "limit": limit,
53
+ "offset": offset,
54
+ },
55
+ request_options=request_options,
56
+ )
57
+ try:
58
+ if 200 <= _response.status_code < 300:
59
+ _data = typing.cast(
60
+ ListSubscriptionsResponse,
61
+ parse_obj_as(
62
+ type_=ListSubscriptionsResponse, # type: ignore
63
+ object_=_response.json(),
64
+ ),
65
+ )
66
+ return HttpResponse(response=_response, data=_data)
67
+ if _response.status_code == 422:
68
+ raise UnprocessableEntityError(
69
+ headers=dict(_response.headers),
70
+ body=typing.cast(
71
+ HttpValidationError,
72
+ parse_obj_as(
73
+ type_=HttpValidationError, # type: ignore
74
+ object_=_response.json(),
75
+ ),
76
+ ),
77
+ )
78
+ _response_json = _response.json()
79
+ except JSONDecodeError:
80
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
81
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
82
+
83
+ def create_subscription(
84
+ self,
85
+ *,
86
+ rate_card_id: str,
87
+ 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,
91
+ request_options: typing.Optional[RequestOptions] = None,
92
+ ) -> HttpResponse[SubscriptionResource]:
93
+ """
94
+ Parameters
95
+ ----------
96
+ rate_card_id : str
97
+
98
+ subject_id : str
99
+
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
+
106
+ request_options : typing.Optional[RequestOptions]
107
+ Request-specific configuration.
108
+
109
+ Returns
110
+ -------
111
+ HttpResponse[SubscriptionResource]
112
+ Successful Response
113
+ """
114
+ _response = self._client_wrapper.httpx_client.request(
115
+ "subscriptions",
116
+ method="POST",
117
+ json={
118
+ "rate_card_id": rate_card_id,
119
+ "subject_id": subject_id,
120
+ "effective_at": effective_at,
121
+ "variables": variables,
122
+ "metadata": metadata,
123
+ },
124
+ headers={
125
+ "content-type": "application/json",
126
+ },
127
+ request_options=request_options,
128
+ omit=OMIT,
129
+ )
130
+ try:
131
+ if 200 <= _response.status_code < 300:
132
+ _data = typing.cast(
133
+ SubscriptionResource,
134
+ parse_obj_as(
135
+ type_=SubscriptionResource, # type: ignore
136
+ object_=_response.json(),
137
+ ),
138
+ )
139
+ return HttpResponse(response=_response, data=_data)
140
+ if _response.status_code == 422:
141
+ raise UnprocessableEntityError(
142
+ headers=dict(_response.headers),
143
+ body=typing.cast(
144
+ HttpValidationError,
145
+ parse_obj_as(
146
+ type_=HttpValidationError, # type: ignore
147
+ object_=_response.json(),
148
+ ),
149
+ ),
150
+ )
151
+ _response_json = _response.json()
152
+ except JSONDecodeError:
153
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
154
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
155
+
156
+ def get_subscription(
157
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
158
+ ) -> HttpResponse[SubscriptionResource]:
159
+ """
160
+ Parameters
161
+ ----------
162
+ subscription_id : str
163
+
164
+ request_options : typing.Optional[RequestOptions]
165
+ Request-specific configuration.
166
+
167
+ Returns
168
+ -------
169
+ HttpResponse[SubscriptionResource]
170
+ Successful Response
171
+ """
172
+ _response = self._client_wrapper.httpx_client.request(
173
+ f"subscriptions/{jsonable_encoder(subscription_id)}",
174
+ method="GET",
175
+ request_options=request_options,
176
+ )
177
+ try:
178
+ if 200 <= _response.status_code < 300:
179
+ _data = typing.cast(
180
+ SubscriptionResource,
181
+ parse_obj_as(
182
+ type_=SubscriptionResource, # type: ignore
183
+ object_=_response.json(),
184
+ ),
185
+ )
186
+ return HttpResponse(response=_response, data=_data)
187
+ if _response.status_code == 422:
188
+ raise UnprocessableEntityError(
189
+ headers=dict(_response.headers),
190
+ body=typing.cast(
191
+ HttpValidationError,
192
+ parse_obj_as(
193
+ type_=HttpValidationError, # type: ignore
194
+ object_=_response.json(),
195
+ ),
196
+ ),
197
+ )
198
+ _response_json = _response.json()
199
+ except JSONDecodeError:
200
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
201
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
202
+
203
+ def cancel_subscription(
204
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
205
+ ) -> HttpResponse[None]:
206
+ """
207
+ Parameters
208
+ ----------
209
+ subscription_id : str
210
+
211
+ request_options : typing.Optional[RequestOptions]
212
+ Request-specific configuration.
213
+
214
+ Returns
215
+ -------
216
+ HttpResponse[None]
217
+ """
218
+ _response = self._client_wrapper.httpx_client.request(
219
+ f"subscriptions/{jsonable_encoder(subscription_id)}",
220
+ method="DELETE",
221
+ request_options=request_options,
222
+ )
223
+ try:
224
+ if 200 <= _response.status_code < 300:
225
+ return HttpResponse(response=_response, data=None)
226
+ _response_json = _response.json()
227
+ except JSONDecodeError:
228
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
229
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
230
+
231
+ def update_subscription(
232
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
233
+ ) -> HttpResponse[None]:
234
+ """
235
+ Parameters
236
+ ----------
237
+ subscription_id : str
238
+
239
+ request_options : typing.Optional[RequestOptions]
240
+ Request-specific configuration.
241
+
242
+ Returns
243
+ -------
244
+ HttpResponse[None]
245
+ """
246
+ _response = self._client_wrapper.httpx_client.request(
247
+ f"subscriptions/{jsonable_encoder(subscription_id)}",
248
+ method="PATCH",
249
+ request_options=request_options,
250
+ )
251
+ try:
252
+ if 200 <= _response.status_code < 300:
253
+ return HttpResponse(response=_response, data=None)
254
+ _response_json = _response.json()
255
+ except JSONDecodeError:
256
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
257
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
258
+
259
+
260
+ class AsyncRawSubscriptionsClient:
261
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
262
+ self._client_wrapper = client_wrapper
263
+
264
+ async def list_subscriptions(
265
+ self,
266
+ *,
267
+ limit: typing.Optional[int] = None,
268
+ offset: typing.Optional[int] = None,
269
+ request_options: typing.Optional[RequestOptions] = None,
270
+ ) -> AsyncHttpResponse[ListSubscriptionsResponse]:
271
+ """
272
+ Parameters
273
+ ----------
274
+ limit : typing.Optional[int]
275
+
276
+ offset : typing.Optional[int]
277
+
278
+ request_options : typing.Optional[RequestOptions]
279
+ Request-specific configuration.
280
+
281
+ Returns
282
+ -------
283
+ AsyncHttpResponse[ListSubscriptionsResponse]
284
+ Successful Response
285
+ """
286
+ _response = await self._client_wrapper.httpx_client.request(
287
+ "subscriptions",
288
+ method="GET",
289
+ params={
290
+ "limit": limit,
291
+ "offset": offset,
292
+ },
293
+ request_options=request_options,
294
+ )
295
+ try:
296
+ if 200 <= _response.status_code < 300:
297
+ _data = typing.cast(
298
+ ListSubscriptionsResponse,
299
+ parse_obj_as(
300
+ type_=ListSubscriptionsResponse, # type: ignore
301
+ object_=_response.json(),
302
+ ),
303
+ )
304
+ return AsyncHttpResponse(response=_response, data=_data)
305
+ if _response.status_code == 422:
306
+ raise UnprocessableEntityError(
307
+ headers=dict(_response.headers),
308
+ body=typing.cast(
309
+ HttpValidationError,
310
+ parse_obj_as(
311
+ type_=HttpValidationError, # type: ignore
312
+ object_=_response.json(),
313
+ ),
314
+ ),
315
+ )
316
+ _response_json = _response.json()
317
+ except JSONDecodeError:
318
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
319
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
320
+
321
+ async def create_subscription(
322
+ self,
323
+ *,
324
+ rate_card_id: str,
325
+ 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,
329
+ request_options: typing.Optional[RequestOptions] = None,
330
+ ) -> AsyncHttpResponse[SubscriptionResource]:
331
+ """
332
+ Parameters
333
+ ----------
334
+ rate_card_id : str
335
+
336
+ subject_id : str
337
+
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]]]
343
+
344
+ request_options : typing.Optional[RequestOptions]
345
+ Request-specific configuration.
346
+
347
+ Returns
348
+ -------
349
+ AsyncHttpResponse[SubscriptionResource]
350
+ Successful Response
351
+ """
352
+ _response = await self._client_wrapper.httpx_client.request(
353
+ "subscriptions",
354
+ method="POST",
355
+ json={
356
+ "rate_card_id": rate_card_id,
357
+ "subject_id": subject_id,
358
+ "effective_at": effective_at,
359
+ "variables": variables,
360
+ "metadata": metadata,
361
+ },
362
+ headers={
363
+ "content-type": "application/json",
364
+ },
365
+ request_options=request_options,
366
+ omit=OMIT,
367
+ )
368
+ try:
369
+ if 200 <= _response.status_code < 300:
370
+ _data = typing.cast(
371
+ SubscriptionResource,
372
+ parse_obj_as(
373
+ type_=SubscriptionResource, # type: ignore
374
+ object_=_response.json(),
375
+ ),
376
+ )
377
+ return AsyncHttpResponse(response=_response, data=_data)
378
+ if _response.status_code == 422:
379
+ raise UnprocessableEntityError(
380
+ headers=dict(_response.headers),
381
+ body=typing.cast(
382
+ HttpValidationError,
383
+ parse_obj_as(
384
+ type_=HttpValidationError, # type: ignore
385
+ object_=_response.json(),
386
+ ),
387
+ ),
388
+ )
389
+ _response_json = _response.json()
390
+ except JSONDecodeError:
391
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
392
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
393
+
394
+ async def get_subscription(
395
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
396
+ ) -> AsyncHttpResponse[SubscriptionResource]:
397
+ """
398
+ Parameters
399
+ ----------
400
+ subscription_id : str
401
+
402
+ request_options : typing.Optional[RequestOptions]
403
+ Request-specific configuration.
404
+
405
+ Returns
406
+ -------
407
+ AsyncHttpResponse[SubscriptionResource]
408
+ Successful Response
409
+ """
410
+ _response = await self._client_wrapper.httpx_client.request(
411
+ f"subscriptions/{jsonable_encoder(subscription_id)}",
412
+ method="GET",
413
+ request_options=request_options,
414
+ )
415
+ try:
416
+ if 200 <= _response.status_code < 300:
417
+ _data = typing.cast(
418
+ SubscriptionResource,
419
+ parse_obj_as(
420
+ type_=SubscriptionResource, # type: ignore
421
+ object_=_response.json(),
422
+ ),
423
+ )
424
+ return AsyncHttpResponse(response=_response, data=_data)
425
+ if _response.status_code == 422:
426
+ raise UnprocessableEntityError(
427
+ headers=dict(_response.headers),
428
+ body=typing.cast(
429
+ HttpValidationError,
430
+ parse_obj_as(
431
+ type_=HttpValidationError, # type: ignore
432
+ object_=_response.json(),
433
+ ),
434
+ ),
435
+ )
436
+ _response_json = _response.json()
437
+ except JSONDecodeError:
438
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
439
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
440
+
441
+ async def cancel_subscription(
442
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
443
+ ) -> AsyncHttpResponse[None]:
444
+ """
445
+ Parameters
446
+ ----------
447
+ subscription_id : str
448
+
449
+ request_options : typing.Optional[RequestOptions]
450
+ Request-specific configuration.
451
+
452
+ Returns
453
+ -------
454
+ AsyncHttpResponse[None]
455
+ """
456
+ _response = await self._client_wrapper.httpx_client.request(
457
+ f"subscriptions/{jsonable_encoder(subscription_id)}",
458
+ method="DELETE",
459
+ request_options=request_options,
460
+ )
461
+ try:
462
+ if 200 <= _response.status_code < 300:
463
+ return AsyncHttpResponse(response=_response, data=None)
464
+ _response_json = _response.json()
465
+ except JSONDecodeError:
466
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
467
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
468
+
469
+ async def update_subscription(
470
+ self, subscription_id: str, *, request_options: typing.Optional[RequestOptions] = None
471
+ ) -> AsyncHttpResponse[None]:
472
+ """
473
+ Parameters
474
+ ----------
475
+ subscription_id : str
476
+
477
+ request_options : typing.Optional[RequestOptions]
478
+ Request-specific configuration.
479
+
480
+ Returns
481
+ -------
482
+ AsyncHttpResponse[None]
483
+ """
484
+ _response = await self._client_wrapper.httpx_client.request(
485
+ f"subscriptions/{jsonable_encoder(subscription_id)}",
486
+ method="PATCH",
487
+ request_options=request_options,
488
+ )
489
+ try:
490
+ if 200 <= _response.status_code < 300:
491
+ return AsyncHttpResponse(response=_response, data=None)
492
+ _response_json = _response.json()
493
+ except JSONDecodeError:
494
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
495
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)