diff options
author | Santo Cariotti <santo@dcariotti.me> | 2021-08-05 20:33:14 +0200 |
---|---|---|
committer | Santo Cariotti <santo@dcariotti.me> | 2021-08-05 20:33:14 +0200 |
commit | 5ddacf8e8131bacbcbd360b24c4c45b5380678ee (patch) | |
tree | 7ffb5aeb9adca95aaf344ae68d810c9456f01a4c /src/browser/mod.rs | |
parent | 0ef059378e3b10c0eebcbb4e5abc0e033f06cd25 (diff) |
feat: get spaces of a faculty
Diffstat (limited to 'src/browser/mod.rs')
-rw-r--r-- | src/browser/mod.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/browser/mod.rs b/src/browser/mod.rs index 1675595..1f44493 100644 --- a/src/browser/mod.rs +++ b/src/browser/mod.rs @@ -35,6 +35,17 @@ pub async unsafe fn get_faculties() -> WebDriverResult<Option<HashMap<String, St Ok(None) } +/// Get the spaces (rooms) available to book +pub async unsafe fn get_spaces() -> WebDriverResult<Option<HashMap<String, String>>> { + if let Some(driver) = &WEB_BROWSER { + if let Some(spaces) = driver.spaces().await? { + return Ok(Some(spaces)); + } + } + + Ok(None) +} + pub async unsafe fn select_option( klass: &str, property_name: &str, |