Skip to content

Commit 5ee6bfb

Browse files
authored
Merge pull request #250 from appwrite/dev
Dev
2 parents 185e6b7 + ee53d24 commit 5ee6bfb

19 files changed

+51
-29
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
# Change Log
2+
3+
## 16.0.0
4+
5+
* Remove `Gif` from ImageFormat enum
6+
* Remove `search` param from `listExecutions` method
7+
* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage
8+
* Update default `quality` for `getFilePreview` from 0 to -1
9+
110
## 15.0.2
211

312
* Avoid setting empty `User-Agent` header and only encode it when present.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
[![pub package](https://img.shields.io/pub/v/appwrite?style=flat-square)](https://pub.dartlang.org/packages/appwrite)
44
![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?style=flat-square)
5-
![Version](https://img.shields.io/badge/api%20version-1.6.x-blue.svg?style=flat-square)
5+
![Version](https://img.shields.io/badge/api%20version-1.7.x-blue.svg?style=flat-square)
66
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
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.6.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 1.7.x. 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 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)
1313

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

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

docs/examples/avatars/get-browser.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ UInt8List bytes = await avatars.getBrowser(
1111
code: Browser.avantBrowser,
1212
width: 0, // optional
1313
height: 0, // optional
14-
quality: 0, // optional
14+
quality: -1, // optional
1515
)
1616

1717
final file = File('path_to_file/filename.ext');
@@ -23,7 +23,7 @@ FutureBuilder(
2323
code: Browser.avantBrowser,
2424
width:0 , // optional
2525
height:0 , // optional
26-
quality:0 , // optional
26+
quality:-1 , // optional
2727
), // Works for both public file and private file, for private files you need to be logged in
2828
builder: (context, snapshot) {
2929
return snapshot.hasData && snapshot.data != null

docs/examples/avatars/get-credit-card.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ UInt8List bytes = await avatars.getCreditCard(
1111
code: CreditCard.americanExpress,
1212
width: 0, // optional
1313
height: 0, // optional
14-
quality: 0, // optional
14+
quality: -1, // optional
1515
)
1616

1717
final file = File('path_to_file/filename.ext');
@@ -23,7 +23,7 @@ FutureBuilder(
2323
code: CreditCard.americanExpress,
2424
width:0 , // optional
2525
height:0 , // optional
26-
quality:0 , // optional
26+
quality:-1 , // optional
2727
), // Works for both public file and private file, for private files you need to be logged in
2828
builder: (context, snapshot) {
2929
return snapshot.hasData && snapshot.data != null

docs/examples/avatars/get-flag.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ UInt8List bytes = await avatars.getFlag(
1111
code: Flag.afghanistan,
1212
width: 0, // optional
1313
height: 0, // optional
14-
quality: 0, // optional
14+
quality: -1, // optional
1515
)
1616

1717
final file = File('path_to_file/filename.ext');
@@ -23,7 +23,7 @@ FutureBuilder(
2323
code: Flag.afghanistan,
2424
width:0 , // optional
2525
height:0 , // optional
26-
quality:0 , // optional
26+
quality:-1 , // optional
2727
), // Works for both public file and private file, for private files you need to be logged in
2828
builder: (context, snapshot) {
2929
return snapshot.hasData && snapshot.data != null

docs/examples/databases/create-document.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import 'package:appwrite/appwrite.dart';
22

33
Client client = Client()
44
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
5-
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
5+
.setSession('') // The user session to authenticate with
6+
.setKey('') //
7+
.setJWT('<YOUR_JWT>'); // Your secret JSON Web Token
68

79
Databases databases = Databases(client);
810

docs/examples/functions/list-executions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ Functions functions = Functions(client);
99
ExecutionList result = await functions.listExecutions(
1010
functionId: '<FUNCTION_ID>',
1111
queries: [], // optional
12-
search: '<SEARCH>', // optional
1312
);

docs/examples/storage/get-file-download.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Storage storage = Storage(client);
1010
UInt8List bytes = await storage.getFileDownload(
1111
bucketId: '<BUCKET_ID>',
1212
fileId: '<FILE_ID>',
13+
token: '<TOKEN>', // optional
1314
)
1415

1516
final file = File('path_to_file/filename.ext');
@@ -20,6 +21,7 @@ FutureBuilder(
2021
future: storage.getFileDownload(
2122
bucketId:'<BUCKET_ID>' ,
2223
fileId:'<FILE_ID>' ,
24+
token:'<TOKEN>' , // optional
2325
), // Works for both public file and private file, for private files you need to be logged in
2426
builder: (context, snapshot) {
2527
return snapshot.hasData && snapshot.data != null

docs/examples/storage/get-file-preview.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ UInt8List bytes = await storage.getFilePreview(
1313
width: 0, // optional
1414
height: 0, // optional
1515
gravity: ImageGravity.center, // optional
16-
quality: 0, // optional
16+
quality: -1, // optional
1717
borderWidth: 0, // optional
1818
borderColor: '', // optional
1919
borderRadius: 0, // optional
2020
opacity: 0, // optional
2121
rotation: -360, // optional
2222
background: '', // optional
2323
output: ImageFormat.jpg, // optional
24+
token: '<TOKEN>', // optional
2425
)
2526

2627
final file = File('path_to_file/filename.ext');
@@ -34,14 +35,15 @@ FutureBuilder(
3435
width:0 , // optional
3536
height:0 , // optional
3637
gravity: ImageGravity.center, // optional
37-
quality:0 , // optional
38+
quality:-1 , // optional
3839
borderWidth:0 , // optional
3940
borderColor:'' , // optional
4041
borderRadius:0 , // optional
4142
opacity:0 , // optional
4243
rotation:-360 , // optional
4344
background:'' , // optional
4445
output: ImageFormat.jpg, // optional
46+
token:'<TOKEN>' , // optional
4547
), // Works for both public file and private file, for private files you need to be logged in
4648
builder: (context, snapshot) {
4749
return snapshot.hasData && snapshot.data != null

docs/examples/storage/get-file-view.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Storage storage = Storage(client);
1010
UInt8List bytes = await storage.getFileView(
1111
bucketId: '<BUCKET_ID>',
1212
fileId: '<FILE_ID>',
13+
token: '<TOKEN>', // optional
1314
)
1415

1516
final file = File('path_to_file/filename.ext');
@@ -20,6 +21,7 @@ FutureBuilder(
2021
future: storage.getFileView(
2122
bucketId:'<BUCKET_ID>' ,
2223
fileId:'<FILE_ID>' ,
24+
token:'<TOKEN>' , // optional
2325
), // Works for both public file and private file, for private files you need to be logged in
2426
builder: (context, snapshot) {
2527
return snapshot.hasData && snapshot.data != null

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.6.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/services/databases.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class Databases extends Service {
3636
/// collection resource using either a [server
3737
/// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection)
3838
/// API or directly from your database console.
39-
///
4039
Future<models.Document> createDocument({
4140
required String databaseId,
4241
required String collectionId,

lib/services/functions.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ class Functions extends Service {
1111
Future<models.ExecutionList> listExecutions({
1212
required String functionId,
1313
List<String>? queries,
14-
String? search,
1514
}) async {
1615
final String apiPath = '/functions/{functionId}/executions'.replaceAll(
1716
'{functionId}',
1817
functionId,
1918
);
2019

21-
final Map<String, dynamic> apiParams = {
22-
'queries': queries,
23-
'search': search,
24-
};
20+
final Map<String, dynamic> apiParams = {'queries': queries};
2521

2622
final Map<String, String> apiHeaders = {};
2723

lib/services/storage.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,17 @@ class Storage extends Service {
169169
Future<Uint8List> getFileDownload({
170170
required String bucketId,
171171
required String fileId,
172+
String? token,
172173
}) async {
173174
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download'
174175
.replaceAll('{bucketId}', bucketId)
175176
.replaceAll('{fileId}', fileId);
176177

177-
final Map<String, dynamic> params = {'project': client.config['project']};
178+
final Map<String, dynamic> params = {
179+
'token': token,
180+
181+
'project': client.config['project'],
182+
};
178183

179184
final res = await client.call(
180185
HttpMethod.get,
@@ -204,6 +209,7 @@ class Storage extends Service {
204209
int? rotation,
205210
String? background,
206211
enums.ImageFormat? output,
212+
String? token,
207213
}) async {
208214
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview'
209215
.replaceAll('{bucketId}', bucketId)
@@ -221,6 +227,7 @@ class Storage extends Service {
221227
'rotation': rotation,
222228
'background': background,
223229
'output': output?.value,
230+
'token': token,
224231

225232
'project': client.config['project'],
226233
};
@@ -240,12 +247,17 @@ class Storage extends Service {
240247
Future<Uint8List> getFileView({
241248
required String bucketId,
242249
required String fileId,
250+
String? token,
243251
}) async {
244252
final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view'
245253
.replaceAll('{bucketId}', bucketId)
246254
.replaceAll('{fileId}', fileId);
247255

248-
final Map<String, dynamic> params = {'project': client.config['project']};
256+
final Map<String, dynamic> params = {
257+
'token': token,
258+
259+
'project': client.config['project'],
260+
};
249261

250262
final res = await client.call(
251263
HttpMethod.get,

lib/src/client_browser.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ class ClientBrowser extends ClientBase with ClientMixin {
4040
'x-sdk-name': 'Flutter',
4141
'x-sdk-platform': 'client',
4242
'x-sdk-language': 'flutter',
43-
'x-sdk-version': '15.0.2',
44-
'X-Appwrite-Response-Format': '1.6.0',
43+
'x-sdk-version': '16.0.0',
44+
'X-Appwrite-Response-Format': '1.7.0',
4545
};
4646

4747
config = {};

lib/src/client_io.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class ClientIO extends ClientBase with ClientMixin {
5959
'x-sdk-name': 'Flutter',
6060
'x-sdk-platform': 'client',
6161
'x-sdk-language': 'flutter',
62-
'x-sdk-version': '15.0.2',
63-
'X-Appwrite-Response-Format': '1.6.0',
62+
'x-sdk-version': '16.0.0',
63+
'X-Appwrite-Response-Format': '1.7.0',
6464
};
6565

6666
config = {};

lib/src/enums/image_format.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ part of '../../enums.dart';
33
enum ImageFormat {
44
jpg(value: 'jpg'),
55
jpeg(value: 'jpeg'),
6-
gif(value: 'gif'),
76
png(value: 'png'),
87
webp(value: 'webp'),
98
heic(value: 'heic'),

lib/src/models/execution.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Execution implements Model {
4747
/// Function errors. Includes the last 4,000 characters. This will return an empty string unless the response is returned using an API key or as part of a webhook payload.
4848
final String errors;
4949

50-
/// Function execution duration in seconds.
50+
/// Resource(function/site) execution duration in seconds.
5151
final double duration;
5252

5353
/// The scheduled time for execution. If left empty, execution will be queued immediately.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: appwrite
2-
version: 15.0.2
2+
version: 16.0.0
33
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
44
homepage: https://appwrite.io
55
repository: https://github.com/appwrite/sdk-for-flutter

0 commit comments

Comments
 (0)