dodopayments_rust 2.2.2

Rust SDK for Dodo Payments API
Documentation
/*
 * public
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.87.0
 * 
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateProductRequest {
    /// Addons available for subscription product
    #[serde(rename = "addons", skip_serializing_if = "Option::is_none")]
    pub addons: Option<Vec<String>>,
    /// Brand id for the product, if not provided will default to primary brand
    #[serde(rename = "brand_id", skip_serializing_if = "Option::is_none")]
    pub brand_id: Option<String>,
    /// Optional credit entitlements to attach (max 3)
    #[serde(rename = "credit_entitlements", skip_serializing_if = "Option::is_none")]
    pub credit_entitlements: Option<Vec<models::AttachCreditEntitlementRequest>>,
    /// Optional description of the product
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Choose how you would like you digital product delivered
    #[serde(rename = "digital_product_delivery", skip_serializing_if = "Option::is_none")]
    pub digital_product_delivery: Option<Box<models::CreateDigitalProductDeliveryRequest>>,
    /// Optional message displayed during license key activation
    #[serde(rename = "license_key_activation_message", skip_serializing_if = "Option::is_none")]
    pub license_key_activation_message: Option<String>,
    /// The number of times the license key can be activated. Must be 0 or greater
    #[serde(rename = "license_key_activations_limit", skip_serializing_if = "Option::is_none")]
    pub license_key_activations_limit: Option<i32>,
    /// Duration configuration for the license key. Set to null if you don't want the license key to expire. For subscriptions, the lifetime of the license key is tied to the subscription period
    #[serde(rename = "license_key_duration", skip_serializing_if = "Option::is_none")]
    pub license_key_duration: Option<Box<models::LicenseKeyDuration>>,
    /// When true, generates and sends a license key to your customer. Defaults to false
    #[serde(rename = "license_key_enabled", skip_serializing_if = "Option::is_none")]
    pub license_key_enabled: Option<bool>,
    /// Additional metadata for the product
    #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
    pub metadata: Option<std::collections::HashMap<String, String>>,
    /// Name of the product
    #[serde(rename = "name")]
    pub name: String,
    /// Price configuration for the product
    #[serde(rename = "price")]
    pub price: Box<models::Price>,
    /// Tax category applied to this product
    #[serde(rename = "tax_category")]
    pub tax_category: models::TaxCategory,
}

impl CreateProductRequest {
    pub fn new(name: String, price: models::Price, tax_category: models::TaxCategory) -> CreateProductRequest {
        CreateProductRequest {
            addons: None,
            brand_id: None,
            credit_entitlements: None,
            description: None,
            digital_product_delivery: None,
            license_key_activation_message: None,
            license_key_activations_limit: None,
            license_key_duration: None,
            license_key_enabled: None,
            metadata: None,
            name,
            price: Box::new(price),
            tax_category,
        }
    }
}