@@ -23,6 +23,7 @@ import {
23
23
CallOptions ,
24
24
Descriptors ,
25
25
ClientOptions ,
26
+ GrpcClientOptions ,
26
27
LROperation ,
27
28
PaginationCallback ,
28
29
GaxCall ,
@@ -75,7 +76,7 @@ export class ConversationDatasetsClient {
75
76
*
76
77
* @param {object } [options] - The configuration object.
77
78
* The options accepted by the constructor are described in detail
78
- * in [this document](https://github.com/googleapis/gax-nodejs/blob/master /client-libraries.md#creating-the-client-instance).
79
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main /client-libraries.md#creating-the-client-instance).
79
80
* The common options are:
80
81
* @param {object } [options.credentials] - Credentials object.
81
82
* @param {string } [options.credentials.client_email]
@@ -98,11 +99,10 @@ export class ConversationDatasetsClient {
98
99
* API remote host.
99
100
* @param {gax.ClientConfig } [options.clientConfig] - Client configuration override.
100
101
* Follows the structure of {@link gapicConfig}.
101
- * @param {boolean } [options.fallback] - Use HTTP fallback mode.
102
- * In fallback mode, a special browser-compatible transport implementation is used
103
- * instead of gRPC transport. In browser context (if the `window` object is defined)
104
- * the fallback mode is enabled automatically; set `options.fallback` to `false`
105
- * if you need to override this behavior.
102
+ * @param {boolean | "rest" } [options.fallback] - Use HTTP fallback mode.
103
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
104
+ * For more information, please check the
105
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
106
106
*/
107
107
constructor ( opts ?: ClientOptions ) {
108
108
// Ensure that options include all the required fields.
@@ -326,16 +326,49 @@ export class ConversationDatasetsClient {
326
326
} ;
327
327
328
328
const protoFilesRoot = this . _gaxModule . protobuf . Root . fromJSON ( jsonProtos ) ;
329
-
330
329
// This API contains "long-running operations", which return a
331
330
// an Operation object that allows for tracking of the operation,
332
331
// rather than holding a request open.
333
-
332
+ const lroOptions : GrpcClientOptions = {
333
+ auth : this . auth ,
334
+ grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
335
+ } ;
336
+ if ( opts . fallback === 'rest' ) {
337
+ lroOptions . protoJson = protoFilesRoot ;
338
+ lroOptions . httpRules = [
339
+ {
340
+ selector : 'google.cloud.location.Locations.GetLocation' ,
341
+ get : '/v2/{name=projects/*/locations/*}' ,
342
+ } ,
343
+ {
344
+ selector : 'google.cloud.location.Locations.ListLocations' ,
345
+ get : '/v2/{name=projects/*}/locations' ,
346
+ } ,
347
+ {
348
+ selector : 'google.longrunning.Operations.CancelOperation' ,
349
+ post : '/v2/{name=projects/*/operations/*}:cancel' ,
350
+ additional_bindings : [
351
+ { post : '/v2/{name=projects/*/locations/*/operations/*}:cancel' } ,
352
+ ] ,
353
+ } ,
354
+ {
355
+ selector : 'google.longrunning.Operations.GetOperation' ,
356
+ get : '/v2/{name=projects/*/operations/*}' ,
357
+ additional_bindings : [
358
+ { get : '/v2/{name=projects/*/locations/*/operations/*}' } ,
359
+ ] ,
360
+ } ,
361
+ {
362
+ selector : 'google.longrunning.Operations.ListOperations' ,
363
+ get : '/v2/{name=projects/*}/operations' ,
364
+ additional_bindings : [
365
+ { get : '/v2/{name=projects/*/locations/*}/operations' } ,
366
+ ] ,
367
+ } ,
368
+ ] ;
369
+ }
334
370
this . operationsClient = this . _gaxModule
335
- . lro ( {
336
- auth : this . auth ,
337
- grpc : 'grpc' in this . _gaxGrpc ? this . _gaxGrpc . grpc : undefined ,
338
- } )
371
+ . lro ( lroOptions )
339
372
. operationsClient ( opts ) ;
340
373
const createConversationDatasetResponse = protoFilesRoot . lookup (
341
374
'.google.cloud.dialogflow.v2.ConversationDataset'
0 commit comments