Skip to main content

autogen_squareup/models/
measurement_unit.rs

1/*
2 * Square
3 *
4 * Use Square APIs to manage and run business including payment, customer, product, inventory, and employee management.
5 *
6 * The version of the OpenAPI document: 2.0
7 * Contact: developers@squareup.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// MeasurementUnit : Represents a unit of measurement to use with a quantity, such as ounces or inches. Exactly one of the following fields are required: `custom_unit`, `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct MeasurementUnit {
17    #[serde(rename = "custom_unit", skip_serializing_if = "Option::is_none")]
18    pub custom_unit: Option<Box<models::MeasurementUnitCustom>>,
19    #[serde(rename = "area_unit", skip_serializing_if = "Option::is_none")]
20    pub area_unit: Option<models::MeasurementUnitArea>,
21    #[serde(rename = "length_unit", skip_serializing_if = "Option::is_none")]
22    pub length_unit: Option<models::MeasurementUnitLength>,
23    #[serde(rename = "volume_unit", skip_serializing_if = "Option::is_none")]
24    pub volume_unit: Option<models::MeasurementUnitVolume>,
25    #[serde(rename = "weight_unit", skip_serializing_if = "Option::is_none")]
26    pub weight_unit: Option<models::MeasurementUnitWeight>,
27    #[serde(rename = "generic_unit", skip_serializing_if = "Option::is_none")]
28    pub generic_unit: Option<models::MeasurementUnitGeneric>,
29    #[serde(rename = "time_unit", skip_serializing_if = "Option::is_none")]
30    pub time_unit: Option<models::MeasurementUnitTime>,
31    #[serde(rename = "type", skip_serializing_if = "Option::is_none")]
32    pub r#type: Option<models::MeasurementUnitUnitType>,
33}
34
35impl MeasurementUnit {
36    /// Represents a unit of measurement to use with a quantity, such as ounces or inches. Exactly one of the following fields are required: `custom_unit`, `area_unit`, `length_unit`, `volume_unit`, and `weight_unit`.
37    pub fn new() -> MeasurementUnit {
38        MeasurementUnit {
39            custom_unit: None,
40            area_unit: None,
41            length_unit: None,
42            volume_unit: None,
43            weight_unit: None,
44            generic_unit: None,
45            time_unit: None,
46            r#type: None,
47        }
48    }
49}
50