use serde::{self, Deserialize, Serialize};
pub type r#ParamsCohortids = Vec<Option<i64>>;
#[derive(Serialize, Deserialize, Debug)]
pub struct Params {
#[serde(rename = "cohortids")]
pub r#cohortids: ParamsCohortids,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct ReturnsItemCustomfieldsItem {
#[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#ReturnsItemCustomfields = Vec<ReturnsItemCustomfieldsItem>;
#[derive(Serialize, Deserialize, Debug)]
pub struct ReturnsItem {
#[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: ReturnsItemCustomfields,
}
pub type r#Returns = Vec<ReturnsItem>;
pub async fn call<'a>(
client: &'a mut crate::client::MoodleClient,
params: &'a mut Params,
) -> anyhow::Result<Returns> {
let json = client.post("core_cohort_get_cohorts", params).await?;
serde_json::from_value(json).map_err(|e| e.into())
}