dodopayments 1.43.1__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.
- dodopayments/_base_client.py +4 -1
- dodopayments/_client.py +20 -9
- dodopayments/_files.py +4 -4
- dodopayments/_version.py +1 -1
- dodopayments/pagination.py +64 -1
- dodopayments/resources/__init__.py +27 -13
- dodopayments/resources/discounts.py +24 -0
- dodopayments/resources/products/products.py +17 -1
- dodopayments/resources/subscriptions.py +4 -6
- dodopayments/resources/webhooks/__init__.py +33 -0
- dodopayments/resources/webhooks/headers.py +255 -0
- dodopayments/resources/webhooks/webhooks.py +676 -0
- dodopayments/resources/your_webhook_url.py +224 -0
- dodopayments/types/__init__.py +17 -3
- dodopayments/types/addon_cart_response_item_param.py +13 -0
- dodopayments/types/customer_limited_details_param.py +18 -0
- dodopayments/types/customer_request_param.py +2 -2
- dodopayments/types/discount.py +7 -0
- dodopayments/types/discount_create_params.py +7 -0
- dodopayments/types/discount_update_params.py +7 -0
- dodopayments/types/dispute_param.py +45 -0
- dodopayments/types/get_dispute_param.py +52 -0
- dodopayments/types/license_key_param.py +53 -0
- dodopayments/types/new_customer_param.py +16 -0
- dodopayments/types/payment_param.py +131 -0
- dodopayments/types/product.py +4 -1
- dodopayments/types/product_create_params.py +4 -1
- dodopayments/types/product_list_response.py +4 -1
- dodopayments/types/product_update_params.py +4 -1
- dodopayments/types/refund_param.py +42 -0
- dodopayments/types/subscription.py +3 -0
- dodopayments/types/subscription_change_plan_params.py +1 -1
- dodopayments/types/subscription_list_params.py +1 -1
- dodopayments/types/subscription_list_response.py +3 -0
- dodopayments/types/subscription_param.py +97 -0
- dodopayments/types/subscription_status.py +1 -1
- dodopayments/types/webhook_create_params.py +40 -0
- dodopayments/types/webhook_create_response.py +42 -0
- dodopayments/types/webhook_event_type.py +0 -1
- dodopayments/types/webhook_list_params.py +16 -0
- dodopayments/types/webhook_list_response.py +42 -0
- dodopayments/types/webhook_retrieve_response.py +42 -0
- dodopayments/types/webhook_update_params.py +33 -0
- dodopayments/types/webhook_update_response.py +42 -0
- dodopayments/types/webhooks/__init__.py +6 -0
- dodopayments/types/webhooks/header_retrieve_response.py +15 -0
- dodopayments/types/webhooks/header_update_params.py +13 -0
- dodopayments/types/your_webhook_url_create_params.py +66 -0
- {dodopayments-1.43.1.dist-info → dodopayments-1.47.0.dist-info}/METADATA +1 -1
- {dodopayments-1.43.1.dist-info → dodopayments-1.47.0.dist-info}/RECORD +52 -32
- dodopayments/resources/webhook_events.py +0 -326
- dodopayments/types/create_new_customer_param.py +0 -23
- dodopayments/types/webhook_event.py +0 -26
- dodopayments/types/webhook_event_list_params.py +0 -39
- {dodopayments-1.43.1.dist-info → dodopayments-1.47.0.dist-info}/WHEEL +0 -0
- {dodopayments-1.43.1.dist-info → dodopayments-1.47.0.dist-info}/licenses/LICENSE +0 -0
dodopayments/_base_client.py
CHANGED
|
@@ -532,7 +532,10 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
532
532
|
is_body_allowed = options.method.lower() != "get"
|
|
533
533
|
|
|
534
534
|
if is_body_allowed:
|
|
535
|
-
|
|
535
|
+
if isinstance(json_data, bytes):
|
|
536
|
+
kwargs["content"] = json_data
|
|
537
|
+
else:
|
|
538
|
+
kwargs["json"] = json_data if is_given(json_data) else None
|
|
536
539
|
kwargs["files"] = files
|
|
537
540
|
else:
|
|
538
541
|
headers.pop("Content-Type", None)
|
dodopayments/_client.py
CHANGED
|
@@ -33,7 +33,7 @@ from .resources import (
|
|
|
33
33
|
discounts,
|
|
34
34
|
license_keys,
|
|
35
35
|
subscriptions,
|
|
36
|
-
|
|
36
|
+
your_webhook_url,
|
|
37
37
|
license_key_instances,
|
|
38
38
|
)
|
|
39
39
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
@@ -45,6 +45,7 @@ from ._base_client import (
|
|
|
45
45
|
)
|
|
46
46
|
from .resources.invoices import invoices
|
|
47
47
|
from .resources.products import products
|
|
48
|
+
from .resources.webhooks import webhooks
|
|
48
49
|
from .resources.customers import customers
|
|
49
50
|
|
|
50
51
|
__all__ = [
|
|
@@ -76,12 +77,13 @@ class DodoPayments(SyncAPIClient):
|
|
|
76
77
|
refunds: refunds.RefundsResource
|
|
77
78
|
disputes: disputes.DisputesResource
|
|
78
79
|
payouts: payouts.PayoutsResource
|
|
79
|
-
webhook_events: webhook_events.WebhookEventsResource
|
|
80
80
|
products: products.ProductsResource
|
|
81
81
|
misc: misc.MiscResource
|
|
82
82
|
discounts: discounts.DiscountsResource
|
|
83
83
|
addons: addons.AddonsResource
|
|
84
84
|
brands: brands.BrandsResource
|
|
85
|
+
webhooks: webhooks.WebhooksResource
|
|
86
|
+
your_webhook_url: your_webhook_url.YourWebhookURLResource
|
|
85
87
|
with_raw_response: DodoPaymentsWithRawResponse
|
|
86
88
|
with_streaming_response: DodoPaymentsWithStreamedResponse
|
|
87
89
|
|
|
@@ -173,12 +175,13 @@ class DodoPayments(SyncAPIClient):
|
|
|
173
175
|
self.refunds = refunds.RefundsResource(self)
|
|
174
176
|
self.disputes = disputes.DisputesResource(self)
|
|
175
177
|
self.payouts = payouts.PayoutsResource(self)
|
|
176
|
-
self.webhook_events = webhook_events.WebhookEventsResource(self)
|
|
177
178
|
self.products = products.ProductsResource(self)
|
|
178
179
|
self.misc = misc.MiscResource(self)
|
|
179
180
|
self.discounts = discounts.DiscountsResource(self)
|
|
180
181
|
self.addons = addons.AddonsResource(self)
|
|
181
182
|
self.brands = brands.BrandsResource(self)
|
|
183
|
+
self.webhooks = webhooks.WebhooksResource(self)
|
|
184
|
+
self.your_webhook_url = your_webhook_url.YourWebhookURLResource(self)
|
|
182
185
|
self.with_raw_response = DodoPaymentsWithRawResponse(self)
|
|
183
186
|
self.with_streaming_response = DodoPaymentsWithStreamedResponse(self)
|
|
184
187
|
|
|
@@ -300,12 +303,13 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
300
303
|
refunds: refunds.AsyncRefundsResource
|
|
301
304
|
disputes: disputes.AsyncDisputesResource
|
|
302
305
|
payouts: payouts.AsyncPayoutsResource
|
|
303
|
-
webhook_events: webhook_events.AsyncWebhookEventsResource
|
|
304
306
|
products: products.AsyncProductsResource
|
|
305
307
|
misc: misc.AsyncMiscResource
|
|
306
308
|
discounts: discounts.AsyncDiscountsResource
|
|
307
309
|
addons: addons.AsyncAddonsResource
|
|
308
310
|
brands: brands.AsyncBrandsResource
|
|
311
|
+
webhooks: webhooks.AsyncWebhooksResource
|
|
312
|
+
your_webhook_url: your_webhook_url.AsyncYourWebhookURLResource
|
|
309
313
|
with_raw_response: AsyncDodoPaymentsWithRawResponse
|
|
310
314
|
with_streaming_response: AsyncDodoPaymentsWithStreamedResponse
|
|
311
315
|
|
|
@@ -397,12 +401,13 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
397
401
|
self.refunds = refunds.AsyncRefundsResource(self)
|
|
398
402
|
self.disputes = disputes.AsyncDisputesResource(self)
|
|
399
403
|
self.payouts = payouts.AsyncPayoutsResource(self)
|
|
400
|
-
self.webhook_events = webhook_events.AsyncWebhookEventsResource(self)
|
|
401
404
|
self.products = products.AsyncProductsResource(self)
|
|
402
405
|
self.misc = misc.AsyncMiscResource(self)
|
|
403
406
|
self.discounts = discounts.AsyncDiscountsResource(self)
|
|
404
407
|
self.addons = addons.AsyncAddonsResource(self)
|
|
405
408
|
self.brands = brands.AsyncBrandsResource(self)
|
|
409
|
+
self.webhooks = webhooks.AsyncWebhooksResource(self)
|
|
410
|
+
self.your_webhook_url = your_webhook_url.AsyncYourWebhookURLResource(self)
|
|
406
411
|
self.with_raw_response = AsyncDodoPaymentsWithRawResponse(self)
|
|
407
412
|
self.with_streaming_response = AsyncDodoPaymentsWithStreamedResponse(self)
|
|
408
413
|
|
|
@@ -527,12 +532,13 @@ class DodoPaymentsWithRawResponse:
|
|
|
527
532
|
self.refunds = refunds.RefundsResourceWithRawResponse(client.refunds)
|
|
528
533
|
self.disputes = disputes.DisputesResourceWithRawResponse(client.disputes)
|
|
529
534
|
self.payouts = payouts.PayoutsResourceWithRawResponse(client.payouts)
|
|
530
|
-
self.webhook_events = webhook_events.WebhookEventsResourceWithRawResponse(client.webhook_events)
|
|
531
535
|
self.products = products.ProductsResourceWithRawResponse(client.products)
|
|
532
536
|
self.misc = misc.MiscResourceWithRawResponse(client.misc)
|
|
533
537
|
self.discounts = discounts.DiscountsResourceWithRawResponse(client.discounts)
|
|
534
538
|
self.addons = addons.AddonsResourceWithRawResponse(client.addons)
|
|
535
539
|
self.brands = brands.BrandsResourceWithRawResponse(client.brands)
|
|
540
|
+
self.webhooks = webhooks.WebhooksResourceWithRawResponse(client.webhooks)
|
|
541
|
+
self.your_webhook_url = your_webhook_url.YourWebhookURLResourceWithRawResponse(client.your_webhook_url)
|
|
536
542
|
|
|
537
543
|
|
|
538
544
|
class AsyncDodoPaymentsWithRawResponse:
|
|
@@ -549,12 +555,13 @@ class AsyncDodoPaymentsWithRawResponse:
|
|
|
549
555
|
self.refunds = refunds.AsyncRefundsResourceWithRawResponse(client.refunds)
|
|
550
556
|
self.disputes = disputes.AsyncDisputesResourceWithRawResponse(client.disputes)
|
|
551
557
|
self.payouts = payouts.AsyncPayoutsResourceWithRawResponse(client.payouts)
|
|
552
|
-
self.webhook_events = webhook_events.AsyncWebhookEventsResourceWithRawResponse(client.webhook_events)
|
|
553
558
|
self.products = products.AsyncProductsResourceWithRawResponse(client.products)
|
|
554
559
|
self.misc = misc.AsyncMiscResourceWithRawResponse(client.misc)
|
|
555
560
|
self.discounts = discounts.AsyncDiscountsResourceWithRawResponse(client.discounts)
|
|
556
561
|
self.addons = addons.AsyncAddonsResourceWithRawResponse(client.addons)
|
|
557
562
|
self.brands = brands.AsyncBrandsResourceWithRawResponse(client.brands)
|
|
563
|
+
self.webhooks = webhooks.AsyncWebhooksResourceWithRawResponse(client.webhooks)
|
|
564
|
+
self.your_webhook_url = your_webhook_url.AsyncYourWebhookURLResourceWithRawResponse(client.your_webhook_url)
|
|
558
565
|
|
|
559
566
|
|
|
560
567
|
class DodoPaymentsWithStreamedResponse:
|
|
@@ -571,12 +578,13 @@ class DodoPaymentsWithStreamedResponse:
|
|
|
571
578
|
self.refunds = refunds.RefundsResourceWithStreamingResponse(client.refunds)
|
|
572
579
|
self.disputes = disputes.DisputesResourceWithStreamingResponse(client.disputes)
|
|
573
580
|
self.payouts = payouts.PayoutsResourceWithStreamingResponse(client.payouts)
|
|
574
|
-
self.webhook_events = webhook_events.WebhookEventsResourceWithStreamingResponse(client.webhook_events)
|
|
575
581
|
self.products = products.ProductsResourceWithStreamingResponse(client.products)
|
|
576
582
|
self.misc = misc.MiscResourceWithStreamingResponse(client.misc)
|
|
577
583
|
self.discounts = discounts.DiscountsResourceWithStreamingResponse(client.discounts)
|
|
578
584
|
self.addons = addons.AddonsResourceWithStreamingResponse(client.addons)
|
|
579
585
|
self.brands = brands.BrandsResourceWithStreamingResponse(client.brands)
|
|
586
|
+
self.webhooks = webhooks.WebhooksResourceWithStreamingResponse(client.webhooks)
|
|
587
|
+
self.your_webhook_url = your_webhook_url.YourWebhookURLResourceWithStreamingResponse(client.your_webhook_url)
|
|
580
588
|
|
|
581
589
|
|
|
582
590
|
class AsyncDodoPaymentsWithStreamedResponse:
|
|
@@ -593,12 +601,15 @@ class AsyncDodoPaymentsWithStreamedResponse:
|
|
|
593
601
|
self.refunds = refunds.AsyncRefundsResourceWithStreamingResponse(client.refunds)
|
|
594
602
|
self.disputes = disputes.AsyncDisputesResourceWithStreamingResponse(client.disputes)
|
|
595
603
|
self.payouts = payouts.AsyncPayoutsResourceWithStreamingResponse(client.payouts)
|
|
596
|
-
self.webhook_events = webhook_events.AsyncWebhookEventsResourceWithStreamingResponse(client.webhook_events)
|
|
597
604
|
self.products = products.AsyncProductsResourceWithStreamingResponse(client.products)
|
|
598
605
|
self.misc = misc.AsyncMiscResourceWithStreamingResponse(client.misc)
|
|
599
606
|
self.discounts = discounts.AsyncDiscountsResourceWithStreamingResponse(client.discounts)
|
|
600
607
|
self.addons = addons.AsyncAddonsResourceWithStreamingResponse(client.addons)
|
|
601
608
|
self.brands = brands.AsyncBrandsResourceWithStreamingResponse(client.brands)
|
|
609
|
+
self.webhooks = webhooks.AsyncWebhooksResourceWithStreamingResponse(client.webhooks)
|
|
610
|
+
self.your_webhook_url = your_webhook_url.AsyncYourWebhookURLResourceWithStreamingResponse(
|
|
611
|
+
client.your_webhook_url
|
|
612
|
+
)
|
|
602
613
|
|
|
603
614
|
|
|
604
615
|
Client = DodoPayments
|
dodopayments/_files.py
CHANGED
|
@@ -69,12 +69,12 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
69
69
|
return file
|
|
70
70
|
|
|
71
71
|
if is_tuple_t(file):
|
|
72
|
-
return (file[0],
|
|
72
|
+
return (file[0], read_file_content(file[1]), *file[2:])
|
|
73
73
|
|
|
74
74
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
75
75
|
|
|
76
76
|
|
|
77
|
-
def
|
|
77
|
+
def read_file_content(file: FileContent) -> HttpxFileContent:
|
|
78
78
|
if isinstance(file, os.PathLike):
|
|
79
79
|
return pathlib.Path(file).read_bytes()
|
|
80
80
|
return file
|
|
@@ -111,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes:
|
|
|
111
111
|
return file
|
|
112
112
|
|
|
113
113
|
if is_tuple_t(file):
|
|
114
|
-
return (file[0], await
|
|
114
|
+
return (file[0], await async_read_file_content(file[1]), *file[2:])
|
|
115
115
|
|
|
116
116
|
raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple")
|
|
117
117
|
|
|
118
118
|
|
|
119
|
-
async def
|
|
119
|
+
async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
|
120
120
|
if isinstance(file, os.PathLike):
|
|
121
121
|
return await anyio.Path(file).read_bytes()
|
|
122
122
|
|
dodopayments/_version.py
CHANGED
dodopayments/pagination.py
CHANGED
|
@@ -5,7 +5,12 @@ from typing_extensions import override
|
|
|
5
5
|
|
|
6
6
|
from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage
|
|
7
7
|
|
|
8
|
-
__all__ = [
|
|
8
|
+
__all__ = [
|
|
9
|
+
"SyncDefaultPageNumberPagination",
|
|
10
|
+
"AsyncDefaultPageNumberPagination",
|
|
11
|
+
"SyncCursorPagePagination",
|
|
12
|
+
"AsyncCursorPagePagination",
|
|
13
|
+
]
|
|
9
14
|
|
|
10
15
|
_T = TypeVar("_T")
|
|
11
16
|
|
|
@@ -42,3 +47,61 @@ class AsyncDefaultPageNumberPagination(BaseAsyncPage[_T], BasePage[_T], Generic[
|
|
|
42
47
|
last_page = cast("int | None", self._options.params.get("page_number")) or 1
|
|
43
48
|
|
|
44
49
|
return PageInfo(params={"page_number": last_page + 1})
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class SyncCursorPagePagination(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
|
|
53
|
+
data: List[_T]
|
|
54
|
+
iterator: Optional[str] = None
|
|
55
|
+
done: Optional[bool] = None
|
|
56
|
+
|
|
57
|
+
@override
|
|
58
|
+
def _get_page_items(self) -> List[_T]:
|
|
59
|
+
data = self.data
|
|
60
|
+
if not data:
|
|
61
|
+
return []
|
|
62
|
+
return data
|
|
63
|
+
|
|
64
|
+
@override
|
|
65
|
+
def has_next_page(self) -> bool:
|
|
66
|
+
done = self.done
|
|
67
|
+
if done is not None and done is False:
|
|
68
|
+
return False
|
|
69
|
+
|
|
70
|
+
return super().has_next_page()
|
|
71
|
+
|
|
72
|
+
@override
|
|
73
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
74
|
+
iterator = self.iterator
|
|
75
|
+
if not iterator:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
return PageInfo(params={"iterator": iterator})
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class AsyncCursorPagePagination(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
|
|
82
|
+
data: List[_T]
|
|
83
|
+
iterator: Optional[str] = None
|
|
84
|
+
done: Optional[bool] = None
|
|
85
|
+
|
|
86
|
+
@override
|
|
87
|
+
def _get_page_items(self) -> List[_T]:
|
|
88
|
+
data = self.data
|
|
89
|
+
if not data:
|
|
90
|
+
return []
|
|
91
|
+
return data
|
|
92
|
+
|
|
93
|
+
@override
|
|
94
|
+
def has_next_page(self) -> bool:
|
|
95
|
+
done = self.done
|
|
96
|
+
if done is not None and done is False:
|
|
97
|
+
return False
|
|
98
|
+
|
|
99
|
+
return super().has_next_page()
|
|
100
|
+
|
|
101
|
+
@override
|
|
102
|
+
def next_page_info(self) -> Optional[PageInfo]:
|
|
103
|
+
iterator = self.iterator
|
|
104
|
+
if not iterator:
|
|
105
|
+
return None
|
|
106
|
+
|
|
107
|
+
return PageInfo(params={"iterator": iterator})
|
|
@@ -80,6 +80,14 @@ from .products import (
|
|
|
80
80
|
ProductsResourceWithStreamingResponse,
|
|
81
81
|
AsyncProductsResourceWithStreamingResponse,
|
|
82
82
|
)
|
|
83
|
+
from .webhooks import (
|
|
84
|
+
WebhooksResource,
|
|
85
|
+
AsyncWebhooksResource,
|
|
86
|
+
WebhooksResourceWithRawResponse,
|
|
87
|
+
AsyncWebhooksResourceWithRawResponse,
|
|
88
|
+
WebhooksResourceWithStreamingResponse,
|
|
89
|
+
AsyncWebhooksResourceWithStreamingResponse,
|
|
90
|
+
)
|
|
83
91
|
from .customers import (
|
|
84
92
|
CustomersResource,
|
|
85
93
|
AsyncCustomersResource,
|
|
@@ -112,13 +120,13 @@ from .subscriptions import (
|
|
|
112
120
|
SubscriptionsResourceWithStreamingResponse,
|
|
113
121
|
AsyncSubscriptionsResourceWithStreamingResponse,
|
|
114
122
|
)
|
|
115
|
-
from .
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
from .your_webhook_url import (
|
|
124
|
+
YourWebhookURLResource,
|
|
125
|
+
AsyncYourWebhookURLResource,
|
|
126
|
+
YourWebhookURLResourceWithRawResponse,
|
|
127
|
+
AsyncYourWebhookURLResourceWithRawResponse,
|
|
128
|
+
YourWebhookURLResourceWithStreamingResponse,
|
|
129
|
+
AsyncYourWebhookURLResourceWithStreamingResponse,
|
|
122
130
|
)
|
|
123
131
|
from .license_key_instances import (
|
|
124
132
|
LicenseKeyInstancesResource,
|
|
@@ -190,12 +198,6 @@ __all__ = [
|
|
|
190
198
|
"AsyncPayoutsResourceWithRawResponse",
|
|
191
199
|
"PayoutsResourceWithStreamingResponse",
|
|
192
200
|
"AsyncPayoutsResourceWithStreamingResponse",
|
|
193
|
-
"WebhookEventsResource",
|
|
194
|
-
"AsyncWebhookEventsResource",
|
|
195
|
-
"WebhookEventsResourceWithRawResponse",
|
|
196
|
-
"AsyncWebhookEventsResourceWithRawResponse",
|
|
197
|
-
"WebhookEventsResourceWithStreamingResponse",
|
|
198
|
-
"AsyncWebhookEventsResourceWithStreamingResponse",
|
|
199
201
|
"ProductsResource",
|
|
200
202
|
"AsyncProductsResource",
|
|
201
203
|
"ProductsResourceWithRawResponse",
|
|
@@ -226,4 +228,16 @@ __all__ = [
|
|
|
226
228
|
"AsyncBrandsResourceWithRawResponse",
|
|
227
229
|
"BrandsResourceWithStreamingResponse",
|
|
228
230
|
"AsyncBrandsResourceWithStreamingResponse",
|
|
231
|
+
"WebhooksResource",
|
|
232
|
+
"AsyncWebhooksResource",
|
|
233
|
+
"WebhooksResourceWithRawResponse",
|
|
234
|
+
"AsyncWebhooksResourceWithRawResponse",
|
|
235
|
+
"WebhooksResourceWithStreamingResponse",
|
|
236
|
+
"AsyncWebhooksResourceWithStreamingResponse",
|
|
237
|
+
"YourWebhookURLResource",
|
|
238
|
+
"AsyncYourWebhookURLResource",
|
|
239
|
+
"YourWebhookURLResourceWithRawResponse",
|
|
240
|
+
"AsyncYourWebhookURLResourceWithRawResponse",
|
|
241
|
+
"YourWebhookURLResourceWithStreamingResponse",
|
|
242
|
+
"AsyncYourWebhookURLResourceWithStreamingResponse",
|
|
229
243
|
]
|
|
@@ -55,6 +55,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
55
55
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
56
56
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
57
57
|
restricted_to: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
58
|
+
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
58
59
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
59
60
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
60
61
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -88,6 +89,10 @@ class DiscountsResource(SyncAPIResource):
|
|
|
88
89
|
|
|
89
90
|
restricted_to: List of product IDs to restrict usage (if any).
|
|
90
91
|
|
|
92
|
+
subscription_cycles: Number of subscription billing cycles this discount is valid for. If not
|
|
93
|
+
provided, the discount will be applied indefinitely to all recurring payments
|
|
94
|
+
related to the subscription.
|
|
95
|
+
|
|
91
96
|
usage_limit: How many times this discount can be used (if any). Must be >= 1 if provided.
|
|
92
97
|
|
|
93
98
|
extra_headers: Send extra headers
|
|
@@ -108,6 +113,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
108
113
|
"expires_at": expires_at,
|
|
109
114
|
"name": name,
|
|
110
115
|
"restricted_to": restricted_to,
|
|
116
|
+
"subscription_cycles": subscription_cycles,
|
|
111
117
|
"usage_limit": usage_limit,
|
|
112
118
|
},
|
|
113
119
|
discount_create_params.DiscountCreateParams,
|
|
@@ -160,6 +166,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
160
166
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
161
167
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
162
168
|
restricted_to: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
169
|
+
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
163
170
|
type: Optional[DiscountType] | NotGiven = NOT_GIVEN,
|
|
164
171
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
165
172
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -187,6 +194,10 @@ class DiscountsResource(SyncAPIResource):
|
|
|
187
194
|
restricted_to: If present, replaces all restricted product IDs with this new set. To remove all
|
|
188
195
|
restrictions, send empty array
|
|
189
196
|
|
|
197
|
+
subscription_cycles: Number of subscription billing cycles this discount is valid for. If not
|
|
198
|
+
provided, the discount will be applied indefinitely to all recurring payments
|
|
199
|
+
related to the subscription.
|
|
200
|
+
|
|
190
201
|
type: If present, update the discount type.
|
|
191
202
|
|
|
192
203
|
extra_headers: Send extra headers
|
|
@@ -208,6 +219,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
208
219
|
"expires_at": expires_at,
|
|
209
220
|
"name": name,
|
|
210
221
|
"restricted_to": restricted_to,
|
|
222
|
+
"subscription_cycles": subscription_cycles,
|
|
211
223
|
"type": type,
|
|
212
224
|
"usage_limit": usage_limit,
|
|
213
225
|
},
|
|
@@ -330,6 +342,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
330
342
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
331
343
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
332
344
|
restricted_to: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
345
|
+
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
333
346
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
334
347
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
335
348
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -363,6 +376,10 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
363
376
|
|
|
364
377
|
restricted_to: List of product IDs to restrict usage (if any).
|
|
365
378
|
|
|
379
|
+
subscription_cycles: Number of subscription billing cycles this discount is valid for. If not
|
|
380
|
+
provided, the discount will be applied indefinitely to all recurring payments
|
|
381
|
+
related to the subscription.
|
|
382
|
+
|
|
366
383
|
usage_limit: How many times this discount can be used (if any). Must be >= 1 if provided.
|
|
367
384
|
|
|
368
385
|
extra_headers: Send extra headers
|
|
@@ -383,6 +400,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
383
400
|
"expires_at": expires_at,
|
|
384
401
|
"name": name,
|
|
385
402
|
"restricted_to": restricted_to,
|
|
403
|
+
"subscription_cycles": subscription_cycles,
|
|
386
404
|
"usage_limit": usage_limit,
|
|
387
405
|
},
|
|
388
406
|
discount_create_params.DiscountCreateParams,
|
|
@@ -435,6 +453,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
435
453
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
436
454
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
437
455
|
restricted_to: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
456
|
+
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
438
457
|
type: Optional[DiscountType] | NotGiven = NOT_GIVEN,
|
|
439
458
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
440
459
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -462,6 +481,10 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
462
481
|
restricted_to: If present, replaces all restricted product IDs with this new set. To remove all
|
|
463
482
|
restrictions, send empty array
|
|
464
483
|
|
|
484
|
+
subscription_cycles: Number of subscription billing cycles this discount is valid for. If not
|
|
485
|
+
provided, the discount will be applied indefinitely to all recurring payments
|
|
486
|
+
related to the subscription.
|
|
487
|
+
|
|
465
488
|
type: If present, update the discount type.
|
|
466
489
|
|
|
467
490
|
extra_headers: Send extra headers
|
|
@@ -483,6 +506,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
483
506
|
"expires_at": expires_at,
|
|
484
507
|
"name": name,
|
|
485
508
|
"restricted_to": restricted_to,
|
|
509
|
+
"subscription_cycles": subscription_cycles,
|
|
486
510
|
"type": type,
|
|
487
511
|
"usage_limit": usage_limit,
|
|
488
512
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import List, Optional
|
|
5
|
+
from typing import Dict, List, Optional
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
@@ -80,6 +80,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
80
80
|
license_key_activations_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
81
81
|
license_key_duration: Optional[LicenseKeyDurationParam] | NotGiven = NOT_GIVEN,
|
|
82
82
|
license_key_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
83
|
+
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
83
84
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
84
85
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
85
86
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -112,6 +113,8 @@ class ProductsResource(SyncAPIResource):
|
|
|
112
113
|
|
|
113
114
|
license_key_enabled: When true, generates and sends a license key to your customer. Defaults to false
|
|
114
115
|
|
|
116
|
+
metadata: Additional metadata for the product
|
|
117
|
+
|
|
115
118
|
name: Optional name of the product
|
|
116
119
|
|
|
117
120
|
extra_headers: Send extra headers
|
|
@@ -136,6 +139,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
136
139
|
"license_key_activations_limit": license_key_activations_limit,
|
|
137
140
|
"license_key_duration": license_key_duration,
|
|
138
141
|
"license_key_enabled": license_key_enabled,
|
|
142
|
+
"metadata": metadata,
|
|
139
143
|
"name": name,
|
|
140
144
|
},
|
|
141
145
|
product_create_params.ProductCreateParams,
|
|
@@ -190,6 +194,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
190
194
|
license_key_activations_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
191
195
|
license_key_duration: Optional[LicenseKeyDurationParam] | NotGiven = NOT_GIVEN,
|
|
192
196
|
license_key_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
197
|
+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
193
198
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
194
199
|
price: Optional[PriceParam] | NotGiven = NOT_GIVEN,
|
|
195
200
|
tax_category: Optional[TaxCategory] | NotGiven = NOT_GIVEN,
|
|
@@ -230,6 +235,8 @@ class ProductsResource(SyncAPIResource):
|
|
|
230
235
|
If `true`, additional fields related to license key (duration, activations
|
|
231
236
|
limit, activation message) become applicable.
|
|
232
237
|
|
|
238
|
+
metadata: Additional metadata for the product
|
|
239
|
+
|
|
233
240
|
name: Name of the product, optional and must be at most 100 characters.
|
|
234
241
|
|
|
235
242
|
price: Price details of the product.
|
|
@@ -260,6 +267,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
260
267
|
"license_key_activations_limit": license_key_activations_limit,
|
|
261
268
|
"license_key_duration": license_key_duration,
|
|
262
269
|
"license_key_enabled": license_key_enabled,
|
|
270
|
+
"metadata": metadata,
|
|
263
271
|
"name": name,
|
|
264
272
|
"price": price,
|
|
265
273
|
"tax_category": tax_category,
|
|
@@ -469,6 +477,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
469
477
|
license_key_activations_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
470
478
|
license_key_duration: Optional[LicenseKeyDurationParam] | NotGiven = NOT_GIVEN,
|
|
471
479
|
license_key_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
480
|
+
metadata: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
472
481
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
473
482
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
474
483
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -501,6 +510,8 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
501
510
|
|
|
502
511
|
license_key_enabled: When true, generates and sends a license key to your customer. Defaults to false
|
|
503
512
|
|
|
513
|
+
metadata: Additional metadata for the product
|
|
514
|
+
|
|
504
515
|
name: Optional name of the product
|
|
505
516
|
|
|
506
517
|
extra_headers: Send extra headers
|
|
@@ -525,6 +536,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
525
536
|
"license_key_activations_limit": license_key_activations_limit,
|
|
526
537
|
"license_key_duration": license_key_duration,
|
|
527
538
|
"license_key_enabled": license_key_enabled,
|
|
539
|
+
"metadata": metadata,
|
|
528
540
|
"name": name,
|
|
529
541
|
},
|
|
530
542
|
product_create_params.ProductCreateParams,
|
|
@@ -579,6 +591,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
579
591
|
license_key_activations_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
580
592
|
license_key_duration: Optional[LicenseKeyDurationParam] | NotGiven = NOT_GIVEN,
|
|
581
593
|
license_key_enabled: Optional[bool] | NotGiven = NOT_GIVEN,
|
|
594
|
+
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
582
595
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
583
596
|
price: Optional[PriceParam] | NotGiven = NOT_GIVEN,
|
|
584
597
|
tax_category: Optional[TaxCategory] | NotGiven = NOT_GIVEN,
|
|
@@ -619,6 +632,8 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
619
632
|
If `true`, additional fields related to license key (duration, activations
|
|
620
633
|
limit, activation message) become applicable.
|
|
621
634
|
|
|
635
|
+
metadata: Additional metadata for the product
|
|
636
|
+
|
|
622
637
|
name: Name of the product, optional and must be at most 100 characters.
|
|
623
638
|
|
|
624
639
|
price: Price details of the product.
|
|
@@ -649,6 +664,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
649
664
|
"license_key_activations_limit": license_key_activations_limit,
|
|
650
665
|
"license_key_duration": license_key_duration,
|
|
651
666
|
"license_key_enabled": license_key_enabled,
|
|
667
|
+
"metadata": metadata,
|
|
652
668
|
"name": name,
|
|
653
669
|
"price": price,
|
|
654
670
|
"tax_category": tax_category,
|
|
@@ -250,8 +250,7 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
250
250
|
customer_id: str | NotGiven = NOT_GIVEN,
|
|
251
251
|
page_number: int | NotGiven = NOT_GIVEN,
|
|
252
252
|
page_size: int | NotGiven = NOT_GIVEN,
|
|
253
|
-
status: Literal["pending", "active", "on_hold", "
|
|
254
|
-
| NotGiven = NOT_GIVEN,
|
|
253
|
+
status: Literal["pending", "active", "on_hold", "cancelled", "failed", "expired"] | NotGiven = NOT_GIVEN,
|
|
255
254
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
256
255
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
257
256
|
extra_headers: Headers | None = None,
|
|
@@ -312,7 +311,7 @@ class SubscriptionsResource(SyncAPIResource):
|
|
|
312
311
|
subscription_id: str,
|
|
313
312
|
*,
|
|
314
313
|
product_id: str,
|
|
315
|
-
proration_billing_mode: Literal["prorated_immediately", "full_immediately"],
|
|
314
|
+
proration_billing_mode: Literal["prorated_immediately", "full_immediately", "difference_immediately"],
|
|
316
315
|
quantity: int,
|
|
317
316
|
addons: Optional[Iterable[AttachAddonParam]] | NotGiven = NOT_GIVEN,
|
|
318
317
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -632,8 +631,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
632
631
|
customer_id: str | NotGiven = NOT_GIVEN,
|
|
633
632
|
page_number: int | NotGiven = NOT_GIVEN,
|
|
634
633
|
page_size: int | NotGiven = NOT_GIVEN,
|
|
635
|
-
status: Literal["pending", "active", "on_hold", "
|
|
636
|
-
| NotGiven = NOT_GIVEN,
|
|
634
|
+
status: Literal["pending", "active", "on_hold", "cancelled", "failed", "expired"] | NotGiven = NOT_GIVEN,
|
|
637
635
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
638
636
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
639
637
|
extra_headers: Headers | None = None,
|
|
@@ -694,7 +692,7 @@ class AsyncSubscriptionsResource(AsyncAPIResource):
|
|
|
694
692
|
subscription_id: str,
|
|
695
693
|
*,
|
|
696
694
|
product_id: str,
|
|
697
|
-
proration_billing_mode: Literal["prorated_immediately", "full_immediately"],
|
|
695
|
+
proration_billing_mode: Literal["prorated_immediately", "full_immediately", "difference_immediately"],
|
|
698
696
|
quantity: int,
|
|
699
697
|
addons: Optional[Iterable[AttachAddonParam]] | NotGiven = NOT_GIVEN,
|
|
700
698
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .headers import (
|
|
4
|
+
HeadersResource,
|
|
5
|
+
AsyncHeadersResource,
|
|
6
|
+
HeadersResourceWithRawResponse,
|
|
7
|
+
AsyncHeadersResourceWithRawResponse,
|
|
8
|
+
HeadersResourceWithStreamingResponse,
|
|
9
|
+
AsyncHeadersResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .webhooks import (
|
|
12
|
+
WebhooksResource,
|
|
13
|
+
AsyncWebhooksResource,
|
|
14
|
+
WebhooksResourceWithRawResponse,
|
|
15
|
+
AsyncWebhooksResourceWithRawResponse,
|
|
16
|
+
WebhooksResourceWithStreamingResponse,
|
|
17
|
+
AsyncWebhooksResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"HeadersResource",
|
|
22
|
+
"AsyncHeadersResource",
|
|
23
|
+
"HeadersResourceWithRawResponse",
|
|
24
|
+
"AsyncHeadersResourceWithRawResponse",
|
|
25
|
+
"HeadersResourceWithStreamingResponse",
|
|
26
|
+
"AsyncHeadersResourceWithStreamingResponse",
|
|
27
|
+
"WebhooksResource",
|
|
28
|
+
"AsyncWebhooksResource",
|
|
29
|
+
"WebhooksResourceWithRawResponse",
|
|
30
|
+
"AsyncWebhooksResourceWithRawResponse",
|
|
31
|
+
"WebhooksResourceWithStreamingResponse",
|
|
32
|
+
"AsyncWebhooksResourceWithStreamingResponse",
|
|
33
|
+
]
|