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