xref: /aosp_15_r20/external/googleapis/google/maps/places/v1/places_service.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.maps.places.v1;
18
19import "google/api/annotations.proto";
20import "google/api/client.proto";
21import "google/api/field_behavior.proto";
22import "google/api/resource.proto";
23import "google/geo/type/viewport.proto";
24import "google/maps/places/v1/ev_charging.proto";
25import "google/maps/places/v1/geometry.proto";
26import "google/maps/places/v1/place.proto";
27import "google/type/latlng.proto";
28
29option cc_enable_arenas = true;
30option csharp_namespace = "Google.Maps.Places.V1";
31option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
32option java_multiple_files = true;
33option java_outer_classname = "PlacesServiceProto";
34option java_package = "com.google.maps.places.v1";
35option objc_class_prefix = "GMPSV1";
36option php_namespace = "Google\\Maps\\Places\\V1";
37
38// Service definition for the Places API.
39// Note: every request (except for Autocomplete requests) requires a field mask
40// set outside of the request proto (`all/*`, is not assumed). The field mask
41// can be set via the HTTP header `X-Goog-FieldMask`. See:
42// https://developers.google.com/maps/documentation/places/web-service/choose-fields
43service Places {
44  option (google.api.default_host) = "places.googleapis.com";
45
46  // Search for places near locations.
47  rpc SearchNearby(SearchNearbyRequest) returns (SearchNearbyResponse) {
48    option (google.api.http) = {
49      post: "/v1/places:searchNearby"
50      body: "*"
51    };
52  }
53
54  // Text query based place search.
55  rpc SearchText(SearchTextRequest) returns (SearchTextResponse) {
56    option (google.api.http) = {
57      post: "/v1/places:searchText"
58      body: "*"
59    };
60  }
61
62  // Get a photo media with a photo reference string.
63  rpc GetPhotoMedia(GetPhotoMediaRequest) returns (PhotoMedia) {
64    option (google.api.http) = {
65      get: "/v1/{name=places/*/photos/*/media}"
66    };
67    option (google.api.method_signature) = "name";
68  }
69
70  // Get the details of a place based on its resource name, which is a string
71  // in the `places/{place_id}` format.
72  rpc GetPlace(GetPlaceRequest) returns (Place) {
73    option (google.api.http) = {
74      get: "/v1/{name=places/*}"
75    };
76    option (google.api.method_signature) = "name";
77  }
78
79  // Returns predictions for the given input.
80  rpc AutocompletePlaces(AutocompletePlacesRequest)
81      returns (AutocompletePlacesResponse) {
82    option (google.api.http) = {
83      post: "/v1/places:autocomplete"
84      body: "*"
85    };
86  }
87}
88
89// Request proto for Search Nearby.
90//
91//
92message SearchNearbyRequest {
93  // The region to search.
94  message LocationRestriction {
95    oneof type {
96      // A circle defined by center point and radius.
97      Circle circle = 2;
98    }
99  }
100
101  // How results will be ranked in the response.
102  enum RankPreference {
103    // RankPreference value not set. Will use rank by POPULARITY by default.
104    RANK_PREFERENCE_UNSPECIFIED = 0;
105
106    // Ranks results by distance.
107    DISTANCE = 1;
108
109    // Ranks results by popularity.
110    POPULARITY = 2;
111  }
112
113  // Place details will be displayed with the preferred language if available.
114  // If the language code is unspecified or unrecognized, place details of any
115  // language may be returned, with a preference for English if such details
116  // exist.
117  //
118  // Current list of supported languages:
119  // https://developers.google.com/maps/faq#languagesupport.
120  string language_code = 1;
121
122  // The Unicode country/region code (CLDR) of the location where the
123  // request is coming from. This parameter is used to display the place
124  // details, like region-specific place name, if available. The parameter can
125  // affect results based on applicable law.
126  //
127  // For more information, see
128  // https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
129  //
130  //
131  // Note that 3-digit region codes are not currently supported.
132  string region_code = 2;
133
134  // Included Place type (eg, "restaurant" or "gas_station") from
135  // https://developers.google.com/maps/documentation/places/web-service/place-types.
136  //
137  // Up to 50 types from [Table
138  // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
139  // may be specified.
140  //
141  // If there are any conflicting types, i.e. a type appears in both
142  // included_types and excluded_types, an INVALID_ARGUMENT error is
143  // returned.
144  //
145  // If a Place type is specified with multiple type restrictions, only places
146  // that satisfy all of the restrictions are returned. For example, if we
147  // have {included_types = ["restaurant"], excluded_primary_types =
148  // ["restaurant"]}, the returned places provide "restaurant"
149  // related services but do not operate primarily as "restaurants".
150  repeated string included_types = 3;
151
152  // Excluded Place type (eg, "restaurant" or "gas_station") from
153  // https://developers.google.com/maps/documentation/places/web-service/place-types.
154  //
155  // Up to 50 types from [Table
156  // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
157  // may be specified.
158  //
159  // If the client provides both included_types (e.g. restaurant) and
160  // excluded_types (e.g. cafe), then the response should include places that
161  // are restaurant but not cafe. The response includes places that match at
162  // least one of the included_types and none of the excluded_types.
163  //
164  // If there are any conflicting types, i.e. a type appears in both
165  // included_types and excluded_types, an INVALID_ARGUMENT error is returned.
166  //
167  // If a Place type is specified with multiple type restrictions, only places
168  // that satisfy all of the restrictions are returned. For example, if we
169  // have {included_types = ["restaurant"], excluded_primary_types =
170  // ["restaurant"]}, the returned places provide "restaurant"
171  // related services but do not operate primarily as "restaurants".
172  repeated string excluded_types = 4;
173
174  // Included primary Place type (e.g. "restaurant" or "gas_station") from
175  // https://developers.google.com/maps/documentation/places/web-service/place-types.
176  // A place can only have a single primary type from the supported types table
177  // associated with it.
178  //
179  // Up to 50 types from [Table
180  // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
181  // may be specified.
182  //
183  // If there are any conflicting primary types, i.e. a type appears in both
184  // included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
185  // error is returned.
186  //
187  // If a Place type is specified with multiple type restrictions, only places
188  // that satisfy all of the restrictions are returned. For example, if we
189  // have {included_types = ["restaurant"], excluded_primary_types =
190  // ["restaurant"]}, the returned places provide "restaurant"
191  // related services but do not operate primarily as "restaurants".
192  repeated string included_primary_types = 5;
193
194  // Excluded primary Place type (e.g. "restaurant" or "gas_station") from
195  // https://developers.google.com/maps/documentation/places/web-service/place-types.
196  //
197  // Up to 50 types from [Table
198  // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
199  // may be specified.
200  //
201  // If there are any conflicting primary types, i.e. a type appears in both
202  // included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
203  // error is returned.
204  //
205  // If a Place type is specified with multiple type restrictions, only places
206  // that satisfy all of the restrictions are returned. For example, if we
207  // have {included_types = ["restaurant"], excluded_primary_types =
208  // ["restaurant"]}, the returned places provide "restaurant"
209  // related services but do not operate primarily as "restaurants".
210  repeated string excluded_primary_types = 6;
211
212  // Maximum number of results to return. It must be between 1 and 20 (default),
213  // inclusively. If the number is unset, it falls back to the upper limit. If
214  // the number is set to negative or exceeds the upper limit, an
215  // INVALID_ARGUMENT error is returned.
216  int32 max_result_count = 7;
217
218  // Required. The region to search.
219  LocationRestriction location_restriction = 8
220      [(google.api.field_behavior) = REQUIRED];
221
222  // How results will be ranked in the response.
223  RankPreference rank_preference = 9;
224}
225
226// Response proto for Search Nearby.
227//
228message SearchNearbyResponse {
229  // A list of places that meets user's requirements like places
230  // types, number of places and specific location restriction.
231  repeated Place places = 1;
232}
233
234// Request proto for SearchText.
235//
236//
237message SearchTextRequest {
238  // How results will be ranked in the response.
239  enum RankPreference {
240    // RankPreference value not set. Will default to DISTANCE.
241    RANK_PREFERENCE_UNSPECIFIED = 0;
242
243    // Ranks results by distance.
244    DISTANCE = 1;
245
246    // Ranks results by relevance. Sort order determined by normal ranking
247    // stack.
248    RELEVANCE = 2;
249  }
250
251  // The region to search. This location serves as a bias which means results
252  // around given location might be returned.
253  message LocationBias {
254    oneof type {
255      // A rectangle box defined by northeast and southwest corner.
256      // `rectangle.high()` must be the northeast point of the rectangle
257      // viewport. `rectangle.low()` must be the southwest point of the
258      // rectangle viewport. `rectangle.low().latitude()` cannot be greater than
259      // `rectangle.high().latitude()`. This will result in an empty latitude
260      // range. A rectangle viewport cannot be wider than 180 degrees.
261      google.geo.type.Viewport rectangle = 1;
262
263      // A circle defined by center point and radius.
264      Circle circle = 2;
265    }
266  }
267
268  // The region to search. This location serves as a restriction which means
269  // results outside given location will not be returned.
270  message LocationRestriction {
271    oneof type {
272      // A rectangle box defined by northeast and southwest corner.
273      // `rectangle.high()` must be the northeast point of the rectangle
274      // viewport. `rectangle.low()` must be the southwest point of the
275      // rectangle viewport. `rectangle.low().latitude()` cannot be greater than
276      // `rectangle.high().latitude()`. This will result in an empty latitude
277      // range. A rectangle viewport cannot be wider than 180 degrees.
278      google.geo.type.Viewport rectangle = 1;
279    }
280  }
281
282  // Searchable EV options of a place search request.
283  message EVOptions {
284    // Optional. Minimum required charging rate in kilowatts. A place with a
285    // charging rate less than the specified rate is filtered out.
286    double minimum_charging_rate_kw = 1
287        [(google.api.field_behavior) = OPTIONAL];
288
289    // Optional. The list of preferred EV connector types. A place that does not
290    // support any of the listed connector types is filtered out.
291    repeated EVConnectorType connector_types = 2
292        [(google.api.field_behavior) = OPTIONAL];
293  }
294
295  // Required. The text query for textual search.
296  string text_query = 1 [(google.api.field_behavior) = REQUIRED];
297
298  // Place details will be displayed with the preferred language if available.
299  // If the language code is unspecified or unrecognized, place details of any
300  // language may be returned, with a preference for English if such details
301  // exist.
302  //
303  // Current list of supported languages:
304  // https://developers.google.com/maps/faq#languagesupport.
305  string language_code = 2;
306
307  // The Unicode country/region code (CLDR) of the location where the
308  // request is coming from. This parameter is used to display the place
309  // details, like region-specific place name, if available. The parameter can
310  // affect results based on applicable law.
311  //
312  // For more information, see
313  // https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
314  //
315  //
316  // Note that 3-digit region codes are not currently supported.
317  string region_code = 3;
318
319  // How results will be ranked in the response.
320  RankPreference rank_preference = 4;
321
322  // The requested place type. Full list of types supported:
323  // https://developers.google.com/maps/documentation/places/web-service/place-types.
324  // Only support one included type.
325  string included_type = 6;
326
327  // Used to restrict the search to places that are currently open.  The default
328  // is false.
329  bool open_now = 7;
330
331  // Filter out results whose average user rating is strictly less than this
332  // limit. A valid value must be a float between 0 and 5 (inclusively) at a
333  // 0.5 cadence i.e. [0, 0.5, 1.0, ... , 5.0] inclusively. The input rating
334  // will round up to the nearest 0.5(ceiling). For instance, a rating of 0.6
335  // will eliminate all results with a less than 1.0 rating.
336  double min_rating = 9;
337
338  // Maximum number of results to return. It must be between 1 and 20,
339  // inclusively. The default is 20.  If the number is unset, it falls back to
340  // the upper limit. If the number is set to negative or exceeds the upper
341  // limit, an INVALID_ARGUMENT error is returned.
342  int32 max_result_count = 10;
343
344  // Used to restrict the search to places that are marked as certain price
345  // levels. Users can choose any combinations of price levels. Default to
346  // select all price levels.
347  repeated PriceLevel price_levels = 11;
348
349  // Used to set strict type filtering for included_type. If set to true, only
350  // results of the same type will be returned. Default to false.
351  bool strict_type_filtering = 12;
352
353  // The region to search. This location serves as a bias which means results
354  // around given location might be returned. Cannot be set along with
355  // location_restriction.
356  LocationBias location_bias = 13;
357
358  // The region to search. This location serves as a restriction which means
359  // results outside given location will not be returned. Cannot be set along
360  // with location_bias.
361  LocationRestriction location_restriction = 14;
362
363  // Optional. Set the searchable EV options of a place search request.
364  EVOptions ev_options = 15 [(google.api.field_behavior) = OPTIONAL];
365}
366
367// Response proto for SearchText.
368//
369message SearchTextResponse {
370  // A list of places that meet the user's text search criteria.
371  repeated Place places = 1;
372}
373
374// Request for fetching a photo of a place using a photo resource name.
375message GetPhotoMediaRequest {
376  // Required. The resource name of a photo media in the format:
377  // `places/{place_id}/photos/{photo_reference}/media`.
378  //
379  // The resource name of a photo as returned in a Place object's `photos.name`
380  // field comes with the format
381  // `places/{place_id}/photos/{photo_reference}`. You need to append `/media`
382  // at the end of the photo resource to get the photo media resource name.
383  string name = 1 [
384    (google.api.field_behavior) = REQUIRED,
385    (google.api.resource_reference) = {
386      type: "places.googleapis.com/PhotoMedia"
387    }
388  ];
389
390  // Optional. Specifies the maximum desired width, in pixels, of the image. If
391  // the image is smaller than the values specified, the original image will be
392  // returned. If the image is larger in either dimension, it will be scaled to
393  // match the smaller of the two dimensions, restricted to its original aspect
394  // ratio. Both the max_height_px and max_width_px properties accept an integer
395  // between 1 and 4800, inclusively. If the value is not within the allowed
396  // range, an INVALID_ARGUMENT error will be returned.
397  //
398  // At least one of max_height_px or max_width_px needs to be specified. If
399  // neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
400  // error will be returned.
401  int32 max_width_px = 2 [(google.api.field_behavior) = OPTIONAL];
402
403  // Optional. Specifies the maximum desired height, in pixels, of the image. If
404  // the image is smaller than the values specified, the original image will be
405  // returned. If the image is larger in either dimension, it will be scaled to
406  // match the smaller of the two dimensions, restricted to its original aspect
407  // ratio. Both the max_height_px and max_width_px properties accept an integer
408  // between 1 and 4800, inclusively. If the value is not within the allowed
409  // range, an INVALID_ARGUMENT error will be returned.
410  //
411  // At least one of max_height_px or max_width_px needs to be specified. If
412  // neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
413  // error will be returned.
414  int32 max_height_px = 3 [(google.api.field_behavior) = OPTIONAL];
415
416  // Optional. If set, skip the default HTTP redirect behavior and render a text
417  // format (for example, in JSON format for HTTP use case) response. If not
418  // set, an HTTP redirect will be issued to redirect the call to the image
419  // media. This option is ignored for non-HTTP requests.
420  bool skip_http_redirect = 4 [(google.api.field_behavior) = OPTIONAL];
421}
422
423// A photo media from Places API.
424message PhotoMedia {
425  option (google.api.resource) = {
426    type: "places.googleapis.com/PhotoMedia"
427    pattern: "places/{place_id}/photos/{photo_reference}/media"
428    plural: "photoMedias"
429    singular: "photoMedia"
430  };
431
432  // The resource name of a photo media in the format:
433  // `places/{place_id}/photos/{photo_reference}/media`.
434  string name = 1;
435
436  // A short-lived uri that can be used to render the photo.
437  string photo_uri = 2;
438}
439
440// Request for fetching a Place based on its resource name, which is a string in
441// the `places/{place_id}` format.
442message GetPlaceRequest {
443  // Required. The resource name of a place, in the `places/{place_id}` format.
444  string name = 1 [
445    (google.api.field_behavior) = REQUIRED,
446    (google.api.resource_reference) = { type: "places.googleapis.com/Place" }
447  ];
448
449  // Optional. Place details will be displayed with the preferred language if
450  // available.
451  //
452  // Current list of supported languages:
453  // https://developers.google.com/maps/faq#languagesupport.
454  string language_code = 2 [(google.api.field_behavior) = OPTIONAL];
455
456  // Optional. The Unicode country/region code (CLDR) of the location where the
457  // request is coming from. This parameter is used to display the place
458  // details, like region-specific place name, if available. The parameter can
459  // affect results based on applicable law.
460  // For more information, see
461  // https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
462  //
463  //
464  // Note that 3-digit region codes are not currently supported.
465  string region_code = 3 [(google.api.field_behavior) = OPTIONAL];
466
467  // Optional. A string which identifies an Autocomplete session for billing
468  // purposes. Must be a URL and filename safe base64 string with at most 36
469  // ASCII characters in length. Otherwise an INVALID_ARGUMENT error is
470  // returned.
471  //
472  // The session begins when the user starts typing a query, and concludes when
473  // they select a place and a call to Place Details or Address Validation is
474  // made. Each session can have multiple queries, followed by one Place Details
475  // or Address Validation request. The credentials used for each request within
476  // a session must belong to the same Google Cloud Console project. Once a
477  // session has concluded, the token is no longer valid; your app must generate
478  // a fresh token for each session. If the `session_token` parameter is
479  // omitted, or if you reuse a session token, the session is charged as if no
480  // session token was provided (each request is billed separately).
481  //
482  // We recommend the following guidelines:
483  //
484  // * Use session tokens for all Place Autocomplete calls.
485  // * Generate a fresh token for each session. Using a version 4 UUID is
486  //   recommended.
487  // * Ensure that the credentials used for all Place Autocomplete, Place
488  //   Details, and Address Validation requests within a session belong to the
489  //   same Cloud Console project.
490  // * Be sure to pass a unique session token for each new session. Using the
491  //   same token for more than one session will result in each request being
492  //   billed individually.
493  string session_token = 4 [(google.api.field_behavior) = OPTIONAL];
494}
495
496// Request proto for AutocompletePlaces.
497message AutocompletePlacesRequest {
498  // The region to search. The results may be biased around the specified
499  // region.
500  message LocationBias {
501    oneof type {
502      // A viewport defined by a northeast and a southwest corner.
503      google.geo.type.Viewport rectangle = 1;
504
505      // A circle defined by a center point and radius.
506      Circle circle = 2;
507    }
508  }
509
510  // The region to search. The results will be restricted to the specified
511  // region.
512  message LocationRestriction {
513    oneof type {
514      // A viewport defined by a northeast and a southwest corner.
515      google.geo.type.Viewport rectangle = 1;
516
517      // A circle defined by a center point and radius.
518      Circle circle = 2;
519    }
520  }
521
522  // Required. The text string on which to search.
523  string input = 1 [(google.api.field_behavior) = REQUIRED];
524
525  // Optional. Bias results to a specified location.
526  //
527  // At most one of `location_bias` or `location_restriction` should be set. If
528  // neither are set, the results will be biased by IP address, meaning the IP
529  // address will be mapped to an imprecise location and used as a biasing
530  // signal.
531  LocationBias location_bias = 2 [(google.api.field_behavior) = OPTIONAL];
532
533  // Optional. Restrict results to a specified location.
534  //
535  // At most one of `location_bias` or `location_restriction` should be set. If
536  // neither are set, the results will be biased by IP address, meaning the IP
537  // address will be mapped to an imprecise location and used as a biasing
538  // signal.
539  LocationRestriction location_restriction = 3
540      [(google.api.field_behavior) = OPTIONAL];
541
542  // Optional. Included primary Place type (for example, "restaurant" or
543  // "gas_station") from
544  // https://developers.google.com/maps/documentation/places/web-service/place-types.
545  // A Place is only returned if its primary type is included in this list. Up
546  // to 5 values can be specified. If no types are specified, all Place types
547  // are returned.
548  repeated string included_primary_types = 4
549      [(google.api.field_behavior) = OPTIONAL];
550
551  // Optional. Only include results in the specified regions, specified as up to
552  // 15 CLDR two-character region codes. An empty set will not restrict the
553  // results. If both `location_restriction` and `included_region_codes` are
554  // set, the results will be located in the area of intersection.
555  repeated string included_region_codes = 5
556      [(google.api.field_behavior) = OPTIONAL];
557
558  // Optional. The language in which to return results. Defaults to en-US. The
559  // results may be in mixed languages if the language used in `input` is
560  // different from `language_code` or if the returned Place does not have a
561  // translation from the local language to `language_code`.
562  string language_code = 6 [(google.api.field_behavior) = OPTIONAL];
563
564  // Optional. The region code, specified as a CLDR two-character region code.
565  // This affects address formatting, result ranking, and may influence what
566  // results are returned. This does not restrict results to the specified
567  // region. To restrict results to a region, use `region_code_restriction`.
568  string region_code = 7 [(google.api.field_behavior) = OPTIONAL];
569
570  // Optional. The origin point from which to calculate geodesic distance to the
571  // destination (returned as `distance_meters`). If this value is omitted,
572  // geodesic distance will not be returned.
573  google.type.LatLng origin = 8 [(google.api.field_behavior) = OPTIONAL];
574
575  // Optional. A zero-based Unicode character offset of `input` indicating the
576  // cursor position in `input`. The cursor position may influence what
577  // predictions are returned.
578  //
579  // If empty, defaults to the length of `input`.
580  int32 input_offset = 9 [(google.api.field_behavior) = OPTIONAL];
581
582  // Optional. If true, the response will include both Place and query
583  // predictions. Otherwise the response will only return Place predictions.
584  bool include_query_predictions = 10 [(google.api.field_behavior) = OPTIONAL];
585
586  // Optional. A string which identifies an Autocomplete session for billing
587  // purposes. Must be a URL and filename safe base64 string with at most 36
588  // ASCII characters in length. Otherwise an INVALID_ARGUMENT error is
589  // returned.
590  //
591  // The session begins when the user starts typing a query, and concludes when
592  // they select a place and a call to Place Details or Address Validation is
593  // made. Each session can have multiple queries, followed by one Place Details
594  // or Address Validation request. The credentials used for each request within
595  // a session must belong to the same Google Cloud Console project. Once a
596  // session has concluded, the token is no longer valid; your app must generate
597  // a fresh token for each session. If the `session_token` parameter is
598  // omitted, or if you reuse a session token, the session is charged as if no
599  // session token was provided (each request is billed separately).
600  //
601  // We recommend the following guidelines:
602  //
603  // * Use session tokens for all Place Autocomplete calls.
604  // * Generate a fresh token for each session. Using a version 4 UUID is
605  //   recommended.
606  // * Ensure that the credentials used for all Place Autocomplete, Place
607  //   Details, and Address Validation requests within a session belong to the
608  //   same Cloud Console project.
609  // * Be sure to pass a unique session token for each new session. Using the
610  //   same token for more than one session will result in each request being
611  //   billed individually.
612  string session_token = 11 [(google.api.field_behavior) = OPTIONAL];
613}
614
615// Response proto for AutocompletePlaces.
616message AutocompletePlacesResponse {
617  // An Autocomplete suggestion result.
618  message Suggestion {
619    // Identifies a substring within a given text.
620    message StringRange {
621      // Zero-based offset of the first Unicode character of the string
622      // (inclusive).
623      int32 start_offset = 1;
624
625      // Zero-based offset of the last Unicode character (exclusive).
626      int32 end_offset = 2;
627    }
628
629    // Text representing a Place or query prediction. The text may be used as is
630    // or formatted.
631    message FormattableText {
632      // Text that may be used as is or formatted with `matches`.
633      string text = 1;
634
635      // A list of string ranges identifying where the input request matched in
636      // `text`. The ranges can be used to format specific parts of `text`. The
637      // substrings may not be exact matches of `input` if the matching was
638      // determined by criteria other than string matching (for example, spell
639      // corrections or transliterations).
640      //
641      // These values are Unicode character offsets of `text`. The ranges are
642      // guaranteed to be ordered in increasing offset values.
643      repeated StringRange matches = 2;
644    }
645
646    // Contains a breakdown of a Place or query prediction into main text
647    // and secondary text.
648    //
649    // For Place predictions, the main text contains the specific name of the
650    // Place. For query predictions, the main text contains the query.
651    //
652    // The secondary text contains additional disambiguating features (such as a
653    // city or region) to further identify the Place or refine the query.
654    message StructuredFormat {
655      // Represents the name of the Place or query.
656      FormattableText main_text = 1;
657
658      // Represents additional disambiguating features (such as a city or
659      // region) to further identify the Place or refine the query.
660      FormattableText secondary_text = 2;
661    }
662
663    // Prediction results for a Place Autocomplete prediction.
664    message PlacePrediction {
665      // The resource name of the suggested Place. This name can be used in
666      // other APIs that accept Place names.
667      string place = 1 [(google.api.resource_reference) = {
668        type: "places.googleapis.com/Place"
669      }];
670
671      // The unique identifier of the suggested Place. This identifier can be
672      // used in other APIs that accept Place IDs.
673      string place_id = 2;
674
675      // Contains the human-readable name for the returned result. For
676      // establishment results, this is usually the business name and address.
677      //
678      // `text` is recommended for developers who wish to show a single UI
679      // element. Developers who wish to show two separate, but related, UI
680      // elements may want to use `structured_format` instead. They are two
681      // different ways to represent a Place prediction. Users should not try to
682      // parse `structured_format` into `text` or vice versa.
683      //
684      // This text may be different from the `display_name` returned by
685      // GetPlace.
686      //
687      // May be in mixed languages if the request `input` and `language_code`
688      // are in different languages or if the Place does not have a translation
689      // from the local language to `language_code`.
690      FormattableText text = 3;
691
692      // A breakdown of the Place prediction into main text containing the name
693      // of the Place and secondary text containing additional disambiguating
694      // features (such as a city or region).
695      //
696      // `structured_format` is recommended for developers who wish to show two
697      // separate, but related, UI elements. Developers who wish to show a
698      // single UI element may want to use `text` instead. They are two
699      // different ways to represent a Place prediction. Users should not try to
700      // parse `structured_format` into `text` or vice versa.
701      StructuredFormat structured_format = 4;
702
703      // List of types that apply to this Place from Table A or Table B in
704      // https://developers.google.com/maps/documentation/places/web-service/place-types.
705      //
706      // A type is a categorization of a Place. Places with shared types will
707      // share similar characteristics.
708      repeated string types = 5;
709
710      // The length of the geodesic in meters from `origin` if `origin` is
711      // specified. Certain predictions such as routes may not populate this
712      // field.
713      int32 distance_meters = 6;
714    }
715
716    // Prediction results for a Query Autocomplete prediction.
717    message QueryPrediction {
718      // The predicted text. This text does not represent a Place, but rather a
719      // text query that could be used in a search endpoint (for example,
720      // Text Search).
721      //
722      // `text` is recommended for developers who wish to show a single UI
723      // element. Developers who wish to show two separate, but related, UI
724      // elements may want to use `structured_format` instead. They are two
725      // different ways to represent a query prediction. Users should not try to
726      // parse `structured_format` into `text` or vice versa.
727      //
728      // May be in mixed languages if the request `input` and `language_code`
729      // are in different languages or if part of the query does not have a
730      // translation from the local language to `language_code`.
731      FormattableText text = 1;
732
733      // A breakdown of the query prediction into main text containing the query
734      // and secondary text containing additional disambiguating features (such
735      // as a city or region).
736      //
737      // `structured_format` is recommended for developers who wish to show two
738      // separate, but related, UI elements. Developers who wish to show a
739      // single UI element may want to use `text` instead. They are two
740      // different ways to represent a query prediction. Users should not try to
741      // parse `structured_format` into `text` or vice versa.
742      StructuredFormat structured_format = 2;
743    }
744
745    oneof kind {
746      // A prediction for a Place.
747      PlacePrediction place_prediction = 1;
748
749      // A prediction for a query.
750      QueryPrediction query_prediction = 2;
751    }
752  }
753
754  // Contains a list of suggestions, ordered in descending order of relevance.
755  repeated Suggestion suggestions = 1;
756}
757