google-cloud-dialogflow-v2 1.12.1 → 1.13.0

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 (67) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/v2/agent_coaching_instruction_pb.rb +47 -0
  3. data/lib/google/cloud/dialogflow/v2/answer_record_pb.rb +3 -1
  4. data/lib/google/cloud/dialogflow/v2/answer_records/paths.rb +19 -0
  5. data/lib/google/cloud/dialogflow/v2/audio_config_pb.rb +3 -1
  6. data/lib/google/cloud/dialogflow/v2/conversation_event_pb.rb +3 -1
  7. data/lib/google/cloud/dialogflow/v2/conversation_model_pb.rb +1 -1
  8. data/lib/google/cloud/dialogflow/v2/conversation_pb.rb +1 -1
  9. data/lib/google/cloud/dialogflow/v2/conversation_profile_pb.rb +3 -1
  10. data/lib/google/cloud/dialogflow/v2/conversations/client.rb +10 -1
  11. data/lib/google/cloud/dialogflow/v2/conversations/paths.rb +19 -0
  12. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +10 -1
  13. data/lib/google/cloud/dialogflow/v2/document_pb.rb +1 -1
  14. data/lib/google/cloud/dialogflow/v2/generator_evaluation_pb.rb +82 -0
  15. data/lib/google/cloud/dialogflow/v2/generator_evaluation_services_pb.rb +51 -0
  16. data/lib/google/cloud/dialogflow/v2/generator_evaluations/client.rb +815 -0
  17. data/lib/google/cloud/dialogflow/v2/generator_evaluations/credentials.rb +52 -0
  18. data/lib/google/cloud/dialogflow/v2/generator_evaluations/operations.rb +841 -0
  19. data/lib/google/cloud/dialogflow/v2/generator_evaluations/paths.rb +92 -0
  20. data/lib/google/cloud/dialogflow/v2/generator_evaluations/rest/client.rb +752 -0
  21. data/lib/google/cloud/dialogflow/v2/generator_evaluations/rest/operations.rb +945 -0
  22. data/lib/google/cloud/dialogflow/v2/generator_evaluations/rest/service_stub.rb +326 -0
  23. data/lib/google/cloud/dialogflow/v2/generator_evaluations/rest.rb +54 -0
  24. data/lib/google/cloud/dialogflow/v2/generator_evaluations.rb +56 -0
  25. data/lib/google/cloud/dialogflow/v2/generator_pb.rb +18 -1
  26. data/lib/google/cloud/dialogflow/v2/generators/paths.rb +19 -0
  27. data/lib/google/cloud/dialogflow/v2/operations_pb.rb +45 -0
  28. data/lib/google/cloud/dialogflow/v2/participant_pb.rb +3 -1
  29. data/lib/google/cloud/dialogflow/v2/rest.rb +3 -0
  30. data/lib/google/cloud/dialogflow/v2/sip_trunk_pb.rb +62 -0
  31. data/lib/google/cloud/dialogflow/v2/sip_trunk_services_pb.rb +53 -0
  32. data/lib/google/cloud/dialogflow/v2/sip_trunks/client.rb +885 -0
  33. data/lib/google/cloud/dialogflow/v2/sip_trunks/credentials.rb +52 -0
  34. data/lib/google/cloud/dialogflow/v2/sip_trunks/paths.rb +69 -0
  35. data/lib/google/cloud/dialogflow/v2/sip_trunks/rest/client.rb +815 -0
  36. data/lib/google/cloud/dialogflow/v2/sip_trunks/rest/service_stub.rb +388 -0
  37. data/lib/google/cloud/dialogflow/v2/sip_trunks/rest.rb +53 -0
  38. data/lib/google/cloud/dialogflow/v2/sip_trunks.rb +55 -0
  39. data/lib/google/cloud/dialogflow/v2/tool_call_pb.rb +52 -0
  40. data/lib/google/cloud/dialogflow/v2/tool_pb.rb +80 -0
  41. data/lib/google/cloud/dialogflow/v2/tool_services_pb.rb +55 -0
  42. data/lib/google/cloud/dialogflow/v2/tools/client.rb +897 -0
  43. data/lib/google/cloud/dialogflow/v2/tools/credentials.rb +52 -0
  44. data/lib/google/cloud/dialogflow/v2/tools/paths.rb +109 -0
  45. data/lib/google/cloud/dialogflow/v2/tools/rest/client.rb +827 -0
  46. data/lib/google/cloud/dialogflow/v2/tools/rest/service_stub.rb +388 -0
  47. data/lib/google/cloud/dialogflow/v2/tools/rest.rb +55 -0
  48. data/lib/google/cloud/dialogflow/v2/tools.rb +57 -0
  49. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  50. data/lib/google/cloud/dialogflow/v2/webhook_pb.rb +2 -1
  51. data/lib/google/cloud/dialogflow/v2.rb +3 -0
  52. data/proto_docs/google/cloud/dialogflow/v2/agent_coaching_instruction.rb +109 -0
  53. data/proto_docs/google/cloud/dialogflow/v2/answer_record.rb +8 -3
  54. data/proto_docs/google/cloud/dialogflow/v2/audio_config.rb +40 -0
  55. data/proto_docs/google/cloud/dialogflow/v2/conversation.rb +19 -2
  56. data/proto_docs/google/cloud/dialogflow/v2/conversation_event.rb +2 -0
  57. data/proto_docs/google/cloud/dialogflow/v2/conversation_model.rb +12 -0
  58. data/proto_docs/google/cloud/dialogflow/v2/conversation_profile.rb +38 -6
  59. data/proto_docs/google/cloud/dialogflow/v2/document.rb +3 -0
  60. data/proto_docs/google/cloud/dialogflow/v2/generator.rb +220 -4
  61. data/proto_docs/google/cloud/dialogflow/v2/generator_evaluation.rb +539 -0
  62. data/proto_docs/google/cloud/dialogflow/v2/operations.rb +39 -0
  63. data/proto_docs/google/cloud/dialogflow/v2/participant.rb +70 -7
  64. data/proto_docs/google/cloud/dialogflow/v2/sip_trunk.rb +211 -0
  65. data/proto_docs/google/cloud/dialogflow/v2/tool.rb +552 -0
  66. data/proto_docs/google/cloud/dialogflow/v2/tool_call.rb +115 -0
  67. metadata +39 -1
