Skip to content

Commit

Permalink
Commit from GitHub Actions (Format and push)
Browse files Browse the repository at this point in the history
  • Loading branch information
TorstenDittmann committed Aug 27, 2024
1 parent 13594fc commit 37a396a
Show file tree
Hide file tree
Showing 133 changed files with 11,564 additions and 11,026 deletions.
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';
2 changes: 1 addition & 1 deletion lib/dart_appwrite.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// Appwrite Dart 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-dart/releases).
library dart_appwrite;
Expand Down
3 changes: 1 addition & 2 deletions lib/id.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ 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: 26 additions & 19 deletions lib/query.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
part of 'dart_appwrite.dart';


/// Helper class to generate query strings.
class Query {
final String method;
Expand All @@ -14,11 +13,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 @@ -29,7 +28,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 @@ -61,10 +60,12 @@ 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 @@ -84,40 +85,46 @@ 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();
}
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 'dart_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 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';
}
/// Grants access to anyone.
///
/// This includes authenticated and unauthenticated users.
static String any() {
return 'any';
}

/// 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';
/// 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';
}

/// 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 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';
}

/// 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';
}
/// 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 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 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';
}

/// Grants access to a user with the specified label.
static String label(String name) {
return 'label:$name';
}
}
/// 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';
}
}
Loading

0 comments on commit 37a396a

Please sign in to comment.