amazon-spapi 2.0.3

A Rust client library for Amazon Selling Partner API (SP-API)
Documentation
/*
 * Selling Partner API for Retail Procurement Orders
 *
 * The Selling Partner API for Retail Procurement Orders provides programmatic access to vendor orders data.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// Money : An amount of money. Includes the currency code and an optional unit of measure for items priced by weight.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Money {
    /// Three digit currency code in ISO 4217 format. String of length 3.
    #[serde(rename = "currencyCode", skip_serializing_if = "Option::is_none")]
    pub currency_code: Option<String>,
    /// 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+)?$`.
    #[serde(rename = "amount", skip_serializing_if = "Option::is_none")]
    pub amount: Option<String>,
    /// The unit of measure for prices of items sold by weight. If this field is absent, the item is sold by eaches.
    #[serde(rename = "unitOfMeasure", skip_serializing_if = "Option::is_none")]
    pub unit_of_measure: Option<UnitOfMeasure>,
}

impl Money {
    /// An amount of money. Includes the currency code and an optional unit of measure for items priced by weight.
    pub fn new() -> Money {
        Money {
            currency_code: None,
            amount: None,
            unit_of_measure: None,
        }
    }
}
/// The unit of measure for prices of items sold by weight. If this field is absent, the item is sold by eaches.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum UnitOfMeasure {
    #[serde(rename = "POUNDS")]
    Pounds,
    #[serde(rename = "OUNCES")]
    Ounces,
    #[serde(rename = "GRAMS")]
    Grams,
    #[serde(rename = "KILOGRAMS")]
    Kilograms,
}

impl Default for UnitOfMeasure {
    fn default() -> UnitOfMeasure {
        Self::Pounds
    }
}