@@ -0,0 +1,897 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/cloud/dialogflow/v2/tool_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module Dialogflow
26
+ module V2
27
+ module Tools
28
+ ##
29
+ # Client for the Tools service.
30
+ #
31
+ # Tool Service for LLM powered Agent Assist. Tools can be used to interact with
32
+ # remote APIs (e.g. fetching orders) to retrieve additional information as
33
+ # input to LLM.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "dialogflow.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :tools_stub
46
+
47
+ ##
48
+ # Configure the Tools Client class.
49
+ #
50
+ # See {::Google::Cloud::Dialogflow::V2::Tools::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all Tools clients
56
+ # ::Google::Cloud::Dialogflow::V2::Tools::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the Tools Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Cloud::Dialogflow::V2::Tools::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @tools_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new Tools client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Cloud::Dialogflow::V2::Tools::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Cloud::Dialogflow::V2::Tools::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the Tools client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # These require statements are intentionally placed here to initialize
134
+ # the gRPC module only when it's required.
135
+ # See https://github.com/googleapis/toolkit/issues/446
136
+ require "gapic/grpc"
137
+ require "google/cloud/dialogflow/v2/tool_services_pb"
138
+
139
+ # Create the configuration object
140
+ @config = Configuration.new Client.configure
141
+
142
+ # Yield the configuration if needed
143
+ yield @config if block_given?
144
+
145
+ # Create credentials
146
+ credentials = @config.credentials
147
+ # Use self-signed JWT if the endpoint is unchanged from default,
148
+ # but only if the default endpoint does not have a region prefix.
149
+ enable_self_signed_jwt = @config.endpoint.nil? ||
150
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
151
+ !@config.endpoint.split(".").first.include?("-"))
152
+ credentials ||= Credentials.default scope: @config.scope,
153
+ enable_self_signed_jwt: enable_self_signed_jwt
154
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
155
+ credentials = Credentials.new credentials, scope: @config.scope
156
+ end
157
+ @quota_project_id = @config.quota_project
158
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
159
+
160
+ @tools_stub = ::Gapic::ServiceStub.new(
161
+ ::Google::Cloud::Dialogflow::V2::Tools::Stub,
162
+ credentials: credentials,
163
+ endpoint: @config.endpoint,
164
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
165
+ universe_domain: @config.universe_domain,
166
+ channel_args: @config.channel_args,
167
+ interceptors: @config.interceptors,
168
+ channel_pool_config: @config.channel_pool,
169
+ logger: @config.logger
170
+ )
171
+
172
+ @tools_stub.stub_logger&.info do |entry|
173
+ entry.set_system_name
174
+ entry.set_service
175
+ entry.message = "Created client for #{entry.service}"
176
+ entry.set_credentials_fields credentials
177
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
178
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
179
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
180
+ end
181
+
182
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
183
+ config.credentials = credentials
184
+ config.quota_project = @quota_project_id
185
+ config.endpoint = @tools_stub.endpoint
186
+ config.universe_domain = @tools_stub.universe_domain
187
+ config.logger = @tools_stub.logger if config.respond_to? :logger=
188
+ end
189
+ end
190
+
191
+ ##
192
+ # Get the associated client for mix-in of the Locations.
193
+ #
194
+ # @return [Google::Cloud::Location::Locations::Client]
195
+ #
196
+ attr_reader :location_client
197
+
198
+ ##
199
+ # The logger used for request/response debug logging.
200
+ #
201
+ # @return [Logger]
202
+ #
203
+ def logger
204
+ @tools_stub.logger
205
+ end
206
+
207
+ # Service calls
208
+
209
+ ##
210
+ # Creates a tool.
211
+ #
212
+ # @overload create_tool(request, options = nil)
213
+ # Pass arguments to `create_tool` via a request object, either of type
214
+ # {::Google::Cloud::Dialogflow::V2::CreateToolRequest} or an equivalent Hash.
215
+ #
216
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateToolRequest, ::Hash]
217
+ # A request object representing the call parameters. Required. To specify no
218
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
219
+ # @param options [::Gapic::CallOptions, ::Hash]
220
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
221
+ #
222
+ # @overload create_tool(parent: nil, tool: nil, tool_id: nil)
223
+ # Pass arguments to `create_tool` via keyword arguments. Note that at
224
+ # least one keyword argument is required. To specify no parameters, or to keep all
225
+ # the default parameter values, pass an empty Hash as a request object (see above).
226
+ #
227
+ # @param parent [::String]
228
+ # Required. The project/location to create tool for. Format:
229
+ # `projects/<Project ID>/locations/<Location ID>`
230
+ # @param tool [::Google::Cloud::Dialogflow::V2::Tool, ::Hash]
231
+ # Required. The tool to create.
232
+ # @param tool_id [::String]
233
+ # Optional. The ID to use for the tool, which will become the final
234
+ # component of the tool's resource name.
235
+ #
236
+ # The tool ID must be compliant with the regression formula
237
+ # `[a-zA-Z][a-zA-Z0-9_-]*` with the characters length in range of [3,64].
238
+ # If the field is not provide, an Id will be auto-generated.
239
+ # If the field is provided, the caller is responsible for
240
+ # 1. the uniqueness of the ID, otherwise the request will be rejected.
241
+ # 2. the consistency for whether to use custom ID or not under a project to
242
+ # better ensure uniqueness.
243
+ #
244
+ # @yield [response, operation] Access the result along with the RPC operation
245
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Tool]
246
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
247
+ #
248
+ # @return [::Google::Cloud::Dialogflow::V2::Tool]
249
+ #
250
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
251
+ #
252
+ # @example Basic example
253
+ # require "google/cloud/dialogflow/v2"
254
+ #
255
+ # # Create a client object. The client can be reused for multiple calls.
256
+ # client = Google::Cloud::Dialogflow::V2::Tools::Client.new
257
+ #
258
+ # # Create a request. To set request fields, pass in keyword arguments.
259
+ # request = Google::Cloud::Dialogflow::V2::CreateToolRequest.new
260
+ #
261
+ # # Call the create_tool method.
262
+ # result = client.create_tool request
263
+ #
264
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::Tool.
265
+ # p result
266
+ #
267
+ def create_tool request, options = nil
268
+ raise ::ArgumentError, "request must be provided" if request.nil?
269
+
270
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateToolRequest
271
+
272
+ # Converts hash and nil to an options object
273
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
274
+
275
+ # Customize the options with defaults
276
+ metadata = @config.rpcs.create_tool.metadata.to_h
277
+
278
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
279
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
280
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
281
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
282
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
283
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
284
+
285
+ header_params = {}
286
+ if request.parent
287
+ header_params["parent"] = request.parent
288
+ end
289
+
290
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
291
+ metadata[:"x-goog-request-params"] ||= request_params_header
292
+
293
+ options.apply_defaults timeout: @config.rpcs.create_tool.timeout,
294
+ metadata: metadata,
295
+ retry_policy: @config.rpcs.create_tool.retry_policy
296
+
297
+ options.apply_defaults timeout: @config.timeout,
298
+ metadata: @config.metadata,
299
+ retry_policy: @config.retry_policy
300
+
301
+ @tools_stub.call_rpc :create_tool, request, options: options do |response, operation|
302
+ yield response, operation if block_given?
303
+ end
304
+ rescue ::GRPC::BadStatus => e
305
+ raise ::Google::Cloud::Error.from_error(e)
306
+ end
307
+
308
+ ##
309
+ # Retrieves a tool.
310
+ #
311
+ # @overload get_tool(request, options = nil)
312
+ # Pass arguments to `get_tool` via a request object, either of type
313
+ # {::Google::Cloud::Dialogflow::V2::GetToolRequest} or an equivalent Hash.
314
+ #
315
+ # @param request [::Google::Cloud::Dialogflow::V2::GetToolRequest, ::Hash]
316
+ # A request object representing the call parameters. Required. To specify no
317
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
318
+ # @param options [::Gapic::CallOptions, ::Hash]
319
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
320
+ #
321
+ # @overload get_tool(name: nil)
322
+ # Pass arguments to `get_tool` via keyword arguments. Note that at
323
+ # least one keyword argument is required. To specify no parameters, or to keep all
324
+ # the default parameter values, pass an empty Hash as a request object (see above).
325
+ #
326
+ # @param name [::String]
327
+ # Required. The tool resource name to retrieve. Format:
328
+ # `projects/<Project ID>/locations/<Location ID>/tools/<Tool ID>`
329
+ #
330
+ # @yield [response, operation] Access the result along with the RPC operation
331
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Tool]
332
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
333
+ #
334
+ # @return [::Google::Cloud::Dialogflow::V2::Tool]
335
+ #
336
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
337
+ #
338
+ # @example Basic example
339
+ # require "google/cloud/dialogflow/v2"
340
+ #
341
+ # # Create a client object. The client can be reused for multiple calls.
342
+ # client = Google::Cloud::Dialogflow::V2::Tools::Client.new
343
+ #
344
+ # # Create a request. To set request fields, pass in keyword arguments.
345
+ # request = Google::Cloud::Dialogflow::V2::GetToolRequest.new
346
+ #
347
+ # # Call the get_tool method.
348
+ # result = client.get_tool request
349
+ #
350
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::Tool.
351
+ # p result
352
+ #
353
+ def get_tool request, options = nil
354
+ raise ::ArgumentError, "request must be provided" if request.nil?
355
+
356
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetToolRequest
357
+
358
+ # Converts hash and nil to an options object
359
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
360
+
361
+ # Customize the options with defaults
362
+ metadata = @config.rpcs.get_tool.metadata.to_h
363
+
364
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
365
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
366
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
367
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
368
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
369
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
370
+
371
+ header_params = {}
372
+ if request.name
373
+ header_params["name"] = request.name
374
+ end
375
+
376
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
377
+ metadata[:"x-goog-request-params"] ||= request_params_header
378
+
379
+ options.apply_defaults timeout: @config.rpcs.get_tool.timeout,
380
+ metadata: metadata,
381
+ retry_policy: @config.rpcs.get_tool.retry_policy
382
+
383
+ options.apply_defaults timeout: @config.timeout,
384
+ metadata: @config.metadata,
385
+ retry_policy: @config.retry_policy
386
+
387
+ @tools_stub.call_rpc :get_tool, request, options: options do |response, operation|
388
+ yield response, operation if block_given?
389
+ end
390
+ rescue ::GRPC::BadStatus => e
391
+ raise ::Google::Cloud::Error.from_error(e)
392
+ end
393
+
394
+ ##
395
+ # Lists tools.
396
+ #
397
+ # @overload list_tools(request, options = nil)
398
+ # Pass arguments to `list_tools` via a request object, either of type
399
+ # {::Google::Cloud::Dialogflow::V2::ListToolsRequest} or an equivalent Hash.
400
+ #
401
+ # @param request [::Google::Cloud::Dialogflow::V2::ListToolsRequest, ::Hash]
402
+ # A request object representing the call parameters. Required. To specify no
403
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
404
+ # @param options [::Gapic::CallOptions, ::Hash]
405
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
406
+ #
407
+ # @overload list_tools(parent: nil, page_size: nil, page_token: nil)
408
+ # Pass arguments to `list_tools` via keyword arguments. Note that at
409
+ # least one keyword argument is required. To specify no parameters, or to keep all
410
+ # the default parameter values, pass an empty Hash as a request object (see above).
411
+ #
412
+ # @param parent [::String]
413
+ # Required. The project/location to list tools for. Format:
414
+ # `projects/<Project ID>/locations/<Location ID>`
415
+ # @param page_size [::Integer]
416
+ # Optional. Maximum number of conversation models to return in a single page.
417
+ # Default to 10.
418
+ # @param page_token [::String]
419
+ # Optional. The next_page_token value returned from a previous list request.
420
+ #
421
+ # @yield [response, operation] Access the result along with the RPC operation
422
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Tool>]
423
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
424
+ #
425
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Tool>]
426
+ #
427
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
428
+ #
429
+ # @example Basic example
430
+ # require "google/cloud/dialogflow/v2"
431
+ #
432
+ # # Create a client object. The client can be reused for multiple calls.
433
+ # client = Google::Cloud::Dialogflow::V2::Tools::Client.new
434
+ #
435
+ # # Create a request. To set request fields, pass in keyword arguments.
436
+ # request = Google::Cloud::Dialogflow::V2::ListToolsRequest.new
437
+ #
438
+ # # Call the list_tools method.
439
+ # result = client.list_tools request
440
+ #
441
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
442
+ # # over elements, and API calls will be issued to fetch pages as needed.
443
+ # result.each do |item|
444
+ # # Each element is of type ::Google::Cloud::Dialogflow::V2::Tool.
445
+ # p item
446
+ # end
447
+ #
448
+ def list_tools request, options = nil
449
+ raise ::ArgumentError, "request must be provided" if request.nil?
450
+
451
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListToolsRequest
452
+
453
+ # Converts hash and nil to an options object
454
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
455
+
456
+ # Customize the options with defaults
457
+ metadata = @config.rpcs.list_tools.metadata.to_h
458
+
459
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
460
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
461
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
462
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
463
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
464
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
+
466
+ header_params = {}
467
+ if request.parent
468
+ header_params["parent"] = request.parent
469
+ end
470
+
471
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
472
+ metadata[:"x-goog-request-params"] ||= request_params_header
473
+
474
+ options.apply_defaults timeout: @config.rpcs.list_tools.timeout,
475
+ metadata: metadata,
476
+ retry_policy: @config.rpcs.list_tools.retry_policy
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
480
+ retry_policy: @config.retry_policy
481
+
482
+ @tools_stub.call_rpc :list_tools, request, options: options do |response, operation|
483
+ response = ::Gapic::PagedEnumerable.new @tools_stub, :list_tools, request, response, operation, options
484
+ yield response, operation if block_given?
485
+ throw :response, response
486
+ end
487
+ rescue ::GRPC::BadStatus => e
488
+ raise ::Google::Cloud::Error.from_error(e)
489
+ end
490
+
491
+ ##
492
+ # Deletes a tool.
493
+ #
494
+ # @overload delete_tool(request, options = nil)
495
+ # Pass arguments to `delete_tool` via a request object, either of type
496
+ # {::Google::Cloud::Dialogflow::V2::DeleteToolRequest} or an equivalent Hash.
497
+ #
498
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteToolRequest, ::Hash]
499
+ # A request object representing the call parameters. Required. To specify no
500
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
501
+ # @param options [::Gapic::CallOptions, ::Hash]
502
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
503
+ #
504
+ # @overload delete_tool(name: nil)
505
+ # Pass arguments to `delete_tool` via keyword arguments. Note that at
506
+ # least one keyword argument is required. To specify no parameters, or to keep all
507
+ # the default parameter values, pass an empty Hash as a request object (see above).
508
+ #
509
+ # @param name [::String]
510
+ # Required. The tool resource name to delete. Format:
511
+ # `projects/<Project ID>/locations/<Location ID>/tools/<Tool ID>`
512
+ #
513
+ # @yield [response, operation] Access the result along with the RPC operation
514
+ # @yieldparam response [::Google::Protobuf::Empty]
515
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
516
+ #
517
+ # @return [::Google::Protobuf::Empty]
518
+ #
519
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
520
+ #
521
+ # @example Basic example
522
+ # require "google/cloud/dialogflow/v2"
523
+ #
524
+ # # Create a client object. The client can be reused for multiple calls.
525
+ # client = Google::Cloud::Dialogflow::V2::Tools::Client.new
526
+ #
527
+ # # Create a request. To set request fields, pass in keyword arguments.
528
+ # request = Google::Cloud::Dialogflow::V2::DeleteToolRequest.new
529
+ #
530
+ # # Call the delete_tool method.
531
+ # result = client.delete_tool request
532
+ #
533
+ # # The returned object is of type Google::Protobuf::Empty.
534
+ # p result
535
+ #
536
+ def delete_tool request, options = nil
537
+ raise ::ArgumentError, "request must be provided" if request.nil?
538
+
539
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteToolRequest
540
+
541
+ # Converts hash and nil to an options object
542
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
543
+
544
+ # Customize the options with defaults
545
+ metadata = @config.rpcs.delete_tool.metadata.to_h
546
+
547
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
548
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
549
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
550
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
551
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
552
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
553
+
554
+ header_params = {}
555
+ if request.name
556
+ header_params["name"] = request.name
557
+ end
558
+
559
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
560
+ metadata[:"x-goog-request-params"] ||= request_params_header
561
+
562
+ options.apply_defaults timeout: @config.rpcs.delete_tool.timeout,
563
+ metadata: metadata,
564
+ retry_policy: @config.rpcs.delete_tool.retry_policy
565
+
566
+ options.apply_defaults timeout: @config.timeout,
567
+ metadata: @config.metadata,
568
+ retry_policy: @config.retry_policy
569
+
570
+ @tools_stub.call_rpc :delete_tool, request, options: options do |response, operation|
571
+ yield response, operation if block_given?
572
+ end
573
+ rescue ::GRPC::BadStatus => e
574
+ raise ::Google::Cloud::Error.from_error(e)
575
+ end
576
+
577
+ ##
578
+ # Updates a tool.
579
+ #
580
+ # @overload update_tool(request, options = nil)
581
+ # Pass arguments to `update_tool` via a request object, either of type
582
+ # {::Google::Cloud::Dialogflow::V2::UpdateToolRequest} or an equivalent Hash.
583
+ #
584
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateToolRequest, ::Hash]
585
+ # A request object representing the call parameters. Required. To specify no
586
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
587
+ # @param options [::Gapic::CallOptions, ::Hash]
588
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
589
+ #
590
+ # @overload update_tool(tool: nil, update_mask: nil)
591
+ # Pass arguments to `update_tool` via keyword arguments. Note that at
592
+ # least one keyword argument is required. To specify no parameters, or to keep all
593
+ # the default parameter values, pass an empty Hash as a request object (see above).
594
+ #
595
+ # @param tool [::Google::Cloud::Dialogflow::V2::Tool, ::Hash]
596
+ # Required. The tool to update.
597
+ # The name field of tool is to identify the tool to
598
+ # update.
599
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
600
+ # Optional. The list of fields to update.
601
+ #
602
+ # @yield [response, operation] Access the result along with the RPC operation
603
+ # @yieldparam response [::Google::Cloud::Dialogflow::V2::Tool]
604
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
605
+ #
606
+ # @return [::Google::Cloud::Dialogflow::V2::Tool]
607
+ #
608
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
609
+ #
610
+ # @example Basic example
611
+ # require "google/cloud/dialogflow/v2"
612
+ #
613
+ # # Create a client object. The client can be reused for multiple calls.
614
+ # client = Google::Cloud::Dialogflow::V2::Tools::Client.new
615
+ #
616
+ # # Create a request. To set request fields, pass in keyword arguments.
617
+ # request = Google::Cloud::Dialogflow::V2::UpdateToolRequest.new
618
+ #
619
+ # # Call the update_tool method.
620
+ # result = client.update_tool request
621
+ #
622
+ # # The returned object is of type Google::Cloud::Dialogflow::V2::Tool.
623
+ # p result
624
+ #
625
+ def update_tool request, options = nil
626
+ raise ::ArgumentError, "request must be provided" if request.nil?
627
+
628
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateToolRequest
629
+
630
+ # Converts hash and nil to an options object
631
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
632
+
633
+ # Customize the options with defaults
634
+ metadata = @config.rpcs.update_tool.metadata.to_h
635
+
636
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
637
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
638
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
639
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION
640
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
641
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
642
+
643
+ header_params = {}
644
+ if request.tool&.name
645
+ header_params["tool.name"] = request.tool.name
646
+ end
647
+
648
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
649
+ metadata[:"x-goog-request-params"] ||= request_params_header
650
+
651
+ options.apply_defaults timeout: @config.rpcs.update_tool.timeout,
652
+ metadata: metadata,
653
+ retry_policy: @config.rpcs.update_tool.retry_policy
654
+
655
+ options.apply_defaults timeout: @config.timeout,
656
+ metadata: @config.metadata,
657
+ retry_policy: @config.retry_policy
658
+
659
+ @tools_stub.call_rpc :update_tool, request, options: options do |response, operation|
660
+ yield response, operation if block_given?
661
+ end
662
+ rescue ::GRPC::BadStatus => e
663
+ raise ::Google::Cloud::Error.from_error(e)
664
+ end
665
+
666
+ ##
667
+ # Configuration class for the Tools API.
668
+ #
669
+ # This class represents the configuration for Tools,
670
+ # providing control over timeouts, retry behavior, logging, transport
671
+ # parameters, and other low-level controls. Certain parameters can also be
672
+ # applied individually to specific RPCs. See
673
+ # {::Google::Cloud::Dialogflow::V2::Tools::Client::Configuration::Rpcs}
674
+ # for a list of RPCs that can be configured independently.
675
+ #
676
+ # Configuration can be applied globally to all clients, or to a single client
677
+ # on construction.
678
+ #
679
+ # @example
680
+ #
681
+ # # Modify the global config, setting the timeout for
682
+ # # create_tool to 20 seconds,
683
+ # # and all remaining timeouts to 10 seconds.
684
+ # ::Google::Cloud::Dialogflow::V2::Tools::Client.configure do |config|
685
+ # config.timeout = 10.0
686
+ # config.rpcs.create_tool.timeout = 20.0
687
+ # end
688
+ #
689
+ # # Apply the above configuration only to a new client.
690
+ # client = ::Google::Cloud::Dialogflow::V2::Tools::Client.new do |config|
691
+ # config.timeout = 10.0
692
+ # config.rpcs.create_tool.timeout = 20.0
693
+ # end
694
+ #
695
+ # @!attribute [rw] endpoint
696
+ # A custom service endpoint, as a hostname or hostname:port. The default is
697
+ # nil, indicating to use the default endpoint in the current universe domain.
698
+ # @return [::String,nil]
699
+ # @!attribute [rw] credentials
700
+ # Credentials to send with calls. You may provide any of the following types:
701
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
702
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
703
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
704
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
705
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
706
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
707
+ # * (`nil`) indicating no credentials
708
+ #
709
+ # @note Warning: Passing a `String` to a keyfile path or a `Hash` of credentials
710
+ # is deprecated. Providing an unvalidated credential configuration to
711
+ # Google APIs can compromise the security of your systems and data.
712
+ #
713
+ # @example
714
+ #
715
+ # # The recommended way to provide credentials is to use the `make_creds` method
716
+ # # on the appropriate credentials class for your environment.
717
+ #
718
+ # require "googleauth"
719
+ #
720
+ # credentials = ::Google::Auth::ServiceAccountCredentials.make_creds(
721
+ # json_key_io: ::File.open("/path/to/keyfile.json")
722
+ # )
723
+ #
724
+ # client = ::Google::Cloud::Dialogflow::V2::Tools::Client.new do |config|
725
+ # config.credentials = credentials
726
+ # end
727
+ #
728
+ # @note Warning: If you accept a credential configuration (JSON file or Hash) from an
729
+ # external source for authentication to Google Cloud, you must validate it before
730
+ # providing it to a Google API client library. Providing an unvalidated credential
731
+ # configuration to Google APIs can compromise the security of your systems and data.
732
+ # For more information, refer to [Validate credential configurations from external
733
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
734
+ # @return [::Object]
735
+ # @!attribute [rw] scope
736
+ # The OAuth scopes
737
+ # @return [::Array<::String>]
738
+ # @!attribute [rw] lib_name
739
+ # The library name as recorded in instrumentation and logging
740
+ # @return [::String]
741
+ # @!attribute [rw] lib_version
742
+ # The library version as recorded in instrumentation and logging
743
+ # @return [::String]
744
+ # @!attribute [rw] channel_args
745
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
746
+ # `GRPC::Core::Channel` object is provided as the credential.
747
+ # @return [::Hash]
748
+ # @!attribute [rw] interceptors
749
+ # An array of interceptors that are run before calls are executed.
750
+ # @return [::Array<::GRPC::ClientInterceptor>]
751
+ # @!attribute [rw] timeout
752
+ # The call timeout in seconds.
753
+ # @return [::Numeric]
754
+ # @!attribute [rw] metadata
755
+ # Additional gRPC headers to be sent with the call.
756
+ # @return [::Hash{::Symbol=>::String}]
757
+ # @!attribute [rw] retry_policy
758
+ # The retry policy. The value is a hash with the following keys:
759
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
760
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
761
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
762
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
763
+ # trigger a retry.
764
+ # @return [::Hash]
765
+ # @!attribute [rw] quota_project
766
+ # A separate project against which to charge quota.
767
+ # @return [::String]
768
+ # @!attribute [rw] universe_domain
769
+ # The universe domain within which to make requests. This determines the
770
+ # default endpoint URL. The default value of nil uses the environment
771
+ # universe (usually the default "googleapis.com" universe).
772
+ # @return [::String,nil]
773
+ # @!attribute [rw] logger
774
+ # A custom logger to use for request/response debug logging, or the value
775
+ # `:default` (the default) to construct a default logger, or `nil` to
776
+ # explicitly disable logging.
777
+ # @return [::Logger,:default,nil]
778
+ #
779
+ class Configuration
780
+ extend ::Gapic::Config
781
+
782
+ # @private
783
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
784
+ DEFAULT_ENDPOINT = "dialogflow.googleapis.com"
785
+
786
+ config_attr :endpoint, nil, ::String, nil
787
+ config_attr :credentials, nil do |value|
788
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
789
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
790
+ allowed.any? { |klass| klass === value }
791
+ end
792
+ config_attr :scope, nil, ::String, ::Array, nil
793
+ config_attr :lib_name, nil, ::String, nil
794
+ config_attr :lib_version, nil, ::String, nil
795
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
796
+ config_attr :interceptors, nil, ::Array, nil
797
+ config_attr :timeout, nil, ::Numeric, nil
798
+ config_attr :metadata, nil, ::Hash, nil
799
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
800
+ config_attr :quota_project, nil, ::String, nil
801
+ config_attr :universe_domain, nil, ::String, nil
802
+ config_attr :logger, :default, ::Logger, nil, :default
803
+
804
+ # @private
805
+ def initialize parent_config = nil
806
+ @parent_config = parent_config unless parent_config.nil?
807
+
808
+ yield self if block_given?
809
+ end
810
+
811
+ ##
812
+ # Configurations for individual RPCs
813
+ # @return [Rpcs]
814
+ #
815
+ def rpcs
816
+ @rpcs ||= begin
817
+ parent_rpcs = nil
818
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
819
+ Rpcs.new parent_rpcs
820
+ end
821
+ end
822
+
823
+ ##
824
+ # Configuration for the channel pool
825
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
826
+ #
827
+ def channel_pool
828
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
829
+ end
830
+
831
+ ##
832
+ # Configuration RPC class for the Tools API.
833
+ #
834
+ # Includes fields providing the configuration for each RPC in this service.
835
+ # Each configuration object is of type `Gapic::Config::Method` and includes
836
+ # the following configuration fields:
837
+ #
838
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
839
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
840
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
841
+ # include the following keys:
842
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
843
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
844
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
845
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
846
+ # trigger a retry.
847
+ #
848
+ class Rpcs
849
+ ##
850
+ # RPC-specific configuration for `create_tool`
851
+ # @return [::Gapic::Config::Method]
852
+ #
853
+ attr_reader :create_tool
854
+ ##
855
+ # RPC-specific configuration for `get_tool`
856
+ # @return [::Gapic::Config::Method]
857
+ #
858
+ attr_reader :get_tool
859
+ ##
860
+ # RPC-specific configuration for `list_tools`
861
+ # @return [::Gapic::Config::Method]
862
+ #
863
+ attr_reader :list_tools
864
+ ##
865
+ # RPC-specific configuration for `delete_tool`
866
+ # @return [::Gapic::Config::Method]
867
+ #
868
+ attr_reader :delete_tool
869
+ ##
870
+ # RPC-specific configuration for `update_tool`
871
+ # @return [::Gapic::Config::Method]
872
+ #
873
+ attr_reader :update_tool
874
+
875
+ # @private
876
+ def initialize parent_rpcs = nil
877
+ create_tool_config = parent_rpcs.create_tool if parent_rpcs.respond_to? :create_tool
878
+ @create_tool = ::Gapic::Config::Method.new create_tool_config
879
+ get_tool_config = parent_rpcs.get_tool if parent_rpcs.respond_to? :get_tool
880
+ @get_tool = ::Gapic::Config::Method.new get_tool_config
881
+ list_tools_config = parent_rpcs.list_tools if parent_rpcs.respond_to? :list_tools
882
+ @list_tools = ::Gapic::Config::Method.new list_tools_config
883
+ delete_tool_config = parent_rpcs.delete_tool if parent_rpcs.respond_to? :delete_tool
884
+ @delete_tool = ::Gapic::Config::Method.new delete_tool_config
885
+ update_tool_config = parent_rpcs.update_tool if parent_rpcs.respond_to? :update_tool
886
+ @update_tool = ::Gapic::Config::Method.new update_tool_config
887
+
888
+ yield self if block_given?
889
+ end
890
+ end
891
+ end
892
+ end
893
+ end
894
+ end
895
+ end
896
+ end
897
+ end