checkout-intents 0.1.0__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/__init__.py +104 -0
- checkout_intents/_base_client.py +1995 -0
- checkout_intents/_client.py +471 -0
- checkout_intents/_compat.py +219 -0
- checkout_intents/_constants.py +14 -0
- checkout_intents/_exceptions.py +108 -0
- checkout_intents/_files.py +123 -0
- checkout_intents/_models.py +840 -0
- checkout_intents/_qs.py +150 -0
- checkout_intents/_resource.py +43 -0
- checkout_intents/_response.py +832 -0
- checkout_intents/_streaming.py +331 -0
- checkout_intents/_types.py +260 -0
- checkout_intents/_utils/__init__.py +64 -0
- checkout_intents/_utils/_compat.py +45 -0
- checkout_intents/_utils/_datetime_parse.py +136 -0
- checkout_intents/_utils/_logs.py +25 -0
- checkout_intents/_utils/_proxy.py +65 -0
- checkout_intents/_utils/_reflection.py +42 -0
- checkout_intents/_utils/_resources_proxy.py +24 -0
- checkout_intents/_utils/_streams.py +12 -0
- checkout_intents/_utils/_sync.py +58 -0
- checkout_intents/_utils/_transform.py +457 -0
- checkout_intents/_utils/_typing.py +156 -0
- checkout_intents/_utils/_utils.py +421 -0
- checkout_intents/_version.py +4 -0
- checkout_intents/lib/.keep +4 -0
- checkout_intents/py.typed +0 -0
- checkout_intents/resources/__init__.py +33 -0
- checkout_intents/resources/brands.py +173 -0
- checkout_intents/resources/checkout_intents.py +480 -0
- checkout_intents/types/__init__.py +18 -0
- checkout_intents/types/base_checkout_intent.py +26 -0
- checkout_intents/types/brand_retrieve_response.py +21 -0
- checkout_intents/types/buyer.py +31 -0
- checkout_intents/types/buyer_param.py +31 -0
- checkout_intents/types/checkout_intent.py +83 -0
- checkout_intents/types/checkout_intent_add_payment_params.py +14 -0
- checkout_intents/types/checkout_intent_confirm_params.py +14 -0
- checkout_intents/types/checkout_intent_create_params.py +22 -0
- checkout_intents/types/money.py +13 -0
- checkout_intents/types/offer.py +40 -0
- checkout_intents/types/payment_method.py +15 -0
- checkout_intents/types/payment_method_param.py +15 -0
- checkout_intents/types/variant_selection.py +21 -0
- checkout_intents/types/variant_selection_param.py +22 -0
- checkout_intents-0.1.0.dist-info/METADATA +532 -0
- checkout_intents-0.1.0.dist-info/RECORD +50 -0
- checkout_intents-0.1.0.dist-info/WHEEL +4 -0
- checkout_intents-0.1.0.dist-info/licenses/LICENSE +7 -0
|
@@ -0,0 +1,480 @@
|
|
|
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 Any, Iterable, cast
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import (
|
|
10
|
+
checkout_intent_create_params,
|
|
11
|
+
checkout_intent_confirm_params,
|
|
12
|
+
checkout_intent_add_payment_params,
|
|
13
|
+
)
|
|
14
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
15
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
16
|
+
from .._compat import cached_property
|
|
17
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
18
|
+
from .._response import (
|
|
19
|
+
to_raw_response_wrapper,
|
|
20
|
+
to_streamed_response_wrapper,
|
|
21
|
+
async_to_raw_response_wrapper,
|
|
22
|
+
async_to_streamed_response_wrapper,
|
|
23
|
+
)
|
|
24
|
+
from .._base_client import make_request_options
|
|
25
|
+
from ..types.buyer_param import BuyerParam
|
|
26
|
+
from ..types.checkout_intent import CheckoutIntent
|
|
27
|
+
from ..types.payment_method_param import PaymentMethodParam
|
|
28
|
+
from ..types.variant_selection_param import VariantSelectionParam
|
|
29
|
+
|
|
30
|
+
__all__ = ["CheckoutIntentsResource", "AsyncCheckoutIntentsResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class CheckoutIntentsResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> CheckoutIntentsResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/rye-com/checkout-intents-python#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
42
|
+
return CheckoutIntentsResourceWithRawResponse(self)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_streaming_response(self) -> CheckoutIntentsResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/rye-com/checkout-intents-python#with_streaming_response
|
|
50
|
+
"""
|
|
51
|
+
return CheckoutIntentsResourceWithStreamingResponse(self)
|
|
52
|
+
|
|
53
|
+
def create(
|
|
54
|
+
self,
|
|
55
|
+
*,
|
|
56
|
+
buyer: BuyerParam,
|
|
57
|
+
product_url: str,
|
|
58
|
+
quantity: float,
|
|
59
|
+
variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
|
|
60
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
61
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
62
|
+
extra_headers: Headers | None = None,
|
|
63
|
+
extra_query: Query | None = None,
|
|
64
|
+
extra_body: Body | None = None,
|
|
65
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
66
|
+
) -> CheckoutIntent:
|
|
67
|
+
"""
|
|
68
|
+
Create a checkout intent with the given request body.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
extra_headers: Send extra headers
|
|
72
|
+
|
|
73
|
+
extra_query: Add additional query parameters to the request
|
|
74
|
+
|
|
75
|
+
extra_body: Add additional JSON properties to the request
|
|
76
|
+
|
|
77
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
78
|
+
"""
|
|
79
|
+
return cast(
|
|
80
|
+
CheckoutIntent,
|
|
81
|
+
self._post(
|
|
82
|
+
"/api/v1/checkout-intents",
|
|
83
|
+
body=maybe_transform(
|
|
84
|
+
{
|
|
85
|
+
"buyer": buyer,
|
|
86
|
+
"product_url": product_url,
|
|
87
|
+
"quantity": quantity,
|
|
88
|
+
"variant_selections": variant_selections,
|
|
89
|
+
},
|
|
90
|
+
checkout_intent_create_params.CheckoutIntentCreateParams,
|
|
91
|
+
),
|
|
92
|
+
options=make_request_options(
|
|
93
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
94
|
+
),
|
|
95
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
96
|
+
),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
def retrieve(
|
|
100
|
+
self,
|
|
101
|
+
id: str,
|
|
102
|
+
*,
|
|
103
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
104
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
105
|
+
extra_headers: Headers | None = None,
|
|
106
|
+
extra_query: Query | None = None,
|
|
107
|
+
extra_body: Body | None = None,
|
|
108
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
109
|
+
) -> CheckoutIntent:
|
|
110
|
+
"""
|
|
111
|
+
Retrieve a checkout intent by id
|
|
112
|
+
|
|
113
|
+
Returns checkout intent information if the lookup succeeds.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
extra_headers: Send extra headers
|
|
117
|
+
|
|
118
|
+
extra_query: Add additional query parameters to the request
|
|
119
|
+
|
|
120
|
+
extra_body: Add additional JSON properties to the request
|
|
121
|
+
|
|
122
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
123
|
+
"""
|
|
124
|
+
if not id:
|
|
125
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
126
|
+
return cast(
|
|
127
|
+
CheckoutIntent,
|
|
128
|
+
self._get(
|
|
129
|
+
f"/api/v1/checkout-intents/{id}",
|
|
130
|
+
options=make_request_options(
|
|
131
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
132
|
+
),
|
|
133
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
134
|
+
),
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def add_payment(
|
|
138
|
+
self,
|
|
139
|
+
id: str,
|
|
140
|
+
*,
|
|
141
|
+
payment_method: PaymentMethodParam,
|
|
142
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
143
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
144
|
+
extra_headers: Headers | None = None,
|
|
145
|
+
extra_query: Query | None = None,
|
|
146
|
+
extra_body: Body | None = None,
|
|
147
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
148
|
+
) -> CheckoutIntent:
|
|
149
|
+
"""
|
|
150
|
+
Add payment details to a checkout intent
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
extra_headers: Send extra headers
|
|
154
|
+
|
|
155
|
+
extra_query: Add additional query parameters to the request
|
|
156
|
+
|
|
157
|
+
extra_body: Add additional JSON properties to the request
|
|
158
|
+
|
|
159
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
160
|
+
"""
|
|
161
|
+
if not id:
|
|
162
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
163
|
+
return cast(
|
|
164
|
+
CheckoutIntent,
|
|
165
|
+
self._post(
|
|
166
|
+
f"/api/v1/checkout-intents/{id}/payment",
|
|
167
|
+
body=maybe_transform(
|
|
168
|
+
{"payment_method": payment_method},
|
|
169
|
+
checkout_intent_add_payment_params.CheckoutIntentAddPaymentParams,
|
|
170
|
+
),
|
|
171
|
+
options=make_request_options(
|
|
172
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
173
|
+
),
|
|
174
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
175
|
+
),
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
def confirm(
|
|
179
|
+
self,
|
|
180
|
+
id: str,
|
|
181
|
+
*,
|
|
182
|
+
payment_method: PaymentMethodParam,
|
|
183
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
184
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
185
|
+
extra_headers: Headers | None = None,
|
|
186
|
+
extra_query: Query | None = None,
|
|
187
|
+
extra_body: Body | None = None,
|
|
188
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
189
|
+
) -> CheckoutIntent:
|
|
190
|
+
"""
|
|
191
|
+
Confirm a checkout intent with provided payment information
|
|
192
|
+
|
|
193
|
+
Confirm means we have buyer's name, address and payment info, so we can move
|
|
194
|
+
forward to place the order.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
extra_headers: Send extra headers
|
|
198
|
+
|
|
199
|
+
extra_query: Add additional query parameters to the request
|
|
200
|
+
|
|
201
|
+
extra_body: Add additional JSON properties to the request
|
|
202
|
+
|
|
203
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
204
|
+
"""
|
|
205
|
+
if not id:
|
|
206
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
207
|
+
return cast(
|
|
208
|
+
CheckoutIntent,
|
|
209
|
+
self._post(
|
|
210
|
+
f"/api/v1/checkout-intents/{id}/confirm",
|
|
211
|
+
body=maybe_transform(
|
|
212
|
+
{"payment_method": payment_method}, checkout_intent_confirm_params.CheckoutIntentConfirmParams
|
|
213
|
+
),
|
|
214
|
+
options=make_request_options(
|
|
215
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
216
|
+
),
|
|
217
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
218
|
+
),
|
|
219
|
+
)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
class AsyncCheckoutIntentsResource(AsyncAPIResource):
|
|
223
|
+
@cached_property
|
|
224
|
+
def with_raw_response(self) -> AsyncCheckoutIntentsResourceWithRawResponse:
|
|
225
|
+
"""
|
|
226
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
227
|
+
the raw response object instead of the parsed content.
|
|
228
|
+
|
|
229
|
+
For more information, see https://www.github.com/rye-com/checkout-intents-python#accessing-raw-response-data-eg-headers
|
|
230
|
+
"""
|
|
231
|
+
return AsyncCheckoutIntentsResourceWithRawResponse(self)
|
|
232
|
+
|
|
233
|
+
@cached_property
|
|
234
|
+
def with_streaming_response(self) -> AsyncCheckoutIntentsResourceWithStreamingResponse:
|
|
235
|
+
"""
|
|
236
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
237
|
+
|
|
238
|
+
For more information, see https://www.github.com/rye-com/checkout-intents-python#with_streaming_response
|
|
239
|
+
"""
|
|
240
|
+
return AsyncCheckoutIntentsResourceWithStreamingResponse(self)
|
|
241
|
+
|
|
242
|
+
async def create(
|
|
243
|
+
self,
|
|
244
|
+
*,
|
|
245
|
+
buyer: BuyerParam,
|
|
246
|
+
product_url: str,
|
|
247
|
+
quantity: float,
|
|
248
|
+
variant_selections: Iterable[VariantSelectionParam] | Omit = omit,
|
|
249
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
250
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
251
|
+
extra_headers: Headers | None = None,
|
|
252
|
+
extra_query: Query | None = None,
|
|
253
|
+
extra_body: Body | None = None,
|
|
254
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
255
|
+
) -> CheckoutIntent:
|
|
256
|
+
"""
|
|
257
|
+
Create a checkout intent with the given request body.
|
|
258
|
+
|
|
259
|
+
Args:
|
|
260
|
+
extra_headers: Send extra headers
|
|
261
|
+
|
|
262
|
+
extra_query: Add additional query parameters to the request
|
|
263
|
+
|
|
264
|
+
extra_body: Add additional JSON properties to the request
|
|
265
|
+
|
|
266
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
267
|
+
"""
|
|
268
|
+
return cast(
|
|
269
|
+
CheckoutIntent,
|
|
270
|
+
await self._post(
|
|
271
|
+
"/api/v1/checkout-intents",
|
|
272
|
+
body=await async_maybe_transform(
|
|
273
|
+
{
|
|
274
|
+
"buyer": buyer,
|
|
275
|
+
"product_url": product_url,
|
|
276
|
+
"quantity": quantity,
|
|
277
|
+
"variant_selections": variant_selections,
|
|
278
|
+
},
|
|
279
|
+
checkout_intent_create_params.CheckoutIntentCreateParams,
|
|
280
|
+
),
|
|
281
|
+
options=make_request_options(
|
|
282
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
283
|
+
),
|
|
284
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
285
|
+
),
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
async def retrieve(
|
|
289
|
+
self,
|
|
290
|
+
id: str,
|
|
291
|
+
*,
|
|
292
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
293
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
294
|
+
extra_headers: Headers | None = None,
|
|
295
|
+
extra_query: Query | None = None,
|
|
296
|
+
extra_body: Body | None = None,
|
|
297
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
298
|
+
) -> CheckoutIntent:
|
|
299
|
+
"""
|
|
300
|
+
Retrieve a checkout intent by id
|
|
301
|
+
|
|
302
|
+
Returns checkout intent information if the lookup succeeds.
|
|
303
|
+
|
|
304
|
+
Args:
|
|
305
|
+
extra_headers: Send extra headers
|
|
306
|
+
|
|
307
|
+
extra_query: Add additional query parameters to the request
|
|
308
|
+
|
|
309
|
+
extra_body: Add additional JSON properties to the request
|
|
310
|
+
|
|
311
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
312
|
+
"""
|
|
313
|
+
if not id:
|
|
314
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
315
|
+
return cast(
|
|
316
|
+
CheckoutIntent,
|
|
317
|
+
await self._get(
|
|
318
|
+
f"/api/v1/checkout-intents/{id}",
|
|
319
|
+
options=make_request_options(
|
|
320
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
321
|
+
),
|
|
322
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
323
|
+
),
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
async def add_payment(
|
|
327
|
+
self,
|
|
328
|
+
id: str,
|
|
329
|
+
*,
|
|
330
|
+
payment_method: PaymentMethodParam,
|
|
331
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
332
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
333
|
+
extra_headers: Headers | None = None,
|
|
334
|
+
extra_query: Query | None = None,
|
|
335
|
+
extra_body: Body | None = None,
|
|
336
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
337
|
+
) -> CheckoutIntent:
|
|
338
|
+
"""
|
|
339
|
+
Add payment details to a checkout intent
|
|
340
|
+
|
|
341
|
+
Args:
|
|
342
|
+
extra_headers: Send extra headers
|
|
343
|
+
|
|
344
|
+
extra_query: Add additional query parameters to the request
|
|
345
|
+
|
|
346
|
+
extra_body: Add additional JSON properties to the request
|
|
347
|
+
|
|
348
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
349
|
+
"""
|
|
350
|
+
if not id:
|
|
351
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
352
|
+
return cast(
|
|
353
|
+
CheckoutIntent,
|
|
354
|
+
await self._post(
|
|
355
|
+
f"/api/v1/checkout-intents/{id}/payment",
|
|
356
|
+
body=await async_maybe_transform(
|
|
357
|
+
{"payment_method": payment_method},
|
|
358
|
+
checkout_intent_add_payment_params.CheckoutIntentAddPaymentParams,
|
|
359
|
+
),
|
|
360
|
+
options=make_request_options(
|
|
361
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
362
|
+
),
|
|
363
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
364
|
+
),
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
async def confirm(
|
|
368
|
+
self,
|
|
369
|
+
id: str,
|
|
370
|
+
*,
|
|
371
|
+
payment_method: PaymentMethodParam,
|
|
372
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
373
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
374
|
+
extra_headers: Headers | None = None,
|
|
375
|
+
extra_query: Query | None = None,
|
|
376
|
+
extra_body: Body | None = None,
|
|
377
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
378
|
+
) -> CheckoutIntent:
|
|
379
|
+
"""
|
|
380
|
+
Confirm a checkout intent with provided payment information
|
|
381
|
+
|
|
382
|
+
Confirm means we have buyer's name, address and payment info, so we can move
|
|
383
|
+
forward to place the order.
|
|
384
|
+
|
|
385
|
+
Args:
|
|
386
|
+
extra_headers: Send extra headers
|
|
387
|
+
|
|
388
|
+
extra_query: Add additional query parameters to the request
|
|
389
|
+
|
|
390
|
+
extra_body: Add additional JSON properties to the request
|
|
391
|
+
|
|
392
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
393
|
+
"""
|
|
394
|
+
if not id:
|
|
395
|
+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
|
|
396
|
+
return cast(
|
|
397
|
+
CheckoutIntent,
|
|
398
|
+
await self._post(
|
|
399
|
+
f"/api/v1/checkout-intents/{id}/confirm",
|
|
400
|
+
body=await async_maybe_transform(
|
|
401
|
+
{"payment_method": payment_method}, checkout_intent_confirm_params.CheckoutIntentConfirmParams
|
|
402
|
+
),
|
|
403
|
+
options=make_request_options(
|
|
404
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
405
|
+
),
|
|
406
|
+
cast_to=cast(Any, CheckoutIntent), # Union types cannot be passed in as arguments in the type system
|
|
407
|
+
),
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
class CheckoutIntentsResourceWithRawResponse:
|
|
412
|
+
def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
|
|
413
|
+
self._checkout_intents = checkout_intents
|
|
414
|
+
|
|
415
|
+
self.create = to_raw_response_wrapper(
|
|
416
|
+
checkout_intents.create,
|
|
417
|
+
)
|
|
418
|
+
self.retrieve = to_raw_response_wrapper(
|
|
419
|
+
checkout_intents.retrieve,
|
|
420
|
+
)
|
|
421
|
+
self.add_payment = to_raw_response_wrapper(
|
|
422
|
+
checkout_intents.add_payment,
|
|
423
|
+
)
|
|
424
|
+
self.confirm = to_raw_response_wrapper(
|
|
425
|
+
checkout_intents.confirm,
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
class AsyncCheckoutIntentsResourceWithRawResponse:
|
|
430
|
+
def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
|
|
431
|
+
self._checkout_intents = checkout_intents
|
|
432
|
+
|
|
433
|
+
self.create = async_to_raw_response_wrapper(
|
|
434
|
+
checkout_intents.create,
|
|
435
|
+
)
|
|
436
|
+
self.retrieve = async_to_raw_response_wrapper(
|
|
437
|
+
checkout_intents.retrieve,
|
|
438
|
+
)
|
|
439
|
+
self.add_payment = async_to_raw_response_wrapper(
|
|
440
|
+
checkout_intents.add_payment,
|
|
441
|
+
)
|
|
442
|
+
self.confirm = async_to_raw_response_wrapper(
|
|
443
|
+
checkout_intents.confirm,
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
class CheckoutIntentsResourceWithStreamingResponse:
|
|
448
|
+
def __init__(self, checkout_intents: CheckoutIntentsResource) -> None:
|
|
449
|
+
self._checkout_intents = checkout_intents
|
|
450
|
+
|
|
451
|
+
self.create = to_streamed_response_wrapper(
|
|
452
|
+
checkout_intents.create,
|
|
453
|
+
)
|
|
454
|
+
self.retrieve = to_streamed_response_wrapper(
|
|
455
|
+
checkout_intents.retrieve,
|
|
456
|
+
)
|
|
457
|
+
self.add_payment = to_streamed_response_wrapper(
|
|
458
|
+
checkout_intents.add_payment,
|
|
459
|
+
)
|
|
460
|
+
self.confirm = to_streamed_response_wrapper(
|
|
461
|
+
checkout_intents.confirm,
|
|
462
|
+
)
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
class AsyncCheckoutIntentsResourceWithStreamingResponse:
|
|
466
|
+
def __init__(self, checkout_intents: AsyncCheckoutIntentsResource) -> None:
|
|
467
|
+
self._checkout_intents = checkout_intents
|
|
468
|
+
|
|
469
|
+
self.create = async_to_streamed_response_wrapper(
|
|
470
|
+
checkout_intents.create,
|
|
471
|
+
)
|
|
472
|
+
self.retrieve = async_to_streamed_response_wrapper(
|
|
473
|
+
checkout_intents.retrieve,
|
|
474
|
+
)
|
|
475
|
+
self.add_payment = async_to_streamed_response_wrapper(
|
|
476
|
+
checkout_intents.add_payment,
|
|
477
|
+
)
|
|
478
|
+
self.confirm = async_to_streamed_response_wrapper(
|
|
479
|
+
checkout_intents.confirm,
|
|
480
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .buyer import Buyer as Buyer
|
|
6
|
+
from .money import Money as Money
|
|
7
|
+
from .offer import Offer as Offer
|
|
8
|
+
from .buyer_param import BuyerParam as BuyerParam
|
|
9
|
+
from .payment_method import PaymentMethod as PaymentMethod
|
|
10
|
+
from .checkout_intent import CheckoutIntent as CheckoutIntent
|
|
11
|
+
from .variant_selection import VariantSelection as VariantSelection
|
|
12
|
+
from .base_checkout_intent import BaseCheckoutIntent as BaseCheckoutIntent
|
|
13
|
+
from .payment_method_param import PaymentMethodParam as PaymentMethodParam
|
|
14
|
+
from .brand_retrieve_response import BrandRetrieveResponse as BrandRetrieveResponse
|
|
15
|
+
from .variant_selection_param import VariantSelectionParam as VariantSelectionParam
|
|
16
|
+
from .checkout_intent_create_params import CheckoutIntentCreateParams as CheckoutIntentCreateParams
|
|
17
|
+
from .checkout_intent_confirm_params import CheckoutIntentConfirmParams as CheckoutIntentConfirmParams
|
|
18
|
+
from .checkout_intent_add_payment_params import CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .buyer import Buyer
|
|
9
|
+
from .._models import BaseModel
|
|
10
|
+
from .variant_selection import VariantSelection
|
|
11
|
+
|
|
12
|
+
__all__ = ["BaseCheckoutIntent"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BaseCheckoutIntent(BaseModel):
|
|
16
|
+
id: str
|
|
17
|
+
|
|
18
|
+
buyer: Buyer
|
|
19
|
+
|
|
20
|
+
created_at: datetime = FieldInfo(alias="createdAt")
|
|
21
|
+
|
|
22
|
+
product_url: str = FieldInfo(alias="productUrl")
|
|
23
|
+
|
|
24
|
+
quantity: float
|
|
25
|
+
|
|
26
|
+
variant_selections: Optional[List[VariantSelection]] = FieldInfo(alias="variantSelections", default=None)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from .._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["BrandRetrieveResponse"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BrandRetrieveResponse(BaseModel):
|
|
11
|
+
id: str
|
|
12
|
+
"""A unique identifier for the brand."""
|
|
13
|
+
|
|
14
|
+
marketplace: Literal["AMAZON", "SHOPIFY", "UNKNOWN"]
|
|
15
|
+
"""Indicates what ecommerce platform the brand uses."""
|
|
16
|
+
|
|
17
|
+
supported: bool
|
|
18
|
+
"""
|
|
19
|
+
If `false`, then products from this brand cannot be purchased through the Sell
|
|
20
|
+
Anything API.
|
|
21
|
+
"""
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from pydantic import Field as FieldInfo
|
|
6
|
+
|
|
7
|
+
from .._models import BaseModel
|
|
8
|
+
|
|
9
|
+
__all__ = ["Buyer"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Buyer(BaseModel):
|
|
13
|
+
address1: str
|
|
14
|
+
|
|
15
|
+
city: str
|
|
16
|
+
|
|
17
|
+
country: str
|
|
18
|
+
|
|
19
|
+
email: str
|
|
20
|
+
|
|
21
|
+
first_name: str = FieldInfo(alias="firstName")
|
|
22
|
+
|
|
23
|
+
last_name: str = FieldInfo(alias="lastName")
|
|
24
|
+
|
|
25
|
+
phone: str
|
|
26
|
+
|
|
27
|
+
postal_code: str = FieldInfo(alias="postalCode")
|
|
28
|
+
|
|
29
|
+
province: str
|
|
30
|
+
|
|
31
|
+
address2: Optional[str] = None
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Required, Annotated, TypedDict
|
|
6
|
+
|
|
7
|
+
from .._utils import PropertyInfo
|
|
8
|
+
|
|
9
|
+
__all__ = ["BuyerParam"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class BuyerParam(TypedDict, total=False):
|
|
13
|
+
address1: Required[str]
|
|
14
|
+
|
|
15
|
+
city: Required[str]
|
|
16
|
+
|
|
17
|
+
country: Required[str]
|
|
18
|
+
|
|
19
|
+
email: Required[str]
|
|
20
|
+
|
|
21
|
+
first_name: Required[Annotated[str, PropertyInfo(alias="firstName")]]
|
|
22
|
+
|
|
23
|
+
last_name: Required[Annotated[str, PropertyInfo(alias="lastName")]]
|
|
24
|
+
|
|
25
|
+
phone: Required[str]
|
|
26
|
+
|
|
27
|
+
postal_code: Required[Annotated[str, PropertyInfo(alias="postalCode")]]
|
|
28
|
+
|
|
29
|
+
province: Required[str]
|
|
30
|
+
|
|
31
|
+
address2: str
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Union, Optional
|
|
4
|
+
from typing_extensions import Literal, TypeAlias
|
|
5
|
+
|
|
6
|
+
from pydantic import Field as FieldInfo
|
|
7
|
+
|
|
8
|
+
from .offer import Offer
|
|
9
|
+
from .._models import BaseModel
|
|
10
|
+
from .payment_method import PaymentMethod
|
|
11
|
+
from .base_checkout_intent import BaseCheckoutIntent
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"CheckoutIntent",
|
|
15
|
+
"RetrievingOfferCheckoutIntent",
|
|
16
|
+
"AwaitingConfirmationCheckoutIntent",
|
|
17
|
+
"PlacingOrderCheckoutIntent",
|
|
18
|
+
"CompletedCheckoutIntent",
|
|
19
|
+
"FailedCheckoutIntent",
|
|
20
|
+
"FailedCheckoutIntentFailureReason",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class RetrievingOfferCheckoutIntent(BaseCheckoutIntent):
|
|
25
|
+
state: Literal["retrieving_offer"]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class AwaitingConfirmationCheckoutIntent(BaseCheckoutIntent):
|
|
29
|
+
offer: Offer
|
|
30
|
+
|
|
31
|
+
state: Literal["awaiting_confirmation"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class PlacingOrderCheckoutIntent(BaseCheckoutIntent):
|
|
35
|
+
offer: Offer
|
|
36
|
+
|
|
37
|
+
payment_method: PaymentMethod = FieldInfo(alias="paymentMethod")
|
|
38
|
+
|
|
39
|
+
state: Literal["placing_order"]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class CompletedCheckoutIntent(BaseCheckoutIntent):
|
|
43
|
+
offer: Offer
|
|
44
|
+
|
|
45
|
+
payment_method: PaymentMethod = FieldInfo(alias="paymentMethod")
|
|
46
|
+
|
|
47
|
+
state: Literal["completed"]
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class FailedCheckoutIntentFailureReason(BaseModel):
|
|
51
|
+
code: Literal[
|
|
52
|
+
"checkout_intent_expired",
|
|
53
|
+
"payment_failed",
|
|
54
|
+
"insufficient_stock",
|
|
55
|
+
"product_out_of_stock",
|
|
56
|
+
"offer_retrieval_failed",
|
|
57
|
+
"order_placement_failed",
|
|
58
|
+
"developer_not_found",
|
|
59
|
+
"missing_shipping_method",
|
|
60
|
+
"unsupported_currency",
|
|
61
|
+
"unsupported_store_no_guest_checkout",
|
|
62
|
+
]
|
|
63
|
+
|
|
64
|
+
message: str
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class FailedCheckoutIntent(BaseCheckoutIntent):
|
|
68
|
+
failure_reason: FailedCheckoutIntentFailureReason = FieldInfo(alias="failureReason")
|
|
69
|
+
|
|
70
|
+
state: Literal["failed"]
|
|
71
|
+
|
|
72
|
+
offer: Optional[Offer] = None
|
|
73
|
+
|
|
74
|
+
payment_method: Optional[PaymentMethod] = FieldInfo(alias="paymentMethod", default=None)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
CheckoutIntent: TypeAlias = Union[
|
|
78
|
+
RetrievingOfferCheckoutIntent,
|
|
79
|
+
AwaitingConfirmationCheckoutIntent,
|
|
80
|
+
PlacingOrderCheckoutIntent,
|
|
81
|
+
CompletedCheckoutIntent,
|
|
82
|
+
FailedCheckoutIntent,
|
|
83
|
+
]
|