Update
This commit is contained in:
parent
d6b28aa323
commit
5d5724cac1
1 changed files with 25 additions and 2 deletions
27
src/lib.rs
27
src/lib.rs
|
@ -283,6 +283,9 @@ struct ApiTeachersResponse {
|
||||||
data: ApiTeachersResponseData,
|
data: ApiTeachersResponseData,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
pub struct ApiProfile {}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Client {
|
pub struct Client {
|
||||||
pub api_url: url::Url,
|
pub api_url: url::Url,
|
||||||
|
@ -733,7 +736,27 @@ impl Client {
|
||||||
Ok(resp.data.elements)
|
Ok(resp.data.elements)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn exams(&self) -> Result<()> {
|
// pub async fn exams(&self) -> Result<()> {
|
||||||
Ok(())
|
// Ok(())
|
||||||
|
// }
|
||||||
|
|
||||||
|
pub async fn profile(&self) -> Result<ApiProfile> {
|
||||||
|
let resp = reqwest::Client::new()
|
||||||
|
.get(self.api_url.join("profile/general")?)
|
||||||
|
.header(reqwest::header::USER_AGENT, &self.user_agent)
|
||||||
|
.header(reqwest::header::ACCEPT, "application/json")
|
||||||
|
.header(
|
||||||
|
reqwest::header::COOKIE,
|
||||||
|
self.session.as_ref().context("Not logged in")?,
|
||||||
|
)
|
||||||
|
.header(
|
||||||
|
reqwest::header::AUTHORIZATION,
|
||||||
|
Client::construct_bearer(&self.authorization.as_ref().context("Not logged in")?),
|
||||||
|
)
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
|
dbg!(resp.text().await?);
|
||||||
|
|
||||||
|
Ok(ApiProfile {})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue