Skip to content

Commit 3d783dd

Browse files
sdk update
1 parent 74a4d6b commit 3d783dd

File tree

164 files changed

+8067
-7895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+8067
-7895
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
88
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
99

10-
**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).**
10+
**This SDK is compatible with Appwrite server version latest. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).**
1111

1212
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)
1313

@@ -19,7 +19,7 @@ Add this to your package's `pubspec.yaml` file:
1919

2020
```yml
2121
dependencies:
22-
appwrite: ^21.4.0
22+
appwrite: ^21.4.1
2323
```
2424
2525
You can install packages from the command line:

docs/examples/databases/list-documents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ DocumentList result = await databases.listDocuments(
1313
queries: [], // optional
1414
transactionId: '<TRANSACTION_ID>', // optional
1515
total: false, // optional
16+
ttl: 0, // optional
1617
);
1718
```

docs/examples/tablesdb/list-rows.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ RowList result = await tablesDB.listRows(
1313
queries: [], // optional
1414
transactionId: '<TRANSACTION_ID>', // optional
1515
total: false, // optional
16+
ttl: 0, // optional
1617
);
1718
```

lib/appwrite.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// Appwrite Flutter SDK
22
///
3-
/// This SDK is compatible with Appwrite server version 1.8.x.
3+
/// This SDK is compatible with Appwrite server version 1.8.x.
44
/// For older versions, please check
55
/// [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).
66
library appwrite;

lib/channel.dart

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,28 @@ part of appwrite;
22

33
// Marker classes for type safety
44
class _Root {}
5-
65
class _Database {}
7-
86
class _Collection {}
9-
107
class _Document {}
11-
128
class _TablesDB {}
13-
149
class _Table {}
15-
1610
class _Row {}
17-
1811
class _Bucket {}
19-
2012
class _File {}
21-
2213
class _Func {}
23-
2414
class _Execution {}
25-
2615
class _Team {}
27-
2816
class _Membership {}
29-
3017
class _Resolved {}
3118

3219
// Helper function for normalizing ID
33-
String _normalize(String id) => id.trim().isEmpty ? '*' : id.trim();
20+
String _normalize(String id) {
21+
final trimmed = id.trim();
22+
if (trimmed.isEmpty) {
23+
throw ArgumentError('Channel ID is required');
24+
}
25+
return trimmed;
26+
}
3427

3528
/// Channel class with generic type parameter for type-safe method chaining
3629
class Channel<T> {
@@ -58,25 +51,25 @@ class Channel<T> {
5851
String toString() => _segments.join('.');
5952

6053
// --- ROOT FACTORIES ---
61-
static Channel<_Database> database([String id = '*']) =>
54+
static Channel<_Database> database(String id) =>
6255
Channel<_Database>._(['databases', _normalize(id)]);
6356

64-
static Channel<_TablesDB> tablesdb([String id = '*']) =>
57+
static Channel<_TablesDB> tablesdb(String id) =>
6558
Channel<_TablesDB>._(['tablesdb', _normalize(id)]);
6659

67-
static Channel<_Bucket> bucket([String id = '*']) =>
60+
static Channel<_Bucket> bucket(String id) =>
6861
Channel<_Bucket>._(['buckets', _normalize(id)]);
6962

70-
static Channel<_Execution> execution([String id = '*']) =>
63+
static Channel<_Execution> execution(String id) =>
7164
Channel<_Execution>._(['executions', _normalize(id)]);
7265

73-
static Channel<_Func> function([String id = '*']) =>
66+
static Channel<_Func> function(String id) =>
7467
Channel<_Func>._(['functions', _normalize(id)]);
7568

76-
static Channel<_Team> team([String id = '*']) =>
69+
static Channel<_Team> team(String id) =>
7770
Channel<_Team>._(['teams', _normalize(id)]);
7871

79-
static Channel<_Membership> membership([String id = '*']) =>
72+
static Channel<_Membership> membership(String id) =>
8073
Channel<_Membership>._(['memberships', _normalize(id)]);
8174

8275
static String account() => 'account';
@@ -95,21 +88,21 @@ class Channel<T> {
9588

9689
/// Only available on Channel<_Database>
9790
extension DatabaseChannel on Channel<_Database> {
98-
Channel<_Collection> collection([String? id]) =>
99-
_next<_Collection>('collections', id ?? '*');
91+
Channel<_Collection> collection(String id) =>
92+
_next<_Collection>('collections', id);
10093
}
10194

10295
/// Only available on Channel<_Collection>
10396
extension CollectionChannel on Channel<_Collection> {
104-
Channel<_Document> document([String? id]) =>
105-
_next<_Document>('documents', id);
97+
Channel<_Document> document([String? id]) => _next<_Document>('documents', id);
10698
}
10799

108100
// --- TABLESDB ROUTE ---
109101

110102
/// Only available on Channel<_TablesDB>
111103
extension TablesDBChannel on Channel<_TablesDB> {
112-
Channel<_Table> table([String? id]) => _next<_Table>('tables', id ?? '*');
104+
Channel<_Table> table(String id) =>
105+
_next<_Table>('tables', id);
113106
}
114107

115108
/// Only available on Channel<_Table>

lib/client_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/client_browser.dart';
1+
export 'src/client_browser.dart';

lib/client_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/client_io.dart';
1+
export 'src/client_io.dart';

lib/operator.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Operator {
3131

3232
result['method'] = method;
3333

34-
if (values != null) {
34+
if(values != null) {
3535
result['values'] = values is List ? values : [values];
3636
}
3737

@@ -147,7 +147,8 @@ class Operator {
147147
Operator._('arrayRemove', [value]).toString();
148148

149149
/// Remove duplicate values from an array attribute.
150-
static String arrayUnique() => Operator._('arrayUnique', []).toString();
150+
static String arrayUnique() =>
151+
Operator._('arrayUnique', []).toString();
151152

152153
/// Keep only values that exist in both the current array and the provided array.
153154
static String arrayIntersect(List<dynamic> values) =>
@@ -172,7 +173,8 @@ class Operator {
172173
Operator._('stringReplace', [search, replace]).toString();
173174

174175
/// Toggle a boolean attribute.
175-
static String toggle() => Operator._('toggle', []).toString();
176+
static String toggle() =>
177+
Operator._('toggle', []).toString();
176178

177179
/// Add days to a date attribute.
178180
static String dateAddDays(int days) =>
@@ -183,5 +185,6 @@ class Operator {
183185
Operator._('dateSubDays', [days]).toString();
184186

185187
/// Set a date attribute to the current date and time.
186-
static String dateSetNow() => Operator._('dateSetNow', []).toString();
188+
static String dateSetNow() =>
189+
Operator._('dateSetNow', []).toString();
187190
}

lib/query.dart

Lines changed: 40 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ class Query {
1010

1111
Map<String, dynamic> toJson() {
1212
final result = <String, dynamic>{};
13-
13+
1414
result['method'] = method;
15-
16-
if (attribute != null) {
15+
16+
if(attribute != null) {
1717
result['attribute'] = attribute;
1818
}
19-
20-
if (values != null) {
19+
20+
if(values != null) {
2121
result['values'] = values is List ? values : [values];
2222
}
2323

@@ -28,7 +28,7 @@ class Query {
2828
String toString() => jsonEncode(toJson());
2929

3030
/// Filter resources where [attribute] is equal to [value].
31-
///
31+
///
3232
/// [value] can be a single value or a list. If a list is used
3333
/// the query will return resources where [attribute] is equal
3434
/// to any of the values in the list.
@@ -140,46 +140,50 @@ class Query {
140140
Query._('notEndsWith', attribute, value).toString();
141141

142142
/// Filter resources where document was created before [value].
143-
static String createdBefore(String value) => lessThan('\$createdAt', value);
143+
static String createdBefore(String value) =>
144+
lessThan('\$createdAt', value);
144145

145146
/// Filter resources where document was created after [value].
146-
static String createdAfter(String value) => greaterThan('\$createdAt', value);
147+
static String createdAfter(String value) =>
148+
greaterThan('\$createdAt', value);
147149

148150
/// Filter resources where document was created between [start] and [end] (inclusive).
149151
static String createdBetween(String start, String end) =>
150152
between('\$createdAt', start, end);
151153

152154
/// Filter resources where document was updated before [value].
153-
static String updatedBefore(String value) => lessThan('\$updatedAt', value);
155+
static String updatedBefore(String value) =>
156+
lessThan('\$updatedAt', value);
154157

155158
/// Filter resources where document was updated after [value].
156-
static String updatedAfter(String value) => greaterThan('\$updatedAt', value);
159+
static String updatedAfter(String value) =>
160+
greaterThan('\$updatedAt', value);
157161

158162
/// Filter resources where document was updated between [start] and [end] (inclusive).
159163
static String updatedBetween(String start, String end) =>
160164
between('\$updatedAt', start, end);
161165

162166
static String or(List<String> queries) => Query._(
163-
'or',
164-
null,
165-
queries.map((query) => jsonDecode(query)).toList(),
166-
).toString();
167+
'or',
168+
null,
169+
queries.map((query) => jsonDecode(query)).toList(),
170+
).toString();
167171

168172
static String and(List<String> queries) => Query._(
169-
'and',
170-
null,
171-
queries.map((query) => jsonDecode(query)).toList(),
172-
).toString();
173+
'and',
174+
null,
175+
queries.map((query) => jsonDecode(query)).toList(),
176+
).toString();
173177

174178
/// Filter array elements where at least one element matches all the specified queries.
175179
///
176180
/// [attribute] The attribute containing the array to filter on.
177181
/// [queries] The list of query strings to match against array elements.
178182
static String elemMatch(String attribute, List<String> queries) => Query._(
179-
'elemMatch',
180-
attribute,
181-
queries.map((query) => jsonDecode(query)).toList(),
182-
).toString();
183+
'elemMatch',
184+
attribute,
185+
queries.map((query) => jsonDecode(query)).toList(),
186+
).toString();
183187

184188
/// Specify which attributes should be returned by the API call.
185189
static String select(List<String> attributes) =>
@@ -194,17 +198,18 @@ class Query {
194198
Query._('orderDesc', attribute).toString();
195199

196200
/// Sort results randomly.
197-
static String orderRandom() => Query._('orderRandom').toString();
201+
static String orderRandom() =>
202+
Query._('orderRandom').toString();
198203

199204
/// Return results before [id].
200-
///
205+
///
201206
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
202207
/// docs for more information.
203208
static String cursorBefore(String id) =>
204209
Query._('cursorBefore', null, id).toString();
205210

206211
/// Return results after [id].
207-
///
212+
///
208213
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
209214
/// docs for more information.
210215
static String cursorAfter(String id) =>
@@ -214,43 +219,27 @@ class Query {
214219
static String limit(int limit) => Query._('limit', null, limit).toString();
215220

216221
/// Return results from [offset].
217-
///
222+
///
218223
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
219224
/// docs for more information.
220225
static String offset(int offset) =>
221226
Query._('offset', null, offset).toString();
222227

223228
/// Filter resources where [attribute] is at a specific distance from the given coordinates.
224-
static String distanceEqual(
225-
String attribute, List<dynamic> values, num distance,
226-
[bool meters = true]) =>
227-
Query._('distanceEqual', attribute, [
228-
[values, distance, meters]
229-
]).toString();
229+
static String distanceEqual(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
230+
Query._('distanceEqual', attribute, [[values, distance, meters]]).toString();
230231

231232
/// Filter resources where [attribute] is not at a specific distance from the given coordinates.
232-
static String distanceNotEqual(
233-
String attribute, List<dynamic> values, num distance,
234-
[bool meters = true]) =>
235-
Query._('distanceNotEqual', attribute, [
236-
[values, distance, meters]
237-
]).toString();
233+
static String distanceNotEqual(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
234+
Query._('distanceNotEqual', attribute, [[values, distance, meters]]).toString();
238235

239236
/// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
240-
static String distanceGreaterThan(
241-
String attribute, List<dynamic> values, num distance,
242-
[bool meters = true]) =>
243-
Query._('distanceGreaterThan', attribute, [
244-
[values, distance, meters]
245-
]).toString();
237+
static String distanceGreaterThan(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
238+
Query._('distanceGreaterThan', attribute, [[values, distance, meters]]).toString();
246239

247240
/// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
248-
static String distanceLessThan(
249-
String attribute, List<dynamic> values, num distance,
250-
[bool meters = true]) =>
251-
Query._('distanceLessThan', attribute, [
252-
[values, distance, meters]
253-
]).toString();
241+
static String distanceLessThan(String attribute, List<dynamic> values, num distance, [bool meters = true]) =>
242+
Query._('distanceLessThan', attribute, [[values, distance, meters]]).toString();
254243

255244
/// Filter resources where [attribute] intersects with the given geometry.
256245
static String intersects(String attribute, List<dynamic> values) =>
@@ -283,4 +272,4 @@ class Query {
283272
/// Filter resources where [attribute] does not touch the given geometry.
284273
static String notTouches(String attribute, List<dynamic> values) =>
285274
Query._('notTouches', attribute, [values]).toString();
286-
}
275+
}

lib/realtime_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export 'src/realtime_browser.dart';
1+
export 'src/realtime_browser.dart';

0 commit comments

Comments
 (0)