Skip to content

Commit 5ab54d3

Browse files
authored
Merge pull request #15 from solgenomics/topic/brapi_v2
Implement brapi version 2 calls (beta), also compatible with verson 1.3
2 parents d8238eb + b1a9be3 commit 5ab54d3

38 files changed

Lines changed: 2252 additions & 145 deletions

docs/README.md

Lines changed: 197 additions & 98 deletions
Large diffs are not rendered by default.

src/brapi_methods.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
export * from "./brapi_methods/allelematrices";
22
export * from "./brapi_methods/attributes";
3+
export * from "./brapi_methods/attributevalues";
34
export * from "./brapi_methods/breedingmethods";
45
export * from "./brapi_methods/calls";
6+
export * from "./brapi_methods/callsets";
57
export * from "./brapi_methods/commoncropnames";
8+
export * from "./brapi_methods/crosses";
9+
export * from "./brapi_methods/crossingprojects";
10+
export * from "./brapi_methods/events";
611
export * from "./brapi_methods/germplasm";
712
export * from "./brapi_methods/images";
813
export * from "./brapi_methods/lists";
@@ -11,18 +16,26 @@ export * from "./brapi_methods/maps";
1116
export * from "./brapi_methods/markerprofiles";
1217
export * from "./brapi_methods/markers";
1318
export * from "./brapi_methods/methods";
19+
export * from "./brapi_methods/observations";
1420
export * from "./brapi_methods/observationlevels";
1521
export * from "./brapi_methods/observationunits";
1622
export * from "./brapi_methods/ontologies";
1723
export * from "./brapi_methods/people";
1824
export * from "./brapi_methods/phenotypes";
25+
export * from "./brapi_methods/plannedcrosses";
1926
export * from "./brapi_methods/programs";
27+
export * from "./brapi_methods/references";
28+
export * from "./brapi_methods/referencesets";
2029
export * from "./brapi_methods/samples";
2130
export * from "./brapi_methods/scales";
2231
export * from "./brapi_methods/search";
2332
export * from "./brapi_methods/seasons";
33+
export * from "./brapi_methods/seedlots";
34+
export * from "./brapi_methods/serverinfo";
2435
export * from "./brapi_methods/studies";
2536
export * from "./brapi_methods/traits";
2637
export * from "./brapi_methods/trials";
2738
export * from "./brapi_methods/variables";
39+
export * from "./brapi_methods/variants";
40+
export * from "./brapi_methods/variantsets";
2841
export * from "./brapi_methods/vendor";

src/brapi_methods/attributes.js

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,67 @@ export function attributes (params,behavior){
1818
return this.simple_brapi_call(call);
1919
}
2020

