@google-cloud/discoveryengine 0.8.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +13 -1
  3. package/build/protos/google/cloud/discoveryengine/v1/common.proto +30 -2
  4. package/build/protos/google/cloud/discoveryengine/v1/completion_service.proto +15 -2
  5. package/build/protos/google/cloud/discoveryengine/v1/conversation.proto +114 -0
  6. package/build/protos/google/cloud/discoveryengine/v1/conversational_search_service.proto +303 -0
  7. package/build/protos/google/cloud/discoveryengine/v1/document.proto +8 -5
  8. package/build/protos/google/cloud/discoveryengine/v1/document_service.proto +4 -3
  9. package/build/protos/google/cloud/discoveryengine/v1/import_config.proto +27 -23
  10. package/build/protos/google/cloud/discoveryengine/v1/schema.proto +1 -1
  11. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +428 -20
  12. package/build/protos/google/cloud/discoveryengine/v1/user_event.proto +48 -39
  13. package/build/protos/google/cloud/discoveryengine/v1/user_event_service.proto +2 -2
  14. package/build/protos/google/cloud/discoveryengine/v1beta/common.proto +7 -2
  15. package/build/protos/google/cloud/discoveryengine/v1beta/completion_service.proto +13 -2
  16. package/build/protos/google/cloud/discoveryengine/v1beta/conversation.proto +138 -0
  17. package/build/protos/google/cloud/discoveryengine/v1beta/conversational_search_service.proto +306 -0
  18. package/build/protos/google/cloud/discoveryengine/v1beta/document.proto +2 -4
  19. package/build/protos/google/cloud/discoveryengine/v1beta/document_service.proto +2 -1
  20. package/build/protos/google/cloud/discoveryengine/v1beta/import_config.proto +17 -17
  21. package/build/protos/google/cloud/discoveryengine/v1beta/schema.proto +1 -1
  22. package/build/protos/google/cloud/discoveryengine/v1beta/search_service.proto +276 -64
  23. package/build/protos/google/cloud/discoveryengine/v1beta/user_event.proto +45 -36
  24. package/build/protos/google/cloud/discoveryengine/v1beta/user_event_service.proto +2 -2
  25. package/build/protos/protos.d.ts +13913 -8367
  26. package/build/protos/protos.js +36766 -22883
  27. package/build/protos/protos.json +3956 -2571
  28. package/build/src/index.d.ts +4 -1
  29. package/build/src/index.js +4 -1
  30. package/build/src/v1/completion_service_client.d.ts +161 -12
  31. package/build/src/v1/completion_service_client.js +188 -4
  32. package/build/src/v1/conversational_search_service_client.d.ts +947 -0
  33. package/build/src/v1/conversational_search_service_client.js +1205 -0
  34. package/build/src/v1/conversational_search_service_client_config.json +68 -0
  35. package/build/src/v1/document_service_client.d.ts +245 -109
  36. package/build/src/v1/document_service_client.js +231 -31
  37. package/build/src/v1/index.d.ts +1 -0
  38. package/build/src/v1/index.js +3 -1
  39. package/build/src/v1/schema_service_client.d.ts +187 -53
  40. package/build/src/v1/schema_service_client.js +224 -27
  41. package/build/src/v1/search_service_client.d.ts +266 -59
  42. package/build/src/v1/search_service_client.js +267 -41
  43. package/build/src/v1/user_event_service_client.d.ts +159 -19
  44. package/build/src/v1/user_event_service_client.js +208 -7
  45. package/build/src/v1beta/completion_service_client.d.ts +159 -12
  46. package/build/src/v1beta/completion_service_client.js +188 -4
  47. package/build/src/v1beta/conversational_search_service_client.d.ts +947 -0
  48. package/build/src/v1beta/conversational_search_service_client.js +1205 -0
  49. package/build/src/v1beta/conversational_search_service_client_config.json +68 -0
  50. package/build/src/v1beta/document_service_client.d.ts +237 -101
  51. package/build/src/v1beta/document_service_client.js +227 -27
  52. package/build/src/v1beta/index.d.ts +1 -0
  53. package/build/src/v1beta/index.js +3 -1
  54. package/build/src/v1beta/recommendation_service_client.d.ts +158 -15
  55. package/build/src/v1beta/recommendation_service_client.js +188 -4
  56. package/build/src/v1beta/schema_service_client.d.ts +187 -53
  57. package/build/src/v1beta/schema_service_client.js +224 -27
  58. package/build/src/v1beta/search_service_client.d.ts +305 -71
  59. package/build/src/v1beta/search_service_client.js +293 -49
  60. package/build/src/v1beta/user_event_service_client.d.ts +156 -16
  61. package/build/src/v1beta/user_event_service_client.js +208 -7
  62. package/package.json +10 -13
