diff --git a/CHANGELOG.md b/CHANGELOG.md index 834c926..3be014d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 20.3.3 + +* Fix boolean parameter not handled correctly in Client requests + ## 20.3.2 * Fix OAuth2 browser infinite redirect issue diff --git a/LICENSE b/LICENSE index c1602fc..6f8702b 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2025 Appwrite (https://appwrite.io) and individual contributors. +Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/README.md b/README.md index a94911b..d433331 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,9 @@ [![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite) [![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord) -**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).** - -Appwrite is an open-source backend as a service server that abstract and simplify complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) - +**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).** +Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Flutter SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs) ![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png) @@ -21,7 +19,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^20.3.2 + appwrite: ^20.3.3 ``` You can install packages from the command line: diff --git a/docs/examples/account/create-jwt.md b/docs/examples/account/create-jwt.md index b9cbc8f..58dbdff 100644 --- a/docs/examples/account/create-jwt.md +++ b/docs/examples/account/create-jwt.md @@ -6,4 +6,6 @@ Client client = Client() Account account = Account(client); -Jwt result = await account.createJWT(); +Jwt result = await account.createJWT( + duration: 0, // optional +); diff --git a/docs/examples/avatars/get-screenshot.md b/docs/examples/avatars/get-screenshot.md index 0dc9b76..ed44613 100644 --- a/docs/examples/avatars/get-screenshot.md +++ b/docs/examples/avatars/get-screenshot.md @@ -30,7 +30,7 @@ Uint8List bytes = await avatars.getScreenshot( width: 800, // optional height: 600, // optional quality: 85, // optional - output: Output.jpg, // optional + output: ImageFormat.jpg, // optional ) final file = File('path_to_file/filename.ext'); @@ -61,7 +61,7 @@ FutureBuilder( width:800 , // optional height:600 , // optional quality:85 , // optional - output: Output.jpg, // optional + output: ImageFormat.jpg, // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/docs/examples/databases/update-document.md b/docs/examples/databases/update-document.md index 9a5b3ee..92407b1 100644 --- a/docs/examples/databases/update-document.md +++ b/docs/examples/databases/update-document.md @@ -12,7 +12,13 @@ Document result = await databases.updateDocument( databaseId: '', collectionId: '', documentId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional permissions: [Permission.read(Role.any())], // optional transactionId: '', // optional ); diff --git a/docs/examples/databases/upsert-document.md b/docs/examples/databases/upsert-document.md index 7e6eb1a..6ad7638 100644 --- a/docs/examples/databases/upsert-document.md +++ b/docs/examples/databases/upsert-document.md @@ -12,7 +12,13 @@ Document result = await databases.upsertDocument( databaseId: '', collectionId: '', documentId: '', - data: {}, + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 30, + "isAdmin": false + }, // optional permissions: [Permission.read(Role.any())], // optional transactionId: '', // optional ); diff --git a/docs/examples/tablesdb/update-row.md b/docs/examples/tablesdb/update-row.md index 91f2dd3..cf7dd77 100644 --- a/docs/examples/tablesdb/update-row.md +++ b/docs/examples/tablesdb/update-row.md @@ -12,7 +12,13 @@ Row result = await tablesDB.updateRow( databaseId: '', tableId: '', rowId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional permissions: [Permission.read(Role.any())], // optional transactionId: '', // optional ); diff --git a/docs/examples/tablesdb/upsert-row.md b/docs/examples/tablesdb/upsert-row.md index 4fb785d..9d69ef6 100644 --- a/docs/examples/tablesdb/upsert-row.md +++ b/docs/examples/tablesdb/upsert-row.md @@ -12,7 +12,13 @@ Row result = await tablesDB.upsertRow( databaseId: '', tableId: '', rowId: '', - data: {}, // optional + data: { + "username": "walter.obrien", + "email": "walter.obrien@example.com", + "fullName": "Walter O'Brien", + "age": 33, + "isAdmin": false + }, // optional permissions: [Permission.read(Role.any())], // optional transactionId: '', // optional ); diff --git a/lib/enums.dart b/lib/enums.dart index 04d860c..3429ca0 100644 --- a/lib/enums.dart +++ b/lib/enums.dart @@ -9,9 +9,8 @@ part 'src/enums/credit_card.dart'; part 'src/enums/flag.dart'; part 'src/enums/theme.dart'; part 'src/enums/timezone.dart'; -part 'src/enums/output.dart'; +part 'src/enums/image_format.dart'; part 'src/enums/execution_method.dart'; part 'src/enums/image_gravity.dart'; -part 'src/enums/image_format.dart'; part 'src/enums/execution_trigger.dart'; part 'src/enums/execution_status.dart'; diff --git a/lib/services/account.dart b/lib/services/account.dart index c7997ec..f4dda77 100644 --- a/lib/services/account.dart +++ b/lib/services/account.dart @@ -117,10 +117,12 @@ class Account extends Service { /// Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes /// from its creation and will be invalid if the user will logout in that time /// frame. - Future createJWT() async { + Future createJWT({int? duration}) async { const String apiPath = '/account/jwts'; - final Map apiParams = {}; + final Map apiParams = { + if (duration != null) 'duration': duration, + }; final Map apiHeaders = { 'content-type': 'application/json', diff --git a/lib/services/avatars.dart b/lib/services/avatars.dart index f24d5d8..8921a8b 100644 --- a/lib/services/avatars.dart +++ b/lib/services/avatars.dart @@ -219,7 +219,7 @@ class Avatars extends Service { int? width, int? height, int? quality, - enums.Output? output}) async { + enums.ImageFormat? output}) async { const String apiPath = '/avatars/screenshots'; final Map params = { diff --git a/lib/services/databases.dart b/lib/services/databases.dart index 4063c0b..e7db8c2 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -218,7 +218,7 @@ class Databases extends Service { {required String databaseId, required String collectionId, required String documentId, - required Map data, + Map? data, List? permissions, String? transactionId}) async { final String apiPath = @@ -228,7 +228,7 @@ class Databases extends Service { .replaceAll('{documentId}', documentId); final Map apiParams = { - 'data': data, + if (data != null) 'data': data, 'permissions': permissions, 'transactionId': transactionId, }; diff --git a/lib/services/storage.dart b/lib/services/storage.dart index 0aca3f7..7ddfcf1 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -111,7 +111,7 @@ class Storage extends Service { .replaceAll('{fileId}', fileId); final Map apiParams = { - 'name': name, + if (name != null) 'name': name, 'permissions': permissions, }; diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 36d791a..7d46739 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -40,7 +40,7 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '20.3.2', + 'x-sdk-version': '20.3.3', 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index 91d47a7..322f130 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -58,7 +58,7 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '20.3.2', + 'x-sdk-version': '20.3.3', 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/lib/src/client_mixin.dart b/lib/src/client_mixin.dart index 23d5468..03922da 100644 --- a/lib/src/client_mixin.dart +++ b/lib/src/client_mixin.dart @@ -46,6 +46,8 @@ mixin ClientMixin { if (value != null) { if (value is int || value is double) { filteredParams[key] = value.toString(); + } else if (value is bool) { + filteredParams[key] = value.toString(); } else if (value is List) { filteredParams["$key[]"] = value; } else { diff --git a/lib/src/enums/o_auth_provider.dart b/lib/src/enums/o_auth_provider.dart index 383e45b..48b6c20 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -40,7 +40,8 @@ enum OAuthProvider { yandex(value: 'yandex'), zoho(value: 'zoho'), zoom(value: 'zoom'), - mock(value: 'mock'); + mock(value: 'mock'), + mockUnverified(value: 'mock-unverified'); const OAuthProvider({required this.value}); diff --git a/lib/src/enums/output.dart b/lib/src/enums/output.dart deleted file mode 100644 index 01790d6..0000000 --- a/lib/src/enums/output.dart +++ /dev/null @@ -1,17 +0,0 @@ -part of '../../enums.dart'; - -enum Output { - jpg(value: 'jpg'), - jpeg(value: 'jpeg'), - png(value: 'png'), - webp(value: 'webp'), - heic(value: 'heic'), - avif(value: 'avif'), - gif(value: 'gif'); - - const Output({required this.value}); - - final String value; - - String toJson() => value; -} diff --git a/pubspec.yaml b/pubspec.yaml index 8cb133b..8486032 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: appwrite -version: 20.3.2 -description: Appwrite is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API +version: 20.3.3 +description: Appwrite is an open-source self-hosted backend server that abstracts and simplifies complex and repetitive development tasks behind a very simple REST API homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter issue_tracker: https://github.com/appwrite/sdk-generator/issues diff --git a/test/services/databases_test.dart b/test/services/databases_test.dart index 681fc1f..d7fcf81 100644 --- a/test/services/databases_test.dart +++ b/test/services/databases_test.dart @@ -244,7 +244,6 @@ void main() { databaseId: '', collectionId: '', documentId: '', - data: {}, ); expect(response, isA()); });