Struct libbklrs::BklrClient
source · pub struct BklrClient { /* private fields */ }
Expand description
Provides an interface to the school API.
§Examples
let api = BklrClient::new().unwrap();
let timetable = api.get_timetable().await.unwrap();
Implementations§
source§impl BklrClient
impl BklrClient
sourcepub async fn new(
username: &str,
password: &str,
url: &str
) -> Result<BklrClient, APIError>
pub async fn new( username: &str, password: &str, url: &str ) -> Result<BklrClient, APIError>
Constructs a new API client.
§Examples
let api = BklrClient::new().unwrap_or_else(|err| {
panic!("Error while constructing API client: {err}");
});
§Errors
This method fails when an invalid URL is provided, incorrect info is provided, or when the API is unavailable, most likely due to a connection issue.
sourcepub async fn get_timetable(&self) -> Result<Timetable, APIError>
pub async fn get_timetable(&self) -> Result<Timetable, APIError>
Attempts to fetch the timetable. Fails on API error, or a connection error.
Auto Trait Implementations§
impl !RefUnwindSafe for BklrClient
impl Send for BklrClient
impl Sync for BklrClient
impl Unpin for BklrClient
impl !UnwindSafe for BklrClient
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more