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};

/// Shipment : A list of one or more shipments with respective details.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Shipment {
    /// Unique Transportation ID created by Vendor (Should not be used over the last 365 days).
    #[serde(rename = "vendorShipmentIdentifier")]
    pub vendor_shipment_identifier: String,
    /// Indicates the type of transportation request (for example, `New` or `Cancel`). Each `transactionType` has a unique set of operations and there are corresponding details to be populated for each operation.
    #[serde(rename = "transactionType")]
    pub transaction_type: TransactionType,
    /// The buyer Reference Number is a unique identifier generated by buyer for all Collect/WePay shipments when you submit a transportation request. This field is mandatory for Collect/WePay shipments.
    #[serde(rename = "buyerReferenceNumber", skip_serializing_if = "Option::is_none")]
    pub buyer_reference_number: Option<String>,
    /// Date on which the transportation request was submitted.
    #[serde(rename = "transactionDate")]
    pub transaction_date: String,
    /// Indicates the current shipment status.
    #[serde(rename = "currentShipmentStatus", skip_serializing_if = "Option::is_none")]
    pub current_shipment_status: Option<CurrentShipmentStatus>,
    /// Date and time when the last status was updated.
    #[serde(rename = "currentshipmentStatusDate", skip_serializing_if = "Option::is_none")]
    pub currentshipment_status_date: Option<String>,
    /// Indicates the list of current shipment status details and when the last update was received from carrier this is available on shipment Details response.
    #[serde(rename = "shipmentStatusDetails", skip_serializing_if = "Option::is_none")]
    pub shipment_status_details: Option<Vec<models::vendor_shipments::ShipmentStatusDetails>>,
    /// The date and time of the shipment request created by vendor.
    #[serde(rename = "shipmentCreateDate", skip_serializing_if = "Option::is_none")]
    pub shipment_create_date: Option<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 = "shipmentConfirmDate", skip_serializing_if = "Option::is_none")]
    pub shipment_confirm_date: Option<String>,
    /// The date and time of the package label created for the shipment by buyer.
    #[serde(rename = "packageLabelCreateDate", skip_serializing_if = "Option::is_none")]
    pub package_label_create_date: Option<String>,
    /// Specifies if payment is Collect (WePay) or Prepaid (TheyPay). Required.
    #[serde(rename = "shipmentFreightTerm", skip_serializing_if = "Option::is_none")]
    pub shipment_freight_term: Option<ShipmentFreightTerm>,
    #[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::TransportShipmentMeasurements>>,
    #[serde(rename = "collectFreightPickupDetails", skip_serializing_if = "Option::is_none")]
    pub collect_freight_pickup_details: Option<Box<models::vendor_shipments::CollectFreightPickupDetails>>,
    /// Indicates the purchase orders involved for the transportation request. This group is an array create 1 for each PO and list their corresponding items. This information is used for deciding the route,truck allocation and storage efficiently. This is a mandatory information for Buyer performing transportation from vendor warehouse (WePay/Collect)
    #[serde(rename = "purchaseOrders", skip_serializing_if = "Option::is_none")]
    pub purchase_orders: Option<Vec<models::vendor_shipments::PurchaseOrders>>,
    #[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 transportation and their associated inner container 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 = "containers", skip_serializing_if = "Option::is_none")]
    pub containers: Option<Vec<models::vendor_shipments::Containers>>,
    #[serde(rename = "transportationDetails", skip_serializing_if = "Option::is_none")]
    pub transportation_details: Option<Box<models::vendor_shipments::TransportationDetails>>,
}

impl Shipment {
    /// A list of one or more shipments with respective details.
    pub fn new(vendor_shipment_identifier: String, transaction_type: TransactionType, transaction_date: String, selling_party: models::vendor_shipments::PartyIdentification, ship_from_party: models::vendor_shipments::PartyIdentification, ship_to_party: models::vendor_shipments::PartyIdentification) -> Shipment {
        Shipment {
            vendor_shipment_identifier,
            transaction_type,
            buyer_reference_number: None,
            transaction_date,
            current_shipment_status: None,
            currentshipment_status_date: None,
            shipment_status_details: None,
            shipment_create_date: None,
            shipment_confirm_date: None,
            package_label_create_date: None,
            shipment_freight_term: 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,
            collect_freight_pickup_details: None,
            purchase_orders: None,
            import_details: None,
            containers: None,
            transportation_details: None,
        }
    }
}
/// Indicates the type of transportation request (for example, `New` or `Cancel`). Each `transactionType` has a unique set of operations and there are corresponding details to be populated for each operation.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TransactionType {
    #[serde(rename = "New")]
    New,
    #[serde(rename = "Cancel")]
    Cancel,
}

impl Default for TransactionType {
    fn default() -> TransactionType {
        Self::New
    }
}
/// Indicates the current shipment status.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum CurrentShipmentStatus {
    #[serde(rename = "Created")]
    Created,
    #[serde(rename = "TransportationRequested")]
    TransportationRequested,
    #[serde(rename = "CarrierAssigned")]
    CarrierAssigned,
    #[serde(rename = "Shipped")]
    Shipped,
}

impl Default for CurrentShipmentStatus {
    fn default() -> CurrentShipmentStatus {
        Self::Created
    }
}
/// Specifies if payment is Collect (WePay) or Prepaid (TheyPay). Required.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ShipmentFreightTerm {
    #[serde(rename = "Collect")]
    Collect,
    #[serde(rename = "Prepaid")]
    Prepaid,
}

impl Default for ShipmentFreightTerm {
    fn default() -> ShipmentFreightTerm {
        Self::Collect
    }
}