google-cloud-dialogflow-cx-v3 0.13.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +1032 -0
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +815 -0
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +586 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest.rb +56 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +6 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/bindings_override.rb +104 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +472 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +168 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest.rb +55 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/changelogs.rb +6 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +456 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +168 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest.rb +55 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/deployments.rb +6 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +740 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +347 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest.rb +55 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +6 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +1028 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +815 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +585 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments/rest.rb +57 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +6 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +821 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +467 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest.rb +55 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +6 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +1182 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +815 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +646 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/flows/rest.rb +56 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +6 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +722 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +347 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +55 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +6 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +777 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +347 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/pages/rest.rb +55 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +6 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +55 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +673 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +347 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest.rb +55 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +6 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +688 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +384 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest.rb +56 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +6 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/session_pb.rb +1 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +3 -1
  54. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +576 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +254 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest.rb +58 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +6 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +1304 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +815 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +765 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest.rb +57 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +6 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +748 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +347 -0
  65. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest.rb +56 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +6 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  68. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +865 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +815 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +467 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/versions/rest.rb +56 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +6 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +677 -0
  74. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +347 -0
  75. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest.rb +55 -0
  76. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +6 -0
  77. data/lib/google/cloud/dialogflow/cx/v3.rb +5 -0
  78. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +3 -0
  79. metadata +61 -5
