1717 async_to_streamed_response_wrapper ,
1818)
1919from ..._base_client import make_request_options
20- from ...types .objects import bulk_set_params , bulk_delete_params , bulk_add_subscriptions_params
20+ from ...types .objects import (
21+ bulk_set_params ,
22+ bulk_delete_params ,
23+ bulk_add_subscriptions_params ,
24+ bulk_delete_subscriptions_params ,
25+ )
2126from ...types .bulk_operation import BulkOperation
2227
2328__all__ = ["BulkResource" , "AsyncBulkResource" ]
@@ -109,7 +114,7 @@ def add_subscriptions(
109114 for the `recipient` field.
110115
111116 Args:
112- subscriptions: A list of subscriptions.
117+ subscriptions: A nested list of subscriptions.
113118
114119 extra_headers: Send extra headers
115120
@@ -138,6 +143,54 @@ def add_subscriptions(
138143 cast_to = BulkOperation ,
139144 )
140145
146+ def delete_subscriptions (
147+ self ,
148+ collection : str ,
149+ * ,
150+ subscriptions : Iterable [bulk_delete_subscriptions_params .Subscription ],
151+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
152+ # The extra values given here take precedence over values defined on the client or passed to this method.
153+ extra_headers : Headers | None = None ,
154+ extra_query : Query | None = None ,
155+ extra_body : Body | None = None ,
156+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
157+ idempotency_key : str | None = None ,
158+ ) -> BulkOperation :
159+ """Delete subscriptions for many objects in a single collection type.
160+
161+ If a
162+ subscription for an object in the collection doesn't exist, it will be skipped.
163+
164+ Args:
165+ subscriptions: A nested list of subscriptions.
166+
167+ extra_headers: Send extra headers
168+
169+ extra_query: Add additional query parameters to the request
170+
171+ extra_body: Add additional JSON properties to the request
172+
173+ timeout: Override the client-level default timeout for this request, in seconds
174+
175+ idempotency_key: Specify a custom idempotency key for this request
176+ """
177+ if not collection :
178+ raise ValueError (f"Expected a non-empty value for `collection` but received { collection !r} " )
179+ return self ._post (
180+ f"/v1/objects/{ collection } /bulk/subscriptions/delete" ,
181+ body = maybe_transform (
182+ {"subscriptions" : subscriptions }, bulk_delete_subscriptions_params .BulkDeleteSubscriptionsParams
183+ ),
184+ options = make_request_options (
185+ extra_headers = extra_headers ,
186+ extra_query = extra_query ,
187+ extra_body = extra_body ,
188+ timeout = timeout ,
189+ idempotency_key = idempotency_key ,
190+ ),
191+ cast_to = BulkOperation ,
192+ )
193+
141194 def set (
142195 self ,
143196 collection : str ,
@@ -269,7 +322,7 @@ async def add_subscriptions(
269322 for the `recipient` field.
270323
271324 Args:
272- subscriptions: A list of subscriptions.
325+ subscriptions: A nested list of subscriptions.
273326
274327 extra_headers: Send extra headers
275328
@@ -298,6 +351,54 @@ async def add_subscriptions(
298351 cast_to = BulkOperation ,
299352 )
300353
354+ async def delete_subscriptions (
355+ self ,
356+ collection : str ,
357+ * ,
358+ subscriptions : Iterable [bulk_delete_subscriptions_params .Subscription ],
359+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
360+ # The extra values given here take precedence over values defined on the client or passed to this method.
361+ extra_headers : Headers | None = None ,
362+ extra_query : Query | None = None ,
363+ extra_body : Body | None = None ,
364+ timeout : float | httpx .Timeout | None | NotGiven = not_given ,
365+ idempotency_key : str | None = None ,
366+ ) -> BulkOperation :
367+ """Delete subscriptions for many objects in a single collection type.
368+
369+ If a
370+ subscription for an object in the collection doesn't exist, it will be skipped.
371+
372+ Args:
373+ subscriptions: A nested list of subscriptions.
374+
375+ extra_headers: Send extra headers
376+
377+ extra_query: Add additional query parameters to the request
378+
379+ extra_body: Add additional JSON properties to the request
380+
381+ timeout: Override the client-level default timeout for this request, in seconds
382+
383+ idempotency_key: Specify a custom idempotency key for this request
384+ """
385+ if not collection :
386+ raise ValueError (f"Expected a non-empty value for `collection` but received { collection !r} " )
387+ return await self ._post (
388+ f"/v1/objects/{ collection } /bulk/subscriptions/delete" ,
389+ body = await async_maybe_transform (
390+ {"subscriptions" : subscriptions }, bulk_delete_subscriptions_params .BulkDeleteSubscriptionsParams
391+ ),
392+ options = make_request_options (
393+ extra_headers = extra_headers ,
394+ extra_query = extra_query ,
395+ extra_body = extra_body ,
396+ timeout = timeout ,
397+ idempotency_key = idempotency_key ,
398+ ),
399+ cast_to = BulkOperation ,
400+ )
401+
301402 async def set (
302403 self ,
303404 collection : str ,
@@ -353,6 +454,9 @@ def __init__(self, bulk: BulkResource) -> None:
353454 self .add_subscriptions = to_raw_response_wrapper (
354455 bulk .add_subscriptions ,
355456 )
457+ self .delete_subscriptions = to_raw_response_wrapper (
458+ bulk .delete_subscriptions ,
459+ )
356460 self .set = to_raw_response_wrapper (
357461 bulk .set ,
358462 )
@@ -368,6 +472,9 @@ def __init__(self, bulk: AsyncBulkResource) -> None:
368472 self .add_subscriptions = async_to_raw_response_wrapper (
369473 bulk .add_subscriptions ,
370474 )
475+ self .delete_subscriptions = async_to_raw_response_wrapper (
476+ bulk .delete_subscriptions ,
477+ )
371478 self .set = async_to_raw_response_wrapper (
372479 bulk .set ,
373480 )
@@ -383,6 +490,9 @@ def __init__(self, bulk: BulkResource) -> None:
383490 self .add_subscriptions = to_streamed_response_wrapper (
384491 bulk .add_subscriptions ,
385492 )
493+ self .delete_subscriptions = to_streamed_response_wrapper (
494+ bulk .delete_subscriptions ,
495+ )
386496 self .set = to_streamed_response_wrapper (
387497 bulk .set ,
388498 )
@@ -398,6 +508,9 @@ def __init__(self, bulk: AsyncBulkResource) -> None:
398508 self .add_subscriptions = async_to_streamed_response_wrapper (
399509 bulk .add_subscriptions ,
400510 )
511+ self .delete_subscriptions = async_to_streamed_response_wrapper (
512+ bulk .delete_subscriptions ,
513+ )
401514 self .set = async_to_streamed_response_wrapper (
402515 bulk .set ,
403516 )
0 commit comments