amazon_spapi/models/shipping_v2/
dimensions.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/// Dimensions : A set of measurements for a three-dimensional object.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Dimensions {
17    /// The length of the package.
18    #[serde(rename = "length")]
19    pub length: f64,
20    /// The width of the package.
21    #[serde(rename = "width")]
22    pub width: f64,
23    /// The height of the package.
24    #[serde(rename = "height")]
25    pub height: f64,
26    /// The unit of measurement.
27    #[serde(rename = "unit")]
28    pub unit: Unit,
29}
30
31impl Dimensions {
32    /// A set of measurements for a three-dimensional object.
33    pub fn new(length: f64, width: f64, height: f64, unit: Unit) -> Dimensions {
34        Dimensions {
35            length,
36            width,
37            height,
38            unit,
39        }
40    }
41}
42/// The unit of measurement.
43#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
44pub enum Unit {
45    #[serde(rename = "INCH")]
46    Inch,
47    #[serde(rename = "CENTIMETER")]
48    Centimeter,
49}
50
51impl Default for Unit {
52    fn default() -> Unit {
53        Self::Inch
54    }
55}
56