python-amazon-sp-api 2.0.15__py3-none-any.whl → 2.1.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.
Files changed (214) hide show
  1. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/METADATA +7 -7
  2. python_amazon_sp_api-2.1.3.dist-info/RECORD +350 -0
  3. sp_api/__version__.py +1 -1
  4. sp_api/api/__init__.py +160 -4
  5. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +85 -110
  6. sp_api/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu_2024_05_09.py +456 -0
  7. sp_api/api/aplus_content/aplus_content.py +176 -125
  8. sp_api/api/application_integrations/application_integrations.py +59 -68
  9. sp_api/api/application_management/application_management.py +20 -13
  10. sp_api/api/authorization/authorization.py +8 -26
  11. sp_api/api/catalog/catalog.py +27 -61
  12. sp_api/api/catalog_items/catalog_items.py +108 -78
  13. sp_api/api/catalog_items/catalog_items_2020_12_01.py +86 -0
  14. sp_api/api/catalog_items/catalog_items_2022_04_01.py +89 -0
  15. sp_api/api/customer_feedback/customer_feedback.py +100 -0
  16. sp_api/api/data_kiosk/data_kiosk.py +80 -75
  17. sp_api/api/delivery_by_amazon/__init__.py +0 -0
  18. sp_api/api/delivery_by_amazon/delivery_by_amazon.py +92 -0
  19. sp_api/api/delivery_by_amazon/delivery_by_amazon_2022_07_01.py +81 -0
  20. sp_api/api/easy_ship/easy_ship.py +121 -111
  21. sp_api/api/external_fulfillment/external_fulfillment.py +211 -434
  22. sp_api/api/external_fulfillment/inventory.py +120 -0
  23. sp_api/api/external_fulfillment/inventory_2021_01_06.py +71 -0
  24. sp_api/api/external_fulfillment/inventory_2024_09_11.py +96 -0
  25. sp_api/api/external_fulfillment/returns.py +120 -0
  26. sp_api/api/external_fulfillment/returns_2021_08_19.py +88 -0
  27. sp_api/api/external_fulfillment/returns_2024_09_11.py +141 -0
  28. sp_api/api/external_fulfillment/shipping.py +120 -0
  29. sp_api/api/external_fulfillment/shipping_2021_01_06.py +256 -0
  30. sp_api/api/external_fulfillment/shipping_2024_09_11.py +233 -0
  31. sp_api/api/fba_inbound_eligibility/fba_inbound_eligibility.py +30 -24
  32. sp_api/api/fba_small_and_light/fba_small_and_light.py +60 -99
  33. sp_api/api/feeds/feeds.py +75 -245
  34. sp_api/api/feeds/feeds_2021_06_30.py +320 -0
  35. sp_api/api/finances/finances.py +123 -90
  36. sp_api/api/finances/finances_2024_06_01.py +71 -0
  37. sp_api/api/finances/finances_2024_06_19.py +114 -0
  38. sp_api/api/finances/finances_v0.py +116 -0
  39. sp_api/api/fulfillment_inbound/fulfillment_inbound.py +107 -1784
  40. sp_api/api/fulfillment_inbound/fulfillment_inbound_2024_03_20.py +1722 -0
  41. sp_api/api/fulfillment_inbound/fulfillment_inbound_v0.py +1384 -0
  42. sp_api/api/fulfillment_outbound/fulfillment_outbound.py +256 -480
  43. sp_api/api/inventories/inventories.py +79 -42
  44. sp_api/api/invoices/__init__.py +0 -0
  45. sp_api/api/invoices/invoices.py +92 -0
  46. sp_api/api/invoices/invoices_2024_06_19.py +344 -0
  47. sp_api/api/listings_items/listings_items.py +110 -163
  48. sp_api/api/listings_items/listings_items_2020_09_01.py +189 -0
  49. sp_api/api/listings_items/listings_items_2021_08_01.py +233 -0
  50. sp_api/api/listings_restrictions/listings_restrictions.py +23 -10
  51. sp_api/api/merchant_fulfillment/merchant_fulfillment.py +107 -222
  52. sp_api/api/messaging/messaging.py +184 -198
  53. sp_api/api/notifications/notifications.py +144 -106
  54. sp_api/api/orders/orders.py +9 -46
  55. sp_api/api/orders/orders_2026_01_01.py +19 -65
  56. sp_api/api/orders/orders_v0.py +152 -184
  57. sp_api/api/product_fees/product_fees.py +101 -75
  58. sp_api/api/product_type_definitions/product_type_definitions.py +47 -36
  59. sp_api/api/products/products.py +94 -386
  60. sp_api/api/products/products_2022_05_01.py +96 -0
  61. sp_api/api/products/products_v0.py +389 -0
  62. sp_api/api/replenishment/replenishment.py +58 -69
  63. sp_api/api/reports/reports.py +124 -157
  64. sp_api/api/sales/sales.py +22 -39
  65. sp_api/api/seller_wallet/__init__.py +0 -0
  66. sp_api/api/seller_wallet/seller_wallet.py +92 -0
  67. sp_api/api/seller_wallet/seller_wallet_2024_03_01.py +300 -0
  68. sp_api/api/sellers/sellers.py +15 -35
  69. sp_api/api/services/services.py +479 -82
  70. sp_api/api/shipment_invoicing/__init__.py +0 -0
  71. sp_api/api/shipment_invoicing/shipment_invoicing.py +92 -0
  72. sp_api/api/shipment_invoicing/shipment_invoicing_v0.py +101 -0
  73. sp_api/api/shipping/shipping.py +94 -440
  74. sp_api/api/shipping/shippingV2.py +183 -474
  75. sp_api/api/shipping/shipping_v1.py +330 -0
  76. sp_api/api/shipping/shipping_v2.py +723 -0
  77. sp_api/api/solicitations/solicitations.py +28 -18
  78. sp_api/api/supply_sources/supply_sources.py +67 -57
  79. sp_api/api/tokens/tokens.py +14 -35
  80. sp_api/api/vehicles/__init__.py +0 -0
  81. sp_api/api/vehicles/vehicles.py +92 -0
  82. sp_api/api/vehicles/vehicles_2024_11_01.py +33 -0
  83. sp_api/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +16 -29
  84. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +116 -189
  85. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_2021_12_28.py +114 -0
  86. sp_api/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_v1.py +114 -0
  87. sp_api/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +15 -225
  88. sp_api/api/vendor_direct_fulfillment_sandbox_test_data/__init__.py +0 -0
  89. sp_api/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data.py +92 -0
  90. sp_api/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.py +50 -0
  91. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +122 -624
  92. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_2021_12_28.py +390 -0
  93. sp_api/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_v1.py +320 -0
  94. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +113 -29
  95. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_2021_12_28.py +47 -0
  96. sp_api/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_v1.py +47 -0
  97. sp_api/api/vendor_invoices/vendor_invoices.py +15 -264
  98. sp_api/api/vendor_orders/vendor_orders.py +83 -131
  99. sp_api/api/vendor_shipments/vendor_shipments.py +149 -68
  100. sp_api/api/vendor_transaction_status/vendor_transaction_status.py +16 -11
  101. sp_api/asyncio/api/__init__.py +159 -4
  102. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu.py +84 -110
  103. sp_api/asyncio/api/amazon_warehousing_and_distribu/amazon_warehousing_and_distribu_2024_05_09.py +457 -0
  104. sp_api/asyncio/api/aplus_content/aplus_content.py +176 -125
  105. sp_api/asyncio/api/application_integrations/application_integrations.py +59 -68
  106. sp_api/asyncio/api/application_management/application_management.py +20 -13
  107. sp_api/asyncio/api/authorization/authorization.py +8 -26
  108. sp_api/asyncio/api/catalog/catalog.py +27 -61
  109. sp_api/asyncio/api/catalog_items/catalog_items.py +94 -71
  110. sp_api/asyncio/api/catalog_items/catalog_items_2020_12_01.py +87 -0
  111. sp_api/asyncio/api/catalog_items/catalog_items_2022_04_01.py +90 -0
  112. sp_api/asyncio/api/customer_feedback/customer_feedback.py +100 -0
  113. sp_api/asyncio/api/data_kiosk/data_kiosk.py +80 -75
  114. sp_api/asyncio/api/delivery_by_amazon/__init__.py +0 -0
  115. sp_api/asyncio/api/delivery_by_amazon/delivery_by_amazon.py +92 -0
  116. sp_api/asyncio/api/delivery_by_amazon/delivery_by_amazon_2022_07_01.py +82 -0
  117. sp_api/asyncio/api/easy_ship/easy_ship.py +121 -111
  118. sp_api/asyncio/api/external_fulfillment/external_fulfillment.py +212 -435
  119. sp_api/asyncio/api/external_fulfillment/inventory.py +126 -0
  120. sp_api/asyncio/api/external_fulfillment/inventory_2021_01_06.py +73 -0
  121. sp_api/asyncio/api/external_fulfillment/inventory_2024_09_11.py +98 -0
  122. sp_api/asyncio/api/external_fulfillment/returns.py +124 -0
  123. sp_api/asyncio/api/external_fulfillment/returns_2021_08_19.py +90 -0
  124. sp_api/asyncio/api/external_fulfillment/returns_2024_09_11.py +143 -0
  125. sp_api/asyncio/api/external_fulfillment/shipping.py +124 -0
  126. sp_api/asyncio/api/external_fulfillment/shipping_2021_01_06.py +258 -0
  127. sp_api/asyncio/api/external_fulfillment/shipping_2024_09_11.py +235 -0
  128. sp_api/asyncio/api/fba_inbound_eligibility/fba_inbound_eligibility.py +31 -25
  129. sp_api/asyncio/api/fba_small_and_light/fba_small_and_light.py +61 -100
  130. sp_api/asyncio/api/feeds/feeds.py +75 -243
  131. sp_api/asyncio/api/feeds/feeds_2021_06_30.py +318 -0
  132. sp_api/asyncio/api/finances/finances.py +123 -91
  133. sp_api/asyncio/api/finances/finances_2024_06_01.py +72 -0
  134. sp_api/asyncio/api/finances/finances_2024_06_19.py +115 -0
  135. sp_api/asyncio/api/finances/finances_v0.py +117 -0
  136. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound.py +107 -1785
  137. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound_2024_03_20.py +1723 -0
  138. sp_api/asyncio/api/fulfillment_inbound/fulfillment_inbound_v0.py +1385 -0
  139. sp_api/asyncio/api/fulfillment_outbound/fulfillment_outbound.py +257 -481
  140. sp_api/asyncio/api/inventories/inventories.py +79 -42
  141. sp_api/asyncio/api/invoices/__init__.py +0 -0
  142. sp_api/asyncio/api/invoices/invoices.py +92 -0
  143. sp_api/asyncio/api/invoices/invoices_2024_06_19.py +345 -0
  144. sp_api/asyncio/api/listings_items/listings_items.py +109 -163
  145. sp_api/asyncio/api/listings_items/listings_items_2020_09_01.py +190 -0
  146. sp_api/asyncio/api/listings_items/listings_items_2021_08_01.py +233 -0
  147. sp_api/asyncio/api/listings_restrictions/listings_restrictions.py +23 -10
  148. sp_api/asyncio/api/merchant_fulfillment/merchant_fulfillment.py +110 -222
  149. sp_api/asyncio/api/messaging/messaging.py +185 -199
  150. sp_api/asyncio/api/notifications/notifications.py +145 -107
  151. sp_api/asyncio/api/orders/orders.py +9 -46
  152. sp_api/asyncio/api/orders/orders_2026_01_01.py +19 -65
  153. sp_api/asyncio/api/orders/orders_v0.py +152 -184
  154. sp_api/asyncio/api/product_fees/product_fees.py +101 -75
  155. sp_api/asyncio/api/product_type_definitions/product_type_definitions.py +47 -36
  156. sp_api/asyncio/api/products/products.py +94 -387
  157. sp_api/asyncio/api/products/products_2022_05_01.py +109 -0
  158. sp_api/asyncio/api/products/products_v0.py +388 -0
  159. sp_api/asyncio/api/replenishment/replenishment.py +59 -70
  160. sp_api/asyncio/api/reports/reports.py +124 -157
  161. sp_api/asyncio/api/sales/sales.py +22 -39
  162. sp_api/asyncio/api/seller_wallet/__init__.py +0 -0
  163. sp_api/asyncio/api/seller_wallet/seller_wallet.py +92 -0
  164. sp_api/asyncio/api/seller_wallet/seller_wallet_2024_03_01.py +301 -0
  165. sp_api/asyncio/api/sellers/sellers.py +16 -36
  166. sp_api/asyncio/api/services/services.py +479 -82
  167. sp_api/asyncio/api/shipment_invoicing/__init__.py +0 -0
  168. sp_api/asyncio/api/shipment_invoicing/shipment_invoicing.py +92 -0
  169. sp_api/asyncio/api/shipment_invoicing/shipment_invoicing_v0.py +102 -0
  170. sp_api/asyncio/api/shipping/shipping.py +94 -441
  171. sp_api/asyncio/api/shipping/shippingV2.py +181 -472
  172. sp_api/asyncio/api/shipping/shipping_v1.py +331 -0
  173. sp_api/asyncio/api/shipping/shipping_v2.py +717 -0
  174. sp_api/asyncio/api/solicitations/solicitations.py +29 -19
  175. sp_api/asyncio/api/supply_sources/supply_sources.py +67 -57
  176. sp_api/asyncio/api/tokens/tokens.py +14 -35
  177. sp_api/asyncio/api/vehicles/__init__.py +0 -0
  178. sp_api/asyncio/api/vehicles/vehicles.py +92 -0
  179. sp_api/asyncio/api/vehicles/vehicles_2024_11_01.py +34 -0
  180. sp_api/asyncio/api/vendor_direct_fulfillment_inventory/vendor_direct_fulfillment_inventory.py +16 -29
  181. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders.py +120 -192
  182. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_2021_12_28.py +116 -0
  183. sp_api/asyncio/api/vendor_direct_fulfillment_orders/vendor_direct_fulfillment_orders_v1.py +115 -0
  184. sp_api/asyncio/api/vendor_direct_fulfillment_payments/vendor_direct_fulfillment_payments.py +15 -225
  185. sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/__init__.py +0 -0
  186. sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data.py +92 -0
  187. sp_api/asyncio/api/vendor_direct_fulfillment_sandbox_test_data/vendor_direct_fulfillment_sandbox_test_data_2021_10_28.py +51 -0
  188. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping.py +120 -623
  189. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_2021_12_28.py +392 -0
  190. sp_api/asyncio/api/vendor_direct_fulfillment_shipping/vendor_direct_fulfillment_shipping_v1.py +321 -0
  191. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions.py +112 -29
  192. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_2021_12_28.py +49 -0
  193. sp_api/asyncio/api/vendor_direct_fulfillment_transactions/vendor_direct_fulfillment_transactions_v1.py +48 -0
  194. sp_api/asyncio/api/vendor_invoices/vendor_invoices.py +16 -265
  195. sp_api/asyncio/api/vendor_orders/vendor_orders.py +84 -132
  196. sp_api/asyncio/api/vendor_shipments/vendor_shipments.py +150 -69
  197. sp_api/asyncio/api/vendor_transaction_status/vendor_transaction_status.py +17 -12
  198. sp_api/asyncio/base/client.py +2 -2
  199. sp_api/asyncio/util/load_date_bound.py +1 -1
  200. sp_api/base/__init__.py +10 -0
  201. sp_api/base/_core.py +2 -2
  202. sp_api/base/client.py +3 -3
  203. sp_api/base/helpers.py +12 -1
  204. sp_api/base/marketplaces.py +6 -3
  205. sp_api/util/__init__.py +2 -0
  206. sp_api/util/load_date_bound.py +1 -1
  207. sp_api/util/versioned_client.py +45 -0
  208. python_amazon_sp_api-2.0.15.dist-info/RECORD +0 -255
  209. sp_api/asyncio/api/models/__init__.py +0 -4
  210. sp_api/asyncio/api/overrides/__init__.py +0 -1
  211. {python_amazon_sp_api-2.0.15.data → python_amazon_sp_api-2.1.3.data}/scripts/make_endpoint +0 -0
  212. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/WHEEL +0 -0
  213. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/licenses/LICENSE +0 -0
  214. {python_amazon_sp_api-2.0.15.dist-info → python_amazon_sp_api-2.1.3.dist-info}/top_level.txt +0 -0
