dodopayments 1.51.0__py3-none-any.whl → 1.52.4__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/_client.py +18 -0
- dodopayments/_models.py +1 -1
- dodopayments/_types.py +35 -1
- dodopayments/_utils/__init__.py +1 -0
- dodopayments/_utils/_transform.py +6 -0
- dodopayments/_utils/_typing.py +5 -0
- dodopayments/_version.py +1 -1
- dodopayments/resources/__init__.py +28 -0
- dodopayments/resources/discounts.py +6 -6
- dodopayments/resources/invoices/payments.py +80 -0
- dodopayments/resources/meters.py +554 -0
- dodopayments/resources/products/products.py +16 -16
- dodopayments/resources/subscriptions.py +223 -0
- dodopayments/resources/usage_events.py +597 -0
- dodopayments/types/__init__.py +20 -0
- dodopayments/types/add_meter_to_price.py +29 -0
- dodopayments/types/add_meter_to_price_param.py +30 -0
- dodopayments/types/discount_create_params.py +3 -2
- dodopayments/types/discount_update_params.py +3 -2
- dodopayments/types/event.py +26 -0
- dodopayments/types/event_input_param.py +38 -0
- dodopayments/types/meter.py +40 -0
- dodopayments/types/meter_aggregation.py +16 -0
- dodopayments/types/meter_aggregation_param.py +16 -0
- dodopayments/types/meter_create_params.py +31 -0
- dodopayments/types/meter_filter.py +131 -0
- dodopayments/types/meter_filter_param.py +143 -0
- dodopayments/types/meter_list_params.py +18 -0
- dodopayments/types/payment.py +6 -0
- dodopayments/types/price.py +52 -5
- dodopayments/types/price_param.py +52 -5
- dodopayments/types/product_create_params.py +3 -2
- dodopayments/types/product_update_params.py +4 -3
- dodopayments/types/subscription.py +20 -1
- dodopayments/types/subscription_retrieve_usage_history_params.py +28 -0
- dodopayments/types/subscription_retrieve_usage_history_response.py +46 -0
- dodopayments/types/usage_event_ingest_params.py +15 -0
- dodopayments/types/usage_event_ingest_response.py +9 -0
- dodopayments/types/usage_event_list_params.py +42 -0
- {dodopayments-1.51.0.dist-info → dodopayments-1.52.4.dist-info}/METADATA +1 -1
- {dodopayments-1.51.0.dist-info → dodopayments-1.52.4.dist-info}/RECORD +43 -25
- {dodopayments-1.51.0.dist-info → dodopayments-1.52.4.dist-info}/WHEEL +0 -0
- {dodopayments-1.51.0.dist-info → dodopayments-1.52.4.dist-info}/licenses/LICENSE +0 -0
dodopayments/_client.py
CHANGED
|
@@ -25,6 +25,7 @@ from .resources import (
|
|
|
25
25
|
misc,
|
|
26
26
|
addons,
|
|
27
27
|
brands,
|
|
28
|
+
meters,
|
|
28
29
|
payouts,
|
|
29
30
|
refunds,
|
|
30
31
|
disputes,
|
|
@@ -32,6 +33,7 @@ from .resources import (
|
|
|
32
33
|
payments,
|
|
33
34
|
discounts,
|
|
34
35
|
license_keys,
|
|
36
|
+
usage_events,
|
|
35
37
|
subscriptions,
|
|
36
38
|
checkout_sessions,
|
|
37
39
|
license_key_instances,
|
|
@@ -84,6 +86,8 @@ class DodoPayments(SyncAPIClient):
|
|
|
84
86
|
addons: addons.AddonsResource
|
|
85
87
|
brands: brands.BrandsResource
|
|
86
88
|
webhooks: webhooks.WebhooksResource
|
|
89
|
+
usage_events: usage_events.UsageEventsResource
|
|
90
|
+
meters: meters.MetersResource
|
|
87
91
|
with_raw_response: DodoPaymentsWithRawResponse
|
|
88
92
|
with_streaming_response: DodoPaymentsWithStreamedResponse
|
|
89
93
|
|
|
@@ -182,6 +186,8 @@ class DodoPayments(SyncAPIClient):
|
|
|
182
186
|
self.addons = addons.AddonsResource(self)
|
|
183
187
|
self.brands = brands.BrandsResource(self)
|
|
184
188
|
self.webhooks = webhooks.WebhooksResource(self)
|
|
189
|
+
self.usage_events = usage_events.UsageEventsResource(self)
|
|
190
|
+
self.meters = meters.MetersResource(self)
|
|
185
191
|
self.with_raw_response = DodoPaymentsWithRawResponse(self)
|
|
186
192
|
self.with_streaming_response = DodoPaymentsWithStreamedResponse(self)
|
|
187
193
|
|
|
@@ -310,6 +316,8 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
310
316
|
addons: addons.AsyncAddonsResource
|
|
311
317
|
brands: brands.AsyncBrandsResource
|
|
312
318
|
webhooks: webhooks.AsyncWebhooksResource
|
|
319
|
+
usage_events: usage_events.AsyncUsageEventsResource
|
|
320
|
+
meters: meters.AsyncMetersResource
|
|
313
321
|
with_raw_response: AsyncDodoPaymentsWithRawResponse
|
|
314
322
|
with_streaming_response: AsyncDodoPaymentsWithStreamedResponse
|
|
315
323
|
|
|
@@ -408,6 +416,8 @@ class AsyncDodoPayments(AsyncAPIClient):
|
|
|
408
416
|
self.addons = addons.AsyncAddonsResource(self)
|
|
409
417
|
self.brands = brands.AsyncBrandsResource(self)
|
|
410
418
|
self.webhooks = webhooks.AsyncWebhooksResource(self)
|
|
419
|
+
self.usage_events = usage_events.AsyncUsageEventsResource(self)
|
|
420
|
+
self.meters = meters.AsyncMetersResource(self)
|
|
411
421
|
self.with_raw_response = AsyncDodoPaymentsWithRawResponse(self)
|
|
412
422
|
self.with_streaming_response = AsyncDodoPaymentsWithStreamedResponse(self)
|
|
413
423
|
|
|
@@ -539,6 +549,8 @@ class DodoPaymentsWithRawResponse:
|
|
|
539
549
|
self.addons = addons.AddonsResourceWithRawResponse(client.addons)
|
|
540
550
|
self.brands = brands.BrandsResourceWithRawResponse(client.brands)
|
|
541
551
|
self.webhooks = webhooks.WebhooksResourceWithRawResponse(client.webhooks)
|
|
552
|
+
self.usage_events = usage_events.UsageEventsResourceWithRawResponse(client.usage_events)
|
|
553
|
+
self.meters = meters.MetersResourceWithRawResponse(client.meters)
|
|
542
554
|
|
|
543
555
|
|
|
544
556
|
class AsyncDodoPaymentsWithRawResponse:
|
|
@@ -564,6 +576,8 @@ class AsyncDodoPaymentsWithRawResponse:
|
|
|
564
576
|
self.addons = addons.AsyncAddonsResourceWithRawResponse(client.addons)
|
|
565
577
|
self.brands = brands.AsyncBrandsResourceWithRawResponse(client.brands)
|
|
566
578
|
self.webhooks = webhooks.AsyncWebhooksResourceWithRawResponse(client.webhooks)
|
|
579
|
+
self.usage_events = usage_events.AsyncUsageEventsResourceWithRawResponse(client.usage_events)
|
|
580
|
+
self.meters = meters.AsyncMetersResourceWithRawResponse(client.meters)
|
|
567
581
|
|
|
568
582
|
|
|
569
583
|
class DodoPaymentsWithStreamedResponse:
|
|
@@ -589,6 +603,8 @@ class DodoPaymentsWithStreamedResponse:
|
|
|
589
603
|
self.addons = addons.AddonsResourceWithStreamingResponse(client.addons)
|
|
590
604
|
self.brands = brands.BrandsResourceWithStreamingResponse(client.brands)
|
|
591
605
|
self.webhooks = webhooks.WebhooksResourceWithStreamingResponse(client.webhooks)
|
|
606
|
+
self.usage_events = usage_events.UsageEventsResourceWithStreamingResponse(client.usage_events)
|
|
607
|
+
self.meters = meters.MetersResourceWithStreamingResponse(client.meters)
|
|
592
608
|
|
|
593
609
|
|
|
594
610
|
class AsyncDodoPaymentsWithStreamedResponse:
|
|
@@ -614,6 +630,8 @@ class AsyncDodoPaymentsWithStreamedResponse:
|
|
|
614
630
|
self.addons = addons.AsyncAddonsResourceWithStreamingResponse(client.addons)
|
|
615
631
|
self.brands = brands.AsyncBrandsResourceWithStreamingResponse(client.brands)
|
|
616
632
|
self.webhooks = webhooks.AsyncWebhooksResourceWithStreamingResponse(client.webhooks)
|
|
633
|
+
self.usage_events = usage_events.AsyncUsageEventsResourceWithStreamingResponse(client.usage_events)
|
|
634
|
+
self.meters = meters.AsyncMetersResourceWithStreamingResponse(client.meters)
|
|
617
635
|
|
|
618
636
|
|
|
619
637
|
Client = DodoPayments
|
dodopayments/_models.py
CHANGED
|
@@ -304,7 +304,7 @@ class BaseModel(pydantic.BaseModel):
|
|
|
304
304
|
exclude_none=exclude_none,
|
|
305
305
|
)
|
|
306
306
|
|
|
307
|
-
return cast(dict[str, Any], json_safe(dumped)) if mode == "json" else dumped
|
|
307
|
+
return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped
|
|
308
308
|
|
|
309
309
|
@override
|
|
310
310
|
def model_dump_json(
|
dodopayments/_types.py
CHANGED
|
@@ -13,10 +13,21 @@ from typing import (
|
|
|
13
13
|
Mapping,
|
|
14
14
|
TypeVar,
|
|
15
15
|
Callable,
|
|
16
|
+
Iterator,
|
|
16
17
|
Optional,
|
|
17
18
|
Sequence,
|
|
18
19
|
)
|
|
19
|
-
from typing_extensions import
|
|
20
|
+
from typing_extensions import (
|
|
21
|
+
Set,
|
|
22
|
+
Literal,
|
|
23
|
+
Protocol,
|
|
24
|
+
TypeAlias,
|
|
25
|
+
TypedDict,
|
|
26
|
+
SupportsIndex,
|
|
27
|
+
overload,
|
|
28
|
+
override,
|
|
29
|
+
runtime_checkable,
|
|
30
|
+
)
|
|
20
31
|
|
|
21
32
|
import httpx
|
|
22
33
|
import pydantic
|
|
@@ -217,3 +228,26 @@ class _GenericAlias(Protocol):
|
|
|
217
228
|
class HttpxSendArgs(TypedDict, total=False):
|
|
218
229
|
auth: httpx.Auth
|
|
219
230
|
follow_redirects: bool
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
_T_co = TypeVar("_T_co", covariant=True)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
if TYPE_CHECKING:
|
|
237
|
+
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
|
|
238
|
+
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
|
|
239
|
+
class SequenceNotStr(Protocol[_T_co]):
|
|
240
|
+
@overload
|
|
241
|
+
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
|
|
242
|
+
@overload
|
|
243
|
+
def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
|
|
244
|
+
def __contains__(self, value: object, /) -> bool: ...
|
|
245
|
+
def __len__(self) -> int: ...
|
|
246
|
+
def __iter__(self) -> Iterator[_T_co]: ...
|
|
247
|
+
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
|
|
248
|
+
def count(self, value: Any, /) -> int: ...
|
|
249
|
+
def __reversed__(self) -> Iterator[_T_co]: ...
|
|
250
|
+
else:
|
|
251
|
+
# just point this to a normal `Sequence` at runtime to avoid having to special case
|
|
252
|
+
# deserializing our custom sequence type
|
|
253
|
+
SequenceNotStr = Sequence
|
dodopayments/_utils/__init__.py
CHANGED
|
@@ -38,6 +38,7 @@ from ._typing import (
|
|
|
38
38
|
extract_type_arg as extract_type_arg,
|
|
39
39
|
is_iterable_type as is_iterable_type,
|
|
40
40
|
is_required_type as is_required_type,
|
|
41
|
+
is_sequence_type as is_sequence_type,
|
|
41
42
|
is_annotated_type as is_annotated_type,
|
|
42
43
|
is_type_alias_type as is_type_alias_type,
|
|
43
44
|
strip_annotated_type as strip_annotated_type,
|
|
@@ -16,6 +16,7 @@ from ._utils import (
|
|
|
16
16
|
lru_cache,
|
|
17
17
|
is_mapping,
|
|
18
18
|
is_iterable,
|
|
19
|
+
is_sequence,
|
|
19
20
|
)
|
|
20
21
|
from .._files import is_base64_file_input
|
|
21
22
|
from ._typing import (
|
|
@@ -24,6 +25,7 @@ from ._typing import (
|
|
|
24
25
|
extract_type_arg,
|
|
25
26
|
is_iterable_type,
|
|
26
27
|
is_required_type,
|
|
28
|
+
is_sequence_type,
|
|
27
29
|
is_annotated_type,
|
|
28
30
|
strip_annotated_type,
|
|
29
31
|
)
|
|
@@ -184,6 +186,8 @@ def _transform_recursive(
|
|
|
184
186
|
(is_list_type(stripped_type) and is_list(data))
|
|
185
187
|
# Iterable[T]
|
|
186
188
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
189
|
+
# Sequence[T]
|
|
190
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
187
191
|
):
|
|
188
192
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
189
193
|
# intended as an iterable, so we don't transform it.
|
|
@@ -346,6 +350,8 @@ async def _async_transform_recursive(
|
|
|
346
350
|
(is_list_type(stripped_type) and is_list(data))
|
|
347
351
|
# Iterable[T]
|
|
348
352
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
353
|
+
# Sequence[T]
|
|
354
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
349
355
|
):
|
|
350
356
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
351
357
|
# intended as an iterable, so we don't transform it.
|
dodopayments/_utils/_typing.py
CHANGED
|
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
|
|
|
26
26
|
return (get_origin(typ) or typ) == list
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def is_sequence_type(typ: type) -> bool:
|
|
30
|
+
origin = get_origin(typ) or typ
|
|
31
|
+
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
|
|
32
|
+
|
|
33
|
+
|
|
29
34
|
def is_iterable_type(typ: type) -> bool:
|
|
30
35
|
"""If the given type is `typing.Iterable[T]`"""
|
|
31
36
|
origin = get_origin(typ) or typ
|
dodopayments/_version.py
CHANGED
|
@@ -24,6 +24,14 @@ from .brands import (
|
|
|
24
24
|
BrandsResourceWithStreamingResponse,
|
|
25
25
|
AsyncBrandsResourceWithStreamingResponse,
|
|
26
26
|
)
|
|
27
|
+
from .meters import (
|
|
28
|
+
MetersResource,
|
|
29
|
+
AsyncMetersResource,
|
|
30
|
+
MetersResourceWithRawResponse,
|
|
31
|
+
AsyncMetersResourceWithRawResponse,
|
|
32
|
+
MetersResourceWithStreamingResponse,
|
|
33
|
+
AsyncMetersResourceWithStreamingResponse,
|
|
34
|
+
)
|
|
27
35
|
from .payouts import (
|
|
28
36
|
PayoutsResource,
|
|
29
37
|
AsyncPayoutsResource,
|
|
@@ -112,6 +120,14 @@ from .license_keys import (
|
|
|
112
120
|
LicenseKeysResourceWithStreamingResponse,
|
|
113
121
|
AsyncLicenseKeysResourceWithStreamingResponse,
|
|
114
122
|
)
|
|
123
|
+
from .usage_events import (
|
|
124
|
+
UsageEventsResource,
|
|
125
|
+
AsyncUsageEventsResource,
|
|
126
|
+
UsageEventsResourceWithRawResponse,
|
|
127
|
+
AsyncUsageEventsResourceWithRawResponse,
|
|
128
|
+
UsageEventsResourceWithStreamingResponse,
|
|
129
|
+
AsyncUsageEventsResourceWithStreamingResponse,
|
|
130
|
+
)
|
|
115
131
|
from .subscriptions import (
|
|
116
132
|
SubscriptionsResource,
|
|
117
133
|
AsyncSubscriptionsResource,
|
|
@@ -240,4 +256,16 @@ __all__ = [
|
|
|
240
256
|
"AsyncWebhooksResourceWithRawResponse",
|
|
241
257
|
"WebhooksResourceWithStreamingResponse",
|
|
242
258
|
"AsyncWebhooksResourceWithStreamingResponse",
|
|
259
|
+
"UsageEventsResource",
|
|
260
|
+
"AsyncUsageEventsResource",
|
|
261
|
+
"UsageEventsResourceWithRawResponse",
|
|
262
|
+
"AsyncUsageEventsResourceWithRawResponse",
|
|
263
|
+
"UsageEventsResourceWithStreamingResponse",
|
|
264
|
+
"AsyncUsageEventsResourceWithStreamingResponse",
|
|
265
|
+
"MetersResource",
|
|
266
|
+
"AsyncMetersResource",
|
|
267
|
+
"MetersResourceWithRawResponse",
|
|
268
|
+
"AsyncMetersResourceWithRawResponse",
|
|
269
|
+
"MetersResourceWithStreamingResponse",
|
|
270
|
+
"AsyncMetersResourceWithStreamingResponse",
|
|
243
271
|
]
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Union, Optional
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
10
|
from ..types import DiscountType, discount_list_params, discount_create_params, discount_update_params
|
|
11
|
-
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
|
11
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
|
|
12
12
|
from .._utils import maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -54,7 +54,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
54
54
|
code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
55
55
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
56
56
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
57
|
-
restricted_to: Optional[
|
|
57
|
+
restricted_to: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
58
58
|
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
59
59
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
60
60
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -165,7 +165,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
165
165
|
code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
166
166
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
167
167
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
168
|
-
restricted_to: Optional[
|
|
168
|
+
restricted_to: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
169
169
|
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
170
170
|
type: Optional[DiscountType] | NotGiven = NOT_GIVEN,
|
|
171
171
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
@@ -341,7 +341,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
341
341
|
code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
342
342
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
343
343
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
344
|
-
restricted_to: Optional[
|
|
344
|
+
restricted_to: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
345
345
|
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
346
346
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
347
347
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
@@ -452,7 +452,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
452
452
|
code: Optional[str] | NotGiven = NOT_GIVEN,
|
|
453
453
|
expires_at: Union[str, datetime, None] | NotGiven = NOT_GIVEN,
|
|
454
454
|
name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
455
|
-
restricted_to: Optional[
|
|
455
|
+
restricted_to: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
456
456
|
subscription_cycles: Optional[int] | NotGiven = NOT_GIVEN,
|
|
457
457
|
type: Optional[DiscountType] | NotGiven = NOT_GIVEN,
|
|
458
458
|
usage_limit: Optional[int] | NotGiven = NOT_GIVEN,
|
|
@@ -74,6 +74,38 @@ class PaymentsResource(SyncAPIResource):
|
|
|
74
74
|
cast_to=BinaryAPIResponse,
|
|
75
75
|
)
|
|
76
76
|
|
|
77
|
+
def retrieve_refund(
|
|
78
|
+
self,
|
|
79
|
+
refund_id: str,
|
|
80
|
+
*,
|
|
81
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
82
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
83
|
+
extra_headers: Headers | None = None,
|
|
84
|
+
extra_query: Query | None = None,
|
|
85
|
+
extra_body: Body | None = None,
|
|
86
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
87
|
+
) -> BinaryAPIResponse:
|
|
88
|
+
"""
|
|
89
|
+
Args:
|
|
90
|
+
extra_headers: Send extra headers
|
|
91
|
+
|
|
92
|
+
extra_query: Add additional query parameters to the request
|
|
93
|
+
|
|
94
|
+
extra_body: Add additional JSON properties to the request
|
|
95
|
+
|
|
96
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
97
|
+
"""
|
|
98
|
+
if not refund_id:
|
|
99
|
+
raise ValueError(f"Expected a non-empty value for `refund_id` but received {refund_id!r}")
|
|
100
|
+
extra_headers = {"Accept": "application/pdf", **(extra_headers or {})}
|
|
101
|
+
return self._get(
|
|
102
|
+
f"/invoices/refunds/{refund_id}",
|
|
103
|
+
options=make_request_options(
|
|
104
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
105
|
+
),
|
|
106
|
+
cast_to=BinaryAPIResponse,
|
|
107
|
+
)
|
|
108
|
+
|
|
77
109
|
|
|
78
110
|
class AsyncPaymentsResource(AsyncAPIResource):
|
|
79
111
|
@cached_property
|
|
@@ -127,6 +159,38 @@ class AsyncPaymentsResource(AsyncAPIResource):
|
|
|
127
159
|
cast_to=AsyncBinaryAPIResponse,
|
|
128
160
|
)
|
|
129
161
|
|
|
162
|
+
async def retrieve_refund(
|
|
163
|
+
self,
|
|
164
|
+
refund_id: str,
|
|
165
|
+
*,
|
|
166
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
167
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
168
|
+
extra_headers: Headers | None = None,
|
|
169
|
+
extra_query: Query | None = None,
|
|
170
|
+
extra_body: Body | None = None,
|
|
171
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
172
|
+
) -> AsyncBinaryAPIResponse:
|
|
173
|
+
"""
|
|
174
|
+
Args:
|
|
175
|
+
extra_headers: Send extra headers
|
|
176
|
+
|
|
177
|
+
extra_query: Add additional query parameters to the request
|
|
178
|
+
|
|
179
|
+
extra_body: Add additional JSON properties to the request
|
|
180
|
+
|
|
181
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
182
|
+
"""
|
|
183
|
+
if not refund_id:
|
|
184
|
+
raise ValueError(f"Expected a non-empty value for `refund_id` but received {refund_id!r}")
|
|
185
|
+
extra_headers = {"Accept": "application/pdf", **(extra_headers or {})}
|
|
186
|
+
return await self._get(
|
|
187
|
+
f"/invoices/refunds/{refund_id}",
|
|
188
|
+
options=make_request_options(
|
|
189
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
190
|
+
),
|
|
191
|
+
cast_to=AsyncBinaryAPIResponse,
|
|
192
|
+
)
|
|
193
|
+
|
|
130
194
|
|
|
131
195
|
class PaymentsResourceWithRawResponse:
|
|
132
196
|
def __init__(self, payments: PaymentsResource) -> None:
|
|
@@ -136,6 +200,10 @@ class PaymentsResourceWithRawResponse:
|
|
|
136
200
|
payments.retrieve,
|
|
137
201
|
BinaryAPIResponse,
|
|
138
202
|
)
|
|
203
|
+
self.retrieve_refund = to_custom_raw_response_wrapper(
|
|
204
|
+
payments.retrieve_refund,
|
|
205
|
+
BinaryAPIResponse,
|
|
206
|
+
)
|
|
139
207
|
|
|
140
208
|
|
|
141
209
|
class AsyncPaymentsResourceWithRawResponse:
|
|
@@ -146,6 +214,10 @@ class AsyncPaymentsResourceWithRawResponse:
|
|
|
146
214
|
payments.retrieve,
|
|
147
215
|
AsyncBinaryAPIResponse,
|
|
148
216
|
)
|
|
217
|
+
self.retrieve_refund = async_to_custom_raw_response_wrapper(
|
|
218
|
+
payments.retrieve_refund,
|
|
219
|
+
AsyncBinaryAPIResponse,
|
|
220
|
+
)
|
|
149
221
|
|
|
150
222
|
|
|
151
223
|
class PaymentsResourceWithStreamingResponse:
|
|
@@ -156,6 +228,10 @@ class PaymentsResourceWithStreamingResponse:
|
|
|
156
228
|
payments.retrieve,
|
|
157
229
|
StreamedBinaryAPIResponse,
|
|
158
230
|
)
|
|
231
|
+
self.retrieve_refund = to_custom_streamed_response_wrapper(
|
|
232
|
+
payments.retrieve_refund,
|
|
233
|
+
StreamedBinaryAPIResponse,
|
|
234
|
+
)
|
|
159
235
|
|
|
160
236
|
|
|
161
237
|
class AsyncPaymentsResourceWithStreamingResponse:
|
|
@@ -166,3 +242,7 @@ class AsyncPaymentsResourceWithStreamingResponse:
|
|
|
166
242
|
payments.retrieve,
|
|
167
243
|
AsyncStreamedBinaryAPIResponse,
|
|
168
244
|
)
|
|
245
|
+
self.retrieve_refund = async_to_custom_streamed_response_wrapper(
|
|
246
|
+
payments.retrieve_refund,
|
|
247
|
+
AsyncStreamedBinaryAPIResponse,
|
|
248
|
+
)
|