Skip to content

Dev #250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 18, 2025
Merged

Dev #250

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,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.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/avatars/get-browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/avatars/get-credit-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/avatars/get-flag.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/examples/databases/create-document.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import 'package:appwrite/appwrite.dart';

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

Databases databases = Databases(client);

Expand Down
1 change: 0 additions & 1 deletion docs/examples/functions/list-executions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ Functions functions = Functions(client);
ExecutionList result = await functions.listExecutions(
functionId: '<FUNCTION_ID>',
queries: [], // optional
search: '<SEARCH>', // optional
);
2 changes: 2 additions & 0 deletions docs/examples/storage/get-file-download.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Storage storage = Storage(client);
UInt8List bytes = await storage.getFileDownload(
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
token: '<TOKEN>', // optional
)

final file = File('path_to_file/filename.ext');
Expand All @@ -20,6 +21,7 @@ FutureBuilder(
future: storage.getFileDownload(
bucketId:'<BUCKET_ID>' ,
fileId:'<FILE_ID>' ,
token:'<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
Expand Down
6 changes: 4 additions & 2 deletions docs/examples/storage/get-file-preview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@ 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
opacity: 0, // optional
rotation: -360, // optional
background: '', // optional
output: ImageFormat.jpg, // optional
token: '<TOKEN>', // optional
)

final file = File('path_to_file/filename.ext');
Expand All @@ -34,14 +35,15 @@ 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
opacity:0 , // optional
rotation:-360 , // optional
background:'' , // optional
output: ImageFormat.jpg, // optional
token:'<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
Expand Down
2 changes: 2 additions & 0 deletions docs/examples/storage/get-file-view.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Storage storage = Storage(client);
UInt8List bytes = await storage.getFileView(
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
token: '<TOKEN>', // optional
)

final file = File('path_to_file/filename.ext');
Expand All @@ -20,6 +21,7 @@ FutureBuilder(
future: storage.getFileView(
bucketId:'<BUCKET_ID>' ,
fileId:'<FILE_ID>' ,
token:'<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
Expand Down
2 changes: 1 addition & 1 deletion lib/appwrite.dart
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 0 additions & 1 deletion lib/services/databases.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<models.Document> createDocument({
required String databaseId,
required String collectionId,
Expand Down
6 changes: 1 addition & 5 deletions lib/services/functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,13 @@ class Functions extends Service {
Future<models.ExecutionList> listExecutions({
required String functionId,
List<String>? queries,
String? search,
}) async {
final String apiPath = '/functions/{functionId}/executions'.replaceAll(
'{functionId}',
functionId,
);

final Map<String, dynamic> apiParams = {
'queries': queries,
'search': search,
};
final Map<String, dynamic> apiParams = {'queries': queries};

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

Expand Down
16 changes: 14 additions & 2 deletions lib/services/storage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,17 @@ class Storage extends Service {
Future<Uint8List> 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<String, dynamic> params = {'project': client.config['project']};
final Map<String, dynamic> params = {
'token': token,

'project': client.config['project'],
};

final res = await client.call(
HttpMethod.get,
Expand Down Expand Up @@ -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)
Expand All @@ -221,6 +227,7 @@ class Storage extends Service {
'rotation': rotation,
'background': background,
'output': output?.value,
'token': token,

'project': client.config['project'],
};
Expand All @@ -240,12 +247,17 @@ class Storage extends Service {
Future<Uint8List> 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<String, dynamic> params = {'project': client.config['project']};
final Map<String, dynamic> params = {
'token': token,

'project': client.config['project'],
};

final res = await client.call(
HttpMethod.get,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/client_browser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
4 changes: 2 additions & 2 deletions lib/src/client_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down
1 change: 0 additions & 1 deletion lib/src/enums/image_format.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/models/execution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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: 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
Expand Down