dodopayments 1.19.0__py3-none-any.whl → 1.21.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.
- dodopayments/_client.py +9 -0
- dodopayments/_version.py +1 -1
- dodopayments/resources/__init__.py +14 -0
- dodopayments/resources/addons.py +589 -0
- dodopayments/resources/payments.py +4 -301
- dodopayments/resources/products/products.py +11 -6
- dodopayments/resources/subscriptions.py +20 -307
- dodopayments/types/__init__.py +9 -0
- dodopayments/types/addon_cart_response_item.py +11 -0
- dodopayments/types/addon_create_params.py +30 -0
- dodopayments/types/addon_list_params.py +16 -0
- dodopayments/types/addon_response.py +44 -0
- dodopayments/types/addon_update_images_response.py +11 -0
- dodopayments/types/addon_update_params.py +33 -0
- dodopayments/types/currency.py +153 -0
- dodopayments/types/payment.py +3 -295
- dodopayments/types/payment_create_params.py +2 -149
- dodopayments/types/payment_list_response.py +2 -148
- dodopayments/types/payout_list_response.py +2 -147
- dodopayments/types/price.py +3 -294
- dodopayments/types/price_param.py +3 -298
- dodopayments/types/product.py +2 -2
- dodopayments/types/product_create_params.py +3 -2
- dodopayments/types/product_list_response.py +4 -151
- dodopayments/types/product_update_params.py +3 -2
- dodopayments/types/refund.py +2 -150
- dodopayments/types/subscription.py +7 -149
- dodopayments/types/subscription_create_params.py +13 -151
- dodopayments/types/subscription_create_response.py +5 -1
- dodopayments/types/subscription_list_response.py +77 -0
- dodopayments/types/tax_category.py +7 -0
- {dodopayments-1.19.0.dist-info → dodopayments-1.21.0.dist-info}/METADATA +1 -1
- {dodopayments-1.19.0.dist-info → dodopayments-1.21.0.dist-info}/RECORD +35 -25
- {dodopayments-1.19.0.dist-info → dodopayments-1.21.0.dist-info}/WHEEL +0 -0
- {dodopayments-1.19.0.dist-info → dodopayments-1.21.0.dist-info}/licenses/LICENSE +0 -0
dodopayments/_client.py
CHANGED
|
@@ -23,6 +23,7 @@ from ._utils import is_given, get_async_library
|
|
|
23
23
|
from ._version import __version__
|
|
24
24
|
from .resources import (
|
|
25
25
|
misc,
|
|
26
|
+
addons,
|
|
26
27
|
payouts,
|
|
27
28
|
refunds,
|
|
28
29
|
disputes,
|
|
@@ -78,6 +79,7 @@ class DodoPayments(SyncAPIClient):
|
|
|
78
79
|
products: products.ProductsResource
|
|
79
80
|
misc: misc.MiscResource
|
|
80
81
|
discounts: discounts.DiscountsResource
|
|
82
|
+
addons: addons.AddonsResource
|
|
81
83
|
with_raw_response: DodoPaymentsWithRawResponse
|
|
82
84
|
with_streaming_response: DodoPaymentsWithStreamedResponse
|
|
83
85
|
|
|
@@ -173,6 +175,7 @@ class DodoPayments(SyncAPIClient):
|
|
|
173
175
|
self.products = products.ProductsResource(self)
|
|
174
176
|
self.misc = misc.MiscResource(self)
|
|
175
177
|
self.discounts = discounts.DiscountsResource(self)
|
|
178
|
+
self.addons = addons.AddonsResource(self)
|
|
176
179
|
self.with_raw_response = DodoPaymentsWithRawResponse(self)
|
|
177
180
|
self.with_streaming_response = DodoPaymentsWithStreamedResponse(self)
|
|
178
181
|
|
|
@@ -298,6 +301,7 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
298
301
|
products: products.AsyncProductsResource
|
|
299
302
|
misc: misc.AsyncMiscResource
|
|
300
303
|
discounts: discounts.AsyncDiscountsResource
|
|
304
|
+
addons: addons.AsyncAddonsResource
|
|
301
305
|
with_raw_response: AsyncDodoPaymentsWithRawResponse
|
|
302
306
|
with_streaming_response: AsyncDodoPaymentsWithStreamedResponse
|
|
303
307
|
|
|
@@ -393,6 +397,7 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
393
397
|
self.products = products.AsyncProductsResource(self)
|
|
394
398
|
self.misc = misc.AsyncMiscResource(self)
|
|
395
399
|
self.discounts = discounts.AsyncDiscountsResource(self)
|
|
400
|
+
self.addons = addons.AsyncAddonsResource(self)
|
|
396
401
|
self.with_raw_response = AsyncDodoPaymentsWithRawResponse(self)
|
|
397
402
|
self.with_streaming_response = AsyncDodoPaymentsWithStreamedResponse(self)
|
|
398
403
|
|
|
@@ -521,6 +526,7 @@ class DodoPaymentsWithRawResponse:
|
|
|
521
526
|
self.products = products.ProductsResourceWithRawResponse(client.products)
|
|
522
527
|
self.misc = misc.MiscResourceWithRawResponse(client.misc)
|
|
523
528
|
self.discounts = discounts.DiscountsResourceWithRawResponse(client.discounts)
|
|
529
|
+
self.addons = addons.AddonsResourceWithRawResponse(client.addons)
|
|
524
530
|
|
|
525
531
|
|
|
526
532
|
class AsyncDodoPaymentsWithRawResponse:
|
|
@@ -541,6 +547,7 @@ class AsyncDodoPaymentsWithRawResponse:
|
|
|
541
547
|
self.products = products.AsyncProductsResourceWithRawResponse(client.products)
|
|
542
548
|
self.misc = misc.AsyncMiscResourceWithRawResponse(client.misc)
|
|
543
549
|
self.discounts = discounts.AsyncDiscountsResourceWithRawResponse(client.discounts)
|
|
550
|
+
self.addons = addons.AsyncAddonsResourceWithRawResponse(client.addons)
|
|
544
551
|
|
|
545
552
|
|
|
546
553
|
class DodoPaymentsWithStreamedResponse:
|
|
@@ -561,6 +568,7 @@ class DodoPaymentsWithStreamedResponse:
|
|
|
561
568
|
self.products = products.ProductsResourceWithStreamingResponse(client.products)
|
|
562
569
|
self.misc = misc.MiscResourceWithStreamingResponse(client.misc)
|
|
563
570
|
self.discounts = discounts.DiscountsResourceWithStreamingResponse(client.discounts)
|
|
571
|
+
self.addons = addons.AddonsResourceWithStreamingResponse(client.addons)
|
|
564
572
|
|
|
565
573
|
|
|
566
574
|
class AsyncDodoPaymentsWithStreamedResponse:
|
|
@@ -581,6 +589,7 @@ class AsyncDodoPaymentsWithStreamedResponse:
|
|
|
581
589
|
self.products = products.AsyncProductsResourceWithStreamingResponse(client.products)
|
|
582
590
|
self.misc = misc.AsyncMiscResourceWithStreamingResponse(client.misc)
|
|
583
591
|
self.discounts = discounts.AsyncDiscountsResourceWithStreamingResponse(client.discounts)
|
|
592
|
+
self.addons = addons.AsyncAddonsResourceWithStreamingResponse(client.addons)
|
|
584
593
|
|
|
585
594
|
|
|
586
595
|
Client = DodoPayments
|
dodopayments/_version.py
CHANGED
|
@@ -8,6 +8,14 @@ from .misc import (
|
|
|
8
8
|
MiscResourceWithStreamingResponse,
|
|
9
9
|
AsyncMiscResourceWithStreamingResponse,
|
|
10
10
|
)
|
|
11
|
+
from .addons import (
|
|
12
|
+
AddonsResource,
|
|
13
|
+
AsyncAddonsResource,
|
|
14
|
+
AddonsResourceWithRawResponse,
|
|
15
|
+
AsyncAddonsResourceWithRawResponse,
|
|
16
|
+
AddonsResourceWithStreamingResponse,
|
|
17
|
+
AsyncAddonsResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
11
19
|
from .payouts import (
|
|
12
20
|
PayoutsResource,
|
|
13
21
|
AsyncPayoutsResource,
|
|
@@ -198,4 +206,10 @@ __all__ = [
|
|
|
198
206
|
"AsyncDiscountsResourceWithRawResponse",
|
|
199
207
|
"DiscountsResourceWithStreamingResponse",
|
|
200
208
|
"AsyncDiscountsResourceWithStreamingResponse",
|
|
209
|
+
"AddonsResource",
|
|
210
|
+
"AsyncAddonsResource",
|
|
211
|
+
"AddonsResourceWithRawResponse",
|
|
212
|
+
"AsyncAddonsResourceWithRawResponse",
|
|
213
|
+
"AddonsResourceWithStreamingResponse",
|
|
214
|
+
"AsyncAddonsResourceWithStreamingResponse",
|
|
201
215
|
]
|
|
@@ -0,0 +1,589 @@
|
|
|
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 Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import Currency, TaxCategory, addon_list_params, addon_create_params, addon_update_params
|
|
10
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from .._compat import cached_property
|
|
13
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from .._response import (
|
|
15
|
+
to_raw_response_wrapper,
|
|
16
|
+
to_streamed_response_wrapper,
|
|
17
|
+
async_to_raw_response_wrapper,
|
|
18
|
+
async_to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
20
|
+
from ..pagination import SyncDefaultPageNumberPagination, AsyncDefaultPageNumberPagination
|
|
21
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
22
|
+
from ..types.currency import Currency
|
|
23
|
+
from ..types.tax_category import TaxCategory
|
|
24
|
+
from ..types.addon_response import AddonResponse
|
|
25
|
+
from ..types.addon_update_images_response import AddonUpdateImagesResponse
|
|
26
|
+
|
|
27
|
+
__all__ = ["AddonsResource", "AsyncAddonsResource"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class AddonsResource(SyncAPIResource):
|
|
31
|
+
@cached_property
|
|
32
|
+
def with_raw_response(self) -> AddonsResourceWithRawResponse:
|
|
33
|
+
"""
|
|
34
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
35
|
+
the raw response object instead of the parsed content.
|
|
36
|
+
|
|
37
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
38
|
+
"""
|
|
39
|
+
return AddonsResourceWithRawResponse(self)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_streaming_response(self) -> AddonsResourceWithStreamingResponse:
|
|
43
|
+
"""
|
|
44
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
45
|
+
|
|
46
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
47
|
+
"""
|
|
48
|
+
return AddonsResourceWithStreamingResponse(self)
|
|
49
|
+
|
|
50
|
+
def create(
|
|
51
|
+
self,
|
|
52
|
+
*,
|
|
53
|
+
currency: Currency,
|
|
54
|
+
name: str,
|
|
55
|
+
price: int,
|
|
56
|
+
tax_category: TaxCategory,
|
|
57
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
58
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
59
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
60
|
+
extra_headers: Headers | None = None,
|
|
61
|
+
extra_query: Query | None = None,
|
|
62
|
+
extra_body: Body | None = None,
|
|
63
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
64
|
+
) -> AddonResponse:
|
|
65
|
+
"""
|
|
66
|
+
Args:
|
|
67
|
+
name: Name of the Addon
|
|
68
|
+
|
|
69
|
+
price: Amount of the addon
|
|
70
|
+
|
|
71
|
+
tax_category: Represents the different categories of taxation applicable to various products
|
|
72
|
+
and services.
|
|
73
|
+
|
|
74
|
+
description: Optional description of the Addon
|
|
75
|
+
|
|
76
|
+
extra_headers: Send extra headers
|
|
77
|
+
|
|
78
|
+
extra_query: Add additional query parameters to the request
|
|
79
|
+
|
|
80
|
+
extra_body: Add additional JSON properties to the request
|
|
81
|
+
|
|
82
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
83
|
+
"""
|
|
84
|
+
return self._post(
|
|
85
|
+
"/addons",
|
|
86
|
+
body=maybe_transform(
|
|
87
|
+
{
|
|
88
|
+
"currency": currency,
|
|
89
|
+
"name": name,
|
|
90
|
+
"price": price,
|
|
91
|
+
"tax_category": tax_category,
|
|
92
|
+
"description": description,
|
|
93
|
+
},
|
|
94
|
+
addon_create_params.AddonCreateParams,
|
|
95
|
+
),
|
|
96
|
+
options=make_request_options(
|
|
97
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
98
|
+
),
|
|
99
|
+
cast_to=AddonResponse,
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
def retrieve(
|
|
103
|
+
self,
|
|
104
|
+
id: str,
|
|
105
|
+
*,
|
|
106
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
107
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
108
|
+
extra_headers: Headers | None = None,
|
|
109
|
+
extra_query: Query | None = None,
|
|
110
|
+
extra_body: Body | None = None,
|
|
111
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
112
|
+
) -> AddonResponse:
|
|
113
|
+
"""
|
|
114
|
+
Args:
|
|
115
|
+
extra_headers: Send extra headers
|
|
116
|
+
|
|
117
|
+
extra_query: Add additional query parameters to the request
|
|
118
|
+
|
|
119
|
+
extra_body: Add additional JSON properties to the request
|
|
120
|
+
|
|
121
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
122
|
+
"""
|
|
123
|
+
if not id:
|
|
124
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
125
|
+
return self._get(
|
|
126
|
+
f"/addons/{id}",
|
|
127
|
+
options=make_request_options(
|
|
128
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
129
|
+
),
|
|
130
|
+
cast_to=AddonResponse,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
def update(
|
|
134
|
+
self,
|
|
135
|
+
id: str,
|
|
136
|
+
*,
|
|
137
|
+
currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
138
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
139
|
+
image_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
140
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
141
|
+
price: Optional[int] | NotGiven = NOT_GIVEN,
|
|
142
|
+
tax_category: Optional[TaxCategory] | NotGiven = NOT_GIVEN,
|
|
143
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
144
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
145
|
+
extra_headers: Headers | None = None,
|
|
146
|
+
extra_query: Query | None = None,
|
|
147
|
+
extra_body: Body | None = None,
|
|
148
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
149
|
+
) -> AddonResponse:
|
|
150
|
+
"""
|
|
151
|
+
Args:
|
|
152
|
+
description: Description of the Addon, optional and must be at most 1000 characters.
|
|
153
|
+
|
|
154
|
+
image_id: Addon image id after its uploaded to S3
|
|
155
|
+
|
|
156
|
+
name: Name of the Addon, optional and must be at most 100 characters.
|
|
157
|
+
|
|
158
|
+
price: Amount of the addon
|
|
159
|
+
|
|
160
|
+
tax_category: Represents the different categories of taxation applicable to various products
|
|
161
|
+
and services.
|
|
162
|
+
|
|
163
|
+
extra_headers: Send extra headers
|
|
164
|
+
|
|
165
|
+
extra_query: Add additional query parameters to the request
|
|
166
|
+
|
|
167
|
+
extra_body: Add additional JSON properties to the request
|
|
168
|
+
|
|
169
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
170
|
+
"""
|
|
171
|
+
if not id:
|
|
172
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
173
|
+
return self._patch(
|
|
174
|
+
f"/addons/{id}",
|
|
175
|
+
body=maybe_transform(
|
|
176
|
+
{
|
|
177
|
+
"currency": currency,
|
|
178
|
+
"description": description,
|
|
179
|
+
"image_id": image_id,
|
|
180
|
+
"name": name,
|
|
181
|
+
"price": price,
|
|
182
|
+
"tax_category": tax_category,
|
|
183
|
+
},
|
|
184
|
+
addon_update_params.AddonUpdateParams,
|
|
185
|
+
),
|
|
186
|
+
options=make_request_options(
|
|
187
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
188
|
+
),
|
|
189
|
+
cast_to=AddonResponse,
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
def list(
|
|
193
|
+
self,
|
|
194
|
+
*,
|
|
195
|
+
page_number: Optional[int] | NotGiven = NOT_GIVEN,
|
|
196
|
+
page_size: Optional[int] | NotGiven = NOT_GIVEN,
|
|
197
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
198
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
199
|
+
extra_headers: Headers | None = None,
|
|
200
|
+
extra_query: Query | None = None,
|
|
201
|
+
extra_body: Body | None = None,
|
|
202
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
203
|
+
) -> SyncDefaultPageNumberPagination[AddonResponse]:
|
|
204
|
+
"""
|
|
205
|
+
Args:
|
|
206
|
+
page_number: Page number default is 0
|
|
207
|
+
|
|
208
|
+
page_size: Page size default is 10 max is 100
|
|
209
|
+
|
|
210
|
+
extra_headers: Send extra headers
|
|
211
|
+
|
|
212
|
+
extra_query: Add additional query parameters to the request
|
|
213
|
+
|
|
214
|
+
extra_body: Add additional JSON properties to the request
|
|
215
|
+
|
|
216
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
217
|
+
"""
|
|
218
|
+
return self._get_api_list(
|
|
219
|
+
"/addons",
|
|
220
|
+
page=SyncDefaultPageNumberPagination[AddonResponse],
|
|
221
|
+
options=make_request_options(
|
|
222
|
+
extra_headers=extra_headers,
|
|
223
|
+
extra_query=extra_query,
|
|
224
|
+
extra_body=extra_body,
|
|
225
|
+
timeout=timeout,
|
|
226
|
+
query=maybe_transform(
|
|
227
|
+
{
|
|
228
|
+
"page_number": page_number,
|
|
229
|
+
"page_size": page_size,
|
|
230
|
+
},
|
|
231
|
+
addon_list_params.AddonListParams,
|
|
232
|
+
),
|
|
233
|
+
),
|
|
234
|
+
model=AddonResponse,
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
def update_images(
|
|
238
|
+
self,
|
|
239
|
+
id: str,
|
|
240
|
+
*,
|
|
241
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
242
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
243
|
+
extra_headers: Headers | None = None,
|
|
244
|
+
extra_query: Query | None = None,
|
|
245
|
+
extra_body: Body | None = None,
|
|
246
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
247
|
+
) -> AddonUpdateImagesResponse:
|
|
248
|
+
"""
|
|
249
|
+
Args:
|
|
250
|
+
extra_headers: Send extra headers
|
|
251
|
+
|
|
252
|
+
extra_query: Add additional query parameters to the request
|
|
253
|
+
|
|
254
|
+
extra_body: Add additional JSON properties to the request
|
|
255
|
+
|
|
256
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
257
|
+
"""
|
|
258
|
+
if not id:
|
|
259
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
260
|
+
return self._put(
|
|
261
|
+
f"/addons/{id}/images",
|
|
262
|
+
options=make_request_options(
|
|
263
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
264
|
+
),
|
|
265
|
+
cast_to=AddonUpdateImagesResponse,
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
class AsyncAddonsResource(AsyncAPIResource):
|
|
270
|
+
@cached_property
|
|
271
|
+
def with_raw_response(self) -> AsyncAddonsResourceWithRawResponse:
|
|
272
|
+
"""
|
|
273
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
274
|
+
the raw response object instead of the parsed content.
|
|
275
|
+
|
|
276
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
277
|
+
"""
|
|
278
|
+
return AsyncAddonsResourceWithRawResponse(self)
|
|
279
|
+
|
|
280
|
+
@cached_property
|
|
281
|
+
def with_streaming_response(self) -> AsyncAddonsResourceWithStreamingResponse:
|
|
282
|
+
"""
|
|
283
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
284
|
+
|
|
285
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
286
|
+
"""
|
|
287
|
+
return AsyncAddonsResourceWithStreamingResponse(self)
|
|
288
|
+
|
|
289
|
+
async def create(
|
|
290
|
+
self,
|
|
291
|
+
*,
|
|
292
|
+
currency: Currency,
|
|
293
|
+
name: str,
|
|
294
|
+
price: int,
|
|
295
|
+
tax_category: TaxCategory,
|
|
296
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
297
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
298
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
299
|
+
extra_headers: Headers | None = None,
|
|
300
|
+
extra_query: Query | None = None,
|
|
301
|
+
extra_body: Body | None = None,
|
|
302
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
303
|
+
) -> AddonResponse:
|
|
304
|
+
"""
|
|
305
|
+
Args:
|
|
306
|
+
name: Name of the Addon
|
|
307
|
+
|
|
308
|
+
price: Amount of the addon
|
|
309
|
+
|
|
310
|
+
tax_category: Represents the different categories of taxation applicable to various products
|
|
311
|
+
and services.
|
|
312
|
+
|
|
313
|
+
description: Optional description of the Addon
|
|
314
|
+
|
|
315
|
+
extra_headers: Send extra headers
|
|
316
|
+
|
|
317
|
+
extra_query: Add additional query parameters to the request
|
|
318
|
+
|
|
319
|
+
extra_body: Add additional JSON properties to the request
|
|
320
|
+
|
|
321
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
322
|
+
"""
|
|
323
|
+
return await self._post(
|
|
324
|
+
"/addons",
|
|
325
|
+
body=await async_maybe_transform(
|
|
326
|
+
{
|
|
327
|
+
"currency": currency,
|
|
328
|
+
"name": name,
|
|
329
|
+
"price": price,
|
|
330
|
+
"tax_category": tax_category,
|
|
331
|
+
"description": description,
|
|
332
|
+
},
|
|
333
|
+
addon_create_params.AddonCreateParams,
|
|
334
|
+
),
|
|
335
|
+
options=make_request_options(
|
|
336
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
337
|
+
),
|
|
338
|
+
cast_to=AddonResponse,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
async def retrieve(
|
|
342
|
+
self,
|
|
343
|
+
id: str,
|
|
344
|
+
*,
|
|
345
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
346
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
347
|
+
extra_headers: Headers | None = None,
|
|
348
|
+
extra_query: Query | None = None,
|
|
349
|
+
extra_body: Body | None = None,
|
|
350
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
351
|
+
) -> AddonResponse:
|
|
352
|
+
"""
|
|
353
|
+
Args:
|
|
354
|
+
extra_headers: Send extra headers
|
|
355
|
+
|
|
356
|
+
extra_query: Add additional query parameters to the request
|
|
357
|
+
|
|
358
|
+
extra_body: Add additional JSON properties to the request
|
|
359
|
+
|
|
360
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
361
|
+
"""
|
|
362
|
+
if not id:
|
|
363
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
364
|
+
return await self._get(
|
|
365
|
+
f"/addons/{id}",
|
|
366
|
+
options=make_request_options(
|
|
367
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
368
|
+
),
|
|
369
|
+
cast_to=AddonResponse,
|
|
370
|
+
)
|
|
371
|
+
|
|
372
|
+
async def update(
|
|
373
|
+
self,
|
|
374
|
+
id: str,
|
|
375
|
+
*,
|
|
376
|
+
currency: Optional[Currency] | NotGiven = NOT_GIVEN,
|
|
377
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
378
|
+
image_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
379
|
+
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
380
|
+
price: Optional[int] | NotGiven = NOT_GIVEN,
|
|
381
|
+
tax_category: Optional[TaxCategory] | NotGiven = NOT_GIVEN,
|
|
382
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
383
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
384
|
+
extra_headers: Headers | None = None,
|
|
385
|
+
extra_query: Query | None = None,
|
|
386
|
+
extra_body: Body | None = None,
|
|
387
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
388
|
+
) -> AddonResponse:
|
|
389
|
+
"""
|
|
390
|
+
Args:
|
|
391
|
+
description: Description of the Addon, optional and must be at most 1000 characters.
|
|
392
|
+
|
|
393
|
+
image_id: Addon image id after its uploaded to S3
|
|
394
|
+
|
|
395
|
+
name: Name of the Addon, optional and must be at most 100 characters.
|
|
396
|
+
|
|
397
|
+
price: Amount of the addon
|
|
398
|
+
|
|
399
|
+
tax_category: Represents the different categories of taxation applicable to various products
|
|
400
|
+
and services.
|
|
401
|
+
|
|
402
|
+
extra_headers: Send extra headers
|
|
403
|
+
|
|
404
|
+
extra_query: Add additional query parameters to the request
|
|
405
|
+
|
|
406
|
+
extra_body: Add additional JSON properties to the request
|
|
407
|
+
|
|
408
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
409
|
+
"""
|
|
410
|
+
if not id:
|
|
411
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
412
|
+
return await self._patch(
|
|
413
|
+
f"/addons/{id}",
|
|
414
|
+
body=await async_maybe_transform(
|
|
415
|
+
{
|
|
416
|
+
"currency": currency,
|
|
417
|
+
"description": description,
|
|
418
|
+
"image_id": image_id,
|
|
419
|
+
"name": name,
|
|
420
|
+
"price": price,
|
|
421
|
+
"tax_category": tax_category,
|
|
422
|
+
},
|
|
423
|
+
addon_update_params.AddonUpdateParams,
|
|
424
|
+
),
|
|
425
|
+
options=make_request_options(
|
|
426
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
427
|
+
),
|
|
428
|
+
cast_to=AddonResponse,
|
|
429
|
+
)
|
|
430
|
+
|
|
431
|
+
def list(
|
|
432
|
+
self,
|
|
433
|
+
*,
|
|
434
|
+
page_number: Optional[int] | NotGiven = NOT_GIVEN,
|
|
435
|
+
page_size: Optional[int] | NotGiven = NOT_GIVEN,
|
|
436
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
437
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
438
|
+
extra_headers: Headers | None = None,
|
|
439
|
+
extra_query: Query | None = None,
|
|
440
|
+
extra_body: Body | None = None,
|
|
441
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
442
|
+
) -> AsyncPaginator[AddonResponse, AsyncDefaultPageNumberPagination[AddonResponse]]:
|
|
443
|
+
"""
|
|
444
|
+
Args:
|
|
445
|
+
page_number: Page number default is 0
|
|
446
|
+
|
|
447
|
+
page_size: Page size default is 10 max is 100
|
|
448
|
+
|
|
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
|
+
return self._get_api_list(
|
|
458
|
+
"/addons",
|
|
459
|
+
page=AsyncDefaultPageNumberPagination[AddonResponse],
|
|
460
|
+
options=make_request_options(
|
|
461
|
+
extra_headers=extra_headers,
|
|
462
|
+
extra_query=extra_query,
|
|
463
|
+
extra_body=extra_body,
|
|
464
|
+
timeout=timeout,
|
|
465
|
+
query=maybe_transform(
|
|
466
|
+
{
|
|
467
|
+
"page_number": page_number,
|
|
468
|
+
"page_size": page_size,
|
|
469
|
+
},
|
|
470
|
+
addon_list_params.AddonListParams,
|
|
471
|
+
),
|
|
472
|
+
),
|
|
473
|
+
model=AddonResponse,
|
|
474
|
+
)
|
|
475
|
+
|
|
476
|
+
async def update_images(
|
|
477
|
+
self,
|
|
478
|
+
id: str,
|
|
479
|
+
*,
|
|
480
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
481
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
482
|
+
extra_headers: Headers | None = None,
|
|
483
|
+
extra_query: Query | None = None,
|
|
484
|
+
extra_body: Body | None = None,
|
|
485
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
486
|
+
) -> AddonUpdateImagesResponse:
|
|
487
|
+
"""
|
|
488
|
+
Args:
|
|
489
|
+
extra_headers: Send extra headers
|
|
490
|
+
|
|
491
|
+
extra_query: Add additional query parameters to the request
|
|
492
|
+
|
|
493
|
+
extra_body: Add additional JSON properties to the request
|
|
494
|
+
|
|
495
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
496
|
+
"""
|
|
497
|
+
if not id:
|
|
498
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
499
|
+
return await self._put(
|
|
500
|
+
f"/addons/{id}/images",
|
|
501
|
+
options=make_request_options(
|
|
502
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
503
|
+
),
|
|
504
|
+
cast_to=AddonUpdateImagesResponse,
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
class AddonsResourceWithRawResponse:
|
|
509
|
+
def __init__(self, addons: AddonsResource) -> None:
|
|
510
|
+
self._addons = addons
|
|
511
|
+
|
|
512
|
+
self.create = to_raw_response_wrapper(
|
|
513
|
+
addons.create,
|
|
514
|
+
)
|
|
515
|
+
self.retrieve = to_raw_response_wrapper(
|
|
516
|
+
addons.retrieve,
|
|
517
|
+
)
|
|
518
|
+
self.update = to_raw_response_wrapper(
|
|
519
|
+
addons.update,
|
|
520
|
+
)
|
|
521
|
+
self.list = to_raw_response_wrapper(
|
|
522
|
+
addons.list,
|
|
523
|
+
)
|
|
524
|
+
self.update_images = to_raw_response_wrapper(
|
|
525
|
+
addons.update_images,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
class AsyncAddonsResourceWithRawResponse:
|
|
530
|
+
def __init__(self, addons: AsyncAddonsResource) -> None:
|
|
531
|
+
self._addons = addons
|
|
532
|
+
|
|
533
|
+
self.create = async_to_raw_response_wrapper(
|
|
534
|
+
addons.create,
|
|
535
|
+
)
|
|
536
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
537
|
+
addons.retrieve,
|
|
538
|
+
)
|
|
539
|
+
self.update = async_to_raw_response_wrapper(
|
|
540
|
+
addons.update,
|
|
541
|
+
)
|
|
542
|
+
self.list = async_to_raw_response_wrapper(
|
|
543
|
+
addons.list,
|
|
544
|
+
)
|
|
545
|
+
self.update_images = async_to_raw_response_wrapper(
|
|
546
|
+
addons.update_images,
|
|
547
|
+
)
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
class AddonsResourceWithStreamingResponse:
|
|
551
|
+
def __init__(self, addons: AddonsResource) -> None:
|
|
552
|
+
self._addons = addons
|
|
553
|
+
|
|
554
|
+
self.create = to_streamed_response_wrapper(
|
|
555
|
+
addons.create,
|
|
556
|
+
)
|
|
557
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
558
|
+
addons.retrieve,
|
|
559
|
+
)
|
|
560
|
+
self.update = to_streamed_response_wrapper(
|
|
561
|
+
addons.update,
|
|
562
|
+
)
|
|
563
|
+
self.list = to_streamed_response_wrapper(
|
|
564
|
+
addons.list,
|
|
565
|
+
)
|
|
566
|
+
self.update_images = to_streamed_response_wrapper(
|
|
567
|
+
addons.update_images,
|
|
568
|
+
)
|
|
569
|
+
|
|
570
|
+
|
|
571
|
+
class AsyncAddonsResourceWithStreamingResponse:
|
|
572
|
+
def __init__(self, addons: AsyncAddonsResource) -> None:
|
|
573
|
+
self._addons = addons
|
|
574
|
+
|
|
575
|
+
self.create = async_to_streamed_response_wrapper(
|
|
576
|
+
addons.create,
|
|
577
|
+
)
|
|
578
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
579
|
+
addons.retrieve,
|
|
580
|
+
)
|
|
581
|
+
self.update = async_to_streamed_response_wrapper(
|
|
582
|
+
addons.update,
|
|
583
|
+
)
|
|
584
|
+
self.list = async_to_streamed_response_wrapper(
|
|
585
|
+
addons.list,
|
|
586
|
+
)
|
|
587
|
+
self.update_images = async_to_streamed_response_wrapper(
|
|
588
|
+
addons.update_images,
|
|
589
|
+
)
|