This commit is contained in:
Dominic Grimm 2023-01-27 18:13:53 +01:00
parent 51c09d0e5a
commit 15dfc5982c
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530

View file

@ -3,6 +3,7 @@ use chrono::Datelike;
use cookie::Cookie; use cookie::Cookie;
use serde::Deserialize; use serde::Deserialize;
use serde_json::json; use serde_json::json;
use url::Url;
fn deserialize_date<'de, D>(deserializer: D) -> Result<chrono::NaiveDate, D::Error> fn deserialize_date<'de, D>(deserializer: D) -> Result<chrono::NaiveDate, D::Error>
where where
@ -285,8 +286,8 @@ struct ApiTeachersResponse {
#[derive(Debug)] #[derive(Debug)]
pub struct Client { pub struct Client {
pub webuntis_url: url::Url, pub webuntis_url: Url,
pub rpc_url: url::Url, pub rpc_url: Url,
pub client_name: String, pub client_name: String,
pub user_agent: String, pub user_agent: String,
pub username: String, pub username: String,
@ -296,7 +297,7 @@ pub struct Client {
} }
impl Client { impl Client {
pub fn gen_rpc_url(endpoint: url::Url, school: &str) -> Result<url::Url> { pub fn gen_rpc_url(endpoint: &Url, school: &str) -> Result<Url> {
let mut x = endpoint.join("jsonrpc.do")?; let mut x = endpoint.join("jsonrpc.do")?;
x.query_pairs_mut().append_pair("school", school); x.query_pairs_mut().append_pair("school", school);