amazon_spapi/client_apis/
orders_v0_api.rs

1use anyhow::Result;
2
3use crate::{client::SpapiClient, models};
4
5impl SpapiClient {
6    /// Updates the shipment confirmation status for a specified order.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 10 |
7    pub async fn confirm_shipment(
8        &self,
9        order_id: &str,
10        payload: models::orders_v0::ConfirmShipmentRequest,
11    ) -> Result<()> {
12        let configuration = self.create_configuration().await?;
13        let guard = self
14            .limiter()
15            .wait("orders_v0/confirm_shipment", 2.0, 10)
16            .await?;
17        let res =
18            crate::apis::orders_v0::confirm_shipment(&configuration, order_id, payload).await?;
19        guard.mark_response().await;
20        Ok(res)
21    }
22
23    /// Returns the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
24    pub async fn get_order(&self, order_id: &str) -> Result<models::orders_v0::GetOrderResponse> {
25        let configuration = self.create_configuration().await?;
26        let guard = self.limiter().wait("orders_v0/get_order", 0.5, 30).await?;
27        let res = crate::apis::orders_v0::get_order(&configuration, order_id).await?;
28        guard.mark_response().await;
29        Ok(res)
30    }
31
32    /// Returns the shipping address for the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
33    pub async fn get_order_address(
34        &self,
35        order_id: &str,
36    ) -> Result<models::orders_v0::GetOrderAddressResponse> {
37        let configuration = self.create_configuration().await?;
38        let guard = self
39            .limiter()
40            .wait("orders_v0/get_order_address", 0.5, 30)
41            .await?;
42        let res = crate::apis::orders_v0::get_order_address(&configuration, order_id).await?;
43        guard.mark_response().await;
44        Ok(res)
45    }
46
47    /// Returns buyer information for the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
48    pub async fn get_order_buyer_info(
49        &self,
50        order_id: &str,
51    ) -> Result<models::orders_v0::GetOrderBuyerInfoResponse> {
52        let configuration = self.create_configuration().await?;
53        let guard = self
54            .limiter()
55            .wait("orders_v0/get_order_buyer_info", 0.5, 30)
56            .await?;
57        let res = crate::apis::orders_v0::get_order_buyer_info(&configuration, order_id).await?;
58        guard.mark_response().await;
59        Ok(res)
60    }
61
62    /// Returns detailed order item information for the order that you specify. If `NextToken` is provided, it's used to retrieve the next page of order items.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
63    pub async fn get_order_items(
64        &self,
65        order_id: &str,
66        next_token: Option<&str>,
67    ) -> Result<models::orders_v0::GetOrderItemsResponse> {
68        let configuration = self.create_configuration().await?;
69        let guard = self
70            .limiter()
71            .wait("orders_v0/get_order_items", 0.5, 30)
72            .await?;
73        let res =
74            crate::apis::orders_v0::get_order_items(&configuration, order_id, next_token).await?;
75        guard.mark_response().await;
76        Ok(res)
77    }
78
79    /// Returns buyer information for the order items in the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
80    pub async fn get_order_items_buyer_info(
81        &self,
82        order_id: &str,
83        next_token: Option<&str>,
84    ) -> Result<models::orders_v0::GetOrderItemsBuyerInfoResponse> {
85        let configuration = self.create_configuration().await?;
86        let guard = self
87            .limiter()
88            .wait("orders_v0/get_order_items_buyer_info", 0.5, 30)
89            .await?;
90        let res = crate::apis::orders_v0::get_order_items_buyer_info(
91            &configuration,
92            order_id,
93            next_token,
94        )
95        .await?;
96        guard.mark_response().await;
97        Ok(res)
98    }
99
100    /// Returns regulated information for the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
101    pub async fn get_order_regulated_info(
102        &self,
103        order_id: &str,
104    ) -> Result<models::orders_v0::GetOrderRegulatedInfoResponse> {
105        let configuration = self.create_configuration().await?;
106        let guard = self
107            .limiter()
108            .wait("orders_v0/get_order_regulated_info", 0.5, 30)
109            .await?;
110        let res =
111            crate::apis::orders_v0::get_order_regulated_info(&configuration, order_id).await?;
112        guard.mark_response().await;
113        Ok(res)
114    }
115
116    /// Returns orders that are created or updated during the specified time period. If you want to return specific types of orders, you can apply filters to your request.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 20 |
117    pub async fn get_orders(
118        &self,
119        marketplace_ids: Vec<String>,
120        created_after: Option<&str>,
121        created_before: Option<&str>,
122        last_updated_after: Option<&str>,
123        last_updated_before: Option<&str>,
124        order_statuses: Option<Vec<String>>,
125        fulfillment_channels: Option<Vec<String>>,
126        payment_methods: Option<Vec<String>>,
127        buyer_email: Option<&str>,
128        seller_order_id: Option<&str>,
129        max_results_per_page: Option<i32>,
130        easy_ship_shipment_statuses: Option<Vec<String>>,
131        electronic_invoice_statuses: Option<Vec<String>>,
132        next_token: Option<&str>,
133        amazon_order_ids: Option<Vec<String>>,
134        actual_fulfillment_supply_source_id: Option<&str>,
135        is_ispu: Option<bool>,
136        store_chain_store_id: Option<&str>,
137        earliest_delivery_date_before: Option<&str>,
138        earliest_delivery_date_after: Option<&str>,
139        latest_delivery_date_before: Option<&str>,
140        latest_delivery_date_after: Option<&str>,
141    ) -> Result<models::orders_v0::GetOrdersResponse> {
142        let configuration = self.create_configuration().await?;
143        let guard = self
144            .limiter()
145            .wait("orders_v0/get_orders", 0.0167, 20)
146            .await?;
147        let res = crate::apis::orders_v0::get_orders(
148            &configuration,
149            marketplace_ids,
150            created_after,
151            created_before,
152            last_updated_after,
153            last_updated_before,
154            order_statuses,
155            fulfillment_channels,
156            payment_methods,
157            buyer_email,
158            seller_order_id,
159            max_results_per_page,
160            easy_ship_shipment_statuses,
161            electronic_invoice_statuses,
162            next_token,
163            amazon_order_ids,
164            actual_fulfillment_supply_source_id,
165            is_ispu,
166            store_chain_store_id,
167            earliest_delivery_date_before,
168            earliest_delivery_date_after,
169            latest_delivery_date_before,
170            latest_delivery_date_after,
171        )
172        .await?;
173        guard.mark_response().await;
174        Ok(res)
175    }
176
177    /// Updates (approves or rejects) the verification status of an order containing regulated products.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |
178    pub async fn update_verification_status(
179        &self,
180        order_id: &str,
181        payload: models::orders_v0::UpdateVerificationStatusRequest,
182    ) -> Result<()> {
183        let configuration = self.create_configuration().await?;
184        let guard = self
185            .limiter()
186            .wait("orders_v0/update_verification_status", 0.5, 30)
187            .await?;
188        let res =
189            crate::apis::orders_v0::update_verification_status(&configuration, order_id, payload)
190                .await?;
191        guard.mark_response().await;
192        Ok(res)
193    }
194
195    /// Update the shipment status for an order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 15 |  The `x-amzn-RateLimit-Limit` response header contains the usage plan rate limits for the operation, when available. The preceding table contains the default rate and burst values for this operation. Selling partners whose business demands require higher throughput might have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
196    pub async fn update_shipment_status(
197        &self,
198        order_id: &str,
199        payload: models::orders_v0::UpdateShipmentStatusRequest,
200    ) -> Result<()> {
201        let configuration = self.create_configuration().await?;
202        let guard = self
203            .limiter()
204            .wait("orders_v0/update_shipment_status", 5.0, 15)
205            .await?;
206        let res = crate::apis::orders_v0::update_shipment_status(&configuration, order_id, payload)
207            .await?;
208        guard.mark_response().await;
209        Ok(res)
210    }
211}