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

## 19.2.0

* Add transaction support for Databases and TablesDB

## 19.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 @@ -23,7 +23,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
dart_appwrite: ^19.1.0
dart_appwrite: ^19.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 @@ -19,4 +19,5 @@ Document result = await databases.createDocument(
"isAdmin": false
},
permissions: ["read("any")"], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/create-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ DocumentList result = await databases.createDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
transactionId: '<TRANSACTION_ID>', // (optional)
);
23 changes: 23 additions & 0 deletions docs/examples/databases/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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)
Comment on lines +13 to +22
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

Replace hard tabs with spaces.

Markdownlint flagged hard tabs on these lines, which should be replaced with spaces for consistent indentation.

Apply this diff to replace hard tabs with spaces:

     operations: [
-	    {
-	        "action": "create",
-	        "databaseId": "<DATABASE_ID>",
-	        "collectionId": "<COLLECTION_ID>",
-	        "documentId": "<DOCUMENT_ID>",
-	        "data": {
-	            "name": "Walter O'Brien"
-	        }
-	    }
+        {
+            "action": "create",
+            "databaseId": "<DATABASE_ID>",
+            "collectionId": "<COLLECTION_ID>",
+            "documentId": "<DOCUMENT_ID>",
+            "data": {
+                "name": "Walter O'Brien"
+            }
+        }
 	], // (optional)

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

13-13: Hard tabs
Column: 1

(MD010, no-hard-tabs)


14-14: Hard tabs
Column: 1

(MD010, no-hard-tabs)


15-15: Hard tabs
Column: 1

(MD010, no-hard-tabs)


16-16: Hard tabs
Column: 1

(MD010, no-hard-tabs)


17-17: Hard tabs
Column: 1

(MD010, no-hard-tabs)


18-18: Hard tabs
Column: 1

(MD010, no-hard-tabs)


19-19: Hard tabs
Column: 1

(MD010, no-hard-tabs)


20-20: Hard tabs
Column: 1

(MD010, no-hard-tabs)


21-21: Hard tabs
Column: 1

(MD010, no-hard-tabs)


22-22: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In docs/examples/databases/create-operations.md around lines 13 to 22, replace
hard tab characters used for indentation with spaces to satisfy markdownlint;
update each indented line (the JSON block items and the closing bracket/comment
line) by converting tabs to spaces (use the repository's standard — typically 2
or 4 spaces — to match surrounding file), ensuring consistent indentation
throughout the code block and re-run markdownlint to verify the warning is
resolved.

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

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

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 @@ -14,4 +14,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 @@ -11,4 +11,5 @@ await databases.deleteDocument(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/delete-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ await databases.deleteDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/databases/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -12,4 +12,5 @@ Document result = await databases.getDocument(
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/databases/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -14,4 +14,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 @@ -11,4 +11,5 @@ DocumentList result = await databases.listDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/databases/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -13,4 +13,5 @@ Document result = await databases.updateDocument(
documentId: '<DOCUMENT_ID>',
data: {}, // (optional)
permissions: ["read("any")"], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/update-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ DocumentList result = await databases.updateDocuments(
collectionId: '<COLLECTION_ID>',
data: {}, // (optional)
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
14 changes: 14 additions & 0 deletions docs/examples/databases/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -13,4 +13,5 @@ Document result = await databases.upsertDocument(
documentId: '<DOCUMENT_ID>',
data: {},
permissions: ["read("any")"], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/databases/upsert-documents.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ DocumentList result = await databases.upsertDocuments(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documents: [],
transactionId: '<TRANSACTION_ID>', // (optional)
);
2 changes: 1 addition & 1 deletion docs/examples/messaging/create-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Message result = await messaging.createPush(
targets: [], // (optional)
data: {}, // (optional)
action: '<ACTION>', // (optional)
image: '[ID1:ID2]', // (optional)
image: '<ID1:ID2>', // (optional)
icon: '<ICON>', // (optional)
sound: '<SOUND>', // (optional)
color: '<COLOR>', // (optional)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/messaging/update-push.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Message result = await messaging.updatePush(
body: '<BODY>', // (optional)
data: {}, // (optional)
action: '<ACTION>', // (optional)
image: '[ID1:ID2]', // (optional)
image: '<ID1:ID2>', // (optional)
icon: '<ICON>', // (optional)
sound: '<SOUND>', // (optional)
color: '<COLOR>', // (optional)
Expand Down
23 changes: 23 additions & 0 deletions docs/examples/tablesdb/create-operations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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)
);
Comment on lines +10 to +23
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

Replace hard tabs with spaces.

The example uses hard tabs for indentation in the operations array (lines 13-22). Replace them with spaces to comply with Markdown standards.

Apply this diff to fix the indentation:

 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"
-	        }
-	    }
+        {
+            "action": "create",
+            "databaseId": "<DATABASE_ID>",
+            "tableId": "<TABLE_ID>",
+            "rowId": "<ROW_ID>",
+            "data": {
+                "name": "Walter O'Brien"
+            }
+        }
 	], // (optional)
 );

