google-cloud-document_ai-v1 0.2.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Api
22
+ # The launch stage as defined by [Google Cloud Platform
23
+ # Launch Stages](http://cloud.google.com/terms/launch-stages).
24
+ module LaunchStage
25
+ # Do not use this default value.
26
+ LAUNCH_STAGE_UNSPECIFIED = 0
27
+
28
+ # The feature is not yet implemented. Users can not use it.
29
+ UNIMPLEMENTED = 6
30
+
31
+ # Prelaunch features are hidden from users and are only visible internally.
32
+ PRELAUNCH = 7
33
+
34
+ # Early Access features are limited to a closed group of testers. To use
35
+ # these features, you must sign up in advance and sign a Trusted Tester
36
+ # agreement (which includes confidentiality provisions). These features may
37
+ # be unstable, changed in backward-incompatible ways, and are not
38
+ # guaranteed to be released.
39
+ EARLY_ACCESS = 1
40
+
41
+ # Alpha is a limited availability test for releases before they are cleared
42
+ # for widespread use. By Alpha, all significant design issues are resolved
43
+ # and we are in the process of verifying functionality. Alpha customers
44
+ # need to apply for access, agree to applicable terms, and have their
45
+ # projects allowlisted. Alpha releases don’t have to be feature complete,
46
+ # no SLAs are provided, and there are no technical support obligations, but
47
+ # they will be far enough along that customers can actually use them in
48
+ # test environments or for limited-use tests -- just like they would in
49
+ # normal production cases.
50
+ ALPHA = 2
51
+
52
+ # Beta is the point at which we are ready to open a release for any
53
+ # customer to use. There are no SLA or technical support obligations in a
54
+ # Beta release. Products will be complete from a feature perspective, but
55
+ # may have some open outstanding issues. Beta releases are suitable for
56
+ # limited production use cases.
57
+ BETA = 3
58
+
59
+ # GA features are open to all developers and are considered stable and
60
+ # fully qualified for production use.
61
+ GA = 4
62
+
63
+ # Deprecated features are scheduled to be shut down and removed. For more
64
+ # information, see the “Deprecation Policy” section of our [Terms of
65
+ # Service](https://cloud.google.com/terms/)
66
+ # and the [Google Cloud Platform Subject to the Deprecation
67
+ # Policy](https://cloud.google.com/terms/deprecation) documentation.
68
+ DEPRECATED = 5
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2022 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+
20
+ module Google
21
+ module Cloud
22
+ module DocumentAI
23
+ module V1
24
+ # Encodes the detailed information of a barcode.
25
+ # @!attribute [rw] format
26
+ # @return [::String]
27
+ # Format of a barcode.
28
+ # The supported formats are:
29
+ # CODE_128: Code 128 type.
30
+ # CODE_39: Code 39 type.
31
+ # CODE_93: Code 93 type.
32
+ # CODABAR: Codabar type.
33
+ # DATA_MATRIX: 2D Data Matrix type.
34
+ # ITF: ITF type.
35
+ # EAN_13: EAN-13 type.
36
+ # EAN_8: EAN-8 type.
37
+ # QR_CODE: 2D QR code type.
38
+ # UPC_A: UPC-A type.
39
+ # UPC_E: UPC-E type.
40
+ # PDF417: PDF417 type.
41
+ # AZTEC: 2D Aztec code type.
42
+ # DATABAR: GS1 DataBar code type.
43
+ # @!attribute [rw] value_format
44
+ # @return [::String]
45
+ # Value format describes the format of the value that a barcode
46
+ # encodes.
47
+ # The supported formats are:
48
+ # CONTACT_INFO: Contact information.
49
+ # EMAIL: Email address.
50
+ # ISBN: ISBN identifier.
51
+ # PHONE: Phone number.
52
+ # PRODUCT: Product.
53
+ # SMS: SMS message.
54
+ # TEXT: Text string.
55
+ # URL: URL address.
56
+ # WIFI: Wifi information.
57
+ # GEO: Geo-localization.
58
+ # CALENDAR_EVENT: Calendar event.
59
+ # DRIVER_LICENSE: Driver's license.
60
+ # @!attribute [rw] raw_value
61
+ # @return [::String]
62
+ # Raw value encoded in the barcode.
63
+ # For example, 'MEBKM:TITLE:Google;URL:https://www.google.com;;'.
64
+ class Barcode
65
+ include ::Google::Protobuf::MessageExts
66
+ extend ::Google::Protobuf::MessageExts::ClassMethods
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -21,11 +21,10 @@ module Google
21
21
  module Cloud
