vrchatapi 1.20.8-nightly.11

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

/// NotificationV2 :
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct NotificationV2 {
    #[serde(rename = "canDelete")]
    pub can_delete: bool,
    #[serde(rename = "category")]
    pub category: String,
    #[serde(rename = "createdAt")]
    pub created_at: String,
    #[serde(rename = "data")]
    pub data: models::NotificationV2Data,
    #[serde(rename = "details", skip_serializing_if = "Option::is_none")]
    pub details: Option<models::NotificationV2DetailsBoop>,
    #[serde(rename = "expiresAt")]
    pub expires_at: String,
    #[serde(rename = "expiryAfterSeen", deserialize_with = "Option::deserialize")]
    pub expiry_after_seen: Option<i32>,
    #[serde(rename = "id")]
    pub id: String,
    #[serde(rename = "ignoreDND")]
    pub ignore_dnd: bool,
    #[serde(rename = "imageUrl", deserialize_with = "Option::deserialize")]
    pub image_url: Option<String>,
    #[serde(rename = "isSystem")]
    pub is_system: bool,
    #[serde(rename = "link")]
    pub link: String,
    #[serde(rename = "linkText")]
    pub link_text: String,
    #[serde(rename = "linkTextKey", deserialize_with = "Option::deserialize")]
    pub link_text_key: Option<String>,
    #[serde(rename = "message")]
    pub message: String,
    #[serde(
        rename = "messageKey",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub message_key: Option<Option<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 = "receiverUserId")]
    pub receiver_user_id: String,
    #[serde(
        rename = "relatedNotificationsId",
        deserialize_with = "Option::deserialize"
    )]
    pub related_notifications_id: Option<String>,
    #[serde(rename = "requireSeen")]
    pub require_seen: bool,
    #[serde(rename = "responses")]
    pub responses: Vec<models::NotificationV2Response>,
    #[serde(rename = "seen")]
    pub seen: bool,
    /// 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 = "senderUserId")]
    pub sender_user_id: String,
    #[serde(rename = "senderUsername", deserialize_with = "Option::deserialize")]
    pub sender_username: Option<String>,
    #[serde(rename = "title")]
    pub title: String,
    #[serde(rename = "titleKey", deserialize_with = "Option::deserialize")]
    pub title_key: Option<String>,
    #[serde(rename = "type")]
    pub r#type: models::NotificationV2Type,
    #[serde(rename = "updatedAt")]
    pub updated_at: String,
    #[serde(rename = "version")]
    pub version: i32,
}

impl NotificationV2 {
    pub fn new(
        can_delete: bool,
        category: String,
        created_at: String,
        data: models::NotificationV2Data,
        expires_at: String,
        expiry_after_seen: Option<i32>,
        id: String,
        ignore_dnd: bool,
        image_url: Option<String>,
        is_system: bool,
        link: String,
        link_text: String,
        link_text_key: Option<String>,
        message: String,
        receiver_user_id: String,
        related_notifications_id: Option<String>,
        require_seen: bool,
        responses: Vec<models::NotificationV2Response>,
        seen: bool,
        sender_user_id: String,
        sender_username: Option<String>,
        title: String,
        title_key: Option<String>,
        r#type: models::NotificationV2Type,
        updated_at: String,
        version: i32,
    ) -> NotificationV2 {
        NotificationV2 {
            can_delete,
            category,
            created_at,
            data,
            details: None,
            expires_at,
            expiry_after_seen,
            id,
            ignore_dnd,
            image_url,
            is_system,
            link,
            link_text,
            link_text_key,
            message,
            message_key: None,
            receiver_user_id,
            related_notifications_id,
            require_seen,
            responses,
            seen,
            sender_user_id,
            sender_username,
            title,
            title_key,
            r#type,
            updated_at,
            version,
        }
    }
}