aboutsummaryrefslogtreecommitdiff
path: root/src/api/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/mod.rs')
-rw-r--r--src/api/mod.rs14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/api/mod.rs b/src/api/mod.rs
index 27f0da1..c4aa1f7 100644
--- a/src/api/mod.rs
+++ b/src/api/mod.rs
@@ -113,7 +113,9 @@ impl Api {
/// Combines the given endpoint with the `base_url` of this API.
fn make_url(&self, endpoint: &str) -> Url {
- self.base_url.join(endpoint).expect("Invalid API endpoint")
+ let mut result = self.base_url.join(endpoint).expect("Invalid API endpoint");
+ result.set_query(Some("v=2019-19-12T0:00"));
+ result
}
/// Get and deserialize a cached value.
@@ -123,7 +125,7 @@ impl Api {
P: AsRef<Path>,
{
match self.cache.get(name.as_ref())? {
- Some(data) => Ok(serde_json::from_slice(&data)?),
+ Some(data) => serde_json::from_slice(&data).or(Ok(None)),
None => Ok(None),
}
}
@@ -208,6 +210,14 @@ impl Api {
self.get_multiple_cached("professions", "professions/", ids)
}
+ /// Retrieve all available professions.
+ ///
+ /// This is a shortcut around `get_profession_ids` and `get_professions`.
+ pub fn get_all_professions(&mut self) -> Result<Vec<Profession>, ApiError> {
+ let ids = self.get_profession_ids()?;
+ self.get_professions(&ids)
+ }
+
/// Retrieve detailed information about the given skills.
///
/// Skills that are found in the cache are taken from there.