@@ -2,6 +2,8 @@ import * as v1 from './v1';
2
2
  import * as v1beta from './v1beta';
3
3
  declare const CompletionServiceClient: typeof v1.CompletionServiceClient;
4
4
  type CompletionServiceClient = v1.CompletionServiceClient;
5
+ declare const ConversationalSearchServiceClient: typeof v1.ConversationalSearchServiceClient;
6
+ type ConversationalSearchServiceClient = v1.ConversationalSearchServiceClient;
5
7
  declare const DocumentServiceClient: typeof v1.DocumentServiceClient;
6
8
  type DocumentServiceClient = v1.DocumentServiceClient;
7
9
  declare const SchemaServiceClient: typeof v1.SchemaServiceClient;
@@ -10,11 +12,12 @@ declare const SearchServiceClient: typeof v1.SearchServiceClient;
10
12
  type SearchServiceClient = v1.SearchServiceClient;
11
13
  declare const UserEventServiceClient: typeof v1.UserEventServiceClient;
12
14
  type UserEventServiceClient = v1.UserEventServiceClient;
13
- export { v1, v1beta, CompletionServiceClient, DocumentServiceClient, SchemaServiceClient, SearchServiceClient, UserEventServiceClient, };
15
+ export { v1, v1beta, CompletionServiceClient, ConversationalSearchServiceClient, DocumentServiceClient, SchemaServiceClient, SearchServiceClient, UserEventServiceClient, };
14
16
  declare const _default: {
15
17
  v1: typeof v1;
16
18
  v1beta: typeof v1beta;
17
19
  CompletionServiceClient: typeof v1.CompletionServiceClient;
20
+ ConversationalSearchServiceClient: typeof v1.ConversationalSearchServiceClient;
18
21
  DocumentServiceClient: typeof v1.DocumentServiceClient;
19
22
  SchemaServiceClient: typeof v1.SchemaServiceClient;
20
23
  SearchServiceClient: typeof v1.SearchServiceClient;
@@ -17,13 +17,15 @@
17
17
  // ** https://github.com/googleapis/synthtool **
18
18
  // ** All changes to this file may be overwritten. **
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.protos = exports.UserEventServiceClient = exports.SearchServiceClient = exports.SchemaServiceClient = exports.DocumentServiceClient = exports.CompletionServiceClient = exports.v1beta = exports.v1 = void 0;
20
+ exports.protos = exports.UserEventServiceClient = exports.SearchServiceClient = exports.SchemaServiceClient = exports.DocumentServiceClient = exports.ConversationalSearchServiceClient = exports.CompletionServiceClient = exports.v1beta = exports.v1 = void 0;
21
21
  const v1 = require("./v1");
22
22
  exports.v1 = v1;
23
23
  const v1beta = require("./v1beta");
24
24
  exports.v1beta = v1beta;
25
25
  const CompletionServiceClient = v1.CompletionServiceClient;
26
26
  exports.CompletionServiceClient = CompletionServiceClient;
27
+ const ConversationalSearchServiceClient = v1.ConversationalSearchServiceClient;
28
+ exports.ConversationalSearchServiceClient = ConversationalSearchServiceClient;
27
29
  const DocumentServiceClient = v1.DocumentServiceClient;
28
30
  exports.DocumentServiceClient = DocumentServiceClient;
29
31
  const SchemaServiceClient = v1.SchemaServiceClient;
@@ -36,6 +38,7 @@ exports.default = {
36
38
  v1,
37
39
  v1beta,
38
40
  CompletionServiceClient,
41
+ ConversationalSearchServiceClient,
39
42
  DocumentServiceClient,
40
43
  SchemaServiceClient,
41
44
  SearchServiceClient,
@@ -1,5 +1,5 @@
1
1
  import type * as gax from 'google-gax';
2
- import type { Callback, CallOptions, Descriptors, ClientOptions } from 'google-gax';
2
+ import type { Callback, CallOptions, Descriptors, ClientOptions, LocationsClient, LocationProtos } from 'google-gax';
3
3
  import * as protos from '../../protos/protos';
4
4
  /**
5
5
  * Service for Auto-Completion.
@@ -20,6 +20,7 @@ export declare class CompletionServiceClient {
20
20
  innerApiCalls: {
21
21
  [name: string]: Function;
22
22
  };
23
+ locationsClient: LocationsClient;
23
24
  pathTemplates: {
24
25
  [name: string]: gax.PathTemplate;
25
26
  };
@@ -54,8 +55,7 @@ export declare class CompletionServiceClient {
54
55
  * API remote host.
55
56
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
56
57
  * Follows the structure of {@link gapicConfig}.
57
- * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
58
- * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
58
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
59
59
  * For more information, please check the
60
60
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
61
61
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -63,7 +63,7 @@ export declare class CompletionServiceClient {
63
63
  * HTTP implementation. Load only fallback version and pass it to the constructor:
64
64
  * ```
65
65
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
66
- * const client = new CompletionServiceClient({fallback: 'rest'}, gax);
66
+ * const client = new CompletionServiceClient({fallback: true}, gax);
67
67
  * ```
68
68
  */
69
69
  constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
@@ -123,17 +123,18 @@ export declare class CompletionServiceClient {
123
123
  *
124
124
  * * `document` - Using suggestions generated from user-imported documents.
125
125
  * * `search-history` - Using suggestions generated from the past history of
126
- * {@link google.cloud.discoveryengine.v1.SearchService.Search|SearchService.Search}
126
+ * {@link protos.google.cloud.discoveryengine.v1.SearchService.Search|SearchService.Search}
127
127
  * API calls. Do not use it when there is no traffic for Search API.
128
128
  * * `user-event` - Using suggestions generated from user-imported search
129
129
  * events.
130
+ * * `document-completable` - Using suggestions taken directly from
131
+ * user-imported document fields marked as completable.
130
132
  *
131
133
  * Default values:
132
134
  *
133
135
  * * `document` is the default model for regular dataStores.
134
136
  * * `search-history` is the default model for
135
- * {@link google.cloud.discoveryengine.v1.IndustryVertical.SITE_SEARCH|IndustryVertical.SITE_SEARCH}
136
- * dataStores.
137
+ * {@link protos.|IndustryVertical.SITE_SEARCH} dataStores.
137
138
  * @param {string} request.userPseudoId
138
139
  * A unique identifier for tracking visitors. For example, this could be
139
140
  * implemented with an HTTP cookie, which should be able to uniquely identify
@@ -143,18 +144,22 @@ export declare class CompletionServiceClient {
143
144
  * This field should NOT have a fixed value such as `unknown_visitor`.
144
145
  *
145
146
  * This should be the same identifier as
146
- * {@link google.cloud.discoveryengine.v1.UserEvent.user_pseudo_id|UserEvent.user_pseudo_id}
147
+ * {@link protos.google.cloud.discoveryengine.v1.UserEvent.user_pseudo_id|UserEvent.user_pseudo_id}
147
148
  * and
148
- * {@link google.cloud.discoveryengine.v1.SearchRequest.user_pseudo_id|SearchRequest.user_pseudo_id}.
149
+ * {@link protos.google.cloud.discoveryengine.v1.SearchRequest.user_pseudo_id|SearchRequest.user_pseudo_id}.
149
150
  *
150
151
  * The field must be a UTF-8 encoded string with a length limit of 128
151
152
  * characters. Otherwise, an `INVALID_ARGUMENT` error is returned.
153
+ * @param {boolean} request.includeTailSuggestions
154
+ * Indicates if tail suggestions should be returned if there are no
155
+ * suggestions that match the full query. Even if set to true, if there are
156
+ * suggestions that match the full query, those are returned and no
157
+ * tail suggestions are returned.
152
158
  * @param {object} [options]
153
159
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
154
160
  * @returns {Promise} - The promise which resolves to an array.
155
- * The first element of the array is an object representing {@link google.cloud.discoveryengine.v1.CompleteQueryResponse | CompleteQueryResponse}.
156
- * Please see the
157
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
161
+ * The first element of the array is an object representing {@link protos.google.cloud.discoveryengine.v1.CompleteQueryResponse|CompleteQueryResponse}.
162
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
158
163
  * for more details and examples.
159
164
  * @example <caption>include:samples/generated/v1/completion_service.complete_query.js</caption>
160
165
  * region_tag:discoveryengine_v1_generated_CompletionService_CompleteQuery_async
@@ -166,6 +171,57 @@ export declare class CompletionServiceClient {
166
171
  ]>;
167
172
  completeQuery(request: protos.google.cloud.discoveryengine.v1.ICompleteQueryRequest, options: CallOptions, callback: Callback<protos.google.cloud.discoveryengine.v1.ICompleteQueryResponse, protos.google.cloud.discoveryengine.v1.ICompleteQueryRequest | null | undefined, {} | null | undefined>): void;
168
173
  completeQuery(request: protos.google.cloud.discoveryengine.v1.ICompleteQueryRequest, callback: Callback<protos.google.cloud.discoveryengine.v1.ICompleteQueryResponse, protos.google.cloud.discoveryengine.v1.ICompleteQueryRequest | null | undefined, {} | null | undefined>): void;
174
+ /**
175
+ * Gets information about a location.
176
+ *
177
+ * @param {Object} request
178
+ * The request object that will be sent.
179
+ * @param {string} request.name
180
+ * Resource name for the location.
181
+ * @param {object} [options]
182
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
183
+ * @returns {Promise} - The promise which resolves to an array.
184
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
185
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
186
+ * for more details and examples.
187
+ * @example
188
+ * ```
189
+ * const [response] = await client.getLocation(request);
190
+ * ```
191
+ */
192
+ getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;
193
+ /**
194
+ * Lists information about the supported locations for this service. Returns an iterable object.
195
+ *
196
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
197
+ * @param {Object} request
198
+ * The request object that will be sent.
199
+ * @param {string} request.name
200
+ * The resource that owns the locations collection, if applicable.
201
+ * @param {string} request.filter
202
+ * The standard list filter.
203
+ * @param {number} request.pageSize
204
+ * The standard list page size.
205
+ * @param {string} request.pageToken
206
+ * The standard list page token.
207
+ * @param {object} [options]
208
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
209
+ * @returns {Object}
210
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
211
+ * When you iterate the returned iterable, each element will be an object representing
212
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
213
+ * so you can stop the iteration when you don't need more results.
214
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
215
+ * for more details and examples.
216
+ * @example
217
+ * ```
218
+ * const iterable = client.listLocationsAsync(request);
219
+ * for await (const response of iterable) {
220
+ * // process response
221
+ * }
222
+ * ```
223
+ */
224
+ listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;
169
225
  /**
170
226
  * Return a fully-qualified projectLocationCollectionDataStore resource name string.
171
227
  *
@@ -268,6 +324,57 @@ export declare class CompletionServiceClient {
268
324
  * @returns {string} A string representing the document.
269
325
  */
270
326
  matchDocumentFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName: string): string | number;
327
+ /**
328
+ * Return a fully-qualified projectLocationCollectionDataStoreConversation resource name string.
329
+ *
330
+ * @param {string} project
331
+ * @param {string} location
332
+ * @param {string} collection
333
+ * @param {string} data_store
334
+ * @param {string} conversation
335
+ * @returns {string} Resource name string.
336
+ */
337
+ projectLocationCollectionDataStoreConversationPath(project: string, location: string, collection: string, dataStore: string, conversation: string): string;
338
+ /**
339
+ * Parse the project from ProjectLocationCollectionDataStoreConversation resource.
340
+ *
341
+ * @param {string} projectLocationCollectionDataStoreConversationName
342
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
343
+ * @returns {string} A string representing the project.
344
+ */
345
+ matchProjectFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName: string): string | number;
346
+ /**
347
+ * Parse the location from ProjectLocationCollectionDataStoreConversation resource.
348
+ *
349
+ * @param {string} projectLocationCollectionDataStoreConversationName
350
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
351
+ * @returns {string} A string representing the location.
352
+ */
353
+ matchLocationFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName: string): string | number;
354
+ /**
355
+ * Parse the collection from ProjectLocationCollectionDataStoreConversation resource.
356
+ *
357
+ * @param {string} projectLocationCollectionDataStoreConversationName
358
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
359
+ * @returns {string} A string representing the collection.
360
+ */
361
+ matchCollectionFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName: string): string | number;
362
+ /**
363
+ * Parse the data_store from ProjectLocationCollectionDataStoreConversation resource.
364
+ *
365
+ * @param {string} projectLocationCollectionDataStoreConversationName
366
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
367
+ * @returns {string} A string representing the data_store.
368
+ */
369
+ matchDataStoreFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName: string): string | number;
370
+ /**
371
+ * Parse the conversation from ProjectLocationCollectionDataStoreConversation resource.
372
+ *
373
+ * @param {string} projectLocationCollectionDataStoreConversationName
374
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
375
+ * @returns {string} A string representing the conversation.
376
+ */
377
+ matchConversationFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName: string): string | number;
271
378
  /**
272
379
  * Return a fully-qualified projectLocationCollectionDataStoreSchema resource name string.
273
380
  *
@@ -403,6 +510,48 @@ export declare class CompletionServiceClient {
403
510
  * @returns {string} A string representing the document.
404
511
  */
