Update
This commit is contained in:
parent
171df04dad
commit
80470c2fc9
1 changed files with 12 additions and 2 deletions
14
src/lib.rs
14
src/lib.rs
|
@ -738,13 +738,21 @@ impl Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn student_reports(&self, class_id: i32) -> Result<()> {
|
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")?;
|
let mut url = self.webuntis_url.join("reports.do")?;
|
||||||
url.query_pairs_mut()
|
url.query_pairs_mut()
|
||||||
.append_pair("name", "Student")
|
.append_pair("name", "Student")
|
||||||
.append_pair("format", "csv")
|
.append_pair("format", "csv")
|
||||||
.append_pair("klasseId", &class_id.to_string())
|
.append_pair("klasseId", &class_id.to_string())
|
||||||
.append_pair("studentsForDate", "true");
|
.append_pair("studentsForDate", "true");
|
||||||
let resp = reqwest::Client::new()
|
let resp: Data = reqwest::Client::new()
|
||||||
.get(url)
|
.get(url)
|
||||||
.header(reqwest::header::USER_AGENT, &self.user_agent)
|
.header(reqwest::header::USER_AGENT, &self.user_agent)
|
||||||
.header(reqwest::header::ACCEPT, "application/json")
|
.header(reqwest::header::ACCEPT, "application/json")
|
||||||
|
@ -757,8 +765,10 @@ impl Client {
|
||||||
Client::construct_bearer(&self.authorization.as_ref().context("Not logged in")?),
|
Client::construct_bearer(&self.authorization.as_ref().context("Not logged in")?),
|
||||||
)
|
)
|
||||||
.send()
|
.send()
|
||||||
|
.await?
|
||||||
|
.json()
|
||||||
.await?;
|
.await?;
|
||||||
dbg!(resp.text().await?);
|
dbg!(resp);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue