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

/// Item : An item in a package.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Item {
    #[serde(rename = "itemValue", skip_serializing_if = "Option::is_none")]
    pub item_value: Option<Box<models::shipping_v2::Currency>>,
    /// The product description of the item.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// A unique identifier for an item provided by the client.
    #[serde(rename = "itemIdentifier", skip_serializing_if = "Option::is_none")]
    pub item_identifier: Option<String>,
    /// The number of units. This value is required.
    #[serde(rename = "quantity")]
    pub quantity: i32,
    #[serde(rename = "weight", skip_serializing_if = "Option::is_none")]
    pub weight: Option<Box<models::shipping_v2::Weight>>,
    #[serde(rename = "liquidVolume", skip_serializing_if = "Option::is_none")]
    pub liquid_volume: Option<Box<models::shipping_v2::LiquidVolume>>,
    /// When true, the item qualifies as hazardous materials (hazmat). Defaults to false.
    #[serde(rename = "isHazmat", skip_serializing_if = "Option::is_none")]
    pub is_hazmat: Option<bool>,
    #[serde(rename = "dangerousGoodsDetails", skip_serializing_if = "Option::is_none")]
    pub dangerous_goods_details: Option<Box<models::shipping_v2::DangerousGoodsDetails>>,
    /// The product type of the item.
    #[serde(rename = "productType", skip_serializing_if = "Option::is_none")]
    pub product_type: Option<String>,
    #[serde(rename = "invoiceDetails", skip_serializing_if = "Option::is_none")]
    pub invoice_details: Option<Box<models::shipping_v2::InvoiceDetails>>,
    /// A list of unique serial numbers in an Amazon package that can be used to guarantee non-fraudulent items. The number of serial numbers in the list must be less than or equal to the quantity of items being shipped. Only applicable when channel source is Amazon.
    #[serde(rename = "serialNumbers", skip_serializing_if = "Option::is_none")]
    pub serial_numbers: Option<Vec<String>>,
    #[serde(rename = "directFulfillmentItemIdentifiers", skip_serializing_if = "Option::is_none")]
    pub direct_fulfillment_item_identifiers: Option<Box<models::shipping_v2::DirectFulfillmentItemIdentifiers>>,
}

impl Item {
    /// An item in a package.
    pub fn new(quantity: i32) -> Item {
        Item {
            item_value: None,
            description: None,
            item_identifier: None,
            quantity,
            weight: None,
            liquid_volume: None,
            is_hazmat: None,
            dangerous_goods_details: None,
            product_type: None,
            invoice_details: None,
            serial_numbers: None,
            direct_fulfillment_item_identifiers: None,
        }
    }
}