@google-cloud/geocode 0.1.1

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,14 @@
1
+ import * as v4 from './v4';
2
+ declare const DestinationServiceClient: typeof v4.DestinationServiceClient;
3
+ type DestinationServiceClient = v4.DestinationServiceClient;
4
+ declare const GeocodeServiceClient: typeof v4.GeocodeServiceClient;
5
+ type GeocodeServiceClient = v4.GeocodeServiceClient;
6
+ export { v4, DestinationServiceClient, GeocodeServiceClient };
7
+ declare const _default: {
8
+ v4: typeof v4;
9
+ DestinationServiceClient: typeof v4.DestinationServiceClient;
10
+ GeocodeServiceClient: typeof v4.GeocodeServiceClient;
11
+ };
12
+ export default _default;
13
+ import * as protos from '../protos/protos';
14
+ export { protos };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // Copyright 2026 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.GeocodeServiceClient = exports.DestinationServiceClient = exports.v4 = void 0;
21
+ const v4 = require("./v4");
22
+ exports.v4 = v4;
23
+ const DestinationServiceClient = v4.DestinationServiceClient;
24
+ exports.DestinationServiceClient = DestinationServiceClient;
25
+ const GeocodeServiceClient = v4.GeocodeServiceClient;
26
+ exports.GeocodeServiceClient = GeocodeServiceClient;
27
+ exports.default = { v4, DestinationServiceClient, GeocodeServiceClient };
28
+ const protos = require("../protos/protos");
29
+ exports.protos = protos;
30
+ //# 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;AAOnB,gBAAE;AALV,MAAM,wBAAwB,GAAG,EAAE,CAAC,wBAAwB,CAAC;AAKjD,4DAAwB;AAHpC,MAAM,oBAAoB,GAAG,EAAE,CAAC,oBAAoB,CAAC;AAGf,oDAAoB;AAC1D,kBAAe,EAAC,EAAE,EAAE,wBAAwB,EAAE,oBAAoB,EAAC,CAAC;AACpE,2CAA2C;AACnC,wBAAM"}
@@ -0,0 +1,165 @@
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
+ * A service for retrieving destinations.
6
+ *
7
+ * A destination provides hierarchical context about a place, which
8
+ * allows you to, for example, find apartment buildings within a larger
9
+ * apartment complex and vice versa. It also provides navigation points suitable
10
+ * for use cases such as ridesharing or delivery.
11
+ * @class
12
+ * @memberof v4
13
+ */
14
+ export declare class DestinationServiceClient {
15
+ private _terminated;
16
+ private _opts;
17
+ private _providedCustomServicePath;
18
+ private _gaxModule;
19
+ private _gaxGrpc;
20
+ private _protos;
21
+ private _defaults;
22
+ private _universeDomain;
23
+ private _servicePath;
24
+ private _log;
25
+ auth: gax.GoogleAuth;
26
+ descriptors: Descriptors;
27
+ warn: (code: string, message: string, warnType?: string) => void;
28
+ innerApiCalls: {
29
+ [name: string]: Function;
30
+ };
31
+ destinationServiceStub?: Promise<{
32
+ [name: string]: Function;
33
+ }>;
34
+ /**
35
+ * Construct an instance of DestinationServiceClient.
36
+ *
37
+ * @param {object} [options] - The configuration object.
38
+ * The options accepted by the constructor are described in detail
39
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
40
+ * The common options are:
41
+ * @param {object} [options.credentials] - Credentials object.
42
+ * @param {string} [options.credentials.client_email]
43
+ * @param {string} [options.credentials.private_key]
44
+ * @param {string} [options.email] - Account email address. Required when
45
+ * using a .pem or .p12 keyFilename.
46
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
47
+ * .p12 key downloaded from the Google Developers Console. If you provide
48
+ * a path to a JSON file, the projectId option below is not necessary.
49
+ * NOTE: .pem and .p12 require you to specify options.email as well.
50
+ * @param {number} [options.port] - The port on which to connect to
51
+ * the remote host.
52
+ * @param {string} [options.projectId] - The project ID from the Google
53
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
54
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
55
+ * app is running in an environment which supports
56
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
57
+ * your project ID will be detected automatically.
58
+ * @param {string} [options.apiEndpoint] - The domain name of the
59
+ * API remote host.
60
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
61
+ * Follows the structure of {@link gapicConfig}.
62
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
63
+ * For more information, please check the
64
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
65
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
66
+ * need to avoid loading the default gRPC version and want to use the fallback
67
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
68
+ * ```
69
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
70
+ * const client = new DestinationServiceClient({fallback: true}, gax);
71
+ * ```
72
+ */
73
+ constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
74
+ /**
75
+ * Initialize the client.
76
+ * Performs asynchronous operations (such as authentication) and prepares the client.
77
+ * This function will be called automatically when any class method is called for the
78
+ * first time, but if you need to initialize it before calling an actual method,
79
+ * feel free to call initialize() directly.
80
+ *
81
+ * You can await on this method if you want to make sure the client is initialized.
82
+ *
83
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
84
+ */
85
+ initialize(): Promise<{
86
+ [name: string]: Function;
87
+ }>;
88
+ /**
89
+ * The DNS address for this API service.
90
+ * @deprecated Use the apiEndpoint method of the client instance.
91
+ * @returns {string} The DNS address for this service.
92
+ */
93
+ static get servicePath(): string;
94
+ /**
95
+ * The DNS address for this API service - same as servicePath.
96
+ * @deprecated Use the apiEndpoint method of the client instance.
97
+ * @returns {string} The DNS address for this service.
98
+ */
99
+ static get apiEndpoint(): string;
100
+ /**
101
+ * The DNS address for this API service.
102
+ * @returns {string} The DNS address for this service.
103
+ */
104
+ get apiEndpoint(): string;
105
+ get universeDomain(): string;
106
+ /**
107
+ * The port for this API service.
108
+ * @returns {number} The default port for this service.
109
+ */
110
+ static get port(): number;
111
+ /**
112
+ * The scopes needed to make gRPC calls for every method defined
113
+ * in this service.
114
+ * @returns {string[]} List of default scopes.
115
+ */
116
+ static get scopes(): string[];
117
+ getProjectId(): Promise<string>;
118
+ getProjectId(callback: Callback<string, undefined, undefined>): void;
119
+ /**
120
+ * This method performs a destination lookup and returns a list of
121
+ * destinations.
122
+ *
123
+ * @param {Object} request
124
+ * The request object that will be sent.
125
+ * @param {string} request.place
126
+ * The resource name of a place, in `places/{place_id}` format.
127
+ * @param {google.maps.geocode.v4.SearchDestinationsRequest.AddressQuery} request.addressQuery
128
+ * A street address.
129
+ * @param {google.maps.geocode.v4.SearchDestinationsRequest.LocationQuery} request.locationQuery
130
+ * A precise location.
131
+ * @param {number[]} [request.travelModes]
132
+ * Optional. The travel modes to filter navigation points for. This influences
133
+ * the `navigation_points` field returned in the response. If empty,
134
+ * navigation points of all travel modes are returned.
135
+ * @param {string} [request.languageCode]
136
+ * Optional. Language in which the results should be returned.
137
+ * @param {string} [request.regionCode]
138
+ * Optional. Region code. The region code, specified as a ccTLD ("top-level
139
+ * domain") two-character value. The parameter affects results based on
140
+ * applicable law. This parameter also influences, but not fully restricts,
141
+ * results from the service.
142
+ * @param {object} [options]
143
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
144
+ * @returns {Promise} - The promise which resolves to an array.
145
+ * The first element of the array is an object representing {@link protos.google.maps.geocode.v4.SearchDestinationsResponse|SearchDestinationsResponse}.
146
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
147
+ * for more details and examples.
148
+ * @example <caption>include:samples/generated/v4/destination_service.search_destinations.js</caption>
149
+ * region_tag:geocoding-backend_v4_generated_DestinationService_SearchDestinations_async
150
+ */
151
+ searchDestinations(request?: protos.google.maps.geocode.v4.ISearchDestinationsRequest, options?: CallOptions): Promise<[
152
+ protos.google.maps.geocode.v4.ISearchDestinationsResponse,
153
+ protos.google.maps.geocode.v4.ISearchDestinationsRequest | undefined,
154
+ {} | undefined
155
+ ]>;
156
+ searchDestinations(request: protos.google.maps.geocode.v4.ISearchDestinationsRequest, options: CallOptions, callback: Callback<protos.google.maps.geocode.v4.ISearchDestinationsResponse, protos.google.maps.geocode.v4.ISearchDestinationsRequest | null | undefined, {} | null | undefined>): void;
157
+ searchDestinations(request: protos.google.maps.geocode.v4.ISearchDestinationsRequest, callback: Callback<protos.google.maps.geocode.v4.ISearchDestinationsResponse, protos.google.maps.geocode.v4.ISearchDestinationsRequest | null | undefined, {} | null | undefined>): void;
158
+ /**
159
+ * Terminate the gRPC channel and close the client.
160
+ *
161
+ * The client will no longer be usable and all future behavior is undefined.
162
+ * @returns {Promise} A promise that resolves when the client is closed.
163
+ */
164
+ close(): Promise<void>;
165
+ }
@@ -0,0 +1,326 @@
1
+ "use strict";
2
+ // Copyright 2026 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.DestinationServiceClient = void 0;
21
+ const jsonProtos = require("../../protos/protos.json");
22
+ const google_gax_1 = require("google-gax");
23
+ /**
24
+ * Client JSON configuration object, loaded from
25
+ * `src/v4/destination_service_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./destination_service_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * A service for retrieving destinations.
32
+ *
33
+ * A destination provides hierarchical context about a place, which
34
+ * allows you to, for example, find apartment buildings within a larger
35
+ * apartment complex and vice versa. It also provides navigation points suitable
36
+ * for use cases such as ridesharing or delivery.
37
+ * @class
38
+ * @memberof v4
39
+ */
40
+ class DestinationServiceClient {
41
+ _terminated = false;
42
+ _opts;
43
+ _providedCustomServicePath;
44
+ _gaxModule;
45
+ _gaxGrpc;
46
+ _protos;
47
+ _defaults;
48
+ _universeDomain;
49
+ _servicePath;
50
+ _log = google_gax_1.loggingUtils.log('geocode');
51
+ auth;
52
+ descriptors = {
53
+ page: {},
54
+ stream: {},
55
+ longrunning: {},
56
+ batching: {},
57
+ };
58
+ warn;
59
+ innerApiCalls;
60
+ destinationServiceStub;
61
+ /**
62
+ * Construct an instance of DestinationServiceClient.
63
+ *
64
+ * @param {object} [options] - The configuration object.
65
+ * The options accepted by the constructor are described in detail
66
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
67
+ * The common options are:
68
+ * @param {object} [options.credentials] - Credentials object.
69
+ * @param {string} [options.credentials.client_email]
70
+ * @param {string} [options.credentials.private_key]
71
+ * @param {string} [options.email] - Account email address. Required when
72
+ * using a .pem or .p12 keyFilename.
73
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
74
+ * .p12 key downloaded from the Google Developers Console. If you provide
75
+ * a path to a JSON file, the projectId option below is not necessary.
76
+ * NOTE: .pem and .p12 require you to specify options.email as well.
77
+ * @param {number} [options.port] - The port on which to connect to
78
+ * the remote host.
79
+ * @param {string} [options.projectId] - The project ID from the Google
80
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
81
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
82
+ * app is running in an environment which supports
83
+ * {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
84
+ * your project ID will be detected automatically.
85
+ * @param {string} [options.apiEndpoint] - The domain name of the
86
+ * API remote host.
87
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
88
+ * Follows the structure of {@link gapicConfig}.
89
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
90
+ * For more information, please check the
91
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
92
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
93
+ * need to avoid loading the default gRPC version and want to use the fallback
94
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
95
+ * ```
96
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
97
+ * const client = new DestinationServiceClient({fallback: true}, gax);
98
+ * ```
99
+ */
100
+ constructor(opts, gaxInstance) {
101
+ // Ensure that options include all the required fields.
102
+ const staticMembers = this.constructor;
103
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
104
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
105
+ }
106
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
107
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
108
+ this._servicePath = 'geocoding-backend.' + this._universeDomain;
109
+ const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
110
+ this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
111
+ const port = opts?.port || staticMembers.port;
112
+ const clientConfig = opts?.clientConfig ?? {};
113
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
114
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
115
+ // Request numeric enum values if REST transport is used.
116
+ opts.numericEnums = true;
117
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
118
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
119
+ opts['scopes'] = staticMembers.scopes;
120
+ }
121
+ // Load google-gax module synchronously if needed
122
+ if (!gaxInstance) {
123
+ gaxInstance = require('google-gax');
124
+ }
125
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
126
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
127
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
128
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
129
+ // Save options to use in initialize() method.
130
+ this._opts = opts;
131
+ // Save the auth object to the client, for use by other methods.
132
+ this.auth = this._gaxGrpc.auth;
133
+ // Set useJWTAccessWithScope on the auth object.
134
+ this.auth.useJWTAccessWithScope = true;
135
+ // Set defaultServicePath on the auth object.
136
+ this.auth.defaultServicePath = this._servicePath;
137
+ // Set the default scopes in auth client if needed.
138
+ if (servicePath === this._servicePath) {
139
+ this.auth.defaultScopes = staticMembers.scopes;
140
+ }
141
+ // Determine the client header string.
142
+ const clientHeader = [
143
+ `gax/${this._gaxModule.version}`,
144
+ `gapic/${version}`,
145
+ ];
146
+ if (typeof process === 'object' && 'versions' in process) {
147
+ clientHeader.push(`gl-node/${process.versions.node}`);
148
+ }
149
+ else {
150
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
151
+ }
152
+ if (!opts.fallback) {
153
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
154
+ }
155
+ else {
156
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
157
+ }
158
+ if (opts.libName && opts.libVersion) {
159
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
160
+ }
161
+ // Load the applicable protos.
162
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
163
+ // Put together the default options sent with requests.
164
+ this._defaults = this._gaxGrpc.constructSettings('google.maps.geocode.v4.DestinationService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
165
+ // Set up a dictionary of "inner API calls"; the core implementation
166
+ // of calling the API is handled in `google-gax`, with this code
167
+ // merely providing the destination and request information.
168
+ this.innerApiCalls = {};
169
+ // Add a warn function to the client constructor so it can be easily tested.
170
+ this.warn = this._gaxModule.warn;
171
+ }
172
+ /**
173
+ * Initialize the client.
174
+ * Performs asynchronous operations (such as authentication) and prepares the client.
175
+ * This function will be called automatically when any class method is called for the
176
+ * first time, but if you need to initialize it before calling an actual method,
177
+ * feel free to call initialize() directly.
178
+ *
179
+ * You can await on this method if you want to make sure the client is initialized.
180
+ *
181
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
182
+ */
183
+ initialize() {
184
+ // If the client stub promise is already initialized, return immediately.
185
+ if (this.destinationServiceStub) {
186
+ return this.destinationServiceStub;
187
+ }
188
+ // Put together the "service stub" for
189
+ // google.maps.geocode.v4.DestinationService.
190
+ this.destinationServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
191
+ this._protos.lookupService('google.maps.geocode.v4.DestinationService') :
192
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
193
+ this._protos.google.maps.geocode.v4.DestinationService, this._opts, this._providedCustomServicePath);
194
+ // Iterate over each of the methods that the service provides
195
+ // and create an API call method for each.
196
+ const destinationServiceStubMethods = ['searchDestinations'];
197
+ for (const methodName of destinationServiceStubMethods) {
198
+ const callPromise = this.destinationServiceStub.then(stub => (...args) => {
199
+ if (this._terminated) {
200
+ return Promise.reject('The client has already been closed.');
201
+ }
202
+ const func = stub[methodName];
203
+ return func.apply(stub, args);
204
+ }, (err) => () => {
205
+ throw err;
206
+ });
207
+ const descriptor = undefined;
208
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
209
+ this.innerApiCalls[methodName] = apiCall;
210
+ }
211
+ return this.destinationServiceStub;
212
+ }
213
+ /**
214
+ * The DNS address for this API service.
215
+ * @deprecated Use the apiEndpoint method of the client instance.
216
+ * @returns {string} The DNS address for this service.
217
+ */
218
+ static get servicePath() {
219
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
220
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
221
+ }
222
+ return 'geocoding-backend.googleapis.com';
223
+ }
224
+ /**
225
+ * The DNS address for this API service - same as servicePath.
226
+ * @deprecated Use the apiEndpoint method of the client instance.
227
+ * @returns {string} The DNS address for this service.
228
+ */
229
+ static get apiEndpoint() {
230
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
231
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
232
+ }
233
+ return 'geocoding-backend.googleapis.com';
234
+ }
235
+ /**
236
+ * The DNS address for this API service.
237
+ * @returns {string} The DNS address for this service.
238
+ */
239
+ get apiEndpoint() {
240
+ return this._servicePath;
241
+ }
242
+ get universeDomain() {
243
+ return this._universeDomain;
244
+ }
245
+ /**
246
+ * The port for this API service.
247
+ * @returns {number} The default port for this service.
248
+ */
249
+ static get port() {
250
+ return 443;
251
+ }
252
+ /**
253
+ * The scopes needed to make gRPC calls for every method defined
254
+ * in this service.
255
+ * @returns {string[]} List of default scopes.
256
+ */
257
+ static get scopes() {
258
+ return [
259
+ 'https://www.googleapis.com/auth/cloud-platform',
260
+ 'https://www.googleapis.com/auth/maps-platform.destinations',
261
+ 'https://www.googleapis.com/auth/maps-platform.geocode'
262
+ ];
263
+ }
264
+ /**
265
+ * Return the project ID used by this class.
266
+ * @returns {Promise} A promise that resolves to string containing the project ID.
267
+ */
268
+ getProjectId(callback) {
269
+ if (callback) {
270
+ this.auth.getProjectId(callback);
271
+ return;
272
+ }
273
+ return this.auth.getProjectId();
274
+ }
275
+ searchDestinations(request, optionsOrCallback, callback) {
276
+ request = request || {};
277
+ let options;
278
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
279
+ callback = optionsOrCallback;
280
+ options = {};
281
+ }
282
+ else {
283
+ options = optionsOrCallback;
284
+ }
285
+ options = options || {};
286
+ options.otherArgs = options.otherArgs || {};
287
+ options.otherArgs.headers = options.otherArgs.headers || {};
288
+ this.initialize().catch(err => { throw err; });
289
+ this._log.info('searchDestinations request %j', request);
290
+ const wrappedCallback = callback
291
+ ? (error, response, options, rawResponse) => {
292
+ this._log.info('searchDestinations response %j', response);
293
+ callback(error, response, options, rawResponse); // We verified callback above.
294
+ }
295
+ : undefined;
296
+ return this.innerApiCalls.searchDestinations(request, options, wrappedCallback)
297
+ ?.then(([response, options, rawResponse]) => {
298
+ this._log.info('searchDestinations response %j', response);
299
+ return [response, options, rawResponse];
300
+ }).catch((error) => {
301
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
302
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
303
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
304
+ }
305
+ throw error;
306
+ });
307
+ }
308
+ /**
309
+ * Terminate the gRPC channel and close the client.
310
+ *
311
+ * The client will no longer be usable and all future behavior is undefined.
312
+ * @returns {Promise} A promise that resolves when the client is closed.
313
+ */
314
+ close() {
315
+ if (this.destinationServiceStub && !this._terminated) {
316
+ return this.destinationServiceStub.then(stub => {
317
+ this._log.info('ending gRPC channel');
318
+ this._terminated = true;
319
+ stub.close();
320
+ });
321
+ }
322
+ return Promise.resolve();
323
+ }
324
+ }
325
+ exports.DestinationServiceClient = DestinationServiceClient;
326
+ //# sourceMappingURL=destination_service_client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"destination_service_client.js","sourceRoot":"","sources":["../../../src/v4/destination_service_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;;;AAOrD,uDAAwD;AACxD,2CAA2E;AAE3E;;;;GAIG;AACH,wEAAwE;AACxE,MAAM,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAa,wBAAwB;IAC3B,WAAW,GAAG,KAAK,CAAC;IACpB,KAAK,CAAgB;IACrB,0BAA0B,CAAU;IACpC,UAAU,CAAmC;IAC7C,QAAQ,CAA2C;IACnD,OAAO,CAAK;IACZ,SAAS,CAAuC;IAChD,eAAe,CAAS;IACxB,YAAY,CAAS;IACrB,IAAI,GAAG,yBAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAEtC,IAAI,CAAiB;IACrB,WAAW,GAAgB;QACzB,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,EAAE;KACb,CAAC;IACF,IAAI,CAA6D;IACjE,aAAa,CAA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,EAAE;YACH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;YAC3D,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAU,EAAE,EAAE;YACtB,IAAI,KAAK,IAAI,eAAe,IAAI,KAAK,IAAI,KAAK,CAAC,aAAa,YAAY,KAAK,EAAE,CAAC;gBAC9E,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAiC,CAAC;gBAClG,KAAK,CAAC,aAAa,GAAG,IAAA,mCAAsB,EAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAC5E,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC;IAGD;;;;;OAKG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,sBAAsB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACrD,OAAO,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAC7C,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;gBACtC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AArZD,4DAqZC"}
@@ -0,0 +1,43 @@
1
+ {
2
+ "interfaces": {
3
+ "google.maps.geocode.v4.DestinationService": {
4
+ "retry_codes": {
5
+ "non_idempotent": [],
6
+ "idempotent": [
7
+ "DEADLINE_EXCEEDED",
8
+ "UNAVAILABLE"
9
+ ],
10
+ "unavailable": [
11
+ "UNAVAILABLE"
12
+ ]
13
+ },
14
+ "retry_params": {
15
+ "default": {
16
+ "initial_retry_delay_millis": 100,
17
+ "retry_delay_multiplier": 1.3,
18
+ "max_retry_delay_millis": 60000,
19
+ "initial_rpc_timeout_millis": 60000,
20
+ "rpc_timeout_multiplier": 1,
21
+ "max_rpc_timeout_millis": 60000,
22
+ "total_timeout_millis": 600000
23
+ },
24
+ "ce5b960a6ed052e690863808e4f0deff3dc7d49f": {
25
+ "initial_retry_delay_millis": 1000,
26
+ "retry_delay_multiplier": 1.3,
27
+ "max_retry_delay_millis": 10000,
28
+ "initial_rpc_timeout_millis": 60000,
29
+ "rpc_timeout_multiplier": 1,
30
+ "max_rpc_timeout_millis": 60000,
31
+ "total_timeout_millis": 600000
32
+ }
33
+ },
34
+ "methods": {
35
+ "SearchDestinations": {
36
+ "timeout_millis": 60000,
37
+ "retry_codes_name": "unavailable",
38
+ "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ }
@@ -0,0 +1,5 @@
1
+ [
2
+ "../../protos/google/geo/type/viewport.proto",
3
+ "../../protos/google/maps/geocode/v4/destination_service.proto",
4
+ "../../protos/google/maps/geocode/v4/geocode_service.proto"
5
+ ]