dodopayments 1.51.1__py3-none-any.whl → 1.56.5__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/__init__.py +5 -1
- dodopayments/_base_client.py +12 -12
- dodopayments/_client.py +52 -14
- dodopayments/_compat.py +48 -48
- dodopayments/_exceptions.py +4 -0
- dodopayments/_models.py +50 -44
- dodopayments/_qs.py +7 -7
- dodopayments/_streaming.py +4 -6
- dodopayments/_types.py +18 -11
- dodopayments/_utils/__init__.py +8 -2
- dodopayments/_utils/_compat.py +45 -0
- dodopayments/_utils/_datetime_parse.py +136 -0
- dodopayments/_utils/_transform.py +13 -3
- dodopayments/_utils/_typing.py +1 -1
- dodopayments/_utils/_utils.py +5 -6
- dodopayments/_version.py +1 -1
- dodopayments/resources/__init__.py +28 -0
- dodopayments/resources/addons.py +29 -29
- dodopayments/resources/brands.py +29 -29
- dodopayments/resources/checkout_sessions.py +110 -27
- dodopayments/resources/customers/__init__.py +14 -0
- dodopayments/resources/customers/customer_portal.py +5 -5
- dodopayments/resources/customers/customers.py +53 -21
- dodopayments/resources/customers/wallets/__init__.py +33 -0
- dodopayments/resources/customers/wallets/ledger_entries.py +318 -0
- dodopayments/resources/customers/wallets/wallets.py +191 -0
- dodopayments/resources/discounts.py +44 -44
- dodopayments/resources/disputes.py +19 -19
- dodopayments/resources/invoices/payments.py +83 -3
- dodopayments/resources/license_key_instances.py +13 -13
- dodopayments/resources/license_keys.py +23 -23
- dodopayments/resources/licenses.py +14 -14
- dodopayments/resources/meters.py +554 -0
- dodopayments/resources/misc.py +3 -3
- dodopayments/resources/payments.py +49 -41
- dodopayments/resources/payouts.py +26 -7
- dodopayments/resources/products/images.py +5 -5
- dodopayments/resources/products/products.py +82 -82
- dodopayments/resources/refunds.py +39 -30
- dodopayments/resources/subscriptions.py +316 -73
- dodopayments/resources/usage_events.py +597 -0
- dodopayments/resources/webhooks/headers.py +5 -5
- dodopayments/resources/webhooks/webhooks.py +119 -44
- dodopayments/types/__init__.py +48 -0
- dodopayments/types/add_meter_to_price.py +29 -0
- dodopayments/types/add_meter_to_price_param.py +30 -0
- dodopayments/types/checkout_session_create_params.py +6 -0
- dodopayments/types/checkout_session_status.py +35 -0
- dodopayments/types/customer_limited_details.py +5 -0
- dodopayments/types/customers/__init__.py +2 -0
- dodopayments/types/customers/customer_wallet.py +20 -0
- dodopayments/types/customers/wallet_list_response.py +15 -0
- dodopayments/types/customers/wallets/__init__.py +7 -0
- dodopayments/types/customers/wallets/customer_wallet_transaction.py +38 -0
- dodopayments/types/customers/wallets/ledger_entry_create_params.py +25 -0
- dodopayments/types/customers/wallets/ledger_entry_list_params.py +18 -0
- dodopayments/types/discount_create_params.py +3 -2
- dodopayments/types/discount_update_params.py +3 -2
- dodopayments/types/dispute_accepted_webhook_event.py +29 -0
- dodopayments/types/dispute_accepted_webhook_event1.py +29 -0
- dodopayments/types/dispute_cancelled_webhook_event.py +29 -0
- dodopayments/types/dispute_cancelled_webhook_event1.py +29 -0
- dodopayments/types/dispute_challenged_webhook_event.py +29 -0
- dodopayments/types/dispute_challenged_webhook_event1.py +29 -0
- dodopayments/types/dispute_expired_webhook_event.py +29 -0
- dodopayments/types/dispute_expired_webhook_event1.py +29 -0
- dodopayments/types/dispute_lost_webhook_event.py +29 -0
- dodopayments/types/dispute_lost_webhook_event1.py +29 -0
- dodopayments/types/dispute_opened_webhook_event.py +29 -0
- dodopayments/types/dispute_opened_webhook_event1.py +29 -0
- dodopayments/types/dispute_won_webhook_event.py +29 -0
- dodopayments/types/dispute_won_webhook_event1.py +29 -0
- dodopayments/types/event.py +26 -0
- dodopayments/types/event_input_param.py +38 -0
- dodopayments/types/license_activate_response.py +40 -0
- dodopayments/types/license_key_created_webhook_event.py +29 -0
- dodopayments/types/license_key_created_webhook_event1.py +29 -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/new_customer_param.py +7 -1
- dodopayments/types/payment.py +37 -2
- dodopayments/types/payment_cancelled_webhook_event.py +29 -0
- dodopayments/types/payment_cancelled_webhook_event1.py +29 -0
- dodopayments/types/payment_create_params.py +3 -0
- dodopayments/types/payment_failed_webhook_event.py +29 -0
- dodopayments/types/payment_failed_webhook_event1.py +29 -0
- dodopayments/types/payment_method_types.py +1 -0
- dodopayments/types/payment_processing_webhook_event.py +29 -0
- dodopayments/types/payment_processing_webhook_event1.py +29 -0
- dodopayments/types/payment_succeeded_webhook_event.py +29 -0
- dodopayments/types/payment_succeeded_webhook_event1.py +29 -0
- dodopayments/types/payout_list_params.py +11 -1
- 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/refund.py +8 -1
- dodopayments/types/refund_create_params.py +4 -1
- dodopayments/types/refund_failed_webhook_event.py +29 -0
- dodopayments/types/refund_failed_webhook_event1.py +29 -0
- dodopayments/types/refund_list_response.py +39 -0
- dodopayments/types/refund_succeeded_webhook_event.py +29 -0
- dodopayments/types/refund_succeeded_webhook_event1.py +29 -0
- dodopayments/types/subscription.py +23 -1
- dodopayments/types/subscription_active_webhook_event.py +29 -0
- dodopayments/types/subscription_active_webhook_event1.py +29 -0
- dodopayments/types/subscription_cancelled_webhook_event.py +29 -0
- dodopayments/types/subscription_cancelled_webhook_event1.py +29 -0
- dodopayments/types/subscription_charge_params.py +12 -1
- dodopayments/types/subscription_create_params.py +3 -0
- dodopayments/types/subscription_expired_webhook_event.py +29 -0
- dodopayments/types/subscription_expired_webhook_event1.py +29 -0
- dodopayments/types/subscription_failed_webhook_event.py +29 -0
- dodopayments/types/subscription_failed_webhook_event1.py +29 -0
- dodopayments/types/subscription_list_response.py +3 -0
- dodopayments/types/subscription_on_hold_webhook_event.py +29 -0
- dodopayments/types/subscription_on_hold_webhook_event1.py +29 -0
- dodopayments/types/subscription_plan_changed_webhook_event.py +29 -0
- dodopayments/types/subscription_plan_changed_webhook_event1.py +29 -0
- dodopayments/types/subscription_renewed_webhook_event.py +29 -0
- dodopayments/types/subscription_renewed_webhook_event1.py +29 -0
- dodopayments/types/subscription_retrieve_usage_history_params.py +28 -0
- dodopayments/types/subscription_retrieve_usage_history_response.py +46 -0
- dodopayments/types/subscription_update_params.py +2 -0
- dodopayments/types/unsafe_unwrap_webhook_event.py +52 -0
- dodopayments/types/unwrap_webhook_event.py +52 -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.1.dist-info → dodopayments-1.56.5.dist-info}/METADATA +6 -4
- dodopayments-1.56.5.dist-info/RECORD +239 -0
- dodopayments-1.51.1.dist-info/RECORD +0 -163
- {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/WHEEL +0 -0
- {dodopayments-1.51.1.dist-info → dodopayments-1.56.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ...._types import Body, Query, Headers, NotGiven, not_given
|
|
8
|
+
from ...._compat import cached_property
|
|
9
|
+
from ...._resource import SyncAPIResource, AsyncAPIResource
|
|
10
|
+
from ...._response import (
|
|
11
|
+
to_raw_response_wrapper,
|
|
12
|
+
to_streamed_response_wrapper,
|
|
13
|
+
async_to_raw_response_wrapper,
|
|
14
|
+
async_to_streamed_response_wrapper,
|
|
15
|
+
)
|
|
16
|
+
from .ledger_entries import (
|
|
17
|
+
LedgerEntriesResource,
|
|
18
|
+
AsyncLedgerEntriesResource,
|
|
19
|
+
LedgerEntriesResourceWithRawResponse,
|
|
20
|
+
AsyncLedgerEntriesResourceWithRawResponse,
|
|
21
|
+
LedgerEntriesResourceWithStreamingResponse,
|
|
22
|
+
AsyncLedgerEntriesResourceWithStreamingResponse,
|
|
23
|
+
)
|
|
24
|
+
from ...._base_client import make_request_options
|
|
25
|
+
from ....types.customers.wallet_list_response import WalletListResponse
|
|
26
|
+
|
|
27
|
+
__all__ = ["WalletsResource", "AsyncWalletsResource"]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class WalletsResource(SyncAPIResource):
|
|
31
|
+
@cached_property
|
|
32
|
+
def ledger_entries(self) -> LedgerEntriesResource:
|
|
33
|
+
return LedgerEntriesResource(self._client)
|
|
34
|
+
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_raw_response(self) -> WalletsResourceWithRawResponse:
|
|
37
|
+
"""
|
|
38
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
39
|
+
the raw response object instead of the parsed content.
|
|
40
|
+
|
|
41
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
42
|
+
"""
|
|
43
|
+
return WalletsResourceWithRawResponse(self)
|
|
44
|
+
|
|
45
|
+
@cached_property
|
|
46
|
+
def with_streaming_response(self) -> WalletsResourceWithStreamingResponse:
|
|
47
|
+
"""
|
|
48
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
49
|
+
|
|
50
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
51
|
+
"""
|
|
52
|
+
return WalletsResourceWithStreamingResponse(self)
|
|
53
|
+
|
|
54
|
+
def list(
|
|
55
|
+
self,
|
|
56
|
+
customer_id: str,
|
|
57
|
+
*,
|
|
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
|
+
) -> WalletListResponse:
|
|
65
|
+
"""
|
|
66
|
+
Args:
|
|
67
|
+
extra_headers: Send extra headers
|
|
68
|
+
|
|
69
|
+
extra_query: Add additional query parameters to the request
|
|
70
|
+
|
|
71
|
+
extra_body: Add additional JSON properties to the request
|
|
72
|
+
|
|
73
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
74
|
+
"""
|
|
75
|
+
if not customer_id:
|
|
76
|
+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
|
|
77
|
+
return self._get(
|
|
78
|
+
f"/customers/{customer_id}/wallets",
|
|
79
|
+
options=make_request_options(
|
|
80
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
81
|
+
),
|
|
82
|
+
cast_to=WalletListResponse,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class AsyncWalletsResource(AsyncAPIResource):
|
|
87
|
+
@cached_property
|
|
88
|
+
def ledger_entries(self) -> AsyncLedgerEntriesResource:
|
|
89
|
+
return AsyncLedgerEntriesResource(self._client)
|
|
90
|
+
|
|
91
|
+
@cached_property
|
|
92
|
+
def with_raw_response(self) -> AsyncWalletsResourceWithRawResponse:
|
|
93
|
+
"""
|
|
94
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
95
|
+
the raw response object instead of the parsed content.
|
|
96
|
+
|
|
97
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
98
|
+
"""
|
|
99
|
+
return AsyncWalletsResourceWithRawResponse(self)
|
|
100
|
+
|
|
101
|
+
@cached_property
|
|
102
|
+
def with_streaming_response(self) -> AsyncWalletsResourceWithStreamingResponse:
|
|
103
|
+
"""
|
|
104
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
105
|
+
|
|
106
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
107
|
+
"""
|
|
108
|
+
return AsyncWalletsResourceWithStreamingResponse(self)
|
|
109
|
+
|
|
110
|
+
async def list(
|
|
111
|
+
self,
|
|
112
|
+
customer_id: str,
|
|
113
|
+
*,
|
|
114
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
115
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
116
|
+
extra_headers: Headers | None = None,
|
|
117
|
+
extra_query: Query | None = None,
|
|
118
|
+
extra_body: Body | None = None,
|
|
119
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
120
|
+
) -> WalletListResponse:
|
|
121
|
+
"""
|
|
122
|
+
Args:
|
|
123
|
+
extra_headers: Send extra headers
|
|
124
|
+
|
|
125
|
+
extra_query: Add additional query parameters to the request
|
|
126
|
+
|
|
127
|
+
extra_body: Add additional JSON properties to the request
|
|
128
|
+
|
|
129
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
130
|
+
"""
|
|
131
|
+
if not customer_id:
|
|
132
|
+
raise ValueError(f"Expected a non-empty value for `customer_id` but received {customer_id!r}")
|
|
133
|
+
return await self._get(
|
|
134
|
+
f"/customers/{customer_id}/wallets",
|
|
135
|
+
options=make_request_options(
|
|
136
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
137
|
+
),
|
|
138
|
+
cast_to=WalletListResponse,
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class WalletsResourceWithRawResponse:
|
|
143
|
+
def __init__(self, wallets: WalletsResource) -> None:
|
|
144
|
+
self._wallets = wallets
|
|
145
|
+
|
|
146
|
+
self.list = to_raw_response_wrapper(
|
|
147
|
+
wallets.list,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
@cached_property
|
|
151
|
+
def ledger_entries(self) -> LedgerEntriesResourceWithRawResponse:
|
|
152
|
+
return LedgerEntriesResourceWithRawResponse(self._wallets.ledger_entries)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
class AsyncWalletsResourceWithRawResponse:
|
|
156
|
+
def __init__(self, wallets: AsyncWalletsResource) -> None:
|
|
157
|
+
self._wallets = wallets
|
|
158
|
+
|
|
159
|
+
self.list = async_to_raw_response_wrapper(
|
|
160
|
+
wallets.list,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
@cached_property
|
|
164
|
+
def ledger_entries(self) -> AsyncLedgerEntriesResourceWithRawResponse:
|
|
165
|
+
return AsyncLedgerEntriesResourceWithRawResponse(self._wallets.ledger_entries)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class WalletsResourceWithStreamingResponse:
|
|
169
|
+
def __init__(self, wallets: WalletsResource) -> None:
|
|
170
|
+
self._wallets = wallets
|
|
171
|
+
|
|
172
|
+
self.list = to_streamed_response_wrapper(
|
|
173
|
+
wallets.list,
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
@cached_property
|
|
177
|
+
def ledger_entries(self) -> LedgerEntriesResourceWithStreamingResponse:
|
|
178
|
+
return LedgerEntriesResourceWithStreamingResponse(self._wallets.ledger_entries)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class AsyncWalletsResourceWithStreamingResponse:
|
|
182
|
+
def __init__(self, wallets: AsyncWalletsResource) -> None:
|
|
183
|
+
self._wallets = wallets
|
|
184
|
+
|
|
185
|
+
self.list = async_to_streamed_response_wrapper(
|
|
186
|
+
wallets.list,
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
@cached_property
|
|
190
|
+
def ledger_entries(self) -> AsyncLedgerEntriesResourceWithStreamingResponse:
|
|
191
|
+
return AsyncLedgerEntriesResourceWithStreamingResponse(self._wallets.ledger_entries)
|
|
@@ -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
|
|
11
|
+
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
|
|
12
12
|
from .._utils import maybe_transform, async_maybe_transform
|
|
13
13
|
from .._compat import cached_property
|
|
14
14
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -51,18 +51,18 @@ class DiscountsResource(SyncAPIResource):
|
|
|
51
51
|
*,
|
|
52
52
|
amount: int,
|
|
53
53
|
type: DiscountType,
|
|
54
|
-
code: Optional[str] |
|
|
55
|
-
expires_at: Union[str, datetime, None] |
|
|
56
|
-
name: Optional[str] |
|
|
57
|
-
restricted_to: Optional[
|
|
58
|
-
subscription_cycles: Optional[int] |
|
|
59
|
-
usage_limit: Optional[int] |
|
|
54
|
+
code: Optional[str] | Omit = omit,
|
|
55
|
+
expires_at: Union[str, datetime, None] | Omit = omit,
|
|
56
|
+
name: Optional[str] | Omit = omit,
|
|
57
|
+
restricted_to: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
58
|
+
subscription_cycles: Optional[int] | Omit = omit,
|
|
59
|
+
usage_limit: Optional[int] | Omit = omit,
|
|
60
60
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
61
61
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
62
62
|
extra_headers: Headers | None = None,
|
|
63
63
|
extra_query: Query | None = None,
|
|
64
64
|
extra_body: Body | None = None,
|
|
65
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
65
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
66
66
|
) -> Discount:
|
|
67
67
|
"""
|
|
68
68
|
POST /discounts If `code` is omitted or empty, a random 16-char uppercase code
|
|
@@ -133,7 +133,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
133
133
|
extra_headers: Headers | None = None,
|
|
134
134
|
extra_query: Query | None = None,
|
|
135
135
|
extra_body: Body | None = None,
|
|
136
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
136
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
137
137
|
) -> Discount:
|
|
138
138
|
"""
|
|
139
139
|
GET /discounts/{discount_id}
|
|
@@ -161,20 +161,20 @@ class DiscountsResource(SyncAPIResource):
|
|
|
161
161
|
self,
|
|
162
162
|
discount_id: str,
|
|
163
163
|
*,
|
|
164
|
-
amount: Optional[int] |
|
|
165
|
-
code: Optional[str] |
|
|
166
|
-
expires_at: Union[str, datetime, None] |
|
|
167
|
-
name: Optional[str] |
|
|
168
|
-
restricted_to: Optional[
|
|
169
|
-
subscription_cycles: Optional[int] |
|
|
170
|
-
type: Optional[DiscountType] |
|
|
171
|
-
usage_limit: Optional[int] |
|
|
164
|
+
amount: Optional[int] | Omit = omit,
|
|
165
|
+
code: Optional[str] | Omit = omit,
|
|
166
|
+
expires_at: Union[str, datetime, None] | Omit = omit,
|
|
167
|
+
name: Optional[str] | Omit = omit,
|
|
168
|
+
restricted_to: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
169
|
+
subscription_cycles: Optional[int] | Omit = omit,
|
|
170
|
+
type: Optional[DiscountType] | Omit = omit,
|
|
171
|
+
usage_limit: Optional[int] | Omit = omit,
|
|
172
172
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
173
173
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
174
174
|
extra_headers: Headers | None = None,
|
|
175
175
|
extra_query: Query | None = None,
|
|
176
176
|
extra_body: Body | None = None,
|
|
177
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
177
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
178
178
|
) -> Discount:
|
|
179
179
|
"""
|
|
180
180
|
PATCH /discounts/{discount_id}
|
|
@@ -234,14 +234,14 @@ class DiscountsResource(SyncAPIResource):
|
|
|
234
234
|
def list(
|
|
235
235
|
self,
|
|
236
236
|
*,
|
|
237
|
-
page_number: int |
|
|
238
|
-
page_size: int |
|
|
237
|
+
page_number: int | Omit = omit,
|
|
238
|
+
page_size: int | Omit = omit,
|
|
239
239
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
240
240
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
241
241
|
extra_headers: Headers | None = None,
|
|
242
242
|
extra_query: Query | None = None,
|
|
243
243
|
extra_body: Body | None = None,
|
|
244
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
244
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
245
245
|
) -> SyncDefaultPageNumberPagination[Discount]:
|
|
246
246
|
"""
|
|
247
247
|
GET /discounts
|
|
@@ -287,7 +287,7 @@ class DiscountsResource(SyncAPIResource):
|
|
|
287
287
|
extra_headers: Headers | None = None,
|
|
288
288
|
extra_query: Query | None = None,
|
|
289
289
|
extra_body: Body | None = None,
|
|
290
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
290
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
291
291
|
) -> None:
|
|
292
292
|
"""
|
|
293
293
|
DELETE /discounts/{discount_id}
|
|
@@ -338,18 +338,18 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
338
338
|
*,
|
|
339
339
|
amount: int,
|
|
340
340
|
type: DiscountType,
|
|
341
|
-
code: Optional[str] |
|
|
342
|
-
expires_at: Union[str, datetime, None] |
|
|
343
|
-
name: Optional[str] |
|
|
344
|
-
restricted_to: Optional[
|
|
345
|
-
subscription_cycles: Optional[int] |
|
|
346
|
-
usage_limit: Optional[int] |
|
|
341
|
+
code: Optional[str] | Omit = omit,
|
|
342
|
+
expires_at: Union[str, datetime, None] | Omit = omit,
|
|
343
|
+
name: Optional[str] | Omit = omit,
|
|
344
|
+
restricted_to: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
345
|
+
subscription_cycles: Optional[int] | Omit = omit,
|
|
346
|
+
usage_limit: Optional[int] | Omit = omit,
|
|
347
347
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
348
348
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
349
349
|
extra_headers: Headers | None = None,
|
|
350
350
|
extra_query: Query | None = None,
|
|
351
351
|
extra_body: Body | None = None,
|
|
352
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
352
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
353
353
|
) -> Discount:
|
|
354
354
|
"""
|
|
355
355
|
POST /discounts If `code` is omitted or empty, a random 16-char uppercase code
|
|
@@ -420,7 +420,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
420
420
|
extra_headers: Headers | None = None,
|
|
421
421
|
extra_query: Query | None = None,
|
|
422
422
|
extra_body: Body | None = None,
|
|
423
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
423
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
424
424
|
) -> Discount:
|
|
425
425
|
"""
|
|
426
426
|
GET /discounts/{discount_id}
|
|
@@ -448,20 +448,20 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
448
448
|
self,
|
|
449
449
|
discount_id: str,
|
|
450
450
|
*,
|
|
451
|
-
amount: Optional[int] |
|
|
452
|
-
code: Optional[str] |
|
|
453
|
-
expires_at: Union[str, datetime, None] |
|
|
454
|
-
name: Optional[str] |
|
|
455
|
-
restricted_to: Optional[
|
|
456
|
-
subscription_cycles: Optional[int] |
|
|
457
|
-
type: Optional[DiscountType] |
|
|
458
|
-
usage_limit: Optional[int] |
|
|
451
|
+
amount: Optional[int] | Omit = omit,
|
|
452
|
+
code: Optional[str] | Omit = omit,
|
|
453
|
+
expires_at: Union[str, datetime, None] | Omit = omit,
|
|
454
|
+
name: Optional[str] | Omit = omit,
|
|
455
|
+
restricted_to: Optional[SequenceNotStr[str]] | Omit = omit,
|
|
456
|
+
subscription_cycles: Optional[int] | Omit = omit,
|
|
457
|
+
type: Optional[DiscountType] | Omit = omit,
|
|
458
|
+
usage_limit: Optional[int] | Omit = omit,
|
|
459
459
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
460
460
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
461
461
|
extra_headers: Headers | None = None,
|
|
462
462
|
extra_query: Query | None = None,
|
|
463
463
|
extra_body: Body | None = None,
|
|
464
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
464
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
465
465
|
) -> Discount:
|
|
466
466
|
"""
|
|
467
467
|
PATCH /discounts/{discount_id}
|
|
@@ -521,14 +521,14 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
521
521
|
def list(
|
|
522
522
|
self,
|
|
523
523
|
*,
|
|
524
|
-
page_number: int |
|
|
525
|
-
page_size: int |
|
|
524
|
+
page_number: int | Omit = omit,
|
|
525
|
+
page_size: int | Omit = omit,
|
|
526
526
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
527
527
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
528
528
|
extra_headers: Headers | None = None,
|
|
529
529
|
extra_query: Query | None = None,
|
|
530
530
|
extra_body: Body | None = None,
|
|
531
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
531
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
532
532
|
) -> AsyncPaginator[Discount, AsyncDefaultPageNumberPagination[Discount]]:
|
|
533
533
|
"""
|
|
534
534
|
GET /discounts
|
|
@@ -574,7 +574,7 @@ class AsyncDiscountsResource(AsyncAPIResource):
|
|
|
574
574
|
extra_headers: Headers | None = None,
|
|
575
575
|
extra_query: Query | None = None,
|
|
576
576
|
extra_body: Body | None = None,
|
|
577
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
577
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
578
578
|
) -> None:
|
|
579
579
|
"""
|
|
580
580
|
DELETE /discounts/{discount_id}
|
|
@@ -9,7 +9,7 @@ from typing_extensions import Literal
|
|
|
9
9
|
import httpx
|
|
10
10
|
|
|
11
11
|
from ..types import dispute_list_params
|
|
12
|
-
from .._types import
|
|
12
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
13
13
|
from .._utils import maybe_transform
|
|
14
14
|
from .._compat import cached_property
|
|
15
15
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -56,7 +56,7 @@ class DisputesResource(SyncAPIResource):
|
|
|
56
56
|
extra_headers: Headers | None = None,
|
|
57
57
|
extra_query: Query | None = None,
|
|
58
58
|
extra_body: Body | None = None,
|
|
59
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
59
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
60
60
|
) -> GetDispute:
|
|
61
61
|
"""
|
|
62
62
|
Args:
|
|
@@ -81,10 +81,10 @@ class DisputesResource(SyncAPIResource):
|
|
|
81
81
|
def list(
|
|
82
82
|
self,
|
|
83
83
|
*,
|
|
84
|
-
created_at_gte: Union[str, datetime] |
|
|
85
|
-
created_at_lte: Union[str, datetime] |
|
|
86
|
-
customer_id: str |
|
|
87
|
-
dispute_stage: Literal["pre_dispute", "dispute", "pre_arbitration"] |
|
|
84
|
+
created_at_gte: Union[str, datetime] | Omit = omit,
|
|
85
|
+
created_at_lte: Union[str, datetime] | Omit = omit,
|
|
86
|
+
customer_id: str | Omit = omit,
|
|
87
|
+
dispute_stage: Literal["pre_dispute", "dispute", "pre_arbitration"] | Omit = omit,
|
|
88
88
|
dispute_status: Literal[
|
|
89
89
|
"dispute_opened",
|
|
90
90
|
"dispute_expired",
|
|
@@ -94,15 +94,15 @@ class DisputesResource(SyncAPIResource):
|
|
|
94
94
|
"dispute_won",
|
|
95
95
|
"dispute_lost",
|
|
96
96
|
]
|
|
97
|
-
|
|
|
98
|
-
page_number: int |
|
|
99
|
-
page_size: int |
|
|
97
|
+
| Omit = omit,
|
|
98
|
+
page_number: int | Omit = omit,
|
|
99
|
+
page_size: int | Omit = omit,
|
|
100
100
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
101
101
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
102
102
|
extra_headers: Headers | None = None,
|
|
103
103
|
extra_query: Query | None = None,
|
|
104
104
|
extra_body: Body | None = None,
|
|
105
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
105
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
106
106
|
) -> SyncDefaultPageNumberPagination[DisputeListResponse]:
|
|
107
107
|
"""
|
|
108
108
|
Args:
|
|
@@ -182,7 +182,7 @@ class AsyncDisputesResource(AsyncAPIResource):
|
|
|
182
182
|
extra_headers: Headers | None = None,
|
|
183
183
|
extra_query: Query | None = None,
|
|
184
184
|
extra_body: Body | None = None,
|
|
185
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
185
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
186
186
|
) -> GetDispute:
|
|
187
187
|
"""
|
|
188
188
|
Args:
|
|
@@ -207,10 +207,10 @@ class AsyncDisputesResource(AsyncAPIResource):
|
|
|
207
207
|
def list(
|
|
208
208
|
self,
|
|
209
209
|
*,
|
|
210
|
-
created_at_gte: Union[str, datetime] |
|
|
211
|
-
created_at_lte: Union[str, datetime] |
|
|
212
|
-
customer_id: str |
|
|
213
|
-
dispute_stage: Literal["pre_dispute", "dispute", "pre_arbitration"] |
|
|
210
|
+
created_at_gte: Union[str, datetime] | Omit = omit,
|
|
211
|
+
created_at_lte: Union[str, datetime] | Omit = omit,
|
|
212
|
+
customer_id: str | Omit = omit,
|
|
213
|
+
dispute_stage: Literal["pre_dispute", "dispute", "pre_arbitration"] | Omit = omit,
|
|
214
214
|
dispute_status: Literal[
|
|
215
215
|
"dispute_opened",
|
|
216
216
|
"dispute_expired",
|
|
@@ -220,15 +220,15 @@ class AsyncDisputesResource(AsyncAPIResource):
|
|
|
220
220
|
"dispute_won",
|
|
221
221
|
"dispute_lost",
|
|
222
222
|
]
|
|
223
|
-
|
|
|
224
|
-
page_number: int |
|
|
225
|
-
page_size: int |
|
|
223
|
+
| Omit = omit,
|
|
224
|
+
page_number: int | Omit = omit,
|
|
225
|
+
page_size: int | Omit = omit,
|
|
226
226
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
227
227
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
228
228
|
extra_headers: Headers | None = None,
|
|
229
229
|
extra_query: Query | None = None,
|
|
230
230
|
extra_body: Body | None = None,
|
|
231
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
231
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
232
232
|
) -> AsyncPaginator[DisputeListResponse, AsyncDefaultPageNumberPagination[DisputeListResponse]]:
|
|
233
233
|
"""
|
|
234
234
|
Args:
|
|
@@ -4,7 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import httpx
|
|
6
6
|
|
|
7
|
-
from ..._types import
|
|
7
|
+
from ..._types import Body, Query, Headers, NotGiven, not_given
|
|
8
8
|
from ..._compat import cached_property
|
|
9
9
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
10
10
|
from ..._response import (
|
|
@@ -51,7 +51,7 @@ class PaymentsResource(SyncAPIResource):
|
|
|
51
51
|
extra_headers: Headers | None = None,
|
|
52
52
|
extra_query: Query | None = None,
|
|
53
53
|
extra_body: Body | None = None,
|
|
54
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
54
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
55
55
|
) -> BinaryAPIResponse:
|
|
56
56
|
"""
|
|
57
57
|
Args:
|
|
@@ -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
|
|
@@ -104,7 +136,7 @@ class AsyncPaymentsResource(AsyncAPIResource):
|
|
|
104
136
|
extra_headers: Headers | None = None,
|
|
105
137
|
extra_query: Query | None = None,
|
|
106
138
|
extra_body: Body | None = None,
|
|
107
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
139
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
108
140
|
) -> AsyncBinaryAPIResponse:
|
|
109
141
|
"""
|
|
110
142
|
Args:
|
|
@@ -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
|
+
)
|