diff --git a/CHANGELOG.md b/CHANGELOG.md index f592de0..4d8f850 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# Change Log + +## 16.0.0 + +* Remove `Gif` from ImageFormat enum +* Remove `search` param from `listExecutions` method +* Add `token` param to `getFilePreview` and `getFileView` for File tokens usage +* Update default `quality` for `getFilePreview` from 0 to -1 + ## 15.0.2 * Avoid setting empty `User-Agent` header and only encode it when present. diff --git a/README.md b/README.md index 793fc62..717cdab 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,12 @@ [![pub package](https://img.shields.io/pub/v/appwrite?style=flat-square)](https://pub.dartlang.org/packages/appwrite) ![License](https://img.shields.io/github/license/appwrite/sdk-for-flutter.svg?style=flat-square) -![Version](https://img.shields.io/badge/api%20version-1.6.x-blue.svg?style=flat-square) +![Version](https://img.shields.io/badge/api%20version-1.7.x-blue.svg?style=flat-square) [![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator) [![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 1.6.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).** +**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).** 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) @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file: ```yml dependencies: - appwrite: ^15.0.2 + appwrite: ^16.0.0 ``` You can install packages from the command line: diff --git a/docs/examples/avatars/get-browser.md b/docs/examples/avatars/get-browser.md index 0ca83b8..e97d24a 100644 --- a/docs/examples/avatars/get-browser.md +++ b/docs/examples/avatars/get-browser.md @@ -11,7 +11,7 @@ UInt8List bytes = await avatars.getBrowser( code: Browser.avantBrowser, width: 0, // optional height: 0, // optional - quality: 0, // optional + quality: -1, // optional ) final file = File('path_to_file/filename.ext'); @@ -23,7 +23,7 @@ FutureBuilder( code: Browser.avantBrowser, width:0 , // optional height:0 , // optional - quality:0 , // optional + quality:-1 , // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/docs/examples/avatars/get-credit-card.md b/docs/examples/avatars/get-credit-card.md index 1075e81..9ec4258 100644 --- a/docs/examples/avatars/get-credit-card.md +++ b/docs/examples/avatars/get-credit-card.md @@ -11,7 +11,7 @@ UInt8List bytes = await avatars.getCreditCard( code: CreditCard.americanExpress, width: 0, // optional height: 0, // optional - quality: 0, // optional + quality: -1, // optional ) final file = File('path_to_file/filename.ext'); @@ -23,7 +23,7 @@ FutureBuilder( code: CreditCard.americanExpress, width:0 , // optional height:0 , // optional - quality:0 , // optional + quality:-1 , // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/docs/examples/avatars/get-flag.md b/docs/examples/avatars/get-flag.md index 3aae5bf..99d4340 100644 --- a/docs/examples/avatars/get-flag.md +++ b/docs/examples/avatars/get-flag.md @@ -11,7 +11,7 @@ UInt8List bytes = await avatars.getFlag( code: Flag.afghanistan, width: 0, // optional height: 0, // optional - quality: 0, // optional + quality: -1, // optional ) final file = File('path_to_file/filename.ext'); @@ -23,7 +23,7 @@ FutureBuilder( code: Flag.afghanistan, width:0 , // optional height:0 , // optional - quality:0 , // optional + quality:-1 , // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/docs/examples/databases/create-document.md b/docs/examples/databases/create-document.md index 27efc34..4f286ff 100644 --- a/docs/examples/databases/create-document.md +++ b/docs/examples/databases/create-document.md @@ -2,7 +2,9 @@ import 'package:appwrite/appwrite.dart'; Client client = Client() .setEndpoint('https://.cloud.appwrite.io/v1') // Your API Endpoint - .setProject(''); // Your project ID + .setSession('') // The user session to authenticate with + .setKey('') // + .setJWT(''); // Your secret JSON Web Token Databases databases = Databases(client); diff --git a/docs/examples/functions/list-executions.md b/docs/examples/functions/list-executions.md index accebe9..232f325 100644 --- a/docs/examples/functions/list-executions.md +++ b/docs/examples/functions/list-executions.md @@ -9,5 +9,4 @@ Functions functions = Functions(client); ExecutionList result = await functions.listExecutions( functionId: '', queries: [], // optional - search: '', // optional ); diff --git a/docs/examples/storage/get-file-download.md b/docs/examples/storage/get-file-download.md index 9048fe4..5bef06e 100644 --- a/docs/examples/storage/get-file-download.md +++ b/docs/examples/storage/get-file-download.md @@ -10,6 +10,7 @@ Storage storage = Storage(client); UInt8List bytes = await storage.getFileDownload( bucketId: '', fileId: '', + token: '', // optional ) final file = File('path_to_file/filename.ext'); @@ -20,6 +21,7 @@ FutureBuilder( future: storage.getFileDownload( bucketId:'' , fileId:'' , + token:'' , // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/docs/examples/storage/get-file-preview.md b/docs/examples/storage/get-file-preview.md index 3d81e61..96338bd 100644 --- a/docs/examples/storage/get-file-preview.md +++ b/docs/examples/storage/get-file-preview.md @@ -13,7 +13,7 @@ UInt8List bytes = await storage.getFilePreview( width: 0, // optional height: 0, // optional gravity: ImageGravity.center, // optional - quality: 0, // optional + quality: -1, // optional borderWidth: 0, // optional borderColor: '', // optional borderRadius: 0, // optional @@ -21,6 +21,7 @@ UInt8List bytes = await storage.getFilePreview( rotation: -360, // optional background: '', // optional output: ImageFormat.jpg, // optional + token: '', // optional ) final file = File('path_to_file/filename.ext'); @@ -34,7 +35,7 @@ FutureBuilder( width:0 , // optional height:0 , // optional gravity: ImageGravity.center, // optional - quality:0 , // optional + quality:-1 , // optional borderWidth:0 , // optional borderColor:'' , // optional borderRadius:0 , // optional @@ -42,6 +43,7 @@ FutureBuilder( rotation:-360 , // optional background:'' , // optional output: ImageFormat.jpg, // optional + token:'' , // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/docs/examples/storage/get-file-view.md b/docs/examples/storage/get-file-view.md index 7d43806..6587f08 100644 --- a/docs/examples/storage/get-file-view.md +++ b/docs/examples/storage/get-file-view.md @@ -10,6 +10,7 @@ Storage storage = Storage(client); UInt8List bytes = await storage.getFileView( bucketId: '', fileId: '', + token: '', // optional ) final file = File('path_to_file/filename.ext'); @@ -20,6 +21,7 @@ FutureBuilder( future: storage.getFileView( bucketId:'' , fileId:'' , + token:'' , // optional ), // Works for both public file and private file, for private files you need to be logged in builder: (context, snapshot) { return snapshot.hasData && snapshot.data != null diff --git a/lib/appwrite.dart b/lib/appwrite.dart index c89bac2..d1d5610 100644 --- a/lib/appwrite.dart +++ b/lib/appwrite.dart @@ -1,6 +1,6 @@ /// Appwrite Flutter SDK /// -/// This SDK is compatible with Appwrite server version 1.6.x. +/// 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). library appwrite; diff --git a/lib/services/databases.dart b/lib/services/databases.dart index eb3cdd3..f276f50 100644 --- a/lib/services/databases.dart +++ b/lib/services/databases.dart @@ -36,7 +36,6 @@ class Databases extends Service { /// collection resource using either a [server /// integration](https://appwrite.io/docs/server/databases#databasesCreateCollection) /// API or directly from your database console. - /// Future createDocument({ required String databaseId, required String collectionId, diff --git a/lib/services/functions.dart b/lib/services/functions.dart index 6017b64..d892427 100644 --- a/lib/services/functions.dart +++ b/lib/services/functions.dart @@ -11,17 +11,13 @@ class Functions extends Service { Future listExecutions({ required String functionId, List? queries, - String? search, }) async { final String apiPath = '/functions/{functionId}/executions'.replaceAll( '{functionId}', functionId, ); - final Map apiParams = { - 'queries': queries, - 'search': search, - }; + final Map apiParams = {'queries': queries}; final Map apiHeaders = {}; diff --git a/lib/services/storage.dart b/lib/services/storage.dart index 1ce98f4..258776f 100644 --- a/lib/services/storage.dart +++ b/lib/services/storage.dart @@ -169,12 +169,17 @@ class Storage extends Service { Future getFileDownload({ required String bucketId, required String fileId, + String? token, }) async { final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/download' .replaceAll('{bucketId}', bucketId) .replaceAll('{fileId}', fileId); - final Map params = {'project': client.config['project']}; + final Map params = { + 'token': token, + + 'project': client.config['project'], + }; final res = await client.call( HttpMethod.get, @@ -204,6 +209,7 @@ class Storage extends Service { int? rotation, String? background, enums.ImageFormat? output, + String? token, }) async { final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/preview' .replaceAll('{bucketId}', bucketId) @@ -221,6 +227,7 @@ class Storage extends Service { 'rotation': rotation, 'background': background, 'output': output?.value, + 'token': token, 'project': client.config['project'], }; @@ -240,12 +247,17 @@ class Storage extends Service { Future getFileView({ required String bucketId, required String fileId, + String? token, }) async { final String apiPath = '/storage/buckets/{bucketId}/files/{fileId}/view' .replaceAll('{bucketId}', bucketId) .replaceAll('{fileId}', fileId); - final Map params = {'project': client.config['project']}; + final Map params = { + 'token': token, + + 'project': client.config['project'], + }; final res = await client.call( HttpMethod.get, diff --git a/lib/src/client_browser.dart b/lib/src/client_browser.dart index f82b4c4..f1d51f9 100644 --- a/lib/src/client_browser.dart +++ b/lib/src/client_browser.dart @@ -40,8 +40,8 @@ class ClientBrowser extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '15.0.2', - 'X-Appwrite-Response-Format': '1.6.0', + 'x-sdk-version': '16.0.0', + 'X-Appwrite-Response-Format': '1.7.0', }; config = {}; diff --git a/lib/src/client_io.dart b/lib/src/client_io.dart index a3e4f01..440dbd5 100644 --- a/lib/src/client_io.dart +++ b/lib/src/client_io.dart @@ -59,8 +59,8 @@ class ClientIO extends ClientBase with ClientMixin { 'x-sdk-name': 'Flutter', 'x-sdk-platform': 'client', 'x-sdk-language': 'flutter', - 'x-sdk-version': '15.0.2', - 'X-Appwrite-Response-Format': '1.6.0', + 'x-sdk-version': '16.0.0', + 'X-Appwrite-Response-Format': '1.7.0', }; config = {}; diff --git a/lib/src/enums/image_format.dart b/lib/src/enums/image_format.dart index 4d07af1..120c93f 100644 --- a/lib/src/enums/image_format.dart +++ b/lib/src/enums/image_format.dart @@ -3,7 +3,6 @@ part of '../../enums.dart'; enum ImageFormat { jpg(value: 'jpg'), jpeg(value: 'jpeg'), - gif(value: 'gif'), png(value: 'png'), webp(value: 'webp'), heic(value: 'heic'), diff --git a/lib/src/models/execution.dart b/lib/src/models/execution.dart index 3a7a353..8618bcd 100644 --- a/lib/src/models/execution.dart +++ b/lib/src/models/execution.dart @@ -47,7 +47,7 @@ class Execution implements Model { /// 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. final String errors; - /// Function execution duration in seconds. + /// Resource(function/site) execution duration in seconds. final double duration; /// The scheduled time for execution. If left empty, execution will be queued immediately. diff --git a/pubspec.yaml b/pubspec.yaml index 3f6cfd5..a48a262 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: appwrite -version: 15.0.2 +version: 16.0.0 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 homepage: https://appwrite.io repository: https://github.com/appwrite/sdk-for-flutter