appwrite 19.1.0 → 19.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64a22a71e17b953f80760db4e8b9413488b2bc36f2e24ea383964f45c305066d
4
- data.tar.gz: e01febf3f51453fa219a17cbc795235f7b7fb67ed2358be4f8091a6bfa4f345a
3
+ metadata.gz: d18450d32531866c43ac61e2ded50d750cf7c6b81323afaecbee969475c50a0c
4
+ data.tar.gz: 95dc160194148918a4ce252491a3770e068bd55679e91c4a4a6e7f4f44e52f58
5
5
  SHA512:
6
- metadata.gz: 6fff66c4c1f8ce87720e13c93581704597cf65ce96e0c171c099541079d8051dcd6bc143f6bf136b931ed4343a65175dec7908b7ef86f6e6a96f55a808dec41b
7
- data.tar.gz: 65af206356d68b6a79255dee4c799ab3f37ce7093bbc31c48b5527a05134c42c63d353615ab594d8b63e0431497baddbc2bb2151ad00b11494cec53be74b6c85
6
+ metadata.gz: 40546a7ae581a476e905a8c772fabc44a2f8d4bc7dee1974a590f89f764920f54f4bf1b63964593cf9bef589a667441ae155f2444c16fa4c5d3a44e6577c2a8b
7
+ data.tar.gz: 7159f4e73f3ac4407209f9a5d44bbe2865d0af8735d3ff060a0ce21bd7feda1f154ba405a6a11598bc8308e9bd9ed6f8d5c5acfd7783c18a4719ecb42fa94fed
@@ -15,7 +15,7 @@ module Appwrite
15
15
  'x-sdk-name'=> 'Ruby',
16
16
  'x-sdk-platform'=> 'server',
17
17
  'x-sdk-language'=> 'ruby',
18
- 'x-sdk-version'=> '19.1.0',
18
+ 'x-sdk-version'=> '19.2.1',
19
19
  'X-Appwrite-Response-Format' => '1.8.0'
20
20
  }
21
21
  @endpoint = 'https://cloud.appwrite.io/v1'
@@ -0,0 +1,52 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class Transaction
6
+ attr_reader :id
7
+ attr_reader :created_at
8
+ attr_reader :updated_at
9
+ attr_reader :status
10
+ attr_reader :operations
11
+ attr_reader :expires_at
12
+
13
+ def initialize(
14
+ id:,
15
+ created_at:,
16
+ updated_at:,
17
+ status:,
18
+ operations:,
19
+ expires_at:
20
+ )
21
+ @id = id
22
+ @created_at = created_at
23
+ @updated_at = updated_at
24
+ @status = status
25
+ @operations = operations
26
+ @expires_at = expires_at
27
+ end
28
+
29
+ def self.from(map:)
30
+ Transaction.new(
31
+ id: map["$id"],
32
+ created_at: map["$createdAt"],
33
+ updated_at: map["$updatedAt"],
34
+ status: map["status"],
35
+ operations: map["operations"],
36
+ expires_at: map["expiresAt"]
37
+ )
38
+ end
39
+
40
+ def to_map
41
+ {
42
+ "$id": @id,
43
+ "$createdAt": @created_at,
44
+ "$updatedAt": @updated_at,
45
+ "status": @status,
46
+ "operations": @operations,
47
+ "expiresAt": @expires_at
48
+ }
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,32 @@
1
+ #frozen_string_literal: true
2
+
3
+ module Appwrite
4
+ module Models
5
+ class TransactionList
6
+ attr_reader :total
7
+ attr_reader :transactions
8
+
9
+ def initialize(
10
+ total:,
11
+ transactions:
12
+ )
13
+ @total = total
14
+ @transactions = transactions
15
+ end
16
+
17
+ def self.from(map:)
18
+ TransactionList.new(
19
+ total: map["total"],
20
+ transactions: map["transactions"].map { |it| Transaction.from(map: it) }
21
+ )
22
+ end
23
+
24
+ def to_map
25
+ {
26
+ "total": @total,
27
+ "transactions": @transactions.map { |it| it.to_map }
28
+ }
29
+ end
30
+ end
31
+ end
32
+ end
@@ -78,6 +78,175 @@ module Appwrite
78
78
  )
79
79
  end
80
80
 
