diff options
author | Daniel Schadt <kingdread@gmx.de> | 2019-12-20 18:04:24 +0100 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2019-12-20 18:04:24 +0100 |
commit | 9f4a4eaa06f3d0136de9088c0e60a0c077248c91 (patch) | |
tree | 4ab0e0c9f5910643ac6404c390e6aa6fad4ca470 /src/api/mod.rs | |
parent | 087580b3c269dbc5b2298ff6f4590f010279d339 (diff) | |
download | kondou-9f4a4eaa06f3d0136de9088c0e60a0c077248c91.tar.gz kondou-9f4a4eaa06f3d0136de9088c0e60a0c077248c91.tar.bz2 kondou-9f4a4eaa06f3d0136de9088c0e60a0c077248c91.zip |
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.
Diffstat (limited to 'src/api/mod.rs')
-rw-r--r-- | src/api/mod.rs | 12 |
1 files changed, 11 insertions, 1 deletions
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<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. |