com.google.android.libraries.places.api.net.kotlin

Top-level functions summary

FetchPhotoRequest
fetchPhotoRequest(photoMetadata: PhotoMetadata, actions: (FetchPhotoRequest.Builder.() -> Unit)?)

This function is deprecated. Replaced with new API.

FetchPlaceRequest
fetchPlaceRequest(
    placeId: String,
    placeFields: List<Place.Field>,
    actions: (FetchPlaceRequest.Builder.() -> Unit)?
)

Builds a new FetchPlaceRequest.

FetchResolvedPhotoUriRequest
fetchResolvedPhotoUriRequest(
    photoMetadata: PhotoMetadata,
    actions: (FetchResolvedPhotoUriRequest.Builder.() -> Unit)?
)

Builds a new FetchResolvedPhotoUriRequest.

FindAutocompletePredictionsRequest

Builds a new FindAutocompletePredictionsRequest.

FindCurrentPlaceRequest
findCurrentPlaceRequest(
    placeFields: List<Place.Field>,
    actions: (FindCurrentPlaceRequest.Builder.() -> Unit)?
)

This function is deprecated. Replaced with new API.

IsOpenRequest
isOpenRequest(placeId: String, utcTimeMillis: Long?, actions: (IsOpenRequest.Builder.() -> Unit)?)

Builds a new IsOpenRequest.

IsOpenRequest
isOpenRequest(place: Place, utcTimeMillis: Long?, actions: (IsOpenRequest.Builder.() -> Unit)?)

Builds a new IsOpenRequest.

SearchByTextRequest
searchByTextRequest(
    textQuery: String,
    placeFields: List<Place.Field>,
    actions: (SearchByTextRequest.Builder.() -> Unit)?
)

Builds a new SearchByTextRequest.

SearchNearbyRequest
searchNearbyRequest(
    locationRestriction: LocationRestriction,
    placeFields: List<Place.Field>,
    actions: (SearchNearbyRequest.Builder.() -> Unit)?
)

Builds a new SearchNearbyRequest.

Extension functions summary

suspend FetchPhotoResponse
PlacesClient.awaitFetchPhoto(
    photoMetadata: PhotoMetadata,
    actions: FetchPhotoRequest.Builder.() -> Unit
)

This function is deprecated. Replaced with new API.

suspend FetchPlaceResponse
PlacesClient.awaitFetchPlace(
    placeId: String,
    placeFields: List<Place.Field>,
    actions: FetchPlaceRequest.Builder.() -> Unit
)

Wraps PlacesClient.fetchPlace in a suspending function.

suspend FetchResolvedPhotoUriResponse

Wraps PlacesClient.fetchResolvedPhotoUri in a suspending function.

suspend FindAutocompletePredictionsResponse

Wraps PlacesClient.findAutocompletePredictions in a suspending function.

suspend FindCurrentPlaceResponse
@RequiresPermission(anyOf = ["ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION"])
PlacesClient.awaitFindCurrentPlace(placeFields: List<Place.Field>)

This function is deprecated. Replaced with new API.

suspend IsOpenResponse
PlacesClient.awaitIsOpen(placeId: String, utcTimeMillis: Long?)

Wraps PlacesClient.isOpen in a suspending function with the given placeId.

suspend IsOpenResponse
PlacesClient.awaitIsOpen(place: Place, utcTimeMillis: Long?)

Wraps PlacesClient.isOpen in a suspending function with the given Place object.

suspend SearchByTextResponse
PlacesClient.awaitSearchByText(
    textQuery: String,
    placeFields: List<Place.Field>,
    actions: SearchByTextRequest.Builder.() -> Unit
)

Wraps PlacesClient.searchByText in a suspending function.

suspend SearchNearbyResponse
PlacesClient.awaitSearchNearby(
    locationRestriction: LocationRestriction,
    placeFields: List<Place.Field>,
    actions: SearchNearbyRequest.Builder.() -> Unit
)

Wraps PlacesClient.searchNearby in a suspending function.

Top-level functions

fetchPhotoRequest

