mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
googlemaps: adapt to api changes (#26954)
* add missing response status codes Added response status codes according to: https://developers.google.com/maps/documentation/javascript/places#place_details_responses * mark radarSearch as deprecated https://developers.google.com/maps/documentation/javascript/places#radar_search_requests * add new find places apis https://developers.google.com/maps/documentation/javascript/places#find_place_requests - findPlaceFromPhoneNumber() - findPlaceFromQuery() * add new fields parameter for place detail requests https://developers.google.com/maps/documentation/javascript/places#place_search_fields * add simple tests
This commit is contained in:
committed by
Mohamed Hegazy
parent
b42074d845
commit
84c222d10b
@@ -412,3 +412,28 @@ heatmap.setData([
|
||||
{ weight: 1, location: new google.maps.LatLng(37.782551, -122.445368) },
|
||||
{ weight: 2, location: new google.maps.LatLng(37.782745, -122.444586) }
|
||||
]);
|
||||
|
||||
/***** google.maps.places.PlacesService *****/
|
||||
let service = new google.maps.places.PlacesService(new HTMLDivElement());
|
||||
|
||||
service.getDetails({
|
||||
placeId: '-a1',
|
||||
fields: ['name']
|
||||
}, (result, status) => {
|
||||
if (status === google.maps.places.PlacesServiceStatus.NOT_FOUND) {
|
||||
return;
|
||||
}
|
||||
|
||||
result.name; // $ExpectType string
|
||||
})
|
||||
|
||||
service.findPlaceFromQuery({
|
||||
query: 'Big Ben London',
|
||||
fields: ['name']
|
||||
}, (results, status) => {
|
||||
if (status === google.maps.places.PlacesServiceStatus.ERROR) {
|
||||
return;
|
||||
}
|
||||
|
||||
results[0].name; // $ExpectType string
|
||||
});
|
||||
|
||||
Vendored
+27
@@ -1106,6 +1106,13 @@ declare namespace google.maps {
|
||||
zIndex?: number;
|
||||
}
|
||||
|
||||
export interface CircleLiteral extends CircleOptions {
|
||||
/** The center of the Circle. */
|
||||
center?: LatLng|LatLngLiteral;
|
||||
/** The radius in meters on the Earth's surface. */
|
||||
radius?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The possible positions of the stroke on a polygon.
|
||||
*/
|
||||
@@ -2549,6 +2556,8 @@ declare namespace google.maps {
|
||||
country: string|string[];
|
||||
}
|
||||
|
||||
export type LocationBias = LatLng|LatLngLiteral|LatLngBounds|LatLngBoundsLiteral|Circle|CircleLiteral|string;
|
||||
|
||||
export interface PlaceAspectRating {
|
||||
rating: number;
|
||||
type: string;
|
||||
@@ -2556,6 +2565,7 @@ declare namespace google.maps {
|
||||
|
||||
export interface PlaceDetailsRequest {
|
||||
placeId: string;
|
||||
fields?: string[];
|
||||
}
|
||||
|
||||
export interface PlaceGeometry {
|
||||
@@ -2629,16 +2639,21 @@ declare namespace google.maps {
|
||||
|
||||
export class PlacesService {
|
||||
constructor(attrContainer: HTMLDivElement|Map);
|
||||
findPlaceFromPhoneNumber(request: FindPlaceFromPhoneNumberRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void): void;
|
||||
findPlaceFromQuery(request: FindPlaceFromQueryRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void): void;
|
||||
getDetails(request: PlaceDetailsRequest, callback: (result: PlaceResult, status: PlacesServiceStatus) => void): void;
|
||||
nearbySearch(request: PlaceSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void): void;
|
||||
/** @deprecated Radar search is deprecated as of June 30, 2018. After that time, this feature will no longer be available. */
|
||||
radarSearch(request: RadarSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus) => void): void;
|
||||
textSearch(request: TextSearchRequest, callback: (results: PlaceResult[], status: PlacesServiceStatus, pagination: PlaceSearchPagination) => void): void;
|
||||
}
|
||||
|
||||
export enum PlacesServiceStatus {
|
||||
ERROR,
|
||||
INVALID_REQUEST,
|
||||
OK,
|
||||
OVER_QUERY_LIMIT,
|
||||
NOT_FOUND,
|
||||
REQUEST_DENIED,
|
||||
UNKNOWN_ERROR,
|
||||
ZERO_RESULTS
|
||||
@@ -2693,6 +2708,18 @@ declare namespace google.maps {
|
||||
types?: string[]; /* Deprecated. Will be removed February 16, 2017 */
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export interface FindPlaceFromQueryRequest {
|
||||
fields: string[];
|
||||
locationBias?: LocationBias;
|
||||
query: string;
|
||||
}
|
||||
|
||||
export interface FindPlaceFromPhoneNumberRequest {
|
||||
fields: string[];
|
||||
locationBias?: LocationBias;
|
||||
query: string;
|
||||
}
|
||||
}
|
||||
|
||||
/***** Drawing Library *****/
|
||||
|
||||
Reference in New Issue
Block a user