@googlemaps/places 1.0.1 → 1.2.0

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.
@@ -19,6 +19,7 @@ package google.maps.places.v1;
19
19
  import "google/api/annotations.proto";
20
20
  import "google/api/client.proto";
21
21
  import "google/api/field_behavior.proto";
22
+ import "google/api/resource.proto";
22
23
  import "google/geo/type/viewport.proto";
23
24
  import "google/maps/places/v1/geometry.proto";
24
25
  import "google/maps/places/v1/place.proto";
@@ -33,30 +34,196 @@ option objc_class_prefix = "GMPSV1";
33
34
  option php_namespace = "Google\\Maps\\Places\\V1";
34
35
 
35
36
  // Service definition for the Places API.
37
+ // Note: every request actually requires a field mask set outside of
38
+ // the request proto (all/'*', is not assumed). That can be set via either a
39
+ // side channel (SystemParameterContext) over RPC, or a header
40
+ // (X-Goog-FieldMask) over HTTP. See:
41
+ // https://cloud.google.com/apis/docs/system-parameters
36
42
  service Places {
37
43
  option (google.api.default_host) = "places.googleapis.com";
38
44
 
45
+ // Search for places near locations.
46
+ rpc SearchNearby(SearchNearbyRequest) returns (SearchNearbyResponse) {
47
+ option (google.api.http) = {
48
+ post: "/v1/places:searchNearby"
49
+ body: "*"
50
+ };
51
+ }
52
+
39
53
  // Text query based place search.
40
54
  rpc SearchText(SearchTextRequest) returns (SearchTextResponse) {
41
55
  option (google.api.http) = {
42
- post: "/v1/Text:search"
56
+ post: "/v1/places:searchText"
43
57
  body: "*"
44
58
  };
45
59
  }
60
+
61
+ // Get a photo media with a photo reference string.
62
+ rpc GetPhotoMedia(GetPhotoMediaRequest) returns (PhotoMedia) {
63
+ option (google.api.http) = {
64
+ get: "/v1/{name=places/*/photos/*/media}"
65
+ };
66
+ option (google.api.method_signature) = "name";
67
+ }
68
+
69
+ // Get place details with a place id (in a name) string.
70
+ rpc GetPlace(GetPlaceRequest) returns (Place) {
71
+ option (google.api.http) = {
72
+ get: "/v1/{name=places/*}"
73
+ };
74
+ option (google.api.method_signature) = "name";
75
+ }
46
76
  }
47
77
 
48
- // int 32 range. Both min and max are optional. If only min is set, then the
49
- // range only has a lower bound. If only max is set, then range only has an
50
- // upper bound. At least one of min and max must be set. Values are inclusive.
51
- message Int32Range {
52
- // Lower bound. If unset, behavior is documented on the range field.
53
- optional int32 min = 1;
78
+ // Request proto for Search Nearby.
79
+ //
80
+ //
81
+ message SearchNearbyRequest {
82
+ // The region to search.
83
+ message LocationRestriction {
84
+ oneof type {
85
+ // A circle defined by center point and radius.
86
+ Circle circle = 2;
87
+ }
88
+ }
89
+
90
+ // How results will be ranked in the response.
91
+ enum RankPreference {
92
+ // RankPreference value not set. Will use rank by POPULARITY by default.
93
+ RANK_PREFERENCE_UNSPECIFIED = 0;
94
+
95
+ // Ranks results by distance.
96
+ DISTANCE = 1;
97
+
98
+ // Ranks results by popularity.
99
+ POPULARITY = 2;
100
+ }
54
101
 
55
- // Upper bound. If unset, behavior is documented on the range field.
56
- optional int32 max = 2;
102
+ // Place details will be displayed with the preferred language if available.
103
+ // If the language code is unspecified or unrecognized, place details of any
104
+ // language may be returned, with a preference for English if such details
105
+ // exist.
106
+ //
107
+ // Current list of supported languages:
108
+ // https://developers.google.com/maps/faq#languagesupport.
109
+ string language_code = 1;
110
+
111
+ // The Unicode country/region code (CLDR) of the location where the
112
+ // request is coming from. This parameter is used to display the place
113
+ // details, like region-specific place name, if available. The parameter can
114
+ // affect results based on applicable law.
115
+ //
116
+ // For more information, see
117
+ // https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
118
+ //
119
+ //
120
+ // Note that 3-digit region codes are not currently supported.
121
+ string region_code = 2;
122
+
123
+ // Included Place type (eg, "restaurant" or "gas_station") from
124
+ // https://developers.google.com/maps/documentation/places/web-service/place-types.
125
+ //
126
+ // Up to 50 types from [Table
127
+ // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
128
+ // may be specified.
129
+ //
130
+ // If there are any conflicting types, i.e. a type appears in both
131
+ // included_types and excluded_types, an INVALID_ARGUMENT error is
132
+ // returned.
133
+ //
134
+ // If a Place type is specified with multiple type restrictions, only places
135
+ // that satisfy all of the restrictions are returned. For example, if we
136
+ // have {included_types = ["restaurant"], excluded_primary_types =
137
+ // ["restaurant"]}, the returned places provide "restaurant"
138
+ // related services but do not operate primarily as "restaurants".
139
+ repeated string included_types = 3;
140
+
141
+ // Excluded Place type (eg, "restaurant" or "gas_station") from
142
+ // https://developers.google.com/maps/documentation/places/web-service/place-types.
143
+ //
144
+ // Up to 50 types from [Table
145
+ // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
146
+ // may be specified.
147
+ //
148
+ // If the client provides both included_types (e.g. restaurant) and
149
+ // excluded_types (e.g. cafe), then the response should include places that
150
+ // are restaurant but not cafe. The response includes places that match at
151
+ // least one of the included_types and none of the excluded_types.
152
+ //
153
+ // If there are any conflicting types, i.e. a type appears in both
154
+ // included_types and excluded_types, an INVALID_ARGUMENT error is returned.
155
+ //
156
+ // If a Place type is specified with multiple type restrictions, only places
157
+ // that satisfy all of the restrictions are returned. For example, if we
158
+ // have {included_types = ["restaurant"], excluded_primary_types =
159
+ // ["restaurant"]}, the returned places provide "restaurant"
160
+ // related services but do not operate primarily as "restaurants".
161
+ repeated string excluded_types = 4;
162
+
163
+ // Included primary Place type (e.g. "restaurant" or "gas_station") from
164
+ // https://developers.google.com/maps/documentation/places/web-service/place-types.
165
+ // A place can only have a single primary type from the supported types table
166
+ // associated with it.
167
+ //
168
+ // Up to 50 types from [Table
169
+ // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
170
+ // may be specified.
171
+ //
172
+ // If there are any conflicting primary types, i.e. a type appears in both
173
+ // included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
174
+ // error is returned.
175
+ //
176
+ // If a Place type is specified with multiple type restrictions, only places
177
+ // that satisfy all of the restrictions are returned. For example, if we
178
+ // have {included_types = ["restaurant"], excluded_primary_types =
179
+ // ["restaurant"]}, the returned places provide "restaurant"
180
+ // related services but do not operate primarily as "restaurants".
181
+ repeated string included_primary_types = 5;
182
+
183
+ // Excluded primary Place type (e.g. "restaurant" or "gas_station") from
184
+ // https://developers.google.com/maps/documentation/places/web-service/place-types.
185
+ //
186
+ // Up to 50 types from [Table
187
+ // A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
188
+ // may be specified.
189
+ //
190
+ // If there are any conflicting primary types, i.e. a type appears in both
191
+ // included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
192
+ // error is returned.
193
+ //
194
+ // If a Place type is specified with multiple type restrictions, only places
195
+ // that satisfy all of the restrictions are returned. For example, if we
196
+ // have {included_types = ["restaurant"], excluded_primary_types =
197
+ // ["restaurant"]}, the returned places provide "restaurant"
198
+ // related services but do not operate primarily as "restaurants".
199
+ repeated string excluded_primary_types = 6;
200
+
201
+ // Maximum number of results to return. It must be between 1 and 20 (default),
202
+ // inclusively. If the number is unset, it falls back to the upper limit. If
203
+ // the number is set to negative or exceeds the upper limit, an
204
+ // INVALID_ARGUMENT error is returned.
205
+ int32 max_result_count = 7;
206
+
207
+ // Required. The region to search.
208
+ LocationRestriction location_restriction = 8
209
+ [(google.api.field_behavior) = REQUIRED];
210
+
211
+ // How results will be ranked in the response.
212
+ RankPreference rank_preference = 9;
57
213
  }
58
214
 
59
- // Request data structure for SearchText.
215
+ // Response proto for Search Nearby.
216
+ //
217
+ //
218
+ message SearchNearbyResponse {
219
+ // A list of places that meets user's requirements like places
220
+ // types, number of places and specific location restriction.
221
+ repeated Place places = 1;
222
+ }
223
+
224
+ // Request proto for SearchText.
225
+ //
226
+ //
60
227
  message SearchTextRequest {
61
228
  // How results will be ranked in the response.
62
229
  enum RankPreference {
@@ -67,30 +234,20 @@ message SearchTextRequest {
67
234
  DISTANCE = 1;
68
235
 
69
236
  // Ranks results by relevance. Sort order determined by normal ranking
70
- // stack. See SortRefinement::RELEVANCE.
237
+ // stack.
71
238
  RELEVANCE = 2;
72
239
  }
73
240
 
74
- // The region to search.
75
- //
76
- // Deprecated. Use LocationRestriction or LocationBias instead.
77
- message Location {
78
- oneof type {
79
- // A rectangle box defined by northeast and southwest corner.
80
- google.geo.type.Viewport rectangle = 1;
81
- }
82
-
83
- // Make location field a strict restriction and filter out POIs outside of
84
- // the given location. If location type field is unset this field will have
85
- // no effect.
86
- bool strict_restriction = 2;
87
- }
88
-
89
241
  // The region to search. This location serves as a bias which means results
90
242
  // around given location might be returned.
91
243
  message LocationBias {
92
244
  oneof type {
93
245
  // A rectangle box defined by northeast and southwest corner.
246
+ // `rectangle.high()` must be the northeast point of the rectangle
247
+ // viewport. `rectangle.low()` must be the southwest point of the
248
+ // rectangle viewport. `rectangle.low().latitude()` cannot be greater than
249
+ // `rectangle.high().latitude()`. This will result in an empty latitude
250
+ // range. A rectangle viewport cannot be wider than 180 degrees.
94
251
  google.geo.type.Viewport rectangle = 1;
95
252
 
96
253
  // A circle defined by center point and radius.
@@ -103,6 +260,11 @@ message SearchTextRequest {
103
260
  message LocationRestriction {
104
261
  oneof type {
105
262
  // A rectangle box defined by northeast and southwest corner.
263
+ // `rectangle.high()` must be the northeast point of the rectangle
264
+ // viewport. `rectangle.low()` must be the southwest point of the
265
+ // rectangle viewport. `rectangle.low().latitude()` cannot be greater than
266
+ // `rectangle.high().latitude()`. This will result in an empty latitude
267
+ // range. A rectangle viewport cannot be wider than 180 degrees.
106
268
  google.geo.type.Viewport rectangle = 1;
107
269
  }
108
270
  }
@@ -120,11 +282,12 @@ message SearchTextRequest {
120
282
  string language_code = 2;
121
283
 
122
284
  // The Unicode country/region code (CLDR) of the location where the
123
- // request is coming from. It is used to display the place details, like
124
- // region-specific place name, if available.
285
+ // request is coming from. This parameter is used to display the place
286
+ // details, like region-specific place name, if available. The parameter can
287
+ // affect results based on applicable law.
125
288
  //
126
289
  // For more information, see
127
- // http://www.unicode.org/reports/tr35/#unicode_region_subtag.
290
+ // https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
128
291
  //
129
292
  //
130
293
  // Note that 3-digit region codes are not currently supported.
@@ -133,42 +296,26 @@ message SearchTextRequest {
133
296
  // How results will be ranked in the response.
134
297
  RankPreference rank_preference = 4;
135
298
 
136
- // The region to search. Setting location would usually yields
137
- // better results. Recommended to set. This location serves as a bias unless
138
- // strict_restriction is set to true, which turns the location to a strict
139
- // restriction.
140
- //
141
- // Deprecated. Use LocationRestriction or LocationBias instead.
142
- Location location = 5 [deprecated = true];
143
-
144
299
  // The requested place type. Full list of types supported:
145
- // https://developers.google.com/places/supported_types. Only support one
146
- // included type.
300
+ // https://developers.google.com/maps/documentation/places/web-service/place-types.
301
+ // Only support one included type.
147
302
  string included_type = 6;
148
303
 
149
- // Used to restrict the search to places that are open at a specific time.
150
- // open_now marks if a business is currently open.
304
+ // Used to restrict the search to places that are currently open. The default
305
+ // is false.
151
306
  bool open_now = 7;
152
307
 
153
- // [Deprecated!]Used to restrict the search to places that are within a
154
- // certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or
155
- // set a maximum of 4 has no effect on the search results. Min price is
156
- // default to 0 and max price is default to 4. Default value will be used if
157
- // either min or max is unset.
158
- Int32Range price_range = 8 [deprecated = true];
159
-
160
308
  // Filter out results whose average user rating is strictly less than this
161
- // limit. A valid value must be an float between 0 and 5 (inclusively) at a
162
- // 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep
163
- // parity with LocalRefinement_UserRating. The input rating will round up to
164
- // the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all
165
- // results with a less than 1.0 rating.
309
+ // limit. A valid value must be a float between 0 and 5 (inclusively) at a
310
+ // 0.5 cadence i.e. [0, 0.5, 1.0, ... , 5.0] inclusively. The input rating
311
+ // will round up to the nearest 0.5(ceiling). For instance, a rating of 0.6
312
+ // will eliminate all results with a less than 1.0 rating.
166
313
  double min_rating = 9;
167
314
 
168
315
  // Maximum number of results to return. It must be between 1 and 20,
169
- // inclusively. If the number is unset, it falls back to the upper limit. If
170
- // the number is set to negative or exceeds the upper limit, an
171
- // INVALID_ARGUMENT error is returned.
316
+ // inclusively. The default is 20. If the number is unset, it falls back to
317
+ // the upper limit. If the number is set to negative or exceeds the upper
318
+ // limit, an INVALID_ARGUMENT error is returned.
172
319
  int32 max_result_count = 10;
173
320
 
174
321
  // Used to restrict the search to places that are marked as certain price
@@ -197,3 +344,98 @@ message SearchTextResponse {
197
344
  // A list of places that meet the user's text search criteria.
198
345
  repeated Place places = 1;
199
346
  }
347
+
348
+ // Request for fetching a photo of a place using a photo resource name.
349
+ message GetPhotoMediaRequest {
350
+ // Required. The resource name of a photo media in the format:
351
+ // `places/{place_id}/photos/{photo_reference}/media`.
352
+ //
353
+ // The resource name of a photo as returned in a Place object's `photos.name`
354
+ // field comes with the format
355
+ // `places/{place_id}/photos/{photo_reference}`. You need to append `/media`
356
+ // at the end of the photo resource to get the photo media resource name.
357
+ string name = 1 [
358
+ (google.api.field_behavior) = REQUIRED,
359
+ (google.api.resource_reference) = {
360
+ type: "places.googleapis.com/PhotoMedia"
361
+ }
362
+ ];
363
+
364
+ // Optional. Specifies the maximum desired width, in pixels, of the image. If
365
+ // the image is smaller than the values specified, the original image will be
366
+ // returned. If the image is larger in either dimension, it will be scaled to
367
+ // match the smaller of the two dimensions, restricted to its original aspect
368
+ // ratio. Both the max_height_px and max_width_px properties accept an integer
369
+ // between 1 and 4800, inclusively. If the value is not within the allowed
370
+ // range, an INVALID_ARGUMENT error will be returned.
371
+ //
372
+ // At least one of max_height_px or max_width_px needs to be specified. If
373
+ // neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
374
+ // error will be returned.
375
+ int32 max_width_px = 2 [(google.api.field_behavior) = OPTIONAL];
376
+
377
+ // Optional. Specifies the maximum desired height, in pixels, of the image. If
378
+ // the image is smaller than the values specified, the original image will be
379
+ // returned. If the image is larger in either dimension, it will be scaled to
380
+ // match the smaller of the two dimensions, restricted to its original aspect
381
+ // ratio. Both the max_height_px and max_width_px properties accept an integer
382
+ // between 1 and 4800, inclusively. If the value is not within the allowed
383
+ // range, an INVALID_ARGUMENT error will be returned.
384
+ //
385
+ // At least one of max_height_px or max_width_px needs to be specified. If
386
+ // neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
387
+ // error will be returned.
388
+ int32 max_height_px = 3 [(google.api.field_behavior) = OPTIONAL];
389
+
390
+ // Optional. If set, skip the default HTTP redirect behavior and render a text
391
+ // format (for example, in JSON format for HTTP use case) response. If not
392
+ // set, an HTTP redirect will be issued to redirect the call to the image
393
+ // media. This option is ignored for non-HTTP requests.
394
+ bool skip_http_redirect = 4 [(google.api.field_behavior) = OPTIONAL];
395
+ }
396
+
397
+ // A photo media from Places API.
398
+ message PhotoMedia {
399
+ option (google.api.resource) = {
400
+ type: "places.googleapis.com/PhotoMedia"
401
+ pattern: "places/{place_id}/photos/{photo_reference}/media"
402
+ plural: "photoMedias"
403
+ singular: "photoMedia"
404
+ };
405
+
406
+ // The resource name of a photo media in the format:
407
+ // `places/{place_id}/photos/{photo_reference}/media`.
408
+ string name = 1;
409
+
410
+ // A short-lived uri that can be used to render the photo.
411
+ string photo_uri = 2;
412
+ }
413
+
414
+ // Request for fetching a Place with a place id (in a name) string.
415
+ message GetPlaceRequest {
416
+ // Required. A place ID returned in a Place (with "places/" prefix), or
417
+ // equivalently the name in the same Place. Format:
418
+ // `places/{place_id}`.
419
+ string name = 1 [
420
+ (google.api.field_behavior) = REQUIRED,
421
+ (google.api.resource_reference) = { type: "places.googleapis.com/Place" }
422
+ ];
423
+
424
+ // Optional. Place details will be displayed with the preferred language if
425
+ // available.
426
+ //
427
+ // Current list of supported languages:
428
+ // https://developers.google.com/maps/faq#languagesupport.
429
+ string language_code = 2 [(google.api.field_behavior) = OPTIONAL];
430
+
431
+ // Optional. The Unicode country/region code (CLDR) of the location where the
432
+ // request is coming from. This parameter is used to display the place
433
+ // details, like region-specific place name, if available. The parameter can
434
+ // affect results based on applicable law.
435
+ // For more information, see
436
+ // https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
437
+ //
438
+ //
439
+ // Note that 3-digit region codes are not currently supported.
440
+ string region_code = 3 [(google.api.field_behavior) = OPTIONAL];
441
+ }
@@ -0,0 +1,65 @@
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
+
15
+ syntax = "proto3";
16
+
17
+ package google.maps.places.v1;
18
+
19
+ import "google/api/resource.proto";
20
+ import "google/maps/places/v1/attribution.proto";
21
+ import "google/protobuf/timestamp.proto";
22
+ import "google/type/localized_text.proto";
23
+
24
+ option cc_enable_arenas = true;
25
+ option csharp_namespace = "Google.Maps.Places.V1";
26
+ option go_package = "cloud.google.com/go/maps/places/apiv1/placespb;placespb";
27
+ option java_multiple_files = true;
28
+ option java_outer_classname = "ReviewProto";
29
+ option java_package = "com.google.maps.places.v1";
30
+ option objc_class_prefix = "GMPSV1";
31
+ option php_namespace = "Google\\Maps\\Places\\V1";
32
+
33
+ // Information about a review of a place.
34
+ message Review {
35
+ option (google.api.resource) = {
36
+ type: "places.googleapis.com/Review"
37
+ pattern: "places/{place}/reviews/{review}"
38
+ plural: "reviews"
39
+ singular: "review"
40
+ };
41
+
42
+ // A reference representing this place review which may be used to look up
43
+ // this place review again (also called the API "resource" name:
44
+ // `places/{place_id}/reviews/{review}`).
45
+ string name = 1;
46
+
47
+ // A string of formatted recent time, expressing the review time relative
48
+ // to the current time in a form appropriate for the language and country.
49
+ string relative_publish_time_description = 2;
50
+
51
+ // The localized text of the review.
52
+ google.type.LocalizedText text = 9;
53
+
54
+ // The review text in its original language.
55
+ google.type.LocalizedText original_text = 12;
56
+
57
+ // A number between 1.0 and 5.0, also called the number of stars.
58
+ double rating = 7;
59
+
60
+ // This review's author.
61
+ AuthorAttribution author_attribution = 13;
62
+
63
+ // Timestamp for the review.
64
+ google.protobuf.Timestamp publish_time = 14;
65
+ }