google-cloud-document_ai-v1beta3 0.24.0 → 0.25.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 874c654f8cfe406c08fae1cb6b257e899672238d977cfa5f174ffcef633394b3
4
- data.tar.gz: ea4546e6df5ddbc579da1f9658fe3a6b680e6d6d1b56c5fc212fda0135973555
3
+ metadata.gz: c60364ce123a47b9ac5ac09894c35cd341119e5bef78659fe766a510a7f55b53
4
+ data.tar.gz: 0ac3e4c8b1af36c2db5b8142d197ffaa631d7415245db9912dcf17b8bde5515d
5
5
  SHA512:
6
- metadata.gz: f5b707d9a7d247a2805a65420dbd938f5c51d010a152ef9104ca8510900d93d419b6975eabbeb700f9d5ec292d2edacc5665d86bf39bc27d9e82ba3c7131790a
7
- data.tar.gz: 8184c01a1597bda5985cc3389f73612890ebc661dde4d527c8c00a76bc0d97bfe31331c04c77856f36cff631a0ffcadc27f0554993046be67cc988ade211d52e
6
+ metadata.gz: fbcb8b8d5f7afaf9a56df2b6349e186c3844d6d5d705433818a58ad14ab0fd248d7993de3ed2cc8c940aca8b754392505556e47923dde66a7e4a3b2a99636f28
7
+ data.tar.gz: d0fa8e1ebf02342c6130c2d24cb10c109b34b4cc003a7bfd91c7faeca1ba63f406a1b811a274a9c2c2a3e4d53c5b6771cdeb0376d28bd4fa9d2cb5d1fa293049
@@ -202,7 +202,7 @@ module Google
202
202
  # @param options [::Gapic::CallOptions, ::Hash]
203
203
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
204
204
  #
205
- # @overload process_document(inline_document: nil, raw_document: nil, name: nil, document: nil, skip_human_review: nil, field_mask: nil, process_options: nil)
205
+ # @overload process_document(inline_document: nil, raw_document: nil, gcs_document: nil, name: nil, document: nil, skip_human_review: nil, field_mask: nil, process_options: nil)
206
206
  # Pass arguments to `process_document` via keyword arguments. Note that at
207
207
  # least one keyword argument is required. To specify no parameters, or to keep all
208
208
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -211,6 +211,8 @@ module Google
211
211
  # An inline document proto.
212
212
  # @param raw_document [::Google::Cloud::DocumentAI::V1beta3::RawDocument, ::Hash]
213
213
  # A raw document content (bytes).
214
+ # @param gcs_document [::Google::Cloud::DocumentAI::V1beta3::GcsDocument, ::Hash]
215
+ # A raw document on Google Cloud Storage.
214
216
  # @param name [::String]
215
217
  # Required. The resource name of the
216
218
  # {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} or
@@ -194,7 +194,7 @@ module Google
194
194
  # @param options [::Gapic::CallOptions, ::Hash]
195
195
  # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
196
196
  #
197
- # @overload process_document(inline_document: nil, raw_document: nil, name: nil, document: nil, skip_human_review: nil, field_mask: nil, process_options: nil)
197
+ # @overload process_document(inline_document: nil, raw_document: nil, gcs_document: nil, name: nil, document: nil, skip_human_review: nil, field_mask: nil, process_options: nil)
198
198
  # Pass arguments to `process_document` via keyword arguments. Note that at
199
199
  # least one keyword argument is required. To specify no parameters, or to keep all
200
200
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -203,6 +203,8 @@ module Google
203
203
  # An inline document proto.
204
204
  # @param raw_document [::Google::Cloud::DocumentAI::V1beta3::RawDocument, ::Hash]
205
205
  # A raw document content (bytes).
206
+ # @param gcs_document [::Google::Cloud::DocumentAI::V1beta3::GcsDocument, ::Hash]
207
+ # A raw document on Google Cloud Storage.
206
208
  # @param name [::String]
207
209
  # Required. The resource name of the
