google-cloud-document_ai-v1 0.2.4 → 0.5.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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -6
  3. data/lib/google/cloud/document_ai/v1/document_processor_service/client.rb +1490 -58
  4. data/lib/google/cloud/document_ai/v1/document_processor_service/operations.rb +3 -0
  5. data/lib/google/cloud/document_ai/v1/document_processor_service/paths.rb +38 -0
  6. data/lib/google/cloud/document_ai/v1/version.rb +1 -1
  7. data/lib/google/cloud/document_ai/v1.rb +2 -0
  8. data/lib/google/cloud/documentai/v1/barcode_pb.rb +24 -0
  9. data/lib/google/cloud/documentai/v1/document_io_pb.rb +0 -1
  10. data/lib/google/cloud/documentai/v1/document_pb.rb +20 -2
  11. data/lib/google/cloud/documentai/v1/document_processor_service_pb.rb +142 -1
  12. data/lib/google/cloud/documentai/v1/document_processor_service_services_pb.rb +34 -0
  13. data/lib/google/cloud/documentai/v1/document_schema_pb.rb +60 -0
  14. data/lib/google/cloud/documentai/v1/geometry_pb.rb +0 -1
  15. data/lib/google/cloud/documentai/v1/operation_metadata_pb.rb +3 -2
  16. data/lib/google/cloud/documentai/v1/processor_pb.rb +71 -0
  17. data/lib/google/cloud/documentai/v1/processor_type_pb.rb +34 -0
  18. data/proto_docs/google/api/launch_stage.rb +71 -0
  19. data/proto_docs/google/cloud/documentai/v1/barcode.rb +71 -0
  20. data/proto_docs/google/cloud/documentai/v1/document.rb +87 -31
  21. data/proto_docs/google/cloud/documentai/v1/document_processor_service.rb +354 -5
  22. data/proto_docs/google/cloud/documentai/v1/document_schema.rb +154 -0
  23. data/proto_docs/google/cloud/documentai/v1/operation_metadata.rb +3 -0
  24. data/proto_docs/google/cloud/documentai/v1/processor.rb +171 -0
  25. data/proto_docs/google/cloud/documentai/v1/processor_type.rb +62 -0
  26. data/proto_docs/google/protobuf/any.rb +3 -3
  27. data/proto_docs/google/protobuf/empty.rb +0 -2
  28. data/proto_docs/google/protobuf/field_mask.rb +1 -1
  29. metadata +41 -12
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/cloud/documentai/v1/document_processor_service_pb"
21
+ require "google/cloud/location"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -157,6 +158,12 @@ module Google
157
158
  config.endpoint = @config.endpoint
158
159
  end
159
160
 