@@ -0,0 +1,677 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/cx/v3/webhook_pb"
21
+ require "google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module CX
28
+ module V3
29
+ module Webhooks
30
+ module Rest
31
+ ##
32
+ # REST client for the Webhooks service.
33
+ #
34
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::Webhook Webhooks}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :webhooks_stub
41
+
42
+ ##
43
+ # Configure the Webhooks Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Webhooks clients
51
+ # ::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client.configure do |config|
52
+ # config.timeout = 10.0
53
+ # end
54
+ #
55
+ # @yield [config] Configure the Client client.
56
+ # @yieldparam config [Client::Configuration]
57
+ #
58
+ # @return [Client::Configuration]
59
+ #
60
+ def self.configure
61
+ @configure ||= begin
62
+ namespace = ["Google", "Cloud", "Dialogflow", "CX", "V3"]
63
+ parent_config = while namespace.any?
64
+ parent_name = namespace.join "::"
65
+ parent_const = const_get parent_name
66
+ break parent_const.configure if parent_const.respond_to? :configure
67
+ namespace.pop
68
+ end
69
+ default_config = Client::Configuration.new parent_config
70
+
71
+ default_config.timeout = 60.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config
77
+ end
78
+ yield @configure if block_given?
79
+ @configure
80
+ end
81
+
82
+ ##
83
+ # Configure the Webhooks Client instance.
84
+ #
85
+ # The configuration is set to the derived mode, meaning that values can be changed,
86
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
87
+ # should be made on {Client.configure}.
88
+ #
89
+ # See {::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client::Configuration}
90
+ # for a description of the configuration fields.
91
+ #
92
+ # @yield [config] Configure the Client client.
93
+ # @yieldparam config [Client::Configuration]
94
+ #
95
+ # @return [Client::Configuration]
96
+ #
97
+ def configure
98
+ yield @config if block_given?
99
+ @config
100
+ end
101
+
102
+ ##
103
+ # Create a new Webhooks REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Webhooks client.
116
+ # @yieldparam config [Client::Configuration]
117
+ #
118
+ def initialize
119
+ # Create the configuration object
120
+ @config = Configuration.new Client.configure
121
+
122
+ # Yield the configuration if needed
123
+ yield @config if block_given?
124
+
125
+ # Create credentials
126
+ credentials = @config.credentials
127
+ # Use self-signed JWT if the endpoint is unchanged from default,
128
+ # but only if the default endpoint does not have a region prefix.
129
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
130
+ !@config.endpoint.split(".").first.include?("-")
131
+ credentials ||= Credentials.default scope: @config.scope,
132
+ enable_self_signed_jwt: enable_self_signed_jwt
133
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
134
+ credentials = Credentials.new credentials, scope: @config.scope
135
+ end
136
+
137
+ @quota_project_id = @config.quota_project
138
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
139
+
140
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ config.bindings_override = @config.bindings_override
145
+ end
146
+
147
+ @webhooks_stub = ::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
148
+ end
149
+
150
+ ##
151
+ # Get the associated client for mix-in of the Locations.
152
+ #
153
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
154
+ #
155
+ attr_reader :location_client
156
+
157
+ # Service calls
158
+
159
+ ##
160
+ # Returns the list of all webhooks in the specified agent.
161
+ #
162
+ # @overload list_webhooks(request, options = nil)
163
+ # Pass arguments to `list_webhooks` via a request object, either of type
164
+ # {::Google::Cloud::Dialogflow::CX::V3::ListWebhooksRequest} or an equivalent Hash.
165
+ #
166
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListWebhooksRequest, ::Hash]
167
+ # A request object representing the call parameters. Required. To specify no
168
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
169
+ # @param options [::Gapic::CallOptions, ::Hash]
170
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
171
+ #
172
+ # @overload list_webhooks(parent: nil, page_size: nil, page_token: nil)
173
+ # Pass arguments to `list_webhooks` via keyword arguments. Note that at
174
+ # least one keyword argument is required. To specify no parameters, or to keep all
175
+ # the default parameter values, pass an empty Hash as a request object (see above).
176
+ #
177
+ # @param parent [::String]
178
+ # Required. The agent to list all webhooks for.
179
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
180
+ # @param page_size [::Integer]
181
+ # The maximum number of items to return in a single page. By default 100 and
182
+ # at most 1000.
183
+ # @param page_token [::String]
184
+ # The next_page_token value returned from a previous list request.
185
+ # @yield [result, operation] Access the result along with the TransportOperation object
186
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Webhook>]
187
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
188
+ #
189
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Webhook>]
190
+ #
191
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
192
+ def list_webhooks request, options = nil
193
+ raise ::ArgumentError, "request must be provided" if request.nil?
194
+
195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListWebhooksRequest
196
+
197
+ # Converts hash and nil to an options object
198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
199
+
200
+ # Customize the options with defaults
201
+ call_metadata = @config.rpcs.list_webhooks.metadata.to_h
202
+
203
+ # Set x-goog-api-client and x-goog-user-project headers
204
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
206
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
207
+ transports_version_send: [:rest]
208
+
209
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
210
+
211
+ options.apply_defaults timeout: @config.rpcs.list_webhooks.timeout,
212
+ metadata: call_metadata,
213
+ retry_policy: @config.rpcs.list_webhooks.retry_policy
214
+
215
+ options.apply_defaults timeout: @config.timeout,
216
+ metadata: @config.metadata,
217
+ retry_policy: @config.retry_policy
218
+
219
+ @webhooks_stub.list_webhooks request, options do |result, operation|
220
+ result = ::Gapic::Rest::PagedEnumerable.new @webhooks_stub, :list_webhooks, "webhooks", request, result, options
221
+ yield result, operation if block_given?
222
+ return result
223
+ end
224
+ rescue ::Gapic::Rest::Error => e
225
+ raise ::Google::Cloud::Error.from_error(e)
226
+ end
227
+
228
+ ##
229
+ # Retrieves the specified webhook.
230
+ #
231
+ # @overload get_webhook(request, options = nil)
232
+ # Pass arguments to `get_webhook` via a request object, either of type
233
+ # {::Google::Cloud::Dialogflow::CX::V3::GetWebhookRequest} or an equivalent Hash.
234
+ #
235
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetWebhookRequest, ::Hash]
236
+ # A request object representing the call parameters. Required. To specify no
237
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
238
+ # @param options [::Gapic::CallOptions, ::Hash]
239
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
240
+ #
241
+ # @overload get_webhook(name: nil)
242
+ # Pass arguments to `get_webhook` via keyword arguments. Note that at
243
+ # least one keyword argument is required. To specify no parameters, or to keep all
244
+ # the default parameter values, pass an empty Hash as a request object (see above).
245
+ #
246
+ # @param name [::String]
247
+ # Required. The name of the webhook.
248
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
249
+ # ID>/webhooks/<Webhook ID>`.
250
+ # @yield [result, operation] Access the result along with the TransportOperation object
251
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Webhook]
252
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
253
+ #
254
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Webhook]
255
+ #
256
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
257
+ def get_webhook request, options = nil
258
+ raise ::ArgumentError, "request must be provided" if request.nil?
259
+
260
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetWebhookRequest
261
+
262
+ # Converts hash and nil to an options object
263
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
264
+
265
+ # Customize the options with defaults
266
+ call_metadata = @config.rpcs.get_webhook.metadata.to_h
267
+
268
+ # Set x-goog-api-client and x-goog-user-project headers
269
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
270
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
271
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
272
+ transports_version_send: [:rest]
273
+
274
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
275
+
276
+ options.apply_defaults timeout: @config.rpcs.get_webhook.timeout,
277
+ metadata: call_metadata,
278
+ retry_policy: @config.rpcs.get_webhook.retry_policy
279
+
280
+ options.apply_defaults timeout: @config.timeout,
281
+ metadata: @config.metadata,
282
+ retry_policy: @config.retry_policy
283
+
284
+ @webhooks_stub.get_webhook request, options do |result, operation|
285
+ yield result, operation if block_given?
286
+ return result
287
+ end
288
+ rescue ::Gapic::Rest::Error => e
289
+ raise ::Google::Cloud::Error.from_error(e)
290
+ end
291
+
292
+ ##
293
+ # Creates a webhook in the specified agent.
294
+ #
295
+ # @overload create_webhook(request, options = nil)
296
+ # Pass arguments to `create_webhook` via a request object, either of type
297
+ # {::Google::Cloud::Dialogflow::CX::V3::CreateWebhookRequest} or an equivalent Hash.
298
+ #
299
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreateWebhookRequest, ::Hash]
300
+ # A request object representing the call parameters. Required. To specify no
301
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
302
+ # @param options [::Gapic::CallOptions, ::Hash]
303
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
304
+ #
305
+ # @overload create_webhook(parent: nil, webhook: nil)
306
+ # Pass arguments to `create_webhook` via keyword arguments. Note that at
307
+ # least one keyword argument is required. To specify no parameters, or to keep all
308
+ # the default parameter values, pass an empty Hash as a request object (see above).
309
+ #
310
+ # @param parent [::String]
311
+ # Required. The agent to create a webhook for.
312
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
313
+ # @param webhook [::Google::Cloud::Dialogflow::CX::V3::Webhook, ::Hash]
314
+ # Required. The webhook to create.
315
+ # @yield [result, operation] Access the result along with the TransportOperation object
316
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Webhook]
317
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
318
+ #
319
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Webhook]
320
+ #
321
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
322
+ def create_webhook request, options = nil
323
+ raise ::ArgumentError, "request must be provided" if request.nil?
324
+
325
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateWebhookRequest
326
+
327
+ # Converts hash and nil to an options object
328
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
329
+
330
+ # Customize the options with defaults
331
+ call_metadata = @config.rpcs.create_webhook.metadata.to_h
332
+
333
+ # Set x-goog-api-client and x-goog-user-project headers
334
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
335
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
336
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
337
+ transports_version_send: [:rest]
338
+
339
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
340
+
341
+ options.apply_defaults timeout: @config.rpcs.create_webhook.timeout,
342
+ metadata: call_metadata,
343
+ retry_policy: @config.rpcs.create_webhook.retry_policy
344
+
345
+ options.apply_defaults timeout: @config.timeout,
346
+ metadata: @config.metadata,
347
+ retry_policy: @config.retry_policy
348
+
349
+ @webhooks_stub.create_webhook request, options do |result, operation|
350
+ yield result, operation if block_given?
351
+ return result
352
+ end
353
+ rescue ::Gapic::Rest::Error => e
354
+ raise ::Google::Cloud::Error.from_error(e)
355
+ end
356
+
357
+ ##
358
+ # Updates the specified webhook.
359
+ #
360
+ # @overload update_webhook(request, options = nil)
361
+ # Pass arguments to `update_webhook` via a request object, either of type
362
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdateWebhookRequest} or an equivalent Hash.
363
+ #
364
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdateWebhookRequest, ::Hash]
365
+ # A request object representing the call parameters. Required. To specify no
366
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
367
+ # @param options [::Gapic::CallOptions, ::Hash]
368
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
369
+ #
370
+ # @overload update_webhook(webhook: nil, update_mask: nil)
371
+ # Pass arguments to `update_webhook` via keyword arguments. Note that at
372
+ # least one keyword argument is required. To specify no parameters, or to keep all
373
+ # the default parameter values, pass an empty Hash as a request object (see above).
374
+ #
375
+ # @param webhook [::Google::Cloud::Dialogflow::CX::V3::Webhook, ::Hash]
376
+ # Required. The webhook to update.
377
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
378
+ # The mask to control which fields get updated. If the mask is not present,
379
+ # all fields will be updated.
380
+ # @yield [result, operation] Access the result along with the TransportOperation object
381
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Webhook]
382
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
383
+ #
384
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Webhook]
385
+ #
386
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
387
+ def update_webhook request, options = nil
388
+ raise ::ArgumentError, "request must be provided" if request.nil?
389
+
390
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateWebhookRequest
391
+
392
+ # Converts hash and nil to an options object
393
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
394
+
395
+ # Customize the options with defaults
396
+ call_metadata = @config.rpcs.update_webhook.metadata.to_h
397
+
398
+ # Set x-goog-api-client and x-goog-user-project headers
399
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
400
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
401
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
402
+ transports_version_send: [:rest]
403
+
404
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
405
+
406
+ options.apply_defaults timeout: @config.rpcs.update_webhook.timeout,
407
+ metadata: call_metadata,
408
+ retry_policy: @config.rpcs.update_webhook.retry_policy
409
+
410
+ options.apply_defaults timeout: @config.timeout,
411
+ metadata: @config.metadata,
412
+ retry_policy: @config.retry_policy
413
+
414
+ @webhooks_stub.update_webhook request, options do |result, operation|
415
+ yield result, operation if block_given?
416
+ return result
417
+ end
418
+ rescue ::Gapic::Rest::Error => e
419
+ raise ::Google::Cloud::Error.from_error(e)
420
+ end
421
+
422
+ ##
423
+ # Deletes the specified webhook.
424
+ #
425
+ # @overload delete_webhook(request, options = nil)
426
+ # Pass arguments to `delete_webhook` via a request object, either of type
427
+ # {::Google::Cloud::Dialogflow::CX::V3::DeleteWebhookRequest} or an equivalent Hash.
428
+ #
429
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeleteWebhookRequest, ::Hash]
430
+ # A request object representing the call parameters. Required. To specify no
431
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
432
+ # @param options [::Gapic::CallOptions, ::Hash]
433
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
434
+ #
435
+ # @overload delete_webhook(name: nil, force: nil)
436
+ # Pass arguments to `delete_webhook` via keyword arguments. Note that at
437
+ # least one keyword argument is required. To specify no parameters, or to keep all
438
+ # the default parameter values, pass an empty Hash as a request object (see above).
439
+ #
440
+ # @param name [::String]
441
+ # Required. The name of the webhook to delete.
442
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
443
+ # ID>/webhooks/<Webhook ID>`.
444
+ # @param force [::Boolean]
445
+ # This field has no effect for webhook not being used.
446
+ # For webhooks that are used by pages/flows/transition route groups:
447
+ #
448
+ # * If `force` is set to false, an error will be returned with message
449
+ # indicating the referenced resources.
450
+ # * If `force` is set to true, Dialogflow will remove the webhook, as well
451
+ # as any references to the webhook (i.e.
452
+ # {::Google::Cloud::Dialogflow::CX::V3::Fulfillment#webhook Webhook} and
453
+ # {::Google::Cloud::Dialogflow::CX::V3::Fulfillment#tag tag}in fulfillments that
454
+ # point to this webhook will be removed).
455
+ # @yield [result, operation] Access the result along with the TransportOperation object
456
+ # @yieldparam result [::Google::Protobuf::Empty]
457
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
458
+ #
459
+ # @return [::Google::Protobuf::Empty]
460
+ #
461
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
462
+ def delete_webhook request, options = nil
463
+ raise ::ArgumentError, "request must be provided" if request.nil?
464
+
465
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeleteWebhookRequest
466
+
467
+ # Converts hash and nil to an options object
468
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
469
+
470
+ # Customize the options with defaults
471
+ call_metadata = @config.rpcs.delete_webhook.metadata.to_h
472
+
473
+ # Set x-goog-api-client and x-goog-user-project headers
474
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
476
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
477
+ transports_version_send: [:rest]
478
+
479
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
480
+
481
+ options.apply_defaults timeout: @config.rpcs.delete_webhook.timeout,
482
+ metadata: call_metadata,
483
+ retry_policy: @config.rpcs.delete_webhook.retry_policy
484
+
485
+ options.apply_defaults timeout: @config.timeout,
486
+ metadata: @config.metadata,
487
+ retry_policy: @config.retry_policy
488
+
489
+ @webhooks_stub.delete_webhook request, options do |result, operation|
490
+ yield result, operation if block_given?
491
+ return result
492
+ end
493
+ rescue ::Gapic::Rest::Error => e
494
+ raise ::Google::Cloud::Error.from_error(e)
495
+ end
496
+
497
+ ##
498
+ # Configuration class for the Webhooks REST API.
499
+ #
500
+ # This class represents the configuration for Webhooks REST,
501
+ # providing control over timeouts, retry behavior, logging, transport
502
+ # parameters, and other low-level controls. Certain parameters can also be
503
+ # applied individually to specific RPCs. See
504
+ # {::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client::Configuration::Rpcs}
505
+ # for a list of RPCs that can be configured independently.
506
+ #
507
+ # Configuration can be applied globally to all clients, or to a single client
508
+ # on construction.
509
+ #
510
+ # @example
511
+ #
512
+ # # Modify the global config, setting the timeout for
513
+ # # list_webhooks to 20 seconds,
514
+ # # and all remaining timeouts to 10 seconds.
515
+ # ::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client.configure do |config|
516
+ # config.timeout = 10.0
517
+ # config.rpcs.list_webhooks.timeout = 20.0
518
+ # end
519
+ #
520
+ # # Apply the above configuration only to a new client.
521
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Webhooks::Rest::Client.new do |config|
522
+ # config.timeout = 10.0
523
+ # config.rpcs.list_webhooks.timeout = 20.0
524
+ # end
525
+ #
526
+ # @!attribute [rw] endpoint
527
+ # The hostname or hostname:port of the service endpoint.
528
+ # Defaults to `"dialogflow.googleapis.com"`.
529
+ # @return [::String]
530
+ # @!attribute [rw] credentials
531
+ # Credentials to send with calls. You may provide any of the following types:
532
+ # * (`String`) The path to a service account key file in JSON format
533
+ # * (`Hash`) A service account key as a Hash
534
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
535
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
536
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
537
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
538
+ # * (`nil`) indicating no credentials
539
+ # @return [::Object]
540
+ # @!attribute [rw] scope
541
+ # The OAuth scopes
542
+ # @return [::Array<::String>]
543
+ # @!attribute [rw] lib_name
544
+ # The library name as recorded in instrumentation and logging
545
+ # @return [::String]
546
+ # @!attribute [rw] lib_version
547
+ # The library version as recorded in instrumentation and logging
548
+ # @return [::String]
549
+ # @!attribute [rw] timeout
550
+ # The call timeout in seconds.
551
+ # @return [::Numeric]
552
+ # @!attribute [rw] metadata
553
+ # Additional headers to be sent with the call.
554
+ # @return [::Hash{::Symbol=>::String}]
555
+ # @!attribute [rw] retry_policy
556
+ # The retry policy. The value is a hash with the following keys:
557
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
558
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
559
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
560
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
561
+ # trigger a retry.
562
+ # @return [::Hash]
563
+ # @!attribute [rw] quota_project
564
+ # A separate project against which to charge quota.
565
+ # @return [::String]
566
+ #
567
+ class Configuration
568
+ extend ::Gapic::Config
569
+
570
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
571
+ config_attr :credentials, nil do |value|
572
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
573
+ allowed.any? { |klass| klass === value }
574
+ end
575
+ config_attr :scope, nil, ::String, ::Array, nil
576
+ config_attr :lib_name, nil, ::String, nil
577
+ config_attr :lib_version, nil, ::String, nil
578
+ config_attr :timeout, nil, ::Numeric, nil
579
+ config_attr :metadata, nil, ::Hash, nil
580
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
581
+ config_attr :quota_project, nil, ::String, nil
582
+
583
+ # @private
584
+ # Overrides for http bindings for the RPCs of this service
585
+ # are only used when this service is used as mixin, and only
586
+ # by the host service.
587
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
588
+ config_attr :bindings_override, {}, ::Hash, nil
589
+
590
+ # @private
591
+ def initialize parent_config = nil
592
+ @parent_config = parent_config unless parent_config.nil?
593
+
594
+ yield self if block_given?
595
+ end
596
+
597
+ ##
598
+ # Configurations for individual RPCs
599
+ # @return [Rpcs]
600
+ #
601
+ def rpcs
602
+ @rpcs ||= begin
603
+ parent_rpcs = nil
604
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
605
+ Rpcs.new parent_rpcs
606
+ end
607
+ end
608
+
609
+ ##
610
+ # Configuration RPC class for the Webhooks API.
611
+ #
612
+ # Includes fields providing the configuration for each RPC in this service.
613
+ # Each configuration object is of type `Gapic::Config::Method` and includes
614
+ # the following configuration fields:
615
+ #
616
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
617
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
618
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
619
+ # include the following keys:
620
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
621
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
622
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
623
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
624
+ # trigger a retry.
625
+ #
626
+ class Rpcs
627
+ ##
628
+ # RPC-specific configuration for `list_webhooks`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :list_webhooks
632
+ ##
633
+ # RPC-specific configuration for `get_webhook`
634
+ # @return [::Gapic::Config::Method]
635
+ #
636
+ attr_reader :get_webhook
637
+ ##
638
+ # RPC-specific configuration for `create_webhook`
639
+ # @return [::Gapic::Config::Method]
640
+ #
641
+ attr_reader :create_webhook
642
+ ##
643
+ # RPC-specific configuration for `update_webhook`
644
+ # @return [::Gapic::Config::Method]
645
+ #
646
+ attr_reader :update_webhook
647
+ ##
648
+ # RPC-specific configuration for `delete_webhook`
649
+ # @return [::Gapic::Config::Method]
650
+ #
651
+ attr_reader :delete_webhook
652
+
653
+ # @private
654
+ def initialize parent_rpcs = nil
655
+ list_webhooks_config = parent_rpcs.list_webhooks if parent_rpcs.respond_to? :list_webhooks
656
+ @list_webhooks = ::Gapic::Config::Method.new list_webhooks_config
657
+ get_webhook_config = parent_rpcs.get_webhook if parent_rpcs.respond_to? :get_webhook
658
+ @get_webhook = ::Gapic::Config::Method.new get_webhook_config
659
+ create_webhook_config = parent_rpcs.create_webhook if parent_rpcs.respond_to? :create_webhook
660
+ @create_webhook = ::Gapic::Config::Method.new create_webhook_config
661
+ update_webhook_config = parent_rpcs.update_webhook if parent_rpcs.respond_to? :update_webhook
662
+ @update_webhook = ::Gapic::Config::Method.new update_webhook_config
663
+ delete_webhook_config = parent_rpcs.delete_webhook if parent_rpcs.respond_to? :delete_webhook
664
+ @delete_webhook = ::Gapic::Config::Method.new delete_webhook_config
665
+
666
+ yield self if block_given?
667
+ end
668
+ end
669
+ end
670
+ end
671
+ end
672
+ end
673
+ end
674
+ end
675
+ end
676
+ end
677
+ end