21+
/** `POST /attributes`
22+
* @alias BrAPINode.prototype.attributes_store
23+
* @param {Object} params Parameters to provide to the call
24+
* @param {String} [behavior="fork"] Behavior of the node
25+
* @return {BrAPI_Behavior_Node}
26+
*/
27+
export function attributes_store (params,behavior){
28+
var call = {
29+
'defaultMethod': 'post',
30+
'urlTemplate': '/attributes',
31+
'params': params,
32+
'behaviorOptions': ['fork','map'],
33+
'behavior': behavior,
34+
}
35+
this.version.check(call.urlTemplate,{
36+
introduced:"v2.0"
37+
});
38+
return this.simple_brapi_call(call);
39+
}
40+
41+
42+
/** `GET /attributes/{attributeDbId}`
43+
* @alias BrAPINode.prototype.attributes_detail
44+
* @param {Object} params Parameters to provide to the call
45+
* @param {String} params.attributeDbId attributeDbId
46+
* @return {BrAPI_Behavior_Node}
47+
*/
48+
export function attributes_detail (params){
49+
var call = {
50+
'defaultMethod': 'get',
51+
'urlTemplate': '/attributes/{attributeDbId}',
52+
'params': params,
53+
'behavior': 'map',
54+
}
55+
this.version.check(call.urlTemplate,{
56+
introduced:"v2.0"
57+
});
58+
return this.simple_brapi_call(call);
59+
}
60+
61+
62+
/** `PUT /attributes/{attributeDbId}`
63+
* @alias BrAPINode.prototype.attributes_modify
64+
* @param {Object} params Parameters to provide to the call
65+
* @param {String} [behavior="fork"] Behavior of the node
66+
* @return {BrAPI_Behavior_Node}
67+
*/
68+
export function attributes_modify (params,behavior){
69+
var call = {
70+
'defaultMethod': 'put',
71+
'urlTemplate': '/attributes/{attributeDbId}',
72+
'params': params,
73+
'behaviorOptions': ['fork','map'],
74+
'behavior': behavior,
75+
}
76+
this.version.check(call.urlTemplate,{
77+
introduced:"v2.0"
78+
});
79+
return this.simple_brapi_call(call);
80+
}
81+
2182
/** `GET /attributes_categories`
2283
* @alias BrAPINode.prototype.attributes_categories
2384
* @param {Object} params Parameters to provide to the call
@@ -37,3 +98,17 @@ export function attributes_categories (params,behavior){
3798
});
3899
return this.simple_brapi_call(call);
39100
}
101+
102+
103+
/** `POST /search/attributes -> GET /search/attributes`
104+
* @alias BrAPINode.prototype.search_attributes
105+
* @param {Object} params Parameters to provide to the call
106+
* @param {String} [behavior="fork"] Behavior of the node
107+
* @return {BrAPI_Behavior_Node}
108+
*/
109+
export function search_attributes(params,behavior){
110+
this.version.check("POST /search/attributes -> GET /search/attributes",{
111+
introduced:"v2.0"
112+
});
113+
return this.search("attributes",params,behavior);
114+
};
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
/** `GET /attributevalues`
2+
* @alias BrAPINode.prototype.attributevalues
3+
* @param {Object} params Parameters to provide to the call
4+
* @param {String} [behavior="fork"] Behavior of the node
5+
* @return {BrAPI_Behavior_Node}
6+
*/
7+
export function attributevalues (params,behavior){
8+
var call = {
9+
'defaultMethod': 'get',
10+
'urlTemplate': '/attributevalues',
11+
'params': params,
12+
'behaviorOptions': ['fork','map'],
13+
'behavior': behavior,
14+
}
15+
this.version.check(call.urlTemplate,{
16+
introduced:"v2.0"
17+
});
18+
return this.simple_brapi_call(call);
19+
}
20+
21+
/** `POST /attributevalues`
22+
* @alias BrAPINode.prototype.attributevalues_store
23+
* @param {Object} params Parameters to provide to the call
24+
* @param {String} [behavior="fork"] Behavior of the node
25+
* @return {BrAPI_Behavior_Node}
26+
*/
27+
export function attributevalues_store (params,behavior){
28+
var call = {
29+
'defaultMethod': 'post',
30+
'urlTemplate': '/attributevalues',
31+
'params': params,
32+
'behaviorOptions': ['fork','map'],
33+
'behavior': behavior,
34+
}
35+
this.version.check(call.urlTemplate,{
36+
introduced:"v2.0"
37+
});
38+
return this.simple_brapi_call(call);
39+
}
40+
41+
/** `GET /attributevalues/{attributeValueDbId}`
42+
* @alias BrAPINode.prototype.attributevalues_detail
43+
* @param {Object} params Parameters to provide to the call
44+
* @param {String} params.attributeValueDbId attributeValueDbId
45+
* @return {BrAPI_Behavior_Node}
46+
*/
47+
export function attributevalues_detail (params){
48+
var call = {
49+
'defaultMethod': 'get',
50+
'urlTemplate': '/attributevalues/{attributeValueDbId}',
51+
'params': params,
52+
'behavior': 'map',
53+
}
54+
this.version.check(call.urlTemplate,{
55+
introduced:"v2.0"
56+
});
57+
return this.simple_brapi_call(call);
58+
}
59+
60+
/** `PUT /attributevalues/{attributeValueDbId}`
61+
* @alias BrAPINode.prototype.attributevalues_modify
62+
* @param {Object} params Parameters to provide to the call
63+
* @param {String} [behavior="fork"] Behavior of the node
64+
* @return {BrAPI_Behavior_Node}
65+
*/
66+
export function attributevalues_modify (params,behavior){
67+
var call = {
68+
'defaultMethod': 'put',
69+
'urlTemplate': '/attributevalues/{attributeValueDbId}',
70+
'params': params,
71+
'behaviorOptions': ['fork','map'],
72+
'behavior': behavior,
73+
}
74+
this.version.check(call.urlTemplate,{
75+
introduced:"v2.0"
76+
});
77+
return this.simple_brapi_call(call);
78+
}
79+
80+
81+
/** `POST /search/attributevalues -> GET /search/attributevalues`
82+
* @alias BrAPINode.prototype.search_attributevalues
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 search_attributevalues(params,behavior){
88+
this.version.check("POST /search/attributevalues -> GET /search/attributevalues",{
89+
introduced:"v2.0"
90+
});
91+
return this.search("attributevalues",params,behavior);
92+
};

src/brapi_methods/calls.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,16 @@ export function calls (params,behavior){
1717
});
1818
return this.simple_brapi_call(call);
1919
}
20+
21+
/** `POST /search/calls -> GET /search/calls`
22+
* @alias BrAPINode.prototype.search_calls
23+
* @param {Object} params Parameters to provide to the call
24+
* @param {String} [behavior="fork"] Behavior of the node
25+
* @return {BrAPI_Behavior_Node}
26+
*/
27+
export function search_calls(params,behavior){
28+
this.version.check("POST /search/calls -> GET /search/calls",{
29+
introduced:"v2.0"
30+
});
31+
return this.search("calls",params,behavior);
32+
};

