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