moodle_api 0.1.0

Moodle Webservice Client in Rust.
Documentation
use serde::{self, Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct Params {}

#[derive(Serialize, Deserialize, Debug)]
pub struct Returns {
    /// The current user id.
    #[serde(rename = "userid")]
    pub r#userid: Option<i64>,
    /// The number of seconds remaining in this session.
    #[serde(rename = "timeremaining")]
    pub r#timeremaining: Option<i64>,
}

pub async fn call<'a>(
    client: &'a mut moodle_client::MoodleClient,
    params: &'a mut Params,
) -> anyhow::Result<Returns> {
    let json = client.post("core_session_time_remaining", 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_session_time_remaining", params).await
}