amazon_spapi/models/vendor_shipments/
weight.rs

1/*
2 * Selling Partner API for Retail Procurement Shipments
3 *
4 * The Selling Partner API for Retail Procurement Shipments provides programmatic access to retail shipping data for vendors.
5 *
6 * The version of the OpenAPI document: v1
7 * 
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// Weight : The weight of the shipment.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Weight {
17    /// The unit of measurement.
18    #[serde(rename = "unitOfMeasure")]
19    pub unit_of_measure: UnitOfMeasure,
20    /// A decimal number with no loss of precision. Useful when precision loss is unacceptable, as with currencies. Follows RFC7159 for number representation. <br>**Pattern** : `^-?(0|([1-9]\\d*))(\\.\\d+)?([eE][+-]?\\d+)?$`.
21    #[serde(rename = "value")]
22    pub value: String,
23}
24
25impl Weight {
26    /// The weight of the shipment.
27    pub fn new(unit_of_measure: UnitOfMeasure, value: String) -> Weight {
28        Weight {
29            unit_of_measure,
30            value,
31        }
32    }
33}
34/// The unit of measurement.
35#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
36pub enum UnitOfMeasure {
37    #[serde(rename = "G")]
38    G,
39    #[serde(rename = "Kg")]
40    Kg,
41    #[serde(rename = "Oz")]
42    Oz,
43    #[serde(rename = "Lb")]
44    Lb,
45}
46
47impl Default for UnitOfMeasure {
48    fn default() -> UnitOfMeasure {
49        Self::G
50    }
51}
52