react-native-appwrite 0.15.0 → 0.17.1

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/sdk.js +431 -21
  3. package/dist/cjs/sdk.js.map +1 -1
  4. package/dist/esm/sdk.js +431 -21
  5. package/dist/esm/sdk.js.map +1 -1
  6. package/docs/examples/account/create-email-verification.md +13 -0
  7. package/docs/examples/account/update-email-verification.md +14 -0
  8. package/docs/examples/databases/create-document.md +2 -1
  9. package/docs/examples/databases/create-operations.md +24 -0
  10. package/docs/examples/databases/create-transaction.md +13 -0
  11. package/docs/examples/databases/decrement-document-attribute.md +2 -1
  12. package/docs/examples/databases/delete-document.md +2 -1
  13. package/docs/examples/databases/delete-transaction.md +13 -0
  14. package/docs/examples/databases/get-document.md +2 -1
  15. package/docs/examples/databases/get-transaction.md +13 -0
  16. package/docs/examples/databases/increment-document-attribute.md +2 -1
  17. package/docs/examples/databases/list-documents.md +2 -1
  18. package/docs/examples/databases/list-transactions.md +13 -0
  19. package/docs/examples/databases/update-document.md +2 -1
  20. package/docs/examples/databases/update-transaction.md +15 -0
  21. package/docs/examples/databases/upsert-document.md +2 -1
  22. package/docs/examples/tablesdb/create-operations.md +24 -0
  23. package/docs/examples/tablesdb/create-row.md +2 -1
  24. package/docs/examples/tablesdb/create-transaction.md +13 -0
  25. package/docs/examples/tablesdb/decrement-row-column.md +2 -1
  26. package/docs/examples/tablesdb/delete-row.md +2 -1
  27. package/docs/examples/tablesdb/delete-transaction.md +13 -0
  28. package/docs/examples/tablesdb/get-row.md +2 -1
  29. package/docs/examples/tablesdb/get-transaction.md +13 -0
  30. package/docs/examples/tablesdb/increment-row-column.md +2 -1
  31. package/docs/examples/tablesdb/list-rows.md +2 -1
  32. package/docs/examples/tablesdb/list-transactions.md +13 -0
  33. package/docs/examples/tablesdb/update-row.md +2 -1
  34. package/docs/examples/tablesdb/update-transaction.md +15 -0
  35. package/docs/examples/tablesdb/upsert-row.md +2 -1
  36. package/package.json +1 -1
  37. package/src/client.ts +1 -1
  38. package/src/models.ts +44 -0
  39. package/src/services/account.ts +123 -4
  40. package/src/services/databases.ts +414 -56
  41. package/src/services/tables-db.ts +426 -68
  42. package/types/models.d.ts +42 -0
  43. package/types/services/account.d.ts +49 -0
  44. package/types/services/databases.d.ts +155 -8
  45. package/types/services/tables-db.d.ts +167 -20
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.15.0',
81
+ 'x-sdk-version': '0.17.1',
82
82
  'X-Appwrite-Response-Format': '1.8.0',
83
83
  };
84
84
  this.realtime = {
@@ -1716,6 +1716,30 @@ class Account extends Service {
1716
1716
  'content-type': 'application/json',
1717
1717
  }, payload);
1718
1718
  }