161
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
162
+ config.credentials = credentials
163
+ config.quota_project = @quota_project_id
164
+ config.endpoint = @config.endpoint
165
+ end
166
+
160
167
  @document_processor_service_stub = ::Gapic::ServiceStub.new(
161
168
  ::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Stub,
162
169
  credentials: credentials,
@@ -167,47 +174,1273 @@ module Google
167
174
  end
168
175
 
169
176
  ##
170
- # Get the associated client for long-running operations.
177
+ # Get the associated client for long-running operations.
178
+ #
179
+ # @return [::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Operations]
180
+ #
181
+ attr_reader :operations_client
182
+
183
+ ##
184
+ # Get the associated client for mix-in of the Locations.
185
+ #
186
+ # @return [Google::Cloud::Location::Locations::Client]
187
+ #
188
+ attr_reader :location_client
189
+
190
+ # Service calls
191
+
192
+ ##
193
+ # Processes a single document.
194
+ #
195
+ # @overload process_document(request, options = nil)
196
+ # Pass arguments to `process_document` via a request object, either of type
197
+ # {::Google::Cloud::DocumentAI::V1::ProcessRequest} or an equivalent Hash.
198
+ #
199
+ # @param request [::Google::Cloud::DocumentAI::V1::ProcessRequest, ::Hash]
200
+ # A request object representing the call parameters. Required. To specify no
201
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
202
+ # @param options [::Gapic::CallOptions, ::Hash]
203
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
204
+ #
205
+ # @overload process_document(inline_document: nil, raw_document: nil, name: nil, skip_human_review: nil, field_mask: nil)
206
+ # Pass arguments to `process_document` via keyword arguments. Note that at
207
+ # least one keyword argument is required. To specify no parameters, or to keep all
208
+ # the default parameter values, pass an empty Hash as a request object (see above).
209
+ #
210
+ # @param inline_document [::Google::Cloud::DocumentAI::V1::Document, ::Hash]
211
+ # An inline document proto.
212
+ # @param raw_document [::Google::Cloud::DocumentAI::V1::RawDocument, ::Hash]
213
+ # A raw document content (bytes).
214
+ # @param name [::String]
215
+ # Required. The resource name of the {::Google::Cloud::DocumentAI::V1::Processor Processor} or
216
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion}
217
+ # to use for processing. If a {::Google::Cloud::DocumentAI::V1::Processor Processor} is specified, the server will use
218
+ # its {::Google::Cloud::DocumentAI::V1::Processor#default_processor_version default version}. Format:
219
+ # `projects/{project}/locations/{location}/processors/{processor}`, or
220
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
221
+ # @param skip_human_review [::Boolean]
222
+ # Whether Human Review feature should be skipped for this request. Default to
223
+ # false.
224
+ # @param field_mask [::Google::Protobuf::FieldMask, ::Hash]
225
+ # Specifies which fields to include in ProcessResponse's document.
226
+ #
227
+ # @yield [response, operation] Access the result along with the RPC operation
228
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::ProcessResponse]
229
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
230
+ #
231
+ # @return [::Google::Cloud::DocumentAI::V1::ProcessResponse]
232
+ #
233
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
234
+ #
235
+ # @example Basic example
236
+ # require "google/cloud/document_ai/v1"
237
+ #
238
+ # # Create a client object. The client can be reused for multiple calls.
239
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
240
+ #
241
+ # # Create a request. To set request fields, pass in keyword arguments.
242
+ # request = Google::Cloud::DocumentAI::V1::ProcessRequest.new
243
+ #
244
+ # # Call the process_document method.
245
+ # result = client.process_document request
246
+ #
247
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::ProcessResponse.
248
+ # p result
249
+ #
250
+ def process_document request, options = nil
251
+ raise ::ArgumentError, "request must be provided" if request.nil?
252
+
253
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ProcessRequest
254
+
255
+ # Converts hash and nil to an options object
256
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
257
+
258
+ # Customize the options with defaults
259
+ metadata = @config.rpcs.process_document.metadata.to_h
260
+
261
+ # Set x-goog-api-client and x-goog-user-project headers
262
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
263
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
264
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
265
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
266
+
267
+ header_params = {}
268
+ if request.name
269
+ header_params["name"] = request.name
270
+ end
271
+
272
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
273
+ metadata[:"x-goog-request-params"] ||= request_params_header
274
+
275
+ options.apply_defaults timeout: @config.rpcs.process_document.timeout,
276
+ metadata: metadata,
277
+ retry_policy: @config.rpcs.process_document.retry_policy
278
+
279
+ options.apply_defaults timeout: @config.timeout,
280
+ metadata: @config.metadata,
281
+ retry_policy: @config.retry_policy
282
+
283
+ @document_processor_service_stub.call_rpc :process_document, request, options: options do |response, operation|
284
+ yield response, operation if block_given?
285
+ return response
286
+ end
287
+ rescue ::GRPC::BadStatus => e
288
+ raise ::Google::Cloud::Error.from_error(e)
289
+ end
290
+
291
+ ##
292
+ # LRO endpoint to batch process many documents. The output is written
293
+ # to Cloud Storage as JSON in the [Document] format.
294
+ #
295
+ # @overload batch_process_documents(request, options = nil)
296
+ # Pass arguments to `batch_process_documents` via a request object, either of type
297
+ # {::Google::Cloud::DocumentAI::V1::BatchProcessRequest} or an equivalent Hash.
298
+ #
299
+ # @param request [::Google::Cloud::DocumentAI::V1::BatchProcessRequest, ::Hash]
300
+ # A request object representing the call parameters. Required. To specify no
301
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
302
+ # @param options [::Gapic::CallOptions, ::Hash]
303
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
304
+ #
305
+ # @overload batch_process_documents(name: nil, input_documents: nil, document_output_config: nil, skip_human_review: nil)
306
+ # Pass arguments to `batch_process_documents` via keyword arguments. Note that at
307
+ # least one keyword argument is required. To specify no parameters, or to keep all
308
+ # the default parameter values, pass an empty Hash as a request object (see above).
309
+ #
310
+ # @param name [::String]
311
+ # Required. The resource name of {::Google::Cloud::DocumentAI::V1::Processor Processor} or
312
+ # {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion}.
313
+ # Format: `projects/{project}/locations/{location}/processors/{processor}`,
314
+ # or
315
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
316
+ # @param input_documents [::Google::Cloud::DocumentAI::V1::BatchDocumentsInputConfig, ::Hash]
317
+ # The input documents for batch process.
318
+ # @param document_output_config [::Google::Cloud::DocumentAI::V1::DocumentOutputConfig, ::Hash]
319
+ # The overall output config for batch process.
320
+ # @param skip_human_review [::Boolean]
321
+ # Whether Human Review feature should be skipped for this request. Default to
322
+ # false.
323
+ #
324
+ # @yield [response, operation] Access the result along with the RPC operation
325
+ # @yieldparam response [::Gapic::Operation]
326
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
327
+ #
328
+ # @return [::Gapic::Operation]
329
+ #
330
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
331
+ #
332
+ # @example Basic example
333
+ # require "google/cloud/document_ai/v1"
334
+ #
335
+ # # Create a client object. The client can be reused for multiple calls.
336
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
337
+ #
338
+ # # Create a request. To set request fields, pass in keyword arguments.
339
+ # request = Google::Cloud::DocumentAI::V1::BatchProcessRequest.new
340
+ #
341
+ # # Call the batch_process_documents method.
342
+ # result = client.batch_process_documents request
343
+ #
344
+ # # The returned object is of type Gapic::Operation. You can use this
345
+ # # object to check the status of an operation, cancel it, or wait
346
+ # # for results. Here is how to block until completion:
347
+ # result.wait_until_done! timeout: 60
348
+ # if result.response?
349
+ # p result.response
350
+ # else
351
+ # puts "Error!"
352
+ # end
353
+ #
354
+ def batch_process_documents request, options = nil
355
+ raise ::ArgumentError, "request must be provided" if request.nil?
356
+
357
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::BatchProcessRequest
358
+
359
+ # Converts hash and nil to an options object
360
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
361
+
362
+ # Customize the options with defaults
363
+ metadata = @config.rpcs.batch_process_documents.metadata.to_h
364
+
365
+ # Set x-goog-api-client and x-goog-user-project headers
366
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
367
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
368
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
369
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
370
+
371
+ header_params = {}
372
+ if request.name
373
+ header_params["name"] = request.name
374
+ end
375
+
376
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
377
+ metadata[:"x-goog-request-params"] ||= request_params_header
378
+
379
+ options.apply_defaults timeout: @config.rpcs.batch_process_documents.timeout,
380
+ metadata: metadata,
381
+ retry_policy: @config.rpcs.batch_process_documents.retry_policy
382
+
383
+ options.apply_defaults timeout: @config.timeout,
384
+ metadata: @config.metadata,
385
+ retry_policy: @config.retry_policy
386
+
387
+ @document_processor_service_stub.call_rpc :batch_process_documents, request, options: options do |response, operation|
388
+ response = ::Gapic::Operation.new response, @operations_client, options: options
389
+ yield response, operation if block_given?
390
+ return response
391
+ end
392
+ rescue ::GRPC::BadStatus => e
393
+ raise ::Google::Cloud::Error.from_error(e)
394
+ end
395
+
396
+ ##
397
+ # Fetches processor types. Note that we do not use ListProcessorTypes here
398
+ # because it is not paginated.
399
+ #
400
+ # @overload fetch_processor_types(request, options = nil)
401
+ # Pass arguments to `fetch_processor_types` via a request object, either of type
402
+ # {::Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest} or an equivalent Hash.
403
+ #
404
+ # @param request [::Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest, ::Hash]
405
+ # A request object representing the call parameters. Required. To specify no
406
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
407
+ # @param options [::Gapic::CallOptions, ::Hash]
408
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
409
+ #
410
+ # @overload fetch_processor_types(parent: nil)
411
+ # Pass arguments to `fetch_processor_types` via keyword arguments. Note that at
412
+ # least one keyword argument is required. To specify no parameters, or to keep all
413
+ # the default parameter values, pass an empty Hash as a request object (see above).
414
+ #
415
+ # @param parent [::String]
416
+ # Required. The project of processor type to list.
417
+ # The available processor types may depend on the allow-listing on projects.
418
+ # Format: `projects/{project}/locations/{location}`
419
+ #
420
+ # @yield [response, operation] Access the result along with the RPC operation
421
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::FetchProcessorTypesResponse]
422
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
423
+ #
424
+ # @return [::Google::Cloud::DocumentAI::V1::FetchProcessorTypesResponse]
425
+ #
426
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
427
+ #
428
+ # @example Basic example
429
+ # require "google/cloud/document_ai/v1"
430
+ #
431
+ # # Create a client object. The client can be reused for multiple calls.
432
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
433
+ #
434
+ # # Create a request. To set request fields, pass in keyword arguments.
435
+ # request = Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest.new
436
+ #
437
+ # # Call the fetch_processor_types method.
438
+ # result = client.fetch_processor_types request
439
+ #
440
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::FetchProcessorTypesResponse.
441
+ # p result
442
+ #
443
+ def fetch_processor_types request, options = nil
444
+ raise ::ArgumentError, "request must be provided" if request.nil?
445
+
446
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::FetchProcessorTypesRequest
447
+
448
+ # Converts hash and nil to an options object
449
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
450
+
451
+ # Customize the options with defaults
452
+ metadata = @config.rpcs.fetch_processor_types.metadata.to_h
453
+
454
+ # Set x-goog-api-client and x-goog-user-project headers
455
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
456
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
457
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
458
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
459
+
460
+ header_params = {}
461
+ if request.parent
462
+ header_params["parent"] = request.parent
463
+ end
464
+
465
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
466
+ metadata[:"x-goog-request-params"] ||= request_params_header
467
+
468
+ options.apply_defaults timeout: @config.rpcs.fetch_processor_types.timeout,
469
+ metadata: metadata,
470
+ retry_policy: @config.rpcs.fetch_processor_types.retry_policy
471
+
472
+ options.apply_defaults timeout: @config.timeout,
473
+ metadata: @config.metadata,
474
+ retry_policy: @config.retry_policy
475
+
476
+ @document_processor_service_stub.call_rpc :fetch_processor_types, request, options: options do |response, operation|
477
+ yield response, operation if block_given?
478
+ return response
479
+ end
480
+ rescue ::GRPC::BadStatus => e
481
+ raise ::Google::Cloud::Error.from_error(e)
482
+ end
483
+
484
+ ##
485
+ # Lists the processor types that exist.
486
+ #
487
+ # @overload list_processor_types(request, options = nil)
488
+ # Pass arguments to `list_processor_types` via a request object, either of type
489
+ # {::Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest} or an equivalent Hash.
490
+ #
491
+ # @param request [::Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest, ::Hash]
492
+ # A request object representing the call parameters. Required. To specify no
493
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
494
+ # @param options [::Gapic::CallOptions, ::Hash]
495
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
496
+ #
497
+ # @overload list_processor_types(parent: nil, page_size: nil, page_token: nil)
498
+ # Pass arguments to `list_processor_types` via keyword arguments. Note that at
499
+ # least one keyword argument is required. To specify no parameters, or to keep all
500
+ # the default parameter values, pass an empty Hash as a request object (see above).
501
+ #
502
+ # @param parent [::String]
503
+ # Required. The location of processor type to list.
504
+ # The available processor types may depend on the allow-listing on projects.
505
+ # Format: `projects/{project}/locations/{location}`
506
+ # @param page_size [::Integer]
507
+ # The maximum number of processor types to return.
508
+ # If unspecified, at most 100 processor types will be returned.
509
+ # The maximum value is 500; values above 500 will be coerced to 500.
510
+ # @param page_token [::String]
511
+ # Used to retrieve the next page of results, empty if at the end of the list.
512
+ #
513
+ # @yield [response, operation] Access the result along with the RPC operation
514
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorType>]
515
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
516
+ #
517
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorType>]
518
+ #
519
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
520
+ #
521
+ # @example Basic example
522
+ # require "google/cloud/document_ai/v1"
523
+ #
524
+ # # Create a client object. The client can be reused for multiple calls.
525
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
526
+ #
527
+ # # Create a request. To set request fields, pass in keyword arguments.
528
+ # request = Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest.new
529
+ #
530
+ # # Call the list_processor_types method.
531
+ # result = client.list_processor_types request
532
+ #
533
+ # # The returned object is of type Gapic::PagedEnumerable. You can
534
+ # # iterate over all elements by calling #each, and the enumerable
535
+ # # will lazily make API calls to fetch subsequent pages. Other
536
+ # # methods are also available for managing paging directly.
537
+ # result.each do |response|
538
+ # # Each element is of type ::Google::Cloud::DocumentAI::V1::ProcessorType.
539
+ # p response
540
+ # end
541
+ #
542
+ def list_processor_types request, options = nil
543
+ raise ::ArgumentError, "request must be provided" if request.nil?
544
+
545
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListProcessorTypesRequest
546
+
547
+ # Converts hash and nil to an options object
548
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
549
+
550
+ # Customize the options with defaults
551
+ metadata = @config.rpcs.list_processor_types.metadata.to_h
552
+
553
+ # Set x-goog-api-client and x-goog-user-project headers
554
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
555
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
556
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
557
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
558
+
559
+ header_params = {}
560
+ if request.parent
561
+ header_params["parent"] = request.parent
562
+ end
563
+
564
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
565
+ metadata[:"x-goog-request-params"] ||= request_params_header
566
+
567
+ options.apply_defaults timeout: @config.rpcs.list_processor_types.timeout,
568
+ metadata: metadata,
569
+ retry_policy: @config.rpcs.list_processor_types.retry_policy
570
+
571
+ options.apply_defaults timeout: @config.timeout,
572
+ metadata: @config.metadata,
573
+ retry_policy: @config.retry_policy
574
+
575
+ @document_processor_service_stub.call_rpc :list_processor_types, request, options: options do |response, operation|
576
+ response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_types, request, response, operation, options
577
+ yield response, operation if block_given?
578
+ return response
579
+ end
580
+ rescue ::GRPC::BadStatus => e
581
+ raise ::Google::Cloud::Error.from_error(e)
582
+ end
583
+
584
+ ##
585
+ # Lists all processors which belong to this project.
586
+ #
587
+ # @overload list_processors(request, options = nil)
588
+ # Pass arguments to `list_processors` via a request object, either of type
589
+ # {::Google::Cloud::DocumentAI::V1::ListProcessorsRequest} or an equivalent Hash.
590
+ #
591
+ # @param request [::Google::Cloud::DocumentAI::V1::ListProcessorsRequest, ::Hash]
592
+ # A request object representing the call parameters. Required. To specify no
593
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
594
+ # @param options [::Gapic::CallOptions, ::Hash]
595
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
596
+ #
597
+ # @overload list_processors(parent: nil, page_size: nil, page_token: nil)
598
+ # Pass arguments to `list_processors` via keyword arguments. Note that at
599
+ # least one keyword argument is required. To specify no parameters, or to keep all
600
+ # the default parameter values, pass an empty Hash as a request object (see above).
601
+ #
602
+ # @param parent [::String]
603
+ # Required. The parent (project and location) which owns this collection of Processors.
604
+ # Format: `projects/{project}/locations/{location}`
605
+ # @param page_size [::Integer]
606
+ # The maximum number of processors to return.
607
+ # If unspecified, at most 50 processors will be returned.
608
+ # The maximum value is 100; values above 100 will be coerced to 100.
609
+ # @param page_token [::String]
610
+ # We will return the processors sorted by creation time. The page token
611
+ # will point to the next processor.
612
+ #
613
+ # @yield [response, operation] Access the result along with the RPC operation
614
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Processor>]
615
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
616
+ #
617
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::Processor>]
618
+ #
619
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
620
+ #
621
+ # @example Basic example
622
+ # require "google/cloud/document_ai/v1"
623
+ #
624
+ # # Create a client object. The client can be reused for multiple calls.
625
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
626
+ #
627
+ # # Create a request. To set request fields, pass in keyword arguments.
628
+ # request = Google::Cloud::DocumentAI::V1::ListProcessorsRequest.new
629
+ #
630
+ # # Call the list_processors method.
631
+ # result = client.list_processors request
632
+ #
633
+ # # The returned object is of type Gapic::PagedEnumerable. You can
634
+ # # iterate over all elements by calling #each, and the enumerable
635
+ # # will lazily make API calls to fetch subsequent pages. Other
636
+ # # methods are also available for managing paging directly.
637
+ # result.each do |response|
638
+ # # Each element is of type ::Google::Cloud::DocumentAI::V1::Processor.
639
+ # p response
640
+ # end
641
+ #
642
+ def list_processors request, options = nil
643
+ raise ::ArgumentError, "request must be provided" if request.nil?
644
+
645
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListProcessorsRequest
646
+
647
+ # Converts hash and nil to an options object
648
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
649
+
650
+ # Customize the options with defaults
651
+ metadata = @config.rpcs.list_processors.metadata.to_h
652
+
653
+ # Set x-goog-api-client and x-goog-user-project headers
654
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
655
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
656
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
657
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
658
+
659
+ header_params = {}
660
+ if request.parent
661
+ header_params["parent"] = request.parent
662
+ end
663
+
664
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
665
+ metadata[:"x-goog-request-params"] ||= request_params_header
666
+
667
+ options.apply_defaults timeout: @config.rpcs.list_processors.timeout,
668
+ metadata: metadata,
669
+ retry_policy: @config.rpcs.list_processors.retry_policy
670
+
671
+ options.apply_defaults timeout: @config.timeout,
672
+ metadata: @config.metadata,
673
+ retry_policy: @config.retry_policy
674
+
675
+ @document_processor_service_stub.call_rpc :list_processors, request, options: options do |response, operation|
676
+ response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processors, request, response, operation, options
677
+ yield response, operation if block_given?
678
+ return response
679
+ end
680
+ rescue ::GRPC::BadStatus => e
681
+ raise ::Google::Cloud::Error.from_error(e)
682
+ end
683
+
684
+ ##
685
+ # Gets a processor detail.
686
+ #
687
+ # @overload get_processor(request, options = nil)
688
+ # Pass arguments to `get_processor` via a request object, either of type
689
+ # {::Google::Cloud::DocumentAI::V1::GetProcessorRequest} or an equivalent Hash.
690
+ #
691
+ # @param request [::Google::Cloud::DocumentAI::V1::GetProcessorRequest, ::Hash]
692
+ # A request object representing the call parameters. Required. To specify no
693
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
694
+ # @param options [::Gapic::CallOptions, ::Hash]
695
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
696
+ #
697
+ # @overload get_processor(name: nil)
698
+ # Pass arguments to `get_processor` via keyword arguments. Note that at
699
+ # least one keyword argument is required. To specify no parameters, or to keep all
700
+ # the default parameter values, pass an empty Hash as a request object (see above).
701
+ #
702
+ # @param name [::String]
703
+ # Required. The processor resource name.
704
+ #
705
+ # @yield [response, operation] Access the result along with the RPC operation
706
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::Processor]
707
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
708
+ #
709
+ # @return [::Google::Cloud::DocumentAI::V1::Processor]
710
+ #
711
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
712
+ #
713
+ # @example Basic example
714
+ # require "google/cloud/document_ai/v1"
715
+ #
716
+ # # Create a client object. The client can be reused for multiple calls.
717
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
718
+ #
719
+ # # Create a request. To set request fields, pass in keyword arguments.
720
+ # request = Google::Cloud::DocumentAI::V1::GetProcessorRequest.new
721
+ #
722
+ # # Call the get_processor method.
723
+ # result = client.get_processor request
724
+ #
725
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::Processor.
726
+ # p result
727
+ #
728
+ def get_processor request, options = nil
729
+ raise ::ArgumentError, "request must be provided" if request.nil?
730
+
731
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetProcessorRequest
732
+
733
+ # Converts hash and nil to an options object
734
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
735
+
736
+ # Customize the options with defaults
737
+ metadata = @config.rpcs.get_processor.metadata.to_h
738
+
739
+ # Set x-goog-api-client and x-goog-user-project headers
740
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
741
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
742
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
743
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
744
+
745
+ header_params = {}
746
+ if request.name
747
+ header_params["name"] = request.name
748
+ end
749
+
750
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
751
+ metadata[:"x-goog-request-params"] ||= request_params_header
752
+
753
+ options.apply_defaults timeout: @config.rpcs.get_processor.timeout,
754
+ metadata: metadata,
755
+ retry_policy: @config.rpcs.get_processor.retry_policy
756
+
757
+ options.apply_defaults timeout: @config.timeout,
758
+ metadata: @config.metadata,
759
+ retry_policy: @config.retry_policy
760
+
761
+ @document_processor_service_stub.call_rpc :get_processor, request, options: options do |response, operation|
762
+ yield response, operation if block_given?
763
+ return response
764
+ end
765
+ rescue ::GRPC::BadStatus => e
766
+ raise ::Google::Cloud::Error.from_error(e)
767
+ end
768
+
769
+ ##
770
+ # Gets a processor version detail.
771
+ #
772
+ # @overload get_processor_version(request, options = nil)
773
+ # Pass arguments to `get_processor_version` via a request object, either of type
774
+ # {::Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest} or an equivalent Hash.
775
+ #
776
+ # @param request [::Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest, ::Hash]
777
+ # A request object representing the call parameters. Required. To specify no
778
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
779
+ # @param options [::Gapic::CallOptions, ::Hash]
780
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
781
+ #
782
+ # @overload get_processor_version(name: nil)
783
+ # Pass arguments to `get_processor_version` via keyword arguments. Note that at
784
+ # least one keyword argument is required. To specify no parameters, or to keep all
785
+ # the default parameter values, pass an empty Hash as a request object (see above).
786
+ #
787
+ # @param name [::String]
788
+ # Required. The processor resource name.
789
+ #
790
+ # @yield [response, operation] Access the result along with the RPC operation
791
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::ProcessorVersion]
792
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
793
+ #
794
+ # @return [::Google::Cloud::DocumentAI::V1::ProcessorVersion]
795
+ #
796
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
797
+ #
798
+ # @example Basic example
799
+ # require "google/cloud/document_ai/v1"
800
+ #
801
+ # # Create a client object. The client can be reused for multiple calls.
802
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
803
+ #
804
+ # # Create a request. To set request fields, pass in keyword arguments.
805
+ # request = Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest.new
806
+ #
807
+ # # Call the get_processor_version method.
808
+ # result = client.get_processor_version request
809
+ #
810
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::ProcessorVersion.
811
+ # p result
812
+ #
813
+ def get_processor_version request, options = nil
814
+ raise ::ArgumentError, "request must be provided" if request.nil?
815
+
816
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::GetProcessorVersionRequest
817
+
818
+ # Converts hash and nil to an options object
819
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
820
+
821
+ # Customize the options with defaults
822
+ metadata = @config.rpcs.get_processor_version.metadata.to_h
823
+
824
+ # Set x-goog-api-client and x-goog-user-project headers
825
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
826
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
827
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
828
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
829
+
830
+ header_params = {}
831
+ if request.name
832
+ header_params["name"] = request.name
833
+ end
834
+
835
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
836
+ metadata[:"x-goog-request-params"] ||= request_params_header
837
+
838
+ options.apply_defaults timeout: @config.rpcs.get_processor_version.timeout,
839
+ metadata: metadata,
840
+ retry_policy: @config.rpcs.get_processor_version.retry_policy
841
+
842
+ options.apply_defaults timeout: @config.timeout,
843
+ metadata: @config.metadata,
844
+ retry_policy: @config.retry_policy
845
+
846
+ @document_processor_service_stub.call_rpc :get_processor_version, request, options: options do |response, operation|
847
+ yield response, operation if block_given?
848
+ return response
849
+ end
850
+ rescue ::GRPC::BadStatus => e
851
+ raise ::Google::Cloud::Error.from_error(e)
852
+ end
853
+
854
+ ##
855
+ # Lists all versions of a processor.
856
+ #
857
+ # @overload list_processor_versions(request, options = nil)
858
+ # Pass arguments to `list_processor_versions` via a request object, either of type
859
+ # {::Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest} or an equivalent Hash.
860
+ #
861
+ # @param request [::Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest, ::Hash]
862
+ # A request object representing the call parameters. Required. To specify no
863
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
864
+ # @param options [::Gapic::CallOptions, ::Hash]
865
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
866
+ #
867
+ # @overload list_processor_versions(parent: nil, page_size: nil, page_token: nil)
868
+ # Pass arguments to `list_processor_versions` via keyword arguments. Note that at
869
+ # least one keyword argument is required. To specify no parameters, or to keep all
870
+ # the default parameter values, pass an empty Hash as a request object (see above).
871
+ #
872
+ # @param parent [::String]
873
+ # Required. The parent (project, location and processor) to list all versions.
874
+ # Format: `projects/{project}/locations/{location}/processors/{processor}`
875
+ # @param page_size [::Integer]
876
+ # The maximum number of processor versions to return.
877
+ # If unspecified, at most 10 processor versions will be returned.
878
+ # The maximum value is 20; values above 20 will be coerced to 20.
879
+ # @param page_token [::String]
880
+ # We will return the processor versions sorted by creation time. The page
881
+ # token will point to the next processor version.
882
+ #
883
+ # @yield [response, operation] Access the result along with the RPC operation
884
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorVersion>]
885
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
886
+ #
887
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DocumentAI::V1::ProcessorVersion>]
888
+ #
889
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
890
+ #
891
+ # @example Basic example
892
+ # require "google/cloud/document_ai/v1"
893
+ #
894
+ # # Create a client object. The client can be reused for multiple calls.
895
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
896
+ #
897
+ # # Create a request. To set request fields, pass in keyword arguments.
898
+ # request = Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest.new
899
+ #
900
+ # # Call the list_processor_versions method.
901
+ # result = client.list_processor_versions request
902
+ #
903
+ # # The returned object is of type Gapic::PagedEnumerable. You can
904
+ # # iterate over all elements by calling #each, and the enumerable
905
+ # # will lazily make API calls to fetch subsequent pages. Other
906
+ # # methods are also available for managing paging directly.
907
+ # result.each do |response|
908
+ # # Each element is of type ::Google::Cloud::DocumentAI::V1::ProcessorVersion.
909
+ # p response
910
+ # end
911
+ #
912
+ def list_processor_versions request, options = nil
913
+ raise ::ArgumentError, "request must be provided" if request.nil?
914
+
915
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ListProcessorVersionsRequest
916
+
917
+ # Converts hash and nil to an options object
918
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
919
+
920
+ # Customize the options with defaults
921
+ metadata = @config.rpcs.list_processor_versions.metadata.to_h
922
+
923
+ # Set x-goog-api-client and x-goog-user-project headers
924
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
925
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
926
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
927
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
928
+
929
+ header_params = {}
930
+ if request.parent
931
+ header_params["parent"] = request.parent
932
+ end
933
+
934
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
935
+ metadata[:"x-goog-request-params"] ||= request_params_header
936
+
937
+ options.apply_defaults timeout: @config.rpcs.list_processor_versions.timeout,
938
+ metadata: metadata,
939
+ retry_policy: @config.rpcs.list_processor_versions.retry_policy
940
+
941
+ options.apply_defaults timeout: @config.timeout,
942
+ metadata: @config.metadata,
943
+ retry_policy: @config.retry_policy
944
+
945
+ @document_processor_service_stub.call_rpc :list_processor_versions, request, options: options do |response, operation|
946
+ response = ::Gapic::PagedEnumerable.new @document_processor_service_stub, :list_processor_versions, request, response, operation, options
947
+ yield response, operation if block_given?
948
+ return response
949
+ end
950
+ rescue ::GRPC::BadStatus => e
951
+ raise ::Google::Cloud::Error.from_error(e)
952
+ end
953
+
954
+ ##
955
+ # Deletes the processor version, all artifacts under the processor version
956
+ # will be deleted.
957
+ #
958
+ # @overload delete_processor_version(request, options = nil)
959
+ # Pass arguments to `delete_processor_version` via a request object, either of type
960
+ # {::Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest} or an equivalent Hash.
961
+ #
962
+ # @param request [::Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest, ::Hash]
963
+ # A request object representing the call parameters. Required. To specify no
964
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
965
+ # @param options [::Gapic::CallOptions, ::Hash]
966
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
967
+ #
968
+ # @overload delete_processor_version(name: nil)
969
+ # Pass arguments to `delete_processor_version` via keyword arguments. Note that at
970
+ # least one keyword argument is required. To specify no parameters, or to keep all
971
+ # the default parameter values, pass an empty Hash as a request object (see above).
972
+ #
973
+ # @param name [::String]
974
+ # Required. The processor version resource name to be deleted.
975
+ #
976
+ # @yield [response, operation] Access the result along with the RPC operation
977
+ # @yieldparam response [::Gapic::Operation]
978
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
979
+ #
980
+ # @return [::Gapic::Operation]
981
+ #
982
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
983
+ #
984
+ # @example Basic example
985
+ # require "google/cloud/document_ai/v1"
986
+ #
987
+ # # Create a client object. The client can be reused for multiple calls.
988
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
989
+ #
990
+ # # Create a request. To set request fields, pass in keyword arguments.
991
+ # request = Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest.new
992
+ #
993
+ # # Call the delete_processor_version method.
994
+ # result = client.delete_processor_version request
995
+ #
996
+ # # The returned object is of type Gapic::Operation. You can use this
997
+ # # object to check the status of an operation, cancel it, or wait
998
+ # # for results. Here is how to block until completion:
999
+ # result.wait_until_done! timeout: 60
1000
+ # if result.response?
1001
+ # p result.response
1002
+ # else
1003
+ # puts "Error!"
1004
+ # end
1005
+ #
1006
+ def delete_processor_version request, options = nil
1007
+ raise ::ArgumentError, "request must be provided" if request.nil?
1008
+
1009
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DeleteProcessorVersionRequest
1010
+
1011
+ # Converts hash and nil to an options object
1012
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1013
+
1014
+ # Customize the options with defaults
1015
+ metadata = @config.rpcs.delete_processor_version.metadata.to_h
1016
+
1017
+ # Set x-goog-api-client and x-goog-user-project headers
1018
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1019
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1020
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
1021
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1022
+
1023
+ header_params = {}
1024
+ if request.name
1025
+ header_params["name"] = request.name
1026
+ end
1027
+
1028
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1029
+ metadata[:"x-goog-request-params"] ||= request_params_header
1030
+
1031
+ options.apply_defaults timeout: @config.rpcs.delete_processor_version.timeout,
1032
+ metadata: metadata,
1033
+ retry_policy: @config.rpcs.delete_processor_version.retry_policy
1034
+
1035
+ options.apply_defaults timeout: @config.timeout,
1036
+ metadata: @config.metadata,
1037
+ retry_policy: @config.retry_policy
1038
+
1039
+ @document_processor_service_stub.call_rpc :delete_processor_version, request, options: options do |response, operation|
1040
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1041
+ yield response, operation if block_given?
1042
+ return response
1043
+ end
1044
+ rescue ::GRPC::BadStatus => e
1045
+ raise ::Google::Cloud::Error.from_error(e)
1046
+ end
1047
+
1048
+ ##
1049
+ # Deploys the processor version.
1050
+ #
1051
+ # @overload deploy_processor_version(request, options = nil)
1052
+ # Pass arguments to `deploy_processor_version` via a request object, either of type
1053
+ # {::Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest} or an equivalent Hash.
1054
+ #
1055
+ # @param request [::Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest, ::Hash]
1056
+ # A request object representing the call parameters. Required. To specify no
1057
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1058
+ # @param options [::Gapic::CallOptions, ::Hash]
1059
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1060
+ #
1061
+ # @overload deploy_processor_version(name: nil)
1062
+ # Pass arguments to `deploy_processor_version` via keyword arguments. Note that at
1063
+ # least one keyword argument is required. To specify no parameters, or to keep all
1064
+ # the default parameter values, pass an empty Hash as a request object (see above).
1065
+ #
1066
+ # @param name [::String]
1067
+ # Required. The processor version resource name to be deployed.
1068
+ #
1069
+ # @yield [response, operation] Access the result along with the RPC operation
1070
+ # @yieldparam response [::Gapic::Operation]
1071
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1072
+ #
1073
+ # @return [::Gapic::Operation]
1074
+ #
1075
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1076
+ #
1077
+ # @example Basic example
1078
+ # require "google/cloud/document_ai/v1"
1079
+ #
1080
+ # # Create a client object. The client can be reused for multiple calls.
1081
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
1082
+ #
1083
+ # # Create a request. To set request fields, pass in keyword arguments.
1084
+ # request = Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest.new
1085
+ #
1086
+ # # Call the deploy_processor_version method.
1087
+ # result = client.deploy_processor_version request
1088
+ #
1089
+ # # The returned object is of type Gapic::Operation. You can use this
1090
+ # # object to check the status of an operation, cancel it, or wait
1091
+ # # for results. Here is how to block until completion:
1092
+ # result.wait_until_done! timeout: 60
1093
+ # if result.response?
1094
+ # p result.response
1095
+ # else
1096
+ # puts "Error!"
1097
+ # end
1098
+ #
1099
+ def deploy_processor_version request, options = nil
1100
+ raise ::ArgumentError, "request must be provided" if request.nil?
1101
+
1102
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DeployProcessorVersionRequest
1103
+
1104
+ # Converts hash and nil to an options object
1105
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1106
+
1107
+ # Customize the options with defaults
1108
+ metadata = @config.rpcs.deploy_processor_version.metadata.to_h
1109
+
1110
+ # Set x-goog-api-client and x-goog-user-project headers
1111
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1112
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1113
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
1114
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1115
+
1116
+ header_params = {}
1117
+ if request.name
1118
+ header_params["name"] = request.name
1119
+ end
1120
+
1121
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1122
+ metadata[:"x-goog-request-params"] ||= request_params_header
1123
+
1124
+ options.apply_defaults timeout: @config.rpcs.deploy_processor_version.timeout,
1125
+ metadata: metadata,
1126
+ retry_policy: @config.rpcs.deploy_processor_version.retry_policy
1127
+
1128
+ options.apply_defaults timeout: @config.timeout,
1129
+ metadata: @config.metadata,
1130
+ retry_policy: @config.retry_policy
1131
+
1132
+ @document_processor_service_stub.call_rpc :deploy_processor_version, request, options: options do |response, operation|
1133
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1134
+ yield response, operation if block_given?
1135
+ return response
1136
+ end
1137
+ rescue ::GRPC::BadStatus => e
1138
+ raise ::Google::Cloud::Error.from_error(e)
1139
+ end
1140
+
1141
+ ##
1142
+ # Undeploys the processor version.
1143
+ #
1144
+ # @overload undeploy_processor_version(request, options = nil)
1145
+ # Pass arguments to `undeploy_processor_version` via a request object, either of type
1146
+ # {::Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest} or an equivalent Hash.
1147
+ #
1148
+ # @param request [::Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest, ::Hash]
1149
+ # A request object representing the call parameters. Required. To specify no
1150
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1151
+ # @param options [::Gapic::CallOptions, ::Hash]
1152
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1153
+ #
1154
+ # @overload undeploy_processor_version(name: nil)
1155
+ # Pass arguments to `undeploy_processor_version` via keyword arguments. Note that at
1156
+ # least one keyword argument is required. To specify no parameters, or to keep all
1157
+ # the default parameter values, pass an empty Hash as a request object (see above).
1158
+ #
1159
+ # @param name [::String]
1160
+ # Required. The processor version resource name to be undeployed.
1161
+ #
1162
+ # @yield [response, operation] Access the result along with the RPC operation
1163
+ # @yieldparam response [::Gapic::Operation]
1164
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1165
+ #
1166
+ # @return [::Gapic::Operation]
1167
+ #
1168
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1169
+ #
1170
+ # @example Basic example
1171
+ # require "google/cloud/document_ai/v1"
1172
+ #
1173
+ # # Create a client object. The client can be reused for multiple calls.
1174
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
1175
+ #
1176
+ # # Create a request. To set request fields, pass in keyword arguments.
1177
+ # request = Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest.new
1178
+ #
1179
+ # # Call the undeploy_processor_version method.
1180
+ # result = client.undeploy_processor_version request
1181
+ #
1182
+ # # The returned object is of type Gapic::Operation. You can use this
1183
+ # # object to check the status of an operation, cancel it, or wait
1184
+ # # for results. Here is how to block until completion:
1185
+ # result.wait_until_done! timeout: 60
1186
+ # if result.response?
1187
+ # p result.response
1188
+ # else
1189
+ # puts "Error!"
1190
+ # end
1191
+ #
1192
+ def undeploy_processor_version request, options = nil
1193
+ raise ::ArgumentError, "request must be provided" if request.nil?
1194
+
1195
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::UndeployProcessorVersionRequest
1196
+
1197
+ # Converts hash and nil to an options object
1198
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1199
+
1200
+ # Customize the options with defaults
1201
+ metadata = @config.rpcs.undeploy_processor_version.metadata.to_h
1202
+
1203
+ # Set x-goog-api-client and x-goog-user-project headers
1204
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1205
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1206
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
1207
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1208
+
1209
+ header_params = {}
1210
+ if request.name
1211
+ header_params["name"] = request.name
1212
+ end
1213
+
1214
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1215
+ metadata[:"x-goog-request-params"] ||= request_params_header
1216
+
1217
+ options.apply_defaults timeout: @config.rpcs.undeploy_processor_version.timeout,
1218
+ metadata: metadata,
1219
+ retry_policy: @config.rpcs.undeploy_processor_version.retry_policy
1220
+
1221
+ options.apply_defaults timeout: @config.timeout,
1222
+ metadata: @config.metadata,
1223
+ retry_policy: @config.retry_policy
1224
+
1225
+ @document_processor_service_stub.call_rpc :undeploy_processor_version, request, options: options do |response, operation|
1226
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1227
+ yield response, operation if block_given?
1228
+ return response
1229
+ end
1230
+ rescue ::GRPC::BadStatus => e
1231
+ raise ::Google::Cloud::Error.from_error(e)
1232
+ end
1233
+
1234
+ ##
1235
+ # Creates a processor from the type processor that the user chose.
1236
+ # The processor will be at "ENABLED" state by default after its creation.
1237
+ #
1238
+ # @overload create_processor(request, options = nil)
1239
+ # Pass arguments to `create_processor` via a request object, either of type
1240
+ # {::Google::Cloud::DocumentAI::V1::CreateProcessorRequest} or an equivalent Hash.
1241
+ #
1242
+ # @param request [::Google::Cloud::DocumentAI::V1::CreateProcessorRequest, ::Hash]
1243
+ # A request object representing the call parameters. Required. To specify no
1244
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1245
+ # @param options [::Gapic::CallOptions, ::Hash]
1246
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1247
+ #
1248
+ # @overload create_processor(parent: nil, processor: nil)
1249
+ # Pass arguments to `create_processor` via keyword arguments. Note that at
1250
+ # least one keyword argument is required. To specify no parameters, or to keep all
1251
+ # the default parameter values, pass an empty Hash as a request object (see above).
1252
+ #
1253
+ # @param parent [::String]
1254
+ # Required. The parent (project and location) under which to create the processor.
1255
+ # Format: `projects/{project}/locations/{location}`
1256
+ # @param processor [::Google::Cloud::DocumentAI::V1::Processor, ::Hash]
1257
+ # Required. The processor to be created, requires [processor_type] and [display_name]
1258
+ # to be set. Also, the processor is under CMEK if CMEK fields are set.
1259
+ #
1260
+ # @yield [response, operation] Access the result along with the RPC operation
1261
+ # @yieldparam response [::Google::Cloud::DocumentAI::V1::Processor]
1262
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1263
+ #
1264
+ # @return [::Google::Cloud::DocumentAI::V1::Processor]
1265
+ #
1266
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1267
+ #
1268
+ # @example Basic example
1269
+ # require "google/cloud/document_ai/v1"
1270
+ #
1271
+ # # Create a client object. The client can be reused for multiple calls.
1272
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
1273
+ #
1274
+ # # Create a request. To set request fields, pass in keyword arguments.
1275
+ # request = Google::Cloud::DocumentAI::V1::CreateProcessorRequest.new
1276
+ #
1277
+ # # Call the create_processor method.
1278
+ # result = client.create_processor request
1279
+ #
1280
+ # # The returned object is of type Google::Cloud::DocumentAI::V1::Processor.
1281
+ # p result
1282
+ #
1283
+ def create_processor request, options = nil
1284
+ raise ::ArgumentError, "request must be provided" if request.nil?
1285
+
1286
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::CreateProcessorRequest
1287
+
1288
+ # Converts hash and nil to an options object
1289
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1290
+
1291
+ # Customize the options with defaults
1292
+ metadata = @config.rpcs.create_processor.metadata.to_h
1293
+
1294
+ # Set x-goog-api-client and x-goog-user-project headers
1295
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1296
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1297
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
1298
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1299
+
1300
+ header_params = {}
1301
+ if request.parent
1302
+ header_params["parent"] = request.parent
1303
+ end
1304
+
1305
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1306
+ metadata[:"x-goog-request-params"] ||= request_params_header
1307
+
1308
+ options.apply_defaults timeout: @config.rpcs.create_processor.timeout,
1309
+ metadata: metadata,
1310
+ retry_policy: @config.rpcs.create_processor.retry_policy
1311
+
1312
+ options.apply_defaults timeout: @config.timeout,
1313
+ metadata: @config.metadata,
1314
+ retry_policy: @config.retry_policy
1315
+
1316
+ @document_processor_service_stub.call_rpc :create_processor, request, options: options do |response, operation|
1317
+ yield response, operation if block_given?
1318
+ return response
1319
+ end
1320
+ rescue ::GRPC::BadStatus => e
1321
+ raise ::Google::Cloud::Error.from_error(e)
1322
+ end
1323
+
1324
+ ##
1325
+ # Deletes the processor, unloads all deployed model artifacts if it was
1326
+ # enabled and then deletes all artifacts associated with this processor.
171
1327
  #
