vrchatapi/models/
notification.rs

1/*
2 * VRChat API Documentation
3 *
4 *
5 * Contact: vrchatapi.lpv0t@aries.fyi
6 * Generated by: https://openapi-generator.tech
7 */
8
9use crate::models;
10use serde::{Deserialize, Serialize};
11
12/// Notification :
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct Notification {
15    #[serde(rename = "created_at")]
16    pub created_at: String,
17    /// **NOTICE:** This is not a JSON object when received from the REST API, but it is when received from the Websocket API. When received from the REST API, this is a json **encoded** object, meaning you have to json-de-encode to get the NotificationDetail object depending on the NotificationType.
18    #[serde(rename = "details")]
19    pub details: String,
20    #[serde(rename = "id")]
21    pub id: String,
22    #[serde(rename = "message")]
23    pub message: String,
24    /// Not included in notification objects received from the Websocket API
25    #[serde(rename = "seen", skip_serializing_if = "Option::is_none")]
26    pub seen: Option<bool>,
27    /// 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.
28    #[serde(rename = "receiverUserId", skip_serializing_if = "Option::is_none")]
29    pub receiver_user_id: Option<String>,
30    /// 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.
31    #[serde(rename = "senderUserId")]
32    pub sender_user_id: String,
33    /// -| **DEPRECATED:** VRChat API no longer return usernames of other users. [See issue by Tupper for more information](https://github.com/pypy-vrc/VRCX/issues/429).
34    #[serde(rename = "senderUsername", skip_serializing_if = "Option::is_none")]
35    pub sender_username: Option<String>,
36    #[serde(rename = "type")]
37    pub r#type: models::NotificationType,
38}
39
40impl Notification {
41    pub fn new(
42        created_at: String,
43        details: String,
44        id: String,
45        message: String,
46        sender_user_id: String,
47        r#type: models::NotificationType,
48    ) -> Notification {
49        Notification {
50            created_at,
51            details,
52            id,
53            message,
54            seen: None,
55            receiver_user_id: None,
56            sender_user_id,
57            sender_username: None,
58            r#type,
59        }
60    }
61}