1719
+ createEmailVerification(paramsOrFirst) {
1720
+ let params;
1721
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1722
+ params = (paramsOrFirst || {});
1723
+ }
1724
+ else {
1725
+ params = {
1726
+ url: paramsOrFirst
1727
+ };
1728
+ }
1729
+ const url = params.url;
1730
+ if (typeof url === 'undefined') {
1731
+ throw new AppwriteException('Missing required parameter: "url"');
1732
+ }
1733
+ const apiPath = '/account/verifications/email';
1734
+ const payload = {};
1735
+ if (typeof url !== 'undefined') {
1736
+ payload['url'] = url;
1737
+ }
1738
+ const uri = new URL(this.client.config.endpoint + apiPath);
1739
+ return this.client.call('post', uri, {
1740
+ 'content-type': 'application/json',
1741
+ }, payload);
1742
+ }
1719
1743
  createVerification(paramsOrFirst) {
1720
1744
  let params;
1721
1745
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -1730,7 +1754,7 @@ class Account extends Service {
1730
1754
  if (typeof url === 'undefined') {
1731
1755
  throw new AppwriteException('Missing required parameter: "url"');
1732
1756
  }
1733
- const apiPath = '/account/verification';
1757
+ const apiPath = '/account/verifications/email';
1734
1758
  const payload = {};
1735
1759
  if (typeof url !== 'undefined') {
1736
1760
  payload['url'] = url;
@@ -1740,6 +1764,38 @@ class Account extends Service {
1740
1764
  'content-type': 'application/json',
1741
1765
  }, payload);
1742
1766
  }
1767
+ updateEmailVerification(paramsOrFirst, ...rest) {
1768
+ let params;
1769
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
1770
+ params = (paramsOrFirst || {});
1771
+ }
1772
+ else {
1773
+ params = {
1774
+ userId: paramsOrFirst,
1775
+ secret: rest[0]
1776
+ };
1777
+ }
1778
+ const userId = params.userId;
1779
+ const secret = params.secret;
1780
+ if (typeof userId === 'undefined') {
1781
+ throw new AppwriteException('Missing required parameter: "userId"');
1782
+ }
1783
+ if (typeof secret === 'undefined') {
1784
+ throw new AppwriteException('Missing required parameter: "secret"');
1785
+ }
1786
+ const apiPath = '/account/verifications/email';
1787
+ const payload = {};
1788
+ if (typeof userId !== 'undefined') {
1789
+ payload['userId'] = userId;
1790
+ }
1791
+ if (typeof secret !== 'undefined') {
1792
+ payload['secret'] = secret;
1793
+ }
1794
+ const uri = new URL(this.client.config.endpoint + apiPath);
1795
+ return this.client.call('put', uri, {
1796
+ 'content-type': 'application/json',
1797
+ }, payload);
1798
+ }
1743
1799
  updateVerification(paramsOrFirst, ...rest) {
1744
1800
  let params;
1745
1801
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -1759,7 +1815,7 @@ class Account extends Service {
1759
1815
  if (typeof secret === 'undefined') {
1760
1816
  throw new AppwriteException('Missing required parameter: "secret"');
1761
1817
  }
1762
- const apiPath = '/account/verification';
1818
+ const apiPath = '/account/verifications/email';
1763
1819
  const payload = {};
1764
1820
  if (typeof userId !== 'undefined') {
1765
1821
  payload['userId'] = userId;
@@ -1779,7 +1835,7 @@ class Account extends Service {
1779
1835
  * @returns {Promise}
1780
1836
  */
1781
1837
  createPhoneVerification() {
1782
- const apiPath = '/account/verification/phone';
1838
+ const apiPath = '/account/verifications/phone';
1783
1839
  const payload = {};
1784
1840
  const uri = new URL(this.client.config.endpoint + apiPath);
1785
1841
  return this.client.call('post', uri, {
@@ -1805,7 +1861,7 @@ class Account extends Service {
1805
1861
  if (typeof secret === 'undefined') {
1806
1862
  throw new AppwriteException('Missing required parameter: "secret"');
1807
1863
  }
1808
- const apiPath = '/account/verification/phone';
1864
+ const apiPath = '/account/verifications/phone';
1809
1865
  const payload = {};
1810
1866
  if (typeof userId !== 'undefined') {
1811
1867
  payload['userId'] = userId;
@@ -2340,6 +2396,143 @@ class Databases extends Service {
2340
2396
  constructor(client) {
2341
2397
  super(client);
2342
2398
  }
2399
+ listTransactions(paramsOrFirst) {
2400
+ let params;
2401
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2402
+ params = (paramsOrFirst || {});
2403
+ }
2404
+ else {
2405
+ params = {
2406
+ queries: paramsOrFirst
2407
+ };
2408
+ }
2409
+ const queries = params.queries;
2410
+ const apiPath = '/databases/transactions';
2411
+ const payload = {};
2412
+ if (typeof queries !== 'undefined') {
2413
+ payload['queries'] = queries;
2414
+ }
2415
+ const uri = new URL(this.client.config.endpoint + apiPath);
2416
+ return this.client.call('get', uri, {}, payload);
2417
+ }
2418
+ createTransaction(paramsOrFirst) {
2419
+ let params;
2420
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2421
+ params = (paramsOrFirst || {});
2422
+ }
2423
+ else {
2424
+ params = {
2425
+ ttl: paramsOrFirst
2426
+ };
2427
+ }
2428
+ const ttl = params.ttl;
2429
+ const apiPath = '/databases/transactions';
2430
+ const payload = {};
2431
+ if (typeof ttl !== 'undefined') {
2432
+ payload['ttl'] = ttl;
2433
+ }
2434
+ const uri = new URL(this.client.config.endpoint + apiPath);
2435
+ return this.client.call('post', uri, {
2436
+ 'content-type': 'application/json',
2437
+ }, payload);
2438
+ }
2439
+ getTransaction(paramsOrFirst) {
2440
+ let params;
2441
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2442
+ params = (paramsOrFirst || {});
2443
+ }
2444
+ else {
2445
+ params = {
2446
+ transactionId: paramsOrFirst
2447
+ };
2448
+ }
2449
+ const transactionId = params.transactionId;
2450
+ if (typeof transactionId === 'undefined') {
2451
+ throw new AppwriteException('Missing required parameter: "transactionId"');
2452
+ }
2453
+ const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId);
2454
+ const payload = {};
2455
+ const uri = new URL(this.client.config.endpoint + apiPath);
2456
+ return this.client.call('get', uri, {}, payload);
2457
+ }
2458
+ updateTransaction(paramsOrFirst, ...rest) {
2459
+ let params;
2460
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2461
+ params = (paramsOrFirst || {});
2462
+ }
2463
+ else {
2464
+ params = {
2465
+ transactionId: paramsOrFirst,
2466
+ commit: rest[0],
2467
+ rollback: rest[1]
2468
+ };
2469
+ }
2470
+ const transactionId = params.transactionId;
2471
+ const commit = params.commit;
2472
+ const rollback = params.rollback;
2473
+ if (typeof transactionId === 'undefined') {
2474
+ throw new AppwriteException('Missing required parameter: "transactionId"');
2475
+ }
2476
+ const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId);
2477
+ const payload = {};
2478
+ if (typeof commit !== 'undefined') {
2479
+ payload['commit'] = commit;
2480
+ }
2481
+ if (typeof rollback !== 'undefined') {
2482
+ payload['rollback'] = rollback;
2483
+ }
2484
+ const uri = new URL(this.client.config.endpoint + apiPath);
2485
+ return this.client.call('patch', uri, {
2486
+ 'content-type': 'application/json',
2487
+ }, payload);
2488
+ }
2489
+ deleteTransaction(paramsOrFirst) {
2490
+ let params;
2491
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2492
+ params = (paramsOrFirst || {});
2493
+ }
2494
+ else {
2495
+ params = {
2496
+ transactionId: paramsOrFirst
2497
+ };
2498
+ }
2499
+ const transactionId = params.transactionId;
2500
+ if (typeof transactionId === 'undefined') {
2501
+ throw new AppwriteException('Missing required parameter: "transactionId"');
2502
+ }
2503
+ const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId);
2504
+ const payload = {};
2505
+ const uri = new URL(this.client.config.endpoint + apiPath);
2506
+ return this.client.call('delete', uri, {
2507
+ 'content-type': 'application/json',
2508
+ }, payload);
2509
+ }
2510
+ createOperations(paramsOrFirst, ...rest) {
2511
+ let params;
2512
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
2513
+ params = (paramsOrFirst || {});
2514
+ }
2515
+ else {
2516
+ params = {
2517
+ transactionId: paramsOrFirst,
2518
+ operations: rest[0]
2519
+ };
2520
+ }
2521
+ const transactionId = params.transactionId;
2522
+ const operations = params.operations;
2523
+ if (typeof transactionId === 'undefined') {
2524
+ throw new AppwriteException('Missing required parameter: "transactionId"');
2525
+ }
2526
+ const apiPath = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
2527
+ const payload = {};
2528
+ if (typeof operations !== 'undefined') {
2529
+ payload['operations'] = operations;
2530
+ }
2531
+ const uri = new URL(this.client.config.endpoint + apiPath);
2532
+ return this.client.call('post', uri, {
2533
+ 'content-type': 'application/json',
2534
+ }, payload);
2535
+ }
2343
2536
  listDocuments(paramsOrFirst, ...rest) {
2344
2537
  let params;
2345
2538
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -2349,12 +2542,14 @@ class Databases extends Service {
2349
2542
  params = {
2350
2543
  databaseId: paramsOrFirst,
2351
2544
  collectionId: rest[0],
2352
- queries: rest[1]
2545
+ queries: rest[1],
2546
+ transactionId: rest[2]
2353
2547
  };
2354
2548
  }
2355
2549
  const databaseId = params.databaseId;
2356
2550
  const collectionId = params.collectionId;
2357
2551
  const queries = params.queries;
2552
+ const transactionId = params.transactionId;
2358
2553
  if (typeof databaseId === 'undefined') {
2359
2554
  throw new AppwriteException('Missing required parameter: "databaseId"');
2360
2555
  }
@@ -2366,6 +2561,9 @@ class Databases extends Service {
2366
2561
  if (typeof queries !== 'undefined') {
2367
2562
  payload['queries'] = queries;
2368
2563
  }
2564
+ if (typeof transactionId !== 'undefined') {
2565
+ payload['transactionId'] = transactionId;
2566
+ }
2369
2567
  const uri = new URL(this.client.config.endpoint + apiPath);
2370
2568
  return this.client.call('get', uri, {}, payload);
2371
2569
  }
@@ -2380,7 +2578,8 @@ class Databases extends Service {
2380
2578
  collectionId: rest[0],
2381
2579
  documentId: rest[1],
2382
2580
  data: rest[2],
2383
- permissions: rest[3]
2581
+ permissions: rest[3],
2582
+ transactionId: rest[4]
2384
2583
  };
2385
2584
  }
2386
2585
  const databaseId = params.databaseId;
@@ -2388,6 +2587,7 @@ class Databases extends Service {
2388
2587
  const documentId = params.documentId;
2389
2588
  const data = params.data;
2390
2589
  const permissions = params.permissions;
2590
+ const transactionId = params.transactionId;
2391
2591
  if (typeof databaseId === 'undefined') {
2392
2592
  throw new AppwriteException('Missing required parameter: "databaseId"');
2393
2593
  }
@@ -2411,6 +2611,9 @@ class Databases extends Service {
2411
2611
  if (typeof permissions !== 'undefined') {
2412
2612
  payload['permissions'] = permissions;
2413
2613
  }
2614
+ if (typeof transactionId !== 'undefined') {
2615
+ payload['transactionId'] = transactionId;
2616
+ }
2414
2617
  const uri = new URL(this.client.config.endpoint + apiPath);
2415
2618
  return this.client.call('post', uri, {
2416
2619
  'content-type': 'application/json',
@@ -2426,13 +2629,15 @@ class Databases extends Service {
2426
2629
  databaseId: paramsOrFirst,
2427
2630
  collectionId: rest[0],
2428
2631
  documentId: rest[1],
2429
- queries: rest[2]
2632
+ queries: rest[2],
2633
+ transactionId: rest[3]
2430
2634
  };
2431
2635
  }
2432
2636
  const databaseId = params.databaseId;
2433
2637
  const collectionId = params.collectionId;
2434
2638
  const documentId = params.documentId;
2435
2639
  const queries = params.queries;
2640
+ const transactionId = params.transactionId;
2436
2641
  if (typeof databaseId === 'undefined') {
2437
2642
  throw new AppwriteException('Missing required parameter: "databaseId"');
2438
2643
  }
@@ -2447,6 +2652,9 @@ class Databases extends Service {
2447
2652
  if (typeof queries !== 'undefined') {
2448
2653
  payload['queries'] = queries;
2449
2654
  }
2655
+ if (typeof transactionId !== 'undefined') {
2656
+ payload['transactionId'] = transactionId;
2657
+ }
2450
2658
  const uri = new URL(this.client.config.endpoint + apiPath);
2451
2659
  return this.client.call('get', uri, {}, payload);
2452
2660
  }
@@ -2461,7 +2669,8 @@ class Databases extends Service {
2461
2669
  collectionId: rest[0],
2462
2670
  documentId: rest[1],
2463
2671
  data: rest[2],
2464
- permissions: rest[3]
2672
+ permissions: rest[3],
2673
+ transactionId: rest[4]
2465
2674
  };
2466
2675
  }
2467
2676
  const databaseId = params.databaseId;
@@ -2469,6 +2678,7 @@ class Databases extends Service {
2469
2678
  const documentId = params.documentId;
2470
2679
  const data = params.data;
2471
2680
  const permissions = params.permissions;
2681
+ const transactionId = params.transactionId;
2472
2682
  if (typeof databaseId === 'undefined') {
2473
2683
  throw new AppwriteException('Missing required parameter: "databaseId"');
2474
2684
  }
@@ -2489,6 +2699,9 @@ class Databases extends Service {
2489
2699
  if (typeof permissions !== 'undefined') {
2490
2700
  payload['permissions'] = permissions;
2491
2701
  }
2702
+ if (typeof transactionId !== 'undefined') {
2703
+ payload['transactionId'] = transactionId;
2704
+ }
2492
2705
  const uri = new URL(this.client.config.endpoint + apiPath);
2493
2706
  return this.client.call('put', uri, {
2494
2707
  'content-type': 'application/json',
@@ -2505,7 +2718,8 @@ class Databases extends Service {
2505
2718
  collectionId: rest[0],
2506
2719
  documentId: rest[1],
2507
2720
  data: rest[2],
2508
- permissions: rest[3]
2721
+ permissions: rest[3],
2722
+ transactionId: rest[4]
2509
2723
  };
2510
2724
  }
2511
2725
  const databaseId = params.databaseId;
@@ -2513,6 +2727,7 @@ class Databases extends Service {
2513
2727
  const documentId = params.documentId;
2514
2728
  const data = params.data;
2515
2729
  const permissions = params.permissions;
2730
+ const transactionId = params.transactionId;
2516
2731
  if (typeof databaseId === 'undefined') {
2517
2732
  throw new AppwriteException('Missing required parameter: "databaseId"');
2518
2733
  }
@@ -2530,6 +2745,9 @@ class Databases extends Service {
2530
2745
  if (typeof permissions !== 'undefined') {
2531
2746
  payload['permissions'] = permissions;
2532
2747
  }
2748
+ if (typeof transactionId !== 'undefined') {
2749
+ payload['transactionId'] = transactionId;
2750
+ }
2533
2751
  const uri = new URL(this.client.config.endpoint + apiPath);
2534
2752
  return this.client.call('patch', uri, {
2535
2753
  'content-type': 'application/json',
@@ -2544,12 +2762,14 @@ class Databases extends Service {
2544
2762
  params = {
2545
2763
  databaseId: paramsOrFirst,
2546
2764
  collectionId: rest[0],
2547
- documentId: rest[1]
2765
+ documentId: rest[1],
2766
+ transactionId: rest[2]
2548
2767
  };
2549
2768
  }
2550
2769
  const databaseId = params.databaseId;
2551
2770
  const collectionId = params.collectionId;
2552
2771
  const documentId = params.documentId;
2772
+ const transactionId = params.transactionId;
2553
2773
  if (typeof databaseId === 'undefined') {
2554
2774
  throw new AppwriteException('Missing required parameter: "databaseId"');
2555
2775
  }
@@ -2561,6 +2781,9 @@ class Databases extends Service {
2561
2781
  }
2562
2782
  const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
2563
2783
  const payload = {};
2784
+ if (typeof transactionId !== 'undefined') {
2785
+ payload['transactionId'] = transactionId;
2786
+ }
2564
2787
  const uri = new URL(this.client.config.endpoint + apiPath);
2565
2788
  return this.client.call('delete', uri, {
2566
2789
  'content-type': 'application/json',
@@ -2578,7 +2801,8 @@ class Databases extends Service {
2578
2801
  documentId: rest[1],
2579
2802
  attribute: rest[2],
2580
2803
  value: rest[3],
2581
- min: rest[4]
2804
+ min: rest[4],
2805
+ transactionId: rest[5]
2582
2806
  };
2583
2807
  }
2584
2808
  const databaseId = params.databaseId;
@@ -2587,6 +2811,7 @@ class Databases extends Service {
2587
2811
  const attribute = params.attribute;
2588
2812
  const value = params.value;
2589
2813
  const min = params.min;
2814
+ const transactionId = params.transactionId;
2590
2815
  if (typeof databaseId === 'undefined') {
2591
2816
  throw new AppwriteException('Missing required parameter: "databaseId"');
2592
2817
  }
@@ -2607,6 +2832,9 @@ class Databases extends Service {
2607
2832
  if (typeof min !== 'undefined') {
2608
2833
  payload['min'] = min;
2609
2834
  }
2835
+ if (typeof transactionId !== 'undefined') {
2836
+ payload['transactionId'] = transactionId;
2837
+ }
2610
2838
  const uri = new URL(this.client.config.endpoint + apiPath);
2611
2839
  return this.client.call('patch', uri, {
2612
2840
  'content-type': 'application/json',
@@ -2624,7 +2852,8 @@ class Databases extends Service {
2624
2852
  documentId: rest[1],
2625
2853
  attribute: rest[2],
2626
2854
  value: rest[3],
2627
- max: rest[4]
2855
+ max: rest[4],
2856
+ transactionId: rest[5]
2628
2857
  };
2629
2858
  }
2630
2859
  const databaseId = params.databaseId;
@@ -2633,6 +2862,7 @@ class Databases extends Service {
2633
2862
  const attribute = params.attribute;
2634
2863
  const value = params.value;
2635
2864
  const max = params.max;
2865
+ const transactionId = params.transactionId;
2636
2866
  if (typeof databaseId === 'undefined') {
2637
2867
  throw new AppwriteException('Missing required parameter: "databaseId"');
2638
2868
  }
@@ -2653,6 +2883,9 @@ class Databases extends Service {
2653
2883
  if (typeof max !== 'undefined') {
2654
2884
  payload['max'] = max;
2655
2885
  }
2886
+ if (typeof transactionId !== 'undefined') {
2887
+ payload['transactionId'] = transactionId;
2888
+ }
2656
2889
  const uri = new URL(this.client.config.endpoint + apiPath);
2657
2890
  return this.client.call('patch', uri, {
2658
2891
  'content-type': 'application/json',
@@ -3483,6 +3716,143 @@ class TablesDB extends Service {
3483
3716
  constructor(client) {
3484
3717
  super(client);
3485
3718
  }
3719
+ listTransactions(paramsOrFirst) {
3720
+ let params;
3721
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3722
+ params = (paramsOrFirst || {});
3723
+ }
3724
+ else {
3725
+ params = {
3726
+ queries: paramsOrFirst
3727
+ };
3728
+ }
3729
+ const queries = params.queries;
3730
+ const apiPath = '/tablesdb/transactions';
3731
+ const payload = {};
3732
+ if (typeof queries !== 'undefined') {
3733
+ payload['queries'] = queries;
3734
+ }
3735
+ const uri = new URL(this.client.config.endpoint + apiPath);
3736
+ return this.client.call('get', uri, {}, payload);
3737
+ }
3738
+ createTransaction(paramsOrFirst) {
3739
+ let params;
3740
+ if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3741
+ params = (paramsOrFirst || {});
3742
+ }
3743
+ else {
3744
+ params = {
3745
+ ttl: paramsOrFirst
3746
+ };
3747
+ }
3748
+ const ttl = params.ttl;
3749
+ const apiPath = '/tablesdb/transactions';
3750
+ const payload = {};
3751
+ if (typeof ttl !== 'undefined') {
3752
+ payload['ttl'] = ttl;
3753
+ }
3754
+ const uri = new URL(this.client.config.endpoint + apiPath);
3755
+ return this.client.call('post', uri, {
3756
+ 'content-type': 'application/json',
3757
+ }, payload);
3758
+ }
3759
+ getTransaction(paramsOrFirst) {
3760
+ let params;
3761
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3762
+ params = (paramsOrFirst || {});
3763
+ }
3764
+ else {
3765
+ params = {
3766
+ transactionId: paramsOrFirst
3767
+ };
3768
+ }
3769
+ const transactionId = params.transactionId;
3770
+ if (typeof transactionId === 'undefined') {
3771
+ throw new AppwriteException('Missing required parameter: "transactionId"');
3772
+ }
3773
+ const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
3774
+ const payload = {};
3775
+ const uri = new URL(this.client.config.endpoint + apiPath);
3776
+ return this.client.call('get', uri, {}, payload);
3777
+ }
3778
+ updateTransaction(paramsOrFirst, ...rest) {
3779
+ let params;
3780
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3781
+ params = (paramsOrFirst || {});
3782
+ }
3783
+ else {
3784
+ params = {
3785
+ transactionId: paramsOrFirst,
3786
+ commit: rest[0],
3787
+ rollback: rest[1]
3788
+ };
3789
+ }
3790
+ const transactionId = params.transactionId;
3791
+ const commit = params.commit;
3792
+ const rollback = params.rollback;
3793
+ if (typeof transactionId === 'undefined') {
3794
+ throw new AppwriteException('Missing required parameter: "transactionId"');
3795
+ }
3796
+ const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
3797
+ const payload = {};
3798
+ if (typeof commit !== 'undefined') {
3799
+ payload['commit'] = commit;
3800
+ }
3801
+ if (typeof rollback !== 'undefined') {
3802
+ payload['rollback'] = rollback;
3803
+ }
3804
+ const uri = new URL(this.client.config.endpoint + apiPath);
3805
+ return this.client.call('patch', uri, {
3806
+ 'content-type': 'application/json',
3807
+ }, payload);
3808
+ }
3809
+ deleteTransaction(paramsOrFirst) {
3810
+ let params;
3811
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3812
+ params = (paramsOrFirst || {});
3813
+ }
3814
+ else {
3815
+ params = {
3816
+ transactionId: paramsOrFirst
3817
+ };
3818
+ }
3819
+ const transactionId = params.transactionId;
3820
+ if (typeof transactionId === 'undefined') {
3821
+ throw new AppwriteException('Missing required parameter: "transactionId"');
3822
+ }
3823
+ const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
3824
+ const payload = {};
3825
+ const uri = new URL(this.client.config.endpoint + apiPath);
3826
+ return this.client.call('delete', uri, {
3827
+ 'content-type': 'application/json',
3828
+ }, payload);
3829
+ }
3830
+ createOperations(paramsOrFirst, ...rest) {
3831
+ let params;
3832
+ if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
3833
+ params = (paramsOrFirst || {});
3834
+ }
3835
+ else {
3836
+ params = {
3837
+ transactionId: paramsOrFirst,
3838
+ operations: rest[0]
3839
+ };
3840
+ }
3841
+ const transactionId = params.transactionId;
3842
+ const operations = params.operations;
3843
+ if (typeof transactionId === 'undefined') {
3844
+ throw new AppwriteException('Missing required parameter: "transactionId"');
3845
+ }
3846
+ const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
3847
+ const payload = {};
3848
+ if (typeof operations !== 'undefined') {
3849
+ payload['operations'] = operations;
3850
+ }
3851
+ const uri = new URL(this.client.config.endpoint + apiPath);
3852
+ return this.client.call('post', uri, {
3853
+ 'content-type': 'application/json',
3854
+ }, payload);
3855
+ }
3486
3856
  listRows(paramsOrFirst, ...rest) {
3487
3857
  let params;
3488
3858
  if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
@@ -3492,12 +3862,14 @@ class TablesDB extends Service {
3492
3862
  params = {
3493
3863
  databaseId: paramsOrFirst,
3494
3864
  tableId: rest[0],
3495
- queries: rest[1]
3865
+ queries: rest[1],
3866
+ transactionId: rest[2]
3496
3867
  };
3497
3868
  }
3498
3869
  const databaseId = params.databaseId;
3499
3870
  const tableId = params.tableId;
3500
3871
  const queries = params.queries;
3872
+ const transactionId = params.transactionId;
3501
3873
  if (typeof databaseId === 'undefined') {
3502
3874
  throw new AppwriteException('Missing required parameter: "databaseId"');
3503
3875
  }
@@ -3509,6 +3881,9 @@ class TablesDB extends Service {
3509
3881
  if (typeof queries !== 'undefined') {
3510
3882
  payload['queries'] = queries;
3511
3883
  }
3884
+ if (typeof transactionId !== 'undefined') {
3885
+ payload['transactionId'] = transactionId;
3886
+ }
3512
3887
  const uri = new URL(this.client.config.endpoint + apiPath);
3513
3888
  return this.client.call('get', uri, {}, payload);
3514
3889
  }
@@ -3523,7 +3898,8 @@ class TablesDB extends Service {
3523
3898
  tableId: rest[0],
3524
3899
  rowId: rest[1],
3525
3900
  data: rest[2],
3526
- permissions: rest[3]
3901
+ permissions: rest[3],
3902
+ transactionId: rest[4]
3527
3903
  };
3528
3904
  }
3529
3905
  const databaseId = params.databaseId;
@@ -3531,6 +3907,7 @@ class TablesDB extends Service {
3531
3907
  const rowId = params.rowId;
3532
3908
  const data = params.data;
3533
3909
  const permissions = params.permissions;
3910
+ const transactionId = params.transactionId;
3534
3911
  if (typeof databaseId === 'undefined') {
3535
3912
  throw new AppwriteException('Missing required parameter: "databaseId"');
3536
3913
  }
@@ -3554,6 +3931,9 @@ class TablesDB extends Service {
3554
3931
  if (typeof permissions !== 'undefined') {
3555
3932
  payload['permissions'] = permissions;
3556
3933
  }
3934
+ if (typeof transactionId !== 'undefined') {
3935
+ payload['transactionId'] = transactionId;
3936
+ }
3557
3937
  const uri = new URL(this.client.config.endpoint + apiPath);
3558
3938
  return this.client.call('post', uri, {
3559
3939
  'content-type': 'application/json',
@@ -3569,13 +3949,15 @@ class TablesDB extends Service {
3569
3949
  databaseId: paramsOrFirst,
3570
3950
  tableId: rest[0],
3571
3951
  rowId: rest[1],
3572
- queries: rest[2]
3952
+ queries: rest[2],
3953
+ transactionId: rest[3]
3573
3954
  };
3574
3955
  }
3575
3956
  const databaseId = params.databaseId;
3576
3957
  const tableId = params.tableId;
3577
3958
  const rowId = params.rowId;
3578
3959
  const queries = params.queries;
3960
+ const transactionId = params.transactionId;
3579
3961
  if (typeof databaseId === 'undefined') {
3580
3962
  throw new AppwriteException('Missing required parameter: "databaseId"');
3581
3963
  }
@@ -3590,6 +3972,9 @@ class TablesDB extends Service {
3590
3972
  if (typeof queries !== 'undefined') {
3591
3973
  payload['queries'] = queries;
3592
3974
  }
3975
+ if (typeof transactionId !== 'undefined') {
3976
+ payload['transactionId'] = transactionId;
3977
+ }
3593
3978
  const uri = new URL(this.client.config.endpoint + apiPath);
3594
3979
  return this.client.call('get', uri, {}, payload);
3595
3980
  }
@@ -3604,7 +3989,8 @@ class TablesDB extends Service {
3604
3989
  tableId: rest[0],
3605
3990
  rowId: rest[1],
3606
3991
  data: rest[2],
3607
- permissions: rest[3]
3992
+ permissions: rest[3],
3993
+ transactionId: rest[4]
3608
3994
  };
3609
3995
  }
3610
3996
  const databaseId = params.databaseId;
@@ -3612,6 +3998,7 @@ class TablesDB extends Service {
3612
3998
  const rowId = params.rowId;
3613
3999
  const data = params.data;
3614
4000
  const permissions = params.permissions;
4001
+ const transactionId = params.transactionId;
3615
4002
  if (typeof databaseId === 'undefined') {
3616
4003
  throw new AppwriteException('Missing required parameter: "databaseId"');
3617
4004
  }
@@ -3629,6 +4016,9 @@ class TablesDB extends Service {
3629
4016
  if (typeof permissions !== 'undefined') {
3630
4017
  payload['permissions'] = permissions;
3631
4018
  }
4019
+ if (typeof transactionId !== 'undefined') {
4020
+ payload['transactionId'] = transactionId;
4021
+ }
3632
4022
  const uri = new URL(this.client.config.endpoint + apiPath);
3633
4023
  return this.client.call('put', uri, {
3634
4024
  'content-type': 'application/json',
@@ -3645,7 +4035,8 @@ class TablesDB extends Service {
3645
4035
  tableId: rest[0],
3646
4036
  rowId: rest[1],
3647
4037
  data: rest[2],
3648
- permissions: rest[3]
4038
+ permissions: rest[3],
4039
+ transactionId: rest[4]
3649
4040
  };
3650
4041
  }
3651
4042
  const databaseId = params.databaseId;
@@ -3653,6 +4044,7 @@ class TablesDB extends Service {
3653
4044
  const rowId = params.rowId;
3654
4045
  const data = params.data;
3655
4046
  const permissions = params.permissions;
4047
+ const transactionId = params.transactionId;
3656
4048
  if (typeof databaseId === 'undefined') {
3657
4049
  throw new AppwriteException('Missing required parameter: "databaseId"');
3658
4050
  }
@@ -3670,6 +4062,9 @@ class TablesDB extends Service {
3670
4062
  if (typeof permissions !== 'undefined') {
3671
4063
  payload['permissions'] = permissions;
3672
4064
  }
4065
+ if (typeof transactionId !== 'undefined') {
4066
+ payload['transactionId'] = transactionId;
4067
+ }
3673
4068
  const uri = new URL(this.client.config.endpoint + apiPath);
3674
4069
  return this.client.call('patch', uri, {
3675
4070
  'content-type': 'application/json',
@@ -3684,12 +4079,14 @@ class TablesDB extends Service {
3684
4079
  params = {
3685
4080
  databaseId: paramsOrFirst,
3686
4081
  tableId: rest[0],
3687
- rowId: rest[1]
4082
+ rowId: rest[1],
4083
+ transactionId: rest[2]
3688
4084
  };
3689
4085
  }
3690
4086
  const databaseId = params.databaseId;
3691
4087
  const tableId = params.tableId;
3692
4088
  const rowId = params.rowId;
4089
+ const transactionId = params.transactionId;
3693
4090
  if (typeof databaseId === 'undefined') {
3694
4091
  throw new AppwriteException('Missing required parameter: "databaseId"');
3695
4092
  }
@@ -3701,6 +4098,9 @@ class TablesDB extends Service {
3701
4098
  }
3702
4099
  const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
3703
4100
  const payload = {};
4101
+ if (typeof transactionId !== 'undefined') {
4102
+ payload['transactionId'] = transactionId;
4103
+ }
3704
4104
  const uri = new URL(this.client.config.endpoint + apiPath);
3705
4105
  return this.client.call('delete', uri, {
3706
4106
  'content-type': 'application/json',
@@ -3718,7 +4118,8 @@ class TablesDB extends Service {
3718
4118
  rowId: rest[1],
3719
4119
  column: rest[2],
3720
4120
  value: rest[3],
3721
- min: rest[4]
4121
+ min: rest[4],
4122
+ transactionId: rest[5]
3722
4123
  };
3723
4124
  }
3724
4125
  const databaseId = params.databaseId;
@@ -3727,6 +4128,7 @@ class TablesDB extends Service {
3727
4128
  const column = params.column;
3728
4129
  const value = params.value;
3729
4130
  const min = params.min;
4131
+ const transactionId = params.transactionId;
3730
4132
  if (typeof databaseId === 'undefined') {
3731
4133
  throw new AppwriteException('Missing required parameter: "databaseId"');
3732
4134
  }
@@ -3747,6 +4149,9 @@ class TablesDB extends Service {
3747
4149
  if (typeof min !== 'undefined') {
3748
4150
  payload['min'] = min;
3749
4151
  }
4152
+ if (typeof transactionId !== 'undefined') {
4153
+ payload['transactionId'] = transactionId;
4154
+ }
3750
4155
  const uri = new URL(this.client.config.endpoint + apiPath);
3751
4156
  return this.client.call('patch', uri, {
3752
4157
  'content-type': 'application/json',
@@ -3764,7 +4169,8 @@ class TablesDB extends Service {
3764
4169
  rowId: rest[1],
3765
4170
  column: rest[2],
3766
4171
  value: rest[3],
3767
- max: rest[4]
4172
+ max: rest[4],
4173
+ transactionId: rest[5]
3768
4174
  };
3769
4175
  }
3770
4176
  const databaseId = params.databaseId;
@@ -3773,6 +4179,7 @@ class TablesDB extends Service {
3773
4179
  const column = params.column;
3774
4180
  const value = params.value;
3775
4181
  const max = params.max;
4182
+ const transactionId = params.transactionId;
3776
4183
  if (typeof databaseId === 'undefined') {
3777
4184
  throw new AppwriteException('Missing required parameter: "databaseId"');
3778
4185
  }
@@ -3793,6 +4200,9 @@ class TablesDB extends Service {
3793
4200
  if (typeof max !== 'undefined') {
3794
4201
  payload['max'] = max;
3795
4202
  }
4203
+ if (typeof transactionId !== 'undefined') {
4204
+ payload['transactionId'] = transactionId;
4205
+ }
3796
4206
  const uri = new URL(this.client.config.endpoint + apiPath);
3797
4207
  return this.client.call('patch', uri, {
3798
4208
  'content-type': 'application/json',