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