Module: Google::Cloud::Dialogflow

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

Constant Summary collapse

VERSION =
"1.8.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.



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

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.



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

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



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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