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/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.
|
|
81
|
+
'x-sdk-version': '0.17.1',
|
|
82
82
|
'X-Appwrite-Response-Format': '1.8.0',
|
|
83
83
|
};
|
|
84
84
|
this.realtime = {
|
|
@@ -2396,6 +2396,143 @@ class Databases extends Service {
|
|
|
2396
2396
|
constructor(client) {
|
|
2397
2397
|
super(client);
|
|
2398
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
|
+
}
|
|
2399
2536
|
listDocuments(paramsOrFirst, ...rest) {
|
|
2400
2537
|
let params;
|
|
2401
2538
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -2405,12 +2542,14 @@ class Databases extends Service {
|
|
|
2405
2542
|
params = {
|
|
2406
2543
|
databaseId: paramsOrFirst,
|
|
2407
2544
|
collectionId: rest[0],
|
|
2408
|
-
queries: rest[1]
|
|
2545
|
+
queries: rest[1],
|
|
2546
|
+
transactionId: rest[2]
|
|
2409
2547
|
};
|
|
2410
2548
|
}
|
|
2411
2549
|
const databaseId = params.databaseId;
|
|
2412
2550
|
const collectionId = params.collectionId;
|
|
2413
2551
|
const queries = params.queries;
|
|
2552
|
+
const transactionId = params.transactionId;
|
|
2414
2553
|
if (typeof databaseId === 'undefined') {
|
|
2415
2554
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2416
2555
|
}
|
|
@@ -2422,6 +2561,9 @@ class Databases extends Service {
|
|
|
2422
2561
|
if (typeof queries !== 'undefined') {
|
|
2423
2562
|
payload['queries'] = queries;
|
|
2424
2563
|
}
|
|
2564
|
+
if (typeof transactionId !== 'undefined') {
|
|
2565
|
+
payload['transactionId'] = transactionId;
|
|
2566
|
+
}
|
|
2425
2567
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2426
2568
|
return this.client.call('get', uri, {}, payload);
|
|
2427
2569
|
}
|
|
@@ -2436,7 +2578,8 @@ class Databases extends Service {
|
|
|
2436
2578
|
collectionId: rest[0],
|
|
2437
2579
|
documentId: rest[1],
|
|
2438
2580
|
data: rest[2],
|
|
2439
|
-
permissions: rest[3]
|
|
2581
|
+
permissions: rest[3],
|
|
2582
|
+
transactionId: rest[4]
|
|
2440
2583
|
};
|
|
2441
2584
|
}
|
|
2442
2585
|
const databaseId = params.databaseId;
|
|
@@ -2444,6 +2587,7 @@ class Databases extends Service {
|
|
|
2444
2587
|
const documentId = params.documentId;
|
|
2445
2588
|
const data = params.data;
|
|
2446
2589
|
const permissions = params.permissions;
|
|
2590
|
+
const transactionId = params.transactionId;
|
|
2447
2591
|
if (typeof databaseId === 'undefined') {
|
|
2448
2592
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2449
2593
|
}
|
|
@@ -2467,6 +2611,9 @@ class Databases extends Service {
|
|
|
2467
2611
|
if (typeof permissions !== 'undefined') {
|
|
2468
2612
|
payload['permissions'] = permissions;
|
|
2469
2613
|
}
|
|
2614
|
+
if (typeof transactionId !== 'undefined') {
|
|
2615
|
+
payload['transactionId'] = transactionId;
|
|
2616
|
+
}
|
|
2470
2617
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2471
2618
|
return this.client.call('post', uri, {
|
|
2472
2619
|
'content-type': 'application/json',
|
|
@@ -2482,13 +2629,15 @@ class Databases extends Service {
|
|
|
2482
2629
|
databaseId: paramsOrFirst,
|
|
2483
2630
|
collectionId: rest[0],
|
|
2484
2631
|
documentId: rest[1],
|
|
2485
|
-
queries: rest[2]
|
|
2632
|
+
queries: rest[2],
|
|
2633
|
+
transactionId: rest[3]
|
|
2486
2634
|
};
|
|
2487
2635
|
}
|
|
2488
2636
|
const databaseId = params.databaseId;
|
|
2489
2637
|
const collectionId = params.collectionId;
|
|
2490
2638
|
const documentId = params.documentId;
|
|
2491
2639
|
const queries = params.queries;
|
|
2640
|
+
const transactionId = params.transactionId;
|
|
2492
2641
|
if (typeof databaseId === 'undefined') {
|
|
2493
2642
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2494
2643
|
}
|
|
@@ -2503,6 +2652,9 @@ class Databases extends Service {
|
|
|
2503
2652
|
if (typeof queries !== 'undefined') {
|
|
2504
2653
|
payload['queries'] = queries;
|
|
2505
2654
|
}
|
|
2655
|
+
if (typeof transactionId !== 'undefined') {
|
|
2656
|
+
payload['transactionId'] = transactionId;
|
|
2657
|
+
}
|
|
2506
2658
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2507
2659
|
return this.client.call('get', uri, {}, payload);
|
|
2508
2660
|
}
|
|
@@ -2517,7 +2669,8 @@ class Databases extends Service {
|
|
|
2517
2669
|
collectionId: rest[0],
|
|
2518
2670
|
documentId: rest[1],
|
|
2519
2671
|
data: rest[2],
|
|
2520
|
-
permissions: rest[3]
|
|
2672
|
+
permissions: rest[3],
|
|
2673
|
+
transactionId: rest[4]
|
|
2521
2674
|
};
|
|
2522
2675
|
}
|
|
2523
2676
|
const databaseId = params.databaseId;
|
|
@@ -2525,6 +2678,7 @@ class Databases extends Service {
|
|
|
2525
2678
|
const documentId = params.documentId;
|
|
2526
2679
|
const data = params.data;
|
|
2527
2680
|
const permissions = params.permissions;
|
|
2681
|
+
const transactionId = params.transactionId;
|
|
2528
2682
|
if (typeof databaseId === 'undefined') {
|
|
2529
2683
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2530
2684
|
}
|
|
@@ -2545,6 +2699,9 @@ class Databases extends Service {
|
|
|
2545
2699
|
if (typeof permissions !== 'undefined') {
|
|
2546
2700
|
payload['permissions'] = permissions;
|
|
2547
2701
|
}
|
|
2702
|
+
if (typeof transactionId !== 'undefined') {
|
|
2703
|
+
payload['transactionId'] = transactionId;
|
|
2704
|
+
}
|
|
2548
2705
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2549
2706
|
return this.client.call('put', uri, {
|
|
2550
2707
|
'content-type': 'application/json',
|
|
@@ -2561,7 +2718,8 @@ class Databases extends Service {
|
|
|
2561
2718
|
collectionId: rest[0],
|
|
2562
2719
|
documentId: rest[1],
|
|
2563
2720
|
data: rest[2],
|
|
2564
|
-
permissions: rest[3]
|
|
2721
|
+
permissions: rest[3],
|
|
2722
|
+
transactionId: rest[4]
|
|
2565
2723
|
};
|
|
2566
2724
|
}
|
|
2567
2725
|
const databaseId = params.databaseId;
|
|
@@ -2569,6 +2727,7 @@ class Databases extends Service {
|
|
|
2569
2727
|
const documentId = params.documentId;
|
|
2570
2728
|
const data = params.data;
|
|
2571
2729
|
const permissions = params.permissions;
|
|
2730
|
+
const transactionId = params.transactionId;
|
|
2572
2731
|
if (typeof databaseId === 'undefined') {
|
|
2573
2732
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2574
2733
|
}
|
|
@@ -2586,6 +2745,9 @@ class Databases extends Service {
|
|
|
2586
2745
|
if (typeof permissions !== 'undefined') {
|
|
2587
2746
|
payload['permissions'] = permissions;
|
|
2588
2747
|
}
|
|
2748
|
+
if (typeof transactionId !== 'undefined') {
|
|
2749
|
+
payload['transactionId'] = transactionId;
|
|
2750
|
+
}
|
|
2589
2751
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2590
2752
|
return this.client.call('patch', uri, {
|
|
2591
2753
|
'content-type': 'application/json',
|
|
@@ -2600,12 +2762,14 @@ class Databases extends Service {
|
|
|
2600
2762
|
params = {
|
|
2601
2763
|
databaseId: paramsOrFirst,
|
|
2602
2764
|
collectionId: rest[0],
|
|
2603
|
-
documentId: rest[1]
|
|
2765
|
+
documentId: rest[1],
|
|
2766
|
+
transactionId: rest[2]
|
|
2604
2767
|
};
|
|
2605
2768
|
}
|
|
2606
2769
|
const databaseId = params.databaseId;
|
|
2607
2770
|
const collectionId = params.collectionId;
|
|
2608
2771
|
const documentId = params.documentId;
|
|
2772
|
+
const transactionId = params.transactionId;
|
|
2609
2773
|
if (typeof databaseId === 'undefined') {
|
|
2610
2774
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2611
2775
|
}
|
|
@@ -2617,6 +2781,9 @@ class Databases extends Service {
|
|
|
2617
2781
|
}
|
|
2618
2782
|
const apiPath = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'.replace('{databaseId}', databaseId).replace('{collectionId}', collectionId).replace('{documentId}', documentId);
|
|
2619
2783
|
const payload = {};
|
|
2784
|
+
if (typeof transactionId !== 'undefined') {
|
|
2785
|
+
payload['transactionId'] = transactionId;
|
|
2786
|
+
}
|
|
2620
2787
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2621
2788
|
return this.client.call('delete', uri, {
|
|
2622
2789
|
'content-type': 'application/json',
|
|
@@ -2634,7 +2801,8 @@ class Databases extends Service {
|
|
|
2634
2801
|
documentId: rest[1],
|
|
2635
2802
|
attribute: rest[2],
|
|
2636
2803
|
value: rest[3],
|
|
2637
|
-
min: rest[4]
|
|
2804
|
+
min: rest[4],
|
|
2805
|
+
transactionId: rest[5]
|
|
2638
2806
|
};
|
|
2639
2807
|
}
|
|
2640
2808
|
const databaseId = params.databaseId;
|
|
@@ -2643,6 +2811,7 @@ class Databases extends Service {
|
|
|
2643
2811
|
const attribute = params.attribute;
|
|
2644
2812
|
const value = params.value;
|
|
2645
2813
|
const min = params.min;
|
|
2814
|
+
const transactionId = params.transactionId;
|
|
2646
2815
|
if (typeof databaseId === 'undefined') {
|
|
2647
2816
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2648
2817
|
}
|
|
@@ -2663,6 +2832,9 @@ class Databases extends Service {
|
|
|
2663
2832
|
if (typeof min !== 'undefined') {
|
|
2664
2833
|
payload['min'] = min;
|
|
2665
2834
|
}
|
|
2835
|
+
if (typeof transactionId !== 'undefined') {
|
|
2836
|
+
payload['transactionId'] = transactionId;
|
|
2837
|
+
}
|
|
2666
2838
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2667
2839
|
return this.client.call('patch', uri, {
|
|
2668
2840
|
'content-type': 'application/json',
|
|
@@ -2680,7 +2852,8 @@ class Databases extends Service {
|
|
|
2680
2852
|
documentId: rest[1],
|
|
2681
2853
|
attribute: rest[2],
|
|
2682
2854
|
value: rest[3],
|
|
2683
|
-
max: rest[4]
|
|
2855
|
+
max: rest[4],
|
|
2856
|
+
transactionId: rest[5]
|
|
2684
2857
|
};
|
|
2685
2858
|
}
|
|
2686
2859
|
const databaseId = params.databaseId;
|
|
@@ -2689,6 +2862,7 @@ class Databases extends Service {
|
|
|
2689
2862
|
const attribute = params.attribute;
|
|
2690
2863
|
const value = params.value;
|
|
2691
2864
|
const max = params.max;
|
|
2865
|
+
const transactionId = params.transactionId;
|
|
2692
2866
|
if (typeof databaseId === 'undefined') {
|
|
2693
2867
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
2694
2868
|
}
|
|
@@ -2709,6 +2883,9 @@ class Databases extends Service {
|
|
|
2709
2883
|
if (typeof max !== 'undefined') {
|
|
2710
2884
|
payload['max'] = max;
|
|
2711
2885
|
}
|
|
2886
|
+
if (typeof transactionId !== 'undefined') {
|
|
2887
|
+
payload['transactionId'] = transactionId;
|
|
2888
|
+
}
|
|
2712
2889
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
2713
2890
|
return this.client.call('patch', uri, {
|
|
2714
2891
|
'content-type': 'application/json',
|
|
@@ -3539,6 +3716,143 @@ class TablesDB extends Service {
|
|
|
3539
3716
|
constructor(client) {
|
|
3540
3717
|
super(client);
|
|
3541
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
|
+
}
|
|
3542
3856
|
listRows(paramsOrFirst, ...rest) {
|
|
3543
3857
|
let params;
|
|
3544
3858
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
@@ -3548,12 +3862,14 @@ class TablesDB extends Service {
|
|
|
3548
3862
|
params = {
|
|
3549
3863
|
databaseId: paramsOrFirst,
|
|
3550
3864
|
tableId: rest[0],
|
|
3551
|
-
queries: rest[1]
|
|
3865
|
+
queries: rest[1],
|
|
3866
|
+
transactionId: rest[2]
|
|
3552
3867
|
};
|
|
3553
3868
|
}
|
|
3554
3869
|
const databaseId = params.databaseId;
|
|
3555
3870
|
const tableId = params.tableId;
|
|
3556
3871
|
const queries = params.queries;
|
|
3872
|
+
const transactionId = params.transactionId;
|
|
3557
3873
|
if (typeof databaseId === 'undefined') {
|
|
3558
3874
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3559
3875
|
}
|
|
@@ -3565,6 +3881,9 @@ class TablesDB extends Service {
|
|
|
3565
3881
|
if (typeof queries !== 'undefined') {
|
|
3566
3882
|
payload['queries'] = queries;
|
|
3567
3883
|
}
|
|
3884
|
+
if (typeof transactionId !== 'undefined') {
|
|
3885
|
+
payload['transactionId'] = transactionId;
|
|
3886
|
+
}
|
|
3568
3887
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3569
3888
|
return this.client.call('get', uri, {}, payload);
|
|
3570
3889
|
}
|
|
@@ -3579,7 +3898,8 @@ class TablesDB extends Service {
|
|
|
3579
3898
|
tableId: rest[0],
|
|
3580
3899
|
rowId: rest[1],
|
|
3581
3900
|
data: rest[2],
|
|
3582
|
-
permissions: rest[3]
|
|
3901
|
+
permissions: rest[3],
|
|
3902
|
+
transactionId: rest[4]
|
|
3583
3903
|
};
|
|
3584
3904
|
}
|
|
3585
3905
|
const databaseId = params.databaseId;
|
|
@@ -3587,6 +3907,7 @@ class TablesDB extends Service {
|
|
|
3587
3907
|
const rowId = params.rowId;
|
|
3588
3908
|
const data = params.data;
|
|
3589
3909
|
const permissions = params.permissions;
|
|
3910
|
+
const transactionId = params.transactionId;
|
|
3590
3911
|
if (typeof databaseId === 'undefined') {
|
|
3591
3912
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3592
3913
|
}
|
|
@@ -3610,6 +3931,9 @@ class TablesDB extends Service {
|
|
|
3610
3931
|
if (typeof permissions !== 'undefined') {
|
|
3611
3932
|
payload['permissions'] = permissions;
|
|
3612
3933
|
}
|
|
3934
|
+
if (typeof transactionId !== 'undefined') {
|
|
3935
|
+
payload['transactionId'] = transactionId;
|
|
3936
|
+
}
|
|
3613
3937
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3614
3938
|
return this.client.call('post', uri, {
|
|
3615
3939
|
'content-type': 'application/json',
|
|
@@ -3625,13 +3949,15 @@ class TablesDB extends Service {
|
|
|
3625
3949
|
databaseId: paramsOrFirst,
|
|
3626
3950
|
tableId: rest[0],
|
|
3627
3951
|
rowId: rest[1],
|
|
3628
|
-
queries: rest[2]
|
|
3952
|
+
queries: rest[2],
|
|
3953
|
+
transactionId: rest[3]
|
|
3629
3954
|
};
|
|
3630
3955
|
}
|
|
3631
3956
|
const databaseId = params.databaseId;
|
|
3632
3957
|
const tableId = params.tableId;
|
|
3633
3958
|
const rowId = params.rowId;
|
|
3634
3959
|
const queries = params.queries;
|
|
3960
|
+
const transactionId = params.transactionId;
|
|
3635
3961
|
if (typeof databaseId === 'undefined') {
|
|
3636
3962
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3637
3963
|
}
|
|
@@ -3646,6 +3972,9 @@ class TablesDB extends Service {
|
|
|
3646
3972
|
if (typeof queries !== 'undefined') {
|
|
3647
3973
|
payload['queries'] = queries;
|
|
3648
3974
|
}
|
|
3975
|
+
if (typeof transactionId !== 'undefined') {
|
|
3976
|
+
payload['transactionId'] = transactionId;
|
|
3977
|
+
}
|
|
3649
3978
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3650
3979
|
return this.client.call('get', uri, {}, payload);
|
|
3651
3980
|
}
|
|
@@ -3660,7 +3989,8 @@ class TablesDB extends Service {
|
|
|
3660
3989
|
tableId: rest[0],
|
|
3661
3990
|
rowId: rest[1],
|
|
3662
3991
|
data: rest[2],
|
|
3663
|
-
permissions: rest[3]
|
|
3992
|
+
permissions: rest[3],
|
|
3993
|
+
transactionId: rest[4]
|
|
3664
3994
|
};
|
|
3665
3995
|
}
|
|
3666
3996
|
const databaseId = params.databaseId;
|
|
@@ -3668,6 +3998,7 @@ class TablesDB extends Service {
|
|
|
3668
3998
|
const rowId = params.rowId;
|
|
3669
3999
|
const data = params.data;
|
|
3670
4000
|
const permissions = params.permissions;
|
|
4001
|
+
const transactionId = params.transactionId;
|
|
3671
4002
|
if (typeof databaseId === 'undefined') {
|
|
3672
4003
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3673
4004
|
}
|
|
@@ -3685,6 +4016,9 @@ class TablesDB extends Service {
|
|
|
3685
4016
|
if (typeof permissions !== 'undefined') {
|
|
3686
4017
|
payload['permissions'] = permissions;
|
|
3687
4018
|
}
|
|
4019
|
+
if (typeof transactionId !== 'undefined') {
|
|
4020
|
+
payload['transactionId'] = transactionId;
|
|
4021
|
+
}
|
|
3688
4022
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3689
4023
|
return this.client.call('put', uri, {
|
|
3690
4024
|
'content-type': 'application/json',
|
|
@@ -3701,7 +4035,8 @@ class TablesDB extends Service {
|
|
|
3701
4035
|
tableId: rest[0],
|
|
3702
4036
|
rowId: rest[1],
|
|
3703
4037
|
data: rest[2],
|
|
3704
|
-
permissions: rest[3]
|
|
4038
|
+
permissions: rest[3],
|
|
4039
|
+
transactionId: rest[4]
|
|
3705
4040
|
};
|
|
3706
4041
|
}
|
|
3707
4042
|
const databaseId = params.databaseId;
|
|
@@ -3709,6 +4044,7 @@ class TablesDB extends Service {
|
|
|
3709
4044
|
const rowId = params.rowId;
|
|
3710
4045
|
const data = params.data;
|
|
3711
4046
|
const permissions = params.permissions;
|
|
4047
|
+
const transactionId = params.transactionId;
|
|
3712
4048
|
if (typeof databaseId === 'undefined') {
|
|
3713
4049
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3714
4050
|
}
|
|
@@ -3726,6 +4062,9 @@ class TablesDB extends Service {
|
|
|
3726
4062
|
if (typeof permissions !== 'undefined') {
|
|
3727
4063
|
payload['permissions'] = permissions;
|
|
3728
4064
|
}
|
|
4065
|
+
if (typeof transactionId !== 'undefined') {
|
|
4066
|
+
payload['transactionId'] = transactionId;
|
|
4067
|
+
}
|
|
3729
4068
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3730
4069
|
return this.client.call('patch', uri, {
|
|
3731
4070
|
'content-type': 'application/json',
|
|
@@ -3740,12 +4079,14 @@ class TablesDB extends Service {
|
|
|
3740
4079
|
params = {
|
|
3741
4080
|
databaseId: paramsOrFirst,
|
|
3742
4081
|
tableId: rest[0],
|
|
3743
|
-
rowId: rest[1]
|
|
4082
|
+
rowId: rest[1],
|
|
4083
|
+
transactionId: rest[2]
|
|
3744
4084
|
};
|
|
3745
4085
|
}
|
|
3746
4086
|
const databaseId = params.databaseId;
|
|
3747
4087
|
const tableId = params.tableId;
|
|
3748
4088
|
const rowId = params.rowId;
|
|
4089
|
+
const transactionId = params.transactionId;
|
|
3749
4090
|
if (typeof databaseId === 'undefined') {
|
|
3750
4091
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3751
4092
|
}
|
|
@@ -3757,6 +4098,9 @@ class TablesDB extends Service {
|
|
|
3757
4098
|
}
|
|
3758
4099
|
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
3759
4100
|
const payload = {};
|
|
4101
|
+
if (typeof transactionId !== 'undefined') {
|
|
4102
|
+
payload['transactionId'] = transactionId;
|
|
4103
|
+
}
|
|
3760
4104
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3761
4105
|
return this.client.call('delete', uri, {
|
|
3762
4106
|
'content-type': 'application/json',
|
|
@@ -3774,7 +4118,8 @@ class TablesDB extends Service {
|
|
|
3774
4118
|
rowId: rest[1],
|
|
3775
4119
|
column: rest[2],
|
|
3776
4120
|
value: rest[3],
|
|
3777
|
-
min: rest[4]
|
|
4121
|
+
min: rest[4],
|
|
4122
|
+
transactionId: rest[5]
|
|
3778
4123
|
};
|
|
3779
4124
|
}
|
|
3780
4125
|
const databaseId = params.databaseId;
|
|
@@ -3783,6 +4128,7 @@ class TablesDB extends Service {
|
|
|
3783
4128
|
const column = params.column;
|
|
3784
4129
|
const value = params.value;
|
|
3785
4130
|
const min = params.min;
|
|
4131
|
+
const transactionId = params.transactionId;
|
|
3786
4132
|
if (typeof databaseId === 'undefined') {
|
|
3787
4133
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3788
4134
|
}
|
|
@@ -3803,6 +4149,9 @@ class TablesDB extends Service {
|
|
|
3803
4149
|
if (typeof min !== 'undefined') {
|
|
3804
4150
|
payload['min'] = min;
|
|
3805
4151
|
}
|
|
4152
|
+
if (typeof transactionId !== 'undefined') {
|
|
4153
|
+
payload['transactionId'] = transactionId;
|
|
4154
|
+
}
|
|
3806
4155
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3807
4156
|
return this.client.call('patch', uri, {
|
|
3808
4157
|
'content-type': 'application/json',
|
|
@@ -3820,7 +4169,8 @@ class TablesDB extends Service {
|
|
|
3820
4169
|
rowId: rest[1],
|
|
3821
4170
|
column: rest[2],
|
|
3822
4171
|
value: rest[3],
|
|
3823
|
-
max: rest[4]
|
|
4172
|
+
max: rest[4],
|
|
4173
|
+
transactionId: rest[5]
|
|
3824
4174
|
};
|
|
3825
4175
|
}
|
|
3826
4176
|
const databaseId = params.databaseId;
|
|
@@ -3829,6 +4179,7 @@ class TablesDB extends Service {
|
|
|
3829
4179
|
const column = params.column;
|
|
3830
4180
|
const value = params.value;
|
|
3831
4181
|
const max = params.max;
|
|
4182
|
+
const transactionId = params.transactionId;
|
|
3832
4183
|
if (typeof databaseId === 'undefined') {
|
|
3833
4184
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
3834
4185
|
}
|
|
@@ -3849,6 +4200,9 @@ class TablesDB extends Service {
|
|
|
3849
4200
|
if (typeof max !== 'undefined') {
|
|
3850
4201
|
payload['max'] = max;
|
|
3851
4202
|
}
|
|
4203
|
+
if (typeof transactionId !== 'undefined') {
|
|
4204
|
+
payload['transactionId'] = transactionId;
|
|
4205
|
+
}
|
|
3852
4206
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
3853
4207
|
return this.client.call('patch', uri, {
|
|
3854
4208
|
'content-type': 'application/json',
|