1 | declare namespace google.maps.places {
|
2 | class AutocompleteService {
|
3 | constructor();
|
4 | getPlacePredictions(
|
5 | request: AutocompletionRequest,
|
6 | callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void,
|
7 | ): void;
|
8 | getQueryPredictions(
|
9 | request: QueryAutocompletionRequest,
|
10 | callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void,
|
11 | ): void;
|
12 | }
|
13 |
|
14 | interface AutocompletionRequest {
|
15 | bounds?: LatLngBounds | LatLngBoundsLiteral;
|
16 | componentRestrictions?: ComponentRestrictions;
|
17 | input: string;
|
18 | location?: LatLng;
|
19 | offset?: number;
|
20 |
|
21 | |
22 |
|
23 |
|
24 |
|
25 | origin?: LatLng | LatLngLiteral;
|
26 |
|
27 | radius?: number;
|
28 | sessionToken?: AutocompleteSessionToken;
|
29 | types?: string[];
|
30 | }
|
31 |
|
32 | interface QueryAutocompletionRequest {
|
33 | bounds?: LatLngBounds | LatLngBoundsLiteral;
|
34 | input?: string;
|
35 | location?: LatLng;
|
36 | offset?: number;
|
37 | radius?: number;
|
38 | }
|
39 |
|
40 | class AutocompleteSessionToken {}
|
41 |
|
42 | interface ComponentRestrictions {
|
43 | country: string | string[];
|
44 | }
|
45 |
|
46 | interface AutocompletePrediction {
|
47 | description: string;
|
48 |
|
49 | |
50 |
|
51 |
|
52 |
|
53 | distance_meters?: number;
|
54 |
|
55 | id?: string;
|
56 | matched_substrings: PredictionSubstring[];
|
57 | place_id: string;
|
58 | reference: string;
|
59 | structured_formatting: AutocompleteStructuredFormatting;
|
60 | terms: PredictionTerm[];
|
61 | types: string[];
|
62 | }
|
63 |
|
64 | interface QueryAutocompletePrediction {
|
65 | description: string;
|
66 | id?: string;
|
67 | matched_substrings: PredictionSubstring[];
|
68 | place_id: string;
|
69 | terms: PredictionTerm[];
|
70 | }
|
71 |
|
72 | interface PredictionTerm {
|
73 | offset: number;
|
74 | value: string;
|
75 | }
|
76 |
|
77 | interface PredictionSubstring {
|
78 | length: number;
|
79 | offset: number;
|
80 | }
|
81 |
|
82 |
|
83 | interface AutocompleteStructuredFormatting {
|
84 | main_text: string;
|
85 | main_text_matched_substrings: PredictionSubstring[];
|
86 | secondary_text: string;
|
87 | secondary_text_matched_substrings?: PredictionSubstring[];
|
88 | }
|
89 | }
|