use serde::{self, Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct Params {
#[serde(rename = "useridto")]
pub r#useridto: Option<i64>,
#[serde(rename = "newestfirst")]
pub r#newestfirst: Option<bool>,
#[serde(rename = "limit")]
pub r#limit: Option<i64>,
#[serde(rename = "offset")]
pub r#offset: Option<i64>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ReturnsNotificationsItem {
#[serde(rename = "id")]
pub r#id: Option<i64>,
#[serde(rename = "useridfrom")]
pub r#useridfrom: Option<i64>,
#[serde(rename = "useridto")]
pub r#useridto: Option<i64>,
#[serde(rename = "subject")]
pub r#subject: Option<String>,
#[serde(rename = "shortenedsubject")]
pub r#shortenedsubject: Option<String>,
#[serde(rename = "text")]
pub r#text: Option<String>,
#[serde(rename = "fullmessage")]
pub r#fullmessage: Option<String>,
#[serde(rename = "fullmessageformat")]
pub r#fullmessageformat: Option<i64>,
#[serde(rename = "fullmessagehtml")]
pub r#fullmessagehtml: Option<String>,
#[serde(rename = "smallmessage")]
pub r#smallmessage: Option<String>,
#[serde(rename = "contexturl")]
pub r#contexturl: Option<String>,
#[serde(rename = "contexturlname")]
pub r#contexturlname: Option<String>,
#[serde(rename = "timecreated")]
pub r#timecreated: Option<i64>,
#[serde(rename = "timecreatedpretty")]
pub r#timecreatedpretty: Option<String>,
#[serde(rename = "timeread")]
pub r#timeread: Option<i64>,
#[serde(rename = "read")]
pub r#read: Option<bool>,
#[serde(rename = "deleted")]
pub r#deleted: Option<bool>,
#[serde(rename = "iconurl")]
pub r#iconurl: Option<String>,
#[serde(rename = "component")]
pub r#component: Option<String>,
#[serde(rename = "eventtype")]
pub r#eventtype: Option<String>,
#[serde(rename = "customdata")]
pub r#customdata: Option<String>,
}
pub type r#ReturnsNotifications = Vec<ReturnsNotificationsItem>;
#[derive(Serialize, Deserialize, Debug)]
pub struct Returns {
#[serde(rename = "notifications")]
pub r#notifications: Option<r#ReturnsNotifications>,
#[serde(rename = "unreadcount")]
pub r#unreadcount: Option<i64>,
}
pub async fn call<'a>(
client: &'a mut moodle_client::MoodleClient,
params: &'a mut Params,
) -> anyhow::Result<Returns> {
let json = client
.post("message_popup_get_popup_notifications", params)
.await?;
serde_json::from_value(json).map_err(|e| e.into())
}
pub async fn call_raw<'a>(
client: &'a mut moodle_client::MoodleClient,
params: &'a mut Params,
) -> anyhow::Result<serde_json::Value> {
client
.post("message_popup_get_popup_notifications", params)
.await
}