react-native-appwrite 0.16.0 → 0.18.0
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 +9 -0
- package/dist/cjs/sdk.js +707 -31
- package/dist/cjs/sdk.js.map +1 -1
- package/dist/esm/sdk.js +707 -32
- package/dist/esm/sdk.js.map +1 -1
- package/docs/examples/account/list-identities.md +2 -1
- package/docs/examples/account/list-logs.md +2 -1
- package/docs/examples/databases/create-document.md +3 -2
- 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 +3 -1
- package/docs/examples/databases/list-transactions.md +13 -0
- package/docs/examples/databases/update-document.md +3 -2
- package/docs/examples/databases/update-transaction.md +15 -0
- package/docs/examples/databases/upsert-document.md +3 -2
- package/docs/examples/functions/list-executions.md +2 -1
- package/docs/examples/storage/create-file.md +1 -1
- package/docs/examples/storage/list-files.md +2 -1
- package/docs/examples/storage/update-file.md +1 -1
- package/docs/examples/tablesdb/create-operations.md +24 -0
- package/docs/examples/tablesdb/create-row.md +3 -2
- 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 +3 -1
- package/docs/examples/tablesdb/list-transactions.md +13 -0
- package/docs/examples/tablesdb/update-row.md +3 -2
- package/docs/examples/tablesdb/update-transaction.md +15 -0
- package/docs/examples/tablesdb/upsert-row.md +3 -2
- package/docs/examples/teams/list-memberships.md +2 -1
- package/docs/examples/teams/list.md +2 -1
- package/package.json +2 -3
- package/src/client.ts +1 -1
- package/src/enums/execution-status.ts +1 -0
- package/src/index.ts +3 -0
- package/src/models.ts +45 -1
- package/src/operator.ts +308 -0
- package/src/query.ts +6 -6
- package/src/services/account.ts +30 -12
- package/src/services/databases.ts +422 -56
- package/src/services/functions.ts +15 -7
- package/src/services/storage.ts +15 -7
- package/src/services/tables-db.ts +422 -56
- package/src/services/teams.ts +30 -14
- package/types/enums/execution-status.d.ts +2 -1
- package/types/index.d.ts +3 -0
- package/types/models.d.ts +43 -1
- package/types/operator.d.ts +180 -0
- package/types/services/account.d.ts +8 -2
- package/types/services/databases.d.ts +158 -8
- package/types/services/functions.d.ts +4 -1
- package/types/services/storage.d.ts +4 -1
- package/types/services/tables-db.d.ts +158 -8
- package/types/services/teams.d.ts +8 -2
|
@@ -13,46 +13,348 @@ 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.
|
|
317
|
+
* @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
22
318
|
* @throws {AppwriteException}
|
|
23
319
|
* @returns {Promise}
|
|
24
320
|
*/
|
|
25
|
-
listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[] }): Promise<Models.RowList<Row>>;
|
|
321
|
+
listRows<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean }): Promise<Models.RowList<Row>>;
|
|
26
322
|
/**
|
|
27
323
|
* Get a list of all the user's rows in a given table. You can use the query params to filter your results.
|
|
28
324
|
*
|
|
29
325
|
* @param {string} databaseId - Database ID.
|
|
30
326
|
* @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
327
|
* @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.
|
|
328
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
329
|
+
* @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
|
|
32
330
|
* @throws {AppwriteException}
|
|
33
331
|
* @returns {Promise<Models.RowList<Row>>}
|
|
34
332
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
35
333
|
*/
|
|
36
|
-
listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[]): Promise<Models.RowList<Row>>;
|
|
334
|
+
listRows<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean): Promise<Models.RowList<Row>>;
|
|
37
335
|
listRows<Row extends Models.Row = Models.DefaultRow>(
|
|
38
|
-
paramsOrFirst: { databaseId: string, tableId: string, queries?: string[] } | string,
|
|
39
|
-
...rest: [(string)?, (string[])?]
|
|
336
|
+
paramsOrFirst: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean } | string,
|
|
337
|
+
...rest: [(string)?, (string[])?, (string)?, (boolean)?]
|
|
40
338
|
): Promise<Models.RowList<Row>> {
|
|
41
|
-
let params: { databaseId: string, tableId: string, queries?: string[] };
|
|
339
|
+
let params: { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean };
|
|
42
340
|
|
|
43
341
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
44
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[] };
|
|
342
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, queries?: string[], transactionId?: string, total?: boolean };
|
|
45
343
|
} else {
|
|
46
344
|
params = {
|
|
47
345
|
databaseId: paramsOrFirst as string,
|
|
48
346
|
tableId: rest[0] as string,
|
|
49
|
-
queries: rest[1] as string[]
|
|
347
|
+
queries: rest[1] as string[],
|
|
348
|
+
transactionId: rest[2] as string,
|
|
349
|
+
total: rest[3] as boolean
|
|
50
350
|
};
|
|
51
351
|
}
|
|
52
352
|
|
|
53
353
|
const databaseId = params.databaseId;
|
|
54
354
|
const tableId = params.tableId;
|
|
55
355
|
const queries = params.queries;
|
|
356
|
+
const transactionId = params.transactionId;
|
|
357
|
+
const total = params.total;
|
|
56
358
|
|
|
57
359
|
if (typeof databaseId === 'undefined') {
|
|
58
360
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -69,6 +371,14 @@ export class TablesDB extends Service {
|
|
|
69
371
|
payload['queries'] = queries;
|
|
70
372
|
}
|
|
71
373
|
|
|
374
|
+
if (typeof transactionId !== 'undefined') {
|
|
375
|
+
payload['transactionId'] = transactionId;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
if (typeof total !== 'undefined') {
|
|
379
|
+
payload['total'] = total;
|
|
380
|
+
}
|
|
381
|
+
|
|
72
382
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
73
383
|
return this.client.call('get', uri, {
|
|
74
384
|
}, payload);
|
|
@@ -82,10 +392,11 @@ export class TablesDB extends Service {
|
|
|
82
392
|
* @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
393
|
* @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
394
|
* @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).
|
|
395
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
85
396
|
* @throws {AppwriteException}
|
|
86
397
|
* @returns {Promise}
|
|
87
398
|
*/
|
|
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>;
|
|
399
|
+
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
400
|
/**
|
|
90
401
|
* 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
402
|
*
|
|
@@ -94,26 +405,28 @@ export class TablesDB extends Service {
|
|
|
94
405
|
* @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
406
|
* @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
407
|
* @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).
|
|
408
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
97
409
|
* @throws {AppwriteException}
|
|
98
410
|
* @returns {Promise<Row>}
|
|
99
411
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
100
412
|
*/
|
|
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>;
|
|
413
|
+
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
414
|
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[])?]
|
|
415
|
+
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,
|
|
416
|
+
...rest: [(string)?, (string)?, (Row extends Models.DefaultRow ? Partial<Models.Row> & Record<string, any> : Partial<Models.Row> & Omit<Row, keyof Models.Row>)?, (string[])?, (string)?]
|
|
105
417
|
): 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[] };
|
|
418
|
+
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
419
|
|
|
108
420
|
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[] };
|
|
421
|
+
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
422
|
} else {
|
|
111
423
|
params = {
|
|
112
424
|
databaseId: paramsOrFirst as string,
|
|
113
425
|
tableId: rest[0] as string,
|
|
114
426
|
rowId: rest[1] as string,
|
|
115
427
|
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[]
|
|
428
|
+
permissions: rest[3] as string[],
|
|
429
|
+
transactionId: rest[4] as string
|
|
117
430
|
};
|
|
118
431
|
}
|
|
119
432
|
|
|
@@ -122,6 +435,7 @@ export class TablesDB extends Service {
|
|
|
122
435
|
const rowId = params.rowId;
|
|
123
436
|
const data = params.data;
|
|
124
437
|
const permissions = params.permissions;
|
|
438
|
+
const transactionId = params.transactionId;
|
|
125
439
|
|
|
126
440
|
if (typeof databaseId === 'undefined') {
|
|
127
441
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -154,6 +468,10 @@ export class TablesDB extends Service {
|
|
|
154
468
|
payload['permissions'] = permissions;
|
|
155
469
|
}
|
|
156
470
|
|
|
471
|
+
if (typeof transactionId !== 'undefined') {
|
|
472
|
+
payload['transactionId'] = transactionId;
|
|
473
|
+
}
|
|
474
|
+
|
|
157
475
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
158
476
|
return this.client.call('post', uri, {
|
|
159
477
|
'content-type': 'application/json',
|
|
@@ -167,10 +485,11 @@ export class TablesDB extends Service {
|
|
|
167
485
|
* @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
486
|
* @param {string} params.rowId - Row ID.
|
|
169
487
|
* @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.
|
|
488
|
+
* @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
170
489
|
* @throws {AppwriteException}
|
|
171
490
|
* @returns {Promise}
|
|
172
491
|
*/
|
|
173
|
-
getRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, queries?: string[] }): Promise<Row>;
|
|
492
|
+
getRow<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string }): Promise<Row>;
|
|
174
493
|
/**
|
|
175
494
|
* Get a row by its unique ID. This endpoint response returns a JSON object with the row data.
|
|
176
495
|
*
|
|
@@ -178,25 +497,27 @@ export class TablesDB extends Service {
|
|
|
178
497
|
* @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
498
|
* @param {string} rowId - Row ID.
|
|
180
499
|
* @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.
|
|
500
|
+
* @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
|
|
181
501
|
* @throws {AppwriteException}
|
|
182
502
|
* @returns {Promise<Row>}
|
|
183
503
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
184
504
|
*/
|
|
185
|
-
getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[]): Promise<Row>;
|
|
505
|
+
getRow<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string): Promise<Row>;
|
|
186
506
|
getRow<Row extends Models.Row = Models.DefaultRow>(
|
|
187
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[] } | string,
|
|
188
|
-
...rest: [(string)?, (string)?, (string[])?]
|
|
507
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string } | string,
|
|
508
|
+
...rest: [(string)?, (string)?, (string[])?, (string)?]
|
|
189
509
|
): Promise<Row> {
|
|
190
|
-
let params: { databaseId: string, tableId: string, rowId: string, queries?: string[] };
|
|
510
|
+
let params: { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string };
|
|
191
511
|
|
|
192
512
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
193
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[] };
|
|
513
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, queries?: string[], transactionId?: string };
|
|
194
514
|
} else {
|
|
195
515
|
params = {
|
|
196
516
|
databaseId: paramsOrFirst as string,
|
|
197
517
|
tableId: rest[0] as string,
|
|
198
518
|
rowId: rest[1] as string,
|
|
199
|
-
queries: rest[2] as string[]
|
|
519
|
+
queries: rest[2] as string[],
|
|
520
|
+
transactionId: rest[3] as string
|
|
200
521
|
};
|
|
201
522
|
}
|
|
202
523
|
|
|
@@ -204,6 +525,7 @@ export class TablesDB extends Service {
|
|
|
204
525
|
const tableId = params.tableId;
|
|
205
526
|
const rowId = params.rowId;
|
|
206
527
|
const queries = params.queries;
|
|
528
|
+
const transactionId = params.transactionId;
|
|
207
529
|
|
|
208
530
|
if (typeof databaseId === 'undefined') {
|
|
209
531
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -224,6 +546,10 @@ export class TablesDB extends Service {
|
|
|
224
546
|
payload['queries'] = queries;
|
|
225
547
|
}
|
|
226
548
|
|
|
549
|
+
if (typeof transactionId !== 'undefined') {
|
|
550
|
+
payload['transactionId'] = transactionId;
|
|
551
|
+
}
|
|
552
|
+
|
|
227
553
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
228
554
|
return this.client.call('get', uri, {
|
|
229
555
|
}, payload);
|
|
@@ -237,10 +563,11 @@ export class TablesDB extends Service {
|
|
|
237
563
|
* @param {string} params.rowId - Row ID.
|
|
238
564
|
* @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
565
|
* @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).
|
|
566
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
240
567
|
* @throws {AppwriteException}
|
|
241
568
|
* @returns {Promise}
|
|
242
569
|
*/
|
|
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>;
|
|
570
|
+
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
571
|
/**
|
|
245
572
|
* 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
573
|
*
|
|
@@ -249,26 +576,28 @@ export class TablesDB extends Service {
|
|
|
249
576
|
* @param {string} rowId - Row ID.
|
|
250
577
|
* @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
578
|
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
579
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
252
580
|
* @throws {AppwriteException}
|
|
253
581
|
* @returns {Promise<Row>}
|
|
254
582
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
255
583
|
*/
|
|
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>;
|
|
584
|
+
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
585
|
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[])?]
|
|
586
|
+
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,
|
|
587
|
+
...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
588
|
): 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[] };
|
|
589
|
+
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
590
|
|
|
263
591
|
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[] };
|
|
592
|
+
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
593
|
} else {
|
|
266
594
|
params = {
|
|
267
595
|
databaseId: paramsOrFirst as string,
|
|
268
596
|
tableId: rest[0] as string,
|
|
269
597
|
rowId: rest[1] as string,
|
|
270
598
|
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[]
|
|
599
|
+
permissions: rest[3] as string[],
|
|
600
|
+
transactionId: rest[4] as string
|
|
272
601
|
};
|
|
273
602
|
}
|
|
274
603
|
|
|
@@ -277,6 +606,7 @@ export class TablesDB extends Service {
|
|
|
277
606
|
const rowId = params.rowId;
|
|
278
607
|
const data = params.data;
|
|
279
608
|
const permissions = params.permissions;
|
|
609
|
+
const transactionId = params.transactionId;
|
|
280
610
|
|
|
281
611
|
if (typeof databaseId === 'undefined') {
|
|
282
612
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -301,6 +631,10 @@ export class TablesDB extends Service {
|
|
|
301
631
|
payload['permissions'] = permissions;
|
|
302
632
|
}
|
|
303
633
|
|
|
634
|
+
if (typeof transactionId !== 'undefined') {
|
|
635
|
+
payload['transactionId'] = transactionId;
|
|
636
|
+
}
|
|
637
|
+
|
|
304
638
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
305
639
|
return this.client.call('put', uri, {
|
|
306
640
|
'content-type': 'application/json',
|
|
@@ -315,10 +649,11 @@ export class TablesDB extends Service {
|
|
|
315
649
|
* @param {string} params.rowId - Row ID.
|
|
316
650
|
* @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
651
|
* @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).
|
|
652
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
318
653
|
* @throws {AppwriteException}
|
|
319
654
|
* @returns {Promise}
|
|
320
655
|
*/
|
|
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>;
|
|
656
|
+
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
657
|
/**
|
|
323
658
|
* Update a row by its unique ID. Using the patch method you can pass only specific fields that will get updated.
|
|
324
659
|
*
|
|
@@ -327,26 +662,28 @@ export class TablesDB extends Service {
|
|
|
327
662
|
* @param {string} rowId - Row ID.
|
|
328
663
|
* @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
664
|
* @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
|
|
665
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
330
666
|
* @throws {AppwriteException}
|
|
331
667
|
* @returns {Promise<Row>}
|
|
332
668
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
333
669
|
*/
|
|
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>;
|
|
670
|
+
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
671
|
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[])?]
|
|
672
|
+
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,
|
|
673
|
+
...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
674
|
): 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[] };
|
|
675
|
+
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
676
|
|
|
341
677
|
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[] };
|
|
678
|
+
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
679
|
} else {
|
|
344
680
|
params = {
|
|
345
681
|
databaseId: paramsOrFirst as string,
|
|
346
682
|
tableId: rest[0] as string,
|
|
347
683
|
rowId: rest[1] as string,
|
|
348
684
|
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[]
|
|
685
|
+
permissions: rest[3] as string[],
|
|
686
|
+
transactionId: rest[4] as string
|
|
350
687
|
};
|
|
351
688
|
}
|
|
352
689
|
|
|
@@ -355,6 +692,7 @@ export class TablesDB extends Service {
|
|
|
355
692
|
const rowId = params.rowId;
|
|
356
693
|
const data = params.data;
|
|
357
694
|
const permissions = params.permissions;
|
|
695
|
+
const transactionId = params.transactionId;
|
|
358
696
|
|
|
359
697
|
if (typeof databaseId === 'undefined') {
|
|
360
698
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -379,6 +717,10 @@ export class TablesDB extends Service {
|
|
|
379
717
|
payload['permissions'] = permissions;
|
|
380
718
|
}
|
|
381
719
|
|
|
720
|
+
if (typeof transactionId !== 'undefined') {
|
|
721
|
+
payload['transactionId'] = transactionId;
|
|
722
|
+
}
|
|
723
|
+
|
|
382
724
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
383
725
|
return this.client.call('patch', uri, {
|
|
384
726
|
'content-type': 'application/json',
|
|
@@ -391,40 +733,44 @@ export class TablesDB extends Service {
|
|
|
391
733
|
* @param {string} params.databaseId - Database ID.
|
|
392
734
|
* @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
735
|
* @param {string} params.rowId - Row ID.
|
|
736
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
394
737
|
* @throws {AppwriteException}
|
|
395
738
|
* @returns {Promise}
|
|
396
739
|
*/
|
|
397
|
-
deleteRow(params: { databaseId: string, tableId: string, rowId: string }): Promise<{}>;
|
|
740
|
+
deleteRow(params: { databaseId: string, tableId: string, rowId: string, transactionId?: string }): Promise<{}>;
|
|
398
741
|
/**
|
|
399
742
|
* Delete a row by its unique ID.
|
|
400
743
|
*
|
|
401
744
|
* @param {string} databaseId - Database ID.
|
|
402
745
|
* @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
746
|
* @param {string} rowId - Row ID.
|
|
747
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
404
748
|
* @throws {AppwriteException}
|
|
405
749
|
* @returns {Promise<{}>}
|
|
406
750
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
407
751
|
*/
|
|
408
|
-
deleteRow(databaseId: string, tableId: string, rowId: string): Promise<{}>;
|
|
752
|
+
deleteRow(databaseId: string, tableId: string, rowId: string, transactionId?: string): Promise<{}>;
|
|
409
753
|
deleteRow(
|
|
410
|
-
paramsOrFirst: { databaseId: string, tableId: string, rowId: string } | string,
|
|
411
|
-
...rest: [(string)?, (string)?]
|
|
754
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, transactionId?: string } | string,
|
|
755
|
+
...rest: [(string)?, (string)?, (string)?]
|
|
412
756
|
): Promise<{}> {
|
|
413
|
-
let params: { databaseId: string, tableId: string, rowId: string };
|
|
757
|
+
let params: { databaseId: string, tableId: string, rowId: string, transactionId?: string };
|
|
414
758
|
|
|
415
759
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
416
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string };
|
|
760
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, transactionId?: string };
|
|
417
761
|
} else {
|
|
418
762
|
params = {
|
|
419
763
|
databaseId: paramsOrFirst as string,
|
|
420
764
|
tableId: rest[0] as string,
|
|
421
|
-
rowId: rest[1] as string
|
|
765
|
+
rowId: rest[1] as string,
|
|
766
|
+
transactionId: rest[2] as string
|
|
422
767
|
};
|
|
423
768
|
}
|
|
424
769
|
|
|
425
770
|
const databaseId = params.databaseId;
|
|
426
771
|
const tableId = params.tableId;
|
|
427
772
|
const rowId = params.rowId;
|
|
773
|
+
const transactionId = params.transactionId;
|
|
428
774
|
|
|
429
775
|
if (typeof databaseId === 'undefined') {
|
|
430
776
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -441,6 +787,10 @@ export class TablesDB extends Service {
|
|
|
441
787
|
const apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
|
|
442
788
|
const payload: Payload = {};
|
|
443
789
|
|
|
790
|
+
if (typeof transactionId !== 'undefined') {
|
|
791
|
+
payload['transactionId'] = transactionId;
|
|
792
|
+
}
|
|
793
|
+
|
|
444
794
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
445
795
|
return this.client.call('delete', uri, {
|
|
446
796
|
'content-type': 'application/json',
|
|
@@ -456,10 +806,11 @@ export class TablesDB extends Service {
|
|
|
456
806
|
* @param {string} params.column - Column key.
|
|
457
807
|
* @param {number} params.value - Value to increment the column by. The value must be a number.
|
|
458
808
|
* @param {number} params.min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
|
|
809
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
459
810
|
* @throws {AppwriteException}
|
|
460
811
|
* @returns {Promise}
|
|
461
812
|
*/
|
|
462
|
-
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number }): Promise<Row>;
|
|
813
|
+
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
814
|
/**
|
|
464
815
|
* Decrement a specific column of a row by a given value.
|
|
465
816
|
*
|
|
@@ -469,19 +820,20 @@ export class TablesDB extends Service {
|
|
|
469
820
|
* @param {string} column - Column key.
|
|
470
821
|
* @param {number} value - Value to increment the column by. The value must be a number.
|
|
471
822
|
* @param {number} min - Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
|
|
823
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
472
824
|
* @throws {AppwriteException}
|
|
473
825
|
* @returns {Promise<Row>}
|
|
474
826
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
475
827
|
*/
|
|
476
|
-
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number): Promise<Row>;
|
|
828
|
+
decrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string): Promise<Row>;
|
|
477
829
|
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)?]
|
|
830
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string } | string,
|
|
831
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?]
|
|
480
832
|
): Promise<Row> {
|
|
481
|
-
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number };
|
|
833
|
+
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string };
|
|
482
834
|
|
|
483
835
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
484
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number };
|
|
836
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, min?: number, transactionId?: string };
|
|
485
837
|
} else {
|
|
486
838
|
params = {
|
|
487
839
|
databaseId: paramsOrFirst as string,
|
|
@@ -489,7 +841,8 @@ export class TablesDB extends Service {
|
|
|
489
841
|
rowId: rest[1] as string,
|
|
490
842
|
column: rest[2] as string,
|
|
491
843
|
value: rest[3] as number,
|
|
492
|
-
min: rest[4] as number
|
|
844
|
+
min: rest[4] as number,
|
|
845
|
+
transactionId: rest[5] as string
|
|
493
846
|
};
|
|
494
847
|
}
|
|
495
848
|
|
|
@@ -499,6 +852,7 @@ export class TablesDB extends Service {
|
|
|
499
852
|
const column = params.column;
|
|
500
853
|
const value = params.value;
|
|
501
854
|
const min = params.min;
|
|
855
|
+
const transactionId = params.transactionId;
|
|
502
856
|
|
|
503
857
|
if (typeof databaseId === 'undefined') {
|
|
504
858
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -527,6 +881,10 @@ export class TablesDB extends Service {
|
|
|
527
881
|
payload['min'] = min;
|
|
528
882
|
}
|
|
529
883
|
|
|
884
|
+
if (typeof transactionId !== 'undefined') {
|
|
885
|
+
payload['transactionId'] = transactionId;
|
|
886
|
+
}
|
|
887
|
+
|
|
530
888
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
531
889
|
return this.client.call('patch', uri, {
|
|
532
890
|
'content-type': 'application/json',
|
|
@@ -542,10 +900,11 @@ export class TablesDB extends Service {
|
|
|
542
900
|
* @param {string} params.column - Column key.
|
|
543
901
|
* @param {number} params.value - Value to increment the column by. The value must be a number.
|
|
544
902
|
* @param {number} params.max - Maximum value for the column. If the current value is greater than this value, an error will be thrown.
|
|
903
|
+
* @param {string} params.transactionId - Transaction ID for staging the operation.
|
|
545
904
|
* @throws {AppwriteException}
|
|
546
905
|
* @returns {Promise}
|
|
547
906
|
*/
|
|
548
|
-
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number }): Promise<Row>;
|
|
907
|
+
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
908
|
/**
|
|
550
909
|
* Increment a specific column of a row by a given value.
|
|
551
910
|
*
|
|
@@ -555,19 +914,20 @@ export class TablesDB extends Service {
|
|
|
555
914
|
* @param {string} column - Column key.
|
|
556
915
|
* @param {number} value - Value to increment the column by. The value must be a number.
|
|
557
916
|
* @param {number} max - Maximum value for the column. If the current value is greater than this value, an error will be thrown.
|
|
917
|
+
* @param {string} transactionId - Transaction ID for staging the operation.
|
|
558
918
|
* @throws {AppwriteException}
|
|
559
919
|
* @returns {Promise<Row>}
|
|
560
920
|
* @deprecated Use the object parameter style method for a better developer experience.
|
|
561
921
|
*/
|
|
562
|
-
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number): Promise<Row>;
|
|
922
|
+
incrementRowColumn<Row extends Models.Row = Models.DefaultRow>(databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string): Promise<Row>;
|
|
563
923
|
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)?]
|
|
924
|
+
paramsOrFirst: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string } | string,
|
|
925
|
+
...rest: [(string)?, (string)?, (string)?, (number)?, (number)?, (string)?]
|
|
566
926
|
): Promise<Row> {
|
|
567
|
-
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number };
|
|
927
|
+
let params: { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string };
|
|
568
928
|
|
|
569
929
|
if ((paramsOrFirst && typeof paramsOrFirst === 'object' && !Array.isArray(paramsOrFirst))) {
|
|
570
|
-
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number };
|
|
930
|
+
params = (paramsOrFirst || {}) as { databaseId: string, tableId: string, rowId: string, column: string, value?: number, max?: number, transactionId?: string };
|
|
571
931
|
} else {
|
|
572
932
|
params = {
|
|
573
933
|
databaseId: paramsOrFirst as string,
|
|
@@ -575,7 +935,8 @@ export class TablesDB extends Service {
|
|
|
575
935
|
rowId: rest[1] as string,
|
|
576
936
|
column: rest[2] as string,
|
|
577
937
|
value: rest[3] as number,
|
|
578
|
-
max: rest[4] as number
|
|
938
|
+
max: rest[4] as number,
|
|
939
|
+
transactionId: rest[5] as string
|
|
579
940
|
};
|
|
580
941
|
}
|
|
581
942
|
|
|
@@ -585,6 +946,7 @@ export class TablesDB extends Service {
|
|
|
585
946
|
const column = params.column;
|
|
586
947
|
const value = params.value;
|
|
587
948
|
const max = params.max;
|
|
949
|
+
const transactionId = params.transactionId;
|
|
588
950
|
|
|
589
951
|
if (typeof databaseId === 'undefined') {
|
|
590
952
|
throw new AppwriteException('Missing required parameter: "databaseId"');
|
|
@@ -613,6 +975,10 @@ export class TablesDB extends Service {
|
|
|
613
975
|
payload['max'] = max;
|
|
614
976
|
}
|
|
615
977
|
|
|
978
|
+
if (typeof transactionId !== 'undefined') {
|
|
979
|
+
payload['transactionId'] = transactionId;
|
|
980
|
+
}
|
|
981
|
+
|
|
616
982
|
const uri = new URL(this.client.config.endpoint + apiPath);
|
|
617
983
|
return this.client.call('patch', uri, {
|
|
618
984
|
'content-type': 'application/json',
|