Skip to content

Commit b1a9be3

Browse files
committed
fix revisions comments
1 parent 9d4f509 commit b1a9be3

10 files changed

Lines changed: 52 additions & 67 deletions

File tree

docs/README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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.
44

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

77
### Contents
88

@@ -41,7 +41,7 @@ import BrAPI from './build/BrAPI.js';
4141
```
4242
```js
4343
// Node.js
44-
const BrAPI = require('BrAPI.js');
44+
const BrAPI = require('./BrAPI.js');
4545
```
4646

4747
## How it Works
@@ -198,7 +198,7 @@ This method registers a callback function which is called once a node has loaded
198198
| --------------- | -------------------- | --------------- | ------------------ |
199199
| _node_.allelematrices_search(_params_,...) | `/allelematrices-search`(>=v1.2) or `/allelematrix-search`(<v1.2) || `POST` |
200200
| _node_.allelematrices(_params_,...) | `/allelematrices` | | `GET` |
201-
| _node_.attributes_categories(_params_,...) | `/attributes_categories` | `attributes/categories` | `GET` |
201+
| _node_.attributes_categories(_params_,...) | `/attributes_categories` | `/attributes/categories` | `GET` |
202202
| _node_.attributes_detail(_params_,...)||`/attributes/{attributeDbId}` | `GET` |
203203
| _node_.attributes_modify(_params_,...)||`/attributes/{attributeDbId}` | `PUT` |
204204
| _node_.attributes_store(_params_,...)||`/attributes` | `POST` |
@@ -209,7 +209,9 @@ This method registers a callback function which is called once a node has loaded
209209
| _node_.attributevalues(_params_,...)||`/attributevalues` | `GET` |
210210
| _node_.breedingmethods_detail(_params_,...) | `/breedingmethods/{breedingMethodDbId}` | `/breedingmethods/{breedingMethodDbId}` | `GET` |
211211
| _node_.breedingmethods(_params_,...) | `/breedingmethods` | `/breedingmethods` | `GET` |
212-
| _node_.calls(_params_,...) | `/calls` | `/calls` | `GET` |
212+
| _node_.calls(_params_,...) | `/calls` (server info) | | `GET` |
213+
| _node_.serverinfo(_params_,...)||`/serverinfo` | `GET` |
214+
| _node_.calls(_params_,...) | | `/calls` (genotyping calls) | `GET` |
213215
| _node_.callsets_calls(_params_,...)||`/callsets/{callSetDbId}/calls` | `GET` |
214216
| _node_.callsets_detail(_params_,...)||`/callsets/{callSetDbId}` | `GET` |
215217
| _node_.callsets(_params_,...)||`/callsets` | `GET` |
@@ -233,14 +235,14 @@ This method registers a callback function which is called once a node has loaded
233235
| _node_.germplasm_store(_params_,...)||`/germplasm` | `POST` |
234236
| _node_.germplasm(_params_,...) | `/germplasm` | `/germplasm` | `GET` |
235237
| _node_.images_detail(_params_,...) | `/images/{imageDbId}` | `/images/{imageDbId}` | `GET` |
236-
| _node_.images_imagecontent(_params_,...) | `/images/{imageDbId}/imagecontent` | `/images/{imageDbId}/imagecontent` | `PUT` |
238+
| _node_.images_imagecontent(_params_,...) | `/images/{imageDbId}/imagecontent` | | `PUT` |
239+
| _node_.images_imagecontent_modify(_params_,...) | | `/images/{imageDbId}/imagecontent` | `PUT` |
237240
| _node_.images_modify(_params_,...)||`/images/{imageDbId}` | `PUT` |
238241
| _node_.images_store(_params_,...)||`/images` | `POST` |
239242
| _node_.images(_params_,...) | `/images` | `/images` | `GET` |
240243
| _node_.lists_detail(_params_,...) | `/lists/{listDbId}` | `/lists/{listDbId}` | `GET` |
241-
| _node_.lists_items(_params_,...) | `/lists/{listDbId}/items` | `/lists/{listDbId}/items` | `PUT` |
242244
| _node_.lists_modify(_params_,...)||`/lists/{listDbId}` | `PUT` |
243-
| _node_.lists_store_items(_params_,...)||`/lists/{listDbId}/items` | `POST` |
245+
| _node_.lists_items_store(_params_,...)||`/lists/{listDbId}/items` | `POST` |
244246
| _node_.lists_store(_params_,...)||`/lists` | `POST` |
245247
| _node_.lists(_params_,...) | `/lists` | `/lists` | `GET` |
246248
| _node_.locations_detail(_params_,...) | `/locations/{locationDbId}` | `/locations/{locationDbId}` | `GET` |
@@ -264,15 +266,15 @@ This method registers a callback function which is called once a node has loaded
264266
| _node_.methods_store(_params_,...)||`/methods` | `POST` |
265267
| _node_.methods(_params_,...) | `/methods` | `/methods` | `GET` |
266268
| _node_.observationlevels(_params_,...) | `/observationlevels`(>=v1.2) or `/observationLevels`(<v1.2) | `/observationlevels` | `GET` |
267-
| _node_.observations_detail_modify(_params_,...)||`/observations/{observationDbId}` | `PUT` |
269+
| _node_.observations_modify(_params_,...)||`/observations/{observationDbId}` | `PUT` |
268270
| _node_.observations_detail(_params_,...)||`/observations/{observationDbId}` | `GET` |
269-
| _node_.observations_modify(_params_,...)||`/observations` | `PUT` |
271+
| _node_.observations_modify_multiple(_params_,...)||`/observations` | `PUT` |
270272
| _node_.observations_store(_params_,...)||`/observations` | `POST` |
271273
| _node_.observations_table(_params_,...)||`/observations/table `| `GET` |
272274
| _node_.observations(_params_,...)||`/observations` | `GET` |
273-
| _node_.observationunits_detail_modify(_params_,...)||`/observationunits/{observationUnitDbId}` | `PUT` |
275+
| _node_.observationunits_modify(_params_,...)||`/observationunits/{observationUnitDbId}` | `PUT` |
274276
| _node_.observationunits_detail(_params_,...)||`/observationunits/{observationUnitDbId}` | `GET` |
275-
| _node_.observationunits_modify(_params_,...)||`/observationunits` | `PUT` |
277+
| _node_.observationunits_modify_multiple(_params_,...)||`/observationunits` | `PUT` |
276278
| _node_.observationunits_store(_params_,...)||`/observationunits` | `POST` |
277279
| _node_.observationunits_table(_params_,...)||`/observationunits/table `| `GET` |
278280
| _node_.observationunits(_params_,...) | `/observationunits` | `/observationunits` | `GET` |
@@ -342,7 +344,6 @@ This method registers a callback function which is called once a node has loaded
342344
| _node_.seedlots_transactions_store(_params_,...)||`/seedlots/transactions` | `POST` |
343345
| _node_.seedlots_transactions(_params_,...)||`/seedlots/transactions` | `GET` |
344346
| _node_.seedlots(_params_,...)||`/seedlots` | `GET` |
345-
| _node_.serverinfo(_params_,...)||`/serverinfo` | `GET` |
346347
| _node_.studies_detail(_params_,...) | `/studies/{studyDbId}` | `/studies/{studyDbId}` | `GET` |
347348
| _node_.studies_germplasm(_params_,...) | `/studies/{studyDbId}/germplasm` | | `GET` |
348349
| _node_.studies_layouts(_params_,...) | `/studies/{studyDbId}/layouts` | `/studies/{studyDbId}/layout` | `GET` |

src/brapi_methods/attributevalues.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function attributevalues (params,behavior){
1313
'behavior': behavior,
1414
}
1515
this.version.check(call.urlTemplate,{
16-
introduced:"v1.3"
16+
introduced:"v2.0"
1717
});
1818
return this.simple_brapi_call(call);
1919
}
@@ -52,7 +52,7 @@ export function attributevalues_detail (params){
5252
'behavior': 'map',
5353
}
5454
this.version.check(call.urlTemplate,{
55-
introduced:"v1.3"
55+
introduced:"v2.0"
5656
});
5757
return this.simple_brapi_call(call);
5858
}
@@ -86,7 +86,7 @@ export function attributevalues_modify (params,behavior){
8686
*/
8787
export function search_attributevalues(params,behavior){
8888
this.version.check("POST /search/attributevalues -> GET /search/attributevalues",{
89-
introduced:"v1.3"
89+
introduced:"v2.0"
9090
});
9191
return this.search("attributevalues",params,behavior);
9292
};

src/brapi_methods/commoncropnames.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,13 @@ export function commoncropnames (params,behavior){
1111
'behaviorOptions': ['fork','map'],
1212
'behavior': behavior,
1313
}
14-
if (this.version.predates("v1.2")){
14+
if (this.version.predates("v1.3")){
1515
call.urlTemplate = "/crops"
1616
this.version.check(call.urlTemplate,{
1717
introduced:"v1.0",
18-
deprecated:"v1.2",
18+
deprecated:"v1.3",
1919
deprecated:"v2.0"
2020
});
21-
} else if (this.version.predates("v1.3")){
22-
call.urlTemplate = "/commonCropNames"
23-
this.version.check(call.urlTemplate,{
24-
introduced:"v1.2",
25-
deprecated:"v1.3"
26-
});
2721
} else {
2822
call.urlTemplate = "/commoncropnames"
2923
this.version.check(call.urlTemplate,{

src/brapi_methods/images.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,25 @@ export function images_imagecontent (params){
9696
return this.simple_brapi_call(call);
9797
}
9898

99+
/** `PUT /images/{imageDbId}/imagecontent`
100+
* @alias BrAPINode.prototype.images_imagecontent_modify
101+
* @param {Object} params Parameters to provide to the call
102+
* @param {String} params.imageDbId imageDbId
103+
* @return {BrAPI_Behavior_Node}
104+
*/
105+
export function images_imagecontent_modify (params){
106+
var call = {
107+
'defaultMethod': 'put',
108+
'urlTemplate': '/images/{imageDbId}/imagecontent',
109+
'params': params,
110+
'behavior': 'map',
111+
}
112+
this.version.check(call.urlTemplate,{
113+
introduced:"v2.0"
114+
});
115+
return this.simple_brapi_call(call);
116+
}
117+
99118
/** `POST /search/images -> GET /search/images`
100119
* @alias BrAPINode.prototype.search_images
101120
* @param {Object} params Parameters to provide to the call

src/brapi_methods/lists.js

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -77,40 +77,21 @@ export function lists_modify (params,behavior){
7777
return this.simple_brapi_call(call);
7878
}
7979

80-
/** `PUT /lists/{listDbId}/items`
81-
* @alias BrAPINode.prototype.lists_items
82-
* @param {Object} params Parameters to provide to the call
83-
* @param {String} params.imageDbId imageDbId
84-
* @return {BrAPI_Behavior_Node}
85-
*/
86-
export function lists_items (params){
87-
var call = {
88-
'defaultMethod': 'put',
89-
'urlTemplate': '/lists/{listDbId}/items',
90-
'params': params,
91-
'behavior': 'map',
92-
}
93-
this.version.check(call.urlTemplate,{
94-
introduced:"v1.3",
95-
deprecated:"v2.0"
96-
});
97-
return this.simple_brapi_call(call);
98-
}
99-
10080
/** `POST /lists/{listDbId}/items`
101-
* @alias BrAPINode.prototype.lists_store_items
81+
* @alias BrAPINode.prototype.lists_items_store
10282
* @param {Object} params Parameters to provide to the call
10383
* @param {String} params.imageDbId imageDbId
10484
* @return {BrAPI_Behavior_Node}
10585
*/
106-
export function lists_store_items (params){
86+
export function lists_items_store (params){
10787
var call = {
10888
'defaultMethod': 'post',
10989
'urlTemplate': '/lists/{listDbId}/items',
11090
'params': params,
11191
'behavior': 'map',
11292
}
11393
this.version.check(call.urlTemplate,{
94+
introduced:"v1.3",
11495
introduced:"v2.0"
11596
});
11697
return this.simple_brapi_call(call);
@@ -133,7 +114,7 @@ export function lists_search(params,behavior){
133114
* @param {String} [behavior="fork"] Behavior of the node
134115
* @return {BrAPI_Behavior_Node}
135116
*/
136-
export function search_lists(params,behavior,useOld){
117+
export function search_lists(params,behavior){
137118
this.version.check("POST /search/lists -> GET /search/lists",{
138119
introduced:"v2.0"
139120
});

src/brapi_methods/locations.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function locations_search(params,behavior){
9494
* @param {String} [behavior="fork"] Behavior of the node
9595
* @return {BrAPI_Behavior_Node}
9696
*/
97-
export function search_locations(params,behavior,useOld){
97+
export function search_locations(params,behavior){
9898
this.version.check("POST /search/locations -> GET /search/locations",{
9999
introduced:"v2.0"
100100
});

src/brapi_methods/observations.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ export function observations_store (params,behavior){
3838
}
3939

4040
/** `PUT /observations`
41-
* @alias BrAPINode.prototype.observations_modify
41+
* @alias BrAPINode.prototype.observations_modify_multiple
4242
* @param {Object} params Parameters to provide to the call
4343
* @param {String} [behavior="fork"] Behavior of the node
4444
* @return {BrAPI_Behavior_Node}
4545
*/
46-
export function observations_modify (params,behavior){
46+
export function observations_modify_multiple (params,behavior){
4747
var call = {
4848
'defaultMethod': 'put',
4949
'urlTemplate': '/observations',
@@ -78,12 +78,12 @@ export function observations_detail (params){
7878

7979

8080
/** `PUT /observations/{observationDbId}`
81-
* @alias BrAPINode.prototype.observations_detail_modify
81+
* @alias BrAPINode.prototype.observations_modify
8282
* @param {Object} params Parameters to provide to the call
8383
* @param {String} [behavior="fork"] Behavior of the node
8484
* @return {BrAPI_Behavior_Node}
8585
*/
86-
export function observations_detail_modify (params,behavior){
86+
export function observations_modify (params,behavior){
8787
var call = {
8888
'defaultMethod': 'put',
8989
'urlTemplate': '/observations/{observationDbId}',

src/brapi_methods/observationunits.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ export function observationunits_store (params,behavior){
3939
}
4040

4141
/** `PUT /observationunits`
42-
* @alias BrAPINode.prototype.observationunits_modify
42+
* @alias BrAPINode.prototype.observationunits_modify_multiple
4343
* @param {Object} params Parameters to provide to the call
4444
* @param {String} [behavior="fork"] Behavior of the node
4545
* @return {BrAPI_Behavior_Node}
4646
*/
47-
export function observationunits_modify (params,behavior){
47+
export function observationunits_modify_multiple (params,behavior){
4848
var call = {
4949
'defaultMethod': 'put',
5050
'urlTemplate': '/observationunits',
@@ -78,12 +78,12 @@ export function observationunits_detail (params){
7878
}
7979

8080
/** `PUT /observationunits/{observationUnitDbId}`
81-
* @alias BrAPINode.prototype.observationunits_detail_modify
81+
* @alias BrAPINode.prototype.observationunits_modify
8282
* @param {Object} params Parameters to provide to the call
8383
* @param {String} [behavior="fork"] Behavior of the node
8484
* @return {BrAPI_Behavior_Node}
8585
*/
86-
export function observationunits_detail_modify (params,behavior){
86+
export function observationunits_modify (params,behavior){
8787
var call = {
8888
'defaultMethod': 'put',
8989
'urlTemplate': '/observationunits/{observationUnitDbId}',

src/brapi_methods/people.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,23 +78,13 @@ export function people_modify (params,behavior){
7878
return this.simple_brapi_call(call);
7979
}
8080

81-
/** `POST /search/people`
82-
* @alias BrAPINode.prototype.people_search
83-
* @param {Object} params Parameters to provide to the call
84-
* @param {String} [behavior="fork"] Behavior of the node
85-
* @return {BrAPI_Behavior_Node}
86-
*/
87-
export function people_search(params,behavior){
88-
return this.search_people(params,behavior,true);
89-
};
90-
9181
/** `POST /search/people -> GET /search/people`
9282
* @alias BrAPINode.prototype.search_people
9383
* @param {Object} params Parameters to provide to the call
9484
* @param {String} [behavior="fork"] Behavior of the node
9585
* @return {BrAPI_Behavior_Node}
9686
*/
97-
export function search_people(params,behavior,useOld){
87+
export function search_people(params,behavior){
9888
this.version.check("POST /search/people -> GET /search/people",{
9989
introduced:"v2.0"
10090
});

src/brapi_methods/trials.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export function trials_search(params,behavior){
9494
* @param {String} [behavior="fork"] Behavior of the node
9595
* @return {BrAPI_Behavior_Node}
9696
*/
97-
export function search_trials(params,behavior,useOld){
97+
export function search_trials(params,behavior){
9898
this.version.check("POST /search/trials -> GET /search/trials",{
9999
introduced:"v2.0"
100100
});

0 commit comments

Comments
 (0)