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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/client.rb +1032 -0
  3. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/operations.rb +815 -0
  4. data/lib/google/cloud/dialogflow/cx/v3/agents/rest/service_stub.rb +586 -0
  5. data/lib/google/cloud/dialogflow/cx/v3/agents/rest.rb +56 -0
  6. data/lib/google/cloud/dialogflow/cx/v3/agents.rb +6 -0
  7. data/lib/google/cloud/dialogflow/cx/v3/bindings_override.rb +104 -0
  8. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/client.rb +472 -0
  9. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest/service_stub.rb +168 -0
  10. data/lib/google/cloud/dialogflow/cx/v3/changelogs/rest.rb +55 -0
  11. data/lib/google/cloud/dialogflow/cx/v3/changelogs.rb +6 -0
  12. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/client.rb +456 -0
  13. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest/service_stub.rb +168 -0
  14. data/lib/google/cloud/dialogflow/cx/v3/deployments/rest.rb +55 -0
  15. data/lib/google/cloud/dialogflow/cx/v3/deployments.rb +6 -0
  16. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/client.rb +740 -0
  17. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest/service_stub.rb +347 -0
  18. data/lib/google/cloud/dialogflow/cx/v3/entity_types/rest.rb +55 -0
  19. data/lib/google/cloud/dialogflow/cx/v3/entity_types.rb +6 -0
  20. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/client.rb +1028 -0
  21. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/operations.rb +815 -0
  22. data/lib/google/cloud/dialogflow/cx/v3/environments/rest/service_stub.rb +585 -0
  23. data/lib/google/cloud/dialogflow/cx/v3/environments/rest.rb +57 -0
  24. data/lib/google/cloud/dialogflow/cx/v3/environments.rb +6 -0
  25. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/client.rb +821 -0
  26. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest/service_stub.rb +467 -0
  27. data/lib/google/cloud/dialogflow/cx/v3/experiments/rest.rb +55 -0
  28. data/lib/google/cloud/dialogflow/cx/v3/experiments.rb +6 -0
  29. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/client.rb +1182 -0
  30. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/operations.rb +815 -0
  31. data/lib/google/cloud/dialogflow/cx/v3/flows/rest/service_stub.rb +646 -0
  32. data/lib/google/cloud/dialogflow/cx/v3/flows/rest.rb +56 -0
  33. data/lib/google/cloud/dialogflow/cx/v3/flows.rb +6 -0
  34. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/client.rb +722 -0
  35. data/lib/google/cloud/dialogflow/cx/v3/intents/rest/service_stub.rb +347 -0
  36. data/lib/google/cloud/dialogflow/cx/v3/intents/rest.rb +55 -0
  37. data/lib/google/cloud/dialogflow/cx/v3/intents.rb +6 -0
  38. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/client.rb +777 -0
  39. data/lib/google/cloud/dialogflow/cx/v3/pages/rest/service_stub.rb +347 -0
  40. data/lib/google/cloud/dialogflow/cx/v3/pages/rest.rb +55 -0
  41. data/lib/google/cloud/dialogflow/cx/v3/pages.rb +6 -0
  42. data/lib/google/cloud/dialogflow/cx/v3/rest.rb +55 -0
  43. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/client.rb +673 -0
  44. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest/service_stub.rb +347 -0
  45. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service/rest.rb +55 -0
  46. data/lib/google/cloud/dialogflow/cx/v3/security_settings_service.rb +6 -0
  47. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/client.rb +688 -0
  48. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest/service_stub.rb +384 -0
  49. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types/rest.rb +56 -0
  50. data/lib/google/cloud/dialogflow/cx/v3/session_entity_types.rb +6 -0
  51. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/client.rb +576 -0
  52. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest/service_stub.rb +254 -0
  53. data/lib/google/cloud/dialogflow/cx/v3/sessions/rest.rb +58 -0
  54. data/lib/google/cloud/dialogflow/cx/v3/sessions.rb +6 -0
  55. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/client.rb +1304 -0
  56. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/operations.rb +815 -0
  57. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest/service_stub.rb +765 -0
  58. data/lib/google/cloud/dialogflow/cx/v3/test_cases/rest.rb +57 -0
  59. data/lib/google/cloud/dialogflow/cx/v3/test_cases.rb +6 -0
  60. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/client.rb +748 -0
  61. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest/service_stub.rb +347 -0
  62. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups/rest.rb +56 -0
  63. data/lib/google/cloud/dialogflow/cx/v3/transition_route_groups.rb +6 -0
  64. data/lib/google/cloud/dialogflow/cx/v3/version.rb +1 -1
  65. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/client.rb +865 -0
  66. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/operations.rb +815 -0
  67. data/lib/google/cloud/dialogflow/cx/v3/versions/rest/service_stub.rb +467 -0
  68. data/lib/google/cloud/dialogflow/cx/v3/versions/rest.rb +56 -0
  69. data/lib/google/cloud/dialogflow/cx/v3/versions.rb +6 -0
  70. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/client.rb +677 -0
  71. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest/service_stub.rb +347 -0
  72. data/lib/google/cloud/dialogflow/cx/v3/webhooks/rest.rb +55 -0
  73. data/lib/google/cloud/dialogflow/cx/v3/webhooks.rb +6 -0
  74. data/lib/google/cloud/dialogflow/cx/v3.rb +5 -0
  75. metadata +57 -2
