lib/google/cloud/dialogflow.rb in google-cloud-dialogflow-1.5.0 vs lib/google/cloud/dialogflow.rb in google-cloud-dialogflow-1.6.0

- old
+ new

@@ -47,519 +47,593 @@ ## # Create a new client object for Agents. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Agents::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Agents/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Agents::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.agents version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Agents).const_get(:Client).new(&block) + 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 ## # Create a new client object for Contexts. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Contexts::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Contexts/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Contexts::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.contexts version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Contexts).const_get(:Client).new(&block) + 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 ## # Create a new client object for Intents. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Intents::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Intents/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Intents::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.intents version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Intents).const_get(:Client).new(&block) + 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 ## # Create a new client object for EntityTypes. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::EntityTypes::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/EntityTypes/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [EntityTypes::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.entity_types version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:EntityTypes).const_get(:Client).new(&block) + 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 ## # Create a new client object for SessionEntityTypes. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::SessionEntityTypes::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/SessionEntityTypes/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. + # Service for managing + # SessionEntityTypes. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [SessionEntityTypes::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.session_entity_types version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:SessionEntityTypes).const_get(:Client).new(&block) + 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 ## # Create a new client object for Sessions. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Sessions::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Sessions/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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](https://cloud.google.com/dialogflow/docs/api-overview). # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Sessions::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.sessions version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Sessions).const_get(:Client).new(&block) + 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 ## # Create a new client object for Participants. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Participants::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Participants/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Participants::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.participants version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Participants).const_get(:Client).new(&block) + 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 ## # Create a new client object for AnswerRecords. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::AnswerRecords::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/AnswerRecords/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. + # Service for managing + # AnswerRecords. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [AnswerRecords::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.answer_records version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:AnswerRecords).const_get(:Client).new(&block) + 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 ## # Create a new client object for Conversations. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Conversations::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Conversations/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. + # Service for managing + # Conversations. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Conversations::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.conversations version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Conversations).const_get(:Client).new(&block) + 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 ## # Create a new client object for ConversationDatasets. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::ConversationDatasets::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/ConversationDatasets/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [ConversationDatasets::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.conversation_datasets version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:ConversationDatasets).const_get(:Client).new(&block) + 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 ## # Create a new client object for ConversationModels. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::ConversationModels::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/ConversationModels/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [ConversationModels::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.conversation_models version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:ConversationModels).const_get(:Client).new(&block) + 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 ## # Create a new client object for ConversationProfiles. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::ConversationProfiles::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/ConversationProfiles/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. + # Service for managing + # ConversationProfiles. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [ConversationProfiles::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.conversation_profiles version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:ConversationProfiles).const_get(:Client).new(&block) + 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 ## # Create a new client object for Documents. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Documents::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Documents/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. + # Service for managing knowledge + # Documents. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Documents::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.documents version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Documents).const_get(:Client).new(&block) + 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 ## # Create a new client object for Fulfillments. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Fulfillments::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Fulfillments/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Fulfillments::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.fulfillments version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Fulfillments).const_get(:Client).new(&block) + 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 ## # Create a new client object for Environments. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Environments::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Environments/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Environments::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.environments version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Environments).const_get(:Client).new(&block) + 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 ## # Create a new client object for KnowledgeBases. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::KnowledgeBases::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/KnowledgeBases/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. + # Service for managing + # KnowledgeBases. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [KnowledgeBases::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.knowledge_bases version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:KnowledgeBases).const_get(:Client).new(&block) + 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 ## # Create a new client object for Versions. # # By default, this returns an instance of # [Google::Cloud::Dialogflow::V2::Versions::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Versions/Client.html) - # for version V2 of the API. - # However, you can specify specify a different API version by passing it in the + # 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. # # @param version [::String, ::Symbol] The API version to connect to. Optional. # Defaults to `:v2`. - # @return [Versions::Client] A client object for the specified version. + # @param transport [:grpc, :rest] The transport to use. Defaults to `:grpc`. + # @return [::Object] A client object for the specified version. # - def self.versions version: :v2, &block + 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 - package_module = Google::Cloud::Dialogflow.const_get package_name - package_module.const_get(:Versions).const_get(:Client).new(&block) + 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 ## # Configure the google-cloud-dialogflow library. # @@ -575,10 +649,10 @@ # * `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 gRPC headers to be sent with the call. + # 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.