google-cloud-dialogflow 0.14.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -1
  3. data/AUTHENTICATION.md +51 -59
  4. data/LICENSE.md +203 -0
  5. data/MIGRATING.md +445 -0
  6. data/README.md +35 -25
  7. data/lib/{google/cloud/dialogflow/v2/doc/google/protobuf/empty.rb → google-cloud-dialogflow.rb} +4 -14
  8. data/lib/google/cloud/dialogflow.rb +256 -506
  9. data/lib/google/cloud/dialogflow/version.rb +1 -1
  10. metadata +63 -86
  11. data/LICENSE +0 -201
  12. data/lib/google/cloud/dialogflow/v2.rb +0 -598
  13. data/lib/google/cloud/dialogflow/v2/agent_pb.rb +0 -121
  14. data/lib/google/cloud/dialogflow/v2/agent_services_pb.rb +0 -111
  15. data/lib/google/cloud/dialogflow/v2/agents_client.rb +0 -807
  16. data/lib/google/cloud/dialogflow/v2/agents_client_config.json +0 -71
  17. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +0 -96
  18. data/lib/google/cloud/dialogflow/v2/context_pb.rb +0 -63
  19. data/lib/google/cloud/dialogflow/v2/context_services_pb.rb +0 -75
  20. data/lib/google/cloud/dialogflow/v2/contexts_client.rb +0 -519
  21. data/lib/google/cloud/dialogflow/v2/contexts_client_config.json +0 -56
  22. data/lib/google/cloud/dialogflow/v2/credentials.rb +0 -42
  23. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/agent.rb +0 -247
  24. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/audio_config.rb +0 -341
  25. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/context.rb +0 -116
  26. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/entity_type.rb +0 -305
  27. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/intent.rb +0 -937
  28. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session.rb +0 -498
  29. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/session_entity_type.rb +0 -130
  30. data/lib/google/cloud/dialogflow/v2/doc/google/cloud/dialogflow/v2/validation_result.rb +0 -71
  31. data/lib/google/cloud/dialogflow/v2/doc/google/longrunning/operations.rb +0 -51
  32. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/any.rb +0 -131
  33. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/duration.rb +0 -91
  34. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/field_mask.rb +0 -222
  35. data/lib/google/cloud/dialogflow/v2/doc/google/protobuf/struct.rb +0 -74
  36. data/lib/google/cloud/dialogflow/v2/doc/google/rpc/status.rb +0 -39
  37. data/lib/google/cloud/dialogflow/v2/doc/google/type/latlng.rb +0 -31
  38. data/lib/google/cloud/dialogflow/v2/entity_type_pb.rb +0 -125
  39. data/lib/google/cloud/dialogflow/v2/entity_type_services_pb.rb +0 -105
  40. data/lib/google/cloud/dialogflow/v2/entity_types_client.rb +0 -994
  41. data/lib/google/cloud/dialogflow/v2/entity_types_client_config.json +0 -76
  42. data/lib/google/cloud/dialogflow/v2/intent_pb.rb +0 -367
  43. data/lib/google/cloud/dialogflow/v2/intent_services_pb.rb +0 -93
  44. data/lib/google/cloud/dialogflow/v2/intents_client.rb +0 -760
  45. data/lib/google/cloud/dialogflow/v2/intents_client_config.json +0 -61
  46. data/lib/google/cloud/dialogflow/v2/session_entity_type_pb.rb +0 -65
  47. data/lib/google/cloud/dialogflow/v2/session_entity_type_services_pb.rb +0 -93
  48. data/lib/google/cloud/dialogflow/v2/session_entity_types_client.rb +0 -504
  49. data/lib/google/cloud/dialogflow/v2/session_entity_types_client_config.json +0 -51
  50. data/lib/google/cloud/dialogflow/v2/session_pb.rb +0 -141
  51. data/lib/google/cloud/dialogflow/v2/session_services_pb.rb +0 -56
  52. data/lib/google/cloud/dialogflow/v2/sessions_client.rb +0 -337
  53. data/lib/google/cloud/dialogflow/v2/sessions_client_config.json +0 -36
  54. data/lib/google/cloud/dialogflow/v2/validation_result_pb.rb +0 -36
  55. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +0 -46
data/README.md CHANGED
@@ -1,42 +1,52 @@
1
- # Ruby Client for Dialogflow API
1
+ # Ruby Client for the Dialogflow API
2
2
 
3
- [Dialogflow API][Product Documentation]:
4
- Builds conversational interfaces (for example, chatbots, and voice-powered
5
- apps and devices).
6
- - [Client Library Documentation][]
7
- - [Product Documentation][]
3
+ API Client library for the Dialogflow API
8
4
 
9
- ## Quick Start
10
- In order to use this library, you first need to go through the following
11
- steps:
5
+ Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business.
12
6
 
