Skip to content

Commit 192d449

Browse files
add queryDocument post call
1 parent 08013b3 commit 192d449

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

lib/woqlClient.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,34 @@ WOQLClient.prototype.addDocument = function(json, params, dbId, message="add a n
10261026
return this.dispatch(CONST.POST, this.connectionConfig.documentURL(docParams), json)
10271027
}
10281028

1029+
/**
1030+
* Retrieves all documents that match a given document template
1031+
* @param {object} [query] - the query template
1032+
* @param {typedef.DocParamsGet} [params] - the get parameters
1033+
* @param {string} [dbId] - the database id
1034+
* @param {string} [branch] - the database branch
1035+
* @returns {Promise} A promise that returns the call response object, or an Error if rejected.
1036+
* @example
1037+
* const query = {
1038+
* "type": "Person",
1039+
* "count": 10,
1040+
* "query": { "age": 42 },
1041+
* }
1042+
* client.queryDocument(query,{"as_list":true})
1043+
*
1044+
*
1045+
*/
1046+
1047+
WOQLClient.prototype.queryDocument = function(query, params, dbId, branch){
1048+
if (dbId) {
1049+
this.db(dbId)
1050+
}
1051+
if(branch){
1052+
this.checkout(branch)
1053+
}
1054+
return this.dispatch(CONST.QUERY_DOCUMENT, this.connectionConfig.documentURL(params),query)
1055+
}
1056+
10291057
/**
10301058
*
10311059
* @param {typedef.DocParamsGet} [params] - the get parameters

0 commit comments

Comments
 (0)