208
210
  # {::Google::Cloud::DocumentAI::V1beta3::Processor Processor} or
@@ -267,6 +267,299 @@ module Google
267
267
  raise ::Google::Cloud::Error.from_error(e)
268
268
  end
269
269
 
270
+ ##
271
+ # Import documents into a dataset.
272
+ #
273
+ # @overload import_documents(request, options = nil)
274
+ # Pass arguments to `import_documents` via a request object, either of type
275
+ # {::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest} or an equivalent Hash.
276
+ #
277
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest, ::Hash]
278
+ # A request object representing the call parameters. Required. To specify no
279
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
280
+ # @param options [::Gapic::CallOptions, ::Hash]
281
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
282
+ #
283
+ # @overload import_documents(dataset: nil, batch_documents_import_configs: nil)
284
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
285
+ # least one keyword argument is required. To specify no parameters, or to keep all
286
+ # the default parameter values, pass an empty Hash as a request object (see above).
287
+ #
288
+ # @param dataset [::String]
289
+ # Required. The dataset resource name.
290
+ # Format:
291
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset
292
+ # @param batch_documents_import_configs [::Array<::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest::BatchDocumentsImportConfig, ::Hash>]
293
+ # Required. The Cloud Storage uri containing raw documents that must be
294
+ # imported.
295
+ #
296
+ # @yield [response, operation] Access the result along with the RPC operation
297
+ # @yieldparam response [::Gapic::Operation]
298
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
299
+ #
300
+ # @return [::Gapic::Operation]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
303
+ #
304
+ # @example Basic example
305
+ # require "google/cloud/document_ai/v1beta3"
306
+ #
307
+ # # Create a client object. The client can be reused for multiple calls.
308
+ # client = Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
309
+ #
310
+ # # Create a request. To set request fields, pass in keyword arguments.
311
+ # request = Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest.new
312
+ #
313
+ # # Call the import_documents method.
314
+ # result = client.import_documents request
315
+ #
316
+ # # The returned object is of type Gapic::Operation. You can use it to
317
+ # # check the status of an operation, cancel it, or wait for results.
318
+ # # Here is how to wait for a response.
319
+ # result.wait_until_done! timeout: 60
320
+ # if result.response?
321
+ # p result.response
322
+ # else
323
+ # puts "No response received."
324
+ # end
325
+ #
326
+ def import_documents request, options = nil
327
+ raise ::ArgumentError, "request must be provided" if request.nil?
328
+
329
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest
330
+
331
+ # Converts hash and nil to an options object
332
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
333
+
334
+ # Customize the options with defaults
335
+ metadata = @config.rpcs.import_documents.metadata.to_h
336
+
337
+ # Set x-goog-api-client and x-goog-user-project headers
338
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
339
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
340
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
341
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
342
+
343
+ header_params = {}
344
+ if request.dataset
345
+ header_params["dataset"] = request.dataset
346
+ end
347
+
348
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
349
+ metadata[:"x-goog-request-params"] ||= request_params_header
350
+
351
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
352
+ metadata: metadata,
353
+ retry_policy: @config.rpcs.import_documents.retry_policy
354
+
355
+ options.apply_defaults timeout: @config.timeout,
356
+ metadata: @config.metadata,
357
+ retry_policy: @config.retry_policy
358
+
359
+ @document_service_stub.call_rpc :import_documents, request, options: options do |response, operation|
360
+ response = ::Gapic::Operation.new response, @operations_client, options: options
361
+ yield response, operation if block_given?
362
+ return response
363
+ end
364
+ rescue ::GRPC::BadStatus => e
365
+ raise ::Google::Cloud::Error.from_error(e)
366
+ end
367
+
368
+ ##
369
+ # Returns relevant fields present in the requested document.
370
+ #
371
+ # @overload get_document(request, options = nil)
372
+ # Pass arguments to `get_document` via a request object, either of type
373
+ # {::Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest} or an equivalent Hash.
374
+ #
375
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest, ::Hash]
376
+ # A request object representing the call parameters. Required. To specify no
377
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
378
+ # @param options [::Gapic::CallOptions, ::Hash]
379
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
380
+ #
381
+ # @overload get_document(dataset: nil, document_id: nil, read_mask: nil, page_range: nil)
382
+ # Pass arguments to `get_document` via keyword arguments. Note that at
383
+ # least one keyword argument is required. To specify no parameters, or to keep all
384
+ # the default parameter values, pass an empty Hash as a request object (see above).
385
+ #
386
+ # @param dataset [::String]
387
+ # Required. The resource name of the dataset that the document belongs to .
388
+ # Format:
389
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset
390
+ # @param document_id [::Google::Cloud::DocumentAI::V1beta3::DocumentId, ::Hash]
391
+ # Required. Document identifier.
392
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
393
+ # If set, only fields listed here will be returned. Otherwise, all fields
394
+ # will be returned by default.
395
+ # @param page_range [::Google::Cloud::DocumentAI::V1beta3::DocumentPageRange, ::Hash]
396
+ # List of pages for which the fields specified in the `read_mask` must
397
+ # be served.
398
+ #
399
+ # @yield [response, operation] Access the result along with the RPC operation
400
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1beta3::GetDocumentResponse]
401
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
402
+ #
403
+ # @return [::Google::Cloud::DocumentAI::V1beta3::GetDocumentResponse]
404
+ #
405
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
406
+ #
407
+ # @example Basic example
408
+ # require "google/cloud/document_ai/v1beta3"
409
+ #
410
+ # # Create a client object. The client can be reused for multiple calls.
411
+ # client = Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
412
+ #
413
+ # # Create a request. To set request fields, pass in keyword arguments.
414
+ # request = Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest.new
415
+ #
416
+ # # Call the get_document method.
417
+ # result = client.get_document request
418
+ #
419
+ # # The returned object is of type Google::Cloud::DocumentAI::V1beta3::GetDocumentResponse.
420
+ # p result
421
+ #
422
+ def get_document request, options = nil
423
+ raise ::ArgumentError, "request must be provided" if request.nil?
424
+
425
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest
426
+
427
+ # Converts hash and nil to an options object
428
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
429
+
430
+ # Customize the options with defaults
431
+ metadata = @config.rpcs.get_document.metadata.to_h
432
+
433
+ # Set x-goog-api-client and x-goog-user-project headers
434
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
435
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
436
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
437
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
438
+
439
+ header_params = {}
440
+ if request.dataset
441
+ header_params["dataset"] = request.dataset
442
+ end
443
+
444
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
445
+ metadata[:"x-goog-request-params"] ||= request_params_header
446
+
447
+ options.apply_defaults timeout: @config.rpcs.get_document.timeout,
448
+ metadata: metadata,
449
+ retry_policy: @config.rpcs.get_document.retry_policy
450
+
451
+ options.apply_defaults timeout: @config.timeout,
452
+ metadata: @config.metadata,
453
+ retry_policy: @config.retry_policy
454
+
455
+ @document_service_stub.call_rpc :get_document, request, options: options do |response, operation|
456
+ yield response, operation if block_given?
457
+ return response
458
+ end
459
+ rescue ::GRPC::BadStatus => e
460
+ raise ::Google::Cloud::Error.from_error(e)
461
+ end
462
+
463
+ ##
464
+ # Deletes a set of documents.
465
+ #
466
+ # @overload batch_delete_documents(request, options = nil)
467
+ # Pass arguments to `batch_delete_documents` via a request object, either of type
468
+ # {::Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest} or an equivalent Hash.
469
+ #
470
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest, ::Hash]
471
+ # A request object representing the call parameters. Required. To specify no
472
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
473
+ # @param options [::Gapic::CallOptions, ::Hash]
474
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
475
+ #
476
+ # @overload batch_delete_documents(dataset: nil, dataset_documents: nil)
477
+ # Pass arguments to `batch_delete_documents` via keyword arguments. Note that at
478
+ # least one keyword argument is required. To specify no parameters, or to keep all
479
+ # the default parameter values, pass an empty Hash as a request object (see above).
480
+ #
481
+ # @param dataset [::String]
482
+ # Required. The dataset resource name.
483
+ # Format:
484
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset
485
+ # @param dataset_documents [::Google::Cloud::DocumentAI::V1beta3::BatchDatasetDocuments, ::Hash]
486
+ # Required. Dataset documents input. If given `filter`, all documents
487
+ # satisfying the filter will be deleted. If given documentIds, a maximum of
488
+ # 50 documents can be deleted in a batch. The request will be rejected if
489
+ # more than 50 document_ids are provided.
490
+ #
491
+ # @yield [response, operation] Access the result along with the RPC operation
492
+ # @yieldparam response [::Gapic::Operation]
493
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
494
+ #
495
+ # @return [::Gapic::Operation]
496
+ #
497
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
498
+ #
499
+ # @example Basic example
500
+ # require "google/cloud/document_ai/v1beta3"
501
+ #
502
+ # # Create a client object. The client can be reused for multiple calls.
503
+ # client = Google::Cloud::DocumentAI::V1beta3::DocumentService::Client.new
504
+ #
505
+ # # Create a request. To set request fields, pass in keyword arguments.
506
+ # request = Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest.new
507
+ #
508
+ # # Call the batch_delete_documents method.
509
+ # result = client.batch_delete_documents request
510
+ #
511
+ # # The returned object is of type Gapic::Operation. You can use it to
512
+ # # check the status of an operation, cancel it, or wait for results.
513
+ # # Here is how to wait for a response.
514
+ # result.wait_until_done! timeout: 60
515
+ # if result.response?
516
+ # p result.response
517
+ # else
518
+ # puts "No response received."
519
+ # end
520
+ #
521
+ def batch_delete_documents request, options = nil
522
+ raise ::ArgumentError, "request must be provided" if request.nil?
523
+
524
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest
525
+
526
+ # Converts hash and nil to an options object
527
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
528
+
529
+ # Customize the options with defaults
530
+ metadata = @config.rpcs.batch_delete_documents.metadata.to_h
531
+
532
+ # Set x-goog-api-client and x-goog-user-project headers
533
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
534
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
535
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION
536
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
537
+
538
+ header_params = {}
539
+ if request.dataset
540
+ header_params["dataset"] = request.dataset
541
+ end
542
+
543
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
544
+ metadata[:"x-goog-request-params"] ||= request_params_header
545
+
546
+ options.apply_defaults timeout: @config.rpcs.batch_delete_documents.timeout,
547
+ metadata: metadata,
548
+ retry_policy: @config.rpcs.batch_delete_documents.retry_policy
549
+
550
+ options.apply_defaults timeout: @config.timeout,
551
+ metadata: @config.metadata,
552
+ retry_policy: @config.retry_policy
553
+
554
+ @document_service_stub.call_rpc :batch_delete_documents, request, options: options do |response, operation|
555
+ response = ::Gapic::Operation.new response, @operations_client, options: options
556
+ yield response, operation if block_given?
557
+ return response
558
+ end
559
+ rescue ::GRPC::BadStatus => e
560
+ raise ::Google::Cloud::Error.from_error(e)
561
+ end
562
+
270
563
  ##
