@@ -11,11 +11,11 @@ class Query {
1111 Map <String , dynamic > toJson () {
1212 final map = < String , dynamic > {'method' : method};
1313
14- if (attribute != null ) {
14+ if (attribute != null ) {
1515 map['attribute' ] = attribute;
1616 }
17-
18- if (values != null ) {
17+
18+ if (values != null ) {
1919 map['values' ] = values is List ? values : [values];
2020 }
2121
@@ -26,7 +26,7 @@ class Query {
2626 String toString () => jsonEncode (toJson ());
2727
2828 /// Filter resources where [attribute] is equal to [value] .
29- ///
29+ ///
3030 /// [value] can be a single value or a list. If a list is used
3131 /// the query will return resources where [attribute] is equal
3232 /// to any of the values in the list.
@@ -152,14 +152,14 @@ class Query {
152152 Query ._('orderDesc' , attribute).toString ();
153153
154154 /// Return results before [id] .
155- ///
155+ ///
156156 /// Refer to the [Cursor Based Pagination] (https://appwrite.io/docs/pagination#cursor-pagination)
157157 /// docs for more information.
158158 static String cursorBefore (String id) =>
159159 Query ._('cursorBefore' , null , id).toString ();
160160
161161 /// Return results after [id] .
162- ///
162+ ///
163163 /// Refer to the [Cursor Based Pagination] (https://appwrite.io/docs/pagination#cursor-pagination)
164164 /// docs for more information.
165165 static String cursorAfter (String id) =>
@@ -169,9 +169,57 @@ class Query {
169169 static String limit (int limit) => Query ._('limit' , null , limit).toString ();
170170
171171 /// Return results from [offset] .
172- ///
172+ ///
173173 /// Refer to the [Offset Pagination] (https://appwrite.io/docs/pagination#offset-pagination)
174174 /// docs for more information.
175175 static String offset (int offset) =>
176176 Query ._('offset' , null , offset).toString ();
177- }
177+
178+ /// Filter resources where [attribute] is at a specific distance from the given coordinates.
179+ static String distanceEqual (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
180+ Query ._('distanceEqual' , attribute, [values, distance, meters]).toString ();
181+
182+ /// Filter resources where [attribute] is not at a specific distance from the given coordinates.
183+ static String distanceNotEqual (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
184+ Query ._('distanceNotEqual' , attribute, [values, distance, meters]).toString ();
185+
186+ /// Filter resources where [attribute] is at a distance greater than the specified value from the given coordinates.
187+ static String distanceGreaterThan (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
188+ Query ._('distanceGreaterThan' , attribute, [values, distance, meters]).toString ();
189+
190+ /// Filter resources where [attribute] is at a distance less than the specified value from the given coordinates.
191+ static String distanceLessThan (String attribute, List <dynamic > values, double distance, [bool meters = true ]) =>
192+ Query ._('distanceLessThan' , attribute, [values, distance, meters]).toString ();
193+
194+ /// Filter resources where [attribute] intersects with the given geometry.
195+ static String intersects (String attribute, List <dynamic > values) =>
196+ Query ._('intersects' , attribute, values).toString ();
197+
198+ /// Filter resources where [attribute] does not intersect with the given geometry.
199+ static String notIntersects (String attribute, List <dynamic > values) =>
200+ Query ._('notIntersects' , attribute, values).toString ();
201+
202+ /// Filter resources where [attribute] crosses the given geometry.
203+ static String crosses (String attribute, List <dynamic > values) =>
204+ Query ._('crosses' , attribute, values).toString ();
205+
206+ /// Filter resources where [attribute] does not cross the given geometry.
207+ static String notCrosses (String attribute, List <dynamic > values) =>
208+ Query ._('notCrosses' , attribute, values).toString ();
209+
210+ /// Filter resources where [attribute] overlaps with the given geometry.
211+ static String overlaps (String attribute, List <dynamic > values) =>
212+ Query ._('overlaps' , attribute, values).toString ();
213+
214+ /// Filter resources where [attribute] does not overlap with the given geometry.
215+ static String notOverlaps (String attribute, List <dynamic > values) =>
216+ Query ._('notOverlaps' , attribute, values).toString ();
217+
218+ /// Filter resources where [attribute] touches the given geometry.
219+ static String touches (String attribute, List <dynamic > values) =>
220+ Query ._('touches' , attribute, values).toString ();
221+
222+ /// Filter resources where [attribute] does not touch the given geometry.
223+ static String notTouches (String attribute, List <dynamic > values) =>
224+ Query ._('notTouches' , attribute, values).toString ();
225+ }
0 commit comments