google-cloud-dialogflow-v2 0.22.0 → 0.23.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/dialogflow/v2/agents/rest/client.rb +1078 -0
  4. data/lib/google/cloud/dialogflow/v2/agents/rest/operations.rb +813 -0
  5. data/lib/google/cloud/dialogflow/v2/agents/rest/service_stub.rb +652 -0
  6. data/lib/google/cloud/dialogflow/v2/agents/rest.rb +54 -0
  7. data/lib/google/cloud/dialogflow/v2/agents.rb +6 -0
  8. data/lib/google/cloud/dialogflow/v2/answer_records/rest/client.rb +463 -0
  9. data/lib/google/cloud/dialogflow/v2/answer_records/rest/service_stub.rb +182 -0
  10. data/lib/google/cloud/dialogflow/v2/answer_records/rest.rb +54 -0
  11. data/lib/google/cloud/dialogflow/v2/answer_records.rb +6 -0
  12. data/lib/google/cloud/dialogflow/v2/bindings_override.rb +102 -0
  13. data/lib/google/cloud/dialogflow/v2/contexts/rest/client.rb +753 -0
  14. data/lib/google/cloud/dialogflow/v2/contexts/rest/service_stub.rb +536 -0
  15. data/lib/google/cloud/dialogflow/v2/contexts/rest.rb +53 -0
  16. data/lib/google/cloud/dialogflow/v2/contexts.rb +6 -0
  17. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/client.rb +714 -0
  18. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/operations.rb +813 -0
  19. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest/service_stub.rb +367 -0
  20. data/lib/google/cloud/dialogflow/v2/conversation_datasets/rest.rb +57 -0
  21. data/lib/google/cloud/dialogflow/v2/conversation_datasets.rb +6 -0
  22. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/client.rb +1010 -0
  23. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/operations.rb +813 -0
  24. data/lib/google/cloud/dialogflow/v2/conversation_models/rest/service_stub.rb +642 -0
  25. data/lib/google/cloud/dialogflow/v2/conversation_models/rest.rb +54 -0
  26. data/lib/google/cloud/dialogflow/v2/conversation_models.rb +6 -0
  27. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/client.rb +868 -0
  28. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/operations.rb +813 -0
  29. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest/service_stub.rb +518 -0
  30. data/lib/google/cloud/dialogflow/v2/conversation_profiles/rest.rb +55 -0
  31. data/lib/google/cloud/dialogflow/v2/conversation_profiles.rb +6 -0
  32. data/lib/google/cloud/dialogflow/v2/conversations/rest/client.rb +819 -0
  33. data/lib/google/cloud/dialogflow/v2/conversations/rest/service_stub.rb +450 -0
  34. data/lib/google/cloud/dialogflow/v2/conversations/rest.rb +54 -0
  35. data/lib/google/cloud/dialogflow/v2/conversations.rb +6 -0
  36. data/lib/google/cloud/dialogflow/v2/documents/rest/client.rb +1013 -0
  37. data/lib/google/cloud/dialogflow/v2/documents/rest/operations.rb +813 -0
  38. data/lib/google/cloud/dialogflow/v2/documents/rest/service_stub.rb +631 -0
  39. data/lib/google/cloud/dialogflow/v2/documents/rest.rb +55 -0
  40. data/lib/google/cloud/dialogflow/v2/documents.rb +6 -0
  41. data/lib/google/cloud/dialogflow/v2/entity_types/rest/client.rb +1178 -0
  42. data/lib/google/cloud/dialogflow/v2/entity_types/rest/operations.rb +813 -0
  43. data/lib/google/cloud/dialogflow/v2/entity_types/rest/service_stub.rb +722 -0
  44. data/lib/google/cloud/dialogflow/v2/entity_types/rest.rb +54 -0
  45. data/lib/google/cloud/dialogflow/v2/entity_types.rb +6 -0
  46. data/lib/google/cloud/dialogflow/v2/environments/rest/client.rb +779 -0
  47. data/lib/google/cloud/dialogflow/v2/environments/rest/service_stub.rb +448 -0
  48. data/lib/google/cloud/dialogflow/v2/environments/rest.rb +53 -0
  49. data/lib/google/cloud/dialogflow/v2/environments.rb +6 -0
  50. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/client.rb +444 -0
  51. data/lib/google/cloud/dialogflow/v2/fulfillments/rest/service_stub.rb +182 -0
  52. data/lib/google/cloud/dialogflow/v2/fulfillments/rest.rb +53 -0
  53. data/lib/google/cloud/dialogflow/v2/fulfillments.rb +6 -0
  54. data/lib/google/cloud/dialogflow/v2/intents/rest/client.rb +914 -0
  55. data/lib/google/cloud/dialogflow/v2/intents/rest/operations.rb +813 -0
  56. data/lib/google/cloud/dialogflow/v2/intents/rest/service_stub.rb +532 -0
  57. data/lib/google/cloud/dialogflow/v2/intents/rest.rb +54 -0
  58. data/lib/google/cloud/dialogflow/v2/intents.rb +6 -0
  59. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/client.rb +696 -0
  60. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest/service_stub.rb +419 -0
  61. data/lib/google/cloud/dialogflow/v2/knowledge_bases/rest.rb +54 -0
  62. data/lib/google/cloud/dialogflow/v2/knowledge_bases.rb +6 -0
  63. data/lib/google/cloud/dialogflow/v2/participants/rest/client.rb +955 -0
  64. data/lib/google/cloud/dialogflow/v2/participants/rest/service_stub.rb +588 -0
  65. data/lib/google/cloud/dialogflow/v2/participants/rest.rb +53 -0
  66. data/lib/google/cloud/dialogflow/v2/participants.rb +6 -0
  67. data/lib/google/cloud/dialogflow/v2/rest.rb +54 -0
  68. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/client.rb +703 -0
  69. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest/service_stub.rb +456 -0
  70. data/lib/google/cloud/dialogflow/v2/session_entity_types/rest.rb +54 -0
  71. data/lib/google/cloud/dialogflow/v2/session_entity_types.rb +6 -0
  72. data/lib/google/cloud/dialogflow/v2/sessions/rest/client.rb +437 -0
  73. data/lib/google/cloud/dialogflow/v2/sessions/rest/service_stub.rb +132 -0
  74. data/lib/google/cloud/dialogflow/v2/sessions/rest.rb +56 -0
  75. data/lib/google/cloud/dialogflow/v2/sessions.rb +6 -0
  76. data/lib/google/cloud/dialogflow/v2/version.rb +1 -1
  77. data/lib/google/cloud/dialogflow/v2/versions/rest/client.rb +686 -0
  78. data/lib/google/cloud/dialogflow/v2/versions/rest/service_stub.rb +382 -0
  79. data/lib/google/cloud/dialogflow/v2/versions/rest.rb +53 -0
  80. data/lib/google/cloud/dialogflow/v2/versions.rb +6 -0
  81. data/lib/google/cloud/dialogflow/v2.rb +5 -0
  82. metadata +66 -5
