amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Selling Partner API for Merchant Fulfillment
 *
 * With the Selling Partner API for Merchant Fulfillment, you can build applications that sellers can use to purchase shipping for non-Prime and Prime orders using Amazon's Buy Shipping Services.
 *
 * The version of the OpenAPI document: v0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

/// Shipment : The details of a shipment. Includes the shipment status.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Shipment {
    /// An Amazon-defined shipment identifier.
    #[serde(rename = "ShipmentId")]
    pub shipment_id: String,
    /// An Amazon-defined order identifier, in 3-7-7 format.
    #[serde(rename = "AmazonOrderId")]
    pub amazon_order_id: String,
    /// A seller-defined order identifier.
    #[serde(rename = "SellerOrderId", skip_serializing_if = "Option::is_none")]
    pub seller_order_id: Option<String>,
    /// The list of items you want to include in a shipment.
    #[serde(rename = "ItemList")]
    pub item_list: Vec<models::merchant_fulfillment_v0::Item>,
    #[serde(rename = "ShipFromAddress")]
    pub ship_from_address: Box<models::merchant_fulfillment_v0::Address>,
    #[serde(rename = "ShipToAddress")]
    pub ship_to_address: Box<models::merchant_fulfillment_v0::Address>,
    #[serde(rename = "PackageDimensions")]
    pub package_dimensions: Box<models::merchant_fulfillment_v0::PackageDimensions>,
    #[serde(rename = "Weight")]
    pub weight: Box<models::merchant_fulfillment_v0::Weight>,
    #[serde(rename = "Insurance")]
    pub insurance: Box<models::merchant_fulfillment_v0::CurrencyAmount>,
    #[serde(rename = "ShippingService")]
    pub shipping_service: Box<models::merchant_fulfillment_v0::ShippingService>,
    #[serde(rename = "Label")]
    pub label: Box<models::merchant_fulfillment_v0::Label>,
    #[serde(rename = "Status")]
    pub status: models::merchant_fulfillment_v0::ShipmentStatus,
    /// The shipment tracking identifier provided by the carrier.
    #[serde(rename = "TrackingId", skip_serializing_if = "Option::is_none")]
    pub tracking_id: Option<String>,
    /// Date-time formatted timestamp.
    #[serde(rename = "CreatedDate")]
    pub created_date: String,
    /// Date-time formatted timestamp.
    #[serde(rename = "LastUpdatedDate", skip_serializing_if = "Option::is_none")]
    pub last_updated_date: Option<String>,
}

impl Shipment {
    /// The details of a shipment. Includes the shipment status.
    pub fn new(shipment_id: String, amazon_order_id: String, item_list: Vec<models::merchant_fulfillment_v0::Item>, ship_from_address: models::merchant_fulfillment_v0::Address, ship_to_address: models::merchant_fulfillment_v0::Address, package_dimensions: models::merchant_fulfillment_v0::PackageDimensions, weight: models::merchant_fulfillment_v0::Weight, insurance: models::merchant_fulfillment_v0::CurrencyAmount, shipping_service: models::merchant_fulfillment_v0::ShippingService, label: models::merchant_fulfillment_v0::Label, status: models::merchant_fulfillment_v0::ShipmentStatus, created_date: String) -> Shipment {
        Shipment {
            shipment_id,
            amazon_order_id,
            seller_order_id: None,
            item_list,
            ship_from_address: Box::new(ship_from_address),
            ship_to_address: Box::new(ship_to_address),
            package_dimensions: Box::new(package_dimensions),
            weight: Box::new(weight),
            insurance: Box::new(insurance),
            shipping_service: Box::new(shipping_service),
            label: Box::new(label),
            status,
            tracking_id: None,
            created_date,
            last_updated_date: None,
        }
    }
}