-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into maintenance-upgrade-dependencies
- Loading branch information
Showing
60 changed files
with
1,414 additions
and
147 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
part of {{ language.params.packageName }}; | ||
|
||
/// Helper class to generate ID strings for resources. | ||
class ID { | ||
ID._(); | ||
|
||
static String unique() { | ||
return 'unique()'; | ||
} | ||
ID._(); | ||
|
||
static String custom(String id) { | ||
return id; | ||
} | ||
/// Have Appwrite generate a unique ID for you. | ||
static String unique() { | ||
return 'unique()'; | ||
} | ||
|
||
/// Uses [id] as the ID for the resource. | ||
static String custom(String id) { | ||
return id; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
part of {{ language.params.packageName }}; | ||
|
||
/// Helper class to generate permission strings for resources. | ||
class Permission { | ||
Permission._(); | ||
Permission._(); | ||
|
||
static String read(String role) { | ||
return 'read("$role")'; | ||
} | ||
static String write(String role) { | ||
return 'write("$role")'; | ||
} | ||
static String create(String role) { | ||
return 'create("$role")'; | ||
} | ||
static String update(String role) { | ||
return 'update("$role")'; | ||
} | ||
static String delete(String role) { | ||
return 'delete("$role")'; | ||
} | ||
/// Read permission for provided [role] | ||
static String read(String role) { | ||
return 'read("$role")'; | ||
} | ||
|
||
/// Write permission for provided [role] | ||
/// | ||
/// This is an alias of update, delete, and possibly create. | ||
/// Don't use write in combination with update, delete, or create. | ||
static String write(String role) { | ||
return 'write("$role")'; | ||
} | ||
|
||
/// Create permission for provided [role] | ||
static String create(String role) { | ||
return 'create("$role")'; | ||
} | ||
|
||
/// Update permission for provided [role] | ||
static String update(String role) { | ||
return 'update("$role")'; | ||
} | ||
|
||
/// Delete permission for provided [role] | ||
static String delete(String role) { | ||
return 'delete("$role")'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,61 +1,99 @@ | ||
part of {{ language.params.packageName }}; | ||
|
||
/// Helper class to generate query strings. | ||
class Query { | ||
Query._(); | ||
|
||
Query._(); | ||
|
||
/// 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. | ||
static String equal(String attribute, dynamic value) => | ||
_addQuery(attribute, 'equal', value); | ||
|
||
/// Filter resources where [attribute] is not 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. | ||
static String notEqual(String attribute, dynamic value) => | ||
_addQuery(attribute, 'notEqual', value); | ||
|
||
/// Filter resources where [attribute] is less than [value]. | ||
static String lessThan(String attribute, dynamic value) => | ||
_addQuery(attribute, 'lessThan', value); | ||
|
||
/// Filter resources where [attribute] is less than or equal to [value]. | ||
static String lessThanEqual(String attribute, dynamic value) => | ||
_addQuery(attribute, 'lessThanEqual', value); | ||
|
||
/// Filter resources where [attribute] is greater than [value]. | ||
static String greaterThan(String attribute, dynamic value) => | ||
_addQuery(attribute, 'greaterThan', value); | ||
|
||
/// Filter resources where [attribute] is greater than or equal to [value]. | ||
static String greaterThanEqual(String attribute, dynamic value) => | ||
_addQuery(attribute, 'greaterThanEqual', value); | ||
|
||
/// Filter resources where by searching [attribute] for [value]. | ||
static String search(String attribute, String value) => | ||
_addQuery(attribute, 'search', value); | ||
|
||
/// Filter resources where [attribute] is null. | ||
static String isNull(String attribute) => 'isNull("$attribute")'; | ||
|
||
/// Filter resources where [attribute] is not null. | ||
static String isNotNull(String attribute) => 'isNotNull("$attribute")'; | ||
|
||
/// Filter resources where [attribute] is between [start] and [end] (inclusive). | ||
static String between(String attribute, dynamic start, dynamic end) => | ||
_addQuery(attribute, 'between', [start, end]); | ||
|
||
/// Filter resources where [attribute] starts with [value]. | ||
static String startsWith(String attribute, String value) => | ||
_addQuery(attribute, 'startsWith', value); | ||
|
||
/// Filter resources where [attribute] ends with [value]. | ||
static String endsWith(String attribute, String value) => | ||
_addQuery(attribute, 'endsWith', value); | ||
|
||
static String select(List<String> attributes) => 'select([${attributes.map((attr) => "\"$attr\"").join(",")}])'; | ||
/// Specify which attributes should be returned by the API call. | ||
static String select(List<String> attributes) => | ||
'select([${attributes.map((attr) => "\"$attr\"").join(",")}])'; | ||
|
||
/// Sort results by [attribute] ascending. | ||
static String orderAsc(String attribute) => 'orderAsc("$attribute")'; | ||
|
||
/// Sort results by [attribute] descending. | ||
static String orderDesc(String attribute) => 'orderDesc("$attribute")'; | ||
|
||
/// Return results before [id]. | ||
/// | ||
/// Refer to the [Cursor Based Pagination]({{sdk.url}}/docs/pagination#cursor-pagination) | ||
/// docs for more information. | ||
static String cursorBefore(String id) => 'cursorBefore("$id")'; | ||
|
||
/// Return results after [id]. | ||
/// | ||
/// Refer to the [Cursor Based Pagination]({{sdk.url}}/docs/pagination#cursor-pagination) | ||
/// docs for more information. | ||
static String cursorAfter(String id) => 'cursorAfter("$id")'; | ||
|
||
/// Return only [limit] results. | ||
static String limit(int limit) => 'limit($limit)'; | ||
|
||
/// Return results from [offset]. | ||
/// | ||
/// Refer to the [Offset Pagination]({{sdk.url}}/docs/pagination#offset-pagination) | ||
/// docs for more information. | ||
static String offset(int offset) => 'offset($offset)'; | ||
|
||
static String _addQuery(String attribute, String method, dynamic value) => (value | ||
is List) | ||
? '$method("$attribute", [${value.map((item) => parseValues(item)).join(",")}])' | ||
: '$method("$attribute", [${parseValues(value)}])'; | ||
? '$method("$attribute", [${value.map((item) => _parseValues(item)).join(",")}])' | ||
: '$method("$attribute", [${_parseValues(value)}])'; | ||
|
||
static String parseValues(dynamic value) => | ||
static String _parseValues(dynamic value) => | ||
(value is String) ? '"$value"' : '$value'; | ||
} | ||
} |
Oops, something went wrong.