Update
This commit is contained in:
parent
25d59d5b87
commit
e4b5af4d64
1 changed files with 8 additions and 3 deletions
11
src/lib.rs
11
src/lib.rs
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue