2022-11-27 14:44:43 +00:00
|
|
|
//! Module containing all info about notifications.
|
|
|
|
|
|
|
|
use super::{account::Account, status::Status};
|
|
|
|
use chrono::prelude::*;
|
2022-12-07 20:58:28 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
2022-11-27 14:44:43 +00:00
|
|
|
|
|
|
|
/// A struct containing info about a notification.
|
2022-12-27 18:01:42 +00:00
|
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
2022-12-07 20:58:28 +00:00
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
|
2022-11-27 14:44:43 +00:00
|
|
|
pub struct Notification {
|
|
|
|
/// The notification ID.
|
|
|
|
pub id: String,
|
|
|
|
/// The type of notification.
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub notification_type: NotificationType,
|
|
|
|
/// The time the notification was created.
|
|
|
|
pub created_at: DateTime<Utc>,
|
|
|
|
/// The Account sending the notification to the user.
|
|
|
|
pub account: Account,
|
|
|
|
/// The Status associated with the notification, if applicable.
|
|
|
|
pub status: Option<Status>,
|
|
|
|
}
|
|
|
|
|
|
|
|
/// The type of notification.
|
2022-12-27 18:01:06 +00:00
|
|
|
#[derive(Debug, Clone, Copy, Deserialize, Serialize, PartialEq, Eq)]
|
2022-11-27 14:44:43 +00:00
|
|
|
#[serde(rename_all = "lowercase")]
|
|
|
|
pub enum NotificationType {
|
|
|
|
/// Someone mentioned the application client in another status.
|
|
|
|
Mention,
|
|
|
|
/// Someone reblogged one of the application client's statuses.
|
|
|
|
Reblog,
|
|
|
|
/// Someone favourited one of the application client's statuses.
|
|
|
|
Favourite,
|
|
|
|
/// Someone followed the application client.
|
|
|
|
Follow,
|
|
|
|
}
|