A new function void getKVPairs(String const URL, KVReturn &data); that takes in an API endpoint and a KVReturn struct. This means there is only one function to maintain for any API endpoint that returns simple key/value pairs.
Method for getting all tags (this is the beauty of getKVPairs!)
A new example showing the functionality and use of these methods.
Modified:
Updated README to include new information.
Changed getProject to getProjects and getWorkspace to getWorkspaces. This is so that pre-existing users of the library are "forced" to take note of the change, as it is not backwards compatible.
The correct approach here I suppose would be to leave the existing functions in and have this patch (along with the existing functions) as 1.3. Then when a version 2 comes around, remove getProject and getWorkspace? This is all up to you though of course, just listing my thoughts.
Verification:
Tested the new provided example on both a NodeMCU ESP8266 and NodeMCU ESP32-S from the Arduino IDE. Both produce the expected results for multiple workspaces and projects.
This patch simplifies GET requests that return key/value pairs. Further discussion can be found at Issue https://github.com/JoeyStrandnes/Arduino-Toggl-API/issues/7
Added:
KVPair
andKVReturn
void getKVPairs(String const URL, KVReturn &data);
that takes in an API endpoint and a KVReturn struct. This means there is only one function to maintain for any API endpoint that returns simple key/value pairs.getKVPairs
!)Modified:
getProject
togetProjects
andgetWorkspace
togetWorkspaces
. This is so that pre-existing users of the library are "forced" to take note of the change, as it is not backwards compatible.getProject
andgetWorkspace
? This is all up to you though of course, just listing my thoughts.Verification: