@google-cloud/discoveryengine 0.6.0 → 0.7.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +38 -22
  3. package/build/protos/google/cloud/discoveryengine/v1/common.proto +100 -0
  4. package/build/protos/google/cloud/discoveryengine/v1/completion_service.proto +116 -0
  5. package/build/protos/google/cloud/discoveryengine/v1/document.proto +118 -0
  6. package/build/protos/google/cloud/discoveryengine/v1/document_service.proto +313 -0
  7. package/build/protos/google/cloud/discoveryengine/v1/import_config.proto +334 -0
  8. package/build/protos/google/cloud/discoveryengine/v1/purge_config.proto +86 -0
  9. package/build/protos/google/cloud/discoveryengine/v1/schema.proto +58 -0
  10. package/build/protos/google/cloud/discoveryengine/v1/schema_service.proto +256 -0
  11. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +289 -0
  12. package/build/protos/google/cloud/discoveryengine/v1/user_event.proto +458 -0
  13. package/build/protos/google/cloud/discoveryengine/v1/user_event_service.proto +133 -0
  14. package/build/protos/google/cloud/discoveryengine/v1beta/import_config.proto +54 -0
  15. package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +29 -4
  16. package/build/protos/protos.d.ts +6589 -0
  17. package/build/protos/protos.js +16050 -1
  18. package/build/protos/protos.json +1807 -0
  19. package/build/src/index.d.ts +18 -19
  20. package/build/src/index.js +9 -9
  21. package/build/src/v1/completion_service_client.d.ts +455 -0
  22. package/build/src/v1/completion_service_client.js +659 -0
  23. package/build/src/v1/completion_service_client_config.json +43 -0
  24. package/build/src/v1/document_service_client.d.ts +995 -0
  25. package/build/src/v1/document_service_client.js +1191 -0
  26. package/build/src/v1/document_service_client_config.json +82 -0
  27. package/build/src/v1/index.d.ts +5 -0
  28. package/build/src/v1/index.js +31 -0
  29. package/build/src/v1/schema_service_client.d.ts +795 -0
  30. package/build/src/v1/schema_service_client.js +1129 -0
  31. package/build/src/v1/schema_service_client_config.json +63 -0
  32. package/build/src/v1/search_service_client.d.ts +857 -0
  33. package/build/src/v1/search_service_client.js +1073 -0
  34. package/build/src/v1/search_service_client_config.json +43 -0
  35. package/build/src/v1/user_event_service_client.d.ts +638 -0
  36. package/build/src/v1/user_event_service_client.js +933 -0
  37. package/build/src/v1/user_event_service_client_config.json +62 -0
  38. package/build/src/v1beta/document_service_client.d.ts +52 -0
  39. package/build/src/v1beta/document_service_client.js +6 -0
  40. package/build/src/v1beta/schema_service_client.js +6 -0
  41. package/build/src/v1beta/search_service_client.d.ts +78 -12
  42. package/build/src/v1beta/search_service_client.js +52 -8
  43. package/build/src/v1beta/user_event_service_client.js +6 -0
  44. package/package.json +2 -2