@@ -0,0 +1,1078 @@
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/v2/agent_pb"
21
+ require "google/cloud/dialogflow/v2/agents/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Agents
29
+ module Rest
30
+ ##
31
+ # REST client for the Agents service.
32
+ #
33
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Agent Agents}.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :agents_stub
40
+
41
+ ##
42
+ # Configure the Agents Client class.
43
+ #
44
+ # See {::Google::Cloud::Dialogflow::V2::Agents::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Agents clients
50
+ # ::Google::Cloud::Dialogflow::V2::Agents::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the Agents Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::Dialogflow::V2::Agents::Rest::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # Create a new Agents REST client object.
103
+ #
104
+ # @example
105
+ #
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::Agents::Rest::Client.new
108
+ #
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::Dialogflow::V2::Agents::Rest::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the Agents client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @operations_client = ::Google::Cloud::Dialogflow::V2::Agents::Rest::Operations.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ end
144
+
145
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
146
+ config.credentials = credentials
147
+ config.quota_project = @quota_project_id
148
+ config.endpoint = @config.endpoint
149
+ config.bindings_override = @config.bindings_override
150
+ end
151
+
152
+ @agents_stub = ::Google::Cloud::Dialogflow::V2::Agents::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
153
+ end
154
+
155
+ ##
156
+ # Get the associated client for long-running operations.
157
+ #
158
+ # @return [::Google::Cloud::Dialogflow::V2::Agents::Rest::Operations]
159
+ #
160
+ attr_reader :operations_client
161
+
162
+ ##
163
+ # Get the associated client for mix-in of the Locations.
164
+ #
165
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
166
+ #
167
+ attr_reader :location_client
168
+
169
+ # Service calls
170
+
171
+ ##
172
+ # Retrieves the specified agent.
173
+ #
174
+ # @overload get_agent(request, options = nil)
175
+ # Pass arguments to `get_agent` via a request object, either of type
176
+ # {::Google::Cloud::Dialogflow::V2::GetAgentRequest} or an equivalent Hash.
177
+ #
178
+ # @param request [::Google::Cloud::Dialogflow::V2::GetAgentRequest, ::Hash]
179
+ # A request object representing the call parameters. Required. To specify no
180
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
181
+ # @param options [::Gapic::CallOptions, ::Hash]
182
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
183
+ #
184
+ # @overload get_agent(parent: nil)
185
+ # Pass arguments to `get_agent` via keyword arguments. Note that at
186
+ # least one keyword argument is required. To specify no parameters, or to keep all
187
+ # the default parameter values, pass an empty Hash as a request object (see above).
188
+ #
189
+ # @param parent [::String]
190
+ # Required. The project that the agent to fetch is associated with.
191
+ # Format: `projects/<Project ID>`.
192
+ # @yield [result, operation] Access the result along with the TransportOperation object
193
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Agent]
194
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
195
+ #
196
+ # @return [::Google::Cloud::Dialogflow::V2::Agent]
197
+ #
198
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
199
+ def get_agent request, options = nil
200
+ raise ::ArgumentError, "request must be provided" if request.nil?
201
+
202
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetAgentRequest
203
+
204
+ # Converts hash and nil to an options object
205
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
206
+
207
+ # Customize the options with defaults
208
+ call_metadata = @config.rpcs.get_agent.metadata.to_h
209
+
210
+ # Set x-goog-api-client and x-goog-user-project headers
211
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
212
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
213
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
214
+ transports_version_send: [:rest]
215
+
216
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
217
+
218
+ options.apply_defaults timeout: @config.rpcs.get_agent.timeout,
219
+ metadata: call_metadata,
220
+ retry_policy: @config.rpcs.get_agent.retry_policy
221
+
222
+ options.apply_defaults timeout: @config.timeout,
223
+ metadata: @config.metadata,
224
+ retry_policy: @config.retry_policy
225
+
226
+ @agents_stub.get_agent request, options do |result, operation|
227
+ yield result, operation if block_given?
228
+ return result
229
+ end
230
+ rescue ::Gapic::Rest::Error => e
231
+ raise ::Google::Cloud::Error.from_error(e)
232
+ end
233
+
234
+ ##
235
+ # Creates/updates the specified agent.
236
+ #
237
+ # Note: You should always train an agent prior to sending it queries. See the
238
+ # [training
239
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
240
+ #
241
+ # @overload set_agent(request, options = nil)
242
+ # Pass arguments to `set_agent` via a request object, either of type
243
+ # {::Google::Cloud::Dialogflow::V2::SetAgentRequest} or an equivalent Hash.
244
+ #
245
+ # @param request [::Google::Cloud::Dialogflow::V2::SetAgentRequest, ::Hash]
246
+ # A request object representing the call parameters. Required. To specify no
247
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
248
+ # @param options [::Gapic::CallOptions, ::Hash]
249
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
250
+ #
251
+ # @overload set_agent(agent: nil, update_mask: nil)
252
+ # Pass arguments to `set_agent` via keyword arguments. Note that at
253
+ # least one keyword argument is required. To specify no parameters, or to keep all
254
+ # the default parameter values, pass an empty Hash as a request object (see above).
255
+ #
256
+ # @param agent [::Google::Cloud::Dialogflow::V2::Agent, ::Hash]
257
+ # Required. The agent to update.
258
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
259
+ # Optional. The mask to control which fields get updated.
260
+ # @yield [result, operation] Access the result along with the TransportOperation object
261
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Agent]
262
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
263
+ #
264
+ # @return [::Google::Cloud::Dialogflow::V2::Agent]
265
+ #
266
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
267
+ def set_agent request, options = nil
268
+ raise ::ArgumentError, "request must be provided" if request.nil?
269
+
270
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SetAgentRequest
271
+
272
+ # Converts hash and nil to an options object
273
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
274
+
275
+ # Customize the options with defaults
276
+ call_metadata = @config.rpcs.set_agent.metadata.to_h
277
+
278
+ # Set x-goog-api-client and x-goog-user-project headers
279
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
280
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
281
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
282
+ transports_version_send: [:rest]
283
+
284
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
+
286
+ options.apply_defaults timeout: @config.rpcs.set_agent.timeout,
287
+ metadata: call_metadata,
288
+ retry_policy: @config.rpcs.set_agent.retry_policy
289
+
290
+ options.apply_defaults timeout: @config.timeout,
291
+ metadata: @config.metadata,
292
+ retry_policy: @config.retry_policy
293
+
294
+ @agents_stub.set_agent request, options do |result, operation|
295
+ yield result, operation if block_given?
296
+ return result
297
+ end
298
+ rescue ::Gapic::Rest::Error => e
299
+ raise ::Google::Cloud::Error.from_error(e)
300
+ end
301
+
302
+ ##
303
+ # Deletes the specified agent.
304
+ #
305
+ # @overload delete_agent(request, options = nil)
306
+ # Pass arguments to `delete_agent` via a request object, either of type
307
+ # {::Google::Cloud::Dialogflow::V2::DeleteAgentRequest} or an equivalent Hash.
308
+ #
309
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteAgentRequest, ::Hash]
310
+ # A request object representing the call parameters. Required. To specify no
311
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
312
+ # @param options [::Gapic::CallOptions, ::Hash]
313
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
314
+ #
315
+ # @overload delete_agent(parent: nil)
316
+ # Pass arguments to `delete_agent` via keyword arguments. Note that at
317
+ # least one keyword argument is required. To specify no parameters, or to keep all
318
+ # the default parameter values, pass an empty Hash as a request object (see above).
319
+ #
320
+ # @param parent [::String]
321
+ # Required. The project that the agent to delete is associated with.
322
+ # Format: `projects/<Project ID>`.
323
+ # @yield [result, operation] Access the result along with the TransportOperation object
324
+ # @yieldparam result [::Google::Protobuf::Empty]
325
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
326
+ #
327
+ # @return [::Google::Protobuf::Empty]
328
+ #
329
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
330
+ def delete_agent request, options = nil
331
+ raise ::ArgumentError, "request must be provided" if request.nil?
332
+
333
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteAgentRequest
334
+
335
+ # Converts hash and nil to an options object
336
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
337
+
338
+ # Customize the options with defaults
339
+ call_metadata = @config.rpcs.delete_agent.metadata.to_h
340
+
341
+ # Set x-goog-api-client and x-goog-user-project headers
342
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
343
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
344
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
345
+ transports_version_send: [:rest]
346
+
347
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
348
+
349
+ options.apply_defaults timeout: @config.rpcs.delete_agent.timeout,
350
+ metadata: call_metadata,
351
+ retry_policy: @config.rpcs.delete_agent.retry_policy
352
+
353
+ options.apply_defaults timeout: @config.timeout,
354
+ metadata: @config.metadata,
355
+ retry_policy: @config.retry_policy
356
+
357
+ @agents_stub.delete_agent request, options do |result, operation|
358
+ yield result, operation if block_given?
359
+ return result
360
+ end
361
+ rescue ::Gapic::Rest::Error => e
362
+ raise ::Google::Cloud::Error.from_error(e)
363
+ end
364
+
365
+ ##
366
+ # Returns the list of agents.
367
+ #
368
+ # Since there is at most one conversational agent per project, this method is
369
+ # useful primarily for listing all agents across projects the caller has
370
+ # access to. One can achieve that with a wildcard project collection id "-".
371
+ # Refer to [List
372
+ # Sub-Collections](https://cloud.google.com/apis/design/design_patterns#list_sub-collections).
373
+ #
374
+ # @overload search_agents(request, options = nil)
375
+ # Pass arguments to `search_agents` via a request object, either of type
376
+ # {::Google::Cloud::Dialogflow::V2::SearchAgentsRequest} or an equivalent Hash.
377
+ #
378
+ # @param request [::Google::Cloud::Dialogflow::V2::SearchAgentsRequest, ::Hash]
379
+ # A request object representing the call parameters. Required. To specify no
380
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
381
+ # @param options [::Gapic::CallOptions, ::Hash]
382
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
383
+ #
384
+ # @overload search_agents(parent: nil, page_size: nil, page_token: nil)
385
+ # Pass arguments to `search_agents` via keyword arguments. Note that at
386
+ # least one keyword argument is required. To specify no parameters, or to keep all
387
+ # the default parameter values, pass an empty Hash as a request object (see above).
388
+ #
389
+ # @param parent [::String]
390
+ # Required. The project to list agents from.
391
+ # Format: `projects/<Project ID or '-'>`.
392
+ # @param page_size [::Integer]
393
+ # Optional. The maximum number of items to return in a single page. By
394
+ # default 100 and at most 1000.
395
+ # @param page_token [::String]
396
+ # The next_page_token value returned from a previous list request.
397
+ # @yield [result, operation] Access the result along with the TransportOperation object
398
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Agent>]
399
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
400
+ #
401
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Agent>]
402
+ #
403
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
404
+ def search_agents request, options = nil
405
+ raise ::ArgumentError, "request must be provided" if request.nil?
406
+
407
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::SearchAgentsRequest
408
+
409
+ # Converts hash and nil to an options object
410
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
411
+
412
+ # Customize the options with defaults
413
+ call_metadata = @config.rpcs.search_agents.metadata.to_h
414
+
415
+ # Set x-goog-api-client and x-goog-user-project headers
416
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
417
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
418
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
419
+ transports_version_send: [:rest]
420
+
421
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
422
+
423
+ options.apply_defaults timeout: @config.rpcs.search_agents.timeout,
424
+ metadata: call_metadata,
425
+ retry_policy: @config.rpcs.search_agents.retry_policy
426
+
427
+ options.apply_defaults timeout: @config.timeout,
428
+ metadata: @config.metadata,
429
+ retry_policy: @config.retry_policy
430
+
431
+ @agents_stub.search_agents request, options do |result, operation|
432
+ result = ::Gapic::Rest::PagedEnumerable.new @agents_stub, :search_agents, "agents", request, result, options
433
+ yield result, operation if block_given?
434
+ return result
435
+ end
436
+ rescue ::Gapic::Rest::Error => e
437
+ raise ::Google::Cloud::Error.from_error(e)
438
+ end
439
+
440
+ ##
441
+ # Trains the specified agent.
442
+ #
443
+ # This method is a [long-running
444
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
445
+ # The returned `Operation` type has the following method-specific fields:
446
+ #
447
+ # - `metadata`: An empty [Struct
448
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
449
+ # - `response`: An [Empty
450
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
451
+ #
452
+ # Note: You should always train an agent prior to sending it queries. See the
453
+ # [training
454
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
455
+ #
456
+ # @overload train_agent(request, options = nil)
457
+ # Pass arguments to `train_agent` via a request object, either of type
458
+ # {::Google::Cloud::Dialogflow::V2::TrainAgentRequest} or an equivalent Hash.
459
+ #
460
+ # @param request [::Google::Cloud::Dialogflow::V2::TrainAgentRequest, ::Hash]
461
+ # A request object representing the call parameters. Required. To specify no
462
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
463
+ # @param options [::Gapic::CallOptions, ::Hash]
464
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
465
+ #
466
+ # @overload train_agent(parent: nil)
467
+ # Pass arguments to `train_agent` via keyword arguments. Note that at
468
+ # least one keyword argument is required. To specify no parameters, or to keep all
469
+ # the default parameter values, pass an empty Hash as a request object (see above).
470
+ #
471
+ # @param parent [::String]
472
+ # Required. The project that the agent to train is associated with.
473
+ # Format: `projects/<Project ID>`.
474
+ # @yield [result, operation] Access the result along with the TransportOperation object
475
+ # @yieldparam result [::Gapic::Operation]
476
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
477
+ #
478
+ # @return [::Gapic::Operation]
479
+ #
480
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
481
+ def train_agent request, options = nil
482
+ raise ::ArgumentError, "request must be provided" if request.nil?
483
+
484
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::TrainAgentRequest
485
+
486
+ # Converts hash and nil to an options object
487
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
488
+
489
+ # Customize the options with defaults
490
+ call_metadata = @config.rpcs.train_agent.metadata.to_h
491
+
492
+ # Set x-goog-api-client and x-goog-user-project headers
493
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
494
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
495
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
496
+ transports_version_send: [:rest]
497
+
498
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
499
+
500
+ options.apply_defaults timeout: @config.rpcs.train_agent.timeout,
501
+ metadata: call_metadata,
502
+ retry_policy: @config.rpcs.train_agent.retry_policy
503
+
504
+ options.apply_defaults timeout: @config.timeout,
505
+ metadata: @config.metadata,
506
+ retry_policy: @config.retry_policy
507
+
508
+ @agents_stub.train_agent request, options do |result, operation|
509
+ result = ::Gapic::Operation.new result, @operations_client, options: options
510
+ yield result, operation if block_given?
511
+ return result
512
+ end
513
+ rescue ::Gapic::Rest::Error => e
514
+ raise ::Google::Cloud::Error.from_error(e)
515
+ end
516
+
517
+ ##
518
+ # Exports the specified agent to a ZIP file.
519
+ #
520
+ # This method is a [long-running
521
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
522
+ # The returned `Operation` type has the following method-specific fields:
523
+ #
524
+ # - `metadata`: An empty [Struct
525
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
526
+ # - `response`:
527
+ # {::Google::Cloud::Dialogflow::V2::ExportAgentResponse ExportAgentResponse}
528
+ #
529
+ # @overload export_agent(request, options = nil)
530
+ # Pass arguments to `export_agent` via a request object, either of type
531
+ # {::Google::Cloud::Dialogflow::V2::ExportAgentRequest} or an equivalent Hash.
532
+ #
533
+ # @param request [::Google::Cloud::Dialogflow::V2::ExportAgentRequest, ::Hash]
534
+ # A request object representing the call parameters. Required. To specify no
535
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
536
+ # @param options [::Gapic::CallOptions, ::Hash]
537
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
538
+ #
539
+ # @overload export_agent(parent: nil, agent_uri: nil)
540
+ # Pass arguments to `export_agent` via keyword arguments. Note that at
541
+ # least one keyword argument is required. To specify no parameters, or to keep all
542
+ # the default parameter values, pass an empty Hash as a request object (see above).
543
+ #
544
+ # @param parent [::String]
545
+ # Required. The project that the agent to export is associated with.
546
+ # Format: `projects/<Project ID>`.
547
+ # @param agent_uri [::String]
548
+ # Required. The [Google Cloud
549
+ # Storage](https://cloud.google.com/storage/docs/) URI to export the agent
550
+ # to. The format of this URI must be `gs://<bucket-name>/<object-name>`. If
551
+ # left unspecified, the serialized agent is returned inline.
552
+ #
553
+ # Dialogflow performs a write operation for the Cloud Storage object
554
+ # on the caller's behalf, so your request authentication must
555
+ # have write permissions for the object. For more information, see
556
+ # [Dialogflow access
557
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
558
+ # @yield [result, operation] Access the result along with the TransportOperation object
559
+ # @yieldparam result [::Gapic::Operation]
560
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
561
+ #
562
+ # @return [::Gapic::Operation]
563
+ #
564
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
565
+ def export_agent request, options = nil
566
+ raise ::ArgumentError, "request must be provided" if request.nil?
567
+
568
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ExportAgentRequest
569
+
570
+ # Converts hash and nil to an options object
571
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
572
+
573
+ # Customize the options with defaults
574
+ call_metadata = @config.rpcs.export_agent.metadata.to_h
575
+
576
+ # Set x-goog-api-client and x-goog-user-project headers
577
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
578
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
579
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
580
+ transports_version_send: [:rest]
581
+
582
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
583
+
584
+ options.apply_defaults timeout: @config.rpcs.export_agent.timeout,
585
+ metadata: call_metadata,
586
+ retry_policy: @config.rpcs.export_agent.retry_policy
587
+
588
+ options.apply_defaults timeout: @config.timeout,
589
+ metadata: @config.metadata,
590
+ retry_policy: @config.retry_policy
591
+
592
+ @agents_stub.export_agent request, options do |result, operation|
593
+ result = ::Gapic::Operation.new result, @operations_client, options: options
594
+ yield result, operation if block_given?
595
+ return result
596
+ end
597
+ rescue ::Gapic::Rest::Error => e
598
+ raise ::Google::Cloud::Error.from_error(e)
599
+ end
600
+
601
+ ##
602
+ # Imports the specified agent from a ZIP file.
603
+ #
604
+ # Uploads new intents and entity types without deleting the existing ones.
605
+ # Intents and entity types with the same name are replaced with the new
606
+ # versions from
607
+ # {::Google::Cloud::Dialogflow::V2::ImportAgentRequest ImportAgentRequest}. After
608
+ # the import, the imported draft agent will be trained automatically (unless
609
+ # disabled in agent settings). However, once the import is done, training may
610
+ # not be completed yet. Please call
611
+ # {::Google::Cloud::Dialogflow::V2::Agents::Rest::Client#train_agent TrainAgent} and wait for the
612
+ # operation it returns in order to train explicitly.
613
+ #
614
+ # This method is a [long-running
615
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
616
+ # The returned `Operation` type has the following method-specific fields:
617
+ #
618
+ # - `metadata`: An empty [Struct
619
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
620
+ # - `response`: An [Empty
621
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
622
+ #
623
+ # The operation only tracks when importing is complete, not when it is done
624
+ # training.
625
+ #
626
+ # Note: You should always train an agent prior to sending it queries. See the
627
+ # [training
628
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
629
+ #
630
+ # @overload import_agent(request, options = nil)
631
+ # Pass arguments to `import_agent` via a request object, either of type
632
+ # {::Google::Cloud::Dialogflow::V2::ImportAgentRequest} or an equivalent Hash.
633
+ #
634
+ # @param request [::Google::Cloud::Dialogflow::V2::ImportAgentRequest, ::Hash]
635
+ # A request object representing the call parameters. Required. To specify no
636
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
637
+ # @param options [::Gapic::CallOptions, ::Hash]
638
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
639
+ #
640
+ # @overload import_agent(parent: nil, agent_uri: nil, agent_content: nil)
641
+ # Pass arguments to `import_agent` via keyword arguments. Note that at
642
+ # least one keyword argument is required. To specify no parameters, or to keep all
643
+ # the default parameter values, pass an empty Hash as a request object (see above).
644
+ #
645
+ # @param parent [::String]
646
+ # Required. The project that the agent to import is associated with.
647
+ # Format: `projects/<Project ID>`.
648
+ # @param agent_uri [::String]
649
+ # The URI to a Google Cloud Storage file containing the agent to import.
650
+ # Note: The URI must start with "gs://".
651
+ #
652
+ # Dialogflow performs a read operation for the Cloud Storage object
653
+ # on the caller's behalf, so your request authentication must
654
+ # have read permissions for the object. For more information, see
655
+ # [Dialogflow access
656
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
657
+ # @param agent_content [::String]
658
+ # Zip compressed raw byte content for agent.
659
+ # @yield [result, operation] Access the result along with the TransportOperation object
660
+ # @yieldparam result [::Gapic::Operation]
661
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
662
+ #
663
+ # @return [::Gapic::Operation]
664
+ #
665
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
666
+ def import_agent request, options = nil
667
+ raise ::ArgumentError, "request must be provided" if request.nil?
668
+
669
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ImportAgentRequest
670
+
671
+ # Converts hash and nil to an options object
672
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
673
+
674
+ # Customize the options with defaults
675
+ call_metadata = @config.rpcs.import_agent.metadata.to_h
676
+
677
+ # Set x-goog-api-client and x-goog-user-project headers
678
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
679
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
680
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
681
+ transports_version_send: [:rest]
682
+
683
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
684
+
685
+ options.apply_defaults timeout: @config.rpcs.import_agent.timeout,
686
+ metadata: call_metadata,
687
+ retry_policy: @config.rpcs.import_agent.retry_policy
688
+
689
+ options.apply_defaults timeout: @config.timeout,
690
+ metadata: @config.metadata,
691
+ retry_policy: @config.retry_policy
692
+
693
+ @agents_stub.import_agent request, options do |result, operation|
694
+ result = ::Gapic::Operation.new result, @operations_client, options: options
695
+ yield result, operation if block_given?
696
+ return result
697
+ end
698
+ rescue ::Gapic::Rest::Error => e
699
+ raise ::Google::Cloud::Error.from_error(e)
700
+ end
701
+
702
+ ##
703
+ # Restores the specified agent from a ZIP file.
704
+ #
705
+ # Replaces the current agent version with a new one. All the intents and
706
+ # entity types in the older version are deleted. After the restore, the
707
+ # restored draft agent will be trained automatically (unless disabled in
708
+ # agent settings). However, once the restore is done, training may not be
709
+ # completed yet. Please call
710
+ # {::Google::Cloud::Dialogflow::V2::Agents::Rest::Client#train_agent TrainAgent} and wait for the
711
+ # operation it returns in order to train explicitly.
712
+ #
713
+ # This method is a [long-running
714
+ # operation](https://cloud.google.com/dialogflow/es/docs/how/long-running-operations).
715
+ # The returned `Operation` type has the following method-specific fields:
716
+ #
717
+ # - `metadata`: An empty [Struct
718
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#struct)
719
+ # - `response`: An [Empty
720
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
721
+ #
722
+ # The operation only tracks when restoring is complete, not when it is done
723
+ # training.
724
+ #
725
+ # Note: You should always train an agent prior to sending it queries. See the
726
+ # [training
727
+ # documentation](https://cloud.google.com/dialogflow/es/docs/training).
728
+ #
729
+ # @overload restore_agent(request, options = nil)
730
+ # Pass arguments to `restore_agent` via a request object, either of type
731
+ # {::Google::Cloud::Dialogflow::V2::RestoreAgentRequest} or an equivalent Hash.
732
+ #
733
+ # @param request [::Google::Cloud::Dialogflow::V2::RestoreAgentRequest, ::Hash]
734
+ # A request object representing the call parameters. Required. To specify no
735
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
736
+ # @param options [::Gapic::CallOptions, ::Hash]
737
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
738
+ #
739
+ # @overload restore_agent(parent: nil, agent_uri: nil, agent_content: nil)
740
+ # Pass arguments to `restore_agent` via keyword arguments. Note that at
741
+ # least one keyword argument is required. To specify no parameters, or to keep all
742
+ # the default parameter values, pass an empty Hash as a request object (see above).
743
+ #
744
+ # @param parent [::String]
745
+ # Required. The project that the agent to restore is associated with.
746
+ # Format: `projects/<Project ID>`.
747
+ # @param agent_uri [::String]
748
+ # The URI to a Google Cloud Storage file containing the agent to restore.
749
+ # Note: The URI must start with "gs://".
750
+ #
751
+ # Dialogflow performs a read operation for the Cloud Storage object
752
+ # on the caller's behalf, so your request authentication must
753
+ # have read permissions for the object. For more information, see
754
+ # [Dialogflow access
755
+ # control](https://cloud.google.com/dialogflow/cx/docs/concept/access-control#storage).
756
+ # @param agent_content [::String]
757
+ # Zip compressed raw byte content for agent.
758
+ # @yield [result, operation] Access the result along with the TransportOperation object
759
+ # @yieldparam result [::Gapic::Operation]
760
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
761
+ #
762
+ # @return [::Gapic::Operation]
763
+ #
764
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
765
+ def restore_agent request, options = nil
766
+ raise ::ArgumentError, "request must be provided" if request.nil?
767
+
768
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::RestoreAgentRequest
769
+
770
+ # Converts hash and nil to an options object
771
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
772
+
773
+ # Customize the options with defaults
774
+ call_metadata = @config.rpcs.restore_agent.metadata.to_h
775
+
776
+ # Set x-goog-api-client and x-goog-user-project headers
777
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
778
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
779
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
780
+ transports_version_send: [:rest]
781
+
782
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
783
+
784
+ options.apply_defaults timeout: @config.rpcs.restore_agent.timeout,
785
+ metadata: call_metadata,
786
+ retry_policy: @config.rpcs.restore_agent.retry_policy
787
+
788
+ options.apply_defaults timeout: @config.timeout,
789
+ metadata: @config.metadata,
790
+ retry_policy: @config.retry_policy
791
+
792
+ @agents_stub.restore_agent request, options do |result, operation|
793
+ result = ::Gapic::Operation.new result, @operations_client, options: options
794
+ yield result, operation if block_given?
795
+ return result
796
+ end
797
+ rescue ::Gapic::Rest::Error => e
798
+ raise ::Google::Cloud::Error.from_error(e)
799
+ end
800
+
801
+ ##
802
+ # Gets agent validation result. Agent validation is performed during
803
+ # training time and is updated automatically when training is completed.
804
+ #
805
+ # @overload get_validation_result(request, options = nil)
806
+ # Pass arguments to `get_validation_result` via a request object, either of type
807
+ # {::Google::Cloud::Dialogflow::V2::GetValidationResultRequest} or an equivalent Hash.
808
+ #
809
+ # @param request [::Google::Cloud::Dialogflow::V2::GetValidationResultRequest, ::Hash]
810
+ # A request object representing the call parameters. Required. To specify no
811
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
812
+ # @param options [::Gapic::CallOptions, ::Hash]
813
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
814
+ #
815
+ # @overload get_validation_result(parent: nil, language_code: nil)
816
+ # Pass arguments to `get_validation_result` via keyword arguments. Note that at
817
+ # least one keyword argument is required. To specify no parameters, or to keep all
818
+ # the default parameter values, pass an empty Hash as a request object (see above).
819
+ #
820
+ # @param parent [::String]
821
+ # Required. The project that the agent is associated with.
822
+ # Format: `projects/<Project ID>`.
823
+ # @param language_code [::String]
824
+ # Optional. The language for which you want a validation result. If not
825
+ # specified, the agent's default language is used. [Many
826
+ # languages](https://cloud.google.com/dialogflow/docs/reference/language)
827
+ # are supported. Note: languages must be enabled in the agent before they can
828
+ # be used.
829
+ # @yield [result, operation] Access the result along with the TransportOperation object
830
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::ValidationResult]
831
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
832
+ #
833
+ # @return [::Google::Cloud::Dialogflow::V2::ValidationResult]
834
+ #
835
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
836
+ def get_validation_result request, options = nil
837
+ raise ::ArgumentError, "request must be provided" if request.nil?
838
+
839
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetValidationResultRequest
840
+
841
+ # Converts hash and nil to an options object
842
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
843
+
844
+ # Customize the options with defaults
845
+ call_metadata = @config.rpcs.get_validation_result.metadata.to_h
846
+
847
+ # Set x-goog-api-client and x-goog-user-project headers
848
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
849
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
850
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
851
+ transports_version_send: [:rest]
852
+
853
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
854
+
855
+ options.apply_defaults timeout: @config.rpcs.get_validation_result.timeout,
856
+ metadata: call_metadata,
857
+ retry_policy: @config.rpcs.get_validation_result.retry_policy
858
+
859
+ options.apply_defaults timeout: @config.timeout,
860
+ metadata: @config.metadata,
861
+ retry_policy: @config.retry_policy
862
+
863
+ @agents_stub.get_validation_result request, options do |result, operation|
864
+ yield result, operation if block_given?
865
+ return result
866
+ end
867
+ rescue ::Gapic::Rest::Error => e
868
+ raise ::Google::Cloud::Error.from_error(e)
869
+ end
870
+
871
+ ##
872
+ # Configuration class for the Agents REST API.
873
+ #
874
+ # This class represents the configuration for Agents REST,
875
+ # providing control over timeouts, retry behavior, logging, transport
876
+ # parameters, and other low-level controls. Certain parameters can also be
877
+ # applied individually to specific RPCs. See
878
+ # {::Google::Cloud::Dialogflow::V2::Agents::Rest::Client::Configuration::Rpcs}
879
+ # for a list of RPCs that can be configured independently.
880
+ #
881
+ # Configuration can be applied globally to all clients, or to a single client
882
+ # on construction.
883
+ #
884
+ # @example
885
+ #
886
+ # # Modify the global config, setting the timeout for
887
+ # # get_agent to 20 seconds,
888
+ # # and all remaining timeouts to 10 seconds.
889
+ # ::Google::Cloud::Dialogflow::V2::Agents::Rest::Client.configure do |config|
890
+ # config.timeout = 10.0
891
+ # config.rpcs.get_agent.timeout = 20.0
892
+ # end
893
+ #
894
+ # # Apply the above configuration only to a new client.
895
+ # client = ::Google::Cloud::Dialogflow::V2::Agents::Rest::Client.new do |config|
896
+ # config.timeout = 10.0
897
+ # config.rpcs.get_agent.timeout = 20.0
898
+ # end
899
+ #
900
+ # @!attribute [rw] endpoint
901
+ # The hostname or hostname:port of the service endpoint.
902
+ # Defaults to `"dialogflow.googleapis.com"`.
903
+ # @return [::String]
904
+ # @!attribute [rw] credentials
905
+ # Credentials to send with calls. You may provide any of the following types:
906
+ # * (`String`) The path to a service account key file in JSON format
907
+ # * (`Hash`) A service account key as a Hash
908
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
909
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
910
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
911
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
912
+ # * (`nil`) indicating no credentials
913
+ # @return [::Object]
914
+ # @!attribute [rw] scope
915
+ # The OAuth scopes
916
+ # @return [::Array<::String>]
917
+ # @!attribute [rw] lib_name
918
+ # The library name as recorded in instrumentation and logging
919
+ # @return [::String]
920
+ # @!attribute [rw] lib_version
921
+ # The library version as recorded in instrumentation and logging
922
+ # @return [::String]
923
+ # @!attribute [rw] timeout
924
+ # The call timeout in seconds.
925
+ # @return [::Numeric]
926
+ # @!attribute [rw] metadata
927
+ # Additional headers to be sent with the call.
928
+ # @return [::Hash{::Symbol=>::String}]
929
+ # @!attribute [rw] retry_policy
930
+ # The retry policy. The value is a hash with the following keys:
931
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
932
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
933
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
934
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
935
+ # trigger a retry.
936
+ # @return [::Hash]
937
+ # @!attribute [rw] quota_project
938
+ # A separate project against which to charge quota.
939
+ # @return [::String]
940
+ #
941
+ class Configuration
942
+ extend ::Gapic::Config
943
+
944
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
945
+ config_attr :credentials, nil do |value|
946
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
947
+ allowed.any? { |klass| klass === value }
948
+ end
949
+ config_attr :scope, nil, ::String, ::Array, nil
950
+ config_attr :lib_name, nil, ::String, nil
951
+ config_attr :lib_version, nil, ::String, nil
952
+ config_attr :timeout, nil, ::Numeric, nil
953
+ config_attr :metadata, nil, ::Hash, nil
954
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
955
+ config_attr :quota_project, nil, ::String, nil
956
+
957
+ # @private
958
+ # Overrides for http bindings for the RPCs of this service
959
+ # are only used when this service is used as mixin, and only
960
+ # by the host service.
961
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
962
+ config_attr :bindings_override, {}, ::Hash, nil
963
+
964
+ # @private
965
+ def initialize parent_config = nil
966
+ @parent_config = parent_config unless parent_config.nil?
967
+
968
+ yield self if block_given?
969
+ end
970
+
971
+ ##
972
+ # Configurations for individual RPCs
973
+ # @return [Rpcs]
974
+ #
975
+ def rpcs
976
+ @rpcs ||= begin
977
+ parent_rpcs = nil
978
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
979
+ Rpcs.new parent_rpcs
980
+ end
981
+ end
982
+
983
+ ##
984
+ # Configuration RPC class for the Agents API.
985
+ #
986
+ # Includes fields providing the configuration for each RPC in this service.
987
+ # Each configuration object is of type `Gapic::Config::Method` and includes
988
+ # the following configuration fields:
989
+ #
990
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
991
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
992
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
993
+ # include the following keys:
994
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
995
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
996
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
997
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
998
+ # trigger a retry.
999
+ #
1000
+ class Rpcs
1001
+ ##
1002
+ # RPC-specific configuration for `get_agent`
1003
+ # @return [::Gapic::Config::Method]
1004
+ #
1005
+ attr_reader :get_agent
1006
+ ##
1007
+ # RPC-specific configuration for `set_agent`
1008
+ # @return [::Gapic::Config::Method]
1009
+ #
1010
+ attr_reader :set_agent
1011
+ ##
1012
+ # RPC-specific configuration for `delete_agent`
1013
+ # @return [::Gapic::Config::Method]
1014
+ #
1015
+ attr_reader :delete_agent
1016
+ ##
1017
+ # RPC-specific configuration for `search_agents`
1018
+ # @return [::Gapic::Config::Method]
1019
+ #
1020
+ attr_reader :search_agents
1021
+ ##
1022
+ # RPC-specific configuration for `train_agent`
1023
+ # @return [::Gapic::Config::Method]
1024
+ #
1025
+ attr_reader :train_agent
1026
+ ##
1027
+ # RPC-specific configuration for `export_agent`
1028
+ # @return [::Gapic::Config::Method]
1029
+ #
1030
+ attr_reader :export_agent
1031
+ ##
1032
+ # RPC-specific configuration for `import_agent`
1033
+ # @return [::Gapic::Config::Method]
1034
+ #
1035
+ attr_reader :import_agent
1036
+ ##
1037
+ # RPC-specific configuration for `restore_agent`
1038
+ # @return [::Gapic::Config::Method]
1039
+ #
1040
+ attr_reader :restore_agent
1041
+ ##
1042
+ # RPC-specific configuration for `get_validation_result`
1043
+ # @return [::Gapic::Config::Method]
1044
+ #
1045
+ attr_reader :get_validation_result
1046
+
1047
+ # @private
1048
+ def initialize parent_rpcs = nil
1049
+ get_agent_config = parent_rpcs.get_agent if parent_rpcs.respond_to? :get_agent
1050
+ @get_agent = ::Gapic::Config::Method.new get_agent_config
1051
+ set_agent_config = parent_rpcs.set_agent if parent_rpcs.respond_to? :set_agent
1052
+ @set_agent = ::Gapic::Config::Method.new set_agent_config
1053
+ delete_agent_config = parent_rpcs.delete_agent if parent_rpcs.respond_to? :delete_agent
1054
+ @delete_agent = ::Gapic::Config::Method.new delete_agent_config
1055
+ search_agents_config = parent_rpcs.search_agents if parent_rpcs.respond_to? :search_agents
1056
+ @search_agents = ::Gapic::Config::Method.new search_agents_config
1057
+ train_agent_config = parent_rpcs.train_agent if parent_rpcs.respond_to? :train_agent
1058
+ @train_agent = ::Gapic::Config::Method.new train_agent_config
1059
+ export_agent_config = parent_rpcs.export_agent if parent_rpcs.respond_to? :export_agent
1060
+ @export_agent = ::Gapic::Config::Method.new export_agent_config
1061
+ import_agent_config = parent_rpcs.import_agent if parent_rpcs.respond_to? :import_agent
1062
+ @import_agent = ::Gapic::Config::Method.new import_agent_config
1063
+ restore_agent_config = parent_rpcs.restore_agent if parent_rpcs.respond_to? :restore_agent
1064
+ @restore_agent = ::Gapic::Config::Method.new restore_agent_config
1065
+ get_validation_result_config = parent_rpcs.get_validation_result if parent_rpcs.respond_to? :get_validation_result
1066
+ @get_validation_result = ::Gapic::Config::Method.new get_validation_result_config
1067
+
1068
+ yield self if block_given?
1069
+ end
1070
+ end
1071
+ end
1072
+ end
1073
+ end
1074
+ end
1075
+ end
1076
+ end
1077
+ end
1078
+ end