node-appwrite 20.1.0 → 20.2.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.
@@ -76,6 +76,173 @@ var TablesDB = class {
76
76
  payload
77
77
  );
78
78
  }
79
+ listTransactions(paramsOrFirst) {
80
+ let params;
81
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
82
+ params = paramsOrFirst || {};
83
+ } else {
84
+ params = {
85
+ queries: paramsOrFirst
86
+ };
87
+ }
88
+ const queries = params.queries;
89
+ const apiPath = "/tablesdb/transactions";
90
+ const payload = {};
91
+ if (typeof queries !== "undefined") {
92
+ payload["queries"] = queries;
93
+ }
94
+ const uri = new URL(this.client.config.endpoint + apiPath);
95
+ const apiHeaders = {};
96
+ return this.client.call(
97
+ "get",
98
+ uri,
99
+ apiHeaders,
100
+ payload
101
+ );
102
+ }
103
+ createTransaction(paramsOrFirst) {
104
+ let params;
105
+ if (!paramsOrFirst || paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
106
+ params = paramsOrFirst || {};
107
+ } else {
108
+ params = {
109
+ ttl: paramsOrFirst
110
+ };
111
+ }
112
+ const ttl = params.ttl;
113
+ const apiPath = "/tablesdb/transactions";
114
+ const payload = {};
115
+ if (typeof ttl !== "undefined") {
116
+ payload["ttl"] = ttl;
117
+ }
118
+ const uri = new URL(this.client.config.endpoint + apiPath);
119
+ const apiHeaders = {
120
+ "content-type": "application/json"
121
+ };
122
+ return this.client.call(
123
+ "post",
124
+ uri,
125
+ apiHeaders,
126
+ payload
127
+ );
128
+ }
129
+ getTransaction(paramsOrFirst) {
130
+ let params;
131
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
132
+ params = paramsOrFirst || {};
133
+ } else {
134
+ params = {
135
+ transactionId: paramsOrFirst
136
+ };
137
+ }
138
+ const transactionId = params.transactionId;
139
+ if (typeof transactionId === "undefined") {
140
+ throw new AppwriteException('Missing required parameter: "transactionId"');
141
+ }
142
+ const apiPath = "/tablesdb/transactions/{transactionId}".replace("{transactionId}", transactionId);
143
+ const payload = {};
144
+ const uri = new URL(this.client.config.endpoint + apiPath);
145
+ const apiHeaders = {};
146
+ return this.client.call(
147
+ "get",
148
+ uri,
149
+ apiHeaders,
150
+ payload
151
+ );
152
+ }
153
+ updateTransaction(paramsOrFirst, ...rest) {
154
+ let params;
155
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
156
+ params = paramsOrFirst || {};
157
+ } else {
158
+ params = {
159
+ transactionId: paramsOrFirst,
160
+ commit: rest[0],
161
+ rollback: rest[1]
162
+ };
163
+ }
164
+ const transactionId = params.transactionId;
165
+ const commit = params.commit;
166
+ const rollback = params.rollback;
167
+ if (typeof transactionId === "undefined") {
168
+ throw new AppwriteException('Missing required parameter: "transactionId"');
169
+ }
170
+ const apiPath = "/tablesdb/transactions/{transactionId}".replace("{transactionId}", transactionId);
171
+ const payload = {};
172
+ if (typeof commit !== "undefined") {
173
+ payload["commit"] = commit;
174
+ }
175
+ if (typeof rollback !== "undefined") {
176
+ payload["rollback"] = rollback;
177
+ }
178
+ const uri = new URL(this.client.config.endpoint + apiPath);
179
+ const apiHeaders = {
180
+ "content-type": "application/json"
181
+ };
182
+ return this.client.call(
183
+ "patch",
184
+ uri,
185
+ apiHeaders,
186
+ payload
187
+ );
188
+ }
189
+ deleteTransaction(paramsOrFirst) {
190
+ let params;
191
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
192
+ params = paramsOrFirst || {};
193
+ } else {
194
+ params = {
195
+ transactionId: paramsOrFirst
196
+ };
197
+ }
198
+ const transactionId = params.transactionId;
199
+ if (typeof transactionId === "undefined") {
200
+ throw new AppwriteException('Missing required parameter: "transactionId"');
201
+ }
202
+ const apiPath = "/tablesdb/transactions/{transactionId}".replace("{transactionId}", transactionId);
203
+ const payload = {};
204
+ const uri = new URL(this.client.config.endpoint + apiPath);
205
+ const apiHeaders = {
206
+ "content-type": "application/json"
207
+ };
208
+ return this.client.call(
209
+ "delete",
210
+ uri,
211
+ apiHeaders,
212
+ payload
213
+ );
214
+ }
215
+ createOperations(paramsOrFirst, ...rest) {
216
+ let params;
217
+ if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
218
+ params = paramsOrFirst || {};
219
+ } else {
220
+ params = {
221
+ transactionId: paramsOrFirst,
222
+ operations: rest[0]
223
+ };
224
+ }
225
+ const transactionId = params.transactionId;
226
+ const operations = params.operations;
227
+ if (typeof transactionId === "undefined") {
228
+ throw new AppwriteException('Missing required parameter: "transactionId"');
229
+ }
230
+ const apiPath = "/tablesdb/transactions/{transactionId}/operations".replace("{transactionId}", transactionId);
231
+ const payload = {};
232
+ if (typeof operations !== "undefined") {
233
+ payload["operations"] = operations;
234
+ }
235
+ const uri = new URL(this.client.config.endpoint + apiPath);
236
+ const apiHeaders = {
237
+ "content-type": "application/json"
238
+ };
239
+ return this.client.call(
240
+ "post",
241
+ uri,
242
+ apiHeaders,
243
+ payload
244
+ );
245
+ }
79
246
  get(paramsOrFirst) {
80
247
  let params;
81
248
  if (paramsOrFirst && typeof paramsOrFirst === "object" && !Array.isArray(paramsOrFirst)) {
@@ -2182,12 +2349,14 @@ var TablesDB = class {
2182
2349
  params = {
2183
2350
  databaseId: paramsOrFirst,
2184
2351
  tableId: rest[0],
2185
- queries: rest[1]
2352
+ queries: rest[1],
2353
+ transactionId: rest[2]
2186
2354
  };
2187
2355
  }
2188
2356
  const databaseId = params.databaseId;
2189
2357
  const tableId = params.tableId;
2190
2358
  const queries = params.queries;
2359
+ const transactionId = params.transactionId;
2191
2360
  if (typeof databaseId === "undefined") {
2192
2361
  throw new AppwriteException('Missing required parameter: "databaseId"');
2193
2362
  }
@@ -2199,6 +2368,9 @@ var TablesDB = class {
2199
2368
  if (typeof queries !== "undefined") {
2200
2369
  payload["queries"] = queries;
2201
2370
  }
2371
+ if (typeof transactionId !== "undefined") {
2372
+ payload["transactionId"] = transactionId;
2373
+ }
2202
2374
  const uri = new URL(this.client.config.endpoint + apiPath);
2203
2375
  const apiHeaders = {};
2204
2376
  return this.client.call(
@@ -2218,7 +2390,8 @@ var TablesDB = class {
2218
2390
  tableId: rest[0],
2219
2391
  rowId: rest[1],
2220
2392
  data: rest[2],
2221
- permissions: rest[3]
2393
+ permissions: rest[3],
2394
+ transactionId: rest[4]
2222
2395
  };
2223
2396
  }
2224
2397
  const databaseId = params.databaseId;
@@ -2226,6 +2399,7 @@ var TablesDB = class {
2226
2399
  const rowId = params.rowId;
2227
2400
  const data = params.data;
2228
2401
  const permissions = params.permissions;
2402
+ const transactionId = params.transactionId;
2229
2403
  if (typeof databaseId === "undefined") {
2230
2404
  throw new AppwriteException('Missing required parameter: "databaseId"');
2231
2405
  }
@@ -2249,6 +2423,9 @@ var TablesDB = class {
2249
2423
  if (typeof permissions !== "undefined") {
2250
2424
  payload["permissions"] = permissions;
2251
2425
  }
2426
+ if (typeof transactionId !== "undefined") {
2427
+ payload["transactionId"] = transactionId;
2428
+ }
2252
2429
  const uri = new URL(this.client.config.endpoint + apiPath);
2253
2430
  const apiHeaders = {
2254
2431
  "content-type": "application/json"
@@ -2268,12 +2445,14 @@ var TablesDB = class {
2268
2445
  params = {
2269
2446
  databaseId: paramsOrFirst,
2270
2447
  tableId: rest[0],
2271
- rows: rest[1]
2448
+ rows: rest[1],
2449
+ transactionId: rest[2]
2272
2450
  };
2273
2451
  }
2274
2452
  const databaseId = params.databaseId;
2275
2453
  const tableId = params.tableId;
2276
2454
  const rows = params.rows;
2455
+ const transactionId = params.transactionId;
2277
2456
  if (typeof databaseId === "undefined") {
2278
2457
  throw new AppwriteException('Missing required parameter: "databaseId"');
2279
2458
  }
@@ -2288,6 +2467,9 @@ var TablesDB = class {
2288
2467
  if (typeof rows !== "undefined") {
2289
2468
  payload["rows"] = rows;
2290
2469
  }
2470
+ if (typeof transactionId !== "undefined") {
2471
+ payload["transactionId"] = transactionId;
2472
+ }
2291
2473
  const uri = new URL(this.client.config.endpoint + apiPath);
2292
2474
  const apiHeaders = {
2293
2475
  "content-type": "application/json"
@@ -2307,12 +2489,14 @@ var TablesDB = class {
2307
2489
  params = {
2308
2490
  databaseId: paramsOrFirst,
2309
2491
  tableId: rest[0],
2310
- rows: rest[1]
2492
+ rows: rest[1],
2493
+ transactionId: rest[2]
2311
2494
  };
2312
2495
  }
2313
2496
  const databaseId = params.databaseId;
2314
2497
  const tableId = params.tableId;
2315
2498
  const rows = params.rows;
2499
+ const transactionId = params.transactionId;
2316
2500
  if (typeof databaseId === "undefined") {
2317
2501
  throw new AppwriteException('Missing required parameter: "databaseId"');
2318
2502
  }
@@ -2327,6 +2511,9 @@ var TablesDB = class {
2327
2511
  if (typeof rows !== "undefined") {
2328
2512
  payload["rows"] = rows;
2329
2513
  }
2514
+ if (typeof transactionId !== "undefined") {
2515
+ payload["transactionId"] = transactionId;
2516
+ }
2330
2517
  const uri = new URL(this.client.config.endpoint + apiPath);
2331
2518
  const apiHeaders = {
2332
2519
  "content-type": "application/json"
@@ -2347,13 +2534,15 @@ var TablesDB = class {
2347
2534
  databaseId: paramsOrFirst,
2348
2535
  tableId: rest[0],
2349
2536
  data: rest[1],
2350
- queries: rest[2]
2537
+ queries: rest[2],
2538
+ transactionId: rest[3]
2351
2539
  };
2352
2540
  }
2353
2541
  const databaseId = params.databaseId;
2354
2542
  const tableId = params.tableId;
2355
2543
  const data = params.data;
2356
2544
  const queries = params.queries;
2545
+ const transactionId = params.transactionId;
2357
2546
  if (typeof databaseId === "undefined") {
2358
2547
  throw new AppwriteException('Missing required parameter: "databaseId"');
2359
2548
  }
@@ -2368,6 +2557,9 @@ var TablesDB = class {
2368
2557
  if (typeof queries !== "undefined") {
2369
2558
  payload["queries"] = queries;
2370
2559
  }
2560
+ if (typeof transactionId !== "undefined") {
2561
+ payload["transactionId"] = transactionId;
2562
+ }
2371
2563
  const uri = new URL(this.client.config.endpoint + apiPath);
2372
2564
  const apiHeaders = {
2373
2565
  "content-type": "application/json"
@@ -2387,12 +2579,14 @@ var TablesDB = class {
2387
2579
  params = {
2388
2580
  databaseId: paramsOrFirst,
2389
2581
  tableId: rest[0],
2390
- queries: rest[1]
2582
+ queries: rest[1],
2583
+ transactionId: rest[2]
2391
2584
  };
2392
2585
  }
2393
2586
  const databaseId = params.databaseId;
2394
2587
  const tableId = params.tableId;
2395
2588
  const queries = params.queries;
2589
+ const transactionId = params.transactionId;
2396
2590
  if (typeof databaseId === "undefined") {
2397
2591
  throw new AppwriteException('Missing required parameter: "databaseId"');
2398
2592
  }
@@ -2404,6 +2598,9 @@ var TablesDB = class {
2404
2598
  if (typeof queries !== "undefined") {
2405
2599
  payload["queries"] = queries;
2406
2600
  }
2601
+ if (typeof transactionId !== "undefined") {
2602
+ payload["transactionId"] = transactionId;
2603
+ }
2407
2604
  const uri = new URL(this.client.config.endpoint + apiPath);
2408
2605
  const apiHeaders = {
2409
2606
  "content-type": "application/json"
@@ -2424,13 +2621,15 @@ var TablesDB = class {
2424
2621
  databaseId: paramsOrFirst,
2425
2622
  tableId: rest[0],
2426
2623
  rowId: rest[1],
2427
- queries: rest[2]
2624
+ queries: rest[2],
2625
+ transactionId: rest[3]
2428
2626
  };
2429
2627
  }
2430
2628
  const databaseId = params.databaseId;
2431
2629
  const tableId = params.tableId;
2432
2630
  const rowId = params.rowId;
2433
2631
  const queries = params.queries;
2632
+ const transactionId = params.transactionId;
2434
2633
  if (typeof databaseId === "undefined") {
2435
2634
  throw new AppwriteException('Missing required parameter: "databaseId"');
2436
2635
  }
@@ -2445,6 +2644,9 @@ var TablesDB = class {
2445
2644
  if (typeof queries !== "undefined") {
2446
2645
  payload["queries"] = queries;
2447
2646
  }
2647
+ if (typeof transactionId !== "undefined") {
2648
+ payload["transactionId"] = transactionId;
2649
+ }
2448
2650
  const uri = new URL(this.client.config.endpoint + apiPath);
2449
2651
  const apiHeaders = {};
2450
2652
  return this.client.call(
@@ -2464,7 +2666,8 @@ var TablesDB = class {
2464
2666
  tableId: rest[0],
2465
2667
  rowId: rest[1],
2466
2668
  data: rest[2],
2467
- permissions: rest[3]
2669
+ permissions: rest[3],
2670
+ transactionId: rest[4]
2468
2671
  };
2469
2672
  }
2470
2673
  const databaseId = params.databaseId;
@@ -2472,6 +2675,7 @@ var TablesDB = class {
2472
2675
  const rowId = params.rowId;
2473
2676
  const data = params.data;
2474
2677
  const permissions = params.permissions;
2678
+ const transactionId = params.transactionId;
2475
2679
  if (typeof databaseId === "undefined") {
2476
2680
  throw new AppwriteException('Missing required parameter: "databaseId"');
2477
2681
  }
@@ -2489,6 +2693,9 @@ var TablesDB = class {
2489
2693
  if (typeof permissions !== "undefined") {
2490
2694
  payload["permissions"] = permissions;
2491
2695
  }
2696
+ if (typeof transactionId !== "undefined") {
2697
+ payload["transactionId"] = transactionId;
2698
+ }
2492
2699
  const uri = new URL(this.client.config.endpoint + apiPath);
2493
2700
  const apiHeaders = {
2494
2701
  "content-type": "application/json"
@@ -2510,7 +2717,8 @@ var TablesDB = class {
2510
2717
  tableId: rest[0],
2511
2718
  rowId: rest[1],
2512
2719
  data: rest[2],
2513
- permissions: rest[3]
2720
+ permissions: rest[3],
2721
+ transactionId: rest[4]
2514
2722
  };
2515
2723
  }
2516
2724
  const databaseId = params.databaseId;
@@ -2518,6 +2726,7 @@ var TablesDB = class {
2518
2726
  const rowId = params.rowId;
2519
2727
  const data = params.data;
2520
2728
  const permissions = params.permissions;
2729
+ const transactionId = params.transactionId;
2521
2730
  if (typeof databaseId === "undefined") {
2522
2731
  throw new AppwriteException('Missing required parameter: "databaseId"');
2523
2732
  }
@@ -2535,6 +2744,9 @@ var TablesDB = class {
2535
2744
  if (typeof permissions !== "undefined") {
2536
2745
  payload["permissions"] = permissions;
2537
2746
  }
2747
+ if (typeof transactionId !== "undefined") {
2748
+ payload["transactionId"] = transactionId;
2749
+ }
2538
2750
  const uri = new URL(this.client.config.endpoint + apiPath);
2539
2751
  const apiHeaders = {
2540
2752
  "content-type": "application/json"
@@ -2554,12 +2766,14 @@ var TablesDB = class {
2554
2766
  params = {
2555
2767
  databaseId: paramsOrFirst,
2556
2768
  tableId: rest[0],
2557
- rowId: rest[1]
2769
+ rowId: rest[1],
2770
+ transactionId: rest[2]
2558
2771
  };
2559
2772
  }
2560
2773
  const databaseId = params.databaseId;
2561
2774
  const tableId = params.tableId;
2562
2775
  const rowId = params.rowId;
2776
+ const transactionId = params.transactionId;
2563
2777
  if (typeof databaseId === "undefined") {
2564
2778
  throw new AppwriteException('Missing required parameter: "databaseId"');
2565
2779
  }
@@ -2571,6 +2785,9 @@ var TablesDB = class {
2571
2785
  }
2572
2786
  const apiPath = "/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}".replace("{databaseId}", databaseId).replace("{tableId}", tableId).replace("{rowId}", rowId);
2573
2787
  const payload = {};
2788
+ if (typeof transactionId !== "undefined") {
2789
+ payload["transactionId"] = transactionId;
2790
+ }
2574
2791
  const uri = new URL(this.client.config.endpoint + apiPath);
2575
2792
  const apiHeaders = {
2576
2793
  "content-type": "application/json"
@@ -2593,7 +2810,8 @@ var TablesDB = class {
2593
2810
  rowId: rest[1],
2594
2811
  column: rest[2],
2595
2812
  value: rest[3],
2596
- min: rest[4]
2813
+ min: rest[4],
2814
+ transactionId: rest[5]
2597
2815
  };
2598
2816
  }
2599
2817
  const databaseId = params.databaseId;
@@ -2602,6 +2820,7 @@ var TablesDB = class {
2602
2820
  const column = params.column;
2603
2821
  const value = params.value;
2604
2822
  const min = params.min;
2823
+ const transactionId = params.transactionId;
2605
2824
  if (typeof databaseId === "undefined") {
2606
2825
  throw new AppwriteException('Missing required parameter: "databaseId"');
2607
2826
  }
@@ -2622,6 +2841,9 @@ var TablesDB = class {
2622
2841
  if (typeof min !== "undefined") {
2623
2842
  payload["min"] = min;
2624
2843
  }
2844
+ if (typeof transactionId !== "undefined") {
2845
+ payload["transactionId"] = transactionId;
2846
+ }
2625
2847
  const uri = new URL(this.client.config.endpoint + apiPath);
2626
2848
  const apiHeaders = {
2627
2849
  "content-type": "application/json"
@@ -2644,7 +2866,8 @@ var TablesDB = class {
2644
2866
  rowId: rest[1],
2645
2867
  column: rest[2],
2646
2868
  value: rest[3],
2647
- max: rest[4]
2869
+ max: rest[4],
2870
+ transactionId: rest[5]
2648
2871
  };
2649
2872
  }
2650
2873
  const databaseId = params.databaseId;
@@ -2653,6 +2876,7 @@ var TablesDB = class {
2653
2876
  const column = params.column;
2654
2877
  const value = params.value;
2655
2878
  const max = params.max;
2879
+ const transactionId = params.transactionId;
2656
2880
  if (typeof databaseId === "undefined") {
2657
2881
  throw new AppwriteException('Missing required parameter: "databaseId"');
2658
2882
  }
@@ -2673,6 +2897,9 @@ var TablesDB = class {
2673
2897
  if (typeof max !== "undefined") {
2674
2898
  payload["max"] = max;
2675
2899
  }
2900
+ if (typeof transactionId !== "undefined") {
2901
+ payload["transactionId"] = transactionId;
2902
+ }
2676
2903
  const uri = new URL(this.client.config.endpoint + apiPath);
2677
2904
  const apiHeaders = {
2678
2905
  "content-type": "application/json"