172
- # @return [::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Operations]
1328
+ # @overload delete_processor(request, options = nil)
1329
+ # Pass arguments to `delete_processor` via a request object, either of type
1330
+ # {::Google::Cloud::DocumentAI::V1::DeleteProcessorRequest} or an equivalent Hash.
173
1331
  #
174
- attr_reader :operations_client
1332
+ # @param request [::Google::Cloud::DocumentAI::V1::DeleteProcessorRequest, ::Hash]
1333
+ # A request object representing the call parameters. Required. To specify no
1334
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1335
+ # @param options [::Gapic::CallOptions, ::Hash]
1336
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1337
+ #
1338
+ # @overload delete_processor(name: nil)
1339
+ # Pass arguments to `delete_processor` via keyword arguments. Note that at
1340
+ # least one keyword argument is required. To specify no parameters, or to keep all
1341
+ # the default parameter values, pass an empty Hash as a request object (see above).
1342
+ #
1343
+ # @param name [::String]
1344
+ # Required. The processor resource name to be deleted.
1345
+ #
1346
+ # @yield [response, operation] Access the result along with the RPC operation
1347
+ # @yieldparam response [::Gapic::Operation]
1348
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1349
+ #
1350
+ # @return [::Gapic::Operation]
1351
+ #
1352
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1353
+ #
1354
+ # @example Basic example
1355
+ # require "google/cloud/document_ai/v1"
1356
+ #
1357
+ # # Create a client object. The client can be reused for multiple calls.
1358
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
1359
+ #
1360
+ # # Create a request. To set request fields, pass in keyword arguments.
1361
+ # request = Google::Cloud::DocumentAI::V1::DeleteProcessorRequest.new
1362
+ #
1363
+ # # Call the delete_processor method.
1364
+ # result = client.delete_processor request
1365
+ #
1366
+ # # The returned object is of type Gapic::Operation. You can use this
1367
+ # # object to check the status of an operation, cancel it, or wait
1368
+ # # for results. Here is how to block until completion:
1369
+ # result.wait_until_done! timeout: 60
1370
+ # if result.response?
1371
+ # p result.response
1372
+ # else
1373
+ # puts "Error!"
1374
+ # end
1375
+ #
1376
+ def delete_processor request, options = nil
1377
+ raise ::ArgumentError, "request must be provided" if request.nil?
175
1378
 
