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 LicenseKey {
    /// The maximum number of activations allowed for this license key.
    #[serde(rename = "activations_limit", skip_serializing_if = "Option::is_none")]
    pub activations_limit: Option<i32>,
    /// The unique identifier of the business associated with the license key.
    #[serde(rename = "business_id")]
    pub business_id: String,
    /// The timestamp indicating when the license key was created, in UTC.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// The unique identifier of the customer associated with the license key.
    #[serde(rename = "customer_id")]
    pub customer_id: String,
    /// The timestamp indicating when the license key expires, in UTC.
    #[serde(rename = "expires_at", skip_serializing_if = "Option::is_none")]
    pub expires_at: Option<String>,
    /// The unique identifier of the license key.
    #[serde(rename = "id")]
    pub id: String,
    /// The current number of instances activated for this license key.
    #[serde(rename = "instances_count")]
    pub instances_count: i32,
    /// The license key string.
    #[serde(rename = "key")]
    pub key: String,
    /// The unique identifier of the payment associated with the license key.
    #[serde(rename = "payment_id")]
    pub payment_id: String,
    /// The unique identifier of the product associated with the license key.
    #[serde(rename = "product_id")]
    pub product_id: String,
    /// The current status of the license key (e.g., active, inactive, expired).
    #[serde(rename = "status")]
    pub status: models::LicenseKeyStatus,
    /// The unique identifier of the subscription associated with the license key, if any.
    #[serde(rename = "subscription_id", skip_serializing_if = "Option::is_none")]
    pub subscription_id: Option<String>,
    #[serde(rename = "payload_type")]
    pub payload_type: PayloadType,
}

impl LicenseKey {
    pub fn new(business_id: String, created_at: String, customer_id: String, id: String, instances_count: i32, key: String, payment_id: String, product_id: String, status: models::LicenseKeyStatus, payload_type: PayloadType) -> LicenseKey {
        LicenseKey {
            activations_limit: None,
            business_id,
            created_at,
            customer_id,
            expires_at: None,
            id,
            instances_count,
            key,
            payment_id,
            product_id,
            status,
            subscription_id: None,
            payload_type,
        }
    }
}
/// 
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PayloadType {
    #[serde(rename = "LicenseKey")]
    LicenseKey,
}

impl Default for PayloadType {
    fn default() -> PayloadType {
        Self::LicenseKey
    }
}