271
564
  # Gets the `DatasetSchema` of a `Dataset`.
272
565
  #
@@ -587,6 +880,21 @@ module Google
587
880
  #
588
881
  attr_reader :update_dataset
589
882
  ##
883
+ # RPC-specific configuration for `import_documents`
884
+ # @return [::Gapic::Config::Method]
885
+ #
886
+ attr_reader :import_documents
887
+ ##
888
+ # RPC-specific configuration for `get_document`
889
+ # @return [::Gapic::Config::Method]
890
+ #
891
+ attr_reader :get_document
892
+ ##
893
+ # RPC-specific configuration for `batch_delete_documents`
894
+ # @return [::Gapic::Config::Method]
895
+ #
896
+ attr_reader :batch_delete_documents
897
+ ##
590
898
  # RPC-specific configuration for `get_dataset_schema`
591
899
  # @return [::Gapic::Config::Method]
592
900
  #
@@ -601,6 +909,12 @@ module Google
601
909
  def initialize parent_rpcs = nil
602
910
  update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
603
911
  @update_dataset = ::Gapic::Config::Method.new update_dataset_config
912
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
913
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
914
+ get_document_config = parent_rpcs.get_document if parent_rpcs.respond_to? :get_document
915
+ @get_document = ::Gapic::Config::Method.new get_document_config
916
+ batch_delete_documents_config = parent_rpcs.batch_delete_documents if parent_rpcs.respond_to? :batch_delete_documents
917
+ @batch_delete_documents = ::Gapic::Config::Method.new batch_delete_documents_config
604
918
  get_dataset_schema_config = parent_rpcs.get_dataset_schema if parent_rpcs.respond_to? :get_dataset_schema
