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