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