81
+ # List transactions across all databases.
82
+ #
83
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
84
+ #
85
+ # @return [TransactionList]
86
+ def list_transactions(queries: nil)
87
+ api_path = '/databases/transactions'
88
+
89
+ api_params = {
90
+ queries: queries,
91
+ }
92
+
93
+ api_headers = {
94
+ }
95
+
96
+ @client.call(
97
+ method: 'GET',
98
+ path: api_path,
99
+ headers: api_headers,
100
+ params: api_params,
101
+ response_type: Models::TransactionList
102
+ )
103
+ end
104
+
105
+ # Create a new transaction.
106
+ #
107
+ # @param [Integer] ttl Seconds before the transaction expires.
108
+ #
109
+ # @return [Transaction]
110
+ def create_transaction(ttl: nil)
111
+ api_path = '/databases/transactions'
112
+
113
+ api_params = {
114
+ ttl: ttl,
115
+ }
116
+
117
+ api_headers = {
118
+ "content-type": 'application/json',
119
+ }
120
+
121
+ @client.call(
122
+ method: 'POST',
123
+ path: api_path,
124
+ headers: api_headers,
125
+ params: api_params,
126
+ response_type: Models::Transaction
127
+ )
128
+ end
129
+
130
+ # Get a transaction by its unique ID.
131
+ #
132
+ # @param [String] transaction_id Transaction ID.
133
+ #
134
+ # @return [Transaction]
135
+ def get_transaction(transaction_id:)
136
+ api_path = '/databases/transactions/{transactionId}'
137
+ .gsub('{transactionId}', transaction_id)
138
+
139
+ if transaction_id.nil?
140
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
141
+ end
142
+
143
+ api_params = {
144
+ }
145
+
146
+ api_headers = {
147
+ }
148
+
149
+ @client.call(
150
+ method: 'GET',
151
+ path: api_path,
152
+ headers: api_headers,
153
+ params: api_params,
154
+ response_type: Models::Transaction
155
+ )
156
+ end
157
+
158
+ # Update a transaction, to either commit or roll back its operations.
159
+ #
160
+ # @param [String] transaction_id Transaction ID.
161
+ # @param [] commit Commit transaction?
162
+ # @param [] rollback Rollback transaction?
163
+ #
164
+ # @return [Transaction]
165
+ def update_transaction(transaction_id:, commit: nil, rollback: nil)
166
+ api_path = '/databases/transactions/{transactionId}'
167
+ .gsub('{transactionId}', transaction_id)
168
+
169
+ if transaction_id.nil?
170
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
171
+ end
172
+
173
+ api_params = {
174
+ commit: commit,
175
+ rollback: rollback,
176
+ }
177
+
178
+ api_headers = {
179
+ "content-type": 'application/json',
180
+ }
181
+
182
+ @client.call(
183
+ method: 'PATCH',
184
+ path: api_path,
185
+ headers: api_headers,
186
+ params: api_params,
187
+ response_type: Models::Transaction
188
+ )
189
+ end
190
+
191
+ # Delete a transaction by its unique ID.
192
+ #
193
+ # @param [String] transaction_id Transaction ID.
194
+ #
195
+ # @return []
196
+ def delete_transaction(transaction_id:)
197
+ api_path = '/databases/transactions/{transactionId}'
198
+ .gsub('{transactionId}', transaction_id)
199
+
200
+ if transaction_id.nil?
201
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
202
+ end
203
+
204
+ api_params = {
205
+ }
206
+
207
+ api_headers = {
208
+ "content-type": 'application/json',
209
+ }
210
+
211
+ @client.call(
212
+ method: 'DELETE',
213
+ path: api_path,
214
+ headers: api_headers,
215
+ params: api_params,
216
+ )
217
+ end
218
+
219
+ # Create multiple operations in a single transaction.
220
+ #
221
+ # @param [String] transaction_id Transaction ID.
222
+ # @param [Array] operations Array of staged operations.
223
+ #
224
+ # @return [Transaction]
225
+ def create_operations(transaction_id:, operations: nil)
226
+ api_path = '/databases/transactions/{transactionId}/operations'
227
+ .gsub('{transactionId}', transaction_id)
228
+
229
+ if transaction_id.nil?
230
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
231
+ end
232
+
233
+ api_params = {
234
+ operations: operations,
235
+ }
236
+
237
+ api_headers = {
238
+ "content-type": 'application/json',
239
+ }
240
+
241
+ @client.call(
242
+ method: 'POST',
243
+ path: api_path,
244
+ headers: api_headers,
245
+ params: api_params,
246
+ response_type: Models::Transaction
247
+ )
248
+ end
249
+
81
250
  #
82
251
  # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.get` instead.
83
252
  #
@@ -2034,9 +2203,10 @@ module Appwrite
2034
2203
  # @param [String] database_id Database ID.
2035
2204
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2036
2205
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2206
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2037
2207
  #
2038
2208
  # @return [DocumentList]
2039
- def list_documents(database_id:, collection_id:, queries: nil)
2209
+ def list_documents(database_id:, collection_id:, queries: nil, transaction_id: nil)
2040
2210
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2041
2211
  .gsub('{databaseId}', database_id)
2042
2212
  .gsub('{collectionId}', collection_id)
@@ -2051,6 +2221,7 @@ module Appwrite
2051
2221
 