@@ -1,459 +1,112 @@
1
- import urllib.parse
1
+ from __future__ import annotations
2
2
 
3
- from sp_api.base import Client, sp_endpoint, fill_query_params, ApiResponse
4
- from sp_api.asyncio.base import AsyncBaseClient
5
-
6
-
7
- class Shipping(AsyncBaseClient):
8
- """
9
- Shipping SP-API Client
10
- :link:
11
-
12
- Provides programmatic access to Amazon Shipping APIs.
13
- """
14
-
15
- @sp_endpoint("/shipping/v1/shipments", method="POST")
16
- async def create_shipment(self, **kwargs) -> ApiResponse:
17
- """
18
- create_shipment(self, **kwargs) -> ApiResponse
19
-
20
- Create a new shipment.
21
-
22
- **Usage Plan:**
23
-
24
- ====================================== ==============
25
- Rate (requests per second) Burst
26
- ====================================== ==============
27
- 5 15
28
- ====================================== ==============
29
-
30
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
31
-
32
- Args:
33
- body: {
34
- "clientReferenceId": "string",
35
- "shipTo": {
36
- "name": "string",
37
- "addressLine1": "string",
38
- "addressLine2": "string",
39
- "addressLine3": "string",
40
- "stateOrRegion": "string",
41
- "city": "string",
42
- "countryCode": "st",
43
- "postalCode": "string",
44
- "email": "string",
45
- "copyEmails": [
46
- "string"
47
- ],
48
- "phoneNumber": "string"
49
- },
50
- "shipFrom": {
51
- "name": "string",
52
- "addressLine1": "string",
53
- "addressLine2": "string",
54
- "addressLine3": "string",
55
- "stateOrRegion": "string",
56
- "city": "string",
57
- "countryCode": "st",
58
- "postalCode": "string",
59
- "email": "string",
60
- "copyEmails": [
61
- "string"
62
- ],
63
- "phoneNumber": "string"
64
- },
65
- "containers": [
66
- {
67
- "containerType": "PACKAGE",
68
- "containerReferenceId": "string",
69
- "value": {
70
- "value": 0,
71
- "unit": "str"
72
- },
73
- "dimensions": {
74
- "length": 0,
75
- "width": 0,
76
- "height": 0,
77
- "unit": "IN"
78
- },
79
- "items": [
80
- {
81
- "quantity": 0,
82
- "unitPrice": {
83
- "value": 0,
84
- "unit": "str"
85
- },
86
- "unitWeight": {
87
- "unit": "g",
88
- "value": 0
89
- },
90
- "title": "string"
91
- }
92
- ],
93
- "weight": {
94
- "unit": "g",
95
- "value": 0
96
- }
97
- }
98
- ]
99
- }
100
-
101
- Returns:
102
- ApiResponse:
103
- """
104
-
105
- return await self._request(kwargs.pop("path"), data=kwargs)
106
-
107
- @sp_endpoint("/shipping/v1/shipments/{}", method="GET")
108
- async def get_shipment(self, shipmentId, **kwargs) -> ApiResponse:
109
- """
110
- get_shipment(self, shipmentId, **kwargs) -> ApiResponse
111
-
112
- Return the entire shipment object for the shipmentId.
113
-
114
- **Usage Plan:**
115
-
116
- ====================================== ==============
117
- Rate (requests per second) Burst
118
- ====================================== ==============
119
- 5 15
120
- ====================================== ==============
121
-
122
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
123
-
124
- Args:
125
- shipmentId:string | * REQUIRED
126
-
127
- Returns:
128
- ApiResponse:
129
- """
130
-
131
- return await self._request(
132
- fill_query_params(kwargs.pop("path"), shipmentId), params=kwargs
133
- )
134
-
135
- @sp_endpoint("/shipping/v1/shipments/{}/cancel", method="POST")
136
- async def cancel_shipment(self, shipmentId, **kwargs) -> ApiResponse:
137
- """
138
- cancel_shipment(self, shipmentId, **kwargs) -> ApiResponse
139
-
140
- Cancel a shipment by the given shipmentId.
141
-
142
- **Usage Plan:**
143
-
144
-
145
- ====================================== ==============
146
- Rate (requests per second) Burst
147
- ====================================== ==============
148
- 5 15
149
- ====================================== ==============
150
-
151
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
152
-
153
- Args:
154
- shipmentId:string | * REQUIRED
155
-
156
- Returns:
157
- ApiResponse:
158
- """
159
-
160
- return await self._request(
161
- fill_query_params(kwargs.pop("path"), shipmentId), data=kwargs
162
- )
163
-
164
- @sp_endpoint("/shipping/v1/shipments/{}/purchaseLabels", method="POST")
165
- async def purchase_labels(self, shipmentId, **kwargs) -> ApiResponse:
166
- """
167
- purchase_labels(self, shipmentId, **kwargs) -> ApiResponse
168
-
169
- Purchase shipping labels based on a given rate.
3
+ import enum
4
+ from typing import Any, Literal, TYPE_CHECKING, overload
170
5
 
171
- **Usage Plan:**
172
-
173
-
174
- ====================================== ==============
175
- Rate (requests per second) Burst
176
- ====================================== ==============
177
- 5 15
178
- ====================================== ==============
179
-
180
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
181
-
182
- Args:
183
- shipmentId:string | * REQUIRED
184
- body: {
185
- "rateId": "string",
186
- "labelSpecification": {
187
- "labelFormat": "PNG",
188
- "labelStockSize": "4x6"
189
- }
190
- }
191
-
192
-
193
- Returns:
194
- ApiResponse:
195
- """
196
-
197
- return await self._request(
198
- fill_query_params(kwargs.pop("path"), shipmentId), data=kwargs
199
- )
200
-
201
- @sp_endpoint("/shipping/v1/shipments/{}/label", method="POST")
202
- async def retrieve_shipping_label(self, shipmentId, **kwargs) -> ApiResponse:
203
- """
204
- retrieve_shipping_label(self, shipmentId, **kwargs) -> ApiResponse
205
-
206
- Retrieve shipping label based on the shipment id and tracking id.
207
-
208
- **Usage Plan:**
209
-
210
- ====================================== ==============
211
- Rate (requests per second) Burst
212
- ====================================== ==============
213
- 5 15
214
- ====================================== ==============
215
-
216
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
217
-
218
- Args:
219
- shipmentId:string | * REQUIRED
220
- trackingId:string | * REQUIRED
221
- body: {
222
- "labelSpecification": {
223
- "labelFormat": "PNG",
224
- "labelStockSize": "4x6"
225
- }
226
- }
227
-
228
- Returns:
229
- ApiResponse:
230
- """
231
-
232
- return await self._request(
233
- fill_query_params(kwargs.pop("path"), shipmentId), data=kwargs
234
- )
235
-
236
- @sp_endpoint("/shipping/v1/purchaseShipment", method="POST")
237
- async def purchase_shipment(self, **kwargs) -> ApiResponse:
238
- """
239
- purchase_shipment(self, **kwargs) -> ApiResponse
240
-
241
- Purchase shipping labels.
242
-
243
- **Usage Plan:**
244
-
245
- ====================================== ==============
246
- Rate (requests per second) Burst
247
- ====================================== ==============
248
- 5 15
249
- ====================================== ==============
250
-
251
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
252
-
253
- Args:
254
- body: {
255
- "clientReferenceId": "string",
256
- "shipTo": {
257
- "name": "string",
258
- "addressLine1": "string",
259
- "addressLine2": "string",
260
- "addressLine3": "string",
261
- "stateOrRegion": "string",
262
- "city": "string",
263
- "countryCode": "st",
264
- "postalCode": "string",
265
- "email": "string",
266
- "copyEmails": [
267
- "string"
268
- ],
269
- "phoneNumber": "string"
270
- },
271
- "shipFrom": {
272
- "name": "string",
273
- "addressLine1": "string",
274
- "addressLine2": "string",
275
- "addressLine3": "string",
276
- "stateOrRegion": "string",
277
- "city": "string",
278
- "countryCode": "st",
279
- "postalCode": "string",
280
- "email": "string",
281
- "copyEmails": [
282
- "string"
283
- ],
284
- "phoneNumber": "string"
285
- },
286
- "shipDate": "2019-08-24T14:15:22Z",
287
- "serviceType": "Amazon Shipping Ground",
288
- "containers": [
289
- {
290
- "containerType": "PACKAGE",
291
- "containerReferenceId": "string",
292
- "value": {
293
- "value": 0,
294
- "unit": "str"
295
- },
296
- "dimensions": {
297
- "length": 0,
298
- "width": 0,
299
- "height": 0,
300
- "unit": "IN"
301
- },
302
- "items": [
303
- {
304
- "quantity": 0,
305
- "unitPrice": {
306
- "value": 0,
307
- "unit": "str"
308
- },
309
- "unitWeight": {
310
- "unit": "g",
311
- "value": 0
312
- },
313
- "title": "string"
314
- }
315
- ],
316
- "weight": {
317
- "unit": "g",
318
- "value": 0
319
- }
320
- }
321
- ],
322
- "labelSpecification": {
323
- "labelFormat": "PNG",
324
- "labelStockSize": "4x6"
325
- }
326
- }
327
-
328
- Returns:
329
- ApiResponse:
330
- """
331
-
332
- return await self._request(kwargs.pop("path"), data=kwargs)
333
-
334
- @sp_endpoint("/shipping/v1/rates", method="POST")
335
- async def get_rates(self, **kwargs) -> ApiResponse:
336
- """
337
- get_rates(self, **kwargs) -> ApiResponse
338
-
339
- Get service rates.
340
-
341
- **Usage Plan:**
342
-
343
- ====================================== ==============
344
- Rate (requests per second) Burst
345
- ====================================== ==============
346
- 5 15
347
- ====================================== ==============
348
-
349
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
350
-
351
- Args:
352
- body:{
353
- "shipTo": {
354
- "name": "string",
355
- "addressLine1": "string",
356
- "addressLine2": "string",
357
- "addressLine3": "string",
358
- "stateOrRegion": "string",
359
- "city": "string",
360
- "countryCode": "st",
361
- "postalCode": "string",
362
- "email": "string",
363
- "copyEmails": [
364
- "string"
365
- ],
366
- "phoneNumber": "string"
367
- },
368
- "shipFrom": {
369
- "name": "string",
370
- "addressLine1": "string",
371
- "addressLine2": "string",
372
- "addressLine3": "string",
373
- "stateOrRegion": "string",
374
- "city": "string",
375
- "countryCode": "st",
376
- "postalCode": "string",
377
- "email": "string",
378
- "copyEmails": [
379
- "string"
380
- ],
381
- "phoneNumber": "string"
382
- },
383
- "serviceTypes": [
384
- "Amazon Shipping Ground"
385
- ],
386
- "shipDate": "2019-08-24T14:15:22Z",
387
- "containerSpecifications": [
388
- {
389
- "dimensions": {
390
- "length": 0,
391
- "width": 0,
392
- "height": 0,
393
- "unit": "IN"
394
- },
395
- "weight": {
396
- "unit": "g",
397
- "value": 0
398
- }
399
- }
400
- ]
401
- }
402
-
403
- Returns:
404
- ApiResponse:
405
- """
406
-
407
- return await self._request(kwargs.pop("path"), data=kwargs)
6
+ from sp_api.asyncio.base import AsyncBaseClient
7
+ from sp_api.util.versioned_client import VersionedClientMeta
408
8
 
