Skip to content

Commit 1c8fb10

Browse files
committed
feat: add condition support in mathadd api
1 parent 965989a commit 1c8fb10

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

docs/generatedApiDocs/api/api-API.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ document with the given documentId in the given table
176176
* `tableName` **[string][1]** The name of the table in which the document is present.
177177
* `documentId` **[string][1]** The document id of the document you want to update.
178178
* `jsonFieldsIncrements` **[Object][4]** This is a JSON object that contains the fields and their increments.
179+
* `condition` **[string][1]?** Optional coco query condition of the form "$.cost<35" that must be satisfied
180+
for update to happen. See query API for more details on how to write coco query strings.
179181

180182
Returns **[Promise][2]<[MathAddResponse][6]>** A promise
181183

src/api/api.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,11 @@ export function get(tableName, documentId) {
271271
* @param {string} tableName - The name of the table in which the document is present.
272272
* @param {string} documentId - The document id of the document you want to update.
273273
* @param {Object}jsonFieldsIncrements - This is a JSON object that contains the fields and their increments.
274+
* @param {string} [condition] - Optional coco query condition of the form "$.cost<35" that must be satisfied
275+
* for update to happen. See query API for more details on how to write coco query strings.
274276
* @returns{Promise<MathAddResponse>} A promise
275277
*/
276-
export function mathAdd(tableName, documentId, jsonFieldsIncrements) {
278+
export function mathAdd(tableName, documentId, jsonFieldsIncrements, condition) {
277279
if (isStringEmpty(tableName)) {
278280
throw new Error('Please provide valid table Name');
279281
}
@@ -286,7 +288,8 @@ export function mathAdd(tableName, documentId, jsonFieldsIncrements) {
286288
return httpPut('/mathAdd', {
287289
tableName: tableName,
288290
documentId: documentId,
289-
jsonFieldsIncrements: jsonFieldsIncrements
291+
jsonFieldsIncrements: jsonFieldsIncrements,
292+
condition: condition
290293
});
291294
}
292295

0 commit comments

Comments
 (0)