2052
2222
  api_params = {
2053
2223
  queries: queries,
2224
+ transactionId: transaction_id,
2054
2225
  }
2055
2226
 
2056
2227
  api_headers = {
@@ -2078,9 +2249,10 @@ module Appwrite
2078
2249
  # @param [String] document_id Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2079
2250
  # @param [Hash] data Document data as JSON object.
2080
2251
  # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
2252
+ # @param [String] transaction_id Transaction ID for staging the operation.
2081
2253
  #
2082
2254
  # @return [Document]
2083
- def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil)
2255
+ def create_document(database_id:, collection_id:, document_id:, data:, permissions: nil, transaction_id: nil)
2084
2256
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2085
2257
  .gsub('{databaseId}', database_id)
2086
2258
  .gsub('{collectionId}', collection_id)
@@ -2105,6 +2277,7 @@ module Appwrite
2105
2277
  documentId: document_id,
2106
2278
  data: data,
2107
2279
  permissions: permissions,
2280
+ transactionId: transaction_id,
2108
2281
  }
2109
2282
 
2110
2283
  api_headers = {
@@ -2131,9 +2304,10 @@ module Appwrite
2131
2304
  # @param [String] database_id Database ID.
2132
2305
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
2133
2306
  # @param [Array] documents Array of documents data as JSON objects.
2307
+ # @param [String] transaction_id Transaction ID for staging the operation.
2134
2308
  #
2135
2309
  # @return [DocumentList]
2136
- def create_documents(database_id:, collection_id:, documents:)
2310
+ def create_documents(database_id:, collection_id:, documents:, transaction_id: nil)
2137
2311
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2138
2312
  .gsub('{databaseId}', database_id)
2139
2313
  .gsub('{collectionId}', collection_id)
@@ -2152,6 +2326,7 @@ module Appwrite
2152
2326
 
2153
2327
  api_params = {
2154
2328
  documents: documents,
2329
+ transactionId: transaction_id,
2155
2330
  }
2156
2331
 
2157
2332
  api_headers = {
@@ -2179,9 +2354,10 @@ module Appwrite
2179
2354
  # @param [String] database_id Database ID.
2180
2355
  # @param [String] collection_id Collection ID.
2181
2356
  # @param [Array] documents Array of document data as JSON objects. May contain partial documents.
2357
+ # @param [String] transaction_id Transaction ID for staging the operation.
2182
2358
  #
2183
2359
  # @return [DocumentList]
2184
- def upsert_documents(database_id:, collection_id:, documents:)
2360
+ def upsert_documents(database_id:, collection_id:, documents:, transaction_id: nil)
2185
2361
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2186
2362
  .gsub('{databaseId}', database_id)
2187
2363
  .gsub('{collectionId}', collection_id)
@@ -2200,6 +2376,7 @@ module Appwrite
2200
2376
 
2201
2377
  api_params = {
2202
2378
  documents: documents,
2379
+ transactionId: transaction_id,
2203
2380
  }
2204
2381
 
2205
2382
  api_headers = {
@@ -2226,9 +2403,10 @@ module Appwrite
2226
2403
  # @param [String] collection_id Collection ID.
2227
2404
  # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
2228
2405
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2406
+ # @param [String] transaction_id Transaction ID for staging the operation.
2229
2407
  #
2230
2408
  # @return [DocumentList]
2231
- def update_documents(database_id:, collection_id:, data: nil, queries: nil)
2409
+ def update_documents(database_id:, collection_id:, data: nil, queries: nil, transaction_id: nil)
2232
2410
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2233
2411
  .gsub('{databaseId}', database_id)
2234
2412
  .gsub('{collectionId}', collection_id)
@@ -2244,6 +2422,7 @@ module Appwrite
2244
2422
  api_params = {
2245
2423
  data: data,
2246
2424
  queries: queries,
2425
+ transactionId: transaction_id,
2247
2426
  }
2248
2427
 
2249
2428
  api_headers = {
@@ -2268,9 +2447,10 @@ module Appwrite
2268
2447
  # @param [String] database_id Database ID.
2269
2448
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2270
2449
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2450
+ # @param [String] transaction_id Transaction ID for staging the operation.
2271
2451
  #
2272
2452
  # @return [DocumentList]
2273
- def delete_documents(database_id:, collection_id:, queries: nil)
2453
+ def delete_documents(database_id:, collection_id:, queries: nil, transaction_id: nil)
2274
2454
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents'
2275
2455
  .gsub('{databaseId}', database_id)
2276
2456
  .gsub('{collectionId}', collection_id)
@@ -2285,6 +2465,7 @@ module Appwrite
2285
2465
 
2286
2466
  api_params = {
2287
2467
  queries: queries,
2468
+ transactionId: transaction_id,
2288
2469
  }
2289
2470
 
2290
2471
  api_headers = {
@@ -2310,9 +2491,10 @@ module Appwrite
2310
2491
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2311
2492
  # @param [String] document_id Document ID.
2312
2493
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2494
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2313
2495
  #
2314
2496
  # @return [Document]
2315
- def get_document(database_id:, collection_id:, document_id:, queries: nil)
2497
+ def get_document(database_id:, collection_id:, document_id:, queries: nil, transaction_id: nil)
2316
2498
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
2317
2499
  .gsub('{databaseId}', database_id)
2318
2500
  .gsub('{collectionId}', collection_id)
@@ -2332,6 +2514,7 @@ module Appwrite
2332
2514
 
2333
2515
  api_params = {
2334
2516
  queries: queries,
2517
+ transactionId: transaction_id,
2335
2518
  }
2336
2519
 
2337
2520
  api_headers = {
@@ -2359,9 +2542,10 @@ module Appwrite
2359
2542
  # @param [String] document_id Document ID.
2360
2543
  # @param [Hash] data Document data as JSON object. Include all required attributes of the document to be created or updated.
2361
2544
  # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
2545
+ # @param [String] transaction_id Transaction ID for staging the operation.
2362
2546
  #
2363
2547
  # @return [Document]
2364
- def upsert_document(database_id:, collection_id:, document_id:, data:, permissions: nil)
2548
+ def upsert_document(database_id:, collection_id:, document_id:, data:, permissions: nil, transaction_id: nil)
2365
2549
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
2366
2550
  .gsub('{databaseId}', database_id)
2367
2551
  .gsub('{collectionId}', collection_id)
@@ -2386,6 +2570,7 @@ module Appwrite
2386
2570
  api_params = {
2387
2571
  data: data,
2388
2572
  permissions: permissions,
2573
+ transactionId: transaction_id,
2389
2574
  }
2390
2575
 
2391
2576
  api_headers = {
@@ -2412,9 +2597,10 @@ module Appwrite
2412
2597
  # @param [String] document_id Document ID.
2413
2598
  # @param [Hash] data Document data as JSON object. Include only attribute and value pairs to be updated.
2414
2599
  # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
2600
+ # @param [String] transaction_id Transaction ID for staging the operation.
2415
2601
  #
2416
2602
  # @return [Document]
2417
- def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil)
2603
+ def update_document(database_id:, collection_id:, document_id:, data: nil, permissions: nil, transaction_id: nil)
2418
2604
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
2419
2605
  .gsub('{databaseId}', database_id)
2420
2606
  .gsub('{collectionId}', collection_id)
@@ -2435,6 +2621,7 @@ module Appwrite
2435
2621
  api_params = {
2436
2622
  data: data,
2437
2623
  permissions: permissions,
2624
+ transactionId: transaction_id,
2438
2625
  }
2439
2626
 
2440
2627
  api_headers = {
@@ -2458,9 +2645,10 @@ module Appwrite
2458
2645
  # @param [String] database_id Database ID.
2459
2646
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
2460
2647
  # @param [String] document_id Document ID.
2648
+ # @param [String] transaction_id Transaction ID for staging the operation.
2461
2649
  #
2462
2650
  # @return []
2463
- def delete_document(database_id:, collection_id:, document_id:)
2651
+ def delete_document(database_id:, collection_id:, document_id:, transaction_id: nil)
2464
2652
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}'
2465
2653
  .gsub('{databaseId}', database_id)
2466
2654
  .gsub('{collectionId}', collection_id)
@@ -2479,6 +2667,7 @@ module Appwrite
2479
2667
  end
2480
2668
 
2481
2669
  api_params = {
2670
+ transactionId: transaction_id,
2482
2671
  }
2483
2672
 
2484
2673
  api_headers = {
@@ -2504,9 +2693,10 @@ module Appwrite
2504
2693
  # @param [String] attribute Attribute key.
2505
2694
  # @param [Float] value Value to increment the attribute by. The value must be a number.
2506
2695
  # @param [Float] min Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
2696
+ # @param [String] transaction_id Transaction ID for staging the operation.
2507
2697
  #
2508
2698
  # @return [Document]
2509
- def decrement_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, min: nil)
2699
+ def decrement_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, min: nil, transaction_id: nil)
2510
2700
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/decrement'
2511
2701
  .gsub('{databaseId}', database_id)
2512
2702
  .gsub('{collectionId}', collection_id)
@@ -2532,6 +2722,7 @@ module Appwrite
2532
2722
  api_params = {
2533
2723
  value: value,
2534
2724
  min: min,
2725
+ transactionId: transaction_id,
2535
2726
  }
2536
2727
 
2537
2728
  api_headers = {
@@ -2558,9 +2749,10 @@ module Appwrite
2558
2749
  # @param [String] attribute Attribute key.
2559
2750
  # @param [Float] value Value to increment the attribute by. The value must be a number.
2560
2751
  # @param [Float] max Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
2752
+ # @param [String] transaction_id Transaction ID for staging the operation.
2561
2753
  #
2562
2754
  # @return [Document]
2563
- def increment_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, max: nil)
2755
+ def increment_document_attribute(database_id:, collection_id:, document_id:, attribute:, value: nil, max: nil, transaction_id: nil)
2564
2756
  api_path = '/databases/{databaseId}/collections/{collectionId}/documents/{documentId}/{attribute}/increment'
2565
2757
  .gsub('{databaseId}', database_id)
2566
2758
  .gsub('{collectionId}', collection_id)
@@ -2586,6 +2778,7 @@ module Appwrite
2586
2778
  api_params = {
2587
2779
  value: value,
2588
2780
  max: max,
2781
+ transactionId: transaction_id,
2589
2782
  }
2590
2783
 
2591
2784
  api_headers = {
@@ -2705,7 +2898,7 @@ module Appwrite
2705
2898
  #
2706
2899
  # @deprecated This API has been deprecated since 1.8.0. Please use `TablesDB.getIndex` instead.
2707
2900
  #
2708
- # Get index by ID.
2901
+ # Get an index by its unique ID.
2709
2902
  #
2710
2903
  # @param [String] database_id Database ID.
2711
2904
  # @param [String] collection_id Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).
@@ -72,6 +72,175 @@ module Appwrite
72
72
  )
73
73
  end
74
74
 
75
+ # List transactions across all databases.
76
+ #
77
+ # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
78
+ #
79
+ # @return [TransactionList]
80
+ def list_transactions(queries: nil)
81
+ api_path = '/tablesdb/transactions'
82
+
83
+ api_params = {
84
+ queries: queries,
85
+ }
86
+
87
+ api_headers = {
88
+ }
89
+
90
+ @client.call(
91
+ method: 'GET',
92
+ path: api_path,
93
+ headers: api_headers,
94
+ params: api_params,
95
+ response_type: Models::TransactionList
96
+ )
97
+ end
98
+
99
+ # Create a new transaction.
100
+ #
101
+ # @param [Integer] ttl Seconds before the transaction expires.
102
+ #
103
+ # @return [Transaction]
104
+ def create_transaction(ttl: nil)
105
+ api_path = '/tablesdb/transactions'
106
+
107
+ api_params = {
108
+ ttl: ttl,
109
+ }
110
+
111
+ api_headers = {
112
+ "content-type": 'application/json',
113
+ }
114
+
115
+ @client.call(
116
+ method: 'POST',
117
+ path: api_path,
118
+ headers: api_headers,
119
+ params: api_params,
120
+ response_type: Models::Transaction
121
+ )
122
+ end
123
+
124
+ # Get a transaction by its unique ID.
125
+ #
126
+ # @param [String] transaction_id Transaction ID.
127
+ #
128
+ # @return [Transaction]
129
+ def get_transaction(transaction_id:)
130
+ api_path = '/tablesdb/transactions/{transactionId}'
131
+ .gsub('{transactionId}', transaction_id)
132
+
133
+ if transaction_id.nil?
134
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
135
+ end
136
+
137
+ api_params = {
138
+ }
139
+
140
+ api_headers = {
141
+ }
142
+
143
+ @client.call(
144
+ method: 'GET',
145
+ path: api_path,
146
+ headers: api_headers,
147
+ params: api_params,
148
+ response_type: Models::Transaction
149
+ )
150
+ end
151
+
152
+ # Update a transaction, to either commit or roll back its operations.
153
+ #
154
+ # @param [String] transaction_id Transaction ID.
155
+ # @param [] commit Commit transaction?
156
+ # @param [] rollback Rollback transaction?
157
+ #
158
+ # @return [Transaction]
159
+ def update_transaction(transaction_id:, commit: nil, rollback: nil)
160
+ api_path = '/tablesdb/transactions/{transactionId}'
161
+ .gsub('{transactionId}', transaction_id)
162
+
163
+ if transaction_id.nil?
164
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
165
+ end
166
+
167
+ api_params = {
168
+ commit: commit,
169
+ rollback: rollback,
170
+ }
171
+
172
+ api_headers = {
173
+ "content-type": 'application/json',
174
+ }
175
+
176
+ @client.call(
177
+ method: 'PATCH',
178
+ path: api_path,
179
+ headers: api_headers,
180
+ params: api_params,
181
+ response_type: Models::Transaction
182
+ )
183
+ end
184
+
185
+ # Delete a transaction by its unique ID.
186
+ #
187
+ # @param [String] transaction_id Transaction ID.
188
+ #
189
+ # @return []
190
+ def delete_transaction(transaction_id:)
191
+ api_path = '/tablesdb/transactions/{transactionId}'
192
+ .gsub('{transactionId}', transaction_id)
193
+
194
+ if transaction_id.nil?
195
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
196
+ end
197
+
198
+ api_params = {
199
+ }
200
+
201
+ api_headers = {
202
+ "content-type": 'application/json',
203
+ }
204
+
205
+ @client.call(
206
+ method: 'DELETE',
207
+ path: api_path,
208
+ headers: api_headers,
209
+ params: api_params,
210
+ )
211
+ end
212
+
213
+ # Create multiple operations in a single transaction.
214
+ #
215
+ # @param [String] transaction_id Transaction ID.
216
+ # @param [Array] operations Array of staged operations.
217
+ #
218
+ # @return [Transaction]
219
+ def create_operations(transaction_id:, operations: nil)
220
+ api_path = '/tablesdb/transactions/{transactionId}/operations'
221
+ .gsub('{transactionId}', transaction_id)
222
+
223
+ if transaction_id.nil?
224
+ raise Appwrite::Exception.new('Missing required parameter: "transactionId"')
225
+ end
226
+
227
+ api_params = {
228
+ operations: operations,
229
+ }
230
+
231
+ api_headers = {
232
+ "content-type": 'application/json',
233
+ }
234
+
235
+ @client.call(
236
+ method: 'POST',
237
+ path: api_path,
238
+ headers: api_headers,
239
+ params: api_params,
240
+ response_type: Models::Transaction
241
+ )
242
+ end
243
+
75
244
  # Get a database by its unique ID. This endpoint response returns a JSON
76
245
  # object with the database metadata.
77
246
  #
@@ -2088,9 +2257,10 @@ module Appwrite
2088
2257
  # @param [String] database_id Database ID.
2089
2258
  # @param [String] table_id Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
2090
2259
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2260
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2091
2261
  #
2092
2262
  # @return [RowList]
2093
- def list_rows(database_id:, table_id:, queries: nil)
2263
+ def list_rows(database_id:, table_id:, queries: nil, transaction_id: nil)
2094
2264
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows'
2095
2265
  .gsub('{databaseId}', database_id)
2096
2266
  .gsub('{tableId}', table_id)
@@ -2105,6 +2275,7 @@ module Appwrite
2105
2275
 
2106
2276
  api_params = {
2107
2277
  queries: queries,
2278
+ transactionId: transaction_id,
2108
2279
  }
2109
2280
 
2110
2281
  api_headers = {
@@ -2129,9 +2300,10 @@ module Appwrite
2129
2300
  # @param [String] row_id Row ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
2130
2301
  # @param [Hash] data Row data as JSON object.
2131
2302
  # @param [Array] permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
2303
+ # @param [String] transaction_id Transaction ID for staging the operation.
2132
2304
  #
2133
2305
  # @return [Row]
2134
- def create_row(database_id:, table_id:, row_id:, data:, permissions: nil)
2306
+ def create_row(database_id:, table_id:, row_id:, data:, permissions: nil, transaction_id: nil)
2135
2307
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows'
2136
2308
  .gsub('{databaseId}', database_id)
2137
2309
  .gsub('{tableId}', table_id)
@@ -2156,6 +2328,7 @@ module Appwrite
2156
2328
  rowId: row_id,
2157
2329
  data: data,
2158
2330
  permissions: permissions,
2331
+ transactionId: transaction_id,
2159
2332
  }
2160
2333
 
2161
2334
  api_headers = {
@@ -2179,9 +2352,10 @@ module Appwrite
2179
2352
  # @param [String] database_id Database ID.
2180
2353
  # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
2181
2354
  # @param [Array] rows Array of rows data as JSON objects.
2355
+ # @param [String] transaction_id Transaction ID for staging the operation.
2182
2356
  #
2183
2357
  # @return [RowList]
2184
- def create_rows(database_id:, table_id:, rows:)
2358
+ def create_rows(database_id:, table_id:, rows:, transaction_id: nil)
2185
2359
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows'
2186
2360
  .gsub('{databaseId}', database_id)
2187
2361
  .gsub('{tableId}', table_id)
@@ -2200,6 +2374,7 @@ module Appwrite
2200
2374
 
2201
2375
  api_params = {
2202
2376
  rows: rows,
2377
+ transactionId: transaction_id,
2203
2378
  }
2204
2379
 
2205
2380
  api_headers = {
@@ -2224,9 +2399,10 @@ module Appwrite
2224
2399
  # @param [String] database_id Database ID.
2225
2400
  # @param [String] table_id Table ID.
2226
2401
  # @param [Array] rows Array of row data as JSON objects. May contain partial rows.
2402
+ # @param [String] transaction_id Transaction ID for staging the operation.
2227
2403
  #
2228
2404
  # @return [RowList]
2229
- def upsert_rows(database_id:, table_id:, rows:)
2405
+ def upsert_rows(database_id:, table_id:, rows:, transaction_id: nil)
2230
2406
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows'
2231
2407
  .gsub('{databaseId}', database_id)
2232
2408
  .gsub('{tableId}', table_id)
@@ -2245,6 +2421,7 @@ module Appwrite
2245
2421
 
2246
2422
  api_params = {
2247
2423
  rows: rows,
2424
+ transactionId: transaction_id,
2248
2425
  }
2249
2426
 
2250
2427
  api_headers = {
@@ -2267,9 +2444,10 @@ module Appwrite
2267
2444
  # @param [String] table_id Table ID.
2268
2445
  # @param [Hash] data Row data as JSON object. Include only column and value pairs to be updated.
2269
2446
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2447
+ # @param [String] transaction_id Transaction ID for staging the operation.
2270
2448
  #
2271
2449
  # @return [RowList]
2272
- def update_rows(database_id:, table_id:, data: nil, queries: nil)
2450
+ def update_rows(database_id:, table_id:, data: nil, queries: nil, transaction_id: nil)
2273
2451
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows'
2274
2452
  .gsub('{databaseId}', database_id)
2275
2453
  .gsub('{tableId}', table_id)
@@ -2285,6 +2463,7 @@ module Appwrite
2285
2463
  api_params = {
2286
2464
  data: data,
2287
2465
  queries: queries,
2466
+ transactionId: transaction_id,
2288
2467
  }
2289
2468
 
2290
2469
  api_headers = {
@@ -2306,9 +2485,10 @@ module Appwrite
2306
2485
  # @param [String] database_id Database ID.
2307
2486
  # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2308
2487
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2488
+ # @param [String] transaction_id Transaction ID for staging the operation.
2309
2489
  #
2310
2490
  # @return [RowList]
2311
- def delete_rows(database_id:, table_id:, queries: nil)
2491
+ def delete_rows(database_id:, table_id:, queries: nil, transaction_id: nil)
2312
2492
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows'
2313
2493
  .gsub('{databaseId}', database_id)
2314
2494
  .gsub('{tableId}', table_id)
@@ -2323,6 +2503,7 @@ module Appwrite
2323
2503
 
2324
2504
  api_params = {
2325
2505
  queries: queries,
2506
+ transactionId: transaction_id,
2326
2507
  }
2327
2508
 
2328
2509
  api_headers = {
@@ -2345,9 +2526,10 @@ module Appwrite
2345
2526
  # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2346
2527
  # @param [String] row_id Row ID.
2347
2528
  # @param [Array] queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2529
+ # @param [String] transaction_id Transaction ID to read uncommitted changes within the transaction.
2348
2530
  #
2349
2531
  # @return [Row]
2350
- def get_row(database_id:, table_id:, row_id:, queries: nil)
2532
+ def get_row(database_id:, table_id:, row_id:, queries: nil, transaction_id: nil)
2351
2533
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'
2352
2534
  .gsub('{databaseId}', database_id)
2353
2535
  .gsub('{tableId}', table_id)
@@ -2367,6 +2549,7 @@ module Appwrite
2367
2549
 
2368
2550
  api_params = {
2369
2551
  queries: queries,
2552
+ transactionId: transaction_id,
2370
2553
  }
2371
2554
 
2372
2555
  api_headers = {
@@ -2391,9 +2574,10 @@ module Appwrite
2391
2574
  # @param [String] row_id Row ID.
2392
2575
  # @param [Hash] data Row data as JSON object. Include all required columns of the row to be created or updated.
2393
2576
  # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
2577
+ # @param [String] transaction_id Transaction ID for staging the operation.
2394
2578
  #
2395
2579
  # @return [Row]
2396
- def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil)
2580
+ def upsert_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, transaction_id: nil)
2397
2581
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'
2398
2582
  .gsub('{databaseId}', database_id)
2399
2583
  .gsub('{tableId}', table_id)
@@ -2414,6 +2598,7 @@ module Appwrite
2414
2598
  api_params = {
2415
2599
  data: data,
2416
2600
  permissions: permissions,
2601
+ transactionId: transaction_id,
2417
2602
  }
2418
2603
 
2419
2604
  api_headers = {
@@ -2437,9 +2622,10 @@ module Appwrite
2437
2622
  # @param [String] row_id Row ID.
2438
2623
  # @param [Hash] data Row data as JSON object. Include only columns and value pairs to be updated.
2439
2624
  # @param [Array] permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
2625
+ # @param [String] transaction_id Transaction ID for staging the operation.
2440
2626
  #
2441
2627
  # @return [Row]
2442
- def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil)
2628
+ def update_row(database_id:, table_id:, row_id:, data: nil, permissions: nil, transaction_id: nil)
2443
2629
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'
2444
2630
  .gsub('{databaseId}', database_id)
2445
2631
  .gsub('{tableId}', table_id)
@@ -2460,6 +2646,7 @@ module Appwrite
2460
2646
  api_params = {
2461
2647
  data: data,
2462
2648
  permissions: permissions,
2649
+ transactionId: transaction_id,
2463
2650
  }
2464
2651
 
2465
2652
  api_headers = {
@@ -2480,9 +2667,10 @@ module Appwrite
2480
2667
  # @param [String] database_id Database ID.
2481
2668
  # @param [String] table_id Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2482
2669
  # @param [String] row_id Row ID.
2670
+ # @param [String] transaction_id Transaction ID for staging the operation.
2483
2671
  #
2484
2672
  # @return []
2485
- def delete_row(database_id:, table_id:, row_id:)
2673
+ def delete_row(database_id:, table_id:, row_id:, transaction_id: nil)
2486
2674
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'
2487
2675
  .gsub('{databaseId}', database_id)
2488
2676
  .gsub('{tableId}', table_id)
@@ -2501,6 +2689,7 @@ module Appwrite
2501
2689
  end
2502
2690
 
2503
2691
  api_params = {
2692
+ transactionId: transaction_id,
2504
2693
  }
2505
2694
 
2506
2695
  api_headers = {
@@ -2523,9 +2712,10 @@ module Appwrite
2523
2712
  # @param [String] column Column key.
2524
2713
  # @param [Float] value Value to increment the column by. The value must be a number.
2525
2714
  # @param [Float] min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
2715
+ # @param [String] transaction_id Transaction ID for staging the operation.
2526
2716
  #
2527
2717
  # @return [Row]
2528
- def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: nil)
2718
+ def decrement_row_column(database_id:, table_id:, row_id:, column:, value: nil, min: nil, transaction_id: nil)
2529
2719
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'
2530
2720
  .gsub('{databaseId}', database_id)
2531
2721
  .gsub('{tableId}', table_id)
@@ -2551,6 +2741,7 @@ module Appwrite
2551
2741
  api_params = {
2552
2742
  value: value,
2553
2743
  min: min,
2744
+ transactionId: transaction_id,
2554
2745
  }
2555
2746
 
2556
2747
  api_headers = {
@@ -2574,9 +2765,10 @@ module Appwrite
2574
2765
  # @param [String] column Column key.
2575
2766
  # @param [Float] value Value to increment the column by. The value must be a number.
2576
2767
  # @param [Float] max Maximum value for the column. If the current value is greater than this value, an error will be thrown.
2768
+ # @param [String] transaction_id Transaction ID for staging the operation.
2577
2769
  #
2578
2770
  # @return [Row]
2579
- def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: nil)
2771
+ def increment_row_column(database_id:, table_id:, row_id:, column:, value: nil, max: nil, transaction_id: nil)
2580
2772
  api_path = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'
2581
2773
  .gsub('{databaseId}', database_id)
2582
2774
  .gsub('{tableId}', table_id)
@@ -2602,6 +2794,7 @@ module Appwrite
2602
2794
  api_params = {
2603
2795
  value: value,
2604
2796
  max: max,
2797
+ transactionId: transaction_id,
2605
2798
  }
2606
2799
 
2607
2800
  api_headers = {
data/lib/appwrite.rb CHANGED
@@ -46,6 +46,7 @@ require_relative 'appwrite/models/message_list'
46
46
  require_relative 'appwrite/models/topic_list'
47
47
  require_relative 'appwrite/models/subscriber_list'
48
48
  require_relative 'appwrite/models/target_list'
49
+ require_relative 'appwrite/models/transaction_list'
49
50
  require_relative 'appwrite/models/specification_list'
50
51
  require_relative 'appwrite/models/database'
51
52
  require_relative 'appwrite/models/collection'
@@ -130,6 +131,7 @@ require_relative 'appwrite/models/mfa_factors'
130
131
  require_relative 'appwrite/models/provider'
131
132
  require_relative 'appwrite/models/message'
132
133
  require_relative 'appwrite/models/topic'
134
+ require_relative 'appwrite/models/transaction'
133
135
  require_relative 'appwrite/models/subscriber'
134
136
  require_relative 'appwrite/models/target'
135
137
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appwrite
3
3
  version: !ruby/object:Gem::Version
4
- version: 19.1.0
4
+ version: 19.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Appwrite Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-10-08 00:00:00.000000000 Z
11
+ date: 2025-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mime-types
@@ -185,6 +185,8 @@ files:
185
185
  - lib/appwrite/models/token.rb
186
186
  - lib/appwrite/models/topic.rb
187
187
  - lib/appwrite/models/topic_list.rb
188
+ - lib/appwrite/models/transaction.rb
189
+ - lib/appwrite/models/transaction_list.rb
188
190
  - lib/appwrite/models/user.rb
189
191
  - lib/appwrite/models/user_list.rb
190
192
  - lib/appwrite/models/variable.rb