/*
* Amazon Shipping API
*
* The Amazon Shipping API is designed to support outbound shipping use cases both for orders originating on Amazon-owned marketplaces as well as external channels/marketplaces. With these APIs, you can request shipping rates, create shipments, cancel shipments, and track shipments.
*
* The version of the OpenAPI document: v2
* Contact: swa-api-core@amazon.com
* 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_shipment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CancelShipmentError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_claim`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateClaimError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`direct_purchase_shipment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DirectPurchaseShipmentError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`generate_collection_form`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GenerateCollectionFormError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_access_points`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAccessPointsError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_additional_inputs`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetAdditionalInputsError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_carrier_account_form_inputs`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCarrierAccountFormInputsError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_carrier_accounts`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCarrierAccountsError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_collection_form`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCollectionFormError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_collection_form_history`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCollectionFormHistoryError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_rates`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetRatesError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_shipment_documents`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetShipmentDocumentsError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_tracking`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTrackingError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_unmanifested_shipments`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetUnmanifestedShipmentsError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`link_carrier_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LinkCarrierAccountError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`link_carrier_account_0`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum LinkCarrierAccount0Error {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`one_click_shipment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum OneClickShipmentError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`purchase_shipment`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum PurchaseShipmentError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`submit_ndr_feedback`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum SubmitNdrFeedbackError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`unlink_carrier_account`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum UnlinkCarrierAccountError {
Status400(models::shipping_v2::ErrorList),
Status401(models::shipping_v2::ErrorList),
Status403(models::shipping_v2::ErrorList),
Status404(models::shipping_v2::ErrorList),
Status413(models::shipping_v2::ErrorList),
Status415(models::shipping_v2::ErrorList),
Status429(models::shipping_v2::ErrorList),
Status500(models::shipping_v2::ErrorList),
Status503(models::shipping_v2::ErrorList),
UnknownValue(serde_json::Value),
}
/// Cancels a purchased shipment. Returns an empty object if the shipment is successfully cancelled. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_shipment(configuration: &configuration::Configuration, shipment_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::CancelShipmentResponse, Error<CancelShipmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_shipment_id = shipment_id;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/shipments/{shipmentId}/cancel", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::CancelShipmentResponse`"))),
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::shipping_v2::CancelShipmentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CancelShipmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API will be used to create claim for single eligible shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
pub async fn create_claim(configuration: &configuration::Configuration, body: models::shipping_v2::CreateClaimRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::CreateClaimResponse, Error<CreateClaimError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/claims", 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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::CreateClaimResponse`"))),
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::shipping_v2::CreateClaimResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<CreateClaimError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Purchases the shipping service for a shipment using the best fit service offering. Returns purchase related details and documents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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 direct_purchase_shipment(configuration: &configuration::Configuration, body: models::shipping_v2::DirectPurchaseRequest, x_amzn_idempotency_key: Option<&str>, locale: Option<&str>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::DirectPurchaseResponse, Error<DirectPurchaseShipmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_idempotency_key = x_amzn_idempotency_key;
let p_locale = locale;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/shipments/directPurchase", 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());
}
if let Some(param_value) = p_x_amzn_idempotency_key {
req_builder = req_builder.header("x-amzn-IdempotencyKey", param_value.to_string());
}
if let Some(param_value) = p_locale {
req_builder = req_builder.header("locale", param_value.to_string());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::DirectPurchaseResponse`"))),
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::shipping_v2::DirectPurchaseResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<DirectPurchaseShipmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API Call to generate the collection form. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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 generate_collection_form(configuration: &configuration::Configuration, body: models::shipping_v2::GenerateCollectionFormRequest, x_amzn_idempotency_key: Option<&str>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GenerateCollectionFormResponse, Error<GenerateCollectionFormError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_idempotency_key = x_amzn_idempotency_key;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/collectionForms", 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());
}
if let Some(param_value) = p_x_amzn_idempotency_key {
req_builder = req_builder.header("x-amzn-IdempotencyKey", param_value.to_string());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GenerateCollectionFormResponse`"))),
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::shipping_v2::GenerateCollectionFormResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GenerateCollectionFormError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a list of access points in proximity of input postal code. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_access_points(configuration: &configuration::Configuration, access_point_types: Vec<String>, country_code: &str, postal_code: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetAccessPointsResponse, Error<GetAccessPointsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_access_point_types = access_point_types;
let p_country_code = country_code;
let p_postal_code = postal_code;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/accessPoints", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = match "csv" {
"multi" => req_builder.query(&p_access_point_types.into_iter().map(|p| ("accessPointTypes".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("accessPointTypes", &p_access_point_types.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
req_builder = req_builder.query(&[("countryCode", &p_country_code.to_string())]);
req_builder = req_builder.query(&[("postalCode", &p_postal_code.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetAccessPointsResponse`"))),
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::shipping_v2::GetAccessPointsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetAccessPointsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the JSON schema to use for providing additional inputs when needed to purchase a shipping offering. Call the getAdditionalInputs operation when the response to a previous call to the getRates operation indicates that additional inputs are required for the rate (shipping offering) that you want to purchase. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_additional_inputs(configuration: &configuration::Configuration, request_token: &str, rate_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetAdditionalInputsResponse, Error<GetAdditionalInputsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_request_token = request_token;
let p_rate_id = rate_id;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/shipments/additionalInputs/schema", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("requestToken", &p_request_token.to_string())]);
req_builder = req_builder.query(&[("rateId", &p_rate_id.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetAdditionalInputsResponse`"))),
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::shipping_v2::GetAdditionalInputsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetAdditionalInputsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API will return a list of input schema required to register a shipper account with the carrier. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_carrier_account_form_inputs(configuration: &configuration::Configuration, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCarrierAccountFormInputsResponse, Error<GetCarrierAccountFormInputsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/carrierAccountFormInputs", configuration.base_path);
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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetCarrierAccountFormInputsResponse`"))),
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::shipping_v2::GetCarrierAccountFormInputsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCarrierAccountFormInputsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API will return Get all carrier accounts for a merchant. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_carrier_accounts(configuration: &configuration::Configuration, body: models::shipping_v2::GetCarrierAccountsRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCarrierAccountsResponse, Error<GetCarrierAccountsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/carrierAccounts", configuration.base_path);
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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetCarrierAccountsResponse`"))),
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::shipping_v2::GetCarrierAccountsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCarrierAccountsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API reprint a collection form. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_collection_form(configuration: &configuration::Configuration, collection_form_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCollectionFormResponse, Error<GetCollectionFormError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_collection_form_id = collection_form_id;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/collectionForms/{collectionFormId}", configuration.base_path, collectionFormId=crate::apis::urlencode(p_collection_form_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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetCollectionFormResponse`"))),
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::shipping_v2::GetCollectionFormResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCollectionFormError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API Call to get the history of the previously generated collection forms. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_collection_form_history(configuration: &configuration::Configuration, body: models::shipping_v2::GetCollectionFormHistoryRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetCollectionFormHistoryResponse, Error<GetCollectionFormHistoryError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/collectionForms/history", configuration.base_path);
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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetCollectionFormHistoryResponse`"))),
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::shipping_v2::GetCollectionFormHistoryResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetCollectionFormHistoryError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the available shipping service offerings. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_rates(configuration: &configuration::Configuration, body: models::shipping_v2::GetRatesRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetRatesResponse, Error<GetRatesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/shipments/rates", 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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetRatesResponse`"))),
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::shipping_v2::GetRatesResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetRatesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the shipping documents associated with a package in a shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_shipment_documents(configuration: &configuration::Configuration, shipment_id: &str, package_client_reference_id: &str, format: Option<&str>, dpi: Option<f64>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetShipmentDocumentsResponse, Error<GetShipmentDocumentsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_shipment_id = shipment_id;
let p_package_client_reference_id = package_client_reference_id;
let p_format = format;
let p_dpi = dpi;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/shipments/{shipmentId}/documents", configuration.base_path, shipmentId=crate::apis::urlencode(p_shipment_id));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("packageClientReferenceId", &p_package_client_reference_id.to_string())]);
if let Some(ref param_value) = p_format {
req_builder = req_builder.query(&[("format", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_dpi {
req_builder = req_builder.query(&[("dpi", ¶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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetShipmentDocumentsResponse`"))),
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::shipping_v2::GetShipmentDocumentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetShipmentDocumentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns tracking information for a purchased shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_tracking(configuration: &configuration::Configuration, tracking_id: &str, carrier_id: &str, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetTrackingResponse, Error<GetTrackingError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_tracking_id = tracking_id;
let p_carrier_id = carrier_id;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/tracking", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
req_builder = req_builder.query(&[("trackingId", &p_tracking_id.to_string())]);
req_builder = req_builder.query(&[("carrierId", &p_carrier_id.to_string())]);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetTrackingResponse`"))),
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::shipping_v2::GetTrackingResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetTrackingError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API Get all unmanifested carriers with shipment locations. Any locations which has unmanifested shipments with an eligible carrier for manifesting shall be returned. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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_unmanifested_shipments(configuration: &configuration::Configuration, body: models::shipping_v2::GetUnmanifestedShipmentsRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::GetUnmanifestedShipmentsResponse, Error<GetUnmanifestedShipmentsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/unmanifestedShipments", configuration.base_path);
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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::GetUnmanifestedShipmentsResponse`"))),
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::shipping_v2::GetUnmanifestedShipmentsResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<GetUnmanifestedShipmentsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API associates/links the specified carrier account with the merchant. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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 link_carrier_account(configuration: &configuration::Configuration, carrier_id: &str, body: models::shipping_v2::LinkCarrierAccountRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::LinkCarrierAccountResponse, Error<LinkCarrierAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_carrier_id = carrier_id;
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/carrierAccounts/{carrierId}", configuration.base_path, carrierId=crate::apis::urlencode(p_carrier_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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::LinkCarrierAccountResponse`"))),
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::shipping_v2::LinkCarrierAccountResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<LinkCarrierAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API associates/links the specified carrier account with the merchant. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 5 | 10 | 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 see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
pub async fn link_carrier_account_0(configuration: &configuration::Configuration, carrier_id: &str, body: models::shipping_v2::LinkCarrierAccountRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::LinkCarrierAccountResponse, Error<LinkCarrierAccount0Error>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_carrier_id = carrier_id;
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/carrierAccounts/{carrierId}", configuration.base_path, carrierId=crate::apis::urlencode(p_carrier_id));
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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::LinkCarrierAccountResponse`"))),
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::shipping_v2::LinkCarrierAccountResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<LinkCarrierAccount0Error> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Purchases a shipping service identifier and returns purchase-related details and documents. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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 one_click_shipment(configuration: &configuration::Configuration, body: models::shipping_v2::OneClickShipmentRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::OneClickShipmentResponse, Error<OneClickShipmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/oneClickShipment", 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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::OneClickShipmentResponse`"))),
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::shipping_v2::OneClickShipmentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<OneClickShipmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Purchases a shipping service and returns purchase related details and documents. Note: You must complete the purchase within 10 minutes of rate creation by the shipping service provider. If you make the request after the 10 minutes have expired, you will receive an error response with the error code equal to \"TOKEN_EXPIRED\". If you receive this error response, you must get the rates for the shipment again. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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 purchase_shipment(configuration: &configuration::Configuration, body: models::shipping_v2::PurchaseShipmentRequest, x_amzn_idempotency_key: Option<&str>, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::PurchaseShipmentResponse, Error<PurchaseShipmentError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_idempotency_key = x_amzn_idempotency_key;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/shipments", 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());
}
if let Some(param_value) = p_x_amzn_idempotency_key {
req_builder = req_builder.header("x-amzn-IdempotencyKey", param_value.to_string());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::PurchaseShipmentResponse`"))),
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::shipping_v2::PurchaseShipmentResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<PurchaseShipmentError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API submits the NDR (Non-delivery Report) Feedback for any eligible shipment. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [Usage Plans and Rate Limits in the Selling Partner API](doc:usage-plans-and-rate-limits-in-the-sp-api).
pub async fn submit_ndr_feedback(configuration: &configuration::Configuration, body: models::shipping_v2::SubmitNdrFeedbackRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<(), Error<SubmitNdrFeedbackError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/ndrFeedback", 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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
req_builder = req_builder.json(&p_body);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<SubmitNdrFeedbackError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// This API Unlink the specified carrier account with the merchant. **Usage Plan:** | Rate (requests per second) | Burst | | ---- | ---- | | 80 | 100 | 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 see higher rate and burst values then those shown here. For more information, see [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 unlink_carrier_account(configuration: &configuration::Configuration, carrier_id: &str, body: models::shipping_v2::UnlinkCarrierAccountRequest, x_amzn_shipping_business_id: Option<&str>) -> Result<models::shipping_v2::UnlinkCarrierAccountResponse, Error<UnlinkCarrierAccountError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_carrier_id = carrier_id;
let p_body = body;
let p_x_amzn_shipping_business_id = x_amzn_shipping_business_id;
let uri_str = format!("{}/shipping/v2/carrierAccounts/{carrierId}/unlink", configuration.base_path, carrierId=crate::apis::urlencode(p_carrier_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());
}
if let Some(param_value) = p_x_amzn_shipping_business_id {
req_builder = req_builder.header("x-amzn-shipping-business-id", param_value.to_string());
}
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::shipping_v2::UnlinkCarrierAccountResponse`"))),
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::shipping_v2::UnlinkCarrierAccountResponse`")))),
}
} else {
let content = resp.text().await?;
let entity: Option<UnlinkCarrierAccountError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}