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

/// OneClickShipmentRequest : The request schema for the OneClickShipment operation. When the channelType is not Amazon, shipTo is required and when channelType is Amazon shipTo is ignored.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct OneClickShipmentRequest {
    #[serde(rename = "shipTo", skip_serializing_if = "Option::is_none")]
    pub ship_to: Option<Box<models::shipping_v2::Address>>,
    #[serde(rename = "shipFrom")]
    pub ship_from: Box<models::shipping_v2::Address>,
    #[serde(rename = "returnTo", skip_serializing_if = "Option::is_none")]
    pub return_to: Option<Box<models::shipping_v2::Address>>,
    /// The ship date and time (the requested pickup). This defaults to the current date and time.
    #[serde(rename = "shipDate", skip_serializing_if = "Option::is_none")]
    pub ship_date: Option<String>,
    #[serde(rename = "goodsOwner", skip_serializing_if = "Option::is_none")]
    pub goods_owner: Option<Box<models::shipping_v2::GoodsOwner>>,
    /// A list of packages to be shipped through a shipping service offering.
    #[serde(rename = "packages")]
    pub packages: Vec<models::shipping_v2::Package>,
    /// The value-added services to be added to a shipping service purchase.
    #[serde(rename = "valueAddedServicesDetails", skip_serializing_if = "Option::is_none")]
    pub value_added_services_details: Option<Vec<models::shipping_v2::OneClickShipmentValueAddedService>>,
    /// A list of tax detail information.
    #[serde(rename = "taxDetails", skip_serializing_if = "Option::is_none")]
    pub tax_details: Option<Vec<models::shipping_v2::TaxDetail>>,
    #[serde(rename = "channelDetails")]
    pub channel_details: Box<models::shipping_v2::ChannelDetails>,
    #[serde(rename = "labelSpecifications")]
    pub label_specifications: Box<models::shipping_v2::RequestedDocumentSpecification>,
    #[serde(rename = "serviceSelection")]
    pub service_selection: Box<models::shipping_v2::ServiceSelection>,
    #[serde(rename = "shipperInstruction", skip_serializing_if = "Option::is_none")]
    pub shipper_instruction: Option<Box<models::shipping_v2::ShipperInstruction>>,
    #[serde(rename = "destinationAccessPointDetails", skip_serializing_if = "Option::is_none")]
    pub destination_access_point_details: Option<Box<models::shipping_v2::AccessPointDetails>>,
}

impl OneClickShipmentRequest {
    /// The request schema for the OneClickShipment operation. When the channelType is not Amazon, shipTo is required and when channelType is Amazon shipTo is ignored.
    pub fn new(ship_from: models::shipping_v2::Address, packages: Vec<models::shipping_v2::Package>, channel_details: models::shipping_v2::ChannelDetails, label_specifications: models::shipping_v2::RequestedDocumentSpecification, service_selection: models::shipping_v2::ServiceSelection) -> OneClickShipmentRequest {
        OneClickShipmentRequest {
            ship_to: None,
            ship_from: Box::new(ship_from),
            return_to: None,
            ship_date: None,
            goods_owner: None,
            packages,
            value_added_services_details: None,
            tax_details: None,
            channel_details: Box::new(channel_details),
            label_specifications: Box::new(label_specifications),
            service_selection: Box::new(service_selection),
            shipper_instruction: None,
            destination_access_point_details: None,
        }
    }
}