22
22
  module DocumentAI
23
23
  module V1
24
- # Document represents the canonical document resource in Document Understanding
25
- # AI.
26
- # It is an interchange format that provides insights into documents and allows
27
- # for collaboration between users and Document Understanding AI to iterate and
28
- # optimize for quality.
24
+ # Document represents the canonical document resource in Document AI. It is an
25
+ # interchange format that provides insights into documents and allows for
26
+ # collaboration between users and Document AI to iterate and optimize for
27
+ # quality.
29
28
  # @!attribute [rw] uri
30
29
  # @return [::String]
31
30
  # Optional. Currently supports Google Cloud Storage URI of the form
@@ -48,7 +47,7 @@ module Google
48
47
  # Optional. UTF-8 encoded text in reading order from the document.
49
48
  # @!attribute [rw] text_styles
50
49
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Style>]
51
- # Styles for the {::Google::Cloud::DocumentAI::V1::Document#text Document.text}.
50
+ # Placeholder. Styles for the {::Google::Cloud::DocumentAI::V1::Document#text Document.text}.
52
51
  # @!attribute [rw] pages
53
52
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Page>]
54
53
  # Visual page layout for the {::Google::Cloud::DocumentAI::V1::Document Document}.
@@ -58,12 +57,12 @@ module Google
58
57
  # entities in this list may cross shard boundaries.
59
58
  # @!attribute [rw] entity_relations
60
59
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::EntityRelation>]
61
- # Relationship among {::Google::Cloud::DocumentAI::V1::Document#entities Document.entities}.
60
+ # Placeholder. Relationship among {::Google::Cloud::DocumentAI::V1::Document#entities Document.entities}.
62
61
  # @!attribute [rw] text_changes
63
62
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::TextChange>]
64
- # A list of text corrections made to [Document.text]. This is usually
65
- # used for annotating corrections to OCR mistakes. Text changes for a given
66
- # revision may not overlap with each other.
63
+ # Placeholder. A list of text corrections made to [Document.text]. This is
64
+ # usually used for annotating corrections to OCR mistakes. Text changes for
65
+ # a given revision may not overlap with each other.
67
66
  # @!attribute [rw] shard_info
68
67
  # @return [::Google::Cloud::DocumentAI::V1::Document::ShardInfo]
69
68
  # Information about the sharding if this document is sharded part of a larger
@@ -73,7 +72,7 @@ module Google
73
72
  # Any error that occurred while processing this document.
74
73
  # @!attribute [rw] revisions
75
74
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Revision>]
76
- # Revision history of this document.
75
+ # Placeholder. Revision history of this document.
77
76
  class Document
78
77
  include ::Google::Protobuf::MessageExts
79
78
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -190,6 +189,12 @@ module Google
190
189
  # @!attribute [rw] form_fields
191
190
  # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Page::FormField>]
192
191
  # A list of visually detected form fields on the page.
192
+ # @!attribute [rw] symbols
193
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Page::Symbol>]
194
+ # A list of visually detected symbols on the page.
195
+ # @!attribute [rw] detected_barcodes
196
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Page::DetectedBarcode>]
197
+ # A list of detected barcodes.
193
198
  # @!attribute [rw] provenance
194
199
  # @return [::Google::Cloud::DocumentAI::V1::Document::Provenance]
195
200
  # The history of this page.
@@ -382,6 +387,18 @@ module Google
382
387
  end
383
388
  end
384
389
 
390
+ # A detected symbol.
391
+ # @!attribute [rw] layout
392
+ # @return [::Google::Cloud::DocumentAI::V1::Document::Page::Layout]
393
+ # {::Google::Cloud::DocumentAI::V1::Document::Page::Layout Layout} for {::Google::Cloud::DocumentAI::V1::Document::Page::Symbol Symbol}.
394
+ # @!attribute [rw] detected_languages
395
+ # @return [::Array<::Google::Cloud::DocumentAI::V1::Document::Page::DetectedLanguage>]
396
+ # A list of detected languages together with confidence.
397
+ class Symbol
398
+ include ::Google::Protobuf::MessageExts
399
+ extend ::Google::Protobuf::MessageExts::ClassMethods
400
+ end
401
+
385
402
  # Detected non-text visual elements e.g. checkbox, signature etc. on the
