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,554 @@
|
|
|
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 meter_list_params, meter_create_params
|
|
10
|
+
from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, omit, not_given
|
|
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 ..types.meter import Meter
|
|
22
|
+
from .._base_client import AsyncPaginator, make_request_options
|
|
23
|
+
from ..types.meter_filter_param import MeterFilterParam
|
|
24
|
+
from ..types.meter_aggregation_param import MeterAggregationParam
|
|
25
|
+
|
|
26
|
+
__all__ = ["MetersResource", "AsyncMetersResource"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class MetersResource(SyncAPIResource):
|
|
30
|
+
@cached_property
|
|
31
|
+
def with_raw_response(self) -> MetersResourceWithRawResponse:
|
|
32
|
+
"""
|
|
33
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
34
|
+
the raw response object instead of the parsed content.
|
|
35
|
+
|
|
36
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
37
|
+
"""
|
|
38
|
+
return MetersResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> MetersResourceWithStreamingResponse:
|
|
42
|
+
"""
|
|
43
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
44
|
+
|
|
45
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
46
|
+
"""
|
|
47
|
+
return MetersResourceWithStreamingResponse(self)
|
|
48
|
+
|
|
49
|
+
def create(
|
|
50
|
+
self,
|
|
51
|
+
*,
|
|
52
|
+
aggregation: MeterAggregationParam,
|
|
53
|
+
event_name: str,
|
|
54
|
+
measurement_unit: str,
|
|
55
|
+
name: str,
|
|
56
|
+
description: Optional[str] | Omit = omit,
|
|
57
|
+
filter: Optional[MeterFilterParam] | Omit = omit,
|
|
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
|
+
) -> Meter:
|
|
65
|
+
"""
|
|
66
|
+
Args:
|
|
67
|
+
aggregation: Aggregation configuration for the meter
|
|
68
|
+
|
|
69
|
+
event_name: Event name to track
|
|
70
|
+
|
|
71
|
+
measurement_unit: measurement unit
|
|
72
|
+
|
|
73
|
+
name: Name of the meter
|
|
74
|
+
|
|
75
|
+
description: Optional description of the meter
|
|
76
|
+
|
|
77
|
+
filter: Optional filter to apply to the meter
|
|
78
|
+
|
|
79
|
+
extra_headers: Send extra headers
|
|
80
|
+
|
|
81
|
+
extra_query: Add additional query parameters to the request
|
|
82
|
+
|
|
83
|
+
extra_body: Add additional JSON properties to the request
|
|
84
|
+
|
|
85
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
86
|
+
"""
|
|
87
|
+
return self._post(
|
|
88
|
+
"/meters",
|
|
89
|
+
body=maybe_transform(
|
|
90
|
+
{
|
|
91
|
+
"aggregation": aggregation,
|
|
92
|
+
"event_name": event_name,
|
|
93
|
+
"measurement_unit": measurement_unit,
|
|
94
|
+
"name": name,
|
|
95
|
+
"description": description,
|
|
96
|
+
"filter": filter,
|
|
97
|
+
},
|
|
98
|
+
meter_create_params.MeterCreateParams,
|
|
99
|
+
),
|
|
100
|
+
options=make_request_options(
|
|
101
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
102
|
+
),
|
|
103
|
+
cast_to=Meter,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
def retrieve(
|
|
107
|
+
self,
|
|
108
|
+
id: str,
|
|
109
|
+
*,
|
|
110
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
111
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
112
|
+
extra_headers: Headers | None = None,
|
|
113
|
+
extra_query: Query | None = None,
|
|
114
|
+
extra_body: Body | None = None,
|
|
115
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
116
|
+
) -> Meter:
|
|
117
|
+
"""
|
|
118
|
+
Args:
|
|
119
|
+
extra_headers: Send extra headers
|
|
120
|
+
|
|
121
|
+
extra_query: Add additional query parameters to the request
|
|
122
|
+
|
|
123
|
+
extra_body: Add additional JSON properties to the request
|
|
124
|
+
|
|
125
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
126
|
+
"""
|
|
127
|
+
if not id:
|
|
128
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
129
|
+
return self._get(
|
|
130
|
+
f"/meters/{id}",
|
|
131
|
+
options=make_request_options(
|
|
132
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
133
|
+
),
|
|
134
|
+
cast_to=Meter,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def list(
|
|
138
|
+
self,
|
|
139
|
+
*,
|
|
140
|
+
archived: bool | Omit = omit,
|
|
141
|
+
page_number: int | Omit = omit,
|
|
142
|
+
page_size: int | Omit = omit,
|
|
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
|
+
) -> SyncDefaultPageNumberPagination[Meter]:
|
|
150
|
+
"""
|
|
151
|
+
Args:
|
|
152
|
+
archived: List archived meters
|
|
153
|
+
|
|
154
|
+
page_number: Page number default is 0
|
|
155
|
+
|
|
156
|
+
page_size: Page size default is 10 max is 100
|
|
157
|
+
|
|
158
|
+
extra_headers: Send extra headers
|
|
159
|
+
|
|
160
|
+
extra_query: Add additional query parameters to the request
|
|
161
|
+
|
|
162
|
+
extra_body: Add additional JSON properties to the request
|
|
163
|
+
|
|
164
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
165
|
+
"""
|
|
166
|
+
return self._get_api_list(
|
|
167
|
+
"/meters",
|
|
168
|
+
page=SyncDefaultPageNumberPagination[Meter],
|
|
169
|
+
options=make_request_options(
|
|
170
|
+
extra_headers=extra_headers,
|
|
171
|
+
extra_query=extra_query,
|
|
172
|
+
extra_body=extra_body,
|
|
173
|
+
timeout=timeout,
|
|
174
|
+
query=maybe_transform(
|
|
175
|
+
{
|
|
176
|
+
"archived": archived,
|
|
177
|
+
"page_number": page_number,
|
|
178
|
+
"page_size": page_size,
|
|
179
|
+
},
|
|
180
|
+
meter_list_params.MeterListParams,
|
|
181
|
+
),
|
|
182
|
+
),
|
|
183
|
+
model=Meter,
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
def archive(
|
|
187
|
+
self,
|
|
188
|
+
id: str,
|
|
189
|
+
*,
|
|
190
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
191
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
192
|
+
extra_headers: Headers | None = None,
|
|
193
|
+
extra_query: Query | None = None,
|
|
194
|
+
extra_body: Body | None = None,
|
|
195
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
196
|
+
) -> None:
|
|
197
|
+
"""
|
|
198
|
+
Args:
|
|
199
|
+
extra_headers: Send extra headers
|
|
200
|
+
|
|
201
|
+
extra_query: Add additional query parameters to the request
|
|
202
|
+
|
|
203
|
+
extra_body: Add additional JSON properties to the request
|
|
204
|
+
|
|
205
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
206
|
+
"""
|
|
207
|
+
if not id:
|
|
208
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
209
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
210
|
+
return self._delete(
|
|
211
|
+
f"/meters/{id}",
|
|
212
|
+
options=make_request_options(
|
|
213
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
214
|
+
),
|
|
215
|
+
cast_to=NoneType,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
def unarchive(
|
|
219
|
+
self,
|
|
220
|
+
id: str,
|
|
221
|
+
*,
|
|
222
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
223
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
224
|
+
extra_headers: Headers | None = None,
|
|
225
|
+
extra_query: Query | None = None,
|
|
226
|
+
extra_body: Body | None = None,
|
|
227
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
228
|
+
) -> None:
|
|
229
|
+
"""
|
|
230
|
+
Args:
|
|
231
|
+
extra_headers: Send extra headers
|
|
232
|
+
|
|
233
|
+
extra_query: Add additional query parameters to the request
|
|
234
|
+
|
|
235
|
+
extra_body: Add additional JSON properties to the request
|
|
236
|
+
|
|
237
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
238
|
+
"""
|
|
239
|
+
if not id:
|
|
240
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
241
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
242
|
+
return self._post(
|
|
243
|
+
f"/meters/{id}/unarchive",
|
|
244
|
+
options=make_request_options(
|
|
245
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
246
|
+
),
|
|
247
|
+
cast_to=NoneType,
|
|
248
|
+
)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class AsyncMetersResource(AsyncAPIResource):
|
|
252
|
+
@cached_property
|
|
253
|
+
def with_raw_response(self) -> AsyncMetersResourceWithRawResponse:
|
|
254
|
+
"""
|
|
255
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
256
|
+
the raw response object instead of the parsed content.
|
|
257
|
+
|
|
258
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#accessing-raw-response-data-eg-headers
|
|
259
|
+
"""
|
|
260
|
+
return AsyncMetersResourceWithRawResponse(self)
|
|
261
|
+
|
|
262
|
+
@cached_property
|
|
263
|
+
def with_streaming_response(self) -> AsyncMetersResourceWithStreamingResponse:
|
|
264
|
+
"""
|
|
265
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
266
|
+
|
|
267
|
+
For more information, see https://www.github.com/dodopayments/dodopayments-python#with_streaming_response
|
|
268
|
+
"""
|
|
269
|
+
return AsyncMetersResourceWithStreamingResponse(self)
|
|
270
|
+
|
|
271
|
+
async def create(
|
|
272
|
+
self,
|
|
273
|
+
*,
|
|
274
|
+
aggregation: MeterAggregationParam,
|
|
275
|
+
event_name: str,
|
|
276
|
+
measurement_unit: str,
|
|
277
|
+
name: str,
|
|
278
|
+
description: Optional[str] | Omit = omit,
|
|
279
|
+
filter: Optional[MeterFilterParam] | Omit = omit,
|
|
280
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
281
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
282
|
+
extra_headers: Headers | None = None,
|
|
283
|
+
extra_query: Query | None = None,
|
|
284
|
+
extra_body: Body | None = None,
|
|
285
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
286
|
+
) -> Meter:
|
|
287
|
+
"""
|
|
288
|
+
Args:
|
|
289
|
+
aggregation: Aggregation configuration for the meter
|
|
290
|
+
|
|
291
|
+
event_name: Event name to track
|
|
292
|
+
|
|
293
|
+
measurement_unit: measurement unit
|
|
294
|
+
|
|
295
|
+
name: Name of the meter
|
|
296
|
+
|
|
297
|
+
description: Optional description of the meter
|
|
298
|
+
|
|
299
|
+
filter: Optional filter to apply to the meter
|
|
300
|
+
|
|
301
|
+
extra_headers: Send extra headers
|
|
302
|
+
|
|
303
|
+
extra_query: Add additional query parameters to the request
|
|
304
|
+
|
|
305
|
+
extra_body: Add additional JSON properties to the request
|
|
306
|
+
|
|
307
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
308
|
+
"""
|
|
309
|
+
return await self._post(
|
|
310
|
+
"/meters",
|
|
311
|
+
body=await async_maybe_transform(
|
|
312
|
+
{
|
|
313
|
+
"aggregation": aggregation,
|
|
314
|
+
"event_name": event_name,
|
|
315
|
+
"measurement_unit": measurement_unit,
|
|
316
|
+
"name": name,
|
|
317
|
+
"description": description,
|
|
318
|
+
"filter": filter,
|
|
319
|
+
},
|
|
320
|
+
meter_create_params.MeterCreateParams,
|
|
321
|
+
),
|
|
322
|
+
options=make_request_options(
|
|
323
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
324
|
+
),
|
|
325
|
+
cast_to=Meter,
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
async def retrieve(
|
|
329
|
+
self,
|
|
330
|
+
id: str,
|
|
331
|
+
*,
|
|
332
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
333
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
334
|
+
extra_headers: Headers | None = None,
|
|
335
|
+
extra_query: Query | None = None,
|
|
336
|
+
extra_body: Body | None = None,
|
|
337
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
338
|
+
) -> Meter:
|
|
339
|
+
"""
|
|
340
|
+
Args:
|
|
341
|
+
extra_headers: Send extra headers
|
|
342
|
+
|
|
343
|
+
extra_query: Add additional query parameters to the request
|
|
344
|
+
|
|
345
|
+
extra_body: Add additional JSON properties to the request
|
|
346
|
+
|
|
347
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
348
|
+
"""
|
|
349
|
+
if not id:
|
|
350
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
351
|
+
return await self._get(
|
|
352
|
+
f"/meters/{id}",
|
|
353
|
+
options=make_request_options(
|
|
354
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
355
|
+
),
|
|
356
|
+
cast_to=Meter,
|
|
357
|
+
)
|
|
358
|
+
|
|
359
|
+
def list(
|
|
360
|
+
self,
|
|
361
|
+
*,
|
|
362
|
+
archived: bool | Omit = omit,
|
|
363
|
+
page_number: int | Omit = omit,
|
|
364
|
+
page_size: int | Omit = omit,
|
|
365
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
366
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
367
|
+
extra_headers: Headers | None = None,
|
|
368
|
+
extra_query: Query | None = None,
|
|
369
|
+
extra_body: Body | None = None,
|
|
370
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
371
|
+
) -> AsyncPaginator[Meter, AsyncDefaultPageNumberPagination[Meter]]:
|
|
372
|
+
"""
|
|
373
|
+
Args:
|
|
374
|
+
archived: List archived meters
|
|
375
|
+
|
|
376
|
+
page_number: Page number default is 0
|
|
377
|
+
|
|
378
|
+
page_size: Page size default is 10 max is 100
|
|
379
|
+
|
|
380
|
+
extra_headers: Send extra headers
|
|
381
|
+
|
|
382
|
+
extra_query: Add additional query parameters to the request
|
|
383
|
+
|
|
384
|
+
extra_body: Add additional JSON properties to the request
|
|
385
|
+
|
|
386
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
387
|
+
"""
|
|
388
|
+
return self._get_api_list(
|
|
389
|
+
"/meters",
|
|
390
|
+
page=AsyncDefaultPageNumberPagination[Meter],
|
|
391
|
+
options=make_request_options(
|
|
392
|
+
extra_headers=extra_headers,
|
|
393
|
+
extra_query=extra_query,
|
|
394
|
+
extra_body=extra_body,
|
|
395
|
+
timeout=timeout,
|
|
396
|
+
query=maybe_transform(
|
|
397
|
+
{
|
|
398
|
+
"archived": archived,
|
|
399
|
+
"page_number": page_number,
|
|
400
|
+
"page_size": page_size,
|
|
401
|
+
},
|
|
402
|
+
meter_list_params.MeterListParams,
|
|
403
|
+
),
|
|
404
|
+
),
|
|
405
|
+
model=Meter,
|
|
406
|
+
)
|
|
407
|
+
|
|
408
|
+
async def archive(
|
|
409
|
+
self,
|
|
410
|
+
id: str,
|
|
411
|
+
*,
|
|
412
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
413
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
414
|
+
extra_headers: Headers | None = None,
|
|
415
|
+
extra_query: Query | None = None,
|
|
416
|
+
extra_body: Body | None = None,
|
|
417
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
418
|
+
) -> None:
|
|
419
|
+
"""
|
|
420
|
+
Args:
|
|
421
|
+
extra_headers: Send extra headers
|
|
422
|
+
|
|
423
|
+
extra_query: Add additional query parameters to the request
|
|
424
|
+
|
|
425
|
+
extra_body: Add additional JSON properties to the request
|
|
426
|
+
|
|
427
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
428
|
+
"""
|
|
429
|
+
if not id:
|
|
430
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
431
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
432
|
+
return await self._delete(
|
|
433
|
+
f"/meters/{id}",
|
|
434
|
+
options=make_request_options(
|
|
435
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
436
|
+
),
|
|
437
|
+
cast_to=NoneType,
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
async def unarchive(
|
|
441
|
+
self,
|
|
442
|
+
id: str,
|
|
443
|
+
*,
|
|
444
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
445
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
446
|
+
extra_headers: Headers | None = None,
|
|
447
|
+
extra_query: Query | None = None,
|
|
448
|
+
extra_body: Body | None = None,
|
|
449
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
450
|
+
) -> None:
|
|
451
|
+
"""
|
|
452
|
+
Args:
|
|
453
|
+
extra_headers: Send extra headers
|
|
454
|
+
|
|
455
|
+
extra_query: Add additional query parameters to the request
|
|
456
|
+
|
|
457
|
+
extra_body: Add additional JSON properties to the request
|
|
458
|
+
|
|
459
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
460
|
+
"""
|
|
461
|
+
if not id:
|
|
462
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
463
|
+
extra_headers = {"Accept": "*/*", **(extra_headers or {})}
|
|
464
|
+
return await self._post(
|
|
465
|
+
f"/meters/{id}/unarchive",
|
|
466
|
+
options=make_request_options(
|
|
467
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
468
|
+
),
|
|
469
|
+
cast_to=NoneType,
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
class MetersResourceWithRawResponse:
|
|
474
|
+
def __init__(self, meters: MetersResource) -> None:
|
|
475
|
+
self._meters = meters
|
|
476
|
+
|
|
477
|
+
self.create = to_raw_response_wrapper(
|
|
478
|
+
meters.create,
|
|
479
|
+
)
|
|
480
|
+
self.retrieve = to_raw_response_wrapper(
|
|
481
|
+
meters.retrieve,
|
|
482
|
+
)
|
|
483
|
+
self.list = to_raw_response_wrapper(
|
|
484
|
+
meters.list,
|
|
485
|
+
)
|
|
486
|
+
self.archive = to_raw_response_wrapper(
|
|
487
|
+
meters.archive,
|
|
488
|
+
)
|
|
489
|
+
self.unarchive = to_raw_response_wrapper(
|
|
490
|
+
meters.unarchive,
|
|
491
|
+
)
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
class AsyncMetersResourceWithRawResponse:
|
|
495
|
+
def __init__(self, meters: AsyncMetersResource) -> None:
|
|
496
|
+
self._meters = meters
|
|
497
|
+
|
|
498
|
+
self.create = async_to_raw_response_wrapper(
|
|
499
|
+
meters.create,
|
|
500
|
+
)
|
|
501
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
502
|
+
meters.retrieve,
|
|
503
|
+
)
|
|
504
|
+
self.list = async_to_raw_response_wrapper(
|
|
505
|
+
meters.list,
|
|
506
|
+
)
|
|
507
|
+
self.archive = async_to_raw_response_wrapper(
|
|
508
|
+
meters.archive,
|
|
509
|
+
)
|
|
510
|
+
self.unarchive = async_to_raw_response_wrapper(
|
|
511
|
+
meters.unarchive,
|
|
512
|
+
)
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
class MetersResourceWithStreamingResponse:
|
|
516
|
+
def __init__(self, meters: MetersResource) -> None:
|
|
517
|
+
self._meters = meters
|
|
518
|
+
|
|
519
|
+
self.create = to_streamed_response_wrapper(
|
|
520
|
+
meters.create,
|
|
521
|
+
)
|
|
522
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
523
|
+
meters.retrieve,
|
|
524
|
+
)
|
|
525
|
+
self.list = to_streamed_response_wrapper(
|
|
526
|
+
meters.list,
|
|
527
|
+
)
|
|
528
|
+
self.archive = to_streamed_response_wrapper(
|
|
529
|
+
meters.archive,
|
|
530
|
+
)
|
|
531
|
+
self.unarchive = to_streamed_response_wrapper(
|
|
532
|
+
meters.unarchive,
|
|
533
|
+
)
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
class AsyncMetersResourceWithStreamingResponse:
|
|
537
|
+
def __init__(self, meters: AsyncMetersResource) -> None:
|
|
538
|
+
self._meters = meters
|
|
539
|
+
|
|
540
|
+
self.create = async_to_streamed_response_wrapper(
|
|
541
|
+
meters.create,
|
|
542
|
+
)
|
|
543
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
544
|
+
meters.retrieve,
|
|
545
|
+
)
|
|
546
|
+
self.list = async_to_streamed_response_wrapper(
|
|
547
|
+
meters.list,
|
|
548
|
+
)
|
|
549
|
+
self.archive = async_to_streamed_response_wrapper(
|
|
550
|
+
meters.archive,
|
|
551
|
+
)
|
|
552
|
+
self.unarchive = async_to_streamed_response_wrapper(
|
|
553
|
+
meters.unarchive,
|
|
554
|
+
)
|
dodopayments/resources/misc.py
CHANGED
|
@@ -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 (
|
|
@@ -47,7 +47,7 @@ class MiscResource(SyncAPIResource):
|
|
|
47
47
|
extra_headers: Headers | None = None,
|
|
48
48
|
extra_query: Query | None = None,
|
|
49
49
|
extra_body: Body | None = None,
|
|
50
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
50
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
51
51
|
) -> MiscListSupportedCountriesResponse:
|
|
52
52
|
return self._get(
|
|
53
53
|
"/checkout/supported_countries",
|
|
@@ -86,7 +86,7 @@ class AsyncMiscResource(AsyncAPIResource):
|
|
|
86
86
|
extra_headers: Headers | None = None,
|
|
87
87
|
extra_query: Query | None = None,
|
|
88
88
|
extra_body: Body | None = None,
|
|
89
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
89
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
90
90
|
) -> MiscListSupportedCountriesResponse:
|
|
91
91
|
return await self._get(
|
|
92
92
|
"/checkout/supported_countries",
|