/*
* Selling Partner APIs for Fulfillment Outbound
*
* The Selling Partner API for Fulfillment Outbound lets you create applications that help a seller fulfill Multi-Channel Fulfillment orders using their inventory in Amazon's fulfillment network. You can get information on both potential and existing fulfillment orders.
*
* The version of the OpenAPI document: 2020-07-01
*
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use serde::{Deserialize, Serialize, de::Error as _};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration, ContentType};
/// struct for typed errors of method [`cancel_fulfillment_order`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CancelFulfillmentOrderError {
Status400(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
Status401(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
Status403(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
Status404(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
Status429(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
Status500(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
Status503(models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_fulfillment_order`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateFulfillmentOrderError {
Status400(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
Status401(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
Status403(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
Status404(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
Status429(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
Status500(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
Status503(models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_fulfillment_return`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateFulfillmentReturnError {
Status400(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
Status401(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
Status403(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
Status404(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
Status429(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
Status500(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
Status503(models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delivery_offers`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeliveryOffersError {
Status400(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_feature_inventory`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFeatureInventoryError {
Status400(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_feature_sku`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFeatureSkuError {
Status400(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_features`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFeaturesError {
Status400(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetFeaturesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_fulfillment_order`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFulfillmentOrderError {
Status400(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_fulfillment_preview`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetFulfillmentPreviewError {
Status400(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_package_tracking_details`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetPackageTrackingDetailsError {
Status400(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
Status401(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
Status403(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
Status404(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
Status429(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
Status500(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
Status503(models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_all_fulfillment_orders`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListAllFulfillmentOrdersError {
Status400(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
Status401(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
Status403(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
Status404(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
Status429(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
Status500(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
Status503(models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`list_return_reason_codes`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum ListReturnReasonCodesError {
Status400(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
Status401(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
Status403(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
Status404(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
Status429(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
Status500(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
Status503(models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`submit_fulfillment_order_status_update`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitFulfillmentOrderStatusUpdateError {
Status400(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
Status401(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
Status403(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
Status404(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
Status429(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
Status500(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
Status503(models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`update_fulfillment_order`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UpdateFulfillmentOrderError {
Status400(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
Status401(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
Status403(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
Status404(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
Status429(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
Status500(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
Status503(models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse),
UnknownValue(serde_json::Value),
}
/// Requests that Amazon stop attempting to fulfill the fulfillment order indicated by the specified order identifier. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn cancel_fulfillment_order(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str) -> Result<models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse, Error<CancelFulfillmentOrderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/cancel", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse`"))),
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::fulfillment_outbound_2020_07_01::CancelFulfillmentOrderResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CancelFulfillmentOrderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Requests that Amazon ship items from the seller's inventory in Amazon's fulfillment network to a destination address. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api)
pub async fn create_fulfillment_order(configuration: &configuration::Configuration, body: models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderRequest) -> Result<models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse, Error<CreateFulfillmentOrderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse`"))),
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::fulfillment_outbound_2020_07_01::CreateFulfillmentOrderResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateFulfillmentOrderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Creates a fulfillment return. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn create_fulfillment_return(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str, body: models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnRequest) -> Result<models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse, Error<CreateFulfillmentReturnError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
let p_body = body;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/return", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse`"))),
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::fulfillment_outbound_2020_07_01::CreateFulfillmentReturnResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateFulfillmentReturnError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns delivery options that include an estimated delivery date and offer expiration, based on criteria that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn delivery_offers(configuration: &configuration::Configuration, body: models::fulfillment_outbound_2020_07_01::GetDeliveryOffersRequest) -> Result<models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse, Error<DeliveryOffersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/fba/outbound/2020-07-01/deliveryOffers", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse`"))),
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::fulfillment_outbound_2020_07_01::GetDeliveryOffersResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DeliveryOffersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a list of inventory items that are eligible for the fulfillment feature you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api)..
pub async fn get_feature_inventory(configuration: &configuration::Configuration, marketplace_id: &str, feature_name: &str, next_token: Option<&str>, query_start_date: Option<String>) -> Result<models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse, Error<GetFeatureInventoryError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_marketplace_id = marketplace_id;
let p_feature_name = feature_name;
let p_next_token = next_token;
let p_query_start_date = query_start_date;
let uri_str = format!("{}/fba/outbound/2020-07-01/features/inventory/{featureName}", configuration.base_path, featureName=crate::apis::urlencode(p_feature_name));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
if let Some(ref param_value) = p_next_token {
req_builder = req_builder.query(&[("nextToken", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_query_start_date {
req_builder = req_builder.query(&[("queryStartDate", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse`"))),
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::fulfillment_outbound_2020_07_01::GetFeatureInventoryResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFeatureInventoryError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the number of items with the sellerSKU you specify that can have orders fulfilled using the specified feature. Note that if the sellerSKU isn't eligible, the response will contain an empty skuInfo object. The parameters for this operation may contain special characters that require URL encoding. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding). **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn get_feature_sku(configuration: &configuration::Configuration, marketplace_id: &str, feature_name: &str, seller_sku: &str) -> Result<models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse, Error<GetFeatureSkuError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_marketplace_id = marketplace_id;
let p_feature_name = feature_name;
let p_seller_sku = seller_sku;
let uri_str = format!("{}/fba/outbound/2020-07-01/features/inventory/{featureName}/{sellerSku}", configuration.base_path, featureName=crate::apis::urlencode(p_feature_name), sellerSku=crate::apis::urlencode(p_seller_sku));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse`"))),
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::fulfillment_outbound_2020_07_01::GetFeatureSkuResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFeatureSkuError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a list of features available for Multi-Channel Fulfillment orders in the marketplace you specify, and whether the seller for which you made the call is enrolled for each feature. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn get_features(configuration: &configuration::Configuration, marketplace_id: &str) -> Result<models::fulfillment_outbound_2020_07_01::GetFeaturesResponse, Error<GetFeaturesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_marketplace_id = marketplace_id;
let uri_str = format!("{}/fba/outbound/2020-07-01/features", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("marketplaceId", &p_marketplace_id.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFeaturesResponse`"))),
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::fulfillment_outbound_2020_07_01::GetFeaturesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFeaturesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the fulfillment order indicated by the specified order identifier. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn get_fulfillment_order(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str) -> Result<models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse, Error<GetFulfillmentOrderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse`"))),
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::fulfillment_outbound_2020_07_01::GetFulfillmentOrderResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFulfillmentOrderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a list of fulfillment order previews based on shipping criteria that you specify. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn get_fulfillment_preview(configuration: &configuration::Configuration, body: models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewRequest) -> Result<models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse, Error<GetFulfillmentPreviewError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/preview", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse`"))),
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::fulfillment_outbound_2020_07_01::GetFulfillmentPreviewResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetFulfillmentPreviewError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns delivery tracking information for a package in an outbound shipment for a Multi-Channel Fulfillment order. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn get_package_tracking_details(configuration: &configuration::Configuration, package_number: i32) -> Result<models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse, Error<GetPackageTrackingDetailsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_package_number = package_number;
let uri_str = format!("{}/fba/outbound/2020-07-01/tracking", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("packageNumber", &p_package_number.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse`"))),
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::fulfillment_outbound_2020_07_01::GetPackageTrackingDetailsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetPackageTrackingDetailsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a list of fulfillment orders fulfilled after (or at) a specified date-time, or indicated by the next token parameter. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api)
pub async fn list_all_fulfillment_orders(configuration: &configuration::Configuration, query_start_date: Option<String>, next_token: Option<&str>) -> Result<models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse, Error<ListAllFulfillmentOrdersError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_query_start_date = query_start_date;
let p_next_token = next_token;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_query_start_date {
req_builder = req_builder.query(&[("queryStartDate", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_next_token {
req_builder = req_builder.query(&[("nextToken", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse`"))),
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::fulfillment_outbound_2020_07_01::ListAllFulfillmentOrdersResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ListAllFulfillmentOrdersError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a list of return reason codes for a seller SKU in a given marketplace. The parameters for this operation may contain special characters that require URL encoding. To avoid errors with SKUs when encoding URLs, refer to [URL Encoding](https://developer-docs.amazon.com/sp-api/docs/url-encoding). **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn list_return_reason_codes(configuration: &configuration::Configuration, seller_sku: &str, marketplace_id: Option<&str>, seller_fulfillment_order_id: Option<&str>, language: Option<&str>) -> Result<models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse, Error<ListReturnReasonCodesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_seller_sku = seller_sku;
let p_marketplace_id = marketplace_id;
let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
let p_language = language;
let uri_str = format!("{}/fba/outbound/2020-07-01/returnReasonCodes", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("sellerSku", &p_seller_sku.to_string())]);
if let Some(ref param_value) = p_marketplace_id {
req_builder = req_builder.query(&[("marketplaceId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_seller_fulfillment_order_id {
req_builder = req_builder.query(&[("sellerFulfillmentOrderId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_language {
req_builder = req_builder.query(&[("language", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse`"))),
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::fulfillment_outbound_2020_07_01::ListReturnReasonCodesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<ListReturnReasonCodesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Requests that Amazon update the status of an order in the sandbox testing environment. This is a sandbox-only operation and must be directed to a sandbox endpoint. Refer to [Fulfillment Outbound Dynamic Sandbox Guide](https://developer-docs.amazon.com/sp-api/docs/fulfillment-outbound-dynamic-sandbox-guide) and [Selling Partner API sandbox](https://developer-docs.amazon.com/sp-api/docs/the-selling-partner-api-sandbox) for more information.
pub async fn submit_fulfillment_order_status_update(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str, body: models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateRequest) -> Result<models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse, Error<SubmitFulfillmentOrderStatusUpdateError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
let p_body = body;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}/status", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse`"))),
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::fulfillment_outbound_2020_07_01::SubmitFulfillmentOrderStatusUpdateResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<SubmitFulfillmentOrderStatusUpdateError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Updates and/or requests shipment for a fulfillment order with an order hold on it. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 2 | 30 | The `x-amzn-RateLimit-Limit` response header returns the usage plan rate limits that were applied to the requested operation, when available. The table above indicates the default rate and burst values for this operation. Selling partners whose business demands require higher throughput may have higher rate and burst values than those shown here. For more information, refer to [Usage Plans and Rate Limits in the Selling Partner API](https://developer-docs.amazon.com/sp-api/docs/usage-plans-and-rate-limits-in-the-sp-api).
pub async fn update_fulfillment_order(configuration: &configuration::Configuration, seller_fulfillment_order_id: &str, body: models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderRequest) -> Result<models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse, Error<UpdateFulfillmentOrderError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_seller_fulfillment_order_id = seller_fulfillment_order_id;
let p_body = body;
let uri_str = format!("{}/fba/outbound/2020-07-01/fulfillmentOrders/{sellerFulfillmentOrderId}", configuration.base_path, sellerFulfillmentOrderId=crate::apis::urlencode(p_seller_fulfillment_order_id));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
let content_type = resp
.headers()
.get("content-type")
.and_then(|v| v.to_str().ok())
.unwrap_or("application/octet-stream");
let content_type = super::ContentType::from(content_type);
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
match content_type {
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse`"))),
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::fulfillment_outbound_2020_07_01::UpdateFulfillmentOrderResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UpdateFulfillmentOrderError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}