Skip to content

Remove strings from functions where data is in key/value format#12

Open
kcranky wants to merge 8 commits intoJoeyStrandnes:masterfrom
kcranky:RemoveStrings
Open

Remove strings from functions where data is in key/value format#12
kcranky wants to merge 8 commits intoJoeyStrandnes:masterfrom
kcranky:RemoveStrings

Conversation

@kcranky
Copy link
Contributor

@kcranky kcranky commented Apr 5, 2021

This patch simplifies GET requests that return key/value pairs.
Further discussion can be found at Issue #7

Added:

  • Two new structs, KVPair and KVReturn
  • 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.

@JoeyStrandnes JoeyStrandnes self-assigned this Apr 7, 2021
@kcranky kcranky changed the title Remove strings from functions that data that is in key/value format Remove strings from functions where data is in key/value format Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants