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

View file

@ -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 {})
} }
} }