176
- # Service calls
1379
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DeleteProcessorRequest
1380
+
1381
+ # Converts hash and nil to an options object
1382
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1383
+
1384
+ # Customize the options with defaults
1385
+ metadata = @config.rpcs.delete_processor.metadata.to_h
1386
+
1387
+ # Set x-goog-api-client and x-goog-user-project headers
1388
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1389
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1390
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
1391
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1392
+
1393
+ header_params = {}
1394
+ if request.name
1395
+ header_params["name"] = request.name
1396
+ end
1397
+
1398
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1399
+ metadata[:"x-goog-request-params"] ||= request_params_header
1400
+
1401
+ options.apply_defaults timeout: @config.rpcs.delete_processor.timeout,
1402
+ metadata: metadata,
1403
+ retry_policy: @config.rpcs.delete_processor.retry_policy
1404
+
1405
+ options.apply_defaults timeout: @config.timeout,
1406
+ metadata: @config.metadata,
1407
+ retry_policy: @config.retry_policy
1408
+
1409
+ @document_processor_service_stub.call_rpc :delete_processor, request, options: options do |response, operation|
1410
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1411
+ yield response, operation if block_given?
1412
+ return response
1413
+ end
1414
+ rescue ::GRPC::BadStatus => e
1415
+ raise ::Google::Cloud::Error.from_error(e)
1416
+ end
177
1417
 