386
403
  # page.
387
404
  # @!attribute [rw] layout
@@ -464,6 +481,16 @@ module Google
464
481
  # - blank (this indicates the field_value is normal text)
465
482
  # - "unfilled_checkbox"
466
483
  # - "filled_checkbox"
484
+ # @!attribute [rw] corrected_key_text
485
+ # @return [::String]
486
+ # Created for Labeling UI to export key text.
487
+ # If corrections were made to the text identified by the
488
+ # `field_name.text_anchor`, this field will contain the correction.
489
+ # @!attribute [rw] corrected_value_text
490
+ # @return [::String]
491
+ # Created for Labeling UI to export value text.
492
+ # If corrections were made to the text identified by the
493
+ # `field_value.text_anchor`, this field will contain the correction.
467
494
  # @!attribute [rw] provenance
468
495
  # @return [::Google::Cloud::DocumentAI::V1::Document::Provenance]
469
496
  # The history of this annotation.
@@ -472,12 +499,24 @@ module Google
472
499
  extend ::Google::Protobuf::MessageExts::ClassMethods
473
500
  end
474
501
 
502
+ # A detected barcode.
503
+ # @!attribute [rw] layout
504
+ # @return [::Google::Cloud::DocumentAI::V1::Document::Page::Layout]
505
+ # {::Google::Cloud::DocumentAI::V1::Document::Page::Layout Layout} for {::Google::Cloud::DocumentAI::V1::Document::Page::DetectedBarcode DetectedBarcode}.
506
+ # @!attribute [rw] barcode
507
+ # @return [::Google::Cloud::DocumentAI::V1::Barcode]
508
+ # Detailed barcode information of the {::Google::Cloud::DocumentAI::V1::Document::Page::DetectedBarcode DetectedBarcode}.
509
+ class DetectedBarcode
510
+ include ::Google::Protobuf::MessageExts
511
+ extend ::Google::Protobuf::MessageExts::ClassMethods
512
+ end
513
+
475
514
  # Detected language for a structural component.
476
515
  # @!attribute [rw] language_code
477
516
  # @return [::String]
478
517
  # The BCP-47 language code, such as "en-US" or "sr-Latn". For more
479
518
  # information, see
480
- # http://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
519
+ # https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.
481
520
  # @!attribute [rw] confidence
482
521
  # @return [::Float]
483
522
  # Confidence of detected language. Range [0, 1].
@@ -487,18 +526,20 @@ module Google
487
526
  end
488
527
  end
489
528
 
490
- # A phrase in the text that is a known entity type, such as a person, an
491
- # organization, or location.
529
+ # An entity that could be a phrase in the text or a property that belongs to
530
+ # the document. It is a known entity type, such as a person, an organization,
531
+ # or location.
492
532
  # @!attribute [rw] text_anchor
493
533
  # @return [::Google::Cloud::DocumentAI::V1::Document::TextAnchor]
494
534
  # Optional. Provenance of the entity.
495
535
  # Text anchor indexing into the {::Google::Cloud::DocumentAI::V1::Document#text Document.text}.
496
536
  # @!attribute [rw] type
497
537
  # @return [::String]
498
- # Entity type from a schema e.g. `Address`.
538
+ # Required. Entity type from a schema e.g. `Address`.
499
539
  # @!attribute [rw] mention_text
500
540
  # @return [::String]
501
- # Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`.
541
+ # Optional. Text value in the document e.g. `1600 Amphitheatre Pkwy`. If the entity
542
+ # is not present in the document, this field will be empty.
502
543
  # @!attribute [rw] mention_id
503
544
  # @return [::String]
504
545
  # Optional. Deprecated. Use `id` field instead.
@@ -554,12 +595,21 @@ module Google
554
595
  # @return [::Boolean]
555
596
  # Boolean value. Can be used for entities with binary values, or for
556
597
  # checkboxes.
