Skip to content

Commit bc8e879

Browse files
committed
Allow query chaining methods
1 parent 26d20c1 commit bc8e879

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Source/Query.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,9 @@ public class Query : Printable {
181181
///
182182
/// Note: at indexing, geoloc of an object should be set with _geoloc attribute containing
183183
/// lat and lng attributes (for example {"_geoloc":{"lat":48.853409, "lng":2.348800}})
184-
public func searchAroundLatitude(latitude: Float, longitude: Float, maxDistance maxDist: UInt) {
184+
public func searchAroundLatitude(latitude: Float, longitude: Float, maxDistance maxDist: UInt) -> Query {
185185
aroundLatLong = "aroundLatLng=\(latitude),\(longitude)&aroundRadius=\(maxDist)"
186+
return self
186187
}
187188

188189
/// Search for entries around a given latitude/longitude.
@@ -192,8 +193,9 @@ public class Query : Printable {
192193
///
193194
/// Note: at indexing, geoloc of an object should be set with _geoloc attribute containing
194195
/// lat and lng attributes (for example {"_geoloc":{"lat":48.853409, "lng":2.348800}})
195-
public func searchAroundLatitude(latitude: Float, longitude: Float, maxDistance maxDist: UInt, precision: UInt) {
196+
public func searchAroundLatitude(latitude: Float, longitude: Float, maxDistance maxDist: UInt, precision: UInt) -> Query {
196197
aroundLatLong = "aroundLatLng=\(latitude),\(longitude)&aroundRadius=\(maxDist)&aroundPrecision=\(precision)"
198+
return self
197199
}
198200

199201
/// Search for entries around a given latitude/longitude (using IP geolocation).
@@ -202,9 +204,10 @@ public class Query : Printable {
202204
///
203205
/// Note: at indexing, geoloc of an object should be set with _geoloc attribute containing
204206
/// lat and lng attributes (for example {"_geoloc":{"lat":48.853409, "lng":2.348800}})
205-
public func searchAroundLatitudeLongitudeViaIP(maxDistance maxDist: UInt) {
207+
public func searchAroundLatitudeLongitudeViaIP(maxDistance maxDist: UInt) -> Query {
206208
aroundLatLong = "aroundRadius=\(maxDist)"
207209
aroundLatLongViaIP = true
210+
return self
208211
}
209212

210213
/// Search for entries around a given latitude/longitude (using IP geolocation).
@@ -214,17 +217,19 @@ public class Query : Printable {
214217
///
215218
/// Note: at indexing, geoloc of an object should be set with _geoloc attribute containing
216219
/// lat and lng attributes (for example {"_geoloc":{"lat":48.853409, "lng":2.348800}})
217-
public func searchAroundLatitudeLongitudeViaIP(maxDistane maxDist: UInt, precision: UInt) {
220+
public func searchAroundLatitudeLongitudeViaIP(maxDistane maxDist: UInt, precision: UInt) -> Query {
218221
aroundLatLong = "aroundRadius=\(maxDist)&aroundPrecision=\(precision)"
219222
aroundLatLongViaIP = true
223+
return self
220224
}
221225

222226
/// Search for entries inside a given area defined by the two extreme points of a rectangle.
223227
///
224228
/// Note: at indexing, geoloc of an object should be set with _geoloc attribute containing
225229
/// lat and lng attributes (for example {"_geoloc":{"lat":48.853409, "lng":2.348800}})
226-
public func searchInsideBoundingBoxWithLatitudeP1(latitudeP1: Float, longitudeP1: Float, latitudeP2: Float, longitudeP2: Float) {
230+
public func searchInsideBoundingBoxWithLatitudeP1(latitudeP1: Float, longitudeP1: Float, latitudeP2: Float, longitudeP2: Float) -> Query {
227231
insideBoundingBox = "insideBoundingBox=\(latitudeP1),\(longitudeP1),\(latitudeP2),\(longitudeP2)"
232+
return self
228233
}
229234

230235
/// Return the final query string used in URL.

0 commit comments

Comments
 (0)