amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * 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 crate::models;
use serde::{Deserialize, Serialize};

/// Package : A package to be shipped through a shipping service offering.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Package {
    #[serde(rename = "dimensions")]
    pub dimensions: Box<models::shipping_v2::Dimensions>,
    #[serde(rename = "weight")]
    pub weight: Box<models::shipping_v2::Weight>,
    #[serde(rename = "insuredValue")]
    pub insured_value: Box<models::shipping_v2::Currency>,
    /// When true, the package contains hazardous materials. Defaults to false.
    #[serde(rename = "isHazmat", skip_serializing_if = "Option::is_none")]
    pub is_hazmat: Option<bool>,
    /// The seller name displayed on the label.
    #[serde(rename = "sellerDisplayName", skip_serializing_if = "Option::is_none")]
    pub seller_display_name: Option<String>,
    /// A list of charges based on the shipping service charges applied on a package.
    #[serde(rename = "charges", skip_serializing_if = "Option::is_none")]
    pub charges: Option<Vec<models::shipping_v2::ChargeComponent>>,
    /// A client provided unique identifier for a package being shipped. This value should be saved by the client to pass as a parameter to the getShipmentDocuments operation.
    #[serde(rename = "packageClientReferenceId")]
    pub package_client_reference_id: String,
    /// A list of items.
    #[serde(rename = "items")]
    pub items: Vec<models::shipping_v2::Item>,
}

impl Package {
    /// A package to be shipped through a shipping service offering.
    pub fn new(dimensions: models::shipping_v2::Dimensions, weight: models::shipping_v2::Weight, insured_value: models::shipping_v2::Currency, package_client_reference_id: String, items: Vec<models::shipping_v2::Item>) -> Package {
        Package {
            dimensions: Box::new(dimensions),
            weight: Box::new(weight),
            insured_value: Box::new(insured_value),
            is_hazmat: None,
            seller_display_name: None,
            charges: None,
            package_client_reference_id,
            items,
        }
    }
}