diff --git a/CHANGELOG.md b/CHANGELOG.md index d6b62f24..db327d3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Change Log +## 21.4.0 + +* Added upsert() to DocumentChannel and RowChannel to support upsert operations on documents and rows. +* Added Query.contains, Query.containsAny, and Query.containsAll for enhanced filtering capabilities. + +## 21.3.0 + +* Added memberships realtime channel helper + ## 21.1.0 * Add `queries` parameter to Realtime subscriptions for filtering events diff --git a/README.md b/README.md index 45303b60..6018da14 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![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 latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).** +**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 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) @@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^21.3.0 + appwrite: ^21.4.0 ``` You can install packages from the command line: diff --git a/lib/channel.dart b/lib/channel.dart index 04acadfc..c38833c7 100644 --- a/lib/channel.dart +++ b/lib/channel.dart @@ -130,6 +130,7 @@ extension BucketChannel on Channel<_Bucket> { /// Only available on Channel<_Document> extension DocumentChannel on Channel<_Document> { Channel<_Resolved> create() => _resolve('create'); + Channel<_Resolved> upsert() => _resolve('upsert'); Channel<_Resolved> update() => _resolve('update'); Channel<_Resolved> delete() => _resolve('delete'); } @@ -137,6 +138,7 @@ extension DocumentChannel on Channel<_Document> { /// Only available on Channel<_Row> extension RowChannel on Channel<_Row> { Channel<_Resolved> create() => _resolve('create'); + Channel<_Resolved> upsert() => _resolve('upsert'); Channel<_Resolved> update() => _resolve('update'); Channel<_Resolved> delete() => _resolve('delete'); } diff --git a/lib/query.dart b/lib/query.dart index 2f07d998..3693dce6 100644 --- a/lib/query.dart +++ b/lib/query.dart @@ -98,11 +98,26 @@ class Query { static String endsWith(String attribute, String value) => Query._('endsWith', attribute, value).toString(); - /// Filter resources where [attribute] contains [value] + /// Filter resources where [attribute] contains [value]. + /// For string attributes, checks if the string contains the substring. /// [value] can be a single value or a list. + /// + /// Note: For array attributes, use [containsAny] or [containsAll] instead. static String contains(String attribute, dynamic value) => Query._('contains', attribute, value).toString(); + /// Filter resources where [attribute] contains ANY of the specified [value]s. + /// For array and relationship attributes, matches documents where the attribute + /// contains at least one of the given values. + static String containsAny(String attribute, List value) => + Query._('containsAny', attribute, value).toString(); + + /// Filter resources where [attribute] contains ALL of the specified [value]s. + /// For array and relationship attributes, matches documents where the attribute + /// contains every one of the given values. + static String containsAll(String attribute, List value) => + Query._('containsAll', attribute, value).toString(); + /// Filter resources where [attribute] does not contain [value] /// [value] can be a single value or a list. static String notContains(String attribute, dynamic value) => diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index 01b5b61c..17828b86 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': '21.3.0', + 'x-sdk-version': '21.4.0', 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index a156bf92..2b01050e 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': '21.3.0', + 'x-sdk-version': '21.4.0', 'X-Appwrite-Response-Format': '1.8.0', }; diff --git a/lib/src/enums/o_auth_provider.dart b/lib/src/enums/o_auth_provider.dart index 539e3784..fe3f1c74 100644 --- a/lib/src/enums/o_auth_provider.dart +++ b/lib/src/enums/o_auth_provider.dart @@ -39,9 +39,7 @@ enum OAuthProvider { yammer(value: 'yammer'), yandex(value: 'yandex'), zoho(value: 'zoho'), - zoom(value: 'zoom'), - githubImagine(value: 'githubImagine'), - googleImagine(value: 'googleImagine'); + zoom(value: 'zoom'); const OAuthProvider({required this.value}); diff --git a/pubspec.yaml b/pubspec.yaml index 34b67b6a..e699240b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 21.3.0 +version: 21.4.0 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 diff --git a/test/channel_test.dart b/test/channel_test.dart index d4c0e1a7..07a265a6 100644 --- a/test/channel_test.dart +++ b/test/channel_test.dart @@ -26,6 +26,16 @@ void main() { .toString(), 'databases.db1.collections.col1.documents.doc1.create'); }); + + test('returns database channel with upsert action', () { + expect( + Channel.database('db1') + .collection('col1') + .document('doc1') + .upsert() + .toString(), + 'databases.db1.collections.col1.documents.doc1.upsert'); + }); }); group('tablesdb()', () {