From b1a9be3d8f588b506197766becd887b0686a4535 Mon Sep 17 00:00:00 2001 From: Mirella Flores Date: Wed, 7 Apr 2021 14:40:16 -0400 Subject: [PATCH] fix revisions comments --- docs/README.md | 25 +++++++++++++------------ src/brapi_methods/attributevalues.js | 6 +++--- src/brapi_methods/commoncropnames.js | 10 ++-------- src/brapi_methods/images.js | 19 +++++++++++++++++++ src/brapi_methods/lists.js | 27 ++++----------------------- src/brapi_methods/locations.js | 2 +- src/brapi_methods/observations.js | 8 ++++---- src/brapi_methods/observationunits.js | 8 ++++---- src/brapi_methods/people.js | 12 +----------- src/brapi_methods/trials.js | 2 +- 10 files changed, 52 insertions(+), 67 deletions(-) diff --git a/docs/README.md b/docs/README.md index c99fec4..4359cb4 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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 @@ -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 @@ -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) or `/observationLevels`( GET /search/attributevalues",{ - introduced:"v1.3" + introduced:"v2.0" }); return this.search("attributevalues",params,behavior); }; diff --git a/src/brapi_methods/commoncropnames.js b/src/brapi_methods/commoncropnames.js index 1d20bd6..19ae353 100644 --- a/src/brapi_methods/commoncropnames.js +++ b/src/brapi_methods/commoncropnames.js @@ -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,{ diff --git a/src/brapi_methods/images.js b/src/brapi_methods/images.js index 6a97b8f..90d3400 100644 --- a/src/brapi_methods/images.js +++ b/src/brapi_methods/images.js @@ -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 diff --git a/src/brapi_methods/lists.js b/src/brapi_methods/lists.js index 4abdcc7..6055776 100644 --- a/src/brapi_methods/lists.js +++ b/src/brapi_methods/lists.js @@ -77,33 +77,13 @@ 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', @@ -111,6 +91,7 @@ export function lists_store_items (params){ 'behavior': 'map', } this.version.check(call.urlTemplate,{ + introduced:"v1.3", introduced:"v2.0" }); return this.simple_brapi_call(call); @@ -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" }); diff --git a/src/brapi_methods/locations.js b/src/brapi_methods/locations.js index 2bdaf0c..52c2ab5 100644 --- a/src/brapi_methods/locations.js +++ b/src/brapi_methods/locations.js @@ -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" }); diff --git a/src/brapi_methods/observations.js b/src/brapi_methods/observations.js index f128130..a26c06b 100644 --- a/src/brapi_methods/observations.js +++ b/src/brapi_methods/observations.js @@ -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', @@ -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}', diff --git a/src/brapi_methods/observationunits.js b/src/brapi_methods/observationunits.js index 7916eaf..ccf0c39 100644 --- a/src/brapi_methods/observationunits.js +++ b/src/brapi_methods/observationunits.js @@ -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', @@ -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}', diff --git a/src/brapi_methods/people.js b/src/brapi_methods/people.js index 62ee08e..a1b5052 100644 --- a/src/brapi_methods/people.js +++ b/src/brapi_methods/people.js @@ -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" }); diff --git a/src/brapi_methods/trials.js b/src/brapi_methods/trials.js index 0ecf3c7..5847719 100644 --- a/src/brapi_methods/trials.js +++ b/src/brapi_methods/trials.js @@ -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" });