178
1418
  ##
179
- # Processes a single document.
1419
+ # Enables a processor
180
1420
  #
181
- # @overload process_document(request, options = nil)
182
- # Pass arguments to `process_document` via a request object, either of type
183
- # {::Google::Cloud::DocumentAI::V1::ProcessRequest} or an equivalent Hash.
1421
+ # @overload enable_processor(request, options = nil)
1422
+ # Pass arguments to `enable_processor` via a request object, either of type
1423
+ # {::Google::Cloud::DocumentAI::V1::EnableProcessorRequest} or an equivalent Hash.
184
1424
  #
185
- # @param request [::Google::Cloud::DocumentAI::V1::ProcessRequest, ::Hash]
1425
+ # @param request [::Google::Cloud::DocumentAI::V1::EnableProcessorRequest, ::Hash]
186
1426
  # A request object representing the call parameters. Required. To specify no
187
1427
  # parameters, or to keep all the default parameter values, pass an empty Hash.
188
1428
  # @param options [::Gapic::CallOptions, ::Hash]
189
1429
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
190
1430
  #
191
- # @overload process_document(inline_document: nil, raw_document: nil, name: nil, skip_human_review: nil)
192
- # Pass arguments to `process_document` via keyword arguments. Note that at
1431
+ # @overload enable_processor(name: nil)
1432
+ # Pass arguments to `enable_processor` via keyword arguments. Note that at
193
1433
  # least one keyword argument is required. To specify no parameters, or to keep all
