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