-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
With this code:
fn main() -> Result<(), untis::Error> {
// Get the school by its id.
let school = untis::schools::get_by_id(&[redacted])?;
// Log in with your credentials. The school's details are filled in automatically.
let result = school.client_login(
"[redacted]",
"[redacted]",
);
let mut client: untis::Client;
// Match the result to handle specific error cases.
match result {
Ok(v) => client = v,
Err(untis::Error::Rpc(err)) => {
if err.code == untis::jsonrpc::ErrorCode::InvalidCredentials.as_isize() {
println!("Invalid credentials");
}
return Err(untis::Error::Rpc(err));
}
Err(err) => return Err(err)?,
};
println!("hehe");
let date = chrono::Local::now().date_naive() + chrono::Duration::weeks(2);
// Get the client's own timetable until 2 weeks from now.
let timetable = client.own_timetable_for_week(&date.into())?;
for lesson in timetable {
println!("{:?}", lesson);
}
Ok(())
}
I receive the error Error: Rpc(Error { code: -7004, message: "no allowed date" })
. Currently there is no active schooljear, but in two weeks there is and data for in two weeks already exists.
Metadata
Metadata
Assignees
Labels
No labels