@googlemaps/routing 2.0.1 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,24 +1,24 @@
1
1
  [//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2
- [//]: # "To regenerate it, use `python -m synthtool`."
2
+ [//]: # "The comments you see below are used to generate those parts of the template in later states."
3
3
  <img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
4
4
 
5
- # [Google Maps Routing: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-maps-routing)
6
-
7
- [![release level](https://img.shields.io/badge/release%20level-preview-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
8
- [![npm version](https://img.shields.io/npm/v/@googlemaps/routing.svg)](https://www.npmjs.org/package/@googlemaps/routing)
9
-
5
+ # [Routes API: Nodejs Client][homepage]
10
6
 
7
+ This library is considered to be in **preview**. This means it is still a
8
+ work-in-progress and under active development. Any release is subject to
9
+ backwards-incompatible changes at any time.
11
10
 
11
+ [![npm version](https://img.shields.io/npm/v/@googlemaps/routing.svg)](https://www.npmjs.org/package/@googlemaps/routing)
12
12
 
13
- client for Node.js
13
+ Routes API client for Node.js
14
14
 
15
+ [//]: # "partials.introduction"
15
16
 
16
17
  A comprehensive list of changes in each version may be found in
17
- [the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-maps-routing/CHANGELOG.md).
18
+ [the CHANGELOG][homepage_changelog].
18
19
 
19
- * [Google Maps Routing Node.js Client API Reference][client-docs]
20
+ * [Routes API Nodejs Client API Reference](https://cloud.google.com/nodejs/docs/reference/routing/latest)
20
21
 
21
- * [github.com/googleapis/google-cloud-node/packages/google-maps-routing](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-maps-routing)
22
22
 
23
23
  Read more about the client libraries for Cloud APIs, including the older
24
24
  Google APIs Client Libraries, in [Client Libraries Explained][explained].
@@ -27,149 +27,60 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
27
27
 
28
28
  **Table of contents:**
29
29
 
30
-
31
30
  * [Quickstart](#quickstart)
32
31
  * [Before you begin](#before-you-begin)
33
32
  * [Installing the client library](#installing-the-client-library)
34
- * [Using the client library](#using-the-client-library)
35
- * [Samples](#samples)
33
+
36
34
  * [Versioning](#versioning)
37
35
  * [Contributing](#contributing)
38
36
  * [License](#license)
39
37
 
40
38
  ## Quickstart
41
-
42
39
  ### Before you begin
43
40
 
44
41
  1. [Select or create a Cloud Platform project][projects].
45
42
  1. [Enable billing for your project][billing].
46
- 1. [Enable the Google Maps Routing API][enable_api].
47
- 1. [Set up authentication with a service account][auth] so you can access the
43
+ 1. [Enable the Routes API API][enable_api].
44
+ 1. [Set up authentication][auth] so you can access the
48
45
  API from your local workstation.
49
-
50
46
  ### Installing the client library
51
47
 
52
48
  ```bash
53
49
  npm install @googlemaps/routing
54
50
  ```
55
51
 
52
+ ## Terms of Service
56
53
 
57
- ### Using the client library
58
-
59
- ```javascript
60
- /**
61
- * This snippet has been automatically generated and should be regarded as a code template only.
62
- * It will require modifications to work.
63
- * It may require correct/in-range values for request initialization.
64
- * TODO(developer): Uncomment these variables before running the sample.
65
- */
66
- /**
67
- * Required. Origin waypoint.
68
- */
69
- // const origin = {}
70
- /**
71
- * Required. Destination waypoint.
72
- */
73
- // const destination = {}
74
- /**
75
- * Optional. A set of waypoints along the route (excluding terminal points),
76
- * for either stopping at or passing by. Up to 25 intermediate waypoints are
77
- * supported.
78
- */
79
- // const intermediates = 1234
80
- /**
81
- * Optional. Specifies the mode of transportation.
82
- */
83
- // const travelMode = {}
84
- /**
85
- * Optional. Specifies how to compute the route. The server
86
- * attempts to use the selected routing preference to compute the route. If
87
- * the routing preference results in an error or an extra long latency, then
88
- * an error is returned. In the future, we might implement a fallback
89
- * mechanism to use a different option when the preferred option does not give
90
- * a valid result. You can specify this option only when the `travel_mode` is
91
- * `DRIVE` or `TWO_WHEELER`, otherwise the request fails.
92
- */
93
- // const routingPreference = {}
94
- /**
95
- * Optional. Specifies your preference for the quality of the polyline.
96
- */
97
- // const polylineQuality = {}
98
- /**
99
- * Optional. Specifies the preferred encoding for the polyline.
100
- */
101
- // const polylineEncoding = {}
102
- /**
103
- * Optional. The departure time. If you don't set this value, then this value
104
- * defaults to the time that you made the request. If you set this value to a
105
- * time that has already occurred, then the request fails.
106
- */
107
- // const departureTime = {}
108
- /**
109
- * Optional. Specifies whether to calculate alternate routes in addition to the route.
110
- */
111
- // const computeAlternativeRoutes = true
112
- /**
113
- * Optional. A set of conditions to satisfy that affect the way routes are
114
- * calculated.
115
- */
116
- // const routeModifiers = {}
117
- /**
118
- * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
119
- * information, see
120
- * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See
121
- * Language Support (https://developers.google.com/maps/faq#languagesupport)
122
- * for the list of supported languages. When you don't provide this value, the
123
- * display language is inferred from the location of the route request.
124
- */
125
- // const languageCode = 'abc123'
126
- /**
127
- * Optional. Specifies the units of measure for the display fields. This
128
- * includes the `instruction` field in `NavigationInstruction`. The units of
129
- * measure used for the route, leg, step distance, and duration are not
130
- * affected by this value. If you don't provide this value, then the display
131
- * units are inferred from the location of the request.
132
- */
133
- // const units = {}
134
-
135
- // Imports the Routing library
136
- const {RoutesClient} = require('@googlemaps/routing').v2;
137
-
138
- // Instantiates a client
139
- const routingClient = new RoutesClient();
140
-
141
- async function callComputeRoutes() {
142
- // Construct request
143
- const request = {
144
- origin,
145
- destination,
146
- };
147
-
148
- // Run request
149
- const response = await routingClient.computeRoutes(request);
150
- console.log(response);
151
- }
152
-
153
- callComputeRoutes();
154
-
155
- ```
54
+ `@googlemaps/routing` uses Google Maps Platform services. Use of Google
55
+ Maps Platform services through this library is subject to the
56
+ [Google Maps Platform Terms of Service][gmp-tos].
156
57
 
58
+ This library is not a Google Maps Platform Core Service.
59
+ Therefore, the Google Maps Platform Terms of Service (e.g., Technical
60
+ Support Services, Service Level Agreements, and Deprecation Policy)
61
+ do not apply to this library.
157
62
 
63
+ ### European Economic Area (EEA) developers
158
64
 
159
- ## Samples
65
+ If your billing address is in the European Economic Area, effective on
66
+ 8 July 2025, the [Google Maps Platform EEA Terms of Service][gmp-tos-eea]
67
+ will apply to your use of the Services. Functionality varies by region.
68
+ [Learn more][gmp-tos-eea-faq].
160
69
 
161
- Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-maps-routing/samples) directory. Each sample's `README.md` has instructions for running its sample.
70
+ [gmp-tos]: https://cloud.google.com/maps-platform/terms
71
+ [gmp-tos-eea]: https://cloud.google.com/terms/maps-platform/eea
72
+ [gmp-tos-eea-faq]: https://developers.google.com/maps/comms/eea/faq
162
73
 
163
- | Sample | Source Code | Try it |
164
- | --------------------------- | --------------------------------- | ------ |
165
- | Routes.compute_route_matrix | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js,packages/google-maps-routing/samples/README.md) |
166
- | Routes.compute_routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js,packages/google-maps-routing/samples/README.md) |
167
- | Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-maps-routing/samples/quickstart.js,packages/google-maps-routing/samples/README.md) |
74
+ ## Samples
168
75
 
76
+ Samples are in the [`samples/`][homepage_samples] directory. Each sample's `README.md` has instructions for running its sample.
169
77
 
78
+ | Sample | Source Code |
79
+ | --------------------------- | --------------------------------- |
80
+ | compute route matrix | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js) |
81
+ | compute routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js) |
82
+ | maps | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples/generated/v2/snippet_metadata_google.maps.routing.v2.json) |
170
83
 
171
- The [Google Maps Routing Node.js Client API Reference][client-docs] documentation
172
- also contains samples.
173
84
 
174
85
  ## Supported Node.js Versions
175
86
 
@@ -196,41 +107,29 @@ for versions compatible with Node.js 8.
196
107
 
197
108
  This library follows [Semantic Versioning](http://semver.org/).
198
109
 
199
-
200
-
201
-
202
-
203
-
204
-
205
- This library is considered to be in **preview**. This means it is still a
206
- work-in-progress and under active development. Any release is subject to
207
- backwards-incompatible changes at any time.
208
-
209
-
210
110
  More Information: [Google Cloud Platform Launch Stages][launch_stages]
211
111
 
212
112
  [launch_stages]: https://cloud.google.com/terms/launch-stages
213
113
 
214
114
  ## Contributing
215
115
 
216
- Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md).
116
+ Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/CONTRIBUTING.md).
217
117
 
218
- Please note that this `README.md`, the `samples/README.md`,
118
+ Please note that this `README.md`
219
119
  and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
220
- are generated from a central template. To edit one of these files, make an edit
221
- to its templates in
222
- [directory](https://github.com/googleapis/synthtool).
120
+ are generated from a central template.
223
121
 
224
122
  ## License
225
123
 
226
124
  Apache Version 2.0
227
125
 
228
- See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
229
-
230
- [client-docs]: https://cloud.google.com/nodejs/docs/reference/routing/latest
126
+ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/LICENSE)
231
127
 
232
128
  [shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
233
129
  [projects]: https://console.cloud.google.com/project
234
130
  [billing]: https://support.google.com/cloud/answer/6293499#enable-billing
235
131
  [enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=routes.googleapis.com
236
- [auth]: https://cloud.google.com/docs/authentication/getting-started
132
+ [auth]: https://cloud.google.com/docs/authentication/external/set-up-adc-local
133
+ [homepage_samples]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/samples
134
+ [homepage_changelog]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing/CHANGELOG.md
135
+ [homepage]: https://github.com/googleapis/google-cloud-node/blob/main/packages/google-maps-routing
@@ -27,7 +27,7 @@ export namespace google {
27
27
  type_url?: (string|null);
28
28
 
29
29
  /** Any value */
30
- value?: (Uint8Array|string|null);
30
+ value?: (Uint8Array|Buffer|string|null);
31
31
  }
32
32
 
33
33
  /** Represents an Any. */
@@ -43,7 +43,7 @@ export namespace google {
43
43
  public type_url: string;
44
44
 
45
45
  /** Any value. */
46
- public value: (Uint8Array|string);
46
+ public value: (Uint8Array|Buffer|string);
47
47
 
48
48
  /**
49
49
  * Creates a new Any instance using the specified properties.
@@ -903,7 +903,7 @@ export namespace google {
903
903
  interface IBytesValue {
904
904
 
905
905
  /** BytesValue value */
906
- value?: (Uint8Array|string|null);
906
+ value?: (Uint8Array|Buffer|string|null);
907
907
  }
908
908
 
909
909
  /** Represents a BytesValue. */
@@ -916,7 +916,7 @@ export namespace google {
916
916
  constructor(properties?: google.protobuf.IBytesValue);
917
917
 
918
918
  /** BytesValue value. */
919
- public value: (Uint8Array|string);
919
+ public value: (Uint8Array|Buffer|string);
920
920
 
921
921
  /**
922
922
  * Creates a new BytesValue instance using the specified properties.
@@ -4110,6 +4110,9 @@ export namespace google {
4110
4110
 
4111
4111
  /** ServiceOptions .google.api.oauthScopes */
4112
4112
  ".google.api.oauthScopes"?: (string|null);
4113
+
4114
+ /** ServiceOptions .google.api.apiVersion */
4115
+ ".google.api.apiVersion"?: (string|null);
4113
4116
  }
4114
4117
 
4115
4118
  /** Represents a ServiceOptions. */
@@ -4358,7 +4361,7 @@ export namespace google {
4358
4361
  doubleValue?: (number|null);
4359
4362
 
4360
4363
  /** UninterpretedOption stringValue */
4361
- stringValue?: (Uint8Array|string|null);
4364
+ stringValue?: (Uint8Array|Buffer|string|null);
4362
4365
 
4363
4366
  /** UninterpretedOption aggregateValue */
4364
4367
  aggregateValue?: (string|null);
@@ -4389,7 +4392,7 @@ export namespace google {
4389
4392
  public doubleValue: number;
4390
4393
 
4391
4394
  /** UninterpretedOption stringValue. */
4392
- public stringValue: (Uint8Array|string);
4395
+ public stringValue: (Uint8Array|Buffer|string);
4393
4396
 
4394
4397
  /** UninterpretedOption aggregateValue. */
4395
4398
  public aggregateValue: string;
@@ -6333,9 +6336,6 @@ export namespace google {
6333
6336
  /** GeocodedWaypoint placeId. */
6334
6337
  public placeId: string;
6335
6338
 
6336
- /** GeocodedWaypoint _intermediateWaypointRequestIndex. */
6337
- public _intermediateWaypointRequestIndex?: "intermediateWaypointRequestIndex";
6338
-
6339
6339
  /**
6340
6340
  * Creates a new GeocodedWaypoint instance using the specified properties.
6341
6341
  * @param [properties] Properties to set
@@ -6998,12 +6998,6 @@ export namespace google {
6998
6998
  /** PolylinePointIndex endIndex. */
6999
6999
  public endIndex?: (number|null);
7000
7000
 
7001
- /** PolylinePointIndex _startIndex. */
7002
- public _startIndex?: "startIndex";
7003
-
7004
- /** PolylinePointIndex _endIndex. */
7005
- public _endIndex?: "endIndex";
7006
-
7007
7001
  /**
7008
7002
  * Creates a new PolylinePointIndex instance using the specified properties.
7009
7003
  * @param [properties] Properties to set
@@ -8308,12 +8302,6 @@ export namespace google {
8308
8302
  /** MultiModalSegment travelMode. */
8309
8303
  public travelMode: (google.maps.routing.v2.RouteTravelMode|keyof typeof google.maps.routing.v2.RouteTravelMode);
8310
8304
 
8311
- /** MultiModalSegment _stepStartIndex. */
8312
- public _stepStartIndex?: "stepStartIndex";
8313
-
8314
- /** MultiModalSegment _stepEndIndex. */
8315
- public _stepEndIndex?: "stepEndIndex";
8316
-
8317
8305
  /**
8318
8306
  * Creates a new MultiModalSegment instance using the specified properties.
8319
8307
  * @param [properties] Properties to set
@@ -9055,12 +9043,6 @@ export namespace google {
9055
9043
  /** SpeedReadingInterval speed. */
9056
9044
  public speed?: (google.maps.routing.v2.SpeedReadingInterval.Speed|keyof typeof google.maps.routing.v2.SpeedReadingInterval.Speed|null);
9057
9045
 
9058
- /** SpeedReadingInterval _startPolylinePointIndex. */
9059
- public _startPolylinePointIndex?: "startPolylinePointIndex";
9060
-
9061
- /** SpeedReadingInterval _endPolylinePointIndex. */
9062
- public _endPolylinePointIndex?: "endPolylinePointIndex";
9063
-
9064
9046
  /** SpeedReadingInterval speedType. */
9065
9047
  public speedType?: "speed";
9066
9048
 
@@ -10924,12 +10906,6 @@ export namespace google {
10924
10906
  /** RouteMatrixElement localizedValues. */
10925
10907
  public localizedValues?: (google.maps.routing.v2.RouteMatrixElement.ILocalizedValues|null);
10926
10908
 
10927
- /** RouteMatrixElement _originIndex. */
10928
- public _originIndex?: "originIndex";
10929
-
10930
- /** RouteMatrixElement _destinationIndex. */
10931
- public _destinationIndex?: "destinationIndex";
10932
-
10933
10909
  /**
10934
10910
  * Creates a new RouteMatrixElement instance using the specified properties.
10935
10911
  * @param [properties] Properties to set
@@ -12193,6 +12169,9 @@ export namespace google {
12193
12169
 
12194
12170
  /** Publishing protoReferenceDocumentationUri */
12195
12171
  protoReferenceDocumentationUri?: (string|null);
12172
+
12173
+ /** Publishing restReferenceDocumentationUri */
12174
+ restReferenceDocumentationUri?: (string|null);
12196
12175
  }
12197
12176
 
12198
12177
  /** Represents a Publishing. */
@@ -12234,6 +12213,9 @@ export namespace google {
12234
12213
  /** Publishing protoReferenceDocumentationUri. */
12235
12214
  public protoReferenceDocumentationUri: string;
12236
12215
 
12216
+ /** Publishing restReferenceDocumentationUri. */
12217
+ public restReferenceDocumentationUri: string;
12218
+
12237
12219
  /**
12238
12220
  * Creates a new Publishing instance using the specified properties.
12239
12221
  * @param [properties] Properties to set