1- // Copyright 2020 Google LLC
1+ // Copyright 2021 Google LLC
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import "google/api/client.proto";
2121import "google/api/field_behavior.proto" ;
2222import "google/api/resource.proto" ;
2323import "google/cloud/documentai/v1beta3/document.proto" ;
24+ import "google/cloud/documentai/v1beta3/document_io.proto" ;
2425import "google/longrunning/operations.proto" ;
2526import "google/protobuf/field_mask.proto" ;
2627import "google/protobuf/timestamp.proto" ;
@@ -99,6 +100,15 @@ service DocumentProcessorService {
99100
100101// Request message for the process document method.
101102message ProcessRequest {
103+ // The document payload.
104+ oneof source {
105+ // An inline document proto.
106+ Document inline_document = 4 ;
107+
108+ // A raw document content (bytes).
109+ RawDocument raw_document = 5 ;
110+ }
111+
102112 // Required. The processor resource name.
103113 string name = 1 [
104114 (google.api.field_behavior ) = REQUIRED ,
@@ -108,13 +118,49 @@ message ProcessRequest {
108118 ];
109119
110120 // The document payload, the [content] and [mime_type] fields must be set.
111- Document document = 2 ;
121+ Document document = 2 [ deprecated = true ] ;
112122
113123 // Whether Human Review feature should be skipped for this request. Default to
114124 // false.
115125 bool skip_human_review = 3 ;
116126}
117127
128+ // The status of human review on a processed document.
129+ message HumanReviewStatus {
130+ // The final state of human review on a processed document.
131+ enum State {
132+ // Human review state is unspecified. Most likely due to an internal error.
133+ STATE_UNSPECIFIED = 0 ;
134+
135+ // Human review is skipped for the document. This can happen because human
136+ // review is not enabled on the processor or the processing request has
137+ // been set to skip this document.
138+ SKIPPED = 1 ;
139+
140+ // Human review validation is triggered and passed, so no review is needed.
141+ VALIDATION_PASSED = 2 ;
142+
143+ // Human review validation is triggered and the document is under review.
144+ IN_PROGRESS = 3 ;
145+
146+ // Some error happened during triggering human review, see the
147+ // [state_message] for details.
148+ ERROR = 4 ;
149+ }
150+
151+ // The state of human review on the processing request.
152+ State state = 1 ;
153+
154+ // A message providing more details about the human review state.
155+ string state_message = 2 ;
156+
157+ // The name of the operation triggered by the processed document. This field
158+ // is populated only when the [state] is [HUMAN_REVIEW_IN_PROGRESS]. It has
159+ // the same response type and metadata as the long running operation returned
160+ // by [ReviewDocument] method.
161+ string human_review_operation = 3 ;
162+ }
163+
118164// Response message for the process document method.
119165message ProcessResponse {
120166 // The document payload, will populate fields based on the processor's
@@ -125,13 +171,18 @@ message ProcessResponse {
125171 // review process is not triggered, this field will be empty. It has the same
126172 // response type and metadata as the long running operation returned by
127173 // ReviewDocument method.
128- string human_review_operation = 2 ;
174+ string human_review_operation = 2 [deprecated = true ];
175+
176+ // The status of human review on the processed document.
177+ HumanReviewStatus human_review_status = 3 ;
129178}
130179
131180// Request message for batch process document method.
132181message BatchProcessRequest {
133182 // The message for input config in batch process.
134183 message BatchInputConfig {
184+ option deprecated = true ;
185+
135186 // The Cloud Storage location as the source of the document.
136187 string gcs_source = 1 ;
137188
@@ -143,6 +194,8 @@ message BatchProcessRequest {
143194
144195 // The message for output config in batch process.
145196 message BatchOutputConfig {
197+ option deprecated = true ;
198+
146199 // The output Cloud Storage directory to put the processed documents.
147200 string gcs_destination = 1 ;
148201 }
@@ -156,10 +209,20 @@ message BatchProcessRequest {
156209 ];
157210
158211 // The input config for each single document in the batch process.
159- repeated BatchInputConfig input_configs = 2 ;
212+ repeated BatchInputConfig input_configs = 2 [ deprecated = true ] ;
160213
161214 // The overall output config for batch process.
162- BatchOutputConfig output_config = 3 ;
215+ BatchOutputConfig output_config = 3 [deprecated = true ];
216+
217+ // The input documents for batch process.
218+ BatchDocumentsInputConfig input_documents = 5 ;
219+
220+ // The overall output config for batch process.
221+ DocumentOutputConfig document_output_config = 6 ;
222+
223+ // Whether Human Review feature should be skipped for this request. Default to
224+ // false.
225+ bool skip_human_review = 4 ;
163226}
164227
165228// Response message for batch process document method.
@@ -188,7 +251,10 @@ message BatchProcessMetadata {
188251 // human review process is not triggered, this field will be empty. It has
189252 // the same response type and metadata as the long running operation
190253 // returned by ReviewDocument method.
191- string human_review_operation = 4 ;
254+ string human_review_operation = 4 [deprecated = true ];
255+
256+ // The status of human review on the processed document.
257+ HumanReviewStatus human_review_status = 5 ;
192258 }
193259
194260 // Possible states of the batch processing operation.
@@ -234,6 +300,12 @@ message BatchProcessMetadata {
234300
235301// Request message for review document method.
236302message ReviewDocumentRequest {
303+ // The document payload.
304+ oneof source {
305+ // An inline document proto.
306+ Document inline_document = 4 ;
307+ }
308+
237309 // Required. The resource name of the HumanReviewConfig that the document will be
238310 // reviewed with.
239311 string human_review_config = 1 [
@@ -244,7 +316,7 @@ message ReviewDocumentRequest {
244316 ];
245317
246318 // The document that needs human review.
247- Document document = 2 ;
319+ Document document = 2 [ deprecated = true ] ;
248320}
249321
250322// Response message for review document method.
@@ -288,4 +360,43 @@ message ReviewDocumentOperationMetadata {
288360
289361 // The last update time of the operation.
290362 google.protobuf.Timestamp update_time = 4 ;
363+
364+ // The basic metadata of the long running operation.
365+ CommonOperationMetadata common_metadata = 5 ;
366+ }
367+
368+ // The common metadata for long running operations.
369+ message CommonOperationMetadata {
370+ // State of the longrunning operation.
371+ enum State {
372+ // Unspecified state.
373+ STATE_UNSPECIFIED = 0 ;
374+
375+ // Operation is still running.
376+ RUNNING = 1 ;
377+
378+ // Operation is being cancelled.
379+ CANCELLING = 2 ;
380+
381+ // Operation succeeded.
382+ SUCCEEDED = 3 ;
383+
384+ // Operation failed.
385+ FAILED = 4 ;
386+
387+ // Operation is cancelled.
388+ CANCELLED = 5 ;
389+ }
390+
391+ // The state of the operation.
392+ State state = 1 ;
393+
394+ // A message providing more details about the current state of processing.
395+ string state_message = 2 ;
396+
397+ // The creation time of the operation.
398+ google.protobuf.Timestamp create_time = 3 ;
399+
400+ // The last update time of the operation.
401+ google.protobuf.Timestamp update_time = 4 ;
291402}
0 commit comments