react-native-appwrite 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/sdk.js CHANGED
@@ -78,7 +78,7 @@ class Client {
78
78
  'x-sdk-name': 'React Native',
79
79
  'x-sdk-platform': 'client',
80
80
  'x-sdk-language': 'reactnative',
81
- 'x-sdk-version': '0.10.1',
81
+ 'x-sdk-version': '0.11.0',
82
82
  'X-Appwrite-Response-Format': '1.7.0',
83
83
  };
84
84
  this.realtime = {
@@ -463,7 +463,7 @@ class Account extends Service {
463
463
  *
464
464
  * @throws {AppwriteException}
465
465
  * @returns {Promise}
466
- */
466
+ */
467
467
  get() {
468
468
  const apiPath = '/account';
469
469
  const payload = {};
@@ -485,7 +485,7 @@ class Account extends Service {
485
485
  * @param {string} name
486
486
  * @throws {AppwriteException}
487
487
  * @returns {Promise}
488
- */
488
+ */
489
489
  create(userId, email, password, name) {
490
490
  if (typeof userId === 'undefined') {
491
491
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -529,7 +529,7 @@ class Account extends Service {
529
529
  * @param {string} password
530
530
  * @throws {AppwriteException}
531
531
  * @returns {Promise}
532
- */
532
+ */
533
533
  updateEmail(email, password) {
534
534
  if (typeof email === 'undefined') {
535
535
  throw new AppwriteException('Missing required parameter: "email"');
@@ -556,7 +556,7 @@ class Account extends Service {
556
556
  * @param {string[]} queries
557
557
  * @throws {AppwriteException}
558
558
  * @returns {Promise}
559
- */
559
+ */
560
560
  listIdentities(queries) {
561
561
  const apiPath = '/account/identities';
562
562
  const payload = {};
@@ -572,7 +572,7 @@ class Account extends Service {
572
572
  * @param {string} identityId
573
573
  * @throws {AppwriteException}
574
574
  * @returns {Promise}
575
- */
575
+ */
576
576
  deleteIdentity(identityId) {
577
577
  if (typeof identityId === 'undefined') {
578
578
  throw new AppwriteException('Missing required parameter: "identityId"');
@@ -593,7 +593,7 @@ class Account extends Service {
593
593
  *
594
594
  * @throws {AppwriteException}
595
595
  * @returns {Promise}
596
- */
596
+ */
597
597
  createJWT() {
598
598
  const apiPath = '/account/jwts';
599
599
  const payload = {};
@@ -609,7 +609,7 @@ class Account extends Service {
609
609
  * @param {string[]} queries
610
610
  * @throws {AppwriteException}
611
611
  * @returns {Promise}
612
- */
612
+ */
613
613
  listLogs(queries) {
614
614
  const apiPath = '/account/logs';
615
615
  const payload = {};
@@ -625,7 +625,7 @@ class Account extends Service {
625
625
  * @param {boolean} mfa
626
626
  * @throws {AppwriteException}
627
627
  * @returns {Promise}
628
- */
628
+ */
629
629
  updateMFA(mfa) {
630
630
  if (typeof mfa === 'undefined') {
631
631
  throw new AppwriteException('Missing required parameter: "mfa"');
@@ -649,7 +649,7 @@ class Account extends Service {
649
649
  * @param {AuthenticatorType} type
650
650
  * @throws {AppwriteException}
651
651
  * @returns {Promise}
652
- */
652
+ */
653
653
  createMfaAuthenticator(type) {
654
654
  if (typeof type === 'undefined') {
655
655
  throw new AppwriteException('Missing required parameter: "type"');
@@ -670,7 +670,7 @@ class Account extends Service {
670
670
  * @param {string} otp
671
671
  * @throws {AppwriteException}
672
672
  * @returns {Promise}
673
- */
673
+ */
674
674
  updateMfaAuthenticator(type, otp) {
675
675
  if (typeof type === 'undefined') {
676
676
  throw new AppwriteException('Missing required parameter: "type"');
@@ -694,7 +694,7 @@ class Account extends Service {
694
694
  * @param {AuthenticatorType} type
695
695
  * @throws {AppwriteException}
696
696
  * @returns {Promise}
697
- */
697
+ */
698
698
  deleteMfaAuthenticator(type) {
699
699
  if (typeof type === 'undefined') {
700
700
  throw new AppwriteException('Missing required parameter: "type"');
@@ -714,7 +714,7 @@ class Account extends Service {
714
714
  * @param {AuthenticationFactor} factor
715
715
  * @throws {AppwriteException}
716
716
  * @returns {Promise}
717
- */
717
+ */
718
718
  createMfaChallenge(factor) {
719
719
  if (typeof factor === 'undefined') {
720
720
  throw new AppwriteException('Missing required parameter: "factor"');
@@ -740,7 +740,7 @@ class Account extends Service {
740
740
  * @param {string} otp
741
741
  * @throws {AppwriteException}
742
742
  * @returns {Promise}
743
- */
743
+ */
744
744
  updateMfaChallenge(challengeId, otp) {
745
745
  if (typeof challengeId === 'undefined') {
746
746
  throw new AppwriteException('Missing required parameter: "challengeId"');
@@ -766,7 +766,7 @@ class Account extends Service {
766
766
  *
767
767
  * @throws {AppwriteException}
768
768
  * @returns {Promise}
769
- */
769
+ */
770
770
  listMfaFactors() {
771
771
  const apiPath = '/account/mfa/factors';
772
772
  const payload = {};
@@ -781,7 +781,7 @@ class Account extends Service {
781
781
  *
782
782
  * @throws {AppwriteException}
783
783
  * @returns {Promise}
784
- */
784
+ */
785
785
  getMfaRecoveryCodes() {
786
786
  const apiPath = '/account/mfa/recovery-codes';
787
787
  const payload = {};
@@ -797,7 +797,7 @@ class Account extends Service {
797
797
  *
798
798
  * @throws {AppwriteException}
799
799
  * @returns {Promise}
800
- */
800
+ */
801
801
  createMfaRecoveryCodes() {
802
802
  const apiPath = '/account/mfa/recovery-codes';
803
803
  const payload = {};
@@ -814,7 +814,7 @@ class Account extends Service {
814
814
  *
815
815
  * @throws {AppwriteException}
816
816
  * @returns {Promise}
817
- */
817
+ */
818
818
  updateMfaRecoveryCodes() {
819
819
  const apiPath = '/account/mfa/recovery-codes';
820
820
  const payload = {};
@@ -829,7 +829,7 @@ class Account extends Service {
829
829
  * @param {string} name
830
830
  * @throws {AppwriteException}
831
831
  * @returns {Promise}
832
- */
832
+ */
833
833
  updateName(name) {
834
834
  if (typeof name === 'undefined') {
835
835
  throw new AppwriteException('Missing required parameter: "name"');
@@ -853,7 +853,7 @@ class Account extends Service {
853
853
  * @param {string} oldPassword
854
854
  * @throws {AppwriteException}
855
855
  * @returns {Promise}
856
- */
856
+ */
857
857
  updatePassword(password, oldPassword) {
858
858
  if (typeof password === 'undefined') {
859
859
  throw new AppwriteException('Missing required parameter: "password"');
@@ -882,7 +882,7 @@ class Account extends Service {
882
882
  * @param {string} password
883
883
  * @throws {AppwriteException}
884
884
  * @returns {Promise}
885
- */
885
+ */
886
886
  updatePhone(phone, password) {
887
887
  if (typeof phone === 'undefined') {
888
888
  throw new AppwriteException('Missing required parameter: "phone"');
@@ -908,7 +908,7 @@ class Account extends Service {
908
908
  *
909
909
  * @throws {AppwriteException}
910
910
  * @returns {Promise}
911
- */
911
+ */
912
912
  getPrefs() {
913
913
  const apiPath = '/account/prefs';
914
914
  const payload = {};
@@ -923,7 +923,7 @@ class Account extends Service {
923
923
  * @param {object} prefs
924
924
  * @throws {AppwriteException}
925
925
  * @returns {Promise}
926
- */
926
+ */
927
927
  updatePrefs(prefs) {
928
928
  if (typeof prefs === 'undefined') {
929
929
  throw new AppwriteException('Missing required parameter: "prefs"');
@@ -952,7 +952,7 @@ class Account extends Service {
952
952
  * @param {string} url
953
953
  * @throws {AppwriteException}
954
954
  * @returns {Promise}
955
- */
955
+ */
956
956
  createRecovery(email, url) {
957
957
  if (typeof email === 'undefined') {
958
958
  throw new AppwriteException('Missing required parameter: "email"');
@@ -990,7 +990,7 @@ class Account extends Service {
990
990
  * @param {string} password
991
991
  * @throws {AppwriteException}
992
992
  * @returns {Promise}
993
- */
993
+ */
994
994
  updateRecovery(userId, secret, password) {
995
995
  if (typeof userId === 'undefined') {
996
996
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1023,7 +1023,7 @@ class Account extends Service {
1023
1023
  *
1024
1024
  * @throws {AppwriteException}
1025
1025
  * @returns {Promise}
1026
- */
1026
+ */
1027
1027
  listSessions() {
1028
1028
  const apiPath = '/account/sessions';
1029
1029
  const payload = {};
@@ -1036,7 +1036,7 @@ class Account extends Service {
1036
1036
  *
1037
1037
  * @throws {AppwriteException}
1038
1038
  * @returns {Promise}
1039
- */
1039
+ */
1040
1040
  deleteSessions() {
1041
1041
  const apiPath = '/account/sessions';
1042
1042
  const payload = {};
@@ -1056,7 +1056,7 @@ class Account extends Service {
1056
1056
  *
1057
1057
  * @throws {AppwriteException}
1058
1058
  * @returns {Promise}
1059
- */
1059
+ */
1060
1060
  createAnonymousSession() {
1061
1061
  const apiPath = '/account/sessions/anonymous';
1062
1062
  const payload = {};
@@ -1077,7 +1077,7 @@ class Account extends Service {
1077
1077
  * @param {string} password
1078
1078
  * @throws {AppwriteException}
1079
1079
  * @returns {Promise}
1080
- */
1080
+ */
1081
1081
  createEmailPasswordSession(email, password) {
1082
1082
  if (typeof email === 'undefined') {
1083
1083
  throw new AppwriteException('Missing required parameter: "email"');
@@ -1107,7 +1107,7 @@ class Account extends Service {
1107
1107
  * @param {string} secret
1108
1108
  * @throws {AppwriteException}
1109
1109
  * @returns {Promise}
1110
- */
1110
+ */
1111
1111
  updateMagicURLSession(userId, secret) {
1112
1112
  if (typeof userId === 'undefined') {
1113
1113
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1152,7 +1152,7 @@ class Account extends Service {
1152
1152
  * @param {string[]} scopes
1153
1153
  * @throws {AppwriteException}
1154
1154
  * @returns {void|string}
1155
- */
1155
+ */
1156
1156
  createOAuth2Session(provider, success, failure, scopes) {
1157
1157
  if (typeof provider === 'undefined') {
1158
1158
  throw new AppwriteException('Missing required parameter: "provider"');
@@ -1184,7 +1184,7 @@ class Account extends Service {
1184
1184
  * @param {string} secret
1185
1185
  * @throws {AppwriteException}
1186
1186
  * @returns {Promise}
1187
- */
1187
+ */
1188
1188
  updatePhoneSession(userId, secret) {
1189
1189
  if (typeof userId === 'undefined') {
1190
1190
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1214,7 +1214,7 @@ class Account extends Service {
1214
1214
  * @param {string} secret
1215
1215
  * @throws {AppwriteException}
1216
1216
  * @returns {Promise}
1217
- */
1217
+ */
1218
1218
  createSession(userId, secret) {
1219
1219
  if (typeof userId === 'undefined') {
1220
1220
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1242,7 +1242,7 @@ class Account extends Service {
1242
1242
  * @param {string} sessionId
1243
1243
  * @throws {AppwriteException}
1244
1244
  * @returns {Promise}
1245
- */
1245
+ */
1246
1246
  getSession(sessionId) {
1247
1247
  if (typeof sessionId === 'undefined') {
1248
1248
  throw new AppwriteException('Missing required parameter: "sessionId"');
@@ -1260,7 +1260,7 @@ class Account extends Service {
1260
1260
  * @param {string} sessionId
1261
1261
  * @throws {AppwriteException}
1262
1262
  * @returns {Promise}
1263
- */
1263
+ */
1264
1264
  updateSession(sessionId) {
1265
1265
  if (typeof sessionId === 'undefined') {
1266
1266
  throw new AppwriteException('Missing required parameter: "sessionId"');
@@ -1282,7 +1282,7 @@ class Account extends Service {
1282
1282
  * @param {string} sessionId
1283
1283
  * @throws {AppwriteException}
1284
1284
  * @returns {Promise}
1285
- */
1285
+ */
1286
1286
  deleteSession(sessionId) {
1287
1287
  if (typeof sessionId === 'undefined') {
1288
1288
  throw new AppwriteException('Missing required parameter: "sessionId"');
@@ -1301,7 +1301,7 @@ class Account extends Service {
1301
1301
  *
1302
1302
  * @throws {AppwriteException}
1303
1303
  * @returns {Promise}
1304
- */
1304
+ */
1305
1305
  updateStatus() {
1306
1306
  const apiPath = '/account/status';
1307
1307
  const payload = {};
@@ -1322,7 +1322,7 @@ class Account extends Service {
1322
1322
  * @param {string} providerId
1323
1323
  * @throws {AppwriteException}
1324
1324
  * @returns {Promise}
1325
- */
1325
+ */
1326
1326
  createPushTarget(targetId, identifier, providerId) {
1327
1327
  if (typeof targetId === 'undefined') {
1328
1328
  throw new AppwriteException('Missing required parameter: "targetId"');
@@ -1357,7 +1357,7 @@ class Account extends Service {
1357
1357
  * @param {string} identifier
1358
1358
  * @throws {AppwriteException}
1359
1359
  * @returns {Promise}
1360
- */
1360
+ */
1361
1361
  updatePushTarget(targetId, identifier) {
1362
1362
  if (typeof targetId === 'undefined') {
1363
1363
  throw new AppwriteException('Missing required parameter: "targetId"');
@@ -1383,7 +1383,7 @@ class Account extends Service {
1383
1383
  * @param {string} targetId
1384
1384
  * @throws {AppwriteException}
1385
1385
  * @returns {Promise}
1386
- */
1386
+ */
1387
1387
  deletePushTarget(targetId) {
1388
1388
  if (typeof targetId === 'undefined') {
1389
1389
  throw new AppwriteException('Missing required parameter: "targetId"');
@@ -1412,7 +1412,7 @@ class Account extends Service {
1412
1412
  * @param {boolean} phrase
1413
1413
  * @throws {AppwriteException}
1414
1414
  * @returns {Promise}
1415
- */
1415
+ */
1416
1416
  createEmailToken(userId, email, phrase) {
1417
1417
  if (typeof userId === 'undefined') {
1418
1418
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1458,7 +1458,7 @@ class Account extends Service {
1458
1458
  * @param {boolean} phrase
1459
1459
  * @throws {AppwriteException}
1460
1460
  * @returns {Promise}
1461
- */
1461
+ */
1462
1462
  createMagicURLToken(userId, email, url, phrase) {
1463
1463
  if (typeof userId === 'undefined') {
1464
1464
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1507,7 +1507,7 @@ class Account extends Service {
1507
1507
  * @param {string[]} scopes
1508
1508
  * @throws {AppwriteException}
1509
1509
  * @returns {void|string}
1510
- */
1510
+ */
1511
1511
  createOAuth2Token(provider, success, failure, scopes) {
1512
1512
  if (typeof provider === 'undefined') {
1513
1513
  throw new AppwriteException('Missing required parameter: "provider"');
@@ -1546,7 +1546,7 @@ class Account extends Service {
1546
1546
  * @param {string} phone
1547
1547
  * @throws {AppwriteException}
1548
1548
  * @returns {Promise}
1549
- */
1549
+ */
1550
1550
  createPhoneToken(userId, phone) {
1551
1551
  if (typeof userId === 'undefined') {
1552
1552
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1587,7 +1587,7 @@ class Account extends Service {
1587
1587
  * @param {string} url
1588
1588
  * @throws {AppwriteException}
1589
1589
  * @returns {Promise}
1590
- */
1590
+ */
1591
1591
  createVerification(url) {
1592
1592
  if (typeof url === 'undefined') {
1593
1593
  throw new AppwriteException('Missing required parameter: "url"');
@@ -1612,7 +1612,7 @@ class Account extends Service {
1612
1612
  * @param {string} secret
1613
1613
  * @throws {AppwriteException}
1614
1614
  * @returns {Promise}
1615
- */
1615
+ */
1616
1616
  updateVerification(userId, secret) {
1617
1617
  if (typeof userId === 'undefined') {
1618
1618
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1645,7 +1645,7 @@ class Account extends Service {
1645
1645
  *
1646
1646
  * @throws {AppwriteException}
1647
1647
  * @returns {Promise}
1648
- */
1648
+ */
1649
1649
  createPhoneVerification() {
1650
1650
  const apiPath = '/account/verification/phone';
1651
1651
  const payload = {};
@@ -1664,7 +1664,7 @@ class Account extends Service {
1664
1664
  * @param {string} secret
1665
1665
  * @throws {AppwriteException}
1666
1666
  * @returns {Promise}
1667
- */
1667
+ */
1668
1668
  updatePhoneVerification(userId, secret) {
1669
1669
  if (typeof userId === 'undefined') {
1670
1670
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1709,7 +1709,7 @@ class Avatars extends Service {
1709
1709
  * @param {number} quality
1710
1710
  * @throws {AppwriteException}
1711
1711
  * @returns {ArrayBuffer}
1712
- */
1712
+ */
1713
1713
  getBrowser(code, width, height, quality) {
1714
1714
  if (typeof code === 'undefined') {
1715
1715
  throw new AppwriteException('Missing required parameter: "code"');
@@ -1749,7 +1749,7 @@ class Avatars extends Service {
1749
1749
  * @param {number} quality
1750
1750
  * @throws {AppwriteException}
1751
1751
  * @returns {ArrayBuffer}
1752
- */
1752
+ */
1753
1753
  getCreditCard(code, width, height, quality) {
1754
1754
  if (typeof code === 'undefined') {
1755
1755
  throw new AppwriteException('Missing required parameter: "code"');
@@ -1781,7 +1781,7 @@ class Avatars extends Service {
1781
1781
  * @param {string} url
1782
1782
  * @throws {AppwriteException}
1783
1783
  * @returns {ArrayBuffer}
1784
- */
1784
+ */
1785
1785
  getFavicon(url) {
1786
1786
  if (typeof url === 'undefined') {
1787
1787
  throw new AppwriteException('Missing required parameter: "url"');
@@ -1816,7 +1816,7 @@ class Avatars extends Service {
1816
1816
  * @param {number} quality
1817
1817
  * @throws {AppwriteException}
1818
1818
  * @returns {ArrayBuffer}
1819
- */
1819
+ */
1820
1820
  getFlag(code, width, height, quality) {
1821
1821
  if (typeof code === 'undefined') {
1822
1822
  throw new AppwriteException('Missing required parameter: "code"');
@@ -1857,7 +1857,7 @@ class Avatars extends Service {
1857
1857
  * @param {number} height
1858
1858
  * @throws {AppwriteException}
1859
1859
  * @returns {ArrayBuffer}
1860
- */
1860
+ */
1861
1861
  getImage(url, width, height) {
1862
1862
  if (typeof url === 'undefined') {
1863
1863
  throw new AppwriteException('Missing required parameter: "url"');
@@ -1904,7 +1904,7 @@ class Avatars extends Service {
1904
1904
  * @param {string} background
1905
1905
  * @throws {AppwriteException}
1906
1906
  * @returns {ArrayBuffer}
1907
- */
1907
+ */
1908
1908
  getInitials(name, width, height, background) {
1909
1909
  const apiPath = '/avatars/initials';
1910
1910
  const payload = {};
@@ -1938,7 +1938,7 @@ class Avatars extends Service {
1938
1938
  * @param {boolean} download
1939
1939
  * @throws {AppwriteException}
1940
1940
  * @returns {ArrayBuffer}
1941
- */
1941
+ */
1942
1942
  getQR(text, size, margin, download) {
1943
1943
  if (typeof text === 'undefined') {
1944
1944
  throw new AppwriteException('Missing required parameter: "text"');
@@ -2234,7 +2234,7 @@ class Databases extends Service {
2234
2234
  * @param {string[]} queries
2235
2235
  * @throws {AppwriteException}
2236
2236
  * @returns {Promise}
2237
- */
2237
+ */
2238
2238
  listDocuments(databaseId, collectionId, queries) {
2239
2239
  if (typeof databaseId === 'undefined') {
2240
2240
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2263,7 +2263,7 @@ class Databases extends Service {
2263
2263
  * @param {string[]} permissions
2264
2264
  * @throws {AppwriteException}
2265
2265
  * @returns {Promise}
2266
- */
2266
+ */
2267
2267
  createDocument(databaseId, collectionId, documentId, data, permissions) {
2268
2268
  if (typeof databaseId === 'undefined') {
2269
2269
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2303,7 +2303,7 @@ class Databases extends Service {
2303
2303
  * @param {string[]} queries
2304
2304
  * @throws {AppwriteException}
2305
2305
  * @returns {Promise}
2306
- */
2306
+ */
2307
2307
  getDocument(databaseId, collectionId, documentId, queries) {
2308
2308
  if (typeof databaseId === 'undefined') {
2309
2309
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2339,7 +2339,7 @@ class Databases extends Service {
2339
2339
  * @param {string[]} permissions
2340
2340
  * @throws {AppwriteException}
2341
2341
  * @returns {Promise}
2342
- */
2342
+ */
2343
2343
  upsertDocument(databaseId, collectionId, documentId, data, permissions) {
2344
2344
  if (typeof databaseId === 'undefined') {
2345
2345
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2377,7 +2377,7 @@ class Databases extends Service {
2377
2377
  * @param {string[]} permissions
2378
2378
  * @throws {AppwriteException}
2379
2379
  * @returns {Promise}
2380
- */
2380
+ */
2381
2381
  updateDocument(databaseId, collectionId, documentId, data, permissions) {
2382
2382
  if (typeof databaseId === 'undefined') {
2383
2383
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2409,7 +2409,7 @@ class Databases extends Service {
2409
2409
  * @param {string} documentId
2410
2410
  * @throws {AppwriteException}
2411
2411
  * @returns {Promise}
2412
- */
2412
+ */
2413
2413
  deleteDocument(databaseId, collectionId, documentId) {
2414
2414
  if (typeof databaseId === 'undefined') {
2415
2415
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2427,6 +2427,82 @@ class Databases extends Service {
2427
2427
  'content-type': 'application/json',
2428
2428
  }, payload);
2429
2429
  }
2430
+ /**
2431
+ * Decrement a specific attribute of a document by a given value.
2432
+ *
2433
+ * @param {string} databaseId
2434
+ * @param {string} collectionId
2435
+ * @param {string} documentId
2436
+ * @param {string} attribute
2437
+ * @param {number} value
2438
+ * @param {number} min
2439
+ * @throws {AppwriteException}
2440
+ * @returns {Promise}
2441
+ */
2442
+ decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min) {
2443
+ if (typeof databaseId === 'undefined') {
2444
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2445
+ }
2446
+ if (typeof collectionId === 'undefined') {
2447
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2448
+ }
2449
+ if (typeof documentId === 'undefined') {
2450
+ throw new AppwriteException('Missing required parameter: "documentId"');
2451
+ }
2452
+ if (typeof attribute === 'undefined') {
2453
+ throw new AppwriteException('Missing required parameter: "attribute"');
2454
+ }
2455
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2456
+ const payload = {};
2457
+ if (typeof value !== 'undefined') {
2458
+ payload['value'] = value;
2459
+ }
2460
+ if (typeof min !== 'undefined') {
2461
+ payload['min'] = min;
2462
+ }
2463
+ const uri = new URL(this.client.config.endpoint + apiPath);
2464
+ return this.client.call('patch', uri, {
2465
+ 'content-type': 'application/json',
2466
+ }, payload);
2467
+ }
2468
+ /**
2469
+ * Increment a specific attribute of a document by a given value.
2470
+ *
2471
+ * @param {string} databaseId
2472
+ * @param {string} collectionId
2473
+ * @param {string} documentId
2474
+ * @param {string} attribute
2475
+ * @param {number} value
2476
+ * @param {number} max
2477
+ * @throws {AppwriteException}
2478
+ * @returns {Promise}
2479
+ */
2480
+ incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max) {
2481
+ if (typeof databaseId === 'undefined') {
2482
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2483
+ }
2484
+ if (typeof collectionId === 'undefined') {
2485
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2486
+ }
2487
+ if (typeof documentId === 'undefined') {
2488
+ throw new AppwriteException('Missing required parameter: "documentId"');
2489
+ }
2490
+ if (typeof attribute === 'undefined') {
2491
+ throw new AppwriteException('Missing required parameter: "attribute"');
2492
+ }
2493
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2494
+ const payload = {};
2495
+ if (typeof value !== 'undefined') {
2496
+ payload['value'] = value;
2497
+ }
2498
+ if (typeof max !== 'undefined') {
2499
+ payload['max'] = max;
2500
+ }
2501
+ const uri = new URL(this.client.config.endpoint + apiPath);
2502
+ return this.client.call('patch', uri, {
2503
+ 'content-type': 'application/json',
2504
+ }, payload);
2505
+ }
2430
2506
  }
2431
2507
 
2432
2508
  class Functions extends Service {
@@ -2441,7 +2517,7 @@ class Functions extends Service {
2441
2517
  * @param {string[]} queries
2442
2518
  * @throws {AppwriteException}
2443
2519
  * @returns {Promise}
2444
- */
2520
+ */
2445
2521
  listExecutions(functionId, queries) {
2446
2522
  if (typeof functionId === 'undefined') {
2447
2523
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -2469,7 +2545,7 @@ class Functions extends Service {
2469
2545
  * @param {string} scheduledAt
2470
2546
  * @throws {AppwriteException}
2471
2547
  * @returns {Promise}
2472
- */
2548
+ */
2473
2549
  createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
2474
2550
  if (typeof functionId === 'undefined') {
2475
2551
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -2506,7 +2582,7 @@ class Functions extends Service {
2506
2582
  * @param {string} executionId
2507
2583
  * @throws {AppwriteException}
2508
2584
  * @returns {Promise}
2509
- */
2585
+ */
2510
2586
  getExecution(functionId, executionId) {
2511
2587
  if (typeof functionId === 'undefined') {
2512
2588
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -2531,7 +2607,7 @@ class Graphql extends Service {
2531
2607
  * @param {object} query
2532
2608
  * @throws {AppwriteException}
2533
2609
  * @returns {Promise}
2534
- */
2610
+ */
2535
2611
  query(query) {
2536
2612
  if (typeof query === 'undefined') {
2537
2613
  throw new AppwriteException('Missing required parameter: "query"');
@@ -2553,7 +2629,7 @@ class Graphql extends Service {
2553
2629
  * @param {object} query
2554
2630
  * @throws {AppwriteException}
2555
2631
  * @returns {Promise}
2556
- */
2632
+ */
2557
2633
  mutation(query) {
2558
2634
  if (typeof query === 'undefined') {
2559
2635
  throw new AppwriteException('Missing required parameter: "query"');
@@ -2585,7 +2661,7 @@ class Locale extends Service {
2585
2661
  *
2586
2662
  * @throws {AppwriteException}
2587
2663
  * @returns {Promise}
2588
- */
2664
+ */
2589
2665
  get() {
2590
2666
  const apiPath = '/locale';
2591
2667
  const payload = {};
@@ -2598,7 +2674,7 @@ class Locale extends Service {
2598
2674
  *
2599
2675
  * @throws {AppwriteException}
2600
2676
  * @returns {Promise}
2601
- */
2677
+ */
2602
2678
  listCodes() {
2603
2679
  const apiPath = '/locale/codes';
2604
2680
  const payload = {};
@@ -2611,7 +2687,7 @@ class Locale extends Service {
2611
2687
  *
2612
2688
  * @throws {AppwriteException}
2613
2689
  * @returns {Promise}
2614
- */
2690
+ */
2615
2691
  listContinents() {
2616
2692
  const apiPath = '/locale/continents';
2617
2693
  const payload = {};
@@ -2624,7 +2700,7 @@ class Locale extends Service {
2624
2700
  *
2625
2701
  * @throws {AppwriteException}
2626
2702
  * @returns {Promise}
2627
- */
2703
+ */
2628
2704
  listCountries() {
2629
2705
  const apiPath = '/locale/countries';
2630
2706
  const payload = {};
@@ -2637,7 +2713,7 @@ class Locale extends Service {
2637
2713
  *
2638
2714
  * @throws {AppwriteException}
2639
2715
  * @returns {Promise}
2640
- */
2716
+ */
2641
2717
  listCountriesEU() {
2642
2718
  const apiPath = '/locale/countries/eu';
2643
2719
  const payload = {};
@@ -2650,7 +2726,7 @@ class Locale extends Service {
2650
2726
  *
2651
2727
  * @throws {AppwriteException}
2652
2728
  * @returns {Promise}
2653
- */
2729
+ */
2654
2730
  listCountriesPhones() {
2655
2731
  const apiPath = '/locale/countries/phones';
2656
2732
  const payload = {};
@@ -2664,7 +2740,7 @@ class Locale extends Service {
2664
2740
  *
2665
2741
  * @throws {AppwriteException}
2666
2742
  * @returns {Promise}
2667
- */
2743
+ */
2668
2744
  listCurrencies() {
2669
2745
  const apiPath = '/locale/currencies';
2670
2746
  const payload = {};
@@ -2677,7 +2753,7 @@ class Locale extends Service {
2677
2753
  *
2678
2754
  * @throws {AppwriteException}
2679
2755
  * @returns {Promise}
2680
- */
2756
+ */
2681
2757
  listLanguages() {
2682
2758
  const apiPath = '/locale/languages';
2683
2759
  const payload = {};
@@ -2698,7 +2774,7 @@ class Messaging extends Service {
2698
2774
  * @param {string} targetId
2699
2775
  * @throws {AppwriteException}
2700
2776
  * @returns {Promise}
2701
- */
2777
+ */
2702
2778
  createSubscriber(topicId, subscriberId, targetId) {
2703
2779
  if (typeof topicId === 'undefined') {
2704
2780
  throw new AppwriteException('Missing required parameter: "topicId"');
@@ -2729,7 +2805,7 @@ class Messaging extends Service {
2729
2805
  * @param {string} subscriberId
2730
2806
  * @throws {AppwriteException}
2731
2807
  * @returns {Promise}
2732
- */
2808
+ */
2733
2809
  deleteSubscriber(topicId, subscriberId) {
2734
2810
  if (typeof topicId === 'undefined') {
2735
2811
  throw new AppwriteException('Missing required parameter: "topicId"');
@@ -2759,7 +2835,7 @@ class Storage extends Service {
2759
2835
  * @param {string} search
2760
2836
  * @throws {AppwriteException}
2761
2837
  * @returns {Promise}
2762
- */
2838
+ */
2763
2839
  listFiles(bucketId, queries, search) {
2764
2840
  if (typeof bucketId === 'undefined') {
2765
2841
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2801,7 +2877,7 @@ class Storage extends Service {
2801
2877
  * @param {string[]} permissions
2802
2878
  * @throws {AppwriteException}
2803
2879
  * @returns {Promise}
2804
- */
2880
+ */
2805
2881
  createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2806
2882
  return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2807
2883
  if (typeof bucketId === 'undefined') {
@@ -2883,7 +2959,7 @@ class Storage extends Service {
2883
2959
  * @param {string} fileId
2884
2960
  * @throws {AppwriteException}
2885
2961
  * @returns {Promise}
2886
- */
2962
+ */
2887
2963
  getFile(bucketId, fileId) {
2888
2964
  if (typeof bucketId === 'undefined') {
2889
2965
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2906,7 +2982,7 @@ class Storage extends Service {
2906
2982
  * @param {string[]} permissions
2907
2983
  * @throws {AppwriteException}
2908
2984
  * @returns {Promise}
2909
- */
2985
+ */
2910
2986
  updateFile(bucketId, fileId, name, permissions) {
2911
2987
  if (typeof bucketId === 'undefined') {
2912
2988
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2935,7 +3011,7 @@ class Storage extends Service {
2935
3011
  * @param {string} fileId
2936
3012
  * @throws {AppwriteException}
2937
3013
  * @returns {Promise}
2938
- */
3014
+ */
2939
3015
  deleteFile(bucketId, fileId) {
2940
3016
  if (typeof bucketId === 'undefined') {
2941
3017
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2960,7 +3036,7 @@ class Storage extends Service {
2960
3036
  * @param {string} token
2961
3037
  * @throws {AppwriteException}
2962
3038
  * @returns {ArrayBuffer}
2963
- */
3039
+ */
2964
3040
  getFileDownload(bucketId, fileId, token) {
2965
3041
  if (typeof bucketId === 'undefined') {
2966
3042
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -3003,7 +3079,7 @@ class Storage extends Service {
3003
3079
  * @param {string} token
3004
3080
  * @throws {AppwriteException}
3005
3081
  * @returns {ArrayBuffer}
3006
- */
3082
+ */
3007
3083
  getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
3008
3084
  if (typeof bucketId === 'undefined') {
3009
3085
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -3066,7 +3142,7 @@ class Storage extends Service {
3066
3142
  * @param {string} token
3067
3143
  * @throws {AppwriteException}
3068
3144
  * @returns {ArrayBuffer}
3069
- */
3145
+ */
3070
3146
  getFileView(bucketId, fileId, token) {
3071
3147
  if (typeof bucketId === 'undefined') {
3072
3148
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -3218,7 +3294,7 @@ class Teams extends Service {
3218
3294
  * @param {string} search
3219
3295
  * @throws {AppwriteException}
3220
3296
  * @returns {Promise}
3221
- */
3297
+ */
3222
3298
  list(queries, search) {
3223
3299
  const apiPath = '/teams';
3224
3300
  const payload = {};
@@ -3241,7 +3317,7 @@ class Teams extends Service {
3241
3317
  * @param {string[]} roles
3242
3318
  * @throws {AppwriteException}
3243
3319
  * @returns {Promise}
3244
- */
3320
+ */
3245
3321
  create(teamId, name, roles) {
3246
3322
  if (typeof teamId === 'undefined') {
3247
3323
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3271,7 +3347,7 @@ class Teams extends Service {
3271
3347
  * @param {string} teamId
3272
3348
  * @throws {AppwriteException}
3273
3349
  * @returns {Promise}
3274
- */
3350
+ */
3275
3351
  get(teamId) {
3276
3352
  if (typeof teamId === 'undefined') {
3277
3353
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3288,7 +3364,7 @@ class Teams extends Service {
3288
3364
  * @param {string} name
3289
3365
  * @throws {AppwriteException}
3290
3366
  * @returns {Promise}
3291
- */
3367
+ */
3292
3368
  updateName(teamId, name) {
3293
3369
  if (typeof teamId === 'undefined') {
3294
3370
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3313,7 +3389,7 @@ class Teams extends Service {
3313
3389
  * @param {string} teamId
3314
3390
  * @throws {AppwriteException}
3315
3391
  * @returns {Promise}
3316
- */
3392
+ */
3317
3393
  delete(teamId) {
3318
3394
  if (typeof teamId === 'undefined') {
3319
3395
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3335,7 +3411,7 @@ class Teams extends Service {
3335
3411
  * @param {string} search
3336
3412
  * @throws {AppwriteException}
3337
3413
  * @returns {Promise}
3338
- */
3414
+ */
3339
3415
  listMemberships(teamId, queries, search) {
3340
3416
  if (typeof teamId === 'undefined') {
3341
3417
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3383,7 +3459,7 @@ class Teams extends Service {
3383
3459
  * @param {string} name
3384
3460
  * @throws {AppwriteException}
3385
3461
  * @returns {Promise}
3386
- */
3462
+ */
3387
3463
  createMembership(teamId, roles, email, userId, phone, url, name) {
3388
3464
  if (typeof teamId === 'undefined') {
3389
3465
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3425,7 +3501,7 @@ class Teams extends Service {
3425
3501
  * @param {string} membershipId
3426
3502
  * @throws {AppwriteException}
3427
3503
  * @returns {Promise}
3428
- */
3504
+ */
3429
3505
  getMembership(teamId, membershipId) {
3430
3506
  if (typeof teamId === 'undefined') {
3431
3507
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3449,7 +3525,7 @@ class Teams extends Service {
3449
3525
  * @param {string[]} roles
3450
3526
  * @throws {AppwriteException}
3451
3527
  * @returns {Promise}
3452
- */
3528
+ */
3453
3529
  updateMembership(teamId, membershipId, roles) {
3454
3530
  if (typeof teamId === 'undefined') {
3455
3531
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3479,7 +3555,7 @@ class Teams extends Service {
3479
3555
  * @param {string} membershipId
3480
3556
  * @throws {AppwriteException}
3481
3557
  * @returns {Promise}
3482
- */
3558
+ */
3483
3559
  deleteMembership(teamId, membershipId) {
3484
3560
  if (typeof teamId === 'undefined') {
3485
3561
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3509,7 +3585,7 @@ class Teams extends Service {
3509
3585
  * @param {string} secret
3510
3586
  * @throws {AppwriteException}
3511
3587
  * @returns {Promise}
3512
- */
3588
+ */
3513
3589
  updateMembershipStatus(teamId, membershipId, userId, secret) {
3514
3590
  if (typeof teamId === 'undefined') {
3515
3591
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3544,7 +3620,7 @@ class Teams extends Service {
3544
3620
  * @param {string} teamId
3545
3621
  * @throws {AppwriteException}
3546
3622
  * @returns {Promise}
3547
- */
3623
+ */
3548
3624
  getPrefs(teamId) {
3549
3625
  if (typeof teamId === 'undefined') {
3550
3626
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3563,7 +3639,7 @@ class Teams extends Service {
3563
3639
  * @param {object} prefs
3564
3640
  * @throws {AppwriteException}
3565
3641
  * @returns {Promise}
3566
- */
3642
+ */
3567
3643
  updatePrefs(teamId, prefs) {
3568
3644
  if (typeof teamId === 'undefined') {
3569
3645
  throw new AppwriteException('Missing required parameter: "teamId"');