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,777 @@
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/page_pb"
21
+ require "google/cloud/dialogflow/cx/v3/pages/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 Pages
30
+ module Rest
31
+ ##
32
+ # REST client for the Pages service.
33
+ #
34
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::Page Pages}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :pages_stub
41
+
42
+ ##
43
+ # Configure the Pages Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::CX::V3::Pages::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Pages clients
51
+ # ::Google::Cloud::Dialogflow::CX::V3::Pages::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 Pages 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::Pages::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 Pages REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Pages::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Pages::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Pages 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
+ @pages_stub = ::Google::Cloud::Dialogflow::CX::V3::Pages::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 pages in the specified flow.
161
+ #
162
+ # @overload list_pages(request, options = nil)
163
+ # Pass arguments to `list_pages` via a request object, either of type
164
+ # {::Google::Cloud::Dialogflow::CX::V3::ListPagesRequest} or an equivalent Hash.
165
+ #
166
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListPagesRequest, ::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_pages(parent: nil, language_code: nil, page_size: nil, page_token: nil)
173
+ # Pass arguments to `list_pages` 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 flow to list all pages for.
179
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
180
+ # ID>/flows/<Flow ID>`.
181
+ # @param language_code [::String]
182
+ # The language to list pages for. The following fields are language
183
+ # dependent:
184
+ #
185
+ # * `Page.entry_fulfillment.messages`
186
+ # * `Page.entry_fulfillment.conditional_cases`
187
+ # * `Page.event_handlers.trigger_fulfillment.messages`
188
+ # * `Page.event_handlers.trigger_fulfillment.conditional_cases`
189
+ # * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
190
+ # *
191
+ # `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
192
+ # * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
193
+ # *
194
+ # `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
195
+ # * `Page.transition_routes.trigger_fulfillment.messages`
196
+ # * `Page.transition_routes.trigger_fulfillment.conditional_cases`
197
+ #
198
+ # If not specified, the agent's default language is used.
199
+ # [Many
200
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
201
+ # are supported.
202
+ # Note: languages must be enabled in the agent before they can be used.
203
+ # @param page_size [::Integer]
204
+ # The maximum number of items to return in a single page. By default 100 and
205
+ # at most 1000.
206
+ # @param page_token [::String]
207
+ # The next_page_token value returned from a previous list request.
208
+ # @yield [result, operation] Access the result along with the TransportOperation object
209
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Page>]
210
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
211
+ #
212
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Page>]
213
+ #
214
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
215
+ def list_pages request, options = nil
216
+ raise ::ArgumentError, "request must be provided" if request.nil?
217
+
218
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListPagesRequest
219
+
220
+ # Converts hash and nil to an options object
221
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
222
+
223
+ # Customize the options with defaults
224
+ call_metadata = @config.rpcs.list_pages.metadata.to_h
225
+
226
+ # Set x-goog-api-client and x-goog-user-project headers
227
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
228
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
229
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
230
+ transports_version_send: [:rest]
231
+
232
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
233
+
234
+ options.apply_defaults timeout: @config.rpcs.list_pages.timeout,
235
+ metadata: call_metadata,
236
+ retry_policy: @config.rpcs.list_pages.retry_policy
237
+
238
+ options.apply_defaults timeout: @config.timeout,
239
+ metadata: @config.metadata,
240
+ retry_policy: @config.retry_policy
241
+
242
+ @pages_stub.list_pages request, options do |result, operation|
243
+ result = ::Gapic::Rest::PagedEnumerable.new @pages_stub, :list_pages, "pages", request, result, options
244
+ yield result, operation if block_given?
245
+ return result
246
+ end
247
+ rescue ::Gapic::Rest::Error => e
248
+ raise ::Google::Cloud::Error.from_error(e)
249
+ end
250
+
251
+ ##
252
+ # Retrieves the specified page.
253
+ #
254
+ # @overload get_page(request, options = nil)
255
+ # Pass arguments to `get_page` via a request object, either of type
256
+ # {::Google::Cloud::Dialogflow::CX::V3::GetPageRequest} or an equivalent Hash.
257
+ #
258
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetPageRequest, ::Hash]
259
+ # A request object representing the call parameters. Required. To specify no
260
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
261
+ # @param options [::Gapic::CallOptions, ::Hash]
262
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
263
+ #
264
+ # @overload get_page(name: nil, language_code: nil)
265
+ # Pass arguments to `get_page` via keyword arguments. Note that at
266
+ # least one keyword argument is required. To specify no parameters, or to keep all
267
+ # the default parameter values, pass an empty Hash as a request object (see above).
268
+ #
269
+ # @param name [::String]
270
+ # Required. The name of the page.
271
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
272
+ # ID>/flows/<Flow ID>/pages/<Page ID>`.
273
+ # @param language_code [::String]
274
+ # The language to retrieve the page for. The following fields are language
275
+ # dependent:
276
+ #
277
+ # * `Page.entry_fulfillment.messages`
278
+ # * `Page.entry_fulfillment.conditional_cases`
279
+ # * `Page.event_handlers.trigger_fulfillment.messages`
280
+ # * `Page.event_handlers.trigger_fulfillment.conditional_cases`
281
+ # * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
282
+ # *
283
+ # `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
284
+ # * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
285
+ # *
286
+ # `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
287
+ # * `Page.transition_routes.trigger_fulfillment.messages`
288
+ # * `Page.transition_routes.trigger_fulfillment.conditional_cases`
289
+ #
290
+ # If not specified, the agent's default language is used.
291
+ # [Many
292
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
293
+ # are supported.
294
+ # Note: languages must be enabled in the agent before they can be used.
295
+ # @yield [result, operation] Access the result along with the TransportOperation object
296
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Page]
297
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
298
+ #
299
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Page]
300
+ #
301
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
302
+ def get_page request, options = nil
303
+ raise ::ArgumentError, "request must be provided" if request.nil?
304
+
305
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetPageRequest
306
+
307
+ # Converts hash and nil to an options object
308
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
309
+
310
+ # Customize the options with defaults
311
+ call_metadata = @config.rpcs.get_page.metadata.to_h
312
+
313
+ # Set x-goog-api-client and x-goog-user-project headers
314
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
315
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
316
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
317
+ transports_version_send: [:rest]
318
+
319
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
320
+
321
+ options.apply_defaults timeout: @config.rpcs.get_page.timeout,
322
+ metadata: call_metadata,
323
+ retry_policy: @config.rpcs.get_page.retry_policy
324
+
325
+ options.apply_defaults timeout: @config.timeout,
326
+ metadata: @config.metadata,
327
+ retry_policy: @config.retry_policy
328
+
329
+ @pages_stub.get_page request, options do |result, operation|
330
+ yield result, operation if block_given?
331
+ return result
332
+ end
333
+ rescue ::Gapic::Rest::Error => e
334
+ raise ::Google::Cloud::Error.from_error(e)
335
+ end
336
+
337
+ ##
338
+ # Creates a page in the specified flow.
339
+ #
340
+ # Note: You should always train a flow prior to sending it queries. See the
341
+ # [training
342
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
343
+ #
344
+ # @overload create_page(request, options = nil)
345
+ # Pass arguments to `create_page` via a request object, either of type
346
+ # {::Google::Cloud::Dialogflow::CX::V3::CreatePageRequest} or an equivalent Hash.
347
+ #
348
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreatePageRequest, ::Hash]
349
+ # A request object representing the call parameters. Required. To specify no
350
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
351
+ # @param options [::Gapic::CallOptions, ::Hash]
352
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
353
+ #
354
+ # @overload create_page(parent: nil, page: nil, language_code: nil)
355
+ # Pass arguments to `create_page` via keyword arguments. Note that at
356
+ # least one keyword argument is required. To specify no parameters, or to keep all
357
+ # the default parameter values, pass an empty Hash as a request object (see above).
358
+ #
359
+ # @param parent [::String]
360
+ # Required. The flow to create a page for.
361
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
362
+ # ID>/flows/<Flow ID>`.
363
+ # @param page [::Google::Cloud::Dialogflow::CX::V3::Page, ::Hash]
364
+ # Required. The page to create.
365
+ # @param language_code [::String]
366
+ # The language of the following fields in `page`:
367
+ #
368
+ # * `Page.entry_fulfillment.messages`
369
+ # * `Page.entry_fulfillment.conditional_cases`
370
+ # * `Page.event_handlers.trigger_fulfillment.messages`
371
+ # * `Page.event_handlers.trigger_fulfillment.conditional_cases`
372
+ # * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
373
+ # *
374
+ # `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
375
+ # * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
376
+ # *
377
+ # `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
378
+ # * `Page.transition_routes.trigger_fulfillment.messages`
379
+ # * `Page.transition_routes.trigger_fulfillment.conditional_cases`
380
+ #
381
+ # If not specified, the agent's default language is used.
382
+ # [Many
383
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
384
+ # are supported.
385
+ # Note: languages must be enabled in the agent before they can be used.
386
+ # @yield [result, operation] Access the result along with the TransportOperation object
387
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Page]
388
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
389
+ #
390
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Page]
391
+ #
392
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
393
+ def create_page request, options = nil
394
+ raise ::ArgumentError, "request must be provided" if request.nil?
395
+
396
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreatePageRequest
397
+
398
+ # Converts hash and nil to an options object
399
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
400
+
401
+ # Customize the options with defaults
402
+ call_metadata = @config.rpcs.create_page.metadata.to_h
403
+
404
+ # Set x-goog-api-client and x-goog-user-project headers
405
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
406
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
407
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
408
+ transports_version_send: [:rest]
409
+
410
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
411
+
412
+ options.apply_defaults timeout: @config.rpcs.create_page.timeout,
413
+ metadata: call_metadata,
414
+ retry_policy: @config.rpcs.create_page.retry_policy
415
+
416
+ options.apply_defaults timeout: @config.timeout,
417
+ metadata: @config.metadata,
418
+ retry_policy: @config.retry_policy
419
+
420
+ @pages_stub.create_page request, options do |result, operation|
421
+ yield result, operation if block_given?
422
+ return result
423
+ end
424
+ rescue ::Gapic::Rest::Error => e
425
+ raise ::Google::Cloud::Error.from_error(e)
426
+ end
427
+
428
+ ##
429
+ # Updates the specified page.
430
+ #
431
+ # Note: You should always train a flow prior to sending it queries. See the
432
+ # [training
433
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
434
+ #
435
+ # @overload update_page(request, options = nil)
436
+ # Pass arguments to `update_page` via a request object, either of type
437
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdatePageRequest} or an equivalent Hash.
438
+ #
439
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdatePageRequest, ::Hash]
440
+ # A request object representing the call parameters. Required. To specify no
441
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
442
+ # @param options [::Gapic::CallOptions, ::Hash]
443
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
444
+ #
445
+ # @overload update_page(page: nil, language_code: nil, update_mask: nil)
446
+ # Pass arguments to `update_page` via keyword arguments. Note that at
447
+ # least one keyword argument is required. To specify no parameters, or to keep all
448
+ # the default parameter values, pass an empty Hash as a request object (see above).
449
+ #
450
+ # @param page [::Google::Cloud::Dialogflow::CX::V3::Page, ::Hash]
451
+ # Required. The page to update.
452
+ # @param language_code [::String]
453
+ # The language of the following fields in `page`:
454
+ #
455
+ # * `Page.entry_fulfillment.messages`
456
+ # * `Page.entry_fulfillment.conditional_cases`
457
+ # * `Page.event_handlers.trigger_fulfillment.messages`
458
+ # * `Page.event_handlers.trigger_fulfillment.conditional_cases`
459
+ # * `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.messages`
460
+ # *
461
+ # `Page.form.parameters.fill_behavior.initial_prompt_fulfillment.conditional_cases`
462
+ # * `Page.form.parameters.fill_behavior.reprompt_event_handlers.messages`
463
+ # *
464
+ # `Page.form.parameters.fill_behavior.reprompt_event_handlers.conditional_cases`
465
+ # * `Page.transition_routes.trigger_fulfillment.messages`
466
+ # * `Page.transition_routes.trigger_fulfillment.conditional_cases`
467
+ #
468
+ # If not specified, the agent's default language is used.
469
+ # [Many
470
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
471
+ # are supported.
472
+ # Note: languages must be enabled in the agent before they can be used.
473
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
474
+ # The mask to control which fields get updated. If the mask is not present,
475
+ # all fields will be updated.
476
+ # @yield [result, operation] Access the result along with the TransportOperation object
477
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Page]
478
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
479
+ #
480
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Page]
481
+ #
482
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
483
+ def update_page request, options = nil
484
+ raise ::ArgumentError, "request must be provided" if request.nil?
485
+
486
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdatePageRequest
487
+
488
+ # Converts hash and nil to an options object
489
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
490
+
491
+ # Customize the options with defaults
492
+ call_metadata = @config.rpcs.update_page.metadata.to_h
493
+
494
+ # Set x-goog-api-client and x-goog-user-project headers
495
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
496
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
497
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
498
+ transports_version_send: [:rest]
499
+
500
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
501
+
502
+ options.apply_defaults timeout: @config.rpcs.update_page.timeout,
503
+ metadata: call_metadata,
504
+ retry_policy: @config.rpcs.update_page.retry_policy
505
+
506
+ options.apply_defaults timeout: @config.timeout,
507
+ metadata: @config.metadata,
508
+ retry_policy: @config.retry_policy
509
+
510
+ @pages_stub.update_page request, options do |result, operation|
511
+ yield result, operation if block_given?
512
+ return result
513
+ end
514
+ rescue ::Gapic::Rest::Error => e
515
+ raise ::Google::Cloud::Error.from_error(e)
516
+ end
517
+
518
+ ##
519
+ # Deletes the specified page.
520
+ #
521
+ # Note: You should always train a flow prior to sending it queries. See the
522
+ # [training
523
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
524
+ #
525
+ # @overload delete_page(request, options = nil)
526
+ # Pass arguments to `delete_page` via a request object, either of type
527
+ # {::Google::Cloud::Dialogflow::CX::V3::DeletePageRequest} or an equivalent Hash.
528
+ #
529
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeletePageRequest, ::Hash]
530
+ # A request object representing the call parameters. Required. To specify no
531
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
532
+ # @param options [::Gapic::CallOptions, ::Hash]
533
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
534
+ #
535
+ # @overload delete_page(name: nil, force: nil)
536
+ # Pass arguments to `delete_page` via keyword arguments. Note that at
537
+ # least one keyword argument is required. To specify no parameters, or to keep all
538
+ # the default parameter values, pass an empty Hash as a request object (see above).
539
+ #
540
+ # @param name [::String]
541
+ # Required. The name of the page to delete.
542
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
543
+ # ID>/Flows/<flow ID>/pages/<Page ID>`.
544
+ # @param force [::Boolean]
545
+ # This field has no effect for pages with no incoming transitions.
546
+ # For pages with incoming transitions:
547
+ #
548
+ # * If `force` is set to false, an error will be returned with message
549
+ # indicating the incoming transitions.
550
+ # * If `force` is set to true, Dialogflow will remove the page, as well as
551
+ # any transitions to the page (i.e. [Target
552
+ # page][EventHandler.target_page] in event handlers or [Target
553
+ # page][TransitionRoute.target_page] in transition routes that point to
554
+ # this page will be cleared).
555
+ # @yield [result, operation] Access the result along with the TransportOperation object
556
+ # @yieldparam result [::Google::Protobuf::Empty]
557
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
558
+ #
559
+ # @return [::Google::Protobuf::Empty]
560
+ #
561
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
562
+ def delete_page request, options = nil
563
+ raise ::ArgumentError, "request must be provided" if request.nil?
564
+
565
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeletePageRequest
566
+
567
+ # Converts hash and nil to an options object
568
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
569
+
570
+ # Customize the options with defaults
571
+ call_metadata = @config.rpcs.delete_page.metadata.to_h
572
+
573
+ # Set x-goog-api-client and x-goog-user-project headers
574
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
575
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
576
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
577
+ transports_version_send: [:rest]
578
+
579
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
580
+
581
+ options.apply_defaults timeout: @config.rpcs.delete_page.timeout,
582
+ metadata: call_metadata,
583
+ retry_policy: @config.rpcs.delete_page.retry_policy
584
+
585
+ options.apply_defaults timeout: @config.timeout,
586
+ metadata: @config.metadata,
587
+ retry_policy: @config.retry_policy
588
+
589
+ @pages_stub.delete_page request, options do |result, operation|
590
+ yield result, operation if block_given?
591
+ return result
592
+ end
593
+ rescue ::Gapic::Rest::Error => e
594
+ raise ::Google::Cloud::Error.from_error(e)
595
+ end
596
+
597
+ ##
598
+ # Configuration class for the Pages REST API.
599
+ #
600
+ # This class represents the configuration for Pages REST,
601
+ # providing control over timeouts, retry behavior, logging, transport
602
+ # parameters, and other low-level controls. Certain parameters can also be
603
+ # applied individually to specific RPCs. See
604
+ # {::Google::Cloud::Dialogflow::CX::V3::Pages::Rest::Client::Configuration::Rpcs}
605
+ # for a list of RPCs that can be configured independently.
606
+ #
607
+ # Configuration can be applied globally to all clients, or to a single client
608
+ # on construction.
609
+ #
610
+ # @example
611
+ #
612
+ # # Modify the global config, setting the timeout for
613
+ # # list_pages to 20 seconds,
614
+ # # and all remaining timeouts to 10 seconds.
615
+ # ::Google::Cloud::Dialogflow::CX::V3::Pages::Rest::Client.configure do |config|
616
+ # config.timeout = 10.0
617
+ # config.rpcs.list_pages.timeout = 20.0
618
+ # end
619
+ #
620
+ # # Apply the above configuration only to a new client.
621
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Pages::Rest::Client.new do |config|
622
+ # config.timeout = 10.0
623
+ # config.rpcs.list_pages.timeout = 20.0
624
+ # end
625
+ #
626
+ # @!attribute [rw] endpoint
627
+ # The hostname or hostname:port of the service endpoint.
628
+ # Defaults to `"dialogflow.googleapis.com"`.
629
+ # @return [::String]
630
+ # @!attribute [rw] credentials
631
+ # Credentials to send with calls. You may provide any of the following types:
632
+ # * (`String`) The path to a service account key file in JSON format
633
+ # * (`Hash`) A service account key as a Hash
634
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
635
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
636
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
637
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
638
+ # * (`nil`) indicating no credentials
639
+ # @return [::Object]
640
+ # @!attribute [rw] scope
641
+ # The OAuth scopes
642
+ # @return [::Array<::String>]
643
+ # @!attribute [rw] lib_name
644
+ # The library name as recorded in instrumentation and logging
645
+ # @return [::String]
646
+ # @!attribute [rw] lib_version
647
+ # The library version as recorded in instrumentation and logging
648
+ # @return [::String]
649
+ # @!attribute [rw] timeout
650
+ # The call timeout in seconds.
651
+ # @return [::Numeric]
652
+ # @!attribute [rw] metadata
653
+ # Additional headers to be sent with the call.
654
+ # @return [::Hash{::Symbol=>::String}]
655
+ # @!attribute [rw] retry_policy
656
+ # The retry policy. The value is a hash with the following keys:
657
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
658
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
659
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
660
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
661
+ # trigger a retry.
662
+ # @return [::Hash]
663
+ # @!attribute [rw] quota_project
664
+ # A separate project against which to charge quota.
665
+ # @return [::String]
666
+ #
667
+ class Configuration
668
+ extend ::Gapic::Config
669
+
670
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
671
+ config_attr :credentials, nil do |value|
672
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
673
+ allowed.any? { |klass| klass === value }
674
+ end
675
+ config_attr :scope, nil, ::String, ::Array, nil
676
+ config_attr :lib_name, nil, ::String, nil
677
+ config_attr :lib_version, nil, ::String, nil
678
+ config_attr :timeout, nil, ::Numeric, nil
679
+ config_attr :metadata, nil, ::Hash, nil
680
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
681
+ config_attr :quota_project, nil, ::String, nil
682
+
683
+ # @private
684
+ # Overrides for http bindings for the RPCs of this service
685
+ # are only used when this service is used as mixin, and only
686
+ # by the host service.
687
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
688
+ config_attr :bindings_override, {}, ::Hash, nil
689
+
690
+ # @private
691
+ def initialize parent_config = nil
692
+ @parent_config = parent_config unless parent_config.nil?
693
+
694
+ yield self if block_given?
695
+ end
696
+
697
+ ##
698
+ # Configurations for individual RPCs
699
+ # @return [Rpcs]
700
+ #
701
+ def rpcs
702
+ @rpcs ||= begin
703
+ parent_rpcs = nil
704
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
705
+ Rpcs.new parent_rpcs
706
+ end
707
+ end
708
+
709
+ ##
710
+ # Configuration RPC class for the Pages API.
711
+ #
712
+ # Includes fields providing the configuration for each RPC in this service.
713
+ # Each configuration object is of type `Gapic::Config::Method` and includes
714
+ # the following configuration fields:
715
+ #
716
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
717
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
718
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
719
+ # include the following keys:
720
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
721
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
722
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
723
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
724
+ # trigger a retry.
725
+ #
726
+ class Rpcs
727
+ ##
728
+ # RPC-specific configuration for `list_pages`
729
+ # @return [::Gapic::Config::Method]
730
+ #
731
+ attr_reader :list_pages
732
+ ##
733
+ # RPC-specific configuration for `get_page`
734
+ # @return [::Gapic::Config::Method]
735
+ #
736
+ attr_reader :get_page
737
+ ##
738
+ # RPC-specific configuration for `create_page`
739
+ # @return [::Gapic::Config::Method]
740
+ #
741
+ attr_reader :create_page
742
+ ##
743
+ # RPC-specific configuration for `update_page`
744
+ # @return [::Gapic::Config::Method]
745
+ #
746
+ attr_reader :update_page
747
+ ##
748
+ # RPC-specific configuration for `delete_page`
749
+ # @return [::Gapic::Config::Method]
750
+ #
751
+ attr_reader :delete_page
752
+
753
+ # @private
754
+ def initialize parent_rpcs = nil
755
+ list_pages_config = parent_rpcs.list_pages if parent_rpcs.respond_to? :list_pages
756
+ @list_pages = ::Gapic::Config::Method.new list_pages_config
757
+ get_page_config = parent_rpcs.get_page if parent_rpcs.respond_to? :get_page
758
+ @get_page = ::Gapic::Config::Method.new get_page_config
759
+ create_page_config = parent_rpcs.create_page if parent_rpcs.respond_to? :create_page
760
+ @create_page = ::Gapic::Config::Method.new create_page_config
761
+ update_page_config = parent_rpcs.update_page if parent_rpcs.respond_to? :update_page
762
+ @update_page = ::Gapic::Config::Method.new update_page_config
763
+ delete_page_config = parent_rpcs.delete_page if parent_rpcs.respond_to? :delete_page
764
+ @delete_page = ::Gapic::Config::Method.new delete_page_config
765
+
766
+ yield self if block_given?
767
+ end
768
+ end
769
+ end
770
+ end
771
+ end
772
+ end
773
+ end
774
+ end
775
+ end
776
+ end
777
+ end