Update
This commit is contained in:
parent
00cabc308d
commit
0ad1739d4f
1 changed files with 33 additions and 3 deletions
36
src/lib.rs
36
src/lib.rs
|
@ -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(())
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue