meteroid-rs 0.31.4

Official Rust SDK for Meteroid, the open-source billing platform: subscriptions, invoicing, usage-based billing and webhooks.
Documentation
// this file is @generated
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct SlotPricing {
    #[serde(skip_serializing_if = "Option::is_none")]
    pub max_slots: Option<i32>,

    #[serde(skip_serializing_if = "Option::is_none")]
    pub min_slots: Option<i32>,

    pub r#type: String,

    pub unit_rate: rust_decimal::Decimal,

    /// Properties this version of the SDK does not know, sent back as received.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, serde_json::Value>,
}

impl SlotPricing {
    /// Creates a value from its required fields.
    #[must_use]
    pub fn new(unit_rate: rust_decimal::Decimal) -> Self {
        Self {
            max_slots: None,
            min_slots: None,
            r#type: "SLOT".into(),
            unit_rate,
            extra: serde_json::Map::new(),
        }
    }

    /// Sets `max_slots`.
    #[must_use]
    pub fn max_slots(mut self, max_slots: impl Into<i32>) -> Self {
        self.max_slots = Some(max_slots.into());
        self
    }

    /// Sets `min_slots`.
    #[must_use]
    pub fn min_slots(mut self, min_slots: impl Into<i32>) -> Self {
        self.min_slots = Some(min_slots.into());
        self
    }
}