Committable suggestion skipped: line range outside the PR's diff.

🧰 Tools
🪛 markdownlint-cli2 (0.18.1)

13-13: Hard tabs
Column: 1

(MD010, no-hard-tabs)


14-14: Hard tabs
Column: 1

(MD010, no-hard-tabs)


15-15: Hard tabs
Column: 1

(MD010, no-hard-tabs)


16-16: Hard tabs
Column: 1

(MD010, no-hard-tabs)


17-17: Hard tabs
Column: 1

(MD010, no-hard-tabs)


18-18: Hard tabs
Column: 1

(MD010, no-hard-tabs)


19-19: Hard tabs
Column: 1

(MD010, no-hard-tabs)


20-20: Hard tabs
Column: 1

(MD010, no-hard-tabs)


21-21: Hard tabs
Column: 1

(MD010, no-hard-tabs)


22-22: Hard tabs
Column: 1

(MD010, no-hard-tabs)

🤖 Prompt for AI Agents
In docs/examples/tablesdb/create-operations.md around lines 10 to 23, the
example snippet uses hard tab characters for indentation inside the operations
array; replace all hard tabs on lines 13–22 with standard spaces (use two or
four spaces per indent consistent with the rest of the file) so the Markdown
renders correctly and complies with repository formatting.

1 change: 1 addition & 0 deletions docs/examples/tablesdb/create-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ Row result = await tablesDB.createRow(
"isAdmin": false
},
permissions: ["read("any")"], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/create-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ RowList result = await tablesDB.createRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rows: [],
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/tablesdb/create-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -14,4 +14,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 @@ -11,4 +11,5 @@ await tablesDB.deleteRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/delete-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ await tablesDB.deleteRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/tablesdb/delete-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -12,4 +12,5 @@ Row result = await tablesDB.getRow(
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/tablesdb/get-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -14,4 +14,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 @@ -11,4 +11,5 @@ RowList result = await tablesDB.listRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
12 changes: 12 additions & 0 deletions docs/examples/tablesdb/list-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -13,4 +13,5 @@ Row result = await tablesDB.updateRow(
rowId: '<ROW_ID>',
data: {}, // (optional)
permissions: ["read("any")"], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/update-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ RowList result = await tablesDB.updateRows(
tableId: '<TABLE_ID>',
data: {}, // (optional)
queries: [], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
14 changes: 14 additions & 0 deletions docs/examples/tablesdb/update-transaction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:dart_appwrite/dart_appwrite.dart';

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

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 @@ -13,4 +13,5 @@ Row result = await tablesDB.upsertRow(
rowId: '<ROW_ID>',
data: {}, // (optional)
permissions: ["read("any")"], // (optional)
transactionId: '<TRANSACTION_ID>', // (optional)
);
1 change: 1 addition & 0 deletions docs/examples/tablesdb/upsert-rows.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ RowList result = await tablesDB.upsertRows(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rows: [],
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 @@ -38,6 +38,7 @@ part 'src/models/message_list.dart';
part 'src/models/topic_list.dart';
part 'src/models/subscriber_list.dart';
part 'src/models/target_list.dart';
part 'src/models/transaction_list.dart';
part 'src/models/specification_list.dart';
part 'src/models/database.dart';
part 'src/models/collection.dart';
Expand Down Expand Up @@ -122,5 +123,6 @@ part 'src/models/mfa_factors.dart';
part 'src/models/provider.dart';
part 'src/models/message.dart';
part 'src/models/topic.dart';
part 'src/models/transaction.dart';
part 'src/models/subscriber.dart';
part 'src/models/target.dart';
Loading