google-cloud-dialogflow-cx-v3 0.14.0 → 0.15.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/client.rb +2 -2
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/operations.rb +2 -2
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +1032 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +815 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +586 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/agents/rest.rb +56 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +6 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/bindings_override.rb +104 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/changelogs/client.rb +2 -2
  12. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +472 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +168 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest.rb +55 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/changelogs.rb +6 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/deployments/client.rb +2 -2
  17. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +456 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +168 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest.rb +55 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/deployments.rb +6 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/entity_types/client.rb +2 -2
  22. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +740 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +347 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest.rb +55 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +6 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/environments/client.rb +2 -2
  27. data/lib/google/cloud/dialogflow/cx/v3/environments/operations.rb +2 -2
  28. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +1028 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +815 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +585 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/environments/rest.rb +57 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +6 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/experiments/client.rb +2 -2
  34. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +821 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +467 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest.rb +55 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +6 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/flows/client.rb +2 -2
  39. data/lib/google/cloud/dialogflow/cx/v3/flows/operations.rb +2 -2
  40. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +1182 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +815 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +646 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/flows/rest.rb +56 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +6 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/intents/client.rb +2 -2
  46. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +722 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +347 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +55 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +6 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/pages/client.rb +2 -2
  51. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +777 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +347 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/pages/rest.rb +55 -0
  54. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +6 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +55 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/client.rb +2 -2
  57. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +673 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +347 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest.rb +55 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +6 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/client.rb +2 -2
  62. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +688 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +384 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest.rb +56 -0
  65. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +6 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/sessions/client.rb +2 -2
  67. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +576 -0
  68. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +254 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest.rb +58 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +6 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/test_cases/client.rb +2 -2
  72. data/lib/google/cloud/dialogflow/cx/v3/test_cases/operations.rb +2 -2
  73. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +1304 -0
  74. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +815 -0
  75. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +765 -0
  76. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest.rb +57 -0
  77. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +6 -0
  78. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/client.rb +2 -2
  79. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +748 -0
  80. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +347 -0
  81. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest.rb +56 -0
  82. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +6 -0
  83. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  84. data/lib/google/cloud/dialogflow/cx/v3/versions/client.rb +2 -2
  85. data/lib/google/cloud/dialogflow/cx/v3/versions/operations.rb +2 -2
  86. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +865 -0
  87. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +815 -0
  88. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +467 -0
  89. data/lib/google/cloud/dialogflow/cx/v3/versions/rest.rb +56 -0
  90. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +6 -0
  91. data/lib/google/cloud/dialogflow/cx/v3/webhooks/client.rb +2 -2
  92. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +677 -0
  93. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +347 -0
  94. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest.rb +55 -0
  95. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +6 -0
  96. data/lib/google/cloud/dialogflow/cx/v3.rb +5 -0
  97. data/proto_docs/google/cloud/dialogflow/cx/v3/deployment.rb +1 -1
  98. data/proto_docs/google/cloud/dialogflow/cx/v3/session.rb +1 -1
  99. metadata +57 -2
