Skip to content

Commit

Permalink
Merge pull request #19 from IntegratedBreedingPlatform/fix-v2-searchR…
Browse files Browse the repository at this point in the history
…esultsDbId

Fix v2 searchResultDbId > searchResultsDbId
  • Loading branch information
MFlores2021 authored Oct 12, 2021
2 parents 5ab54d3 + 4a4acf4 commit 5802afa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ This method registers a callback function which is called once a node has loaded
| _node_.search_calls(_params_,...)||`/search/calls` | `POST-->GET` |
| _node_.search_callsets(_params_,...)||`/search/callsets` | `POST-->GET` |
| _node_.search_germplasm(_params_,...) | `/germplasm-search` | `/search/germplasm` | `POST-->GET` |
| _node_.search_GET(_entity_, _params_,...)| `/search/{entity}/{searchResultDbId}` | | `GET` |
| _node_.search_GET(_entity_, _params_,...)| `/search/{entity}/{searchResultDbId}` | `/search/{entity}/{searchResultsDbId}` | `GET` |
| _node_.search_images(_params_,...) | `/search/images` | `/search/images` | `POST-->GET` |
| _node_.search_lists(_params_,...)||`/search/lists` | `POST-->GET` |
| _node_.search_locations(_params_,...)||`/search/locations` | `POST-->GET` |
Expand All @@ -332,7 +332,7 @@ This method registers a callback function which is called once a node has loaded
| _node_.search_trials(_params_,...)||`/search/trials` | `POST-->GET` |
| _node_.search_variants(_params_,...)||`/search/variants` | `POST-->GET` |
| _node_.search_variantsets(_params_,...)||`/search/variantsets` | `POST-->GET` |
| _node_.search(_entity_, _params_,...) | `/search/{entity-->search/{entity}/{searchResultDbId}` | | `POST-->GET` |
| _node_.search(_entity_, _params_,...) | `/search/{entity-->search/{entity}/{searchResultDbId}` | `/search/{entity-->search/{entity}/{searchResultsDbId}` | `POST-->GET` |
| _node_.seasons_detail(_params_,...)||`/seasons/{seasonDbId}` | `GET` |
| _node_.seasons_modify(_params_,...)||`/seasons/{seasonDbId}` | `PUT` |
| _node_.seasons_store(_params_,...)||`/seasons` | `POST` |
Expand Down Expand Up @@ -388,4 +388,4 @@ This method registers a callback function which is called once a node has loaded
| _node_.vendor_plates_detail(_params_,...) | `/vendor/plates/{submissionId}` | `/vendor/plates/{submissionId}` | `GET` |
| _node_.vendor_plates_search(_params_,...) | `/vendor/plates-search`(>=v1.2) or `/vendor/plate-search`(<v1.2) || `POST` |
| _node_.vendor_plates(_params_,...) | `/vendor/plates` | `/vendor/plates` | `POST` |
| _node_.vendor_specifications(_params_,...) | `/vendor/specifications` | `/vendor/specifications` | `GET` |
| _node_.vendor_specifications(_params_,...) | `/vendor/specifications` | `/vendor/specifications` | `GET` |
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@solgenomics/brapijs",
"version": "1.0.2",
"version": "2.0.1",
"description": "BrAPI.js is a JavaScript client library for [BrAPI](https://brapi.org). It can be used either in the browser or within Node.js. It uses the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (or [node-fetch]() in Node.js) for AJAX calls. BrAPI.js also uses ES6 classes.",
"bugs": {
"url": "https://github.com/solgenomics/BrAPI.js/issues"
Expand Down
9 changes: 5 additions & 4 deletions src/brapi_methods/search.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** `POST /search/{entity} then GET /search/{entity}/{searchResultDbId}`
/** `POST /search/{entity} then GET /search/{entity}/{searchResultsDbId}`
* @alias BrAPINode.prototype.search
* @param {String} entity Entity type to search over
* @param {Object} params Parameters to provide to the call
Expand All @@ -18,7 +18,8 @@ export function search(entity,params,behavior){
});
return param_map.join(search_ids).search_GET(entity,function(joined){
var get_params = {};
get_params.searchResultDbId = joined[1].searchResultDbId;
// searchResultDbId for v1 compatibility
get_params.searchResultsDbId = joined[1].searchResultsDbId || joined[1].searchResultDbId;
if(joined[0].page!=undefined) get_params.page = joined[0].page;
if(joined[0].pageRange!=undefined) get_params.pageRange = joined[0].pageRange;
if(joined[0].pageSize!=undefined) get_params.pageSize = joined[0].pageSize;
Expand All @@ -41,7 +42,7 @@ export function search_POST(entity,params){
}
return this.simple_brapi_call(call);
};
/** `GET /search/{entity}/{searchResultDbId}`
/** `GET /search/{entity}/{searchResultsDbId}`
* @alias BrAPINode.prototype.search_GET
* @param {String} entity Entity type to search over
* @param {Object} params Parameters to provide to the call
Expand All @@ -51,7 +52,7 @@ export function search_POST(entity,params){
export function search_GET(entity,params,behavior){
var call = {
'defaultMethod': 'get',
'urlTemplate': '/search/'+entity+'/{searchResultDbId}',
'urlTemplate': '/search/'+entity+'/{searchResultsDbId}',
'params': params,
'behaviorOptions': ['fork','map'],
'behavior': behavior,
Expand Down

0 comments on commit 5802afa

Please sign in to comment.