google-cloud-dialogflow-v2 0.4.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +6 -6
  3. data/README.md +1 -1
  4. data/lib/google/cloud/dialogflow/v2.rb +2 -1
  5. data/lib/google/cloud/dialogflow/v2/agents.rb +5 -5
  6. data/lib/google/cloud/dialogflow/v2/agents/client.rb +212 -207
  7. data/lib/google/cloud/dialogflow/v2/agents/credentials.rb +1 -1
  8. data/lib/google/cloud/dialogflow/v2/agents/operations.rb +109 -103
  9. data/lib/google/cloud/dialogflow/v2/agents/paths.rb +2 -2
  10. data/lib/google/cloud/dialogflow/v2/contexts.rb +3 -3
  11. data/lib/google/cloud/dialogflow/v2/contexts/client.rb +148 -143
  12. data/lib/google/cloud/dialogflow/v2/contexts/credentials.rb +1 -1
  13. data/lib/google/cloud/dialogflow/v2/contexts/paths.rb +14 -14
  14. data/lib/google/cloud/dialogflow/v2/entity_types.rb +2 -2
  15. data/lib/google/cloud/dialogflow/v2/entity_types/client.rb +238 -233
  16. data/lib/google/cloud/dialogflow/v2/entity_types/credentials.rb +1 -1
  17. data/lib/google/cloud/dialogflow/v2/entity_types/operations.rb +109 -103
  18. data/lib/google/cloud/dialogflow/v2/entity_types/paths.rb +3 -3
  19. data/lib/google/cloud/dialogflow/v2/environment_pb.rb +51 -0
  20. data/lib/google/cloud/dialogflow/v2/environment_services_pb.rb +45 -0
  21. data/lib/google/cloud/dialogflow/v2/environments.rb +49 -0
  22. data/lib/google/cloud/dialogflow/v2/environments/client.rb +384 -0
  23. data/lib/google/cloud/dialogflow/v2/environments/credentials.rb +52 -0
  24. data/lib/google/cloud/dialogflow/v2/environments/paths.rb +47 -0
  25. data/lib/google/cloud/dialogflow/v2/intents.rb +3 -3
  26. data/lib/google/cloud/dialogflow/v2/intents/client.rb +183 -178
  27. data/lib/google/cloud/dialogflow/v2/intents/credentials.rb +1 -1
  28. data/lib/google/cloud/dialogflow/v2/intents/operations.rb +109 -103
  29. data/lib/google/cloud/dialogflow/v2/intents/paths.rb +11 -11
  30. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +1 -1
  31. data/lib/google/cloud/dialogflow/v2/session_entity_types/client.rb +130 -125
  32. data/lib/google/cloud/dialogflow/v2/session_entity_types/credentials.rb +1 -1
  33. data/lib/google/cloud/dialogflow/v2/session_entity_types/paths.rb +14 -14
  34. data/lib/google/cloud/dialogflow/v2/sessions.rb +3 -3
  35. data/lib/google/cloud/dialogflow/v2/sessions/client.rb +86 -81
  36. data/lib/google/cloud/dialogflow/v2/sessions/credentials.rb +1 -1
  37. data/lib/google/cloud/dialogflow/v2/sessions/paths.rb +22 -22
  38. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  39. data/proto_docs/google/api/resource.rb +12 -12
  40. data/proto_docs/google/cloud/dialogflow/v2/agent.rb +69 -69
  41. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +45 -44
  42. data/proto_docs/google/cloud/dialogflow/v2/context.rb +38 -38
  43. data/proto_docs/google/cloud/dialogflow/v2/entity_type.rb +86 -86
  44. data/proto_docs/google/cloud/dialogflow/v2/environment.rb +103 -0
  45. data/proto_docs/google/cloud/dialogflow/v2/intent.rb +251 -250
  46. data/proto_docs/google/cloud/dialogflow/v2/session.rb +114 -106
  47. data/proto_docs/google/cloud/dialogflow/v2/session_entity_type.rb +35 -35
  48. data/proto_docs/google/cloud/dialogflow/v2/validation_result.rb +8 -8
  49. data/proto_docs/google/cloud/dialogflow/v2/webhook.rb +43 -36
  50. data/proto_docs/google/longrunning/operations.rb +30 -30
  51. data/proto_docs/google/protobuf/any.rb +4 -4
  52. data/proto_docs/google/protobuf/duration.rb +4 -4
  53. data/proto_docs/google/protobuf/empty.rb +2 -2
  54. data/proto_docs/google/protobuf/field_mask.rb +3 -3
  55. data/proto_docs/google/protobuf/struct.rb +18 -18
  56. data/proto_docs/google/protobuf/timestamp.rb +120 -0
  57. data/proto_docs/google/rpc/status.rb +6 -6
  58. data/proto_docs/google/type/latlng.rb +4 -4
  59. metadata +41 -6
  60. data/lib/google/cloud/common_resources_pb.rb +0 -15
