This commit is contained in:
Dominic Grimm 2023-01-27 12:57:03 +01:00
parent 00cabc308d
commit 0ad1739d4f
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530

View file

@ -283,9 +283,6 @@ struct ApiTeachersResponse {
data: ApiTeachersResponseData,
}
#[derive(Deserialize, Debug)]
pub struct ApiProfile {}
#[derive(Debug)]
pub struct Client {
pub api_url: url::Url,
@ -736,6 +733,39 @@ impl Client {
Ok(resp.data.elements)
}
pub async fn students(&self) -> Result<()> {
let resp = reqwest::Client::new()
.get(self.rpc_url.as_str())
.header(reqwest::header::USER_AGENT, &self.user_agent)
.header(reqwest::header::CONTENT_TYPE, "application/json")
.header(reqwest::header::ACCEPT, "application/json")
.header(
reqwest::header::COOKIE,
self.session.as_ref().context("Not logged in")?,
)
.json(&json!({
"id": "ID",
"method": "getStudents",
"params": {},
"jsonrpc": "2.0"
}))
.send()
.await?;
// .json()
// .await?;
// if let Some(e) = resp.error {
// bail!("RPC error: {:?}", e);
// }
dbg!(resp.text().await?);
// if let Some(x) = resp.result {
// Ok(x)
// } else {
// bail!("RPC result is null");
// }
Ok(())
}
// pub async fn exams(&self) -> Result<()> {
// Ok(())
// }