Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

## 20.2.0

* Add transaction support for Databases and TablesDB

## 20.1.0

* Deprecate `createVerification` method in `Account` service
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
appwrite: ^20.1.0
appwrite: ^20.2.0
```

You can install packages from the command line:
Expand Down
1 change: 1 addition & 0 deletions docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ Document result = await databases.createDocument(
"isAdmin": false
},
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
22 changes: 22 additions & 0 deletions docs/examples/databases/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Databases databases = Databases(client);

Transaction result = await databases.createOperations(
transactionId: '<TRANSACTION_ID>',
operations: [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"collectionId": "<COLLECTION_ID>",
"documentId": "<DOCUMENT_ID>",
"data": {
"name": "Walter O'Brien"
}
}
], // optional
);
11 changes: 11 additions & 0 deletions docs/examples/databases/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Databases databases = Databases(client);

Transaction result = await databases.createTransaction(
ttl: 60, // optional
);
1 change: 1 addition & 0 deletions docs/examples/databases/decrement-document-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Document result = await databases.decrementDocumentAttribute(
attribute: '',
value: 0, // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>', // optional
);
1 change: 1 addition & 0 deletions docs/examples/databases/delete-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ await databases.deleteDocument(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>', // optional
);
11 changes: 11 additions & 0 deletions docs/examples/databases/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Databases databases = Databases(client);

await databases.deleteTransaction(
transactionId: '<TRANSACTION_ID>',
);
1 change: 1 addition & 0 deletions docs/examples/databases/get-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Document result = await databases.getDocument(
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
11 changes: 11 additions & 0 deletions docs/examples/databases/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Databases databases = Databases(client);

Transaction result = await databases.getTransaction(
transactionId: '<TRANSACTION_ID>',
);
1 change: 1 addition & 0 deletions docs/examples/databases/increment-document-attribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Document result = await databases.incrementDocumentAttribute(
attribute: '',
value: 0, // optional
max: 0, // optional
transactionId: '<TRANSACTION_ID>', // optional
);
1 change: 1 addition & 0 deletions docs/examples/databases/list-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ DocumentList result = await databases.listDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
11 changes: 11 additions & 0 deletions docs/examples/databases/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Databases databases = Databases(client);

TransactionList result = await databases.listTransactions(
queries: [], // optional
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Document result = await databases.updateDocument(
documentId: '<DOCUMENT_ID>',
data: {}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
13 changes: 13 additions & 0 deletions docs/examples/databases/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

Databases databases = Databases(client);

Transaction result = await databases.updateTransaction(
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false, // optional
);
1 change: 1 addition & 0 deletions docs/examples/databases/upsert-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Document result = await databases.upsertDocument(
documentId: '<DOCUMENT_ID>',
data: {},
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
22 changes: 22 additions & 0 deletions docs/examples/tablesdb/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

TablesDB tablesDB = TablesDB(client);

Transaction result = await tablesDB.createOperations(
transactionId: '<TRANSACTION_ID>',
operations: [
{
"action": "create",
"databaseId": "<DATABASE_ID>",
"tableId": "<TABLE_ID>",
"rowId": "<ROW_ID>",
"data": {
"name": "Walter O'Brien"
}
}
], // optional
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/create-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ Row result = await tablesDB.createRow(
"isAdmin": false
},
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>', // optional
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix hard tab character.

The static analysis tool flagged a hard tab character on this line. For consistency with the rest of the codebase, use spaces for indentation.

Replace the hard tab with spaces to match the indentation of surrounding lines.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

21-21: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In docs/examples/tablesdb/create-row.md around line 21, the line contains a hard
tab character for indentation ("transactionId: '<TRANSACTION_ID>', //
optional"); replace the hard tab with spaces to match surrounding lines'
indentation (use the project's standard number of spaces, e.g., 2 or 4) so the
file uses spaces consistently and the static analysis warning is resolved.

);
11 changes: 11 additions & 0 deletions docs/examples/tablesdb/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

TablesDB tablesDB = TablesDB(client);

Transaction result = await tablesDB.createTransaction(
ttl: 60, // optional
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/decrement-row-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Row result = await tablesDB.decrementRowColumn(
column: '',
value: 0, // optional
min: 0, // optional
transactionId: '<TRANSACTION_ID>', // optional
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/delete-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ await tablesDB.deleteRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
transactionId: '<TRANSACTION_ID>', // optional
);
11 changes: 11 additions & 0 deletions docs/examples/tablesdb/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

TablesDB tablesDB = TablesDB(client);

await tablesDB.deleteTransaction(
transactionId: '<TRANSACTION_ID>',
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/get-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Row result = await tablesDB.getRow(
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
11 changes: 11 additions & 0 deletions docs/examples/tablesdb/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

TablesDB tablesDB = TablesDB(client);

Transaction result = await tablesDB.getTransaction(
transactionId: '<TRANSACTION_ID>',
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/increment-row-column.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ Row result = await tablesDB.incrementRowColumn(
column: '',
value: 0, // optional
max: 0, // optional
transactionId: '<TRANSACTION_ID>', // optional
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/list-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ RowList result = await tablesDB.listRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
11 changes: 11 additions & 0 deletions docs/examples/tablesdb/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

TablesDB tablesDB = TablesDB(client);

TransactionList result = await tablesDB.listTransactions(
queries: [], // optional
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/update-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Row result = await tablesDB.updateRow(
rowId: '<ROW_ID>',
data: {}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
13 changes: 13 additions & 0 deletions docs/examples/tablesdb/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:appwrite/appwrite.dart';

Client client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID

TablesDB tablesDB = TablesDB(client);

Transaction result = await tablesDB.updateTransaction(
transactionId: '<TRANSACTION_ID>',
commit: false, // optional
rollback: false, // optional
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/upsert-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ Row result = await tablesDB.upsertRow(
rowId: '<ROW_ID>',
data: {}, // optional
permissions: ["read("any")"], // optional
transactionId: '<TRANSACTION_ID>', // optional
);
2 changes: 2 additions & 0 deletions lib/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ part 'src/models/language_list.dart';
part 'src/models/currency_list.dart';
part 'src/models/phone_list.dart';
part 'src/models/locale_code_list.dart';
part 'src/models/transaction_list.dart';
part 'src/models/row.dart';
part 'src/models/document.dart';
part 'src/models/log.dart';
Expand Down Expand Up @@ -51,5 +52,6 @@ part 'src/models/mfa_challenge.dart';
part 'src/models/mfa_recovery_codes.dart';
part 'src/models/mfa_type.dart';
part 'src/models/mfa_factors.dart';
part 'src/models/transaction.dart';
part 'src/models/subscriber.dart';
part 'src/models/target.dart';
Loading