checkout-intents 0.10.0__tar.gz → 0.12.0__tar.gz
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.
- checkout_intents-0.12.0/.release-please-manifest.json +3 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/CHANGELOG.md +34 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/PKG-INFO +1 -1
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/pyproject.toml +1 -1
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_base_client.py +134 -11
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_client.py +4 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_models.py +16 -1
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_types.py +9 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_version.py +1 -1
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/resources/betas/checkout_sessions.py +18 -4
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/resources/checkout_intents.py +70 -14
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/base_checkout_intent.py +12 -1
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/betas/checkout_session_create_params.py +12 -2
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_intent_create_params.py +12 -2
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_intent_purchase_params.py +12 -2
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/api_resources/betas/test_checkout_sessions.py +2 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/api_resources/test_checkout_intents.py +4 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_client.py +249 -2
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/uv.lock +1 -1
- checkout_intents-0.10.0/.release-please-manifest.json +0 -3
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/.gitignore +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/CONTRIBUTING.md +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/LICENSE +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/README.md +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/SECURITY.md +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/api.md +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/bin/check-release-environment +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/bin/publish-pypi +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/examples/.keep +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/examples/complete-checkout-intent.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/examples/error-handling.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/noxfile.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/release-please-config.json +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/requirements-dev.lock +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/requirements.lock +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_compat.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_constants.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_exceptions.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_files.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_qs.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_resource.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_response.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_streaming.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_compat.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_datetime_parse.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_logs.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_proxy.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_reflection.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_resources_proxy.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_streams.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_sync.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_transform.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_typing.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/_utils/_utils.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/lib/.keep +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/pagination.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/py.typed +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/resources/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/resources/betas/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/resources/betas/betas.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/resources/brands.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/betas/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/brand_retrieve_response.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/buyer.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/buyer_param.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_intent.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_intent_add_payment_params.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_intent_confirm_params.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_intent_list_params.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/checkout_session.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/money.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/offer.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/payment_method.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/payment_method_param.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/variant_selection.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/src/checkout_intents/types/variant_selection_param.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/api_resources/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/api_resources/betas/__init__.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/api_resources/test_brands.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/conftest.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/sample_file.txt +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_deepcopy.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_environment_inference.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_extract_files.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_files.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_models.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_polling.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_qs.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_required_args.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_response.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_streaming.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_transform.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_utils/test_proxy.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/test_utils/test_typing.py +0 -0
- {checkout_intents-0.10.0 → checkout_intents-0.12.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.12.0 (2026-01-24)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.11.0...v0.12.0](https://github.com/rye-com/checkout-intents-python/compare/v0.11.0...v0.12.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* add support for idempotency for v2 api ([b7a09af](https://github.com/rye-com/checkout-intents-python/commit/b7a09af76927e67befdbe59566bddf7ab43240f0))
|
|
10
|
+
* **api:** introduce offerRetrievalEffort constraint ([5bc7a2c](https://github.com/rye-com/checkout-intents-python/commit/5bc7a2cc58c555dd4dcd5c0e3abf1f157cd61e8f))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Chores
|
|
14
|
+
|
|
15
|
+
* **ci:** upgrade `actions/github-script` ([526d94a](https://github.com/rye-com/checkout-intents-python/commit/526d94ae385eb0e5f54124ca429651d55ce0ec53))
|
|
16
|
+
* **internal:** update `actions/checkout` version ([9eadb2e](https://github.com/rye-com/checkout-intents-python/commit/9eadb2e9a5a8abaad98be7567dd3dc195458cd53))
|
|
17
|
+
|
|
18
|
+
## 0.11.0 (2026-01-15)
|
|
19
|
+
|
|
20
|
+
Full Changelog: [v0.10.0...v0.11.0](https://github.com/rye-com/checkout-intents-python/compare/v0.10.0...v0.11.0)
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* **client:** add support for binary request streaming ([438d3db](https://github.com/rye-com/checkout-intents-python/commit/438d3db019a0e94f9f7d2ea204887c15ea34ec8d))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* **api:** correctly type quantity as int ([c0cfd41](https://github.com/rye-com/checkout-intents-python/commit/c0cfd41c5d71765cf3d34eddd1c640282caa4c33))
|
|
30
|
+
* **api:** correctly type quantity as integer ([642e3f2](https://github.com/rye-com/checkout-intents-python/commit/642e3f206f4ba6120ff4f9892c8bc077f10fedfd))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Chores
|
|
34
|
+
|
|
35
|
+
* **internal:** bump uv.lock version ([9e551da](https://github.com/rye-com/checkout-intents-python/commit/9e551da1755c820314699cc0d2ccaf8578f5f7f8))
|
|
36
|
+
|
|
3
37
|
## 0.10.0 (2026-01-06)
|
|
4
38
|
|
|
5
39
|
Full Changelog: [v0.9.0...v0.10.0](https://github.com/rye-com/checkout-intents-python/compare/v0.9.0...v0.10.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: checkout-intents
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.12.0
|
|
4
4
|
Summary: The official Python library for the Checkout Intents API
|
|
5
5
|
Project-URL: Homepage, https://github.com/rye-com/checkout-intents-python
|
|
6
6
|
Project-URL: Repository, https://github.com/rye-com/checkout-intents-python
|
|
@@ -9,6 +9,7 @@ import asyncio
|
|
|
9
9
|
import inspect
|
|
10
10
|
import logging
|
|
11
11
|
import platform
|
|
12
|
+
import warnings
|
|
12
13
|
import email.utils
|
|
13
14
|
from types import TracebackType
|
|
14
15
|
from random import random
|
|
@@ -51,9 +52,11 @@ from ._types import (
|
|
|
51
52
|
ResponseT,
|
|
52
53
|
AnyMapping,
|
|
53
54
|
PostParser,
|
|
55
|
+
BinaryTypes,
|
|
54
56
|
RequestFiles,
|
|
55
57
|
HttpxSendArgs,
|
|
56
58
|
RequestOptions,
|
|
59
|
+
AsyncBinaryTypes,
|
|
57
60
|
HttpxRequestFiles,
|
|
58
61
|
ModelBuilderProtocol,
|
|
59
62
|
not_given,
|
|
@@ -477,8 +480,19 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
477
480
|
retries_taken: int = 0,
|
|
478
481
|
) -> httpx.Request:
|
|
479
482
|
if log.isEnabledFor(logging.DEBUG):
|
|
480
|
-
log.debug(
|
|
481
|
-
|
|
483
|
+
log.debug(
|
|
484
|
+
"Request options: %s",
|
|
485
|
+
model_dump(
|
|
486
|
+
options,
|
|
487
|
+
exclude_unset=True,
|
|
488
|
+
# Pydantic v1 can't dump every type we support in content, so we exclude it for now.
|
|
489
|
+
exclude={
|
|
490
|
+
"content",
|
|
491
|
+
}
|
|
492
|
+
if PYDANTIC_V1
|
|
493
|
+
else {},
|
|
494
|
+
),
|
|
495
|
+
)
|
|
482
496
|
kwargs: dict[str, Any] = {}
|
|
483
497
|
|
|
484
498
|
json_data = options.json_data
|
|
@@ -532,7 +546,13 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]):
|
|
|
532
546
|
is_body_allowed = options.method.lower() != "get"
|
|
533
547
|
|
|
534
548
|
if is_body_allowed:
|
|
535
|
-
if
|
|
549
|
+
if options.content is not None and json_data is not None:
|
|
550
|
+
raise TypeError("Passing both `content` and `json_data` is not supported")
|
|
551
|
+
if options.content is not None and files is not None:
|
|
552
|
+
raise TypeError("Passing both `content` and `files` is not supported")
|
|
553
|
+
if options.content is not None:
|
|
554
|
+
kwargs["content"] = options.content
|
|
555
|
+
elif isinstance(json_data, bytes):
|
|
536
556
|
kwargs["content"] = json_data
|
|
537
557
|
else:
|
|
538
558
|
kwargs["json"] = json_data if is_given(json_data) else None
|
|
@@ -1194,6 +1214,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1194
1214
|
*,
|
|
1195
1215
|
cast_to: Type[ResponseT],
|
|
1196
1216
|
body: Body | None = None,
|
|
1217
|
+
content: BinaryTypes | None = None,
|
|
1197
1218
|
options: RequestOptions = {},
|
|
1198
1219
|
files: RequestFiles | None = None,
|
|
1199
1220
|
stream: Literal[False] = False,
|
|
@@ -1206,6 +1227,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1206
1227
|
*,
|
|
1207
1228
|
cast_to: Type[ResponseT],
|
|
1208
1229
|
body: Body | None = None,
|
|
1230
|
+
content: BinaryTypes | None = None,
|
|
1209
1231
|
options: RequestOptions = {},
|
|
1210
1232
|
files: RequestFiles | None = None,
|
|
1211
1233
|
stream: Literal[True],
|
|
@@ -1219,6 +1241,7 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1219
1241
|
*,
|
|
1220
1242
|
cast_to: Type[ResponseT],
|
|
1221
1243
|
body: Body | None = None,
|
|
1244
|
+
content: BinaryTypes | None = None,
|
|
1222
1245
|
options: RequestOptions = {},
|
|
1223
1246
|
files: RequestFiles | None = None,
|
|
1224
1247
|
stream: bool,
|
|
@@ -1231,13 +1254,25 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1231
1254
|
*,
|
|
1232
1255
|
cast_to: Type[ResponseT],
|
|
1233
1256
|
body: Body | None = None,
|
|
1257
|
+
content: BinaryTypes | None = None,
|
|
1234
1258
|
options: RequestOptions = {},
|
|
1235
1259
|
files: RequestFiles | None = None,
|
|
1236
1260
|
stream: bool = False,
|
|
1237
1261
|
stream_cls: type[_StreamT] | None = None,
|
|
1238
1262
|
) -> ResponseT | _StreamT:
|
|
1263
|
+
if body is not None and content is not None:
|
|
1264
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1265
|
+
if files is not None and content is not None:
|
|
1266
|
+
raise TypeError("Passing both `files` and `content` is not supported")
|
|
1267
|
+
if isinstance(body, bytes):
|
|
1268
|
+
warnings.warn(
|
|
1269
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1270
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1271
|
+
DeprecationWarning,
|
|
1272
|
+
stacklevel=2,
|
|
1273
|
+
)
|
|
1239
1274
|
opts = FinalRequestOptions.construct(
|
|
1240
|
-
method="post", url=path, json_data=body, files=to_httpx_files(files), **options
|
|
1275
|
+
method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
|
|
1241
1276
|
)
|
|
1242
1277
|
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
|
|
1243
1278
|
|
|
@@ -1247,11 +1282,23 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1247
1282
|
*,
|
|
1248
1283
|
cast_to: Type[ResponseT],
|
|
1249
1284
|
body: Body | None = None,
|
|
1285
|
+
content: BinaryTypes | None = None,
|
|
1250
1286
|
files: RequestFiles | None = None,
|
|
1251
1287
|
options: RequestOptions = {},
|
|
1252
1288
|
) -> ResponseT:
|
|
1289
|
+
if body is not None and content is not None:
|
|
1290
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1291
|
+
if files is not None and content is not None:
|
|
1292
|
+
raise TypeError("Passing both `files` and `content` is not supported")
|
|
1293
|
+
if isinstance(body, bytes):
|
|
1294
|
+
warnings.warn(
|
|
1295
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1296
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1297
|
+
DeprecationWarning,
|
|
1298
|
+
stacklevel=2,
|
|
1299
|
+
)
|
|
1253
1300
|
opts = FinalRequestOptions.construct(
|
|
1254
|
-
method="patch", url=path, json_data=body, files=to_httpx_files(files), **options
|
|
1301
|
+
method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
|
|
1255
1302
|
)
|
|
1256
1303
|
return self.request(cast_to, opts)
|
|
1257
1304
|
|
|
@@ -1261,11 +1308,23 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1261
1308
|
*,
|
|
1262
1309
|
cast_to: Type[ResponseT],
|
|
1263
1310
|
body: Body | None = None,
|
|
1311
|
+
content: BinaryTypes | None = None,
|
|
1264
1312
|
files: RequestFiles | None = None,
|
|
1265
1313
|
options: RequestOptions = {},
|
|
1266
1314
|
) -> ResponseT:
|
|
1315
|
+
if body is not None and content is not None:
|
|
1316
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1317
|
+
if files is not None and content is not None:
|
|
1318
|
+
raise TypeError("Passing both `files` and `content` is not supported")
|
|
1319
|
+
if isinstance(body, bytes):
|
|
1320
|
+
warnings.warn(
|
|
1321
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1322
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1323
|
+
DeprecationWarning,
|
|
1324
|
+
stacklevel=2,
|
|
1325
|
+
)
|
|
1267
1326
|
opts = FinalRequestOptions.construct(
|
|
1268
|
-
method="put", url=path, json_data=body, files=to_httpx_files(files), **options
|
|
1327
|
+
method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options
|
|
1269
1328
|
)
|
|
1270
1329
|
return self.request(cast_to, opts)
|
|
1271
1330
|
|
|
@@ -1275,9 +1334,19 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1275
1334
|
*,
|
|
1276
1335
|
cast_to: Type[ResponseT],
|
|
1277
1336
|
body: Body | None = None,
|
|
1337
|
+
content: BinaryTypes | None = None,
|
|
1278
1338
|
options: RequestOptions = {},
|
|
1279
1339
|
) -> ResponseT:
|
|
1280
|
-
|
|
1340
|
+
if body is not None and content is not None:
|
|
1341
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1342
|
+
if isinstance(body, bytes):
|
|
1343
|
+
warnings.warn(
|
|
1344
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1345
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1346
|
+
DeprecationWarning,
|
|
1347
|
+
stacklevel=2,
|
|
1348
|
+
)
|
|
1349
|
+
opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options)
|
|
1281
1350
|
return self.request(cast_to, opts)
|
|
1282
1351
|
|
|
1283
1352
|
def get_api_list(
|
|
@@ -1717,6 +1786,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1717
1786
|
*,
|
|
1718
1787
|
cast_to: Type[ResponseT],
|
|
1719
1788
|
body: Body | None = None,
|
|
1789
|
+
content: AsyncBinaryTypes | None = None,
|
|
1720
1790
|
files: RequestFiles | None = None,
|
|
1721
1791
|
options: RequestOptions = {},
|
|
1722
1792
|
stream: Literal[False] = False,
|
|
@@ -1729,6 +1799,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1729
1799
|
*,
|
|
1730
1800
|
cast_to: Type[ResponseT],
|
|
1731
1801
|
body: Body | None = None,
|
|
1802
|
+
content: AsyncBinaryTypes | None = None,
|
|
1732
1803
|
files: RequestFiles | None = None,
|
|
1733
1804
|
options: RequestOptions = {},
|
|
1734
1805
|
stream: Literal[True],
|
|
@@ -1742,6 +1813,7 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1742
1813
|
*,
|
|
1743
1814
|
cast_to: Type[ResponseT],
|
|
1744
1815
|
body: Body | None = None,
|
|
1816
|
+
content: AsyncBinaryTypes | None = None,
|
|
1745
1817
|
files: RequestFiles | None = None,
|
|
1746
1818
|
options: RequestOptions = {},
|
|
1747
1819
|
stream: bool,
|
|
@@ -1754,13 +1826,25 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1754
1826
|
*,
|
|
1755
1827
|
cast_to: Type[ResponseT],
|
|
1756
1828
|
body: Body | None = None,
|
|
1829
|
+
content: AsyncBinaryTypes | None = None,
|
|
1757
1830
|
files: RequestFiles | None = None,
|
|
1758
1831
|
options: RequestOptions = {},
|
|
1759
1832
|
stream: bool = False,
|
|
1760
1833
|
stream_cls: type[_AsyncStreamT] | None = None,
|
|
1761
1834
|
) -> ResponseT | _AsyncStreamT:
|
|
1835
|
+
if body is not None and content is not None:
|
|
1836
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1837
|
+
if files is not None and content is not None:
|
|
1838
|
+
raise TypeError("Passing both `files` and `content` is not supported")
|
|
1839
|
+
if isinstance(body, bytes):
|
|
1840
|
+
warnings.warn(
|
|
1841
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1842
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1843
|
+
DeprecationWarning,
|
|
1844
|
+
stacklevel=2,
|
|
1845
|
+
)
|
|
1762
1846
|
opts = FinalRequestOptions.construct(
|
|
1763
|
-
method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options
|
|
1847
|
+
method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options
|
|
1764
1848
|
)
|
|
1765
1849
|
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
|
|
1766
1850
|
|
|
@@ -1770,11 +1854,28 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1770
1854
|
*,
|
|
1771
1855
|
cast_to: Type[ResponseT],
|
|
1772
1856
|
body: Body | None = None,
|
|
1857
|
+
content: AsyncBinaryTypes | None = None,
|
|
1773
1858
|
files: RequestFiles | None = None,
|
|
1774
1859
|
options: RequestOptions = {},
|
|
1775
1860
|
) -> ResponseT:
|
|
1861
|
+
if body is not None and content is not None:
|
|
1862
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1863
|
+
if files is not None and content is not None:
|
|
1864
|
+
raise TypeError("Passing both `files` and `content` is not supported")
|
|
1865
|
+
if isinstance(body, bytes):
|
|
1866
|
+
warnings.warn(
|
|
1867
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1868
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1869
|
+
DeprecationWarning,
|
|
1870
|
+
stacklevel=2,
|
|
1871
|
+
)
|
|
1776
1872
|
opts = FinalRequestOptions.construct(
|
|
1777
|
-
method="patch",
|
|
1873
|
+
method="patch",
|
|
1874
|
+
url=path,
|
|
1875
|
+
json_data=body,
|
|
1876
|
+
content=content,
|
|
1877
|
+
files=await async_to_httpx_files(files),
|
|
1878
|
+
**options,
|
|
1778
1879
|
)
|
|
1779
1880
|
return await self.request(cast_to, opts)
|
|
1780
1881
|
|
|
@@ -1784,11 +1885,23 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1784
1885
|
*,
|
|
1785
1886
|
cast_to: Type[ResponseT],
|
|
1786
1887
|
body: Body | None = None,
|
|
1888
|
+
content: AsyncBinaryTypes | None = None,
|
|
1787
1889
|
files: RequestFiles | None = None,
|
|
1788
1890
|
options: RequestOptions = {},
|
|
1789
1891
|
) -> ResponseT:
|
|
1892
|
+
if body is not None and content is not None:
|
|
1893
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1894
|
+
if files is not None and content is not None:
|
|
1895
|
+
raise TypeError("Passing both `files` and `content` is not supported")
|
|
1896
|
+
if isinstance(body, bytes):
|
|
1897
|
+
warnings.warn(
|
|
1898
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1899
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1900
|
+
DeprecationWarning,
|
|
1901
|
+
stacklevel=2,
|
|
1902
|
+
)
|
|
1790
1903
|
opts = FinalRequestOptions.construct(
|
|
1791
|
-
method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options
|
|
1904
|
+
method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options
|
|
1792
1905
|
)
|
|
1793
1906
|
return await self.request(cast_to, opts)
|
|
1794
1907
|
|
|
@@ -1798,9 +1911,19 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1798
1911
|
*,
|
|
1799
1912
|
cast_to: Type[ResponseT],
|
|
1800
1913
|
body: Body | None = None,
|
|
1914
|
+
content: AsyncBinaryTypes | None = None,
|
|
1801
1915
|
options: RequestOptions = {},
|
|
1802
1916
|
) -> ResponseT:
|
|
1803
|
-
|
|
1917
|
+
if body is not None and content is not None:
|
|
1918
|
+
raise TypeError("Passing both `body` and `content` is not supported")
|
|
1919
|
+
if isinstance(body, bytes):
|
|
1920
|
+
warnings.warn(
|
|
1921
|
+
"Passing raw bytes as `body` is deprecated and will be removed in a future version. "
|
|
1922
|
+
"Please pass raw bytes via the `content` parameter instead.",
|
|
1923
|
+
DeprecationWarning,
|
|
1924
|
+
stacklevel=2,
|
|
1925
|
+
)
|
|
1926
|
+
opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options)
|
|
1804
1927
|
return await self.request(cast_to, opts)
|
|
1805
1928
|
|
|
1806
1929
|
def get_api_list(
|
|
@@ -167,6 +167,8 @@ class CheckoutIntents(SyncAPIClient):
|
|
|
167
167
|
_strict_response_validation=_strict_response_validation,
|
|
168
168
|
)
|
|
169
169
|
|
|
170
|
+
self._idempotency_header = "Idempotency-Key"
|
|
171
|
+
|
|
170
172
|
@cached_property
|
|
171
173
|
def checkout_intents(self) -> CheckoutIntentsResource:
|
|
172
174
|
from .resources.checkout_intents import CheckoutIntentsResource
|
|
@@ -396,6 +398,8 @@ class AsyncCheckoutIntents(AsyncAPIClient):
|
|
|
396
398
|
_strict_response_validation=_strict_response_validation,
|
|
397
399
|
)
|
|
398
400
|
|
|
401
|
+
self._idempotency_header = "Idempotency-Key"
|
|
402
|
+
|
|
399
403
|
@cached_property
|
|
400
404
|
def checkout_intents(self) -> AsyncCheckoutIntentsResource:
|
|
401
405
|
from .resources.checkout_intents import AsyncCheckoutIntentsResource
|
|
@@ -3,7 +3,20 @@ from __future__ import annotations
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
5
|
import weakref
|
|
6
|
-
from typing import
|
|
6
|
+
from typing import (
|
|
7
|
+
IO,
|
|
8
|
+
TYPE_CHECKING,
|
|
9
|
+
Any,
|
|
10
|
+
Type,
|
|
11
|
+
Union,
|
|
12
|
+
Generic,
|
|
13
|
+
TypeVar,
|
|
14
|
+
Callable,
|
|
15
|
+
Iterable,
|
|
16
|
+
Optional,
|
|
17
|
+
AsyncIterable,
|
|
18
|
+
cast,
|
|
19
|
+
)
|
|
7
20
|
from datetime import date, datetime
|
|
8
21
|
from typing_extensions import (
|
|
9
22
|
List,
|
|
@@ -787,6 +800,7 @@ class FinalRequestOptionsInput(TypedDict, total=False):
|
|
|
787
800
|
timeout: float | Timeout | None
|
|
788
801
|
files: HttpxRequestFiles | None
|
|
789
802
|
idempotency_key: str
|
|
803
|
+
content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None]
|
|
790
804
|
json_data: Body
|
|
791
805
|
extra_json: AnyMapping
|
|
792
806
|
follow_redirects: bool
|
|
@@ -805,6 +819,7 @@ class FinalRequestOptions(pydantic.BaseModel):
|
|
|
805
819
|
post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven()
|
|
806
820
|
follow_redirects: Union[bool, None] = None
|
|
807
821
|
|
|
822
|
+
content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None
|
|
808
823
|
# It should be noted that we cannot use `json` here as that would override
|
|
809
824
|
# a BaseModel method in an incompatible fashion.
|
|
810
825
|
json_data: Union[Body, None] = None
|
|
@@ -13,9 +13,11 @@ from typing import (
|
|
|
13
13
|
Mapping,
|
|
14
14
|
TypeVar,
|
|
15
15
|
Callable,
|
|
16
|
+
Iterable,
|
|
16
17
|
Iterator,
|
|
17
18
|
Optional,
|
|
18
19
|
Sequence,
|
|
20
|
+
AsyncIterable,
|
|
19
21
|
)
|
|
20
22
|
from typing_extensions import (
|
|
21
23
|
Set,
|
|
@@ -56,6 +58,13 @@ if TYPE_CHECKING:
|
|
|
56
58
|
else:
|
|
57
59
|
Base64FileInput = Union[IO[bytes], PathLike]
|
|
58
60
|
FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8.
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
# Used for sending raw binary data / streaming data in request bodies
|
|
64
|
+
# e.g. for file uploads without multipart encoding
|
|
65
|
+
BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]]
|
|
66
|
+
AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]]
|
|
67
|
+
|
|
59
68
|
FileTypes = Union[
|
|
60
69
|
# file (or bytes)
|
|
61
70
|
FileContent,
|
|
@@ -48,7 +48,7 @@ class CheckoutSessionsResource(SyncAPIResource):
|
|
|
48
48
|
self,
|
|
49
49
|
*,
|
|
50
50
|
product_url: str,
|
|
51
|
-
quantity:
|
|
51
|
+
quantity: int,
|
|
52
52
|
buyer: checkout_session_create_params.Buyer | Omit = omit,
|
|
53
53
|
constraints: checkout_session_create_params.Constraints | Omit = omit,
|
|
54
54
|
promo_codes: SequenceNotStr[str] | Omit = omit,
|
|
@@ -59,6 +59,7 @@ class CheckoutSessionsResource(SyncAPIResource):
|
|
|
59
59
|
extra_query: Query | None = None,
|
|
60
60
|
extra_body: Body | None = None,
|
|
61
61
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
62
|
+
idempotency_key: str | None = None,
|
|
62
63
|
) -> CheckoutSession:
|
|
63
64
|
"""
|
|
64
65
|
Create a new checkout session.
|
|
@@ -77,6 +78,8 @@ class CheckoutSessionsResource(SyncAPIResource):
|
|
|
77
78
|
extra_body: Add additional JSON properties to the request
|
|
78
79
|
|
|
79
80
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
81
|
+
|
|
82
|
+
idempotency_key: Specify a custom idempotency key for this request
|
|
80
83
|
"""
|
|
81
84
|
return self._post(
|
|
82
85
|
"/api/v1/betas/checkout-sessions",
|
|
@@ -92,7 +95,11 @@ class CheckoutSessionsResource(SyncAPIResource):
|
|
|
92
95
|
checkout_session_create_params.CheckoutSessionCreateParams,
|
|
93
96
|
),
|
|
94
97
|
options=make_request_options(
|
|
95
|
-
extra_headers=extra_headers,
|
|
98
|
+
extra_headers=extra_headers,
|
|
99
|
+
extra_query=extra_query,
|
|
100
|
+
extra_body=extra_body,
|
|
101
|
+
timeout=timeout,
|
|
102
|
+
idempotency_key=idempotency_key,
|
|
96
103
|
),
|
|
97
104
|
cast_to=CheckoutSession,
|
|
98
105
|
)
|
|
@@ -122,7 +129,7 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
|
|
|
122
129
|
self,
|
|
123
130
|
*,
|
|
124
131
|
product_url: str,
|
|
125
|
-
quantity:
|
|
132
|
+
quantity: int,
|
|
126
133
|
buyer: checkout_session_create_params.Buyer | Omit = omit,
|
|
127
134
|
constraints: checkout_session_create_params.Constraints | Omit = omit,
|
|
128
135
|
promo_codes: SequenceNotStr[str] | Omit = omit,
|
|
@@ -133,6 +140,7 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
|
|
|
133
140
|
extra_query: Query | None = None,
|
|
134
141
|
extra_body: Body | None = None,
|
|
135
142
|
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
143
|
+
idempotency_key: str | None = None,
|
|
136
144
|
) -> CheckoutSession:
|
|
137
145
|
"""
|
|
138
146
|
Create a new checkout session.
|
|
@@ -151,6 +159,8 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
|
|
|
151
159
|
extra_body: Add additional JSON properties to the request
|
|
152
160
|
|
|
153
161
|
timeout: Override the client-level default timeout for this request, in seconds
|
|
162
|
+
|
|
163
|
+
idempotency_key: Specify a custom idempotency key for this request
|
|
154
164
|
"""
|
|
155
165
|
return await self._post(
|
|
156
166
|
"/api/v1/betas/checkout-sessions",
|
|
@@ -166,7 +176,11 @@ class AsyncCheckoutSessionsResource(AsyncAPIResource):
|
|
|
166
176
|
checkout_session_create_params.CheckoutSessionCreateParams,
|
|
167
177
|
),
|
|
168
178
|
options=make_request_options(
|
|
169
|
-
extra_headers=extra_headers,
|
|
179
|
+
extra_headers=extra_headers,
|
|
180
|
+
extra_query=extra_query,
|
|
181
|
+
extra_body=extra_body,
|
|
182
|
+
timeout=timeout,
|
|
183
|
+
idempotency_key=idempotency_key,
|
|
170
184
|
),
|
|
171
185
|
cast_to=CheckoutSession,
|
|
172
186
|
)
|