This commit is contained in:
Candifloss 2024-09-19 16:51:57 +05:30
parent f507d0b687
commit 7506134553

View File

@ -1,13 +1,17 @@
use crate::notification::Notification; use crate::notification::Notification;
use serde_json::json; use serde_json::{json, Value};
impl Notification { impl Notification {
// Json format, useful for data exchange // Json format, useful for data exchange
pub fn json(&self) { pub fn json(&self) {
let actions = json!( // Actions
{} let actions: Value = if self.actions().is_empty() {
); "None".into()
} else {
self.actions().into()
};
json!({"actions": actions})
} }
} }