194
1434
  # the default parameter values, pass an empty Hash as a request object (see above).
195
1435
  #
196
- # @param inline_document [::Google::Cloud::DocumentAI::V1::Document, ::Hash]
197
- # An inline document proto.
198
- # @param raw_document [::Google::Cloud::DocumentAI::V1::RawDocument, ::Hash]
199
- # A raw document content (bytes).
200
1436
  # @param name [::String]
201
- # Required. The processor resource name.
202
- # @param skip_human_review [::Boolean]
203
- # Whether Human Review feature should be skipped for this request. Default to
204
- # false.
1437
+ # Required. The processor resource name to be enabled.
205
1438
  #
206
1439
  # @yield [response, operation] Access the result along with the RPC operation
207
- # @yieldparam response [::Google::Cloud::DocumentAI::V1::ProcessResponse]
1440
+ # @yieldparam response [::Gapic::Operation]
208
1441
  # @yieldparam operation [::GRPC::ActiveCall::Operation]
209
1442
  #
210
- # @return [::Google::Cloud::DocumentAI::V1::ProcessResponse]
1443
+ # @return [::Gapic::Operation]
211
1444
  #
212
1445
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
213
1446
  #
@@ -218,24 +1451,31 @@ module Google
218
1451
  # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
219
1452
  #
220
1453
  # # Create a request. To set request fields, pass in keyword arguments.
221
- # request = Google::Cloud::DocumentAI::V1::ProcessRequest.new
1454
+ # request = Google::Cloud::DocumentAI::V1::EnableProcessorRequest.new
222
1455
  #
223
- # # Call the process_document method.
224
- # result = client.process_document request
1456
+ # # Call the enable_processor method.
1457
+ # result = client.enable_processor request
225
1458
  #
226
- # # The returned object is of type Google::Cloud::DocumentAI::V1::ProcessResponse.
227
- # p result
1459
+ # # The returned object is of type Gapic::Operation. You can use this
1460
+ # # object to check the status of an operation, cancel it, or wait
1461
+ # # for results. Here is how to block until completion:
1462
+ # result.wait_until_done! timeout: 60
1463
+ # if result.response?
1464
+ # p result.response
1465
+ # else
1466
+ # puts "Error!"
1467
+ # end
228
1468
  #
229
- def process_document request, options = nil
1469
+ def enable_processor request, options = nil
230
1470
  raise ::ArgumentError, "request must be provided" if request.nil?
231
1471
 
232
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::ProcessRequest
1472
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::EnableProcessorRequest
233
1473
 
234
1474
  # Converts hash and nil to an options object
235
1475
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
236
1476
 
237
1477
  # Customize the options with defaults
238
- metadata = @config.rpcs.process_document.metadata.to_h
1478
+ metadata = @config.rpcs.enable_processor.metadata.to_h
239
1479
 
