Skip to content

Commit

Permalink
chore: update SDKs for appwrite 1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
christyjacob4 committed Aug 23, 2024
1 parent d1caf81 commit 39032cb
Show file tree
Hide file tree
Showing 91 changed files with 4,743 additions and 5,141 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Add this to your package's `pubspec.yaml` file:

```yml
dependencies:
appwrite: ^13.0.0-rc.4
appwrite: ^13.0.0
```
You can install packages from the command line:
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.6.x.
/// For older versions, please check
/// [previous releases](https://github.com/appwrite/sdk-for-flutter/releases).
library appwrite;
Expand Down
2 changes: 1 addition & 1 deletion lib/client_browser.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'src/client_browser.dart';
export 'src/client_browser.dart';
2 changes: 1 addition & 1 deletion lib/client_io.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'src/client_io.dart';
export 'src/client_io.dart';
3 changes: 2 additions & 1 deletion lib/id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class ID {
final now = DateTime.now();
final sec = (now.millisecondsSinceEpoch / 1000).floor();
final usec = now.microsecondsSinceEpoch - (sec * 1000000);
return sec.toRadixString(16) + usec.toRadixString(16).padLeft(5, '0');
return sec.toRadixString(16) +
usec.toRadixString(16).padLeft(5, '0');
}

// Generate a unique ID with padding to have a longer ID
Expand Down
45 changes: 19 additions & 26 deletions lib/query.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
part of 'appwrite.dart';


/// Helper class to generate query strings.
class Query {
final String method;
Expand All @@ -13,11 +14,11 @@ class Query {
'method': method,
};

if (attribute != null) {
if(attribute != null) {
map['attribute'] = attribute;
}

if (values != null) {
if(values != null) {
map['values'] = values is List ? values : [values];
}

Expand All @@ -28,7 +29,7 @@ class Query {
String toString() => jsonEncode(toJson());

/// Filter resources where [attribute] is equal to [value].
///
///
/// [value] can be a single value or a list. If a list is used
/// the query will return resources where [attribute] is equal
/// to any of the values in the list.
Expand Down Expand Up @@ -60,12 +61,10 @@ class Query {
Query._('search', attribute, value).toString();

/// Filter resources where [attribute] is null.
static String isNull(String attribute) =>
Query._('isNull', attribute).toString();
static String isNull(String attribute) => Query._('isNull', attribute).toString();

/// Filter resources where [attribute] is not null.
static String isNotNull(String attribute) =>
Query._('isNotNull', attribute).toString();
static String isNotNull(String attribute) => Query._('isNotNull', attribute).toString();

/// Filter resources where [attribute] is between [start] and [end] (inclusive).
static String between(String attribute, dynamic start, dynamic end) =>
Expand All @@ -85,46 +84,40 @@ class Query {
Query._('contains', attribute, value).toString();

static String or(List<String> queries) =>
Query._('or', null, queries.map((query) => jsonDecode(query)).toList())
.toString();
Query._('or', null, queries.map((query) => jsonDecode(query)).toList()).toString();

static String and(List<String> queries) =>
Query._('and', null, queries.map((query) => jsonDecode(query)).toList())
.toString();
Query._('and', null, queries.map((query) => jsonDecode(query)).toList()).toString();

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

/// Sort results by [attribute] ascending.
static String orderAsc(String attribute) =>
Query._('orderAsc', attribute).toString();
static String orderAsc(String attribute) => Query._('orderAsc', attribute).toString();

/// Sort results by [attribute] descending.
static String orderDesc(String attribute) =>
Query._('orderDesc', attribute).toString();
static String orderDesc(String attribute) => Query._('orderDesc', attribute).toString();

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

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

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

/// Return results from [offset].
///
///
/// Refer to the [Offset Pagination](https://appwrite.io/docs/pagination#offset-pagination)
/// docs for more information.
static String offset(int offset) =>
Query._('offset', null, offset).toString();
}
static String offset(int offset) => Query._('offset', null, offset).toString();

}
2 changes: 1 addition & 1 deletion lib/realtime_browser.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'src/realtime_browser.dart';
export 'src/realtime_browser.dart';
2 changes: 1 addition & 1 deletion lib/realtime_io.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export 'src/realtime_io.dart';
export 'src/realtime_io.dart';
106 changes: 53 additions & 53 deletions lib/role.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,65 @@ part of 'appwrite.dart';

/// Helper class to generate role strings for [Permission].
class Role {
Role._();

/// Grants access to anyone.
///
/// This includes authenticated and unauthenticated users.
static String any() {
return 'any';
}
Role._();
/// Grants access to anyone.
///
/// This includes authenticated and unauthenticated users.
static String any() {
return 'any';
}

/// Grants access to a specific user by user ID.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String user(String id, [String status = '']) {
if (status.isEmpty) {
return 'user:$id';
/// Grants access to a specific user by user ID.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String user(String id, [String status = '']) {
if(status.isEmpty) {
return 'user:$id';
}
return 'user:$id/$status';
}
return 'user:$id/$status';
}

/// Grants access to any authenticated or anonymous user.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String users([String status = '']) {
if (status.isEmpty) {
return 'users';
/// Grants access to any authenticated or anonymous user.
///
/// You can optionally pass verified or unverified for
/// [status] to target specific types of users.
static String users([String status = '']) {
if(status.isEmpty) {
return 'users';
}
return 'users/$status';
}
return 'users/$status';
}

/// Grants access to any guest user without a session.
///
/// Authenticated users don't have access to this role.
static String guests() {
return 'guests';
}
/// Grants access to any guest user without a session.
///
/// Authenticated users don't have access to this role.
static String guests() {
return 'guests';
}

/// Grants access to a team by team ID.
///
/// You can optionally pass a role for [role] to target
/// team members with the specified role.
static String team(String id, [String role = '']) {
if (role.isEmpty) {
return 'team:$id';
/// Grants access to a team by team ID.
///
/// You can optionally pass a role for [role] to target
/// team members with the specified role.
static String team(String id, [String role = '']) {
if(role.isEmpty) {
return 'team:$id';
}
return 'team:$id/$role';
}
return 'team:$id/$role';
}

/// Grants access to a specific member of a team.
///
/// When the member is removed from the team, they will
/// no longer have access.
static String member(String id) {
return 'member:$id';
}
/// Grants access to a specific member of a team.
///
/// When the member is removed from the team, they will
/// no longer have access.
static String member(String id) {
return 'member:$id';
}

/// Grants access to a user with the specified label.
static String label(String name) {
return 'label:$name';
}
}
/// Grants access to a user with the specified label.
static String label(String name) {
return 'label:$name';
}
}
Loading

0 comments on commit 39032cb

Please sign in to comment.