python-amazon-sp-api 2.0.9__py3-none-any.whl → 2.0.11__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.
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/METADATA +1 -1
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/RECORD +15 -13
- sp_api/__version__.py +1 -1
- sp_api/api/__init__.py +2 -0
- sp_api/api/orders/orders.py +125 -386
- sp_api/api/orders/orders_2026_01_01.py +1 -1
- sp_api/api/orders/orders_v0.py +359 -0
- sp_api/asyncio/api/__init__.py +2 -0
- sp_api/asyncio/api/orders/orders.py +128 -388
- sp_api/asyncio/api/orders/orders_2026_01_01.py +79 -3
- sp_api/asyncio/api/orders/orders_v0.py +361 -0
- {python_amazon_sp_api-2.0.9.data → python_amazon_sp_api-2.0.11.data}/scripts/make_endpoint +0 -0
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/WHEEL +0 -0
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/licenses/LICENSE +0 -0
- {python_amazon_sp_api-2.0.9.dist-info → python_amazon_sp_api-2.0.11.dist-info}/top_level.txt +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import enum
|
|
4
|
-
from typing import Any, Literal, overload
|
|
4
|
+
from typing import Any, Literal, TYPE_CHECKING, overload
|
|
5
5
|
|
|
6
6
|
from sp_api.asyncio.base import AsyncBaseClient
|
|
7
|
-
from sp_api.base import ApiResponse, deprecated, fill_query_params, sp_endpoint
|
|
7
|
+
from sp_api.base import ApiResponse, Marketplaces, deprecated, fill_query_params, sp_endpoint
|
|
8
8
|
from sp_api.util import normalize_csv_param
|
|
9
9
|
|
|
10
10
|
from .orders_2026_01_01 import OrdersV20260101
|
|
11
|
+
from .orders_v0 import OrdersV0
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class OrdersVersion(str, enum.Enum):
|
|
@@ -16,397 +17,136 @@ class OrdersVersion(str, enum.Enum):
|
|
|
16
17
|
LATEST = "2026-01-01"
|
|
17
18
|
|
|
18
19
|
|
|
19
|
-
class
|
|
20
|
-
"""
|
|
20
|
+
class _VersionedClientMeta(type):
|
|
21
|
+
"""Metaclass that dispatches construction to a version-specific implementation.
|
|
21
22
|
|
|
22
|
-
This
|
|
23
|
+
This keeps the call-site ergonomic (`Orders(version=...)`) while allowing a single
|
|
24
|
+
place to implement the dispatch logic.
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
Subclasses should define:
|
|
27
|
+
- `_VERSION_MAP`: mapping of normalized version strings to implementation classes
|
|
28
|
+
- `_VERSION_ALIASES` (optional): mapping of alias strings to normalized versions
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
If no version is provided, the default version is used.
|
|
29
31
|
"""
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
cls,
|
|
34
|
-
*args: Any,
|
|
35
|
-
version: Literal[OrdersVersion.V_2026_01_01, "2026-01-01"],
|
|
36
|
-
**kwargs: Any,
|
|
37
|
-
) -> OrdersV20260101: ...
|
|
38
|
-
|
|
39
|
-
@overload
|
|
40
|
-
def __new__(
|
|
41
|
-
cls,
|
|
42
|
-
*args: Any,
|
|
43
|
-
version: str | OrdersVersion | None = None,
|
|
44
|
-
**kwargs: Any,
|
|
45
|
-
) -> "Orders": ...
|
|
46
|
-
|
|
47
|
-
def __new__(
|
|
48
|
-
cls,
|
|
49
|
-
*args: Any,
|
|
50
|
-
version: str | OrdersVersion | None = None,
|
|
51
|
-
**kwargs: Any,
|
|
52
|
-
):
|
|
53
|
-
if cls is Orders:
|
|
54
|
-
v = version if version is not None else kwargs.get("version")
|
|
55
|
-
if v in (OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"):
|
|
56
|
-
kwargs.pop("version", None)
|
|
57
|
-
return OrdersV20260101(*args, **kwargs)
|
|
58
|
-
return super().__new__(cls)
|
|
59
|
-
|
|
60
|
-
@sp_endpoint("/orders/v0/orders")
|
|
61
|
-
async def get_orders(self, **kwargs) -> ApiResponse:
|
|
62
|
-
"""
|
|
63
|
-
get_orders(self, **kwargs) -> ApiResponse
|
|
64
|
-
Returns orders created or updated during the time frame indicated by the specified parameters.
|
|
65
|
-
You can also apply a range of filtering criteria to narrow the list of orders returned.
|
|
66
|
-
If NextToken is present, that will be used to retrieve the orders instead of other criteria.
|
|
67
|
-
|
|
68
|
-
**Usage Plan:**
|
|
69
|
-
|
|
70
|
-
====================================== ==============
|
|
71
|
-
Rate (requests per second) Burst
|
|
72
|
-
====================================== ==============
|
|
73
|
-
1 1
|
|
74
|
-
====================================== ==============
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
78
|
-
|
|
79
|
-
Examples:
|
|
80
|
-
literal blocks::
|
|
81
|
-
|
|
82
|
-
Orders().get_orders(CreatedAfter='TEST_CASE_200', MarketplaceIds=["ATVPDKIKX0DER"])
|
|
83
|
-
|
|
84
|
-
Args:
|
|
85
|
-
key CreatedAfter: date
|
|
86
|
-
key CreatedBefore: date
|
|
87
|
-
key LastUpdatedAfter: date
|
|
88
|
-
key LastUpdatedBefore: date
|
|
89
|
-
key OrderStatuses: [str]
|
|
90
|
-
key MarketplaceIds: [str]
|
|
91
|
-
key FulfillmentChannels: [str]
|
|
92
|
-
key PaymentMethods: [str]
|
|
93
|
-
key BuyerEmail: str
|
|
94
|
-
key SellerOrderId: str
|
|
95
|
-
key MaxResultsPerPage: int
|
|
96
|
-
key EasyShipShipmentStatuses: [str]
|
|
97
|
-
key NextToken: str
|
|
98
|
-
key AmazonOrderIds: [str]
|
|
99
|
-
key RestrictedResources: [str]
|
|
100
|
-
|
|
101
|
-
Returns:
|
|
102
|
-
ApiResponse:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
"""
|
|
106
|
-
normalize_csv_param(kwargs, "OrderStatuses")
|
|
107
|
-
normalize_csv_param(kwargs, "MarketplaceIds")
|
|
108
|
-
normalize_csv_param(kwargs, "FulfillmentChannels")
|
|
109
|
-
normalize_csv_param(kwargs, "PaymentMethods")
|
|
110
|
-
normalize_csv_param(kwargs, "AmazonOrderIds")
|
|
111
|
-
|
|
112
|
-
if "RestrictedResources" in kwargs:
|
|
113
|
-
return self._access_restricted(kwargs)
|
|
114
|
-
return await self._request(kwargs.pop("path"), params={**kwargs})
|
|
115
|
-
|
|
116
|
-
@sp_endpoint("/orders/v0/orders/{}")
|
|
117
|
-
async def get_order(self, order_id: str, **kwargs) -> ApiResponse:
|
|
118
|
-
"""
|
|
119
|
-
get_order(self, order_id: str, **kwargs) -> ApiResponse
|
|
120
|
-
Returns the order indicated by the specified order ID.
|
|
121
|
-
|
|
122
|
-
**Usage Plan:**
|
|
123
|
-
|
|
124
|
-
====================================== ==============
|
|
125
|
-
Rate (requests per second) Burst
|
|
126
|
-
====================================== ==============
|
|
127
|
-
1 1
|
|
128
|
-
====================================== ==============
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
132
|
-
|
|
133
|
-
Examples:
|
|
134
|
-
literal blocks::
|
|
135
|
-
|
|
136
|
-
Orders().get_order('TEST_CASE_200')
|
|
137
|
-
|
|
138
|
-
Args:
|
|
139
|
-
order_id: str
|
|
140
|
-
key RestrictedResources: [str]
|
|
141
|
-
**kwargs:
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
ApiResponse:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
"""
|
|
148
|
-
if "RestrictedResources" in kwargs:
|
|
149
|
-
kwargs.update(
|
|
150
|
-
{"original_path": fill_query_params(kwargs.get("path"), order_id)}
|
|
151
|
-
)
|
|
152
|
-
return self._access_restricted(kwargs)
|
|
153
|
-
return await self._request(
|
|
154
|
-
fill_query_params(kwargs.pop("path"), order_id),
|
|
155
|
-
params={**kwargs},
|
|
156
|
-
add_marketplace=False,
|
|
157
|
-
)
|
|
158
|
-
|
|
159
|
-
@sp_endpoint("/orders/v0/orders/{}/orderItems")
|
|
160
|
-
async def get_order_items(self, order_id: str, **kwargs) -> ApiResponse:
|
|
161
|
-
"""
|
|
162
|
-
get_order_items(self, order_id: str, **kwargs) -> ApiResponse
|
|
163
|
-
|
|
164
|
-
Returns detailed order item information for the order indicated by the specified order ID.
|
|
165
|
-
If NextToken is provided, it's used to retrieve the next page of order items.
|
|
166
|
-
|
|
167
|
-
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized),
|
|
168
|
-
the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or
|
|
169
|
-
promotions for the order items in the order.
|
|
170
|
-
After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped,
|
|
171
|
-
Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes,
|
|
172
|
-
shipping charges, gift status and promotions for the order items in the order.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
**Usage Plan:**
|
|
176
|
-
|
|
177
|
-
====================================== ==============
|
|
178
|
-
Rate (requests per second) Burst
|
|
179
|
-
====================================== ==============
|
|
180
|
-
1 1
|
|
181
|
-
====================================== ==============
|
|
33
|
+
def __call__(cls, *args: Any, **kwargs: Any):
|
|
34
|
+
version = kwargs.pop("version", None)
|
|
182
35
|
|
|
36
|
+
# Only dispatch for the public front class itself.
|
|
37
|
+
if cls is Orders:
|
|
38
|
+
# Backwards-compatible default: if no version is provided, return the
|
|
39
|
+
# oldest supported implementation.
|
|
40
|
+
v_raw = version if version is not None else getattr(cls, "_DEFAULT_VERSION", None)
|
|
41
|
+
if v_raw is None:
|
|
42
|
+
return super().__call__(*args, **kwargs)
|
|
43
|
+
|
|
44
|
+
v_raw = getattr(v_raw, "value", v_raw)
|
|
45
|
+
v = str(v_raw)
|
|
46
|
+
aliases: dict[str, str] = getattr(cls, "_VERSION_ALIASES", {})
|
|
47
|
+
v_norm = aliases.get(v, v)
|
|
48
|
+
|
|
49
|
+
impl_map: dict[str, type] = getattr(cls, "_VERSION_MAP", {})
|
|
50
|
+
impl = impl_map.get(v_norm)
|
|
51
|
+
if impl is not None:
|
|
52
|
+
return impl(*args, **kwargs)
|
|
53
|
+
|
|
54
|
+
supported = ", ".join(sorted(impl_map.keys()))
|
|
55
|
+
raise ValueError(f"Unsupported version {v!r}. Supported: {supported}")
|
|
56
|
+
|
|
57
|
+
return super().__call__(*args, **kwargs)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
if TYPE_CHECKING:
|
|
61
|
+
|
|
62
|
+
class _OrdersMeta(_VersionedClientMeta):
|
|
63
|
+
@overload
|
|
64
|
+
def __call__(
|
|
65
|
+
self,
|
|
66
|
+
*args: Any,
|
|
67
|
+
version: Literal[OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"],
|
|
68
|
+
**kwargs: Any,
|
|
69
|
+
) -> OrdersV20260101: ...
|
|
70
|
+
|
|
71
|
+
@overload
|
|
72
|
+
def __call__(
|
|
73
|
+
self,
|
|
74
|
+
*args: Any,
|
|
75
|
+
version: Literal[OrdersVersion.V0, "v0"],
|
|
76
|
+
**kwargs: Any,
|
|
77
|
+
) -> OrdersV0: ...
|
|
78
|
+
|
|
79
|
+
@overload
|
|
80
|
+
def __call__(
|
|
81
|
+
self,
|
|
82
|
+
*args: Any,
|
|
83
|
+
version: None = None,
|
|
84
|
+
**kwargs: Any,
|
|
85
|
+
) -> OrdersV0: ...
|
|
86
|
+
|
|
87
|
+
@overload
|
|
88
|
+
def __call__(
|
|
89
|
+
self,
|
|
90
|
+
*args: Any,
|
|
91
|
+
version: str | OrdersVersion,
|
|
92
|
+
**kwargs: Any,
|
|
93
|
+
) -> AsyncBaseClient: ...
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
else:
|
|
97
|
+
_OrdersMeta = _VersionedClientMeta
|
|
98
|
+
|
|
99
|
+
class Orders(AsyncBaseClient, metaclass=_OrdersMeta):
|
|
100
|
+
"""Orders API client.
|
|
101
|
+
|
|
102
|
+
This class dispatches to a versioned Orders API client.
|
|
103
|
+
|
|
104
|
+
If you do not pass a version, the constructor returns the oldest supported implementation ("v0").
|
|
183
105
|
|
|
106
|
+
:link: https://github.com/amzn/selling-partner-api-docs/tree/main/references/orders-api
|
|
107
|
+
"""
|
|
184
108
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
)
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
Args:
|
|
231
|
-
order_id: str
|
|
232
|
-
**kwargs:
|
|
233
|
-
|
|
234
|
-
Returns:
|
|
235
|
-
ApiResponse
|
|
236
|
-
"""
|
|
237
|
-
return await self._request(
|
|
238
|
-
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
239
|
-
)
|
|
240
|
-
|
|
241
|
-
@sp_endpoint("/orders/v0/orders/{}/buyerInfo")
|
|
242
|
-
async def get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
243
|
-
"""
|
|
244
|
-
get_order_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
245
|
-
Returns buyer information for the order indicated by the specified order ID.
|
|
246
|
-
|
|
247
|
-
:note: To get useful information from this method, you need to have access to PII.
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
**Usage Plan:**
|
|
251
|
-
|
|
252
|
-
====================================== ==============
|
|
253
|
-
Rate (requests per second) Burst
|
|
254
|
-
====================================== ==============
|
|
255
|
-
1 1
|
|
256
|
-
====================================== ==============
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
260
|
-
|
|
261
|
-
Examples:
|
|
262
|
-
Orders().get_order_buyer_info('TEST_CASE_200')
|
|
263
|
-
|
|
264
|
-
Args:
|
|
265
|
-
order_id: str
|
|
266
|
-
**kwargs:
|
|
267
|
-
|
|
268
|
-
Returns:
|
|
269
|
-
GetOrderBuyerInfoResponse:
|
|
270
|
-
|
|
271
|
-
"""
|
|
272
|
-
return await self._request(
|
|
273
|
-
fill_query_params(kwargs.pop("path"), order_id), params={**kwargs}
|
|
274
|
-
)
|
|
275
|
-
|
|
276
|
-
@sp_endpoint("/orders/v0/orders/{}/orderItems/buyerInfo")
|
|
277
|
-
async def get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse:
|
|
278
|
-
"""
|
|
279
|
-
get_order_items_buyer_info(self, order_id: str, **kwargs) -> ApiResponse
|
|
280
|
-
|
|
281
|
-
Returns buyer information in the order items of the order indicated by the specified order ID.
|
|
282
|
-
|
|
283
|
-
**Usage Plan:**
|
|
284
|
-
|
|
285
|
-
====================================== ==============
|
|
286
|
-
Rate (requests per second) Burst
|
|
287
|
-
====================================== ==============
|
|
288
|
-
1 1
|
|
289
|
-
====================================== ==============
|
|
290
|
-
|
|
291
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
292
|
-
|
|
293
|
-
Examples:
|
|
294
|
-
literal blocks::
|
|
295
|
-
|
|
296
|
-
Orders().get_order_items_buyer_info('TEST_CASE_200')
|
|
297
|
-
|
|
298
|
-
Args:
|
|
299
|
-
order_id: str
|
|
300
|
-
key NextToken: str | retrieve data by next token
|
|
301
|
-
|
|
302
|
-
Returns:
|
|
303
|
-
ApiResponse
|
|
304
|
-
"""
|
|
305
|
-
return await self._request(
|
|
306
|
-
fill_query_params(kwargs.pop("path"), order_id), params=kwargs
|
|
307
|
-
)
|
|
308
|
-
|
|
309
|
-
@sp_endpoint("/orders/v0/orders/{}/shipment", method="POST")
|
|
310
|
-
async def update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse:
|
|
311
|
-
"""
|
|
312
|
-
update_shipment_status(self, order_id: str, **kwargs) -> ApiResponse
|
|
313
|
-
Update the shipment status.
|
|
314
|
-
**Usage Plan:**
|
|
315
|
-
====================================== ==============
|
|
316
|
-
Rate (requests per second) Burst
|
|
317
|
-
====================================== ==============
|
|
318
|
-
5 15
|
|
319
|
-
====================================== ==============
|
|
320
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
321
|
-
Examples:
|
|
322
|
-
literal blocks::
|
|
323
|
-
Orders().update_shipment_status(
|
|
324
|
-
order_id='123-1234567-1234567',
|
|
325
|
-
marketplaceId='ATVPDKIKX0DER',
|
|
326
|
-
shipmentStatus='ReadyForPickup'
|
|
327
|
-
)
|
|
328
|
-
Args:
|
|
329
|
-
order_id: str
|
|
330
|
-
Returns:
|
|
331
|
-
ApiResponse
|
|
332
|
-
"""
|
|
333
|
-
return await self._request(
|
|
334
|
-
fill_query_params(kwargs.pop("path"), order_id),
|
|
335
|
-
res_no_data=True,
|
|
336
|
-
data=kwargs,
|
|
337
|
-
)
|
|
338
|
-
|
|
339
|
-
@sp_endpoint("/orders/v0/orders/{}/shipmentConfirmation", method="POST")
|
|
340
|
-
async def confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse:
|
|
341
|
-
"""
|
|
342
|
-
confirm_shipment(self, order_id: str, **kwargs) -> ApiResponse
|
|
343
|
-
Updates the shipment confirmation status for a specified order.
|
|
344
|
-
**Usage Plan:**
|
|
345
|
-
====================================== ==============
|
|
346
|
-
Rate (requests per second) Burst
|
|
347
|
-
====================================== ==============
|
|
348
|
-
2 10
|
|
349
|
-
====================================== ==============
|
|
350
|
-
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
351
|
-
Examples:
|
|
352
|
-
literal blocks::
|
|
353
|
-
Orders().confirm_shipment(
|
|
354
|
-
order_id='123-1234567-1234567',
|
|
355
|
-
marketplaceId='ATVPDKIKX0DER',
|
|
356
|
-
packageDetail={
|
|
357
|
-
'packageReferenceId': '0001',
|
|
358
|
-
'carrierCode': 'DHL',
|
|
359
|
-
"shippingMethod": 'Paket',
|
|
360
|
-
'trackingNumber': '1234567890',
|
|
361
|
-
'shipDate': '2023-03-19T12:00:00Z',
|
|
362
|
-
'orderItems': [
|
|
363
|
-
{
|
|
364
|
-
'orderItemId': '123456789',
|
|
365
|
-
'quantity': 1
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
'orderItemId': '2345678901',
|
|
369
|
-
'quantity': 2
|
|
370
|
-
},
|
|
371
|
-
]
|
|
372
|
-
}
|
|
373
|
-
)
|
|
374
|
-
Args:
|
|
375
|
-
order_id: str
|
|
376
|
-
Returns:
|
|
377
|
-
ApiResponse
|
|
378
|
-
"""
|
|
379
|
-
return await self._request(
|
|
380
|
-
fill_query_params(kwargs.pop("path"), order_id),
|
|
381
|
-
add_marketplace=False,
|
|
382
|
-
res_no_data=True,
|
|
383
|
-
data=kwargs,
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
@sp_endpoint("/tokens/2021-03-01/restrictedDataToken", method="POST")
|
|
387
|
-
async def _get_token(self, **kwargs):
|
|
388
|
-
data_elements = kwargs.pop("RestrictedResources")
|
|
389
|
-
|
|
390
|
-
restricted_resources = [
|
|
391
|
-
{
|
|
392
|
-
"method": "GET",
|
|
393
|
-
"path": kwargs.get("original_path"),
|
|
394
|
-
"dataElements": data_elements,
|
|
395
|
-
}
|
|
396
|
-
]
|
|
397
|
-
|
|
398
|
-
return await self._request(
|
|
399
|
-
kwargs.pop("path"),
|
|
400
|
-
data={"restrictedResources": restricted_resources, **kwargs},
|
|
401
|
-
)
|
|
402
|
-
|
|
403
|
-
async def _access_restricted(self, kwargs):
|
|
404
|
-
if "original_path" not in kwargs:
|
|
405
|
-
kwargs.update({"original_path": kwargs["path"]})
|
|
406
|
-
token = self._get_token(**kwargs).payload
|
|
407
|
-
self.restricted_data_token = token["restrictedDataToken"]
|
|
408
|
-
r = await self._request(kwargs.pop("original_path"), params={**kwargs})
|
|
409
|
-
if not self.keep_restricted_data_token:
|
|
410
|
-
self.restricted_data_token = None
|
|
411
|
-
return r
|
|
412
|
-
|
|
109
|
+
if TYPE_CHECKING:
|
|
110
|
+
@overload
|
|
111
|
+
def __new__(
|
|
112
|
+
cls,
|
|
113
|
+
*args: Any,
|
|
114
|
+
version: Literal[OrdersVersion.V_2026_01_01, OrdersVersion.LATEST, "2026-01-01"],
|
|
115
|
+
**kwargs: Any,
|
|
116
|
+
) -> OrdersV20260101: ...
|
|
117
|
+
|
|
118
|
+
@overload
|
|
119
|
+
def __new__(
|
|
120
|
+
cls,
|
|
121
|
+
*args: Any,
|
|
122
|
+
version: Literal[OrdersVersion.V0, "v0"],
|
|
123
|
+
**kwargs: Any,
|
|
124
|
+
) -> OrdersV0: ...
|
|
125
|
+
|
|
126
|
+
@overload
|
|
127
|
+
def __new__(
|
|
128
|
+
cls,
|
|
129
|
+
*args: Any,
|
|
130
|
+
version: None = None,
|
|
131
|
+
**kwargs: Any,
|
|
132
|
+
) -> OrdersV0: ...
|
|
133
|
+
|
|
134
|
+
@overload
|
|
135
|
+
def __new__(
|
|
136
|
+
cls,
|
|
137
|
+
*args: Any,
|
|
138
|
+
version: str | OrdersVersion,
|
|
139
|
+
**kwargs: Any,
|
|
140
|
+
) -> AsyncBaseClient: ...
|
|
141
|
+
|
|
142
|
+
_DEFAULT_VERSION = "v0"
|
|
143
|
+
|
|
144
|
+
_VERSION_MAP = {
|
|
145
|
+
"v0": OrdersV0,
|
|
146
|
+
"2026-01-01": OrdersV20260101,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
_VERSION_ALIASES = {
|
|
150
|
+
"v0": "v0",
|
|
151
|
+
"2026-01-01": "2026-01-01",
|
|
152
|
+
}
|
|
@@ -19,18 +19,94 @@ class OrdersV20260101(AsyncBaseClient):
|
|
|
19
19
|
|
|
20
20
|
@sp_endpoint("/orders/2026-01-01/orders")
|
|
21
21
|
async def search_orders(self, **kwargs: Any) -> ApiResponse:
|
|
22
|
-
"""
|
|
22
|
+
"""
|
|
23
|
+
search_orders(self, **kwargs) -> ApiResponse
|
|
24
|
+
Returns orders that are created or updated during the time period that you specify.
|
|
25
|
+
You can filter the response for specific types of orders.
|
|
26
|
+
|
|
27
|
+
**Usage Plan:**
|
|
28
|
+
|
|
29
|
+
====================================== =====================
|
|
30
|
+
Rate (requests per second) Burst
|
|
31
|
+
====================================== =====================
|
|
32
|
+
See x-amzn-ratelimit-limit response See Amazon docs
|
|
33
|
+
====================================== =====================
|
|
34
|
+
|
|
35
|
+
Note:
|
|
36
|
+
The SP-API returns an `x-amzn-ratelimit-limit` (or similar) response header indicating the rate limit
|
|
37
|
+
applied to the request. Rate and burst can vary by seller/account and by any Amazon-granted overrides.
|
|
38
|
+
|
|
39
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
40
|
+
|
|
41
|
+
Examples:
|
|
42
|
+
literal blocks::
|
|
43
|
+
|
|
44
|
+
OrdersV20260101().search_orders(
|
|
45
|
+
createdAfter="2026-01-01T00:00:00Z",
|
|
46
|
+
marketplaceIds=["A1PA6795UKMFR9"]
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
key createdAfter: str
|
|
51
|
+
key createdBefore: str
|
|
52
|
+
key lastUpdatedAfter: str
|
|
53
|
+
key lastUpdatedBefore: str
|
|
54
|
+
key fulfillmentStatuses: [str] | str
|
|
55
|
+
key marketplaceIds: [str] | str
|
|
56
|
+
key fulfilledBy: [str] | str
|
|
57
|
+
key includedData: [str] | str
|
|
58
|
+
key paginationToken: str
|
|
59
|
+
key maxResultsPerPage: int
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
ApiResponse:
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
"""
|
|
23
66
|
|
|
24
67
|
normalize_csv_param(kwargs, "fulfillmentStatuses")
|
|
25
68
|
normalize_csv_param(kwargs, "marketplaceIds")
|
|
26
69
|
normalize_csv_param(kwargs, "fulfilledBy")
|
|
27
|
-
normalize_csv_param(kwargs, "includedData")
|
|
28
70
|
|
|
29
71
|
return await self._request(kwargs.pop("path"), params={**kwargs})
|
|
30
72
|
|
|
31
73
|
@sp_endpoint("/orders/2026-01-01/orders/{}")
|
|
32
74
|
async def get_order(self, order_id: str, **kwargs: Any) -> ApiResponse:
|
|
33
|
-
"""
|
|
75
|
+
"""
|
|
76
|
+
get_order(self, order_id: str, **kwargs) -> ApiResponse
|
|
77
|
+
Returns the order that you specify.
|
|
78
|
+
|
|
79
|
+
**Usage Plan:**
|
|
80
|
+
|
|
81
|
+
====================================== =====================
|
|
82
|
+
Rate (requests per second) Burst
|
|
83
|
+
====================================== =====================
|
|
84
|
+
See x-amzn-ratelimit-limit response See Amazon docs
|
|
85
|
+
====================================== =====================
|
|
86
|
+
|
|
87
|
+
Note:
|
|
88
|
+
The SP-API returns an `x-amzn-ratelimit-limit` (or similar) response header indicating the rate limit
|
|
89
|
+
applied to the request. Rate and burst can vary by seller/account and by any Amazon-granted overrides.
|
|
90
|
+
|
|
91
|
+
For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
literal blocks::
|
|
95
|
+
|
|
96
|
+
OrdersV20260101().get_order(
|
|
97
|
+
"306-9860906-6213927",
|
|
98
|
+
includedData=["orderItems"]
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
order_id: str
|
|
103
|
+
key includedData: [str] | str
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
ApiResponse:
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
"""
|
|
34
110
|
|
|
35
111
|
normalize_csv_param(kwargs, "includedData")
|
|
36
112
|
return await self._request(
|