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/cjs/sdk.js CHANGED
@@ -100,7 +100,7 @@ class Client {
100
100
  'x-sdk-name': 'React Native',
101
101
  'x-sdk-platform': 'client',
102
102
  'x-sdk-language': 'reactnative',
103
- 'x-sdk-version': '0.10.1',
103
+ 'x-sdk-version': '0.11.0',
104
104
  'X-Appwrite-Response-Format': '1.7.0',
105
105
  };
106
106
  this.realtime = {
@@ -485,7 +485,7 @@ class Account extends Service {
485
485
  *
486
486
  * @throws {AppwriteException}
487
487
  * @returns {Promise}
488
- */
488
+ */
489
489
  get() {
490
490
  const apiPath = '/account';
491
491
  const payload = {};
@@ -507,7 +507,7 @@ class Account extends Service {
507
507
  * @param {string} name
508
508
  * @throws {AppwriteException}
509
509
  * @returns {Promise}
510
- */
510
+ */
511
511
  create(userId, email, password, name) {
512
512
  if (typeof userId === 'undefined') {
513
513
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -551,7 +551,7 @@ class Account extends Service {
551
551
  * @param {string} password
552
552
  * @throws {AppwriteException}
553
553
  * @returns {Promise}
554
- */
554
+ */
555
555
  updateEmail(email, password) {
556
556
  if (typeof email === 'undefined') {
557
557
  throw new AppwriteException('Missing required parameter: "email"');
@@ -578,7 +578,7 @@ class Account extends Service {
578
578
  * @param {string[]} queries
579
579
  * @throws {AppwriteException}
580
580
  * @returns {Promise}
581
- */
581
+ */
582
582
  listIdentities(queries) {
583
583
  const apiPath = '/account/identities';
584
584
  const payload = {};
@@ -594,7 +594,7 @@ class Account extends Service {
594
594
  * @param {string} identityId
595
595
  * @throws {AppwriteException}
596
596
  * @returns {Promise}
597
- */
597
+ */
598
598
  deleteIdentity(identityId) {
599
599
  if (typeof identityId === 'undefined') {
600
600
  throw new AppwriteException('Missing required parameter: "identityId"');
@@ -615,7 +615,7 @@ class Account extends Service {
615
615
  *
616
616
  * @throws {AppwriteException}
617
617
  * @returns {Promise}
618
- */
618
+ */
619
619
  createJWT() {
620
620
  const apiPath = '/account/jwts';
621
621
  const payload = {};
@@ -631,7 +631,7 @@ class Account extends Service {
631
631
  * @param {string[]} queries
632
632
  * @throws {AppwriteException}
633
633
  * @returns {Promise}
634
- */
634
+ */
635
635
  listLogs(queries) {
636
636
  const apiPath = '/account/logs';
637
637
  const payload = {};
@@ -647,7 +647,7 @@ class Account extends Service {
647
647
  * @param {boolean} mfa
648
648
  * @throws {AppwriteException}
649
649
  * @returns {Promise}
650
- */
650
+ */
651
651
  updateMFA(mfa) {
652
652
  if (typeof mfa === 'undefined') {
653
653
  throw new AppwriteException('Missing required parameter: "mfa"');
@@ -671,7 +671,7 @@ class Account extends Service {
671
671
  * @param {AuthenticatorType} type
672
672
  * @throws {AppwriteException}
673
673
  * @returns {Promise}
674
- */
674
+ */
675
675
  createMfaAuthenticator(type) {
676
676
  if (typeof type === 'undefined') {
677
677
  throw new AppwriteException('Missing required parameter: "type"');
@@ -692,7 +692,7 @@ class Account extends Service {
692
692
  * @param {string} otp
693
693
  * @throws {AppwriteException}
694
694
  * @returns {Promise}
695
- */
695
+ */
696
696
  updateMfaAuthenticator(type, otp) {
697
697
  if (typeof type === 'undefined') {
698
698
  throw new AppwriteException('Missing required parameter: "type"');
@@ -716,7 +716,7 @@ class Account extends Service {
716
716
  * @param {AuthenticatorType} type
717
717
  * @throws {AppwriteException}
718
718
  * @returns {Promise}
719
- */
719
+ */
720
720
  deleteMfaAuthenticator(type) {
721
721
  if (typeof type === 'undefined') {
722
722
  throw new AppwriteException('Missing required parameter: "type"');
@@ -736,7 +736,7 @@ class Account extends Service {
736
736
  * @param {AuthenticationFactor} factor
737
737
  * @throws {AppwriteException}
738
738
  * @returns {Promise}
739
- */
739
+ */
740
740
  createMfaChallenge(factor) {
741
741
  if (typeof factor === 'undefined') {
742
742
  throw new AppwriteException('Missing required parameter: "factor"');
@@ -762,7 +762,7 @@ class Account extends Service {
762
762
  * @param {string} otp
763
763
  * @throws {AppwriteException}
764
764
  * @returns {Promise}
765
- */
765
+ */
766
766
  updateMfaChallenge(challengeId, otp) {
767
767
  if (typeof challengeId === 'undefined') {
768
768
  throw new AppwriteException('Missing required parameter: "challengeId"');
@@ -788,7 +788,7 @@ class Account extends Service {
788
788
  *
789
789
  * @throws {AppwriteException}
790
790
  * @returns {Promise}
791
- */
791
+ */
792
792
  listMfaFactors() {
793
793
  const apiPath = '/account/mfa/factors';
794
794
  const payload = {};
@@ -803,7 +803,7 @@ class Account extends Service {
803
803
  *
804
804
  * @throws {AppwriteException}
805
805
  * @returns {Promise}
806
- */
806
+ */
807
807
  getMfaRecoveryCodes() {
808
808
  const apiPath = '/account/mfa/recovery-codes';
809
809
  const payload = {};
@@ -819,7 +819,7 @@ class Account extends Service {
819
819
  *
820
820
  * @throws {AppwriteException}
821
821
  * @returns {Promise}
822
- */
822
+ */
823
823
  createMfaRecoveryCodes() {
824
824
  const apiPath = '/account/mfa/recovery-codes';
825
825
  const payload = {};
@@ -836,7 +836,7 @@ class Account extends Service {
836
836
  *
837
837
  * @throws {AppwriteException}
838
838
  * @returns {Promise}
839
- */
839
+ */
840
840
  updateMfaRecoveryCodes() {
841
841
  const apiPath = '/account/mfa/recovery-codes';
842
842
  const payload = {};
@@ -851,7 +851,7 @@ class Account extends Service {
851
851
  * @param {string} name
852
852
  * @throws {AppwriteException}
853
853
  * @returns {Promise}
854
- */
854
+ */
855
855
  updateName(name) {
856
856
  if (typeof name === 'undefined') {
857
857
  throw new AppwriteException('Missing required parameter: "name"');
@@ -875,7 +875,7 @@ class Account extends Service {
875
875
  * @param {string} oldPassword
876
876
  * @throws {AppwriteException}
877
877
  * @returns {Promise}
878
- */
878
+ */
879
879
  updatePassword(password, oldPassword) {
880
880
  if (typeof password === 'undefined') {
881
881
  throw new AppwriteException('Missing required parameter: "password"');
@@ -904,7 +904,7 @@ class Account extends Service {
904
904
  * @param {string} password
905
905
  * @throws {AppwriteException}
906
906
  * @returns {Promise}
907
- */
907
+ */
908
908
  updatePhone(phone, password) {
909
909
  if (typeof phone === 'undefined') {
910
910
  throw new AppwriteException('Missing required parameter: "phone"');
@@ -930,7 +930,7 @@ class Account extends Service {
930
930
  *
931
931
  * @throws {AppwriteException}
932
932
  * @returns {Promise}
933
- */
933
+ */
934
934
  getPrefs() {
935
935
  const apiPath = '/account/prefs';
936
936
  const payload = {};
@@ -945,7 +945,7 @@ class Account extends Service {
945
945
  * @param {object} prefs
946
946
  * @throws {AppwriteException}
947
947
  * @returns {Promise}
948
- */
948
+ */
949
949
  updatePrefs(prefs) {
950
950
  if (typeof prefs === 'undefined') {
951
951
  throw new AppwriteException('Missing required parameter: "prefs"');
@@ -974,7 +974,7 @@ class Account extends Service {
974
974
  * @param {string} url
975
975
  * @throws {AppwriteException}
976
976
  * @returns {Promise}
977
- */
977
+ */
978
978
  createRecovery(email, url) {
979
979
  if (typeof email === 'undefined') {
980
980
  throw new AppwriteException('Missing required parameter: "email"');
@@ -1012,7 +1012,7 @@ class Account extends Service {
1012
1012
  * @param {string} password
1013
1013
  * @throws {AppwriteException}
1014
1014
  * @returns {Promise}
1015
- */
1015
+ */
1016
1016
  updateRecovery(userId, secret, password) {
1017
1017
  if (typeof userId === 'undefined') {
1018
1018
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1045,7 +1045,7 @@ class Account extends Service {
1045
1045
  *
1046
1046
  * @throws {AppwriteException}
1047
1047
  * @returns {Promise}
1048
- */
1048
+ */
1049
1049
  listSessions() {
1050
1050
  const apiPath = '/account/sessions';
1051
1051
  const payload = {};
@@ -1058,7 +1058,7 @@ class Account extends Service {
1058
1058
  *
1059
1059
  * @throws {AppwriteException}
1060
1060
  * @returns {Promise}
1061
- */
1061
+ */
1062
1062
  deleteSessions() {
1063
1063
  const apiPath = '/account/sessions';
1064
1064
  const payload = {};
@@ -1078,7 +1078,7 @@ class Account extends Service {
1078
1078
  *
1079
1079
  * @throws {AppwriteException}
1080
1080
  * @returns {Promise}
1081
- */
1081
+ */
1082
1082
  createAnonymousSession() {
1083
1083
  const apiPath = '/account/sessions/anonymous';
1084
1084
  const payload = {};
@@ -1099,7 +1099,7 @@ class Account extends Service {
1099
1099
  * @param {string} password
1100
1100
  * @throws {AppwriteException}
1101
1101
  * @returns {Promise}
1102
- */
1102
+ */
1103
1103
  createEmailPasswordSession(email, password) {
1104
1104
  if (typeof email === 'undefined') {
1105
1105
  throw new AppwriteException('Missing required parameter: "email"');
@@ -1129,7 +1129,7 @@ class Account extends Service {
1129
1129
  * @param {string} secret
1130
1130
  * @throws {AppwriteException}
1131
1131
  * @returns {Promise}
1132
- */
1132
+ */
1133
1133
  updateMagicURLSession(userId, secret) {
1134
1134
  if (typeof userId === 'undefined') {
1135
1135
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1174,7 +1174,7 @@ class Account extends Service {
1174
1174
  * @param {string[]} scopes
1175
1175
  * @throws {AppwriteException}
1176
1176
  * @returns {void|string}
1177
- */
1177
+ */
1178
1178
  createOAuth2Session(provider, success, failure, scopes) {
1179
1179
  if (typeof provider === 'undefined') {
1180
1180
  throw new AppwriteException('Missing required parameter: "provider"');
@@ -1206,7 +1206,7 @@ class Account extends Service {
1206
1206
  * @param {string} secret
1207
1207
  * @throws {AppwriteException}
1208
1208
  * @returns {Promise}
1209
- */
1209
+ */
1210
1210
  updatePhoneSession(userId, secret) {
1211
1211
  if (typeof userId === 'undefined') {
1212
1212
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1236,7 +1236,7 @@ class Account extends Service {
1236
1236
  * @param {string} secret
1237
1237
  * @throws {AppwriteException}
1238
1238
  * @returns {Promise}
1239
- */
1239
+ */
1240
1240
  createSession(userId, secret) {
1241
1241
  if (typeof userId === 'undefined') {
1242
1242
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1264,7 +1264,7 @@ class Account extends Service {
1264
1264
  * @param {string} sessionId
1265
1265
  * @throws {AppwriteException}
1266
1266
  * @returns {Promise}
1267
- */
1267
+ */
1268
1268
  getSession(sessionId) {
1269
1269
  if (typeof sessionId === 'undefined') {
1270
1270
  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
  updateSession(sessionId) {
1287
1287
  if (typeof sessionId === 'undefined') {
1288
1288
  throw new AppwriteException('Missing required parameter: "sessionId"');
@@ -1304,7 +1304,7 @@ class Account extends Service {
1304
1304
  * @param {string} sessionId
1305
1305
  * @throws {AppwriteException}
1306
1306
  * @returns {Promise}
1307
- */
1307
+ */
1308
1308
  deleteSession(sessionId) {
1309
1309
  if (typeof sessionId === 'undefined') {
1310
1310
  throw new AppwriteException('Missing required parameter: "sessionId"');
@@ -1323,7 +1323,7 @@ class Account extends Service {
1323
1323
  *
1324
1324
  * @throws {AppwriteException}
1325
1325
  * @returns {Promise}
1326
- */
1326
+ */
1327
1327
  updateStatus() {
1328
1328
  const apiPath = '/account/status';
1329
1329
  const payload = {};
@@ -1344,7 +1344,7 @@ class Account extends Service {
1344
1344
  * @param {string} providerId
1345
1345
  * @throws {AppwriteException}
1346
1346
  * @returns {Promise}
1347
- */
1347
+ */
1348
1348
  createPushTarget(targetId, identifier, providerId) {
1349
1349
  if (typeof targetId === 'undefined') {
1350
1350
  throw new AppwriteException('Missing required parameter: "targetId"');
@@ -1379,7 +1379,7 @@ class Account extends Service {
1379
1379
  * @param {string} identifier
1380
1380
  * @throws {AppwriteException}
1381
1381
  * @returns {Promise}
1382
- */
1382
+ */
1383
1383
  updatePushTarget(targetId, identifier) {
1384
1384
  if (typeof targetId === 'undefined') {
1385
1385
  throw new AppwriteException('Missing required parameter: "targetId"');
@@ -1405,7 +1405,7 @@ class Account extends Service {
1405
1405
  * @param {string} targetId
1406
1406
  * @throws {AppwriteException}
1407
1407
  * @returns {Promise}
1408
- */
1408
+ */
1409
1409
  deletePushTarget(targetId) {
1410
1410
  if (typeof targetId === 'undefined') {
1411
1411
  throw new AppwriteException('Missing required parameter: "targetId"');
@@ -1434,7 +1434,7 @@ class Account extends Service {
1434
1434
  * @param {boolean} phrase
1435
1435
  * @throws {AppwriteException}
1436
1436
  * @returns {Promise}
1437
- */
1437
+ */
1438
1438
  createEmailToken(userId, email, phrase) {
1439
1439
  if (typeof userId === 'undefined') {
1440
1440
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1480,7 +1480,7 @@ class Account extends Service {
1480
1480
  * @param {boolean} phrase
1481
1481
  * @throws {AppwriteException}
1482
1482
  * @returns {Promise}
1483
- */
1483
+ */
1484
1484
  createMagicURLToken(userId, email, url, phrase) {
1485
1485
  if (typeof userId === 'undefined') {
1486
1486
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1529,7 +1529,7 @@ class Account extends Service {
1529
1529
  * @param {string[]} scopes
1530
1530
  * @throws {AppwriteException}
1531
1531
  * @returns {void|string}
1532
- */
1532
+ */
1533
1533
  createOAuth2Token(provider, success, failure, scopes) {
1534
1534
  if (typeof provider === 'undefined') {
1535
1535
  throw new AppwriteException('Missing required parameter: "provider"');
@@ -1568,7 +1568,7 @@ class Account extends Service {
1568
1568
  * @param {string} phone
1569
1569
  * @throws {AppwriteException}
1570
1570
  * @returns {Promise}
1571
- */
1571
+ */
1572
1572
  createPhoneToken(userId, phone) {
1573
1573
  if (typeof userId === 'undefined') {
1574
1574
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1609,7 +1609,7 @@ class Account extends Service {
1609
1609
  * @param {string} url
1610
1610
  * @throws {AppwriteException}
1611
1611
  * @returns {Promise}
1612
- */
1612
+ */
1613
1613
  createVerification(url) {
1614
1614
  if (typeof url === 'undefined') {
1615
1615
  throw new AppwriteException('Missing required parameter: "url"');
@@ -1634,7 +1634,7 @@ class Account extends Service {
1634
1634
  * @param {string} secret
1635
1635
  * @throws {AppwriteException}
1636
1636
  * @returns {Promise}
1637
- */
1637
+ */
1638
1638
  updateVerification(userId, secret) {
1639
1639
  if (typeof userId === 'undefined') {
1640
1640
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1667,7 +1667,7 @@ class Account extends Service {
1667
1667
  *
1668
1668
  * @throws {AppwriteException}
1669
1669
  * @returns {Promise}
1670
- */
1670
+ */
1671
1671
  createPhoneVerification() {
1672
1672
  const apiPath = '/account/verification/phone';
1673
1673
  const payload = {};
@@ -1686,7 +1686,7 @@ class Account extends Service {
1686
1686
  * @param {string} secret
1687
1687
  * @throws {AppwriteException}
1688
1688
  * @returns {Promise}
1689
- */
1689
+ */
1690
1690
  updatePhoneVerification(userId, secret) {
1691
1691
  if (typeof userId === 'undefined') {
1692
1692
  throw new AppwriteException('Missing required parameter: "userId"');
@@ -1731,7 +1731,7 @@ class Avatars extends Service {
1731
1731
  * @param {number} quality
1732
1732
  * @throws {AppwriteException}
1733
1733
  * @returns {ArrayBuffer}
1734
- */
1734
+ */
1735
1735
  getBrowser(code, width, height, quality) {
1736
1736
  if (typeof code === 'undefined') {
1737
1737
  throw new AppwriteException('Missing required parameter: "code"');
@@ -1771,7 +1771,7 @@ class Avatars extends Service {
1771
1771
  * @param {number} quality
1772
1772
  * @throws {AppwriteException}
1773
1773
  * @returns {ArrayBuffer}
1774
- */
1774
+ */
1775
1775
  getCreditCard(code, width, height, quality) {
1776
1776
  if (typeof code === 'undefined') {
1777
1777
  throw new AppwriteException('Missing required parameter: "code"');
@@ -1803,7 +1803,7 @@ class Avatars extends Service {
1803
1803
  * @param {string} url
1804
1804
  * @throws {AppwriteException}
1805
1805
  * @returns {ArrayBuffer}
1806
- */
1806
+ */
1807
1807
  getFavicon(url) {
1808
1808
  if (typeof url === 'undefined') {
1809
1809
  throw new AppwriteException('Missing required parameter: "url"');
@@ -1838,7 +1838,7 @@ class Avatars extends Service {
1838
1838
  * @param {number} quality
1839
1839
  * @throws {AppwriteException}
1840
1840
  * @returns {ArrayBuffer}
1841
- */
1841
+ */
1842
1842
  getFlag(code, width, height, quality) {
1843
1843
  if (typeof code === 'undefined') {
1844
1844
  throw new AppwriteException('Missing required parameter: "code"');
@@ -1879,7 +1879,7 @@ class Avatars extends Service {
1879
1879
  * @param {number} height
1880
1880
  * @throws {AppwriteException}
1881
1881
  * @returns {ArrayBuffer}
1882
- */
1882
+ */
1883
1883
  getImage(url, width, height) {
1884
1884
  if (typeof url === 'undefined') {
1885
1885
  throw new AppwriteException('Missing required parameter: "url"');
@@ -1926,7 +1926,7 @@ class Avatars extends Service {
1926
1926
  * @param {string} background
1927
1927
  * @throws {AppwriteException}
1928
1928
  * @returns {ArrayBuffer}
1929
- */
1929
+ */
1930
1930
  getInitials(name, width, height, background) {
1931
1931
  const apiPath = '/avatars/initials';
1932
1932
  const payload = {};
@@ -1960,7 +1960,7 @@ class Avatars extends Service {
1960
1960
  * @param {boolean} download
1961
1961
  * @throws {AppwriteException}
1962
1962
  * @returns {ArrayBuffer}
1963
- */
1963
+ */
1964
1964
  getQR(text, size, margin, download) {
1965
1965
  if (typeof text === 'undefined') {
1966
1966
  throw new AppwriteException('Missing required parameter: "text"');
@@ -2256,7 +2256,7 @@ class Databases extends Service {
2256
2256
  * @param {string[]} queries
2257
2257
  * @throws {AppwriteException}
2258
2258
  * @returns {Promise}
2259
- */
2259
+ */
2260
2260
  listDocuments(databaseId, collectionId, queries) {
2261
2261
  if (typeof databaseId === 'undefined') {
2262
2262
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2285,7 +2285,7 @@ class Databases extends Service {
2285
2285
  * @param {string[]} permissions
2286
2286
  * @throws {AppwriteException}
2287
2287
  * @returns {Promise}
2288
- */
2288
+ */
2289
2289
  createDocument(databaseId, collectionId, documentId, data, permissions) {
2290
2290
  if (typeof databaseId === 'undefined') {
2291
2291
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2325,7 +2325,7 @@ class Databases extends Service {
2325
2325
  * @param {string[]} queries
2326
2326
  * @throws {AppwriteException}
2327
2327
  * @returns {Promise}
2328
- */
2328
+ */
2329
2329
  getDocument(databaseId, collectionId, documentId, queries) {
2330
2330
  if (typeof databaseId === 'undefined') {
2331
2331
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2361,7 +2361,7 @@ class Databases extends Service {
2361
2361
  * @param {string[]} permissions
2362
2362
  * @throws {AppwriteException}
2363
2363
  * @returns {Promise}
2364
- */
2364
+ */
2365
2365
  upsertDocument(databaseId, collectionId, documentId, data, permissions) {
2366
2366
  if (typeof databaseId === 'undefined') {
2367
2367
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2399,7 +2399,7 @@ class Databases extends Service {
2399
2399
  * @param {string[]} permissions
2400
2400
  * @throws {AppwriteException}
2401
2401
  * @returns {Promise}
2402
- */
2402
+ */
2403
2403
  updateDocument(databaseId, collectionId, documentId, data, permissions) {
2404
2404
  if (typeof databaseId === 'undefined') {
2405
2405
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2431,7 +2431,7 @@ class Databases extends Service {
2431
2431
  * @param {string} documentId
2432
2432
  * @throws {AppwriteException}
2433
2433
  * @returns {Promise}
2434
- */
2434
+ */
2435
2435
  deleteDocument(databaseId, collectionId, documentId) {
2436
2436
  if (typeof databaseId === 'undefined') {
2437
2437
  throw new AppwriteException('Missing required parameter: "databaseId"');
@@ -2449,6 +2449,82 @@ class Databases extends Service {
2449
2449
  'content-type': 'application/json',
2450
2450
  }, payload);
2451
2451
  }
2452
+ /**
2453
+ * Decrement a specific attribute of a document by a given value.
2454
+ *
2455
+ * @param {string} databaseId
2456
+ * @param {string} collectionId
2457
+ * @param {string} documentId
2458
+ * @param {string} attribute
2459
+ * @param {number} value
2460
+ * @param {number} min
2461
+ * @throws {AppwriteException}
2462
+ * @returns {Promise}
2463
+ */
2464
+ decrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, min) {
2465
+ if (typeof databaseId === 'undefined') {
2466
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2467
+ }
2468
+ if (typeof collectionId === 'undefined') {
2469
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2470
+ }
2471
+ if (typeof documentId === 'undefined') {
2472
+ throw new AppwriteException('Missing required parameter: "documentId"');
2473
+ }
2474
+ if (typeof attribute === 'undefined') {
2475
+ throw new AppwriteException('Missing required parameter: "attribute"');
2476
+ }
2477
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2478
+ const payload = {};
2479
+ if (typeof value !== 'undefined') {
2480
+ payload['value'] = value;
2481
+ }
2482
+ if (typeof min !== 'undefined') {
2483
+ payload['min'] = min;
2484
+ }
2485
+ const uri = new URL(this.client.config.endpoint + apiPath);
2486
+ return this.client.call('patch', uri, {
2487
+ 'content-type': 'application/json',
2488
+ }, payload);
2489
+ }
2490
+ /**
2491
+ * Increment a specific attribute of a document by a given value.
2492
+ *
2493
+ * @param {string} databaseId
2494
+ * @param {string} collectionId
2495
+ * @param {string} documentId
2496
+ * @param {string} attribute
2497
+ * @param {number} value
2498
+ * @param {number} max
2499
+ * @throws {AppwriteException}
2500
+ * @returns {Promise}
2501
+ */
2502
+ incrementDocumentAttribute(databaseId, collectionId, documentId, attribute, value, max) {
2503
+ if (typeof databaseId === 'undefined') {
2504
+ throw new AppwriteException('Missing required parameter: "databaseId"');
2505
+ }
2506
+ if (typeof collectionId === 'undefined') {
2507
+ throw new AppwriteException('Missing required parameter: "collectionId"');
2508
+ }
2509
+ if (typeof documentId === 'undefined') {
2510
+ throw new AppwriteException('Missing required parameter: "documentId"');
2511
+ }
2512
+ if (typeof attribute === 'undefined') {
2513
+ throw new AppwriteException('Missing required parameter: "attribute"');
2514
+ }
2515
+ const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId).replace('{attribute}', attribute);
2516
+ const payload = {};
2517
+ if (typeof value !== 'undefined') {
2518
+ payload['value'] = value;
2519
+ }
2520
+ if (typeof max !== 'undefined') {
2521
+ payload['max'] = max;
2522
+ }
2523
+ const uri = new URL(this.client.config.endpoint + apiPath);
2524
+ return this.client.call('patch', uri, {
2525
+ 'content-type': 'application/json',
2526
+ }, payload);
2527
+ }
2452
2528
  }
2453
2529
 
2454
2530
  class Functions extends Service {
@@ -2463,7 +2539,7 @@ class Functions extends Service {
2463
2539
  * @param {string[]} queries
2464
2540
  * @throws {AppwriteException}
2465
2541
  * @returns {Promise}
2466
- */
2542
+ */
2467
2543
  listExecutions(functionId, queries) {
2468
2544
  if (typeof functionId === 'undefined') {
2469
2545
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -2491,7 +2567,7 @@ class Functions extends Service {
2491
2567
  * @param {string} scheduledAt
2492
2568
  * @throws {AppwriteException}
2493
2569
  * @returns {Promise}
2494
- */
2570
+ */
2495
2571
  createExecution(functionId, body, async, xpath, method, headers, scheduledAt) {
2496
2572
  if (typeof functionId === 'undefined') {
2497
2573
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -2528,7 +2604,7 @@ class Functions extends Service {
2528
2604
  * @param {string} executionId
2529
2605
  * @throws {AppwriteException}
2530
2606
  * @returns {Promise}
2531
- */
2607
+ */
2532
2608
  getExecution(functionId, executionId) {
2533
2609
  if (typeof functionId === 'undefined') {
2534
2610
  throw new AppwriteException('Missing required parameter: "functionId"');
@@ -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
  query(query) {
2558
2634
  if (typeof query === 'undefined') {
2559
2635
  throw new AppwriteException('Missing required parameter: "query"');
@@ -2575,7 +2651,7 @@ class Graphql extends Service {
2575
2651
  * @param {object} query
2576
2652
  * @throws {AppwriteException}
2577
2653
  * @returns {Promise}
2578
- */
2654
+ */
2579
2655
  mutation(query) {
2580
2656
  if (typeof query === 'undefined') {
2581
2657
  throw new AppwriteException('Missing required parameter: "query"');
@@ -2607,7 +2683,7 @@ class Locale extends Service {
2607
2683
  *
2608
2684
  * @throws {AppwriteException}
2609
2685
  * @returns {Promise}
2610
- */
2686
+ */
2611
2687
  get() {
2612
2688
  const apiPath = '/locale';
2613
2689
  const payload = {};
@@ -2620,7 +2696,7 @@ class Locale extends Service {
2620
2696
  *
2621
2697
  * @throws {AppwriteException}
2622
2698
  * @returns {Promise}
2623
- */
2699
+ */
2624
2700
  listCodes() {
2625
2701
  const apiPath = '/locale/codes';
2626
2702
  const payload = {};
@@ -2633,7 +2709,7 @@ class Locale extends Service {
2633
2709
  *
2634
2710
  * @throws {AppwriteException}
2635
2711
  * @returns {Promise}
2636
- */
2712
+ */
2637
2713
  listContinents() {
2638
2714
  const apiPath = '/locale/continents';
2639
2715
  const payload = {};
@@ -2646,7 +2722,7 @@ class Locale extends Service {
2646
2722
  *
2647
2723
  * @throws {AppwriteException}
2648
2724
  * @returns {Promise}
2649
- */
2725
+ */
2650
2726
  listCountries() {
2651
2727
  const apiPath = '/locale/countries';
2652
2728
  const payload = {};
@@ -2659,7 +2735,7 @@ class Locale extends Service {
2659
2735
  *
2660
2736
  * @throws {AppwriteException}
2661
2737
  * @returns {Promise}
2662
- */
2738
+ */
2663
2739
  listCountriesEU() {
2664
2740
  const apiPath = '/locale/countries/eu';
2665
2741
  const payload = {};
@@ -2672,7 +2748,7 @@ class Locale extends Service {
2672
2748
  *
2673
2749
  * @throws {AppwriteException}
2674
2750
  * @returns {Promise}
2675
- */
2751
+ */
2676
2752
  listCountriesPhones() {
2677
2753
  const apiPath = '/locale/countries/phones';
2678
2754
  const payload = {};
@@ -2686,7 +2762,7 @@ class Locale extends Service {
2686
2762
  *
2687
2763
  * @throws {AppwriteException}
2688
2764
  * @returns {Promise}
2689
- */
2765
+ */
2690
2766
  listCurrencies() {
2691
2767
  const apiPath = '/locale/currencies';
2692
2768
  const payload = {};
@@ -2699,7 +2775,7 @@ class Locale extends Service {
2699
2775
  *
2700
2776
  * @throws {AppwriteException}
2701
2777
  * @returns {Promise}
2702
- */
2778
+ */
2703
2779
  listLanguages() {
2704
2780
  const apiPath = '/locale/languages';
2705
2781
  const payload = {};
@@ -2720,7 +2796,7 @@ class Messaging extends Service {
2720
2796
  * @param {string} targetId
2721
2797
  * @throws {AppwriteException}
2722
2798
  * @returns {Promise}
2723
- */
2799
+ */
2724
2800
  createSubscriber(topicId, subscriberId, targetId) {
2725
2801
  if (typeof topicId === 'undefined') {
2726
2802
  throw new AppwriteException('Missing required parameter: "topicId"');
@@ -2751,7 +2827,7 @@ class Messaging extends Service {
2751
2827
  * @param {string} subscriberId
2752
2828
  * @throws {AppwriteException}
2753
2829
  * @returns {Promise}
2754
- */
2830
+ */
2755
2831
  deleteSubscriber(topicId, subscriberId) {
2756
2832
  if (typeof topicId === 'undefined') {
2757
2833
  throw new AppwriteException('Missing required parameter: "topicId"');
@@ -2781,7 +2857,7 @@ class Storage extends Service {
2781
2857
  * @param {string} search
2782
2858
  * @throws {AppwriteException}
2783
2859
  * @returns {Promise}
2784
- */
2860
+ */
2785
2861
  listFiles(bucketId, queries, search) {
2786
2862
  if (typeof bucketId === 'undefined') {
2787
2863
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2823,7 +2899,7 @@ class Storage extends Service {
2823
2899
  * @param {string[]} permissions
2824
2900
  * @throws {AppwriteException}
2825
2901
  * @returns {Promise}
2826
- */
2902
+ */
2827
2903
  createFile(bucketId_1, fileId_1, file_1, permissions_1) {
2828
2904
  return __awaiter(this, arguments, void 0, function* (bucketId, fileId, file, permissions, onProgress = (progress) => { }) {
2829
2905
  if (typeof bucketId === 'undefined') {
@@ -2905,7 +2981,7 @@ class Storage extends Service {
2905
2981
  * @param {string} fileId
2906
2982
  * @throws {AppwriteException}
2907
2983
  * @returns {Promise}
2908
- */
2984
+ */
2909
2985
  getFile(bucketId, fileId) {
2910
2986
  if (typeof bucketId === 'undefined') {
2911
2987
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2928,7 +3004,7 @@ class Storage extends Service {
2928
3004
  * @param {string[]} permissions
2929
3005
  * @throws {AppwriteException}
2930
3006
  * @returns {Promise}
2931
- */
3007
+ */
2932
3008
  updateFile(bucketId, fileId, name, permissions) {
2933
3009
  if (typeof bucketId === 'undefined') {
2934
3010
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2957,7 +3033,7 @@ class Storage extends Service {
2957
3033
  * @param {string} fileId
2958
3034
  * @throws {AppwriteException}
2959
3035
  * @returns {Promise}
2960
- */
3036
+ */
2961
3037
  deleteFile(bucketId, fileId) {
2962
3038
  if (typeof bucketId === 'undefined') {
2963
3039
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -2982,7 +3058,7 @@ class Storage extends Service {
2982
3058
  * @param {string} token
2983
3059
  * @throws {AppwriteException}
2984
3060
  * @returns {ArrayBuffer}
2985
- */
3061
+ */
2986
3062
  getFileDownload(bucketId, fileId, token) {
2987
3063
  if (typeof bucketId === 'undefined') {
2988
3064
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -3025,7 +3101,7 @@ class Storage extends Service {
3025
3101
  * @param {string} token
3026
3102
  * @throws {AppwriteException}
3027
3103
  * @returns {ArrayBuffer}
3028
- */
3104
+ */
3029
3105
  getFilePreview(bucketId, fileId, width, height, gravity, quality, borderWidth, borderColor, borderRadius, opacity, rotation, background, output, token) {
3030
3106
  if (typeof bucketId === 'undefined') {
3031
3107
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -3088,7 +3164,7 @@ class Storage extends Service {
3088
3164
  * @param {string} token
3089
3165
  * @throws {AppwriteException}
3090
3166
  * @returns {ArrayBuffer}
3091
- */
3167
+ */
3092
3168
  getFileView(bucketId, fileId, token) {
3093
3169
  if (typeof bucketId === 'undefined') {
3094
3170
  throw new AppwriteException('Missing required parameter: "bucketId"');
@@ -3240,7 +3316,7 @@ class Teams extends Service {
3240
3316
  * @param {string} search
3241
3317
  * @throws {AppwriteException}
3242
3318
  * @returns {Promise}
3243
- */
3319
+ */
3244
3320
  list(queries, search) {
3245
3321
  const apiPath = '/teams';
3246
3322
  const payload = {};
@@ -3263,7 +3339,7 @@ class Teams extends Service {
3263
3339
  * @param {string[]} roles
3264
3340
  * @throws {AppwriteException}
3265
3341
  * @returns {Promise}
3266
- */
3342
+ */
3267
3343
  create(teamId, name, roles) {
3268
3344
  if (typeof teamId === 'undefined') {
3269
3345
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3293,7 +3369,7 @@ class Teams extends Service {
3293
3369
  * @param {string} teamId
3294
3370
  * @throws {AppwriteException}
3295
3371
  * @returns {Promise}
3296
- */
3372
+ */
3297
3373
  get(teamId) {
3298
3374
  if (typeof teamId === 'undefined') {
3299
3375
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3310,7 +3386,7 @@ class Teams extends Service {
3310
3386
  * @param {string} name
3311
3387
  * @throws {AppwriteException}
3312
3388
  * @returns {Promise}
3313
- */
3389
+ */
3314
3390
  updateName(teamId, name) {
3315
3391
  if (typeof teamId === 'undefined') {
3316
3392
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3335,7 +3411,7 @@ class Teams extends Service {
3335
3411
  * @param {string} teamId
3336
3412
  * @throws {AppwriteException}
3337
3413
  * @returns {Promise}
3338
- */
3414
+ */
3339
3415
  delete(teamId) {
3340
3416
  if (typeof teamId === 'undefined') {
3341
3417
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3357,7 +3433,7 @@ class Teams extends Service {
3357
3433
  * @param {string} search
3358
3434
  * @throws {AppwriteException}
3359
3435
  * @returns {Promise}
3360
- */
3436
+ */
3361
3437
  listMemberships(teamId, queries, search) {
3362
3438
  if (typeof teamId === 'undefined') {
3363
3439
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3405,7 +3481,7 @@ class Teams extends Service {
3405
3481
  * @param {string} name
3406
3482
  * @throws {AppwriteException}
3407
3483
  * @returns {Promise}
3408
- */
3484
+ */
3409
3485
  createMembership(teamId, roles, email, userId, phone, url, name) {
3410
3486
  if (typeof teamId === 'undefined') {
3411
3487
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3447,7 +3523,7 @@ class Teams extends Service {
3447
3523
  * @param {string} membershipId
3448
3524
  * @throws {AppwriteException}
3449
3525
  * @returns {Promise}
3450
- */
3526
+ */
3451
3527
  getMembership(teamId, membershipId) {
3452
3528
  if (typeof teamId === 'undefined') {
3453
3529
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3471,7 +3547,7 @@ class Teams extends Service {
3471
3547
  * @param {string[]} roles
3472
3548
  * @throws {AppwriteException}
3473
3549
  * @returns {Promise}
3474
- */
3550
+ */
3475
3551
  updateMembership(teamId, membershipId, roles) {
3476
3552
  if (typeof teamId === 'undefined') {
3477
3553
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3501,7 +3577,7 @@ class Teams extends Service {
3501
3577
  * @param {string} membershipId
3502
3578
  * @throws {AppwriteException}
3503
3579
  * @returns {Promise}
3504
- */
3580
+ */
3505
3581
  deleteMembership(teamId, membershipId) {
3506
3582
  if (typeof teamId === 'undefined') {
3507
3583
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3531,7 +3607,7 @@ class Teams extends Service {
3531
3607
  * @param {string} secret
3532
3608
  * @throws {AppwriteException}
3533
3609
  * @returns {Promise}
3534
- */
3610
+ */
3535
3611
  updateMembershipStatus(teamId, membershipId, userId, secret) {
3536
3612
  if (typeof teamId === 'undefined') {
3537
3613
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3566,7 +3642,7 @@ class Teams extends Service {
3566
3642
  * @param {string} teamId
3567
3643
  * @throws {AppwriteException}
3568
3644
  * @returns {Promise}
3569
- */
3645
+ */
3570
3646
  getPrefs(teamId) {
3571
3647
  if (typeof teamId === 'undefined') {
3572
3648
  throw new AppwriteException('Missing required parameter: "teamId"');
@@ -3585,7 +3661,7 @@ class Teams extends Service {
3585
3661
  * @param {object} prefs
3586
3662
  * @throws {AppwriteException}
3587
3663
  * @returns {Promise}
3588
- */
3664
+ */
3589
3665
  updatePrefs(teamId, prefs) {
3590
3666
  if (typeof teamId === 'undefined') {
3591
3667
  throw new AppwriteException('Missing required parameter: "teamId"');