@googlemaps/places 1.0.0 → 1.1.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.
- package/CHANGELOG.md +14 -0
- package/README.md +4 -1
- package/build/protos/google/maps/places/v1/attribution.proto +46 -0
- package/build/protos/google/maps/places/v1/ev_charging.proto +111 -0
- package/build/protos/google/maps/places/v1/fuel_options.proto +109 -0
- package/build/protos/google/maps/places/v1/geometry.proto +4 -4
- package/build/protos/google/maps/places/v1/photo.proto +55 -0
- package/build/protos/google/maps/places/v1/place.proto +355 -238
- package/build/protos/google/maps/places/v1/places_service.proto +250 -43
- package/build/protos/google/maps/places/v1/review.proto +72 -0
- package/build/protos/protos.d.ts +4058 -1412
- package/build/protos/protos.js +16394 -8727
- package/build/protos/protos.json +1458 -195
- package/build/src/v1/places_client.d.ts +299 -19
- package/build/src/v1/places_client.js +205 -5
- package/build/src/v1/places_client.js.map +1 -1
- package/build/src/v1/places_client_config.json +12 -0
- package/package.json +6 -6
|
@@ -3,6 +3,10 @@ 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 the request
|
|
7
|
+
* proto (all/'*' is not assumed). That can be set via either a side channel
|
|
8
|
+
* (SystemParameterContext) over RPC, or a header (X-Goog-FieldMask) over HTTP.
|
|
9
|
+
* See: https://cloud.google.com/apis/docs/system-parameters
|
|
6
10
|
* @class
|
|
7
11
|
* @memberof v1
|
|
8
12
|
*/
|
|
@@ -20,6 +24,9 @@ export declare class PlacesClient {
|
|
|
20
24
|
innerApiCalls: {
|
|
21
25
|
[name: string]: Function;
|
|
22
26
|
};
|
|
27
|
+
pathTemplates: {
|
|
28
|
+
[name: string]: gax.PathTemplate;
|
|
29
|
+
};
|
|
23
30
|
placesStub?: Promise<{
|
|
24
31
|
[name: string]: Function;
|
|
25
32
|
}>;
|
|
@@ -51,8 +58,7 @@ export declare class PlacesClient {
|
|
|
51
58
|
* API remote host.
|
|
52
59
|
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
|
|
53
60
|
* Follows the structure of {@link gapicConfig}.
|
|
54
|
-
* @param {boolean
|
|
55
|
-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
|
|
61
|
+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
|
|
56
62
|
* For more information, please check the
|
|
57
63
|
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
|
|
58
64
|
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
|
|
@@ -60,7 +66,7 @@ export declare class PlacesClient {
|
|
|
60
66
|
* HTTP implementation. Load only fallback version and pass it to the constructor:
|
|
61
67
|
* ```
|
|
62
68
|
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
|
|
63
|
-
* const client = new PlacesClient({fallback:
|
|
69
|
+
* const client = new PlacesClient({fallback: true}, gax);
|
|
64
70
|
* ```
|
|
65
71
|
*/
|
|
66
72
|
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
|
|
@@ -102,6 +108,111 @@ export declare class PlacesClient {
|
|
|
102
108
|
static get scopes(): never[];
|
|
103
109
|
getProjectId(): Promise<string>;
|
|
104
110
|
getProjectId(callback: Callback<string, undefined, undefined>): void;
|
|
111
|
+
/**
|
|
112
|
+
* Search for places near locations.
|
|
113
|
+
*
|
|
114
|
+
* @param {Object} request
|
|
115
|
+
* The request object that will be sent.
|
|
116
|
+
* @param {string} request.languageCode
|
|
117
|
+
* Place details will be displayed with the preferred language if available.
|
|
118
|
+
* If the language code is unspecified or unrecognized, place details of any
|
|
119
|
+
* language may be returned, with a preference for English if such details
|
|
120
|
+
* exist.
|
|
121
|
+
*
|
|
122
|
+
* Current list of supported languages:
|
|
123
|
+
* https://developers.google.com/maps/faq#languagesupport.
|
|
124
|
+
* @param {string} request.regionCode
|
|
125
|
+
* The Unicode country/region code (CLDR) of the location where the
|
|
126
|
+
* request is coming from. This parameter is used to display the place
|
|
127
|
+
* details, like region-specific place name, if available. The parameter can
|
|
128
|
+
* affect results based on applicable law.
|
|
129
|
+
*
|
|
130
|
+
* For more information, see
|
|
131
|
+
* http://www.unicode.org/reports/tr35/#unicode_region_subtag.
|
|
132
|
+
*
|
|
133
|
+
*
|
|
134
|
+
* Note that 3-digit region codes are not currently supported.
|
|
135
|
+
* @param {string[]} request.includedTypes
|
|
136
|
+
* Included Place type (eg, "restaurant" or "gas_station") from
|
|
137
|
+
* https://developers.google.com/places/supported_types.
|
|
138
|
+
*
|
|
139
|
+
* If there are any conflicting types, i.e. a type appears in both
|
|
140
|
+
* included_types and excluded_types, an INVALID_ARGUMENT error is
|
|
141
|
+
* returned.
|
|
142
|
+
*
|
|
143
|
+
* If a Place type is specified with multiple type restrictions, only places
|
|
144
|
+
* that satisfy all of the restrictions are returned. For example, if we
|
|
145
|
+
* have {included_types = ["restaurant"], excluded_primary_types =
|
|
146
|
+
* ["restaurant"]}, the returned places are POIs that provide "restaurant"
|
|
147
|
+
* related services but do not operate primarily as "restaurants".
|
|
148
|
+
* @param {string[]} request.excludedTypes
|
|
149
|
+
* Excluded Place type (eg, "restaurant" or "gas_station") from
|
|
150
|
+
* https://developers.google.com/places/supported_types.
|
|
151
|
+
*
|
|
152
|
+
* If the client provides both included_types (e.g. restaurant) and
|
|
153
|
+
* excluded_types (e.g. cafe), then the response should include places that
|
|
154
|
+
* are restaurant but not cafe. The response includes places that match at
|
|
155
|
+
* least one of the included_types and none of the excluded_types.
|
|
156
|
+
*
|
|
157
|
+
* If there are any conflicting types, i.e. a type appears in both
|
|
158
|
+
* included_types and excluded_types, an INVALID_ARGUMENT error is returned.
|
|
159
|
+
*
|
|
160
|
+
* If a Place type is specified with multiple type restrictions, only places
|
|
161
|
+
* that satisfy all of the restrictions are returned. For example, if we
|
|
162
|
+
* have {included_types = ["restaurant"], excluded_primary_types =
|
|
163
|
+
* ["restaurant"]}, the returned places are POIs that provide "restaurant"
|
|
164
|
+
* related services but do not operate primarily as "restaurants".
|
|
165
|
+
* @param {string[]} request.includedPrimaryTypes
|
|
166
|
+
* Included primary Place type (e.g. "restaurant" or "gas_station") from
|
|
167
|
+
* https://developers.google.com/places/supported_types.
|
|
168
|
+
*
|
|
169
|
+
* If there are any conflicting primary types, i.e. a type appears in both
|
|
170
|
+
* included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
|
|
171
|
+
* error is returned.
|
|
172
|
+
*
|
|
173
|
+
* If a Place type is specified with multiple type restrictions, only places
|
|
174
|
+
* that satisfy all of the restrictions are returned. For example, if we
|
|
175
|
+
* have {included_types = ["restaurant"], excluded_primary_types =
|
|
176
|
+
* ["restaurant"]}, the returned places are POIs that provide "restaurant"
|
|
177
|
+
* related services but do not operate primarily as "restaurants".
|
|
178
|
+
* @param {string[]} request.excludedPrimaryTypes
|
|
179
|
+
* Excluded primary Place type (e.g. "restaurant" or "gas_station") from
|
|
180
|
+
* https://developers.google.com/places/supported_types.
|
|
181
|
+
*
|
|
182
|
+
* If there are any conflicting primary types, i.e. a type appears in both
|
|
183
|
+
* included_primary_types and excluded_primary_types, an INVALID_ARGUMENT
|
|
184
|
+
* error is returned.
|
|
185
|
+
*
|
|
186
|
+
* If a Place type is specified with multiple type restrictions, only places
|
|
187
|
+
* that satisfy all of the restrictions are returned. For example, if we
|
|
188
|
+
* have {included_types = ["restaurant"], excluded_primary_types =
|
|
189
|
+
* ["restaurant"]}, the returned places are POIs that provide "restaurant"
|
|
190
|
+
* related services but do not operate primarily as "restaurants".
|
|
191
|
+
* @param {number} request.maxResultCount
|
|
192
|
+
* Maximum number of results to return. It must be between 1 and 20,
|
|
193
|
+
* inclusively. If the number is unset, it falls back to the upper limit. If
|
|
194
|
+
* the number is set to negative or exceeds the upper limit, an
|
|
195
|
+
* INVALID_ARGUMENT error is returned.
|
|
196
|
+
* @param {google.maps.places.v1.SearchNearbyRequest.LocationRestriction} request.locationRestriction
|
|
197
|
+
* Required. The region to search.
|
|
198
|
+
* @param {google.maps.places.v1.SearchNearbyRequest.RankPreference} request.rankPreference
|
|
199
|
+
* How results will be ranked in the response.
|
|
200
|
+
* @param {object} [options]
|
|
201
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
202
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
203
|
+
* The first element of the array is an object representing {@link protos.google.maps.places.v1.SearchNearbyResponse|SearchNearbyResponse}.
|
|
204
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
|
|
205
|
+
* for more details and examples.
|
|
206
|
+
* @example <caption>include:samples/generated/v1/places.search_nearby.js</caption>
|
|
207
|
+
* region_tag:places_v1_generated_Places_SearchNearby_async
|
|
208
|
+
*/
|
|
209
|
+
searchNearby(request?: protos.google.maps.places.v1.ISearchNearbyRequest, options?: CallOptions): Promise<[
|
|
210
|
+
protos.google.maps.places.v1.ISearchNearbyResponse,
|
|
211
|
+
protos.google.maps.places.v1.ISearchNearbyRequest | undefined,
|
|
212
|
+
{} | undefined
|
|
213
|
+
]>;
|
|
214
|
+
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;
|
|
215
|
+
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;
|
|
105
216
|
/**
|
|
106
217
|
* Text query based place search.
|
|
107
218
|
*
|
|
@@ -119,8 +230,9 @@ export declare class PlacesClient {
|
|
|
119
230
|
* https://developers.google.com/maps/faq#languagesupport.
|
|
120
231
|
* @param {string} request.regionCode
|
|
121
232
|
* The Unicode country/region code (CLDR) of the location where the
|
|
122
|
-
* request is coming from.
|
|
123
|
-
* region-specific place name, if available.
|
|
233
|
+
* request is coming from. This parameter is used to display the place
|
|
234
|
+
* details, like region-specific place name, if available. The parameter can
|
|
235
|
+
* affect results based on applicable law.
|
|
124
236
|
*
|
|
125
237
|
* For more information, see
|
|
126
238
|
* http://www.unicode.org/reports/tr35/#unicode_region_subtag.
|
|
@@ -129,13 +241,6 @@ export declare class PlacesClient {
|
|
|
129
241
|
* Note that 3-digit region codes are not currently supported.
|
|
130
242
|
* @param {google.maps.places.v1.SearchTextRequest.RankPreference} request.rankPreference
|
|
131
243
|
* How results will be ranked in the response.
|
|
132
|
-
* @param {google.maps.places.v1.SearchTextRequest.Location} request.location
|
|
133
|
-
* The region to search. Setting location would usually yields
|
|
134
|
-
* better results. Recommended to set. This location serves as a bias unless
|
|
135
|
-
* strict_restriction is set to true, which turns the location to a strict
|
|
136
|
-
* restriction.
|
|
137
|
-
*
|
|
138
|
-
* Deprecated. Use LocationRestriction or LocationBias instead.
|
|
139
244
|
* @param {string} request.includedType
|
|
140
245
|
* The requested place type. Full list of types supported:
|
|
141
246
|
* https://developers.google.com/places/supported_types. Only support one
|
|
@@ -143,16 +248,10 @@ export declare class PlacesClient {
|
|
|
143
248
|
* @param {boolean} request.openNow
|
|
144
249
|
* Used to restrict the search to places that are open at a specific time.
|
|
145
250
|
* open_now marks if a business is currently open.
|
|
146
|
-
* @param {google.maps.places.v1.Int32Range} request.priceRange
|
|
147
|
-
* [Deprecated!]Used to restrict the search to places that are within a
|
|
148
|
-
* certain price range. This is on a scale of 0 to 4. Set a minimum of 0 or
|
|
149
|
-
* set a maximum of 4 has no effect on the search results. Min price is
|
|
150
|
-
* default to 0 and max price is default to 4. Default value will be used if
|
|
151
|
-
* either min or max is unset.
|
|
152
251
|
* @param {number} request.minRating
|
|
153
252
|
* Filter out results whose average user rating is strictly less than this
|
|
154
253
|
* limit. A valid value must be an float between 0 and 5 (inclusively) at a
|
|
155
|
-
* 0.5 cadence i.e.
|
|
254
|
+
* 0.5 cadence i.e. [0, 0.5, 1.0, ... , 5.0] inclusively. This is to keep
|
|
156
255
|
* parity with LocalRefinement_UserRating. The input rating will round up to
|
|
157
256
|
* the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all
|
|
158
257
|
* results with a less than 1.0 rating.
|
|
@@ -192,6 +291,187 @@ export declare class PlacesClient {
|
|
|
192
291
|
]>;
|
|
193
292
|
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;
|
|
194
293
|
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;
|
|
294
|
+
/**
|
|
295
|
+
* Get a photo media with a photo reference string.
|
|
296
|
+
*
|
|
297
|
+
* @param {Object} request
|
|
298
|
+
* The request object that will be sent.
|
|
299
|
+
* @param {string} request.name
|
|
300
|
+
* Required. The resource name of a photo. It is returned in Place's
|
|
301
|
+
* photos.name field. Format:
|
|
302
|
+
* places/<place_id>/photos/<photo_reference>/media.
|
|
303
|
+
* @param {number} [request.maxWidthPx]
|
|
304
|
+
* Optional. Specifies the maximum desired width, in pixels, of the image. If
|
|
305
|
+
* the image is smaller than the values specified, the original image will be
|
|
306
|
+
* returned. If the image is larger in either dimension, it will be scaled to
|
|
307
|
+
* match the smaller of the two dimensions, restricted to its original aspect
|
|
308
|
+
* ratio. Both the max_height_px and max_width_px properties accept an integer
|
|
309
|
+
* between 1 and 4800, inclusively. If the value is not within the allowed
|
|
310
|
+
* range, an INVALID_ARGUMENT error will be returned.
|
|
311
|
+
*
|
|
312
|
+
* At least one of max_height_px or max_width_px needs to be specified. If
|
|
313
|
+
* neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
|
|
314
|
+
* error will be returned.
|
|
315
|
+
* @param {number} [request.maxHeightPx]
|
|
316
|
+
* Optional. Specifies the maximum desired height, in pixels, of the image. If
|
|
317
|
+
* the image is smaller than the values specified, the original image will be
|
|
318
|
+
* returned. If the image is larger in either dimension, it will be scaled to
|
|
319
|
+
* match the smaller of the two dimensions, restricted to its original aspect
|
|
320
|
+
* ratio. Both the max_height_px and max_width_px properties accept an integer
|
|
321
|
+
* between 1 and 4800, inclusively. If the value is not within the allowed
|
|
322
|
+
* range, an INVALID_ARGUMENT error will be returned.
|
|
323
|
+
*
|
|
324
|
+
* At least one of max_height_px or max_width_px needs to be specified. If
|
|
325
|
+
* neither max_height_px nor max_width_px is specified, an INVALID_ARGUMENT
|
|
326
|
+
* error will be returned.
|
|
327
|
+
* @param {boolean} [request.skipHttpRedirect]
|
|
328
|
+
* Optional. If set, skip the default HTTP redirect behavior and render a text
|
|
329
|
+
* format (for example, in JSON format for HTTP use case) response. If not
|
|
330
|
+
* set, an HTTP redirect will be issued to redirect the call to the image
|
|
331
|
+
* midea. This option is ignored for non-HTTP requests.
|
|
332
|
+
* @param {object} [options]
|
|
333
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
334
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
335
|
+
* The first element of the array is an object representing {@link protos.google.maps.places.v1.PhotoMedia|PhotoMedia}.
|
|
336
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
|
|
337
|
+
* for more details and examples.
|
|
338
|
+
* @example <caption>include:samples/generated/v1/places.get_photo_media.js</caption>
|
|
339
|
+
* region_tag:places_v1_generated_Places_GetPhotoMedia_async
|
|
340
|
+
*/
|
|
341
|
+
getPhotoMedia(request?: protos.google.maps.places.v1.IGetPhotoMediaRequest, options?: CallOptions): Promise<[
|
|
342
|
+
protos.google.maps.places.v1.IPhotoMedia,
|
|
343
|
+
protos.google.maps.places.v1.IGetPhotoMediaRequest | undefined,
|
|
344
|
+
{} | undefined
|
|
345
|
+
]>;
|
|
346
|
+
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;
|
|
347
|
+
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;
|
|
348
|
+
/**
|
|
349
|
+
* Get a Place with a place id (in a name) string.
|
|
350
|
+
*
|
|
351
|
+
* @param {Object} request
|
|
352
|
+
* The request object that will be sent.
|
|
353
|
+
* @param {string} request.name
|
|
354
|
+
* Required. A place_id returned in a Place (with "places/" prefix), or
|
|
355
|
+
* equivalently the name in the same Place. Format: places/<place_id>.
|
|
356
|
+
* @param {string} [request.languageCode]
|
|
357
|
+
* Optional. Place details will be displayed with the preferred language if
|
|
358
|
+
* available.
|
|
359
|
+
*
|
|
360
|
+
* Current list of supported languages:
|
|
361
|
+
* https://developers.google.com/maps/faq#languagesupport.
|
|
362
|
+
* @param {string} [request.regionCode]
|
|
363
|
+
* Optional. The Unicode country/region code (CLDR) of the location where the
|
|
364
|
+
* request is coming from. This parameter is used to display the place
|
|
365
|
+
* details, like region-specific place name, if available. The parameter can
|
|
366
|
+
* affect results based on applicable law.
|
|
367
|
+
* For more information, see
|
|
368
|
+
* http://www.unicode.org/reports/tr35/#unicode_region_subtag.
|
|
369
|
+
*
|
|
370
|
+
*
|
|
371
|
+
* Note that 3-digit region codes are not currently supported.
|
|
372
|
+
* @param {object} [options]
|
|
373
|
+
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
|
|
374
|
+
* @returns {Promise} - The promise which resolves to an array.
|
|
375
|
+
* The first element of the array is an object representing {@link protos.google.maps.places.v1.Place|Place}.
|
|
376
|
+
* Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
|
|
377
|
+
* for more details and examples.
|
|
378
|
+
* @example <caption>include:samples/generated/v1/places.get_place.js</caption>
|
|
379
|
+
* region_tag:places_v1_generated_Places_GetPlace_async
|
|
380
|
+
*/
|
|
381
|
+
getPlace(request?: protos.google.maps.places.v1.IGetPlaceRequest, options?: CallOptions): Promise<[
|
|
382
|
+
protos.google.maps.places.v1.IPlace,
|
|
383
|
+
protos.google.maps.places.v1.IGetPlaceRequest | undefined,
|
|
384
|
+
{} | undefined
|
|
385
|
+
]>;
|
|
386
|
+
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;
|
|
387
|
+
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;
|
|
388
|
+
/**
|
|
389
|
+
* Return a fully-qualified photo resource name string.
|
|
390
|
+
*
|
|
391
|
+
* @param {string} place
|
|
392
|
+
* @param {string} photo
|
|
393
|
+
* @returns {string} Resource name string.
|
|
394
|
+
*/
|
|
395
|
+
photoPath(place: string, photo: string): string;
|
|
396
|
+
/**
|
|
397
|
+
* Parse the place from Photo resource.
|
|
398
|
+
*
|
|
399
|
+
* @param {string} photoName
|
|
400
|
+
* A fully-qualified path representing Photo resource.
|
|
401
|
+
* @returns {string} A string representing the place.
|
|
402
|
+
*/
|
|
403
|
+
matchPlaceFromPhotoName(photoName: string): string | number;
|
|
404
|
+
/**
|
|
405
|
+
* Parse the photo from Photo resource.
|
|
406
|
+
*
|
|
407
|
+
* @param {string} photoName
|
|
408
|
+
* A fully-qualified path representing Photo resource.
|
|
409
|
+
* @returns {string} A string representing the photo.
|
|
410
|
+
*/
|
|
411
|
+
matchPhotoFromPhotoName(photoName: string): string | number;
|
|
412
|
+
/**
|
|
413
|
+
* Return a fully-qualified photoMedia resource name string.
|
|
414
|
+
*
|
|
415
|
+
* @param {string} place_id
|
|
416
|
+
* @param {string} photo_reference
|
|
417
|
+
* @returns {string} Resource name string.
|
|
418
|
+
*/
|
|
419
|
+
photoMediaPath(placeId: string, photoReference: string): string;
|
|
420
|
+
/**
|
|
421
|
+
* Parse the place_id from PhotoMedia resource.
|
|
422
|
+
*
|
|
423
|
+
* @param {string} photoMediaName
|
|
424
|
+
* A fully-qualified path representing PhotoMedia resource.
|
|
425
|
+
* @returns {string} A string representing the place_id.
|
|
426
|
+
*/
|
|
427
|
+
matchPlaceIdFromPhotoMediaName(photoMediaName: string): string | number;
|
|
428
|
+
/**
|
|
429
|
+
* Parse the photo_reference from PhotoMedia resource.
|
|
430
|
+
*
|
|
431
|
+
* @param {string} photoMediaName
|
|
432
|
+
* A fully-qualified path representing PhotoMedia resource.
|
|
433
|
+
* @returns {string} A string representing the photo_reference.
|
|
434
|
+
*/
|
|
435
|
+
matchPhotoReferenceFromPhotoMediaName(photoMediaName: string): string | number;
|
|
436
|
+
/**
|
|
437
|
+
* Return a fully-qualified place resource name string.
|
|
438
|
+
*
|
|
439
|
+
* @param {string} place_id
|
|
440
|
+
* @returns {string} Resource name string.
|
|
441
|
+
*/
|
|
442
|
+
placePath(placeId: string): string;
|
|
443
|
+
/**
|
|
444
|
+
* Parse the place_id from Place resource.
|
|
445
|
+
*
|
|
446
|
+
* @param {string} placeName
|
|
447
|
+
* A fully-qualified path representing Place resource.
|
|
448
|
+
* @returns {string} A string representing the place_id.
|
|
449
|
+
*/
|
|
450
|
+
matchPlaceIdFromPlaceName(placeName: string): string | number;
|
|
451
|
+
/**
|
|
452
|
+
* Return a fully-qualified review resource name string.
|
|
453
|
+
*
|
|
454
|
+
* @param {string} place
|
|
455
|
+
* @param {string} review
|
|
456
|
+
* @returns {string} Resource name string.
|
|
457
|
+
*/
|
|
458
|
+
reviewPath(place: string, review: string): string;
|
|
459
|
+
/**
|
|
460
|
+
* Parse the place from Review resource.
|
|
461
|
+
*
|
|
462
|
+
* @param {string} reviewName
|
|
463
|
+
* A fully-qualified path representing Review resource.
|
|
464
|
+
* @returns {string} A string representing the place.
|
|
465
|
+
*/
|
|
466
|
+
matchPlaceFromReviewName(reviewName: string): string | number;
|
|
467
|
+
/**
|
|
468
|
+
* Parse the review from Review resource.
|
|
469
|
+
*
|
|
470
|
+
* @param {string} reviewName
|
|
471
|
+
* A fully-qualified path representing Review resource.
|
|
472
|
+
* @returns {string} A string representing the review.
|
|
473
|
+
*/
|
|
474
|
+
matchReviewFromReviewName(reviewName: string): string | number;
|
|
195
475
|
/**
|
|
196
476
|
* Terminate the gRPC channel and close the client.
|
|
197
477
|
*
|
|
@@ -28,6 +28,10 @@ const gapicConfig = require("./places_client_config.json");
|
|
|
28
28
|
const version = require('../../../package.json').version;
|
|
29
29
|
/**
|
|
30
30
|
* Service definition for the Places API.
|
|
31
|
+
* Note: every request actually requires a field mask set outside of the request
|
|
32
|
+
* proto (all/'*' is not assumed). That can be set via either a side channel
|
|
33
|
+
* (SystemParameterContext) over RPC, or a header (X-Goog-FieldMask) over HTTP.
|
|
34
|
+
* See: https://cloud.google.com/apis/docs/system-parameters
|
|
31
35
|
* @class
|
|
32
36
|
* @memberof v1
|
|
33
37
|
*/
|
|
@@ -60,8 +64,7 @@ class PlacesClient {
|
|
|
60
64
|
* API remote host.
|
|
61
65
|
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
|
|
62
66
|
* Follows the structure of {@link gapicConfig}.
|
|
63
|
-
* @param {boolean
|
|
64
|
-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
|
|
67
|
+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
|
|
65
68
|
* For more information, please check the
|
|
66
69
|
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
|
|
67
70
|
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
|
|
@@ -69,7 +72,7 @@ class PlacesClient {
|
|
|
69
72
|
* HTTP implementation. Load only fallback version and pass it to the constructor:
|
|
70
73
|
* ```
|
|
71
74
|
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
|
|
72
|
-
* const client = new PlacesClient({fallback:
|
|
75
|
+
* const client = new PlacesClient({fallback: true}, gax);
|
|
73
76
|
* ```
|
|
74
77
|
*/
|
|
75
78
|
constructor(opts, gaxInstance) {
|
|
@@ -126,7 +129,7 @@ class PlacesClient {
|
|
|
126
129
|
if (!opts.fallback) {
|
|
127
130
|
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
|
|
128
131
|
}
|
|
129
|
-
else
|
|
132
|
+
else {
|
|
130
133
|
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
|
|
131
134
|
}
|
|
132
135
|
if (opts.libName && opts.libVersion) {
|
|
@@ -134,6 +137,15 @@ class PlacesClient {
|
|
|
134
137
|
}
|
|
135
138
|
// Load the applicable protos.
|
|
136
139
|
this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
|
|
140
|
+
// This API contains "path templates"; forward-slash-separated
|
|
141
|
+
// identifiers to uniquely identify resources within the API.
|
|
142
|
+
// Create useful helper objects for these.
|
|
143
|
+
this.pathTemplates = {
|
|
144
|
+
photoPathTemplate: new this._gaxModule.PathTemplate('places/{place}/photos/{photo}'),
|
|
145
|
+
photoMediaPathTemplate: new this._gaxModule.PathTemplate('places/{place_id}/photos/{photo_reference}/media'),
|
|
146
|
+
placePathTemplate: new this._gaxModule.PathTemplate('places/{place_id}'),
|
|
147
|
+
reviewPathTemplate: new this._gaxModule.PathTemplate('places/{place}/reviews/{review}'),
|
|
148
|
+
};
|
|
137
149
|
// Put together the default options sent with requests.
|
|
138
150
|
this._defaults = this._gaxGrpc.constructSettings('google.maps.places.v1.Places', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
|
|
139
151
|
// Set up a dictionary of "inner API calls"; the core implementation
|
|
@@ -167,7 +179,12 @@ class PlacesClient {
|
|
|
167
179
|
this._protos.google.maps.places.v1.Places, this._opts, this._providedCustomServicePath);
|
|
168
180
|
// Iterate over each of the methods that the service provides
|
|
169
181
|
// and create an API call method for each.
|
|
170
|
-
const placesStubMethods = [
|
|
182
|
+
const placesStubMethods = [
|
|
183
|
+
'searchNearby',
|
|
184
|
+
'searchText',
|
|
185
|
+
'getPhotoMedia',
|
|
186
|
+
'getPlace',
|
|
187
|
+
];
|
|
171
188
|
for (const methodName of placesStubMethods) {
|
|
172
189
|
const callPromise = this.placesStub.then(stub => (...args) => {
|
|
173
190
|
if (this._terminated) {
|
|
@@ -225,6 +242,22 @@ class PlacesClient {
|
|
|
225
242
|
}
|
|
226
243
|
return this.auth.getProjectId();
|
|
227
244
|
}
|
|
245
|
+
searchNearby(request, optionsOrCallback, callback) {
|
|
246
|
+
request = request || {};
|
|
247
|
+
let options;
|
|
248
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
249
|
+
callback = optionsOrCallback;
|
|
250
|
+
options = {};
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
options = optionsOrCallback;
|
|
254
|
+
}
|
|
255
|
+
options = options || {};
|
|
256
|
+
options.otherArgs = options.otherArgs || {};
|
|
257
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
258
|
+
this.initialize();
|
|
259
|
+
return this.innerApiCalls.searchNearby(request, options, callback);
|
|
260
|
+
}
|
|
228
261
|
searchText(request, optionsOrCallback, callback) {
|
|
229
262
|
request = request || {};
|
|
230
263
|
let options;
|
|
@@ -241,6 +274,173 @@ class PlacesClient {
|
|
|
241
274
|
this.initialize();
|
|
242
275
|
return this.innerApiCalls.searchText(request, options, callback);
|
|
243
276
|
}
|
|
277
|
+
getPhotoMedia(request, optionsOrCallback, callback) {
|
|
278
|
+
var _a;
|
|
279
|
+
request = request || {};
|
|
280
|
+
let options;
|
|
281
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
282
|
+
callback = optionsOrCallback;
|
|
283
|
+
options = {};
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
options = optionsOrCallback;
|
|
287
|
+
}
|
|
288
|
+
options = options || {};
|
|
289
|
+
options.otherArgs = options.otherArgs || {};
|
|
290
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
291
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
292
|
+
this._gaxModule.routingHeader.fromParams({
|
|
293
|
+
name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
|
|
294
|
+
});
|
|
295
|
+
this.initialize();
|
|
296
|
+
return this.innerApiCalls.getPhotoMedia(request, options, callback);
|
|
297
|
+
}
|
|
298
|
+
getPlace(request, optionsOrCallback, callback) {
|
|
299
|
+
var _a;
|
|
300
|
+
request = request || {};
|
|
301
|
+
let options;
|
|
302
|
+
if (typeof optionsOrCallback === 'function' && callback === undefined) {
|
|
303
|
+
callback = optionsOrCallback;
|
|
304
|
+
options = {};
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
options = optionsOrCallback;
|
|
308
|
+
}
|
|
309
|
+
options = options || {};
|
|
310
|
+
options.otherArgs = options.otherArgs || {};
|
|
311
|
+
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
312
|
+
options.otherArgs.headers['x-goog-request-params'] =
|
|
313
|
+
this._gaxModule.routingHeader.fromParams({
|
|
314
|
+
name: (_a = request.name) !== null && _a !== void 0 ? _a : '',
|
|
315
|
+
});
|
|
316
|
+
this.initialize();
|
|
317
|
+
return this.innerApiCalls.getPlace(request, options, callback);
|
|
318
|
+
}
|
|
319
|
+
// --------------------
|
|
320
|
+
// -- Path templates --
|
|
321
|
+
// --------------------
|
|
322
|
+
/**
|
|
323
|
+
* Return a fully-qualified photo resource name string.
|
|
324
|
+
*
|
|
325
|
+
* @param {string} place
|
|
326
|
+
* @param {string} photo
|
|
327
|
+
* @returns {string} Resource name string.
|
|
328
|
+
*/
|
|
329
|
+
photoPath(place, photo) {
|
|
330
|
+
return this.pathTemplates.photoPathTemplate.render({
|
|
331
|
+
place: place,
|
|
332
|
+
photo: photo,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
/**
|
|
336
|
+
* Parse the place from Photo resource.
|
|
337
|
+
*
|
|
338
|
+
* @param {string} photoName
|
|
339
|
+
* A fully-qualified path representing Photo resource.
|
|
340
|
+
* @returns {string} A string representing the place.
|
|
341
|
+
*/
|
|
342
|
+
matchPlaceFromPhotoName(photoName) {
|
|
343
|
+
return this.pathTemplates.photoPathTemplate.match(photoName).place;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Parse the photo from Photo resource.
|
|
347
|
+
*
|
|
348
|
+
* @param {string} photoName
|
|
349
|
+
* A fully-qualified path representing Photo resource.
|
|
350
|
+
* @returns {string} A string representing the photo.
|
|
351
|
+
*/
|
|
352
|
+
matchPhotoFromPhotoName(photoName) {
|
|
353
|
+
return this.pathTemplates.photoPathTemplate.match(photoName).photo;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Return a fully-qualified photoMedia resource name string.
|
|
357
|
+
*
|
|
358
|
+
* @param {string} place_id
|
|
359
|
+
* @param {string} photo_reference
|
|
360
|
+
* @returns {string} Resource name string.
|
|
361
|
+
*/
|
|
362
|
+
photoMediaPath(placeId, photoReference) {
|
|
363
|
+
return this.pathTemplates.photoMediaPathTemplate.render({
|
|
364
|
+
place_id: placeId,
|
|
365
|
+
photo_reference: photoReference,
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Parse the place_id from PhotoMedia resource.
|
|
370
|
+
*
|
|
371
|
+
* @param {string} photoMediaName
|
|
372
|
+
* A fully-qualified path representing PhotoMedia resource.
|
|
373
|
+
* @returns {string} A string representing the place_id.
|
|
374
|
+
*/
|
|
375
|
+
matchPlaceIdFromPhotoMediaName(photoMediaName) {
|
|
376
|
+
return this.pathTemplates.photoMediaPathTemplate.match(photoMediaName)
|
|
377
|
+
.place_id;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Parse the photo_reference from PhotoMedia resource.
|
|
381
|
+
*
|
|
382
|
+
* @param {string} photoMediaName
|
|
383
|
+
* A fully-qualified path representing PhotoMedia resource.
|
|
384
|
+
* @returns {string} A string representing the photo_reference.
|
|
385
|
+
*/
|
|
386
|
+
matchPhotoReferenceFromPhotoMediaName(photoMediaName) {
|
|
387
|
+
return this.pathTemplates.photoMediaPathTemplate.match(photoMediaName)
|
|
388
|
+
.photo_reference;
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Return a fully-qualified place resource name string.
|
|
392
|
+
*
|
|
393
|
+
* @param {string} place_id
|
|
394
|
+
* @returns {string} Resource name string.
|
|
395
|
+
*/
|
|
396
|
+
placePath(placeId) {
|
|
397
|
+
return this.pathTemplates.placePathTemplate.render({
|
|
398
|
+
place_id: placeId,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Parse the place_id from Place resource.
|
|
403
|
+
*
|
|
404
|
+
* @param {string} placeName
|
|
405
|
+
* A fully-qualified path representing Place resource.
|
|
406
|
+
* @returns {string} A string representing the place_id.
|
|
407
|
+
*/
|
|
408
|
+
matchPlaceIdFromPlaceName(placeName) {
|
|
409
|
+
return this.pathTemplates.placePathTemplate.match(placeName).place_id;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Return a fully-qualified review resource name string.
|
|
413
|
+
*
|
|
414
|
+
* @param {string} place
|
|
415
|
+
* @param {string} review
|
|
416
|
+
* @returns {string} Resource name string.
|
|
417
|
+
*/
|
|
418
|
+
reviewPath(place, review) {
|
|
419
|
+
return this.pathTemplates.reviewPathTemplate.render({
|
|
420
|
+
place: place,
|
|
421
|
+
review: review,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Parse the place from Review resource.
|
|
426
|
+
*
|
|
427
|
+
* @param {string} reviewName
|
|
428
|
+
* A fully-qualified path representing Review resource.
|
|
429
|
+
* @returns {string} A string representing the place.
|
|
430
|
+
*/
|
|
431
|
+
matchPlaceFromReviewName(reviewName) {
|
|
432
|
+
return this.pathTemplates.reviewPathTemplate.match(reviewName).place;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Parse the review from Review resource.
|
|
436
|
+
*
|
|
437
|
+
* @param {string} reviewName
|
|
438
|
+
* A fully-qualified path representing Review resource.
|
|
439
|
+
* @returns {string} A string representing the review.
|
|
440
|
+
*/
|
|
441
|
+
matchReviewFromReviewName(reviewName) {
|
|
442
|
+
return this.pathTemplates.reviewPathTemplate.match(reviewName).review;
|
|
443
|
+
}
|
|
244
444
|
/**
|
|
245
445
|
* Terminate the gRPC channel and close the client.
|
|
246
446
|
*
|