@@ -0,0 +1,1073 @@
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.SearchServiceClient = void 0;
21
+ const jsonProtos = require("../../protos/protos.json");
22
+ /**
23
+ * Client JSON configuration object, loaded from
24
+ * `src/v1/search_service_client_config.json`.
25
+ * This file defines retry strategy and timeouts for all API methods in this library.
26
+ */
27
+ const gapicConfig = require("./search_service_client_config.json");
28
+ const version = require('../../../package.json').version;
29
+ /**
30
+ * Service for search.
31
+ * @class
32
+ * @memberof v1
33
+ */
34
+ class SearchServiceClient {
35
+ /**
36
+ * Construct an instance of SearchServiceClient.
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 SearchServiceClient({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
+ // This API contains "path templates"; forward-slash-separated
138
+ // identifiers to uniquely identify resources within the API.
139
+ // Create useful helper objects for these.
140
+ this.pathTemplates = {
141
+ projectLocationCollectionDataStoreBranchPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}'),
142
+ projectLocationCollectionDataStoreBranchDocumentPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}'),
143
+ projectLocationCollectionDataStoreSchemaPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}'),
144
+ projectLocationCollectionDataStoreServingConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}'),
145
+ projectLocationDataStoreBranchPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}'),
146
+ projectLocationDataStoreBranchDocumentPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}'),
147
+ projectLocationDataStoreSchemaPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/schemas/{schema}'),
148
+ projectLocationDataStoreServingConfigPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}'),
149
+ };
150
+ // Some of the methods on this service return "paged" results,
151
+ // (e.g. 50 results at a time, with tokens to get subsequent
152
+ // pages). Denote the keys used for pagination and results.
153
+ this.descriptors.page = {
154
+ search: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'results'),
155
+ };
156
+ // Put together the default options sent with requests.
157
+ this._defaults = this._gaxGrpc.constructSettings('google.cloud.discoveryengine.v1.SearchService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
158
+ // Set up a dictionary of "inner API calls"; the core implementation
159
+ // of calling the API is handled in `google-gax`, with this code
160
+ // merely providing the destination and request information.
161
+ this.innerApiCalls = {};
162
+ // Add a warn function to the client constructor so it can be easily tested.
163
+ this.warn = this._gaxModule.warn;
164
+ }
165
+ /**
166
+ * Initialize the client.
167
+ * Performs asynchronous operations (such as authentication) and prepares the client.
168
+ * This function will be called automatically when any class method is called for the
169
+ * first time, but if you need to initialize it before calling an actual method,
170
+ * feel free to call initialize() directly.
171
+ *
172
+ * You can await on this method if you want to make sure the client is initialized.
173
+ *
174
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
175
+ */
176
+ initialize() {
177
+ // If the client stub promise is already initialized, return immediately.
178
+ if (this.searchServiceStub) {
179
+ return this.searchServiceStub;
180
+ }
181
+ // Put together the "service stub" for
182
+ // google.cloud.discoveryengine.v1.SearchService.
183
+ this.searchServiceStub = this._gaxGrpc.createStub(this._opts.fallback
184
+ ? this._protos.lookupService('google.cloud.discoveryengine.v1.SearchService')
185
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
186
+ this._protos.google.cloud.discoveryengine.v1.SearchService, this._opts, this._providedCustomServicePath);
187
+ // Iterate over each of the methods that the service provides
188
+ // and create an API call method for each.
189
+ const searchServiceStubMethods = ['search'];
190
+ for (const methodName of searchServiceStubMethods) {
191
+ const callPromise = this.searchServiceStub.then(stub => (...args) => {
192
+ if (this._terminated) {
193
+ return Promise.reject('The client has already been closed.');
194
+ }
195
+ const func = stub[methodName];
196
+ return func.apply(stub, args);
197
+ }, (err) => () => {
198
+ throw err;
199
+ });
200
+ const descriptor = this.descriptors.page[methodName] || undefined;
201
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
202
+ this.innerApiCalls[methodName] = apiCall;
203
+ }
204
+ return this.searchServiceStub;
205
+ }
206
+ /**
207
+ * The DNS address for this API service.
208
+ * @returns {string} The DNS address for this service.
209
+ */
210
+ static get servicePath() {
211
+ return 'discoveryengine.googleapis.com';
212
+ }
213
+ /**
214
+ * The DNS address for this API service - same as servicePath(),
215
+ * exists for compatibility reasons.
216
+ * @returns {string} The DNS address for this service.
217
+ */
218
+ static get apiEndpoint() {
219
+ return 'discoveryengine.googleapis.com';
220
+ }
221
+ /**
222
+ * The port for this API service.
223
+ * @returns {number} The default port for this service.
224
+ */
225
+ static get port() {
226
+ return 443;
227
+ }
228
+ /**
229
+ * The scopes needed to make gRPC calls for every method defined
230
+ * in this service.
231
+ * @returns {string[]} List of default scopes.
232
+ */
233
+ static get scopes() {
234
+ return ['https://www.googleapis.com/auth/cloud-platform'];
235
+ }
236
+ /**
237
+ * Return the project ID used by this class.
238
+ * @returns {Promise} A promise that resolves to string containing the project ID.
239
+ */
240
+ getProjectId(callback) {
241
+ if (callback) {
242
+ this.auth.getProjectId(callback);
243
+ return;
244
+ }
245
+ return this.auth.getProjectId();
246
+ }
247
+ search(request, optionsOrCallback, callback) {
248
+ var _a;
249
+ request = request || {};
250
+ let options;
251
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
252
+ callback = optionsOrCallback;
253
+ options = {};
254
+ }
255
+ else {
256
+ options = optionsOrCallback;
257
+ }
258
+ options = options || {};
259
+ options.otherArgs = options.otherArgs || {};
260
+ options.otherArgs.headers = options.otherArgs.headers || {};
261
+ options.otherArgs.headers['x-goog-request-params'] =
262
+ this._gaxModule.routingHeader.fromParams({
263
+ serving_config: (_a = request.servingConfig) !== null && _a !== void 0 ? _a : '',
264
+ });
265
+ this.initialize();
266
+ return this.innerApiCalls.search(request, options, callback);
267
+ }
268
+ /**
269
+ * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object.
270
+ * @param {Object} request
271
+ * The request object that will be sent.
272
+ * @param {string} request.servingConfig
273
+ * Required. The resource name of the Search serving config, such as
274
+ * `projects/* /locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
275
+ * This field is used to identify the serving configuration name, set
276
+ * of models used to make the search.
277
+ * @param {string} request.branch
278
+ * The branch resource name, such as
279
+ * `projects/* /locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
280
+ *
281
+ * Use `default_branch` as the branch ID or leave this field empty, to search
282
+ * documents under the default branch.
283
+ * @param {string} request.query
284
+ * Raw search query.
285
+ * @param {number} request.pageSize
286
+ * Maximum number of {@link google.cloud.discoveryengine.v1.Document|Document}s to
287
+ * return. If unspecified, defaults to a reasonable value. The maximum allowed
288
+ * value is 100. Values above 100 will be coerced to 100.
289
+ *
290
+ * If this field is negative, an `INVALID_ARGUMENT` is returned.
291
+ * @param {string} request.pageToken
292
+ * A page token received from a previous
293
+ * {@link google.cloud.discoveryengine.v1.SearchService.Search|SearchService.Search}
294
+ * call. Provide this to retrieve the subsequent page.
295
+ *
296
+ * When paginating, all other parameters provided to
297
+ * {@link google.cloud.discoveryengine.v1.SearchService.Search|SearchService.Search}
298
+ * must match the call that provided the page token. Otherwise, an
299
+ * `INVALID_ARGUMENT` error is returned.
300
+ * @param {number} request.offset
301
+ * A 0-indexed integer that specifies the current offset (that is, starting
302
+ * result location, amongst the
303
+ * {@link google.cloud.discoveryengine.v1.Document|Document}s deemed by the API as
304
+ * relevant) in search results. This field is only considered if
305
+ * {@link google.cloud.discoveryengine.v1.SearchRequest.page_token|page_token} is
306
+ * unset.
307
+ *
308
+ * If this field is negative, an `INVALID_ARGUMENT` is returned.
309
+ * @param {google.cloud.discoveryengine.v1.UserInfo} request.userInfo
310
+ * Information about the end user.
311
+ * Highly recommended for analytics. The user_agent string in UserInfo will
312
+ * be used to deduce device_type for analytics.
313
+ * @param {number[]} request.params
314
+ * Additional search parameters.
315
+ *
316
+ * For public website search only, supported values are:
317
+ *
318
+ * * `user_country_code`: string. Default empty. If set to non-empty, results
319
+ * are restricted or boosted based on the location provided.
320
+ * * `search_type`: double. Default empty. Enables non-webpage searching
321
+ * depending on the value. The only valid non-default value is 1,
322
+ * which enables image searching.
323
+ * @param {google.cloud.discoveryengine.v1.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec
324
+ * The query expansion specification that specifies the conditions under which
325
+ * query expansion will occur.
326
+ * @param {google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec
327
+ * The spell correction specification that specifies the mode under
328
+ * which spell correction will take effect.
329
+ * @param {string} request.userPseudoId
330
+ * A unique identifier for tracking visitors. For example, this could be
331
+ * implemented with an HTTP cookie, which should be able to uniquely identify
332
+ * a visitor on a single device. This unique identifier should not change if
333
+ * the visitor logs in or out of the website.
334
+ *
335
+ * This field should NOT have a fixed value such as `unknown_visitor`.
336
+ *
337
+ * This should be the same identifier as
338
+ * {@link google.cloud.discoveryengine.v1.UserEvent.user_pseudo_id|UserEvent.user_pseudo_id}
339
+ * and
340
+ * {@link google.cloud.discoveryengine.v1.CompleteQueryRequest.user_pseudo_id|CompleteQueryRequest.user_pseudo_id}
341
+ *
342
+ * The field must be a UTF-8 encoded string with a length limit of 128
343
+ * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
344
+ * @param {google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec} request.contentSearchSpec
345
+ * The content search spec that configs the desired behavior of content
346
+ * search.
347
+ * @param {boolean} request.safeSearch
348
+ * Whether to turn on safe search. This is only supported for
349
+ * {@link |ContentConfig.PUBLIC_WEBSITE}.
350
+ * @param {number[]} request.userLabels
351
+ * The user labels applied to a resource must meet the following requirements:
352
+ *
353
+ * * Each resource can have multiple labels, up to a maximum of 64.
354
+ * * Each label must be a key-value pair.
355
+ * * Keys have a minimum length of 1 character and a maximum length of 63
356
+ * characters and cannot be empty. Values can be empty and have a maximum
357
+ * length of 63 characters.
358
+ * * Keys and values can contain only lowercase letters, numeric characters,
359
+ * underscores, and dashes. All characters must use UTF-8 encoding, and
360
+ * international characters are allowed.
361
+ * * The key portion of a label must be unique. However, you can use the same
362
+ * key with multiple resources.
363
+ * * Keys must start with a lowercase letter or international character.
364
+ *
365
+ * See [Google Cloud
366
+ * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
367
+ * for more details.
368
+ * @param {object} [options]
369
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
370
+ * @returns {Stream}
371
+ * An object stream which emits an object representing {@link google.cloud.discoveryengine.v1.SearchResponse.SearchResult | SearchResult} on 'data' event.
372
+ * The client library will perform auto-pagination by default: it will call the API as many
373
+ * times as needed. Note that it can affect your quota.
374
+ * We recommend using `searchAsync()`
375
+ * method described below for async iteration which you can stop as needed.
376
+ * Please see the
377
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
378
+ * for more details and examples.
379
+ */
380
+ searchStream(request, options) {
381
+ var _a;
382
+ request = request || {};
383
+ options = options || {};
384
+ options.otherArgs = options.otherArgs || {};
385
+ options.otherArgs.headers = options.otherArgs.headers || {};
386
+ options.otherArgs.headers['x-goog-request-params'] =
387
+ this._gaxModule.routingHeader.fromParams({
388
+ serving_config: (_a = request.servingConfig) !== null && _a !== void 0 ? _a : '',
389
+ });
390
+ const defaultCallSettings = this._defaults['search'];
391
+ const callSettings = defaultCallSettings.merge(options);
392
+ this.initialize();
393
+ return this.descriptors.page.search.createStream(this.innerApiCalls.search, request, callSettings);
394
+ }
395
+ /**
396
+ * Equivalent to `search`, but returns an iterable object.
397
+ *
398
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
399
+ * @param {Object} request
400
+ * The request object that will be sent.
401
+ * @param {string} request.servingConfig
402
+ * Required. The resource name of the Search serving config, such as
403
+ * `projects/* /locations/global/collections/default_collection/dataStores/default_data_store/servingConfigs/default_serving_config`.
404
+ * This field is used to identify the serving configuration name, set
405
+ * of models used to make the search.
406
+ * @param {string} request.branch
407
+ * The branch resource name, such as
408
+ * `projects/* /locations/global/collections/default_collection/dataStores/default_data_store/branches/0`.
409
+ *
410
+ * Use `default_branch` as the branch ID or leave this field empty, to search
411
+ * documents under the default branch.
412
+ * @param {string} request.query
413
+ * Raw search query.
414
+ * @param {number} request.pageSize
415
+ * Maximum number of {@link google.cloud.discoveryengine.v1.Document|Document}s to
416
+ * return. If unspecified, defaults to a reasonable value. The maximum allowed
417
+ * value is 100. Values above 100 will be coerced to 100.
418
+ *
419
+ * If this field is negative, an `INVALID_ARGUMENT` is returned.
420
+ * @param {string} request.pageToken
421
+ * A page token received from a previous
422
+ * {@link google.cloud.discoveryengine.v1.SearchService.Search|SearchService.Search}
423
+ * call. Provide this to retrieve the subsequent page.
424
+ *
425
+ * When paginating, all other parameters provided to
426
+ * {@link google.cloud.discoveryengine.v1.SearchService.Search|SearchService.Search}
427
+ * must match the call that provided the page token. Otherwise, an
428
+ * `INVALID_ARGUMENT` error is returned.
429
+ * @param {number} request.offset
430
+ * A 0-indexed integer that specifies the current offset (that is, starting
431
+ * result location, amongst the
432
+ * {@link google.cloud.discoveryengine.v1.Document|Document}s deemed by the API as
433
+ * relevant) in search results. This field is only considered if
434
+ * {@link google.cloud.discoveryengine.v1.SearchRequest.page_token|page_token} is
435
+ * unset.
436
+ *
437
+ * If this field is negative, an `INVALID_ARGUMENT` is returned.
438
+ * @param {google.cloud.discoveryengine.v1.UserInfo} request.userInfo
439
+ * Information about the end user.
440
+ * Highly recommended for analytics. The user_agent string in UserInfo will
441
+ * be used to deduce device_type for analytics.
442
+ * @param {number[]} request.params
443
+ * Additional search parameters.
444
+ *
445
+ * For public website search only, supported values are:
446
+ *
447
+ * * `user_country_code`: string. Default empty. If set to non-empty, results
448
+ * are restricted or boosted based on the location provided.
449
+ * * `search_type`: double. Default empty. Enables non-webpage searching
450
+ * depending on the value. The only valid non-default value is 1,
451
+ * which enables image searching.
452
+ * @param {google.cloud.discoveryengine.v1.SearchRequest.QueryExpansionSpec} request.queryExpansionSpec
453
+ * The query expansion specification that specifies the conditions under which
454
+ * query expansion will occur.
455
+ * @param {google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec} request.spellCorrectionSpec
456
+ * The spell correction specification that specifies the mode under
457
+ * which spell correction will take effect.
458
+ * @param {string} request.userPseudoId
459
+ * A unique identifier for tracking visitors. For example, this could be
460
+ * implemented with an HTTP cookie, which should be able to uniquely identify
461
+ * a visitor on a single device. This unique identifier should not change if
462
+ * the visitor logs in or out of the website.
463
+ *
464
+ * This field should NOT have a fixed value such as `unknown_visitor`.
465
+ *
466
+ * This should be the same identifier as
467
+ * {@link google.cloud.discoveryengine.v1.UserEvent.user_pseudo_id|UserEvent.user_pseudo_id}
468
+ * and
469
+ * {@link google.cloud.discoveryengine.v1.CompleteQueryRequest.user_pseudo_id|CompleteQueryRequest.user_pseudo_id}
470
+ *
471
+ * The field must be a UTF-8 encoded string with a length limit of 128
472
+ * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
473
+ * @param {google.cloud.discoveryengine.v1.SearchRequest.ContentSearchSpec} request.contentSearchSpec
474
+ * The content search spec that configs the desired behavior of content
475
+ * search.
476
+ * @param {boolean} request.safeSearch
477
+ * Whether to turn on safe search. This is only supported for
478
+ * {@link |ContentConfig.PUBLIC_WEBSITE}.
479
+ * @param {number[]} request.userLabels
480
+ * The user labels applied to a resource must meet the following requirements:
481
+ *
482
+ * * Each resource can have multiple labels, up to a maximum of 64.
483
+ * * Each label must be a key-value pair.
484
+ * * Keys have a minimum length of 1 character and a maximum length of 63
485
+ * characters and cannot be empty. Values can be empty and have a maximum
486
+ * length of 63 characters.
487
+ * * Keys and values can contain only lowercase letters, numeric characters,
488
+ * underscores, and dashes. All characters must use UTF-8 encoding, and
489
+ * international characters are allowed.
490
+ * * The key portion of a label must be unique. However, you can use the same
491
+ * key with multiple resources.
492
+ * * Keys must start with a lowercase letter or international character.
493
+ *
494
+ * See [Google Cloud
495
+ * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements)
496
+ * for more details.
497
+ * @param {object} [options]
498
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
499
+ * @returns {Object}
500
+ * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
501
+ * When you iterate the returned iterable, each element will be an object representing
502
+ * {@link google.cloud.discoveryengine.v1.SearchResponse.SearchResult | SearchResult}. The API will be called under the hood as needed, once per the page,
503
+ * so you can stop the iteration when you don't need more results.
504
+ * Please see the
505
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
506
+ * for more details and examples.
507
+ * @example <caption>include:samples/generated/v1/search_service.search.js</caption>
508
+ * region_tag:discoveryengine_v1_generated_SearchService_Search_async
509
+ */
510
+ searchAsync(request, options) {
511
+ var _a;
512
+ request = request || {};
513
+ options = options || {};
514
+ options.otherArgs = options.otherArgs || {};
515
+ options.otherArgs.headers = options.otherArgs.headers || {};
516
+ options.otherArgs.headers['x-goog-request-params'] =
517
+ this._gaxModule.routingHeader.fromParams({
518
+ serving_config: (_a = request.servingConfig) !== null && _a !== void 0 ? _a : '',
519
+ });
520
+ const defaultCallSettings = this._defaults['search'];
521
+ const callSettings = defaultCallSettings.merge(options);
522
+ this.initialize();
523
+ return this.descriptors.page.search.asyncIterate(this.innerApiCalls['search'], request, callSettings);
524
+ }
525
+ // --------------------
526
+ // -- Path templates --
527
+ // --------------------
528
+ /**
529
+ * Return a fully-qualified projectLocationCollectionDataStoreBranch resource name string.
530
+ *
531
+ * @param {string} project
532
+ * @param {string} location
533
+ * @param {string} collection
534
+ * @param {string} data_store
535
+ * @param {string} branch
536
+ * @returns {string} Resource name string.
537
+ */
538
+ projectLocationCollectionDataStoreBranchPath(project, location, collection, dataStore, branch) {
539
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchPathTemplate.render({
540
+ project: project,
541
+ location: location,
542
+ collection: collection,
543
+ data_store: dataStore,
544
+ branch: branch,
545
+ });
546
+ }
547
+ /**
548
+ * Parse the project from ProjectLocationCollectionDataStoreBranch resource.
549
+ *
550
+ * @param {string} projectLocationCollectionDataStoreBranchName
551
+ * A fully-qualified path representing project_location_collection_data_store_branch resource.
552
+ * @returns {string} A string representing the project.
553
+ */
554
+ matchProjectFromProjectLocationCollectionDataStoreBranchName(projectLocationCollectionDataStoreBranchName) {
555
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchPathTemplate.match(projectLocationCollectionDataStoreBranchName).project;
556
+ }
557
+ /**
558
+ * Parse the location from ProjectLocationCollectionDataStoreBranch resource.
559
+ *
560
+ * @param {string} projectLocationCollectionDataStoreBranchName
561
+ * A fully-qualified path representing project_location_collection_data_store_branch resource.
562
+ * @returns {string} A string representing the location.
563
+ */
564
+ matchLocationFromProjectLocationCollectionDataStoreBranchName(projectLocationCollectionDataStoreBranchName) {
565
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchPathTemplate.match(projectLocationCollectionDataStoreBranchName).location;
566
+ }
567
+ /**
568
+ * Parse the collection from ProjectLocationCollectionDataStoreBranch resource.
569
+ *
570
+ * @param {string} projectLocationCollectionDataStoreBranchName
571
+ * A fully-qualified path representing project_location_collection_data_store_branch resource.
572
+ * @returns {string} A string representing the collection.
573
+ */
574
+ matchCollectionFromProjectLocationCollectionDataStoreBranchName(projectLocationCollectionDataStoreBranchName) {
575
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchPathTemplate.match(projectLocationCollectionDataStoreBranchName).collection;
576
+ }
577
+ /**
578
+ * Parse the data_store from ProjectLocationCollectionDataStoreBranch resource.
579
+ *
580
+ * @param {string} projectLocationCollectionDataStoreBranchName
581
+ * A fully-qualified path representing project_location_collection_data_store_branch resource.
582
+ * @returns {string} A string representing the data_store.
583
+ */
584
+ matchDataStoreFromProjectLocationCollectionDataStoreBranchName(projectLocationCollectionDataStoreBranchName) {
585
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchPathTemplate.match(projectLocationCollectionDataStoreBranchName).data_store;
586
+ }
587
+ /**
588
+ * Parse the branch from ProjectLocationCollectionDataStoreBranch resource.
589
+ *
590
+ * @param {string} projectLocationCollectionDataStoreBranchName
591
+ * A fully-qualified path representing project_location_collection_data_store_branch resource.
592
+ * @returns {string} A string representing the branch.
593
+ */
594
+ matchBranchFromProjectLocationCollectionDataStoreBranchName(projectLocationCollectionDataStoreBranchName) {
595
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchPathTemplate.match(projectLocationCollectionDataStoreBranchName).branch;
596
+ }
597
+ /**
598
+ * Return a fully-qualified projectLocationCollectionDataStoreBranchDocument resource name string.
599
+ *
600
+ * @param {string} project
601
+ * @param {string} location
602
+ * @param {string} collection
603
+ * @param {string} data_store
604
+ * @param {string} branch
605
+ * @param {string} document
606
+ * @returns {string} Resource name string.
607
+ */
608
+ projectLocationCollectionDataStoreBranchDocumentPath(project, location, collection, dataStore, branch, document) {
609
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.render({
610
+ project: project,
611
+ location: location,
612
+ collection: collection,
613
+ data_store: dataStore,
614
+ branch: branch,
615
+ document: document,
616
+ });
617
+ }
618
+ /**
619
+ * Parse the project from ProjectLocationCollectionDataStoreBranchDocument resource.
620
+ *
621
+ * @param {string} projectLocationCollectionDataStoreBranchDocumentName
622
+ * A fully-qualified path representing project_location_collection_data_store_branch_document resource.
623
+ * @returns {string} A string representing the project.
624
+ */
625
+ matchProjectFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
626
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).project;
627
+ }
628
+ /**
629
+ * Parse the location from ProjectLocationCollectionDataStoreBranchDocument resource.
630
+ *
631
+ * @param {string} projectLocationCollectionDataStoreBranchDocumentName
632
+ * A fully-qualified path representing project_location_collection_data_store_branch_document resource.
633
+ * @returns {string} A string representing the location.
634
+ */
635
+ matchLocationFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
636
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).location;
637
+ }
638
+ /**
639
+ * Parse the collection from ProjectLocationCollectionDataStoreBranchDocument resource.
640
+ *
641
+ * @param {string} projectLocationCollectionDataStoreBranchDocumentName
642
+ * A fully-qualified path representing project_location_collection_data_store_branch_document resource.
643
+ * @returns {string} A string representing the collection.
644
+ */
645
+ matchCollectionFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
646
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).collection;
647
+ }
648
+ /**
649
+ * Parse the data_store from ProjectLocationCollectionDataStoreBranchDocument resource.
650
+ *
651
+ * @param {string} projectLocationCollectionDataStoreBranchDocumentName
652
+ * A fully-qualified path representing project_location_collection_data_store_branch_document resource.
653
+ * @returns {string} A string representing the data_store.
654
+ */
655
+ matchDataStoreFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
656
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).data_store;
657
+ }
658
+ /**
659
+ * Parse the branch from ProjectLocationCollectionDataStoreBranchDocument resource.
660
+ *
661
+ * @param {string} projectLocationCollectionDataStoreBranchDocumentName
662
+ * A fully-qualified path representing project_location_collection_data_store_branch_document resource.
663
+ * @returns {string} A string representing the branch.
664
+ */
665
+ matchBranchFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
666
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).branch;
667
+ }
668
+ /**
669
+ * Parse the document from ProjectLocationCollectionDataStoreBranchDocument resource.
670
+ *
671
+ * @param {string} projectLocationCollectionDataStoreBranchDocumentName
672
+ * A fully-qualified path representing project_location_collection_data_store_branch_document resource.
673
+ * @returns {string} A string representing the document.
674
+ */
675
+ matchDocumentFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
676
+ return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).document;
677
+ }
678
+ /**
679
+ * Return a fully-qualified projectLocationCollectionDataStoreSchema resource name string.
680
+ *
681
+ * @param {string} project
682
+ * @param {string} location
683
+ * @param {string} collection
684
+ * @param {string} data_store
685
+ * @param {string} schema
686
+ * @returns {string} Resource name string.
687
+ */
688
+ projectLocationCollectionDataStoreSchemaPath(project, location, collection, dataStore, schema) {
689
+ return this.pathTemplates.projectLocationCollectionDataStoreSchemaPathTemplate.render({
690
+ project: project,
691
+ location: location,
692
+ collection: collection,
693
+ data_store: dataStore,
694
+ schema: schema,
695
+ });
696
+ }
697
+ /**
698
+ * Parse the project from ProjectLocationCollectionDataStoreSchema resource.
699
+ *
700
+ * @param {string} projectLocationCollectionDataStoreSchemaName
701
+ * A fully-qualified path representing project_location_collection_data_store_schema resource.
702
+ * @returns {string} A string representing the project.
703
+ */
704
+ matchProjectFromProjectLocationCollectionDataStoreSchemaName(projectLocationCollectionDataStoreSchemaName) {
705
+ return this.pathTemplates.projectLocationCollectionDataStoreSchemaPathTemplate.match(projectLocationCollectionDataStoreSchemaName).project;
706
+ }
707
+ /**
708
+ * Parse the location from ProjectLocationCollectionDataStoreSchema resource.
709
+ *
710
+ * @param {string} projectLocationCollectionDataStoreSchemaName
711
+ * A fully-qualified path representing project_location_collection_data_store_schema resource.
712
+ * @returns {string} A string representing the location.
713
+ */
714
+ matchLocationFromProjectLocationCollectionDataStoreSchemaName(projectLocationCollectionDataStoreSchemaName) {
715
+ return this.pathTemplates.projectLocationCollectionDataStoreSchemaPathTemplate.match(projectLocationCollectionDataStoreSchemaName).location;
716
+ }
717
+ /**
718
+ * Parse the collection from ProjectLocationCollectionDataStoreSchema resource.
719
+ *
720
+ * @param {string} projectLocationCollectionDataStoreSchemaName
721
+ * A fully-qualified path representing project_location_collection_data_store_schema resource.
722
+ * @returns {string} A string representing the collection.
723
+ */
724
+ matchCollectionFromProjectLocationCollectionDataStoreSchemaName(projectLocationCollectionDataStoreSchemaName) {
725
+ return this.pathTemplates.projectLocationCollectionDataStoreSchemaPathTemplate.match(projectLocationCollectionDataStoreSchemaName).collection;
726
+ }
727
+ /**
728
+ * Parse the data_store from ProjectLocationCollectionDataStoreSchema resource.
729
+ *
730
+ * @param {string} projectLocationCollectionDataStoreSchemaName
731
+ * A fully-qualified path representing project_location_collection_data_store_schema resource.
732
+ * @returns {string} A string representing the data_store.
733
+ */
734
+ matchDataStoreFromProjectLocationCollectionDataStoreSchemaName(projectLocationCollectionDataStoreSchemaName) {
735
+ return this.pathTemplates.projectLocationCollectionDataStoreSchemaPathTemplate.match(projectLocationCollectionDataStoreSchemaName).data_store;
736
+ }
737
+ /**
738
+ * Parse the schema from ProjectLocationCollectionDataStoreSchema resource.
739
+ *
740
+ * @param {string} projectLocationCollectionDataStoreSchemaName
741
+ * A fully-qualified path representing project_location_collection_data_store_schema resource.
742
+ * @returns {string} A string representing the schema.
743
+ */
744
+ matchSchemaFromProjectLocationCollectionDataStoreSchemaName(projectLocationCollectionDataStoreSchemaName) {
745
+ return this.pathTemplates.projectLocationCollectionDataStoreSchemaPathTemplate.match(projectLocationCollectionDataStoreSchemaName).schema;
746
+ }
747
+ /**
748
+ * Return a fully-qualified projectLocationCollectionDataStoreServingConfig resource name string.
749
+ *
750
+ * @param {string} project
751
+ * @param {string} location
752
+ * @param {string} collection
753
+ * @param {string} data_store
754
+ * @param {string} serving_config
755
+ * @returns {string} Resource name string.
756
+ */
757
+ projectLocationCollectionDataStoreServingConfigPath(project, location, collection, dataStore, servingConfig) {
758
+ return this.pathTemplates.projectLocationCollectionDataStoreServingConfigPathTemplate.render({
759
+ project: project,
760
+ location: location,
761
+ collection: collection,
762
+ data_store: dataStore,
763
+ serving_config: servingConfig,
764
+ });
765
+ }
766
+ /**
767
+ * Parse the project from ProjectLocationCollectionDataStoreServingConfig resource.
768
+ *
769
+ * @param {string} projectLocationCollectionDataStoreServingConfigName
770
+ * A fully-qualified path representing project_location_collection_data_store_serving_config resource.
771
+ * @returns {string} A string representing the project.
772
+ */
773
+ matchProjectFromProjectLocationCollectionDataStoreServingConfigName(projectLocationCollectionDataStoreServingConfigName) {
774
+ return this.pathTemplates.projectLocationCollectionDataStoreServingConfigPathTemplate.match(projectLocationCollectionDataStoreServingConfigName).project;
775
+ }
776
+ /**
777
+ * Parse the location from ProjectLocationCollectionDataStoreServingConfig resource.
778
+ *
779
+ * @param {string} projectLocationCollectionDataStoreServingConfigName
780
+ * A fully-qualified path representing project_location_collection_data_store_serving_config resource.
781
+ * @returns {string} A string representing the location.
782
+ */
783
+ matchLocationFromProjectLocationCollectionDataStoreServingConfigName(projectLocationCollectionDataStoreServingConfigName) {
784
+ return this.pathTemplates.projectLocationCollectionDataStoreServingConfigPathTemplate.match(projectLocationCollectionDataStoreServingConfigName).location;
785
+ }
786
+ /**
787
+ * Parse the collection from ProjectLocationCollectionDataStoreServingConfig resource.
788
+ *
789
+ * @param {string} projectLocationCollectionDataStoreServingConfigName
790
+ * A fully-qualified path representing project_location_collection_data_store_serving_config resource.
791
+ * @returns {string} A string representing the collection.
792
+ */
793
+ matchCollectionFromProjectLocationCollectionDataStoreServingConfigName(projectLocationCollectionDataStoreServingConfigName) {
794
+ return this.pathTemplates.projectLocationCollectionDataStoreServingConfigPathTemplate.match(projectLocationCollectionDataStoreServingConfigName).collection;
795
+ }
796
+ /**
797
+ * Parse the data_store from ProjectLocationCollectionDataStoreServingConfig resource.
798
+ *
799
+ * @param {string} projectLocationCollectionDataStoreServingConfigName
800
+ * A fully-qualified path representing project_location_collection_data_store_serving_config resource.
801
+ * @returns {string} A string representing the data_store.
802
+ */
803
+ matchDataStoreFromProjectLocationCollectionDataStoreServingConfigName(projectLocationCollectionDataStoreServingConfigName) {
804
+ return this.pathTemplates.projectLocationCollectionDataStoreServingConfigPathTemplate.match(projectLocationCollectionDataStoreServingConfigName).data_store;
805
+ }
806
+ /**
807
+ * Parse the serving_config from ProjectLocationCollectionDataStoreServingConfig resource.
808
+ *
809
+ * @param {string} projectLocationCollectionDataStoreServingConfigName
810
+ * A fully-qualified path representing project_location_collection_data_store_serving_config resource.
811
+ * @returns {string} A string representing the serving_config.
812
+ */
813
+ matchServingConfigFromProjectLocationCollectionDataStoreServingConfigName(projectLocationCollectionDataStoreServingConfigName) {
814
+ return this.pathTemplates.projectLocationCollectionDataStoreServingConfigPathTemplate.match(projectLocationCollectionDataStoreServingConfigName).serving_config;
815
+ }
816
+ /**
817
+ * Return a fully-qualified projectLocationDataStoreBranch resource name string.
818
+ *
819
+ * @param {string} project
820
+ * @param {string} location
821
+ * @param {string} data_store
822
+ * @param {string} branch
823
+ * @returns {string} Resource name string.
824
+ */
825
+ projectLocationDataStoreBranchPath(project, location, dataStore, branch) {
826
+ return this.pathTemplates.projectLocationDataStoreBranchPathTemplate.render({
827
+ project: project,
828
+ location: location,
829
+ data_store: dataStore,
830
+ branch: branch,
831
+ });
832
+ }
833
+ /**
834
+ * Parse the project from ProjectLocationDataStoreBranch resource.
835
+ *
836
+ * @param {string} projectLocationDataStoreBranchName
837
+ * A fully-qualified path representing project_location_data_store_branch resource.
838
+ * @returns {string} A string representing the project.
839
+ */
840
+ matchProjectFromProjectLocationDataStoreBranchName(projectLocationDataStoreBranchName) {
841
+ return this.pathTemplates.projectLocationDataStoreBranchPathTemplate.match(projectLocationDataStoreBranchName).project;
842
+ }
843
+ /**
844
+ * Parse the location from ProjectLocationDataStoreBranch resource.
845
+ *
846
+ * @param {string} projectLocationDataStoreBranchName
847
+ * A fully-qualified path representing project_location_data_store_branch resource.
848
+ * @returns {string} A string representing the location.
849
+ */
850
+ matchLocationFromProjectLocationDataStoreBranchName(projectLocationDataStoreBranchName) {
851
+ return this.pathTemplates.projectLocationDataStoreBranchPathTemplate.match(projectLocationDataStoreBranchName).location;
852
+ }
853
+ /**
854
+ * Parse the data_store from ProjectLocationDataStoreBranch resource.
855
+ *
856
+ * @param {string} projectLocationDataStoreBranchName
857
+ * A fully-qualified path representing project_location_data_store_branch resource.
858
+ * @returns {string} A string representing the data_store.
859
+ */
860
+ matchDataStoreFromProjectLocationDataStoreBranchName(projectLocationDataStoreBranchName) {
861
+ return this.pathTemplates.projectLocationDataStoreBranchPathTemplate.match(projectLocationDataStoreBranchName).data_store;
862
+ }
863
+ /**
864
+ * Parse the branch from ProjectLocationDataStoreBranch resource.
865
+ *
866
+ * @param {string} projectLocationDataStoreBranchName
867
+ * A fully-qualified path representing project_location_data_store_branch resource.
868
+ * @returns {string} A string representing the branch.
869
+ */
870
+ matchBranchFromProjectLocationDataStoreBranchName(projectLocationDataStoreBranchName) {
871
+ return this.pathTemplates.projectLocationDataStoreBranchPathTemplate.match(projectLocationDataStoreBranchName).branch;
872
+ }
873
+ /**
874
+ * Return a fully-qualified projectLocationDataStoreBranchDocument resource name string.
875
+ *
876
+ * @param {string} project
877
+ * @param {string} location
878
+ * @param {string} data_store
879
+ * @param {string} branch
880
+ * @param {string} document
881
+ * @returns {string} Resource name string.
882
+ */
883
+ projectLocationDataStoreBranchDocumentPath(project, location, dataStore, branch, document) {
884
+ return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.render({
885
+ project: project,
886
+ location: location,
887
+ data_store: dataStore,
888
+ branch: branch,
889
+ document: document,
890
+ });
891
+ }
892
+ /**
893
+ * Parse the project from ProjectLocationDataStoreBranchDocument resource.
894
+ *
895
+ * @param {string} projectLocationDataStoreBranchDocumentName
896
+ * A fully-qualified path representing project_location_data_store_branch_document resource.
897
+ * @returns {string} A string representing the project.
898
+ */
899
+ matchProjectFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName) {
900
+ return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.match(projectLocationDataStoreBranchDocumentName).project;
901
+ }
902
+ /**
903
+ * Parse the location from ProjectLocationDataStoreBranchDocument resource.
904
+ *
905
+ * @param {string} projectLocationDataStoreBranchDocumentName
906
+ * A fully-qualified path representing project_location_data_store_branch_document resource.
907
+ * @returns {string} A string representing the location.
908
+ */
909
+ matchLocationFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName) {
910
+ return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.match(projectLocationDataStoreBranchDocumentName).location;
911
+ }
912
+ /**
913
+ * Parse the data_store from ProjectLocationDataStoreBranchDocument resource.
914
+ *
915
+ * @param {string} projectLocationDataStoreBranchDocumentName
916
+ * A fully-qualified path representing project_location_data_store_branch_document resource.
917
+ * @returns {string} A string representing the data_store.
918
+ */
919
+ matchDataStoreFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName) {
920
+ return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.match(projectLocationDataStoreBranchDocumentName).data_store;
921
+ }
922
+ /**
923
+ * Parse the branch from ProjectLocationDataStoreBranchDocument resource.
924
+ *
925
+ * @param {string} projectLocationDataStoreBranchDocumentName
926
+ * A fully-qualified path representing project_location_data_store_branch_document resource.
927
+ * @returns {string} A string representing the branch.
928
+ */
929
+ matchBranchFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName) {
930
+ return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.match(projectLocationDataStoreBranchDocumentName).branch;
931
+ }
932
+ /**
933
+ * Parse the document from ProjectLocationDataStoreBranchDocument resource.
934
+ *
935
+ * @param {string} projectLocationDataStoreBranchDocumentName
936
+ * A fully-qualified path representing project_location_data_store_branch_document resource.
937
+ * @returns {string} A string representing the document.
938
+ */
939
+ matchDocumentFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName) {
940
+ return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.match(projectLocationDataStoreBranchDocumentName).document;
941
+ }
942
+ /**
943
+ * Return a fully-qualified projectLocationDataStoreSchema resource name string.
944
+ *
945
+ * @param {string} project
946
+ * @param {string} location
947
+ * @param {string} data_store
948
+ * @param {string} schema
949
+ * @returns {string} Resource name string.
950
+ */
951
+ projectLocationDataStoreSchemaPath(project, location, dataStore, schema) {
952
+ return this.pathTemplates.projectLocationDataStoreSchemaPathTemplate.render({
953
+ project: project,
954
+ location: location,
955
+ data_store: dataStore,
956
+ schema: schema,
957
+ });
958
+ }
959
+ /**
960
+ * Parse the project from ProjectLocationDataStoreSchema resource.
961
+ *
962
+ * @param {string} projectLocationDataStoreSchemaName
963
+ * A fully-qualified path representing project_location_data_store_schema resource.
964
+ * @returns {string} A string representing the project.
965
+ */
966
+ matchProjectFromProjectLocationDataStoreSchemaName(projectLocationDataStoreSchemaName) {
967
+ return this.pathTemplates.projectLocationDataStoreSchemaPathTemplate.match(projectLocationDataStoreSchemaName).project;
968
+ }
969
+ /**
970
+ * Parse the location from ProjectLocationDataStoreSchema resource.
971
+ *
972
+ * @param {string} projectLocationDataStoreSchemaName
973
+ * A fully-qualified path representing project_location_data_store_schema resource.
974
+ * @returns {string} A string representing the location.
975
+ */
976
+ matchLocationFromProjectLocationDataStoreSchemaName(projectLocationDataStoreSchemaName) {
977
+ return this.pathTemplates.projectLocationDataStoreSchemaPathTemplate.match(projectLocationDataStoreSchemaName).location;
978
+ }
979
+ /**
980
+ * Parse the data_store from ProjectLocationDataStoreSchema resource.
981
+ *
982
+ * @param {string} projectLocationDataStoreSchemaName
983
+ * A fully-qualified path representing project_location_data_store_schema resource.
984
+ * @returns {string} A string representing the data_store.
985
+ */
986
+ matchDataStoreFromProjectLocationDataStoreSchemaName(projectLocationDataStoreSchemaName) {
987
+ return this.pathTemplates.projectLocationDataStoreSchemaPathTemplate.match(projectLocationDataStoreSchemaName).data_store;
988
+ }
989
+ /**
990
+ * Parse the schema from ProjectLocationDataStoreSchema resource.
991
+ *
992
+ * @param {string} projectLocationDataStoreSchemaName
993
+ * A fully-qualified path representing project_location_data_store_schema resource.
994
+ * @returns {string} A string representing the schema.
995
+ */
996
+ matchSchemaFromProjectLocationDataStoreSchemaName(projectLocationDataStoreSchemaName) {
997
+ return this.pathTemplates.projectLocationDataStoreSchemaPathTemplate.match(projectLocationDataStoreSchemaName).schema;
998
+ }
999
+ /**
1000
+ * Return a fully-qualified projectLocationDataStoreServingConfig resource name string.
1001
+ *
1002
+ * @param {string} project
1003
+ * @param {string} location
1004
+ * @param {string} data_store
1005
+ * @param {string} serving_config
1006
+ * @returns {string} Resource name string.
1007
+ */
1008
+ projectLocationDataStoreServingConfigPath(project, location, dataStore, servingConfig) {
1009
+ return this.pathTemplates.projectLocationDataStoreServingConfigPathTemplate.render({
1010
+ project: project,
1011
+ location: location,
1012
+ data_store: dataStore,
1013
+ serving_config: servingConfig,
1014
+ });
1015
+ }
1016
+ /**
1017
+ * Parse the project from ProjectLocationDataStoreServingConfig resource.
1018
+ *
1019
+ * @param {string} projectLocationDataStoreServingConfigName
1020
+ * A fully-qualified path representing project_location_data_store_serving_config resource.
1021
+ * @returns {string} A string representing the project.
1022
+ */
1023
+ matchProjectFromProjectLocationDataStoreServingConfigName(projectLocationDataStoreServingConfigName) {
1024
+ return this.pathTemplates.projectLocationDataStoreServingConfigPathTemplate.match(projectLocationDataStoreServingConfigName).project;
1025
+ }
1026
+ /**
1027
+ * Parse the location from ProjectLocationDataStoreServingConfig resource.
1028
+ *
1029
+ * @param {string} projectLocationDataStoreServingConfigName
1030
+ * A fully-qualified path representing project_location_data_store_serving_config resource.
1031
+ * @returns {string} A string representing the location.
1032
+ */
1033
+ matchLocationFromProjectLocationDataStoreServingConfigName(projectLocationDataStoreServingConfigName) {
1034
+ return this.pathTemplates.projectLocationDataStoreServingConfigPathTemplate.match(projectLocationDataStoreServingConfigName).location;
1035
+ }
1036
+ /**
1037
+ * Parse the data_store from ProjectLocationDataStoreServingConfig resource.
1038
+ *
1039
+ * @param {string} projectLocationDataStoreServingConfigName
1040
+ * A fully-qualified path representing project_location_data_store_serving_config resource.
1041
+ * @returns {string} A string representing the data_store.
1042
+ */
1043
+ matchDataStoreFromProjectLocationDataStoreServingConfigName(projectLocationDataStoreServingConfigName) {
1044
+ return this.pathTemplates.projectLocationDataStoreServingConfigPathTemplate.match(projectLocationDataStoreServingConfigName).data_store;
1045
+ }
1046
+ /**
1047
+ * Parse the serving_config from ProjectLocationDataStoreServingConfig resource.
1048
+ *
1049
+ * @param {string} projectLocationDataStoreServingConfigName
1050
+ * A fully-qualified path representing project_location_data_store_serving_config resource.
1051
+ * @returns {string} A string representing the serving_config.
1052
+ */
1053
+ matchServingConfigFromProjectLocationDataStoreServingConfigName(projectLocationDataStoreServingConfigName) {
1054
+ return this.pathTemplates.projectLocationDataStoreServingConfigPathTemplate.match(projectLocationDataStoreServingConfigName).serving_config;
1055
+ }
1056
+ /**
1057
+ * Terminate the gRPC channel and close the client.
1058
+ *
1059
+ * The client will no longer be usable and all future behavior is undefined.
1060
+ * @returns {Promise} A promise that resolves when the client is closed.
1061
+ */
1062
+ close() {
1063
+ if (this.searchServiceStub && !this._terminated) {
1064
+ return this.searchServiceStub.then(stub => {
1065
+ this._terminated = true;
1066
+ stub.close();
1067
+ });
1068
+ }
1069
+ return Promise.resolve();
1070
+ }
1071
+ }
1072
+ exports.SearchServiceClient = SearchServiceClient;
1073
+ //# sourceMappingURL=search_service_client.js.map