Skip to content

Commit

Permalink
adding default request fields to query_sb to adress DOI-USGS#193
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Winslow committed Apr 11, 2016
1 parent f88d541 commit d1ed3fb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: sbtools
Title: USGS ScienceBase Tools
Maintainer: Luke Winslow <[email protected]>
Version: 0.17.0
Version: 0.17.1
Authors@R: c(person("Luke", "Winslow", role = c("aut","cre"),
email = "[email protected]"),
person("Scott", "Chamberlain", role = c("aut"),
Expand Down
7 changes: 6 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Version 0.17.0 (2016-04-11)
# Version 0.17.1 (2016-04-10)

* Improved version of `query_sb()` now requests useful metadata so
`sbitem` list has key metadata

# Version 0.17.0 (2016-04-10)

* On `item_replace_files()` changed default on `all` flag to FALSE
so it doesn't delete files by default.
Expand Down
8 changes: 8 additions & 0 deletions R/query_sb.R
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ query_sb = function(query_list, ..., limit=20, session = current_session()){
#force JSON format
query_list['format'] = 'json'

#ensure we're querying for the bare minimum set of fields
if('fields' %in% names(query_list)){
query_list[['fields']] = paste0(query_list[['fields']], ',id,title,parentId,dateCreated,lastUpdated,createdBy,lastUpdatedBy,files')
}else{
query_list[['fields']] = 'id,title,parentId,dateCreated,lastUpdated,createdBy,lastUpdatedBy,files'
}


#we will need to set max based on limit
if(limit > 1000){
query_list['max'] = 1000
Expand Down

0 comments on commit d1ed3fb

Please sign in to comment.