409
- @sp_endpoint("/shipping/v1/account", method="GET")
410
- async def get_account(self, **kwargs) -> ApiResponse:
411
- """
412
- get_account(self, **kwargs) -> ApiResponse
9
+ from .shipping_v1 import ShippingV1
10
+ from .shipping_v2 import ShippingV2
413
11
 
414
- Verify if the current account is valid.
415
12
 
416
- **Usage Plan:**
13
+ class ShippingVersion(str, enum.Enum):
14
+ V1 = "v1"
15
+ V2 = "v2"
16
+ LATEST = "v2"
417
17
 
418
- ====================================== ==============
419
- Rate (requests per second) Burst
420
- ====================================== ==============
421
- 5 15
422
- ====================================== ==============
423
18
 
424
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
19
+ if TYPE_CHECKING:
425
20
 
426
- Returns:
427
- ApiResponse:
428
- """
21
+ class _ShippingMeta(VersionedClientMeta):
22
+ @overload
23
+ def __call__(
24
+ cls,
25
+ *args: Any,
26
+ version: Literal[ShippingVersion.V2, ShippingVersion.LATEST, "v2"],
27
+ **kwargs: Any,
28
+ ) -> ShippingV2: ...
429
29
 
430
- return await self._request(kwargs.pop("path"), params=kwargs)
30
+ @overload
31
+ def __call__(
32
+ cls,
33
+ *args: Any,
34
+ version: Literal[ShippingVersion.V1, "v1"],
35
+ **kwargs: Any,
36
+ ) -> ShippingV1: ...
431
37
 
