@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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -3,6 +3,11 @@ import type { Callback, CallOptions, Descriptors, ClientOptions } from 'google-g
3
3
  import * as protos from '../../protos/protos';
4
4
  /**
5
5
  * Service definition for the Places API.
6
+ * Note: every request actually requires a field mask set outside of
7
+ * the request proto (all/'*', is not assumed). That can be set via either a
8
+ * side channel (SystemParameterContext) over RPC, or a header
9
+ * (X-Goog-FieldMask) over HTTP. See:
10
+ * https://cloud.google.com/apis/docs/system-parameters
6
11
  * @class
7
12
  * @memberof v1
8
13
  */
@@ -14,12 +19,17 @@ export declare class PlacesClient {
14
19
  private _gaxGrpc;
15
20
  private _protos;
16
21
  private _defaults;
22
+ private _universeDomain;
23
+ private _servicePath;
17
24
  auth: gax.GoogleAuth;
18
25
  descriptors: Descriptors;
19
26
  warn: (code: string, message: string, warnType?: string) => void;
20
27
  innerApiCalls: {
21
28
  [name: string]: Function;
22
29
  };
30
+ pathTemplates: {
31
+ [name: string]: gax.PathTemplate;
32
+ };
23
33
  placesStub?: Promise<{
24
34
  [name: string]: Function;
25
35
  }>;
@@ -79,15 +89,22 @@ export declare class PlacesClient {
79
89
  }>;
80
90
  /**
81
91
  * The DNS address for this API service.
92
+ * @deprecated Use the apiEndpoint method of the client instance.
82
93
  * @returns {string} The DNS address for this service.
83
94
  */
84
95
  static get servicePath(): string;
85
96
  /**
86
- * The DNS address for this API service - same as servicePath(),
87
- * exists for compatibility reasons.
97
+ * The DNS address for this API service - same as servicePath.
98
+ * @deprecated Use the apiEndpoint method of the client instance.
88
99
  * @returns {string} The DNS address for this service.
89
100
  */
90
101
  static get apiEndpoint(): string;
102
+ /**
103
+ * The DNS address for this API service.
104
+ * @returns {string} The DNS address for this service.
105
+ */
106
+ get apiEndpoint(): string;
107
+ get universeDomain(): string;
91
108
  /**
92
109
  * The port for this API service.
93
110
  * @returns {number} The default port for this service.
@@ -101,6 +118,129 @@ export declare class PlacesClient {
101
118
  static get scopes(): never[];
102
119
  getProjectId(): Promise<string>;
103
120
  getProjectId(callback: Callback<string, undefined, undefined>): void;
121
+ /**
122
+ * Search for places near locations.
123
+ *
124
+ * @param {Object} request
125
+ * The request object that will be sent.
126
+ * @param {string} request.languageCode
127
+ * Place details will be displayed with the preferred language if available.
128
+ * If the language code is unspecified or unrecognized, place details of any
129
+ * language may be returned, with a preference for English if such details
130
+ * exist.
131
+ *
132
+ * Current list of supported languages:
133
+ * https://developers.google.com/maps/faq#languagesupport.
134
+ * @param {string} request.regionCode
135
+ * The Unicode country/region code (CLDR) of the location where the
136
+ * request is coming from. This parameter is used to display the place
137
+ * details, like region-specific place name, if available. The parameter can
138
+ * affect results based on applicable law.
139
+ *
140
+ * For more information, see
141
+ * https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
142
+ *
143
+ *
144
+ * Note that 3-digit region codes are not currently supported.
145
+ * @param {string[]} request.includedTypes
146
+ * Included Place type (eg, "restaurant" or "gas_station") from
147
+ * https://developers.google.com/maps/documentation/places/web-service/place-types.
148
+ *
149
+ * Up to 50 types from [Table
150
+ * A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
151
+ * may be specified.
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
155
+ * returned.
156
+ *
157
+ * If a Place type is specified with multiple type restrictions, only places
158
+ * that satisfy all of the restrictions are returned. For example, if we
159
+ * have {included_types = ["restaurant"], excluded_primary_types =
160
+ * ["restaurant"]}, the returned places provide "restaurant"
161
+ * related services but do not operate primarily as "restaurants".
162
+ * @param {string[]} request.excludedTypes
163
+ * Excluded Place type (eg, "restaurant" or "gas_station") from
164
+ * https://developers.google.com/maps/documentation/places/web-service/place-types.
165
+ *
166
+ * Up to 50 types from [Table
167
+ * A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
168
+ * may be specified.
169
+ *
170
+ * If the client provides both included_types (e.g. restaurant) and
171
+ * excluded_types (e.g. cafe), then the response should include places that
172
+ * are restaurant but not cafe. The response includes places that match at
173
+ * least one of the included_types and none of the excluded_types.
174
+ *
175
+ * If there are any conflicting types, i.e. a type appears in both
176
+ * included_types and excluded_types, an INVALID_ARGUMENT error is returned.
177
+ *
178
+ * If a Place type is specified with multiple type restrictions, only places
179
+ * that satisfy all of the restrictions are returned. For example, if we
180
+ * have {included_types = ["restaurant"], excluded_primary_types =
181
+ * ["restaurant"]}, the returned places provide "restaurant"
182
+ * related services but do not operate primarily as "restaurants".
183
+ * @param {string[]} request.includedPrimaryTypes
184
+ * Included primary Place type (e.g. "restaurant" or "gas_station") from
185
+ * https://developers.google.com/maps/documentation/places/web-service/place-types.
186
+ * A place can only have a single primary type from the supported types table
187
+ * associated with it.
188
+ *
189
+ * Up to 50 types from [Table
190
+ * A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
191
+ * may be specified.
192
+ *
193
+ * If there are any conflicting primary types, i.e. a type appears in both
194
+ * included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
195
+ * error is returned.
196
+ *
197
+ * If a Place type is specified with multiple type restrictions, only places
198
+ * that satisfy all of the restrictions are returned. For example, if we
199
+ * have {included_types = ["restaurant"], excluded_primary_types =
200
+ * ["restaurant"]}, the returned places provide "restaurant"
201
+ * related services but do not operate primarily as "restaurants".
202
+ * @param {string[]} request.excludedPrimaryTypes
203
+ * Excluded primary Place type (e.g. "restaurant" or "gas_station") from
204
+ * https://developers.google.com/maps/documentation/places/web-service/place-types.
205
+ *
206
+ * Up to 50 types from [Table
207
+ * A](https://developers.google.com/maps/documentation/places/web-service/place-types#table-a)
208
+ * may be specified.
209
+ *
210
+ * If there are any conflicting primary types, i.e. a type appears in both
211
+ * included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
212
+ * error is returned.
213
+ *
214
+ * If a Place type is specified with multiple type restrictions, only places
215
+ * that satisfy all of the restrictions are returned. For example, if we
216
+ * have {included_types = ["restaurant"], excluded_primary_types =
217
+ * ["restaurant"]}, the returned places provide "restaurant"
218
+ * related services but do not operate primarily as "restaurants".
219
+ * @param {number} request.maxResultCount
220
+ * Maximum number of results to return. It must be between 1 and 20 (default),
221
+ * inclusively. If the number is unset, it falls back to the upper limit. If
222
+ * the number is set to negative or exceeds the upper limit, an
223
+ * INVALID_ARGUMENT error is returned.
224
+ * @param {google.maps.places.v1.SearchNearbyRequest.LocationRestriction} request.locationRestriction
225
+ * Required. The region to search.
226
+ * @param {google.maps.places.v1.SearchNearbyRequest.RankPreference} request.rankPreference
227
+ * How results will be ranked in the response.
228
+ * @param {object} [options]
229
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
230
+ * @returns {Promise} - The promise which resolves to an array.
231
+ * The first element of the array is an object representing {@link protos.google.maps.places.v1.SearchNearbyResponse|SearchNearbyResponse}.
232
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
233
+ * for more details and examples.
234
+ * @example <caption>include:samples/generated/v1/places.search_nearby.js</caption>
235
+ * region_tag:places_v1_generated_Places_SearchNearby_async
236
+ */
237
+ searchNearby(request?: protos.google.maps.places.v1.ISearchNearbyRequest, options?: CallOptions): Promise<[
238
+ protos.google.maps.places.v1.ISearchNearbyResponse,
239
+ protos.google.maps.places.v1.ISearchNearbyRequest | undefined,
240
+ {} | undefined
241
+ ]>;
242
+ searchNearby(request: protos.google.maps.places.v1.ISearchNearbyRequest, options: CallOptions, callback: Callback<protos.google.maps.places.v1.ISearchNearbyResponse, protos.google.maps.places.v1.ISearchNearbyRequest | null | undefined, {} | null | undefined>): void;
243
+ searchNearby(request: protos.google.maps.places.v1.ISearchNearbyRequest, callback: Callback<protos.google.maps.places.v1.ISearchNearbyResponse, protos.google.maps.places.v1.ISearchNearbyRequest | null | undefined, {} | null | undefined>): void;
104
244
  /**
105
245
  * Text query based place search.
106
246
  *
@@ -118,48 +258,35 @@ export declare class PlacesClient {
118
258
  * https://developers.google.com/maps/faq#languagesupport.
119
259
  * @param {string} request.regionCode
120
260
  * The Unicode country/region code (CLDR) of the location where the
121
- * request is coming from. It is used to display the place details, like
122
- * region-specific place name, if available.
261
+ * request is coming from. This parameter is used to display the place
262
+ * details, like region-specific place name, if available. The parameter can
263
+ * affect results based on applicable law.
123
264
  *
124
265
  * For more information, see
125
- * http://www.unicode.org/reports/tr35/#unicode_region_subtag.
266
+ * https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
126
267
  *
127
268
  *
128
269
  * Note that 3-digit region codes are not currently supported.
129
270
  * @param {google.maps.places.v1.SearchTextRequest.RankPreference} request.rankPreference
130
271
  * How results will be ranked in the response.
131
- * @param {google.maps.places.v1.SearchTextRequest.Location} request.location
132
- * The region to search. Setting location would usually yields
133
- * better results. Recommended to set. This location serves as a bias unless
134
- * strict_restriction is set to true, which turns the location to a strict
135
- * restriction.
136
- *
137
- * Deprecated. Use LocationRestriction or LocationBias instead.
138
272
  * @param {string} request.includedType
139
273
  * The requested place type. Full list of types supported:
140
- * https://developers.google.com/places/supported_types. Only support one
141
- * included type.
274
+ * https://developers.google.com/maps/documentation/places/web-service/place-types.
275
+ * Only support one included type.
142
276
  * @param {boolean} request.openNow
143
- * Used to restrict the search to places that are open at a specific time.
144
- * open_now marks if a business is currently open.
145
- * @param {google.maps.places.v1.Int32Range} request.priceRange
146
- * [Deprecated!]Used to restrict the search to places that are within a
147
- * certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or
148
- * set a maximum of 4 has no effect on the search results. Min price is
149
- * default to 0 and max price is default to 4. Default value will be used if
150
- * either min or max is unset.
277
+ * Used to restrict the search to places that are currently open. The default
278
+ * is false.
151
279
  * @param {number} request.minRating
152
280
  * Filter out results whose average user rating is strictly less than this
153
- * limit. A valid value must be an float between 0 and 5 (inclusively) at a
154
- * 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep
155
- * parity with LocalRefinement_UserRating. The input rating will round up to
156
- * the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all
157
- * results with a less than 1.0 rating.
281
+ * limit. A valid value must be a float between 0 and 5 (inclusively) at a
282
+ * 0.5 cadence i.e. [0, 0.5, 1.0, ... , 5.0] inclusively. The input rating
283
+ * will round up to the nearest 0.5(ceiling). For instance, a rating of 0.6
284
+ * will eliminate all results with a less than 1.0 rating.
158
285
  * @param {number} request.maxResultCount
159
286
  * Maximum number of results to return. It must be between 1 and 20,
160
- * inclusively. If the number is unset, it falls back to the upper limit. If
161
- * the number is set to negative or exceeds the upper limit, an
162
- * INVALID_ARGUMENT error is returned.
287
+ * inclusively. The default is 20. If the number is unset, it falls back to
288
+ * the upper limit. If the number is set to negative or exceeds the upper
289
+ * limit, an INVALID_ARGUMENT error is returned.
163
290
  * @param {number[]} request.priceLevels
164
291
  * Used to restrict the search to places that are marked as certain price
165
292
  * levels. Users can choose any combinations of price levels. Default to
@@ -191,6 +318,192 @@ export declare class PlacesClient {
191
318
  ]>;
192
319
  searchText(request: protos.google.maps.places.v1.ISearchTextRequest, options: CallOptions, callback: Callback<protos.google.maps.places.v1.ISearchTextResponse, protos.google.maps.places.v1.ISearchTextRequest | null | undefined, {} | null | undefined>): void;
193
320
  searchText(request: protos.google.maps.places.v1.ISearchTextRequest, callback: Callback<protos.google.maps.places.v1.ISearchTextResponse, protos.google.maps.places.v1.ISearchTextRequest | null | undefined, {} | null | undefined>): void;
321
+ /**
322
+ * Get a photo media with a photo reference string.
323
+ *
324
+ * @param {Object} request
325
+ * The request object that will be sent.
326
+ * @param {string} request.name
327
+ * Required. The resource name of a photo media in the format:
328
+ * `places/{place_id}/photos/{photo_reference}/media`.
329
+ *
330
+ * The resource name of a photo as returned in a Place object's `photos.name`
331
+ * field comes with the format
332
+ * `places/{place_id}/photos/{photo_reference}`. You need to append `/media`
333
+ * at the end of the photo resource to get the photo media resource name.
334
+ * @param {number} [request.maxWidthPx]
335
+ * Optional. Specifies the maximum desired width, in pixels, of the image. If
336
+ * the image is smaller than the values specified, the original image will be
337
+ * returned. If the image is larger in either dimension, it will be scaled to
338
+ * match the smaller of the two dimensions, restricted to its original aspect
339
+ * ratio. Both the max_height_px and max_width_px properties accept an integer
340
+ * between 1 and 4800, inclusively. If the value is not within the allowed
341
+ * range, an INVALID_ARGUMENT error will be returned.
342
+ *
343
+ * At least one of max_height_px or max_width_px needs to be specified. If
344
+ * neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
345
+ * error will be returned.
346
+ * @param {number} [request.maxHeightPx]
347
+ * Optional. Specifies the maximum desired height, in pixels, of the image. If
348
+ * the image is smaller than the values specified, the original image will be
349
+ * returned. If the image is larger in either dimension, it will be scaled to
350
+ * match the smaller of the two dimensions, restricted to its original aspect
351
+ * ratio. Both the max_height_px and max_width_px properties accept an integer
352
+ * between 1 and 4800, inclusively. If the value is not within the allowed
353
+ * range, an INVALID_ARGUMENT error will be returned.
354
+ *
355
+ * At least one of max_height_px or max_width_px needs to be specified. If
356
+ * neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
357
+ * error will be returned.
358
+ * @param {boolean} [request.skipHttpRedirect]
359
+ * Optional. If set, skip the default HTTP redirect behavior and render a text
360
+ * format (for example, in JSON format for HTTP use case) response. If not
361
+ * set, an HTTP redirect will be issued to redirect the call to the image
362
+ * media. This option is ignored for non-HTTP requests.
363
+ * @param {object} [options]
364
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
365
+ * @returns {Promise} - The promise which resolves to an array.
366
+ * The first element of the array is an object representing {@link protos.google.maps.places.v1.PhotoMedia|PhotoMedia}.
367
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
368
+ * for more details and examples.
369
+ * @example <caption>include:samples/generated/v1/places.get_photo_media.js</caption>
370
+ * region_tag:places_v1_generated_Places_GetPhotoMedia_async
371
+ */
372
+ getPhotoMedia(request?: protos.google.maps.places.v1.IGetPhotoMediaRequest, options?: CallOptions): Promise<[
373
+ protos.google.maps.places.v1.IPhotoMedia,
374
+ protos.google.maps.places.v1.IGetPhotoMediaRequest | undefined,
375
+ {} | undefined
376
+ ]>;
377
+ getPhotoMedia(request: protos.google.maps.places.v1.IGetPhotoMediaRequest, options: CallOptions, callback: Callback<protos.google.maps.places.v1.IPhotoMedia, protos.google.maps.places.v1.IGetPhotoMediaRequest | null | undefined, {} | null | undefined>): void;
378
+ getPhotoMedia(request: protos.google.maps.places.v1.IGetPhotoMediaRequest, callback: Callback<protos.google.maps.places.v1.IPhotoMedia, protos.google.maps.places.v1.IGetPhotoMediaRequest | null | undefined, {} | null | undefined>): void;
379
+ /**
380
+ * Get place details with a place id (in a name) string.
381
+ *
382
+ * @param {Object} request
383
+ * The request object that will be sent.
384
+ * @param {string} request.name
385
+ * Required. A place ID returned in a Place (with "places/" prefix), or
386
+ * equivalently the name in the same Place. Format:
387
+ * `places/{place_id}`.
388
+ * @param {string} [request.languageCode]
389
+ * Optional. Place details will be displayed with the preferred language if
390
+ * available.
391
+ *
392
+ * Current list of supported languages:
393
+ * https://developers.google.com/maps/faq#languagesupport.
394
+ * @param {string} [request.regionCode]
395
+ * Optional. The Unicode country/region code (CLDR) of the location where the
396
+ * request is coming from. This parameter is used to display the place
397
+ * details, like region-specific place name, if available. The parameter can
398
+ * affect results based on applicable law.
399
+ * For more information, see
400
+ * https://www.unicode.org/cldr/charts/latest/supplemental/territory_language_information.html.
401
+ *
402
+ *
403
+ * Note that 3-digit region codes are not currently supported.
404
+ * @param {object} [options]
405
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
406
+ * @returns {Promise} - The promise which resolves to an array.
407
+ * The first element of the array is an object representing {@link protos.google.maps.places.v1.Place|Place}.
408
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
409
+ * for more details and examples.
410
+ * @example <caption>include:samples/generated/v1/places.get_place.js</caption>
411
+ * region_tag:places_v1_generated_Places_GetPlace_async
412
+ */
413
+ getPlace(request?: protos.google.maps.places.v1.IGetPlaceRequest, options?: CallOptions): Promise<[
414
+ protos.google.maps.places.v1.IPlace,
415
+ protos.google.maps.places.v1.IGetPlaceRequest | undefined,
416
+ {} | undefined
417
+ ]>;
418
+ getPlace(request: protos.google.maps.places.v1.IGetPlaceRequest, options: CallOptions, callback: Callback<protos.google.maps.places.v1.IPlace, protos.google.maps.places.v1.IGetPlaceRequest | null | undefined, {} | null | undefined>): void;
419
+ getPlace(request: protos.google.maps.places.v1.IGetPlaceRequest, callback: Callback<protos.google.maps.places.v1.IPlace, protos.google.maps.places.v1.IGetPlaceRequest | null | undefined, {} | null | undefined>): void;
420
+ /**
421
+ * Return a fully-qualified photo resource name string.
422
+ *
423
+ * @param {string} place
424
+ * @param {string} photo
425
+ * @returns {string} Resource name string.
426
+ */
427
+ photoPath(place: string, photo: string): string;
428
+ /**
429
+ * Parse the place from Photo resource.
430
+ *
431
+ * @param {string} photoName
432
+ * A fully-qualified path representing Photo resource.
433
+ * @returns {string} A string representing the place.
434
+ */
435
+ matchPlaceFromPhotoName(photoName: string): string | number;
436
+ /**
437
+ * Parse the photo from Photo resource.
438
+ *
439
+ * @param {string} photoName
440
+ * A fully-qualified path representing Photo resource.
441
+ * @returns {string} A string representing the photo.
442
+ */
443
+ matchPhotoFromPhotoName(photoName: string): string | number;
444
+ /**
445
+ * Return a fully-qualified photoMedia resource name string.
446
+ *
447
+ * @param {string} place_id
448
+ * @param {string} photo_reference
449
+ * @returns {string} Resource name string.
450
+ */
451
+ photoMediaPath(placeId: string, photoReference: string): string;
452
+ /**
453
+ * Parse the place_id from PhotoMedia resource.
454
+ *
455
+ * @param {string} photoMediaName
456
+ * A fully-qualified path representing PhotoMedia resource.
457
+ * @returns {string} A string representing the place_id.
458
+ */
459
+ matchPlaceIdFromPhotoMediaName(photoMediaName: string): string | number;
460
+ /**
461
+ * Parse the photo_reference from PhotoMedia resource.
462
+ *
463
+ * @param {string} photoMediaName
464
+ * A fully-qualified path representing PhotoMedia resource.
465
+ * @returns {string} A string representing the photo_reference.
466
+ */
467
+ matchPhotoReferenceFromPhotoMediaName(photoMediaName: string): string | number;
468
+ /**
469
+ * Return a fully-qualified place resource name string.
470
+ *
471
+ * @param {string} place_id
472
+ * @returns {string} Resource name string.
473
+ */
474
+ placePath(placeId: string): string;
475
+ /**
476
+ * Parse the place_id from Place resource.
477
+ *
478
+ * @param {string} placeName
479
+ * A fully-qualified path representing Place resource.
480
+ * @returns {string} A string representing the place_id.
481
+ */
482
+ matchPlaceIdFromPlaceName(placeName: string): string | number;
483
+ /**
484
+ * Return a fully-qualified review resource name string.
485
+ *
486
+ * @param {string} place
487
+ * @param {string} review
488
+ * @returns {string} Resource name string.
489
+ */
490
+ reviewPath(place: string, review: string): string;
491
+ /**
492
+ * Parse the place from Review resource.
493
+ *
494
+ * @param {string} reviewName
495
+ * A fully-qualified path representing Review resource.
496
+ * @returns {string} A string representing the place.
497
+ */
498
+ matchPlaceFromReviewName(reviewName: string): string | number;
499
+ /**
500
+ * Parse the review from Review resource.
501
+ *
502
+ * @param {string} reviewName
503
+ * A fully-qualified path representing Review resource.
504
+ * @returns {string} A string representing the review.
505
+ */
506
+ matchReviewFromReviewName(reviewName: string): string | number;
194
507
  /**
195
508
  * Terminate the gRPC channel and close the client.
196
509
  *