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

/// Containers : 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.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Containers {
    /// The type of container.
    #[serde(rename = "containerType")]
    pub container_type: ContainerType,
    /// 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<String>,
    /// A list of carton identifiers.
    #[serde(rename = "containerIdentifiers")]
    pub container_identifiers: Vec<models::vendor_shipments::ContainerIdentification>,
    /// The tracking number used for identifying the shipment.
    #[serde(rename = "trackingNumber", skip_serializing_if = "Option::is_none")]
    pub tracking_number: Option<String>,
    #[serde(rename = "dimensions", skip_serializing_if = "Option::is_none")]
    pub dimensions: Option<Box<models::vendor_shipments::Dimensions>>,
    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
    pub weight: Option<Box<models::vendor_shipments::Weight>>,
    /// Number of layers per pallet.
    #[serde(rename = "tier", skip_serializing_if = "Option::is_none")]
    pub tier: Option<i32>,
    /// Number of cartons per layer on the pallet.
    #[serde(rename = "block", skip_serializing_if = "Option::is_none")]
    pub block: Option<i32>,
    #[serde(rename = "innerContainersDetails", skip_serializing_if = "Option::is_none")]
    pub inner_containers_details: Option<Box<models::vendor_shipments::InnerContainersDetails>>,
    /// A list of packed items.
    #[serde(rename = "packedItems", skip_serializing_if = "Option::is_none")]
    pub packed_items: Option<Vec<models::vendor_shipments::PackedItems>>,
}

impl Containers {
    /// 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.
    pub fn new(container_type: ContainerType, container_identifiers: Vec<models::vendor_shipments::ContainerIdentification>) -> Containers {
        Containers {
            container_type,
            container_sequence_number: None,
            container_identifiers,
            tracking_number: None,
            dimensions: None,
            weight: None,
            tier: None,
            block: None,
            inner_containers_details: None,
            packed_items: None,
        }
    }
}
/// 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
    }
}