use serde::{self, Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct ParamsCommentsItem {
#[serde(rename = "contextlevel")]
pub r#contextlevel: Option<String>,
#[serde(rename = "instanceid")]
pub r#instanceid: Option<i64>,
#[serde(rename = "component")]
pub r#component: Option<String>,
#[serde(rename = "content")]
pub r#content: Option<String>,
#[serde(rename = "itemid")]
pub r#itemid: Option<i64>,
#[serde(rename = "area")]
pub r#area: Option<String>,
}
pub type r#ParamsComments = Vec<ParamsCommentsItem>;
#[derive(Serialize, Deserialize, Debug)]
pub struct Params {
#[serde(rename = "comments")]
pub r#comments: Option<r#ParamsComments>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ReturnsItem {
#[serde(rename = "id")]
pub r#id: Option<i64>,
#[serde(rename = "content")]
pub r#content: Option<String>,
#[serde(rename = "format")]
pub r#format: Option<i64>,
#[serde(rename = "timecreated")]
pub r#timecreated: Option<i64>,
#[serde(rename = "strftimeformat")]
pub r#strftimeformat: Option<String>,
#[serde(rename = "profileurl")]
pub r#profileurl: Option<String>,
#[serde(rename = "fullname")]
pub r#fullname: Option<String>,
#[serde(rename = "time")]
pub r#time: Option<String>,
#[serde(rename = "avatar")]
pub r#avatar: Option<String>,
#[serde(rename = "userid")]
pub r#userid: Option<i64>,
#[serde(rename = "delete")]
pub r#delete: Option<bool>,
}
pub type r#Returns = Vec<ReturnsItem>;
pub async fn call<'a>(
client: &'a mut moodle_client::MoodleClient,
params: &'a mut Params,
) -> anyhow::Result<Returns> {
let json = client.post("core_comment_add_comments", 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("core_comment_add_comments", params).await
}