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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions lib/channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ 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');
}

/// 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');
}
Expand Down
17 changes: 16 additions & 1 deletion lib/query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<dynamic> 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<dynamic> 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) =>
Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down
2 changes: 1 addition & 1 deletion lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};

Expand Down
4 changes: 1 addition & 3 deletions lib/src/enums/o_auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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});

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions test/channel_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()', () {
Expand Down