@@ -0,0 +1,1182 @@
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/flow_pb"
21
+ require "google/cloud/dialogflow/cx/v3/flows/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 Flows
30
+ module Rest
31
+ ##
32
+ # REST client for the Flows service.
33
+ #
34
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::Flow Flows}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :flows_stub
41
+
42
+ ##
43
+ # Configure the Flows Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Flows clients
51
+ # ::Google::Cloud::Dialogflow::CX::V3::Flows::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 Flows 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::Flows::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 Flows REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Flows 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
+ @operations_client = ::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Operations.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ end
145
+
146
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
147
+ config.credentials = credentials
148
+ config.quota_project = @quota_project_id
149
+ config.endpoint = @config.endpoint
150
+ config.bindings_override = @config.bindings_override
151
+ end
152
+
153
+ @flows_stub = ::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
154
+ end
155
+
156
+ ##
157
+ # Get the associated client for long-running operations.
158
+ #
159
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Operations]
160
+ #
161
+ attr_reader :operations_client
162
+
163
+ ##
164
+ # Get the associated client for mix-in of the Locations.
165
+ #
166
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
167
+ #
168
+ attr_reader :location_client
169
+
170
+ # Service calls
171
+
172
+ ##
173
+ # Creates a flow in the specified agent.
174
+ #
175
+ # Note: You should always train a flow prior to sending it queries. See the
176
+ # [training
177
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
178
+ #
179
+ # @overload create_flow(request, options = nil)
180
+ # Pass arguments to `create_flow` via a request object, either of type
181
+ # {::Google::Cloud::Dialogflow::CX::V3::CreateFlowRequest} or an equivalent Hash.
182
+ #
183
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreateFlowRequest, ::Hash]
184
+ # A request object representing the call parameters. Required. To specify no
185
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
186
+ # @param options [::Gapic::CallOptions, ::Hash]
187
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
188
+ #
189
+ # @overload create_flow(parent: nil, flow: nil, language_code: nil)
190
+ # Pass arguments to `create_flow` via keyword arguments. Note that at
191
+ # least one keyword argument is required. To specify no parameters, or to keep all
192
+ # the default parameter values, pass an empty Hash as a request object (see above).
193
+ #
194
+ # @param parent [::String]
195
+ # Required. The agent to create a flow for.
196
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
197
+ # @param flow [::Google::Cloud::Dialogflow::CX::V3::Flow, ::Hash]
198
+ # Required. The flow to create.
199
+ # @param language_code [::String]
200
+ # The language of the following fields in `flow`:
201
+ #
202
+ # * `Flow.event_handlers.trigger_fulfillment.messages`
203
+ # * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
204
+ # * `Flow.transition_routes.trigger_fulfillment.messages`
205
+ # * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
206
+ #
207
+ # If not specified, the agent's default language is used.
208
+ # [Many
209
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
210
+ # are supported.
211
+ # Note: languages must be enabled in the agent before they can be used.
212
+ # @yield [result, operation] Access the result along with the TransportOperation object
213
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Flow]
214
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
215
+ #
216
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Flow]
217
+ #
218
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
219
+ def create_flow request, options = nil
220
+ raise ::ArgumentError, "request must be provided" if request.nil?
221
+
222
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateFlowRequest
223
+
224
+ # Converts hash and nil to an options object
225
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
226
+
227
+ # Customize the options with defaults
228
+ call_metadata = @config.rpcs.create_flow.metadata.to_h
229
+
230
+ # Set x-goog-api-client and x-goog-user-project headers
231
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
232
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
233
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
234
+ transports_version_send: [:rest]
235
+
236
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
237
+
238
+ options.apply_defaults timeout: @config.rpcs.create_flow.timeout,
239
+ metadata: call_metadata,
240
+ retry_policy: @config.rpcs.create_flow.retry_policy
241
+
242
+ options.apply_defaults timeout: @config.timeout,
243
+ metadata: @config.metadata,
244
+ retry_policy: @config.retry_policy
245
+
246
+ @flows_stub.create_flow request, options do |result, operation|
247
+ yield result, operation if block_given?
248
+ return result
249
+ end
250
+ rescue ::Gapic::Rest::Error => e
251
+ raise ::Google::Cloud::Error.from_error(e)
252
+ end
253
+
254
+ ##
255
+ # Deletes a specified flow.
256
+ #
257
+ # @overload delete_flow(request, options = nil)
258
+ # Pass arguments to `delete_flow` via a request object, either of type
259
+ # {::Google::Cloud::Dialogflow::CX::V3::DeleteFlowRequest} or an equivalent Hash.
260
+ #
261
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeleteFlowRequest, ::Hash]
262
+ # A request object representing the call parameters. Required. To specify no
263
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
264
+ # @param options [::Gapic::CallOptions, ::Hash]
265
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
266
+ #
267
+ # @overload delete_flow(name: nil, force: nil)
268
+ # Pass arguments to `delete_flow` via keyword arguments. Note that at
269
+ # least one keyword argument is required. To specify no parameters, or to keep all
270
+ # the default parameter values, pass an empty Hash as a request object (see above).
271
+ #
272
+ # @param name [::String]
273
+ # Required. The name of the flow to delete.
274
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
275
+ # ID>/flows/<Flow ID>`.
276
+ # @param force [::Boolean]
277
+ # This field has no effect for flows with no incoming transitions.
278
+ # For flows with incoming transitions:
279
+ #
280
+ # * If `force` is set to false, an error will be returned with message
281
+ # indicating the incoming transitions.
282
+ # * If `force` is set to true, Dialogflow will remove the flow, as well as
283
+ # any transitions to the flow (i.e. [Target
284
+ # flow][EventHandler.target_flow] in event handlers or [Target
285
+ # flow][TransitionRoute.target_flow] in transition routes that point to
286
+ # this flow will be cleared).
287
+ # @yield [result, operation] Access the result along with the TransportOperation object
288
+ # @yieldparam result [::Google::Protobuf::Empty]
289
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
290
+ #
291
+ # @return [::Google::Protobuf::Empty]
292
+ #
293
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
294
+ def delete_flow request, options = nil
295
+ raise ::ArgumentError, "request must be provided" if request.nil?
296
+
297
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeleteFlowRequest
298
+
299
+ # Converts hash and nil to an options object
300
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
301
+
302
+ # Customize the options with defaults
303
+ call_metadata = @config.rpcs.delete_flow.metadata.to_h
304
+
305
+ # Set x-goog-api-client and x-goog-user-project headers
306
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
307
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
308
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
309
+ transports_version_send: [:rest]
310
+
311
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
312
+
313
+ options.apply_defaults timeout: @config.rpcs.delete_flow.timeout,
314
+ metadata: call_metadata,
315
+ retry_policy: @config.rpcs.delete_flow.retry_policy
316
+
317
+ options.apply_defaults timeout: @config.timeout,
318
+ metadata: @config.metadata,
319
+ retry_policy: @config.retry_policy
320
+
321
+ @flows_stub.delete_flow request, options do |result, operation|
322
+ yield result, operation if block_given?
323
+ return result
324
+ end
325
+ rescue ::Gapic::Rest::Error => e
326
+ raise ::Google::Cloud::Error.from_error(e)
327
+ end
328
+
329
+ ##
330
+ # Returns the list of all flows in the specified agent.
331
+ #
332
+ # @overload list_flows(request, options = nil)
333
+ # Pass arguments to `list_flows` via a request object, either of type
334
+ # {::Google::Cloud::Dialogflow::CX::V3::ListFlowsRequest} or an equivalent Hash.
335
+ #
336
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListFlowsRequest, ::Hash]
337
+ # A request object representing the call parameters. Required. To specify no
338
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
339
+ # @param options [::Gapic::CallOptions, ::Hash]
340
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
341
+ #
342
+ # @overload list_flows(parent: nil, page_size: nil, page_token: nil, language_code: nil)
343
+ # Pass arguments to `list_flows` via keyword arguments. Note that at
344
+ # least one keyword argument is required. To specify no parameters, or to keep all
345
+ # the default parameter values, pass an empty Hash as a request object (see above).
346
+ #
347
+ # @param parent [::String]
348
+ # Required. The agent containing the flows.
349
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
350
+ # @param page_size [::Integer]
351
+ # The maximum number of items to return in a single page. By default 100 and
352
+ # at most 1000.
353
+ # @param page_token [::String]
354
+ # The next_page_token value returned from a previous list request.
355
+ # @param language_code [::String]
356
+ # The language to list flows for. The following fields are language
357
+ # dependent:
358
+ #
359
+ # * `Flow.event_handlers.trigger_fulfillment.messages`
360
+ # * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
361
+ # * `Flow.transition_routes.trigger_fulfillment.messages`
362
+ # * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
363
+ #
364
+ # If not specified, the agent's default language is used.
365
+ # [Many
366
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
367
+ # are supported.
368
+ # Note: languages must be enabled in the agent before they can be used.
369
+ # @yield [result, operation] Access the result along with the TransportOperation object
370
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Flow>]
371
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
372
+ #
373
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::Flow>]
374
+ #
375
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
376
+ def list_flows request, options = nil
377
+ raise ::ArgumentError, "request must be provided" if request.nil?
378
+
379
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ListFlowsRequest
380
+
381
+ # Converts hash and nil to an options object
382
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
383
+
384
+ # Customize the options with defaults
385
+ call_metadata = @config.rpcs.list_flows.metadata.to_h
386
+
387
+ # Set x-goog-api-client and x-goog-user-project headers
388
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
389
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
390
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
391
+ transports_version_send: [:rest]
392
+
393
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
394
+
395
+ options.apply_defaults timeout: @config.rpcs.list_flows.timeout,
396
+ metadata: call_metadata,
397
+ retry_policy: @config.rpcs.list_flows.retry_policy
398
+
399
+ options.apply_defaults timeout: @config.timeout,
400
+ metadata: @config.metadata,
401
+ retry_policy: @config.retry_policy
402
+
403
+ @flows_stub.list_flows request, options do |result, operation|
404
+ result = ::Gapic::Rest::PagedEnumerable.new @flows_stub, :list_flows, "flows", request, result, options
405
+ yield result, operation if block_given?
406
+ return result
407
+ end
408
+ rescue ::Gapic::Rest::Error => e
409
+ raise ::Google::Cloud::Error.from_error(e)
410
+ end
411
+
412
+ ##
413
+ # Retrieves the specified flow.
414
+ #
415
+ # @overload get_flow(request, options = nil)
416
+ # Pass arguments to `get_flow` via a request object, either of type
417
+ # {::Google::Cloud::Dialogflow::CX::V3::GetFlowRequest} or an equivalent Hash.
418
+ #
419
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetFlowRequest, ::Hash]
420
+ # A request object representing the call parameters. Required. To specify no
421
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
422
+ # @param options [::Gapic::CallOptions, ::Hash]
423
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
424
+ #
425
+ # @overload get_flow(name: nil, language_code: nil)
426
+ # Pass arguments to `get_flow` via keyword arguments. Note that at
427
+ # least one keyword argument is required. To specify no parameters, or to keep all
428
+ # the default parameter values, pass an empty Hash as a request object (see above).
429
+ #
430
+ # @param name [::String]
431
+ # Required. The name of the flow to get.
432
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
433
+ # ID>/flows/<Flow ID>`.
434
+ # @param language_code [::String]
435
+ # The language to retrieve the flow for. The following fields are language
436
+ # dependent:
437
+ #
438
+ # * `Flow.event_handlers.trigger_fulfillment.messages`
439
+ # * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
440
+ # * `Flow.transition_routes.trigger_fulfillment.messages`
441
+ # * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
442
+ #
443
+ # If not specified, the agent's default language is used.
444
+ # [Many
445
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
446
+ # are supported.
447
+ # Note: languages must be enabled in the agent before they can be used.
448
+ # @yield [result, operation] Access the result along with the TransportOperation object
449
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Flow]
450
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
451
+ #
452
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Flow]
453
+ #
454
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
455
+ def get_flow request, options = nil
456
+ raise ::ArgumentError, "request must be provided" if request.nil?
457
+
458
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetFlowRequest
459
+
460
+ # Converts hash and nil to an options object
461
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
462
+
463
+ # Customize the options with defaults
464
+ call_metadata = @config.rpcs.get_flow.metadata.to_h
465
+
466
+ # Set x-goog-api-client and x-goog-user-project headers
467
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
468
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
469
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
470
+ transports_version_send: [:rest]
471
+
472
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
473
+
474
+ options.apply_defaults timeout: @config.rpcs.get_flow.timeout,
475
+ metadata: call_metadata,
476
+ retry_policy: @config.rpcs.get_flow.retry_policy
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
480
+ retry_policy: @config.retry_policy
481
+
482
+ @flows_stub.get_flow request, options do |result, operation|
483
+ yield result, operation if block_given?
484
+ return result
485
+ end
486
+ rescue ::Gapic::Rest::Error => e
487
+ raise ::Google::Cloud::Error.from_error(e)
488
+ end
489
+
490
+ ##
491
+ # Updates the specified flow.
492
+ #
493
+ # Note: You should always train a flow prior to sending it queries. See the
494
+ # [training
495
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
496
+ #
497
+ # @overload update_flow(request, options = nil)
498
+ # Pass arguments to `update_flow` via a request object, either of type
499
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdateFlowRequest} or an equivalent Hash.
500
+ #
501
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdateFlowRequest, ::Hash]
502
+ # A request object representing the call parameters. Required. To specify no
503
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
504
+ # @param options [::Gapic::CallOptions, ::Hash]
505
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
506
+ #
507
+ # @overload update_flow(flow: nil, update_mask: nil, language_code: nil)
508
+ # Pass arguments to `update_flow` via keyword arguments. Note that at
509
+ # least one keyword argument is required. To specify no parameters, or to keep all
510
+ # the default parameter values, pass an empty Hash as a request object (see above).
511
+ #
512
+ # @param flow [::Google::Cloud::Dialogflow::CX::V3::Flow, ::Hash]
513
+ # Required. The flow to update.
514
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
515
+ # The mask to control which fields get updated. If the mask is not present,
516
+ # all fields will be updated.
517
+ # @param language_code [::String]
518
+ # The language of the following fields in `flow`:
519
+ #
520
+ # * `Flow.event_handlers.trigger_fulfillment.messages`
521
+ # * `Flow.event_handlers.trigger_fulfillment.conditional_cases`
522
+ # * `Flow.transition_routes.trigger_fulfillment.messages`
523
+ # * `Flow.transition_routes.trigger_fulfillment.conditional_cases`
524
+ #
525
+ # If not specified, the agent's default language is used.
526
+ # [Many
527
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
528
+ # are supported.
529
+ # Note: languages must be enabled in the agent before they can be used.
530
+ # @yield [result, operation] Access the result along with the TransportOperation object
531
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::Flow]
532
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
533
+ #
534
+ # @return [::Google::Cloud::Dialogflow::CX::V3::Flow]
535
+ #
536
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
537
+ def update_flow request, options = nil
538
+ raise ::ArgumentError, "request must be provided" if request.nil?
539
+
540
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateFlowRequest
541
+
542
+ # Converts hash and nil to an options object
543
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
544
+
545
+ # Customize the options with defaults
546
+ call_metadata = @config.rpcs.update_flow.metadata.to_h
547
+
548
+ # Set x-goog-api-client and x-goog-user-project headers
549
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
550
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
551
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
552
+ transports_version_send: [:rest]
553
+
554
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
555
+
556
+ options.apply_defaults timeout: @config.rpcs.update_flow.timeout,
557
+ metadata: call_metadata,
558
+ retry_policy: @config.rpcs.update_flow.retry_policy
559
+
560
+ options.apply_defaults timeout: @config.timeout,
561
+ metadata: @config.metadata,
562
+ retry_policy: @config.retry_policy
563
+
564
+ @flows_stub.update_flow request, options do |result, operation|
565
+ yield result, operation if block_given?
566
+ return result
567
+ end
568
+ rescue ::Gapic::Rest::Error => e
569
+ raise ::Google::Cloud::Error.from_error(e)
570
+ end
571
+
572
+ ##
573
+ # Trains the specified flow. Note that only the flow in 'draft' environment
574
+ # is trained.
575
+ #
576
+ # This method is a [long-running
577
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
578
+ # The returned `Operation` type has the following method-specific fields:
579
+ #
580
+ # - `metadata`: An empty [Struct
581
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
582
+ # - `response`: An [Empty
583
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
584
+ #
585
+ # Note: You should always train a flow prior to sending it queries. See the
586
+ # [training
587
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
588
+ #
589
+ # @overload train_flow(request, options = nil)
590
+ # Pass arguments to `train_flow` via a request object, either of type
591
+ # {::Google::Cloud::Dialogflow::CX::V3::TrainFlowRequest} or an equivalent Hash.
592
+ #
593
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::TrainFlowRequest, ::Hash]
594
+ # A request object representing the call parameters. Required. To specify no
595
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
596
+ # @param options [::Gapic::CallOptions, ::Hash]
597
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
598
+ #
599
+ # @overload train_flow(name: nil)
600
+ # Pass arguments to `train_flow` via keyword arguments. Note that at
601
+ # least one keyword argument is required. To specify no parameters, or to keep all
602
+ # the default parameter values, pass an empty Hash as a request object (see above).
603
+ #
604
+ # @param name [::String]
605
+ # Required. The flow to train.
606
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
607
+ # ID>/flows/<Flow ID>`.
608
+ # @yield [result, operation] Access the result along with the TransportOperation object
609
+ # @yieldparam result [::Gapic::Operation]
610
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
611
+ #
612
+ # @return [::Gapic::Operation]
613
+ #
614
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
615
+ def train_flow request, options = nil
616
+ raise ::ArgumentError, "request must be provided" if request.nil?
617
+
618
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::TrainFlowRequest
619
+
620
+ # Converts hash and nil to an options object
621
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
622
+
623
+ # Customize the options with defaults
624
+ call_metadata = @config.rpcs.train_flow.metadata.to_h
625
+
626
+ # Set x-goog-api-client and x-goog-user-project headers
627
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
628
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
629
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
630
+ transports_version_send: [:rest]
631
+
632
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
633
+
634
+ options.apply_defaults timeout: @config.rpcs.train_flow.timeout,
635
+ metadata: call_metadata,
636
+ retry_policy: @config.rpcs.train_flow.retry_policy
637
+
638
+ options.apply_defaults timeout: @config.timeout,
639
+ metadata: @config.metadata,
640
+ retry_policy: @config.retry_policy
641
+
642
+ @flows_stub.train_flow request, options do |result, operation|
643
+ result = ::Gapic::Operation.new result, @operations_client, options: options
644
+ yield result, operation if block_given?
645
+ return result
646
+ end
647
+ rescue ::Gapic::Rest::Error => e
648
+ raise ::Google::Cloud::Error.from_error(e)
649
+ end
650
+
651
+ ##
652
+ # Validates the specified flow and creates or updates validation results.
653
+ # Please call this API after the training is completed to get the complete
654
+ # validation results.
655
+ #
656
+ # @overload validate_flow(request, options = nil)
657
+ # Pass arguments to `validate_flow` via a request object, either of type
658
+ # {::Google::Cloud::Dialogflow::CX::V3::ValidateFlowRequest} or an equivalent Hash.
659
+ #
660
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ValidateFlowRequest, ::Hash]
661
+ # A request object representing the call parameters. Required. To specify no
662
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
663
+ # @param options [::Gapic::CallOptions, ::Hash]
664
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
665
+ #
666
+ # @overload validate_flow(name: nil, language_code: nil)
667
+ # Pass arguments to `validate_flow` via keyword arguments. Note that at
668
+ # least one keyword argument is required. To specify no parameters, or to keep all
669
+ # the default parameter values, pass an empty Hash as a request object (see above).
670
+ #
671
+ # @param name [::String]
672
+ # Required. The flow to validate.
673
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
674
+ # ID>/flows/<Flow ID>`.
675
+ # @param language_code [::String]
676
+ # If not specified, the agent's default language is used.
677
+ # @yield [result, operation] Access the result along with the TransportOperation object
678
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::FlowValidationResult]
679
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
680
+ #
681
+ # @return [::Google::Cloud::Dialogflow::CX::V3::FlowValidationResult]
682
+ #
683
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
684
+ def validate_flow request, options = nil
685
+ raise ::ArgumentError, "request must be provided" if request.nil?
686
+
687
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ValidateFlowRequest
688
+
689
+ # Converts hash and nil to an options object
690
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
691
+
692
+ # Customize the options with defaults
693
+ call_metadata = @config.rpcs.validate_flow.metadata.to_h
694
+
695
+ # Set x-goog-api-client and x-goog-user-project headers
696
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
697
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
698
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
699
+ transports_version_send: [:rest]
700
+
701
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
702
+
703
+ options.apply_defaults timeout: @config.rpcs.validate_flow.timeout,
704
+ metadata: call_metadata,
705
+ retry_policy: @config.rpcs.validate_flow.retry_policy
706
+
707
+ options.apply_defaults timeout: @config.timeout,
708
+ metadata: @config.metadata,
709
+ retry_policy: @config.retry_policy
710
+
711
+ @flows_stub.validate_flow request, options do |result, operation|
712
+ yield result, operation if block_given?
713
+ return result
714
+ end
715
+ rescue ::Gapic::Rest::Error => e
716
+ raise ::Google::Cloud::Error.from_error(e)
717
+ end
718
+
719
+ ##
720
+ # Gets the latest flow validation result. Flow validation is performed
721
+ # when ValidateFlow is called.
722
+ #
723
+ # @overload get_flow_validation_result(request, options = nil)
724
+ # Pass arguments to `get_flow_validation_result` via a request object, either of type
725
+ # {::Google::Cloud::Dialogflow::CX::V3::GetFlowValidationResultRequest} or an equivalent Hash.
726
+ #
727
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetFlowValidationResultRequest, ::Hash]
728
+ # A request object representing the call parameters. Required. To specify no
729
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
730
+ # @param options [::Gapic::CallOptions, ::Hash]
731
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
732
+ #
733
+ # @overload get_flow_validation_result(name: nil, language_code: nil)
734
+ # Pass arguments to `get_flow_validation_result` via keyword arguments. Note that at
735
+ # least one keyword argument is required. To specify no parameters, or to keep all
736
+ # the default parameter values, pass an empty Hash as a request object (see above).
737
+ #
738
+ # @param name [::String]
739
+ # Required. The flow name.
740
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
741
+ # ID>/flows/<Flow ID>/validationResult`.
742
+ # @param language_code [::String]
743
+ # If not specified, the agent's default language is used.
744
+ # @yield [result, operation] Access the result along with the TransportOperation object
745
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::FlowValidationResult]
746
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
747
+ #
748
+ # @return [::Google::Cloud::Dialogflow::CX::V3::FlowValidationResult]
749
+ #
750
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
751
+ def get_flow_validation_result request, options = nil
752
+ raise ::ArgumentError, "request must be provided" if request.nil?
753
+
754
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetFlowValidationResultRequest
755
+
756
+ # Converts hash and nil to an options object
757
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
758
+
759
+ # Customize the options with defaults
760
+ call_metadata = @config.rpcs.get_flow_validation_result.metadata.to_h
761
+
762
+ # Set x-goog-api-client and x-goog-user-project headers
763
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
764
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
765
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
766
+ transports_version_send: [:rest]
767
+
768
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
769
+
770
+ options.apply_defaults timeout: @config.rpcs.get_flow_validation_result.timeout,
771
+ metadata: call_metadata,
772
+ retry_policy: @config.rpcs.get_flow_validation_result.retry_policy
773
+
774
+ options.apply_defaults timeout: @config.timeout,
775
+ metadata: @config.metadata,
776
+ retry_policy: @config.retry_policy
777
+
778
+ @flows_stub.get_flow_validation_result request, options do |result, operation|
779
+ yield result, operation if block_given?
780
+ return result
781
+ end
782
+ rescue ::Gapic::Rest::Error => e
783
+ raise ::Google::Cloud::Error.from_error(e)
784
+ end
785
+
786
+ ##
787
+ # Imports the specified flow to the specified agent from a binary file.
788
+ #
789
+ # This method is a [long-running
790
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
791
+ # The returned `Operation` type has the following method-specific fields:
792
+ #
793
+ # - `metadata`: An empty [Struct
794
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
795
+ # - `response`:
796
+ # {::Google::Cloud::Dialogflow::CX::V3::ImportFlowResponse ImportFlowResponse}
797
+ #
798
+ # Note: You should always train a flow prior to sending it queries. See the
799
+ # [training
800
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
801
+ #
802
+ # @overload import_flow(request, options = nil)
803
+ # Pass arguments to `import_flow` via a request object, either of type
804
+ # {::Google::Cloud::Dialogflow::CX::V3::ImportFlowRequest} or an equivalent Hash.
805
+ #
806
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ImportFlowRequest, ::Hash]
807
+ # A request object representing the call parameters. Required. To specify no
808
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
809
+ # @param options [::Gapic::CallOptions, ::Hash]
810
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
811
+ #
812
+ # @overload import_flow(parent: nil, flow_uri: nil, flow_content: nil, import_option: nil)
813
+ # Pass arguments to `import_flow` via keyword arguments. Note that at
814
+ # least one keyword argument is required. To specify no parameters, or to keep all
815
+ # the default parameter values, pass an empty Hash as a request object (see above).
816
+ #
817
+ # @param parent [::String]
818
+ # Required. The agent to import the flow into.
819
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
820
+ # @param flow_uri [::String]
821
+ # The [Google Cloud Storage](https://cloud.google.com/storage/docs/) URI
822
+ # to import flow from. The format of this URI must be
823
+ # `gs://<bucket-name>/<object-name>`.
824
+ #
825
+ # Dialogflow performs a read operation for the Cloud Storage object
826
+ # on the caller's behalf, so your request authentication must
827
+ # have read permissions for the object. For more information, see
828
+ # [Dialogflow access
829
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
830
+ # @param flow_content [::String]
831
+ # Uncompressed raw byte content for flow.
832
+ # @param import_option [::Google::Cloud::Dialogflow::CX::V3::ImportFlowRequest::ImportOption]
833
+ # Flow import mode. If not specified, `KEEP` is assumed.
834
+ # @yield [result, operation] Access the result along with the TransportOperation object
835
+ # @yieldparam result [::Gapic::Operation]
836
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
837
+ #
838
+ # @return [::Gapic::Operation]
839
+ #
840
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
841
+ def import_flow request, options = nil
842
+ raise ::ArgumentError, "request must be provided" if request.nil?
843
+
844
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ImportFlowRequest
845
+
846
+ # Converts hash and nil to an options object
847
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
848
+
849
+ # Customize the options with defaults
850
+ call_metadata = @config.rpcs.import_flow.metadata.to_h
851
+
852
+ # Set x-goog-api-client and x-goog-user-project headers
853
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
854
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
855
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
856
+ transports_version_send: [:rest]
857
+
858
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
859
+
860
+ options.apply_defaults timeout: @config.rpcs.import_flow.timeout,
861
+ metadata: call_metadata,
862
+ retry_policy: @config.rpcs.import_flow.retry_policy
863
+
864
+ options.apply_defaults timeout: @config.timeout,
865
+ metadata: @config.metadata,
866
+ retry_policy: @config.retry_policy
867
+
868
+ @flows_stub.import_flow request, options do |result, operation|
869
+ result = ::Gapic::Operation.new result, @operations_client, options: options
870
+ yield result, operation if block_given?
871
+ return result
872
+ end
873
+ rescue ::Gapic::Rest::Error => e
874
+ raise ::Google::Cloud::Error.from_error(e)
875
+ end
876
+
877
+ ##
878
+ # Exports the specified flow to a binary file.
879
+ #
880
+ # This method is a [long-running
881
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
882
+ # The returned `Operation` type has the following method-specific fields:
883
+ #
884
+ # - `metadata`: An empty [Struct
885
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
886
+ # - `response`:
887
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportFlowResponse ExportFlowResponse}
888
+ #
889
+ # Note that resources (e.g. intents, entities, webhooks) that the flow
890
+ # references will also be exported.
891
+ #
892
+ # @overload export_flow(request, options = nil)
893
+ # Pass arguments to `export_flow` via a request object, either of type
894
+ # {::Google::Cloud::Dialogflow::CX::V3::ExportFlowRequest} or an equivalent Hash.
895
+ #
896
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ExportFlowRequest, ::Hash]
897
+ # A request object representing the call parameters. Required. To specify no
898
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
899
+ # @param options [::Gapic::CallOptions, ::Hash]
900
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
901
+ #
902
+ # @overload export_flow(name: nil, flow_uri: nil, include_referenced_flows: nil)
903
+ # Pass arguments to `export_flow` via keyword arguments. Note that at
904
+ # least one keyword argument is required. To specify no parameters, or to keep all
905
+ # the default parameter values, pass an empty Hash as a request object (see above).
906
+ #
907
+ # @param name [::String]
908
+ # Required. The name of the flow to export.
909
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
910
+ # ID>/flows/<Flow ID>`.
911
+ # @param flow_uri [::String]
912
+ # Optional. The [Google Cloud
913
+ # Storage](https://cloud.google.com/storage/docs/) URI to export the flow to.
914
+ # The format of this URI must be `gs://<bucket-name>/<object-name>`. If left
915
+ # unspecified, the serialized flow is returned inline.
916
+ #
917
+ # Dialogflow performs a write operation for the Cloud Storage object
918
+ # on the caller's behalf, so your request authentication must
919
+ # have write permissions for the object. For more information, see
920
+ # [Dialogflow access
921
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
922
+ # @param include_referenced_flows [::Boolean]
923
+ # Optional. Whether to export flows referenced by the specified flow.
924
+ # @yield [result, operation] Access the result along with the TransportOperation object
925
+ # @yieldparam result [::Gapic::Operation]
926
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
927
+ #
928
+ # @return [::Gapic::Operation]
929
+ #
930
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
931
+ def export_flow request, options = nil
932
+ raise ::ArgumentError, "request must be provided" if request.nil?
933
+
934
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::ExportFlowRequest
935
+
936
+ # Converts hash and nil to an options object
937
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
938
+
939
+ # Customize the options with defaults
940
+ call_metadata = @config.rpcs.export_flow.metadata.to_h
941
+
942
+ # Set x-goog-api-client and x-goog-user-project headers
943
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
944
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
945
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
946
+ transports_version_send: [:rest]
947
+
948
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
949
+
950
+ options.apply_defaults timeout: @config.rpcs.export_flow.timeout,
951
+ metadata: call_metadata,
952
+ retry_policy: @config.rpcs.export_flow.retry_policy
953
+
954
+ options.apply_defaults timeout: @config.timeout,
955
+ metadata: @config.metadata,
956
+ retry_policy: @config.retry_policy
957
+
958
+ @flows_stub.export_flow request, options do |result, operation|
959
+ result = ::Gapic::Operation.new result, @operations_client, options: options
960
+ yield result, operation if block_given?
961
+ return result
962
+ end
963
+ rescue ::Gapic::Rest::Error => e
964
+ raise ::Google::Cloud::Error.from_error(e)
965
+ end
966
+
967
+ ##
968
+ # Configuration class for the Flows REST API.
969
+ #
970
+ # This class represents the configuration for Flows REST,
971
+ # providing control over timeouts, retry behavior, logging, transport
972
+ # parameters, and other low-level controls. Certain parameters can also be
973
+ # applied individually to specific RPCs. See
974
+ # {::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Client::Configuration::Rpcs}
975
+ # for a list of RPCs that can be configured independently.
976
+ #
977
+ # Configuration can be applied globally to all clients, or to a single client
978
+ # on construction.
979
+ #
980
+ # @example
981
+ #
982
+ # # Modify the global config, setting the timeout for
983
+ # # create_flow to 20 seconds,
984
+ # # and all remaining timeouts to 10 seconds.
985
+ # ::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Client.configure do |config|
986
+ # config.timeout = 10.0
987
+ # config.rpcs.create_flow.timeout = 20.0
988
+ # end
989
+ #
990
+ # # Apply the above configuration only to a new client.
991
+ # client = ::Google::Cloud::Dialogflow::CX::V3::Flows::Rest::Client.new do |config|
992
+ # config.timeout = 10.0
993
+ # config.rpcs.create_flow.timeout = 20.0
994
+ # end
995
+ #
996
+ # @!attribute [rw] endpoint
997
+ # The hostname or hostname:port of the service endpoint.
998
+ # Defaults to `"dialogflow.googleapis.com"`.
999
+ # @return [::String]
1000
+ # @!attribute [rw] credentials
1001
+ # Credentials to send with calls. You may provide any of the following types:
1002
+ # * (`String`) The path to a service account key file in JSON format
1003
+ # * (`Hash`) A service account key as a Hash
1004
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1005
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1006
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1007
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1008
+ # * (`nil`) indicating no credentials
1009
+ # @return [::Object]
1010
+ # @!attribute [rw] scope
1011
+ # The OAuth scopes
1012
+ # @return [::Array<::String>]
1013
+ # @!attribute [rw] lib_name
1014
+ # The library name as recorded in instrumentation and logging
1015
+ # @return [::String]
1016
+ # @!attribute [rw] lib_version
1017
+ # The library version as recorded in instrumentation and logging
1018
+ # @return [::String]
1019
+ # @!attribute [rw] timeout
1020
+ # The call timeout in seconds.
1021
+ # @return [::Numeric]
1022
+ # @!attribute [rw] metadata
1023
+ # Additional headers to be sent with the call.
1024
+ # @return [::Hash{::Symbol=>::String}]
1025
+ # @!attribute [rw] retry_policy
1026
+ # The retry policy. The value is a hash with the following keys:
1027
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1028
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1029
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1030
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1031
+ # trigger a retry.
1032
+ # @return [::Hash]
1033
+ # @!attribute [rw] quota_project
1034
+ # A separate project against which to charge quota.
1035
+ # @return [::String]
1036
+ #
1037
+ class Configuration
1038
+ extend ::Gapic::Config
1039
+
1040
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
1041
+ config_attr :credentials, nil do |value|
1042
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1043
+ allowed.any? { |klass| klass === value }
1044
+ end
1045
+ config_attr :scope, nil, ::String, ::Array, nil
1046
+ config_attr :lib_name, nil, ::String, nil
1047
+ config_attr :lib_version, nil, ::String, nil
1048
+ config_attr :timeout, nil, ::Numeric, nil
1049
+ config_attr :metadata, nil, ::Hash, nil
1050
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1051
+ config_attr :quota_project, nil, ::String, nil
1052
+
1053
+ # @private
1054
+ # Overrides for http bindings for the RPCs of this service
1055
+ # are only used when this service is used as mixin, and only
1056
+ # by the host service.
1057
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1058
+ config_attr :bindings_override, {}, ::Hash, nil
1059
+
1060
+ # @private
1061
+ def initialize parent_config = nil
1062
+ @parent_config = parent_config unless parent_config.nil?
1063
+
1064
+ yield self if block_given?
1065
+ end
1066
+
1067
+ ##
1068
+ # Configurations for individual RPCs
1069
+ # @return [Rpcs]
1070
+ #
1071
+ def rpcs
1072
+ @rpcs ||= begin
1073
+ parent_rpcs = nil
1074
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1075
+ Rpcs.new parent_rpcs
1076
+ end
1077
+ end
1078
+
1079
+ ##
1080
+ # Configuration RPC class for the Flows API.
1081
+ #
1082
+ # Includes fields providing the configuration for each RPC in this service.
1083
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1084
+ # the following configuration fields:
1085
+ #
1086
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1087
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1088
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1089
+ # include the following keys:
1090
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1091
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1092
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1093
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1094
+ # trigger a retry.
1095
+ #
1096
+ class Rpcs
1097
+ ##
1098
+ # RPC-specific configuration for `create_flow`
1099
+ # @return [::Gapic::Config::Method]
1100
+ #
1101
+ attr_reader :create_flow
1102
+ ##
1103
+ # RPC-specific configuration for `delete_flow`
1104
+ # @return [::Gapic::Config::Method]
1105
+ #
1106
+ attr_reader :delete_flow
1107
+ ##
1108
+ # RPC-specific configuration for `list_flows`
1109
+ # @return [::Gapic::Config::Method]
1110
+ #
1111
+ attr_reader :list_flows
1112
+ ##
1113
+ # RPC-specific configuration for `get_flow`
1114
+ # @return [::Gapic::Config::Method]
1115
+ #
1116
+ attr_reader :get_flow
1117
+ ##
1118
+ # RPC-specific configuration for `update_flow`
1119
+ # @return [::Gapic::Config::Method]
1120
+ #
1121
+ attr_reader :update_flow
1122
+ ##
1123
+ # RPC-specific configuration for `train_flow`
1124
+ # @return [::Gapic::Config::Method]
1125
+ #
1126
+ attr_reader :train_flow
1127
+ ##
1128
+ # RPC-specific configuration for `validate_flow`
1129
+ # @return [::Gapic::Config::Method]
1130
+ #
1131
+ attr_reader :validate_flow
1132
+ ##
1133
+ # RPC-specific configuration for `get_flow_validation_result`
1134
+ # @return [::Gapic::Config::Method]
1135
+ #
1136
+ attr_reader :get_flow_validation_result
1137
+ ##
1138
+ # RPC-specific configuration for `import_flow`
1139
+ # @return [::Gapic::Config::Method]
1140
+ #
1141
+ attr_reader :import_flow
1142
+ ##
1143
+ # RPC-specific configuration for `export_flow`
1144
+ # @return [::Gapic::Config::Method]
1145
+ #
1146
+ attr_reader :export_flow
1147
+
1148
+ # @private
1149
+ def initialize parent_rpcs = nil
1150
+ create_flow_config = parent_rpcs.create_flow if parent_rpcs.respond_to? :create_flow
1151
+ @create_flow = ::Gapic::Config::Method.new create_flow_config
1152
+ delete_flow_config = parent_rpcs.delete_flow if parent_rpcs.respond_to? :delete_flow
1153
+ @delete_flow = ::Gapic::Config::Method.new delete_flow_config
1154
+ list_flows_config = parent_rpcs.list_flows if parent_rpcs.respond_to? :list_flows
1155
+ @list_flows = ::Gapic::Config::Method.new list_flows_config
1156
+ get_flow_config = parent_rpcs.get_flow if parent_rpcs.respond_to? :get_flow
1157
+ @get_flow = ::Gapic::Config::Method.new get_flow_config
1158
+ update_flow_config = parent_rpcs.update_flow if parent_rpcs.respond_to? :update_flow
1159
+ @update_flow = ::Gapic::Config::Method.new update_flow_config
1160
+ train_flow_config = parent_rpcs.train_flow if parent_rpcs.respond_to? :train_flow
1161
+ @train_flow = ::Gapic::Config::Method.new train_flow_config
1162
+ validate_flow_config = parent_rpcs.validate_flow if parent_rpcs.respond_to? :validate_flow
1163
+ @validate_flow = ::Gapic::Config::Method.new validate_flow_config
1164
+ get_flow_validation_result_config = parent_rpcs.get_flow_validation_result if parent_rpcs.respond_to? :get_flow_validation_result
1165
+ @get_flow_validation_result = ::Gapic::Config::Method.new get_flow_validation_result_config
1166
+ import_flow_config = parent_rpcs.import_flow if parent_rpcs.respond_to? :import_flow
1167
+ @import_flow = ::Gapic::Config::Method.new import_flow_config
1168
+ export_flow_config = parent_rpcs.export_flow if parent_rpcs.respond_to? :export_flow
1169
+ @export_flow = ::Gapic::Config::Method.new export_flow_config
1170
+
1171
+ yield self if block_given?
1172
+ end
1173
+ end
1174
+ end
1175
+ end
1176
+ end
1177
+ end
1178
+ end
1179
+ end
1180
+ end
1181
+ end
1182
+ end