-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Betydb functions to support new API #82
Conversation
If no auth info is provided, betydb_auth will use a default API key-- no need to pass the NULLs in by hand.
N.B. this changes return type of betydb_{trait, specie, citation, site}: Were dataframes, now lists as was documented
All existing functions should now work with API v1.
Not sure how I managed a merge conflict in an autogenerated file, but should be fixed now |
@dlebauer As currently written, I'm defaulting to the v0 API so anyone relying on previous versions can keep their old behavior, but that means regex searches always need to set api_version="beta" or they fail quietly. Switch default to |
If you can pass API version, URL, and key in options() that would make the code easier to read. I've never written a function that used this approach but it would be nice if it wasn't necessary to explicitly pass these with each function call. An alternative would be to create a list of connection parameters and pass that instead of having separate arguments. The options approach seems more elegant but the list approach seems easier to implement and maintain (mostly because it is more straightforward). What do you think? @sckott any guidance wrt best practices/ ropensci convention? |
Without presuming anything on ropensci convention, I'll note I'm usually suspicious of options as 'basically globals by another name', but then again this likely is a global preference -- the user probably wants all queries in any one session to go to the same API on the same server. How about betydb_foo(..., api_version=getOption("bety_api_version", "v0"), betyurl=getOption("bety_url", "https://www.betydb.org"), and so on? Then the defaults are sane and visible to everyone, and options are respected if set but we don't clutter up the options list for users who don't set them. |
That seems sensible, but is this preferable to passing a list connection = list(url, key, version) ? |
Probably equal, unless one's more in the ropensci spirit. |
at a meeting reply soon |
@infotroph the failed build is due to the function
|
@infotroph I think this looks good. @sckott could you merge this? I'd like to use it in a workshop Friday, and I'd prefer to use |
looks good, seems like there may be stuff at top of issue #82 (comment) that isn't done yet, open any new issues if needed |
Thanks! For the record, here are issues for the checkboxes not ticked at merge time:
|
thank |
added (Chris Black) (@infotroph) to author list based on contributions to the betydb interface (especially ropensci#94, ropensci#88, ropensci#82)
As seen in #77:
betydb_query()
betydb_record()