1
1
part of 'dart_appwrite.dart' ;
2
2
3
+
3
4
/// Helper class to generate query strings.
4
5
class Query {
5
6
final String method;
@@ -13,11 +14,11 @@ class Query {
13
14
'method' : method,
14
15
};
15
16
16
- if (attribute != null ) {
17
+ if (attribute != null ) {
17
18
map['attribute' ] = attribute;
18
19
}
19
-
20
- if (values != null ) {
20
+
21
+ if (values != null ) {
21
22
map['values' ] = values is List ? values : [values];
22
23
}
23
24
@@ -28,7 +29,7 @@ class Query {
28
29
String toString () => jsonEncode (toJson ());
29
30
30
31
/// Filter resources where [attribute] is equal to [value] .
31
- ///
32
+ ///
32
33
/// [value] can be a single value or a list. If a list is used
33
34
/// the query will return resources where [attribute] is equal
34
35
/// to any of the values in the list.
@@ -60,12 +61,10 @@ class Query {
60
61
Query ._('search' , attribute, value).toString ();
61
62
62
63
/// Filter resources where [attribute] is null.
63
- static String isNull (String attribute) =>
64
- Query ._('isNull' , attribute).toString ();
64
+ static String isNull (String attribute) => Query ._('isNull' , attribute).toString ();
65
65
66
66
/// Filter resources where [attribute] is not null.
67
- static String isNotNull (String attribute) =>
68
- Query ._('isNotNull' , attribute).toString ();
67
+ static String isNotNull (String attribute) => Query ._('isNotNull' , attribute).toString ();
69
68
70
69
/// Filter resources where [attribute] is between [start] and [end] (inclusive).
71
70
static String between (String attribute, dynamic start, dynamic end) =>
@@ -85,46 +84,40 @@ class Query {
85
84
Query ._('contains' , attribute, value).toString ();
86
85
87
86
static String or (List <String > queries) =>
88
- Query ._('or' , null , queries.map ((query) => jsonDecode (query)).toList ())
89
- .toString ();
87
+ Query ._('or' , null , queries.map ((query) => jsonDecode (query)).toList ()).toString ();
90
88
91
89
static String and (List <String > queries) =>
92
- Query ._('and' , null , queries.map ((query) => jsonDecode (query)).toList ())
93
- .toString ();
90
+ Query ._('and' , null , queries.map ((query) => jsonDecode (query)).toList ()).toString ();
94
91
95
92
/// Specify which attributes should be returned by the API call.
96
93
static String select (List <String > attributes) =>
97
94
Query ._('select' , null , attributes).toString ();
98
95
99
96
/// Sort results by [attribute] ascending.
100
- static String orderAsc (String attribute) =>
101
- Query ._('orderAsc' , attribute).toString ();
97
+ static String orderAsc (String attribute) => Query ._('orderAsc' , attribute).toString ();
102
98
103
99
/// Sort results by [attribute] descending.
104
- static String orderDesc (String attribute) =>
105
- Query ._('orderDesc' , attribute).toString ();
100
+ static String orderDesc (String attribute) => Query ._('orderDesc' , attribute).toString ();
106
101
107
102
/// Return results before [id] .
108
- ///
103
+ ///
109
104
/// Refer to the [Cursor Based Pagination] (https://appwrite.io/docs/pagination#cursor-pagination)
110
105
/// docs for more information.
111
- static String cursorBefore (String id) =>
112
- Query ._('cursorBefore' , null , id).toString ();
106
+ static String cursorBefore (String id) => Query ._('cursorBefore' , null , id).toString ();
113
107
114
108
/// Return results after [id] .
115
- ///
109
+ ///
116
110
/// Refer to the [Cursor Based Pagination] (https://appwrite.io/docs/pagination#cursor-pagination)
117
111
/// docs for more information.
118
- static String cursorAfter (String id) =>
119
- Query ._('cursorAfter' , null , id).toString ();
112
+ static String cursorAfter (String id) => Query ._('cursorAfter' , null , id).toString ();
120
113
121
114
/// Return only [limit] results.
122
115
static String limit (int limit) => Query ._('limit' , null , limit).toString ();
123
116
124
117
/// Return results from [offset] .
125
- ///
118
+ ///
126
119
/// Refer to the [Offset Pagination] (https://appwrite.io/docs/pagination#offset-pagination)
127
120
/// docs for more information.
128
- static String offset (int offset) =>
129
- Query ._( 'offset' , null , offset). toString ();
130
- }
121
+ static String offset (int offset) => Query ._( 'offset' , null , offset). toString ();
122
+
123
+ }
0 commit comments