amazon_spapi/apis/
orders_v0.rs

1/*
2 * Selling Partner API for Orders
3 *
4 * Use the Orders Selling Partner API to programmatically retrieve order information. With this API, you can develop fast, flexible, and custom applications to manage order synchronization, perform order research, and create demand-based decision support tools.   _Note:_ For the JP, AU, and SG marketplaces, the Orders API supports orders from 2016 onward. For all other marketplaces, the Orders API supports orders for the last two years (orders older than this don't show up in the response).
5 *
6 * The version of the OpenAPI document: v0
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`confirm_shipment`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum ConfirmShipmentError {
22    Status400(models::orders_v0::ConfirmShipmentErrorResponse),
23    Status401(models::orders_v0::ConfirmShipmentErrorResponse),
24    Status403(models::orders_v0::ConfirmShipmentErrorResponse),
25    Status404(models::orders_v0::ConfirmShipmentErrorResponse),
26    Status429(models::orders_v0::ConfirmShipmentErrorResponse),
27    Status500(models::orders_v0::ConfirmShipmentErrorResponse),
28    Status503(models::orders_v0::ConfirmShipmentErrorResponse),
29    UnknownValue(serde_json::Value),
30}
31
32/// struct for typed errors of method [`get_order`]
33#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum GetOrderError {
36    Status400(models::orders_v0::GetOrderResponse),
37    Status403(models::orders_v0::GetOrderResponse),
38    Status404(models::orders_v0::GetOrderResponse),
39    Status429(models::orders_v0::GetOrderResponse),
40    Status500(models::orders_v0::GetOrderResponse),
41    Status503(models::orders_v0::GetOrderResponse),
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`get_order_address`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum GetOrderAddressError {
49    Status400(models::orders_v0::GetOrderAddressResponse),
50    Status403(models::orders_v0::GetOrderAddressResponse),
51    Status404(models::orders_v0::GetOrderAddressResponse),
52    Status429(models::orders_v0::GetOrderAddressResponse),
53    Status500(models::orders_v0::GetOrderAddressResponse),
54    Status503(models::orders_v0::GetOrderAddressResponse),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`get_order_buyer_info`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetOrderBuyerInfoError {
62    Status400(models::orders_v0::GetOrderBuyerInfoResponse),
63    Status403(models::orders_v0::GetOrderBuyerInfoResponse),
64    Status404(models::orders_v0::GetOrderBuyerInfoResponse),
65    Status429(models::orders_v0::GetOrderBuyerInfoResponse),
66    Status500(models::orders_v0::GetOrderBuyerInfoResponse),
67    Status503(models::orders_v0::GetOrderBuyerInfoResponse),
68    UnknownValue(serde_json::Value),
69}
70
71/// struct for typed errors of method [`get_order_items`]
72#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(untagged)]
74pub enum GetOrderItemsError {
75    Status400(models::orders_v0::GetOrderItemsResponse),
76    Status403(models::orders_v0::GetOrderItemsResponse),
77    Status404(models::orders_v0::GetOrderItemsResponse),
78    Status429(models::orders_v0::GetOrderItemsResponse),
79    Status500(models::orders_v0::GetOrderItemsResponse),
80    Status503(models::orders_v0::GetOrderItemsResponse),
81    UnknownValue(serde_json::Value),
82}
83
84/// struct for typed errors of method [`get_order_items_buyer_info`]
85#[derive(Debug, Clone, Serialize, Deserialize)]
86#[serde(untagged)]
87pub enum GetOrderItemsBuyerInfoError {
88    Status400(models::orders_v0::GetOrderItemsBuyerInfoResponse),
89    Status403(models::orders_v0::GetOrderItemsBuyerInfoResponse),
90    Status404(models::orders_v0::GetOrderItemsBuyerInfoResponse),
91    Status429(models::orders_v0::GetOrderItemsBuyerInfoResponse),
92    Status500(models::orders_v0::GetOrderItemsBuyerInfoResponse),
93    Status503(models::orders_v0::GetOrderItemsBuyerInfoResponse),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`get_order_regulated_info`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GetOrderRegulatedInfoError {
101    Status400(models::orders_v0::GetOrderRegulatedInfoResponse),
102    Status403(models::orders_v0::GetOrderRegulatedInfoResponse),
103    Status404(models::orders_v0::GetOrderRegulatedInfoResponse),
104    Status429(models::orders_v0::GetOrderRegulatedInfoResponse),
105    Status500(models::orders_v0::GetOrderRegulatedInfoResponse),
106    Status503(models::orders_v0::GetOrderRegulatedInfoResponse),
107    UnknownValue(serde_json::Value),
108}
109
110/// struct for typed errors of method [`get_orders`]
111#[derive(Debug, Clone, Serialize, Deserialize)]
112#[serde(untagged)]
113pub enum GetOrdersError {
114    Status400(models::orders_v0::GetOrdersResponse),
115    Status403(models::orders_v0::GetOrdersResponse),
116    Status404(models::orders_v0::GetOrdersResponse),
117    Status429(models::orders_v0::GetOrdersResponse),
118    Status500(models::orders_v0::GetOrdersResponse),
119    Status503(models::orders_v0::GetOrdersResponse),
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`update_verification_status`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum UpdateVerificationStatusError {
127    Status400(models::orders_v0::UpdateVerificationStatusErrorResponse),
128    Status403(models::orders_v0::UpdateVerificationStatusErrorResponse),
129    Status404(models::orders_v0::UpdateVerificationStatusErrorResponse),
130    Status413(models::orders_v0::UpdateVerificationStatusErrorResponse),
131    Status415(models::orders_v0::UpdateVerificationStatusErrorResponse),
132    Status429(models::orders_v0::UpdateVerificationStatusErrorResponse),
133    Status500(models::orders_v0::UpdateVerificationStatusErrorResponse),
134    Status503(models::orders_v0::UpdateVerificationStatusErrorResponse),
135    UnknownValue(serde_json::Value),
136}
137
138/// struct for typed errors of method [`update_shipment_status`]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum UpdateShipmentStatusError {
142    Status400(models::orders_v0::UpdateShipmentStatusErrorResponse),
143    Status403(models::orders_v0::UpdateShipmentStatusErrorResponse),
144    Status404(models::orders_v0::UpdateShipmentStatusErrorResponse),
145    Status413(models::orders_v0::UpdateShipmentStatusErrorResponse),
146    Status415(models::orders_v0::UpdateShipmentStatusErrorResponse),
147    Status429(models::orders_v0::UpdateShipmentStatusErrorResponse),
148    Status500(models::orders_v0::UpdateShipmentStatusErrorResponse),
149    Status503(models::orders_v0::UpdateShipmentStatusErrorResponse),
150    UnknownValue(serde_json::Value),
151}
152
153/// Updates the shipment confirmation status for a specified order.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 10 |  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).
154pub async fn confirm_shipment(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::ConfirmShipmentRequest) -> Result<(), Error<ConfirmShipmentError>> {
155    // add a prefix to parameters to efficiently prevent name collisions
156    let p_order_id = order_id;
157    let p_payload = payload;
158
159    let uri_str = format!("{}/orders/v0/orders/{orderId}/shipmentConfirmation", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
160    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
161
162    if let Some(ref user_agent) = configuration.user_agent {
163        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
164    }
165    req_builder = req_builder.json(&p_payload);
166
167    let req = req_builder.build()?;
168    let resp = configuration.client.execute(req).await?;
169
170    let status = resp.status();
171
172    if !status.is_client_error() && !status.is_server_error() {
173        Ok(())
174    } else {
175        let content = resp.text().await?;
176        let entity: Option<ConfirmShipmentError> = serde_json::from_str(&content).ok();
177        Err(Error::ResponseError(ResponseContent { status, content, entity }))
178    }
179}
180
181/// Returns the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
182pub async fn get_order(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderResponse, Error<GetOrderError>> {
183    // add a prefix to parameters to efficiently prevent name collisions
184    let p_order_id = order_id;
185
186    let uri_str = format!("{}/orders/v0/orders/{orderId}", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
187    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
188
189    if let Some(ref user_agent) = configuration.user_agent {
190        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
191    }
192
193    let req = req_builder.build()?;
194    let resp = configuration.client.execute(req).await?;
195
196    let status = resp.status();
197    let content_type = resp
198        .headers()
199        .get("content-type")
200        .and_then(|v| v.to_str().ok())
201        .unwrap_or("application/octet-stream");
202    let content_type = super::ContentType::from(content_type);
203
204    if !status.is_client_error() && !status.is_server_error() {
205        let content = resp.text().await?;
206        match content_type {
207            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
208            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderResponse`"))),
209            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrderResponse`")))),
210        }
211    } else {
212        let content = resp.text().await?;
213        let entity: Option<GetOrderError> = serde_json::from_str(&content).ok();
214        Err(Error::ResponseError(ResponseContent { status, content, entity }))
215    }
216}
217
218/// Returns the shipping address for the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
219pub async fn get_order_address(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderAddressResponse, Error<GetOrderAddressError>> {
220    // add a prefix to parameters to efficiently prevent name collisions
221    let p_order_id = order_id;
222
223    let uri_str = format!("{}/orders/v0/orders/{orderId}/address", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
224    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
225
226    if let Some(ref user_agent) = configuration.user_agent {
227        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
228    }
229
230    let req = req_builder.build()?;
231    let resp = configuration.client.execute(req).await?;
232
233    let status = resp.status();
234    let content_type = resp
235        .headers()
236        .get("content-type")
237        .and_then(|v| v.to_str().ok())
238        .unwrap_or("application/octet-stream");
239    let content_type = super::ContentType::from(content_type);
240
241    if !status.is_client_error() && !status.is_server_error() {
242        let content = resp.text().await?;
243        match content_type {
244            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
245            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderAddressResponse`"))),
246            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrderAddressResponse`")))),
247        }
248    } else {
249        let content = resp.text().await?;
250        let entity: Option<GetOrderAddressError> = serde_json::from_str(&content).ok();
251        Err(Error::ResponseError(ResponseContent { status, content, entity }))
252    }
253}
254
255/// Returns buyer information for the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
256pub async fn get_order_buyer_info(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderBuyerInfoResponse, Error<GetOrderBuyerInfoError>> {
257    // add a prefix to parameters to efficiently prevent name collisions
258    let p_order_id = order_id;
259
260    let uri_str = format!("{}/orders/v0/orders/{orderId}/buyerInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
261    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
262
263    if let Some(ref user_agent) = configuration.user_agent {
264        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
265    }
266
267    let req = req_builder.build()?;
268    let resp = configuration.client.execute(req).await?;
269
270    let status = resp.status();
271    let content_type = resp
272        .headers()
273        .get("content-type")
274        .and_then(|v| v.to_str().ok())
275        .unwrap_or("application/octet-stream");
276    let content_type = super::ContentType::from(content_type);
277
278    if !status.is_client_error() && !status.is_server_error() {
279        let content = resp.text().await?;
280        match content_type {
281            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
282            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderBuyerInfoResponse`"))),
283            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrderBuyerInfoResponse`")))),
284        }
285    } else {
286        let content = resp.text().await?;
287        let entity: Option<GetOrderBuyerInfoError> = serde_json::from_str(&content).ok();
288        Err(Error::ResponseError(ResponseContent { status, content, entity }))
289    }
290}
291
292/// 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.  __Note__: When an order is in the Pending state (the order has been placed but payment has not been authorized), the getOrderItems operation does not return information about pricing, taxes, shipping charges, gift status or promotions for the order items in the order. After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped, Partially Shipped, or Shipped state, the getOrderItems operation returns information about pricing, taxes, shipping charges, gift status and promotions for the order items in the order.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
293pub async fn get_order_items(configuration: &configuration::Configuration, order_id: &str, next_token: Option<&str>) -> Result<models::orders_v0::GetOrderItemsResponse, Error<GetOrderItemsError>> {
294    // add a prefix to parameters to efficiently prevent name collisions
295    let p_order_id = order_id;
296    let p_next_token = next_token;
297
298    let uri_str = format!("{}/orders/v0/orders/{orderId}/orderItems", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
299    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
300
301    if let Some(ref param_value) = p_next_token {
302        req_builder = req_builder.query(&[("NextToken", &param_value.to_string())]);
303    }
304    if let Some(ref user_agent) = configuration.user_agent {
305        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
306    }
307
308    let req = req_builder.build()?;
309    let resp = configuration.client.execute(req).await?;
310
311    let status = resp.status();
312    let content_type = resp
313        .headers()
314        .get("content-type")
315        .and_then(|v| v.to_str().ok())
316        .unwrap_or("application/octet-stream");
317    let content_type = super::ContentType::from(content_type);
318
319    if !status.is_client_error() && !status.is_server_error() {
320        let content = resp.text().await?;
321        match content_type {
322            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
323            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderItemsResponse`"))),
324            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrderItemsResponse`")))),
325        }
326    } else {
327        let content = resp.text().await?;
328        let entity: Option<GetOrderItemsError> = serde_json::from_str(&content).ok();
329        Err(Error::ResponseError(ResponseContent { status, content, entity }))
330    }
331}
332
333/// Returns buyer information for the order items in the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
334pub async fn get_order_items_buyer_info(configuration: &configuration::Configuration, order_id: &str, next_token: Option<&str>) -> Result<models::orders_v0::GetOrderItemsBuyerInfoResponse, Error<GetOrderItemsBuyerInfoError>> {
335    // add a prefix to parameters to efficiently prevent name collisions
336    let p_order_id = order_id;
337    let p_next_token = next_token;
338
339    let uri_str = format!("{}/orders/v0/orders/{orderId}/orderItems/buyerInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
340    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
341
342    if let Some(ref param_value) = p_next_token {
343        req_builder = req_builder.query(&[("NextToken", &param_value.to_string())]);
344    }
345    if let Some(ref user_agent) = configuration.user_agent {
346        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
347    }
348
349    let req = req_builder.build()?;
350    let resp = configuration.client.execute(req).await?;
351
352    let status = resp.status();
353    let content_type = resp
354        .headers()
355        .get("content-type")
356        .and_then(|v| v.to_str().ok())
357        .unwrap_or("application/octet-stream");
358    let content_type = super::ContentType::from(content_type);
359
360    if !status.is_client_error() && !status.is_server_error() {
361        let content = resp.text().await?;
362        match content_type {
363            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
364            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderItemsBuyerInfoResponse`"))),
365            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrderItemsBuyerInfoResponse`")))),
366        }
367    } else {
368        let content = resp.text().await?;
369        let entity: Option<GetOrderItemsBuyerInfoError> = serde_json::from_str(&content).ok();
370        Err(Error::ResponseError(ResponseContent { status, content, entity }))
371    }
372}
373
374/// Returns regulated information for the order that you specify.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
375pub async fn get_order_regulated_info(configuration: &configuration::Configuration, order_id: &str) -> Result<models::orders_v0::GetOrderRegulatedInfoResponse, Error<GetOrderRegulatedInfoError>> {
376    // add a prefix to parameters to efficiently prevent name collisions
377    let p_order_id = order_id;
378
379    let uri_str = format!("{}/orders/v0/orders/{orderId}/regulatedInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
380    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
381
382    if let Some(ref user_agent) = configuration.user_agent {
383        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
384    }
385
386    let req = req_builder.build()?;
387    let resp = configuration.client.execute(req).await?;
388
389    let status = resp.status();
390    let content_type = resp
391        .headers()
392        .get("content-type")
393        .and_then(|v| v.to_str().ok())
394        .unwrap_or("application/octet-stream");
395    let content_type = super::ContentType::from(content_type);
396
397    if !status.is_client_error() && !status.is_server_error() {
398        let content = resp.text().await?;
399        match content_type {
400            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
401            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrderRegulatedInfoResponse`"))),
402            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrderRegulatedInfoResponse`")))),
403        }
404    } else {
405        let content = resp.text().await?;
406        let entity: Option<GetOrderRegulatedInfoError> = serde_json::from_str(&content).ok();
407        Err(Error::ResponseError(ResponseContent { status, content, entity }))
408    }
409}
410
411/// 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. `NextToken` doesn't affect any filters that you include in your request; it only impacts the pagination for the filtered orders response.   **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.0167 | 20 |  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).
412pub async fn get_orders(configuration: &configuration::Configuration, marketplace_ids: Vec<String>, created_after: Option<&str>, created_before: Option<&str>, last_updated_after: Option<&str>, last_updated_before: Option<&str>, order_statuses: Option<Vec<String>>, fulfillment_channels: Option<Vec<String>>, payment_methods: Option<Vec<String>>, buyer_email: Option<&str>, seller_order_id: Option<&str>, max_results_per_page: Option<i32>, easy_ship_shipment_statuses: Option<Vec<String>>, electronic_invoice_statuses: Option<Vec<String>>, next_token: Option<&str>, amazon_order_ids: Option<Vec<String>>, actual_fulfillment_supply_source_id: Option<&str>, is_ispu: Option<bool>, store_chain_store_id: Option<&str>, earliest_delivery_date_before: Option<&str>, earliest_delivery_date_after: Option<&str>, latest_delivery_date_before: Option<&str>, latest_delivery_date_after: Option<&str>) -> Result<models::orders_v0::GetOrdersResponse, Error<GetOrdersError>> {
413    // add a prefix to parameters to efficiently prevent name collisions
414    let p_marketplace_ids = marketplace_ids;
415    let p_created_after = created_after;
416    let p_created_before = created_before;
417    let p_last_updated_after = last_updated_after;
418    let p_last_updated_before = last_updated_before;
419    let p_order_statuses = order_statuses;
420    let p_fulfillment_channels = fulfillment_channels;
421    let p_payment_methods = payment_methods;
422    let p_buyer_email = buyer_email;
423    let p_seller_order_id = seller_order_id;
424    let p_max_results_per_page = max_results_per_page;
425    let p_easy_ship_shipment_statuses = easy_ship_shipment_statuses;
426    let p_electronic_invoice_statuses = electronic_invoice_statuses;
427    let p_next_token = next_token;
428    let p_amazon_order_ids = amazon_order_ids;
429    let p_actual_fulfillment_supply_source_id = actual_fulfillment_supply_source_id;
430    let p_is_ispu = is_ispu;
431    let p_store_chain_store_id = store_chain_store_id;
432    let p_earliest_delivery_date_before = earliest_delivery_date_before;
433    let p_earliest_delivery_date_after = earliest_delivery_date_after;
434    let p_latest_delivery_date_before = latest_delivery_date_before;
435    let p_latest_delivery_date_after = latest_delivery_date_after;
436
437    let uri_str = format!("{}/orders/v0/orders", configuration.base_path);
438    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
439
440    if let Some(ref param_value) = p_created_after {
441        req_builder = req_builder.query(&[("CreatedAfter", &param_value.to_string())]);
442    }
443    if let Some(ref param_value) = p_created_before {
444        req_builder = req_builder.query(&[("CreatedBefore", &param_value.to_string())]);
445    }
446    if let Some(ref param_value) = p_last_updated_after {
447        req_builder = req_builder.query(&[("LastUpdatedAfter", &param_value.to_string())]);
448    }
449    if let Some(ref param_value) = p_last_updated_before {
450        req_builder = req_builder.query(&[("LastUpdatedBefore", &param_value.to_string())]);
451    }
452    if let Some(ref param_value) = p_order_statuses {
453        req_builder = match "csv" {
454            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("OrderStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
455            _ => req_builder.query(&[("OrderStatuses", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
456        };
457    }
458    req_builder = match "csv" {
459        "multi" => req_builder.query(&p_marketplace_ids.into_iter().map(|p| ("MarketplaceIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
460        _ => req_builder.query(&[("MarketplaceIds", &p_marketplace_ids.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
461    };
462    if let Some(ref param_value) = p_fulfillment_channels {
463        req_builder = match "csv" {
464            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("FulfillmentChannels".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
465            _ => req_builder.query(&[("FulfillmentChannels", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
466        };
467    }
468    if let Some(ref param_value) = p_payment_methods {
469        req_builder = match "csv" {
470            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("PaymentMethods".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
471            _ => req_builder.query(&[("PaymentMethods", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
472        };
473    }
474    if let Some(ref param_value) = p_buyer_email {
475        req_builder = req_builder.query(&[("BuyerEmail", &param_value.to_string())]);
476    }
477    if let Some(ref param_value) = p_seller_order_id {
478        req_builder = req_builder.query(&[("SellerOrderId", &param_value.to_string())]);
479    }
480    if let Some(ref param_value) = p_max_results_per_page {
481        req_builder = req_builder.query(&[("MaxResultsPerPage", &param_value.to_string())]);
482    }
483    if let Some(ref param_value) = p_easy_ship_shipment_statuses {
484        req_builder = match "csv" {
485            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("EasyShipShipmentStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
486            _ => req_builder.query(&[("EasyShipShipmentStatuses", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
487        };
488    }
489    if let Some(ref param_value) = p_electronic_invoice_statuses {
490        req_builder = match "csv" {
491            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("ElectronicInvoiceStatuses".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
492            _ => req_builder.query(&[("ElectronicInvoiceStatuses", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
493        };
494    }
495    if let Some(ref param_value) = p_next_token {
496        req_builder = req_builder.query(&[("NextToken", &param_value.to_string())]);
497    }
498    if let Some(ref param_value) = p_amazon_order_ids {
499        req_builder = match "csv" {
500            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("AmazonOrderIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
501            _ => req_builder.query(&[("AmazonOrderIds", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
502        };
503    }
504    if let Some(ref param_value) = p_actual_fulfillment_supply_source_id {
505        req_builder = req_builder.query(&[("ActualFulfillmentSupplySourceId", &param_value.to_string())]);
506    }
507    if let Some(ref param_value) = p_is_ispu {
508        req_builder = req_builder.query(&[("IsISPU", &param_value.to_string())]);
509    }
510    if let Some(ref param_value) = p_store_chain_store_id {
511        req_builder = req_builder.query(&[("StoreChainStoreId", &param_value.to_string())]);
512    }
513    if let Some(ref param_value) = p_earliest_delivery_date_before {
514        req_builder = req_builder.query(&[("EarliestDeliveryDateBefore", &param_value.to_string())]);
515    }
516    if let Some(ref param_value) = p_earliest_delivery_date_after {
517        req_builder = req_builder.query(&[("EarliestDeliveryDateAfter", &param_value.to_string())]);
518    }
519    if let Some(ref param_value) = p_latest_delivery_date_before {
520        req_builder = req_builder.query(&[("LatestDeliveryDateBefore", &param_value.to_string())]);
521    }
522    if let Some(ref param_value) = p_latest_delivery_date_after {
523        req_builder = req_builder.query(&[("LatestDeliveryDateAfter", &param_value.to_string())]);
524    }
525    if let Some(ref user_agent) = configuration.user_agent {
526        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
527    }
528
529    let req = req_builder.build()?;
530    let resp = configuration.client.execute(req).await?;
531
532    let status = resp.status();
533    let content_type = resp
534        .headers()
535        .get("content-type")
536        .and_then(|v| v.to_str().ok())
537        .unwrap_or("application/octet-stream");
538    let content_type = super::ContentType::from(content_type);
539
540    if !status.is_client_error() && !status.is_server_error() {
541        let content = resp.text().await?;
542        match content_type {
543            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
544            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::orders_v0::GetOrdersResponse`"))),
545            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::orders_v0::GetOrdersResponse`")))),
546        }
547    } else {
548        let content = resp.text().await?;
549        let entity: Option<GetOrdersError> = serde_json::from_str(&content).ok();
550        Err(Error::ResponseError(ResponseContent { status, content, entity }))
551    }
552}
553
554/// Updates (approves or rejects) the verification status of an order containing regulated products.  **Usage Plan:**  | Rate (requests per second) | Burst | | ---- | ---- | | 0.5 | 30 |  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).
555pub async fn update_verification_status(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::UpdateVerificationStatusRequest) -> Result<(), Error<UpdateVerificationStatusError>> {
556    // add a prefix to parameters to efficiently prevent name collisions
557    let p_order_id = order_id;
558    let p_payload = payload;
559
560    let uri_str = format!("{}/orders/v0/orders/{orderId}/regulatedInfo", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
561    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
562
563    if let Some(ref user_agent) = configuration.user_agent {
564        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
565    }
566    req_builder = req_builder.json(&p_payload);
567
568    let req = req_builder.build()?;
569    let resp = configuration.client.execute(req).await?;
570
571    let status = resp.status();
572
573    if !status.is_client_error() && !status.is_server_error() {
574        Ok(())
575    } else {
576        let content = resp.text().await?;
577        let entity: Option<UpdateVerificationStatusError> = serde_json::from_str(&content).ok();
578        Err(Error::ResponseError(ResponseContent { status, content, entity }))
579    }
580}
581
582/// 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).
583pub async fn update_shipment_status(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::UpdateShipmentStatusRequest) -> Result<(), Error<UpdateShipmentStatusError>> {
584    // add a prefix to parameters to efficiently prevent name collisions
585    let p_order_id = order_id;
586    let p_payload = payload;
587
588    let uri_str = format!("{}/orders/v0/orders/{orderId}/shipment", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
589    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
590
591    if let Some(ref user_agent) = configuration.user_agent {
592        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
593    }
594    req_builder = req_builder.json(&p_payload);
595
596    let req = req_builder.build()?;
597    let resp = configuration.client.execute(req).await?;
598
599    let status = resp.status();
600
601    if !status.is_client_error() && !status.is_server_error() {
602        Ok(())
603    } else {
604        let content = resp.text().await?;
605        let entity: Option<UpdateShipmentStatusError> = serde_json::from_str(&content).ok();
606        Err(Error::ResponseError(ResponseContent { status, content, entity }))
607    }
608}