Update
This commit is contained in:
parent
b3b194cb7c
commit
e1515ea207
1 changed files with 13 additions and 6 deletions
19
src/lib.rs
19
src/lib.rs
|
@ -284,6 +284,15 @@ struct ApiTeachersResponse {
|
|||
data: ApiTeachersResponseData,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Debug)]
|
||||
pub struct ApiReportStudent {
|
||||
pub name: String,
|
||||
#[serde(rename = "longName")]
|
||||
pub long_name: String,
|
||||
#[serde(rename = "foreName")]
|
||||
pub fore_name: String,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Client {
|
||||
pub webuntis_url: Url,
|
||||
|
@ -737,7 +746,7 @@ impl Client {
|
|||
Ok(resp.data.elements)
|
||||
}
|
||||
|
||||
pub async fn student_reports(&self, class_id: i32) -> Result<()> {
|
||||
pub async fn student_reports(&self, class_id: i32) -> Result<Vec<ApiReportStudent>> {
|
||||
#[derive(Deserialize, Debug)]
|
||||
struct Data {
|
||||
finished: bool,
|
||||
|
@ -810,11 +819,9 @@ impl Client {
|
|||
let mut reader = csv::ReaderBuilder::new()
|
||||
.delimiter(b'\t')
|
||||
.from_reader(records.as_bytes());
|
||||
for record in reader.records() {
|
||||
let record = record?;
|
||||
dbg!(record);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(reader
|
||||
.deserialize::<ApiReportStudent>()
|
||||
.collect::<Result<Vec<_>, _>>()?)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue