Skip to content

Commit 0427fa4

Browse files
committed
Add inc/dec
1 parent 79ad903 commit 0427fa4

File tree

100 files changed

+4782
-5034
lines changed

Some content is hidden

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

100 files changed

+4782
-5034
lines changed

CHANGELOG.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# Change Log
22

3-
## 17.0.0
3+
## 16.1.1
44

55
* Update `flutter_web_auth_2` dependency to version 4.1.0
66
* Update `auth.html` example in README.md to align with `flutter_web_auth_2` documentation
7-
* Breaking changes:
8-
* Minimum iOS version supported is now 17.4 due to the updated requirements of `flutter_web_auth_2` version 4.1.0
97

108
## 16.1.0
119

@@ -22,7 +20,7 @@
2220
## 15.0.2
2321

2422
* Avoid setting empty `User-Agent` header and only encode it when present.
25-
* Update doc examples to use new multi-region endpoint: `https://<REGION>.cloud.appwrite.io/v1`.
23+
* Update doc examples to use new multi-region endpoint: `https://<REGION>.cloud.appwrite.io/v1`.
2624

2725
## 15.0.1
2826

@@ -34,7 +32,7 @@
3432

3533
* Encode `User-Agent` header to fix invalid HTTP header field value error.
3634
* Breaking changes:
37-
* Changed the typing of `AppwriteException`&#039;s response parameter from a `dynamic` object to an optional string (`?String`).
35+
* Changed the typing of `AppwriteException`'s response parameter from a `dynamic` object to an optional string (`?String`).
3836

3937
## 14.0.0
4038

@@ -180,8 +178,8 @@ https://github.com/appwrite/appwrite/blob/master/CHANGES.md
180178
## 6.0.0
181179
* Support for Appwrite 0.15
182180
* **NEW** Phone authentication `account.createPhoneSession()`
183-
* **BREAKING** `Database` -&gt; `Databases`
184-
* **BREAKING** `account.createSession()` -&gt; `account.createEmailSession()`
181+
* **BREAKING** `Database` -> `Databases`
182+
* **BREAKING** `account.createSession()` -> `account.createEmailSession()`
185183
* **BREAKING** `dateCreated` attribute removed from `Team`, `Execution`, `File` models
186184
* **BREAKING** `dateCreated` and `dateUpdated` attribute removed from `Func`, `Deployment`, `Bucket` models
187185
* **BREAKING** Realtime channels
@@ -192,7 +190,7 @@ https://github.com/appwrite/appwrite/blob/master/CHANGES.md
192190

193191
## 5.0.0
194192
* Support for Appwrite 0.14
195-
* **BREAKING** `account.delete()` -&gt; `account.updateStatus()`
193+
* **BREAKING** `account.delete()` -> `account.updateStatus()`
196194
* **BREAKING** Execution model `stdout` renamed to `response`
197195
* **BREAKING** Membership model `name` renamed to `userName` and `email` renamed to `userEmail`
198196
* Added `teamName` to Membership model
@@ -209,7 +207,7 @@ https://github.com/appwrite/appwrite/blob/master/CHANGES.md
209207
* **BREAKING** **Tags** have been renamed to **Deployments**
210208
* **BREAKING** `createFile` function expects Bucket ID as the first parameter
211209
* **BREAKING** `createDeployment` and `createFile` functions expect an instance **InputFile** rather than the instance of **MultipartFile**
212-
* **BREAKING** `list&lt;Entity&gt;` endpoints now contain a `total` attribute instead of `sum`
210+
* **BREAKING** `list<Entity>` endpoints now contain a `total` attribute instead of `sum`
213211
* `onProgress()` callback function for endpoints supporting file uploads
214212
* Support for synchronous function executions
215213
* Bug fixes and Improvements
@@ -270,7 +268,7 @@ https://github.com/appwrite/appwrite/blob/master/CHANGES.md
270268

271269
## 0.7.0
272270
- Support for Appwrite 0.9
273-
- Breaking - removed order type enum, now you should pass string &#039;ASC&#039; or &#039;DESC&#039;
271+
- Breaking - removed order type enum, now you should pass string 'ASC' or 'DESC'
274272
- Image Crop Gravity support in image preview service
275273
- New endpoint in Account getSession to get session by ID
276274
- Fix - issues with User-Agent when app name consisted of non-ASCII characters
@@ -305,7 +303,7 @@ https://github.com/appwrite/appwrite/blob/master/CHANGES.md
305303

306304
- Upgraded to Null-safety, minimum Dart SDK required 2.12.0 and minimum Flutter SDK version required 2.0.0
307305
- Upgraded all underlying dependencies to null safe version
308-
- All of Avatars service now return Future&lt;Response&gt;&lt;/Response&gt; instead of String like the Storage getFilePreview, getFileView and getFileDownload
306+
- All of Avatars service now return Future<Response></Response> instead of String like the Storage getFilePreview, getFileView and getFileDownload
309307
- Upgraded to Null-safety, minimum Dart SDK required 2.12.0
310308
- Upgraded all underlying dependencies to null safe version
311309

@@ -347,7 +345,7 @@ https://github.com/appwrite/appwrite/blob/master/CHANGES.md
347345

348346
## 0.2.3
349347

350-
- Fixed OAuth2 cookie bug, where a new session cookie couldn&#039;t overwrite an old cookie
348+
- Fixed OAuth2 cookie bug, where a new session cookie couldn't overwrite an old cookie
351349

352350
## 0.2.2
353351

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:
2121

2222
```yml
2323
dependencies:
24-
appwrite: ^17.0.1
24+
appwrite: ^17.1.0
2525
```
2626
2727
You can install packages from the command line:

docs/examples/databases/create-document.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:appwrite/appwrite.dart';
22

33
Client client = Client()
44
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setAdmin('') //
56
.setSession('') // The user session to authenticate with
67
.setKey('') //
78
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'package:appwrite/appwrite.dart';
2+
3+
Client client = Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
6+
7+
Databases databases = Databases(client);
8+
9+
Document result = await databases.decrementDocumentAttribute(
10+
databaseId: '<DATABASE_ID>',
11+
collectionId: '<COLLECTION_ID>',
12+
documentId: '<DOCUMENT_ID>',
13+
attribute: '',
14+
value: 0, // optional
15+
min: 0, // optional
16+
);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import 'package:appwrite/appwrite.dart';
2+
3+
Client client = Client()
4+
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5+
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
6+
7+
Databases databases = Databases(client);
8+
9+
Document result = await databases.incrementDocumentAttribute(
10+
databaseId: '<DATABASE_ID>',
11+
collectionId: '<COLLECTION_ID>',
12+
documentId: '<DOCUMENT_ID>',
13+
attribute: '',
14+
value: 0, // optional
15+
max: 0, // optional
16+
);

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.7.x.
3+
/// This SDK is compatible with Appwrite server version 1.7.x.
44
/// For older versions, please check
55
/// [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).
66
library appwrite;

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/id.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class ID {
1010
final now = DateTime.now();
1111
final sec = (now.millisecondsSinceEpoch / 1000).floor();
1212
final usec = now.microsecondsSinceEpoch - (sec * 1000000);
13-
return sec.toRadixString(16) + usec.toRadixString(16).padLeft(5, '0');
13+
return sec.toRadixString(16) +
14+
usec.toRadixString(16).padLeft(5, '0');
1415
}
1516

1617
// Generate a unique ID with padding to have a longer ID

lib/query.dart

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
part of 'appwrite.dart';
22

