artifacts-rs 1.7.3

Rust client for Artifacts
Documentation
use crate::models;
use serde::{Deserialize, Serialize};

/// PendingItemSchema : Schema for pending items that can be claimed by any character.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct PendingItemSchema {
    /// Pending item ID.
    #[serde(rename = "id")]
    pub id: String,
    /// Account username.
    #[serde(rename = "account")]
    pub account: String,
    /// Source of the pending item.
    #[serde(rename = "source")]
    pub source: models::PendingItemSource,
    /// ID reference for the source (e.g., achievement code, order id).
    #[serde(rename = "source_id", skip_serializing_if = "Option::is_none")]
    pub source_id: Option<String>,
    /// Description for display.
    #[serde(rename = "description")]
    pub description: String,
    /// Gold amount.
    #[serde(rename = "gold", skip_serializing_if = "Option::is_none")]
    pub gold: Option<i32>,
    /// List of items to be claimed.
    #[serde(rename = "items", skip_serializing_if = "Option::is_none")]
    pub items: Option<Vec<models::SimpleItemSchema>>,
    /// When the pending item was created.
    #[serde(rename = "created_at")]
    pub created_at: String,
    /// When the pending item was claimed.
    #[serde(rename = "claimed_at", skip_serializing_if = "Option::is_none")]
    pub claimed_at: Option<String>,
}

impl PendingItemSchema {
    /// Schema for pending items that can be claimed by any character.
    pub fn new(
        id: String,
        account: String,
        source: models::PendingItemSource,
        description: String,
        created_at: String,
    ) -> PendingItemSchema {
        PendingItemSchema {
            id,
            account,
            source,
            source_id: None,
            description,
            gold: None,
            items: None,
            created_at,
            claimed_at: None,
        }
    }
}