605
919
  @get_dataset_schema = ::Gapic::Config::Method.new get_dataset_schema_config
606
920
  update_dataset_schema_config = parent_rpcs.update_dataset_schema if parent_rpcs.respond_to? :update_dataset_schema
@@ -229,6 +229,216 @@ module Google
229
229
  raise ::Google::Cloud::Error.from_error(e)
230
230
  end
231
231
 
232
+ ##
233
+ # Import documents into a dataset.
234
+ #
235
+ # @overload import_documents(request, options = nil)
236
+ # Pass arguments to `import_documents` via a request object, either of type
237
+ # {::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest} or an equivalent Hash.
238
+ #
239
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest, ::Hash]
240
+ # A request object representing the call parameters. Required. To specify no
241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
242
+ # @param options [::Gapic::CallOptions, ::Hash]
243
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
244
+ #
245
+ # @overload import_documents(dataset: nil, batch_documents_import_configs: nil)
246
+ # Pass arguments to `import_documents` via keyword arguments. Note that at
247
+ # least one keyword argument is required. To specify no parameters, or to keep all
248
+ # the default parameter values, pass an empty Hash as a request object (see above).
249
+ #
250
+ # @param dataset [::String]
251
+ # Required. The dataset resource name.
252
+ # Format:
253
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset
254
+ # @param batch_documents_import_configs [::Array<::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest::BatchDocumentsImportConfig, ::Hash>]
255
+ # Required. The Cloud Storage uri containing raw documents that must be
256
+ # imported.
257
+ # @yield [result, operation] Access the result along with the TransportOperation object
258
+ # @yieldparam result [::Gapic::Operation]
259
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
260
+ #
261
+ # @return [::Gapic::Operation]
262
+ #
263
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
264
+ def import_documents request, options = nil
265
+ raise ::ArgumentError, "request must be provided" if request.nil?
266
+
267
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::ImportDocumentsRequest
268
+
269
+ # Converts hash and nil to an options object
270
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
271
+
272
+ # Customize the options with defaults
273
+ call_metadata = @config.rpcs.import_documents.metadata.to_h
274
+
275
+ # Set x-goog-api-client and x-goog-user-project headers
276
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
277
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
278
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION,
279
+ transports_version_send: [:rest]
280
+
281
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
282
+
283
+ options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
284
+ metadata: call_metadata,
285
+ retry_policy: @config.rpcs.import_documents.retry_policy
286
+
287
+ options.apply_defaults timeout: @config.timeout,
288
+ metadata: @config.metadata,
289
+ retry_policy: @config.retry_policy
290
+
291
+ @document_service_stub.import_documents request, options do |result, operation|
292
+ result = ::Gapic::Operation.new result, @operations_client, options: options
293
+ yield result, operation if block_given?
294
+ return result
295
+ end
296
+ rescue ::Gapic::Rest::Error => e
297
+ raise ::Google::Cloud::Error.from_error(e)
298
+ end
299
+
300
+ ##
301
+ # Returns relevant fields present in the requested document.
302
+ #
303
+ # @overload get_document(request, options = nil)
304
+ # Pass arguments to `get_document` via a request object, either of type
305
+ # {::Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest} or an equivalent Hash.
306
+ #
307
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest, ::Hash]
308
+ # A request object representing the call parameters. Required. To specify no
309
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
310
+ # @param options [::Gapic::CallOptions, ::Hash]
311
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
312
+ #
313
+ # @overload get_document(dataset: nil, document_id: nil, read_mask: nil, page_range: nil)
314
+ # Pass arguments to `get_document` via keyword arguments. Note that at
315
+ # least one keyword argument is required. To specify no parameters, or to keep all
316
+ # the default parameter values, pass an empty Hash as a request object (see above).
317
+ #
318
+ # @param dataset [::String]
319
+ # Required. The resource name of the dataset that the document belongs to .
320
+ # Format:
321
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset
322
+ # @param document_id [::Google::Cloud::DocumentAI::V1beta3::DocumentId, ::Hash]
323
+ # Required. Document identifier.
324
+ # @param read_mask [::Google::Protobuf::FieldMask, ::Hash]
325
+ # If set, only fields listed here will be returned. Otherwise, all fields
326
+ # will be returned by default.
327
+ # @param page_range [::Google::Cloud::DocumentAI::V1beta3::DocumentPageRange, ::Hash]
328
+ # List of pages for which the fields specified in the `read_mask` must
329
+ # be served.
330
+ # @yield [result, operation] Access the result along with the TransportOperation object
331
+ # @yieldparam result [::Google::Cloud::DocumentAI::V1beta3::GetDocumentResponse]
332
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
333
+ #
334
+ # @return [::Google::Cloud::DocumentAI::V1beta3::GetDocumentResponse]
335
+ #
336
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
337
+ def get_document request, options = nil
338
+ raise ::ArgumentError, "request must be provided" if request.nil?
339
+
340
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::GetDocumentRequest
341
+
342
+ # Converts hash and nil to an options object
343
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
344
+
345
+ # Customize the options with defaults
346
+ call_metadata = @config.rpcs.get_document.metadata.to_h
347
+
348
+ # Set x-goog-api-client and x-goog-user-project headers
349
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
350
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
351
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION,
352
+ transports_version_send: [:rest]
353
+
354
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
355
+
356
+ options.apply_defaults timeout: @config.rpcs.get_document.timeout,
357
+ metadata: call_metadata,
358
+ retry_policy: @config.rpcs.get_document.retry_policy
359
+
360
+ options.apply_defaults timeout: @config.timeout,
361
+ metadata: @config.metadata,
362
+ retry_policy: @config.retry_policy
363
+
364
+ @document_service_stub.get_document request, options do |result, operation|
365
+ yield result, operation if block_given?
366
+ return result
367
+ end
368
+ rescue ::Gapic::Rest::Error => e
369
+ raise ::Google::Cloud::Error.from_error(e)
370
+ end
371
+
372
+ ##
373
+ # Deletes a set of documents.
374
+ #
375
+ # @overload batch_delete_documents(request, options = nil)
376
+ # Pass arguments to `batch_delete_documents` via a request object, either of type
377
+ # {::Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest} or an equivalent Hash.
378
+ #
379
+ # @param request [::Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest, ::Hash]
380
+ # A request object representing the call parameters. Required. To specify no
381
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
382
+ # @param options [::Gapic::CallOptions, ::Hash]
383
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
384
+ #
385
+ # @overload batch_delete_documents(dataset: nil, dataset_documents: nil)
386
+ # Pass arguments to `batch_delete_documents` via keyword arguments. Note that at
387
+ # least one keyword argument is required. To specify no parameters, or to keep all
388
+ # the default parameter values, pass an empty Hash as a request object (see above).
389
+ #
390
+ # @param dataset [::String]
391
+ # Required. The dataset resource name.
392
+ # Format:
393
+ # projects/\\{project}/locations/\\{location}/processors/\\{processor}/dataset
394
+ # @param dataset_documents [::Google::Cloud::DocumentAI::V1beta3::BatchDatasetDocuments, ::Hash]
395
+ # Required. Dataset documents input. If given `filter`, all documents
396
+ # satisfying the filter will be deleted. If given documentIds, a maximum of
397
+ # 50 documents can be deleted in a batch. The request will be rejected if
398
+ # more than 50 document_ids are provided.
399
+ # @yield [result, operation] Access the result along with the TransportOperation object
400
+ # @yieldparam result [::Gapic::Operation]
401
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
402
+ #
403
+ # @return [::Gapic::Operation]
404
+ #
405
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
406
+ def batch_delete_documents request, options = nil
407
+ raise ::ArgumentError, "request must be provided" if request.nil?
408
+
409
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1beta3::BatchDeleteDocumentsRequest
410
+
411
+ # Converts hash and nil to an options object
412
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
413
+
414
+ # Customize the options with defaults
415
+ call_metadata = @config.rpcs.batch_delete_documents.metadata.to_h
416
+
417
+ # Set x-goog-api-client and x-goog-user-project headers
418
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
419
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
420
+ gapic_version: ::Google::Cloud::DocumentAI::V1beta3::VERSION,
421
+ transports_version_send: [:rest]
422
+
423
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
424
+
425
+ options.apply_defaults timeout: @config.rpcs.batch_delete_documents.timeout,
426
+ metadata: call_metadata,
427
+ retry_policy: @config.rpcs.batch_delete_documents.retry_policy
428
+
429
+ options.apply_defaults timeout: @config.timeout,
430
+ metadata: @config.metadata,
431
+ retry_policy: @config.retry_policy
432
+
433
+ @document_service_stub.batch_delete_documents request, options do |result, operation|
434
+ result = ::Gapic::Operation.new result, @operations_client, options: options
435
+ yield result, operation if block_given?
436
+ return result
437
+ end
438
+ rescue ::Gapic::Rest::Error => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
232
442
  ##
