amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Selling Partner API for Direct Fulfillment Shipping
 *
 * The Selling Partner API for Direct Fulfillment Shipping provides programmatic access to a direct fulfillment vendor's shipping data.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// Container : A container used for shipping and packing items.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Container {
    /// The type of container.
    #[serde(rename = "containerType")]
    pub container_type: ContainerType,
    /// The container identifier.
    #[serde(rename = "containerIdentifier")]
    pub container_identifier: String,
    /// The tracking number.
    #[serde(rename = "trackingNumber", skip_serializing_if = "Option::is_none")]
    pub tracking_number: Option<String>,
    /// The manifest identifier.
    #[serde(rename = "manifestId", skip_serializing_if = "Option::is_none")]
    pub manifest_id: Option<String>,
    /// The date of the manifest.
    #[serde(rename = "manifestDate", skip_serializing_if = "Option::is_none")]
    pub manifest_date: Option<String>,
    /// The shipment method.
    #[serde(rename = "shipMethod", skip_serializing_if = "Option::is_none")]
    pub ship_method: Option<String>,
    /// SCAC code required for NA VOC vendors only.
    #[serde(rename = "scacCode", skip_serializing_if = "Option::is_none")]
    pub scac_code: Option<String>,
    /// Carrier required for EU VOC vendors only.
    #[serde(rename = "carrier", skip_serializing_if = "Option::is_none")]
    pub carrier: Option<String>,
    /// An integer that must be submitted for multi-box shipments only, where one item may come in separate packages.
    #[serde(rename = "containerSequenceNumber", skip_serializing_if = "Option::is_none")]
    pub container_sequence_number: Option<i32>,
    #[serde(rename = "dimensions", skip_serializing_if = "Option::is_none")]
    pub dimensions: Option<Box<models::vendor_direct_fulfillment_shipping_v1::Dimensions>>,
    #[serde(rename = "weight")]
    pub weight: Box<models::vendor_direct_fulfillment_shipping_v1::Weight>,
    /// A list of packed items.
    #[serde(rename = "packedItems")]
    pub packed_items: Vec<models::vendor_direct_fulfillment_shipping_v1::PackedItem>,
}

impl Container {
    /// A container used for shipping and packing items.
    pub fn new(container_type: ContainerType, container_identifier: String, weight: models::vendor_direct_fulfillment_shipping_v1::Weight, packed_items: Vec<models::vendor_direct_fulfillment_shipping_v1::PackedItem>) -> Container {
        Container {
            container_type,
            container_identifier,
            tracking_number: None,
            manifest_id: None,
            manifest_date: None,
            ship_method: None,
            scac_code: None,
            carrier: None,
            container_sequence_number: None,
            dimensions: None,
            weight: Box::new(weight),
            packed_items,
        }
    }
}
/// The type of container.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum ContainerType {
    #[serde(rename = "carton")]
    Carton,
    #[serde(rename = "pallet")]
    Pallet,
}

impl Default for ContainerType {
    fn default() -> ContainerType {
        Self::Carton
    }
}