Skip to content

Commit

Permalink
fix revisions comments
Browse files Browse the repository at this point in the history
  • Loading branch information
MFlores2021 committed Apr 7, 2021
1 parent 9d4f509 commit b1a9be3
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 67 deletions.
25 changes: 13 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

BrAPI.js is a JavaScript client library for [BrAPI](https://brapi.org). The call style of this library is inspired by [D3.js](https://d3js.org/). It can be used in either a browser or a Node.js application. It uses the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) (or [node-fetch](https://www.npmjs.com/package/node-fetch) in Node.js) for making AJAX calls. BrAPI.js is dependent on ES6 classes.

BrAPI.js supports BrAPI versions `v1.0`-`v1.3`. Currently, it expects a server to use a single version.
BrAPI.js supports BrAPI versions `v1.0`-`v2.0`. Currently, it expects a server to use a single version.

### Contents

Expand Down Expand Up @@ -41,7 +41,7 @@ import BrAPI from './build/BrAPI.js';
```
```js
// Node.js
const BrAPI = require('BrAPI.js');
const BrAPI = require('./BrAPI.js');
```

## How it Works
Expand Down Expand Up @@ -198,7 +198,7 @@ This method registers a callback function which is called once a node has loaded
| --------------- | -------------------- | --------------- | ------------------ |
| _node_.allelematrices_search(_params_,...) | `/allelematrices-search`(>=v1.2) or `/allelematrix-search`(<v1.2) || `POST` |
| _node_.allelematrices(_params_,...) | `/allelematrices` | | `GET` |
| _node_.attributes_categories(_params_,...) | `/attributes_categories` | `attributes/categories` | `GET` |
| _node_.attributes_categories(_params_,...) | `/attributes_categories` | `/attributes/categories` | `GET` |
| _node_.attributes_detail(_params_,...)||`/attributes/{attributeDbId}` | `GET` |
| _node_.attributes_modify(_params_,...)||`/attributes/{attributeDbId}` | `PUT` |
| _node_.attributes_store(_params_,...)||`/attributes` | `POST` |
Expand All @@ -209,7 +209,9 @@ This method registers a callback function which is called once a node has loaded
| _node_.attributevalues(_params_,...)||`/attributevalues` | `GET` |
| _node_.breedingmethods_detail(_params_,...) | `/breedingmethods/{breedingMethodDbId}` | `/breedingmethods/{breedingMethodDbId}` | `GET` |
| _node_.breedingmethods(_params_,...) | `/breedingmethods` | `/breedingmethods` | `GET` |
| _node_.calls(_params_,...) | `/calls` | `/calls` | `GET` |
| _node_.calls(_params_,...) | `/calls` (server info) | | `GET` |
| _node_.serverinfo(_params_,...)||`/serverinfo` | `GET` |
| _node_.calls(_params_,...) | | `/calls` (genotyping calls) | `GET` |
| _node_.callsets_calls(_params_,...)||`/callsets/{callSetDbId}/calls` | `GET` |
| _node_.callsets_detail(_params_,...)||`/callsets/{callSetDbId}` | `GET` |
| _node_.callsets(_params_,...)||`/callsets` | `GET` |
Expand All @@ -233,14 +235,14 @@ This method registers a callback function which is called once a node has loaded
| _node_.germplasm_store(_params_,...)||`/germplasm` | `POST` |
| _node_.germplasm(_params_,...) | `/germplasm` | `/germplasm` | `GET` |
| _node_.images_detail(_params_,...) | `/images/{imageDbId}` | `/images/{imageDbId}` | `GET` |
| _node_.images_imagecontent(_params_,...) | `/images/{imageDbId}/imagecontent` | `/images/{imageDbId}/imagecontent` | `PUT` |
| _node_.images_imagecontent(_params_,...) | `/images/{imageDbId}/imagecontent` | | `PUT` |
| _node_.images_imagecontent_modify(_params_,...) | | `/images/{imageDbId}/imagecontent` | `PUT` |
| _node_.images_modify(_params_,...)||`/images/{imageDbId}` | `PUT` |
| _node_.images_store(_params_,...)||`/images` | `POST` |
| _node_.images(_params_,...) | `/images` | `/images` | `GET` |
| _node_.lists_detail(_params_,...) | `/lists/{listDbId}` | `/lists/{listDbId}` | `GET` |
| _node_.lists_items(_params_,...) | `/lists/{listDbId}/items` | `/lists/{listDbId}/items` | `PUT` |
| _node_.lists_modify(_params_,...)||`/lists/{listDbId}` | `PUT` |
| _node_.lists_store_items(_params_,...)||`/lists/{listDbId}/items` | `POST` |
| _node_.lists_items_store(_params_,...)||`/lists/{listDbId}/items` | `POST` |
| _node_.lists_store(_params_,...)||`/lists` | `POST` |
| _node_.lists(_params_,...) | `/lists` | `/lists` | `GET` |
| _node_.locations_detail(_params_,...) | `/locations/{locationDbId}` | `/locations/{locationDbId}` | `GET` |
Expand All @@ -264,15 +266,15 @@ This method registers a callback function which is called once a node has loaded
| _node_.methods_store(_params_,...)||`/methods` | `POST` |
| _node_.methods(_params_,...) | `/methods` | `/methods` | `GET` |
| _node_.observationlevels(_params_,...) | `/observationlevels`(>=v1.2) or `/observationLevels`(<v1.2) | `/observationlevels` | `GET` |
| _node_.observations_detail_modify(_params_,...)||`/observations/{observationDbId}` | `PUT` |
| _node_.observations_modify(_params_,...)||`/observations/{observationDbId}` | `PUT` |
| _node_.observations_detail(_params_,...)||`/observations/{observationDbId}` | `GET` |
| _node_.observations_modify(_params_,...)||`/observations` | `PUT` |
| _node_.observations_modify_multiple(_params_,...)||`/observations` | `PUT` |
| _node_.observations_store(_params_,...)||`/observations` | `POST` |
| _node_.observations_table(_params_,...)||`/observations/table `| `GET` |
| _node_.observations(_params_,...)||`/observations` | `GET` |
| _node_.observationunits_detail_modify(_params_,...)||`/observationunits/{observationUnitDbId}` | `PUT` |
| _node_.observationunits_modify(_params_,...)||`/observationunits/{observationUnitDbId}` | `PUT` |
| _node_.observationunits_detail(_params_,...)||`/observationunits/{observationUnitDbId}` | `GET` |
| _node_.observationunits_modify(_params_,...)||`/observationunits` | `PUT` |
| _node_.observationunits_modify_multiple(_params_,...)||`/observationunits` | `PUT` |
| _node_.observationunits_store(_params_,...)||`/observationunits` | `POST` |
| _node_.observationunits_table(_params_,...)||`/observationunits/table `| `GET` |
| _node_.observationunits(_params_,...) | `/observationunits` | `/observationunits` | `GET` |
Expand Down Expand Up @@ -342,7 +344,6 @@ This method registers a callback function which is called once a node has loaded
| _node_.seedlots_transactions_store(_params_,...)||`/seedlots/transactions` | `POST` |
| _node_.seedlots_transactions(_params_,...)||`/seedlots/transactions` | `GET` |
| _node_.seedlots(_params_,...)||`/seedlots` | `GET` |
| _node_.serverinfo(_params_,...)||`/serverinfo` | `GET` |
| _node_.studies_detail(_params_,...) | `/studies/{studyDbId}` | `/studies/{studyDbId}` | `GET` |
| _node_.studies_germplasm(_params_,...) | `/studies/{studyDbId}/germplasm` | | `GET` |
| _node_.studies_layouts(_params_,...) | `/studies/{studyDbId}/layouts` | `/studies/{studyDbId}/layout` | `GET` |
Expand Down
6 changes: 3 additions & 3 deletions src/brapi_methods/attributevalues.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function attributevalues (params,behavior){
'behavior': behavior,
}
this.version.check(call.urlTemplate,{
introduced:"v1.3"
introduced:"v2.0"
});
return this.simple_brapi_call(call);
}
Expand Down Expand Up @@ -52,7 +52,7 @@ export function attributevalues_detail (params){
'behavior': 'map',
}
this.version.check(call.urlTemplate,{
introduced:"v1.3"
introduced:"v2.0"
});
return this.simple_brapi_call(call);
}
Expand Down Expand Up @@ -86,7 +86,7 @@ export function attributevalues_modify (params,behavior){
*/
export function search_attributevalues(params,behavior){
this.version.check("POST /search/attributevalues -> GET /search/attributevalues",{
introduced:"v1.3"
introduced:"v2.0"
});
return this.search("attributevalues",params,behavior);
};
10 changes: 2 additions & 8 deletions src/brapi_methods/commoncropnames.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ export function commoncropnames (params,behavior){
'behaviorOptions': ['fork','map'],
'behavior': behavior,
}
if (this.version.predates("v1.2")){
if (this.version.predates("v1.3")){
call.urlTemplate = "/crops"
this.version.check(call.urlTemplate,{
introduced:"v1.0",
deprecated:"v1.2",
deprecated:"v1.3",
deprecated:"v2.0"
});
} else if (this.version.predates("v1.3")){
call.urlTemplate = "/commonCropNames"
this.version.check(call.urlTemplate,{
introduced:"v1.2",
deprecated:"v1.3"
});
} else {
call.urlTemplate = "/commoncropnames"
this.version.check(call.urlTemplate,{
Expand Down
19 changes: 19 additions & 0 deletions src/brapi_methods/images.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,25 @@ export function images_imagecontent (params){
return this.simple_brapi_call(call);
}

/** `PUT /images/{imageDbId}/imagecontent`
* @alias BrAPINode.prototype.images_imagecontent_modify
* @param {Object} params Parameters to provide to the call
* @param {String} params.imageDbId imageDbId
* @return {BrAPI_Behavior_Node}
*/
export function images_imagecontent_modify (params){
var call = {
'defaultMethod': 'put',
'urlTemplate': '/images/{imageDbId}/imagecontent',
'params': params,
'behavior': 'map',
}
this.version.check(call.urlTemplate,{
introduced:"v2.0"
});
return this.simple_brapi_call(call);
}

/** `POST /search/images -> GET /search/images`
* @alias BrAPINode.prototype.search_images
* @param {Object} params Parameters to provide to the call
Expand Down
27 changes: 4 additions & 23 deletions src/brapi_methods/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,21 @@ export function lists_modify (params,behavior){
return this.simple_brapi_call(call);
}

/** `PUT /lists/{listDbId}/items`
* @alias BrAPINode.prototype.lists_items
* @param {Object} params Parameters to provide to the call
* @param {String} params.imageDbId imageDbId
* @return {BrAPI_Behavior_Node}
*/
export function lists_items (params){
var call = {
'defaultMethod': 'put',
'urlTemplate': '/lists/{listDbId}/items',
'params': params,
'behavior': 'map',
}
this.version.check(call.urlTemplate,{
introduced:"v1.3",
deprecated:"v2.0"
});
return this.simple_brapi_call(call);
}

/** `POST /lists/{listDbId}/items`
* @alias BrAPINode.prototype.lists_store_items
* @alias BrAPINode.prototype.lists_items_store
* @param {Object} params Parameters to provide to the call
* @param {String} params.imageDbId imageDbId
* @return {BrAPI_Behavior_Node}
*/
export function lists_store_items (params){
export function lists_items_store (params){
var call = {
'defaultMethod': 'post',
'urlTemplate': '/lists/{listDbId}/items',
'params': params,
'behavior': 'map',
}
this.version.check(call.urlTemplate,{
introduced:"v1.3",
introduced:"v2.0"
});
return this.simple_brapi_call(call);
Expand All @@ -133,7 +114,7 @@ export function lists_search(params,behavior){
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function search_lists(params,behavior,useOld){
export function search_lists(params,behavior){
this.version.check("POST /search/lists -> GET /search/lists",{
introduced:"v2.0"
});
Expand Down
2 changes: 1 addition & 1 deletion src/brapi_methods/locations.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function locations_search(params,behavior){
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function search_locations(params,behavior,useOld){
export function search_locations(params,behavior){
this.version.check("POST /search/locations -> GET /search/locations",{
introduced:"v2.0"
});
Expand Down
8 changes: 4 additions & 4 deletions src/brapi_methods/observations.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ export function observations_store (params,behavior){
}

/** `PUT /observations`
* @alias BrAPINode.prototype.observations_modify
* @alias BrAPINode.prototype.observations_modify_multiple
* @param {Object} params Parameters to provide to the call
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function observations_modify (params,behavior){
export function observations_modify_multiple (params,behavior){
var call = {
'defaultMethod': 'put',
'urlTemplate': '/observations',
Expand Down Expand Up @@ -78,12 +78,12 @@ export function observations_detail (params){


/** `PUT /observations/{observationDbId}`
* @alias BrAPINode.prototype.observations_detail_modify
* @alias BrAPINode.prototype.observations_modify
* @param {Object} params Parameters to provide to the call
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function observations_detail_modify (params,behavior){
export function observations_modify (params,behavior){
var call = {
'defaultMethod': 'put',
'urlTemplate': '/observations/{observationDbId}',
Expand Down
8 changes: 4 additions & 4 deletions src/brapi_methods/observationunits.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ export function observationunits_store (params,behavior){
}

/** `PUT /observationunits`
* @alias BrAPINode.prototype.observationunits_modify
* @alias BrAPINode.prototype.observationunits_modify_multiple
* @param {Object} params Parameters to provide to the call
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function observationunits_modify (params,behavior){
export function observationunits_modify_multiple (params,behavior){
var call = {
'defaultMethod': 'put',
'urlTemplate': '/observationunits',
Expand Down Expand Up @@ -78,12 +78,12 @@ export function observationunits_detail (params){
}

/** `PUT /observationunits/{observationUnitDbId}`
* @alias BrAPINode.prototype.observationunits_detail_modify
* @alias BrAPINode.prototype.observationunits_modify
* @param {Object} params Parameters to provide to the call
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function observationunits_detail_modify (params,behavior){
export function observationunits_modify (params,behavior){
var call = {
'defaultMethod': 'put',
'urlTemplate': '/observationunits/{observationUnitDbId}',
Expand Down
12 changes: 1 addition & 11 deletions src/brapi_methods/people.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,13 @@ export function people_modify (params,behavior){
return this.simple_brapi_call(call);
}

/** `POST /search/people`
* @alias BrAPINode.prototype.people_search
* @param {Object} params Parameters to provide to the call
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function people_search(params,behavior){
return this.search_people(params,behavior,true);
};

/** `POST /search/people -> GET /search/people`
* @alias BrAPINode.prototype.search_people
* @param {Object} params Parameters to provide to the call
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function search_people(params,behavior,useOld){
export function search_people(params,behavior){
this.version.check("POST /search/people -> GET /search/people",{
introduced:"v2.0"
});
Expand Down
2 changes: 1 addition & 1 deletion src/brapi_methods/trials.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function trials_search(params,behavior){
* @param {String} [behavior="fork"] Behavior of the node
* @return {BrAPI_Behavior_Node}
*/
export function search_trials(params,behavior,useOld){
export function search_trials(params,behavior){
this.version.check("POST /search/trials -> GET /search/trials",{
introduced:"v2.0"
});
Expand Down

0 comments on commit b1a9be3

Please sign in to comment.