react-native-appwrite 0.16.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.
- package/CHANGELOG.md +4 -0
- package/dist/cjs/sdk.js +371 -17
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +371 -17
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/databases/create-document.md +2 -1
- package/docs/examples/databases/create-operations.md +24 -0
- package/docs/examples/databases/create-transaction.md +13 -0
- package/docs/examples/databases/decrement-document-attribute.md +2 -1
- package/docs/examples/databases/delete-document.md +2 -1
- package/docs/examples/databases/delete-transaction.md +13 -0
- package/docs/examples/databases/get-document.md +2 -1
- package/docs/examples/databases/get-transaction.md +13 -0
- package/docs/examples/databases/increment-document-attribute.md +2 -1
- package/docs/examples/databases/list-documents.md +2 -1
- package/docs/examples/databases/list-transactions.md +13 -0
- package/docs/examples/databases/update-document.md +2 -1
- package/docs/examples/databases/update-transaction.md +15 -0
- package/docs/examples/databases/upsert-document.md +2 -1
- package/docs/examples/tablesdb/create-operations.md +24 -0
- package/docs/examples/tablesdb/create-row.md +2 -1
- package/docs/examples/tablesdb/create-transaction.md +13 -0
- package/docs/examples/tablesdb/decrement-row-column.md +2 -1
- package/docs/examples/tablesdb/delete-row.md +2 -1
- package/docs/examples/tablesdb/delete-transaction.md +13 -0
- package/docs/examples/tablesdb/get-row.md +2 -1
- package/docs/examples/tablesdb/get-transaction.md +13 -0
- package/docs/examples/tablesdb/increment-row-column.md +2 -1
- package/docs/examples/tablesdb/list-rows.md +2 -1
- package/docs/examples/tablesdb/list-transactions.md +13 -0
- package/docs/examples/tablesdb/update-row.md +2 -1
- package/docs/examples/tablesdb/update-transaction.md +15 -0
- package/docs/examples/tablesdb/upsert-row.md +2 -1
- package/package.json +1 -1
- package/src/client.ts +1 -1
- package/src/models.ts +44 -0
- package/src/services/databases.ts +414 -56
- package/src/services/tables-db.ts +414 -56
- package/types/models.d.ts +42 -0
- package/types/services/databases.d.ts +155 -8
- package/types/services/tables-db.d.ts +155 -8
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.
|
|
103
|
+
'x-sdk-version': '0.17.1',
|
|
104
104
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
105
105
|
};
|
|
106
106
|
this.realtime = {
|
|
@@ -2418,6 +2418,143 @@ class Databases extends Service {
|
|
|
2418
2418
|
constructor(client) {
|
|
2419
2419
|
super(client);
|
|
2420
2420
|
}
|
|
2421
|
+
listTransactions(paramsOrFirst) {
|
|
2422
|
+
let params;
|
|
2423
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2424
|
+
params = (paramsOrFirst || {});
|
|
2425
|
+
}
|
|
2426
|
+
else {
|
|
2427
|
+
params = {
|
|
2428
|
+
queries: paramsOrFirst
|
|
2429
|
+
};
|
|
2430
|
+
}
|
|
2431
|
+
const queries = params.queries;
|
|
2432
|
+
const apiPath = '/databases/transactions';
|
|
2433
|
+
const payload = {};
|
|
2434
|
+
if (typeof queries !== 'undefined') {
|
|
2435
|
+
payload['queries'] = queries;
|
|
2436
|
+
}
|
|
2437
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2438
|
+
return this.client.call('get', uri, {}, payload);
|
|
2439
|
+
}
|
|
2440
|
+
createTransaction(paramsOrFirst) {
|
|
2441
|
+
let params;
|
|
2442
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2443
|
+
params = (paramsOrFirst || {});
|
|
2444
|
+
}
|
|
2445
|
+
else {
|
|
2446
|
+
params = {
|
|
2447
|
+
ttl: paramsOrFirst
|
|
2448
|
+
};
|
|
2449
|
+
}
|
|
2450
|
+
const ttl = params.ttl;
|
|
2451
|
+
const apiPath = '/databases/transactions';
|
|
2452
|
+
const payload = {};
|
|
2453
|
+
if (typeof ttl !== 'undefined') {
|
|
2454
|
+
payload['ttl'] = ttl;
|
|
2455
|
+
}
|
|
2456
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2457
|
+
return this.client.call('post', uri, {
|
|
2458
|
+
'content-type': 'application/json',
|
|
2459
|
+
}, payload);
|
|
2460
|
+
}
|
|
2461
|
+
getTransaction(paramsOrFirst) {
|
|
2462
|
+
let params;
|
|
2463
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2464
|
+
params = (paramsOrFirst || {});
|
|
2465
|
+
}
|
|
2466
|
+
else {
|
|
2467
|
+
params = {
|
|
2468
|
+
transactionId: paramsOrFirst
|
|
2469
|
+
};
|
|
2470
|
+
}
|
|
2471
|
+
const transactionId = params.transactionId;
|
|
2472
|
+
if (typeof transactionId === 'undefined') {
|
|
2473
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
2474
|
+
}
|
|
2475
|
+
const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
2476
|
+
const payload = {};
|
|
2477
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2478
|
+
return this.client.call('get', uri, {}, payload);
|
|
2479
|
+
}
|
|
2480
|
+
updateTransaction(paramsOrFirst, ...rest) {
|
|
2481
|
+
let params;
|
|
2482
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2483
|
+
params = (paramsOrFirst || {});
|
|
2484
|
+
}
|
|
2485
|
+
else {
|
|
2486
|
+
params = {
|
|
2487
|
+
transactionId: paramsOrFirst,
|
|
2488
|
+
commit: rest[0],
|
|
2489
|
+
rollback: rest[1]
|
|
2490
|
+
};
|
|
2491
|
+
}
|
|
2492
|
+
const transactionId = params.transactionId;
|
|
2493
|
+
const commit = params.commit;
|
|
2494
|
+
const rollback = params.rollback;
|
|
2495
|
+
if (typeof transactionId === 'undefined') {
|
|
2496
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
2497
|
+
}
|
|
2498
|
+
const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
2499
|
+
const payload = {};
|
|
2500
|
+
if (typeof commit !== 'undefined') {
|
|
2501
|
+
payload['commit'] = commit;
|
|
2502
|
+
}
|
|
2503
|
+
if (typeof rollback !== 'undefined') {
|
|
2504
|
+
payload['rollback'] = rollback;
|
|
2505
|
+
}
|
|
2506
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2507
|
+
return this.client.call('patch', uri, {
|
|
2508
|
+
'content-type': 'application/json',
|
|
2509
|
+
}, payload);
|
|
2510
|
+
}
|
|
2511
|
+
deleteTransaction(paramsOrFirst) {
|
|
2512
|
+
let params;
|
|
2513
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2514
|
+
params = (paramsOrFirst || {});
|
|
2515
|
+
}
|
|
2516
|
+
else {
|
|
2517
|
+
params = {
|
|
2518
|
+
transactionId: paramsOrFirst
|
|
2519
|
+
};
|
|
2520
|
+
}
|
|
2521
|
+
const transactionId = params.transactionId;
|
|
2522
|
+
if (typeof transactionId === 'undefined') {
|
|
2523
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
2524
|
+
}
|
|
2525
|
+
const apiPath = '/databases/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
2526
|
+
const payload = {};
|
|
2527
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2528
|
+
return this.client.call('delete', uri, {
|
|
2529
|
+
'content-type': 'application/json',
|
|
2530
|
+
}, payload);
|
|
2531
|
+
}
|
|
2532
|
+
createOperations(paramsOrFirst, ...rest) {
|
|
2533
|
+
let params;
|
|
2534
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
2535
|
+
params = (paramsOrFirst || {});
|
|
2536
|
+
}
|
|
2537
|
+
else {
|
|
2538
|
+
params = {
|
|
2539
|
+
transactionId: paramsOrFirst,
|
|
2540
|
+
operations: rest[0]
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
const transactionId = params.transactionId;
|
|
2544
|
+
const operations = params.operations;
|
|
2545
|
+
if (typeof transactionId === 'undefined') {
|
|
2546
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
2547
|
+
}
|
|
2548
|
+
const apiPath = '/databases/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
|
|
2549
|
+
const payload = {};
|
|
2550
|
+
if (typeof operations !== 'undefined') {
|
|
2551
|
+
payload['operations'] = operations;
|
|
2552
|
+
}
|
|
2553
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2554
|
+
return this.client.call('post', uri, {
|
|
2555
|
+
'content-type': 'application/json',
|
|
2556
|
+
}, payload);
|
|
2557
|
+
}
|
|
2421
2558
|
listDocuments(paramsOrFirst, ...rest) {
|
|
2422
2559
|
let params;
|
|
2423
2560
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -2427,12 +2564,14 @@ class Databases extends Service {
|
|
|
2427
2564
|
params = {
|
|
2428
2565
|
databaseId: paramsOrFirst,
|
|
2429
2566
|
collectionId: rest[0],
|
|
2430
|
-
queries: rest[1]
|
|
2567
|
+
queries: rest[1],
|
|
2568
|
+
transactionId: rest[2]
|
|
2431
2569
|
};
|
|
2432
2570
|
}
|
|
2433
2571
|
const databaseId = params.databaseId;
|
|
2434
2572
|
const collectionId = params.collectionId;
|
|
2435
2573
|
const queries = params.queries;
|
|
2574
|
+
const transactionId = params.transactionId;
|
|
2436
2575
|
if (typeof databaseId === 'undefined') {
|
|
2437
2576
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2438
2577
|
}
|
|
@@ -2444,6 +2583,9 @@ class Databases extends Service {
|
|
|
2444
2583
|
if (typeof queries !== 'undefined') {
|
|
2445
2584
|
payload['queries'] = queries;
|
|
2446
2585
|
}
|
|
2586
|
+
if (typeof transactionId !== 'undefined') {
|
|
2587
|
+
payload['transactionId'] = transactionId;
|
|
2588
|
+
}
|
|
2447
2589
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2448
2590
|
return this.client.call('get', uri, {}, payload);
|
|
2449
2591
|
}
|
|
@@ -2458,7 +2600,8 @@ class Databases extends Service {
|
|
|
2458
2600
|
collectionId: rest[0],
|
|
2459
2601
|
documentId: rest[1],
|
|
2460
2602
|
data: rest[2],
|
|
2461
|
-
permissions: rest[3]
|
|
2603
|
+
permissions: rest[3],
|
|
2604
|
+
transactionId: rest[4]
|
|
2462
2605
|
};
|
|
2463
2606
|
}
|
|
2464
2607
|
const databaseId = params.databaseId;
|
|
@@ -2466,6 +2609,7 @@ class Databases extends Service {
|
|
|
2466
2609
|
const documentId = params.documentId;
|
|
2467
2610
|
const data = params.data;
|
|
2468
2611
|
const permissions = params.permissions;
|
|
2612
|
+
const transactionId = params.transactionId;
|
|
2469
2613
|
if (typeof databaseId === 'undefined') {
|
|
2470
2614
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2471
2615
|
}
|
|
@@ -2489,6 +2633,9 @@ class Databases extends Service {
|
|
|
2489
2633
|
if (typeof permissions !== 'undefined') {
|
|
2490
2634
|
payload['permissions'] = permissions;
|
|
2491
2635
|
}
|
|
2636
|
+
if (typeof transactionId !== 'undefined') {
|
|
2637
|
+
payload['transactionId'] = transactionId;
|
|
2638
|
+
}
|
|
2492
2639
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2493
2640
|
return this.client.call('post', uri, {
|
|
2494
2641
|
'content-type': 'application/json',
|
|
@@ -2504,13 +2651,15 @@ class Databases extends Service {
|
|
|
2504
2651
|
databaseId: paramsOrFirst,
|
|
2505
2652
|
collectionId: rest[0],
|
|
2506
2653
|
documentId: rest[1],
|
|
2507
|
-
queries: rest[2]
|
|
2654
|
+
queries: rest[2],
|
|
2655
|
+
transactionId: rest[3]
|
|
2508
2656
|
};
|
|
2509
2657
|
}
|
|
2510
2658
|
const databaseId = params.databaseId;
|
|
2511
2659
|
const collectionId = params.collectionId;
|
|
2512
2660
|
const documentId = params.documentId;
|
|
2513
2661
|
const queries = params.queries;
|
|
2662
|
+
const transactionId = params.transactionId;
|
|
2514
2663
|
if (typeof databaseId === 'undefined') {
|
|
2515
2664
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2516
2665
|
}
|
|
@@ -2525,6 +2674,9 @@ class Databases extends Service {
|
|
|
2525
2674
|
if (typeof queries !== 'undefined') {
|
|
2526
2675
|
payload['queries'] = queries;
|
|
2527
2676
|
}
|
|
2677
|
+
if (typeof transactionId !== 'undefined') {
|
|
2678
|
+
payload['transactionId'] = transactionId;
|
|
2679
|
+
}
|
|
2528
2680
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2529
2681
|
return this.client.call('get', uri, {}, payload);
|
|
2530
2682
|
}
|
|
@@ -2539,7 +2691,8 @@ class Databases extends Service {
|
|
|
2539
2691
|
collectionId: rest[0],
|
|
2540
2692
|
documentId: rest[1],
|
|
2541
2693
|
data: rest[2],
|
|
2542
|
-
permissions: rest[3]
|
|
2694
|
+
permissions: rest[3],
|
|
2695
|
+
transactionId: rest[4]
|
|
2543
2696
|
};
|
|
2544
2697
|
}
|
|
2545
2698
|
const databaseId = params.databaseId;
|
|
@@ -2547,6 +2700,7 @@ class Databases extends Service {
|
|
|
2547
2700
|
const documentId = params.documentId;
|
|
2548
2701
|
const data = params.data;
|
|
2549
2702
|
const permissions = params.permissions;
|
|
2703
|
+
const transactionId = params.transactionId;
|
|
2550
2704
|
if (typeof databaseId === 'undefined') {
|
|
2551
2705
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2552
2706
|
}
|
|
@@ -2567,6 +2721,9 @@ class Databases extends Service {
|
|
|
2567
2721
|
if (typeof permissions !== 'undefined') {
|
|
2568
2722
|
payload['permissions'] = permissions;
|
|
2569
2723
|
}
|
|
2724
|
+
if (typeof transactionId !== 'undefined') {
|
|
2725
|
+
payload['transactionId'] = transactionId;
|
|
2726
|
+
}
|
|
2570
2727
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2571
2728
|
return this.client.call('put', uri, {
|
|
2572
2729
|
'content-type': 'application/json',
|
|
@@ -2583,7 +2740,8 @@ class Databases extends Service {
|
|
|
2583
2740
|
collectionId: rest[0],
|
|
2584
2741
|
documentId: rest[1],
|
|
2585
2742
|
data: rest[2],
|
|
2586
|
-
permissions: rest[3]
|
|
2743
|
+
permissions: rest[3],
|
|
2744
|
+
transactionId: rest[4]
|
|
2587
2745
|
};
|
|
2588
2746
|
}
|
|
2589
2747
|
const databaseId = params.databaseId;
|
|
@@ -2591,6 +2749,7 @@ class Databases extends Service {
|
|
|
2591
2749
|
const documentId = params.documentId;
|
|
2592
2750
|
const data = params.data;
|
|
2593
2751
|
const permissions = params.permissions;
|
|
2752
|
+
const transactionId = params.transactionId;
|
|
2594
2753
|
if (typeof databaseId === 'undefined') {
|
|
2595
2754
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2596
2755
|
}
|
|
@@ -2608,6 +2767,9 @@ class Databases extends Service {
|
|
|
2608
2767
|
if (typeof permissions !== 'undefined') {
|
|
2609
2768
|
payload['permissions'] = permissions;
|
|
2610
2769
|
}
|
|
2770
|
+
if (typeof transactionId !== 'undefined') {
|
|
2771
|
+
payload['transactionId'] = transactionId;
|
|
2772
|
+
}
|
|
2611
2773
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2612
2774
|
return this.client.call('patch', uri, {
|
|
2613
2775
|
'content-type': 'application/json',
|
|
@@ -2622,12 +2784,14 @@ class Databases extends Service {
|
|
|
2622
2784
|
params = {
|
|
2623
2785
|
databaseId: paramsOrFirst,
|
|
2624
2786
|
collectionId: rest[0],
|
|
2625
|
-
documentId: rest[1]
|
|
2787
|
+
documentId: rest[1],
|
|
2788
|
+
transactionId: rest[2]
|
|
2626
2789
|
};
|
|
2627
2790
|
}
|
|
2628
2791
|
const databaseId = params.databaseId;
|
|
2629
2792
|
const collectionId = params.collectionId;
|
|
2630
2793
|
const documentId = params.documentId;
|
|
2794
|
+
const transactionId = params.transactionId;
|
|
2631
2795
|
if (typeof databaseId === 'undefined') {
|
|
2632
2796
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2633
2797
|
}
|
|
@@ -2639,6 +2803,9 @@ class Databases extends Service {
|
|
|
2639
2803
|
}
|
|
2640
2804
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2641
2805
|
const payload = {};
|
|
2806
|
+
if (typeof transactionId !== 'undefined') {
|
|
2807
|
+
payload['transactionId'] = transactionId;
|
|
2808
|
+
}
|
|
2642
2809
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2643
2810
|
return this.client.call('delete', uri, {
|
|
2644
2811
|
'content-type': 'application/json',
|
|
@@ -2656,7 +2823,8 @@ class Databases extends Service {
|
|
|
2656
2823
|
documentId: rest[1],
|
|
2657
2824
|
attribute: rest[2],
|
|
2658
2825
|
value: rest[3],
|
|
2659
|
-
min: rest[4]
|
|
2826
|
+
min: rest[4],
|
|
2827
|
+
transactionId: rest[5]
|
|
2660
2828
|
};
|
|
2661
2829
|
}
|
|
2662
2830
|
const databaseId = params.databaseId;
|
|
@@ -2665,6 +2833,7 @@ class Databases extends Service {
|
|
|
2665
2833
|
const attribute = params.attribute;
|
|
2666
2834
|
const value = params.value;
|
|
2667
2835
|
const min = params.min;
|
|
2836
|
+
const transactionId = params.transactionId;
|
|
2668
2837
|
if (typeof databaseId === 'undefined') {
|
|
2669
2838
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2670
2839
|
}
|
|
@@ -2685,6 +2854,9 @@ class Databases extends Service {
|
|
|
2685
2854
|
if (typeof min !== 'undefined') {
|
|
2686
2855
|
payload['min'] = min;
|
|
2687
2856
|
}
|
|
2857
|
+
if (typeof transactionId !== 'undefined') {
|
|
2858
|
+
payload['transactionId'] = transactionId;
|
|
2859
|
+
}
|
|
2688
2860
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2689
2861
|
return this.client.call('patch', uri, {
|
|
2690
2862
|
'content-type': 'application/json',
|
|
@@ -2702,7 +2874,8 @@ class Databases extends Service {
|
|
|
2702
2874
|
documentId: rest[1],
|
|
2703
2875
|
attribute: rest[2],
|
|
2704
2876
|
value: rest[3],
|
|
2705
|
-
max: rest[4]
|
|
2877
|
+
max: rest[4],
|
|
2878
|
+
transactionId: rest[5]
|
|
2706
2879
|
};
|
|
2707
2880
|
}
|
|
2708
2881
|
const databaseId = params.databaseId;
|
|
@@ -2711,6 +2884,7 @@ class Databases extends Service {
|
|
|
2711
2884
|
const attribute = params.attribute;
|
|
2712
2885
|
const value = params.value;
|
|
2713
2886
|
const max = params.max;
|
|
2887
|
+
const transactionId = params.transactionId;
|
|
2714
2888
|
if (typeof databaseId === 'undefined') {
|
|
2715
2889
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2716
2890
|
}
|
|
@@ -2731,6 +2905,9 @@ class Databases extends Service {
|
|
|
2731
2905
|
if (typeof max !== 'undefined') {
|
|
2732
2906
|
payload['max'] = max;
|
|
2733
2907
|
}
|
|
2908
|
+
if (typeof transactionId !== 'undefined') {
|
|
2909
|
+
payload['transactionId'] = transactionId;
|
|
2910
|
+
}
|
|
2734
2911
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2735
2912
|
return this.client.call('patch', uri, {
|
|
2736
2913
|
'content-type': 'application/json',
|
|
@@ -3561,6 +3738,143 @@ class TablesDB extends Service {
|
|
|
3561
3738
|
constructor(client) {
|
|
3562
3739
|
super(client);
|
|
3563
3740
|
}
|
|
3741
|
+
listTransactions(paramsOrFirst) {
|
|
3742
|
+
let params;
|
|
3743
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3744
|
+
params = (paramsOrFirst || {});
|
|
3745
|
+
}
|
|
3746
|
+
else {
|
|
3747
|
+
params = {
|
|
3748
|
+
queries: paramsOrFirst
|
|
3749
|
+
};
|
|
3750
|
+
}
|
|
3751
|
+
const queries = params.queries;
|
|
3752
|
+
const apiPath = '/tablesdb/transactions';
|
|
3753
|
+
const payload = {};
|
|
3754
|
+
if (typeof queries !== 'undefined') {
|
|
3755
|
+
payload['queries'] = queries;
|
|
3756
|
+
}
|
|
3757
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3758
|
+
return this.client.call('get', uri, {}, payload);
|
|
3759
|
+
}
|
|
3760
|
+
createTransaction(paramsOrFirst) {
|
|
3761
|
+
let params;
|
|
3762
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3763
|
+
params = (paramsOrFirst || {});
|
|
3764
|
+
}
|
|
3765
|
+
else {
|
|
3766
|
+
params = {
|
|
3767
|
+
ttl: paramsOrFirst
|
|
3768
|
+
};
|
|
3769
|
+
}
|
|
3770
|
+
const ttl = params.ttl;
|
|
3771
|
+
const apiPath = '/tablesdb/transactions';
|
|
3772
|
+
const payload = {};
|
|
3773
|
+
if (typeof ttl !== 'undefined') {
|
|
3774
|
+
payload['ttl'] = ttl;
|
|
3775
|
+
}
|
|
3776
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3777
|
+
return this.client.call('post', uri, {
|
|
3778
|
+
'content-type': 'application/json',
|
|
3779
|
+
}, payload);
|
|
3780
|
+
}
|
|
3781
|
+
getTransaction(paramsOrFirst) {
|
|
3782
|
+
let params;
|
|
3783
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3784
|
+
params = (paramsOrFirst || {});
|
|
3785
|
+
}
|
|
3786
|
+
else {
|
|
3787
|
+
params = {
|
|
3788
|
+
transactionId: paramsOrFirst
|
|
3789
|
+
};
|
|
3790
|
+
}
|
|
3791
|
+
const transactionId = params.transactionId;
|
|
3792
|
+
if (typeof transactionId === 'undefined') {
|
|
3793
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
3794
|
+
}
|
|
3795
|
+
const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
3796
|
+
const payload = {};
|
|
3797
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3798
|
+
return this.client.call('get', uri, {}, payload);
|
|
3799
|
+
}
|
|
3800
|
+
updateTransaction(paramsOrFirst, ...rest) {
|
|
3801
|
+
let params;
|
|
3802
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3803
|
+
params = (paramsOrFirst || {});
|
|
3804
|
+
}
|
|
3805
|
+
else {
|
|
3806
|
+
params = {
|
|
3807
|
+
transactionId: paramsOrFirst,
|
|
3808
|
+
commit: rest[0],
|
|
3809
|
+
rollback: rest[1]
|
|
3810
|
+
};
|
|
3811
|
+
}
|
|
3812
|
+
const transactionId = params.transactionId;
|
|
3813
|
+
const commit = params.commit;
|
|
3814
|
+
const rollback = params.rollback;
|
|
3815
|
+
if (typeof transactionId === 'undefined') {
|
|
3816
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
3817
|
+
}
|
|
3818
|
+
const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
3819
|
+
const payload = {};
|
|
3820
|
+
if (typeof commit !== 'undefined') {
|
|
3821
|
+
payload['commit'] = commit;
|
|
3822
|
+
}
|
|
3823
|
+
if (typeof rollback !== 'undefined') {
|
|
3824
|
+
payload['rollback'] = rollback;
|
|
3825
|
+
}
|
|
3826
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3827
|
+
return this.client.call('patch', uri, {
|
|
3828
|
+
'content-type': 'application/json',
|
|
3829
|
+
}, payload);
|
|
3830
|
+
}
|
|
3831
|
+
deleteTransaction(paramsOrFirst) {
|
|
3832
|
+
let params;
|
|
3833
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3834
|
+
params = (paramsOrFirst || {});
|
|
3835
|
+
}
|
|
3836
|
+
else {
|
|
3837
|
+
params = {
|
|
3838
|
+
transactionId: paramsOrFirst
|
|
3839
|
+
};
|
|
3840
|
+
}
|
|
3841
|
+
const transactionId = params.transactionId;
|
|
3842
|
+
if (typeof transactionId === 'undefined') {
|
|
3843
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
3844
|
+
}
|
|
3845
|
+
const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
3846
|
+
const payload = {};
|
|
3847
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3848
|
+
return this.client.call('delete', uri, {
|
|
3849
|
+
'content-type': 'application/json',
|
|
3850
|
+
}, payload);
|
|
3851
|
+
}
|
|
3852
|
+
createOperations(paramsOrFirst, ...rest) {
|
|
3853
|
+
let params;
|
|
3854
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
3855
|
+
params = (paramsOrFirst || {});
|
|
3856
|
+
}
|
|
3857
|
+
else {
|
|
3858
|
+
params = {
|
|
3859
|
+
transactionId: paramsOrFirst,
|
|
3860
|
+
operations: rest[0]
|
|
3861
|
+
};
|
|
3862
|
+
}
|
|
3863
|
+
const transactionId = params.transactionId;
|
|
3864
|
+
const operations = params.operations;
|
|
3865
|
+
if (typeof transactionId === 'undefined') {
|
|
3866
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
3867
|
+
}
|
|
3868
|
+
const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
|
|
3869
|
+
const payload = {};
|
|
3870
|
+
if (typeof operations !== 'undefined') {
|
|
3871
|
+
payload['operations'] = operations;
|
|
3872
|
+
}
|
|
3873
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3874
|
+
return this.client.call('post', uri, {
|
|
3875
|
+
'content-type': 'application/json',
|
|
3876
|
+
}, payload);
|
|
3877
|
+
}
|
|
3564
3878
|
listRows(paramsOrFirst, ...rest) {
|
|
3565
3879
|
let params;
|
|
3566
3880
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -3570,12 +3884,14 @@ class TablesDB extends Service {
|
|
|
3570
3884
|
params = {
|
|
3571
3885
|
databaseId: paramsOrFirst,
|
|
3572
3886
|
tableId: rest[0],
|
|
3573
|
-
queries: rest[1]
|
|
3887
|
+
queries: rest[1],
|
|
3888
|
+
transactionId: rest[2]
|
|
3574
3889
|
};
|
|
3575
3890
|
}
|
|
3576
3891
|
const databaseId = params.databaseId;
|
|
3577
3892
|
const tableId = params.tableId;
|
|
3578
3893
|
const queries = params.queries;
|
|
3894
|
+
const transactionId = params.transactionId;
|
|
3579
3895
|
if (typeof databaseId === 'undefined') {
|
|
3580
3896
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3581
3897
|
}
|
|
@@ -3587,6 +3903,9 @@ class TablesDB extends Service {
|
|
|
3587
3903
|
if (typeof queries !== 'undefined') {
|
|
3588
3904
|
payload['queries'] = queries;
|
|
3589
3905
|
}
|
|
3906
|
+
if (typeof transactionId !== 'undefined') {
|
|
3907
|
+
payload['transactionId'] = transactionId;
|
|
3908
|
+
}
|
|
3590
3909
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3591
3910
|
return this.client.call('get', uri, {}, payload);
|
|
3592
3911
|
}
|
|
@@ -3601,7 +3920,8 @@ class TablesDB extends Service {
|
|
|
3601
3920
|
tableId: rest[0],
|
|
3602
3921
|
rowId: rest[1],
|
|
3603
3922
|
data: rest[2],
|
|
3604
|
-
permissions: rest[3]
|
|
3923
|
+
permissions: rest[3],
|
|
3924
|
+
transactionId: rest[4]
|
|
3605
3925
|
};
|
|
3606
3926
|
}
|
|
3607
3927
|
const databaseId = params.databaseId;
|
|
@@ -3609,6 +3929,7 @@ class TablesDB extends Service {
|
|
|
3609
3929
|
const rowId = params.rowId;
|
|
3610
3930
|
const data = params.data;
|
|
3611
3931
|
const permissions = params.permissions;
|
|
3932
|
+
const transactionId = params.transactionId;
|
|
3612
3933
|
if (typeof databaseId === 'undefined') {
|
|
3613
3934
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3614
3935
|
}
|
|
@@ -3632,6 +3953,9 @@ class TablesDB extends Service {
|
|
|
3632
3953
|
if (typeof permissions !== 'undefined') {
|
|
3633
3954
|
payload['permissions'] = permissions;
|
|
3634
3955
|
}
|
|
3956
|
+
if (typeof transactionId !== 'undefined') {
|
|
3957
|
+
payload['transactionId'] = transactionId;
|
|
3958
|
+
}
|
|
3635
3959
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3636
3960
|
return this.client.call('post', uri, {
|
|
3637
3961
|
'content-type': 'application/json',
|
|
@@ -3647,13 +3971,15 @@ class TablesDB extends Service {
|
|
|
3647
3971
|
databaseId: paramsOrFirst,
|
|
3648
3972
|
tableId: rest[0],
|
|
3649
3973
|
rowId: rest[1],
|
|
3650
|
-
queries: rest[2]
|
|
3974
|
+
queries: rest[2],
|
|
3975
|
+
transactionId: rest[3]
|
|
3651
3976
|
};
|
|
3652
3977
|
}
|
|
3653
3978
|
const databaseId = params.databaseId;
|
|
3654
3979
|
const tableId = params.tableId;
|
|
3655
3980
|
const rowId = params.rowId;
|
|
3656
3981
|
const queries = params.queries;
|
|
3982
|
+
const transactionId = params.transactionId;
|
|
3657
3983
|
if (typeof databaseId === 'undefined') {
|
|
3658
3984
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3659
3985
|
}
|
|
@@ -3668,6 +3994,9 @@ class TablesDB extends Service {
|
|
|
3668
3994
|
if (typeof queries !== 'undefined') {
|
|
3669
3995
|
payload['queries'] = queries;
|
|
3670
3996
|
}
|
|
3997
|
+
if (typeof transactionId !== 'undefined') {
|
|
3998
|
+
payload['transactionId'] = transactionId;
|
|
3999
|
+
}
|
|
3671
4000
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3672
4001
|
return this.client.call('get', uri, {}, payload);
|
|
3673
4002
|
}
|
|
@@ -3682,7 +4011,8 @@ class TablesDB extends Service {
|
|
|
3682
4011
|
tableId: rest[0],
|
|
3683
4012
|
rowId: rest[1],
|
|
3684
4013
|
data: rest[2],
|
|
3685
|
-
permissions: rest[3]
|
|
4014
|
+
permissions: rest[3],
|
|
4015
|
+
transactionId: rest[4]
|
|
3686
4016
|
};
|
|
3687
4017
|
}
|
|
3688
4018
|
const databaseId = params.databaseId;
|
|
@@ -3690,6 +4020,7 @@ class TablesDB extends Service {
|
|
|
3690
4020
|
const rowId = params.rowId;
|
|
3691
4021
|
const data = params.data;
|
|
3692
4022
|
const permissions = params.permissions;
|
|
4023
|
+
const transactionId = params.transactionId;
|
|
3693
4024
|
if (typeof databaseId === 'undefined') {
|
|
3694
4025
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3695
4026
|
}
|
|
@@ -3707,6 +4038,9 @@ class TablesDB extends Service {
|
|
|
3707
4038
|
if (typeof permissions !== 'undefined') {
|
|
3708
4039
|
payload['permissions'] = permissions;
|
|
3709
4040
|
}
|
|
4041
|
+
if (typeof transactionId !== 'undefined') {
|
|
4042
|
+
payload['transactionId'] = transactionId;
|
|
4043
|
+
}
|
|
3710
4044
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3711
4045
|
return this.client.call('put', uri, {
|
|
3712
4046
|
'content-type': 'application/json',
|
|
@@ -3723,7 +4057,8 @@ class TablesDB extends Service {
|
|
|
3723
4057
|
tableId: rest[0],
|
|
3724
4058
|
rowId: rest[1],
|
|
3725
4059
|
data: rest[2],
|
|
3726
|
-
permissions: rest[3]
|
|
4060
|
+
permissions: rest[3],
|
|
4061
|
+
transactionId: rest[4]
|
|
3727
4062
|
};
|
|
3728
4063
|
}
|
|
3729
4064
|
const databaseId = params.databaseId;
|
|
@@ -3731,6 +4066,7 @@ class TablesDB extends Service {
|
|
|
3731
4066
|
const rowId = params.rowId;
|
|
3732
4067
|
const data = params.data;
|
|
3733
4068
|
const permissions = params.permissions;
|
|
4069
|
+
const transactionId = params.transactionId;
|
|
3734
4070
|
if (typeof databaseId === 'undefined') {
|
|
3735
4071
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3736
4072
|
}
|
|
@@ -3748,6 +4084,9 @@ class TablesDB extends Service {
|
|
|
3748
4084
|
if (typeof permissions !== 'undefined') {
|
|
3749
4085
|
payload['permissions'] = permissions;
|
|
3750
4086
|
}
|
|
4087
|
+
if (typeof transactionId !== 'undefined') {
|
|
4088
|
+
payload['transactionId'] = transactionId;
|
|
4089
|
+
}
|
|
3751
4090
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3752
4091
|
return this.client.call('patch', uri, {
|
|
3753
4092
|
'content-type': 'application/json',
|
|
@@ -3762,12 +4101,14 @@ class TablesDB extends Service {
|
|
|
3762
4101
|
params = {
|
|
3763
4102
|
databaseId: paramsOrFirst,
|
|
3764
4103
|
tableId: rest[0],
|
|
3765
|
-
rowId: rest[1]
|
|
4104
|
+
rowId: rest[1],
|
|
4105
|
+
transactionId: rest[2]
|
|
3766
4106
|
};
|
|
3767
4107
|
}
|
|
3768
4108
|
const databaseId = params.databaseId;
|
|
3769
4109
|
const tableId = params.tableId;
|
|
3770
4110
|
const rowId = params.rowId;
|
|
4111
|
+
const transactionId = params.transactionId;
|
|
3771
4112
|
if (typeof databaseId === 'undefined') {
|
|
3772
4113
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3773
4114
|
}
|
|
@@ -3779,6 +4120,9 @@ class TablesDB extends Service {
|
|
|
3779
4120
|
}
|
|
3780
4121
|
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3781
4122
|
const payload = {};
|
|
4123
|
+
if (typeof transactionId !== 'undefined') {
|
|
4124
|
+
payload['transactionId'] = transactionId;
|
|
4125
|
+
}
|
|
3782
4126
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3783
4127
|
return this.client.call('delete', uri, {
|
|
3784
4128
|
'content-type': 'application/json',
|
|
@@ -3796,7 +4140,8 @@ class TablesDB extends Service {
|
|
|
3796
4140
|
rowId: rest[1],
|
|
3797
4141
|
column: rest[2],
|
|
3798
4142
|
value: rest[3],
|
|
3799
|
-
min: rest[4]
|
|
4143
|
+
min: rest[4],
|
|
4144
|
+
transactionId: rest[5]
|
|
3800
4145
|
};
|
|
3801
4146
|
}
|
|
3802
4147
|
const databaseId = params.databaseId;
|
|
@@ -3805,6 +4150,7 @@ class TablesDB extends Service {
|
|
|
3805
4150
|
const column = params.column;
|
|
3806
4151
|
const value = params.value;
|
|
3807
4152
|
const min = params.min;
|
|
4153
|
+
const transactionId = params.transactionId;
|
|
3808
4154
|
if (typeof databaseId === 'undefined') {
|
|
3809
4155
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3810
4156
|
}
|
|
@@ -3825,6 +4171,9 @@ class TablesDB extends Service {
|
|
|
3825
4171
|
if (typeof min !== 'undefined') {
|
|
3826
4172
|
payload['min'] = min;
|
|
3827
4173
|
}
|
|
4174
|
+
if (typeof transactionId !== 'undefined') {
|
|
4175
|
+
payload['transactionId'] = transactionId;
|
|
4176
|
+
}
|
|
3828
4177
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3829
4178
|
return this.client.call('patch', uri, {
|
|
3830
4179
|
'content-type': 'application/json',
|
|
@@ -3842,7 +4191,8 @@ class TablesDB extends Service {
|
|
|
3842
4191
|
rowId: rest[1],
|
|
3843
4192
|
column: rest[2],
|
|
3844
4193
|
value: rest[3],
|
|
3845
|
-
max: rest[4]
|
|
4194
|
+
max: rest[4],
|
|
4195
|
+
transactionId: rest[5]
|
|
3846
4196
|
};
|
|
3847
4197
|
}
|
|
3848
4198
|
const databaseId = params.databaseId;
|
|
@@ -3851,6 +4201,7 @@ class TablesDB extends Service {
|
|
|
3851
4201
|
const column = params.column;
|
|
3852
4202
|
const value = params.value;
|
|
3853
4203
|
const max = params.max;
|
|
4204
|
+
const transactionId = params.transactionId;
|
|
3854
4205
|
if (typeof databaseId === 'undefined') {
|
|
3855
4206
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3856
4207
|
}
|
|
@@ -3871,6 +4222,9 @@ class TablesDB extends Service {
|
|
|
3871
4222
|
if (typeof max !== 'undefined') {
|
|
3872
4223
|
payload['max'] = max;
|
|
3873
4224
|
}
|
|
4225
|
+
if (typeof transactionId !== 'undefined') {
|
|
4226
|
+
payload['transactionId'] = transactionId;
|
|
4227
|
+
}
|
|
3874
4228
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3875
4229
|
return this.client.call('patch', uri, {
|
|
3876
4230
|
'content-type': 'application/json',
|