amazon_spapi/models/shipping_v2/
rate.rs

1/*
2 * Amazon Shipping API
3 *
4 * 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.
5 *
6 * The version of the OpenAPI document: v2
7 * Contact: swa-api-core@amazon.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Rate : The details of a shipping service offering.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Rate {
17    /// An identifier for the rate (shipment offering) provided by a shipping service provider.
18    #[serde(rename = "rateId")]
19    pub rate_id: String,
20    /// The carrier identifier for the offering, provided by the carrier.
21    #[serde(rename = "carrierId")]
22    pub carrier_id: String,
23    /// The carrier name for the offering.
24    #[serde(rename = "carrierName")]
25    pub carrier_name: String,
26    /// An identifier for the shipping service.
27    #[serde(rename = "serviceId")]
28    pub service_id: String,
29    /// The name of the shipping service.
30    #[serde(rename = "serviceName")]
31    pub service_name: String,
32    #[serde(rename = "billedWeight", skip_serializing_if = "Option::is_none")]
33    pub billed_weight: Option<Box<models::shipping_v2::Weight>>,
34    #[serde(rename = "totalCharge")]
35    pub total_charge: Box<models::shipping_v2::Currency>,
36    #[serde(rename = "promise")]
37    pub promise: Box<models::shipping_v2::Promise>,
38    /// A list of the document specifications supported for a shipment service offering.
39    #[serde(rename = "supportedDocumentSpecifications")]
40    pub supported_document_specifications: Vec<models::shipping_v2::SupportedDocumentSpecification>,
41    /// A list of value-added services available for a shipping service offering.
42    #[serde(rename = "availableValueAddedServiceGroups", skip_serializing_if = "Option::is_none")]
43    pub available_value_added_service_groups: Option<Vec<models::shipping_v2::AvailableValueAddedServiceGroup>>,
44    /// When true, indicates that additional inputs are required to purchase this shipment service. You must then call the getAdditionalInputs operation to return the JSON schema to use when providing the additional inputs to the purchaseShipment operation.
45    #[serde(rename = "requiresAdditionalInputs")]
46    pub requires_additional_inputs: bool,
47    /// A list of RateItem
48    #[serde(rename = "rateItemList", skip_serializing_if = "Option::is_none")]
49    pub rate_item_list: Option<Vec<models::shipping_v2::RateItem>>,
50    #[serde(rename = "paymentType", skip_serializing_if = "Option::is_none")]
51    pub payment_type: Option<models::shipping_v2::PaymentType>,
52    #[serde(rename = "benefits", skip_serializing_if = "Option::is_none")]
53    pub benefits: Option<Box<models::shipping_v2::Benefits>>,
54}
55
56impl Rate {
57    /// The details of a shipping service offering.
58    pub fn new(rate_id: String, carrier_id: String, carrier_name: String, service_id: String, service_name: String, total_charge: models::shipping_v2::Currency, promise: models::shipping_v2::Promise, supported_document_specifications: Vec<models::shipping_v2::SupportedDocumentSpecification>, requires_additional_inputs: bool) -> Rate {
59        Rate {
60            rate_id,
61            carrier_id,
62            carrier_name,
63            service_id,
64            service_name,
65            billed_weight: None,
66            total_charge: Box::new(total_charge),
67            promise: Box::new(promise),
68            supported_document_specifications,
69            available_value_added_service_groups: None,
70            requires_additional_inputs,
71            rate_item_list: None,
72            payment_type: None,
73            benefits: None,
74        }
75    }
76}
77