@googlemaps/places 0.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.
@@ -0,0 +1,11 @@
1
+ import * as v1 from './v1';
2
+ declare const PlacesClient: typeof v1.PlacesClient;
3
+ type PlacesClient = v1.PlacesClient;
4
+ export { v1, PlacesClient };
5
+ declare const _default: {
6
+ v1: typeof v1;
7
+ PlacesClient: typeof v1.PlacesClient;
8
+ };
9
+ export default _default;
10
+ import * as protos from '../protos/protos';
11
+ export { protos };
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // Copyright 2023 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by synthtool. **
17
+ // ** https://github.com/googleapis/synthtool **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.protos = exports.PlacesClient = exports.v1 = void 0;
21
+ const v1 = require("./v1");
22
+ exports.v1 = v1;
23
+ const PlacesClient = v1.PlacesClient;
24
+ exports.PlacesClient = PlacesClient;
25
+ exports.default = { v1, PlacesClient };
26
+ const protos = require("../protos/protos");
27
+ exports.protos = protos;
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,2DAA2D;AAC3D,gDAAgD;AAChD,qDAAqD;;;AAErD,2BAA2B;AAKnB,gBAAE;AAHV,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;AAGzB,oCAAY;AACxB,kBAAe,EAAC,EAAE,EAAE,YAAY,EAAC,CAAC;AAClC,2CAA2C;AACnC,wBAAM"}
@@ -0,0 +1 @@
1
+ export { PlacesClient } from './places_client';
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // Copyright 2023 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by gapic-generator-typescript. **
17
+ // ** https://github.com/googleapis/gapic-generator-typescript **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.PlacesClient = void 0;
21
+ var places_client_1 = require("./places_client");
22
+ Object.defineProperty(exports, "PlacesClient", { enumerable: true, get: function () { return places_client_1.PlacesClient; } });
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v1/index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;;AAErD,iDAA6C;AAArC,6GAAA,YAAY,OAAA"}
@@ -0,0 +1,203 @@
1
+ import type * as gax from 'google-gax';
2
+ import type { Callback, CallOptions, Descriptors, ClientOptions } from 'google-gax';
3
+ import * as protos from '../../protos/protos';
4
+ /**
5
+ * Service definition for the Places API.
6
+ * @class
7
+ * @memberof v1
8
+ */
9
+ export declare class PlacesClient {
10
+ private _terminated;
11
+ private _opts;
12
+ private _providedCustomServicePath;
13
+ private _gaxModule;
14
+ private _gaxGrpc;
15
+ private _protos;
16
+ private _defaults;
17
+ auth: gax.GoogleAuth;
18
+ descriptors: Descriptors;
19
+ warn: (code: string, message: string, warnType?: string) => void;
20
+ innerApiCalls: {
21
+ [name: string]: Function;
22
+ };
23
+ placesStub?: Promise<{
24
+ [name: string]: Function;
25
+ }>;
26
+ /**
27
+ * Construct an instance of PlacesClient.
28
+ *
29
+ * @param {object} [options] - The configuration object.
30
+ * The options accepted by the constructor are described in detail
31
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
32
+ * The common options are:
33
+ * @param {object} [options.credentials] - Credentials object.
34
+ * @param {string} [options.credentials.client_email]
35
+ * @param {string} [options.credentials.private_key]
36
+ * @param {string} [options.email] - Account email address. Required when
37
+ * using a .pem or .p12 keyFilename.
38
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
39
+ * .p12 key downloaded from the Google Developers Console. If you provide
40
+ * a path to a JSON file, the projectId option below is not necessary.
41
+ * NOTE: .pem and .p12 require you to specify options.email as well.
42
+ * @param {number} [options.port] - The port on which to connect to
43
+ * the remote host.
44
+ * @param {string} [options.projectId] - The project ID from the Google
45
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
46
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
47
+ * app is running in an environment which supports
48
+ * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
49
+ * your project ID will be detected automatically.
50
+ * @param {string} [options.apiEndpoint] - The domain name of the
51
+ * API remote host.
52
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
53
+ * Follows the structure of {@link gapicConfig}.
54
+ * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
55
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
56
+ * For more information, please check the
57
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
58
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
59
+ * need to avoid loading the default gRPC version and want to use the fallback
60
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
61
+ * ```
62
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
63
+ * const client = new PlacesClient({fallback: 'rest'}, gax);
64
+ * ```
65
+ */
66
+ constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
67
+ /**
68
+ * Initialize the client.
69
+ * Performs asynchronous operations (such as authentication) and prepares the client.
70
+ * This function will be called automatically when any class method is called for the
71
+ * first time, but if you need to initialize it before calling an actual method,
72
+ * feel free to call initialize() directly.
73
+ *
74
+ * You can await on this method if you want to make sure the client is initialized.
75
+ *
76
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
77
+ */
78
+ initialize(): Promise<{
79
+ [name: string]: Function;
80
+ }>;
81
+ /**
82
+ * The DNS address for this API service.
83
+ * @returns {string} The DNS address for this service.
84
+ */
85
+ static get servicePath(): string;
86
+ /**
87
+ * The DNS address for this API service - same as servicePath(),
88
+ * exists for compatibility reasons.
89
+ * @returns {string} The DNS address for this service.
90
+ */
91
+ static get apiEndpoint(): string;
92
+ /**
93
+ * The port for this API service.
94
+ * @returns {number} The default port for this service.
95
+ */
96
+ static get port(): number;
97
+ /**
98
+ * The scopes needed to make gRPC calls for every method defined
99
+ * in this service.
100
+ * @returns {string[]} List of default scopes.
101
+ */
102
+ static get scopes(): never[];
103
+ getProjectId(): Promise<string>;
104
+ getProjectId(callback: Callback<string, undefined, undefined>): void;
105
+ /**
106
+ * Text query based place search.
107
+ *
108
+ * @param {Object} request
109
+ * The request object that will be sent.
110
+ * @param {string} request.textQuery
111
+ * Required. The text query for textual search.
112
+ * @param {string} request.languageCode
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
+ * @param {string} request.regionCode
121
+ * The Unicode country/region code (CLDR) of the location where the
122
+ * request is coming from. It is used to display the place details, like
123
+ * region-specific place name, if available.
124
+ *
125
+ * For more information, see
126
+ * http://www.unicode.org/reports/tr35/#unicode_region_subtag.
127
+ *
128
+ *
129
+ * Note that 3-digit region codes are not currently supported.
130
+ * @param {google.maps.places.v1.SearchTextRequest.RankPreference} request.rankPreference
131
+ * 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
+ * @param {string} request.includedType
140
+ * The requested place type. Full list of types supported:
141
+ * https://developers.google.com/places/supported_types. Only support one
142
+ * included type.
143
+ * @param {boolean} request.openNow
144
+ * Used to restrict the search to places that are open at a specific time.
145
+ * 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
+ * @param {number} request.minRating
153
+ * Filter out results whose average user rating is strictly less than this
154
+ * limit. A valid value must be an float between 0 and 5 (inclusively) at a
155
+ * 0.5 cadence i.e. `[0, 0.5, 1.0, ... , 5.0]` inclusively. This is to keep
156
+ * parity with LocalRefinement_UserRating. The input rating will round up to
157
+ * the nearest 0.5(ceiling). For instance, a rating of 0.6 will eliminate all
158
+ * results with a less than 1.0 rating.
159
+ * @param {number} request.maxResultCount
160
+ * Maximum number of results to return. It must be between 1 and 20,
161
+ * inclusively. If the number is unset, it falls back to the upper limit. If
162
+ * the number is set to negative or exceeds the upper limit, an
163
+ * INVALID_ARGUMENT error is returned.
164
+ * @param {number[]} request.priceLevels
165
+ * Used to restrict the search to places that are marked as certain price
166
+ * levels. Users can choose any combinations of price levels. Default to
167
+ * select all price levels.
168
+ * @param {boolean} request.strictTypeFiltering
169
+ * Used to set strict type filtering for included_type. If set to true, only
170
+ * results of the same type will be returned. Default to false.
171
+ * @param {google.maps.places.v1.SearchTextRequest.LocationBias} request.locationBias
172
+ * The region to search. This location serves as a bias which means results
173
+ * around given location might be returned. Cannot be set along with
174
+ * location_restriction.
175
+ * @param {google.maps.places.v1.SearchTextRequest.LocationRestriction} request.locationRestriction
176
+ * The region to search. This location serves as a restriction which means
177
+ * results outside given location will not be returned. Cannot be set along
178
+ * with location_bias.
179
+ * @param {object} [options]
180
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
181
+ * @returns {Promise} - The promise which resolves to an array.
182
+ * The first element of the array is an object representing {@link google.maps.places.v1.SearchTextResponse | SearchTextResponse}.
183
+ * Please see the
184
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
185
+ * for more details and examples.
186
+ * @example <caption>include:samples/generated/v1/places.search_text.js</caption>
187
+ * region_tag:places_v1_generated_Places_SearchText_async
188
+ */
189
+ searchText(request?: protos.google.maps.places.v1.ISearchTextRequest, options?: CallOptions): Promise<[
190
+ protos.google.maps.places.v1.ISearchTextResponse,
191
+ protos.google.maps.places.v1.ISearchTextRequest | undefined,
192
+ {} | undefined
193
+ ]>;
194
+ 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;
195
+ 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;
196
+ /**
197
+ * Terminate the gRPC channel and close the client.
198
+ *
199
+ * The client will no longer be usable and all future behavior is undefined.
200
+ * @returns {Promise} A promise that resolves when the client is closed.
201
+ */
202
+ close(): Promise<void>;
203
+ }
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ // Copyright 2023 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by gapic-generator-typescript. **
17
+ // ** https://github.com/googleapis/gapic-generator-typescript **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.PlacesClient = void 0;
21
+ const jsonProtos = require("../../protos/protos.json");
22
+ /**
23
+ * Client JSON configuration object, loaded from
24
+ * `src/v1/places_client_config.json`.
25
+ * This file defines retry strategy and timeouts for all API methods in this library.
26
+ */
27
+ const gapicConfig = require("./places_client_config.json");
28
+ const version = require('../../../package.json').version;
29
+ /**
30
+ * Service definition for the Places API.
31
+ * @class
32
+ * @memberof v1
33
+ */
34
+ class PlacesClient {
35
+ /**
36
+ * Construct an instance of PlacesClient.
37
+ *
38
+ * @param {object} [options] - The configuration object.
39
+ * The options accepted by the constructor are described in detail
40
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
41
+ * The common options are:
42
+ * @param {object} [options.credentials] - Credentials object.
43
+ * @param {string} [options.credentials.client_email]
44
+ * @param {string} [options.credentials.private_key]
45
+ * @param {string} [options.email] - Account email address. Required when
46
+ * using a .pem or .p12 keyFilename.
47
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
48
+ * .p12 key downloaded from the Google Developers Console. If you provide
49
+ * a path to a JSON file, the projectId option below is not necessary.
50
+ * NOTE: .pem and .p12 require you to specify options.email as well.
51
+ * @param {number} [options.port] - The port on which to connect to
52
+ * the remote host.
53
+ * @param {string} [options.projectId] - The project ID from the Google
54
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
55
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
56
+ * app is running in an environment which supports
57
+ * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
58
+ * your project ID will be detected automatically.
59
+ * @param {string} [options.apiEndpoint] - The domain name of the
60
+ * API remote host.
61
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
62
+ * Follows the structure of {@link gapicConfig}.
63
+ * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
64
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
65
+ * For more information, please check the
66
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
67
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
68
+ * need to avoid loading the default gRPC version and want to use the fallback
69
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
70
+ * ```
71
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
72
+ * const client = new PlacesClient({fallback: 'rest'}, gax);
73
+ * ```
74
+ */
75
+ constructor(opts, gaxInstance) {
76
+ var _a, _b;
77
+ this._terminated = false;
78
+ this.descriptors = {
79
+ page: {},
80
+ stream: {},
81
+ longrunning: {},
82
+ batching: {},
83
+ };
84
+ // Ensure that options include all the required fields.
85
+ const staticMembers = this.constructor;
86
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
87
+ this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
88
+ const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
89
+ const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
90
+ const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
91
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
92
+ // Request numeric enum values if REST transport is used.
93
+ opts.numericEnums = true;
94
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
95
+ if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
96
+ opts['scopes'] = staticMembers.scopes;
97
+ }
98
+ // Load google-gax module synchronously if needed
99
+ if (!gaxInstance) {
100
+ gaxInstance = require('google-gax');
101
+ }
102
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
103
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
104
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
105
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
106
+ // Save options to use in initialize() method.
107
+ this._opts = opts;
108
+ // Save the auth object to the client, for use by other methods.
109
+ this.auth = this._gaxGrpc.auth;
110
+ // Set useJWTAccessWithScope on the auth object.
111
+ this.auth.useJWTAccessWithScope = true;
112
+ // Set defaultServicePath on the auth object.
113
+ this.auth.defaultServicePath = staticMembers.servicePath;
114
+ // Set the default scopes in auth client if needed.
115
+ if (servicePath === staticMembers.servicePath) {
116
+ this.auth.defaultScopes = staticMembers.scopes;
117
+ }
118
+ // Determine the client header string.
119
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
120
+ if (typeof process !== 'undefined' && 'versions' in process) {
121
+ clientHeader.push(`gl-node/${process.versions.node}`);
122
+ }
123
+ else {
124
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
125
+ }
126
+ if (!opts.fallback) {
127
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
128
+ }
129
+ else if (opts.fallback === 'rest') {
130
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
131
+ }
132
+ if (opts.libName && opts.libVersion) {
133
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
134
+ }
135
+ // Load the applicable protos.
136
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
137
+ // Put together the default options sent with requests.
138
+ this._defaults = this._gaxGrpc.constructSettings('google.maps.places.v1.Places', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
139
+ // Set up a dictionary of "inner API calls"; the core implementation
140
+ // of calling the API is handled in `google-gax`, with this code
141
+ // merely providing the destination and request information.
142
+ this.innerApiCalls = {};
143
+ // Add a warn function to the client constructor so it can be easily tested.
144
+ this.warn = this._gaxModule.warn;
145
+ }
146
+ /**
147
+ * Initialize the client.
148
+ * Performs asynchronous operations (such as authentication) and prepares the client.
149
+ * This function will be called automatically when any class method is called for the
150
+ * first time, but if you need to initialize it before calling an actual method,
151
+ * feel free to call initialize() directly.
152
+ *
153
+ * You can await on this method if you want to make sure the client is initialized.
154
+ *
155
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
156
+ */
157
+ initialize() {
158
+ // If the client stub promise is already initialized, return immediately.
159
+ if (this.placesStub) {
160
+ return this.placesStub;
161
+ }
162
+ // Put together the "service stub" for
163
+ // google.maps.places.v1.Places.
164
+ this.placesStub = this._gaxGrpc.createStub(this._opts.fallback
165
+ ? this._protos.lookupService('google.maps.places.v1.Places')
166
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
167
+ this._protos.google.maps.places.v1.Places, this._opts, this._providedCustomServicePath);
168
+ // Iterate over each of the methods that the service provides
169
+ // and create an API call method for each.
170
+ const placesStubMethods = ['searchText'];
171
+ for (const methodName of placesStubMethods) {
172
+ const callPromise = this.placesStub.then(stub => (...args) => {
173
+ if (this._terminated) {
174
+ return Promise.reject('The client has already been closed.');
175
+ }
176
+ const func = stub[methodName];
177
+ return func.apply(stub, args);
178
+ }, (err) => () => {
179
+ throw err;
180
+ });
181
+ const descriptor = undefined;
182
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
183
+ this.innerApiCalls[methodName] = apiCall;
184
+ }
185
+ return this.placesStub;
186
+ }
187
+ /**
188
+ * The DNS address for this API service.
189
+ * @returns {string} The DNS address for this service.
190
+ */
191
+ static get servicePath() {
192
+ return 'places.googleapis.com';
193
+ }
194
+ /**
195
+ * The DNS address for this API service - same as servicePath(),
196
+ * exists for compatibility reasons.
197
+ * @returns {string} The DNS address for this service.
198
+ */
199
+ static get apiEndpoint() {
200
+ return 'places.googleapis.com';
201
+ }
202
+ /**
203
+ * The port for this API service.
204
+ * @returns {number} The default port for this service.
205
+ */
206
+ static get port() {
207
+ return 443;
208
+ }
209
+ /**
210
+ * The scopes needed to make gRPC calls for every method defined
211
+ * in this service.
212
+ * @returns {string[]} List of default scopes.
213
+ */
214
+ static get scopes() {
215
+ return [];
216
+ }
217
+ /**
218
+ * Return the project ID used by this class.
219
+ * @returns {Promise} A promise that resolves to string containing the project ID.
220
+ */
221
+ getProjectId(callback) {
222
+ if (callback) {
223
+ this.auth.getProjectId(callback);
224
+ return;
225
+ }
226
+ return this.auth.getProjectId();
227
+ }
228
+ searchText(request, optionsOrCallback, callback) {
229
+ request = request || {};
230
+ let options;
231
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
232
+ callback = optionsOrCallback;
233
+ options = {};
234
+ }
235
+ else {
236
+ options = optionsOrCallback;
237
+ }
238
+ options = options || {};
239
+ options.otherArgs = options.otherArgs || {};
240
+ options.otherArgs.headers = options.otherArgs.headers || {};
241
+ this.initialize();
242
+ return this.innerApiCalls.searchText(request, options, callback);
243
+ }
244
+ /**
245
+ * Terminate the gRPC channel and close the client.
246
+ *
247
+ * The client will no longer be usable and all future behavior is undefined.
248
+ * @returns {Promise} A promise that resolves when the client is closed.
249
+ */
250
+ close() {
251
+ if (this.placesStub && !this._terminated) {
252
+ return this.placesStub.then(stub => {
253
+ this._terminated = true;
254
+ stub.close();
255
+ });
256
+ }
257
+ return Promise.resolve();
258
+ }
259
+ }
260
+ exports.PlacesClient = PlacesClient;
261
+ //# sourceMappingURL=places_client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"places_client.js","sourceRoot":"","sources":["../../../src/v1/places_client.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;;AAYrD,uDAAwD;AACxD;;;;GAIG;AACH,2DAA2D;AAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAEzD;;;;GAIG;AACH,MAAa,YAAY;IAmBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,YACE,IAAoB,EACpB,WAA8C;;QA5DxC,gBAAW,GAAG,KAAK,CAAC;QAQ5B,gBAAW,GAAgB;YACzB,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;SACb,CAAC;QAiDA,uDAAu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 "google.maps.places.v1.Places": {
4
+ "retry_codes": {
5
+ "non_idempotent": [],
6
+ "idempotent": [
7
+ "DEADLINE_EXCEEDED",
8
+ "UNAVAILABLE"
9
+ ]
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 60000,
17
+ "rpc_timeout_multiplier": 1,
18
+ "max_rpc_timeout_millis": 60000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "SearchText": {
24
+ "retry_codes_name": "non_idempotent",
25
+ "retry_params_name": "default"
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@googlemaps/places",
3
+ "version": "0.1.0",
4
+ "description": "Places API (New) client for Node.js",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/googleapis/google-cloud-node.git",
8
+ "directory": "packages/google-maps-places"
9
+ },
10
+ "license": "Apache-2.0",
11
+ "author": "Google LLC",
12
+ "main": "build/src/index.js",
13
+ "files": [
14
+ "build/src",
15
+ "build/protos"
16
+ ],
17
+ "homepage": "https://github.com/googleapis/google-cloud-node/tree/main/packages/google-maps-places",
18
+ "keywords": [
19
+ "google apis client",
20
+ "google api client",
21
+ "google apis",
22
+ "google api",
23
+ "google",
24
+ "google cloud platform",
25
+ "google cloud",
26
+ "cloud",
27
+ "google places",
28
+ "places",
29
+ "Places API (New)"
30
+ ],
31
+ "scripts": {
32
+ "clean": "gts clean",
33
+ "compile": "tsc -p . && cp -r protos build/",
34
+ "compile-protos": "compileProtos src",
35
+ "docs": "jsdoc -c .jsdoc.js",
36
+ "predocs-test": "npm run docs",
37
+ "docs-test": "linkinator docs",
38
+ "fix": "gts fix",
39
+ "lint": "gts check",
40
+ "postpack": "minifyProtoJson",
41
+ "prepare": "npm run compile-protos && npm run compile",
42
+ "system-test": "c8 mocha build/system-test",
43
+ "test": "c8 mocha build/test",
44
+ "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
45
+ "prelint": "cd samples; npm link ../; npm i"
46
+ },
47
+ "dependencies": {
48
+ "google-gax": "^3.5.8"
49
+ },
50
+ "devDependencies": {
51
+ "@types/mocha": "^9.0.0",
52
+ "@types/node": "^18.0.0",
53
+ "@types/sinon": "^10.0.0",
54
+ "c8": "^7.3.5",
55
+ "gts": "^3.1.0",
56
+ "jsdoc": "^4.0.0",
57
+ "jsdoc-fresh": "^2.0.0",
58
+ "jsdoc-region-tag": "^2.0.0",
59
+ "long": "^5.2.3",
60
+ "linkinator": "^4.0.0",
61
+ "mocha": "^9.2.2",
62
+ "null-loader": "^4.0.1",
63
+ "pack-n-play": "^1.0.0-2",
64
+ "sinon": "^15.0.0",
65
+ "ts-loader": "^9.0.0",
66
+ "typescript": "^4.6.4",
67
+ "webpack": "^5.9.0",
68
+ "webpack-cli": "^5.0.0"
69
+ },
70
+ "engines": {
71
+ "node": ">=12.0.0"
72
+ }
73
+ }