src/brapi_methods/callsets.js

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
/** `GET /callsets`
3+
* @alias BrAPINode.prototype.callsets
4+
* @param {Object} params Parameters to provide to the call
5+
* @param {String} params.germplasmDbId germplasmDbId
6+
* @return {BrAPI_Behavior_Node}
7+
*/
8+
export function callsets (params){
9+
var call = {
10+
'defaultMethod': 'get',
11+
'urlTemplate': '/callsets',
12+
'params': params,
13+
'behavior': 'map',
14+
}
15+
this.version.check(call.urlTemplate,{
16+
introduced:"v2.0"
17+
});
18+
return this.simple_brapi_call(call);
19+
}
20+
21+
22+
/** `GET /callsets/{callSetDbId}`
23+
* @alias BrAPINode.prototype.callsets_detail
24+
* @param {Object} params Parameters to provide to the call
25+
* @param {String} params.callSetDbId callSetDbId
26+
* @return {BrAPI_Behavior_Node}
27+
*/
28+
export function callsets_detail (params){
29+
var call = {
30+
'defaultMethod': 'get',
31+
'urlTemplate': '/callsets/{callSetDbId}',
32+
'params': params,
33+
'behavior': 'map',
34+
}
35+
this.version.check(call.urlTemplate,{
36+
introduced:"v2.0"
37+
});
38+
return this.simple_brapi_call(call);
39+
}
40+
41+
42+
/** `GET /callsets/{callSetDbId}/calls`
43+
* @alias BrAPINode.prototype.callsets_calls
44+
* @param {Object} params Parameters to provide to the call
45+
* @param {String} params.callSetDbId callSetDbId
46+
* @return {BrAPI_Behavior_Node}
47+
*/
48+
export function callsets_calls (params){
49+
var call = {
50+
'defaultMethod': 'get',
51+
'urlTemplate': '/callsets/{callSetDbId}/calls',
52+
'params': params,
53+
'behavior': 'map',
54+
}
55+
this.version.check(call.urlTemplate,{
56+
introduced:"v2.0"
57+
});
58+
return this.simple_brapi_call(call);
59+
}
60+
61+
62+
/** `POST /search/callsets -> GET /search/callsets`
63+
* @alias BrAPINode.prototype.search_callsets
64+
* @param {Object} params Parameters to provide to the call
65+
* @param {String} [behavior="fork"] Behavior of the node
66+
* @return {BrAPI_Behavior_Node}
67+
*/
68+
export function search_callsets(params,behavior){
69+
this.version.check("POST /search/callsets -> GET /search/callsets",{
70+
introduced:"v2.0"
71+
});
72+
return this.search("callsets",params,behavior);
73+
};

src/brapi_methods/commoncropnames.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ 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",
19+
deprecated:"v2.0"
1920
});
2021
} else {
21-
call.urlTemplate = "/commonCropNames"
22+
call.urlTemplate = "/commoncropnames"
2223
this.version.check(call.urlTemplate,{
23-
introduced:"v1.2"
24+
introduced:"v1.3"
2425
});
2526
}
2627
return this.simple_brapi_call(call);

src/brapi_methods/crosses.js

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/** `GET /crosses`
2+
* @alias BrAPINode.prototype.crosses
3+
* @param {Object} params Parameters to provide to the call
4+
* @param {String} [behavior="fork"] Behavior of the node
5+
* @return {BrAPI_Behavior_Node}
6+
*/
7+
export function crosses (params,behavior){
8+
var call = {
9+
'defaultMethod': 'get',
10+
'urlTemplate': '/crosses',
11+
'params': params,
12+
'behaviorOptions': ['fork','map'],
13+
'behavior': behavior,
14+
}
15+
this.version.check(call.urlTemplate,{
16+
introduced:"v2.0"
17+
});
18+
return this.simple_brapi_call(call);
19+
}
20+
21+
/** `POST /crosses`
22+
* @alias BrAPINode.prototype.crosses_store
23+
* @param {Object} params Parameters to provide to the call
24+
* @param {String} [behavior="fork"] Behavior of the node
25+
* @return {BrAPI_Behavior_Node}
26+
*/
27+
export function crosses_store (params,behavior){
28+
var call = {
29+
'defaultMethod': 'post',
30+
'urlTemplate': '/crosses',
31+
'params': params,
32+
'behaviorOptions': ['fork','map'],
33+
'behavior': behavior,
34+
}
35+
this.version.check(call.urlTemplate,{
36+
introduced:"v2.0"
37+
});
38+
return this.simple_brapi_call(call);
39+
}
40+
41+
/** `PUT /crosses`
42+
* @alias BrAPINode.prototype.crosses_modify
43+
* @param {Object} params Parameters to provide to the call
44+
* @param {String} [behavior="fork"] Behavior of the node
45+
* @return {BrAPI_Behavior_Node}
46+
*/
47+
export function crosses_modify (params,behavior){
48+
var call = {
49+
'defaultMethod': 'put',
50+
'urlTemplate': '/crosses',
51+
'params': params,
52+
'behaviorOptions': ['fork','map'],
53+
'behavior': behavior,
54+
}
55+
this.version.check(call.urlTemplate,{
56+
introduced:"v2.0"
57+
});
58+
return this.simple_brapi_call(call);
59+
}

0 commit comments

Comments
 (0)