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