240
1480
  # Set x-goog-api-client and x-goog-user-project headers
241
1481
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -251,15 +1491,16 @@ module Google
251
1491
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
252
1492
  metadata[:"x-goog-request-params"] ||= request_params_header
253
1493
 
254
- options.apply_defaults timeout: @config.rpcs.process_document.timeout,
1494
+ options.apply_defaults timeout: @config.rpcs.enable_processor.timeout,
255
1495
  metadata: metadata,
256
- retry_policy: @config.rpcs.process_document.retry_policy
1496
+ retry_policy: @config.rpcs.enable_processor.retry_policy
257
1497
 
258
1498
  options.apply_defaults timeout: @config.timeout,
259
1499
  metadata: @config.metadata,
260
1500
  retry_policy: @config.retry_policy
261
1501
 
262
- @document_processor_service_stub.call_rpc :process_document, request, options: options do |response, operation|
1502
+ @document_processor_service_stub.call_rpc :enable_processor, request, options: options do |response, operation|
1503
+ response = ::Gapic::Operation.new response, @operations_client, options: options
263
1504
  yield response, operation if block_given?
264
1505
  return response
265
1506
  end
@@ -268,33 +1509,25 @@ module Google
268
1509
  end
269
1510
 
270
1511
  ##
271
- # LRO endpoint to batch process many documents. The output is written
272
- # to Cloud Storage as JSON in the [Document] format.
1512
+ # Disables a processor
273
1513
  #
274
- # @overload batch_process_documents(request, options = nil)
275
- # Pass arguments to `batch_process_documents` via a request object, either of type
276
- # {::Google::Cloud::DocumentAI::V1::BatchProcessRequest} or an equivalent Hash.
1514
+ # @overload disable_processor(request, options = nil)
1515
+ # Pass arguments to `disable_processor` via a request object, either of type
1516
+ # {::Google::Cloud::DocumentAI::V1::DisableProcessorRequest} or an equivalent Hash.
277
1517
  #
278
- # @param request [::Google::Cloud::DocumentAI::V1::BatchProcessRequest, ::Hash]
1518
+ # @param request [::Google::Cloud::DocumentAI::V1::DisableProcessorRequest, ::Hash]
279
1519
  # A request object representing the call parameters. Required. To specify no
280
1520
  # parameters, or to keep all the default parameter values, pass an empty Hash.
281
1521
  # @param options [::Gapic::CallOptions, ::Hash]
282
1522
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
283
1523
  #
284
- # @overload batch_process_documents(name: nil, input_documents: nil, document_output_config: nil, skip_human_review: nil)
285
- # Pass arguments to `batch_process_documents` via keyword arguments. Note that at
1524
+ # @overload disable_processor(name: nil)
1525
+ # Pass arguments to `disable_processor` via keyword arguments. Note that at
286
1526
  # least one keyword argument is required. To specify no parameters, or to keep all
287
1527
  # the default parameter values, pass an empty Hash as a request object (see above).
288
1528
  #
289
1529
  # @param name [::String]
290
- # Required. The processor resource name.
291
- # @param input_documents [::Google::Cloud::DocumentAI::V1::BatchDocumentsInputConfig, ::Hash]
292
- # The input documents for batch process.
293
- # @param document_output_config [::Google::Cloud::DocumentAI::V1::DocumentOutputConfig, ::Hash]
294
- # The overall output config for batch process.
295
- # @param skip_human_review [::Boolean]
296
- # Whether Human Review feature should be skipped for this request. Default to
297
- # false.
1530
+ # Required. The processor resource name to be disabled.
298
1531
  #
299
1532
  # @yield [response, operation] Access the result along with the RPC operation
300
1533
  # @yieldparam response [::Gapic::Operation]
@@ -311,10 +1544,10 @@ module Google
311
1544
  # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
312
1545
  #
313
1546
  # # Create a request. To set request fields, pass in keyword arguments.
314
- # request = Google::Cloud::DocumentAI::V1::BatchProcessRequest.new
1547
+ # request = Google::Cloud::DocumentAI::V1::DisableProcessorRequest.new
315
1548
  #
316
- # # Call the batch_process_documents method.
317
- # result = client.batch_process_documents request
1549
+ # # Call the disable_processor method.
1550
+ # result = client.disable_processor request
318
1551
  #
319
1552
  # # The returned object is of type Gapic::Operation. You can use this
320
1553
  # # object to check the status of an operation, cancel it, or wait
@@ -326,16 +1559,16 @@ module Google
326
1559
  # puts "Error!"
327
1560
  # end
328
1561
  #
329
- def batch_process_documents request, options = nil
1562
+ def disable_processor request, options = nil
330
1563
  raise ::ArgumentError, "request must be provided" if request.nil?
331
1564
 
332
- request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::BatchProcessRequest
1565
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::DisableProcessorRequest
333
1566
 
334
1567
  # Converts hash and nil to an options object
335
1568
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
336
1569
 
337
1570
  # Customize the options with defaults
338
- metadata = @config.rpcs.batch_process_documents.metadata.to_h
1571
+ metadata = @config.rpcs.disable_processor.metadata.to_h
339
1572
 
340
1573
  # Set x-goog-api-client and x-goog-user-project headers
341
1574
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
@@ -351,15 +1584,114 @@ module Google
351
1584
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
352
1585
  metadata[:"x-goog-request-params"] ||= request_params_header
353
1586
 
354
- options.apply_defaults timeout: @config.rpcs.batch_process_documents.timeout,
1587
+ options.apply_defaults timeout: @config.rpcs.disable_processor.timeout,
355
1588
  metadata: metadata,
356
- retry_policy: @config.rpcs.batch_process_documents.retry_policy
1589
+ retry_policy: @config.rpcs.disable_processor.retry_policy
357
1590
 
358
1591
  options.apply_defaults timeout: @config.timeout,
359
1592
  metadata: @config.metadata,
360
1593
  retry_policy: @config.retry_policy
361
1594
 
362
- @document_processor_service_stub.call_rpc :batch_process_documents, request, options: options do |response, operation|
1595
+ @document_processor_service_stub.call_rpc :disable_processor, request, options: options do |response, operation|
1596
+ response = ::Gapic::Operation.new response, @operations_client, options: options
1597
+ yield response, operation if block_given?
1598
+ return response
1599
+ end
1600
+ rescue ::GRPC::BadStatus => e
1601
+ raise ::Google::Cloud::Error.from_error(e)
1602
+ end
1603
+
1604
+ ##
1605
+ # Set the default (active) version of a {::Google::Cloud::DocumentAI::V1::Processor Processor} that will be used in
1606
+ # {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client#process_document ProcessDocument} and
1607
+ # {::Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client#batch_process_documents BatchProcessDocuments}.
1608
+ #
1609
+ # @overload set_default_processor_version(request, options = nil)
1610
+ # Pass arguments to `set_default_processor_version` via a request object, either of type
1611
+ # {::Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest} or an equivalent Hash.
1612
+ #
1613
+ # @param request [::Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest, ::Hash]
1614
+ # A request object representing the call parameters. Required. To specify no
1615
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1616
+ # @param options [::Gapic::CallOptions, ::Hash]
1617
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
1618
+ #
1619
+ # @overload set_default_processor_version(processor: nil, default_processor_version: nil)
1620
+ # Pass arguments to `set_default_processor_version` via keyword arguments. Note that at
1621
+ # least one keyword argument is required. To specify no parameters, or to keep all
1622
+ # the default parameter values, pass an empty Hash as a request object (see above).
1623
+ #
1624
+ # @param processor [::String]
1625
+ # Required. The resource name of the {::Google::Cloud::DocumentAI::V1::Processor Processor} to change default version.
1626
+ # @param default_processor_version [::String]
1627
+ # Required. The resource name of child {::Google::Cloud::DocumentAI::V1::ProcessorVersion ProcessorVersion} to use as default.
1628
+ # Format:
1629
+ # `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
1630
+ #
1631
+ # @yield [response, operation] Access the result along with the RPC operation
1632
+ # @yieldparam response [::Gapic::Operation]
1633
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
1634
+ #
1635
+ # @return [::Gapic::Operation]
1636
+ #
1637
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
1638
+ #
1639
+ # @example Basic example
1640
+ # require "google/cloud/document_ai/v1"
1641
+ #
1642
+ # # Create a client object. The client can be reused for multiple calls.
1643
+ # client = Google::Cloud::DocumentAI::V1::DocumentProcessorService::Client.new
1644
+ #
1645
+ # # Create a request. To set request fields, pass in keyword arguments.
1646
+ # request = Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest.new
1647
+ #
1648
+ # # Call the set_default_processor_version method.
1649
+ # result = client.set_default_processor_version request
1650
+ #
1651
+ # # The returned object is of type Gapic::Operation. You can use this
1652
+ # # object to check the status of an operation, cancel it, or wait
1653
+ # # for results. Here is how to block until completion:
1654
+ # result.wait_until_done! timeout: 60
1655
+ # if result.response?
1656
+ # p result.response
1657
+ # else
1658
+ # puts "Error!"
1659
+ # end
1660
+ #
1661
+ def set_default_processor_version request, options = nil
1662
+ raise ::ArgumentError, "request must be provided" if request.nil?
1663
+
1664
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DocumentAI::V1::SetDefaultProcessorVersionRequest
1665
+
1666
+ # Converts hash and nil to an options object
1667
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1668
+
1669
+ # Customize the options with defaults
1670
+ metadata = @config.rpcs.set_default_processor_version.metadata.to_h
1671
+
1672
+ # Set x-goog-api-client and x-goog-user-project headers
1673
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1674
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1675
+ gapic_version: ::Google::Cloud::DocumentAI::V1::VERSION
1676
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1677
+
1678
+ header_params = {}
1679
+ if request.processor
1680
+ header_params["processor"] = request.processor
1681
+ end
1682
+
1683
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1684
+ metadata[:"x-goog-request-params"] ||= request_params_header
1685
+
1686
+ options.apply_defaults timeout: @config.rpcs.set_default_processor_version.timeout,
1687
+ metadata: metadata,
1688
+ retry_policy: @config.rpcs.set_default_processor_version.retry_policy
1689
+
1690
+ options.apply_defaults timeout: @config.timeout,
1691
+ metadata: @config.metadata,
1692
+ retry_policy: @config.retry_policy
1693
+
1694
+ @document_processor_service_stub.call_rpc :set_default_processor_version, request, options: options do |response, operation|
363
1695
  response = ::Gapic::Operation.new response, @operations_client, options: options