405
512
  matchDocumentFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName: string): string | number;
513
+ /**
514
+ * Return a fully-qualified projectLocationDataStoreConversation resource name string.
515
+ *
516
+ * @param {string} project
517
+ * @param {string} location
518
+ * @param {string} data_store
519
+ * @param {string} conversation
520
+ * @returns {string} Resource name string.
521
+ */
522
+ projectLocationDataStoreConversationPath(project: string, location: string, dataStore: string, conversation: string): string;
523
+ /**
524
+ * Parse the project from ProjectLocationDataStoreConversation resource.
525
+ *
526
+ * @param {string} projectLocationDataStoreConversationName
527
+ * A fully-qualified path representing project_location_data_store_conversation resource.
528
+ * @returns {string} A string representing the project.
529
+ */
530
+ matchProjectFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName: string): string | number;
531
+ /**
532
+ * Parse the location from ProjectLocationDataStoreConversation resource.
533
+ *
534
+ * @param {string} projectLocationDataStoreConversationName
535
+ * A fully-qualified path representing project_location_data_store_conversation resource.
536
+ * @returns {string} A string representing the location.
537
+ */
538
+ matchLocationFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName: string): string | number;
539
+ /**
540
+ * Parse the data_store from ProjectLocationDataStoreConversation resource.
541
+ *
542
+ * @param {string} projectLocationDataStoreConversationName
543
+ * A fully-qualified path representing project_location_data_store_conversation resource.
544
+ * @returns {string} A string representing the data_store.
545
+ */
546
+ matchDataStoreFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName: string): string | number;
547
+ /**
548
+ * Parse the conversation from ProjectLocationDataStoreConversation resource.
549
+ *
550
+ * @param {string} projectLocationDataStoreConversationName
551
+ * A fully-qualified path representing project_location_data_store_conversation resource.
552
+ * @returns {string} A string representing the conversation.
553
+ */
554
+ matchConversationFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName: string): string | number;
406
555
  /**
407
556
  * Return a fully-qualified projectLocationDataStoreSchema resource name string.
408
557
  *
@@ -60,8 +60,7 @@ class CompletionServiceClient {
60
60
  * API remote host.
61
61
  * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
62
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.
63
+ * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
65
64
  * For more information, please check the
66
65
  * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
67
66
  * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
@@ -69,7 +68,7 @@ class CompletionServiceClient {
69
68
  * HTTP implementation. Load only fallback version and pass it to the constructor:
70
69
  * ```
71
70
  * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
72
- * const client = new CompletionServiceClient({fallback: 'rest'}, gax);
71
+ * const client = new CompletionServiceClient({fallback: true}, gax);
73
72
  * ```
74
73
  */