@@ -24,7 +24,7 @@ module Google
24
24
  module V2
25
25
  module SessionEntityTypes
26
26
  # Credentials for the SessionEntityTypes API.
27
- class Credentials < Google::Auth::Credentials
27
+ class Credentials < ::Google::Auth::Credentials
28
28
  self.scope = [
29
29
  "https://www.googleapis.com/auth/cloud-platform",
30
30
  "https://www.googleapis.com/auth/dialogflow"
@@ -45,25 +45,25 @@ module Google
45
45
  # @param user [String]
46
46
  # @param session [String]
47
47
  #
48
- # @return [String]
48
+ # @return [::String]
49
49
  def session_path **args
50
50
  resources = {
51
51
  "project:session" => (proc do |project:, session:|
52
- raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
52
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
53
53
 
54
54
  "projects/#{project}/agent/sessions/#{session}"
55
55
  end),
56
56
  "environment:project:session:user" => (proc do |project:, environment:, user:, session:|
57
- raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
58
- raise ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
59
- raise ArgumentError, "user cannot contain /" if user.to_s.include? "/"
57
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
58
+ raise ::ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
59
+ raise ::ArgumentError, "user cannot contain /" if user.to_s.include? "/"
60
60
 
61
61
  "projects/#{project}/agent/environments/#{environment}/users/#{user}/sessions/#{session}"
62
62
  end)
63
63
  }
64
64
 
65
65
  resource = resources[args.keys.sort.join(":")]
66
- raise ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
66
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
67
67
  resource.call(**args)
68
68
  end
69
69
 
@@ -90,27 +90,27 @@ module Google
90
90
  # @param session [String]
91
91
  # @param entity_type [String]
92
92
  #
93
- # @return [String]
93
+ # @return [::String]
94
94
  def session_entity_type_path **args
95
95
  resources = {
96
96
  "entity_type:project:session" => (proc do |project:, session:, entity_type:|
97
- raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
98
- raise ArgumentError, "session cannot contain /" if session.to_s.include? "/"
97
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
98
+ raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"
99
99
 
100
100
  "projects/#{project}/agent/sessions/#{session}/entityTypes/#{entity_type}"
101
101
  end),
102
102
  "entity_type:environment:project:session:user" => (proc do |project:, environment:, user:, session:, entity_type:|
103
- raise ArgumentError, "project cannot contain /" if project.to_s.include? "/"
104
- raise ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
105
- raise ArgumentError, "user cannot contain /" if user.to_s.include? "/"
106
- raise ArgumentError, "session cannot contain /" if session.to_s.include? "/"
103
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
104
+ raise ::ArgumentError, "environment cannot contain /" if environment.to_s.include? "/"
105
+ raise ::ArgumentError, "user cannot contain /" if user.to_s.include? "/"
106
+ raise ::ArgumentError, "session cannot contain /" if session.to_s.include? "/"
107
107
 
108
108
  "projects/#{project}/agent/environments/#{environment}/users/#{user}/sessions/#{session}/entityTypes/#{entity_type}"
109
109
  end)
110
110
  }
111
111
 
112
112
  resource = resources[args.keys.sort.join(":")]
113
- raise ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
113
+ raise ::ArgumentError, "no resource found for values #{args.keys}" if resource.nil?
114
114
  resource.call(**args)
115
115
  end
116
116
 
@@ -32,14 +32,14 @@ module Google
32
32
  module V2
33
33
  ##
34
34
  # A session represents an interaction with a user. You retrieve user input
35
- # and pass it to the {Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
36
- # {Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
35
+ # and pass it to the {::Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
36
+ # {::Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
37
37
  # user intent and respond.
38
38
  #
39
39
  # To load this service and instantiate a client:
40
40
  #
41
41
  # require "google/cloud/dialogflow/v2/sessions"
42
- # client = Google::Cloud::Dialogflow::V2::Sessions::Client.new
42
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Client.new
43
43
  #
44
44
  module Sessions
45
45
  end
@@ -28,8 +28,8 @@ module Google
28
28
  # Client for the Sessions service.
29
29
  #
30
30
  # A session represents an interaction with a user. You retrieve user input
31
- # and pass it to the {Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
32
- # {Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
31
+ # and pass it to the {::Google::Cloud::Dialogflow::V2::Sessions::Client#detect_intent DetectIntent} (or
32
+ # {::Google::Cloud::Dialogflow::V2::Sessions::Client#streaming_detect_intent StreamingDetectIntent}) method to determine
33
33
  # user intent and respond.
34
34
  #
35
35
  class Client
@@ -41,15 +41,15 @@ module Google
41
41
  ##
42
42
  # Configure the Sessions Client class.
43
43
  #
44
- # See {Google::Cloud::Dialogflow::V2::Sessions::Client::Configuration}
44
+ # See {::Google::Cloud::Dialogflow::V2::Sessions::Client::Configuration}
45
45
  # for a description of the configuration fields.
46
46
  #
47
47
  # ## Example
48
48
  #
49
49
  # To modify the configuration for all Sessions clients:
50
50
  #
51
- # Google::Cloud::Dialogflow::V2::Sessions::Client.configure do |config|
52
- # config.timeout = 10_000
51
+ # ::Google::Cloud::Dialogflow::V2::Sessions::Client.configure do |config|
52
+ # config.timeout = 10.0
53
53
  # end
54
54
  #
55
55
  # @yield [config] Configure the Client client.
@@ -85,7 +85,7 @@ module Google
85
85
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
86
  # should be made on {Client.configure}.
87
87
  #
88
- # See {Google::Cloud::Dialogflow::V2::Sessions::Client::Configuration}
88
+ # See {::Google::Cloud::Dialogflow::V2::Sessions::Client::Configuration}
89
89
  # for a description of the configuration fields.
90
90
  #
91
91
  # @yield [config] Configure the Client client.
@@ -106,13 +106,13 @@ module Google
106
106
  # To create a new Sessions client with the default
107
107
  # configuration:
108
108
  #
109
- # client = Google::Cloud::Dialogflow::V2::Sessions::Client.new
109
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Client.new
110
110
  #
111
111
  # To create a new Sessions client with a custom
112
112
  # configuration:
113
113
  #
114
- # client = Google::Cloud::Dialogflow::V2::Sessions::Client.new do |config|
115
- # config.timeout = 10_000
114
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Client.new do |config|
115
+ # config.timeout = 10.0
116
116
  # end
117
117
  #
118
118
  # @yield [config] Configure the Sessions client.
@@ -137,10 +137,11 @@ module Google
137
137
  if credentials.is_a?(String) || credentials.is_a?(Hash)
138
138
  credentials = Credentials.new credentials, scope: @config.scope
139
139
  end
140
- @quota_project_id = credentials.respond_to?(:quota_project_id) ? credentials.quota_project_id : nil
140
+ @quota_project_id = @config.quota_project
141
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
142
 
142
- @sessions_stub = Gapic::ServiceStub.new(
143
- Google::Cloud::Dialogflow::V2::Sessions::Stub,
143
+ @sessions_stub = ::Gapic::ServiceStub.new(
144
+ ::Google::Cloud::Dialogflow::V2::Sessions::Stub,
144
145
  credentials: credentials,
145
146
  endpoint: @config.endpoint,
146
147
  channel_args: @config.channel_args,
@@ -158,12 +159,12 @@ module Google
158
159
  #
159
160
  # @overload detect_intent(request, options = nil)
160
161
  # Pass arguments to `detect_intent` via a request object, either of type
161
- # {Google::Cloud::Dialogflow::V2::DetectIntentRequest} or an equivalent Hash.
162
+ # {::Google::Cloud::Dialogflow::V2::DetectIntentRequest} or an equivalent Hash.
162
163
  #
163
- # @param request [Google::Cloud::Dialogflow::V2::DetectIntentRequest, Hash]
164
+ # @param request [::Google::Cloud::Dialogflow::V2::DetectIntentRequest, ::Hash]
164
165
  # A request object representing the call parameters. Required. To specify no
165
166
  # parameters, or to keep all the default parameter values, pass an empty Hash.
166
- # @param options [Gapic::CallOptions, Hash]
167
+ # @param options [::Gapic::CallOptions, ::Hash]
167
168
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
168
169
  #
169
170
  # @overload detect_intent(session: nil, query_params: nil, query_input: nil, output_audio_config: nil, output_audio_config_mask: nil, input_audio: nil)
@@ -171,7 +172,7 @@ module Google
171
172
  # least one keyword argument is required. To specify no parameters, or to keep all
172
173
  # the default parameter values, pass an empty Hash as a request object (see above).
173
174
  #
174
- # @param session [String]
175
+ # @param session [::String]
175
176
  # Required. The name of the session this query is sent to. Format:
176
177
  # `projects/<Project ID>/agent/sessions/<Session ID>`, or
177
178
  # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
@@ -181,9 +182,9 @@ module Google
181
182
  # `User Id`. They can be a random number or some type of user and session
182
183
  # identifiers (preferably hashed). The length of the `Session ID` and
183
184
  # `User ID` must not exceed 36 characters.
184
- # @param query_params [Google::Cloud::Dialogflow::V2::QueryParameters, Hash]
185
+ # @param query_params [::Google::Cloud::Dialogflow::V2::QueryParameters, ::Hash]
185
186
  # The parameters of this query.
186
- # @param query_input [Google::Cloud::Dialogflow::V2::QueryInput, Hash]
187
+ # @param query_input [::Google::Cloud::Dialogflow::V2::QueryInput, ::Hash]
187
188
  # Required. The input specification. It can be set to:
188
189
  #
189
190
  # 1. an audio config
@@ -192,43 +193,43 @@ module Google
192
193
  # 2. a conversational query in the form of text, or
193
194
  #
194
195
  # 3. an event that specifies which intent to trigger.
195
- # @param output_audio_config [Google::Cloud::Dialogflow::V2::OutputAudioConfig, Hash]
196
+ # @param output_audio_config [::Google::Cloud::Dialogflow::V2::OutputAudioConfig, ::Hash]
196
197
  # Instructs the speech synthesizer how to generate the output
197
198
  # audio. If this field is not set and agent-level speech synthesizer is not
198
199
  # configured, no output audio is generated.
199
- # @param output_audio_config_mask [Google::Protobuf::FieldMask, Hash]
200
- # Mask for {Google::Cloud::Dialogflow::V2::DetectIntentRequest#output_audio_config output_audio_config} indicating which settings in this
200
+ # @param output_audio_config_mask [::Google::Protobuf::FieldMask, ::Hash]
201
+ # Mask for {::Google::Cloud::Dialogflow::V2::DetectIntentRequest#output_audio_config output_audio_config} indicating which settings in this
201
202
  # request-level config should override speech synthesizer settings defined at
202
203
  # agent-level.
203
204
  #
204
- # If unspecified or empty, {Google::Cloud::Dialogflow::V2::DetectIntentRequest#output_audio_config output_audio_config} replaces the agent-level
205
+ # If unspecified or empty, {::Google::Cloud::Dialogflow::V2::DetectIntentRequest#output_audio_config output_audio_config} replaces the agent-level
205
206
  # config in its entirety.
206
- # @param input_audio [String]
207
+ # @param input_audio [::String]
207
208
  # The natural language speech audio to be processed. This field
208
209
  # should be populated iff `query_input` is set to an input audio config.
209
210
  # A single request can contain up to 1 minute of speech audio data.
210
211
  #
211
212
  # @yield [response, operation] Access the result along with the RPC operation
212
- # @yieldparam response [Google::Cloud::Dialogflow::V2::DetectIntentResponse]
213
- # @yieldparam operation [GRPC::ActiveCall::Operation]
213
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::DetectIntentResponse]
214
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
214
215
  #
215
- # @return [Google::Cloud::Dialogflow::V2::DetectIntentResponse]
216
+ # @return [::Google::Cloud::Dialogflow::V2::DetectIntentResponse]
216
217
  #
217
- # @raise [Google::Cloud::Error] if the RPC is aborted.
218
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
218
219
  #
219
220
  def detect_intent request, options = nil
220
- raise ArgumentError, "request must be provided" if request.nil?
221
+ raise ::ArgumentError, "request must be provided" if request.nil?
221
222
 
222
- request = Gapic::Protobuf.coerce request, to: Google::Cloud::Dialogflow::V2::DetectIntentRequest
223
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DetectIntentRequest
223
224
 
224
225
  # Converts hash and nil to an options object
225
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
227
 
227
228
  # Customize the options with defaults
228
229
  metadata = @config.rpcs.detect_intent.metadata.to_h
229
230
 
230
231
  # Set x-goog-api-client and x-goog-user-project headers
231
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
232
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
232
233
  lib_name: @config.lib_name, lib_version: @config.lib_version,
233
234
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
234
235
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -249,8 +250,8 @@ module Google
249
250
  yield response, operation if block_given?
250
251
  return response
251
252
  end
252
- rescue GRPC::BadStatus => e
253
- raise Google::Cloud::Error.from_error(e)
253
+ rescue ::GRPC::BadStatus => e
254
+ raise ::Google::Cloud::Error.from_error(e)
254
255
  end
255
256
 
256
257
  ##
@@ -258,37 +259,37 @@ module Google
258
259
  # and returns structured, actionable data as a result. This method is only
259
260
  # available via the gRPC API (not REST).
260
261
  #
261
- # @param request [Gapic::StreamInput, Enumerable<Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest, Hash>]
262
- # An enumerable of {Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest} instances.
263
- # @param options [Gapic::CallOptions, Hash]
262
+ # @param request [::Gapic::StreamInput, ::Enumerable<::Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest, ::Hash>]
263
+ # An enumerable of {::Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest} instances.
264
+ # @param options [::Gapic::CallOptions, ::Hash]
264
265
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
265
266
  #
266
267
  # @yield [response, operation] Access the result along with the RPC operation
267
- # @yieldparam response [Enumerable<Google::Cloud::Dialogflow::V2::StreamingDetectIntentResponse>]
268
- # @yieldparam operation [GRPC::ActiveCall::Operation]
268
+ # @yieldparam response [::Enumerable<::Google::Cloud::Dialogflow::V2::StreamingDetectIntentResponse>]
269
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
269
270
  #
270
- # @return [Enumerable<Google::Cloud::Dialogflow::V2::StreamingDetectIntentResponse>]
271
+ # @return [::Enumerable<::Google::Cloud::Dialogflow::V2::StreamingDetectIntentResponse>]
271
272
  #
272
- # @raise [Google::Cloud::Error] if the RPC is aborted.
273
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
273
274
  #
274
275
  def streaming_detect_intent request, options = nil
275
- unless request.is_a? Enumerable
276
- raise ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
276
+ unless request.is_a? ::Enumerable
277
+ raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
277
278
  request = request.to_enum
278
279
  end
279
280
 
280
281
  request = request.lazy.map do |req|
281
- Gapic::Protobuf.coerce req, to: Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest
282
+ ::Gapic::Protobuf.coerce req, to: ::Google::Cloud::Dialogflow::V2::StreamingDetectIntentRequest
282
283
  end
283
284
 
284
285
  # Converts hash and nil to an options object
285
- options = Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
286
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
286
287
 
287
288
  # Customize the options with defaults
288
289
  metadata = @config.rpcs.streaming_detect_intent.metadata.to_h
289
290
 
290
291
  # Set x-goog-api-client and x-goog-user-project headers
291
- metadata[:"x-goog-api-client"] ||= Gapic::Headers.x_goog_api_client \
292
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
293
  lib_name: @config.lib_name, lib_version: @config.lib_version,
293
294
  gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
294
295
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
@@ -303,8 +304,8 @@ module Google
303
304
  yield response, operation if block_given?
304
305
  return response
305
306
  end
306
- rescue GRPC::BadStatus => e
307
- raise Google::Cloud::Error.from_error(e)
307
+ rescue ::GRPC::BadStatus => e
308
+ raise ::Google::Cloud::Error.from_error(e)
308
309
  end
309
310
 
310
311
  ##
@@ -314,7 +315,7 @@ module Google
314
315
  # providing control over timeouts, retry behavior, logging, transport
315
316
  # parameters, and other low-level controls. Certain parameters can also be
316
317
  # applied individually to specific RPCs. See
317
- # {Google::Cloud::Dialogflow::V2::Sessions::Client::Configuration::Rpcs}
318
+ # {::Google::Cloud::Dialogflow::V2::Sessions::Client::Configuration::Rpcs}
318
319
  # for a list of RPCs that can be configured independently.
319
320
  #
320
321
  # Configuration can be applied globally to all clients, or to a single client
@@ -325,22 +326,22 @@ module Google
325
326
  # To modify the global config, setting the timeout for detect_intent
326
327
  # to 20 seconds, and all remaining timeouts to 10 seconds:
327
328
  #
328
- # Google::Cloud::Dialogflow::V2::Sessions::Client.configure do |config|
329
- # config.timeout = 10_000
330
- # config.rpcs.detect_intent.timeout = 20_000
329
+ # ::Google::Cloud::Dialogflow::V2::Sessions::Client.configure do |config|
330
+ # config.timeout = 10.0
331
+ # config.rpcs.detect_intent.timeout = 20.0
331
332
  # end
332
333
  #
333
334
  # To apply the above configuration only to a new client:
334
335
  #
335
- # client = Google::Cloud::Dialogflow::V2::Sessions::Client.new do |config|
336
- # config.timeout = 10_000
337
- # config.rpcs.detect_intent.timeout = 20_000
336
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Client.new do |config|
337
+ # config.timeout = 10.0
338
+ # config.rpcs.detect_intent.timeout = 20.0
338
339
  # end
339
340
  #
340
341
  # @!attribute [rw] endpoint
341
342
  # The hostname or hostname:port of the service endpoint.
342
343
  # Defaults to `"dialogflow.googleapis.com"`.
343
- # @return [String]
344
+ # @return [::String]
344
345
  # @!attribute [rw] credentials
345
346
  # Credentials to send with calls. You may provide any of the following types:
346
347
  # * (`String`) The path to a service account key file in JSON format
@@ -352,29 +353,29 @@ module Google
352
353
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
353
354
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
354
355
  # * (`nil`) indicating no credentials
355
- # @return [Object]
356
+ # @return [::Object]
356
357
  # @!attribute [rw] scope
357
358
  # The OAuth scopes
358
- # @return [Array<String>]
359
+ # @return [::Array<::String>]
359
360
  # @!attribute [rw] lib_name
360
361
  # The library name as recorded in instrumentation and logging
361
- # @return [String]
362
+ # @return [::String]
362
363
  # @!attribute [rw] lib_version
363
364
  # The library version as recorded in instrumentation and logging
364
- # @return [String]
365
+ # @return [::String]
365
366
  # @!attribute [rw] channel_args
366
367
  # Extra parameters passed to the gRPC channel. Note: this is ignored if a
367
368
  # `GRPC::Core::Channel` object is provided as the credential.
368
- # @return [Hash]
369
+ # @return [::Hash]
369
370
  # @!attribute [rw] interceptors
370
371
  # An array of interceptors that are run before calls are executed.
371
- # @return [Array<GRPC::ClientInterceptor>]
372
+ # @return [::Array<::GRPC::ClientInterceptor>]
372
373
  # @!attribute [rw] timeout
373
- # The call timeout in milliseconds.
374
- # @return [Numeric]
374
+ # The call timeout in seconds.
375
+ # @return [::Numeric]
375
376
  # @!attribute [rw] metadata
376
377
  # Additional gRPC headers to be sent with the call.
377
- # @return [Hash{Symbol=>String}]
378
+ # @return [::Hash{::Symbol=>::String}]
378
379
  # @!attribute [rw] retry_policy
379
380
  # The retry policy. The value is a hash with the following keys:
380
381
  # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
@@ -382,25 +383,29 @@ module Google
382
383
  # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
383
384
  # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
384
385
  # trigger a retry.
385
- # @return [Hash]
386
+ # @return [::Hash]
387
+ # @!attribute [rw] quota_project
388
+ # A separate project against which to charge quota.
389
+ # @return [::String]
386
390
  #
387
391
  class Configuration
388
- extend Gapic::Config
392
+ extend ::Gapic::Config
389
393
 
390
- config_attr :endpoint, "dialogflow.googleapis.com", String
391
- config_attr :credentials, nil do |value|
394
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
395
+ config_attr :credentials, nil do |value|
392
396
  allowed = [::String, ::Hash, ::Proc, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
393
397
  allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
394
398
  allowed.any? { |klass| klass === value }
395
399
  end
396
- config_attr :scope, nil, String, Array, nil
397
- config_attr :lib_name, nil, String, nil
398
- config_attr :lib_version, nil, String, nil
399
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, Hash, nil)
400
- config_attr :interceptors, nil, Array, nil
401
- config_attr :timeout, nil, Numeric, nil
402
- config_attr :metadata, nil, Hash, nil
403
- config_attr :retry_policy, nil, Hash, Proc, nil
400
+ config_attr :scope, nil, ::String, ::Array, nil
401
+ config_attr :lib_name, nil, ::String, nil
402
+ config_attr :lib_version, nil, ::String, nil
403
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
404
+ config_attr :interceptors, nil, ::Array, nil
405
+ config_attr :timeout, nil, ::Numeric, nil
406
+ config_attr :metadata, nil, ::Hash, nil
407
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
408
+ config_attr :quota_project, nil, ::String, nil
404
409
 
405
410
  # @private
406
411
  def initialize parent_config = nil
@@ -416,7 +421,7 @@ module Google
416
421
  def rpcs
417
422
  @rpcs ||= begin
418
423
  parent_rpcs = nil
419
- parent_rpcs = @parent_config.rpcs if @parent_config&.respond_to? :rpcs
424
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
420
425
  Rpcs.new parent_rpcs
421
426
  end
422
427
  end
@@ -441,21 +446,21 @@ module Google
441
446
  class Rpcs
442
447
  ##
443
448
  # RPC-specific configuration for `detect_intent`
444
- # @return [Gapic::Config::Method]
449
+ # @return [::Gapic::Config::Method]
445
450
  #
446
451
  attr_reader :detect_intent
447
452
  ##
448
453
  # RPC-specific configuration for `streaming_detect_intent`
449
- # @return [Gapic::Config::Method]
454
+ # @return [::Gapic::Config::Method]
450
455
  #
451
456
  attr_reader :streaming_detect_intent
452
457
 
453
458
  # @private
454
459
  def initialize parent_rpcs = nil
455
460
  detect_intent_config = parent_rpcs&.detect_intent if parent_rpcs&.respond_to? :detect_intent
456
- @detect_intent = Gapic::Config::Method.new detect_intent_config
461
+ @detect_intent = ::Gapic::Config::Method.new detect_intent_config
457
462
  streaming_detect_intent_config = parent_rpcs&.streaming_detect_intent if parent_rpcs&.respond_to? :streaming_detect_intent
458
- @streaming_detect_intent = Gapic::Config::Method.new streaming_detect_intent_config
463
+ @streaming_detect_intent = ::Gapic::Config::Method.new streaming_detect_intent_config
459
464
 
460
465
  yield self if block_given?
461
466
  end