use serde::{self, Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct ParamsContext {
#[serde(rename = "contextid")]
pub r#contextid: Option<i64>,
#[serde(rename = "contextlevel")]
pub r#contextlevel: Option<String>,
#[serde(rename = "instanceid")]
pub r#instanceid: Option<i64>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct Params {
#[serde(rename = "query")]
pub r#query: Option<String>,
#[serde(rename = "context")]
pub r#context: Option<ParamsContext>,
#[serde(rename = "includes")]
pub r#includes: Option<String>,
#[serde(rename = "limitfrom")]
pub r#limitfrom: Option<i64>,
#[serde(rename = "limitnum")]
pub r#limitnum: Option<i64>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ReturnsCohortsItemCustomfieldsItem {
#[serde(rename = "name")]
pub r#name: Option<String>,
#[serde(rename = "shortname")]
pub r#shortname: Option<String>,
#[serde(rename = "type")]
pub r#type: Option<String>,
#[serde(rename = "valueraw")]
pub r#valueraw: Option<String>,
#[serde(rename = "value")]
pub r#value: Option<String>,
}
pub type r#ReturnsCohortsItemCustomfields = Vec<ReturnsCohortsItemCustomfieldsItem>;
#[derive(Serialize, Deserialize, Debug)]
pub struct ReturnsCohortsItem {
#[serde(rename = "id")]
pub r#id: Option<i64>,
#[serde(rename = "name")]
pub r#name: Option<String>,
#[serde(rename = "idnumber")]
pub r#idnumber: Option<String>,
#[serde(rename = "description")]
pub r#description: Option<String>,
#[serde(rename = "descriptionformat")]
pub r#descriptionformat: Option<i64>,
#[serde(rename = "visible")]
pub r#visible: Option<bool>,
#[serde(rename = "theme")]
pub r#theme: Option<String>,
#[serde(rename = "customfields")]
pub r#customfields: Option<r#ReturnsCohortsItemCustomfields>,
}
pub type r#ReturnsCohorts = Vec<ReturnsCohortsItem>;
#[derive(Serialize, Deserialize, Debug)]
pub struct Returns {
#[serde(rename = "cohorts")]
pub r#cohorts: Option<r#ReturnsCohorts>,
}
pub async fn call<'a>(
client: &'a mut moodle_client::MoodleClient,
params: &'a mut Params,
) -> anyhow::Result<Returns> {
let json = client.post("tool_lp_search_cohorts", 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("tool_lp_search_cohorts", params).await
}