google-cloud-discovery_engine-v1 0.a → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +451 -0
  6. data/lib/google/cloud/discovery_engine/v1/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +408 -0
  9. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/client.rb +959 -0
  13. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/paths.rb +176 -0
  15. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/client.rb +797 -0
  16. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest/service_stub.rb +450 -0
  17. data/lib/google/cloud/discovery_engine/v1/conversational_search_service/rest.rb +52 -0
  18. data/lib/google/cloud/discovery_engine/v1/conversational_search_service.rb +55 -0
  19. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +1170 -0
  20. data/lib/google/cloud/discovery_engine/v1/document_service/credentials.rb +47 -0
  21. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +770 -0
  22. data/lib/google/cloud/discovery_engine/v1/document_service/paths.rb +135 -0
  23. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +971 -0
  24. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +977 -0
  25. data/lib/google/cloud/discovery_engine/v1/document_service/rest/service_stub.rb +518 -0
  26. data/lib/google/cloud/discovery_engine/v1/document_service/rest.rb +54 -0
  27. data/lib/google/cloud/discovery_engine/v1/document_service.rb +57 -0
  28. data/lib/google/cloud/discovery_engine/v1/rest.rb +42 -0
  29. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +853 -0
  30. data/lib/google/cloud/discovery_engine/v1/schema_service/credentials.rb +47 -0
  31. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +770 -0
  32. data/lib/google/cloud/discovery_engine/v1/schema_service/paths.rb +127 -0
  33. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +693 -0
  34. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +977 -0
  35. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/service_stub.rb +382 -0
  36. data/lib/google/cloud/discovery_engine/v1/schema_service/rest.rb +53 -0
  37. data/lib/google/cloud/discovery_engine/v1/schema_service.rb +56 -0
  38. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +529 -0
  39. data/lib/google/cloud/discovery_engine/v1/search_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1/search_service/paths.rb +131 -0
  41. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +481 -0
  42. data/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb +116 -0
  43. data/lib/google/cloud/discovery_engine/v1/search_service/rest.rb +52 -0
  44. data/lib/google/cloud/discovery_engine/v1/search_service.rb +55 -0
  45. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +654 -0
  46. data/lib/google/cloud/discovery_engine/v1/user_event_service/credentials.rb +47 -0
  47. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +770 -0
  48. data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +131 -0
  49. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +558 -0
  50. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +977 -0
  51. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +250 -0
  52. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest.rb +53 -0
  53. data/lib/google/cloud/discovery_engine/v1/user_event_service.rb +56 -0
  54. data/lib/google/cloud/discovery_engine/v1/version.rb +7 -2
  55. data/lib/google/cloud/discovery_engine/v1.rb +50 -0
  56. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +46 -0
  57. data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +49 -0
  58. data/lib/google/cloud/discoveryengine/v1/completion_service_services_pb.rb +45 -0
  59. data/lib/google/cloud/discoveryengine/v1/conversation_pb.rb +54 -0
  60. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_pb.rb +61 -0
  61. data/lib/google/cloud/discoveryengine/v1/conversational_search_service_services_pb.rb +67 -0
  62. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +48 -0
  63. data/lib/google/cloud/discoveryengine/v1/document_service_pb.rb +58 -0
  64. data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +79 -0
  65. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +66 -0
  66. data/lib/google/cloud/discoveryengine/v1/purge_config_pb.rb +49 -0
  67. data/lib/google/cloud/discoveryengine/v1/schema_pb.rb +47 -0
  68. data/lib/google/cloud/discoveryengine/v1/schema_service_pb.rb +61 -0
  69. data/lib/google/cloud/discoveryengine/v1/schema_service_services_pb.rb +53 -0
  70. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +73 -0
  71. data/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb +45 -0
  72. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +58 -0
  73. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +53 -0
  74. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +59 -0
  75. data/lib/google-cloud-discovery_engine-v1.rb +21 -0
  76. data/proto_docs/README.md +4 -0
  77. data/proto_docs/google/api/client.rb +381 -0
  78. data/proto_docs/google/api/field_behavior.rb +85 -0
  79. data/proto_docs/google/api/httpbody.rb +80 -0
  80. data/proto_docs/google/api/launch_stage.rb +71 -0
  81. data/proto_docs/google/api/resource.rb +222 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +106 -0
  83. data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +111 -0
  84. data/proto_docs/google/cloud/discoveryengine/v1/conversation.rb +113 -0
  85. data/proto_docs/google/cloud/discoveryengine/v1/conversational_search_service.rb +206 -0
  86. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +108 -0
  87. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +181 -0
  88. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +340 -0
  89. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +84 -0
  90. data/proto_docs/google/cloud/discoveryengine/v1/schema.rb +45 -0
  91. data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +177 -0
  92. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +730 -0
  93. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +478 -0
  94. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +64 -0
  95. data/proto_docs/google/longrunning/operations.rb +164 -0
  96. data/proto_docs/google/protobuf/any.rb +144 -0
  97. data/proto_docs/google/protobuf/duration.rb +98 -0
  98. data/proto_docs/google/protobuf/empty.rb +34 -0
  99. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  100. data/proto_docs/google/protobuf/struct.rb +96 -0
  101. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  102. data/proto_docs/google/rpc/status.rb +48 -0
  103. data/proto_docs/google/type/date.rb +53 -0
  104. metadata +277 -13
