Returns a list of locations that match a provided search query. Position inside PlaceSearch means results will be biased to that proximity. You can use the locationInfo to then get full information on a place.
placeSearch(placeSearch: PlaceSearch) : Call<Places>
sessionToken
inside PlaceSearch
indicates the session for requests. Many requests can be made with the same session token.
Parameters
placeSearch
: PlaceSearch
Returns
Call<Places>
Errors
Examples
iOS
let addressService = Karhoo.getAddressService()
let placeSearch = PlaceSearch(
position: Position(latitude: 42, longitude: 42),
query: "iOS Street",
sessionToken: "SOME_SESSION_TOKEN"
)
addressService.placeSearch(placeSearch: placeSearch).execute { result in
switch result {
case .success(let places):
print("Places: \(places.places)")
case .failure(let error):
print("error: \(error.code) \(error.message)")
}
}
Android
val addressService = KarhooApi.addressService
val placeSearch = PlaceSearch(
position = Position(latitude = 42.0, longitude = 42.0),
query = "Android Street",
sessionToken = "SOME_SESSION_TOKEN"
)
addressService.placeSearch(placeSearch).execute { result ->
when (result) {
is Resource.Success -> print(result.data) // Handle data
is Resource.Failure -> print(result.error.internalMessage) //Handle errors
}
}