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

/// GetRatesRequest : The request schema for the getRates operation. When the channelType is Amazon, the shipTo address is not required and will be ignored.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct GetRatesRequest {
    #[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 = "shipperInstruction", skip_serializing_if = "Option::is_none")]
    pub shipper_instruction: Option<Box<models::shipping_v2::ShipperInstruction>>,
    /// A list of packages to be shipped through a shipping service offering.
    #[serde(rename = "packages")]
    pub packages: Vec<models::shipping_v2::Package>,
    #[serde(rename = "valueAddedServices", skip_serializing_if = "Option::is_none")]
    pub value_added_services: Option<Box<models::shipping_v2::ValueAddedServiceDetails>>,
    /// 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>,
    /// Object to pass additional information about the MCI Integrator shipperType: List of ClientReferenceDetail
    #[serde(rename = "clientReferenceDetails", skip_serializing_if = "Option::is_none")]
    pub client_reference_details: Option<Vec<models::shipping_v2::ClientReferenceDetail>>,
    #[serde(rename = "shipmentType", skip_serializing_if = "Option::is_none")]
    pub shipment_type: Option<models::shipping_v2::ShipmentType>,
    #[serde(rename = "destinationAccessPointDetails", skip_serializing_if = "Option::is_none")]
    pub destination_access_point_details: Option<Box<models::shipping_v2::AccessPointDetails>>,
    /// A list of CarrierAccounts
    #[serde(rename = "carrierAccounts", skip_serializing_if = "Option::is_none")]
    pub carrier_accounts: Option<Vec<models::shipping_v2::CarrierAccount>>,
}

impl GetRatesRequest {
    /// The request schema for the getRates operation. When the channelType is Amazon, the shipTo address is not required and will be ignored.
    pub fn new(ship_from: models::shipping_v2::Address, packages: Vec<models::shipping_v2::Package>, channel_details: models::shipping_v2::ChannelDetails) -> GetRatesRequest {
        GetRatesRequest {
            ship_to: None,
            ship_from: Box::new(ship_from),
            return_to: None,
            ship_date: None,
            shipper_instruction: None,
            packages,
            value_added_services: None,
            tax_details: None,
            channel_details: Box::new(channel_details),
            client_reference_details: None,
            shipment_type: None,
            destination_access_point_details: None,
            carrier_accounts: None,
        }
    }
}