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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## 18.0.0

* Rename `CreditCard` enum value `unionChinaPay` to `unionPay`
* Add time between query support
* Add spatial attribute support
* Add spatial index support
* Add spatial query support

## 17.0.0

* Support for Appwrite 1.8
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: ^17.0.0
dart_appwrite: ^18.0.0
```

You can install packages from the command line:
Expand Down
6 changes: 5 additions & 1 deletion docs/examples/account/update-prefs.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,9 @@ Client client = Client()
Account account = Account(client);

User result = await account.updatePrefs(
prefs: {},
prefs: {
"language": "en",
"timezone": "UTC",
"darkTheme": true
},
);
8 changes: 7 additions & 1 deletion docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Document result = await databases.createDocument(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
documentId: '<DOCUMENT_ID>',
data: {},
data: {
"username": "walter.obrien",
"email": "[email protected]",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
},
permissions: ["read("any")"], // (optional)
);
16 changes: 16 additions & 0 deletions docs/examples/databases/create-line-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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);

AttributeLine result = await databases.createLineAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
16 changes: 16 additions & 0 deletions docs/examples/databases/create-point-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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);

AttributePoint result = await databases.createPointAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
Comment on lines +3 to +16
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Same issues: use async entrypoint and correct default shape for Point.

This fixes compile/run behavior and clarifies parameters.

-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);
-
-AttributePoint result = await databases.createPointAttribute(
-    databaseId: '<DATABASE_ID>',
-    collectionId: '<COLLECTION_ID>',
-    key: '',
-    xrequired: false,
-    xdefault: [[1,2], [3, 4]], // (optional)
-);
+Future<void> main() async {
+  final 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
+
+  final databases = Databases(client);
+
+  final AttributePoint result = await databases.createPointAttribute(
+    databaseId: '<DATABASE_ID>',
+    collectionId: '<COLLECTION_ID>',
+    key: '<ATTRIBUTE_KEY>',
+    xrequired: false,
+    // xdefault: [1.0, 2.0], // (optional) [x,y]
+  );
+
+  print(result.toMap());
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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);
AttributePoint result = await databases.createPointAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
Future<void> main() async {
final 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
final databases = Databases(client);
final AttributePoint result = await databases.createPointAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<ATTRIBUTE_KEY>',
xrequired: false,
// xdefault: [1.0, 2.0], // (optional) [x,y]
);
print(result.toMap());
}
🧰 Tools
🪛 LanguageTool

[grammar] ~3-~3: There might be a mistake here.
Context: ...ppwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.app...

(QB_NEW_EN)


[grammar] ~4-~4: There might be a mistake here.
Context: ...ud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your...

(QB_NEW_EN)


[grammar] ~5-~5: There might be a mistake here.
Context: ...('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secre...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In docs/examples/databases/create-point-attribute.md around lines 3–16, the
example uses a synchronous top-level call, an empty key, incorrect parameter
names (xrequired/xdefault), and an invalid default shape for a Point; update the
snippet to run inside an async entrypoint (e.g., async main and await), provide
a non-empty example key, use the correct parameter names (required and default),
and set default to a single 2-number point (e.g., default: [1, 2]) so the
example compiles and reflects the correct Point shape.

16 changes: 16 additions & 0 deletions docs/examples/databases/create-polygon-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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);

AttributePolygon result = await databases.createPolygonAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/databases/update-line-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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);

AttributeLine result = await databases.updateLineAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/databases/update-point-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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);

AttributePoint result = await databases.updatePointAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/databases/update-polygon-attribute.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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);

AttributePolygon result = await databases.updatePolygonAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
Comment on lines +10 to +17
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Wrap the snippet in an async entrypoint; top-level await won’t compile.

Make the example runnable and print the result.

-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);
-
-AttributePolygon result = await databases.updatePolygonAttribute(
-    databaseId: '<DATABASE_ID>',
-    collectionId: '<COLLECTION_ID>',
-    key: '',
-    xrequired: false,
-    xdefault: [[1,2], [3, 4]], // (optional)
-    newKey: '', // (optional)
-);
+Future<void> main() async {
+  final 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
+
+  final databases = Databases(client);
+
+  final AttributePolygon result = await databases.updatePolygonAttribute(
+    databaseId: '<DATABASE_ID>',
+    collectionId: '<COLLECTION_ID>',
+    key: '<ATTRIBUTE_KEY>',
+    xrequired: false,
+    // xdefault: [
+    //   [ [0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0] ]
+    // ], // (optional) [rings][points][x,y]
+    // newKey: '<NEW_KEY>', // (optional)
+  );
+
+  print(result.toMap());
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
AttributePolygon result = await databases.updatePolygonAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
Future<void> main() async {
final 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
final databases = Databases(client);
final AttributePolygon result = await databases.updatePolygonAttribute(
databaseId: '<DATABASE_ID>',
collectionId: '<COLLECTION_ID>',
key: '<ATTRIBUTE_KEY>',
xrequired: false,
// xdefault: [
// [ [0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0], [0.0, 0.0] ]
// ], // (optional) [rings][points][x,y]
// newKey: '<NEW_KEY>', // (optional)
);
print(result.toMap());
}
🤖 Prompt for AI Agents
In docs/examples/databases/update-polygon-attribute.md around lines 10 to 17 the
snippet uses top-level await which won't compile; wrap the call in an async
entrypoint (e.g., async function main() { ... }) perform the await inside that
function, call main() at the end, and print the returned AttributePolygon result
(e.g., console.log/print) so the example is runnable and shows output; keep the
existing parameters/placeholders but ensure the await is inside the async
function and the function is invoked.

16 changes: 16 additions & 0 deletions docs/examples/tablesdb/create-line-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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);

ColumnLine result = await tablesDB.createLineColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
Comment on lines +1 to +16
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Async main and placeholders: make the example copy‑paste runnable.

Top‑level await and empty keys break quickstart UX. Wrap in main(), supply a non-empty key, and only include a valid default if you have one.

-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);
-
-ColumnLine result = await tablesDB.createLineColumn(
-    databaseId: '<DATABASE_ID>',
-    tableId: '<TABLE_ID>',
-    key: '',
-    xrequired: false,
-    xdefault: [[1,2], [3, 4]], // (optional)
-);
+import 'package:dart_appwrite/dart_appwrite.dart';
+
+Future<void> main() async {
+  final 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
+
+  final tablesDB = TablesDB(client);
+
+  final ColumnLine result = await tablesDB.createLineColumn(
+    databaseId: '<DATABASE_ID>',
+    tableId: '<TABLE_ID>',
+    key: '<COLUMN_KEY>',
+    xrequired: false,
+    // xdefault: <VALID_LINE_DEFAULT>, // (optional)
+  );
+  print(result.toMap());
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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);
ColumnLine result = await tablesDB.createLineColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
import 'package:dart_appwrite/dart_appwrite.dart';
Future<void> main() async {
final 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
final tablesDB = TablesDB(client);
final ColumnLine result = await tablesDB.createLineColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '<COLUMN_KEY>',
xrequired: false,
// xdefault: <VALID_LINE_DEFAULT>, // (optional)
);
print(result.toMap());
}
🧰 Tools
🪛 LanguageTool

[grammar] ~3-~3: There might be a mistake here.
Context: ...ppwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.app...

(QB_NEW_EN)


[grammar] ~4-~4: There might be a mistake here.
Context: ...ud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>') // Your...

(QB_NEW_EN)


[grammar] ~5-~5: There might be a mistake here.
Context: ...('<YOUR_PROJECT_ID>') // Your project ID .setKey('<YOUR_API_KEY>'); // Your secre...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In docs/examples/tablesdb/create-line-column.md around lines 1 to 16 the snippet
uses top‑level await and an empty column key which makes the example
non‑runnable; wrap the code in an async main function (e.g., Future<void> main()
async { ... }) so awaits run inside it, replace the empty key with a non‑empty
placeholder like 'your_column_key' (and note to replace with a real key), and
either remove the xdefault or replace it with a valid example or document it as
optional so the snippet can be copy‑pasted and run.

16 changes: 16 additions & 0 deletions docs/examples/tablesdb/create-point-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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);

ColumnPoint result = await tablesDB.createPointColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
16 changes: 16 additions & 0 deletions docs/examples/tablesdb/create-polygon-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
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);

ColumnPolygon result = await tablesDB.createPolygonColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
);
8 changes: 7 additions & 1 deletion docs/examples/tablesdb/create-row.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Row result = await tablesDB.createRow(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
rowId: '<ROW_ID>',
data: {},
data: {
"username": "walter.obrien",
"email": "[email protected]",
"fullName": "Walter O'Brien",
"age": 30,
"isAdmin": false
},
permissions: ["read("any")"], // (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tablesdb/update-line-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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);

ColumnLine result = await tablesDB.updateLineColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tablesdb/update-point-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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);

ColumnPoint result = await tablesDB.updatePointColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
17 changes: 17 additions & 0 deletions docs/examples/tablesdb/update-polygon-column.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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);

ColumnPolygon result = await tablesDB.updatePolygonColumn(
databaseId: '<DATABASE_ID>',
tableId: '<TABLE_ID>',
key: '',
xrequired: false,
xdefault: [[1,2], [3, 4]], // (optional)
newKey: '', // (optional)
);
6 changes: 6 additions & 0 deletions lib/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ part 'src/models/attribute_ip.dart';
part 'src/models/attribute_url.dart';
part 'src/models/attribute_datetime.dart';
part 'src/models/attribute_relationship.dart';
part 'src/models/attribute_point.dart';
part 'src/models/attribute_line.dart';
part 'src/models/attribute_polygon.dart';
part 'src/models/table.dart';
part 'src/models/column_list.dart';
part 'src/models/column_string.dart';
Expand All @@ -62,6 +65,9 @@ part 'src/models/column_ip.dart';
part 'src/models/column_url.dart';
part 'src/models/column_datetime.dart';
part 'src/models/column_relationship.dart';
part 'src/models/column_point.dart';
part 'src/models/column_line.dart';
part 'src/models/column_polygon.dart';
part 'src/models/index.dart';
part 'src/models/column_index.dart';
part 'src/models/row.dart';
Expand Down
Loading