233
443
  # Gets the `DatasetSchema` of a `Dataset`.
234
444
  #
@@ -498,6 +708,21 @@ module Google
498
708
  #
499
709
  attr_reader :update_dataset
500
710
  ##
711
+ # RPC-specific configuration for `import_documents`
712
+ # @return [::Gapic::Config::Method]
713
+ #
714
+ attr_reader :import_documents
715
+ ##
716
+ # RPC-specific configuration for `get_document`
717
+ # @return [::Gapic::Config::Method]
718
+ #
719
+ attr_reader :get_document
720
+ ##
721
+ # RPC-specific configuration for `batch_delete_documents`
722
+ # @return [::Gapic::Config::Method]
723
+ #
724
+ attr_reader :batch_delete_documents
725
+ ##
501
726
  # RPC-specific configuration for `get_dataset_schema`
502
727
  # @return [::Gapic::Config::Method]
503
728
  #
@@ -512,6 +737,12 @@ module Google
512
737
  def initialize parent_rpcs = nil
513
738
  update_dataset_config = parent_rpcs.update_dataset if parent_rpcs.respond_to? :update_dataset
514
739
  @update_dataset = ::Gapic::Config::Method.new update_dataset_config
740
+ import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
741
+ @import_documents = ::Gapic::Config::Method.new import_documents_config
742
+ get_document_config = parent_rpcs.get_document if parent_rpcs.respond_to? :get_document
743
+ @get_document = ::Gapic::Config::Method.new get_document_config
744
+ batch_delete_documents_config = parent_rpcs.batch_delete_documents if parent_rpcs.respond_to? :batch_delete_documents
745
+ @batch_delete_documents = ::Gapic::Config::Method.new batch_delete_documents_config
515
746
  get_dataset_schema_config = parent_rpcs.get_dataset_schema if parent_rpcs.respond_to? :get_dataset_schema
516
747
  @get_dataset_schema = ::Gapic::Config::Method.new get_dataset_schema_config
517
748
  update_dataset_schema_config = parent_rpcs.update_dataset_schema if parent_rpcs.respond_to? :update_dataset_schema