checkout-intents 0.3.1__py3-none-any.whl → 0.3.3__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.
- checkout_intents/_base_client.py +8 -2
- checkout_intents/_client.py +105 -30
- checkout_intents/_streaming.py +12 -10
- checkout_intents/_types.py +3 -2
- checkout_intents/_version.py +1 -1
- {checkout_intents-0.3.1.dist-info → checkout_intents-0.3.3.dist-info}/METADATA +5 -2
- {checkout_intents-0.3.1.dist-info → checkout_intents-0.3.3.dist-info}/RECORD +9 -9
- {checkout_intents-0.3.1.dist-info → checkout_intents-0.3.3.dist-info}/WHEEL +0 -0
- {checkout_intents-0.3.1.dist-info → checkout_intents-0.3.3.dist-info}/licenses/LICENSE +0 -0
checkout_intents/_base_client.py
CHANGED
|
@@ -1247,9 +1247,12 @@ class SyncAPIClient(BaseClient[httpx.Client, Stream[Any]]):
|
|
|
1247
1247
|
*,
|
|
1248
1248
|
cast_to: Type[ResponseT],
|
|
1249
1249
|
body: Body | None = None,
|
|
1250
|
+
files: RequestFiles | None = None,
|
|
1250
1251
|
options: RequestOptions = {},
|
|
1251
1252
|
) -> ResponseT:
|
|
1252
|
-
opts = FinalRequestOptions.construct(
|
|
1253
|
+
opts = FinalRequestOptions.construct(
|
|
1254
|
+
method="patch", url=path, json_data=body, files=to_httpx_files(files), **options
|
|
1255
|
+
)
|
|
1253
1256
|
return self.request(cast_to, opts)
|
|
1254
1257
|
|
|
1255
1258
|
def put(
|
|
@@ -1767,9 +1770,12 @@ class AsyncAPIClient(BaseClient[httpx.AsyncClient, AsyncStream[Any]]):
|
|
|
1767
1770
|
*,
|
|
1768
1771
|
cast_to: Type[ResponseT],
|
|
1769
1772
|
body: Body | None = None,
|
|
1773
|
+
files: RequestFiles | None = None,
|
|
1770
1774
|
options: RequestOptions = {},
|
|
1771
1775
|
) -> ResponseT:
|
|
1772
|
-
opts = FinalRequestOptions.construct(
|
|
1776
|
+
opts = FinalRequestOptions.construct(
|
|
1777
|
+
method="patch", url=path, json_data=body, files=to_httpx_files(files), **options
|
|
1778
|
+
)
|
|
1773
1779
|
return await self.request(cast_to, opts)
|
|
1774
1780
|
|
|
1775
1781
|
async def put(
|
checkout_intents/_client.py
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
5
|
import os
|
|
6
|
-
from typing import Any, Dict, Mapping, cast
|
|
6
|
+
from typing import TYPE_CHECKING, Any, Dict, Mapping, cast
|
|
7
7
|
from typing_extensions import Self, Literal, override
|
|
8
8
|
|
|
9
9
|
import httpx
|
|
@@ -20,8 +20,8 @@ from ._types import (
|
|
|
20
20
|
not_given,
|
|
21
21
|
)
|
|
22
22
|
from ._utils import is_given, get_async_library
|
|
23
|
+
from ._compat import cached_property
|
|
23
24
|
from ._version import __version__
|
|
24
|
-
from .resources import brands, checkout_intents
|
|
25
25
|
from ._streaming import Stream as Stream, AsyncStream as AsyncStream
|
|
26
26
|
from ._exceptions import APIStatusError, CheckoutIntentsError
|
|
27
27
|
from ._base_client import (
|
|
@@ -30,6 +30,11 @@ from ._base_client import (
|
|
|
30
30
|
AsyncAPIClient,
|
|
31
31
|
)
|
|
32
32
|
|
|
33
|
+
if TYPE_CHECKING:
|
|
34
|
+
from .resources import brands, checkout_intents
|
|
35
|
+
from .resources.brands import BrandsResource, AsyncBrandsResource
|
|
36
|
+
from .resources.checkout_intents import CheckoutIntentsResource, AsyncCheckoutIntentsResource
|
|
37
|
+
|
|
33
38
|
__all__ = [
|
|
34
39
|
"ENVIRONMENTS",
|
|
35
40
|
"Timeout",
|
|
@@ -66,11 +71,6 @@ def _extract_environment_from_api_key(api_key: str) -> Literal["staging", "produ
|
|
|
66
71
|
|
|
67
72
|
|
|
68
73
|
class CheckoutIntents(SyncAPIClient):
|
|
69
|
-
checkout_intents: checkout_intents.CheckoutIntentsResource
|
|
70
|
-
brands: brands.BrandsResource
|
|
71
|
-
with_raw_response: CheckoutIntentsWithRawResponse
|
|
72
|
-
with_streaming_response: CheckoutIntentsWithStreamedResponse
|
|
73
|
-
|
|
74
74
|
# client options
|
|
75
75
|
api_key: str
|
|
76
76
|
|
|
@@ -166,10 +166,25 @@ class CheckoutIntents(SyncAPIClient):
|
|
|
166
166
|
_strict_response_validation=_strict_response_validation,
|
|
167
167
|
)
|
|
168
168
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
@cached_property
|
|
170
|
+
def checkout_intents(self) -> CheckoutIntentsResource:
|
|
171
|
+
from .resources.checkout_intents import CheckoutIntentsResource
|
|
172
|
+
|
|
173
|
+
return CheckoutIntentsResource(self)
|
|
174
|
+
|
|
175
|
+
@cached_property
|
|
176
|
+
def brands(self) -> BrandsResource:
|
|
177
|
+
from .resources.brands import BrandsResource
|
|
178
|
+
|
|
179
|
+
return BrandsResource(self)
|
|
180
|
+
|
|
181
|
+
@cached_property
|
|
182
|
+
def with_raw_response(self) -> CheckoutIntentsWithRawResponse:
|
|
183
|
+
return CheckoutIntentsWithRawResponse(self)
|
|
184
|
+
|
|
185
|
+
@cached_property
|
|
186
|
+
def with_streaming_response(self) -> CheckoutIntentsWithStreamedResponse:
|
|
187
|
+
return CheckoutIntentsWithStreamedResponse(self)
|
|
173
188
|
|
|
174
189
|
@property
|
|
175
190
|
@override
|
|
@@ -279,11 +294,6 @@ class CheckoutIntents(SyncAPIClient):
|
|
|
279
294
|
|
|
280
295
|
|
|
281
296
|
class AsyncCheckoutIntents(AsyncAPIClient):
|
|
282
|
-
checkout_intents: checkout_intents.AsyncCheckoutIntentsResource
|
|
283
|
-
brands: brands.AsyncBrandsResource
|
|
284
|
-
with_raw_response: AsyncCheckoutIntentsWithRawResponse
|
|
285
|
-
with_streaming_response: AsyncCheckoutIntentsWithStreamedResponse
|
|
286
|
-
|
|
287
297
|
# client options
|
|
288
298
|
api_key: str
|
|
289
299
|
|
|
@@ -379,10 +389,25 @@ class AsyncCheckoutIntents(AsyncAPIClient):
|
|
|
379
389
|
_strict_response_validation=_strict_response_validation,
|
|
380
390
|
)
|
|
381
391
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
392
|
+
@cached_property
|
|
393
|
+
def checkout_intents(self) -> AsyncCheckoutIntentsResource:
|
|
394
|
+
from .resources.checkout_intents import AsyncCheckoutIntentsResource
|
|
395
|
+
|
|
396
|
+
return AsyncCheckoutIntentsResource(self)
|
|
397
|
+
|
|
398
|
+
@cached_property
|
|
399
|
+
def brands(self) -> AsyncBrandsResource:
|
|
400
|
+
from .resources.brands import AsyncBrandsResource
|
|
401
|
+
|
|
402
|
+
return AsyncBrandsResource(self)
|
|
403
|
+
|
|
404
|
+
@cached_property
|
|
405
|
+
def with_raw_response(self) -> AsyncCheckoutIntentsWithRawResponse:
|
|
406
|
+
return AsyncCheckoutIntentsWithRawResponse(self)
|
|
407
|
+
|
|
408
|
+
@cached_property
|
|
409
|
+
def with_streaming_response(self) -> AsyncCheckoutIntentsWithStreamedResponse:
|
|
410
|
+
return AsyncCheckoutIntentsWithStreamedResponse(self)
|
|
386
411
|
|
|
387
412
|
@property
|
|
388
413
|
@override
|
|
@@ -492,29 +517,79 @@ class AsyncCheckoutIntents(AsyncAPIClient):
|
|
|
492
517
|
|
|
493
518
|
|
|
494
519
|
class CheckoutIntentsWithRawResponse:
|
|
520
|
+
_client: CheckoutIntents
|
|
521
|
+
|
|
495
522
|
def __init__(self, client: CheckoutIntents) -> None:
|
|
496
|
-
self.
|
|
497
|
-
|
|
523
|
+
self._client = client
|
|
524
|
+
|
|
525
|
+
@cached_property
|
|
526
|
+
def checkout_intents(self) -> checkout_intents.CheckoutIntentsResourceWithRawResponse:
|
|
527
|
+
from .resources.checkout_intents import CheckoutIntentsResourceWithRawResponse
|
|
528
|
+
|
|
529
|
+
return CheckoutIntentsResourceWithRawResponse(self._client.checkout_intents)
|
|
530
|
+
|
|
531
|
+
@cached_property
|
|
532
|
+
def brands(self) -> brands.BrandsResourceWithRawResponse:
|
|
533
|
+
from .resources.brands import BrandsResourceWithRawResponse
|
|
534
|
+
|
|
535
|
+
return BrandsResourceWithRawResponse(self._client.brands)
|
|
498
536
|
|
|
499
537
|
|
|
500
538
|
class AsyncCheckoutIntentsWithRawResponse:
|
|
539
|
+
_client: AsyncCheckoutIntents
|
|
540
|
+
|
|
501
541
|
def __init__(self, client: AsyncCheckoutIntents) -> None:
|
|
502
|
-
self.
|
|
503
|
-
|
|
542
|
+
self._client = client
|
|
543
|
+
|
|
544
|
+
@cached_property
|
|
545
|
+
def checkout_intents(self) -> checkout_intents.AsyncCheckoutIntentsResourceWithRawResponse:
|
|
546
|
+
from .resources.checkout_intents import AsyncCheckoutIntentsResourceWithRawResponse
|
|
547
|
+
|
|
548
|
+
return AsyncCheckoutIntentsResourceWithRawResponse(self._client.checkout_intents)
|
|
549
|
+
|
|
550
|
+
@cached_property
|
|
551
|
+
def brands(self) -> brands.AsyncBrandsResourceWithRawResponse:
|
|
552
|
+
from .resources.brands import AsyncBrandsResourceWithRawResponse
|
|
553
|
+
|
|
554
|
+
return AsyncBrandsResourceWithRawResponse(self._client.brands)
|
|
504
555
|
|
|
505
556
|
|
|
506
557
|
class CheckoutIntentsWithStreamedResponse:
|
|
558
|
+
_client: CheckoutIntents
|
|
559
|
+
|
|
507
560
|
def __init__(self, client: CheckoutIntents) -> None:
|
|
508
|
-
self.
|
|
509
|
-
|
|
561
|
+
self._client = client
|
|
562
|
+
|
|
563
|
+
@cached_property
|
|
564
|
+
def checkout_intents(self) -> checkout_intents.CheckoutIntentsResourceWithStreamingResponse:
|
|
565
|
+
from .resources.checkout_intents import CheckoutIntentsResourceWithStreamingResponse
|
|
566
|
+
|
|
567
|
+
return CheckoutIntentsResourceWithStreamingResponse(self._client.checkout_intents)
|
|
568
|
+
|
|
569
|
+
@cached_property
|
|
570
|
+
def brands(self) -> brands.BrandsResourceWithStreamingResponse:
|
|
571
|
+
from .resources.brands import BrandsResourceWithStreamingResponse
|
|
572
|
+
|
|
573
|
+
return BrandsResourceWithStreamingResponse(self._client.brands)
|
|
510
574
|
|
|
511
575
|
|
|
512
576
|
class AsyncCheckoutIntentsWithStreamedResponse:
|
|
577
|
+
_client: AsyncCheckoutIntents
|
|
578
|
+
|
|
513
579
|
def __init__(self, client: AsyncCheckoutIntents) -> None:
|
|
514
|
-
self.
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
580
|
+
self._client = client
|
|
581
|
+
|
|
582
|
+
@cached_property
|
|
583
|
+
def checkout_intents(self) -> checkout_intents.AsyncCheckoutIntentsResourceWithStreamingResponse:
|
|
584
|
+
from .resources.checkout_intents import AsyncCheckoutIntentsResourceWithStreamingResponse
|
|
585
|
+
|
|
586
|
+
return AsyncCheckoutIntentsResourceWithStreamingResponse(self._client.checkout_intents)
|
|
587
|
+
|
|
588
|
+
@cached_property
|
|
589
|
+
def brands(self) -> brands.AsyncBrandsResourceWithStreamingResponse:
|
|
590
|
+
from .resources.brands import AsyncBrandsResourceWithStreamingResponse
|
|
591
|
+
|
|
592
|
+
return AsyncBrandsResourceWithStreamingResponse(self._client.brands)
|
|
518
593
|
|
|
519
594
|
|
|
520
595
|
Client = CheckoutIntents
|
checkout_intents/_streaming.py
CHANGED
|
@@ -54,11 +54,12 @@ class Stream(Generic[_T]):
|
|
|
54
54
|
process_data = self._client._process_response_data
|
|
55
55
|
iterator = self._iter_events()
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
try:
|
|
58
|
+
for sse in iterator:
|
|
59
|
+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
60
|
+
finally:
|
|
61
|
+
# Ensure the response is closed even if the consumer doesn't read all data
|
|
62
|
+
response.close()
|
|
62
63
|
|
|
63
64
|
def __enter__(self) -> Self:
|
|
64
65
|
return self
|
|
@@ -117,11 +118,12 @@ class AsyncStream(Generic[_T]):
|
|
|
117
118
|
process_data = self._client._process_response_data
|
|
118
119
|
iterator = self._iter_events()
|
|
119
120
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
121
|
+
try:
|
|
122
|
+
async for sse in iterator:
|
|
123
|
+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
124
|
+
finally:
|
|
125
|
+
# Ensure the response is closed even if the consumer doesn't read all data
|
|
126
|
+
await response.aclose()
|
|
125
127
|
|
|
126
128
|
async def __aenter__(self) -> Self:
|
|
127
129
|
return self
|
checkout_intents/_types.py
CHANGED
|
@@ -243,6 +243,9 @@ _T_co = TypeVar("_T_co", covariant=True)
|
|
|
243
243
|
if TYPE_CHECKING:
|
|
244
244
|
# This works because str.__contains__ does not accept object (either in typeshed or at runtime)
|
|
245
245
|
# https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285
|
|
246
|
+
#
|
|
247
|
+
# Note: index() and count() methods are intentionally omitted to allow pyright to properly
|
|
248
|
+
# infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr.
|
|
246
249
|
class SequenceNotStr(Protocol[_T_co]):
|
|
247
250
|
@overload
|
|
248
251
|
def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
|
|
@@ -251,8 +254,6 @@ if TYPE_CHECKING:
|
|
|
251
254
|
def __contains__(self, value: object, /) -> bool: ...
|
|
252
255
|
def __len__(self) -> int: ...
|
|
253
256
|
def __iter__(self) -> Iterator[_T_co]: ...
|
|
254
|
-
def index(self, value: Any, start: int = 0, stop: int = ..., /) -> int: ...
|
|
255
|
-
def count(self, value: Any, /) -> int: ...
|
|
256
257
|
def __reversed__(self) -> Iterator[_T_co]: ...
|
|
257
258
|
else:
|
|
258
259
|
# just point this to a normal `Sequence` at runtime to avoid having to special case
|
checkout_intents/_version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: checkout-intents
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
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
|
|
@@ -236,6 +236,7 @@ pip install checkout-intents[aiohttp]
|
|
|
236
236
|
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:
|
|
237
237
|
|
|
238
238
|
```python
|
|
239
|
+
import os
|
|
239
240
|
import asyncio
|
|
240
241
|
from checkout_intents import DefaultAioHttpClient
|
|
241
242
|
from checkout_intents import AsyncCheckoutIntents
|
|
@@ -243,7 +244,9 @@ from checkout_intents import AsyncCheckoutIntents
|
|
|
243
244
|
|
|
244
245
|
async def main() -> None:
|
|
245
246
|
async with AsyncCheckoutIntents(
|
|
246
|
-
api_key=
|
|
247
|
+
api_key=os.environ.get(
|
|
248
|
+
"CHECKOUT_INTENTS_API_KEY"
|
|
249
|
+
), # This is the default and can be omitted
|
|
247
250
|
http_client=DefaultAioHttpClient(),
|
|
248
251
|
) as client:
|
|
249
252
|
checkout_intent = await client.checkout_intents.create(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
checkout_intents/__init__.py,sha256=5m0_Ktnyya4CJ0vdWZbAv7qZMeR1VnXqN_MJtH3RJTM,2833
|
|
2
|
-
checkout_intents/_base_client.py,sha256=
|
|
3
|
-
checkout_intents/_client.py,sha256=
|
|
2
|
+
checkout_intents/_base_client.py,sha256=7CDIPC8cmnmd1k7FLdws7FRpsnw11gy83AFzXndpam4,67245
|
|
3
|
+
checkout_intents/_client.py,sha256=l4Pa_x5hI16yMF3hrMIJTkXEv2i3F61QF7N9OdQVSIA,23941
|
|
4
4
|
checkout_intents/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
|
|
5
5
|
checkout_intents/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
6
|
checkout_intents/_exceptions.py,sha256=oQn7Y6LzccgRDOtdg20l68bXtgf2tgVNKIrufJPDsuk,4252
|
|
@@ -9,9 +9,9 @@ checkout_intents/_models.py,sha256=m6hDet9vdfyY7TuzbLCBYhMPoIN6hddOZp9qDZ-zfVU,3
|
|
|
9
9
|
checkout_intents/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
|
|
10
10
|
checkout_intents/_resource.py,sha256=X-eWffEBAgzTZvakLqNUjwgidMKfBFRmCeeOiuko4lg,1154
|
|
11
11
|
checkout_intents/_response.py,sha256=sLqxWBxzmVqPsdr2x5z6d87h8jb1U-Huvh2YFg-U6nE,28876
|
|
12
|
-
checkout_intents/_streaming.py,sha256=
|
|
13
|
-
checkout_intents/_types.py,sha256=
|
|
14
|
-
checkout_intents/_version.py,sha256=
|
|
12
|
+
checkout_intents/_streaming.py,sha256=y8SjBVAw2SDdVczQsP1T3dufnx4040C5fQqz-jGSvmg,10257
|
|
13
|
+
checkout_intents/_types.py,sha256=PTRxqWPBW57h6JvfwcVuR42gIMpY4nwSZbqAtv85Ado,7305
|
|
14
|
+
checkout_intents/_version.py,sha256=6MP5ntn9QD_nkNa0bPkVqXkR4ZoQEOr1sNar5cCh3Pk,168
|
|
15
15
|
checkout_intents/pagination.py,sha256=VMe3ftq-qqAku2ERRTOz7iZOoMQ_KKp2HIUl_I8oAXE,2908
|
|
16
16
|
checkout_intents/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
checkout_intents/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
@@ -46,7 +46,7 @@ checkout_intents/types/payment_method.py,sha256=-v5-L5RPojm8IDrdAhIMGmhVb89vwqT1
|
|
|
46
46
|
checkout_intents/types/payment_method_param.py,sha256=_yzwZ5nw7bStK4U2-1ybtpjdJz5funCOMN7MALtF0xk,1225
|
|
47
47
|
checkout_intents/types/variant_selection.py,sha256=y6mlU-qGwDfE77mU-x1GTXkDsmn6vuPpy5lBYXqXCBw,259
|
|
48
48
|
checkout_intents/types/variant_selection_param.py,sha256=ahwTmDVIUMV8jvpggEo2jDUTIm9xvXbntDxmIZqT2_k,355
|
|
49
|
-
checkout_intents-0.3.
|
|
50
|
-
checkout_intents-0.3.
|
|
51
|
-
checkout_intents-0.3.
|
|
52
|
-
checkout_intents-0.3.
|
|
49
|
+
checkout_intents-0.3.3.dist-info/METADATA,sha256=zR7ocfBWQJZgLwkj1dQ1y-yGhnzW8ugpxTbqR1QpzBM,23781
|
|
50
|
+
checkout_intents-0.3.3.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
51
|
+
checkout_intents-0.3.3.dist-info/licenses/LICENSE,sha256=dRDmL6lFnLaphTaman8kAc21qY1IQ_qsAETk1F-b6jY,1056
|
|
52
|
+
checkout_intents-0.3.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|