432
- @sp_endpoint("/shipping/v1/tracking/{}", method="GET")
433
- async def get_tracking_information(self, trackingId, **kwargs) -> ApiResponse:
434
- """
435
- get_tracking_information(self, trackingId, **kwargs) -> ApiResponse
38
+ @overload
39
+ def __call__(
40
+ cls,
41
+ *args: Any,
42
+ version: None = None,
43
+ **kwargs: Any,
44
+ ) -> ShippingV1: ...
436
45
 
437
- Return the tracking information of a shipment.
46
+ @overload
47
+ def __call__(
48
+ cls,
49
+ *args: Any,
50
+ version: str | ShippingVersion,
51
+ **kwargs: Any,
52
+ ) -> AsyncBaseClient: ...
438
53
 
439
- **Usage Plan:**
440
54
 
55
+ else:
56
+ _ShippingMeta = VersionedClientMeta
441
57
 
442
- ====================================== ==============
443
- Rate (requests per second) Burst
444
- ====================================== ==============
445
- 1 1
446
- ====================================== ==============
447
58
 
448
- For more information, see "Usage Plans and Rate Limits" in the Selling Partner API documentation.
59
+ class Shipping(AsyncBaseClient, metaclass=_ShippingMeta):
60
+ """Shipping API client.
449
61
 
