From 1106a824dbddc7296f069a0a3e063b0ec9fc914f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 22:10:27 -0700 Subject: [PATCH] feat: [routing] adds support for specifying region_code in the ComputeRoutesRequest (#4103) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: adds support for specifying region_code in the ComputeRoutesRequest feat: adds support for specifying region_code and language_code in the ComputeRouteMatrixRequest PiperOrigin-RevId: 517493769 Source-Link: https://github.com/googleapis/googleapis/commit/8fa8ae4c7610d3cc2e265c464106abb2ce1e8716 Source-Link: https://github.com/googleapis/googleapis-gen/commit/45fd970b1a158937dea5554d5b5ee4ccf5db780f Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtcm91dGluZy8uT3dsQm90LnlhbWwiLCJoIjoiNDVmZDk3MGIxYTE1ODkzN2RlYTU1NTRkNWI1ZWU0Y2NmNWRiNzgwZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- .../maps/routing/v2/routes_service.proto | 18 +++++ .../google-maps-routing/protos/protos.d.ts | 18 +++++ packages/google-maps-routing/protos/protos.js | 69 +++++++++++++++++++ .../google-maps-routing/protos/protos.json | 21 ++++++ .../v2/routes.compute_route_matrix.js | 15 ++++ .../generated/v2/routes.compute_routes.js | 6 ++ ...ippet_metadata.google.maps.routing.v2.json | 16 ++++- .../src/v2/routes_client.ts | 15 ++++ 8 files changed, 176 insertions(+), 2 deletions(-) diff --git a/packages/google-maps-routing/protos/google/maps/routing/v2/routes_service.proto b/packages/google-maps-routing/protos/google/maps/routing/v2/routes_service.proto index dbf362dfdc0..721659cb946 100644 --- a/packages/google-maps-routing/protos/google/maps/routing/v2/routes_service.proto +++ b/packages/google-maps-routing/protos/google/maps/routing/v2/routes_service.proto @@ -211,6 +211,11 @@ message ComputeRoutesRequest { // display language is inferred from the location of the route request. string language_code = 10 [(google.api.field_behavior) = OPTIONAL]; + // Optional. The region code, specified as a ccTLD ("top-level domain") + // two-character value. For more information see + // https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + string region_code = 16 [(google.api.field_behavior) = OPTIONAL]; + // Optional. Specifies the units of measure for the display fields. This // includes the `instruction` field in `NavigationInstruction`. The units of // measure used for the route, leg, step distance, and duration are not @@ -299,6 +304,19 @@ message ComputeRouteMatrixRequest { google.protobuf.Timestamp departure_time = 5 [(google.api.field_behavior) = OPTIONAL]; + // Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + // information, see + // http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + // [Language Support](https://developers.google.com/maps/faq#languagesupport) + // for the list of supported languages. When you don't provide this value, the + // display language is inferred from the location of the first origin. + string language_code = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. The region code, specified as a ccTLD ("top-level domain") + // two-character value. For more information see + // https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + string region_code = 9 [(google.api.field_behavior) = OPTIONAL]; + // Optional. A list of extra computations which may be used to complete the // request. Note: These extra computations may return extra fields on the // response. These extra fields must also be specified in the field mask to be diff --git a/packages/google-maps-routing/protos/protos.d.ts b/packages/google-maps-routing/protos/protos.d.ts index d804444a605..dad7b171cc6 100644 --- a/packages/google-maps-routing/protos/protos.d.ts +++ b/packages/google-maps-routing/protos/protos.d.ts @@ -7310,6 +7310,9 @@ export namespace google { /** ComputeRoutesRequest languageCode */ languageCode?: (string|null); + /** ComputeRoutesRequest regionCode */ + regionCode?: (string|null); + /** ComputeRoutesRequest units */ units?: (google.maps.routing.v2.Units|keyof typeof google.maps.routing.v2.Units|null); @@ -7362,6 +7365,9 @@ export namespace google { /** ComputeRoutesRequest languageCode. */ public languageCode: string; + /** ComputeRoutesRequest regionCode. */ + public regionCode: string; + /** ComputeRoutesRequest units. */ public units: (google.maps.routing.v2.Units|keyof typeof google.maps.routing.v2.Units); @@ -7593,6 +7599,12 @@ export namespace google { /** ComputeRouteMatrixRequest departureTime */ departureTime?: (google.protobuf.ITimestamp|null); + /** ComputeRouteMatrixRequest languageCode */ + languageCode?: (string|null); + + /** ComputeRouteMatrixRequest regionCode */ + regionCode?: (string|null); + /** ComputeRouteMatrixRequest extraComputations */ extraComputations?: (google.maps.routing.v2.ComputeRouteMatrixRequest.ExtraComputation[]|null); } @@ -7621,6 +7633,12 @@ export namespace google { /** ComputeRouteMatrixRequest departureTime. */ public departureTime?: (google.protobuf.ITimestamp|null); + /** ComputeRouteMatrixRequest languageCode. */ + public languageCode: string; + + /** ComputeRouteMatrixRequest regionCode. */ + public regionCode: string; + /** ComputeRouteMatrixRequest extraComputations. */ public extraComputations: google.maps.routing.v2.ComputeRouteMatrixRequest.ExtraComputation[]; diff --git a/packages/google-maps-routing/protos/protos.js b/packages/google-maps-routing/protos/protos.js index 408994f6224..fbfe52f093e 100644 --- a/packages/google-maps-routing/protos/protos.js +++ b/packages/google-maps-routing/protos/protos.js @@ -19485,6 +19485,7 @@ * @property {boolean|null} [computeAlternativeRoutes] ComputeRoutesRequest computeAlternativeRoutes * @property {google.maps.routing.v2.IRouteModifiers|null} [routeModifiers] ComputeRoutesRequest routeModifiers * @property {string|null} [languageCode] ComputeRoutesRequest languageCode + * @property {string|null} [regionCode] ComputeRoutesRequest regionCode * @property {google.maps.routing.v2.Units|null} [units] ComputeRoutesRequest units * @property {Array.|null} [requestedReferenceRoutes] ComputeRoutesRequest requestedReferenceRoutes * @property {Array.|null} [extraComputations] ComputeRoutesRequest extraComputations @@ -19596,6 +19597,14 @@ */ ComputeRoutesRequest.prototype.languageCode = ""; + /** + * ComputeRoutesRequest regionCode. + * @member {string} regionCode + * @memberof google.maps.routing.v2.ComputeRoutesRequest + * @instance + */ + ComputeRoutesRequest.prototype.regionCode = ""; + /** * ComputeRoutesRequest units. * @member {google.maps.routing.v2.Units} units @@ -19681,6 +19690,8 @@ writer.int32(message.extraComputations[i]); writer.ldelim(); } + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 16, wireType 2 =*/130).string(message.regionCode); return writer; }; @@ -19761,6 +19772,10 @@ message.languageCode = reader.string(); break; } + case 16: { + message.regionCode = reader.string(); + break; + } case 11: { message.units = reader.int32(); break; @@ -19896,6 +19911,9 @@ if (message.languageCode != null && message.hasOwnProperty("languageCode")) if (!$util.isString(message.languageCode)) return "languageCode: string expected"; + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + if (!$util.isString(message.regionCode)) + return "regionCode: string expected"; if (message.units != null && message.hasOwnProperty("units")) switch (message.units) { default: @@ -20072,6 +20090,8 @@ } if (object.languageCode != null) message.languageCode = String(object.languageCode); + if (object.regionCode != null) + message.regionCode = String(object.regionCode); switch (object.units) { default: if (typeof object.units === "number") { @@ -20175,6 +20195,7 @@ object.languageCode = ""; object.units = options.enums === String ? "UNITS_UNSPECIFIED" : 0; object.polylineEncoding = options.enums === String ? "POLYLINE_ENCODING_UNSPECIFIED" : 0; + object.regionCode = ""; } if (message.origin != null && message.hasOwnProperty("origin")) object.origin = $root.google.maps.routing.v2.Waypoint.toObject(message.origin, options); @@ -20213,6 +20234,8 @@ for (var j = 0; j < message.extraComputations.length; ++j) object.extraComputations[j] = options.enums === String ? $root.google.maps.routing.v2.ComputeRoutesRequest.ExtraComputation[message.extraComputations[j]] === undefined ? message.extraComputations[j] : $root.google.maps.routing.v2.ComputeRoutesRequest.ExtraComputation[message.extraComputations[j]] : message.extraComputations[j]; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; return object; }; @@ -20570,6 +20593,8 @@ * @property {google.maps.routing.v2.RouteTravelMode|null} [travelMode] ComputeRouteMatrixRequest travelMode * @property {google.maps.routing.v2.RoutingPreference|null} [routingPreference] ComputeRouteMatrixRequest routingPreference * @property {google.protobuf.ITimestamp|null} [departureTime] ComputeRouteMatrixRequest departureTime + * @property {string|null} [languageCode] ComputeRouteMatrixRequest languageCode + * @property {string|null} [regionCode] ComputeRouteMatrixRequest regionCode * @property {Array.|null} [extraComputations] ComputeRouteMatrixRequest extraComputations */ @@ -20631,6 +20656,22 @@ */ ComputeRouteMatrixRequest.prototype.departureTime = null; + /** + * ComputeRouteMatrixRequest languageCode. + * @member {string} languageCode + * @memberof google.maps.routing.v2.ComputeRouteMatrixRequest + * @instance + */ + ComputeRouteMatrixRequest.prototype.languageCode = ""; + + /** + * ComputeRouteMatrixRequest regionCode. + * @member {string} regionCode + * @memberof google.maps.routing.v2.ComputeRouteMatrixRequest + * @instance + */ + ComputeRouteMatrixRequest.prototype.regionCode = ""; + /** * ComputeRouteMatrixRequest extraComputations. * @member {Array.} extraComputations @@ -20675,12 +20716,16 @@ writer.uint32(/* id 4, wireType 0 =*/32).int32(message.routingPreference); if (message.departureTime != null && Object.hasOwnProperty.call(message, "departureTime")) $root.google.protobuf.Timestamp.encode(message.departureTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.languageCode != null && Object.hasOwnProperty.call(message, "languageCode")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.languageCode); if (message.extraComputations != null && message.extraComputations.length) { writer.uint32(/* id 8, wireType 2 =*/66).fork(); for (var i = 0; i < message.extraComputations.length; ++i) writer.int32(message.extraComputations[i]); writer.ldelim(); } + if (message.regionCode != null && Object.hasOwnProperty.call(message, "regionCode")) + writer.uint32(/* id 9, wireType 2 =*/74).string(message.regionCode); return writer; }; @@ -20739,6 +20784,14 @@ message.departureTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); break; } + case 6: { + message.languageCode = reader.string(); + break; + } + case 9: { + message.regionCode = reader.string(); + break; + } case 8: { if (!(message.extraComputations && message.extraComputations.length)) message.extraComputations = []; @@ -20829,6 +20882,12 @@ if (error) return "departureTime." + error; } + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + if (!$util.isString(message.languageCode)) + return "languageCode: string expected"; + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + if (!$util.isString(message.regionCode)) + return "regionCode: string expected"; if (message.extraComputations != null && message.hasOwnProperty("extraComputations")) { if (!Array.isArray(message.extraComputations)) return "extraComputations: array expected"; @@ -20933,6 +20992,10 @@ throw TypeError(".google.maps.routing.v2.ComputeRouteMatrixRequest.departureTime: object expected"); message.departureTime = $root.google.protobuf.Timestamp.fromObject(object.departureTime); } + if (object.languageCode != null) + message.languageCode = String(object.languageCode); + if (object.regionCode != null) + message.regionCode = String(object.regionCode); if (object.extraComputations) { if (!Array.isArray(object.extraComputations)) throw TypeError(".google.maps.routing.v2.ComputeRouteMatrixRequest.extraComputations: array expected"); @@ -20979,6 +21042,8 @@ object.travelMode = options.enums === String ? "TRAVEL_MODE_UNSPECIFIED" : 0; object.routingPreference = options.enums === String ? "ROUTING_PREFERENCE_UNSPECIFIED" : 0; object.departureTime = null; + object.languageCode = ""; + object.regionCode = ""; } if (message.origins && message.origins.length) { object.origins = []; @@ -20996,11 +21061,15 @@ object.routingPreference = options.enums === String ? $root.google.maps.routing.v2.RoutingPreference[message.routingPreference] === undefined ? message.routingPreference : $root.google.maps.routing.v2.RoutingPreference[message.routingPreference] : message.routingPreference; if (message.departureTime != null && message.hasOwnProperty("departureTime")) object.departureTime = $root.google.protobuf.Timestamp.toObject(message.departureTime, options); + if (message.languageCode != null && message.hasOwnProperty("languageCode")) + object.languageCode = message.languageCode; if (message.extraComputations && message.extraComputations.length) { object.extraComputations = []; for (var j = 0; j < message.extraComputations.length; ++j) object.extraComputations[j] = options.enums === String ? $root.google.maps.routing.v2.ComputeRouteMatrixRequest.ExtraComputation[message.extraComputations[j]] === undefined ? message.extraComputations[j] : $root.google.maps.routing.v2.ComputeRouteMatrixRequest.ExtraComputation[message.extraComputations[j]] : message.extraComputations[j]; } + if (message.regionCode != null && message.hasOwnProperty("regionCode")) + object.regionCode = message.regionCode; return object; }; diff --git a/packages/google-maps-routing/protos/protos.json b/packages/google-maps-routing/protos/protos.json index 35faef68297..9eb13a0e9b9 100644 --- a/packages/google-maps-routing/protos/protos.json +++ b/packages/google-maps-routing/protos/protos.json @@ -1840,6 +1840,13 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "regionCode": { + "type": "string", + "id": 16, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "units": { "type": "Units", "id": 11, @@ -1937,6 +1944,20 @@ "(google.api.field_behavior)": "OPTIONAL" } }, + "languageCode": { + "type": "string", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, + "regionCode": { + "type": "string", + "id": 9, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } + }, "extraComputations": { "rule": "repeated", "type": "ExtraComputation", diff --git a/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js b/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js index 1b4eda98dcb..ee92b02d7d5 100644 --- a/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js +++ b/packages/google-maps-routing/samples/generated/v2/routes.compute_route_matrix.js @@ -63,6 +63,21 @@ function main(origins, destinations) { * has already occurred, the request fails. */ // const departureTime = {} + /** + * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + * Language Support (https://developers.google.com/maps/faq#languagesupport) + * for the list of supported languages. When you don't provide this value, the + * display language is inferred from the location of the first origin. + */ + // const languageCode = 'abc123' + /** + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + */ + // const regionCode = 'abc123' /** * Optional. A list of extra computations which may be used to complete the * request. Note: These extra computations may return extra fields on the diff --git a/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js b/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js index b7046b30581..335b0352fce 100644 --- a/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js +++ b/packages/google-maps-routing/samples/generated/v2/routes.compute_routes.js @@ -88,6 +88,12 @@ function main(origin, destination) { * display language is inferred from the location of the route request. */ // const languageCode = 'abc123' + /** + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains + */ + // const regionCode = 'abc123' /** * Optional. Specifies the units of measure for the display fields. This * includes the `instruction` field in `NavigationInstruction`. The units of diff --git a/packages/google-maps-routing/samples/generated/v2/snippet_metadata.google.maps.routing.v2.json b/packages/google-maps-routing/samples/generated/v2/snippet_metadata.google.maps.routing.v2.json index 7fe376bd483..2cd94b6286f 100644 --- a/packages/google-maps-routing/samples/generated/v2/snippet_metadata.google.maps.routing.v2.json +++ b/packages/google-maps-routing/samples/generated/v2/snippet_metadata.google.maps.routing.v2.json @@ -22,7 +22,7 @@ "segments": [ { "start": 25, - "end": 133, + "end": 139, "type": "FULL" } ], @@ -75,6 +75,10 @@ "name": "language_code", "type": "TYPE_STRING" }, + { + "name": "region_code", + "type": "TYPE_STRING" + }, { "name": "units", "type": ".google.maps.routing.v2.Units" @@ -114,7 +118,7 @@ "segments": [ { "start": 25, - "end": 94, + "end": 109, "type": "FULL" } ], @@ -143,6 +147,14 @@ "name": "departure_time", "type": ".google.protobuf.Timestamp" }, + { + "name": "language_code", + "type": "TYPE_STRING" + }, + { + "name": "region_code", + "type": "TYPE_STRING" + }, { "name": "extra_computations", "type": "TYPE_ENUM[]" diff --git a/packages/google-maps-routing/src/v2/routes_client.ts b/packages/google-maps-routing/src/v2/routes_client.ts index ce318d66d8d..dc85b12c102 100644 --- a/packages/google-maps-routing/src/v2/routes_client.ts +++ b/packages/google-maps-routing/src/v2/routes_client.ts @@ -401,6 +401,10 @@ export class RoutesClient { * [Language Support](https://developers.google.com/maps/faq#languagesupport) * for the list of supported languages. When you don't provide this value, the * display language is inferred from the location of the route request. + * @param {string} [request.regionCode] + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains * @param {google.maps.routing.v2.Units} [request.units] * Optional. Specifies the units of measure for the display fields. This * includes the `instruction` field in `NavigationInstruction`. The units of @@ -558,6 +562,17 @@ export class RoutesClient { * Optional. The departure time. If you don't set this value, this defaults to * the time that you made the request. If you set this value to a time that * has already occurred, the request fails. + * @param {string} [request.languageCode] + * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more + * information, see + * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See + * [Language Support](https://developers.google.com/maps/faq#languagesupport) + * for the list of supported languages. When you don't provide this value, the + * display language is inferred from the location of the first origin. + * @param {string} [request.regionCode] + * Optional. The region code, specified as a ccTLD ("top-level domain") + * two-character value. For more information see + * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains * @param {number[]} [request.extraComputations] * Optional. A list of extra computations which may be used to complete the * request. Note: These extra computations may return extra fields on the