fun fetchPhotoRequest(photoMetadata: PhotoMetadata, actions: (FetchPhotoRequest.Builder.() -> Unit)? = null): FetchPhotoRequest

Builds a new FetchPhotoRequest.

Parameters
photoMetadata: PhotoMetadata

the metadata for the requested photo

actions: (FetchPhotoRequest.Builder.() -> Unit)? = null

the actions to apply to the FetchPhotoRequest.Builder

Returns
FetchPhotoRequest

the constructed FetchPhotoRequest

fetchPlaceRequest

fun fetchPlaceRequest(
    placeId: String,
    placeFields: List<Place.Field>,
    actions: (FetchPlaceRequest.Builder.() -> Unit)? = null
): FetchPlaceRequest

Builds a new FetchPlaceRequest.

Parameters
placeId: String

the ID of the place to fetch

placeFields: List<Place.Field>

the fields of the place to be requested

actions: (FetchPlaceRequest.Builder.() -> Unit)? = null

the actions to apply to the FetchPlaceRequest.Builder

Returns
FetchPlaceRequest

the constructed FetchPlaceRequest

fetchResolvedPhotoUriRequest

fun fetchResolvedPhotoUriRequest(
    photoMetadata: PhotoMetadata,
    actions: (FetchResolvedPhotoUriRequest.Builder.() -> Unit)? = null
): FetchResolvedPhotoUriRequest

Builds a new FetchResolvedPhotoUriRequest.

Parameters
photoMetadata: PhotoMetadata

the metadata for the requested photo

actions: (FetchResolvedPhotoUriRequest.Builder.() -> Unit)? = null

the actions to apply to the FetchResolvedPhotoUriRequest.Builder

findCurrentPlaceRequest

fun findCurrentPlaceRequest(
    placeFields: List<Place.Field>,
    actions: (FindCurrentPlaceRequest.Builder.() -> Unit)? = null
): FindCurrentPlaceRequest

Builds a new FindCurrentPlaceRequest.

Parameters
placeFields: List<Place.Field>

the fields of the places to be returned

actions: (FindCurrentPlaceRequest.Builder.() -> Unit)? = null

the actions to apply to the FindCurrentPlaceRequest.Builder

isOpenRequest

fun isOpenRequest(
    placeId: String,
    utcTimeMillis: Long? = null,
    actions: (IsOpenRequest.Builder.() -> Unit)? = null
): IsOpenRequest

Builds a new IsOpenRequest.

Parameters
placeId: String

The Place.id of the place for which isOpen is to be determined.

utcTimeMillis: Long? = null

The milliseconds from 1970-01-01T00:00:00Z.

actions: (IsOpenRequest.Builder.() -> Unit)? = null

the actions to apply to the IsOpenRequest.Builder

Returns
IsOpenRequest

the constructed IsOpenRequest

isOpenRequest

fun isOpenRequest(
    place: Place,
    utcTimeMillis: Long? = null,
    actions: (IsOpenRequest.Builder.() -> Unit)? = null
): IsOpenRequest

Builds a new IsOpenRequest.

Parameters
place: Place

The Place for which isOpen is to be determined.

utcTimeMillis: Long? = null

The milliseconds from 1970-01-01T00:00:00Z.

actions: (IsOpenRequest.Builder.() -> Unit)? = null

the actions to apply to the IsOpenRequest.Builder

Returns
IsOpenRequest

the constructed IsOpenRequest

Throws
java.lang.IllegalArgumentException

if Place does not have a Place.id associated with it.

searchByTextRequest

fun searchByTextRequest(
    textQuery: String,
    placeFields: List<Place.Field>,
    actions: (SearchByTextRequest.Builder.() -> Unit)? = null
): SearchByTextRequest

Builds a new SearchByTextRequest.

Parameters
textQuery: String

the text query for the search

placeFields: List<Place.Field>

the fields of the place to be requested

actions: (SearchByTextRequest.Builder.() -> Unit)? = null

the actions to apply to the SearchByTextRequest.Builder

Returns
SearchByTextRequest

the constructed SearchByTextRequest

searchNearbyRequest

