From 9f4a4eaa06f3d0136de9088c0e60a0c077248c91 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Fri, 20 Dec 2019 18:04:24 +0100 Subject: remove hard coded palette IDs Now that the API actually returns the proper palette IDs, we can use those values instead of relying on the hard coded values. This also gets rid of the make_table script that was mostly hackish anyway, and the lazy static HashMap. --- src/api/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/api/mod.rs') diff --git a/src/api/mod.rs b/src/api/mod.rs index ffed5ea..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. @@ -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, 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. -- cgit v1.2.3