@@ -1168,6 +1168,7 @@ class Databases extends Service {
1168
1168
/// new collection resource using either a [server
1169
1169
/// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
1170
1170
/// API or directly from your database console.
1171
+ ///
1171
1172
Future <models.DocumentList > upsertDocuments ({
1172
1173
required String databaseId,
1173
1174
required String collectionId,
@@ -1378,6 +1379,66 @@ class Databases extends Service {
1378
1379
return res.data;
1379
1380
}
1380
1381
1382
+ /// Decrement a specific attribute of a document by a given value.
1383
+ Future <models.Document > decrementDocumentAttribute ({
1384
+ required String databaseId,
1385
+ required String collectionId,
1386
+ required String documentId,
1387
+ required String attribute,
1388
+ double ? value,
1389
+ double ? min,
1390
+ }) async {
1391
+ final String apiPath =
1392
+ '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'
1393
+ .replaceAll ('{databaseId}' , databaseId)
1394
+ .replaceAll ('{collectionId}' , collectionId)
1395
+ .replaceAll ('{documentId}' , documentId)
1396
+ .replaceAll ('{attribute}' , attribute);
1397
+
1398
+ final Map <String , dynamic > apiParams = {'value' : value, 'min' : min};
1399
+
1400
+ final Map <String , String > apiHeaders = {'content-type' : 'application/json' };
1401
+
1402
+ final res = await client.call (
1403
+ HttpMethod .patch,
1404
+ path: apiPath,
1405
+ params: apiParams,
1406
+ headers: apiHeaders,
1407
+ );
1408
+
1409
+ return models.Document .fromMap (res.data);
1410
+ }
1411
+
1412
+ /// Increment a specific attribute of a document by a given value.
1413
+ Future <models.Document > incrementDocumentAttribute ({
1414
+ required String databaseId,
1415
+ required String collectionId,
1416
+ required String documentId,
1417
+ required String attribute,
1418
+ double ? value,
1419
+ double ? max,
1420
+ }) async {
1421
+ final String apiPath =
1422
+ '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'
1423
+ .replaceAll ('{databaseId}' , databaseId)
1424
+ .replaceAll ('{collectionId}' , collectionId)
1425
+ .replaceAll ('{documentId}' , documentId)
1426
+ .replaceAll ('{attribute}' , attribute);
1427
+
1428
+ final Map <String , dynamic > apiParams = {'value' : value, 'max' : max};
1429
+
1430
+ final Map <String , String > apiHeaders = {'content-type' : 'application/json' };
1431
+
1432
+ final res = await client.call (
1433
+ HttpMethod .patch,
1434
+ path: apiPath,
1435
+ params: apiParams,
1436
+ headers: apiHeaders,
1437
+ );
1438
+
1439
+ return models.Document .fromMap (res.data);
1440
+ }
1441
+
1381
1442
/// List indexes in the collection.
1382
1443
Future <models.IndexList > listIndexes ({
1383
1444
required String databaseId,
0 commit comments