Skip to content

Commit 53296e3

Browse files
committed
review documentation
1 parent 9d7a12e commit 53296e3

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/woqlClient.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ WOQLClient.prototype.userOrganizations = function (orgList) {
14731473
* but you can list the properties that you would like to see in the diff result in any case.
14741474
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
14751475
* @example
1476-
* client.getDiff(
1476+
* client.getJSONDiff(
14771477
* { "@id": "Person/Jane", "@type": "Person", name: "Jane" },
14781478
* { "@id": "Person/Jane", "@type": "Person", name: "Janine" }
14791479
* ).then(diffResult=>{
@@ -1503,31 +1503,32 @@ WOQLClient.prototype.getJSONDiff = function (before, after, options) {
15031503

15041504
/**
15051505
* Get the patch of difference between two documents.
1506+
* @param {string} dataVersion - The version from which to compare the object
1507+
* @param {object} jsonObject - The updated state of JSON document
15061508
* @param {string} id - The object id to be diffed
1507-
* @param {string} before - The version from which to compare the object
1508-
* @param {object} afterVersion - The updated state of JSON document
15091509
* @param {object} [options] - {keep:{}} Options to send to the diff endpoint
15101510
* the diff api outputs the changes between the input (branches or commits),
15111511
* but you can list the properties that you would like to see in the diff result in any case.
15121512
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
15131513
* @example
15141514
* const jsonObj = { "@id": "Person/Jane", "@type": "Person", name: "Janine" }
1515-
* client.getVersionObjectDiff(jsonObj, "a73ssscfx0kke7z76083cgswszdxy6l").then(diffResp=>{
1515+
* client.getVersionObjectDiff("main",jsonObj
1516+
* "Person/Jane").then(diffResp=>{
15161517
* console.log(diffResp)
15171518
* })
15181519
*/
1519-
WOQLClient.prototype.getVersionObjectDiff = function (jsonObject, dataVersion, id, options) {
1520-
if (typeof id !== 'string' || typeof beforeVersion !== 'string' || typeof after !== 'object') {
1521-
const errmsg = '"id", "beforeVersion" or "after" parameter error - you must specify a valid after json document and valid id and version';
1520+
WOQLClient.prototype.getVersionObjectDiff = function (dataVersion, jsonObject, id, options) {
1521+
if (typeof jsonObject !== 'object' || typeof dataVersion !== 'string') {
1522+
const errmsg = 'Parameters error - you must specify a valid jsonObject document and valid branch or commit';
15221523

15231524
return Promise.reject(
15241525
new Error(ErrorMessage.getInvalidParameterMessage(CONST.GET_DIFF, errmsg)),
15251526
);
15261527
}
15271528
const opt = options || {};
15281529
const payload = {
1529-
before: jsonObject,
1530-
after_data_version: dataVersion,
1530+
after: jsonObject,
1531+
before_data_version: dataVersion,
15311532
...opt,
15321533
};
15331534
if (id) {

0 commit comments

Comments
 (0)