amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Selling Partner API for Retail Procurement Shipments
 *
 * The Selling Partner API for Retail Procurement Shipments provides programmatic access to retail shipping data for vendors.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// ShipmentConfirmation : A list of one or more shipment confirmations.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ShipmentConfirmation {
    /// Unique shipment ID (not used over the last 365 days).
    #[serde(rename = "shipmentIdentifier")]
    pub shipment_identifier: String,
    /// Indicates if this shipment confirmation is the initial confirmation, or intended to replace an already posted shipment confirmation. If replacing an existing shipment confirmation, be sure to provide the identical shipmentIdentifier and sellingParty information as in the previous confirmation.
    #[serde(rename = "shipmentConfirmationType")]
    pub shipment_confirmation_type: ShipmentConfirmationType,
    /// The type of shipment.
    #[serde(rename = "shipmentType", skip_serializing_if = "Option::is_none")]
    pub shipment_type: Option<ShipmentType>,
    /// Shipment hierarchical structure.
    #[serde(rename = "shipmentStructure", skip_serializing_if = "Option::is_none")]
    pub shipment_structure: Option<ShipmentStructure>,
    #[serde(rename = "transportationDetails", skip_serializing_if = "Option::is_none")]
    pub transportation_details: Option<Box<models::vendor_shipments::TransportationDetailsForShipmentConfirmation>>,
    /// The Amazon Reference Number is a unique identifier generated by Amazon for all Collect/WePay shipments when you submit  a routing request. This field is mandatory for Collect/WePay shipments.
    #[serde(rename = "amazonReferenceNumber", skip_serializing_if = "Option::is_none")]
    pub amazon_reference_number: Option<String>,
    /// Date on which the shipment confirmation was submitted.
    #[serde(rename = "shipmentConfirmationDate")]
    pub shipment_confirmation_date: String,
    /// The date and time of the departure of the shipment from the vendor's location. Vendors are requested to send ASNs within 30 minutes of departure from their warehouse/distribution center or at least 6 hours prior to the appointment time at the buyer destination warehouse, whichever is sooner. Shipped date mentioned in the shipment confirmation should not be in the future.
    #[serde(rename = "shippedDate", skip_serializing_if = "Option::is_none")]
    pub shipped_date: Option<String>,
    /// The date and time on which the shipment is estimated to reach buyer's warehouse. It needs to be an estimate based on the average transit time between ship from location and the destination. The exact appointment time will be provided by the buyer and is potentially not known when creating the shipment confirmation.
    #[serde(rename = "estimatedDeliveryDate", skip_serializing_if = "Option::is_none")]
    pub estimated_delivery_date: Option<String>,
    #[serde(rename = "sellingParty")]
    pub selling_party: Box<models::vendor_shipments::PartyIdentification>,
    #[serde(rename = "shipFromParty")]
    pub ship_from_party: Box<models::vendor_shipments::PartyIdentification>,
    #[serde(rename = "shipToParty")]
    pub ship_to_party: Box<models::vendor_shipments::PartyIdentification>,
    #[serde(rename = "shipmentMeasurements", skip_serializing_if = "Option::is_none")]
    pub shipment_measurements: Option<Box<models::vendor_shipments::ShipmentMeasurements>>,
    #[serde(rename = "importDetails", skip_serializing_if = "Option::is_none")]
    pub import_details: Option<Box<models::vendor_shipments::ImportDetails>>,
    /// A list of the items in this shipment and their associated details. If any of the item detail fields are common at a carton or a pallet level, provide them at the corresponding carton or pallet level.
    #[serde(rename = "shippedItems")]
    pub shipped_items: Vec<models::vendor_shipments::Item>,
    /// A list of the cartons in this shipment.
    #[serde(rename = "cartons", skip_serializing_if = "Option::is_none")]
    pub cartons: Option<Vec<models::vendor_shipments::Carton>>,
    /// A list of the pallets in this shipment.
    #[serde(rename = "pallets", skip_serializing_if = "Option::is_none")]
    pub pallets: Option<Vec<models::vendor_shipments::Pallet>>,
}

impl ShipmentConfirmation {
    /// A list of one or more shipment confirmations.
    pub fn new(shipment_identifier: String, shipment_confirmation_type: ShipmentConfirmationType, shipment_confirmation_date: String, selling_party: models::vendor_shipments::PartyIdentification, ship_from_party: models::vendor_shipments::PartyIdentification, ship_to_party: models::vendor_shipments::PartyIdentification, shipped_items: Vec<models::vendor_shipments::Item>) -> ShipmentConfirmation {
        ShipmentConfirmation {
            shipment_identifier,
            shipment_confirmation_type,
            shipment_type: None,
            shipment_structure: None,
            transportation_details: None,
            amazon_reference_number: None,
            shipment_confirmation_date,
            shipped_date: None,
            estimated_delivery_date: None,
            selling_party: Box::new(selling_party),
            ship_from_party: Box::new(ship_from_party),
            ship_to_party: Box::new(ship_to_party),
            shipment_measurements: None,
            import_details: None,
            shipped_items,
            cartons: None,
            pallets: None,
        }
    }
}
/// Indicates if this shipment confirmation is the initial confirmation, or intended to replace an already posted shipment confirmation. If replacing an existing shipment confirmation, be sure to provide the identical shipmentIdentifier and sellingParty information as in the previous confirmation.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ShipmentConfirmationType {
    #[serde(rename = "Original")]
    Original,
    #[serde(rename = "Replace")]
    Replace,
}

impl Default for ShipmentConfirmationType {
    fn default() -> ShipmentConfirmationType {
        Self::Original
    }
}
/// The type of shipment.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ShipmentType {
    #[serde(rename = "TruckLoad")]
    TruckLoad,
    #[serde(rename = "LessThanTruckLoad")]
    LessThanTruckLoad,
    #[serde(rename = "SmallParcel")]
    SmallParcel,
}

impl Default for ShipmentType {
    fn default() -> ShipmentType {
        Self::TruckLoad
    }
}
/// Shipment hierarchical structure.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ShipmentStructure {
    #[serde(rename = "PalletizedAssortmentCase")]
    PalletizedAssortmentCase,
    #[serde(rename = "LooseAssortmentCase")]
    LooseAssortmentCase,
    #[serde(rename = "PalletOfItems")]
    PalletOfItems,
    #[serde(rename = "PalletizedStandardCase")]
    PalletizedStandardCase,
    #[serde(rename = "LooseStandardCase")]
    LooseStandardCase,
    #[serde(rename = "MasterPallet")]
    MasterPallet,
    #[serde(rename = "MasterCase")]
    MasterCase,
}

impl Default for ShipmentStructure {
    fn default() -> ShipmentStructure {
        Self::PalletizedAssortmentCase
    }
}