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,444 @@
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/fulfillment_pb"
21
+ require "google/cloud/dialogflow/v2/fulfillments/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Fulfillments
29
+ module Rest
30
+ ##
31
+ # REST client for the Fulfillments service.
32
+ #
33
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Fulfillment Fulfillments}.
34
+ #
35
+ class Client
36
+ include Paths
37
+
38
+ # @private
39
+ attr_reader :fulfillments_stub
40
+
41
+ ##
42
+ # Configure the Fulfillments Client class.
43
+ #
44
+ # See {::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client::Configuration}
45
+ # for a description of the configuration fields.
46
+ #
47
+ # @example
48
+ #
49
+ # # Modify the configuration for all Fulfillments clients
50
+ # ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client.configure do |config|
51
+ # config.timeout = 10.0
52
+ # end
53
+ #
54
+ # @yield [config] Configure the Client client.
55
+ # @yieldparam config [Client::Configuration]
56
+ #
57
+ # @return [Client::Configuration]
58
+ #
59
+ def self.configure
60
+ @configure ||= begin
61
+ namespace = ["Google", "Cloud", "Dialogflow", "V2"]
62
+ parent_config = while namespace.any?
63
+ parent_name = namespace.join "::"
64
+ parent_const = const_get parent_name
65
+ break parent_const.configure if parent_const.respond_to? :configure
66
+ namespace.pop
67
+ end
68
+ default_config = Client::Configuration.new parent_config
69
+
70
+ default_config.timeout = 60.0
71
+ default_config.retry_policy = {
72
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
73
+ }
74
+
75
+ default_config
76
+ end
77
+ yield @configure if block_given?
78
+ @configure
79
+ end
80
+
81
+ ##
82
+ # Configure the Fulfillments Client instance.
83
+ #
84
+ # The configuration is set to the derived mode, meaning that values can be changed,
85
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
86
+ # should be made on {Client.configure}.
87
+ #
88
+ # See {::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client::Configuration}
89
+ # for a description of the configuration fields.
90
+ #
91
+ # @yield [config] Configure the Client client.
92
+ # @yieldparam config [Client::Configuration]
93
+ #
94
+ # @return [Client::Configuration]
95
+ #
96
+ def configure
97
+ yield @config if block_given?
98
+ @config
99
+ end
100
+
101
+ ##
102
+ # Create a new Fulfillments REST client object.
103
+ #
104
+ # @example
105
+ #
106
+ # # Create a client using the default configuration
107
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client.new
108
+ #
109
+ # # Create a client using a custom configuration
110
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client.new do |config|
111
+ # config.timeout = 10.0
112
+ # end
113
+ #
114
+ # @yield [config] Configure the Fulfillments client.
115
+ # @yieldparam config [Client::Configuration]
116
+ #
117
+ def initialize
118
+ # Create the configuration object
119
+ @config = Configuration.new Client.configure
120
+
121
+ # Yield the configuration if needed
122
+ yield @config if block_given?
123
+
124
+ # Create credentials
125
+ credentials = @config.credentials
126
+ # Use self-signed JWT if the endpoint is unchanged from default,
127
+ # but only if the default endpoint does not have a region prefix.
128
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
129
+ !@config.endpoint.split(".").first.include?("-")
130
+ credentials ||= Credentials.default scope: @config.scope,
131
+ enable_self_signed_jwt: enable_self_signed_jwt
132
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
133
+ credentials = Credentials.new credentials, scope: @config.scope
134
+ end
135
+
136
+ @quota_project_id = @config.quota_project
137
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
138
+
139
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
140
+ config.credentials = credentials
141
+ config.quota_project = @quota_project_id
142
+ config.endpoint = @config.endpoint
143
+ config.bindings_override = @config.bindings_override
144
+ end
145
+
146
+ @fulfillments_stub = ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
147
+ end
148
+
149
+ ##
150
+ # Get the associated client for mix-in of the Locations.
151
+ #
152
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
153
+ #
154
+ attr_reader :location_client
155
+
156
+ # Service calls
157
+
158
+ ##
159
+ # Retrieves the fulfillment.
160
+ #
161
+ # @overload get_fulfillment(request, options = nil)
162
+ # Pass arguments to `get_fulfillment` via a request object, either of type
163
+ # {::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest} or an equivalent Hash.
164
+ #
165
+ # @param request [::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest, ::Hash]
166
+ # A request object representing the call parameters. Required. To specify no
167
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
168
+ # @param options [::Gapic::CallOptions, ::Hash]
169
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
170
+ #
171
+ # @overload get_fulfillment(name: nil)
172
+ # Pass arguments to `get_fulfillment` via keyword arguments. Note that at
173
+ # least one keyword argument is required. To specify no parameters, or to keep all
174
+ # the default parameter values, pass an empty Hash as a request object (see above).
175
+ #
176
+ # @param name [::String]
177
+ # Required. The name of the fulfillment.
178
+ # Format: `projects/<Project ID>/agent/fulfillment`.
179
+ # @yield [result, operation] Access the result along with the TransportOperation object
180
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Fulfillment]
181
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
182
+ #
183
+ # @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
184
+ #
185
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
186
+ def get_fulfillment request, options = nil
187
+ raise ::ArgumentError, "request must be provided" if request.nil?
188
+
189
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest
190
+
191
+ # Converts hash and nil to an options object
192
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
193
+
194
+ # Customize the options with defaults
195
+ call_metadata = @config.rpcs.get_fulfillment.metadata.to_h
196
+
197
+ # Set x-goog-api-client and x-goog-user-project headers
198
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
199
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
200
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
201
+ transports_version_send: [:rest]
202
+
203
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
204
+
205
+ options.apply_defaults timeout: @config.rpcs.get_fulfillment.timeout,
206
+ metadata: call_metadata,
207
+ retry_policy: @config.rpcs.get_fulfillment.retry_policy
208
+
209
+ options.apply_defaults timeout: @config.timeout,
210
+ metadata: @config.metadata,
211
+ retry_policy: @config.retry_policy
212
+
213
+ @fulfillments_stub.get_fulfillment request, options do |result, operation|
214
+ yield result, operation if block_given?
215
+ return result
216
+ end
217
+ rescue ::Gapic::Rest::Error => e
218
+ raise ::Google::Cloud::Error.from_error(e)
219
+ end
220
+
221
+ ##
222
+ # Updates the fulfillment.
223
+ #
224
+ # @overload update_fulfillment(request, options = nil)
225
+ # Pass arguments to `update_fulfillment` via a request object, either of type
226
+ # {::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest} or an equivalent Hash.
227
+ #
228
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest, ::Hash]
229
+ # A request object representing the call parameters. Required. To specify no
230
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
231
+ # @param options [::Gapic::CallOptions, ::Hash]
232
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
233
+ #
234
+ # @overload update_fulfillment(fulfillment: nil, update_mask: nil)
235
+ # Pass arguments to `update_fulfillment` via keyword arguments. Note that at
236
+ # least one keyword argument is required. To specify no parameters, or to keep all
237
+ # the default parameter values, pass an empty Hash as a request object (see above).
238
+ #
239
+ # @param fulfillment [::Google::Cloud::Dialogflow::V2::Fulfillment, ::Hash]
240
+ # Required. The fulfillment to update.
241
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
242
+ # Required. The mask to control which fields get updated. If the mask is not
243
+ # present, all fields will be updated.
244
+ # @yield [result, operation] Access the result along with the TransportOperation object
245
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Fulfillment]
246
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
247
+ #
248
+ # @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
249
+ #
250
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
251
+ def update_fulfillment 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::UpdateFulfillmentRequest
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.update_fulfillment.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.update_fulfillment.timeout,
271
+ metadata: call_metadata,
272
+ retry_policy: @config.rpcs.update_fulfillment.retry_policy
273
+
274
+ options.apply_defaults timeout: @config.timeout,
275
+ metadata: @config.metadata,
276
+ retry_policy: @config.retry_policy
277
+
278
+ @fulfillments_stub.update_fulfillment 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 Fulfillments REST API.
288
+ #
289
+ # This class represents the configuration for Fulfillments 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::Fulfillments::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
+ # # get_fulfillment to 20 seconds,
303
+ # # and all remaining timeouts to 10 seconds.
304
+ # ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client.configure do |config|
305
+ # config.timeout = 10.0
306
+ # config.rpcs.get_fulfillment.timeout = 20.0
307
+ # end
308
+ #
309
+ # # Apply the above configuration only to a new client.
310
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client.new do |config|
311
+ # config.timeout = 10.0
312
+ # config.rpcs.get_fulfillment.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 Fulfillments 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 `get_fulfillment`
418
+ # @return [::Gapic::Config::Method]
419
+ #
420
+ attr_reader :get_fulfillment
421
+ ##
422
+ # RPC-specific configuration for `update_fulfillment`
423
+ # @return [::Gapic::Config::Method]
424
+ #
425
+ attr_reader :update_fulfillment
426
+
427
+ # @private
428
+ def initialize parent_rpcs = nil
429
+ get_fulfillment_config = parent_rpcs.get_fulfillment if parent_rpcs.respond_to? :get_fulfillment
430
+ @get_fulfillment = ::Gapic::Config::Method.new get_fulfillment_config
431
+ update_fulfillment_config = parent_rpcs.update_fulfillment if parent_rpcs.respond_to? :update_fulfillment
432
+ @update_fulfillment = ::Gapic::Config::Method.new update_fulfillment_config
433
+
434
+ yield self if block_given?
435
+ end
436
+ end
437
+ end
438
+ end
439
+ end
440
+ end
441
+ end
442
+ end
443
+ end
444
+ end
@@ -0,0 +1,182 @@
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/fulfillment_pb"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Dialogflow
24
+ module V2
25
+ module Fulfillments
26
+ module Rest
27
+ ##
28
+ # REST service stub for the Fulfillments 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 get_fulfillment REST call
45
+ #
46
+ # @param request_pb [::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest]
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::Fulfillment]
53
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
54
+ #
55
+ # @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
56
+ # A result object deserialized from the server's reply
57
+ def get_fulfillment 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_get_fulfillment_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::Fulfillment.decode_json response.body, ignore_unknown_fields: true
76
+
77
+ yield result, operation if block_given?
78
+ result
79
+ end
80
+
81
+ ##
82
+ # Baseline implementation for the update_fulfillment REST call
83
+ #
84
+ # @param request_pb [::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest]
85
+ # A request object representing the call parameters. Required.
86
+ # @param options [::Gapic::CallOptions]
87
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
88
+ #
89
+ # @yield [result, operation] Access the result along with the TransportOperation object
90
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Fulfillment]
91
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
92
+ #
93
+ # @return [::Google::Cloud::Dialogflow::V2::Fulfillment]
94
+ # A result object deserialized from the server's reply
95
+ def update_fulfillment request_pb, options = nil
96
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
97
+
98
+ verb, uri, query_string_params, body = ServiceStub.transcode_update_fulfillment_request request_pb
99
+ query_string_params = if query_string_params.any?
100
+ query_string_params.to_h { |p| p.split("=", 2) }
101
+ else
102
+ {}
103
+ end
104
+
105
+ response = @client_stub.make_http_request(
106
+ verb,
107
+ uri: uri,
108
+ body: body || "",
109
+ params: query_string_params,
110
+ options: options
111
+ )
112
+ operation = ::Gapic::Rest::TransportOperation.new response
113
+ result = ::Google::Cloud::Dialogflow::V2::Fulfillment.decode_json response.body, ignore_unknown_fields: true
114
+
115
+ yield result, operation if block_given?
116
+ result
117
+ end
118
+
119
+ ##
120
+ # @private
121
+ #
122
+ # GRPC transcoding helper method for the get_fulfillment REST call
123
+ #
124
+ # @param request_pb [::Google::Cloud::Dialogflow::V2::GetFulfillmentRequest]
125
+ # A request object representing the call parameters. Required.
126
+ # @return [Array(String, [String, nil], Hash{String => String})]
127
+ # Uri, Body, Query string parameters
128
+ def self.transcode_get_fulfillment_request request_pb
129
+ transcoder = Gapic::Rest::GrpcTranscoder.new
130
+ .with_bindings(
131
+ uri_method: :get,
132
+ uri_template: "/v2/{name}",
133
+ matches: [
134
+ ["name", %r{^projects/[^/]+/agent/fulfillment/?$}, false]
135
+ ]
136
+ )
137
+ .with_bindings(
138
+ uri_method: :get,
139
+ uri_template: "/v2/{name}",
140
+ matches: [
141
+ ["name", %r{^projects/[^/]+/locations/[^/]+/agent/fulfillment/?$}, false]
142
+ ]
143
+ )
144
+ transcoder.transcode request_pb
145
+ end
146
+
147
+ ##
148
+ # @private
149
+ #
150
+ # GRPC transcoding helper method for the update_fulfillment REST call
151
+ #
152
+ # @param request_pb [::Google::Cloud::Dialogflow::V2::UpdateFulfillmentRequest]
153
+ # A request object representing the call parameters. Required.
154
+ # @return [Array(String, [String, nil], Hash{String => String})]
155
+ # Uri, Body, Query string parameters
156
+ def self.transcode_update_fulfillment_request request_pb
157
+ transcoder = Gapic::Rest::GrpcTranscoder.new
158
+ .with_bindings(
159
+ uri_method: :patch,
160
+ uri_template: "/v2/{fulfillment.name}",
161
+ body: "fulfillment",
162
+ matches: [
163
+ ["fulfillment.name", %r{^projects/[^/]+/agent/fulfillment/?$}, false]
164
+ ]
165
+ )
166
+ .with_bindings(
167
+ uri_method: :patch,
168
+ uri_template: "/v2/{fulfillment.name}",
169
+ body: "fulfillment",
170
+ matches: [
171
+ ["fulfillment.name", %r{^projects/[^/]+/locations/[^/]+/agent/fulfillment/?$}, false]
172
+ ]
173
+ )
174
+ transcoder.transcode request_pb
175
+ end
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -0,0 +1,53 @@
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/fulfillments/credentials"
27
+ require "google/cloud/dialogflow/v2/fulfillments/paths"
28
+ require "google/cloud/dialogflow/v2/fulfillments/rest/client"
29
+
30
+ module Google
31
+ module Cloud
32
+ module Dialogflow
33
+ module V2
34
+ ##
35
+ # Service for managing {::Google::Cloud::Dialogflow::V2::Fulfillment Fulfillments}.
36
+ #
37
+ # To load this service and instantiate a REST client:
38
+ #
39
+ # require "google/cloud/dialogflow/v2/fulfillments/rest"
40
+ # client = ::Google::Cloud::Dialogflow::V2::Fulfillments::Rest::Client.new
41
+ #
42
+ module Fulfillments
43
+ # Client for the REST transport
44
+ module Rest
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
52
+ helper_path = ::File.join __dir__, "rest", "helpers.rb"
53
+ require "google/cloud/dialogflow/v2/fulfillments/rest/helpers" if ::File.file? helper_path