13
- 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
14
- 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
15
- 3. [Enable the Dialogflow API.](https://console.cloud.google.com/apis/library/dialogflow.googleapis.com)
16
- 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-dialogflow/latest/file.AUTHENTICATION.html)
7
+ Actual client classes for the various versions of this API are defined in
8
+ _versioned_ client gems, with names of the form `google-cloud-dialogflow-v*`.
9
+ The gem `google-cloud-dialogflow` is a convenience wrapper library that brings the
10
+ verisoned gems in as dependencies, and provides high-level methods for
11
+ constructing clients.
12
+
13
+ View the [Client Library Documentation](https://googleapis.dev/ruby/google-cloud-dialogflow/latest)
14
+ for this library, google-cloud-dialogflow, to see the convenience methods for
15
+ constructing client objects. Reference documentation for the client objects
16
+ themselves can be found in the client library documentation for the versioned
17
+ client gems:
18
+ [google-cloud-dialogflow-v2](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest).
19
+
20
+ See also the [Product Documentation](https://cloud.google.com/dialogflow)
21
+ for more usage information.
22
+
23
+ ## Quick Start
17
24
 
18
- ### Installation
19
25
  ```
20
26
  $ gem install google-cloud-dialogflow
21
27
  ```
22
28
 
23
- ### Next Steps
24
- - Read the [Client Library Documentation][] for Dialogflow API
25
- to see other available methods on the client.
26
- - Read the [Dialogflow API Product documentation][Product Documentation]
27
- to learn more about the product and see How-to Guides.
28
- - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
29
- to see the full list of Cloud APIs that we cover.
29
+ In order to use this library, you first need to go through the following steps:
30
+
31
+ 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
32
+ 1. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
33
+ 1. [Enable the API.](https://console.cloud.google.com/apis/library/dialogflow.googleapis.com)
34
+ 1. {file:AUTHENTICATION.md Set up authentication.}
35
+
36
+ ## Migrating from 0.x versions
30
37
 
31
- [Client Library Documentation]: https://googleapis.dev/ruby/google-cloud-dialogflow/latest
32
- [Product Documentation]: https://cloud.google.com/dialogflow
38
+ The 1.0 release of the google-cloud-dialogflow client is a significant upgrade
39
+ based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-ruby),
40
+ and includes substantial interface changes. Existing code written for earlier
41
+ versions of this library will likely require updates to use this version.
42
+ See the {file:MIGRATING.md MIGRATING.md} document for more information.
33
43
 
34
44
  ## Enabling Logging
35
45
 
36
46
  To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
37
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
47
+ The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib/libdoc/logger/rdoc/Logger.html) as shown below,
38
48
  or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
39
- that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
49
+ that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
40
50
  and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
41
51
 
42
52
  Configuring a Ruby stdlib logger:
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +14,6 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
15
18
 
16
- module Google
17
- module Protobuf
18
- # A generic empty message that you can re-use to avoid defining duplicated
19
- # empty messages in your APIs. A typical example is to use it as the request
20
- # or the response type of an API method. For instance:
21
- #
22
- # service Foo {
23
- # rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
24
- # }
25
- #
26
- # The JSON representation for `Empty` is empty JSON object `{}`.
27
- class Empty; end
28
- end
29
- end
19
+ require "google/cloud/dialogflow" unless defined? Google::Cloud::Dialogflow::VERSION
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright 2020 Google LLC
2
4
  #
3
5
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,537 +14,285 @@
12
14
  # See the License for the specific language governing permissions and
13
15
  # limitations under the License.
14
16
 
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ # Require this file early so that the version constant gets defined before
20
+ # requiring "google/cloud". This is because google-cloud-core will load the
21
+ # entrypoint (gem name) file, which in turn re-requires this file (hence
22
+ # causing a require cycle) unless the version constant is already defined.
23
+ require "google/cloud/dialogflow/version"
15
24
 
16
- require "google/gax"
17
- require "pathname"
25
+ require "googleauth"
26
+ gem "google-cloud-core"
27
+ require "google/cloud" unless defined? ::Google::Cloud.new
28
+ require "google/cloud/config"
29
+
30
+ # Set the default configuration
31
+ ::Google::Cloud.configure.add_config! :dialogflow do |config|
32
+ config.add_field! :endpoint, "dialogflow.googleapis.com", match: ::String
33
+ config.add_field! :credentials, nil, match: [::String, ::Hash, ::Google::Auth::Credentials]
34
+ config.add_field! :scope, nil, match: [::Array, ::String]
35
+ config.add_field! :lib_name, nil, match: ::String
36
+ config.add_field! :lib_version, nil, match: ::String
37
+ config.add_field! :interceptors, nil, match: ::Array
38
+ config.add_field! :timeout, nil, match: ::Numeric
39
+ config.add_field! :metadata, nil, match: ::Hash
40
+ config.add_field! :retry_policy, nil, match: [::Hash, ::Proc]
41
+ config.add_field! :quota_project, nil, match: ::String
42
+ end
18
43
 
19
44
  module Google
20
45
  module Cloud
21
- # rubocop:disable LineLength
22
-
23
- ##
24
- # # Ruby Client for Dialogflow API
25
- #
26
- # [Dialogflow API][Product Documentation]:
27
- # Builds conversational interfaces (for example, chatbots, and voice-powered
28
- # apps and devices).
29
- # - [Product Documentation][]
30
- #
31
- # ## Quick Start
32
- # In order to use this library, you first need to go through the following
33
- # steps:
34
- #
35
- # 1. [Select or create a Cloud Platform project.](https://console.cloud.google.com/project)
36
- # 2. [Enable billing for your project.](https://cloud.google.com/billing/docs/how-to/modify-project#enable_billing_for_a_project)
37
- # 3. [Enable the Dialogflow API.](https://console.cloud.google.com/apis/library/dialogflow.googleapis.com)
38
- # 4. [Setup Authentication.](https://googleapis.dev/ruby/google-cloud-dialogflow/latest/file.AUTHENTICATION.html)
39
- #
40
- # ### Installation
41
- # ```
42
- # $ gem install google-cloud-dialogflow
43
- # ```
44
- #
45
- # ### Next Steps
46
- # - Read the [Dialogflow API Product documentation][Product Documentation]
47
- # to learn more about the product and see How-to Guides.
48
- # - View this [repository's main README](https://github.com/googleapis/google-cloud-ruby/blob/master/README.md)
49
- # to see the full list of Cloud APIs that we cover.
50
- #
51
- # [Product Documentation]: https://cloud.google.com/dialogflow
52
- #
53
- # ## Enabling Logging
54
- #
55
- # To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
56
- # The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html) as shown below,
57
- # or a [`Google::Cloud::Logging::Logger`](https://googleapis.dev/ruby/google-cloud-logging/latest)
58
- # that will write logs to [Stackdriver Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
59
- # and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
60
- #
61
- # Configuring a Ruby stdlib logger:
62
- #
63
- # ```ruby
64
- # require "logger"
65
- #
66
- # module MyLogger
67
- # LOGGER = Logger.new $stderr, level: Logger::WARN
68
- # def logger
69
- # LOGGER
70
- # end
71
- # end
72
- #
73
- # # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
74
- # module GRPC
75
- # extend MyLogger
76
- # end
77
- # ```
78
- #
79
46
  module Dialogflow
80
- # rubocop:enable LineLength
47
+ ##
48
+ # Create a new client object for Agents.
49
+ #
50
+ # By default, this returns an instance of
51
+ # [Google::Cloud::Dialogflow::V2::Agents::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Agents/Client.html)
52
+ # for version V2 of the API.
53
+ # However, you can specify specify a different API version by passing it in the
54
+ # `version` parameter. If the Agents service is
55
+ # supported by that API version, and the corresponding gem is available, the
56
+ # appropriate versioned client will be returned.
57
+ #
58
+ # ## About Agents
59
+ #
60
+ # Service for managing Agents.
61
+ #
62
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
63
+ # Defaults to `:v2`.
64
+ # @return [Agents::Client] A client object for the specified version.
65
+ #
66
+ def self.agents version: :v2, &block
67
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
81
68
 
82
- FILE_DIR = File.realdirpath(Pathname.new(__FILE__).join("..").join("dialogflow"))
69
+ package_name = Google::Cloud::Dialogflow
70
+ .constants
71
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
72
+ .first
73
+ package_module = Google::Cloud::Dialogflow.const_get package_name
74
+ package_module.const_get(:Agents).const_get(:Client).new(&block)
75
+ end
76
+
77
+ ##
78
+ # Create a new client object for Contexts.
79
+ #
80
+ # By default, this returns an instance of
81
+ # [Google::Cloud::Dialogflow::V2::Contexts::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Contexts/Client.html)
82
+ # for version V2 of the API.
83
+ # However, you can specify specify a different API version by passing it in the
84
+ # `version` parameter. If the Contexts service is
85
+ # supported by that API version, and the corresponding gem is available, the
86
+ # appropriate versioned client will be returned.
87
+ #
88
+ # ## About Contexts
89
+ #
90
+ # Service for managing Contexts.
91
+ #
92
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
93
+ # Defaults to `:v2`.
94
+ # @return [Contexts::Client] A client object for the specified version.
95
+ #
96
+ def self.contexts version: :v2, &block
97
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
83
98
 
84
- AVAILABLE_VERSIONS = Dir["#{FILE_DIR}/*"]
85
- .select { |file| File.directory?(file) }
86
- .select { |dir| Google::Gax::VERSION_MATCHER.match(File.basename(dir)) }
87
- .select { |dir| File.exist?(dir + ".rb") }
88
- .map { |dir| File.basename(dir) }
99
+ package_name = Google::Cloud::Dialogflow
100
+ .constants
101
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
102
+ .first
103
+ package_module = Google::Cloud::Dialogflow.const_get package_name
104
+ package_module.const_get(:Contexts).const_get(:Client).new(&block)
105
+ end
89
106
 
90
- module Agents
91
- ##
92
- # Agents are best described as Natural Language Understanding (NLU) modules
93
- # that transform user requests into actionable data. You can include agents
94
- # in your app, product, or service to determine user intent and respond to the
95
- # user in a natural way.
96
- #
97
- # After you create an agent, you can add {Google::Cloud::Dialogflow::V2::Intents Intents}, {Google::Cloud::Dialogflow::V2::Contexts Contexts},
98
- # {Google::Cloud::Dialogflow::V2::EntityTypes Entity Types}, {Google::Cloud::Dialogflow::V2::WebhookRequest Webhooks}, and so on to
99
- # manage the flow of a conversation and match user input to predefined intents
100
- # and actions.
101
- #
102
- # You can create an agent using both Dialogflow Standard Edition and
103
- # Dialogflow Enterprise Edition. For details, see
104
- # [Dialogflow
105
- # Editions](https://cloud.google.com/dialogflow/docs/editions).
106
- #
107
- # You can save your agent for backup or versioning by exporting the agent by
108
- # using the {Google::Cloud::Dialogflow::V2::Agents::ExportAgent ExportAgent} method. You can import a saved
109
- # agent by using the {Google::Cloud::Dialogflow::V2::Agents::ImportAgent ImportAgent} method.
110
- #
111
- # Dialogflow provides several
112
- # [prebuilt
113
- # agents](https://cloud.google.com/dialogflow/docs/agents-prebuilt)
114
- # for common conversation scenarios such as determining a date and time,
115
- # converting currency, and so on.
116
- #
117
- # For more information about agents, see the
118
- # [Dialogflow
119
- # documentation](https://cloud.google.com/dialogflow/docs/agents-overview).
120
- #
121
- # @param version [Symbol, String]
122
- # The major version of the service to be used. By default :v2
123
- # is used.
124
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
125
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
126
- # Provides the means for authenticating requests made by the client. This parameter can
127
- # be many types.
128
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
129
- # authenticating requests made by this client.
130
- # A `String` will be treated as the path to the keyfile to be used for the construction of
131
- # credentials for this client.
132
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
133
- # credentials for this client.
134
- # A `GRPC::Core::Channel` will be used to make calls through.
135
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
136
- # should already be composed with a `GRPC::Core::CallCredentials` object.
137
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
138
- # metadata for requests, generally, to give OAuth credentials.
139
- # @param scopes [Array<String>]
140
- # The OAuth scopes for this service. This parameter is ignored if
141
- # an updater_proc is supplied.
142
- # @param client_config [Hash]
143
- # A Hash for call options for each method. See
144
- # Google::Gax#construct_settings for the structure of
145
- # this data. Falls back to the default config if not specified
146
- # or the specified config is missing data points.
147
- # @param timeout [Numeric]
148
- # The default timeout, in seconds, for calls made through this client.
149
- # @param metadata [Hash]
150
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
151
- # @param service_address [String]
152
- # Override for the service hostname, or `nil` to leave as the default.
153
- # @param service_port [Integer]
154
- # Override for the service port, or `nil` to leave as the default.
155
- # @param exception_transformer [Proc]
156
- # An optional proc that intercepts any exceptions raised during an API call to inject
157
- # custom error handling.
158
- def self.new(*args, version: :v2, **kwargs)
159
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
160
- raise "The version: #{version} is not available. The available versions " \
161
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
162
- end
107
+ ##
108
+ # Create a new client object for EntityTypes.
109
+ #
110
+ # By default, this returns an instance of
111
+ # [Google::Cloud::Dialogflow::V2::EntityTypes::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/EntityTypes/Client.html)
112
+ # for version V2 of the API.
113
+ # However, you can specify specify a different API version by passing it in the
114
+ # `version` parameter. If the EntityTypes service is
115
+ # supported by that API version, and the corresponding gem is available, the
116
+ # appropriate versioned client will be returned.
117
+ #
118
+ # ## About EntityTypes
119
+ #
120
+ # Service for managing EntityTypes.
121
+ #
122
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
123
+ # Defaults to `:v2`.
124
+ # @return [EntityTypes::Client] A client object for the specified version.
125
+ #
126
+ def self.entity_types version: :v2, &block
127
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
163
128
 
164
- require "#{FILE_DIR}/#{version.to_s.downcase}"
165
- version_module = Google::Cloud::Dialogflow
166
- .constants
167
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
168
- .first
169
- Google::Cloud::Dialogflow.const_get(version_module)::Agents.new(*args, **kwargs)
170
- end
129
+ package_name = Google::Cloud::Dialogflow
130
+ .constants
131
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
132
+ .first
133
+ package_module = Google::Cloud::Dialogflow.const_get package_name
134
+ package_module.const_get(:EntityTypes).const_get(:Client).new(&block)
171
135
  end
172
136
 
173
- module Contexts
174
- ##
175
- # A context represents additional information included with user input or with
176
- # an intent returned by the Dialogflow API. Contexts are helpful for
177
- # differentiating user input which may be vague or have a different meaning
178
- # depending on additional details from your application such as user setting
179
- # and preferences, previous user input, where the user is in your application,
180
- # geographic location, and so on.
181
- #
182
- # You can include contexts as input parameters of a
183
- # {Google::Cloud::Dialogflow::V2::Sessions::DetectIntent DetectIntent} (or
184
- # {Google::Cloud::Dialogflow::V2::Sessions::StreamingDetectIntent StreamingDetectIntent}) request,
185
- # or as output contexts included in the returned intent.
186
- # Contexts expire when an intent is matched, after the number of `DetectIntent`
187
- # requests specified by the `lifespan_count` parameter, or after 20 minutes
188
- # if no intents are matched for a `DetectIntent` request.
189
- #
190
- # For more information about contexts, see the
191
- # [Dialogflow
192
- # documentation](https://cloud.google.com/dialogflow/docs/contexts-overview).
193
- #
194
- # @param version [Symbol, String]
195
- # The major version of the service to be used. By default :v2
196
- # is used.
197
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
198
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
199
- # Provides the means for authenticating requests made by the client. This parameter can
200
- # be many types.
201
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
202
- # authenticating requests made by this client.
203
- # A `String` will be treated as the path to the keyfile to be used for the construction of
204
- # credentials for this client.
205
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
206
- # credentials for this client.
207
- # A `GRPC::Core::Channel` will be used to make calls through.
208
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
209
- # should already be composed with a `GRPC::Core::CallCredentials` object.
210
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
211
- # metadata for requests, generally, to give OAuth credentials.
212
- # @param scopes [Array<String>]
213
- # The OAuth scopes for this service. This parameter is ignored if
214
- # an updater_proc is supplied.
215
- # @param client_config [Hash]
216
- # A Hash for call options for each method. See
217
- # Google::Gax#construct_settings for the structure of
218
- # this data. Falls back to the default config if not specified
219
- # or the specified config is missing data points.
220
- # @param timeout [Numeric]
221
- # The default timeout, in seconds, for calls made through this client.
222
- # @param metadata [Hash]
223
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
224
- # @param service_address [String]
225
- # Override for the service hostname, or `nil` to leave as the default.
226
- # @param service_port [Integer]
227
- # Override for the service port, or `nil` to leave as the default.
228
- # @param exception_transformer [Proc]
229
- # An optional proc that intercepts any exceptions raised during an API call to inject
230
- # custom error handling.
231
- def self.new(*args, version: :v2, **kwargs)
232
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
233
- raise "The version: #{version} is not available. The available versions " \
234
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
235
- end
137
+ ##
138
+ # Create a new client object for Environments.
139
+ #
140
+ # By default, this returns an instance of
141
+ # [Google::Cloud::Dialogflow::V2::Environments::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Environments/Client.html)
142
+ # for version V2 of the API.
143
+ # However, you can specify specify a different API version by passing it in the
144
+ # `version` parameter. If the Environments service is
145
+ # supported by that API version, and the corresponding gem is available, the
146
+ # appropriate versioned client will be returned.
147
+ #
148
+ # ## About Environments
149
+ #
150
+ # Service for managing Environments.
151
+ #
152
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
153
+ # Defaults to `:v2`.
154
+ # @return [Environments::Client] A client object for the specified version.
155
+ #
156
+ def self.environments version: :v2, &block
157
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
236
158
 
237
- require "#{FILE_DIR}/#{version.to_s.downcase}"
238
- version_module = Google::Cloud::Dialogflow
239
- .constants
240
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
241
- .first
242
- Google::Cloud::Dialogflow.const_get(version_module)::Contexts.new(*args, **kwargs)
243
- end
159
+ package_name = Google::Cloud::Dialogflow
160
+ .constants
161
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
162
+ .first
163
+ package_module = Google::Cloud::Dialogflow.const_get package_name
164
+ package_module.const_get(:Environments).const_get(:Client).new(&block)
244
165
  end
245
166
 
246
- module EntityTypes
247
- ##
248
- # Entities are extracted from user input and represent parameters that are
249
- # meaningful to your application. For example, a date range, a proper name
250
- # such as a geographic location or landmark, and so on. Entities represent
251
- # actionable data for your application.
252
- #
253
- # When you define an entity, you can also include synonyms that all map to
254
- # that entity. For example, "soft drink", "soda", "pop", and so on.
255
- #
256
- # There are three types of entities:
257
- #
258
- # * **System** - entities that are defined by the Dialogflow API for common
259
- # data types such as date, time, currency, and so on. A system entity is
260
- # represented by the `EntityType` type.
261
- #
262
- # * **Custom** - entities that are defined by you that represent
263
- # actionable data that is meaningful to your application. For example,
264
- # you could define a `pizza.sauce` entity for red or white pizza sauce,
265
- # a `pizza.cheese` entity for the different types of cheese on a pizza,
266
- # a `pizza.topping` entity for different toppings, and so on. A custom
267
- # entity is represented by the `EntityType` type.
268
- #
269
- # * **User** - entities that are built for an individual user such as
270
- # favorites, preferences, playlists, and so on. A user entity is
271
- # represented by the {Google::Cloud::Dialogflow::V2::SessionEntityType SessionEntityType} type.
272
- #
273
- # For more information about entity types, see the
274
- # [Dialogflow
275
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
276
- #
277
- # @param version [Symbol, String]
278
- # The major version of the service to be used. By default :v2
279
- # is used.
280
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
281
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
282
- # Provides the means for authenticating requests made by the client. This parameter can
283
- # be many types.
284
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
285
- # authenticating requests made by this client.
286
- # A `String` will be treated as the path to the keyfile to be used for the construction of
287
- # credentials for this client.
288
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
289
- # credentials for this client.
290
- # A `GRPC::Core::Channel` will be used to make calls through.
291
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
292
- # should already be composed with a `GRPC::Core::CallCredentials` object.
293
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
294
- # metadata for requests, generally, to give OAuth credentials.
295
- # @param scopes [Array<String>]
296
- # The OAuth scopes for this service. This parameter is ignored if
297
- # an updater_proc is supplied.
298
- # @param client_config [Hash]
299
- # A Hash for call options for each method. See
300
- # Google::Gax#construct_settings for the structure of
301
- # this data. Falls back to the default config if not specified
302
- # or the specified config is missing data points.
303
- # @param timeout [Numeric]
304
- # The default timeout, in seconds, for calls made through this client.
305
- # @param metadata [Hash]
306
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
307
- # @param service_address [String]
308
- # Override for the service hostname, or `nil` to leave as the default.
309
- # @param service_port [Integer]
310
- # Override for the service port, or `nil` to leave as the default.
311
- # @param exception_transformer [Proc]
312
- # An optional proc that intercepts any exceptions raised during an API call to inject
313
- # custom error handling.
314
- def self.new(*args, version: :v2, **kwargs)
315
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
316
- raise "The version: #{version} is not available. The available versions " \
317
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
318
- end
167
+ ##
168
+ # Create a new client object for Intents.
169
+ #
170
+ # By default, this returns an instance of
171
+ # [Google::Cloud::Dialogflow::V2::Intents::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Intents/Client.html)
172
+ # for version V2 of the API.
173
+ # However, you can specify specify a different API version by passing it in the
174
+ # `version` parameter. If the Intents service is
175
+ # supported by that API version, and the corresponding gem is available, the
176
+ # appropriate versioned client will be returned.
177
+ #
178
+ # ## About Intents
179
+ #
180
+ # Service for managing Intents.
181
+ #
182
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
183
+ # Defaults to `:v2`.
184
+ # @return [Intents::Client] A client object for the specified version.
185
+ #
186
+ def self.intents version: :v2, &block
187
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
319
188
 
320
- require "#{FILE_DIR}/#{version.to_s.downcase}"
321
- version_module = Google::Cloud::Dialogflow
322
- .constants
323
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
324
- .first
325
- Google::Cloud::Dialogflow.const_get(version_module)::EntityTypes.new(*args, **kwargs)
326
- end
189
+ package_name = Google::Cloud::Dialogflow
190
+ .constants
191
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
192
+ .first
193
+ package_module = Google::Cloud::Dialogflow.const_get package_name
194
+ package_module.const_get(:Intents).const_get(:Client).new(&block)
327
195
  end
328
196
 
329
- module Intents
330
- ##
331
- # An intent represents a mapping between input from a user and an action to
332
- # be taken by your application. When you pass user input to the
333
- # {Google::Cloud::Dialogflow::V2::Sessions::DetectIntent DetectIntent} (or
334
- # {Google::Cloud::Dialogflow::V2::Sessions::StreamingDetectIntent StreamingDetectIntent}) method, the
335
- # Dialogflow API analyzes the input and searches
336
- # for a matching intent. If no match is found, the Dialogflow API returns a
337
- # fallback intent (`is_fallback` = true).
338
- #
339
- # You can provide additional information for the Dialogflow API to use to
340
- # match user input to an intent by adding the following to your intent.
341
- #
342
- # * **Contexts** - provide additional context for intent analysis. For
343
- # example, if an intent is related to an object in your application that
344
- # plays music, you can provide a context to determine when to match the
345
- # intent if the user input is "turn it off". You can include a context
346
- # that matches the intent when there is previous user input of
347
- # "play music", and not when there is previous user input of
348
- # "turn on the light".
349
- #
350
- # * **Events** - allow for matching an intent by using an event name
351
- # instead of user input. Your application can provide an event name and
352
- # related parameters to the Dialogflow API to match an intent. For
353
- # example, when your application starts, you can send a welcome event
354
- # with a user name parameter to the Dialogflow API to match an intent with
355
- # a personalized welcome message for the user.
356
- #
357
- # * **Training phrases** - provide examples of user input to train the
358
- # Dialogflow API agent to better match intents.
359
- #
360
- # For more information about intents, see the
361
- # [Dialogflow
362
- # documentation](https://cloud.google.com/dialogflow/docs/intents-overview).
363
- #
364
- # @param version [Symbol, String]
365
- # The major version of the service to be used. By default :v2
366
- # is used.
367
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
368
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
369
- # Provides the means for authenticating requests made by the client. This parameter can
370
- # be many types.
371
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
372
- # authenticating requests made by this client.
373
- # A `String` will be treated as the path to the keyfile to be used for the construction of
374
- # credentials for this client.
375
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
376
- # credentials for this client.
377
- # A `GRPC::Core::Channel` will be used to make calls through.
378
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
379
- # should already be composed with a `GRPC::Core::CallCredentials` object.
380
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
381
- # metadata for requests, generally, to give OAuth credentials.
382
- # @param scopes [Array<String>]
383
- # The OAuth scopes for this service. This parameter is ignored if
384
- # an updater_proc is supplied.
385
- # @param client_config [Hash]
386
- # A Hash for call options for each method. See
387
- # Google::Gax#construct_settings for the structure of
388
- # this data. Falls back to the default config if not specified
389
- # or the specified config is missing data points.
390
- # @param timeout [Numeric]
391
- # The default timeout, in seconds, for calls made through this client.
392
- # @param metadata [Hash]
393
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
394
- # @param service_address [String]
395
- # Override for the service hostname, or `nil` to leave as the default.
396
- # @param service_port [Integer]
397
- # Override for the service port, or `nil` to leave as the default.
398
- # @param exception_transformer [Proc]
399
- # An optional proc that intercepts any exceptions raised during an API call to inject
400
- # custom error handling.
401
- def self.new(*args, version: :v2, **kwargs)
402
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
403
- raise "The version: #{version} is not available. The available versions " \
404
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
405
- end
197
+ ##
198
+ # Create a new client object for SessionEntityTypes.
199
+ #
200
+ # By default, this returns an instance of
201
+ # [Google::Cloud::Dialogflow::V2::SessionEntityTypes::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/SessionEntityTypes/Client.html)
202
+ # for version V2 of the API.
203
+ # However, you can specify specify a different API version by passing it in the
204
+ # `version` parameter. If the SessionEntityTypes service is
205
+ # supported by that API version, and the corresponding gem is available, the
206
+ # appropriate versioned client will be returned.
207
+ #
208
+ # ## About SessionEntityTypes
209
+ #
210
+ # Service for managing SessionEntityTypes.
211
+ #
212
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
213
+ # Defaults to `:v2`.
214
+ # @return [SessionEntityTypes::Client] A client object for the specified version.
215
+ #
216
+ def self.session_entity_types version: :v2, &block
217
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
406
218
 
407
- require "#{FILE_DIR}/#{version.to_s.downcase}"
408
- version_module = Google::Cloud::Dialogflow
409
- .constants
410
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
411
- .first
412
- Google::Cloud::Dialogflow.const_get(version_module)::Intents.new(*args, **kwargs)
413
- end
219
+ package_name = Google::Cloud::Dialogflow
220
+ .constants
221
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
222
+ .first
223
+ package_module = Google::Cloud::Dialogflow.const_get package_name
224
+ package_module.const_get(:SessionEntityTypes).const_get(:Client).new(&block)
414
225
  end
415
226
 
416
- module SessionEntityTypes
417
- ##
418
- # Entities are extracted from user input and represent parameters that are
419
- # meaningful to your application. For example, a date range, a proper name
420
- # such as a geographic location or landmark, and so on. Entities represent
421
- # actionable data for your application.
422
- #
423
- # Session entity types are referred to as **User** entity types and are
424
- # entities that are built for an individual user such as
425
- # favorites, preferences, playlists, and so on. You can redefine a session
426
- # entity type at the session level.
427
- #
428
- # Session entity methods do not work with Google Assistant integration.
429
- # Contact Dialogflow support if you need to use session entities
430
- # with Google Assistant integration.
431
- #
432
- # For more information about entity types, see the
433
- # [Dialogflow
434
- # documentation](https://cloud.google.com/dialogflow/docs/entities-overview).
435
- #
436
- # @param version [Symbol, String]
437
- # The major version of the service to be used. By default :v2
438
- # is used.
439
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
440
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
441
- # Provides the means for authenticating requests made by the client. This parameter can
442
- # be many types.
443
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
444
- # authenticating requests made by this client.
445
- # A `String` will be treated as the path to the keyfile to be used for the construction of
446
- # credentials for this client.
447
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
448
- # credentials for this client.
449
- # A `GRPC::Core::Channel` will be used to make calls through.
450
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
451
- # should already be composed with a `GRPC::Core::CallCredentials` object.
452
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
453
- # metadata for requests, generally, to give OAuth credentials.
454
- # @param scopes [Array<String>]
455
- # The OAuth scopes for this service. This parameter is ignored if
456
- # an updater_proc is supplied.
457
- # @param client_config [Hash]
458
- # A Hash for call options for each method. See
459
- # Google::Gax#construct_settings for the structure of
460
- # this data. Falls back to the default config if not specified
461
- # or the specified config is missing data points.
462
- # @param timeout [Numeric]
463
- # The default timeout, in seconds, for calls made through this client.
464
- # @param metadata [Hash]
465
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
466
- # @param service_address [String]
467
- # Override for the service hostname, or `nil` to leave as the default.
468
- # @param service_port [Integer]
469
- # Override for the service port, or `nil` to leave as the default.
470
- # @param exception_transformer [Proc]
471
- # An optional proc that intercepts any exceptions raised during an API call to inject
472
- # custom error handling.
473
- def self.new(*args, version: :v2, **kwargs)
474
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
475
- raise "The version: #{version} is not available. The available versions " \
476
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
477
- end
227
+ ##
228
+ # Create a new client object for Sessions.
229
+ #
230
+ # By default, this returns an instance of
231
+ # [Google::Cloud::Dialogflow::V2::Sessions::Client](https://googleapis.dev/ruby/google-cloud-dialogflow-v2/latest/Google/Cloud/Dialogflow/V2/Sessions/Client.html)
232
+ # for version V2 of the API.
233
+ # However, you can specify specify a different API version by passing it in the
234
+ # `version` parameter. If the Sessions service is
235
+ # supported by that API version, and the corresponding gem is available, the
236
+ # appropriate versioned client will be returned.
237
+ #
238
+ # ## About Sessions
239
+ #
240
+ # A service used for session interactions.
241
+ #
242
+ # For more information, see the [API interactions
243
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
244
+ #
245
+ # @param version [::String, ::Symbol] The API version to connect to. Optional.
246
+ # Defaults to `:v2`.
247
+ # @return [Sessions::Client] A client object for the specified version.
248
+ #
249
+ def self.sessions version: :v2, &block
250
+ require "google/cloud/dialogflow/#{version.to_s.downcase}"
478
251
 
479
- require "#{FILE_DIR}/#{version.to_s.downcase}"
480
- version_module = Google::Cloud::Dialogflow
481
- .constants
482
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
483
- .first
484
- Google::Cloud::Dialogflow.const_get(version_module)::SessionEntityTypes.new(*args, **kwargs)
485
- end
252
+ package_name = Google::Cloud::Dialogflow
253
+ .constants
254
+ .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
255
+ .first
256
+ package_module = Google::Cloud::Dialogflow.const_get package_name
257
+ package_module.const_get(:Sessions).const_get(:Client).new(&block)
486
258
  end
487
259
 
488
- module Sessions
489
- ##
490
- # A session represents an interaction with a user. You retrieve user input
491
- # and pass it to the {Google::Cloud::Dialogflow::V2::Sessions::DetectIntent DetectIntent} (or
492
- # {Google::Cloud::Dialogflow::V2::Sessions::StreamingDetectIntent StreamingDetectIntent}) method to determine
493
- # user intent and respond.
494
- #
495
- # @param version [Symbol, String]
496
- # The major version of the service to be used. By default :v2
497
- # is used.
498
- # @overload new(version:, credentials:, scopes:, client_config:, timeout:)
499
- # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
500
- # Provides the means for authenticating requests made by the client. This parameter can
501
- # be many types.
502
- # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
503
- # authenticating requests made by this client.
504
- # A `String` will be treated as the path to the keyfile to be used for the construction of
505
- # credentials for this client.
506
- # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
507
- # credentials for this client.
508
- # A `GRPC::Core::Channel` will be used to make calls through.
509
- # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
510
- # should already be composed with a `GRPC::Core::CallCredentials` object.
511
- # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
512
- # metadata for requests, generally, to give OAuth credentials.
513
- # @param scopes [Array<String>]
514
- # The OAuth scopes for this service. This parameter is ignored if
515
- # an updater_proc is supplied.
516
- # @param client_config [Hash]
517
- # A Hash for call options for each method. See
518
- # Google::Gax#construct_settings for the structure of
519
- # this data. Falls back to the default config if not specified
520
- # or the specified config is missing data points.
521
- # @param timeout [Numeric]
522
- # The default timeout, in seconds, for calls made through this client.
523
- # @param metadata [Hash]
524
- # Default metadata to be sent with each request. This can be overridden on a per call basis.
525
- # @param service_address [String]
526
- # Override for the service hostname, or `nil` to leave as the default.
527
- # @param service_port [Integer]
528
- # Override for the service port, or `nil` to leave as the default.
529
- # @param exception_transformer [Proc]
530
- # An optional proc that intercepts any exceptions raised during an API call to inject
531
- # custom error handling.
532
- def self.new(*args, version: :v2, **kwargs)
533
- unless AVAILABLE_VERSIONS.include?(version.to_s.downcase)
534
- raise "The version: #{version} is not available. The available versions " \
535
- "are: [#{AVAILABLE_VERSIONS.join(", ")}]"
536
- end
260
+ ##
261
+ # Configure the google-cloud-dialogflow library.
262
+ #
263
+ # The following configuration parameters are supported:
264
+ #
265
+ # * `credentials` (*type:* `String, Hash, Google::Auth::Credentials`) -
266
+ # The path to the keyfile as a String, the contents of the keyfile as a
267
+ # Hash, or a Google::Auth::Credentials object.
268
+ # * `lib_name` (*type:* `String`) -
269
+ # The library name as recorded in instrumentation and logging.
270
+ # * `lib_version` (*type:* `String`) -
271
+ # The library version as recorded in instrumentation and logging.
272
+ # * `interceptors` (*type:* `Array<GRPC::ClientInterceptor>`) -
273
+ # An array of interceptors that are run before calls are executed.
274
+ # * `timeout` (*type:* `Numeric`) -
275
+ # Default timeout in seconds.
276
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) -
277
+ # Additional gRPC headers to be sent with the call.
278
+ # * `retry_policy` (*type:* `Hash`) -
279
+ # The retry policy. The value is a hash with the following keys:
280
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
281
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
282
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
283
+ # * `:retry_codes` (*type:* `Array<String>`) -
284
+ # The error codes that should trigger a retry.
285
+ #
286
+ # @return [::Google::Cloud::Config] The default configuration used by this library
287
+ #
288
+ def self.configure
289
+ yield ::Google::Cloud.configure.dialogflow if block_given?
537
290
 
538
- require "#{FILE_DIR}/#{version.to_s.downcase}"
539
- version_module = Google::Cloud::Dialogflow
540
- .constants
541
- .select {|sym| sym.to_s.downcase == version.to_s.downcase}
542
- .first
543
- Google::Cloud::Dialogflow.const_get(version_module)::Sessions.new(*args, **kwargs)
544
- end
291
+ ::Google::Cloud.configure.dialogflow
545
292
  end
546
293
  end
547
294
  end
548
295
  end
296
+
297
+ helper_path = ::File.join __dir__, "dialogflow", "helpers.rb"
298
+ require "google/cloud/dialogflow/helpers" if ::File.file? helper_path