@@ -0,0 +1,971 @@
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/discoveryengine/v1/document_service_pb"
21
+ require "google/cloud/discovery_engine/v1/document_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DiscoveryEngine
27
+ module V1
28
+ module DocumentService
29
+ module Rest
30
+ ##
31
+ # REST client for the DocumentService service.
32
+ #
33
+ # Service for ingesting {::Google::Cloud::DiscoveryEngine::V1::Document Document}
34
+ # information of the customer's website.
35
+ #
36
+ class Client
37
+ include Paths
38
+
39
+ # @private
40
+ attr_reader :document_service_stub
41
+
42
+ ##
43
+ # Configure the DocumentService Client class.
44
+ #
45
+ # See {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client::Configuration}
46
+ # for a description of the configuration fields.
47
+ #
48
+ # @example
49
+ #
50
+ # # Modify the configuration for all DocumentService clients
51
+ # ::Google::Cloud::DiscoveryEngine::V1::DocumentService::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", "DiscoveryEngine", "V1"]
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 = 30.0
72
+ default_config.retry_policy = {
73
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
74
+ }
75
+
76
+ default_config.rpcs.import_documents.timeout = 300.0
77
+ default_config.rpcs.import_documents.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the DocumentService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # Create a new DocumentService REST client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the DocumentService client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # Create the configuration object
125
+ @config = Configuration.new Client.configure
126
+
127
+ # Yield the configuration if needed
128
+ yield @config if block_given?
129
+
130
+ # Create credentials
131
+ credentials = @config.credentials
132
+ # Use self-signed JWT if the endpoint is unchanged from default,
133
+ # but only if the default endpoint does not have a region prefix.
134
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
135
+ !@config.endpoint.split(".").first.include?("-")
136
+ credentials ||= Credentials.default scope: @config.scope,
137
+ enable_self_signed_jwt: enable_self_signed_jwt
138
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
139
+ credentials = Credentials.new credentials, scope: @config.scope
140
+ end
141
+
142
+ @quota_project_id = @config.quota_project
143
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
144
+
145
+ @operations_client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Operations.new do |config|
146
+ config.credentials = credentials
147
+ config.quota_project = @quota_project_id
148
+ config.endpoint = @config.endpoint
149
+ end
150
+
151
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
152
+ config.credentials = credentials
153
+ config.quota_project = @quota_project_id
154
+ config.endpoint = @config.endpoint
155
+ end
156
+
157
+ @document_service_stub = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
158
+ end
159
+
160
+ ##
161
+ # Get the associated client for long-running operations.
162
+ #
163
+ # @return [::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Operations]
164
+ #
165
+ attr_reader :operations_client
166
+
167
+ ##
168
+ # Get the associated client for mix-in of the Locations.
169
+ #
170
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
171
+ #
172
+ attr_reader :location_client
173
+
174
+ # Service calls
175
+
176
+ ##
177
+ # Gets a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
178
+ #
179
+ # @overload get_document(request, options = nil)
180
+ # Pass arguments to `get_document` via a request object, either of type
181
+ # {::Google::Cloud::DiscoveryEngine::V1::GetDocumentRequest} or an equivalent Hash.
182
+ #
183
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::GetDocumentRequest, ::Hash]
184
+ # A request object representing the call parameters. Required. To specify no
185
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
186
+ # @param options [::Gapic::CallOptions, ::Hash]
187
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
188
+ #
189
+ # @overload get_document(name: nil)
190
+ # Pass arguments to `get_document` via keyword arguments. Note that at
191
+ # least one keyword argument is required. To specify no parameters, or to keep all
192
+ # the default parameter values, pass an empty Hash as a request object (see above).
193
+ #
194
+ # @param name [::String]
195
+ # Required. Full resource name of
196
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, such as
197
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
198
+ #
199
+ # If the caller does not have permission to access the
200
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
201
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
202
+ #
203
+ # If the requested {::Google::Cloud::DiscoveryEngine::V1::Document Document} does
204
+ # not exist, a `NOT_FOUND` error is returned.
205
+ # @yield [result, operation] Access the result along with the TransportOperation object
206
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Document]
207
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
208
+ #
209
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Document]
210
+ #
211
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
212
+ def get_document request, options = nil
213
+ raise ::ArgumentError, "request must be provided" if request.nil?
214
+
215
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::GetDocumentRequest
216
+
217
+ # Converts hash and nil to an options object
218
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
219
+
220
+ # Customize the options with defaults
221
+ call_metadata = @config.rpcs.get_document.metadata.to_h
222
+
223
+ # Set x-goog-api-client and x-goog-user-project headers
224
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
225
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
226
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
227
+ transports_version_send: [:rest]
228
+
229
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
230
+
231
+ options.apply_defaults timeout: @config.rpcs.get_document.timeout,
232
+ metadata: call_metadata,
233
+ retry_policy: @config.rpcs.get_document.retry_policy
234
+
235
+ options.apply_defaults timeout: @config.timeout,
236
+ metadata: @config.metadata,
237
+ retry_policy: @config.retry_policy
238
+
239
+ @document_service_stub.get_document request, options do |result, operation|
240
+ yield result, operation if block_given?
241
+ return result
242
+ end
243
+ rescue ::Gapic::Rest::Error => e
244
+ raise ::Google::Cloud::Error.from_error(e)
245
+ end
246
+
247
+ ##
248
+ # Gets a list of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s.
249
+ #
250
+ # @overload list_documents(request, options = nil)
251
+ # Pass arguments to `list_documents` via a request object, either of type
252
+ # {::Google::Cloud::DiscoveryEngine::V1::ListDocumentsRequest} or an equivalent Hash.
253
+ #
254
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ListDocumentsRequest, ::Hash]
255
+ # A request object representing the call parameters. Required. To specify no
256
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
257
+ # @param options [::Gapic::CallOptions, ::Hash]
258
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
259
+ #
260
+ # @overload list_documents(parent: nil, page_size: nil, page_token: nil)
261
+ # Pass arguments to `list_documents` via keyword arguments. Note that at
262
+ # least one keyword argument is required. To specify no parameters, or to keep all
263
+ # the default parameter values, pass an empty Hash as a request object (see above).
264
+ #
265
+ # @param parent [::String]
266
+ # Required. The parent branch resource name, such as
267
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
268
+ # Use `default_branch` as the branch ID, to list documents under the default
269
+ # branch.
270
+ #
271
+ # If the caller does not have permission to list
272
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s under this branch,
273
+ # regardless of whether or not this branch exists, a `PERMISSION_DENIED`
274
+ # error is returned.
275
+ # @param page_size [::Integer]
276
+ # Maximum number of {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to
277
+ # return. If unspecified, defaults to 100. The maximum allowed value is 1000.
278
+ # Values above 1000 will be coerced to 1000.
279
+ #
280
+ # If this field is negative, an `INVALID_ARGUMENT` error is returned.
281
+ # @param page_token [::String]
282
+ # A page token
283
+ # {::Google::Cloud::DiscoveryEngine::V1::ListDocumentsResponse#next_page_token ListDocumentsResponse.next_page_token},
284
+ # received from a previous
285
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}
286
+ # call. Provide this to retrieve the subsequent page.
287
+ #
288
+ # When paginating, all other parameters provided to
289
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}
290
+ # must match the call that provided the page token. Otherwise, an
291
+ # `INVALID_ARGUMENT` error is returned.
292
+ # @yield [result, operation] Access the result along with the TransportOperation object
293
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Document>]
294
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
295
+ #
296
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Document>]
297
+ #
298
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
299
+ def list_documents request, options = nil
300
+ raise ::ArgumentError, "request must be provided" if request.nil?
301
+
302
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListDocumentsRequest
303
+
304
+ # Converts hash and nil to an options object
305
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
306
+
307
+ # Customize the options with defaults
308
+ call_metadata = @config.rpcs.list_documents.metadata.to_h
309
+
310
+ # Set x-goog-api-client and x-goog-user-project headers
311
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
312
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
313
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
314
+ transports_version_send: [:rest]
315
+
316
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
317
+
318
+ options.apply_defaults timeout: @config.rpcs.list_documents.timeout,
319
+ metadata: call_metadata,
320
+ retry_policy: @config.rpcs.list_documents.retry_policy
321
+
322
+ options.apply_defaults timeout: @config.timeout,
323
+ metadata: @config.metadata,
324
+ retry_policy: @config.retry_policy
325
+
326
+ @document_service_stub.list_documents request, options do |result, operation|
327
+ result = ::Gapic::Rest::PagedEnumerable.new @document_service_stub, :list_documents, "documents", request, result, options
328
+ yield result, operation if block_given?
329
+ return result
330
+ end
331
+ rescue ::Gapic::Rest::Error => e
332
+ raise ::Google::Cloud::Error.from_error(e)
333
+ end
334
+
335
+ ##
336
+ # Creates a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
337
+ #
338
+ # @overload create_document(request, options = nil)
339
+ # Pass arguments to `create_document` via a request object, either of type
340
+ # {::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest} or an equivalent Hash.
341
+ #
342
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest, ::Hash]
343
+ # A request object representing the call parameters. Required. To specify no
344
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
345
+ # @param options [::Gapic::CallOptions, ::Hash]
346
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
347
+ #
348
+ # @overload create_document(parent: nil, document: nil, document_id: nil)
349
+ # Pass arguments to `create_document` via keyword arguments. Note that at
350
+ # least one keyword argument is required. To specify no parameters, or to keep all
351
+ # the default parameter values, pass an empty Hash as a request object (see above).
352
+ #
353
+ # @param parent [::String]
354
+ # Required. The parent resource name, such as
355
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
356
+ # @param document [::Google::Cloud::DiscoveryEngine::V1::Document, ::Hash]
357
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1::Document Document} to
358
+ # create.
359
+ # @param document_id [::String]
360
+ # Required. The ID to use for the
361
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, which will become the
362
+ # final component of the
363
+ # {::Google::Cloud::DiscoveryEngine::V1::Document#name Document.name}.
364
+ #
365
+ # If the caller does not have permission to create the
366
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
367
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
368
+ #
369
+ # This field must be unique among all
370
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s with the same
371
+ # {::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest#parent parent}.
372
+ # Otherwise, an `ALREADY_EXISTS` error is returned.
373
+ #
374
+ # This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
375
+ # standard with a length limit of 63 characters. Otherwise, an
376
+ # `INVALID_ARGUMENT` error is returned.
377
+ # @yield [result, operation] Access the result along with the TransportOperation object
378
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Document]
379
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
380
+ #
381
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Document]
382
+ #
383
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
384
+ def create_document request, options = nil
385
+ raise ::ArgumentError, "request must be provided" if request.nil?
386
+
387
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CreateDocumentRequest
388
+
389
+ # Converts hash and nil to an options object
390
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
391
+
392
+ # Customize the options with defaults
393
+ call_metadata = @config.rpcs.create_document.metadata.to_h
394
+
395
+ # Set x-goog-api-client and x-goog-user-project headers
396
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
397
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
398
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
399
+ transports_version_send: [:rest]
400
+
401
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
402
+
403
+ options.apply_defaults timeout: @config.rpcs.create_document.timeout,
404
+ metadata: call_metadata,
405
+ retry_policy: @config.rpcs.create_document.retry_policy
406
+
407
+ options.apply_defaults timeout: @config.timeout,
408
+ metadata: @config.metadata,
409
+ retry_policy: @config.retry_policy
410
+
411
+ @document_service_stub.create_document request, options do |result, operation|
412
+ yield result, operation if block_given?
413
+ return result
414
+ end
415
+ rescue ::Gapic::Rest::Error => e
416
+ raise ::Google::Cloud::Error.from_error(e)
417
+ end
418
+
419
+ ##
420
+ # Updates a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
421
+ #
422
+ # @overload update_document(request, options = nil)
423
+ # Pass arguments to `update_document` via a request object, either of type
424
+ # {::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest} or an equivalent Hash.
425
+ #
426
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest, ::Hash]
427
+ # A request object representing the call parameters. Required. To specify no
428
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
429
+ # @param options [::Gapic::CallOptions, ::Hash]
430
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
431
+ #
432
+ # @overload update_document(document: nil, allow_missing: nil)
433
+ # Pass arguments to `update_document` via keyword arguments. Note that at
434
+ # least one keyword argument is required. To specify no parameters, or to keep all
435
+ # the default parameter values, pass an empty Hash as a request object (see above).
436
+ #
437
+ # @param document [::Google::Cloud::DiscoveryEngine::V1::Document, ::Hash]
438
+ # Required. The document to update/create.
439
+ #
440
+ # If the caller does not have permission to update the
441
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
442
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
443
+ #
444
+ # If the {::Google::Cloud::DiscoveryEngine::V1::Document Document} to update does
445
+ # not exist and
446
+ # {::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest#allow_missing allow_missing}
447
+ # is not set, a `NOT_FOUND` error is returned.
448
+ # @param allow_missing [::Boolean]
449
+ # If set to true, and the
450
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document} is not found, a new
451
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document} will be created.
452
+ # @yield [result, operation] Access the result along with the TransportOperation object
453
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Document]
454
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
455
+ #
456
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Document]
457
+ #
458
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
459
+ def update_document request, options = nil
460
+ raise ::ArgumentError, "request must be provided" if request.nil?
461
+
462
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateDocumentRequest
463
+
464
+ # Converts hash and nil to an options object
465
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
466
+
467
+ # Customize the options with defaults
468
+ call_metadata = @config.rpcs.update_document.metadata.to_h
469
+
470
+ # Set x-goog-api-client and x-goog-user-project headers
471
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
472
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
473
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
474
+ transports_version_send: [:rest]
475
+
476
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
477
+
478
+ options.apply_defaults timeout: @config.rpcs.update_document.timeout,
479
+ metadata: call_metadata,
480
+ retry_policy: @config.rpcs.update_document.retry_policy
481
+
482
+ options.apply_defaults timeout: @config.timeout,
483
+ metadata: @config.metadata,
484
+ retry_policy: @config.retry_policy
485
+
486
+ @document_service_stub.update_document request, options do |result, operation|
487
+ yield result, operation if block_given?
488
+ return result
489
+ end
490
+ rescue ::Gapic::Rest::Error => e
491
+ raise ::Google::Cloud::Error.from_error(e)
492
+ end
493
+
494
+ ##
495
+ # Deletes a {::Google::Cloud::DiscoveryEngine::V1::Document Document}.
496
+ #
497
+ # @overload delete_document(request, options = nil)
498
+ # Pass arguments to `delete_document` via a request object, either of type
499
+ # {::Google::Cloud::DiscoveryEngine::V1::DeleteDocumentRequest} or an equivalent Hash.
500
+ #
501
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::DeleteDocumentRequest, ::Hash]
502
+ # A request object representing the call parameters. Required. To specify no
503
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
504
+ # @param options [::Gapic::CallOptions, ::Hash]
505
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
506
+ #
507
+ # @overload delete_document(name: nil)
508
+ # Pass arguments to `delete_document` via keyword arguments. Note that at
509
+ # least one keyword argument is required. To specify no parameters, or to keep all
510
+ # the default parameter values, pass an empty Hash as a request object (see above).
511
+ #
512
+ # @param name [::String]
513
+ # Required. Full resource name of
514
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, such as
515
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
516
+ #
517
+ # If the caller does not have permission to delete the
518
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}, regardless of whether
519
+ # or not it exists, a `PERMISSION_DENIED` error is returned.
520
+ #
521
+ # If the {::Google::Cloud::DiscoveryEngine::V1::Document Document} to delete does
522
+ # not exist, a `NOT_FOUND` error is returned.
523
+ # @yield [result, operation] Access the result along with the TransportOperation object
524
+ # @yieldparam result [::Google::Protobuf::Empty]
525
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
526
+ #
527
+ # @return [::Google::Protobuf::Empty]
528
+ #
529
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
530
+ def delete_document request, options = nil
531
+ raise ::ArgumentError, "request must be provided" if request.nil?
532
+
533
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::DeleteDocumentRequest
534
+
535
+ # Converts hash and nil to an options object
536
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
537
+
538
+ # Customize the options with defaults
539
+ call_metadata = @config.rpcs.delete_document.metadata.to_h
540
+
541
+ # Set x-goog-api-client and x-goog-user-project headers
542
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
543
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
544
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
545
+ transports_version_send: [:rest]
546
+
547
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
548
+
549
+ options.apply_defaults timeout: @config.rpcs.delete_document.timeout,
550
+ metadata: call_metadata,
551
+ retry_policy: @config.rpcs.delete_document.retry_policy
552
+
553
+ options.apply_defaults timeout: @config.timeout,
554
+ metadata: @config.metadata,
555
+ retry_policy: @config.retry_policy
556
+
557
+ @document_service_stub.delete_document request, options do |result, operation|
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
+ # Bulk import of multiple
567
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s. Request processing
568
+ # may be synchronous. Non-existing items will be created.
569
+ #
570
+ # Note: It is possible for a subset of the
571
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to be successfully
572
+ # updated.
573
+ #
574
+ # @overload import_documents(request, options = nil)
575
+ # Pass arguments to `import_documents` via a request object, either of type
576
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest} or an equivalent Hash.
577
+ #
578
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest, ::Hash]
579
+ # A request object representing the call parameters. Required. To specify no
580
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
581
+ # @param options [::Gapic::CallOptions, ::Hash]
582
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
583
+ #
584
+ # @overload import_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, auto_generate_ids: nil, id_field: nil)
585
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
586
+ # least one keyword argument is required. To specify no parameters, or to keep all
587
+ # the default parameter values, pass an empty Hash as a request object (see above).
588
+ #
589
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::InlineSource, ::Hash]
590
+ # The Inline source for the input content for documents.
591
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1::GcsSource, ::Hash]
592
+ # Cloud Storage location for the input content.
593
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1::BigQuerySource, ::Hash]
594
+ # BigQuery input source.
595
+ # @param parent [::String]
596
+ # Required. The parent branch resource name, such as
597
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
598
+ # Requires create/update permission.
599
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1::ImportErrorConfig, ::Hash]
600
+ # The desired location of errors incurred during the Import.
601
+ # @param reconciliation_mode [::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::ReconciliationMode]
602
+ # The mode of reconciliation between existing documents and the documents to
603
+ # be imported. Defaults to
604
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
605
+ # @param auto_generate_ids [::Boolean]
606
+ # Whether to automatically generate IDs for the documents if absent.
607
+ #
608
+ # If set to `true`,
609
+ # {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s are
610
+ # automatically generated based on the hash of the payload, where IDs may not
611
+ # be consistent during multiple imports. In which case
612
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest::ReconciliationMode::FULL ReconciliationMode.FULL}
613
+ # is highly recommended to avoid duplicate contents. If unset or set to
614
+ # `false`, {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s have
615
+ # to be specified using
616
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest#id_field id_field},
617
+ # otherwise, documents without IDs fail to be imported.
618
+ #
619
+ # Only set this field when using
620
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} or
621
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource}, and when
622
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource#data_schema GcsSource.data_schema}
623
+ # or
624
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource#data_schema BigQuerySource.data_schema}
625
+ # is `custom` or `csv`. Otherwise, an INVALID_ARGUMENT error is thrown.
626
+ # @param id_field [::String]
627
+ # The field in the Cloud Storage and BigQuery sources that indicates the
628
+ # unique IDs of the documents.
629
+ #
630
+ # For {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} it is the key of
631
+ # the JSON field. For instance, `my_id` for JSON `{"my_id": "some_uuid"}`.
632
+ # For {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource} it is
633
+ # the column name of the BigQuery table where the unique ids are stored.
634
+ #
635
+ # The values of the JSON field or the BigQuery column are used as the
636
+ # {::Google::Cloud::DiscoveryEngine::V1::Document#id Document.id}s. The JSON field
637
+ # or the BigQuery column must be of string type, and the values must be set
638
+ # as valid strings conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
639
+ # with 1-63 characters. Otherwise, documents without valid IDs fail to be
640
+ # imported.
641
+ #
642
+ # Only set this field when using
643
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource GcsSource} or
644
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource BigQuerySource}, and when
645
+ # {::Google::Cloud::DiscoveryEngine::V1::GcsSource#data_schema GcsSource.data_schema}
646
+ # or
647
+ # {::Google::Cloud::DiscoveryEngine::V1::BigQuerySource#data_schema BigQuerySource.data_schema}
648
+ # is `custom`. And only set this field when
649
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest#auto_generate_ids auto_generate_ids}
650
+ # is unset or set as `false`. Otherwise, an INVALID_ARGUMENT error is thrown.
651
+ #
652
+ # If it is unset, a default value `_id` is used when importing from the
653
+ # allowed data sources.
654
+ # @yield [result, operation] Access the result along with the TransportOperation object
655
+ # @yieldparam result [::Gapic::Operation]
656
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
657
+ #
658
+ # @return [::Gapic::Operation]
659
+ #
660
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
661
+ def import_documents request, options = nil
662
+ raise ::ArgumentError, "request must be provided" if request.nil?
663
+
664
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ImportDocumentsRequest
665
+
666
+ # Converts hash and nil to an options object
667
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
668
+
669
+ # Customize the options with defaults
670
+ call_metadata = @config.rpcs.import_documents.metadata.to_h
671
+
672
+ # Set x-goog-api-client and x-goog-user-project headers
673
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
674
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
675
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
676
+ transports_version_send: [:rest]
677
+
678
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
679
+
680
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
681
+ metadata: call_metadata,
682
+ retry_policy: @config.rpcs.import_documents.retry_policy
683
+
684
+ options.apply_defaults timeout: @config.timeout,
685
+ metadata: @config.metadata,
686
+ retry_policy: @config.retry_policy
687
+
688
+ @document_service_stub.import_documents request, options do |result, operation|
689
+ result = ::Gapic::Operation.new result, @operations_client, options: options
690
+ yield result, operation if block_given?
691
+ return result
692
+ end
693
+ rescue ::Gapic::Rest::Error => e
694
+ raise ::Google::Cloud::Error.from_error(e)
695
+ end
696
+
697
+ ##
698
+ # Permanently deletes all selected
699
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s in a branch.
700
+ #
701
+ # This process is asynchronous. Depending on the number of
702
+ # {::Google::Cloud::DiscoveryEngine::V1::Document Document}s to be deleted, this
703
+ # operation can take hours to complete. Before the delete operation
704
+ # completes, some {::Google::Cloud::DiscoveryEngine::V1::Document Document}s might
705
+ # still be returned by
706
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#get_document DocumentService.GetDocument}
707
+ # or
708
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}.
709
+ #
710
+ # To get a list of the {::Google::Cloud::DiscoveryEngine::V1::Document Document}s
711
+ # to be deleted, set
712
+ # {::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest#force PurgeDocumentsRequest.force}
713
+ # to false.
714
+ #
715
+ # @overload purge_documents(request, options = nil)
716
+ # Pass arguments to `purge_documents` via a request object, either of type
717
+ # {::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest} or an equivalent Hash.
718
+ #
719
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest, ::Hash]
720
+ # A request object representing the call parameters. Required. To specify no
721
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
722
+ # @param options [::Gapic::CallOptions, ::Hash]
723
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
724
+ #
725
+ # @overload purge_documents(parent: nil, filter: nil, force: nil)
726
+ # Pass arguments to `purge_documents` via keyword arguments. Note that at
727
+ # least one keyword argument is required. To specify no parameters, or to keep all
728
+ # the default parameter values, pass an empty Hash as a request object (see above).
729
+ #
730
+ # @param parent [::String]
731
+ # Required. The parent resource name, such as
732
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
733
+ # @param filter [::String]
734
+ # Required. Filter matching documents to purge. Only currently supported
735
+ # value is
736
+ # `*` (all items).
737
+ # @param force [::Boolean]
738
+ # Actually performs the purge. If `force` is set to false, return the
739
+ # expected purge count without deleting any documents.
740
+ # @yield [result, operation] Access the result along with the TransportOperation object
741
+ # @yieldparam result [::Gapic::Operation]
742
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
743
+ #
744
+ # @return [::Gapic::Operation]
745
+ #
746
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
747
+ def purge_documents request, options = nil
748
+ raise ::ArgumentError, "request must be provided" if request.nil?
749
+
750
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::PurgeDocumentsRequest
751
+
752
+ # Converts hash and nil to an options object
753
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
754
+
755
+ # Customize the options with defaults
756
+ call_metadata = @config.rpcs.purge_documents.metadata.to_h
757
+
758
+ # Set x-goog-api-client and x-goog-user-project headers
759
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
760
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
761
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
762
+ transports_version_send: [:rest]
763
+
764
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
765
+
766
+ options.apply_defaults timeout: @config.rpcs.purge_documents.timeout,
767
+ metadata: call_metadata,
768
+ retry_policy: @config.rpcs.purge_documents.retry_policy
769
+
770
+ options.apply_defaults timeout: @config.timeout,
771
+ metadata: @config.metadata,
772
+ retry_policy: @config.retry_policy
773
+
774
+ @document_service_stub.purge_documents request, options do |result, operation|
775
+ result = ::Gapic::Operation.new result, @operations_client, options: options
776
+ yield result, operation if block_given?
777
+ return result
778
+ end
779
+ rescue ::Gapic::Rest::Error => e
780
+ raise ::Google::Cloud::Error.from_error(e)
781
+ end
782
+
783
+ ##
784
+ # Configuration class for the DocumentService REST API.
785
+ #
786
+ # This class represents the configuration for DocumentService REST,
787
+ # providing control over timeouts, retry behavior, logging, transport
788
+ # parameters, and other low-level controls. Certain parameters can also be
789
+ # applied individually to specific RPCs. See
790
+ # {::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client::Configuration::Rpcs}
791
+ # for a list of RPCs that can be configured independently.
792
+ #
793
+ # Configuration can be applied globally to all clients, or to a single client
794
+ # on construction.
795
+ #
796
+ # @example
797
+ #
798
+ # # Modify the global config, setting the timeout for
799
+ # # get_document to 20 seconds,
800
+ # # and all remaining timeouts to 10 seconds.
801
+ # ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.configure do |config|
802
+ # config.timeout = 10.0
803
+ # config.rpcs.get_document.timeout = 20.0
804
+ # end
805
+ #
806
+ # # Apply the above configuration only to a new client.
807
+ # client = ::Google::Cloud::DiscoveryEngine::V1::DocumentService::Rest::Client.new do |config|
808
+ # config.timeout = 10.0
809
+ # config.rpcs.get_document.timeout = 20.0
810
+ # end
811
+ #
812
+ # @!attribute [rw] endpoint
813
+ # The hostname or hostname:port of the service endpoint.
814
+ # Defaults to `"discoveryengine.googleapis.com"`.
815
+ # @return [::String]
816
+ # @!attribute [rw] credentials
817
+ # Credentials to send with calls. You may provide any of the following types:
818
+ # * (`String`) The path to a service account key file in JSON format
819
+ # * (`Hash`) A service account key as a Hash
820
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
821
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
822
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
823
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
824
+ # * (`nil`) indicating no credentials
825
+ # @return [::Object]
826
+ # @!attribute [rw] scope
827
+ # The OAuth scopes
828
+ # @return [::Array<::String>]
829
+ # @!attribute [rw] lib_name
830
+ # The library name as recorded in instrumentation and logging
831
+ # @return [::String]
832
+ # @!attribute [rw] lib_version
833
+ # The library version as recorded in instrumentation and logging
834
+ # @return [::String]
835
+ # @!attribute [rw] timeout
836
+ # The call timeout in seconds.
837
+ # @return [::Numeric]
838
+ # @!attribute [rw] metadata
839
+ # Additional headers to be sent with the call.
840
+ # @return [::Hash{::Symbol=>::String}]
841
+ # @!attribute [rw] retry_policy
842
+ # The retry policy. The value is a hash with the following keys:
843
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
844
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
845
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
846
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
847
+ # trigger a retry.
848
+ # @return [::Hash]
849
+ # @!attribute [rw] quota_project
850
+ # A separate project against which to charge quota.
851
+ # @return [::String]
852
+ #
853
+ class Configuration
854
+ extend ::Gapic::Config
855
+
856
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
857
+
858
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
859
+ config_attr :credentials, nil do |value|
860
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
861
+ allowed.any? { |klass| klass === value }
862
+ end
863
+ config_attr :scope, nil, ::String, ::Array, nil
864
+ config_attr :lib_name, nil, ::String, nil
865
+ config_attr :lib_version, nil, ::String, nil
866
+ config_attr :timeout, nil, ::Numeric, nil
867
+ config_attr :metadata, nil, ::Hash, nil
868
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
869
+ config_attr :quota_project, nil, ::String, nil
870
+
871
+ # @private
872
+ def initialize parent_config = nil
873
+ @parent_config = parent_config unless parent_config.nil?
874
+
875
+ yield self if block_given?
876
+ end
877
+
878
+ ##
879
+ # Configurations for individual RPCs
880
+ # @return [Rpcs]
881
+ #
882
+ def rpcs
883
+ @rpcs ||= begin
884
+ parent_rpcs = nil
885
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
886
+ Rpcs.new parent_rpcs
887
+ end
888
+ end
889
+
890
+ ##
891
+ # Configuration RPC class for the DocumentService API.
892
+ #
893
+ # Includes fields providing the configuration for each RPC in this service.
894
+ # Each configuration object is of type `Gapic::Config::Method` and includes
895
+ # the following configuration fields:
896
+ #
897
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
898
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
899
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
900
+ # include the following keys:
901
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
902
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
903
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
904
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
905
+ # trigger a retry.
906
+ #
907
+ class Rpcs
908
+ ##
909
+ # RPC-specific configuration for `get_document`
910
+ # @return [::Gapic::Config::Method]
911
+ #
912
+ attr_reader :get_document
913
+ ##
914
+ # RPC-specific configuration for `list_documents`
915
+ # @return [::Gapic::Config::Method]
916
+ #
917
+ attr_reader :list_documents
918
+ ##
919
+ # RPC-specific configuration for `create_document`
920
+ # @return [::Gapic::Config::Method]
921
+ #
922
+ attr_reader :create_document
923
+ ##
924
+ # RPC-specific configuration for `update_document`
925
+ # @return [::Gapic::Config::Method]
926
+ #
927
+ attr_reader :update_document
928
+ ##
929
+ # RPC-specific configuration for `delete_document`
930
+ # @return [::Gapic::Config::Method]
931
+ #
932
+ attr_reader :delete_document
933
+ ##
934
+ # RPC-specific configuration for `import_documents`
935
+ # @return [::Gapic::Config::Method]
936
+ #
937
+ attr_reader :import_documents
938
+ ##
939
+ # RPC-specific configuration for `purge_documents`
940
+ # @return [::Gapic::Config::Method]
941
+ #
942
+ attr_reader :purge_documents
943
+
944
+ # @private
945
+ def initialize parent_rpcs = nil
946
+ get_document_config = parent_rpcs.get_document if parent_rpcs.respond_to? :get_document
947
+ @get_document = ::Gapic::Config::Method.new get_document_config
948
+ list_documents_config = parent_rpcs.list_documents if parent_rpcs.respond_to? :list_documents
949
+ @list_documents = ::Gapic::Config::Method.new list_documents_config
950
+ create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
951
+ @create_document = ::Gapic::Config::Method.new create_document_config
952
+ update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
953
+ @update_document = ::Gapic::Config::Method.new update_document_config
954
+ delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
955
+ @delete_document = ::Gapic::Config::Method.new delete_document_config
956
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
957
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
958
+ purge_documents_config = parent_rpcs.purge_documents if parent_rpcs.respond_to? :purge_documents
959
+ @purge_documents = ::Gapic::Config::Method.new purge_documents_config
960
+
961
+ yield self if block_given?
962
+ end
963
+ end
964
+ end
965
+ end
966
+ end
967
+ end
968
+ end
969
+ end
970
+ end
971
+ end