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