From 80470c2fc958ee9a04be6bd80f5ca224359a7877 Mon Sep 17 00:00:00 2001 From: Dominic Grimm Date: Fri, 27 Jan 2023 18:31:44 +0100 Subject: [PATCH] Update --- src/lib.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 67419f9..7949c51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -738,13 +738,21 @@ impl Client { } pub async fn student_reports(&self, class_id: i32) -> Result<()> { + #[derive(Deserialize, Debug)] + struct Data { + finished: bool, + error: bool, + #[serde(rename = "reportParams")] + report_params: String, + } + let mut url = self.webuntis_url.join("reports.do")?; url.query_pairs_mut() .append_pair("name", "Student") .append_pair("format", "csv") .append_pair("klasseId", &class_id.to_string()) .append_pair("studentsForDate", "true"); - let resp = reqwest::Client::new() + let resp: Data = reqwest::Client::new() .get(url) .header(reqwest::header::USER_AGENT, &self.user_agent) .header(reqwest::header::ACCEPT, "application/json") @@ -757,8 +765,10 @@ impl Client { Client::construct_bearer(&self.authorization.as_ref().context("Not logged in")?), ) .send() + .await? + .json() .await?; - dbg!(resp.text().await?); + dbg!(resp); Ok(()) }