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
|
@@ -13,46 +13,344 @@ export class TablesDB extends Service {
|
|
|
13
13
|
super(client);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* List transactions across all databases.
|
|
18
|
+
*
|
|
19
|
+
* @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
|
|
20
|
+
* @throws {AppwriteException}
|
|
21
|
+
* @returns {Promise}
|
|
22
|
+
*/
|
|
23
|
+
listTransactions(params?: { queries?: string[] }): Promise<Models.TransactionList>;
|
|
24
|
+
/**
|
|
25
|
+
* List transactions across all databases.
|
|
26
|
+
*
|
|
27
|
+
* @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
|
|
28
|
+
* @throws {AppwriteException}
|
|
29
|
+
* @returns {Promise<Models.TransactionList>}
|
|
30
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
31
|
+
*/
|
|
32
|
+
listTransactions(queries?: string[]): Promise<Models.TransactionList>;
|
|
33
|
+
listTransactions(
|
|
34
|
+
paramsOrFirst?: { queries?: string[] } | string[]
|
|
35
|
+
): Promise<Models.TransactionList> {
|
|
36
|
+
let params: { queries?: string[] };
|
|
37
|
+
|
|
38
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
39
|
+
params = (paramsOrFirst || {}) as { queries?: string[] };
|
|
40
|
+
} else {
|
|
41
|
+
params = {
|
|
42
|
+
queries: paramsOrFirst as string[]
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const queries = params.queries;
|
|
47
|
+
|
|
48
|
+
const apiPath = '/tablesdb/transactions';
|
|
49
|
+
const payload: Payload = {};
|
|
50
|
+
|
|
51
|
+
if (typeof queries !== 'undefined') {
|
|
52
|
+
payload['queries'] = queries;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
56
|
+
return this.client.call('get', uri, {
|
|
57
|
+
}, payload);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Create a new transaction.
|
|
62
|
+
*
|
|
63
|
+
* @param {number} params.ttl - Seconds before the transaction expires.
|
|
64
|
+
* @throws {AppwriteException}
|
|
65
|
+
* @returns {Promise}
|
|
66
|
+
*/
|
|
67
|
+
createTransaction(params?: { ttl?: number }): Promise<Models.Transaction>;
|
|
68
|
+
/**
|
|
69
|
+
* Create a new transaction.
|
|
70
|
+
*
|
|
71
|
+
* @param {number} ttl - Seconds before the transaction expires.
|
|
72
|
+
* @throws {AppwriteException}
|
|
73
|
+
* @returns {Promise<Models.Transaction>}
|
|
74
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
75
|
+
*/
|
|
76
|
+
createTransaction(ttl?: number): Promise<Models.Transaction>;
|
|
77
|
+
createTransaction(
|
|
78
|
+
paramsOrFirst?: { ttl?: number } | number
|
|
79
|
+
): Promise<Models.Transaction> {
|
|
80
|
+
let params: { ttl?: number };
|
|
81
|
+
|
|
82
|
+
if (!paramsOrFirst || (paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
83
|
+
params = (paramsOrFirst || {}) as { ttl?: number };
|
|
84
|
+
} else {
|
|
85
|
+
params = {
|
|
86
|
+
ttl: paramsOrFirst as number
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const ttl = params.ttl;
|
|
91
|
+
|
|
92
|
+
const apiPath = '/tablesdb/transactions';
|
|
93
|
+
const payload: Payload = {};
|
|
94
|
+
|
|
95
|
+
if (typeof ttl !== 'undefined') {
|
|
96
|
+
payload['ttl'] = ttl;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
100
|
+
return this.client.call('post', uri, {
|
|
101
|
+
'content-type': 'application/json',
|
|
102
|
+
}, payload);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get a transaction by its unique ID.
|
|
107
|
+
*
|
|
108
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
109
|
+
* @throws {AppwriteException}
|
|
110
|
+
* @returns {Promise}
|
|
111
|
+
*/
|
|
112
|
+
getTransaction(params: { transactionId: string }): Promise<Models.Transaction>;
|
|
113
|
+
/**
|
|
114
|
+
* Get a transaction by its unique ID.
|
|
115
|
+
*
|
|
116
|
+
* @param {string} transactionId - Transaction ID.
|
|
117
|
+
* @throws {AppwriteException}
|
|
118
|
+
* @returns {Promise<Models.Transaction>}
|
|
119
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
120
|
+
*/
|
|
121
|
+
getTransaction(transactionId: string): Promise<Models.Transaction>;
|
|
122
|
+
getTransaction(
|
|
123
|
+
paramsOrFirst: { transactionId: string } | string
|
|
124
|
+
): Promise<Models.Transaction> {
|
|
125
|
+
let params: { transactionId: string };
|
|
126
|
+
|
|
127
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
128
|
+
params = (paramsOrFirst || {}) as { transactionId: string };
|
|
129
|
+
} else {
|
|
130
|
+
params = {
|
|
131
|
+
transactionId: paramsOrFirst as string
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const transactionId = params.transactionId;
|
|
136
|
+
|
|
137
|
+
if (typeof transactionId === 'undefined') {
|
|
138
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
142
|
+
const payload: Payload = {};
|
|
143
|
+
|
|
144
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
145
|
+
return this.client.call('get', uri, {
|
|
146
|
+
}, payload);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Update a transaction, to either commit or roll back its operations.
|
|
151
|
+
*
|
|
152
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
153
|
+
* @param {boolean} params.commit - Commit transaction?
|
|
154
|
+
* @param {boolean} params.rollback - Rollback transaction?
|
|
155
|
+
* @throws {AppwriteException}
|
|
156
|
+
* @returns {Promise}
|
|
157
|
+
*/
|
|
158
|
+
updateTransaction(params: { transactionId: string, commit?: boolean, rollback?: boolean }): Promise<Models.Transaction>;
|
|
159
|
+
/**
|
|
160
|
+
* Update a transaction, to either commit or roll back its operations.
|
|
161
|
+
*
|
|
162
|
+
* @param {string} transactionId - Transaction ID.
|
|
163
|
+
* @param {boolean} commit - Commit transaction?
|
|
164
|
+
* @param {boolean} rollback - Rollback transaction?
|
|
165
|
+
* @throws {AppwriteException}
|
|
166
|
+
* @returns {Promise<Models.Transaction>}
|
|
167
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
168
|
+
*/
|
|
169
|
+
updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>;
|
|
170
|
+
updateTransaction(
|
|
171
|
+
paramsOrFirst: { transactionId: string, commit?: boolean, rollback?: boolean } | string,
|
|
172
|
+
...rest: [(boolean)?, (boolean)?]
|
|
173
|
+
): Promise<Models.Transaction> {
|
|
174
|
+
let params: { transactionId: string, commit?: boolean, rollback?: boolean };
|
|
175
|
+
|
|
176
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
177
|
+
params = (paramsOrFirst || {}) as { transactionId: string, commit?: boolean, rollback?: boolean };
|
|
178
|
+
} else {
|
|
179
|
+
params = {
|
|
180
|
+
transactionId: paramsOrFirst as string,
|
|
181
|
+
commit: rest[0] as boolean,
|
|
182
|
+
rollback: rest[1] as boolean
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const transactionId = params.transactionId;
|
|
187
|
+
const commit = params.commit;
|
|
188
|
+
const rollback = params.rollback;
|
|
189
|
+
|
|
190
|
+
if (typeof transactionId === 'undefined') {
|
|
191
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
195
|
+
const payload: Payload = {};
|
|
196
|
+
|
|
197
|
+
if (typeof commit !== 'undefined') {
|
|
198
|
+
payload['commit'] = commit;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (typeof rollback !== 'undefined') {
|
|
202
|
+
payload['rollback'] = rollback;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
206
|
+
return this.client.call('patch', uri, {
|
|
207
|
+
'content-type': 'application/json',
|
|
208
|
+
}, payload);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Delete a transaction by its unique ID.
|
|
213
|
+
*
|
|
214
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
215
|
+
* @throws {AppwriteException}
|
|
216
|
+
* @returns {Promise}
|
|
217
|
+
*/
|
|
218
|
+
deleteTransaction(params: { transactionId: string }): Promise<{}>;
|
|
219
|
+
/**
|
|
220
|
+
* Delete a transaction by its unique ID.
|
|
221
|
+
*
|
|
222
|
+
* @param {string} transactionId - Transaction ID.
|
|
223
|
+
* @throws {AppwriteException}
|
|
224
|
+
* @returns {Promise<{}>}
|
|
225
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
226
|
+
*/
|
|
227
|
+
deleteTransaction(transactionId: string): Promise<{}>;
|
|
228
|
+
deleteTransaction(
|
|
229
|
+
paramsOrFirst: { transactionId: string } | string
|
|
230
|
+
): Promise<{}> {
|
|
231
|
+
let params: { transactionId: string };
|
|
232
|
+
|
|
233
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
234
|
+
params = (paramsOrFirst || {}) as { transactionId: string };
|
|
235
|
+
} else {
|
|
236
|
+
params = {
|
|
237
|
+
transactionId: paramsOrFirst as string
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
const transactionId = params.transactionId;
|
|
242
|
+
|
|
243
|
+
if (typeof transactionId === 'undefined') {
|
|
244
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
const apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
|
|
248
|
+
const payload: Payload = {};
|
|
249
|
+
|
|
250
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
251
|
+
return this.client.call('delete', uri, {
|
|
252
|
+
'content-type': 'application/json',
|
|
253
|
+
}, payload);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Create multiple operations in a single transaction.
|
|
258
|
+
*
|
|
259
|
+
* @param {string} params.transactionId - Transaction ID.
|
|
260
|
+
* @param {object[]} params.operations - Array of staged operations.
|
|
261
|
+
* @throws {AppwriteException}
|
|
262
|
+
* @returns {Promise}
|
|
263
|
+
*/
|
|
264
|
+
createOperations(params: { transactionId: string, operations?: object[] }): Promise<Models.Transaction>;
|
|
265
|
+
/**
|
|
266
|
+
* Create multiple operations in a single transaction.
|
|
267
|
+
*
|
|
268
|
+
* @param {string} transactionId - Transaction ID.
|
|
269
|
+
* @param {object[]} operations - Array of staged operations.
|
|
270
|
+
* @throws {AppwriteException}
|
|
271
|
+
* @returns {Promise<Models.Transaction>}
|
|
272
|
+
* @deprecated Use the object parameter style method for a better developer experience.
|
|
273
|
+
*/
|
|
274
|
+
createOperations(transactionId: string, operations?: object[]): Promise<Models.Transaction>;
|
|
275
|
+
createOperations(
|
|
276
|
+
paramsOrFirst: { transactionId: string, operations?: object[] } | string,
|
|
277
|
+
...rest: [(object[])?]
|
|
278
|
+
): Promise<Models.Transaction> {
|
|
279
|
+
let params: { transactionId: string, operations?: object[] };
|
|
280
|
+
|
|
281
|
+
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
282
|
+
params = (paramsOrFirst || {}) as { transactionId: string, operations?: object[] };
|
|
283
|
+
} else {
|
|
284
|
+
params = {
|
|
285
|
+
transactionId: paramsOrFirst as string,
|
|
286
|
+
operations: rest[0] as object[]
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const transactionId = params.transactionId;
|
|
291
|
+
const operations = params.operations;
|
|
292
|
+
|
|
293
|
+
if (typeof transactionId === 'undefined') {
|
|
294
|
+
throw new AppwriteException('Missing required parameter: "transactionId"');
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
|
|
298
|
+
const payload: Payload = {};
|
|
299
|
+
|
|
300
|
+
if (typeof operations !== 'undefined') {
|
|
301
|
+
payload['operations'] = operations;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
305
|
+
return this.client.call('post', uri, {
|
|
306
|
+
'content-type': 'application/json',
|
|
307
|
+
}, payload);
|
|
308
|
+
}
|
|
309
|
+
|
|
16
310
|
/**
|
|
17
311
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
18
312
|
*
|
|
19
313
|
* @param {string} params.databaseId - Database ID.
|
|
20
314
|
* @param {string} params.tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
|
|
21
315
|
* @param {string[]} params.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.
|
|
316
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
22
317
|
* @throws {AppwriteException}
|
|
23
318
|
* @returns {Promise}
|
|
24
319
|
*/
|
|
25
|
-
listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[] }): Promise<Models.RowList<Row>>;
|
|
320
|
+
listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string }): Promise<Models.RowList<Row>>;
|
|
26
321
|
/**
|
|
27
322
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
28
323
|
*
|
|
29
324
|
* @param {string} databaseId - Database ID.
|
|
30
325
|
* @param {string} tableId - Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
|
|
31
326
|
* @param {string[]} 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.
|
|
327
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
32
328
|
* @throws {AppwriteException}
|
|
33
329
|
* @returns {Promise<Models.RowList<Row>>}
|
|
34
330
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
35
331
|
*/
|
|
36
|
-
listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[]): Promise<Models.RowList<Row>>;
|
|
332
|
+
listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string): Promise<Models.RowList<Row>>;
|
|
37
333
|
listRows<Row extends Models.Row = Models.DefaultRow>(
|
|
38
|
-
paramsOrFirst: { databaseId: string, tableId: string, queries?: string[] } | string,
|
|
39
|
-
...rest: [(string)?, (string[])?]
|
|
334
|
+
paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string } | string,
|
|
335
|
+
...rest: [(string)?, (string[])?, (string)?]
|
|
40
336
|
): Promise<Models.RowList<Row>> {
|
|
41
|
-
let params: { databaseId: string, tableId: string, queries?: string[] };
|
|
337
|
+
let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string };
|
|
42
338
|
|
|
43
339
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
44
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[] };
|
|
340
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string };
|
|
45
341
|
} else {
|
|
46
342
|
params = {
|
|
47
343
|
databaseId: paramsOrFirst as string,
|
|
48
344
|
tableId: rest[0] as string,
|
|
49
|
-
queries: rest[1] as string[]
|
|
345
|
+
queries: rest[1] as string[],
|
|
346
|
+
transactionId: rest[2] as string
|
|
50
347
|
};
|
|
51
348
|
}
|
|
52
349
|
|
|
53
350
|
const databaseId = params.databaseId;
|
|
54
351
|
const tableId = params.tableId;
|
|
55
352
|
const queries = params.queries;
|
|
353
|
+
const transactionId = params.transactionId;
|
|
56
354
|
|
|
57
355
|
if (typeof databaseId === 'undefined') {
|
|
58
356
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -69,6 +367,10 @@ export class TablesDB extends Service {
|
|
|
69
367
|
payload['queries'] = queries;
|
|
70
368
|
}
|
|
71
369
|
|
|
370
|
+
if (typeof transactionId !== 'undefined') {
|
|
371
|
+
payload['transactionId'] = transactionId;
|
|
372
|
+
}
|
|
373
|
+
|
|
72
374
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
73
375
|
return this.client.call('get', uri, {
|
|
74
376
|
}, payload);
|
|
@@ -82,10 +384,11 @@ export class TablesDB extends Service {
|
|
|
82
384
|
* @param {string} params.rowId - 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.
|
|
83
385
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} params.data - Row data as JSON object.
|
|
84
386
|
* @param {string[]} params.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).
|
|
387
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
85
388
|
* @throws {AppwriteException}
|
|
86
389
|
* @returns {Promise}
|
|
87
390
|
*/
|
|
88
|
-
createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[] }): Promise<Row>;
|
|
391
|
+
createRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string }): Promise<Row>;
|
|
89
392
|
/**
|
|
90
393
|
* Create a new Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
91
394
|
*
|
|
@@ -94,26 +397,28 @@ export class TablesDB extends Service {
|
|
|
94
397
|
* @param {string} rowId - 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.
|
|
95
398
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>} data - Row data as JSON object.
|
|
96
399
|
* @param {string[]} 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).
|
|
400
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
97
401
|
* @throws {AppwriteException}
|
|
98
402
|
* @returns {Promise<Row>}
|
|
99
403
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
100
404
|
*/
|
|
101
|
-
createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[]): Promise<Row>;
|
|
405
|
+
createRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string): Promise<Row>;
|
|
102
406
|
createRow<Row extends Models.Row = Models.DefaultRow>(
|
|
103
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[] } | string,
|
|
104
|
-
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?]
|
|
407
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string } | string,
|
|
408
|
+
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?]
|
|
105
409
|
): Promise<Row> {
|
|
106
|
-
let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[] };
|
|
410
|
+
let params: { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string };
|
|
107
411
|
|
|
108
412
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
109
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[] };
|
|
413
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>, permissions?: string[], transactionId?: string };
|
|
110
414
|
} else {
|
|
111
415
|
params = {
|
|
112
416
|
databaseId: paramsOrFirst as string,
|
|
113
417
|
tableId: rest[0] as string,
|
|
114
418
|
rowId: rest[1] as string,
|
|
115
419
|
data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>,
|
|
116
|
-
permissions: rest[3] as string[]
|
|
420
|
+
permissions: rest[3] as string[],
|
|
421
|
+
transactionId: rest[4] as string
|
|
117
422
|
};
|
|
118
423
|
}
|
|
119
424
|
|
|
@@ -122,6 +427,7 @@ export class TablesDB extends Service {
|
|
|
122
427
|
const rowId = params.rowId;
|
|
123
428
|
const data = params.data;
|
|
124
429
|
const permissions = params.permissions;
|
|
430
|
+
const transactionId = params.transactionId;
|
|
125
431
|
|
|
126
432
|
if (typeof databaseId === 'undefined') {
|
|
127
433
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -154,6 +460,10 @@ export class TablesDB extends Service {
|
|
|
154
460
|
payload['permissions'] = permissions;
|
|
155
461
|
}
|
|
156
462
|
|
|
463
|
+
if (typeof transactionId !== 'undefined') {
|
|
464
|
+
payload['transactionId'] = transactionId;
|
|
465
|
+
}
|
|
466
|
+
|
|
157
467
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
158
468
|
return this.client.call('post', uri, {
|
|
159
469
|
'content-type': 'application/json',
|
|
@@ -167,10 +477,11 @@ export class TablesDB extends Service {
|
|
|
167
477
|
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
168
478
|
* @param {string} params.rowId - Row ID.
|
|
169
479
|
* @param {string[]} params.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.
|
|
480
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
170
481
|
* @throws {AppwriteException}
|
|
171
482
|
* @returns {Promise}
|
|
172
483
|
*/
|
|
173
|
-
getRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, queries?: string[] }): Promise<Row>;
|
|
484
|
+
getRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise<Row>;
|
|
174
485
|
/**
|
|
175
486
|
* Get a row by its unique ID. This endpoint response returns a JSON object with the row data.
|
|
176
487
|
*
|
|
@@ -178,25 +489,27 @@ export class TablesDB extends Service {
|
|
|
178
489
|
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
179
490
|
* @param {string} rowId - Row ID.
|
|
180
491
|
* @param {string[]} 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.
|
|
492
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
181
493
|
* @throws {AppwriteException}
|
|
182
494
|
* @returns {Promise<Row>}
|
|
183
495
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
184
496
|
*/
|
|
185
|
-
getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[]): Promise<Row>;
|
|
497
|
+
getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string): Promise<Row>;
|
|
186
498
|
getRow<Row extends Models.Row = Models.DefaultRow>(
|
|
187
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[] } | string,
|
|
188
|
-
...rest: [(string)?, (string)?, (string[])?]
|
|
499
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string } | string,
|
|
500
|
+
...rest: [(string)?, (string)?, (string[])?, (string)?]
|
|
189
501
|
): Promise<Row> {
|
|
190
|
-
let params: { databaseId: string, tableId: string, rowId: string, queries?: string[] };
|
|
502
|
+
let params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string };
|
|
191
503
|
|
|
192
504
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
193
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[] };
|
|
505
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string };
|
|
194
506
|
} else {
|
|
195
507
|
params = {
|
|
196
508
|
databaseId: paramsOrFirst as string,
|
|
197
509
|
tableId: rest[0] as string,
|
|
198
510
|
rowId: rest[1] as string,
|
|
199
|
-
queries: rest[2] as string[]
|
|
511
|
+
queries: rest[2] as string[],
|
|
512
|
+
transactionId: rest[3] as string
|
|
200
513
|
};
|
|
201
514
|
}
|
|
202
515
|
|
|
@@ -204,6 +517,7 @@ export class TablesDB extends Service {
|
|
|
204
517
|
const tableId = params.tableId;
|
|
205
518
|
const rowId = params.rowId;
|
|
206
519
|
const queries = params.queries;
|
|
520
|
+
const transactionId = params.transactionId;
|
|
207
521
|
|
|
208
522
|
if (typeof databaseId === 'undefined') {
|
|
209
523
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -224,6 +538,10 @@ export class TablesDB extends Service {
|
|
|
224
538
|
payload['queries'] = queries;
|
|
225
539
|
}
|
|
226
540
|
|
|
541
|
+
if (typeof transactionId !== 'undefined') {
|
|
542
|
+
payload['transactionId'] = transactionId;
|
|
543
|
+
}
|
|
544
|
+
|
|
227
545
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
228
546
|
return this.client.call('get', uri, {
|
|
229
547
|
}, payload);
|
|
@@ -237,10 +555,11 @@ export class TablesDB extends Service {
|
|
|
237
555
|
* @param {string} params.rowId - Row ID.
|
|
238
556
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} params.data - Row data as JSON object. Include all required columns of the row to be created or updated.
|
|
239
557
|
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
558
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
240
559
|
* @throws {AppwriteException}
|
|
241
560
|
* @returns {Promise}
|
|
242
561
|
*/
|
|
243
|
-
upsertRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] }): Promise<Row>;
|
|
562
|
+
upsertRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }): Promise<Row>;
|
|
244
563
|
/**
|
|
245
564
|
* Create or update a Row. Before using this route, you should create a new table resource using either a [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable) API or directly from your database console.
|
|
246
565
|
*
|
|
@@ -249,26 +568,28 @@ export class TablesDB extends Service {
|
|
|
249
568
|
* @param {string} rowId - Row ID.
|
|
250
569
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} data - Row data as JSON object. Include all required columns of the row to be created or updated.
|
|
251
570
|
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
571
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
252
572
|
* @throws {AppwriteException}
|
|
253
573
|
* @returns {Promise<Row>}
|
|
254
574
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
255
575
|
*/
|
|
256
|
-
upsertRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[]): Promise<Row>;
|
|
576
|
+
upsertRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string): Promise<Row>;
|
|
257
577
|
upsertRow<Row extends Models.Row = Models.DefaultRow>(
|
|
258
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] } | string,
|
|
259
|
-
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?]
|
|
578
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string } | string,
|
|
579
|
+
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?, (string)?]
|
|
260
580
|
): Promise<Row> {
|
|
261
|
-
let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] };
|
|
581
|
+
let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string };
|
|
262
582
|
|
|
263
583
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
264
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] };
|
|
584
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string };
|
|
265
585
|
} else {
|
|
266
586
|
params = {
|
|
267
587
|
databaseId: paramsOrFirst as string,
|
|
268
588
|
tableId: rest[0] as string,
|
|
269
589
|
rowId: rest[1] as string,
|
|
270
590
|
data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>,
|
|
271
|
-
permissions: rest[3] as string[]
|
|
591
|
+
permissions: rest[3] as string[],
|
|
592
|
+
transactionId: rest[4] as string
|
|
272
593
|
};
|
|
273
594
|
}
|
|
274
595
|
|
|
@@ -277,6 +598,7 @@ export class TablesDB extends Service {
|
|
|
277
598
|
const rowId = params.rowId;
|
|
278
599
|
const data = params.data;
|
|
279
600
|
const permissions = params.permissions;
|
|
601
|
+
const transactionId = params.transactionId;
|
|
280
602
|
|
|
281
603
|
if (typeof databaseId === 'undefined') {
|
|
282
604
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -301,6 +623,10 @@ export class TablesDB extends Service {
|
|
|
301
623
|
payload['permissions'] = permissions;
|
|
302
624
|
}
|
|
303
625
|
|
|
626
|
+
if (typeof transactionId !== 'undefined') {
|
|
627
|
+
payload['transactionId'] = transactionId;
|
|
628
|
+
}
|
|
629
|
+
|
|
304
630
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
305
631
|
return this.client.call('put', uri, {
|
|
306
632
|
'content-type': 'application/json',
|
|
@@ -315,10 +641,11 @@ export class TablesDB extends Service {
|
|
|
315
641
|
* @param {string} params.rowId - Row ID.
|
|
316
642
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} params.data - Row data as JSON object. Include only columns and value pairs to be updated.
|
|
317
643
|
* @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
644
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
318
645
|
* @throws {AppwriteException}
|
|
319
646
|
* @returns {Promise}
|
|
320
647
|
*/
|
|
321
|
-
updateRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] }): Promise<Row>;
|
|
648
|
+
updateRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string }): Promise<Row>;
|
|
322
649
|
/**
|
|
323
650
|
* Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
324
651
|
*
|
|
@@ -327,26 +654,28 @@ export class TablesDB extends Service {
|
|
|
327
654
|
* @param {string} rowId - Row ID.
|
|
328
655
|
* @param {Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>} data - Row data as JSON object. Include only columns and value pairs to be updated.
|
|
329
656
|
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
657
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
330
658
|
* @throws {AppwriteException}
|
|
331
659
|
* @returns {Promise<Row>}
|
|
332
660
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
333
661
|
*/
|
|
334
|
-
updateRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[]): Promise<Row>;
|
|
662
|
+
updateRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string): Promise<Row>;
|
|
335
663
|
updateRow<Row extends Models.Row = Models.DefaultRow>(
|
|
336
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] } | string,
|
|
337
|
-
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?]
|
|
664
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string } | string,
|
|
665
|
+
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>)?, (string[])?, (string)?]
|
|
338
666
|
): Promise<Row> {
|
|
339
|
-
let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] };
|
|
667
|
+
let params: { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string };
|
|
340
668
|
|
|
341
669
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
342
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[] };
|
|
670
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, data?: Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>, permissions?: string[], transactionId?: string };
|
|
343
671
|
} else {
|
|
344
672
|
params = {
|
|
345
673
|
databaseId: paramsOrFirst as string,
|
|
346
674
|
tableId: rest[0] as string,
|
|
347
675
|
rowId: rest[1] as string,
|
|
348
676
|
data: rest[2] as Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Partial<Omit<Row, keyof Models.Row>>,
|
|
349
|
-
permissions: rest[3] as string[]
|
|
677
|
+
permissions: rest[3] as string[],
|
|
678
|
+
transactionId: rest[4] as string
|
|
350
679
|
};
|
|
351
680
|
}
|
|
352
681
|
|
|
@@ -355,6 +684,7 @@ export class TablesDB extends Service {
|
|
|
355
684
|
const rowId = params.rowId;
|
|
356
685
|
const data = params.data;
|
|
357
686
|
const permissions = params.permissions;
|
|
687
|
+
const transactionId = params.transactionId;
|
|
358
688
|
|
|
359
689
|
if (typeof databaseId === 'undefined') {
|
|
360
690
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -379,6 +709,10 @@ export class TablesDB extends Service {
|
|
|
379
709
|
payload['permissions'] = permissions;
|
|
380
710
|
}
|
|
381
711
|
|
|
712
|
+
if (typeof transactionId !== 'undefined') {
|
|
713
|
+
payload['transactionId'] = transactionId;
|
|
714
|
+
}
|
|
715
|
+
|
|
382
716
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
383
717
|
return this.client.call('patch', uri, {
|
|
384
718
|
'content-type': 'application/json',
|
|
@@ -391,40 +725,44 @@ export class TablesDB extends Service {
|
|
|
391
725
|
* @param {string} params.databaseId - Database ID.
|
|
392
726
|
* @param {string} params.tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
393
727
|
* @param {string} params.rowId - Row ID.
|
|
728
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
394
729
|
* @throws {AppwriteException}
|
|
395
730
|
* @returns {Promise}
|
|
396
731
|
*/
|
|
397
|
-
deleteRow(params: { databaseId: string, tableId: string, rowId: string }): Promise<{}>;
|
|
732
|
+
deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>;
|
|
398
733
|
/**
|
|
399
734
|
* Delete a row by its unique ID.
|
|
400
735
|
*
|
|
401
736
|
* @param {string} databaseId - Database ID.
|
|
402
737
|
* @param {string} tableId - Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
|
|
403
738
|
* @param {string} rowId - Row ID.
|
|
739
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
404
740
|
* @throws {AppwriteException}
|
|
405
741
|
* @returns {Promise<{}>}
|
|
406
742
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
407
743
|
*/
|
|
408
|
-
deleteRow(databaseId: string, tableId: string, rowId: string): Promise<{}>;
|
|
744
|
+
deleteRow(databaseId: string, tableId: string, rowId: string, transactionId?: string): Promise<{}>;
|
|
409
745
|
deleteRow(
|
|
410
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string } | string,
|
|
411
|
-
...rest: [(string)?, (string)?]
|
|
746
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, transactionId?: string } | string,
|
|
747
|
+
...rest: [(string)?, (string)?, (string)?]
|
|
412
748
|
): Promise<{}> {
|
|
413
|
-
let params: { databaseId: string, tableId: string, rowId: string };
|
|
749
|
+
let params: { databaseId: string, tableId: string, rowId: string, transactionId?: string };
|
|
414
750
|
|
|
415
751
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
416
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string };
|
|
752
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, transactionId?: string };
|
|
417
753
|
} else {
|
|
418
754
|
params = {
|
|
419
755
|
databaseId: paramsOrFirst as string,
|
|
420
756
|
tableId: rest[0] as string,
|
|
421
|
-
rowId: rest[1] as string
|
|
757
|
+
rowId: rest[1] as string,
|
|
758
|
+
transactionId: rest[2] as string
|
|
422
759
|
};
|
|
423
760
|
}
|
|
424
761
|
|
|
425
762
|
const databaseId = params.databaseId;
|
|
426
763
|
const tableId = params.tableId;
|
|
427
764
|
const rowId = params.rowId;
|
|
765
|
+
const transactionId = params.transactionId;
|
|
428
766
|
|
|
429
767
|
if (typeof databaseId === 'undefined') {
|
|
430
768
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -441,6 +779,10 @@ export class TablesDB extends Service {
|
|
|
441
779
|
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
442
780
|
const payload: Payload = {};
|
|
443
781
|
|
|
782
|
+
if (typeof transactionId !== 'undefined') {
|
|
783
|
+
payload['transactionId'] = transactionId;
|
|
784
|
+
}
|
|
785
|
+
|
|
444
786
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
445
787
|
return this.client.call('delete', uri, {
|
|
446
788
|
'content-type': 'application/json',
|
|
@@ -456,10 +798,11 @@ export class TablesDB extends Service {
|
|
|
456
798
|
* @param {string} params.column - Column key.
|
|
457
799
|
* @param {number} params.value - Value to increment the column by. The value must be a number.
|
|
458
800
|
* @param {number} params.min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
|
|
801
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
459
802
|
* @throws {AppwriteException}
|
|
460
803
|
* @returns {Promise}
|
|
461
804
|
*/
|
|
462
|
-
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number }): Promise<Row>;
|
|
805
|
+
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string }): Promise<Row>;
|
|
463
806
|
/**
|
|
464
807
|
* Decrement a specific column of a row by a given value.
|
|
465
808
|
*
|
|
@@ -469,19 +812,20 @@ export class TablesDB extends Service {
|
|
|
469
812
|
* @param {string} column - Column key.
|
|
470
813
|
* @param {number} value - Value to increment the column by. The value must be a number.
|
|
471
814
|
* @param {number} min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
|
|
815
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
472
816
|
* @throws {AppwriteException}
|
|
473
817
|
* @returns {Promise<Row>}
|
|
474
818
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
475
819
|
*/
|
|
476
|
-
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number): Promise<Row>;
|
|
820
|
+
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string): Promise<Row>;
|
|
477
821
|
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(
|
|
478
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number } | string,
|
|
479
|
-
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?]
|
|
822
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string } | string,
|
|
823
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?]
|
|
480
824
|
): Promise<Row> {
|
|
481
|
-
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number };
|
|
825
|
+
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string };
|
|
482
826
|
|
|
483
827
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
484
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number };
|
|
828
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string };
|
|
485
829
|
} else {
|
|
486
830
|
params = {
|
|
487
831
|
databaseId: paramsOrFirst as string,
|
|
@@ -489,7 +833,8 @@ export class TablesDB extends Service {
|
|
|
489
833
|
rowId: rest[1] as string,
|
|
490
834
|
column: rest[2] as string,
|
|
491
835
|
value: rest[3] as number,
|
|
492
|
-
min: rest[4] as number
|
|
836
|
+
min: rest[4] as number,
|
|
837
|
+
transactionId: rest[5] as string
|
|
493
838
|
};
|
|
494
839
|
}
|
|
495
840
|
|
|
@@ -499,6 +844,7 @@ export class TablesDB extends Service {
|
|
|
499
844
|
const column = params.column;
|
|
500
845
|
const value = params.value;
|
|
501
846
|
const min = params.min;
|
|
847
|
+
const transactionId = params.transactionId;
|
|
502
848
|
|
|
503
849
|
if (typeof databaseId === 'undefined') {
|
|
504
850
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -527,6 +873,10 @@ export class TablesDB extends Service {
|
|
|
527
873
|
payload['min'] = min;
|
|
528
874
|
}
|
|
529
875
|
|
|
876
|
+
if (typeof transactionId !== 'undefined') {
|
|
877
|
+
payload['transactionId'] = transactionId;
|
|
878
|
+
}
|
|
879
|
+
|
|
530
880
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
531
881
|
return this.client.call('patch', uri, {
|
|
532
882
|
'content-type': 'application/json',
|
|
@@ -542,10 +892,11 @@ export class TablesDB extends Service {
|
|
|
542
892
|
* @param {string} params.column - Column key.
|
|
543
893
|
* @param {number} params.value - Value to increment the column by. The value must be a number.
|
|
544
894
|
* @param {number} params.max - Maximum value for the column. If the current value is greater than this value, an error will be thrown.
|
|
895
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
545
896
|
* @throws {AppwriteException}
|
|
546
897
|
* @returns {Promise}
|
|
547
898
|
*/
|
|
548
|
-
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number }): Promise<Row>;
|
|
899
|
+
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string }): Promise<Row>;
|
|
549
900
|
/**
|
|
550
901
|
* Increment a specific column of a row by a given value.
|
|
551
902
|
*
|
|
@@ -555,19 +906,20 @@ export class TablesDB extends Service {
|
|
|
555
906
|
* @param {string} column - Column key.
|
|
556
907
|
* @param {number} value - Value to increment the column by. The value must be a number.
|
|
557
908
|
* @param {number} max - Maximum value for the column. If the current value is greater than this value, an error will be thrown.
|
|
909
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
558
910
|
* @throws {AppwriteException}
|
|
559
911
|
* @returns {Promise<Row>}
|
|
560
912
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
561
913
|
*/
|
|
562
|
-
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number): Promise<Row>;
|
|
914
|
+
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string): Promise<Row>;
|
|
563
915
|
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(
|
|
564
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number } | string,
|
|
565
|
-
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?]
|
|
916
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string } | string,
|
|
917
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?]
|
|
566
918
|
): Promise<Row> {
|
|
567
|
-
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number };
|
|
919
|
+
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string };
|
|
568
920
|
|
|
569
921
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
570
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number };
|
|
922
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string };
|
|
571
923
|
} else {
|
|
572
924
|
params = {
|
|
573
925
|
databaseId: paramsOrFirst as string,
|
|
@@ -575,7 +927,8 @@ export class TablesDB extends Service {
|
|
|
575
927
|
rowId: rest[1] as string,
|
|
576
928
|
column: rest[2] as string,
|
|
577
929
|
value: rest[3] as number,
|
|
578
|
-
max: rest[4] as number
|
|
930
|
+
max: rest[4] as number,
|
|
931
|
+
transactionId: rest[5] as string
|
|
579
932
|
};
|
|
580
933
|
}
|
|
581
934
|
|
|
@@ -585,6 +938,7 @@ export class TablesDB extends Service {
|
|
|
585
938
|
const column = params.column;
|
|
586
939
|
const value = params.value;
|
|
587
940
|
const max = params.max;
|
|
941
|
+
const transactionId = params.transactionId;
|
|
588
942
|
|
|
589
943
|
if (typeof databaseId === 'undefined') {
|
|
590
944
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -613,6 +967,10 @@ export class TablesDB extends Service {
|
|
|
613
967
|
payload['max'] = max;
|
|
614
968
|
}
|
|
615
969
|
|
|
970
|
+
if (typeof transactionId !== 'undefined') {
|
|
971
|
+
payload['transactionId'] = transactionId;
|
|
972
|
+
}
|
|
973
|
+
|
|
616
974
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
617
975
|
return this.client.call('patch', uri, {
|
|
618
976
|
'content-type': 'application/json',
|