Crates.io | moodle |
lib.rs | moodle |
version | 0.1.0 |
source | src |
created_at | 2023-09-17 19:46:43.26169 |
updated_at | 2023-09-18 17:30:13.61267 |
description | Moodle Webservice Client in Rust. |
homepage | https://github.com/JacobLinCool/moodle-rs |
repository | https://github.com/JacobLinCool/moodle-rs |
max_upload_size | |
id | 975300 |
size | 35,613 |
Moodle Webservice Client in Rust.
call_raw
to get the raw serde_json::Value
and parse it yourself.See examples.
use moodle::api::core::course::get_enrolled_courses_by_timeline_classification::{call, Params};
use moodle::client::{login, MoodleClient};
#[tokio::main]
async fn main() {
let base_url = std::env::var("MOODLE_URL").unwrap();
let username = std::env::var("MOODLE_USERNAME").unwrap();
let password = std::env::var("MOODLE_PASSWORD").unwrap();
let token = login(&base_url, &username, &password).await.unwrap();
let mut client = MoodleClient::new(&base_url, &token);
let result = call(
&mut client,
&mut Params {
classification: Some("all".to_string()),
limit: Some(3),
offset: Some(0),
sort: None,
customfieldname: None,
customfieldvalue: None,
searchvalue: None,
},
)
.await;
println!("{:#?}", result);
}