1 | declare namespace google.maps {
|
2 | class DistanceMatrixService {
|
3 | getDistanceMatrix(
|
4 | request: DistanceMatrixRequest,
|
5 | callback: (response: DistanceMatrixResponse, status: DistanceMatrixStatus) => void,
|
6 | ): void;
|
7 | }
|
8 |
|
9 | interface DistanceMatrixRequest {
|
10 | avoidFerries?: boolean;
|
11 | avoidHighways?: boolean;
|
12 | avoidTolls?: boolean;
|
13 | destinations?: string[] | LatLng[] | LatLngLiteral[] | Place[];
|
14 | drivingOptions?: DrivingOptions;
|
15 | durationInTraffic?: boolean;
|
16 | origins?: string[] | LatLng[] | LatLngLiteral[] | Place[];
|
17 | region?: string;
|
18 | transitOptions?: TransitOptions;
|
19 | travelMode?: TravelMode;
|
20 | unitSystem?: UnitSystem;
|
21 | }
|
22 |
|
23 | interface DistanceMatrixResponse {
|
24 | destinationAddresses: string[];
|
25 | originAddresses: string[];
|
26 | rows: DistanceMatrixResponseRow[];
|
27 | }
|
28 |
|
29 | interface DistanceMatrixResponseRow {
|
30 | elements: DistanceMatrixResponseElement[];
|
31 | }
|
32 |
|
33 | interface DistanceMatrixResponseElement {
|
34 | distance: Distance;
|
35 | duration: Duration;
|
36 | duration_in_traffic: Duration;
|
37 | fare: TransitFare;
|
38 | status: DistanceMatrixElementStatus;
|
39 | }
|
40 |
|
41 | enum DistanceMatrixStatus {
|
42 | INVALID_REQUEST = 'INVALID_REQUEST',
|
43 | MAX_DIMENSIONS_EXCEEDED = 'MAX_DIMENSIONS_EXCEEDED',
|
44 | MAX_ELEMENTS_EXCEEDED = 'MAX_ELEMENTS_EXCEEDED',
|
45 | OK = 'OK',
|
46 | OVER_QUERY_LIMIT = 'OVER_QUERY_LIMIT',
|
47 | REQUEST_DENIED = 'REQUEST_DENIED',
|
48 | UNKNOWN_ERROR = 'UNKNOWN_ERROR',
|
49 | }
|
50 |
|
51 | enum DistanceMatrixElementStatus {
|
52 | NOT_FOUND = 'NOT_FOUND',
|
53 | OK = 'OK',
|
54 | ZERO_RESULTS = 'ZERO_RESULTS',
|
55 | }
|
56 | }
|