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