This commit is contained in:
Dominic Grimm 2023-01-27 18:24:11 +01:00
parent 15dfc5982c
commit 171df04dad
No known key found for this signature in database
GPG Key ID: 6F294212DEAAC530
1 changed files with 26 additions and 0 deletions

View File

@ -736,4 +736,30 @@ impl Client {
Ok(resp.data.elements)
}
pub async fn student_reports(&self, class_id: i32) -> Result<()> {
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()
.get(url)
.header(reqwest::header::USER_AGENT, &self.user_agent)
.header(reqwest::header::ACCEPT, "application/json")
.header(
reqwest::header::COOKIE,
self.session.as_ref().context("Not logged in")?,
)
.header(
reqwest::header::AUTHORIZATION,
Client::construct_bearer(&self.authorization.as_ref().context("Not logged in")?),
)
.send()
.await?;
dbg!(resp.text().await?);
Ok(())
}
}