3+
34
/// Helper class to generate query strings.
45
class Query {
56
final String method;
@@ -9,13 +10,15 @@ class Query {
910
Query._(this.method, [this.attribute = null, this.values = null]);
1011

1112
Map<String, dynamic> toJson() {
12-
final map = <String, dynamic>{'method': method};
13+
final map = <String, dynamic>{
14+
'method': method,
15+
};
1316

14-
if (attribute != null) {
17+
if(attribute != null) {
1518
map['attribute'] = attribute;
1619
}
17-
18-
if (values != null) {
20+
21+
if(values != null) {
1922
map['values'] = values is List ? values : [values];
2023
}
2124

@@ -26,7 +29,7 @@ class Query {
2629
String toString() => jsonEncode(toJson());
2730

2831
/// Filter resources where [attribute] is equal to [value].
29-
///
32+
///
3033
/// [value] can be a single value or a list. If a list is used
3134
/// the query will return resources where [attribute] is equal
3235
/// to any of the values in the list.
@@ -58,12 +61,10 @@ class Query {
5861
Query._('search', attribute, value).toString();
5962

6063
/// Filter resources where [attribute] is null.
61-
static String isNull(String attribute) =>
62-
Query._('isNull', attribute).toString();
64+
static String isNull(String attribute) => Query._('isNull', attribute).toString();
6365

6466
/// Filter resources where [attribute] is not null.
65-
static String isNotNull(String attribute) =>
66-
Query._('isNotNull', attribute).toString();
67+
static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString();
6768

6869
/// Filter resources where [attribute] is between [start] and [end] (inclusive).
6970
static String between(String attribute, dynamic start, dynamic end) =>
@@ -82,51 +83,41 @@ class Query {
8283
static String contains(String attribute, dynamic value) =>
8384
Query._('contains', attribute, value).toString();
8485

85-
static String or(List<String> queries) => Query._(
86-
'or',
87-
null,
88-
queries.map((query) => jsonDecode(query)).toList(),
89-
).toString();
86+
static String or(List<String> queries) =>
87+
Query._('or', null, queries.map((query) => jsonDecode(query)).toList()).toString();
9088

91-
static String and(List<String> queries) => Query._(
92-
'and',
93-
null,
94-
queries.map((query) => jsonDecode(query)).toList(),
95-
).toString();
89+
static String and(List<String> queries) =>
90+
Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString();
9691

9792
/// Specify which attributes should be returned by the API call.
9893
static String select(List<String> attributes) =>
9994
Query._('select', null, attributes).toString();
10095

10196
/// Sort results by [attribute] ascending.
102-
static String orderAsc(String attribute) =>
103-
Query._('orderAsc', attribute).toString();
97+
static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString();
10498

10599
/// Sort results by [attribute] descending.
106-
static String orderDesc(String attribute) =>
107-
Query._('orderDesc', attribute).toString();
100+
static String orderDesc(String attribute) => Query._('orderDesc', attribute).toString();
108101

109102
/// Return results before [id].
110-
///
103+
///
111104
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
112105
/// docs for more information.
113-
static String cursorBefore(String id) =>
114-
Query._('cursorBefore', null, id).toString();
106+
static String cursorBefore(String id) => Query._('cursorBefore', null, id).toString();
115107

116108
/// Return results after [id].
117-
///
109+
///
118110
/// Refer to the [Cursor Based Pagination](https://appwrite.io/docs/pagination#cursor-pagination)
119111
/// docs for more information.
120-
static String cursorAfter(String id) =>
121-
Query._('cursorAfter', null, id).toString();
112+
static String cursorAfter(String id) => Query._('cursorAfter', null, id).toString();
122113

123114
/// Return only [limit] results.
124115
static String limit(int limit) => Query._('limit', null, limit).toString();
125116

126117
/// Return results from [offset].
127-
///
118+
///
128119
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
129120
/// docs for more information.
130-
static String offset(int offset) =>
131-
Query._('offset', null, offset).toString();
132-
}
121+
static String offset(int offset) => Query._('offset', null, offset).toString();
122+
123+
}

0 commit comments

Comments
 (0)