450
- Args:
451
- trackingId:string | * REQUIRED
62
+ This class dispatches to a versioned Shipping API client.
452
63
 
453
- Returns:
454
- ApiResponse:
455
- """
64
+ If you do not pass a version, the constructor returns the oldest supported implementation ("v1").
65
+ """
456
66
 
457
- return await self._request(
458
- fill_query_params(kwargs.pop("path"), trackingId), params=kwargs
459
- )
67
+ if TYPE_CHECKING:
68
+ @overload
69
+ def __new__(
70
+ cls,
71
+ *args: Any,
72
+ version: Literal[ShippingVersion.V2, ShippingVersion.LATEST, "v2"],
73
+ **kwargs: Any,
74
+ ) -> ShippingV2: ...
75
+
76
+ @overload
77
+ def __new__(
78
+ cls,
79
+ *args: Any,
80
+ version: Literal[ShippingVersion.V1, "v1"],
81
+ **kwargs: Any,
82
+ ) -> ShippingV1: ...
83
+
84
+ @overload
85
+ def __new__(
86
+ cls,
87
+ *args: Any,
88
+ version: None = None,
89
+ **kwargs: Any,
90
+ ) -> ShippingV1: ...
91
+
92
+ @overload
93
+ def __new__(
94
+ cls,
95
+ *args: Any,
96
+ version: str | ShippingVersion,
97
+ **kwargs: Any,
98
+ ) -> AsyncBaseClient: ...
99
+
100
+ _DISPATCH = True
101
+
102
+ _DEFAULT_VERSION = "v1"
103
+
104
+ _VERSION_MAP = {
105
+ "v1": ShippingV1,
106
+ "v2": ShippingV2,
107
+ }
108
+
109
+ _VERSION_ALIASES = {
110
+ "v1": "v1",
111
+ "v2": "v2",
112
+ }