vrchatapi 1.20.8-nightly.11

VRChat API Client for Rust
Documentation
use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProductListing {
    #[serde(rename = "active")]
    pub active: bool,
    #[serde(rename = "buyerRefundable")]
    pub buyer_refundable: bool,
    #[serde(rename = "description")]
    pub description: String,
    #[serde(rename = "displayName")]
    pub display_name: String,
    #[serde(
        rename = "duration",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub duration: Option<Option<i32>>,
    #[serde(
        rename = "durationType",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub duration_type: Option<Option<String>>,
    #[serde(rename = "groupIcon", skip_serializing_if = "Option::is_none")]
    pub group_icon: Option<String>,
    #[serde(rename = "groupId", skip_serializing_if = "Option::is_none")]
    pub group_id: Option<String>,
    #[serde(
        rename = "groupName",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub group_name: Option<Option<String>>,
    #[serde(rename = "hasAvatar")]
    pub has_avatar: bool,
    #[serde(rename = "hasUdon")]
    pub has_udon: bool,
    #[serde(rename = "hydratedProducts", skip_serializing_if = "Option::is_none")]
    pub hydrated_products: Option<Vec<models::Product>>,
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "imageId", skip_serializing_if = "Option::is_none")]
    pub image_id: Option<String>,
    #[serde(
        rename = "imageUrl",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub image_url: Option<Option<String>>,
    #[serde(rename = "listingType")]
    pub listing_type: models::ProductListingType,
    #[serde(rename = "listingVariants", skip_serializing_if = "Option::is_none")]
    pub listing_variants: Option<Vec<models::ProductListingVariant>>,
    #[serde(rename = "permanent", skip_serializing_if = "Option::is_none")]
    pub permanent: Option<bool>,
    #[serde(rename = "priceTokens")]
    pub price_tokens: i32,
    #[serde(rename = "productIds")]
    pub product_ids: Vec<String>,
    #[serde(rename = "productType")]
    pub product_type: models::ProductType,
    #[serde(rename = "products")]
    pub products: Vec<serde_json::Value>,
    #[serde(rename = "quantifiable", skip_serializing_if = "Option::is_none")]
    pub quantifiable: Option<bool>,
    #[serde(rename = "recurrable")]
    pub recurrable: bool,
    #[serde(rename = "refundable")]
    pub refundable: bool,
    #[serde(rename = "sellerDisplayName")]
    pub seller_display_name: String,
    #[serde(rename = "sellerId")]
    pub seller_id: String,
    #[serde(rename = "soldByVrc", skip_serializing_if = "Option::is_none")]
    pub sold_by_vrc: Option<bool>,
    #[serde(rename = "stackable")]
    pub stackable: bool,
    #[serde(rename = "storeIds")]
    pub store_ids: Vec<String>,
    #[serde(rename = "subtitle", skip_serializing_if = "Option::is_none")]
    pub subtitle: Option<String>,
    #[serde(rename = "tags", skip_serializing_if = "Option::is_none")]
    pub tags: Option<Vec<String>>,
    #[serde(
        rename = "vrcPlusDiscountPrice",
        skip_serializing_if = "Option::is_none"
    )]
    pub vrc_plus_discount_price: Option<i32>,
    #[serde(
        rename = "whenToExpire",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub when_to_expire: Option<Option<String>>,
}

impl ProductListing {
    pub fn new(
        active: bool,
        buyer_refundable: bool,
        description: String,
        display_name: String,
        has_avatar: bool,
        has_udon: bool,
        id: String,
        listing_type: models::ProductListingType,
        price_tokens: i32,
        product_ids: Vec<String>,
        product_type: models::ProductType,
        products: Vec<serde_json::Value>,
        recurrable: bool,
        refundable: bool,
        seller_display_name: String,
        seller_id: String,
        stackable: bool,
        store_ids: Vec<String>,
    ) -> ProductListing {
        ProductListing {
            active,
            buyer_refundable,
            description,
            display_name,
            duration: None,
            duration_type: None,
            group_icon: None,
            group_id: None,
            group_name: None,
            has_avatar,
            has_udon,
            hydrated_products: None,
            id,
            image_id: None,
            image_url: None,
            listing_type,
            listing_variants: None,
            permanent: None,
            price_tokens,
            product_ids,
            product_type,
            products,
            quantifiable: None,
            recurrable,
            refundable,
            seller_display_name,
            seller_id,
            sold_by_vrc: None,
            stackable,
            store_ids,
            subtitle: None,
            tags: None,
            vrc_plus_discount_price: None,
            when_to_expire: None,
        }
    }
}