@@ -0,0 +1,740 @@
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/entity_type_pb"
21
+ require "google/cloud/dialogflow/cx/v3/entity_types/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 EntityTypes
30
+ module Rest
31
+ ##
32
+ # REST client for the EntityTypes service.
33
+ #
34
+ # Service for managing {::Google::Cloud::Dialogflow::CX::V3::EntityType EntityTypes}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :entity_types_stub
41
+
42
+ ##
43
+ # Configure the EntityTypes Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all EntityTypes clients
51
+ # ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::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 EntityTypes 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::EntityTypes::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 EntityTypes REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the EntityTypes 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
+ @entity_types_stub = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::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 entity types in the specified agent.
161
+ #
162
+ # @overload list_entity_types(request, options = nil)
163
+ # Pass arguments to `list_entity_types` via a request object, either of type
164
+ # {::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest} or an equivalent Hash.
165
+ #
166
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::ListEntityTypesRequest, ::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_entity_types(parent: nil, language_code: nil, page_size: nil, page_token: nil)
173
+ # Pass arguments to `list_entity_types` 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 entity types for.
179
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
180
+ # @param language_code [::String]
181
+ # The language to list entity types for. The following fields are language
182
+ # dependent:
183
+ #
184
+ # * `EntityType.entities.value`
185
+ # * `EntityType.entities.synonyms`
186
+ # * `EntityType.excluded_phrases.value`
187
+ #
188
+ # If not specified, the agent's default language is used.
189
+ # [Many
190
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
191
+ # are supported.
192
+ # Note: languages must be enabled in the agent before they can be used.
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::EntityType>]
200
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
201
+ #
202
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::CX::V3::EntityType>]
203
+ #
204
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
205
+ def list_entity_types 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::ListEntityTypesRequest
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_entity_types.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_entity_types.timeout,
225
+ metadata: call_metadata,
226
+ retry_policy: @config.rpcs.list_entity_types.retry_policy
227
+
228
+ options.apply_defaults timeout: @config.timeout,
229
+ metadata: @config.metadata,
230
+ retry_policy: @config.retry_policy
231
+
232
+ @entity_types_stub.list_entity_types request, options do |result, operation|
233
+ result = ::Gapic::Rest::PagedEnumerable.new @entity_types_stub, :list_entity_types, "entity_types", 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 entity type.
243
+ #
244
+ # @overload get_entity_type(request, options = nil)
245
+ # Pass arguments to `get_entity_type` via a request object, either of type
246
+ # {::Google::Cloud::Dialogflow::CX::V3::GetEntityTypeRequest} or an equivalent Hash.
247
+ #
248
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::GetEntityTypeRequest, ::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_entity_type(name: nil, language_code: nil)
255
+ # Pass arguments to `get_entity_type` 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 entity type.
261
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
262
+ # ID>/entityTypes/<Entity Type ID>`.
263
+ # @param language_code [::String]
264
+ # The language to retrieve the entity type for. The following fields are
265
+ # language dependent:
266
+ #
267
+ # * `EntityType.entities.value`
268
+ # * `EntityType.entities.synonyms`
269
+ # * `EntityType.excluded_phrases.value`
270
+ #
271
+ # If not specified, the agent's default language is used.
272
+ # [Many
273
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
274
+ # are supported.
275
+ # Note: languages must be enabled in the agent before they can be used.
276
+ # @yield [result, operation] Access the result along with the TransportOperation object
277
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::EntityType]
278
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
279
+ #
280
+ # @return [::Google::Cloud::Dialogflow::CX::V3::EntityType]
281
+ #
282
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
283
+ def get_entity_type request, options = nil
284
+ raise ::ArgumentError, "request must be provided" if request.nil?
285
+
286
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::GetEntityTypeRequest
287
+
288
+ # Converts hash and nil to an options object
289
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
290
+
291
+ # Customize the options with defaults
292
+ call_metadata = @config.rpcs.get_entity_type.metadata.to_h
293
+
294
+ # Set x-goog-api-client and x-goog-user-project headers
295
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
296
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
297
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
298
+ transports_version_send: [:rest]
299
+
300
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
+
302
+ options.apply_defaults timeout: @config.rpcs.get_entity_type.timeout,
303
+ metadata: call_metadata,
304
+ retry_policy: @config.rpcs.get_entity_type.retry_policy
305
+
306
+ options.apply_defaults timeout: @config.timeout,
307
+ metadata: @config.metadata,
308
+ retry_policy: @config.retry_policy
309
+
310
+ @entity_types_stub.get_entity_type request, options do |result, operation|
311
+ yield result, operation if block_given?
312
+ return result
313
+ end
314
+ rescue ::Gapic::Rest::Error => e
315
+ raise ::Google::Cloud::Error.from_error(e)
316
+ end
317
+
318
+ ##
319
+ # Creates an entity type in the specified agent.
320
+ #
321
+ # Note: You should always train a flow prior to sending it queries. See the
322
+ # [training
323
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
324
+ #
325
+ # @overload create_entity_type(request, options = nil)
326
+ # Pass arguments to `create_entity_type` via a request object, either of type
327
+ # {::Google::Cloud::Dialogflow::CX::V3::CreateEntityTypeRequest} or an equivalent Hash.
328
+ #
329
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::CreateEntityTypeRequest, ::Hash]
330
+ # A request object representing the call parameters. Required. To specify no
331
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
332
+ # @param options [::Gapic::CallOptions, ::Hash]
333
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
334
+ #
335
+ # @overload create_entity_type(parent: nil, entity_type: nil, language_code: nil)
336
+ # Pass arguments to `create_entity_type` via keyword arguments. Note that at
337
+ # least one keyword argument is required. To specify no parameters, or to keep all
338
+ # the default parameter values, pass an empty Hash as a request object (see above).
339
+ #
340
+ # @param parent [::String]
341
+ # Required. The agent to create a entity type for.
342
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>`.
343
+ # @param entity_type [::Google::Cloud::Dialogflow::CX::V3::EntityType, ::Hash]
344
+ # Required. The entity type to create.
345
+ # @param language_code [::String]
346
+ # The language of the following fields in `entity_type`:
347
+ #
348
+ # * `EntityType.entities.value`
349
+ # * `EntityType.entities.synonyms`
350
+ # * `EntityType.excluded_phrases.value`
351
+ #
352
+ # If not specified, the agent's default language is used.
353
+ # [Many
354
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
355
+ # are supported.
356
+ # Note: languages must be enabled in the agent before they can be used.
357
+ # @yield [result, operation] Access the result along with the TransportOperation object
358
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::EntityType]
359
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
360
+ #
361
+ # @return [::Google::Cloud::Dialogflow::CX::V3::EntityType]
362
+ #
363
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
364
+ def create_entity_type request, options = nil
365
+ raise ::ArgumentError, "request must be provided" if request.nil?
366
+
367
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::CreateEntityTypeRequest
368
+
369
+ # Converts hash and nil to an options object
370
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
371
+
372
+ # Customize the options with defaults
373
+ call_metadata = @config.rpcs.create_entity_type.metadata.to_h
374
+
375
+ # Set x-goog-api-client and x-goog-user-project headers
376
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
377
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
378
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
379
+ transports_version_send: [:rest]
380
+
381
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
382
+
383
+ options.apply_defaults timeout: @config.rpcs.create_entity_type.timeout,
384
+ metadata: call_metadata,
385
+ retry_policy: @config.rpcs.create_entity_type.retry_policy
386
+
387
+ options.apply_defaults timeout: @config.timeout,
388
+ metadata: @config.metadata,
389
+ retry_policy: @config.retry_policy
390
+
391
+ @entity_types_stub.create_entity_type request, options do |result, operation|
392
+ yield result, operation if block_given?
393
+ return result
394
+ end
395
+ rescue ::Gapic::Rest::Error => e
396
+ raise ::Google::Cloud::Error.from_error(e)
397
+ end
398
+
399
+ ##
400
+ # Updates the specified entity type.
401
+ #
402
+ # Note: You should always train a flow prior to sending it queries. See the
403
+ # [training
404
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
405
+ #
406
+ # @overload update_entity_type(request, options = nil)
407
+ # Pass arguments to `update_entity_type` via a request object, either of type
408
+ # {::Google::Cloud::Dialogflow::CX::V3::UpdateEntityTypeRequest} or an equivalent Hash.
409
+ #
410
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::UpdateEntityTypeRequest, ::Hash]
411
+ # A request object representing the call parameters. Required. To specify no
412
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
413
+ # @param options [::Gapic::CallOptions, ::Hash]
414
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
415
+ #
416
+ # @overload update_entity_type(entity_type: nil, language_code: nil, update_mask: nil)
417
+ # Pass arguments to `update_entity_type` via keyword arguments. Note that at
418
+ # least one keyword argument is required. To specify no parameters, or to keep all
419
+ # the default parameter values, pass an empty Hash as a request object (see above).
420
+ #
421
+ # @param entity_type [::Google::Cloud::Dialogflow::CX::V3::EntityType, ::Hash]
422
+ # Required. The entity type to update.
423
+ # @param language_code [::String]
424
+ # The language of the following fields in `entity_type`:
425
+ #
426
+ # * `EntityType.entities.value`
427
+ # * `EntityType.entities.synonyms`
428
+ # * `EntityType.excluded_phrases.value`
429
+ #
430
+ # If not specified, the agent's default language is used.
431
+ # [Many
432
+ # languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
433
+ # are supported.
434
+ # Note: languages must be enabled in the agent before they can be used.
435
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
436
+ # The mask to control which fields get updated.
437
+ # @yield [result, operation] Access the result along with the TransportOperation object
438
+ # @yieldparam result [::Google::Cloud::Dialogflow::CX::V3::EntityType]
439
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
440
+ #
441
+ # @return [::Google::Cloud::Dialogflow::CX::V3::EntityType]
442
+ #
443
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
444
+ def update_entity_type request, options = nil
445
+ raise ::ArgumentError, "request must be provided" if request.nil?
446
+
447
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::UpdateEntityTypeRequest
448
+
449
+ # Converts hash and nil to an options object
450
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
451
+
452
+ # Customize the options with defaults
453
+ call_metadata = @config.rpcs.update_entity_type.metadata.to_h
454
+
455
+ # Set x-goog-api-client and x-goog-user-project headers
456
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
457
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
458
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
459
+ transports_version_send: [:rest]
460
+
461
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
462
+
463
+ options.apply_defaults timeout: @config.rpcs.update_entity_type.timeout,
464
+ metadata: call_metadata,
465
+ retry_policy: @config.rpcs.update_entity_type.retry_policy
466
+
467
+ options.apply_defaults timeout: @config.timeout,
468
+ metadata: @config.metadata,
469
+ retry_policy: @config.retry_policy
470
+
471
+ @entity_types_stub.update_entity_type request, options do |result, operation|
472
+ yield result, operation if block_given?
473
+ return result
474
+ end
475
+ rescue ::Gapic::Rest::Error => e
476
+ raise ::Google::Cloud::Error.from_error(e)
477
+ end
478
+
479
+ ##
480
+ # Deletes the specified entity type.
481
+ #
482
+ # Note: You should always train a flow prior to sending it queries. See the
483
+ # [training
484
+ # documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
485
+ #
486
+ # @overload delete_entity_type(request, options = nil)
487
+ # Pass arguments to `delete_entity_type` via a request object, either of type
488
+ # {::Google::Cloud::Dialogflow::CX::V3::DeleteEntityTypeRequest} or an equivalent Hash.
489
+ #
490
+ # @param request [::Google::Cloud::Dialogflow::CX::V3::DeleteEntityTypeRequest, ::Hash]
491
+ # A request object representing the call parameters. Required. To specify no
492
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
493
+ # @param options [::Gapic::CallOptions, ::Hash]
494
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
495
+ #
496
+ # @overload delete_entity_type(name: nil, force: nil)
497
+ # Pass arguments to `delete_entity_type` via keyword arguments. Note that at
498
+ # least one keyword argument is required. To specify no parameters, or to keep all
499
+ # the default parameter values, pass an empty Hash as a request object (see above).
500
+ #
501
+ # @param name [::String]
502
+ # Required. The name of the entity type to delete.
503
+ # Format: `projects/<Project ID>/locations/<Location ID>/agents/<Agent
504
+ # ID>/entityTypes/<Entity Type ID>`.
505
+ # @param force [::Boolean]
506
+ # This field has no effect for entity type not being used.
507
+ # For entity types that are used by intents or pages:
508
+ #
509
+ # * If `force` is set to false, an error will be returned with message
510
+ # indicating the referencing resources.
511
+ # * If `force` is set to true, Dialogflow will remove the entity type, as
512
+ # well as any references to the entity type (i.e. Page
513
+ # {::Google::Cloud::Dialogflow::CX::V3::Form::Parameter parameter} of the entity
514
+ # type will be changed to
515
+ # '@sys.any' and intent
516
+ # {::Google::Cloud::Dialogflow::CX::V3::Intent::Parameter parameter} of the
517
+ # entity type will be removed).
518
+ # @yield [result, operation] Access the result along with the TransportOperation object
519
+ # @yieldparam result [::Google::Protobuf::Empty]
520
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
521
+ #
522
+ # @return [::Google::Protobuf::Empty]
523
+ #
524
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
525
+ def delete_entity_type request, options = nil
526
+ raise ::ArgumentError, "request must be provided" if request.nil?
527
+
528
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::CX::V3::DeleteEntityTypeRequest
529
+
530
+ # Converts hash and nil to an options object
531
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
532
+
533
+ # Customize the options with defaults
534
+ call_metadata = @config.rpcs.delete_entity_type.metadata.to_h
535
+
536
+ # Set x-goog-api-client and x-goog-user-project headers
537
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
538
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
539
+ gapic_version: ::Google::Cloud::Dialogflow::CX::V3::VERSION,
540
+ transports_version_send: [:rest]
541
+
542
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
543
+
544
+ options.apply_defaults timeout: @config.rpcs.delete_entity_type.timeout,
545
+ metadata: call_metadata,
546
+ retry_policy: @config.rpcs.delete_entity_type.retry_policy
547
+
548
+ options.apply_defaults timeout: @config.timeout,
549
+ metadata: @config.metadata,
550
+ retry_policy: @config.retry_policy
551
+
552
+ @entity_types_stub.delete_entity_type request, options do |result, operation|
553
+ yield result, operation if block_given?
554
+ return result
555
+ end
556
+ rescue ::Gapic::Rest::Error => e
557
+ raise ::Google::Cloud::Error.from_error(e)
558
+ end
559
+
560
+ ##
561
+ # Configuration class for the EntityTypes REST API.
562
+ #
563
+ # This class represents the configuration for EntityTypes REST,
564
+ # providing control over timeouts, retry behavior, logging, transport
565
+ # parameters, and other low-level controls. Certain parameters can also be
566
+ # applied individually to specific RPCs. See
567
+ # {::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client::Configuration::Rpcs}
568
+ # for a list of RPCs that can be configured independently.
569
+ #
570
+ # Configuration can be applied globally to all clients, or to a single client
571
+ # on construction.
572
+ #
573
+ # @example
574
+ #
575
+ # # Modify the global config, setting the timeout for
576
+ # # list_entity_types to 20 seconds,
577
+ # # and all remaining timeouts to 10 seconds.
578
+ # ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.configure do |config|
579
+ # config.timeout = 10.0
580
+ # config.rpcs.list_entity_types.timeout = 20.0
581
+ # end
582
+ #
583
+ # # Apply the above configuration only to a new client.
584
+ # client = ::Google::Cloud::Dialogflow::CX::V3::EntityTypes::Rest::Client.new do |config|
585
+ # config.timeout = 10.0
586
+ # config.rpcs.list_entity_types.timeout = 20.0
587
+ # end
588
+ #
589
+ # @!attribute [rw] endpoint
590
+ # The hostname or hostname:port of the service endpoint.
591
+ # Defaults to `"dialogflow.googleapis.com"`.
592
+ # @return [::String]
593
+ # @!attribute [rw] credentials
594
+ # Credentials to send with calls. You may provide any of the following types:
595
+ # * (`String`) The path to a service account key file in JSON format
596
+ # * (`Hash`) A service account key as a Hash
597
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
598
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
599
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
600
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
601
+ # * (`nil`) indicating no credentials
602
+ # @return [::Object]
603
+ # @!attribute [rw] scope
604
+ # The OAuth scopes
605
+ # @return [::Array<::String>]
606
+ # @!attribute [rw] lib_name
607
+ # The library name as recorded in instrumentation and logging
608
+ # @return [::String]
609
+ # @!attribute [rw] lib_version
610
+ # The library version as recorded in instrumentation and logging
611
+ # @return [::String]
612
+ # @!attribute [rw] timeout
613
+ # The call timeout in seconds.
614
+ # @return [::Numeric]
615
+ # @!attribute [rw] metadata
616
+ # Additional headers to be sent with the call.
617
+ # @return [::Hash{::Symbol=>::String}]
618
+ # @!attribute [rw] retry_policy
619
+ # The retry policy. The value is a hash with the following keys:
620
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
621
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
622
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
623
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
624
+ # trigger a retry.
625
+ # @return [::Hash]
626
+ # @!attribute [rw] quota_project
627
+ # A separate project against which to charge quota.
628
+ # @return [::String]
629
+ #
630
+ class Configuration
631
+ extend ::Gapic::Config
632
+
633
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
634
+ config_attr :credentials, nil do |value|
635
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
636
+ allowed.any? { |klass| klass === value }
637
+ end
638
+ config_attr :scope, nil, ::String, ::Array, nil
639
+ config_attr :lib_name, nil, ::String, nil
640
+ config_attr :lib_version, nil, ::String, nil
641
+ config_attr :timeout, nil, ::Numeric, nil
642
+ config_attr :metadata, nil, ::Hash, nil
643
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
644
+ config_attr :quota_project, nil, ::String, nil
645
+
646
+ # @private
647
+ # Overrides for http bindings for the RPCs of this service
648
+ # are only used when this service is used as mixin, and only
649
+ # by the host service.
650
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
651
+ config_attr :bindings_override, {}, ::Hash, nil
652
+
653
+ # @private
654
+ def initialize parent_config = nil
655
+ @parent_config = parent_config unless parent_config.nil?
656
+
657
+ yield self if block_given?
658
+ end
659
+
660
+ ##
661
+ # Configurations for individual RPCs
662
+ # @return [Rpcs]
663
+ #
664
+ def rpcs
665
+ @rpcs ||= begin
666
+ parent_rpcs = nil
667
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
668
+ Rpcs.new parent_rpcs
669
+ end
670
+ end
671
+
672
+ ##
673
+ # Configuration RPC class for the EntityTypes API.
674
+ #
675
+ # Includes fields providing the configuration for each RPC in this service.
676
+ # Each configuration object is of type `Gapic::Config::Method` and includes
677
+ # the following configuration fields:
678
+ #
679
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
680
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
681
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
682
+ # include the following keys:
683
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
684
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
685
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
686
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
687
+ # trigger a retry.
688
+ #
689
+ class Rpcs
690
+ ##
691
+ # RPC-specific configuration for `list_entity_types`
692
+ # @return [::Gapic::Config::Method]
693
+ #
694
+ attr_reader :list_entity_types
695
+ ##
696
+ # RPC-specific configuration for `get_entity_type`
697
+ # @return [::Gapic::Config::Method]
698
+ #
699
+ attr_reader :get_entity_type
700
+ ##
701
+ # RPC-specific configuration for `create_entity_type`
702
+ # @return [::Gapic::Config::Method]
703
+ #
704
+ attr_reader :create_entity_type
705
+ ##
706
+ # RPC-specific configuration for `update_entity_type`
707
+ # @return [::Gapic::Config::Method]
708
+ #
709
+ attr_reader :update_entity_type
710
+ ##
711
+ # RPC-specific configuration for `delete_entity_type`
712
+ # @return [::Gapic::Config::Method]
713
+ #
714
+ attr_reader :delete_entity_type
715
+
716
+ # @private
717
+ def initialize parent_rpcs = nil
718
+ list_entity_types_config = parent_rpcs.list_entity_types if parent_rpcs.respond_to? :list_entity_types
719
+ @list_entity_types = ::Gapic::Config::Method.new list_entity_types_config
720
+ get_entity_type_config = parent_rpcs.get_entity_type if parent_rpcs.respond_to? :get_entity_type
721
+ @get_entity_type = ::Gapic::Config::Method.new get_entity_type_config
722
+ create_entity_type_config = parent_rpcs.create_entity_type if parent_rpcs.respond_to? :create_entity_type
723
+ @create_entity_type = ::Gapic::Config::Method.new create_entity_type_config
724
+ update_entity_type_config = parent_rpcs.update_entity_type if parent_rpcs.respond_to? :update_entity_type
725
+ @update_entity_type = ::Gapic::Config::Method.new update_entity_type_config
726
+ delete_entity_type_config = parent_rpcs.delete_entity_type if parent_rpcs.respond_to? :delete_entity_type
727
+ @delete_entity_type = ::Gapic::Config::Method.new delete_entity_type_config
728
+
729
+ yield self if block_given?
730
+ end
731
+ end
732
+ end
733
+ end
734
+ end
735
+ end
736
+ end
737
+ end
738
+ end
739
+ end
740
+ end