This commit is contained in:
Dominic Grimm 2023-01-27 12:41:33 +01:00
parent d6b28aa323
commit 5d5724cac1
No known key found for this signature in database
GPG Key ID: 6F294212DEAAC530
1 changed files with 25 additions and 2 deletions

View File

@ -283,6 +283,9 @@ struct ApiTeachersResponse {
data: ApiTeachersResponseData,
}
#[derive(Deserialize, Debug)]
pub struct ApiProfile {}
#[derive(Debug)]
pub struct Client {
pub api_url: url::Url,
@ -733,7 +736,27 @@ impl Client {
Ok(resp.data.elements)
}
pub async fn exams(&self) -> Result<()> {
Ok(())
// pub async fn exams(&self) -> Result<()> {
// 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 {})
}
}