Skip to content

Commit 23e3df3

Browse files
add param checking and removed default values
1 parent b065d93 commit 23e3df3

File tree

10 files changed

+34
-36
lines changed

10 files changed

+34
-36
lines changed

CHANGELOG.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
## 0.6.2
2-
3-
- Fixed deployment bug
4-
5-
## 0.6.1
6-
7-
- Fix for image preview param types
8-
91
## 0.6.0
102

113
- Upgraded to Null-safety, minimum Dart SDK required 2.12.0

README.md

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

2323
```yml
2424
dependencies:
25-
appwrite: ^0.6.2
25+
appwrite: ^0.6.3
2626
```
2727
2828
You can install packages from the command line:

lib/client.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Client {
2626

2727
this.headers = {
2828
'content-type': 'application/json',
29-
'x-sdk-version': 'appwrite:flutter:0.6.2',
29+
'x-sdk-version': 'appwrite:flutter:0.6.3',
3030
'X-Appwrite-Response-Format' : '0.8.0',
3131
};
3232

@@ -141,6 +141,12 @@ class Client {
141141
await this.init();
142142
}
143143

144+
params.keys.forEach((key) {
145+
if (params[key] == null) {
146+
params.remove(key);
147+
}
148+
});
149+
144150
// Origin is hardcoded for testing
145151
Options options = Options(
146152
headers: {...this.headers!, ...headers},

lib/services/account.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Account extends Service {
3030
/// login to their new account, you need to create a new [account
3131
/// session](/docs/client/account#accountCreateSession).
3232
///
33-
Future<Response> create({required String email, required String password, String name = ''}) {
33+
Future<Response> create({required String email, required String password, String? name}) {
3434
final String path = '/account';
3535

3636
final Map<String, dynamic> params = {
@@ -153,7 +153,7 @@ class Account extends Service {
153153
/// to pass in the new password, and the old password. For users created with
154154
/// OAuth and Team Invites, oldPassword is optional.
155155
///
156-
Future<Response> updatePassword({required String password, String oldPassword = ''}) {
156+
Future<Response> updatePassword({required String password, String? oldPassword}) {
157157
final String path = '/account/password';
158158

159159
final Map<String, dynamic> params = {
@@ -343,7 +343,7 @@ class Account extends Service {
343343
/// first. Use the success and failure arguments to provide a redirect URL's
344344
/// back to your app when login is completed.
345345
///
346-
Future createOAuth2Session({required String provider, String success = 'https://appwrite.io/auth/oauth2/success', String failure = 'https://appwrite.io/auth/oauth2/failure', List scopes = const []}) {
346+
Future createOAuth2Session({required String provider, String? success, String? failure, List? scopes}) {
347347
final String path = '/account/sessions/oauth2/{provider}'.replaceAll(RegExp('{provider}'), provider);
348348

349349
final Map<String, dynamic> params = {

lib/services/avatars.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Avatars extends Service {
1111
/// /account/sessions endpoint. Use width, height and quality arguments to
1212
/// change the output settings.
1313
///
14-
Future<Response> getBrowser({required String code, int width = 100, int height = 100, int quality = 100}) {
14+
Future<Response> getBrowser({required String code, int? width, int? height, int? quality}) {
1515
final String path = '/avatars/browsers/{code}'.replaceAll(RegExp('{code}'), code);
1616

1717
final Map<String, dynamic> params = {
@@ -34,7 +34,7 @@ class Avatars extends Service {
3434
/// provider you need. Use width, height and quality arguments to change the
3535
/// output settings.
3636
///
37-
Future<Response> getCreditCard({required String code, int width = 100, int height = 100, int quality = 100}) {
37+
Future<Response> getCreditCard({required String code, int? width, int? height, int? quality}) {
3838
final String path = '/avatars/credit-cards/{code}'.replaceAll(RegExp('{code}'), code);
3939

4040
final Map<String, dynamic> params = {
@@ -78,7 +78,7 @@ class Avatars extends Service {
7878
/// users. The code argument receives the 2 letter country code. Use width,
7979
/// height and quality arguments to change the output settings.
8080
///
81-
Future<Response> getFlag({required String code, int width = 100, int height = 100, int quality = 100}) {
81+
Future<Response> getFlag({required String code, int? width, int? height, int? quality}) {
8282
final String path = '/avatars/flags/{code}'.replaceAll(RegExp('{code}'), code);
8383

8484
final Map<String, dynamic> params = {
@@ -102,7 +102,7 @@ class Avatars extends Service {
102102
/// remote images in your app or in case you want to make sure a 3rd party
103103
/// image is properly served using a TLS protocol.
104104
///
105-
Future<Response> getImage({required String url, int width = 400, int height = 400}) {
105+
Future<Response> getImage({required String url, int? width, int? height}) {
106106
final String path = '/avatars/image';
107107

108108
final Map<String, dynamic> params = {
@@ -132,7 +132,7 @@ class Avatars extends Service {
132132
/// the user's initials when reloading the same theme will always return for
133133
/// the same initials.
134134
///
135-
Future<Response> getInitials({String name = '', int width = 500, int height = 500, String color = '', String background = ''}) {
135+
Future<Response> getInitials({String? name, int? width, int? height, String? color, String? background}) {
136136
final String path = '/avatars/initials';
137137

138138
final Map<String, dynamic> params = {
@@ -156,7 +156,7 @@ class Avatars extends Service {
156156
/// Converts a given plain text to a QR code image. You can use the query
157157
/// parameters to change the size and style of the resulting image.
158158
///
159-
Future<Response> getQR({required String text, int size = 400, int margin = 1, bool download = false}) {
159+
Future<Response> getQR({required String text, int? size, int? margin, bool? download}) {
160160
final String path = '/avatars/qr';
161161

162162
final Map<String, dynamic> params = {

lib/services/database.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Database extends Service {
1111
/// of the project's documents. [Learn more about different API
1212
/// modes](/docs/admin).
1313
///
14-
Future<Response> listDocuments({required String collectionId, List filters = const [], int limit = 25, int offset = 0, String orderField = '', OrderType orderType = OrderType.asc, String orderCast = 'string', String search = ''}) {
14+
Future<Response> listDocuments({required String collectionId, List? filters, int? limit, int? offset, String? orderField, OrderType orderType = OrderType.asc, String? orderCast, String? search}) {
1515
final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
1616

1717
final Map<String, dynamic> params = {
@@ -38,7 +38,7 @@ class Database extends Service {
3838
/// integration](/docs/server/database#databaseCreateCollection) API or
3939
/// directly from your database console.
4040
///
41-
Future<Response> createDocument({required String collectionId, required Map data, List read = const [], List write = const [], String parentDocument = '', String parentProperty = '', String parentPropertyType = 'assign'}) {
41+
Future<Response> createDocument({required String collectionId, required Map data, List? read, List? write, String? parentDocument, String? parentProperty, String? parentPropertyType}) {
4242
final String path = '/database/collections/{collectionId}/documents'.replaceAll(RegExp('{collectionId}'), collectionId);
4343

4444
final Map<String, dynamic> params = {
@@ -80,7 +80,7 @@ class Database extends Service {
8080
/// Update a document by its unique ID. Using the patch method you can pass
8181
/// only specific fields that will get updated.
8282
///
83-
Future<Response> updateDocument({required String collectionId, required String documentId, required Map data, List read = const [], List write = const []}) {
83+
Future<Response> updateDocument({required String collectionId, required String documentId, required Map data, List? read, List? write}) {
8484
final String path = '/database/collections/{collectionId}/documents/{documentId}'.replaceAll(RegExp('{collectionId}'), collectionId).replaceAll(RegExp('{documentId}'), documentId);
8585

8686
final Map<String, dynamic> params = {

lib/services/functions.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Functions extends Service {
1111
/// return a list of all of the project's executions. [Learn more about
1212
/// different API modes](/docs/admin).
1313
///
14-
Future<Response> listExecutions({required String functionId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) {
14+
Future<Response> listExecutions({required String functionId, String? search, int? limit, int? offset, OrderType orderType = OrderType.asc}) {
1515
final String path = '/functions/{functionId}/executions'.replaceAll(RegExp('{functionId}'), functionId);
1616

1717
final Map<String, dynamic> params = {
@@ -35,7 +35,7 @@ class Functions extends Service {
3535
/// updates on the current execution status. Once this endpoint is called, your
3636
/// function execution process will start asynchronously.
3737
///
38-
Future<Response> createExecution({required String functionId, String data = ''}) {
38+
Future<Response> createExecution({required String functionId, String? data}) {
3939
final String path = '/functions/{functionId}/executions'.replaceAll(RegExp('{functionId}'), functionId);
4040

4141
final Map<String, dynamic> params = {

lib/services/storage.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Storage extends Service {
1010
/// your results. On admin mode, this endpoint will return a list of all of the
1111
/// project's files. [Learn more about different API modes](/docs/admin).
1212
///
13-
Future<Response> listFiles({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) {
13+
Future<Response> listFiles({String? search, int? limit, int? offset, OrderType orderType = OrderType.asc}) {
1414
final String path = '/storage/files';
1515

1616
final Map<String, dynamic> params = {
@@ -33,7 +33,7 @@ class Storage extends Service {
3333
/// assigned to read and write access unless he has passed custom values for
3434
/// read and write arguments.
3535
///
36-
Future<Response> createFile({required MultipartFile file, List read = const [], List write = const []}) {
36+
Future<Response> createFile({required MultipartFile file, List? read, List? write}) {
3737
final String path = '/storage/files';
3838

3939
final Map<String, dynamic> params = {
@@ -132,7 +132,7 @@ class Storage extends Service {
132132
/// and spreadsheets, will return the file icon image. You can also pass query
133133
/// string arguments for cutting and resizing your preview image.
134134
///
135-
Future<Response> getFilePreview({required String fileId, int width = 0, int height = 0, int quality = 100, int borderWidth = 0, String borderColor = '', int borderRadius = 0, double opacity = 1, int rotation = 0, String background = '', String output = ''}) {
135+
Future<Response> getFilePreview({required String fileId, int? width, int? height, int? quality, int? borderWidth, String? borderColor, int? borderRadius, int? opacity, int? rotation, String? background, String? output}) {
136136
final String path = '/storage/files/{fileId}/preview'.replaceAll(RegExp('{fileId}'), fileId);
137137

138138
final Map<String, dynamic> params = {

lib/services/teams.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Teams extends Service {
1111
/// of the project's teams. [Learn more about different API
1212
/// modes](/docs/admin).
1313
///
14-
Future<Response> list({String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) {
14+
Future<Response> list({String? search, int? limit, int? offset, OrderType orderType = OrderType.asc}) {
1515
final String path = '/teams';
1616

1717
final Map<String, dynamic> params = {
@@ -35,7 +35,7 @@ class Teams extends Service {
3535
/// who will be able add new owners and update or delete the team from your
3636
/// project.
3737
///
38-
Future<Response> create({required String name, List roles = const ["owner"]}) {
38+
Future<Response> create({required String name, List? roles}) {
3939
final String path = '/teams';
4040

4141
final Map<String, dynamic> params = {
@@ -110,7 +110,7 @@ class Teams extends Service {
110110
/// Get a team members by the team unique ID. All team members have read access
111111
/// for this list of resources.
112112
///
113-
Future<Response> getMemberships({required String teamId, String search = '', int limit = 25, int offset = 0, OrderType orderType = OrderType.asc}) {
113+
Future<Response> getMemberships({required String teamId, String? search, int? limit, int? offset, OrderType orderType = OrderType.asc}) {
114114
final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
115115

116116
final Map<String, dynamic> params = {
@@ -143,7 +143,7 @@ class Teams extends Service {
143143
/// the only valid redirect URL's are the once from domains you have set when
144144
/// added your platforms in the console interface.
145145
///
146-
Future<Response> createMembership({required String teamId, required String email, required List roles, required String url, String name = ''}) {
146+
Future<Response> createMembership({required String teamId, required String email, required List roles, required String url, String? name}) {
147147
final String path = '/teams/{teamId}/memberships'.replaceAll(RegExp('{teamId}'), teamId);
148148

149149
final Map<String, dynamic> params = {

pubspec.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: appwrite
2-
version: 0.6.2
2+
version: 0.6.3
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
@@ -11,13 +11,13 @@ dependencies:
1111
flutter:
1212
sdk: flutter
1313
cookie_jar: ^3.0.1
14-
device_info_plus: ^1.0.0
14+
device_info_plus: ^1.0.1
1515
dio: ^4.0.0
1616
dio_cookie_manager: ^2.0.0
1717
flutter_web_auth: ^0.3.0
18-
package_info_plus: ^1.0.0
19-
path_provider: ^2.0.1
20-
shared_preferences: ^2.0.5
18+
package_info_plus: ^1.0.1
19+
path_provider: ^2.0.2
20+
shared_preferences: ^2.0.6
2121
universal_html: ^2.0.8
2222

2323
dev_dependencies:

0 commit comments

Comments
 (0)