Module: Google::Cloud::Dialogflow

Defined in:
lib/google/cloud/dialogflow.rb,
lib/google/cloud/dialogflow/version.rb

Constant Summary collapse

VERSION =
"1.6.0".freeze

Class Method Summary collapse

Class Method Details

.agents(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Agents.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Agents::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Agents service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Agents

Service for managing Agents.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/google/cloud/dialogflow.rb', line 69

def self.agents version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Agents)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.answer_records(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for AnswerRecords.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::AnswerRecords::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the AnswerRecords service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About AnswerRecords

Service for managing AnswerRecords.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



312
313
314
315
316
317
318
319
320
321
322
# File 'lib/google/cloud/dialogflow.rb', line 312

def self.answer_records version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:AnswerRecords)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.configure {|::Google::Cloud.configure.dialogflow| ... } ⇒ ::Google::Cloud::Config

Configure the google-cloud-dialogflow library.

The following configuration parameters are supported:

  • credentials (type: String, Hash, Google::Auth::Credentials) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.
  • lib_name (type: String) - The library name as recorded in instrumentation and logging.
  • lib_version (type: String) - The library version as recorded in instrumentation and logging.
  • interceptors (type: Array<GRPC::ClientInterceptor>) - An array of interceptors that are run before calls are executed.
  • timeout (type: Numeric) - Default timeout in seconds.
  • metadata (type: Hash{Symbol=>String}) - Additional headers to be sent with the call.
  • retry_policy (type: Hash) - The retry policy. The value is a hash with the following keys:
    • :initial_delay (type: Numeric) - The initial delay in seconds.
    • :max_delay (type: Numeric) - The max delay in seconds.
    • :multiplier (type: Numeric) - The incremental backoff multiplier.
    • :retry_codes (type: Array<String>) - The error codes that should trigger a retry.

Yields:

Returns:

  • (::Google::Cloud::Config)

    The default configuration used by this library



665
666
667
668
669
# File 'lib/google/cloud/dialogflow.rb', line 665

def self.configure
  yield ::Google::Cloud.configure.dialogflow if block_given?

  ::Google::Cloud.configure.dialogflow
end

.contexts(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Contexts.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Contexts::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Contexts service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Contexts

Service for managing Contexts.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



103
104
105
106
107
108
109
110
111
112
113
# File 'lib/google/cloud/dialogflow.rb', line 103

def self.contexts version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Contexts)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.conversation_datasets(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ConversationDatasets.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::ConversationDatasets::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ConversationDatasets service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About ConversationDatasets

Conversation datasets.

Conversation datasets contain raw conversation files and their customizable metadata that can be used for model training.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



384
385
386
387
388
389
390
391
392
393
394
# File 'lib/google/cloud/dialogflow.rb', line 384

def self.conversation_datasets version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:ConversationDatasets)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.conversation_models(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ConversationModels.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::ConversationModels::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ConversationModels service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About ConversationModels

Manages a collection of models for human agent assistant.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



418
419
420
421
422
423
424
425
426
427
428
# File 'lib/google/cloud/dialogflow.rb', line 418

def self.conversation_models version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:ConversationModels)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.conversation_profiles(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ConversationProfiles.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::ConversationProfiles::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ConversationProfiles service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About ConversationProfiles

Service for managing ConversationProfiles.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



453
454
455
456
457
458
459
460
461
462
463
# File 'lib/google/cloud/dialogflow.rb', line 453

def self.conversation_profiles version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:ConversationProfiles)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.conversations(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Conversations.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Conversations::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Conversations service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Conversations

Service for managing Conversations.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



347
348
349
350
351
352
353
354
355
356
357
# File 'lib/google/cloud/dialogflow.rb', line 347

def self.conversations version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Conversations)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.documents(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Documents.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Documents::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Documents service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Documents

Service for managing knowledge Documents.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



488
489
490
491
492
493
494
495
496
497
498
# File 'lib/google/cloud/dialogflow.rb', line 488

def self.documents version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Documents)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.entity_types(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for EntityTypes.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::EntityTypes::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the EntityTypes service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About EntityTypes

Service for managing EntityTypes.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



171
172
173
174
175
176
177
178
179
180
181
# File 'lib/google/cloud/dialogflow.rb', line 171

def self.entity_types version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:EntityTypes)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.environments(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Environments.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Environments::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Environments service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Environments

Service for managing Environments.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



556
557
558
559
560
561
562
563
564
565
566
# File 'lib/google/cloud/dialogflow.rb', line 556

def self.environments version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Environments)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.fulfillments(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Fulfillments.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Fulfillments::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Fulfillments service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Fulfillments

Service for managing Fulfillments.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



522
523
524
525
526
527
528
529
530
531
532
# File 'lib/google/cloud/dialogflow.rb', line 522

def self.fulfillments version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Fulfillments)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.intents(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Intents.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Intents::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Intents service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Intents

Service for managing Intents.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



137
138
139
140
141
142
143
144
145
146
147
# File 'lib/google/cloud/dialogflow.rb', line 137

def self.intents version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Intents)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.knowledge_bases(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for KnowledgeBases.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::KnowledgeBases::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the KnowledgeBases service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About KnowledgeBases

Service for managing KnowledgeBases.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



591
592
593
594
595
596
597
598
599
600
601
# File 'lib/google/cloud/dialogflow.rb', line 591

def self.knowledge_bases version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:KnowledgeBases)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.participants(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Participants.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Participants::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Participants service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Participants

Service for managing Participants.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



277
278
279
280
281
282
283
284
285
286
287
# File 'lib/google/cloud/dialogflow.rb', line 277

def self.participants version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Participants)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.session_entity_types(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for SessionEntityTypes.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::SessionEntityTypes::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the SessionEntityTypes service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About SessionEntityTypes

Service for managing SessionEntityTypes.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



206
207
208
209
210
211
212
213
214
215
216
# File 'lib/google/cloud/dialogflow.rb', line 206

def self.session_entity_types version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:SessionEntityTypes)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.sessions(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Sessions.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Sessions::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Sessions service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Sessions

A service used for session interactions.

For more information, see the API interactions guide.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



243
244
245
246
247
248
249
250
251
252
253
# File 'lib/google/cloud/dialogflow.rb', line 243

def self.sessions version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Sessions)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.versions(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for Versions.

By default, this returns an instance of Google::Cloud::Dialogflow::V2::Versions::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the Versions service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

About Versions

Service for managing Versions.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



625
626
627
628
629
630
631
632
633
634
635
# File 'lib/google/cloud/dialogflow.rb', line 625

def self.versions version: :v2, transport: :grpc, &block
  require "google/cloud/dialogflow/#{version.to_s.downcase}"

  package_name = Google::Cloud::Dialogflow
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Dialogflow.const_get(package_name).const_get(:Versions)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end