This commit is contained in:
Dominic Grimm 2023-01-27 18:45:43 +01:00
parent 25d59d5b87
commit e4b5af4d64
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530

View file

@ -748,13 +748,18 @@ impl Client {
report_params: String,
}
#[derive(Deserialize, Debug)]
struct Response {
data: Data,
}
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: Data = reqwest::Client::new()
let resp: Response = reqwest::Client::new()
.get(url)
.header(reqwest::header::USER_AGENT, &self.user_agent)
.header(reqwest::header::ACCEPT, "application/json")
@ -772,9 +777,9 @@ impl Client {
.await?;
dbg!(&resp);
if resp.error {
if resp.data.error {
bail!("Error generating report");
} else if !resp.finished {
} else if !resp.data.finished {
bail!("Report not finished");
}