vrchatapi 1.20.7

VRChat API Client for Rust
Documentation
/*
 * VRChat API Documentation
 *
 *
 * Contact: vrchatapi.lpv0t@aries.fyi
 * Generated by: https://openapi-generator.tech
 */

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

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProductPurchase {
    #[serde(rename = "buyerDisplayName")]
    pub buyer_display_name: String,
    /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
    #[serde(rename = "buyerId")]
    pub buyer_id: String,
    #[serde(rename = "firstParty", skip_serializing_if = "Option::is_none")]
    pub first_party: Option<bool>,
    #[serde(rename = "isBuyer")]
    pub is_buyer: bool,
    #[serde(rename = "isGift")]
    pub is_gift: bool,
    #[serde(rename = "isReceiver")]
    pub is_receiver: bool,
    #[serde(rename = "isSeller")]
    pub is_seller: bool,
    #[serde(rename = "listingCurrentlyAvailable")]
    pub listing_currently_available: bool,
    #[serde(rename = "listingDisplayName")]
    pub listing_display_name: String,
    #[serde(rename = "listingId")]
    pub listing_id: String,
    #[serde(rename = "listingImageId")]
    pub listing_image_id: String,
    #[serde(rename = "listingSubtitle")]
    pub listing_subtitle: String,
    #[serde(rename = "listingType")]
    pub listing_type: models::ProductListingType,
    #[serde(rename = "products")]
    pub products: Vec<serde_json::Value>,
    #[serde(rename = "purchaseActive")]
    pub purchase_active: bool,
    #[serde(rename = "purchaseContext")]
    pub purchase_context: models::ProductPurchasePurchaseContext,
    #[serde(rename = "purchaseCurrentStatus")]
    pub purchase_current_status: String,
    #[serde(rename = "purchaseDate")]
    pub purchase_date: String,
    #[serde(rename = "purchaseDuration", skip_serializing_if = "Option::is_none")]
    pub purchase_duration: Option<i32>,
    #[serde(
        rename = "purchaseDurationType",
        skip_serializing_if = "Option::is_none"
    )]
    pub purchase_duration_type: Option<String>,
    #[serde(rename = "purchaseEndDate")]
    pub purchase_end_date: String,
    #[serde(rename = "purchaseId")]
    pub purchase_id: String,
    #[serde(rename = "purchaseLatest")]
    pub purchase_latest: bool,
    #[serde(rename = "purchasePrice")]
    pub purchase_price: i32,
    #[serde(rename = "purchaseQuantity")]
    pub purchase_quantity: i32,
    #[serde(rename = "purchaseStartDate")]
    pub purchase_start_date: String,
    #[serde(rename = "purchaseToken", deserialize_with = "Option::deserialize")]
    pub purchase_token: Option<serde_json::Value>,
    #[serde(rename = "purchaseType")]
    pub purchase_type: String,
    #[serde(rename = "purchaseUnitPrice")]
    pub purchase_unit_price: i32,
    #[serde(rename = "receiverDisplayName")]
    pub receiver_display_name: String,
    /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
    #[serde(rename = "receiverId")]
    pub receiver_id: String,
    #[serde(rename = "recurrable")]
    pub recurrable: bool,
    #[serde(rename = "refundable")]
    pub refundable: bool,
    #[serde(rename = "sellerDisplayName")]
    pub seller_display_name: String,
    /// A users unique ID, usually in the form of `usr_c1644b5b-3ca4-45b4-97c6-a2a0de70d469`. Legacy players can have old IDs in the form of `8JoV9XEdpo`. The ID can never be changed.
    #[serde(rename = "sellerId")]
    pub seller_id: String,
    #[serde(rename = "stackable")]
    pub stackable: bool,
    #[serde(rename = "willRecur")]
    pub will_recur: bool,
}

impl ProductPurchase {
    pub fn new(
        buyer_display_name: String,
        buyer_id: String,
        is_buyer: bool,
        is_gift: bool,
        is_receiver: bool,
        is_seller: bool,
        listing_currently_available: bool,
        listing_display_name: String,
        listing_id: String,
        listing_image_id: String,
        listing_subtitle: String,
        listing_type: models::ProductListingType,
        products: Vec<serde_json::Value>,
        purchase_active: bool,
        purchase_context: models::ProductPurchasePurchaseContext,
        purchase_current_status: String,
        purchase_date: String,
        purchase_end_date: String,
        purchase_id: String,
        purchase_latest: bool,
        purchase_price: i32,
        purchase_quantity: i32,
        purchase_start_date: String,
        purchase_token: Option<serde_json::Value>,
        purchase_type: String,
        purchase_unit_price: i32,
        receiver_display_name: String,
        receiver_id: String,
        recurrable: bool,
        refundable: bool,
        seller_display_name: String,
        seller_id: String,
        stackable: bool,
        will_recur: bool,
    ) -> ProductPurchase {
        ProductPurchase {
            buyer_display_name,
            buyer_id,
            first_party: None,
            is_buyer,
            is_gift,
            is_receiver,
            is_seller,
            listing_currently_available,
            listing_display_name,
            listing_id,
            listing_image_id,
            listing_subtitle,
            listing_type,
            products,
            purchase_active,
            purchase_context,
            purchase_current_status,
            purchase_date,
            purchase_duration: None,
            purchase_duration_type: None,
            purchase_end_date,
            purchase_id,
            purchase_latest,
            purchase_price,
            purchase_quantity,
            purchase_start_date,
            purchase_token,
            purchase_type,
            purchase_unit_price,
            receiver_display_name,
            receiver_id,
            recurrable,
            refundable,
            seller_display_name,
            seller_id,
            stackable,
            will_recur,
        }
    }
}