598
+ # @!attribute [rw] integer_value
599
+ # @return [::Integer]
600
+ # Integer value.
601
+ # @!attribute [rw] float_value
602
+ # @return [::Float]
603
+ # Float value.
557
604
  # @!attribute [rw] text
558
605
  # @return [::String]
559
- # Required. Normalized entity value stored as a string. This field is populated for
560
- # supported document type (e.g. Invoice). For some entity types, one of
561
- # respective 'structured_value' fields may also be populated.
606
+ # Optional. An optional field to store a normalized string.
607
+ # For some entity types, one of respective `structured_value` fields may
608
+ # also be populated. Also not all the types of `structured_value` will be
609
+ # normalized. For example, some processors may not generate float
610
+ # or int normalized text by default.
562
611
  #
612
+ # Below are sample formats mapped to structured values.
563
613
  # - Money/Currency type (`money_value`) is in the ISO 4217 text format.
564
614
  # - Date type (`date_value`) is in the ISO 8601 text format.
565
615
  # - Datetime type (`datetime_value`) is in the ISO 8601 text format.
@@ -591,7 +641,8 @@ module Google
591
641
  # @!attribute [rw] content
592
642
  # @return [::String]
593
643
  # Contains the content of the text span so that users do
594
- # not have to look it up in the text_segments.
644
+ # not have to look it up in the text_segments. It is always
645
+ # populated for formFields.
595
646
  class TextAnchor
596
647
  include ::Google::Protobuf::MessageExts
597
648
  extend ::Google::Protobuf::MessageExts::ClassMethods
@@ -693,16 +744,15 @@ module Google
693
744
  include ::Google::Protobuf::MessageExts
694
745
  extend ::Google::Protobuf::MessageExts::ClassMethods
695
746
 
696
- # Structure for referencing parent provenances. When an element replaces
697
- # one of more other elements parent references identify the elements that
698
- # are replaced.
747
+ # The parent element the current element is based on. Used for
748
+ # referencing/aligning, removal and replacement operations.
699
749
  # @!attribute [rw] revision
700
750
  # @return [::Integer]
701
- # The index of the [Document.revisions] identifying the parent revision.
751
+ # The index of the index into current revision's parent_ids list.
702
752
  # @!attribute [rw] index
703
753
  # @return [::Integer]
704
- # The index of the parent revisions corresponding collection of items
705
- # (eg. list of entities, properties within entities, etc.)
754
+ # The index of the parent item in the corresponding item list (eg. list
755
+ # of entities, properties within entities, etc.) in the parent revision.
706
756
  # @!attribute [rw] id
707
757
  # @return [::Integer]
708
758
  # The id of the parent provenance.
@@ -713,19 +763,20 @@ module Google
713
763
 
714
764
  # If a processor or agent does an explicit operation on existing elements.
715
765
  module OperationType
716
- # Operation type unspecified.
766
+ # Operation type unspecified. If no operation is specified a provenance
767
+ # entry is simply used to match against a `parent`.
717
768
  OPERATION_TYPE_UNSPECIFIED = 0
718
769
 
719
- # Add an element. Implicit if no `parents` are set for the provenance.
770
+ # Add an element.
720
771
  ADD = 1
721
772
 
722
- # The element is removed. No `parents` should be set.
773
+ # Remove an element identified by `parent`.
723
774
  REMOVE = 2
724
775
 
725
- # Explicitly replaces the element(s) identified by `parents`.
776
+ # Replace an element identified by `parent`.
726
777
  REPLACE = 3
727
778
 
728
- # Element is requested for human review.
779
+ # Request human review for the element identified by `parent`.
729
780
  EVAL_REQUESTED = 4
730
781
 
731
782
  # Element is reviewed and approved at human review, confidence will be
@@ -754,6 +805,11 @@ module Google
754
805
  # The revisions that this revision is based on. This can include one or
755
806
  # more parent (when documents are merged.) This field represents the
756
807
  # index into the `revisions` field.
808
+ # @!attribute [rw] parent_ids
809
+ # @return [::Array<::String>]
810
+ # The revisions that this revision is based on. Must include all the ids
811
+ # that have anything to do with this revision - eg. there are
812
+ # `provenance.parent.revision` fields that index into this field.
757
813
  # @!attribute [rw] create_time
758
814
  # @return [::Google::Protobuf::Timestamp]
759
815
  # The time that the revision was created.