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
|
@@ -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 NOT_GIVEN, Body, Query, Headers, NoneType, 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 ..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] | NotGiven = NOT_GIVEN,
|
|
57
|
+
filter: Optional[MeterFilterParam] | 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
|
+
) -> 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 | NotGiven = NOT_GIVEN,
|
|
141
|
+
page_number: int | NotGiven = NOT_GIVEN,
|
|
142
|
+
page_size: int | 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
|
+
) -> 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] | NotGiven = NOT_GIVEN,
|
|
279
|
+
filter: Optional[MeterFilterParam] | NotGiven = NOT_GIVEN,
|
|
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 | NotGiven = NOT_GIVEN,
|
|
363
|
+
page_number: int | NotGiven = NOT_GIVEN,
|
|
364
|
+
page_size: int | NotGiven = NOT_GIVEN,
|
|
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
|
+
)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
from typing import Dict,
|
|
5
|
+
from typing import Dict, Optional
|
|
6
6
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ from ...types import (
|
|
|
21
21
|
product_update_params,
|
|
22
22
|
product_update_files_params,
|
|
23
23
|
)
|
|
24
|
-
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven
|
|
24
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven, SequenceNotStr
|
|
25
25
|
from ..._utils import maybe_transform, async_maybe_transform
|
|
26
26
|
from ..._compat import cached_property
|
|
27
27
|
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -72,7 +72,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
72
72
|
*,
|
|
73
73
|
price: PriceParam,
|
|
74
74
|
tax_category: TaxCategory,
|
|
75
|
-
addons: Optional[
|
|
75
|
+
addons: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
76
76
|
brand_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
77
77
|
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
78
78
|
digital_product_delivery: Optional[product_create_params.DigitalProductDelivery] | NotGiven = NOT_GIVEN,
|
|
@@ -185,7 +185,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
185
185
|
self,
|
|
186
186
|
id: str,
|
|
187
187
|
*,
|
|
188
|
-
addons: Optional[
|
|
188
|
+
addons: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
189
189
|
brand_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
190
190
|
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
191
191
|
digital_product_delivery: Optional[product_update_params.DigitalProductDelivery] | NotGiven = NOT_GIVEN,
|
|
@@ -342,7 +342,7 @@ class ProductsResource(SyncAPIResource):
|
|
|
342
342
|
model=ProductListResponse,
|
|
343
343
|
)
|
|
344
344
|
|
|
345
|
-
def
|
|
345
|
+
def archive(
|
|
346
346
|
self,
|
|
347
347
|
id: str,
|
|
348
348
|
*,
|
|
@@ -469,7 +469,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
469
469
|
*,
|
|
470
470
|
price: PriceParam,
|
|
471
471
|
tax_category: TaxCategory,
|
|
472
|
-
addons: Optional[
|
|
472
|
+
addons: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
473
473
|
brand_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
474
474
|
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
475
475
|
digital_product_delivery: Optional[product_create_params.DigitalProductDelivery] | NotGiven = NOT_GIVEN,
|
|
@@ -582,7 +582,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
582
582
|
self,
|
|
583
583
|
id: str,
|
|
584
584
|
*,
|
|
585
|
-
addons: Optional[
|
|
585
|
+
addons: Optional[SequenceNotStr[str]] | NotGiven = NOT_GIVEN,
|
|
586
586
|
brand_id: Optional[str] | NotGiven = NOT_GIVEN,
|
|
587
587
|
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
588
588
|
digital_product_delivery: Optional[product_update_params.DigitalProductDelivery] | NotGiven = NOT_GIVEN,
|
|
@@ -739,7 +739,7 @@ class AsyncProductsResource(AsyncAPIResource):
|
|
|
739
739
|
model=ProductListResponse,
|
|
740
740
|
)
|
|
741
741
|
|
|
742
|
-
async def
|
|
742
|
+
async def archive(
|
|
743
743
|
self,
|
|
744
744
|
id: str,
|
|
745
745
|
*,
|
|
@@ -855,8 +855,8 @@ class ProductsResourceWithRawResponse:
|
|
|
855
855
|
self.list = to_raw_response_wrapper(
|
|
856
856
|
products.list,
|
|
857
857
|
)
|
|
858
|
-
self.
|
|
859
|
-
products.
|
|
858
|
+
self.archive = to_raw_response_wrapper(
|
|
859
|
+
products.archive,
|
|
860
860
|
)
|
|
861
861
|
self.unarchive = to_raw_response_wrapper(
|
|
862
862
|
products.unarchive,
|
|
@@ -886,8 +886,8 @@ class AsyncProductsResourceWithRawResponse:
|
|
|
886
886
|
self.list = async_to_raw_response_wrapper(
|
|
887
887
|
products.list,
|
|
888
888
|
)
|
|
889
|
-
self.
|
|
890
|
-
products.
|
|
889
|
+
self.archive = async_to_raw_response_wrapper(
|
|
890
|
+
products.archive,
|
|
891
891
|
)
|
|
892
892
|
self.unarchive = async_to_raw_response_wrapper(
|
|
893
893
|
products.unarchive,
|
|
@@ -917,8 +917,8 @@ class ProductsResourceWithStreamingResponse:
|
|
|
917
917
|
self.list = to_streamed_response_wrapper(
|
|
918
918
|
products.list,
|
|
919
919
|
)
|
|
920
|
-
self.
|
|
921
|
-
products.
|
|
920
|
+
self.archive = to_streamed_response_wrapper(
|
|
921
|
+
products.archive,
|
|
922
922
|
)
|
|
923
923
|
self.unarchive = to_streamed_response_wrapper(
|
|
924
924
|
products.unarchive,
|
|
@@ -948,8 +948,8 @@ class AsyncProductsResourceWithStreamingResponse:
|
|
|
948
948
|
self.list = async_to_streamed_response_wrapper(
|
|
949
949
|
products.list,
|
|
950
950
|
)
|
|
951
|
-
self.
|
|
952
|
-
products.
|
|
951
|
+
self.archive = async_to_streamed_response_wrapper(
|
|
952
|
+
products.archive,
|
|
953
953
|
)
|
|
954
954
|
self.unarchive = async_to_streamed_response_wrapper(
|
|
955
955
|
products.unarchive,
|