amazon_spapi/apis/
shipment_api.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 [`update_shipment_status`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum UpdateShipmentStatusError {
22    Status400(models::orders_v0::UpdateShipmentStatusErrorResponse),
23    Status403(models::orders_v0::UpdateShipmentStatusErrorResponse),
24    Status404(models::orders_v0::UpdateShipmentStatusErrorResponse),
25    Status413(models::orders_v0::UpdateShipmentStatusErrorResponse),
26    Status415(models::orders_v0::UpdateShipmentStatusErrorResponse),
27    Status429(models::orders_v0::UpdateShipmentStatusErrorResponse),
28    Status500(models::orders_v0::UpdateShipmentStatusErrorResponse),
29    Status503(models::orders_v0::UpdateShipmentStatusErrorResponse),
30    UnknownValue(serde_json::Value),
31}
32
33
34/// 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).
35pub async fn update_shipment_status(configuration: &configuration::Configuration, order_id: &str, payload: models::orders_v0::UpdateShipmentStatusRequest) -> Result<(), Error<UpdateShipmentStatusError>> {
36    // add a prefix to parameters to efficiently prevent name collisions
37    let p_order_id = order_id;
38    let p_payload = payload;
39
40    let uri_str = format!("{}/orders/v0/orders/{orderId}/shipment", configuration.base_path, orderId=crate::apis::urlencode(p_order_id));
41    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
42
43    if let Some(ref user_agent) = configuration.user_agent {
44        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
45    }
46    req_builder = req_builder.json(&p_payload);
47
48    let req = req_builder.build()?;
49    let resp = configuration.client.execute(req).await?;
50
51    let status = resp.status();
52
53    if !status.is_client_error() && !status.is_server_error() {
54        Ok(())
55    } else {
56        let content = resp.text().await?;
57        let entity: Option<UpdateShipmentStatusError> = serde_json::from_str(&content).ok();
58        Err(Error::ResponseError(ResponseContent { status, content, entity }))
59    }
60}
61