75
74
  constructor(opts, gaxInstance) {
@@ -115,6 +114,7 @@ class CompletionServiceClient {
115
114
  if (servicePath === staticMembers.servicePath) {
116
115
  this.auth.defaultScopes = staticMembers.scopes;
117
116
  }
117
+ this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
118
118
  // Determine the client header string.
119
119
  const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
120
120
  if (typeof process !== 'undefined' && 'versions' in process) {
@@ -126,7 +126,7 @@ class CompletionServiceClient {
126
126
  if (!opts.fallback) {
127
127
  clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
128
128
  }
129
- else if (opts.fallback === 'rest') {
129
+ else {
130
130
  clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
131
131
  }
132
132
  if (opts.libName && opts.libVersion) {
@@ -140,9 +140,11 @@ class CompletionServiceClient {
140
140
  this.pathTemplates = {
141
141
  projectLocationCollectionDataStorePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}'),
142
142
  projectLocationCollectionDataStoreBranchDocumentPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}'),
143
+ projectLocationCollectionDataStoreConversationPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/conversations/{conversation}'),
143
144
  projectLocationCollectionDataStoreSchemaPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}'),
144
145
  projectLocationDataStorePathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}'),
145
146
  projectLocationDataStoreBranchDocumentPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}'),
147
+ projectLocationDataStoreConversationPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/conversations/{conversation}'),
146
148
  projectLocationDataStoreSchemaPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/dataStores/{data_store}/schemas/{schema}'),
147
149
  };
148
150
  // Put together the default options sent with requests.
@@ -258,6 +260,61 @@ class CompletionServiceClient {
258
260
  this.initialize();
259
261
  return this.innerApiCalls.completeQuery(request, options, callback);
260
262
  }
263
+ /**
264
+ * Gets information about a location.
265
+ *
266
+ * @param {Object} request
267
+ * The request object that will be sent.
268
+ * @param {string} request.name
269
+ * Resource name for the location.
270
+ * @param {object} [options]
271
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
272
+ * @returns {Promise} - The promise which resolves to an array.
273
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
274
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
275
+ * for more details and examples.
276
+ * @example
277
+ * ```
278
+ * const [response] = await client.getLocation(request);
279
+ * ```
280
+ */
281
+ getLocation(request, options, callback) {
282
+ return this.locationsClient.getLocation(request, options, callback);
283
+ }
284
+ /**
285
+ * Lists information about the supported locations for this service. Returns an iterable object.
286
+ *
287
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
288
+ * @param {Object} request
289
+ * The request object that will be sent.
290
+ * @param {string} request.name
291
+ * The resource that owns the locations collection, if applicable.
292
+ * @param {string} request.filter
293
+ * The standard list filter.
294
+ * @param {number} request.pageSize
295
+ * The standard list page size.
296
+ * @param {string} request.pageToken
297
+ * The standard list page token.
298
+ * @param {object} [options]
299
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
300
+ * @returns {Object}
301
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
302
+ * When you iterate the returned iterable, each element will be an object representing
303
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
304
+ * so you can stop the iteration when you don't need more results.
305
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
306
+ * for more details and examples.
307
+ * @example
308
+ * ```
309
+ * const iterable = client.listLocationsAsync(request);
310
+ * for await (const response of iterable) {
311
+ * // process response
312
+ * }
313
+ * ```
314
+ */
315
+ listLocationsAsync(request, options) {
316
+ return this.locationsClient.listLocationsAsync(request, options);
317
+ }
261
318
  // --------------------
262
319
  // -- Path templates --
263
320
  // --------------------
@@ -399,6 +456,75 @@ class CompletionServiceClient {
399
456
  matchDocumentFromProjectLocationCollectionDataStoreBranchDocumentName(projectLocationCollectionDataStoreBranchDocumentName) {
400
457
  return this.pathTemplates.projectLocationCollectionDataStoreBranchDocumentPathTemplate.match(projectLocationCollectionDataStoreBranchDocumentName).document;
401
458
  }
459
+ /**
460
+ * Return a fully-qualified projectLocationCollectionDataStoreConversation resource name string.
461
+ *
462
+ * @param {string} project
463
+ * @param {string} location
464
+ * @param {string} collection
465
+ * @param {string} data_store
466
+ * @param {string} conversation
467
+ * @returns {string} Resource name string.
468
+ */
469
+ projectLocationCollectionDataStoreConversationPath(project, location, collection, dataStore, conversation) {
470
+ return this.pathTemplates.projectLocationCollectionDataStoreConversationPathTemplate.render({
471
+ project: project,
472
+ location: location,
473
+ collection: collection,
474
+ data_store: dataStore,
475
+ conversation: conversation,
476
+ });
477
+ }
478
+ /**
479
+ * Parse the project from ProjectLocationCollectionDataStoreConversation resource.
480
+ *
481
+ * @param {string} projectLocationCollectionDataStoreConversationName
482
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
483
+ * @returns {string} A string representing the project.
484
+ */
485
+ matchProjectFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName) {
486
+ return this.pathTemplates.projectLocationCollectionDataStoreConversationPathTemplate.match(projectLocationCollectionDataStoreConversationName).project;
487
+ }
488
+ /**
489
+ * Parse the location from ProjectLocationCollectionDataStoreConversation resource.
490
+ *
491
+ * @param {string} projectLocationCollectionDataStoreConversationName
492
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
493
+ * @returns {string} A string representing the location.
494
+ */
495
+ matchLocationFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName) {
496
+ return this.pathTemplates.projectLocationCollectionDataStoreConversationPathTemplate.match(projectLocationCollectionDataStoreConversationName).location;
497
+ }
498
+ /**
499
+ * Parse the collection from ProjectLocationCollectionDataStoreConversation resource.
500
+ *
501
+ * @param {string} projectLocationCollectionDataStoreConversationName
502
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
503
+ * @returns {string} A string representing the collection.
504
+ */
505
+ matchCollectionFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName) {
506
+ return this.pathTemplates.projectLocationCollectionDataStoreConversationPathTemplate.match(projectLocationCollectionDataStoreConversationName).collection;
507
+ }
508
+ /**
509
+ * Parse the data_store from ProjectLocationCollectionDataStoreConversation resource.
510
+ *
511
+ * @param {string} projectLocationCollectionDataStoreConversationName
512
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
513
+ * @returns {string} A string representing the data_store.
514
+ */
515
+ matchDataStoreFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName) {
516
+ return this.pathTemplates.projectLocationCollectionDataStoreConversationPathTemplate.match(projectLocationCollectionDataStoreConversationName).data_store;
517
+ }
518
+ /**
519
+ * Parse the conversation from ProjectLocationCollectionDataStoreConversation resource.
520
+ *
521
+ * @param {string} projectLocationCollectionDataStoreConversationName
522
+ * A fully-qualified path representing project_location_collection_data_store_conversation resource.
523
+ * @returns {string} A string representing the conversation.
524
+ */
525
+ matchConversationFromProjectLocationCollectionDataStoreConversationName(projectLocationCollectionDataStoreConversationName) {
526
+ return this.pathTemplates.projectLocationCollectionDataStoreConversationPathTemplate.match(projectLocationCollectionDataStoreConversationName).conversation;
527
+ }
402
528
  /**
403
529
  * Return a fully-qualified projectLocationCollectionDataStoreSchema resource name string.
404
530
  *
@@ -582,6 +708,63 @@ class CompletionServiceClient {
582
708
  matchDocumentFromProjectLocationDataStoreBranchDocumentName(projectLocationDataStoreBranchDocumentName) {
583
709
  return this.pathTemplates.projectLocationDataStoreBranchDocumentPathTemplate.match(projectLocationDataStoreBranchDocumentName).document;
584
710
  }
711
+ /**
712
+ * Return a fully-qualified projectLocationDataStoreConversation resource name string.
713
+ *
714
+ * @param {string} project
715
+ * @param {string} location
716
+ * @param {string} data_store
717
+ * @param {string} conversation
718
+ * @returns {string} Resource name string.
719
+ */
720
+ projectLocationDataStoreConversationPath(project, location, dataStore, conversation) {
721
+ return this.pathTemplates.projectLocationDataStoreConversationPathTemplate.render({
722
+ project: project,
723
+ location: location,
724
+ data_store: dataStore,
725
+ conversation: conversation,
726
+ });
727
+ }
728
+ /**
729
+ * Parse the project from ProjectLocationDataStoreConversation resource.
730
+ *
731
+ * @param {string} projectLocationDataStoreConversationName
732
+ * A fully-qualified path representing project_location_data_store_conversation resource.
733
+ * @returns {string} A string representing the project.
734
+ */
735
+ matchProjectFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName) {
736
+ return this.pathTemplates.projectLocationDataStoreConversationPathTemplate.match(projectLocationDataStoreConversationName).project;
737
+ }
738
+ /**
739
+ * Parse the location from ProjectLocationDataStoreConversation resource.
740
+ *
741
+ * @param {string} projectLocationDataStoreConversationName
742
+ * A fully-qualified path representing project_location_data_store_conversation resource.
743
+ * @returns {string} A string representing the location.
744
+ */
745
+ matchLocationFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName) {
746
+ return this.pathTemplates.projectLocationDataStoreConversationPathTemplate.match(projectLocationDataStoreConversationName).location;
747
+ }
748
+ /**
749
+ * Parse the data_store from ProjectLocationDataStoreConversation resource.
750
+ *
751
+ * @param {string} projectLocationDataStoreConversationName
752
+ * A fully-qualified path representing project_location_data_store_conversation resource.
753
+ * @returns {string} A string representing the data_store.
754
+ */
755
+ matchDataStoreFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName) {
756
+ return this.pathTemplates.projectLocationDataStoreConversationPathTemplate.match(projectLocationDataStoreConversationName).data_store;
757
+ }
758
+ /**
759
+ * Parse the conversation from ProjectLocationDataStoreConversation resource.
760
+ *
761
+ * @param {string} projectLocationDataStoreConversationName
762
+ * A fully-qualified path representing project_location_data_store_conversation resource.
763
+ * @returns {string} A string representing the conversation.
764
+ */
765
+ matchConversationFromProjectLocationDataStoreConversationName(projectLocationDataStoreConversationName) {
766
+ return this.pathTemplates.projectLocationDataStoreConversationPathTemplate.match(projectLocationDataStoreConversationName).conversation;
767
+ }
585
768
  /**
586
769
  * Return a fully-qualified projectLocationDataStoreSchema resource name string.
587
770
  *
@@ -650,6 +833,7 @@ class CompletionServiceClient {
650
833
  return this.completionServiceStub.then(stub => {
651
834
  this._terminated = true;
652
835
  stub.close();
836
+ this.locationsClient.close();
653
837
  });
654
838
  }
655
839
  return Promise.resolve();