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,437 @@
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_pb"
21
+ require "google/cloud/dialogflow/v2/sessions/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Sessions
29
+ module Rest
30
+ ##
31
+ # REST client for the Sessions service.
32
+ #
33
+ # A service used for session interactions.
34
+ #
35
+ # For more information, see the [API interactions
36
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
37
+ #
38
+ class Client
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :sessions_stub
43
+
44
+ ##
45
+ # Configure the Sessions Client class.
46
+ #
47
+ # See {::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all Sessions clients
53
+ # ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.timeout = 60.0
74
+ default_config.retry_policy = {
75
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config.rpcs.detect_intent.timeout = 220.0
79
+ default_config.rpcs.detect_intent.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
81
+ }
82
+
83
+ default_config
84
+ end
85
+ yield @configure if block_given?
86
+ @configure
87
+ end
88
+
89
+ ##
90
+ # Configure the Sessions Client instance.
91
+ #
92
+ # The configuration is set to the derived mode, meaning that values can be changed,
93
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
94
+ # should be made on {Client.configure}.
95
+ #
96
+ # See {::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client::Configuration}
97
+ # for a description of the configuration fields.
98
+ #
99
+ # @yield [config] Configure the Client client.
100
+ # @yieldparam config [Client::Configuration]
101
+ #
102
+ # @return [Client::Configuration]
103
+ #
104
+ def configure
105
+ yield @config if block_given?
106
+ @config
107
+ end
108
+
109
+ ##
110
+ # Create a new Sessions REST client object.
111
+ #
112
+ # @example
113
+ #
114
+ # # Create a client using the default configuration
115
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.new
116
+ #
117
+ # # Create a client using a custom configuration
118
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.new do |config|
119
+ # config.timeout = 10.0
120
+ # end
121
+ #
122
+ # @yield [config] Configure the Sessions client.
123
+ # @yieldparam config [Client::Configuration]
124
+ #
125
+ def initialize
126
+ # Create the configuration object
127
+ @config = Configuration.new Client.configure
128
+
129
+ # Yield the configuration if needed
130
+ yield @config if block_given?
131
+
132
+ # Create credentials
133
+ credentials = @config.credentials
134
+ # Use self-signed JWT if the endpoint is unchanged from default,
135
+ # but only if the default endpoint does not have a region prefix.
136
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
137
+ !@config.endpoint.split(".").first.include?("-")
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+
144
+ @quota_project_id = @config.quota_project
145
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
146
+
147
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
148
+ config.credentials = credentials
149
+ config.quota_project = @quota_project_id
150
+ config.endpoint = @config.endpoint
151
+ config.bindings_override = @config.bindings_override
152
+ end
153
+
154
+ @sessions_stub = ::Google::Cloud::Dialogflow::V2::Sessions::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
155
+ end
156
+
157
+ ##
158
+ # Get the associated client for mix-in of the Locations.
159
+ #
160
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
161
+ #
162
+ attr_reader :location_client
163
+
164
+ # Service calls
165
+
166
+ ##
167
+ # Processes a natural language query and returns structured, actionable data
168
+ # as a result. This method is not idempotent, because it may cause contexts
169
+ # and session entity types to be updated, which in turn might affect
170
+ # results of future queries.
171
+ #
172
+ # If you might use
173
+ # [Agent Assist](https://cloud.google.com/dialogflow/docs/#aa)
174
+ # or other CCAI products now or in the future, consider using
175
+ # {::Google::Cloud::Dialogflow::V2::Participants::Rest::Client#analyze_content AnalyzeContent}
176
+ # instead of `DetectIntent`. `AnalyzeContent` has additional
177
+ # functionality for Agent Assist and other CCAI products.
178
+ #
179
+ # Note: Always use agent versions for production traffic.
180
+ # See [Versions and
181
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
182
+ #
183
+ # @overload detect_intent(request, options = nil)
184
+ # Pass arguments to `detect_intent` via a request object, either of type
185
+ # {::Google::Cloud::Dialogflow::V2::DetectIntentRequest} or an equivalent Hash.
186
+ #
187
+ # @param request [::Google::Cloud::Dialogflow::V2::DetectIntentRequest, ::Hash]
188
+ # A request object representing the call parameters. Required. To specify no
189
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
190
+ # @param options [::Gapic::CallOptions, ::Hash]
191
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
192
+ #
193
+ # @overload detect_intent(session: nil, query_params: nil, query_input: nil, output_audio_config: nil, output_audio_config_mask: nil, input_audio: nil)
194
+ # Pass arguments to `detect_intent` via keyword arguments. Note that at
195
+ # least one keyword argument is required. To specify no parameters, or to keep all
196
+ # the default parameter values, pass an empty Hash as a request object (see above).
197
+ #
198
+ # @param session [::String]
199
+ # Required. The name of the session this query is sent to. Format:
200
+ # `projects/<Project ID>/agent/sessions/<Session ID>`, or
201
+ # `projects/<Project ID>/agent/environments/<Environment ID>/users/<User
202
+ # ID>/sessions/<Session ID>`. If `Environment ID` is not specified, we assume
203
+ # default 'draft' environment (`Environment ID` might be referred to as
204
+ # environment name at some places). If `User ID` is not specified, we are
205
+ # using "-". It's up to the API caller to choose an appropriate `Session ID`
206
+ # and `User Id`. They can be a random number or some type of user and session
207
+ # identifiers (preferably hashed). The length of the `Session ID` and
208
+ # `User ID` must not exceed 36 characters.
209
+ #
210
+ # For more information, see the [API interactions
211
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
212
+ #
213
+ # Note: Always use agent versions for production traffic.
214
+ # See [Versions and
215
+ # environments](https://cloud.google.com/dialogflow/es/docs/agents-versions).
216
+ # @param query_params [::Google::Cloud::Dialogflow::V2::QueryParameters, ::Hash]
217
+ # The parameters of this query.
218
+ # @param query_input [::Google::Cloud::Dialogflow::V2::QueryInput, ::Hash]
219
+ # Required. The input specification. It can be set to:
220
+ #
221
+ # 1. an audio config
222
+ # which instructs the speech recognizer how to process the speech audio,
223
+ #
224
+ # 2. a conversational query in the form of text, or
225
+ #
226
+ # 3. an event that specifies which intent to trigger.
227
+ # @param output_audio_config [::Google::Cloud::Dialogflow::V2::OutputAudioConfig, ::Hash]
228
+ # Instructs the speech synthesizer how to generate the output
229
+ # audio. If this field is not set and agent-level speech synthesizer is not
230
+ # configured, no output audio is generated.
231
+ # @param output_audio_config_mask [::Google::Protobuf::FieldMask, ::Hash]
232
+ # Mask for
233
+ # {::Google::Cloud::Dialogflow::V2::DetectIntentRequest#output_audio_config output_audio_config}
234
+ # indicating which settings in this request-level config should override
235
+ # speech synthesizer settings defined at agent-level.
236
+ #
237
+ # If unspecified or empty,
238
+ # {::Google::Cloud::Dialogflow::V2::DetectIntentRequest#output_audio_config output_audio_config}
239
+ # replaces the agent-level config in its entirety.
240
+ # @param input_audio [::String]
241
+ # The natural language speech audio to be processed. This field
242
+ # should be populated iff `query_input` is set to an input audio config.
243
+ # A single request can contain up to 1 minute of speech audio data.
244
+ # @yield [result, operation] Access the result along with the TransportOperation object
245
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::DetectIntentResponse]
246
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
247
+ #
248
+ # @return [::Google::Cloud::Dialogflow::V2::DetectIntentResponse]
249
+ #
250
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
251
+ def detect_intent request, options = nil
252
+ raise ::ArgumentError, "request must be provided" if request.nil?
253
+
254
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DetectIntentRequest
255
+
256
+ # Converts hash and nil to an options object
257
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
258
+
259
+ # Customize the options with defaults
260
+ call_metadata = @config.rpcs.detect_intent.metadata.to_h
261
+
262
+ # Set x-goog-api-client and x-goog-user-project headers
263
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
264
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
265
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
266
+ transports_version_send: [:rest]
267
+
268
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
269
+
270
+ options.apply_defaults timeout: @config.rpcs.detect_intent.timeout,
271
+ metadata: call_metadata,
272
+ retry_policy: @config.rpcs.detect_intent.retry_policy
273
+
274
+ options.apply_defaults timeout: @config.timeout,
275
+ metadata: @config.metadata,
276
+ retry_policy: @config.retry_policy
277
+
278
+ @sessions_stub.detect_intent request, options do |result, operation|
279
+ yield result, operation if block_given?
280
+ return result
281
+ end
282
+ rescue ::Gapic::Rest::Error => e
283
+ raise ::Google::Cloud::Error.from_error(e)
284
+ end
285
+
286
+ ##
287
+ # Configuration class for the Sessions REST API.
288
+ #
289
+ # This class represents the configuration for Sessions REST,
290
+ # providing control over timeouts, retry behavior, logging, transport
291
+ # parameters, and other low-level controls. Certain parameters can also be
292
+ # applied individually to specific RPCs. See
293
+ # {::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client::Configuration::Rpcs}
294
+ # for a list of RPCs that can be configured independently.
295
+ #
296
+ # Configuration can be applied globally to all clients, or to a single client
297
+ # on construction.
298
+ #
299
+ # @example
300
+ #
301
+ # # Modify the global config, setting the timeout for
302
+ # # detect_intent to 20 seconds,
303
+ # # and all remaining timeouts to 10 seconds.
304
+ # ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.configure do |config|
305
+ # config.timeout = 10.0
306
+ # config.rpcs.detect_intent.timeout = 20.0
307
+ # end
308
+ #
309
+ # # Apply the above configuration only to a new client.
310
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.new do |config|
311
+ # config.timeout = 10.0
312
+ # config.rpcs.detect_intent.timeout = 20.0
313
+ # end
314
+ #
315
+ # @!attribute [rw] endpoint
316
+ # The hostname or hostname:port of the service endpoint.
317
+ # Defaults to `"dialogflow.googleapis.com"`.
318
+ # @return [::String]
319
+ # @!attribute [rw] credentials
320
+ # Credentials to send with calls. You may provide any of the following types:
321
+ # * (`String`) The path to a service account key file in JSON format
322
+ # * (`Hash`) A service account key as a Hash
323
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
324
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
325
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
326
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
327
+ # * (`nil`) indicating no credentials
328
+ # @return [::Object]
329
+ # @!attribute [rw] scope
330
+ # The OAuth scopes
331
+ # @return [::Array<::String>]
332
+ # @!attribute [rw] lib_name
333
+ # The library name as recorded in instrumentation and logging
334
+ # @return [::String]
335
+ # @!attribute [rw] lib_version
336
+ # The library version as recorded in instrumentation and logging
337
+ # @return [::String]
338
+ # @!attribute [rw] timeout
339
+ # The call timeout in seconds.
340
+ # @return [::Numeric]
341
+ # @!attribute [rw] metadata
342
+ # Additional headers to be sent with the call.
343
+ # @return [::Hash{::Symbol=>::String}]
344
+ # @!attribute [rw] retry_policy
345
+ # The retry policy. The value is a hash with the following keys:
346
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
347
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
348
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
349
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
350
+ # trigger a retry.
351
+ # @return [::Hash]
352
+ # @!attribute [rw] quota_project
353
+ # A separate project against which to charge quota.
354
+ # @return [::String]
355
+ #
356
+ class Configuration
357
+ extend ::Gapic::Config
358
+
359
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
360
+ config_attr :credentials, nil do |value|
361
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
362
+ allowed.any? { |klass| klass === value }
363
+ end
364
+ config_attr :scope, nil, ::String, ::Array, nil
365
+ config_attr :lib_name, nil, ::String, nil
366
+ config_attr :lib_version, nil, ::String, nil
367
+ config_attr :timeout, nil, ::Numeric, nil
368
+ config_attr :metadata, nil, ::Hash, nil
369
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
370
+ config_attr :quota_project, nil, ::String, nil
371
+
372
+ # @private
373
+ # Overrides for http bindings for the RPCs of this service
374
+ # are only used when this service is used as mixin, and only
375
+ # by the host service.
376
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
377
+ config_attr :bindings_override, {}, ::Hash, nil
378
+
379
+ # @private
380
+ def initialize parent_config = nil
381
+ @parent_config = parent_config unless parent_config.nil?
382
+
383
+ yield self if block_given?
384
+ end
385
+
386
+ ##
387
+ # Configurations for individual RPCs
388
+ # @return [Rpcs]
389
+ #
390
+ def rpcs
391
+ @rpcs ||= begin
392
+ parent_rpcs = nil
393
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
394
+ Rpcs.new parent_rpcs
395
+ end
396
+ end
397
+
398
+ ##
399
+ # Configuration RPC class for the Sessions API.
400
+ #
401
+ # Includes fields providing the configuration for each RPC in this service.
402
+ # Each configuration object is of type `Gapic::Config::Method` and includes
403
+ # the following configuration fields:
404
+ #
405
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
406
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
407
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
408
+ # include the following keys:
409
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
410
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
411
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
412
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
413
+ # trigger a retry.
414
+ #
415
+ class Rpcs
416
+ ##
417
+ # RPC-specific configuration for `detect_intent`
418
+ # @return [::Gapic::Config::Method]
419
+ #
420
+ attr_reader :detect_intent
421
+
422
+ # @private
423
+ def initialize parent_rpcs = nil
424
+ detect_intent_config = parent_rpcs.detect_intent if parent_rpcs.respond_to? :detect_intent
425
+ @detect_intent = ::Gapic::Config::Method.new detect_intent_config
426
+
427
+ yield self if block_given?
428
+ end
429
+ end
430
+ end
431
+ end
432
+ end
433
+ end
434
+ end
435
+ end
436
+ end
437
+ end
@@ -0,0 +1,132 @@
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/dialogflow/v2/session_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dialogflow
24
+ module V2
25
+ module Sessions
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Sessions service.
29
+ # Service stub contains baseline method implementations
30
+ # including transcoding, making the REST call, and deserialing the response.
31
+ #
32
+ class ServiceStub
33
+ def initialize endpoint:, credentials:
34
+ # These require statements are intentionally placed here to initialize
35
+ # the REST modules only when it's required.
36
+ require "gapic/rest"
37
+
38
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials,
39
+ numeric_enums: true,
40
+ raise_faraday_errors: false
41
+ end
42
+
43
+ ##
44
+ # Baseline implementation for the detect_intent REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Dialogflow::V2::DetectIntentRequest]
47
+ # A request object representing the call parameters. Required.
48
+ # @param options [::Gapic::CallOptions]
49
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
50
+ #
51
+ # @yield [result, operation] Access the result along with the TransportOperation object
52
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::DetectIntentResponse]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Dialogflow::V2::DetectIntentResponse]
56
+ # A result object deserialized from the server's reply
57
+ def detect_intent request_pb, options = nil
58
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
59
+
60
+ verb, uri, query_string_params, body = ServiceStub.transcode_detect_intent_request request_pb
61
+ query_string_params = if query_string_params.any?
62
+ query_string_params.to_h { |p| p.split("=", 2) }
63
+ else
64
+ {}
65
+ end
66
+
67
+ response = @client_stub.make_http_request(
68
+ verb,
69
+ uri: uri,
70
+ body: body || "",
71
+ params: query_string_params,
72
+ options: options
73
+ )
74
+ operation = ::Gapic::Rest::TransportOperation.new response
75
+ result = ::Google::Cloud::Dialogflow::V2::DetectIntentResponse.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # @private
83
+ #
84
+ # GRPC transcoding helper method for the detect_intent REST call
85
+ #
86
+ # @param request_pb [::Google::Cloud::Dialogflow::V2::DetectIntentRequest]
87
+ # A request object representing the call parameters. Required.
88
+ # @return [Array(String, [String, nil], Hash{String => String})]
89
+ # Uri, Body, Query string parameters
90
+ def self.transcode_detect_intent_request request_pb
91
+ transcoder = Gapic::Rest::GrpcTranscoder.new
92
+ .with_bindings(
93
+ uri_method: :post,
94
+ uri_template: "/v2/{session}:detectIntent",
95
+ body: "*",
96
+ matches: [
97
+ ["session", %r{^projects/[^/]+/agent/sessions/[^/]+/?$}, false]
98
+ ]
99
+ )
100
+ .with_bindings(
101
+ uri_method: :post,
102
+ uri_template: "/v2/{session}:detectIntent",
103
+ body: "*",
104
+ matches: [
105
+ ["session", %r{^projects/[^/]+/agent/environments/[^/]+/users/[^/]+/sessions/[^/]+/?$}, false]
106
+ ]
107
+ )
108
+ .with_bindings(
109
+ uri_method: :post,
110
+ uri_template: "/v2/{session}:detectIntent",
111
+ body: "*",
112
+ matches: [
113
+ ["session", %r{^projects/[^/]+/locations/[^/]+/agent/sessions/[^/]+/?$}, false]
114
+ ]
115
+ )
116
+ .with_bindings(
117
+ uri_method: :post,
118
+ uri_template: "/v2/{session}:detectIntent",
119
+ body: "*",
120
+ matches: [
121
+ ["session", %r{^projects/[^/]+/locations/[^/]+/agent/environments/[^/]+/users/[^/]+/sessions/[^/]+/?$}, false]
122
+ ]
123
+ )
124
+ transcoder.transcode request_pb
125
+ end
126
+ end
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
132
+ end
@@ -0,0 +1,56 @@
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 "gapic/rest"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/dialogflow/v2/version"
24
+ require "google/cloud/dialogflow/v2/bindings_override"
25
+
26
+ require "google/cloud/dialogflow/v2/sessions/credentials"
27
+ require "google/cloud/dialogflow/v2/sessions/paths"
28
+ require "google/cloud/dialogflow/v2/sessions/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Dialogflow
33
+ module V2
34
+ ##
35
+ # A service used for session interactions.
36
+ #
37
+ # For more information, see the [API interactions
38
+ # guide](https://cloud.google.com/dialogflow/docs/api-overview).
39
+ #
40
+ # To load this service and instantiate a REST client:
41
+ #
42
+ # require "google/cloud/dialogflow/v2/sessions/rest"
43
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.new
44
+ #
45
+ module Sessions
46
+ # Client for the REST transport
47
+ module Rest
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+
55
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
56
+ require "google/cloud/dialogflow/v2/sessions/rest/helpers" if ::File.file? helper_path
@@ -25,6 +25,7 @@ require "google/cloud/dialogflow/v2/version"
25
25
  require "google/cloud/dialogflow/v2/sessions/credentials"
26
26
  require "google/cloud/dialogflow/v2/sessions/paths"
27
27
  require "google/cloud/dialogflow/v2/sessions/client"
28
+ require "google/cloud/dialogflow/v2/sessions/rest"
28
29
 
29
30
  module Google
30
31
  module Cloud
@@ -41,6 +42,11 @@ module Google
41
42
  # require "google/cloud/dialogflow/v2/sessions"
42
43
  # client = ::Google::Cloud::Dialogflow::V2::Sessions::Client.new
43
44
  #
45
+ # @example Load this service and instantiate a REST client
46
+ #
47
+ # require "google/cloud/dialogflow/v2/sessions/rest"
48
+ # client = ::Google::Cloud::Dialogflow::V2::Sessions::Rest::Client.new
49
+ #
44
50
  module Sessions
45
51
  end
46
52
  end
@@ -21,7 +21,7 @@ module Google
21
21
  module Cloud
22
22
  module Dialogflow
23
23
  module V2
24
- VERSION = "0.22.0"
24
+ VERSION = "0.23.0"
25
25
  end
26
26
  end
27
27
  end