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,1013 @@
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/document_pb"
21
+ require "google/cloud/dialogflow/v2/documents/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module Dialogflow
27
+ module V2
28
+ module Documents
29
+ module Rest
30
+ ##
31
+ # REST client for the Documents service.
32
+ #
33
+ # Service for managing knowledge
34
+ # {::Google::Cloud::Dialogflow::V2::Document Documents}.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :documents_stub
41
+
42
+ ##
43
+ # Configure the Documents Client class.
44
+ #
45
+ # See {::Google::Cloud::Dialogflow::V2::Documents::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all Documents clients
51
+ # ::Google::Cloud::Dialogflow::V2::Documents::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 Documents 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::Documents::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 Documents REST client object.
104
+ #
105
+ # @example
106
+ #
107
+ # # Create a client using the default configuration
108
+ # client = ::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new
109
+ #
110
+ # # Create a client using a custom configuration
111
+ # client = ::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new do |config|
112
+ # config.timeout = 10.0
113
+ # end
114
+ #
115
+ # @yield [config] Configure the Documents 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
+ @operations_client = ::Google::Cloud::Dialogflow::V2::Documents::Rest::Operations.new do |config|
141
+ config.credentials = credentials
142
+ config.quota_project = @quota_project_id
143
+ config.endpoint = @config.endpoint
144
+ end
145
+
146
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
147
+ config.credentials = credentials
148
+ config.quota_project = @quota_project_id
149
+ config.endpoint = @config.endpoint
150
+ config.bindings_override = @config.bindings_override
151
+ end
152
+
153
+ @documents_stub = ::Google::Cloud::Dialogflow::V2::Documents::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
154
+ end
155
+
156
+ ##
157
+ # Get the associated client for long-running operations.
158
+ #
159
+ # @return [::Google::Cloud::Dialogflow::V2::Documents::Rest::Operations]
160
+ #
161
+ attr_reader :operations_client
162
+
163
+ ##
164
+ # Get the associated client for mix-in of the Locations.
165
+ #
166
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
167
+ #
168
+ attr_reader :location_client
169
+
170
+ # Service calls
171
+
172
+ ##
173
+ # Returns the list of all documents of the knowledge base.
174
+ #
175
+ # @overload list_documents(request, options = nil)
176
+ # Pass arguments to `list_documents` via a request object, either of type
177
+ # {::Google::Cloud::Dialogflow::V2::ListDocumentsRequest} or an equivalent Hash.
178
+ #
179
+ # @param request [::Google::Cloud::Dialogflow::V2::ListDocumentsRequest, ::Hash]
180
+ # A request object representing the call parameters. Required. To specify no
181
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
182
+ # @param options [::Gapic::CallOptions, ::Hash]
183
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
184
+ #
185
+ # @overload list_documents(parent: nil, page_size: nil, page_token: nil, filter: nil)
186
+ # Pass arguments to `list_documents` via keyword arguments. Note that at
187
+ # least one keyword argument is required. To specify no parameters, or to keep all
188
+ # the default parameter values, pass an empty Hash as a request object (see above).
189
+ #
190
+ # @param parent [::String]
191
+ # Required. The knowledge base to list all documents for.
192
+ # Format: `projects/<Project ID>/locations/<Location
193
+ # ID>/knowledgeBases/<Knowledge Base ID>`.
194
+ # @param page_size [::Integer]
195
+ # The maximum number of items to return in a single page. By
196
+ # default 10 and at most 100.
197
+ # @param page_token [::String]
198
+ # The next_page_token value returned from a previous list request.
199
+ # @param filter [::String]
200
+ # The filter expression used to filter documents returned by the list method.
201
+ # The expression has the following syntax:
202
+ #
203
+ # <field> <operator> <value> [AND <field> <operator> <value>] ...
204
+ #
205
+ # The following fields and operators are supported:
206
+ #
207
+ # * knowledge_types with has(:) operator
208
+ # * display_name with has(:) operator
209
+ # * state with equals(=) operator
210
+ #
211
+ # Examples:
212
+ #
213
+ # * "knowledge_types:FAQ" matches documents with FAQ knowledge type.
214
+ # * "display_name:customer" matches documents whose display name contains
215
+ # "customer".
216
+ # * "state=ACTIVE" matches documents with ACTIVE state.
217
+ # * "knowledge_types:FAQ AND state=ACTIVE" matches all active FAQ documents.
218
+ #
219
+ # For more information about filtering, see
220
+ # [API Filtering](https://aip.dev/160).
221
+ # @yield [result, operation] Access the result along with the TransportOperation object
222
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>]
223
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
224
+ #
225
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::Dialogflow::V2::Document>]
226
+ #
227
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
228
+ def list_documents request, options = nil
229
+ raise ::ArgumentError, "request must be provided" if request.nil?
230
+
231
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ListDocumentsRequest
232
+
233
+ # Converts hash and nil to an options object
234
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
235
+
236
+ # Customize the options with defaults
237
+ call_metadata = @config.rpcs.list_documents.metadata.to_h
238
+
239
+ # Set x-goog-api-client and x-goog-user-project headers
240
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
241
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
242
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
243
+ transports_version_send: [:rest]
244
+
245
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
246
+
247
+ options.apply_defaults timeout: @config.rpcs.list_documents.timeout,
248
+ metadata: call_metadata,
249
+ retry_policy: @config.rpcs.list_documents.retry_policy
250
+
251
+ options.apply_defaults timeout: @config.timeout,
252
+ metadata: @config.metadata,
253
+ retry_policy: @config.retry_policy
254
+
255
+ @documents_stub.list_documents request, options do |result, operation|
256
+ result = ::Gapic::Rest::PagedEnumerable.new @documents_stub, :list_documents, "documents", request, result, options
257
+ yield result, operation if block_given?
258
+ return result
259
+ end
260
+ rescue ::Gapic::Rest::Error => e
261
+ raise ::Google::Cloud::Error.from_error(e)
262
+ end
263
+
264
+ ##
265
+ # Retrieves the specified document.
266
+ #
267
+ # @overload get_document(request, options = nil)
268
+ # Pass arguments to `get_document` via a request object, either of type
269
+ # {::Google::Cloud::Dialogflow::V2::GetDocumentRequest} or an equivalent Hash.
270
+ #
271
+ # @param request [::Google::Cloud::Dialogflow::V2::GetDocumentRequest, ::Hash]
272
+ # A request object representing the call parameters. Required. To specify no
273
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
274
+ # @param options [::Gapic::CallOptions, ::Hash]
275
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
276
+ #
277
+ # @overload get_document(name: nil)
278
+ # Pass arguments to `get_document` via keyword arguments. Note that at
279
+ # least one keyword argument is required. To specify no parameters, or to keep all
280
+ # the default parameter values, pass an empty Hash as a request object (see above).
281
+ #
282
+ # @param name [::String]
283
+ # Required. The name of the document to retrieve.
284
+ # Format `projects/<Project ID>/locations/<Location
285
+ # ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
286
+ # @yield [result, operation] Access the result along with the TransportOperation object
287
+ # @yieldparam result [::Google::Cloud::Dialogflow::V2::Document]
288
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
289
+ #
290
+ # @return [::Google::Cloud::Dialogflow::V2::Document]
291
+ #
292
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
293
+ def get_document request, options = nil
294
+ raise ::ArgumentError, "request must be provided" if request.nil?
295
+
296
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::GetDocumentRequest
297
+
298
+ # Converts hash and nil to an options object
299
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
300
+
301
+ # Customize the options with defaults
302
+ call_metadata = @config.rpcs.get_document.metadata.to_h
303
+
304
+ # Set x-goog-api-client and x-goog-user-project headers
305
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
306
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
307
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
308
+ transports_version_send: [:rest]
309
+
310
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
311
+
312
+ options.apply_defaults timeout: @config.rpcs.get_document.timeout,
313
+ metadata: call_metadata,
314
+ retry_policy: @config.rpcs.get_document.retry_policy
315
+
316
+ options.apply_defaults timeout: @config.timeout,
317
+ metadata: @config.metadata,
318
+ retry_policy: @config.retry_policy
319
+
320
+ @documents_stub.get_document request, options do |result, operation|
321
+ yield result, operation if block_given?
322
+ return result
323
+ end
324
+ rescue ::Gapic::Rest::Error => e
325
+ raise ::Google::Cloud::Error.from_error(e)
326
+ end
327
+
328
+ ##
329
+ # Creates a new document.
330
+ #
331
+ # This method is a [long-running
332
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
333
+ # The returned `Operation` type has the following method-specific fields:
334
+ #
335
+ # - `metadata`:
336
+ # {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
337
+ # - `response`: {::Google::Cloud::Dialogflow::V2::Document Document}
338
+ #
339
+ # @overload create_document(request, options = nil)
340
+ # Pass arguments to `create_document` via a request object, either of type
341
+ # {::Google::Cloud::Dialogflow::V2::CreateDocumentRequest} or an equivalent Hash.
342
+ #
343
+ # @param request [::Google::Cloud::Dialogflow::V2::CreateDocumentRequest, ::Hash]
344
+ # A request object representing the call parameters. Required. To specify no
345
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
346
+ # @param options [::Gapic::CallOptions, ::Hash]
347
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
348
+ #
349
+ # @overload create_document(parent: nil, document: nil)
350
+ # Pass arguments to `create_document` via keyword arguments. Note that at
351
+ # least one keyword argument is required. To specify no parameters, or to keep all
352
+ # the default parameter values, pass an empty Hash as a request object (see above).
353
+ #
354
+ # @param parent [::String]
355
+ # Required. The knowledge base to create a document for.
356
+ # Format: `projects/<Project ID>/locations/<Location
357
+ # ID>/knowledgeBases/<Knowledge Base ID>`.
358
+ # @param document [::Google::Cloud::Dialogflow::V2::Document, ::Hash]
359
+ # Required. The document to create.
360
+ # @yield [result, operation] Access the result along with the TransportOperation object
361
+ # @yieldparam result [::Gapic::Operation]
362
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
363
+ #
364
+ # @return [::Gapic::Operation]
365
+ #
366
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
367
+ def create_document request, options = nil
368
+ raise ::ArgumentError, "request must be provided" if request.nil?
369
+
370
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::CreateDocumentRequest
371
+
372
+ # Converts hash and nil to an options object
373
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
374
+
375
+ # Customize the options with defaults
376
+ call_metadata = @config.rpcs.create_document.metadata.to_h
377
+
378
+ # Set x-goog-api-client and x-goog-user-project headers
379
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
380
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
381
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
382
+ transports_version_send: [:rest]
383
+
384
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
385
+
386
+ options.apply_defaults timeout: @config.rpcs.create_document.timeout,
387
+ metadata: call_metadata,
388
+ retry_policy: @config.rpcs.create_document.retry_policy
389
+
390
+ options.apply_defaults timeout: @config.timeout,
391
+ metadata: @config.metadata,
392
+ retry_policy: @config.retry_policy
393
+
394
+ @documents_stub.create_document request, options do |result, operation|
395
+ result = ::Gapic::Operation.new result, @operations_client, options: options
396
+ yield result, operation if block_given?
397
+ return result
398
+ end
399
+ rescue ::Gapic::Rest::Error => e
400
+ raise ::Google::Cloud::Error.from_error(e)
401
+ end
402
+
403
+ ##
404
+ # Creates documents by importing data from external sources.
405
+ # Dialogflow supports up to 350 documents in each request. If you try to
406
+ # import more, Dialogflow will return an error.
407
+ #
408
+ # This method is a [long-running
409
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
410
+ # The returned `Operation` type has the following method-specific fields:
411
+ #
412
+ # - `metadata`:
413
+ # {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
414
+ # - `response`:
415
+ # {::Google::Cloud::Dialogflow::V2::ImportDocumentsResponse ImportDocumentsResponse}
416
+ #
417
+ # @overload import_documents(request, options = nil)
418
+ # Pass arguments to `import_documents` via a request object, either of type
419
+ # {::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest} or an equivalent Hash.
420
+ #
421
+ # @param request [::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest, ::Hash]
422
+ # A request object representing the call parameters. Required. To specify no
423
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
424
+ # @param options [::Gapic::CallOptions, ::Hash]
425
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
426
+ #
427
+ # @overload import_documents(parent: nil, gcs_source: nil, document_template: nil, import_gcs_custom_metadata: nil)
428
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
429
+ # least one keyword argument is required. To specify no parameters, or to keep all
430
+ # the default parameter values, pass an empty Hash as a request object (see above).
431
+ #
432
+ # @param parent [::String]
433
+ # Required. The knowledge base to import documents into.
434
+ # Format: `projects/<Project ID>/locations/<Location
435
+ # ID>/knowledgeBases/<Knowledge Base ID>`.
436
+ # @param gcs_source [::Google::Cloud::Dialogflow::V2::GcsSources, ::Hash]
437
+ # The Google Cloud Storage location for the documents.
438
+ # The path can include a wildcard.
439
+ #
440
+ # These URIs may have the forms
441
+ # `gs://<bucket-name>/<object-name>`.
442
+ # `gs://<bucket-name>/<object-path>/*.<extension>`.
443
+ # @param document_template [::Google::Cloud::Dialogflow::V2::ImportDocumentTemplate, ::Hash]
444
+ # Required. Document template used for importing all the documents.
445
+ # @param import_gcs_custom_metadata [::Boolean]
446
+ # Whether to import custom metadata from Google Cloud Storage.
447
+ # Only valid when the document source is Google Cloud Storage URI.
448
+ # @yield [result, operation] Access the result along with the TransportOperation object
449
+ # @yieldparam result [::Gapic::Operation]
450
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
451
+ #
452
+ # @return [::Gapic::Operation]
453
+ #
454
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
455
+ def import_documents request, options = nil
456
+ raise ::ArgumentError, "request must be provided" if request.nil?
457
+
458
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ImportDocumentsRequest
459
+
460
+ # Converts hash and nil to an options object
461
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
462
+
463
+ # Customize the options with defaults
464
+ call_metadata = @config.rpcs.import_documents.metadata.to_h
465
+
466
+ # Set x-goog-api-client and x-goog-user-project headers
467
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
468
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
469
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
470
+ transports_version_send: [:rest]
471
+
472
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
473
+
474
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
475
+ metadata: call_metadata,
476
+ retry_policy: @config.rpcs.import_documents.retry_policy
477
+
478
+ options.apply_defaults timeout: @config.timeout,
479
+ metadata: @config.metadata,
480
+ retry_policy: @config.retry_policy
481
+
482
+ @documents_stub.import_documents request, options do |result, operation|
483
+ result = ::Gapic::Operation.new result, @operations_client, options: options
484
+ yield result, operation if block_given?
485
+ return result
486
+ end
487
+ rescue ::Gapic::Rest::Error => e
488
+ raise ::Google::Cloud::Error.from_error(e)
489
+ end
490
+
491
+ ##
492
+ # Deletes the specified document.
493
+ #
494
+ # This method is a [long-running
495
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
496
+ # The returned `Operation` type has the following method-specific fields:
497
+ #
498
+ # - `metadata`:
499
+ # {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
500
+ # - `response`: An [Empty
501
+ # message](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#empty)
502
+ #
503
+ # @overload delete_document(request, options = nil)
504
+ # Pass arguments to `delete_document` via a request object, either of type
505
+ # {::Google::Cloud::Dialogflow::V2::DeleteDocumentRequest} or an equivalent Hash.
506
+ #
507
+ # @param request [::Google::Cloud::Dialogflow::V2::DeleteDocumentRequest, ::Hash]
508
+ # A request object representing the call parameters. Required. To specify no
509
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
510
+ # @param options [::Gapic::CallOptions, ::Hash]
511
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
512
+ #
513
+ # @overload delete_document(name: nil)
514
+ # Pass arguments to `delete_document` via keyword arguments. Note that at
515
+ # least one keyword argument is required. To specify no parameters, or to keep all
516
+ # the default parameter values, pass an empty Hash as a request object (see above).
517
+ #
518
+ # @param name [::String]
519
+ # Required. The name of the document to delete.
520
+ # Format: `projects/<Project ID>/locations/<Location
521
+ # ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
522
+ # @yield [result, operation] Access the result along with the TransportOperation object
523
+ # @yieldparam result [::Gapic::Operation]
524
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
525
+ #
526
+ # @return [::Gapic::Operation]
527
+ #
528
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
529
+ def delete_document request, options = nil
530
+ raise ::ArgumentError, "request must be provided" if request.nil?
531
+
532
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::DeleteDocumentRequest
533
+
534
+ # Converts hash and nil to an options object
535
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
536
+
537
+ # Customize the options with defaults
538
+ call_metadata = @config.rpcs.delete_document.metadata.to_h
539
+
540
+ # Set x-goog-api-client and x-goog-user-project headers
541
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
542
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
543
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
544
+ transports_version_send: [:rest]
545
+
546
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
547
+
548
+ options.apply_defaults timeout: @config.rpcs.delete_document.timeout,
549
+ metadata: call_metadata,
550
+ retry_policy: @config.rpcs.delete_document.retry_policy
551
+
552
+ options.apply_defaults timeout: @config.timeout,
553
+ metadata: @config.metadata,
554
+ retry_policy: @config.retry_policy
555
+
556
+ @documents_stub.delete_document request, options do |result, operation|
557
+ result = ::Gapic::Operation.new result, @operations_client, options: options
558
+ yield result, operation if block_given?
559
+ return result
560
+ end
561
+ rescue ::Gapic::Rest::Error => e
562
+ raise ::Google::Cloud::Error.from_error(e)
563
+ end
564
+
565
+ ##
566
+ # Updates the specified document.
567
+ #
568
+ # This method is a [long-running
569
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
570
+ # The returned `Operation` type has the following method-specific fields:
571
+ #
572
+ # - `metadata`:
573
+ # {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
574
+ # - `response`: {::Google::Cloud::Dialogflow::V2::Document Document}
575
+ #
576
+ # @overload update_document(request, options = nil)
577
+ # Pass arguments to `update_document` via a request object, either of type
578
+ # {::Google::Cloud::Dialogflow::V2::UpdateDocumentRequest} or an equivalent Hash.
579
+ #
580
+ # @param request [::Google::Cloud::Dialogflow::V2::UpdateDocumentRequest, ::Hash]
581
+ # A request object representing the call parameters. Required. To specify no
582
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
583
+ # @param options [::Gapic::CallOptions, ::Hash]
584
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
585
+ #
586
+ # @overload update_document(document: nil, update_mask: nil)
587
+ # Pass arguments to `update_document` via keyword arguments. Note that at
588
+ # least one keyword argument is required. To specify no parameters, or to keep all
589
+ # the default parameter values, pass an empty Hash as a request object (see above).
590
+ #
591
+ # @param document [::Google::Cloud::Dialogflow::V2::Document, ::Hash]
592
+ # Required. The document to update.
593
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
594
+ # Optional. Not specified means `update all`.
595
+ # Currently, only `display_name` can be updated, an InvalidArgument will be
596
+ # returned for attempting to update other fields.
597
+ # @yield [result, operation] Access the result along with the TransportOperation object
598
+ # @yieldparam result [::Gapic::Operation]
599
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
600
+ #
601
+ # @return [::Gapic::Operation]
602
+ #
603
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
604
+ def update_document request, options = nil
605
+ raise ::ArgumentError, "request must be provided" if request.nil?
606
+
607
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::UpdateDocumentRequest
608
+
609
+ # Converts hash and nil to an options object
610
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
611
+
612
+ # Customize the options with defaults
613
+ call_metadata = @config.rpcs.update_document.metadata.to_h
614
+
615
+ # Set x-goog-api-client and x-goog-user-project headers
616
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
617
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
618
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
619
+ transports_version_send: [:rest]
620
+
621
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
622
+
623
+ options.apply_defaults timeout: @config.rpcs.update_document.timeout,
624
+ metadata: call_metadata,
625
+ retry_policy: @config.rpcs.update_document.retry_policy
626
+
627
+ options.apply_defaults timeout: @config.timeout,
628
+ metadata: @config.metadata,
629
+ retry_policy: @config.retry_policy
630
+
631
+ @documents_stub.update_document request, options do |result, operation|
632
+ result = ::Gapic::Operation.new result, @operations_client, options: options
633
+ yield result, operation if block_given?
634
+ return result
635
+ end
636
+ rescue ::Gapic::Rest::Error => e
637
+ raise ::Google::Cloud::Error.from_error(e)
638
+ end
639
+
640
+ ##
641
+ # Reloads the specified document from its specified source, content_uri or
642
+ # content. The previously loaded content of the document will be deleted.
643
+ # Note: Even when the content of the document has not changed, there still
644
+ # may be side effects because of internal implementation changes.
645
+ #
646
+ # This method is a [long-running
647
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
648
+ # The returned `Operation` type has the following method-specific fields:
649
+ #
650
+ # - `metadata`:
651
+ # {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
652
+ # - `response`: {::Google::Cloud::Dialogflow::V2::Document Document}
653
+ #
654
+ # Note: The `projects.agent.knowledgeBases.documents` resource is deprecated;
655
+ # only use `projects.knowledgeBases.documents`.
656
+ #
657
+ # @overload reload_document(request, options = nil)
658
+ # Pass arguments to `reload_document` via a request object, either of type
659
+ # {::Google::Cloud::Dialogflow::V2::ReloadDocumentRequest} or an equivalent Hash.
660
+ #
661
+ # @param request [::Google::Cloud::Dialogflow::V2::ReloadDocumentRequest, ::Hash]
662
+ # A request object representing the call parameters. Required. To specify no
663
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
664
+ # @param options [::Gapic::CallOptions, ::Hash]
665
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
666
+ #
667
+ # @overload reload_document(name: nil, content_uri: nil, import_gcs_custom_metadata: nil, smart_messaging_partial_update: nil)
668
+ # Pass arguments to `reload_document` via keyword arguments. Note that at
669
+ # least one keyword argument is required. To specify no parameters, or to keep all
670
+ # the default parameter values, pass an empty Hash as a request object (see above).
671
+ #
672
+ # @param name [::String]
673
+ # Required. The name of the document to reload.
674
+ # Format: `projects/<Project ID>/locations/<Location
675
+ # ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`
676
+ # @param content_uri [::String]
677
+ # Optional. The path of gcs source file for reloading document content. For
678
+ # now, only gcs uri is supported.
679
+ #
680
+ # For documents stored in Google Cloud Storage, these URIs must have
681
+ # the form `gs://<bucket-name>/<object-name>`.
682
+ # @param import_gcs_custom_metadata [::Boolean]
683
+ # Optional. Whether to import custom metadata from Google Cloud Storage.
684
+ # Only valid when the document source is Google Cloud Storage URI.
685
+ # @param smart_messaging_partial_update [::Boolean]
686
+ # Optional. When enabled, the reload request is to apply partial update to
687
+ # the smart messaging allowlist.
688
+ # @yield [result, operation] Access the result along with the TransportOperation object
689
+ # @yieldparam result [::Gapic::Operation]
690
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
691
+ #
692
+ # @return [::Gapic::Operation]
693
+ #
694
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
695
+ def reload_document request, options = nil
696
+ raise ::ArgumentError, "request must be provided" if request.nil?
697
+
698
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ReloadDocumentRequest
699
+
700
+ # Converts hash and nil to an options object
701
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
702
+
703
+ # Customize the options with defaults
704
+ call_metadata = @config.rpcs.reload_document.metadata.to_h
705
+
706
+ # Set x-goog-api-client and x-goog-user-project headers
707
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
708
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
709
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
710
+ transports_version_send: [:rest]
711
+
712
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
713
+
714
+ options.apply_defaults timeout: @config.rpcs.reload_document.timeout,
715
+ metadata: call_metadata,
716
+ retry_policy: @config.rpcs.reload_document.retry_policy
717
+
718
+ options.apply_defaults timeout: @config.timeout,
719
+ metadata: @config.metadata,
720
+ retry_policy: @config.retry_policy
721
+
722
+ @documents_stub.reload_document request, options do |result, operation|
723
+ result = ::Gapic::Operation.new result, @operations_client, options: options
724
+ yield result, operation if block_given?
725
+ return result
726
+ end
727
+ rescue ::Gapic::Rest::Error => e
728
+ raise ::Google::Cloud::Error.from_error(e)
729
+ end
730
+
731
+ ##
732
+ # Exports a smart messaging candidate document into the specified
733
+ # destination.
734
+ #
735
+ # This method is a [long-running
736
+ # operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation).
737
+ # The returned `Operation` type has the following method-specific fields:
738
+ #
739
+ # - `metadata`:
740
+ # {::Google::Cloud::Dialogflow::V2::KnowledgeOperationMetadata KnowledgeOperationMetadata}
741
+ # - `response`: {::Google::Cloud::Dialogflow::V2::Document Document}
742
+ #
743
+ # @overload export_document(request, options = nil)
744
+ # Pass arguments to `export_document` via a request object, either of type
745
+ # {::Google::Cloud::Dialogflow::V2::ExportDocumentRequest} or an equivalent Hash.
746
+ #
747
+ # @param request [::Google::Cloud::Dialogflow::V2::ExportDocumentRequest, ::Hash]
748
+ # A request object representing the call parameters. Required. To specify no
749
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
750
+ # @param options [::Gapic::CallOptions, ::Hash]
751
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
752
+ #
753
+ # @overload export_document(name: nil, gcs_destination: nil, export_full_content: nil, smart_messaging_partial_update: nil)
754
+ # Pass arguments to `export_document` via keyword arguments. Note that at
755
+ # least one keyword argument is required. To specify no parameters, or to keep all
756
+ # the default parameter values, pass an empty Hash as a request object (see above).
757
+ #
758
+ # @param name [::String]
759
+ # Required. The name of the document to export.
760
+ # Format: `projects/<Project ID>/locations/<Location
761
+ # ID>/knowledgeBases/<Knowledge Base ID>/documents/<Document ID>`.
762
+ # @param gcs_destination [::Google::Cloud::Dialogflow::V2::GcsDestination, ::Hash]
763
+ # Cloud Storage file path to export the document.
764
+ # @param export_full_content [::Boolean]
765
+ # When enabled, export the full content of the document including empirical
766
+ # probability.
767
+ # @param smart_messaging_partial_update [::Boolean]
768
+ # When enabled, export the smart messaging allowlist document for partial
769
+ # update.
770
+ # @yield [result, operation] Access the result along with the TransportOperation object
771
+ # @yieldparam result [::Gapic::Operation]
772
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
773
+ #
774
+ # @return [::Gapic::Operation]
775
+ #
776
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
777
+ def export_document request, options = nil
778
+ raise ::ArgumentError, "request must be provided" if request.nil?
779
+
780
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Dialogflow::V2::ExportDocumentRequest
781
+
782
+ # Converts hash and nil to an options object
783
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
784
+
785
+ # Customize the options with defaults
786
+ call_metadata = @config.rpcs.export_document.metadata.to_h
787
+
788
+ # Set x-goog-api-client and x-goog-user-project headers
789
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
790
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
791
+ gapic_version: ::Google::Cloud::Dialogflow::V2::VERSION,
792
+ transports_version_send: [:rest]
793
+
794
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
795
+
796
+ options.apply_defaults timeout: @config.rpcs.export_document.timeout,
797
+ metadata: call_metadata,
798
+ retry_policy: @config.rpcs.export_document.retry_policy
799
+
800
+ options.apply_defaults timeout: @config.timeout,
801
+ metadata: @config.metadata,
802
+ retry_policy: @config.retry_policy
803
+
804
+ @documents_stub.export_document request, options do |result, operation|
805
+ result = ::Gapic::Operation.new result, @operations_client, options: options
806
+ yield result, operation if block_given?
807
+ return result
808
+ end
809
+ rescue ::Gapic::Rest::Error => e
810
+ raise ::Google::Cloud::Error.from_error(e)
811
+ end
812
+
813
+ ##
814
+ # Configuration class for the Documents REST API.
815
+ #
816
+ # This class represents the configuration for Documents REST,
817
+ # providing control over timeouts, retry behavior, logging, transport
818
+ # parameters, and other low-level controls. Certain parameters can also be
819
+ # applied individually to specific RPCs. See
820
+ # {::Google::Cloud::Dialogflow::V2::Documents::Rest::Client::Configuration::Rpcs}
821
+ # for a list of RPCs that can be configured independently.
822
+ #
823
+ # Configuration can be applied globally to all clients, or to a single client
824
+ # on construction.
825
+ #
826
+ # @example
827
+ #
828
+ # # Modify the global config, setting the timeout for
829
+ # # list_documents to 20 seconds,
830
+ # # and all remaining timeouts to 10 seconds.
831
+ # ::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.configure do |config|
832
+ # config.timeout = 10.0
833
+ # config.rpcs.list_documents.timeout = 20.0
834
+ # end
835
+ #
836
+ # # Apply the above configuration only to a new client.
837
+ # client = ::Google::Cloud::Dialogflow::V2::Documents::Rest::Client.new do |config|
838
+ # config.timeout = 10.0
839
+ # config.rpcs.list_documents.timeout = 20.0
840
+ # end
841
+ #
842
+ # @!attribute [rw] endpoint
843
+ # The hostname or hostname:port of the service endpoint.
844
+ # Defaults to `"dialogflow.googleapis.com"`.
845
+ # @return [::String]
846
+ # @!attribute [rw] credentials
847
+ # Credentials to send with calls. You may provide any of the following types:
848
+ # * (`String`) The path to a service account key file in JSON format
849
+ # * (`Hash`) A service account key as a Hash
850
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
851
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
852
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
853
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
854
+ # * (`nil`) indicating no credentials
855
+ # @return [::Object]
856
+ # @!attribute [rw] scope
857
+ # The OAuth scopes
858
+ # @return [::Array<::String>]
859
+ # @!attribute [rw] lib_name
860
+ # The library name as recorded in instrumentation and logging
861
+ # @return [::String]
862
+ # @!attribute [rw] lib_version
863
+ # The library version as recorded in instrumentation and logging
864
+ # @return [::String]
865
+ # @!attribute [rw] timeout
866
+ # The call timeout in seconds.
867
+ # @return [::Numeric]
868
+ # @!attribute [rw] metadata
869
+ # Additional headers to be sent with the call.
870
+ # @return [::Hash{::Symbol=>::String}]
871
+ # @!attribute [rw] retry_policy
872
+ # The retry policy. The value is a hash with the following keys:
873
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
874
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
875
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
876
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
877
+ # trigger a retry.
878
+ # @return [::Hash]
879
+ # @!attribute [rw] quota_project
880
+ # A separate project against which to charge quota.
881
+ # @return [::String]
882
+ #
883
+ class Configuration
884
+ extend ::Gapic::Config
885
+
886
+ config_attr :endpoint, "dialogflow.googleapis.com", ::String
887
+ config_attr :credentials, nil do |value|
888
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
889
+ allowed.any? { |klass| klass === value }
890
+ end
891
+ config_attr :scope, nil, ::String, ::Array, nil
892
+ config_attr :lib_name, nil, ::String, nil
893
+ config_attr :lib_version, nil, ::String, nil
894
+ config_attr :timeout, nil, ::Numeric, nil
895
+ config_attr :metadata, nil, ::Hash, nil
896
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
897
+ config_attr :quota_project, nil, ::String, nil
898
+
899
+ # @private
900
+ # Overrides for http bindings for the RPCs of this service
901
+ # are only used when this service is used as mixin, and only
902
+ # by the host service.
903
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
904
+ config_attr :bindings_override, {}, ::Hash, nil
905
+
906
+ # @private
907
+ def initialize parent_config = nil
908
+ @parent_config = parent_config unless parent_config.nil?
909
+
910
+ yield self if block_given?
911
+ end
912
+
913
+ ##
914
+ # Configurations for individual RPCs
915
+ # @return [Rpcs]
916
+ #
917
+ def rpcs
918
+ @rpcs ||= begin
919
+ parent_rpcs = nil
920
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
921
+ Rpcs.new parent_rpcs
922
+ end
923
+ end
924
+
925
+ ##
926
+ # Configuration RPC class for the Documents API.
927
+ #
928
+ # Includes fields providing the configuration for each RPC in this service.
929
+ # Each configuration object is of type `Gapic::Config::Method` and includes
930
+ # the following configuration fields:
931
+ #
932
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
933
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
934
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
935
+ # include the following keys:
936
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
937
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
938
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
939
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
940
+ # trigger a retry.
941
+ #
942
+ class Rpcs
943
+ ##
944
+ # RPC-specific configuration for `list_documents`
945
+ # @return [::Gapic::Config::Method]
946
+ #
947
+ attr_reader :list_documents
948
+ ##
949
+ # RPC-specific configuration for `get_document`
950
+ # @return [::Gapic::Config::Method]
951
+ #
952
+ attr_reader :get_document
953
+ ##
954
+ # RPC-specific configuration for `create_document`
955
+ # @return [::Gapic::Config::Method]
956
+ #
957
+ attr_reader :create_document
958
+ ##
959
+ # RPC-specific configuration for `import_documents`
960
+ # @return [::Gapic::Config::Method]
961
+ #
962
+ attr_reader :import_documents
963
+ ##
964
+ # RPC-specific configuration for `delete_document`
965
+ # @return [::Gapic::Config::Method]
966
+ #
967
+ attr_reader :delete_document
968
+ ##
969
+ # RPC-specific configuration for `update_document`
970
+ # @return [::Gapic::Config::Method]
971
+ #
972
+ attr_reader :update_document
973
+ ##
974
+ # RPC-specific configuration for `reload_document`
975
+ # @return [::Gapic::Config::Method]
976
+ #
977
+ attr_reader :reload_document
978
+ ##
979
+ # RPC-specific configuration for `export_document`
980
+ # @return [::Gapic::Config::Method]
981
+ #
982
+ attr_reader :export_document
983
+
984
+ # @private
985
+ def initialize parent_rpcs = nil
986
+ list_documents_config = parent_rpcs.list_documents if parent_rpcs.respond_to? :list_documents
987
+ @list_documents = ::Gapic::Config::Method.new list_documents_config
988
+ get_document_config = parent_rpcs.get_document if parent_rpcs.respond_to? :get_document
989
+ @get_document = ::Gapic::Config::Method.new get_document_config
990
+ create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
991
+ @create_document = ::Gapic::Config::Method.new create_document_config
992
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
993
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
994
+ delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
995
+ @delete_document = ::Gapic::Config::Method.new delete_document_config
996
+ update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
997
+ @update_document = ::Gapic::Config::Method.new update_document_config
998
+ reload_document_config = parent_rpcs.reload_document if parent_rpcs.respond_to? :reload_document
999
+ @reload_document = ::Gapic::Config::Method.new reload_document_config
1000
+ export_document_config = parent_rpcs.export_document if parent_rpcs.respond_to? :export_document
1001
+ @export_document = ::Gapic::Config::Method.new export_document_config
1002
+
1003
+ yield self if block_given?
1004
+ end
1005
+ end
1006
+ end
1007
+ end
1008
+ end
1009
+ end
1010
+ end
1011
+ end
1012
+ end
1013
+ end