moodle_api/tool/mobile/
get_config.rs1use serde::{self, Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize, Debug)]
4pub struct Params {
5 #[serde(rename = "section")]
7 pub r#section: Option<String>,
8}
9
10#[derive(Serialize, Deserialize, Debug)]
11pub struct ReturnsSettingsItem {
12 #[serde(rename = "name")]
14 pub r#name: Option<String>,
15 #[serde(rename = "value")]
17 pub r#value: Option<String>,
18}
19
20pub type r#ReturnsSettings = Vec<ReturnsSettingsItem>;
22
23#[derive(Serialize, Deserialize, Debug)]
25pub struct ReturnsWarningsItem {
26 #[serde(rename = "item")]
28 pub r#item: Option<String>,
29 #[serde(rename = "itemid")]
31 pub r#itemid: Option<i64>,
32 #[serde(rename = "warningcode")]
34 pub r#warningcode: Option<String>,
35 #[serde(rename = "message")]
37 pub r#message: Option<String>,
38}
39
40pub type r#ReturnsWarnings = Vec<ReturnsWarningsItem>;
42
43#[derive(Serialize, Deserialize, Debug)]
44pub struct Returns {
45 #[serde(rename = "settings")]
47 pub r#settings: Option<r#ReturnsSettings>,
48 #[serde(rename = "warnings")]
50 pub r#warnings: Option<r#ReturnsWarnings>,
51}
52
53pub async fn call<'a>(
54 client: &'a mut moodle_client::MoodleClient,
55 params: &'a mut Params,
56) -> anyhow::Result<Returns> {
57 let json = client.post("tool_mobile_get_config", params).await?;
58
59 serde_json::from_value(json).map_err(|e| e.into())
60}
61
62pub async fn call_raw<'a>(
63 client: &'a mut moodle_client::MoodleClient,
64 params: &'a mut Params,
65) -> anyhow::Result<serde_json::Value> {
66 client.post("tool_mobile_get_config", params).await
67}