364
1696
  yield response, operation if block_given?
365
1697
  return response
@@ -382,7 +1714,7 @@ module Google
382
1714
  # @param options [::Gapic::CallOptions, ::Hash]
383
1715
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
384
1716
  #
385
- # @overload review_document(inline_document: nil, human_review_config: nil, enable_schema_validation: nil, priority: nil)
1717
+ # @overload review_document(inline_document: nil, human_review_config: nil, enable_schema_validation: nil, priority: nil, document_schema: nil)
386
1718
  # Pass arguments to `review_document` via keyword arguments. Note that at
387
1719
  # least one keyword argument is required. To specify no parameters, or to keep all
388
1720
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -396,6 +1728,8 @@ module Google
396
1728
  # Whether the validation should be performed on the ad-hoc review request.
397
1729
  # @param priority [::Google::Cloud::DocumentAI::V1::ReviewDocumentRequest::Priority]
398
1730
  # The priority of the human review task.
1731
+ # @param document_schema [::Google::Cloud::DocumentAI::V1::DocumentSchema, ::Hash]
1732
+ # The document schema of the human review task.
399
1733
  #
400
1734
  # @yield [response, operation] Access the result along with the RPC operation
401
1735
  # @yieldparam response [::Gapic::Operation]
@@ -615,6 +1949,76 @@ module Google
615
1949
  #
616
1950
  attr_reader :batch_process_documents
617
1951
  ##
1952
+ # RPC-specific configuration for `fetch_processor_types`
1953
+ # @return [::Gapic::Config::Method]
1954
+ #
1955
+ attr_reader :fetch_processor_types
1956
+ ##
1957
+ # RPC-specific configuration for `list_processor_types`
1958
+ # @return [::Gapic::Config::Method]
1959
+ #
1960
+ attr_reader :list_processor_types
1961
+ ##
1962
+ # RPC-specific configuration for `list_processors`
1963
+ # @return [::Gapic::Config::Method]
1964
+ #
1965
+ attr_reader :list_processors
1966
+ ##
1967
+ # RPC-specific configuration for `get_processor`
1968
+ # @return [::Gapic::Config::Method]
1969
+ #
1970
+ attr_reader :get_processor
1971
+ ##
1972
+ # RPC-specific configuration for `get_processor_version`
1973
+ # @return [::Gapic::Config::Method]
1974
+ #
1975
+ attr_reader :get_processor_version
1976
+ ##
1977
+ # RPC-specific configuration for `list_processor_versions`
1978
+ # @return [::Gapic::Config::Method]
1979
+ #
1980
+ attr_reader :list_processor_versions
1981
+ ##
1982
+ # RPC-specific configuration for `delete_processor_version`
1983
+ # @return [::Gapic::Config::Method]
1984
+ #
1985
+ attr_reader :delete_processor_version
1986
+ ##
1987
+ # RPC-specific configuration for `deploy_processor_version`
1988
+ # @return [::Gapic::Config::Method]
1989
+ #
1990
+ attr_reader :deploy_processor_version
1991
+ ##
1992
+ # RPC-specific configuration for `undeploy_processor_version`
1993
+ # @return [::Gapic::Config::Method]
1994
+ #
1995
+ attr_reader :undeploy_processor_version
1996
+ ##
1997
+ # RPC-specific configuration for `create_processor`
1998
+ # @return [::Gapic::Config::Method]
1999
+ #
2000
+ attr_reader :create_processor
2001
+ ##
2002
+ # RPC-specific configuration for `delete_processor`
2003
+ # @return [::Gapic::Config::Method]
2004
+ #
2005
+ attr_reader :delete_processor
2006
+ ##
2007
+ # RPC-specific configuration for `enable_processor`
2008
+ # @return [::Gapic::Config::Method]
2009
+ #
2010
+ attr_reader :enable_processor
2011
+ ##
2012
+ # RPC-specific configuration for `disable_processor`
2013
+ # @return [::Gapic::Config::Method]
2014
+ #
2015
+ attr_reader :disable_processor
2016
+ ##
2017
+ # RPC-specific configuration for `set_default_processor_version`
2018
+ # @return [::Gapic::Config::Method]
2019
+ #
2020
+ attr_reader :set_default_processor_version
2021
+ ##
618
2022
  # RPC-specific configuration for `review_document`
619
2023
  # @return [::Gapic::Config::Method]
620
2024
  #
@@ -626,6 +2030,34 @@ module Google
626
2030
  @process_document = ::Gapic::Config::Method.new process_document_config
627
2031
  batch_process_documents_config = parent_rpcs.batch_process_documents if parent_rpcs.respond_to? :batch_process_documents
628
2032
  @batch_process_documents = ::Gapic::Config::Method.new batch_process_documents_config
2033
+ fetch_processor_types_config = parent_rpcs.fetch_processor_types if parent_rpcs.respond_to? :fetch_processor_types
2034
+ @fetch_processor_types = ::Gapic::Config::Method.new fetch_processor_types_config
2035
+ list_processor_types_config = parent_rpcs.list_processor_types if parent_rpcs.respond_to? :list_processor_types
2036
+ @list_processor_types = ::Gapic::Config::Method.new list_processor_types_config
2037
+ list_processors_config = parent_rpcs.list_processors if parent_rpcs.respond_to? :list_processors
2038
+ @list_processors = ::Gapic::Config::Method.new list_processors_config
2039
+ get_processor_config = parent_rpcs.get_processor if parent_rpcs.respond_to? :get_processor
2040
+ @get_processor = ::Gapic::Config::Method.new get_processor_config
2041
+ get_processor_version_config = parent_rpcs.get_processor_version if parent_rpcs.respond_to? :get_processor_version
2042
+ @get_processor_version = ::Gapic::Config::Method.new get_processor_version_config
2043
+ list_processor_versions_config = parent_rpcs.list_processor_versions if parent_rpcs.respond_to? :list_processor_versions
2044
+ @list_processor_versions = ::Gapic::Config::Method.new list_processor_versions_config
2045
+ delete_processor_version_config = parent_rpcs.delete_processor_version if parent_rpcs.respond_to? :delete_processor_version
2046
+ @delete_processor_version = ::Gapic::Config::Method.new delete_processor_version_config
2047
+ deploy_processor_version_config = parent_rpcs.deploy_processor_version if parent_rpcs.respond_to? :deploy_processor_version
2048
+ @deploy_processor_version = ::Gapic::Config::Method.new deploy_processor_version_config
2049
+ undeploy_processor_version_config = parent_rpcs.undeploy_processor_version if parent_rpcs.respond_to? :undeploy_processor_version
2050
+ @undeploy_processor_version = ::Gapic::Config::Method.new undeploy_processor_version_config
2051
+ create_processor_config = parent_rpcs.create_processor if parent_rpcs.respond_to? :create_processor
2052
+ @create_processor = ::Gapic::Config::Method.new create_processor_config
2053
+ delete_processor_config = parent_rpcs.delete_processor if parent_rpcs.respond_to? :delete_processor
2054
+ @delete_processor = ::Gapic::Config::Method.new delete_processor_config
2055
+ enable_processor_config = parent_rpcs.enable_processor if parent_rpcs.respond_to? :enable_processor
2056
+ @enable_processor = ::Gapic::Config::Method.new enable_processor_config
2057
+ disable_processor_config = parent_rpcs.disable_processor if parent_rpcs.respond_to? :disable_processor
2058
+ @disable_processor = ::Gapic::Config::Method.new disable_processor_config
2059
+ set_default_processor_version_config = parent_rpcs.set_default_processor_version if parent_rpcs.respond_to? :set_default_processor_version
2060
+ @set_default_processor_version = ::Gapic::Config::Method.new set_default_processor_version_config
629
2061
  review_document_config = parent_rpcs.review_document if parent_rpcs.respond_to? :review_document
630
2062
  @review_document = ::Gapic::Config::Method.new review_document_config
631
2063