dodopayments 1.44.0__py3-none-any.whl → 1.47.0__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 dodopayments might be problematic. Click here for more details.

Files changed (46) hide show
  1. dodopayments/_client.py +20 -0
  2. dodopayments/_version.py +1 -1
  3. dodopayments/pagination.py +64 -1
  4. dodopayments/resources/__init__.py +28 -0
  5. dodopayments/resources/discounts.py +24 -0
  6. dodopayments/resources/products/products.py +17 -1
  7. dodopayments/resources/webhooks/__init__.py +33 -0
  8. dodopayments/resources/webhooks/headers.py +255 -0
  9. dodopayments/resources/webhooks/webhooks.py +676 -0
  10. dodopayments/resources/your_webhook_url.py +224 -0
  11. dodopayments/types/__init__.py +17 -1
  12. dodopayments/types/addon_cart_response_item_param.py +13 -0
  13. dodopayments/types/customer_limited_details_param.py +18 -0
  14. dodopayments/types/customer_request_param.py +2 -2
  15. dodopayments/types/discount.py +7 -0
  16. dodopayments/types/discount_create_params.py +7 -0
  17. dodopayments/types/discount_update_params.py +7 -0
  18. dodopayments/types/dispute_param.py +45 -0
  19. dodopayments/types/get_dispute_param.py +52 -0
  20. dodopayments/types/license_key_param.py +53 -0
  21. dodopayments/types/new_customer_param.py +16 -0
  22. dodopayments/types/payment_param.py +131 -0
  23. dodopayments/types/product.py +4 -1
  24. dodopayments/types/product_create_params.py +4 -1
  25. dodopayments/types/product_list_response.py +4 -1
  26. dodopayments/types/product_update_params.py +4 -1
  27. dodopayments/types/refund_param.py +42 -0
  28. dodopayments/types/subscription.py +3 -0
  29. dodopayments/types/subscription_list_response.py +3 -0
  30. dodopayments/types/subscription_param.py +97 -0
  31. dodopayments/types/webhook_create_params.py +40 -0
  32. dodopayments/types/webhook_create_response.py +42 -0
  33. dodopayments/types/webhook_list_params.py +16 -0
  34. dodopayments/types/webhook_list_response.py +42 -0
  35. dodopayments/types/webhook_retrieve_response.py +42 -0
  36. dodopayments/types/webhook_update_params.py +33 -0
  37. dodopayments/types/webhook_update_response.py +42 -0
  38. dodopayments/types/webhooks/__init__.py +6 -0
  39. dodopayments/types/webhooks/header_retrieve_response.py +15 -0
  40. dodopayments/types/webhooks/header_update_params.py +13 -0
  41. dodopayments/types/your_webhook_url_create_params.py +66 -0
  42. {dodopayments-1.44.0.dist-info → dodopayments-1.47.0.dist-info}/METADATA +1 -1
  43. {dodopayments-1.44.0.dist-info → dodopayments-1.47.0.dist-info}/RECORD +45 -22
  44. dodopayments/types/create_new_customer_param.py +0 -23
  45. {dodopayments-1.44.0.dist-info → dodopayments-1.47.0.dist-info}/WHEEL +0 -0
  46. {dodopayments-1.44.0.dist-info → dodopayments-1.47.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,676 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Dict, List, Optional
6
+
7
+ import httpx
8
+
9
+ from ...types import webhook_list_params, webhook_create_params, webhook_update_params
10
+ from .headers import (
11
+ HeadersResource,
12
+ AsyncHeadersResource,
13
+ HeadersResourceWithRawResponse,
14
+ AsyncHeadersResourceWithRawResponse,
15
+ HeadersResourceWithStreamingResponse,
16
+ AsyncHeadersResourceWithStreamingResponse,
17
+ )
18
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
19
+ from ..._utils import maybe_transform, async_maybe_transform
20
+ from ..._compat import cached_property
21
+ from ..._resource import SyncAPIResource, AsyncAPIResource
22
+ from ..._response import (
23
+ to_raw_response_wrapper,
24
+ to_streamed_response_wrapper,
25
+ async_to_raw_response_wrapper,
26
+ async_to_streamed_response_wrapper,
27
+ )
28
+ from ...pagination import SyncCursorPagePagination, AsyncCursorPagePagination
29
+ from ..._base_client import AsyncPaginator, make_request_options
30
+ from ...types.webhook_event_type import WebhookEventType
31
+ from ...types.webhook_list_response import WebhookListResponse
32
+ from ...types.webhook_create_response import WebhookCreateResponse
33
+ from ...types.webhook_update_response import WebhookUpdateResponse
34
+ from ...types.webhook_retrieve_response import WebhookRetrieveResponse
35
+
36
+ __all__ = ["WebhooksResource", "AsyncWebhooksResource"]
37
+
38
+
39
+ class WebhooksResource(SyncAPIResource):
40
+ @cached_property
41
+ def headers(self) -> HeadersResource:
42
+ return HeadersResource(self._client)
43
+
44
+ @cached_property
45
+ def with_raw_response(self) -> WebhooksResourceWithRawResponse:
46
+ """
47
+ This property can be used as a prefix for any HTTP method call to return
48
+ the raw response object instead of the parsed content.
49
+
50
+ For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
51
+ """
52
+ return WebhooksResourceWithRawResponse(self)
53
+
54
+ @cached_property
55
+ def with_streaming_response(self) -> WebhooksResourceWithStreamingResponse:
56
+ """
57
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
58
+
59
+ For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
60
+ """
61
+ return WebhooksResourceWithStreamingResponse(self)
62
+
63
+ def create(
64
+ self,
65
+ *,
66
+ url: str,
67
+ description: Optional[str] | NotGiven = NOT_GIVEN,
68
+ disabled: Optional[bool] | NotGiven = NOT_GIVEN,
69
+ filter_types: List[WebhookEventType] | NotGiven = NOT_GIVEN,
70
+ headers: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
71
+ idempotency_key: Optional[str] | NotGiven = NOT_GIVEN,
72
+ metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
73
+ rate_limit: Optional[int] | NotGiven = NOT_GIVEN,
74
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
75
+ # The extra values given here take precedence over values defined on the client or passed to this method.
76
+ extra_headers: Headers | None = None,
77
+ extra_query: Query | None = None,
78
+ extra_body: Body | None = None,
79
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
80
+ ) -> WebhookCreateResponse:
81
+ """
82
+ Create a new webhook
83
+
84
+ Args:
85
+ url: Url of the webhook
86
+
87
+ description: Filter events to the webhook.
88
+
89
+ Webhook event will only be sent for events in the list.
90
+
91
+ disabled: Create the webhook in a disabled state.
92
+
93
+ Default is false
94
+
95
+ headers: Custom headers to be passed
96
+
97
+ idempotency_key: The request's idempotency key
98
+
99
+ metadata: Metadata to be passed to the webhook Defaut is {}
100
+
101
+ extra_headers: Send extra headers
102
+
103
+ extra_query: Add additional query parameters to the request
104
+
105
+ extra_body: Add additional JSON properties to the request
106
+
107
+ timeout: Override the client-level default timeout for this request, in seconds
108
+ """
109
+ return self._post(
110
+ "/webhooks",
111
+ body=maybe_transform(
112
+ {
113
+ "url": url,
114
+ "description": description,
115
+ "disabled": disabled,
116
+ "filter_types": filter_types,
117
+ "headers": headers,
118
+ "idempotency_key": idempotency_key,
119
+ "metadata": metadata,
120
+ "rate_limit": rate_limit,
121
+ },
122
+ webhook_create_params.WebhookCreateParams,
123
+ ),
124
+ options=make_request_options(
125
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
126
+ ),
127
+ cast_to=WebhookCreateResponse,
128
+ )
129
+
130
+ def retrieve(
131
+ self,
132
+ webhook_id: str,
133
+ *,
134
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
135
+ # The extra values given here take precedence over values defined on the client or passed to this method.
136
+ extra_headers: Headers | None = None,
137
+ extra_query: Query | None = None,
138
+ extra_body: Body | None = None,
139
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
140
+ ) -> WebhookRetrieveResponse:
141
+ """
142
+ Get a webhook by id
143
+
144
+ Args:
145
+ extra_headers: Send extra headers
146
+
147
+ extra_query: Add additional query parameters to the request
148
+
149
+ extra_body: Add additional JSON properties to the request
150
+
151
+ timeout: Override the client-level default timeout for this request, in seconds
152
+ """
153
+ if not webhook_id:
154
+ raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}")
155
+ return self._get(
156
+ f"/webhooks/{webhook_id}",
157
+ options=make_request_options(
158
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
159
+ ),
160
+ cast_to=WebhookRetrieveResponse,
161
+ )
162
+
163
+ def update(
164
+ self,
165
+ webhook_id: str,
166
+ *,
167
+ description: Optional[str] | NotGiven = NOT_GIVEN,
168
+ disabled: Optional[bool] | NotGiven = NOT_GIVEN,
169
+ filter_types: Optional[List[WebhookEventType]] | NotGiven = NOT_GIVEN,
170
+ metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
171
+ rate_limit: Optional[int] | NotGiven = NOT_GIVEN,
172
+ url: Optional[str] | NotGiven = NOT_GIVEN,
173
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
174
+ # The extra values given here take precedence over values defined on the client or passed to this method.
175
+ extra_headers: Headers | None = None,
176
+ extra_query: Query | None = None,
177
+ extra_body: Body | None = None,
178
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
179
+ ) -> WebhookUpdateResponse:
180
+ """
181
+ Patch a webhook by id
182
+
183
+ Args:
184
+ description: Description of the webhook
185
+
186
+ disabled: To Disable the endpoint, set it to true.
187
+
188
+ filter_types: Filter events to the endpoint.
189
+
190
+ Webhook event will only be sent for events in the list.
191
+
192
+ metadata: Metadata
193
+
194
+ rate_limit: Rate limit
195
+
196
+ url: Url endpoint
197
+
198
+ extra_headers: Send extra headers
199
+
200
+ extra_query: Add additional query parameters to the request
201
+
202
+ extra_body: Add additional JSON properties to the request
203
+
204
+ timeout: Override the client-level default timeout for this request, in seconds
205
+ """
206
+ if not webhook_id:
207
+ raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}")
208
+ return self._patch(
209
+ f"/webhooks/{webhook_id}",
210
+ body=maybe_transform(
211
+ {
212
+ "description": description,
213
+ "disabled": disabled,
214
+ "filter_types": filter_types,
215
+ "metadata": metadata,
216
+ "rate_limit": rate_limit,
217
+ "url": url,
218
+ },
219
+ webhook_update_params.WebhookUpdateParams,
220
+ ),
221
+ options=make_request_options(
222
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
223
+ ),
224
+ cast_to=WebhookUpdateResponse,
225
+ )
226
+
227
+ def list(
228
+ self,
229
+ *,
230
+ iterator: Optional[str] | NotGiven = NOT_GIVEN,
231
+ limit: Optional[int] | NotGiven = NOT_GIVEN,
232
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
233
+ # The extra values given here take precedence over values defined on the client or passed to this method.
234
+ extra_headers: Headers | None = None,
235
+ extra_query: Query | None = None,
236
+ extra_body: Body | None = None,
237
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
238
+ ) -> SyncCursorPagePagination[WebhookListResponse]:
239
+ """
240
+ List all webhooks
241
+
242
+ Args:
243
+ iterator: The iterator returned from a prior invocation
244
+
245
+ limit: Limit the number of returned items
246
+
247
+ extra_headers: Send extra headers
248
+
249
+ extra_query: Add additional query parameters to the request
250
+
251
+ extra_body: Add additional JSON properties to the request
252
+
253
+ timeout: Override the client-level default timeout for this request, in seconds
254
+ """
255
+ return self._get_api_list(
256
+ "/webhooks",
257
+ page=SyncCursorPagePagination[WebhookListResponse],
258
+ options=make_request_options(
259
+ extra_headers=extra_headers,
260
+ extra_query=extra_query,
261
+ extra_body=extra_body,
262
+ timeout=timeout,
263
+ query=maybe_transform(
264
+ {
265
+ "iterator": iterator,
266
+ "limit": limit,
267
+ },
268
+ webhook_list_params.WebhookListParams,
269
+ ),
270
+ ),
271
+ model=WebhookListResponse,
272
+ )
273
+
274
+ def delete(
275
+ self,
276
+ webhook_id: str,
277
+ *,
278
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
279
+ # The extra values given here take precedence over values defined on the client or passed to this method.
280
+ extra_headers: Headers | None = None,
281
+ extra_query: Query | None = None,
282
+ extra_body: Body | None = None,
283
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
284
+ ) -> None:
285
+ """
286
+ Delete a webhook by id
287
+
288
+ Args:
289
+ extra_headers: Send extra headers
290
+
291
+ extra_query: Add additional query parameters to the request
292
+
293
+ extra_body: Add additional JSON properties to the request
294
+
295
+ timeout: Override the client-level default timeout for this request, in seconds
296
+ """
297
+ if not webhook_id:
298
+ raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}")
299
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
300
+ return self._delete(
301
+ f"/webhooks/{webhook_id}",
302
+ options=make_request_options(
303
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
304
+ ),
305
+ cast_to=NoneType,
306
+ )
307
+
308
+
309
+ class AsyncWebhooksResource(AsyncAPIResource):
310
+ @cached_property
311
+ def headers(self) -> AsyncHeadersResource:
312
+ return AsyncHeadersResource(self._client)
313
+
314
+ @cached_property
315
+ def with_raw_response(self) -> AsyncWebhooksResourceWithRawResponse:
316
+ """
317
+ This property can be used as a prefix for any HTTP method call to return
318
+ the raw response object instead of the parsed content.
319
+
320
+ For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
321
+ """
322
+ return AsyncWebhooksResourceWithRawResponse(self)
323
+
324
+ @cached_property
325
+ def with_streaming_response(self) -> AsyncWebhooksResourceWithStreamingResponse:
326
+ """
327
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
328
+
329
+ For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
330
+ """
331
+ return AsyncWebhooksResourceWithStreamingResponse(self)
332
+
333
+ async def create(
334
+ self,
335
+ *,
336
+ url: str,
337
+ description: Optional[str] | NotGiven = NOT_GIVEN,
338
+ disabled: Optional[bool] | NotGiven = NOT_GIVEN,
339
+ filter_types: List[WebhookEventType] | NotGiven = NOT_GIVEN,
340
+ headers: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
341
+ idempotency_key: Optional[str] | NotGiven = NOT_GIVEN,
342
+ metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
343
+ rate_limit: Optional[int] | NotGiven = NOT_GIVEN,
344
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
345
+ # The extra values given here take precedence over values defined on the client or passed to this method.
346
+ extra_headers: Headers | None = None,
347
+ extra_query: Query | None = None,
348
+ extra_body: Body | None = None,
349
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
350
+ ) -> WebhookCreateResponse:
351
+ """
352
+ Create a new webhook
353
+
354
+ Args:
355
+ url: Url of the webhook
356
+
357
+ description: Filter events to the webhook.
358
+
359
+ Webhook event will only be sent for events in the list.
360
+
361
+ disabled: Create the webhook in a disabled state.
362
+
363
+ Default is false
364
+
365
+ headers: Custom headers to be passed
366
+
367
+ idempotency_key: The request's idempotency key
368
+
369
+ metadata: Metadata to be passed to the webhook Defaut is {}
370
+
371
+ extra_headers: Send extra headers
372
+
373
+ extra_query: Add additional query parameters to the request
374
+
375
+ extra_body: Add additional JSON properties to the request
376
+
377
+ timeout: Override the client-level default timeout for this request, in seconds
378
+ """
379
+ return await self._post(
380
+ "/webhooks",
381
+ body=await async_maybe_transform(
382
+ {
383
+ "url": url,
384
+ "description": description,
385
+ "disabled": disabled,
386
+ "filter_types": filter_types,
387
+ "headers": headers,
388
+ "idempotency_key": idempotency_key,
389
+ "metadata": metadata,
390
+ "rate_limit": rate_limit,
391
+ },
392
+ webhook_create_params.WebhookCreateParams,
393
+ ),
394
+ options=make_request_options(
395
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
396
+ ),
397
+ cast_to=WebhookCreateResponse,
398
+ )
399
+
400
+ async def retrieve(
401
+ self,
402
+ webhook_id: str,
403
+ *,
404
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
405
+ # The extra values given here take precedence over values defined on the client or passed to this method.
406
+ extra_headers: Headers | None = None,
407
+ extra_query: Query | None = None,
408
+ extra_body: Body | None = None,
409
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
410
+ ) -> WebhookRetrieveResponse:
411
+ """
412
+ Get a webhook by id
413
+
414
+ Args:
415
+ extra_headers: Send extra headers
416
+
417
+ extra_query: Add additional query parameters to the request
418
+
419
+ extra_body: Add additional JSON properties to the request
420
+
421
+ timeout: Override the client-level default timeout for this request, in seconds
422
+ """
423
+ if not webhook_id:
424
+ raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}")
425
+ return await self._get(
426
+ f"/webhooks/{webhook_id}",
427
+ options=make_request_options(
428
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
429
+ ),
430
+ cast_to=WebhookRetrieveResponse,
431
+ )
432
+
433
+ async def update(
434
+ self,
435
+ webhook_id: str,
436
+ *,
437
+ description: Optional[str] | NotGiven = NOT_GIVEN,
438
+ disabled: Optional[bool] | NotGiven = NOT_GIVEN,
439
+ filter_types: Optional[List[WebhookEventType]] | NotGiven = NOT_GIVEN,
440
+ metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
441
+ rate_limit: Optional[int] | NotGiven = NOT_GIVEN,
442
+ url: Optional[str] | NotGiven = NOT_GIVEN,
443
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
444
+ # The extra values given here take precedence over values defined on the client or passed to this method.
445
+ extra_headers: Headers | None = None,
446
+ extra_query: Query | None = None,
447
+ extra_body: Body | None = None,
448
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
449
+ ) -> WebhookUpdateResponse:
450
+ """
451
+ Patch a webhook by id
452
+
453
+ Args:
454
+ description: Description of the webhook
455
+
456
+ disabled: To Disable the endpoint, set it to true.
457
+
458
+ filter_types: Filter events to the endpoint.
459
+
460
+ Webhook event will only be sent for events in the list.
461
+
462
+ metadata: Metadata
463
+
464
+ rate_limit: Rate limit
465
+
466
+ url: Url endpoint
467
+
468
+ extra_headers: Send extra headers
469
+
470
+ extra_query: Add additional query parameters to the request
471
+
472
+ extra_body: Add additional JSON properties to the request
473
+
474
+ timeout: Override the client-level default timeout for this request, in seconds
475
+ """
476
+ if not webhook_id:
477
+ raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}")
478
+ return await self._patch(
479
+ f"/webhooks/{webhook_id}",
480
+ body=await async_maybe_transform(
481
+ {
482
+ "description": description,
483
+ "disabled": disabled,
484
+ "filter_types": filter_types,
485
+ "metadata": metadata,
486
+ "rate_limit": rate_limit,
487
+ "url": url,
488
+ },
489
+ webhook_update_params.WebhookUpdateParams,
490
+ ),
491
+ options=make_request_options(
492
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
493
+ ),
494
+ cast_to=WebhookUpdateResponse,
495
+ )
496
+
497
+ def list(
498
+ self,
499
+ *,
500
+ iterator: Optional[str] | NotGiven = NOT_GIVEN,
501
+ limit: Optional[int] | NotGiven = NOT_GIVEN,
502
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
503
+ # The extra values given here take precedence over values defined on the client or passed to this method.
504
+ extra_headers: Headers | None = None,
505
+ extra_query: Query | None = None,
506
+ extra_body: Body | None = None,
507
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
508
+ ) -> AsyncPaginator[WebhookListResponse, AsyncCursorPagePagination[WebhookListResponse]]:
509
+ """
510
+ List all webhooks
511
+
512
+ Args:
513
+ iterator: The iterator returned from a prior invocation
514
+
515
+ limit: Limit the number of returned items
516
+
517
+ extra_headers: Send extra headers
518
+
519
+ extra_query: Add additional query parameters to the request
520
+
521
+ extra_body: Add additional JSON properties to the request
522
+
523
+ timeout: Override the client-level default timeout for this request, in seconds
524
+ """
525
+ return self._get_api_list(
526
+ "/webhooks",
527
+ page=AsyncCursorPagePagination[WebhookListResponse],
528
+ options=make_request_options(
529
+ extra_headers=extra_headers,
530
+ extra_query=extra_query,
531
+ extra_body=extra_body,
532
+ timeout=timeout,
533
+ query=maybe_transform(
534
+ {
535
+ "iterator": iterator,
536
+ "limit": limit,
537
+ },
538
+ webhook_list_params.WebhookListParams,
539
+ ),
540
+ ),
541
+ model=WebhookListResponse,
542
+ )
543
+
544
+ async def delete(
545
+ self,
546
+ webhook_id: str,
547
+ *,
548
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
549
+ # The extra values given here take precedence over values defined on the client or passed to this method.
550
+ extra_headers: Headers | None = None,
551
+ extra_query: Query | None = None,
552
+ extra_body: Body | None = None,
553
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
554
+ ) -> None:
555
+ """
556
+ Delete a webhook by id
557
+
558
+ Args:
559
+ extra_headers: Send extra headers
560
+
561
+ extra_query: Add additional query parameters to the request
562
+
563
+ extra_body: Add additional JSON properties to the request
564
+
565
+ timeout: Override the client-level default timeout for this request, in seconds
566
+ """
567
+ if not webhook_id:
568
+ raise ValueError(f"Expected a non-empty value for `webhook_id` but received {webhook_id!r}")
569
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
570
+ return await self._delete(
571
+ f"/webhooks/{webhook_id}",
572
+ options=make_request_options(
573
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
574
+ ),
575
+ cast_to=NoneType,
576
+ )
577
+
578
+
579
+ class WebhooksResourceWithRawResponse:
580
+ def __init__(self, webhooks: WebhooksResource) -> None:
581
+ self._webhooks = webhooks
582
+
583
+ self.create = to_raw_response_wrapper(
584
+ webhooks.create,
585
+ )
586
+ self.retrieve = to_raw_response_wrapper(
587
+ webhooks.retrieve,
588
+ )
589
+ self.update = to_raw_response_wrapper(
590
+ webhooks.update,
591
+ )
592
+ self.list = to_raw_response_wrapper(
593
+ webhooks.list,
594
+ )
595
+ self.delete = to_raw_response_wrapper(
596
+ webhooks.delete,
597
+ )
598
+
599
+ @cached_property
600
+ def headers(self) -> HeadersResourceWithRawResponse:
601
+ return HeadersResourceWithRawResponse(self._webhooks.headers)
602
+
603
+
604
+ class AsyncWebhooksResourceWithRawResponse:
605
+ def __init__(self, webhooks: AsyncWebhooksResource) -> None:
606
+ self._webhooks = webhooks
607
+
608
+ self.create = async_to_raw_response_wrapper(
609
+ webhooks.create,
610
+ )
611
+ self.retrieve = async_to_raw_response_wrapper(
612
+ webhooks.retrieve,
613
+ )
614
+ self.update = async_to_raw_response_wrapper(
615
+ webhooks.update,
616
+ )
617
+ self.list = async_to_raw_response_wrapper(
618
+ webhooks.list,
619
+ )
620
+ self.delete = async_to_raw_response_wrapper(
621
+ webhooks.delete,
622
+ )
623
+
624
+ @cached_property
625
+ def headers(self) -> AsyncHeadersResourceWithRawResponse:
626
+ return AsyncHeadersResourceWithRawResponse(self._webhooks.headers)
627
+
628
+
629
+ class WebhooksResourceWithStreamingResponse:
630
+ def __init__(self, webhooks: WebhooksResource) -> None:
631
+ self._webhooks = webhooks
632
+
633
+ self.create = to_streamed_response_wrapper(
634
+ webhooks.create,
635
+ )
636
+ self.retrieve = to_streamed_response_wrapper(
637
+ webhooks.retrieve,
638
+ )
639
+ self.update = to_streamed_response_wrapper(
640
+ webhooks.update,
641
+ )
642
+ self.list = to_streamed_response_wrapper(
643
+ webhooks.list,
644
+ )
645
+ self.delete = to_streamed_response_wrapper(
646
+ webhooks.delete,
647
+ )
648
+
649
+ @cached_property
650
+ def headers(self) -> HeadersResourceWithStreamingResponse:
651
+ return HeadersResourceWithStreamingResponse(self._webhooks.headers)
652
+
653
+
654
+ class AsyncWebhooksResourceWithStreamingResponse:
655
+ def __init__(self, webhooks: AsyncWebhooksResource) -> None:
656
+ self._webhooks = webhooks
657
+
658
+ self.create = async_to_streamed_response_wrapper(
659
+ webhooks.create,
660
+ )
661
+ self.retrieve = async_to_streamed_response_wrapper(
662
+ webhooks.retrieve,
663
+ )
664
+ self.update = async_to_streamed_response_wrapper(
665
+ webhooks.update,
666
+ )
667
+ self.list = async_to_streamed_response_wrapper(
668
+ webhooks.list,
669
+ )
670
+ self.delete = async_to_streamed_response_wrapper(
671
+ webhooks.delete,
672
+ )
673
+
674
+ @cached_property
675
+ def headers(self) -> AsyncHeadersResourceWithStreamingResponse:
676
+ return AsyncHeadersResourceWithStreamingResponse(self._webhooks.headers)