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 GetProductResponse {
    /// Available Addons for subscription products
    #[serde(rename = "addons", skip_serializing_if = "Option::is_none")]
    pub addons: Option<Vec<String>>,
    #[serde(rename = "brand_id")]
    pub brand_id: String,
    /// Unique identifier for the business to which the product belongs.
    #[serde(rename = "business_id")]
    pub business_id: String,
    /// Timestamp when the product was created.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// Attached credit entitlements with settings
    #[serde(rename = "credit_entitlements")]
    pub credit_entitlements: Vec<models::CreditEntitlementMappingResponse>,
    /// Description of the product, optional.
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(rename = "digital_product_delivery", skip_serializing_if = "Option::is_none")]
    pub digital_product_delivery: Option<Box<models::DigitalProductDelivery>>,
    /// URL of the product image, optional.
    #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
    pub image: Option<String>,
    /// Indicates if the product is recurring (e.g., subscriptions).
    #[serde(rename = "is_recurring")]
    pub is_recurring: bool,
    /// Message sent upon license key activation, if applicable.
    #[serde(rename = "license_key_activation_message", skip_serializing_if = "Option::is_none")]
    pub license_key_activation_message: Option<String>,
    /// Limit on the number of activations for the license key, if enabled.
    #[serde(rename = "license_key_activations_limit", skip_serializing_if = "Option::is_none")]
    pub license_key_activations_limit: Option<i32>,
    /// Duration of the license key validity, if enabled.
    #[serde(rename = "license_key_duration", skip_serializing_if = "Option::is_none")]
    pub license_key_duration: Option<Box<models::LicenseKeyDuration>>,
    /// Indicates whether the product requires a license key.
    #[serde(rename = "license_key_enabled")]
    pub license_key_enabled: bool,
    /// Additional custom data associated with the product
    #[serde(rename = "metadata")]
    pub metadata: std::collections::HashMap<String, String>,
    /// Name of the product, optional.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// Pricing information for the product.
    #[serde(rename = "price")]
    pub price: Box<models::Price>,
    /// The product collection ID this product belongs to, if any
    #[serde(rename = "product_collection_id", skip_serializing_if = "Option::is_none")]
    pub product_collection_id: Option<String>,
    /// Unique identifier for the product.
    #[serde(rename = "product_id")]
    pub product_id: String,
    /// Tax category associated with the product.
    #[serde(rename = "tax_category")]
    pub tax_category: models::TaxCategory,
    /// Timestamp when the product was last updated.
    #[serde(rename = "updated_at")]
    pub updated_at: String,
}

impl GetProductResponse {
    pub fn new(brand_id: String, business_id: String, created_at: String, credit_entitlements: Vec<models::CreditEntitlementMappingResponse>, is_recurring: bool, license_key_enabled: bool, metadata: std::collections::HashMap<String, String>, price: models::Price, product_id: String, tax_category: models::TaxCategory, updated_at: String) -> GetProductResponse {
        GetProductResponse {
            addons: None,
            brand_id,
            business_id,
            created_at,
            credit_entitlements,
            description: None,
            digital_product_delivery: None,
            image: None,
            is_recurring,
            license_key_activation_message: None,
            license_key_activations_limit: None,
            license_key_duration: None,
            license_key_enabled,
            metadata,
            name: None,
            price: Box::new(price),
            product_collection_id: None,
            product_id,
            tax_category,
            updated_at,
        }
    }
}