1818 async_to_streamed_response_wrapper ,
1919)
2020from ..._wrappers import ResultWrapper
21- from ...pagination import SyncSinglePage , AsyncSinglePage
22- from ..._base_client import AsyncPaginator , make_request_options
23- from ...types .accounts import subscription_create_params , subscription_update_params
21+ from ..._base_client import make_request_options
22+ from ...types .accounts import subscription_update_params
2423from ...types .shared .subscription import Subscription
2524from ...types .shared_params .rate_plan import RatePlan
2625from ...types .accounts .subscription_delete_response import SubscriptionDeleteResponse
@@ -48,58 +47,6 @@ def with_streaming_response(self) -> SubscriptionsResourceWithStreamingResponse:
4847 """
4948 return SubscriptionsResourceWithStreamingResponse (self )
5049
51- def create (
52- self ,
53- * ,
54- account_id : str ,
55- frequency : Literal ["weekly" , "monthly" , "quarterly" , "yearly" ] | Omit = omit ,
56- rate_plan : RatePlan | Omit = omit ,
57- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
58- # The extra values given here take precedence over values defined on the client or passed to this method.
59- extra_headers : Headers | None = None ,
60- extra_query : Query | None = None ,
61- extra_body : Body | None = None ,
62- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
63- ) -> Subscription :
64- """
65- Creates an account subscription.
66-
67- Args:
68- account_id: Identifier
69-
70- frequency: How often the subscription is renewed automatically.
71-
72- rate_plan: The rate plan applied to the subscription.
73-
74- extra_headers: Send extra headers
75-
76- extra_query: Add additional query parameters to the request
77-
78- extra_body: Add additional JSON properties to the request
79-
80- timeout: Override the client-level default timeout for this request, in seconds
81- """
82- if not account_id :
83- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
84- return self ._post (
85- path_template ("/accounts/{account_id}/subscriptions" , account_id = account_id ),
86- body = maybe_transform (
87- {
88- "frequency" : frequency ,
89- "rate_plan" : rate_plan ,
90- },
91- subscription_create_params .SubscriptionCreateParams ,
92- ),
93- options = make_request_options (
94- extra_headers = extra_headers ,
95- extra_query = extra_query ,
96- extra_body = extra_body ,
97- timeout = timeout ,
98- post_parser = ResultWrapper [Subscription ]._unwrapper ,
99- ),
100- cast_to = cast (Type [Subscription ], ResultWrapper [Subscription ]),
101- )
102-
10350 def update (
10451 self ,
10552 subscription_identifier : str ,
@@ -213,42 +160,6 @@ def delete(
213160 cast_to = cast (Type [SubscriptionDeleteResponse ], ResultWrapper [SubscriptionDeleteResponse ]),
214161 )
215162
216- def get (
217- self ,
218- * ,
219- account_id : str ,
220- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
221- # The extra values given here take precedence over values defined on the client or passed to this method.
222- extra_headers : Headers | None = None ,
223- extra_query : Query | None = None ,
224- extra_body : Body | None = None ,
225- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
226- ) -> SyncSinglePage [Subscription ]:
227- """
228- Lists all of an account's subscriptions.
229-
230- Args:
231- account_id: Identifier
232-
233- extra_headers: Send extra headers
234-
235- extra_query: Add additional query parameters to the request
236-
237- extra_body: Add additional JSON properties to the request
238-
239- timeout: Override the client-level default timeout for this request, in seconds
240- """
241- if not account_id :
242- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
243- return self ._get_api_list (
244- path_template ("/accounts/{account_id}/subscriptions" , account_id = account_id ),
245- page = SyncSinglePage [Subscription ],
246- options = make_request_options (
247- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
248- ),
249- model = Subscription ,
250- )
251-
252163
253164class AsyncSubscriptionsResource (AsyncAPIResource ):
254165 @cached_property
@@ -270,58 +181,6 @@ def with_streaming_response(self) -> AsyncSubscriptionsResourceWithStreamingResp
270181 """
271182 return AsyncSubscriptionsResourceWithStreamingResponse (self )
272183
273- async def create (
274- self ,
275- * ,
276- account_id : str ,
277- frequency : Literal ["weekly" , "monthly" , "quarterly" , "yearly" ] | Omit = omit ,
278- rate_plan : RatePlan | Omit = omit ,
279- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
280- # The extra values given here take precedence over values defined on the client or passed to this method.
281- extra_headers : Headers | None = None ,
282- extra_query : Query | None = None ,
283- extra_body : Body | None = None ,
284- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
285- ) -> Subscription :
286- """
287- Creates an account subscription.
288-
289- Args:
290- account_id: Identifier
291-
292- frequency: How often the subscription is renewed automatically.
293-
294- rate_plan: The rate plan applied to the subscription.
295-
296- extra_headers: Send extra headers
297-
298- extra_query: Add additional query parameters to the request
299-
300- extra_body: Add additional JSON properties to the request
301-
302- timeout: Override the client-level default timeout for this request, in seconds
303- """
304- if not account_id :
305- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
306- return await self ._post (
307- path_template ("/accounts/{account_id}/subscriptions" , account_id = account_id ),
308- body = await async_maybe_transform (
309- {
310- "frequency" : frequency ,
311- "rate_plan" : rate_plan ,
312- },
313- subscription_create_params .SubscriptionCreateParams ,
314- ),
315- options = make_request_options (
316- extra_headers = extra_headers ,
317- extra_query = extra_query ,
318- extra_body = extra_body ,
319- timeout = timeout ,
320- post_parser = ResultWrapper [Subscription ]._unwrapper ,
321- ),
322- cast_to = cast (Type [Subscription ], ResultWrapper [Subscription ]),
323- )
324-
325184 async def update (
326185 self ,
327186 subscription_identifier : str ,
@@ -435,110 +294,50 @@ async def delete(
435294 cast_to = cast (Type [SubscriptionDeleteResponse ], ResultWrapper [SubscriptionDeleteResponse ]),
436295 )
437296
438- def get (
439- self ,
440- * ,
441- account_id : str ,
442- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
443- # The extra values given here take precedence over values defined on the client or passed to this method.
444- extra_headers : Headers | None = None ,
445- extra_query : Query | None = None ,
446- extra_body : Body | None = None ,
447- timeout : float | httpx .Timeout | None | NotGiven = not_given ,
448- ) -> AsyncPaginator [Subscription , AsyncSinglePage [Subscription ]]:
449- """
450- Lists all of an account's subscriptions.
451-
452- Args:
453- account_id: Identifier
454-
455- extra_headers: Send extra headers
456-
457- extra_query: Add additional query parameters to the request
458-
459- extra_body: Add additional JSON properties to the request
460-
461- timeout: Override the client-level default timeout for this request, in seconds
462- """
463- if not account_id :
464- raise ValueError (f"Expected a non-empty value for `account_id` but received { account_id !r} " )
465- return self ._get_api_list (
466- path_template ("/accounts/{account_id}/subscriptions" , account_id = account_id ),
467- page = AsyncSinglePage [Subscription ],
468- options = make_request_options (
469- extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
470- ),
471- model = Subscription ,
472- )
473-
474297
475298class SubscriptionsResourceWithRawResponse :
476299 def __init__ (self , subscriptions : SubscriptionsResource ) -> None :
477300 self ._subscriptions = subscriptions
478301
479- self .create = to_raw_response_wrapper (
480- subscriptions .create ,
481- )
482302 self .update = to_raw_response_wrapper (
483303 subscriptions .update ,
484304 )
485305 self .delete = to_raw_response_wrapper (
486306 subscriptions .delete ,
487307 )
488- self .get = to_raw_response_wrapper (
489- subscriptions .get ,
490- )
491308
492309
493310class AsyncSubscriptionsResourceWithRawResponse :
494311 def __init__ (self , subscriptions : AsyncSubscriptionsResource ) -> None :
495312 self ._subscriptions = subscriptions
496313
497- self .create = async_to_raw_response_wrapper (
498- subscriptions .create ,
499- )
500314 self .update = async_to_raw_response_wrapper (
501315 subscriptions .update ,
502316 )
503317 self .delete = async_to_raw_response_wrapper (
504318 subscriptions .delete ,
505319 )
506- self .get = async_to_raw_response_wrapper (
507- subscriptions .get ,
508- )
509320
510321
511322class SubscriptionsResourceWithStreamingResponse :
512323 def __init__ (self , subscriptions : SubscriptionsResource ) -> None :
513324 self ._subscriptions = subscriptions
514325
515- self .create = to_streamed_response_wrapper (
516- subscriptions .create ,
517- )
518326 self .update = to_streamed_response_wrapper (
519327 subscriptions .update ,
520328 )
521329 self .delete = to_streamed_response_wrapper (
522330 subscriptions .delete ,
523331 )
524- self .get = to_streamed_response_wrapper (
525- subscriptions .get ,
526- )
527332
528333
529334class AsyncSubscriptionsResourceWithStreamingResponse :
530335 def __init__ (self , subscriptions : AsyncSubscriptionsResource ) -> None :
531336 self ._subscriptions = subscriptions
532337
533- self .create = async_to_streamed_response_wrapper (
534- subscriptions .create ,
535- )
536338 self .update = async_to_streamed_response_wrapper (
537339 subscriptions .update ,
538340 )
539341 self .delete = async_to_streamed_response_wrapper (
540342 subscriptions .delete ,
541343 )
542- self .get = async_to_streamed_response_wrapper (
543- subscriptions .get ,
544- )
0 commit comments