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