fun searchNearbyRequest(
    locationRestriction: LocationRestriction,
    placeFields: List<Place.Field>,
    actions: (SearchNearbyRequest.Builder.() -> Unit)? = null
): SearchNearbyRequest

Builds a new SearchNearbyRequest.

Parameters
locationRestriction: LocationRestriction

the restricted region to search

placeFields: List<Place.Field>

the fields of the place to be requested

actions: (SearchNearbyRequest.Builder.() -> Unit)? = null

the actions to apply to the SearchNearbyRequest.Builder

Returns
SearchNearbyRequest

the constructed SearchNearbyRequest

Extension functions

awaitFetchPhoto

suspend fun PlacesClient.awaitFetchPhoto(
    photoMetadata: PhotoMetadata,
    actions: FetchPhotoRequest.Builder.() -> Unit = {}
): FetchPhotoResponse

Wraps PlacesClient.fetchPhoto in a suspending function.

Fetches a photo. If an error occurred, an ApiException will be thrown.

awaitFetchPlace

suspend fun PlacesClient.awaitFetchPlace(
    placeId: String,
    placeFields: List<Place.Field>,
    actions: FetchPlaceRequest.Builder.() -> Unit = {}
): FetchPlaceResponse

Wraps PlacesClient.fetchPlace in a suspending function.

Fetches the details of a place. If an error occurred, an ApiException will be thrown.

awaitFetchResolvedPhotoUri

suspend fun PlacesClient.awaitFetchResolvedPhotoUri(
    photoMetadata: PhotoMetadata,
    actions: FetchResolvedPhotoUriRequest.Builder.() -> Unit = {}
): FetchResolvedPhotoUriResponse

Wraps PlacesClient.fetchResolvedPhotoUri in a suspending function.

Fetches a resolved uri for the photo of a place. If an error occurred, an ApiException will be thrown.

awaitFindAutocompletePredictions

suspend fun PlacesClient.awaitFindAutocompletePredictions(actions: FindAutocompletePredictionsRequest.Builder.() -> Unit): FindAutocompletePredictionsResponse

Wraps PlacesClient.findAutocompletePredictions in a suspending function.

Fetches autocomplete predictions. If an error occurred, an ApiException will be thrown.

awaitFindCurrentPlace

@RequiresPermission(anyOf = ["ACCESS_COARSE_LOCATION", "ACCESS_FINE_LOCATION"])
suspend fun PlacesClient.awaitFindCurrentPlace(placeFields: List<Place.Field>): FindCurrentPlaceResponse

Wraps PlacesClient.findCurrentPlace in a suspending function.

Fetches the approximate current place of the user's device. Calling this method without granting the appropriate permissions will result in a SecurityException being thrown. In addition, if an error occurred while fetching the current place, an ApiException will be thrown.

awaitIsOpen

suspend fun PlacesClient.awaitIsOpen(placeId: String, utcTimeMillis: Long? = null): IsOpenResponse

Wraps PlacesClient.isOpen in a suspending function with the given placeId.

Returns whether or not a place is open. If an error occurred, an ApiException will be thrown.

awaitIsOpen

suspend fun PlacesClient.awaitIsOpen(place: Place, utcTimeMillis: Long? = null): IsOpenResponse

Wraps PlacesClient.isOpen in a suspending function with the given Place object.

Returns whether or not a place is open. If an error occurred, an ApiException will be thrown.

awaitSearchByText

suspend fun PlacesClient.awaitSearchByText(
    textQuery: String,
    placeFields: List<Place.Field>,
    actions: SearchByTextRequest.Builder.() -> Unit = {}
): SearchByTextResponse

Wraps PlacesClient.searchByText in a suspending function.

Fetches the place(s) of interest using a text query. If an error occurred, an ApiException will be thrown.

awaitSearchNearby

suspend fun PlacesClient.awaitSearchNearby(
    locationRestriction: LocationRestriction,
    placeFields: List<Place.Field>,
    actions: SearchNearbyRequest.Builder.() -> Unit = {}
): SearchNearbyResponse

Wraps PlacesClient.searchNearby in a suspending function.

Fetches the place(s) of interest using a location. If an error occurred, an ApiException will be thrown.