sellapp-sdk 0.1.1

Official Rust SDK for the SellApp API: manage products, orders, subscriptions, and customers.
// This file is auto-generated by oagen. Do not edit.

#[allow(unused_imports)]
use super::*;
#[allow(unused_imports)]
use crate::enums::*;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(remote = "Self")]
pub struct SdkCreateAddOnDraftRequestApplicationJson {
    /// Seller-facing title for the add-on.
    pub title: String,
    /// Optional store-unique slug. When omitted during creation, SellApp generates one from the title.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub slug: Option<String>,
    /// Description shown when the add-on is offered.
    pub description: String,
    pub visibility: CatalogVisibility,
    /// Defaults to true on creation. Set false to publish. Publication requires exactly one published, fixed-price, single-payment variant; creation can include that variant in the same request.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub is_draft: Option<bool>,
    /// Ordered IDs of same-store, non-subscription products, courses, or bookings to assign. Supplying the field replaces the complete assignment set.
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub parent_product_ids: Option<Vec<i64>>,
    #[serde(skip_serializing_if = "Option::is_none", default)]
    pub variant: Option<CreateAddOnDraftRequestApplicationJsonPropertyVariant>,
    /// Fields returned by a newer API version that are not yet known to this SDK.
    #[serde(default, flatten)]
    pub additional_properties: std::collections::HashMap<String, serde_json::Value>,
}
impl Serialize for SdkCreateAddOnDraftRequestApplicationJson {
    fn serialize<S: serde::Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
        Self::serialize(self, serializer)
    }
}
impl<'de> Deserialize<'de> for SdkCreateAddOnDraftRequestApplicationJson {
    fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
        let mut value = serde_json::Value::deserialize(deserializer)?;
        crate::runtime_schema::model(&value, "SdkCreateAddOnDraftRequestApplicationJson", false)
            .map_err(serde::de::Error::custom)?;
        crate::runtime_schema::retain_model_fields(
            &mut value,
            "SdkCreateAddOnDraftRequestApplicationJson",
        );
        Self::deserialize(value).map_err(serde::de::Error::custom)
    }
}
impl SdkCreateAddOnDraftRequestApplicationJson {
    /// Validate the serialized request, including schema constraints and compatibility rules.
    pub fn validate_request(&self) -> Result<(), crate::error::Error> {
        let value = serde_json::to_value(self)
            .map_err(|e| crate::error::Error::Serialization(e.to_string()))?;
        crate::runtime_schema::model(&value, "SdkCreateAddOnDraftRequestApplicationJson", true)
    }
}