google_cloud_documentai_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate api;
21extern crate async_trait;
22extern crate bytes;
23extern crate gax;
24extern crate gaxi;
25extern crate gtype;
26extern crate lazy_static;
27extern crate location;
28extern crate longrunning;
29extern crate lro;
30extern crate reqwest;
31extern crate rpc;
32extern crate serde;
33extern crate serde_json;
34extern crate serde_with;
35extern crate std;
36extern crate tracing;
37extern crate wkt;
38
39mod debug;
40mod deserialize;
41mod serialize;
42
43/// Encodes the detailed information of a barcode.
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct Barcode {
47 /// Format of a barcode.
48 /// The supported formats are:
49 ///
50 /// - `CODE_128`: Code 128 type.
51 /// - `CODE_39`: Code 39 type.
52 /// - `CODE_93`: Code 93 type.
53 /// - `CODABAR`: Codabar type.
54 /// - `DATA_MATRIX`: 2D Data Matrix type.
55 /// - `ITF`: ITF type.
56 /// - `EAN_13`: EAN-13 type.
57 /// - `EAN_8`: EAN-8 type.
58 /// - `QR_CODE`: 2D QR code type.
59 /// - `UPC_A`: UPC-A type.
60 /// - `UPC_E`: UPC-E type.
61 /// - `PDF417`: PDF417 type.
62 /// - `AZTEC`: 2D Aztec code type.
63 /// - `DATABAR`: GS1 DataBar code type.
64 pub format: std::string::String,
65
66 /// Value format describes the format of the value that a barcode
67 /// encodes.
68 /// The supported formats are:
69 ///
70 /// - `CONTACT_INFO`: Contact information.
71 /// - `EMAIL`: Email address.
72 /// - `ISBN`: ISBN identifier.
73 /// - `PHONE`: Phone number.
74 /// - `PRODUCT`: Product.
75 /// - `SMS`: SMS message.
76 /// - `TEXT`: Text string.
77 /// - `URL`: URL address.
78 /// - `WIFI`: Wifi information.
79 /// - `GEO`: Geo-localization.
80 /// - `CALENDAR_EVENT`: Calendar event.
81 /// - `DRIVER_LICENSE`: Driver's license.
82 pub value_format: std::string::String,
83
84 /// Raw value encoded in the barcode.
85 /// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com>;;'`.
86 pub raw_value: std::string::String,
87
88 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
89}
90
91impl Barcode {
92 pub fn new() -> Self {
93 std::default::Default::default()
94 }
95
96 /// Sets the value of [format][crate::model::Barcode::format].
97 ///
98 /// # Example
99 /// ```ignore,no_run
100 /// # use google_cloud_documentai_v1::model::Barcode;
101 /// let x = Barcode::new().set_format("example");
102 /// ```
103 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
104 self.format = v.into();
105 self
106 }
107
108 /// Sets the value of [value_format][crate::model::Barcode::value_format].
109 ///
110 /// # Example
111 /// ```ignore,no_run
112 /// # use google_cloud_documentai_v1::model::Barcode;
113 /// let x = Barcode::new().set_value_format("example");
114 /// ```
115 pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
116 self.value_format = v.into();
117 self
118 }
119
120 /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
121 ///
122 /// # Example
123 /// ```ignore,no_run
124 /// # use google_cloud_documentai_v1::model::Barcode;
125 /// let x = Barcode::new().set_raw_value("example");
126 /// ```
127 pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
128 self.raw_value = v.into();
129 self
130 }
131}
132
133impl wkt::message::Message for Barcode {
134 fn typename() -> &'static str {
135 "type.googleapis.com/google.cloud.documentai.v1.Barcode"
136 }
137}
138
139/// Document represents the canonical document resource in Document AI. It is an
140/// interchange format that provides insights into documents and allows for
141/// collaboration between users and Document AI to iterate and optimize for
142/// quality.
143#[derive(Clone, Default, PartialEq)]
144#[non_exhaustive]
145pub struct Document {
146 /// Optional. An internal identifier for document. Should be loggable (no PII).
147 pub docid: std::string::String,
148
149 /// An IANA published [media type (MIME
150 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
151 pub mime_type: std::string::String,
152
153 /// Optional. UTF-8 encoded text in reading order from the document.
154 pub text: std::string::String,
155
156 /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
157 ///
158 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
159 #[deprecated]
160 pub text_styles: std::vec::Vec<crate::model::document::Style>,
161
162 /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
163 ///
164 /// [google.cloud.documentai.v1.Document]: crate::model::Document
165 pub pages: std::vec::Vec<crate::model::document::Page>,
166
167 /// A list of entities detected on
168 /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
169 /// shards, entities in this list may cross shard boundaries.
170 ///
171 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
172 pub entities: std::vec::Vec<crate::model::document::Entity>,
173
174 /// Placeholder. Relationship among
175 /// [Document.entities][google.cloud.documentai.v1.Document.entities].
176 ///
177 /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
178 pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
179
180 /// Placeholder. A list of text corrections made to
181 /// [Document.text][google.cloud.documentai.v1.Document.text]. This is usually
182 /// used for annotating corrections to OCR mistakes. Text changes for a given
183 /// revision may not overlap with each other.
184 ///
185 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
186 pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
187
188 /// Information about the sharding if this document is sharded part of a larger
189 /// document. If the document is not sharded, this message is not specified.
190 pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
191
192 /// Any error that occurred while processing this document.
193 pub error: std::option::Option<rpc::model::Status>,
194
195 /// Placeholder. Revision history of this document.
196 pub revisions: std::vec::Vec<crate::model::document::Revision>,
197
198 /// Parsed layout of the document.
199 pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
200
201 /// Document chunked based on chunking config.
202 pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
203
204 /// The entity validation output for the document. This is the validation
205 /// output for `document.entities` field.
206 pub entity_validation_output:
207 std::option::Option<crate::model::document::EntityValidationOutput>,
208
209 /// A list of entity revisions. The entity revisions are appended to the
210 /// document in the processing order. This field can be used for comparing the
211 /// entity extraction results at different stages of the processing.
212 pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
213
214 /// The entity revision id that `document.entities` field is based on.
215 /// If this field is set and `entities_revisions` is not empty, the entities in
216 /// `document.entities` field are the entities in the entity revision with this
217 /// id and `document.entity_validation_output` field is the
218 /// `entity_validation_output` field in this entity revision.
219 pub entities_revision_id: std::string::String,
220
221 /// Original source document from the user.
222 pub source: std::option::Option<crate::model::document::Source>,
223
224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
225}
226
227impl Document {
228 pub fn new() -> Self {
229 std::default::Default::default()
230 }
231
232 /// Sets the value of [docid][crate::model::Document::docid].
233 ///
234 /// # Example
235 /// ```ignore,no_run
236 /// # use google_cloud_documentai_v1::model::Document;
237 /// let x = Document::new().set_docid("example");
238 /// ```
239 pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
240 self.docid = v.into();
241 self
242 }
243
244 /// Sets the value of [mime_type][crate::model::Document::mime_type].
245 ///
246 /// # Example
247 /// ```ignore,no_run
248 /// # use google_cloud_documentai_v1::model::Document;
249 /// let x = Document::new().set_mime_type("example");
250 /// ```
251 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
252 self.mime_type = v.into();
253 self
254 }
255
256 /// Sets the value of [text][crate::model::Document::text].
257 ///
258 /// # Example
259 /// ```ignore,no_run
260 /// # use google_cloud_documentai_v1::model::Document;
261 /// let x = Document::new().set_text("example");
262 /// ```
263 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
264 self.text = v.into();
265 self
266 }
267
268 /// Sets the value of [text_styles][crate::model::Document::text_styles].
269 ///
270 /// # Example
271 /// ```ignore,no_run
272 /// # use google_cloud_documentai_v1::model::Document;
273 /// use google_cloud_documentai_v1::model::document::Style;
274 /// let x = Document::new()
275 /// .set_text_styles([
276 /// Style::default()/* use setters */,
277 /// Style::default()/* use (different) setters */,
278 /// ]);
279 /// ```
280 #[deprecated]
281 pub fn set_text_styles<T, V>(mut self, v: T) -> Self
282 where
283 T: std::iter::IntoIterator<Item = V>,
284 V: std::convert::Into<crate::model::document::Style>,
285 {
286 use std::iter::Iterator;
287 self.text_styles = v.into_iter().map(|i| i.into()).collect();
288 self
289 }
290
291 /// Sets the value of [pages][crate::model::Document::pages].
292 ///
293 /// # Example
294 /// ```ignore,no_run
295 /// # use google_cloud_documentai_v1::model::Document;
296 /// use google_cloud_documentai_v1::model::document::Page;
297 /// let x = Document::new()
298 /// .set_pages([
299 /// Page::default()/* use setters */,
300 /// Page::default()/* use (different) setters */,
301 /// ]);
302 /// ```
303 pub fn set_pages<T, V>(mut self, v: T) -> Self
304 where
305 T: std::iter::IntoIterator<Item = V>,
306 V: std::convert::Into<crate::model::document::Page>,
307 {
308 use std::iter::Iterator;
309 self.pages = v.into_iter().map(|i| i.into()).collect();
310 self
311 }
312
313 /// Sets the value of [entities][crate::model::Document::entities].
314 ///
315 /// # Example
316 /// ```ignore,no_run
317 /// # use google_cloud_documentai_v1::model::Document;
318 /// use google_cloud_documentai_v1::model::document::Entity;
319 /// let x = Document::new()
320 /// .set_entities([
321 /// Entity::default()/* use setters */,
322 /// Entity::default()/* use (different) setters */,
323 /// ]);
324 /// ```
325 pub fn set_entities<T, V>(mut self, v: T) -> Self
326 where
327 T: std::iter::IntoIterator<Item = V>,
328 V: std::convert::Into<crate::model::document::Entity>,
329 {
330 use std::iter::Iterator;
331 self.entities = v.into_iter().map(|i| i.into()).collect();
332 self
333 }
334
335 /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
336 ///
337 /// # Example
338 /// ```ignore,no_run
339 /// # use google_cloud_documentai_v1::model::Document;
340 /// use google_cloud_documentai_v1::model::document::EntityRelation;
341 /// let x = Document::new()
342 /// .set_entity_relations([
343 /// EntityRelation::default()/* use setters */,
344 /// EntityRelation::default()/* use (different) setters */,
345 /// ]);
346 /// ```
347 pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
348 where
349 T: std::iter::IntoIterator<Item = V>,
350 V: std::convert::Into<crate::model::document::EntityRelation>,
351 {
352 use std::iter::Iterator;
353 self.entity_relations = v.into_iter().map(|i| i.into()).collect();
354 self
355 }
356
357 /// Sets the value of [text_changes][crate::model::Document::text_changes].
358 ///
359 /// # Example
360 /// ```ignore,no_run
361 /// # use google_cloud_documentai_v1::model::Document;
362 /// use google_cloud_documentai_v1::model::document::TextChange;
363 /// let x = Document::new()
364 /// .set_text_changes([
365 /// TextChange::default()/* use setters */,
366 /// TextChange::default()/* use (different) setters */,
367 /// ]);
368 /// ```
369 pub fn set_text_changes<T, V>(mut self, v: T) -> Self
370 where
371 T: std::iter::IntoIterator<Item = V>,
372 V: std::convert::Into<crate::model::document::TextChange>,
373 {
374 use std::iter::Iterator;
375 self.text_changes = v.into_iter().map(|i| i.into()).collect();
376 self
377 }
378
379 /// Sets the value of [shard_info][crate::model::Document::shard_info].
380 ///
381 /// # Example
382 /// ```ignore,no_run
383 /// # use google_cloud_documentai_v1::model::Document;
384 /// use google_cloud_documentai_v1::model::document::ShardInfo;
385 /// let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);
386 /// ```
387 pub fn set_shard_info<T>(mut self, v: T) -> Self
388 where
389 T: std::convert::Into<crate::model::document::ShardInfo>,
390 {
391 self.shard_info = std::option::Option::Some(v.into());
392 self
393 }
394
395 /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
396 ///
397 /// # Example
398 /// ```ignore,no_run
399 /// # use google_cloud_documentai_v1::model::Document;
400 /// use google_cloud_documentai_v1::model::document::ShardInfo;
401 /// let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
402 /// let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);
403 /// ```
404 pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
405 where
406 T: std::convert::Into<crate::model::document::ShardInfo>,
407 {
408 self.shard_info = v.map(|x| x.into());
409 self
410 }
411
412 /// Sets the value of [error][crate::model::Document::error].
413 ///
414 /// # Example
415 /// ```ignore,no_run
416 /// # use google_cloud_documentai_v1::model::Document;
417 /// use rpc::model::Status;
418 /// let x = Document::new().set_error(Status::default()/* use setters */);
419 /// ```
420 pub fn set_error<T>(mut self, v: T) -> Self
421 where
422 T: std::convert::Into<rpc::model::Status>,
423 {
424 self.error = std::option::Option::Some(v.into());
425 self
426 }
427
428 /// Sets or clears the value of [error][crate::model::Document::error].
429 ///
430 /// # Example
431 /// ```ignore,no_run
432 /// # use google_cloud_documentai_v1::model::Document;
433 /// use rpc::model::Status;
434 /// let x = Document::new().set_or_clear_error(Some(Status::default()/* use setters */));
435 /// let x = Document::new().set_or_clear_error(None::<Status>);
436 /// ```
437 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
438 where
439 T: std::convert::Into<rpc::model::Status>,
440 {
441 self.error = v.map(|x| x.into());
442 self
443 }
444
445 /// Sets the value of [revisions][crate::model::Document::revisions].
446 ///
447 /// # Example
448 /// ```ignore,no_run
449 /// # use google_cloud_documentai_v1::model::Document;
450 /// use google_cloud_documentai_v1::model::document::Revision;
451 /// let x = Document::new()
452 /// .set_revisions([
453 /// Revision::default()/* use setters */,
454 /// Revision::default()/* use (different) setters */,
455 /// ]);
456 /// ```
457 pub fn set_revisions<T, V>(mut self, v: T) -> Self
458 where
459 T: std::iter::IntoIterator<Item = V>,
460 V: std::convert::Into<crate::model::document::Revision>,
461 {
462 use std::iter::Iterator;
463 self.revisions = v.into_iter().map(|i| i.into()).collect();
464 self
465 }
466
467 /// Sets the value of [document_layout][crate::model::Document::document_layout].
468 ///
469 /// # Example
470 /// ```ignore,no_run
471 /// # use google_cloud_documentai_v1::model::Document;
472 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
473 /// let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);
474 /// ```
475 pub fn set_document_layout<T>(mut self, v: T) -> Self
476 where
477 T: std::convert::Into<crate::model::document::DocumentLayout>,
478 {
479 self.document_layout = std::option::Option::Some(v.into());
480 self
481 }
482
483 /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
484 ///
485 /// # Example
486 /// ```ignore,no_run
487 /// # use google_cloud_documentai_v1::model::Document;
488 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
489 /// let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
490 /// let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);
491 /// ```
492 pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
493 where
494 T: std::convert::Into<crate::model::document::DocumentLayout>,
495 {
496 self.document_layout = v.map(|x| x.into());
497 self
498 }
499
500 /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
501 ///
502 /// # Example
503 /// ```ignore,no_run
504 /// # use google_cloud_documentai_v1::model::Document;
505 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
506 /// let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);
507 /// ```
508 pub fn set_chunked_document<T>(mut self, v: T) -> Self
509 where
510 T: std::convert::Into<crate::model::document::ChunkedDocument>,
511 {
512 self.chunked_document = std::option::Option::Some(v.into());
513 self
514 }
515
516 /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
517 ///
518 /// # Example
519 /// ```ignore,no_run
520 /// # use google_cloud_documentai_v1::model::Document;
521 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
522 /// let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
523 /// let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);
524 /// ```
525 pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
526 where
527 T: std::convert::Into<crate::model::document::ChunkedDocument>,
528 {
529 self.chunked_document = v.map(|x| x.into());
530 self
531 }
532
533 /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
534 ///
535 /// # Example
536 /// ```ignore,no_run
537 /// # use google_cloud_documentai_v1::model::Document;
538 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
539 /// let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
540 /// ```
541 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
542 where
543 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
544 {
545 self.entity_validation_output = std::option::Option::Some(v.into());
546 self
547 }
548
549 /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
550 ///
551 /// # Example
552 /// ```ignore,no_run
553 /// # use google_cloud_documentai_v1::model::Document;
554 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
555 /// let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
556 /// let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
557 /// ```
558 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
559 where
560 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
561 {
562 self.entity_validation_output = v.map(|x| x.into());
563 self
564 }
565
566 /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
567 ///
568 /// # Example
569 /// ```ignore,no_run
570 /// # use google_cloud_documentai_v1::model::Document;
571 /// use google_cloud_documentai_v1::model::document::EntitiesRevision;
572 /// let x = Document::new()
573 /// .set_entities_revisions([
574 /// EntitiesRevision::default()/* use setters */,
575 /// EntitiesRevision::default()/* use (different) setters */,
576 /// ]);
577 /// ```
578 pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
579 where
580 T: std::iter::IntoIterator<Item = V>,
581 V: std::convert::Into<crate::model::document::EntitiesRevision>,
582 {
583 use std::iter::Iterator;
584 self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
585 self
586 }
587
588 /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
589 ///
590 /// # Example
591 /// ```ignore,no_run
592 /// # use google_cloud_documentai_v1::model::Document;
593 /// let x = Document::new().set_entities_revision_id("example");
594 /// ```
595 pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
596 mut self,
597 v: T,
598 ) -> Self {
599 self.entities_revision_id = v.into();
600 self
601 }
602
603 /// Sets the value of [source][crate::model::Document::source].
604 ///
605 /// Note that all the setters affecting `source` are mutually
606 /// exclusive.
607 ///
608 /// # Example
609 /// ```ignore,no_run
610 /// # use google_cloud_documentai_v1::model::Document;
611 /// use google_cloud_documentai_v1::model::document::Source;
612 /// let x = Document::new().set_source(Some(Source::Uri("example".to_string())));
613 /// ```
614 pub fn set_source<
615 T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
616 >(
617 mut self,
618 v: T,
619 ) -> Self {
620 self.source = v.into();
621 self
622 }
623
624 /// The value of [source][crate::model::Document::source]
625 /// if it holds a `Uri`, `None` if the field is not set or
626 /// holds a different branch.
627 pub fn uri(&self) -> std::option::Option<&std::string::String> {
628 #[allow(unreachable_patterns)]
629 self.source.as_ref().and_then(|v| match v {
630 crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
631 _ => std::option::Option::None,
632 })
633 }
634
635 /// Sets the value of [source][crate::model::Document::source]
636 /// to hold a `Uri`.
637 ///
638 /// Note that all the setters affecting `source` are
639 /// mutually exclusive.
640 ///
641 /// # Example
642 /// ```ignore,no_run
643 /// # use google_cloud_documentai_v1::model::Document;
644 /// let x = Document::new().set_uri("example");
645 /// assert!(x.uri().is_some());
646 /// assert!(x.content().is_none());
647 /// ```
648 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
649 self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
650 self
651 }
652
653 /// The value of [source][crate::model::Document::source]
654 /// if it holds a `Content`, `None` if the field is not set or
655 /// holds a different branch.
656 pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
657 #[allow(unreachable_patterns)]
658 self.source.as_ref().and_then(|v| match v {
659 crate::model::document::Source::Content(v) => std::option::Option::Some(v),
660 _ => std::option::Option::None,
661 })
662 }
663
664 /// Sets the value of [source][crate::model::Document::source]
665 /// to hold a `Content`.
666 ///
667 /// Note that all the setters affecting `source` are
668 /// mutually exclusive.
669 ///
670 /// # Example
671 /// ```ignore,no_run
672 /// # use google_cloud_documentai_v1::model::Document;
673 /// let x = Document::new().set_content(bytes::Bytes::from_static(b"example"));
674 /// assert!(x.content().is_some());
675 /// assert!(x.uri().is_none());
676 /// ```
677 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
678 self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
679 self
680 }
681}
682
683impl wkt::message::Message for Document {
684 fn typename() -> &'static str {
685 "type.googleapis.com/google.cloud.documentai.v1.Document"
686 }
687}
688
689/// Defines additional types related to [Document].
690pub mod document {
691 #[allow(unused_imports)]
692 use super::*;
693
694 /// For a large document, sharding may be performed to produce several
695 /// document shards. Each document shard contains this field to detail which
696 /// shard it is.
697 #[derive(Clone, Default, PartialEq)]
698 #[non_exhaustive]
699 pub struct ShardInfo {
700 /// The 0-based index of this shard.
701 pub shard_index: i64,
702
703 /// Total number of shards.
704 pub shard_count: i64,
705
706 /// The index of the first character in
707 /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
708 /// document global text.
709 ///
710 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
711 pub text_offset: i64,
712
713 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
714 }
715
716 impl ShardInfo {
717 pub fn new() -> Self {
718 std::default::Default::default()
719 }
720
721 /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
722 ///
723 /// # Example
724 /// ```ignore,no_run
725 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
726 /// let x = ShardInfo::new().set_shard_index(42);
727 /// ```
728 pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
729 self.shard_index = v.into();
730 self
731 }
732
733 /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
734 ///
735 /// # Example
736 /// ```ignore,no_run
737 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
738 /// let x = ShardInfo::new().set_shard_count(42);
739 /// ```
740 pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
741 self.shard_count = v.into();
742 self
743 }
744
745 /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
746 ///
747 /// # Example
748 /// ```ignore,no_run
749 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
750 /// let x = ShardInfo::new().set_text_offset(42);
751 /// ```
752 pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
753 self.text_offset = v.into();
754 self
755 }
756 }
757
758 impl wkt::message::Message for ShardInfo {
759 fn typename() -> &'static str {
760 "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
761 }
762 }
763
764 /// Annotation for common text style attributes. This adheres to CSS
765 /// conventions as much as possible.
766 #[derive(Clone, Default, PartialEq)]
767 #[non_exhaustive]
768 pub struct Style {
769 /// Text anchor indexing into the
770 /// [Document.text][google.cloud.documentai.v1.Document.text].
771 ///
772 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
773 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
774
775 /// Text color.
776 pub color: std::option::Option<gtype::model::Color>,
777
778 /// Text background color.
779 pub background_color: std::option::Option<gtype::model::Color>,
780
781 /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
782 /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
783 pub font_weight: std::string::String,
784
785 /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
786 /// Possible values are `normal`, `italic`, and `oblique`.
787 pub text_style: std::string::String,
788
789 /// [Text
790 /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
791 /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
792 /// \<text-decoration-style\>
793 pub text_decoration: std::string::String,
794
795 /// Font size.
796 pub font_size: std::option::Option<crate::model::document::style::FontSize>,
797
798 /// Font family such as `Arial`, `Times New Roman`.
799 /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
800 pub font_family: std::string::String,
801
802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
803 }
804
805 impl Style {
806 pub fn new() -> Self {
807 std::default::Default::default()
808 }
809
810 /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
811 ///
812 /// # Example
813 /// ```ignore,no_run
814 /// # use google_cloud_documentai_v1::model::document::Style;
815 /// use google_cloud_documentai_v1::model::document::TextAnchor;
816 /// let x = Style::new().set_text_anchor(TextAnchor::default()/* use setters */);
817 /// ```
818 pub fn set_text_anchor<T>(mut self, v: T) -> Self
819 where
820 T: std::convert::Into<crate::model::document::TextAnchor>,
821 {
822 self.text_anchor = std::option::Option::Some(v.into());
823 self
824 }
825
826 /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
827 ///
828 /// # Example
829 /// ```ignore,no_run
830 /// # use google_cloud_documentai_v1::model::document::Style;
831 /// use google_cloud_documentai_v1::model::document::TextAnchor;
832 /// let x = Style::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
833 /// let x = Style::new().set_or_clear_text_anchor(None::<TextAnchor>);
834 /// ```
835 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
836 where
837 T: std::convert::Into<crate::model::document::TextAnchor>,
838 {
839 self.text_anchor = v.map(|x| x.into());
840 self
841 }
842
843 /// Sets the value of [color][crate::model::document::Style::color].
844 ///
845 /// # Example
846 /// ```ignore,no_run
847 /// # use google_cloud_documentai_v1::model::document::Style;
848 /// use gtype::model::Color;
849 /// let x = Style::new().set_color(Color::default()/* use setters */);
850 /// ```
851 pub fn set_color<T>(mut self, v: T) -> Self
852 where
853 T: std::convert::Into<gtype::model::Color>,
854 {
855 self.color = std::option::Option::Some(v.into());
856 self
857 }
858
859 /// Sets or clears the value of [color][crate::model::document::Style::color].
860 ///
861 /// # Example
862 /// ```ignore,no_run
863 /// # use google_cloud_documentai_v1::model::document::Style;
864 /// use gtype::model::Color;
865 /// let x = Style::new().set_or_clear_color(Some(Color::default()/* use setters */));
866 /// let x = Style::new().set_or_clear_color(None::<Color>);
867 /// ```
868 pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
869 where
870 T: std::convert::Into<gtype::model::Color>,
871 {
872 self.color = v.map(|x| x.into());
873 self
874 }
875
876 /// Sets the value of [background_color][crate::model::document::Style::background_color].
877 ///
878 /// # Example
879 /// ```ignore,no_run
880 /// # use google_cloud_documentai_v1::model::document::Style;
881 /// use gtype::model::Color;
882 /// let x = Style::new().set_background_color(Color::default()/* use setters */);
883 /// ```
884 pub fn set_background_color<T>(mut self, v: T) -> Self
885 where
886 T: std::convert::Into<gtype::model::Color>,
887 {
888 self.background_color = std::option::Option::Some(v.into());
889 self
890 }
891
892 /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
893 ///
894 /// # Example
895 /// ```ignore,no_run
896 /// # use google_cloud_documentai_v1::model::document::Style;
897 /// use gtype::model::Color;
898 /// let x = Style::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
899 /// let x = Style::new().set_or_clear_background_color(None::<Color>);
900 /// ```
901 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
902 where
903 T: std::convert::Into<gtype::model::Color>,
904 {
905 self.background_color = v.map(|x| x.into());
906 self
907 }
908
909 /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
910 ///
911 /// # Example
912 /// ```ignore,no_run
913 /// # use google_cloud_documentai_v1::model::document::Style;
914 /// let x = Style::new().set_font_weight("example");
915 /// ```
916 pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
917 self.font_weight = v.into();
918 self
919 }
920
921 /// Sets the value of [text_style][crate::model::document::Style::text_style].
922 ///
923 /// # Example
924 /// ```ignore,no_run
925 /// # use google_cloud_documentai_v1::model::document::Style;
926 /// let x = Style::new().set_text_style("example");
927 /// ```
928 pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
929 self.text_style = v.into();
930 self
931 }
932
933 /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
934 ///
935 /// # Example
936 /// ```ignore,no_run
937 /// # use google_cloud_documentai_v1::model::document::Style;
938 /// let x = Style::new().set_text_decoration("example");
939 /// ```
940 pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
941 mut self,
942 v: T,
943 ) -> Self {
944 self.text_decoration = v.into();
945 self
946 }
947
948 /// Sets the value of [font_size][crate::model::document::Style::font_size].
949 ///
950 /// # Example
951 /// ```ignore,no_run
952 /// # use google_cloud_documentai_v1::model::document::Style;
953 /// use google_cloud_documentai_v1::model::document::style::FontSize;
954 /// let x = Style::new().set_font_size(FontSize::default()/* use setters */);
955 /// ```
956 pub fn set_font_size<T>(mut self, v: T) -> Self
957 where
958 T: std::convert::Into<crate::model::document::style::FontSize>,
959 {
960 self.font_size = std::option::Option::Some(v.into());
961 self
962 }
963
964 /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
965 ///
966 /// # Example
967 /// ```ignore,no_run
968 /// # use google_cloud_documentai_v1::model::document::Style;
969 /// use google_cloud_documentai_v1::model::document::style::FontSize;
970 /// let x = Style::new().set_or_clear_font_size(Some(FontSize::default()/* use setters */));
971 /// let x = Style::new().set_or_clear_font_size(None::<FontSize>);
972 /// ```
973 pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
974 where
975 T: std::convert::Into<crate::model::document::style::FontSize>,
976 {
977 self.font_size = v.map(|x| x.into());
978 self
979 }
980
981 /// Sets the value of [font_family][crate::model::document::Style::font_family].
982 ///
983 /// # Example
984 /// ```ignore,no_run
985 /// # use google_cloud_documentai_v1::model::document::Style;
986 /// let x = Style::new().set_font_family("example");
987 /// ```
988 pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
989 self.font_family = v.into();
990 self
991 }
992 }
993
994 impl wkt::message::Message for Style {
995 fn typename() -> &'static str {
996 "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
997 }
998 }
999
1000 /// Defines additional types related to [Style].
1001 pub mod style {
1002 #[allow(unused_imports)]
1003 use super::*;
1004
1005 /// Font size with unit.
1006 #[derive(Clone, Default, PartialEq)]
1007 #[non_exhaustive]
1008 pub struct FontSize {
1009 /// Font size for the text.
1010 pub size: f32,
1011
1012 /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
1013 /// `pt`).
1014 pub unit: std::string::String,
1015
1016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1017 }
1018
1019 impl FontSize {
1020 pub fn new() -> Self {
1021 std::default::Default::default()
1022 }
1023
1024 /// Sets the value of [size][crate::model::document::style::FontSize::size].
1025 ///
1026 /// # Example
1027 /// ```ignore,no_run
1028 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1029 /// let x = FontSize::new().set_size(42.0);
1030 /// ```
1031 pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1032 self.size = v.into();
1033 self
1034 }
1035
1036 /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
1037 ///
1038 /// # Example
1039 /// ```ignore,no_run
1040 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1041 /// let x = FontSize::new().set_unit("example");
1042 /// ```
1043 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1044 self.unit = v.into();
1045 self
1046 }
1047 }
1048
1049 impl wkt::message::Message for FontSize {
1050 fn typename() -> &'static str {
1051 "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
1052 }
1053 }
1054 }
1055
1056 /// A page in a [Document][google.cloud.documentai.v1.Document].
1057 ///
1058 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1059 #[derive(Clone, Default, PartialEq)]
1060 #[non_exhaustive]
1061 pub struct Page {
1062 /// 1-based index for current
1063 /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
1064 /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
1065 /// taken out of a [Document][google.cloud.documentai.v1.Document] for
1066 /// individual processing.
1067 ///
1068 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1069 /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
1070 pub page_number: i32,
1071
1072 /// Rendered image for this page. This image is preprocessed to remove any
1073 /// skew, rotation, and distortions such that the annotation bounding boxes
1074 /// can be upright and axis-aligned.
1075 pub image: std::option::Option<crate::model::document::page::Image>,
1076
1077 /// Transformation matrices that were applied to the original document image
1078 /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
1079 ///
1080 /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
1081 pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
1082
1083 /// Physical dimension of the page.
1084 pub dimension: std::option::Option<crate::model::document::page::Dimension>,
1085
1086 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
1087 ///
1088 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1089 pub layout: std::option::Option<crate::model::document::page::Layout>,
1090
1091 /// A list of detected languages together with confidence.
1092 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1093
1094 /// A list of visually detected text blocks on the page.
1095 /// A block has a set of lines (collected into paragraphs) that have a common
1096 /// line-spacing and orientation.
1097 pub blocks: std::vec::Vec<crate::model::document::page::Block>,
1098
1099 /// A list of visually detected text paragraphs on the page.
1100 /// A collection of lines that a human would perceive as a paragraph.
1101 pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
1102
1103 /// A list of visually detected text lines on the page.
1104 /// A collection of tokens that a human would perceive as a line.
1105 pub lines: std::vec::Vec<crate::model::document::page::Line>,
1106
1107 /// A list of visually detected tokens on the page.
1108 pub tokens: std::vec::Vec<crate::model::document::page::Token>,
1109
1110 /// A list of detected non-text visual elements e.g. checkbox,
1111 /// signature etc. on the page.
1112 pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
1113
1114 /// A list of visually detected tables on the page.
1115 pub tables: std::vec::Vec<crate::model::document::page::Table>,
1116
1117 /// A list of visually detected form fields on the page.
1118 pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
1119
1120 /// A list of visually detected symbols on the page.
1121 pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
1122
1123 /// A list of detected barcodes.
1124 pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
1125
1126 /// Image quality scores.
1127 pub image_quality_scores:
1128 std::option::Option<crate::model::document::page::ImageQualityScores>,
1129
1130 /// The history of this page.
1131 #[deprecated]
1132 pub provenance: std::option::Option<crate::model::document::Provenance>,
1133
1134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1135 }
1136
1137 impl Page {
1138 pub fn new() -> Self {
1139 std::default::Default::default()
1140 }
1141
1142 /// Sets the value of [page_number][crate::model::document::Page::page_number].
1143 ///
1144 /// # Example
1145 /// ```ignore,no_run
1146 /// # use google_cloud_documentai_v1::model::document::Page;
1147 /// let x = Page::new().set_page_number(42);
1148 /// ```
1149 pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1150 self.page_number = v.into();
1151 self
1152 }
1153
1154 /// Sets the value of [image][crate::model::document::Page::image].
1155 ///
1156 /// # Example
1157 /// ```ignore,no_run
1158 /// # use google_cloud_documentai_v1::model::document::Page;
1159 /// use google_cloud_documentai_v1::model::document::page::Image;
1160 /// let x = Page::new().set_image(Image::default()/* use setters */);
1161 /// ```
1162 pub fn set_image<T>(mut self, v: T) -> Self
1163 where
1164 T: std::convert::Into<crate::model::document::page::Image>,
1165 {
1166 self.image = std::option::Option::Some(v.into());
1167 self
1168 }
1169
1170 /// Sets or clears the value of [image][crate::model::document::Page::image].
1171 ///
1172 /// # Example
1173 /// ```ignore,no_run
1174 /// # use google_cloud_documentai_v1::model::document::Page;
1175 /// use google_cloud_documentai_v1::model::document::page::Image;
1176 /// let x = Page::new().set_or_clear_image(Some(Image::default()/* use setters */));
1177 /// let x = Page::new().set_or_clear_image(None::<Image>);
1178 /// ```
1179 pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
1180 where
1181 T: std::convert::Into<crate::model::document::page::Image>,
1182 {
1183 self.image = v.map(|x| x.into());
1184 self
1185 }
1186
1187 /// Sets the value of [transforms][crate::model::document::Page::transforms].
1188 ///
1189 /// # Example
1190 /// ```ignore,no_run
1191 /// # use google_cloud_documentai_v1::model::document::Page;
1192 /// use google_cloud_documentai_v1::model::document::page::Matrix;
1193 /// let x = Page::new()
1194 /// .set_transforms([
1195 /// Matrix::default()/* use setters */,
1196 /// Matrix::default()/* use (different) setters */,
1197 /// ]);
1198 /// ```
1199 pub fn set_transforms<T, V>(mut self, v: T) -> Self
1200 where
1201 T: std::iter::IntoIterator<Item = V>,
1202 V: std::convert::Into<crate::model::document::page::Matrix>,
1203 {
1204 use std::iter::Iterator;
1205 self.transforms = v.into_iter().map(|i| i.into()).collect();
1206 self
1207 }
1208
1209 /// Sets the value of [dimension][crate::model::document::Page::dimension].
1210 ///
1211 /// # Example
1212 /// ```ignore,no_run
1213 /// # use google_cloud_documentai_v1::model::document::Page;
1214 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1215 /// let x = Page::new().set_dimension(Dimension::default()/* use setters */);
1216 /// ```
1217 pub fn set_dimension<T>(mut self, v: T) -> Self
1218 where
1219 T: std::convert::Into<crate::model::document::page::Dimension>,
1220 {
1221 self.dimension = std::option::Option::Some(v.into());
1222 self
1223 }
1224
1225 /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
1226 ///
1227 /// # Example
1228 /// ```ignore,no_run
1229 /// # use google_cloud_documentai_v1::model::document::Page;
1230 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1231 /// let x = Page::new().set_or_clear_dimension(Some(Dimension::default()/* use setters */));
1232 /// let x = Page::new().set_or_clear_dimension(None::<Dimension>);
1233 /// ```
1234 pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
1235 where
1236 T: std::convert::Into<crate::model::document::page::Dimension>,
1237 {
1238 self.dimension = v.map(|x| x.into());
1239 self
1240 }
1241
1242 /// Sets the value of [layout][crate::model::document::Page::layout].
1243 ///
1244 /// # Example
1245 /// ```ignore,no_run
1246 /// # use google_cloud_documentai_v1::model::document::Page;
1247 /// use google_cloud_documentai_v1::model::document::page::Layout;
1248 /// let x = Page::new().set_layout(Layout::default()/* use setters */);
1249 /// ```
1250 pub fn set_layout<T>(mut self, v: T) -> Self
1251 where
1252 T: std::convert::Into<crate::model::document::page::Layout>,
1253 {
1254 self.layout = std::option::Option::Some(v.into());
1255 self
1256 }
1257
1258 /// Sets or clears the value of [layout][crate::model::document::Page::layout].
1259 ///
1260 /// # Example
1261 /// ```ignore,no_run
1262 /// # use google_cloud_documentai_v1::model::document::Page;
1263 /// use google_cloud_documentai_v1::model::document::page::Layout;
1264 /// let x = Page::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
1265 /// let x = Page::new().set_or_clear_layout(None::<Layout>);
1266 /// ```
1267 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1268 where
1269 T: std::convert::Into<crate::model::document::page::Layout>,
1270 {
1271 self.layout = v.map(|x| x.into());
1272 self
1273 }
1274
1275 /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
1276 ///
1277 /// # Example
1278 /// ```ignore,no_run
1279 /// # use google_cloud_documentai_v1::model::document::Page;
1280 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
1281 /// let x = Page::new()
1282 /// .set_detected_languages([
1283 /// DetectedLanguage::default()/* use setters */,
1284 /// DetectedLanguage::default()/* use (different) setters */,
1285 /// ]);
1286 /// ```
1287 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1288 where
1289 T: std::iter::IntoIterator<Item = V>,
1290 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1291 {
1292 use std::iter::Iterator;
1293 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1294 self
1295 }
1296
1297 /// Sets the value of [blocks][crate::model::document::Page::blocks].
1298 ///
1299 /// # Example
1300 /// ```ignore,no_run
1301 /// # use google_cloud_documentai_v1::model::document::Page;
1302 /// use google_cloud_documentai_v1::model::document::page::Block;
1303 /// let x = Page::new()
1304 /// .set_blocks([
1305 /// Block::default()/* use setters */,
1306 /// Block::default()/* use (different) setters */,
1307 /// ]);
1308 /// ```
1309 pub fn set_blocks<T, V>(mut self, v: T) -> Self
1310 where
1311 T: std::iter::IntoIterator<Item = V>,
1312 V: std::convert::Into<crate::model::document::page::Block>,
1313 {
1314 use std::iter::Iterator;
1315 self.blocks = v.into_iter().map(|i| i.into()).collect();
1316 self
1317 }
1318
1319 /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
1320 ///
1321 /// # Example
1322 /// ```ignore,no_run
1323 /// # use google_cloud_documentai_v1::model::document::Page;
1324 /// use google_cloud_documentai_v1::model::document::page::Paragraph;
1325 /// let x = Page::new()
1326 /// .set_paragraphs([
1327 /// Paragraph::default()/* use setters */,
1328 /// Paragraph::default()/* use (different) setters */,
1329 /// ]);
1330 /// ```
1331 pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
1332 where
1333 T: std::iter::IntoIterator<Item = V>,
1334 V: std::convert::Into<crate::model::document::page::Paragraph>,
1335 {
1336 use std::iter::Iterator;
1337 self.paragraphs = v.into_iter().map(|i| i.into()).collect();
1338 self
1339 }
1340
1341 /// Sets the value of [lines][crate::model::document::Page::lines].
1342 ///
1343 /// # Example
1344 /// ```ignore,no_run
1345 /// # use google_cloud_documentai_v1::model::document::Page;
1346 /// use google_cloud_documentai_v1::model::document::page::Line;
1347 /// let x = Page::new()
1348 /// .set_lines([
1349 /// Line::default()/* use setters */,
1350 /// Line::default()/* use (different) setters */,
1351 /// ]);
1352 /// ```
1353 pub fn set_lines<T, V>(mut self, v: T) -> Self
1354 where
1355 T: std::iter::IntoIterator<Item = V>,
1356 V: std::convert::Into<crate::model::document::page::Line>,
1357 {
1358 use std::iter::Iterator;
1359 self.lines = v.into_iter().map(|i| i.into()).collect();
1360 self
1361 }
1362
1363 /// Sets the value of [tokens][crate::model::document::Page::tokens].
1364 ///
1365 /// # Example
1366 /// ```ignore,no_run
1367 /// # use google_cloud_documentai_v1::model::document::Page;
1368 /// use google_cloud_documentai_v1::model::document::page::Token;
1369 /// let x = Page::new()
1370 /// .set_tokens([
1371 /// Token::default()/* use setters */,
1372 /// Token::default()/* use (different) setters */,
1373 /// ]);
1374 /// ```
1375 pub fn set_tokens<T, V>(mut self, v: T) -> Self
1376 where
1377 T: std::iter::IntoIterator<Item = V>,
1378 V: std::convert::Into<crate::model::document::page::Token>,
1379 {
1380 use std::iter::Iterator;
1381 self.tokens = v.into_iter().map(|i| i.into()).collect();
1382 self
1383 }
1384
1385 /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
1386 ///
1387 /// # Example
1388 /// ```ignore,no_run
1389 /// # use google_cloud_documentai_v1::model::document::Page;
1390 /// use google_cloud_documentai_v1::model::document::page::VisualElement;
1391 /// let x = Page::new()
1392 /// .set_visual_elements([
1393 /// VisualElement::default()/* use setters */,
1394 /// VisualElement::default()/* use (different) setters */,
1395 /// ]);
1396 /// ```
1397 pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
1398 where
1399 T: std::iter::IntoIterator<Item = V>,
1400 V: std::convert::Into<crate::model::document::page::VisualElement>,
1401 {
1402 use std::iter::Iterator;
1403 self.visual_elements = v.into_iter().map(|i| i.into()).collect();
1404 self
1405 }
1406
1407 /// Sets the value of [tables][crate::model::document::Page::tables].
1408 ///
1409 /// # Example
1410 /// ```ignore,no_run
1411 /// # use google_cloud_documentai_v1::model::document::Page;
1412 /// use google_cloud_documentai_v1::model::document::page::Table;
1413 /// let x = Page::new()
1414 /// .set_tables([
1415 /// Table::default()/* use setters */,
1416 /// Table::default()/* use (different) setters */,
1417 /// ]);
1418 /// ```
1419 pub fn set_tables<T, V>(mut self, v: T) -> Self
1420 where
1421 T: std::iter::IntoIterator<Item = V>,
1422 V: std::convert::Into<crate::model::document::page::Table>,
1423 {
1424 use std::iter::Iterator;
1425 self.tables = v.into_iter().map(|i| i.into()).collect();
1426 self
1427 }
1428
1429 /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
1430 ///
1431 /// # Example
1432 /// ```ignore,no_run
1433 /// # use google_cloud_documentai_v1::model::document::Page;
1434 /// use google_cloud_documentai_v1::model::document::page::FormField;
1435 /// let x = Page::new()
1436 /// .set_form_fields([
1437 /// FormField::default()/* use setters */,
1438 /// FormField::default()/* use (different) setters */,
1439 /// ]);
1440 /// ```
1441 pub fn set_form_fields<T, V>(mut self, v: T) -> Self
1442 where
1443 T: std::iter::IntoIterator<Item = V>,
1444 V: std::convert::Into<crate::model::document::page::FormField>,
1445 {
1446 use std::iter::Iterator;
1447 self.form_fields = v.into_iter().map(|i| i.into()).collect();
1448 self
1449 }
1450
1451 /// Sets the value of [symbols][crate::model::document::Page::symbols].
1452 ///
1453 /// # Example
1454 /// ```ignore,no_run
1455 /// # use google_cloud_documentai_v1::model::document::Page;
1456 /// use google_cloud_documentai_v1::model::document::page::Symbol;
1457 /// let x = Page::new()
1458 /// .set_symbols([
1459 /// Symbol::default()/* use setters */,
1460 /// Symbol::default()/* use (different) setters */,
1461 /// ]);
1462 /// ```
1463 pub fn set_symbols<T, V>(mut self, v: T) -> Self
1464 where
1465 T: std::iter::IntoIterator<Item = V>,
1466 V: std::convert::Into<crate::model::document::page::Symbol>,
1467 {
1468 use std::iter::Iterator;
1469 self.symbols = v.into_iter().map(|i| i.into()).collect();
1470 self
1471 }
1472
1473 /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
1474 ///
1475 /// # Example
1476 /// ```ignore,no_run
1477 /// # use google_cloud_documentai_v1::model::document::Page;
1478 /// use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
1479 /// let x = Page::new()
1480 /// .set_detected_barcodes([
1481 /// DetectedBarcode::default()/* use setters */,
1482 /// DetectedBarcode::default()/* use (different) setters */,
1483 /// ]);
1484 /// ```
1485 pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
1486 where
1487 T: std::iter::IntoIterator<Item = V>,
1488 V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
1489 {
1490 use std::iter::Iterator;
1491 self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
1492 self
1493 }
1494
1495 /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1496 ///
1497 /// # Example
1498 /// ```ignore,no_run
1499 /// # use google_cloud_documentai_v1::model::document::Page;
1500 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1501 /// let x = Page::new().set_image_quality_scores(ImageQualityScores::default()/* use setters */);
1502 /// ```
1503 pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
1504 where
1505 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1506 {
1507 self.image_quality_scores = std::option::Option::Some(v.into());
1508 self
1509 }
1510
1511 /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1512 ///
1513 /// # Example
1514 /// ```ignore,no_run
1515 /// # use google_cloud_documentai_v1::model::document::Page;
1516 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1517 /// let x = Page::new().set_or_clear_image_quality_scores(Some(ImageQualityScores::default()/* use setters */));
1518 /// let x = Page::new().set_or_clear_image_quality_scores(None::<ImageQualityScores>);
1519 /// ```
1520 pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1521 where
1522 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1523 {
1524 self.image_quality_scores = v.map(|x| x.into());
1525 self
1526 }
1527
1528 /// Sets the value of [provenance][crate::model::document::Page::provenance].
1529 ///
1530 /// # Example
1531 /// ```ignore,no_run
1532 /// # use google_cloud_documentai_v1::model::document::Page;
1533 /// use google_cloud_documentai_v1::model::document::Provenance;
1534 /// let x = Page::new().set_provenance(Provenance::default()/* use setters */);
1535 /// ```
1536 #[deprecated]
1537 pub fn set_provenance<T>(mut self, v: T) -> Self
1538 where
1539 T: std::convert::Into<crate::model::document::Provenance>,
1540 {
1541 self.provenance = std::option::Option::Some(v.into());
1542 self
1543 }
1544
1545 /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
1546 ///
1547 /// # Example
1548 /// ```ignore,no_run
1549 /// # use google_cloud_documentai_v1::model::document::Page;
1550 /// use google_cloud_documentai_v1::model::document::Provenance;
1551 /// let x = Page::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
1552 /// let x = Page::new().set_or_clear_provenance(None::<Provenance>);
1553 /// ```
1554 #[deprecated]
1555 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1556 where
1557 T: std::convert::Into<crate::model::document::Provenance>,
1558 {
1559 self.provenance = v.map(|x| x.into());
1560 self
1561 }
1562 }
1563
1564 impl wkt::message::Message for Page {
1565 fn typename() -> &'static str {
1566 "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1567 }
1568 }
1569
1570 /// Defines additional types related to [Page].
1571 pub mod page {
1572 #[allow(unused_imports)]
1573 use super::*;
1574
1575 /// Dimension for the page.
1576 #[derive(Clone, Default, PartialEq)]
1577 #[non_exhaustive]
1578 pub struct Dimension {
1579 /// Page width.
1580 pub width: f32,
1581
1582 /// Page height.
1583 pub height: f32,
1584
1585 /// Dimension unit.
1586 pub unit: std::string::String,
1587
1588 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1589 }
1590
1591 impl Dimension {
1592 pub fn new() -> Self {
1593 std::default::Default::default()
1594 }
1595
1596 /// Sets the value of [width][crate::model::document::page::Dimension::width].
1597 ///
1598 /// # Example
1599 /// ```ignore,no_run
1600 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1601 /// let x = Dimension::new().set_width(42.0);
1602 /// ```
1603 pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1604 self.width = v.into();
1605 self
1606 }
1607
1608 /// Sets the value of [height][crate::model::document::page::Dimension::height].
1609 ///
1610 /// # Example
1611 /// ```ignore,no_run
1612 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1613 /// let x = Dimension::new().set_height(42.0);
1614 /// ```
1615 pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1616 self.height = v.into();
1617 self
1618 }
1619
1620 /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
1621 ///
1622 /// # Example
1623 /// ```ignore,no_run
1624 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1625 /// let x = Dimension::new().set_unit("example");
1626 /// ```
1627 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1628 self.unit = v.into();
1629 self
1630 }
1631 }
1632
1633 impl wkt::message::Message for Dimension {
1634 fn typename() -> &'static str {
1635 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1636 }
1637 }
1638
1639 /// Rendered image contents for this page.
1640 #[derive(Clone, Default, PartialEq)]
1641 #[non_exhaustive]
1642 pub struct Image {
1643 /// Raw byte content of the image.
1644 pub content: ::bytes::Bytes,
1645
1646 /// Encoding [media type (MIME
1647 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
1648 /// for the image.
1649 pub mime_type: std::string::String,
1650
1651 /// Width of the image in pixels.
1652 pub width: i32,
1653
1654 /// Height of the image in pixels.
1655 pub height: i32,
1656
1657 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1658 }
1659
1660 impl Image {
1661 pub fn new() -> Self {
1662 std::default::Default::default()
1663 }
1664
1665 /// Sets the value of [content][crate::model::document::page::Image::content].
1666 ///
1667 /// # Example
1668 /// ```ignore,no_run
1669 /// # use google_cloud_documentai_v1::model::document::page::Image;
1670 /// let x = Image::new().set_content(bytes::Bytes::from_static(b"example"));
1671 /// ```
1672 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1673 self.content = v.into();
1674 self
1675 }
1676
1677 /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
1678 ///
1679 /// # Example
1680 /// ```ignore,no_run
1681 /// # use google_cloud_documentai_v1::model::document::page::Image;
1682 /// let x = Image::new().set_mime_type("example");
1683 /// ```
1684 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1685 mut self,
1686 v: T,
1687 ) -> Self {
1688 self.mime_type = v.into();
1689 self
1690 }
1691
1692 /// Sets the value of [width][crate::model::document::page::Image::width].
1693 ///
1694 /// # Example
1695 /// ```ignore,no_run
1696 /// # use google_cloud_documentai_v1::model::document::page::Image;
1697 /// let x = Image::new().set_width(42);
1698 /// ```
1699 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1700 self.width = v.into();
1701 self
1702 }
1703
1704 /// Sets the value of [height][crate::model::document::page::Image::height].
1705 ///
1706 /// # Example
1707 /// ```ignore,no_run
1708 /// # use google_cloud_documentai_v1::model::document::page::Image;
1709 /// let x = Image::new().set_height(42);
1710 /// ```
1711 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1712 self.height = v.into();
1713 self
1714 }
1715 }
1716
1717 impl wkt::message::Message for Image {
1718 fn typename() -> &'static str {
1719 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1720 }
1721 }
1722
1723 /// Representation for transformation matrix, intended to be compatible and
1724 /// used with OpenCV format for image manipulation.
1725 #[derive(Clone, Default, PartialEq)]
1726 #[non_exhaustive]
1727 pub struct Matrix {
1728 /// Number of rows in the matrix.
1729 pub rows: i32,
1730
1731 /// Number of columns in the matrix.
1732 pub cols: i32,
1733
1734 /// This encodes information about what data type the matrix uses.
1735 /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
1736 /// of OpenCV primitive data types, please refer to
1737 /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
1738 pub r#type: i32,
1739
1740 /// The matrix data.
1741 pub data: ::bytes::Bytes,
1742
1743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1744 }
1745
1746 impl Matrix {
1747 pub fn new() -> Self {
1748 std::default::Default::default()
1749 }
1750
1751 /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
1752 ///
1753 /// # Example
1754 /// ```ignore,no_run
1755 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1756 /// let x = Matrix::new().set_rows(42);
1757 /// ```
1758 pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1759 self.rows = v.into();
1760 self
1761 }
1762
1763 /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
1764 ///
1765 /// # Example
1766 /// ```ignore,no_run
1767 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1768 /// let x = Matrix::new().set_cols(42);
1769 /// ```
1770 pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1771 self.cols = v.into();
1772 self
1773 }
1774
1775 /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
1776 ///
1777 /// # Example
1778 /// ```ignore,no_run
1779 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1780 /// let x = Matrix::new().set_type(42);
1781 /// ```
1782 pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1783 self.r#type = v.into();
1784 self
1785 }
1786
1787 /// Sets the value of [data][crate::model::document::page::Matrix::data].
1788 ///
1789 /// # Example
1790 /// ```ignore,no_run
1791 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1792 /// let x = Matrix::new().set_data(bytes::Bytes::from_static(b"example"));
1793 /// ```
1794 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1795 self.data = v.into();
1796 self
1797 }
1798 }
1799
1800 impl wkt::message::Message for Matrix {
1801 fn typename() -> &'static str {
1802 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1803 }
1804 }
1805
1806 /// Visual element describing a layout unit on a page.
1807 #[derive(Clone, Default, PartialEq)]
1808 #[non_exhaustive]
1809 pub struct Layout {
1810 /// Text anchor indexing into the
1811 /// [Document.text][google.cloud.documentai.v1.Document.text].
1812 ///
1813 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
1814 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1815
1816 /// Confidence of the current
1817 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
1818 /// context of the object this layout is for. e.g. confidence can be for a
1819 /// single token, a table, a visual element, etc. depending on context.
1820 /// Range `[0, 1]`.
1821 ///
1822 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1823 pub confidence: f32,
1824
1825 /// The bounding polygon for the
1826 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1827 ///
1828 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1829 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1830
1831 /// Detected orientation for the
1832 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1833 ///
1834 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1835 pub orientation: crate::model::document::page::layout::Orientation,
1836
1837 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1838 }
1839
1840 impl Layout {
1841 pub fn new() -> Self {
1842 std::default::Default::default()
1843 }
1844
1845 /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1846 ///
1847 /// # Example
1848 /// ```ignore,no_run
1849 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1850 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1851 /// let x = Layout::new().set_text_anchor(TextAnchor::default()/* use setters */);
1852 /// ```
1853 pub fn set_text_anchor<T>(mut self, v: T) -> Self
1854 where
1855 T: std::convert::Into<crate::model::document::TextAnchor>,
1856 {
1857 self.text_anchor = std::option::Option::Some(v.into());
1858 self
1859 }
1860
1861 /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1862 ///
1863 /// # Example
1864 /// ```ignore,no_run
1865 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1866 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1867 /// let x = Layout::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
1868 /// let x = Layout::new().set_or_clear_text_anchor(None::<TextAnchor>);
1869 /// ```
1870 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1871 where
1872 T: std::convert::Into<crate::model::document::TextAnchor>,
1873 {
1874 self.text_anchor = v.map(|x| x.into());
1875 self
1876 }
1877
1878 /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
1879 ///
1880 /// # Example
1881 /// ```ignore,no_run
1882 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1883 /// let x = Layout::new().set_confidence(42.0);
1884 /// ```
1885 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1886 self.confidence = v.into();
1887 self
1888 }
1889
1890 /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1891 ///
1892 /// # Example
1893 /// ```ignore,no_run
1894 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1895 /// use google_cloud_documentai_v1::model::BoundingPoly;
1896 /// let x = Layout::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
1897 /// ```
1898 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1899 where
1900 T: std::convert::Into<crate::model::BoundingPoly>,
1901 {
1902 self.bounding_poly = std::option::Option::Some(v.into());
1903 self
1904 }
1905
1906 /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1907 ///
1908 /// # Example
1909 /// ```ignore,no_run
1910 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1911 /// use google_cloud_documentai_v1::model::BoundingPoly;
1912 /// let x = Layout::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
1913 /// let x = Layout::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
1914 /// ```
1915 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1916 where
1917 T: std::convert::Into<crate::model::BoundingPoly>,
1918 {
1919 self.bounding_poly = v.map(|x| x.into());
1920 self
1921 }
1922
1923 /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
1924 ///
1925 /// # Example
1926 /// ```ignore,no_run
1927 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1928 /// use google_cloud_documentai_v1::model::document::page::layout::Orientation;
1929 /// let x0 = Layout::new().set_orientation(Orientation::PageUp);
1930 /// let x1 = Layout::new().set_orientation(Orientation::PageRight);
1931 /// let x2 = Layout::new().set_orientation(Orientation::PageDown);
1932 /// ```
1933 pub fn set_orientation<
1934 T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1935 >(
1936 mut self,
1937 v: T,
1938 ) -> Self {
1939 self.orientation = v.into();
1940 self
1941 }
1942 }
1943
1944 impl wkt::message::Message for Layout {
1945 fn typename() -> &'static str {
1946 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1947 }
1948 }
1949
1950 /// Defines additional types related to [Layout].
1951 pub mod layout {
1952 #[allow(unused_imports)]
1953 use super::*;
1954
1955 /// Detected human reading orientation.
1956 ///
1957 /// # Working with unknown values
1958 ///
1959 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1960 /// additional enum variants at any time. Adding new variants is not considered
1961 /// a breaking change. Applications should write their code in anticipation of:
1962 ///
1963 /// - New values appearing in future releases of the client library, **and**
1964 /// - New values received dynamically, without application changes.
1965 ///
1966 /// Please consult the [Working with enums] section in the user guide for some
1967 /// guidelines.
1968 ///
1969 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
1970 #[derive(Clone, Debug, PartialEq)]
1971 #[non_exhaustive]
1972 pub enum Orientation {
1973 /// Unspecified orientation.
1974 Unspecified,
1975 /// Orientation is aligned with page up.
1976 PageUp,
1977 /// Orientation is aligned with page right.
1978 /// Turn the head 90 degrees clockwise from upright to read.
1979 PageRight,
1980 /// Orientation is aligned with page down.
1981 /// Turn the head 180 degrees from upright to read.
1982 PageDown,
1983 /// Orientation is aligned with page left.
1984 /// Turn the head 90 degrees counterclockwise from upright to read.
1985 PageLeft,
1986 /// If set, the enum was initialized with an unknown value.
1987 ///
1988 /// Applications can examine the value using [Orientation::value] or
1989 /// [Orientation::name].
1990 UnknownValue(orientation::UnknownValue),
1991 }
1992
1993 #[doc(hidden)]
1994 pub mod orientation {
1995 #[allow(unused_imports)]
1996 use super::*;
1997 #[derive(Clone, Debug, PartialEq)]
1998 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
1999 }
2000
2001 impl Orientation {
2002 /// Gets the enum value.
2003 ///
2004 /// Returns `None` if the enum contains an unknown value deserialized from
2005 /// the string representation of enums.
2006 pub fn value(&self) -> std::option::Option<i32> {
2007 match self {
2008 Self::Unspecified => std::option::Option::Some(0),
2009 Self::PageUp => std::option::Option::Some(1),
2010 Self::PageRight => std::option::Option::Some(2),
2011 Self::PageDown => std::option::Option::Some(3),
2012 Self::PageLeft => std::option::Option::Some(4),
2013 Self::UnknownValue(u) => u.0.value(),
2014 }
2015 }
2016
2017 /// Gets the enum value as a string.
2018 ///
2019 /// Returns `None` if the enum contains an unknown value deserialized from
2020 /// the integer representation of enums.
2021 pub fn name(&self) -> std::option::Option<&str> {
2022 match self {
2023 Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
2024 Self::PageUp => std::option::Option::Some("PAGE_UP"),
2025 Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
2026 Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
2027 Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
2028 Self::UnknownValue(u) => u.0.name(),
2029 }
2030 }
2031 }
2032
2033 impl std::default::Default for Orientation {
2034 fn default() -> Self {
2035 use std::convert::From;
2036 Self::from(0)
2037 }
2038 }
2039
2040 impl std::fmt::Display for Orientation {
2041 fn fmt(
2042 &self,
2043 f: &mut std::fmt::Formatter<'_>,
2044 ) -> std::result::Result<(), std::fmt::Error> {
2045 wkt::internal::display_enum(f, self.name(), self.value())
2046 }
2047 }
2048
2049 impl std::convert::From<i32> for Orientation {
2050 fn from(value: i32) -> Self {
2051 match value {
2052 0 => Self::Unspecified,
2053 1 => Self::PageUp,
2054 2 => Self::PageRight,
2055 3 => Self::PageDown,
2056 4 => Self::PageLeft,
2057 _ => Self::UnknownValue(orientation::UnknownValue(
2058 wkt::internal::UnknownEnumValue::Integer(value),
2059 )),
2060 }
2061 }
2062 }
2063
2064 impl std::convert::From<&str> for Orientation {
2065 fn from(value: &str) -> Self {
2066 use std::string::ToString;
2067 match value {
2068 "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
2069 "PAGE_UP" => Self::PageUp,
2070 "PAGE_RIGHT" => Self::PageRight,
2071 "PAGE_DOWN" => Self::PageDown,
2072 "PAGE_LEFT" => Self::PageLeft,
2073 _ => Self::UnknownValue(orientation::UnknownValue(
2074 wkt::internal::UnknownEnumValue::String(value.to_string()),
2075 )),
2076 }
2077 }
2078 }
2079
2080 impl serde::ser::Serialize for Orientation {
2081 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2082 where
2083 S: serde::Serializer,
2084 {
2085 match self {
2086 Self::Unspecified => serializer.serialize_i32(0),
2087 Self::PageUp => serializer.serialize_i32(1),
2088 Self::PageRight => serializer.serialize_i32(2),
2089 Self::PageDown => serializer.serialize_i32(3),
2090 Self::PageLeft => serializer.serialize_i32(4),
2091 Self::UnknownValue(u) => u.0.serialize(serializer),
2092 }
2093 }
2094 }
2095
2096 impl<'de> serde::de::Deserialize<'de> for Orientation {
2097 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2098 where
2099 D: serde::Deserializer<'de>,
2100 {
2101 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
2102 ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
2103 ))
2104 }
2105 }
2106 }
2107
2108 /// A block has a set of lines (collected into paragraphs) that have a
2109 /// common line-spacing and orientation.
2110 #[derive(Clone, Default, PartialEq)]
2111 #[non_exhaustive]
2112 pub struct Block {
2113 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2114 /// [Block][google.cloud.documentai.v1.Document.Page.Block].
2115 ///
2116 /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
2117 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2118 pub layout: std::option::Option<crate::model::document::page::Layout>,
2119
2120 /// A list of detected languages together with confidence.
2121 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2122
2123 /// The history of this annotation.
2124 #[deprecated]
2125 pub provenance: std::option::Option<crate::model::document::Provenance>,
2126
2127 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2128 }
2129
2130 impl Block {
2131 pub fn new() -> Self {
2132 std::default::Default::default()
2133 }
2134
2135 /// Sets the value of [layout][crate::model::document::page::Block::layout].
2136 ///
2137 /// # Example
2138 /// ```ignore,no_run
2139 /// # use google_cloud_documentai_v1::model::document::page::Block;
2140 /// use google_cloud_documentai_v1::model::document::page::Layout;
2141 /// let x = Block::new().set_layout(Layout::default()/* use setters */);
2142 /// ```
2143 pub fn set_layout<T>(mut self, v: T) -> Self
2144 where
2145 T: std::convert::Into<crate::model::document::page::Layout>,
2146 {
2147 self.layout = std::option::Option::Some(v.into());
2148 self
2149 }
2150
2151 /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
2152 ///
2153 /// # Example
2154 /// ```ignore,no_run
2155 /// # use google_cloud_documentai_v1::model::document::page::Block;
2156 /// use google_cloud_documentai_v1::model::document::page::Layout;
2157 /// let x = Block::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2158 /// let x = Block::new().set_or_clear_layout(None::<Layout>);
2159 /// ```
2160 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2161 where
2162 T: std::convert::Into<crate::model::document::page::Layout>,
2163 {
2164 self.layout = v.map(|x| x.into());
2165 self
2166 }
2167
2168 /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
2169 ///
2170 /// # Example
2171 /// ```ignore,no_run
2172 /// # use google_cloud_documentai_v1::model::document::page::Block;
2173 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2174 /// let x = Block::new()
2175 /// .set_detected_languages([
2176 /// DetectedLanguage::default()/* use setters */,
2177 /// DetectedLanguage::default()/* use (different) setters */,
2178 /// ]);
2179 /// ```
2180 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2181 where
2182 T: std::iter::IntoIterator<Item = V>,
2183 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2184 {
2185 use std::iter::Iterator;
2186 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2187 self
2188 }
2189
2190 /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
2191 ///
2192 /// # Example
2193 /// ```ignore,no_run
2194 /// # use google_cloud_documentai_v1::model::document::page::Block;
2195 /// use google_cloud_documentai_v1::model::document::Provenance;
2196 /// let x = Block::new().set_provenance(Provenance::default()/* use setters */);
2197 /// ```
2198 #[deprecated]
2199 pub fn set_provenance<T>(mut self, v: T) -> Self
2200 where
2201 T: std::convert::Into<crate::model::document::Provenance>,
2202 {
2203 self.provenance = std::option::Option::Some(v.into());
2204 self
2205 }
2206
2207 /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
2208 ///
2209 /// # Example
2210 /// ```ignore,no_run
2211 /// # use google_cloud_documentai_v1::model::document::page::Block;
2212 /// use google_cloud_documentai_v1::model::document::Provenance;
2213 /// let x = Block::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2214 /// let x = Block::new().set_or_clear_provenance(None::<Provenance>);
2215 /// ```
2216 #[deprecated]
2217 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2218 where
2219 T: std::convert::Into<crate::model::document::Provenance>,
2220 {
2221 self.provenance = v.map(|x| x.into());
2222 self
2223 }
2224 }
2225
2226 impl wkt::message::Message for Block {
2227 fn typename() -> &'static str {
2228 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
2229 }
2230 }
2231
2232 /// A collection of lines that a human would perceive as a paragraph.
2233 #[derive(Clone, Default, PartialEq)]
2234 #[non_exhaustive]
2235 pub struct Paragraph {
2236 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2237 /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
2238 ///
2239 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2240 /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
2241 pub layout: std::option::Option<crate::model::document::page::Layout>,
2242
2243 /// A list of detected languages together with confidence.
2244 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2245
2246 /// The history of this annotation.
2247 #[deprecated]
2248 pub provenance: std::option::Option<crate::model::document::Provenance>,
2249
2250 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2251 }
2252
2253 impl Paragraph {
2254 pub fn new() -> Self {
2255 std::default::Default::default()
2256 }
2257
2258 /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
2259 ///
2260 /// # Example
2261 /// ```ignore,no_run
2262 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2263 /// use google_cloud_documentai_v1::model::document::page::Layout;
2264 /// let x = Paragraph::new().set_layout(Layout::default()/* use setters */);
2265 /// ```
2266 pub fn set_layout<T>(mut self, v: T) -> Self
2267 where
2268 T: std::convert::Into<crate::model::document::page::Layout>,
2269 {
2270 self.layout = std::option::Option::Some(v.into());
2271 self
2272 }
2273
2274 /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
2275 ///
2276 /// # Example
2277 /// ```ignore,no_run
2278 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2279 /// use google_cloud_documentai_v1::model::document::page::Layout;
2280 /// let x = Paragraph::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2281 /// let x = Paragraph::new().set_or_clear_layout(None::<Layout>);
2282 /// ```
2283 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2284 where
2285 T: std::convert::Into<crate::model::document::page::Layout>,
2286 {
2287 self.layout = v.map(|x| x.into());
2288 self
2289 }
2290
2291 /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
2292 ///
2293 /// # Example
2294 /// ```ignore,no_run
2295 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2296 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2297 /// let x = Paragraph::new()
2298 /// .set_detected_languages([
2299 /// DetectedLanguage::default()/* use setters */,
2300 /// DetectedLanguage::default()/* use (different) setters */,
2301 /// ]);
2302 /// ```
2303 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2304 where
2305 T: std::iter::IntoIterator<Item = V>,
2306 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2307 {
2308 use std::iter::Iterator;
2309 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2310 self
2311 }
2312
2313 /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
2314 ///
2315 /// # Example
2316 /// ```ignore,no_run
2317 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2318 /// use google_cloud_documentai_v1::model::document::Provenance;
2319 /// let x = Paragraph::new().set_provenance(Provenance::default()/* use setters */);
2320 /// ```
2321 #[deprecated]
2322 pub fn set_provenance<T>(mut self, v: T) -> Self
2323 where
2324 T: std::convert::Into<crate::model::document::Provenance>,
2325 {
2326 self.provenance = std::option::Option::Some(v.into());
2327 self
2328 }
2329
2330 /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
2331 ///
2332 /// # Example
2333 /// ```ignore,no_run
2334 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2335 /// use google_cloud_documentai_v1::model::document::Provenance;
2336 /// let x = Paragraph::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2337 /// let x = Paragraph::new().set_or_clear_provenance(None::<Provenance>);
2338 /// ```
2339 #[deprecated]
2340 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2341 where
2342 T: std::convert::Into<crate::model::document::Provenance>,
2343 {
2344 self.provenance = v.map(|x| x.into());
2345 self
2346 }
2347 }
2348
2349 impl wkt::message::Message for Paragraph {
2350 fn typename() -> &'static str {
2351 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
2352 }
2353 }
2354
2355 /// A collection of tokens that a human would perceive as a line.
2356 /// Does not cross column boundaries, can be horizontal, vertical, etc.
2357 #[derive(Clone, Default, PartialEq)]
2358 #[non_exhaustive]
2359 pub struct Line {
2360 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2361 /// [Line][google.cloud.documentai.v1.Document.Page.Line].
2362 ///
2363 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2364 /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
2365 pub layout: std::option::Option<crate::model::document::page::Layout>,
2366
2367 /// A list of detected languages together with confidence.
2368 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2369
2370 /// The history of this annotation.
2371 #[deprecated]
2372 pub provenance: std::option::Option<crate::model::document::Provenance>,
2373
2374 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2375 }
2376
2377 impl Line {
2378 pub fn new() -> Self {
2379 std::default::Default::default()
2380 }
2381
2382 /// Sets the value of [layout][crate::model::document::page::Line::layout].
2383 ///
2384 /// # Example
2385 /// ```ignore,no_run
2386 /// # use google_cloud_documentai_v1::model::document::page::Line;
2387 /// use google_cloud_documentai_v1::model::document::page::Layout;
2388 /// let x = Line::new().set_layout(Layout::default()/* use setters */);
2389 /// ```
2390 pub fn set_layout<T>(mut self, v: T) -> Self
2391 where
2392 T: std::convert::Into<crate::model::document::page::Layout>,
2393 {
2394 self.layout = std::option::Option::Some(v.into());
2395 self
2396 }
2397
2398 /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
2399 ///
2400 /// # Example
2401 /// ```ignore,no_run
2402 /// # use google_cloud_documentai_v1::model::document::page::Line;
2403 /// use google_cloud_documentai_v1::model::document::page::Layout;
2404 /// let x = Line::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2405 /// let x = Line::new().set_or_clear_layout(None::<Layout>);
2406 /// ```
2407 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2408 where
2409 T: std::convert::Into<crate::model::document::page::Layout>,
2410 {
2411 self.layout = v.map(|x| x.into());
2412 self
2413 }
2414
2415 /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
2416 ///
2417 /// # Example
2418 /// ```ignore,no_run
2419 /// # use google_cloud_documentai_v1::model::document::page::Line;
2420 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2421 /// let x = Line::new()
2422 /// .set_detected_languages([
2423 /// DetectedLanguage::default()/* use setters */,
2424 /// DetectedLanguage::default()/* use (different) setters */,
2425 /// ]);
2426 /// ```
2427 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2428 where
2429 T: std::iter::IntoIterator<Item = V>,
2430 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2431 {
2432 use std::iter::Iterator;
2433 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2434 self
2435 }
2436
2437 /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
2438 ///
2439 /// # Example
2440 /// ```ignore,no_run
2441 /// # use google_cloud_documentai_v1::model::document::page::Line;
2442 /// use google_cloud_documentai_v1::model::document::Provenance;
2443 /// let x = Line::new().set_provenance(Provenance::default()/* use setters */);
2444 /// ```
2445 #[deprecated]
2446 pub fn set_provenance<T>(mut self, v: T) -> Self
2447 where
2448 T: std::convert::Into<crate::model::document::Provenance>,
2449 {
2450 self.provenance = std::option::Option::Some(v.into());
2451 self
2452 }
2453
2454 /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
2455 ///
2456 /// # Example
2457 /// ```ignore,no_run
2458 /// # use google_cloud_documentai_v1::model::document::page::Line;
2459 /// use google_cloud_documentai_v1::model::document::Provenance;
2460 /// let x = Line::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2461 /// let x = Line::new().set_or_clear_provenance(None::<Provenance>);
2462 /// ```
2463 #[deprecated]
2464 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2465 where
2466 T: std::convert::Into<crate::model::document::Provenance>,
2467 {
2468 self.provenance = v.map(|x| x.into());
2469 self
2470 }
2471 }
2472
2473 impl wkt::message::Message for Line {
2474 fn typename() -> &'static str {
2475 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
2476 }
2477 }
2478
2479 /// A detected token.
2480 #[derive(Clone, Default, PartialEq)]
2481 #[non_exhaustive]
2482 pub struct Token {
2483 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2484 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2485 ///
2486 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2487 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2488 pub layout: std::option::Option<crate::model::document::page::Layout>,
2489
2490 /// Detected break at the end of a
2491 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2492 ///
2493 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2494 pub detected_break:
2495 std::option::Option<crate::model::document::page::token::DetectedBreak>,
2496
2497 /// A list of detected languages together with confidence.
2498 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2499
2500 /// The history of this annotation.
2501 #[deprecated]
2502 pub provenance: std::option::Option<crate::model::document::Provenance>,
2503
2504 /// Text style attributes.
2505 pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
2506
2507 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2508 }
2509
2510 impl Token {
2511 pub fn new() -> Self {
2512 std::default::Default::default()
2513 }
2514
2515 /// Sets the value of [layout][crate::model::document::page::Token::layout].
2516 ///
2517 /// # Example
2518 /// ```ignore,no_run
2519 /// # use google_cloud_documentai_v1::model::document::page::Token;
2520 /// use google_cloud_documentai_v1::model::document::page::Layout;
2521 /// let x = Token::new().set_layout(Layout::default()/* use setters */);
2522 /// ```
2523 pub fn set_layout<T>(mut self, v: T) -> Self
2524 where
2525 T: std::convert::Into<crate::model::document::page::Layout>,
2526 {
2527 self.layout = std::option::Option::Some(v.into());
2528 self
2529 }
2530
2531 /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
2532 ///
2533 /// # Example
2534 /// ```ignore,no_run
2535 /// # use google_cloud_documentai_v1::model::document::page::Token;
2536 /// use google_cloud_documentai_v1::model::document::page::Layout;
2537 /// let x = Token::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2538 /// let x = Token::new().set_or_clear_layout(None::<Layout>);
2539 /// ```
2540 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2541 where
2542 T: std::convert::Into<crate::model::document::page::Layout>,
2543 {
2544 self.layout = v.map(|x| x.into());
2545 self
2546 }
2547
2548 /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
2549 ///
2550 /// # Example
2551 /// ```ignore,no_run
2552 /// # use google_cloud_documentai_v1::model::document::page::Token;
2553 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2554 /// let x = Token::new().set_detected_break(DetectedBreak::default()/* use setters */);
2555 /// ```
2556 pub fn set_detected_break<T>(mut self, v: T) -> Self
2557 where
2558 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2559 {
2560 self.detected_break = std::option::Option::Some(v.into());
2561 self
2562 }
2563
2564 /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
2565 ///
2566 /// # Example
2567 /// ```ignore,no_run
2568 /// # use google_cloud_documentai_v1::model::document::page::Token;
2569 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2570 /// let x = Token::new().set_or_clear_detected_break(Some(DetectedBreak::default()/* use setters */));
2571 /// let x = Token::new().set_or_clear_detected_break(None::<DetectedBreak>);
2572 /// ```
2573 pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
2574 where
2575 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2576 {
2577 self.detected_break = v.map(|x| x.into());
2578 self
2579 }
2580
2581 /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
2582 ///
2583 /// # Example
2584 /// ```ignore,no_run
2585 /// # use google_cloud_documentai_v1::model::document::page::Token;
2586 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2587 /// let x = Token::new()
2588 /// .set_detected_languages([
2589 /// DetectedLanguage::default()/* use setters */,
2590 /// DetectedLanguage::default()/* use (different) setters */,
2591 /// ]);
2592 /// ```
2593 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2594 where
2595 T: std::iter::IntoIterator<Item = V>,
2596 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2597 {
2598 use std::iter::Iterator;
2599 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2600 self
2601 }
2602
2603 /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
2604 ///
2605 /// # Example
2606 /// ```ignore,no_run
2607 /// # use google_cloud_documentai_v1::model::document::page::Token;
2608 /// use google_cloud_documentai_v1::model::document::Provenance;
2609 /// let x = Token::new().set_provenance(Provenance::default()/* use setters */);
2610 /// ```
2611 #[deprecated]
2612 pub fn set_provenance<T>(mut self, v: T) -> Self
2613 where
2614 T: std::convert::Into<crate::model::document::Provenance>,
2615 {
2616 self.provenance = std::option::Option::Some(v.into());
2617 self
2618 }
2619
2620 /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
2621 ///
2622 /// # Example
2623 /// ```ignore,no_run
2624 /// # use google_cloud_documentai_v1::model::document::page::Token;
2625 /// use google_cloud_documentai_v1::model::document::Provenance;
2626 /// let x = Token::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2627 /// let x = Token::new().set_or_clear_provenance(None::<Provenance>);
2628 /// ```
2629 #[deprecated]
2630 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2631 where
2632 T: std::convert::Into<crate::model::document::Provenance>,
2633 {
2634 self.provenance = v.map(|x| x.into());
2635 self
2636 }
2637
2638 /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
2639 ///
2640 /// # Example
2641 /// ```ignore,no_run
2642 /// # use google_cloud_documentai_v1::model::document::page::Token;
2643 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2644 /// let x = Token::new().set_style_info(StyleInfo::default()/* use setters */);
2645 /// ```
2646 pub fn set_style_info<T>(mut self, v: T) -> Self
2647 where
2648 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2649 {
2650 self.style_info = std::option::Option::Some(v.into());
2651 self
2652 }
2653
2654 /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
2655 ///
2656 /// # Example
2657 /// ```ignore,no_run
2658 /// # use google_cloud_documentai_v1::model::document::page::Token;
2659 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2660 /// let x = Token::new().set_or_clear_style_info(Some(StyleInfo::default()/* use setters */));
2661 /// let x = Token::new().set_or_clear_style_info(None::<StyleInfo>);
2662 /// ```
2663 pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
2664 where
2665 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2666 {
2667 self.style_info = v.map(|x| x.into());
2668 self
2669 }
2670 }
2671
2672 impl wkt::message::Message for Token {
2673 fn typename() -> &'static str {
2674 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
2675 }
2676 }
2677
2678 /// Defines additional types related to [Token].
2679 pub mod token {
2680 #[allow(unused_imports)]
2681 use super::*;
2682
2683 /// Detected break at the end of a
2684 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2685 ///
2686 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2687 #[derive(Clone, Default, PartialEq)]
2688 #[non_exhaustive]
2689 pub struct DetectedBreak {
2690 /// Detected break type.
2691 pub r#type: crate::model::document::page::token::detected_break::Type,
2692
2693 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2694 }
2695
2696 impl DetectedBreak {
2697 pub fn new() -> Self {
2698 std::default::Default::default()
2699 }
2700
2701 /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
2702 ///
2703 /// # Example
2704 /// ```ignore,no_run
2705 /// # use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2706 /// use google_cloud_documentai_v1::model::document::page::token::detected_break::Type;
2707 /// let x0 = DetectedBreak::new().set_type(Type::Space);
2708 /// let x1 = DetectedBreak::new().set_type(Type::WideSpace);
2709 /// let x2 = DetectedBreak::new().set_type(Type::Hyphen);
2710 /// ```
2711 pub fn set_type<
2712 T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
2713 >(
2714 mut self,
2715 v: T,
2716 ) -> Self {
2717 self.r#type = v.into();
2718 self
2719 }
2720 }
2721
2722 impl wkt::message::Message for DetectedBreak {
2723 fn typename() -> &'static str {
2724 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
2725 }
2726 }
2727
2728 /// Defines additional types related to [DetectedBreak].
2729 pub mod detected_break {
2730 #[allow(unused_imports)]
2731 use super::*;
2732
2733 /// Enum to denote the type of break found.
2734 ///
2735 /// # Working with unknown values
2736 ///
2737 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2738 /// additional enum variants at any time. Adding new variants is not considered
2739 /// a breaking change. Applications should write their code in anticipation of:
2740 ///
2741 /// - New values appearing in future releases of the client library, **and**
2742 /// - New values received dynamically, without application changes.
2743 ///
2744 /// Please consult the [Working with enums] section in the user guide for some
2745 /// guidelines.
2746 ///
2747 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
2748 #[derive(Clone, Debug, PartialEq)]
2749 #[non_exhaustive]
2750 pub enum Type {
2751 /// Unspecified break type.
2752 Unspecified,
2753 /// A single whitespace.
2754 Space,
2755 /// A wider whitespace.
2756 WideSpace,
2757 /// A hyphen that indicates that a token has been split across lines.
2758 Hyphen,
2759 /// If set, the enum was initialized with an unknown value.
2760 ///
2761 /// Applications can examine the value using [Type::value] or
2762 /// [Type::name].
2763 UnknownValue(r#type::UnknownValue),
2764 }
2765
2766 #[doc(hidden)]
2767 pub mod r#type {
2768 #[allow(unused_imports)]
2769 use super::*;
2770 #[derive(Clone, Debug, PartialEq)]
2771 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2772 }
2773
2774 impl Type {
2775 /// Gets the enum value.
2776 ///
2777 /// Returns `None` if the enum contains an unknown value deserialized from
2778 /// the string representation of enums.
2779 pub fn value(&self) -> std::option::Option<i32> {
2780 match self {
2781 Self::Unspecified => std::option::Option::Some(0),
2782 Self::Space => std::option::Option::Some(1),
2783 Self::WideSpace => std::option::Option::Some(2),
2784 Self::Hyphen => std::option::Option::Some(3),
2785 Self::UnknownValue(u) => u.0.value(),
2786 }
2787 }
2788
2789 /// Gets the enum value as a string.
2790 ///
2791 /// Returns `None` if the enum contains an unknown value deserialized from
2792 /// the integer representation of enums.
2793 pub fn name(&self) -> std::option::Option<&str> {
2794 match self {
2795 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2796 Self::Space => std::option::Option::Some("SPACE"),
2797 Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
2798 Self::Hyphen => std::option::Option::Some("HYPHEN"),
2799 Self::UnknownValue(u) => u.0.name(),
2800 }
2801 }
2802 }
2803
2804 impl std::default::Default for Type {
2805 fn default() -> Self {
2806 use std::convert::From;
2807 Self::from(0)
2808 }
2809 }
2810
2811 impl std::fmt::Display for Type {
2812 fn fmt(
2813 &self,
2814 f: &mut std::fmt::Formatter<'_>,
2815 ) -> std::result::Result<(), std::fmt::Error> {
2816 wkt::internal::display_enum(f, self.name(), self.value())
2817 }
2818 }
2819
2820 impl std::convert::From<i32> for Type {
2821 fn from(value: i32) -> Self {
2822 match value {
2823 0 => Self::Unspecified,
2824 1 => Self::Space,
2825 2 => Self::WideSpace,
2826 3 => Self::Hyphen,
2827 _ => Self::UnknownValue(r#type::UnknownValue(
2828 wkt::internal::UnknownEnumValue::Integer(value),
2829 )),
2830 }
2831 }
2832 }
2833
2834 impl std::convert::From<&str> for Type {
2835 fn from(value: &str) -> Self {
2836 use std::string::ToString;
2837 match value {
2838 "TYPE_UNSPECIFIED" => Self::Unspecified,
2839 "SPACE" => Self::Space,
2840 "WIDE_SPACE" => Self::WideSpace,
2841 "HYPHEN" => Self::Hyphen,
2842 _ => Self::UnknownValue(r#type::UnknownValue(
2843 wkt::internal::UnknownEnumValue::String(value.to_string()),
2844 )),
2845 }
2846 }
2847 }
2848
2849 impl serde::ser::Serialize for Type {
2850 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2851 where
2852 S: serde::Serializer,
2853 {
2854 match self {
2855 Self::Unspecified => serializer.serialize_i32(0),
2856 Self::Space => serializer.serialize_i32(1),
2857 Self::WideSpace => serializer.serialize_i32(2),
2858 Self::Hyphen => serializer.serialize_i32(3),
2859 Self::UnknownValue(u) => u.0.serialize(serializer),
2860 }
2861 }
2862 }
2863
2864 impl<'de> serde::de::Deserialize<'de> for Type {
2865 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2866 where
2867 D: serde::Deserializer<'de>,
2868 {
2869 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2870 ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2871 ))
2872 }
2873 }
2874 }
2875
2876 /// Font and other text style attributes.
2877 #[derive(Clone, Default, PartialEq)]
2878 #[non_exhaustive]
2879 pub struct StyleInfo {
2880 /// Font size in points (`1` point is `¹⁄₇₂` inches).
2881 pub font_size: i32,
2882
2883 /// Font size in pixels, equal to _unrounded
2884 /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
2885 ///
2886 /// * _resolution_ ÷ `72.0`.
2887 ///
2888 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
2889 pub pixel_font_size: f64,
2890
2891 /// Letter spacing in points.
2892 pub letter_spacing: f64,
2893
2894 /// Name or style of the font.
2895 pub font_type: std::string::String,
2896
2897 /// Whether the text is bold (equivalent to
2898 /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
2899 /// is at least `700`).
2900 ///
2901 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
2902 pub bold: bool,
2903
2904 /// Whether the text is italic.
2905 pub italic: bool,
2906
2907 /// Whether the text is underlined.
2908 pub underlined: bool,
2909
2910 /// Whether the text is strikethrough. This feature is not supported yet.
2911 pub strikeout: bool,
2912
2913 /// Whether the text is a subscript. This feature is not supported yet.
2914 pub subscript: bool,
2915
2916 /// Whether the text is a superscript. This feature is not supported yet.
2917 pub superscript: bool,
2918
2919 /// Whether the text is in small caps. This feature is not supported yet.
2920 pub smallcaps: bool,
2921
2922 /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
2923 /// Normal is `400`, bold is `700`.
2924 pub font_weight: i32,
2925
2926 /// Whether the text is handwritten.
2927 pub handwritten: bool,
2928
2929 /// Color of the text.
2930 pub text_color: std::option::Option<gtype::model::Color>,
2931
2932 /// Color of the background.
2933 pub background_color: std::option::Option<gtype::model::Color>,
2934
2935 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2936 }
2937
2938 impl StyleInfo {
2939 pub fn new() -> Self {
2940 std::default::Default::default()
2941 }
2942
2943 /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
2944 ///
2945 /// # Example
2946 /// ```ignore,no_run
2947 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2948 /// let x = StyleInfo::new().set_font_size(42);
2949 /// ```
2950 pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2951 self.font_size = v.into();
2952 self
2953 }
2954
2955 /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
2956 ///
2957 /// # Example
2958 /// ```ignore,no_run
2959 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2960 /// let x = StyleInfo::new().set_pixel_font_size(42.0);
2961 /// ```
2962 pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2963 self.pixel_font_size = v.into();
2964 self
2965 }
2966
2967 /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
2968 ///
2969 /// # Example
2970 /// ```ignore,no_run
2971 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2972 /// let x = StyleInfo::new().set_letter_spacing(42.0);
2973 /// ```
2974 pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2975 self.letter_spacing = v.into();
2976 self
2977 }
2978
2979 /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
2980 ///
2981 /// # Example
2982 /// ```ignore,no_run
2983 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2984 /// let x = StyleInfo::new().set_font_type("example");
2985 /// ```
2986 pub fn set_font_type<T: std::convert::Into<std::string::String>>(
2987 mut self,
2988 v: T,
2989 ) -> Self {
2990 self.font_type = v.into();
2991 self
2992 }
2993
2994 /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
2995 ///
2996 /// # Example
2997 /// ```ignore,no_run
2998 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2999 /// let x = StyleInfo::new().set_bold(true);
3000 /// ```
3001 pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3002 self.bold = v.into();
3003 self
3004 }
3005
3006 /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
3007 ///
3008 /// # Example
3009 /// ```ignore,no_run
3010 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3011 /// let x = StyleInfo::new().set_italic(true);
3012 /// ```
3013 pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3014 self.italic = v.into();
3015 self
3016 }
3017
3018 /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
3019 ///
3020 /// # Example
3021 /// ```ignore,no_run
3022 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3023 /// let x = StyleInfo::new().set_underlined(true);
3024 /// ```
3025 pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3026 self.underlined = v.into();
3027 self
3028 }
3029
3030 /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
3031 ///
3032 /// # Example
3033 /// ```ignore,no_run
3034 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3035 /// let x = StyleInfo::new().set_strikeout(true);
3036 /// ```
3037 pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3038 self.strikeout = v.into();
3039 self
3040 }
3041
3042 /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
3043 ///
3044 /// # Example
3045 /// ```ignore,no_run
3046 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3047 /// let x = StyleInfo::new().set_subscript(true);
3048 /// ```
3049 pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3050 self.subscript = v.into();
3051 self
3052 }
3053
3054 /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
3055 ///
3056 /// # Example
3057 /// ```ignore,no_run
3058 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3059 /// let x = StyleInfo::new().set_superscript(true);
3060 /// ```
3061 pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3062 self.superscript = v.into();
3063 self
3064 }
3065
3066 /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
3067 ///
3068 /// # Example
3069 /// ```ignore,no_run
3070 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3071 /// let x = StyleInfo::new().set_smallcaps(true);
3072 /// ```
3073 pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3074 self.smallcaps = v.into();
3075 self
3076 }
3077
3078 /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
3079 ///
3080 /// # Example
3081 /// ```ignore,no_run
3082 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3083 /// let x = StyleInfo::new().set_font_weight(42);
3084 /// ```
3085 pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3086 self.font_weight = v.into();
3087 self
3088 }
3089
3090 /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
3091 ///
3092 /// # Example
3093 /// ```ignore,no_run
3094 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3095 /// let x = StyleInfo::new().set_handwritten(true);
3096 /// ```
3097 pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3098 self.handwritten = v.into();
3099 self
3100 }
3101
3102 /// Sets the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3103 ///
3104 /// # Example
3105 /// ```ignore,no_run
3106 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3107 /// use gtype::model::Color;
3108 /// let x = StyleInfo::new().set_text_color(Color::default()/* use setters */);
3109 /// ```
3110 pub fn set_text_color<T>(mut self, v: T) -> Self
3111 where
3112 T: std::convert::Into<gtype::model::Color>,
3113 {
3114 self.text_color = std::option::Option::Some(v.into());
3115 self
3116 }
3117
3118 /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3119 ///
3120 /// # Example
3121 /// ```ignore,no_run
3122 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3123 /// use gtype::model::Color;
3124 /// let x = StyleInfo::new().set_or_clear_text_color(Some(Color::default()/* use setters */));
3125 /// let x = StyleInfo::new().set_or_clear_text_color(None::<Color>);
3126 /// ```
3127 pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
3128 where
3129 T: std::convert::Into<gtype::model::Color>,
3130 {
3131 self.text_color = v.map(|x| x.into());
3132 self
3133 }
3134
3135 /// Sets the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3136 ///
3137 /// # Example
3138 /// ```ignore,no_run
3139 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3140 /// use gtype::model::Color;
3141 /// let x = StyleInfo::new().set_background_color(Color::default()/* use setters */);
3142 /// ```
3143 pub fn set_background_color<T>(mut self, v: T) -> Self
3144 where
3145 T: std::convert::Into<gtype::model::Color>,
3146 {
3147 self.background_color = std::option::Option::Some(v.into());
3148 self
3149 }
3150
3151 /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3152 ///
3153 /// # Example
3154 /// ```ignore,no_run
3155 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3156 /// use gtype::model::Color;
3157 /// let x = StyleInfo::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
3158 /// let x = StyleInfo::new().set_or_clear_background_color(None::<Color>);
3159 /// ```
3160 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
3161 where
3162 T: std::convert::Into<gtype::model::Color>,
3163 {
3164 self.background_color = v.map(|x| x.into());
3165 self
3166 }
3167 }
3168
3169 impl wkt::message::Message for StyleInfo {
3170 fn typename() -> &'static str {
3171 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
3172 }
3173 }
3174 }
3175
3176 /// A detected symbol.
3177 #[derive(Clone, Default, PartialEq)]
3178 #[non_exhaustive]
3179 pub struct Symbol {
3180 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3181 /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
3182 ///
3183 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3184 /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
3185 pub layout: std::option::Option<crate::model::document::page::Layout>,
3186
3187 /// A list of detected languages together with confidence.
3188 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3189
3190 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3191 }
3192
3193 impl Symbol {
3194 pub fn new() -> Self {
3195 std::default::Default::default()
3196 }
3197
3198 /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
3199 ///
3200 /// # Example
3201 /// ```ignore,no_run
3202 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3203 /// use google_cloud_documentai_v1::model::document::page::Layout;
3204 /// let x = Symbol::new().set_layout(Layout::default()/* use setters */);
3205 /// ```
3206 pub fn set_layout<T>(mut self, v: T) -> Self
3207 where
3208 T: std::convert::Into<crate::model::document::page::Layout>,
3209 {
3210 self.layout = std::option::Option::Some(v.into());
3211 self
3212 }
3213
3214 /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
3215 ///
3216 /// # Example
3217 /// ```ignore,no_run
3218 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3219 /// use google_cloud_documentai_v1::model::document::page::Layout;
3220 /// let x = Symbol::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3221 /// let x = Symbol::new().set_or_clear_layout(None::<Layout>);
3222 /// ```
3223 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3224 where
3225 T: std::convert::Into<crate::model::document::page::Layout>,
3226 {
3227 self.layout = v.map(|x| x.into());
3228 self
3229 }
3230
3231 /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
3232 ///
3233 /// # Example
3234 /// ```ignore,no_run
3235 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3236 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3237 /// let x = Symbol::new()
3238 /// .set_detected_languages([
3239 /// DetectedLanguage::default()/* use setters */,
3240 /// DetectedLanguage::default()/* use (different) setters */,
3241 /// ]);
3242 /// ```
3243 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3244 where
3245 T: std::iter::IntoIterator<Item = V>,
3246 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3247 {
3248 use std::iter::Iterator;
3249 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3250 self
3251 }
3252 }
3253
3254 impl wkt::message::Message for Symbol {
3255 fn typename() -> &'static str {
3256 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
3257 }
3258 }
3259
3260 /// Detected non-text visual elements e.g. checkbox, signature etc. on the
3261 /// page.
3262 #[derive(Clone, Default, PartialEq)]
3263 #[non_exhaustive]
3264 pub struct VisualElement {
3265 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3266 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3267 ///
3268 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3269 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3270 pub layout: std::option::Option<crate::model::document::page::Layout>,
3271
3272 /// Type of the
3273 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3274 ///
3275 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3276 pub r#type: std::string::String,
3277
3278 /// A list of detected languages together with confidence.
3279 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3280
3281 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3282 }
3283
3284 impl VisualElement {
3285 pub fn new() -> Self {
3286 std::default::Default::default()
3287 }
3288
3289 /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
3290 ///
3291 /// # Example
3292 /// ```ignore,no_run
3293 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3294 /// use google_cloud_documentai_v1::model::document::page::Layout;
3295 /// let x = VisualElement::new().set_layout(Layout::default()/* use setters */);
3296 /// ```
3297 pub fn set_layout<T>(mut self, v: T) -> Self
3298 where
3299 T: std::convert::Into<crate::model::document::page::Layout>,
3300 {
3301 self.layout = std::option::Option::Some(v.into());
3302 self
3303 }
3304
3305 /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
3306 ///
3307 /// # Example
3308 /// ```ignore,no_run
3309 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3310 /// use google_cloud_documentai_v1::model::document::page::Layout;
3311 /// let x = VisualElement::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3312 /// let x = VisualElement::new().set_or_clear_layout(None::<Layout>);
3313 /// ```
3314 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3315 where
3316 T: std::convert::Into<crate::model::document::page::Layout>,
3317 {
3318 self.layout = v.map(|x| x.into());
3319 self
3320 }
3321
3322 /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
3323 ///
3324 /// # Example
3325 /// ```ignore,no_run
3326 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3327 /// let x = VisualElement::new().set_type("example");
3328 /// ```
3329 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3330 self.r#type = v.into();
3331 self
3332 }
3333
3334 /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
3335 ///
3336 /// # Example
3337 /// ```ignore,no_run
3338 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3339 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3340 /// let x = VisualElement::new()
3341 /// .set_detected_languages([
3342 /// DetectedLanguage::default()/* use setters */,
3343 /// DetectedLanguage::default()/* use (different) setters */,
3344 /// ]);
3345 /// ```
3346 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3347 where
3348 T: std::iter::IntoIterator<Item = V>,
3349 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3350 {
3351 use std::iter::Iterator;
3352 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3353 self
3354 }
3355 }
3356
3357 impl wkt::message::Message for VisualElement {
3358 fn typename() -> &'static str {
3359 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
3360 }
3361 }
3362
3363 /// A table representation similar to HTML table structure.
3364 #[derive(Clone, Default, PartialEq)]
3365 #[non_exhaustive]
3366 pub struct Table {
3367 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3368 /// [Table][google.cloud.documentai.v1.Document.Page.Table].
3369 ///
3370 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3371 /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
3372 pub layout: std::option::Option<crate::model::document::page::Layout>,
3373
3374 /// Header rows of the table.
3375 pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3376
3377 /// Body rows of the table.
3378 pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3379
3380 /// A list of detected languages together with confidence.
3381 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3382
3383 /// The history of this table.
3384 #[deprecated]
3385 pub provenance: std::option::Option<crate::model::document::Provenance>,
3386
3387 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3388 }
3389
3390 impl Table {
3391 pub fn new() -> Self {
3392 std::default::Default::default()
3393 }
3394
3395 /// Sets the value of [layout][crate::model::document::page::Table::layout].
3396 ///
3397 /// # Example
3398 /// ```ignore,no_run
3399 /// # use google_cloud_documentai_v1::model::document::page::Table;
3400 /// use google_cloud_documentai_v1::model::document::page::Layout;
3401 /// let x = Table::new().set_layout(Layout::default()/* use setters */);
3402 /// ```
3403 pub fn set_layout<T>(mut self, v: T) -> Self
3404 where
3405 T: std::convert::Into<crate::model::document::page::Layout>,
3406 {
3407 self.layout = std::option::Option::Some(v.into());
3408 self
3409 }
3410
3411 /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
3412 ///
3413 /// # Example
3414 /// ```ignore,no_run
3415 /// # use google_cloud_documentai_v1::model::document::page::Table;
3416 /// use google_cloud_documentai_v1::model::document::page::Layout;
3417 /// let x = Table::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3418 /// let x = Table::new().set_or_clear_layout(None::<Layout>);
3419 /// ```
3420 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3421 where
3422 T: std::convert::Into<crate::model::document::page::Layout>,
3423 {
3424 self.layout = v.map(|x| x.into());
3425 self
3426 }
3427
3428 /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
3429 ///
3430 /// # Example
3431 /// ```ignore,no_run
3432 /// # use google_cloud_documentai_v1::model::document::page::Table;
3433 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3434 /// let x = Table::new()
3435 /// .set_header_rows([
3436 /// TableRow::default()/* use setters */,
3437 /// TableRow::default()/* use (different) setters */,
3438 /// ]);
3439 /// ```
3440 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
3441 where
3442 T: std::iter::IntoIterator<Item = V>,
3443 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3444 {
3445 use std::iter::Iterator;
3446 self.header_rows = v.into_iter().map(|i| i.into()).collect();
3447 self
3448 }
3449
3450 /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
3451 ///
3452 /// # Example
3453 /// ```ignore,no_run
3454 /// # use google_cloud_documentai_v1::model::document::page::Table;
3455 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3456 /// let x = Table::new()
3457 /// .set_body_rows([
3458 /// TableRow::default()/* use setters */,
3459 /// TableRow::default()/* use (different) setters */,
3460 /// ]);
3461 /// ```
3462 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
3463 where
3464 T: std::iter::IntoIterator<Item = V>,
3465 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3466 {
3467 use std::iter::Iterator;
3468 self.body_rows = v.into_iter().map(|i| i.into()).collect();
3469 self
3470 }
3471
3472 /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
3473 ///
3474 /// # Example
3475 /// ```ignore,no_run
3476 /// # use google_cloud_documentai_v1::model::document::page::Table;
3477 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3478 /// let x = Table::new()
3479 /// .set_detected_languages([
3480 /// DetectedLanguage::default()/* use setters */,
3481 /// DetectedLanguage::default()/* use (different) setters */,
3482 /// ]);
3483 /// ```
3484 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3485 where
3486 T: std::iter::IntoIterator<Item = V>,
3487 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3488 {
3489 use std::iter::Iterator;
3490 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3491 self
3492 }
3493
3494 /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
3495 ///
3496 /// # Example
3497 /// ```ignore,no_run
3498 /// # use google_cloud_documentai_v1::model::document::page::Table;
3499 /// use google_cloud_documentai_v1::model::document::Provenance;
3500 /// let x = Table::new().set_provenance(Provenance::default()/* use setters */);
3501 /// ```
3502 #[deprecated]
3503 pub fn set_provenance<T>(mut self, v: T) -> Self
3504 where
3505 T: std::convert::Into<crate::model::document::Provenance>,
3506 {
3507 self.provenance = std::option::Option::Some(v.into());
3508 self
3509 }
3510
3511 /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
3512 ///
3513 /// # Example
3514 /// ```ignore,no_run
3515 /// # use google_cloud_documentai_v1::model::document::page::Table;
3516 /// use google_cloud_documentai_v1::model::document::Provenance;
3517 /// let x = Table::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3518 /// let x = Table::new().set_or_clear_provenance(None::<Provenance>);
3519 /// ```
3520 #[deprecated]
3521 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3522 where
3523 T: std::convert::Into<crate::model::document::Provenance>,
3524 {
3525 self.provenance = v.map(|x| x.into());
3526 self
3527 }
3528 }
3529
3530 impl wkt::message::Message for Table {
3531 fn typename() -> &'static str {
3532 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
3533 }
3534 }
3535
3536 /// Defines additional types related to [Table].
3537 pub mod table {
3538 #[allow(unused_imports)]
3539 use super::*;
3540
3541 /// A row of table cells.
3542 #[derive(Clone, Default, PartialEq)]
3543 #[non_exhaustive]
3544 pub struct TableRow {
3545 /// Cells that make up this row.
3546 pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
3547
3548 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3549 }
3550
3551 impl TableRow {
3552 pub fn new() -> Self {
3553 std::default::Default::default()
3554 }
3555
3556 /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
3557 ///
3558 /// # Example
3559 /// ```ignore,no_run
3560 /// # use google_cloud_documentai_v1::model::document::page::table::TableRow;
3561 /// use google_cloud_documentai_v1::model::document::page::table::TableCell;
3562 /// let x = TableRow::new()
3563 /// .set_cells([
3564 /// TableCell::default()/* use setters */,
3565 /// TableCell::default()/* use (different) setters */,
3566 /// ]);
3567 /// ```
3568 pub fn set_cells<T, V>(mut self, v: T) -> Self
3569 where
3570 T: std::iter::IntoIterator<Item = V>,
3571 V: std::convert::Into<crate::model::document::page::table::TableCell>,
3572 {
3573 use std::iter::Iterator;
3574 self.cells = v.into_iter().map(|i| i.into()).collect();
3575 self
3576 }
3577 }
3578
3579 impl wkt::message::Message for TableRow {
3580 fn typename() -> &'static str {
3581 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
3582 }
3583 }
3584
3585 /// A cell representation inside the table.
3586 #[derive(Clone, Default, PartialEq)]
3587 #[non_exhaustive]
3588 pub struct TableCell {
3589 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3590 /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
3591 ///
3592 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3593 /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
3594 pub layout: std::option::Option<crate::model::document::page::Layout>,
3595
3596 /// How many rows this cell spans.
3597 pub row_span: i32,
3598
3599 /// How many columns this cell spans.
3600 pub col_span: i32,
3601
3602 /// A list of detected languages together with confidence.
3603 pub detected_languages:
3604 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3605
3606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3607 }
3608
3609 impl TableCell {
3610 pub fn new() -> Self {
3611 std::default::Default::default()
3612 }
3613
3614 /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
3615 ///
3616 /// # Example
3617 /// ```ignore,no_run
3618 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3619 /// use google_cloud_documentai_v1::model::document::page::Layout;
3620 /// let x = TableCell::new().set_layout(Layout::default()/* use setters */);
3621 /// ```
3622 pub fn set_layout<T>(mut self, v: T) -> Self
3623 where
3624 T: std::convert::Into<crate::model::document::page::Layout>,
3625 {
3626 self.layout = std::option::Option::Some(v.into());
3627 self
3628 }
3629
3630 /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
3631 ///
3632 /// # Example
3633 /// ```ignore,no_run
3634 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3635 /// use google_cloud_documentai_v1::model::document::page::Layout;
3636 /// let x = TableCell::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3637 /// let x = TableCell::new().set_or_clear_layout(None::<Layout>);
3638 /// ```
3639 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3640 where
3641 T: std::convert::Into<crate::model::document::page::Layout>,
3642 {
3643 self.layout = v.map(|x| x.into());
3644 self
3645 }
3646
3647 /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
3648 ///
3649 /// # Example
3650 /// ```ignore,no_run
3651 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3652 /// let x = TableCell::new().set_row_span(42);
3653 /// ```
3654 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3655 self.row_span = v.into();
3656 self
3657 }
3658
3659 /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
3660 ///
3661 /// # Example
3662 /// ```ignore,no_run
3663 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3664 /// let x = TableCell::new().set_col_span(42);
3665 /// ```
3666 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3667 self.col_span = v.into();
3668 self
3669 }
3670
3671 /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
3672 ///
3673 /// # Example
3674 /// ```ignore,no_run
3675 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3676 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3677 /// let x = TableCell::new()
3678 /// .set_detected_languages([
3679 /// DetectedLanguage::default()/* use setters */,
3680 /// DetectedLanguage::default()/* use (different) setters */,
3681 /// ]);
3682 /// ```
3683 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3684 where
3685 T: std::iter::IntoIterator<Item = V>,
3686 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3687 {
3688 use std::iter::Iterator;
3689 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3690 self
3691 }
3692 }
3693
3694 impl wkt::message::Message for TableCell {
3695 fn typename() -> &'static str {
3696 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
3697 }
3698 }
3699 }
3700
3701 /// A form field detected on the page.
3702 #[derive(Clone, Default, PartialEq)]
3703 #[non_exhaustive]
3704 pub struct FormField {
3705 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3706 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
3707 /// e.g. `Address`, `Email`, `Grand total`, `Phone number`, etc.
3708 ///
3709 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3710 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3711 pub field_name: std::option::Option<crate::model::document::page::Layout>,
3712
3713 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3714 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
3715 ///
3716 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3717 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3718 pub field_value: std::option::Option<crate::model::document::page::Layout>,
3719
3720 /// A list of detected languages for name together with confidence.
3721 pub name_detected_languages:
3722 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3723
3724 /// A list of detected languages for value together with confidence.
3725 pub value_detected_languages:
3726 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3727
3728 /// If the value is non-textual, this field represents the type. Current
3729 /// valid values are:
3730 ///
3731 /// - blank (this indicates the `field_value` is normal text)
3732 /// - `unfilled_checkbox`
3733 /// - `filled_checkbox`
3734 pub value_type: std::string::String,
3735
3736 /// Created for Labeling UI to export key text.
3737 /// If corrections were made to the text identified by the
3738 /// `field_name.text_anchor`, this field will contain the correction.
3739 pub corrected_key_text: std::string::String,
3740
3741 /// Created for Labeling UI to export value text.
3742 /// If corrections were made to the text identified by the
3743 /// `field_value.text_anchor`, this field will contain the correction.
3744 pub corrected_value_text: std::string::String,
3745
3746 /// The history of this annotation.
3747 pub provenance: std::option::Option<crate::model::document::Provenance>,
3748
3749 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3750 }
3751
3752 impl FormField {
3753 pub fn new() -> Self {
3754 std::default::Default::default()
3755 }
3756
3757 /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
3758 ///
3759 /// # Example
3760 /// ```ignore,no_run
3761 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3762 /// use google_cloud_documentai_v1::model::document::page::Layout;
3763 /// let x = FormField::new().set_field_name(Layout::default()/* use setters */);
3764 /// ```
3765 pub fn set_field_name<T>(mut self, v: T) -> Self
3766 where
3767 T: std::convert::Into<crate::model::document::page::Layout>,
3768 {
3769 self.field_name = std::option::Option::Some(v.into());
3770 self
3771 }
3772
3773 /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
3774 ///
3775 /// # Example
3776 /// ```ignore,no_run
3777 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3778 /// use google_cloud_documentai_v1::model::document::page::Layout;
3779 /// let x = FormField::new().set_or_clear_field_name(Some(Layout::default()/* use setters */));
3780 /// let x = FormField::new().set_or_clear_field_name(None::<Layout>);
3781 /// ```
3782 pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
3783 where
3784 T: std::convert::Into<crate::model::document::page::Layout>,
3785 {
3786 self.field_name = v.map(|x| x.into());
3787 self
3788 }
3789
3790 /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
3791 ///
3792 /// # Example
3793 /// ```ignore,no_run
3794 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3795 /// use google_cloud_documentai_v1::model::document::page::Layout;
3796 /// let x = FormField::new().set_field_value(Layout::default()/* use setters */);
3797 /// ```
3798 pub fn set_field_value<T>(mut self, v: T) -> Self
3799 where
3800 T: std::convert::Into<crate::model::document::page::Layout>,
3801 {
3802 self.field_value = std::option::Option::Some(v.into());
3803 self
3804 }
3805
3806 /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
3807 ///
3808 /// # Example
3809 /// ```ignore,no_run
3810 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3811 /// use google_cloud_documentai_v1::model::document::page::Layout;
3812 /// let x = FormField::new().set_or_clear_field_value(Some(Layout::default()/* use setters */));
3813 /// let x = FormField::new().set_or_clear_field_value(None::<Layout>);
3814 /// ```
3815 pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
3816 where
3817 T: std::convert::Into<crate::model::document::page::Layout>,
3818 {
3819 self.field_value = v.map(|x| x.into());
3820 self
3821 }
3822
3823 /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_detected_languages].
3824 ///
3825 /// # Example
3826 /// ```ignore,no_run
3827 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3828 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3829 /// let x = FormField::new()
3830 /// .set_name_detected_languages([
3831 /// DetectedLanguage::default()/* use setters */,
3832 /// DetectedLanguage::default()/* use (different) setters */,
3833 /// ]);
3834 /// ```
3835 pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
3836 where
3837 T: std::iter::IntoIterator<Item = V>,
3838 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3839 {
3840 use std::iter::Iterator;
3841 self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
3842 self
3843 }
3844
3845 /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
3846 ///
3847 /// # Example
3848 /// ```ignore,no_run
3849 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3850 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3851 /// let x = FormField::new()
3852 /// .set_value_detected_languages([
3853 /// DetectedLanguage::default()/* use setters */,
3854 /// DetectedLanguage::default()/* use (different) setters */,
3855 /// ]);
3856 /// ```
3857 pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
3858 where
3859 T: std::iter::IntoIterator<Item = V>,
3860 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3861 {
3862 use std::iter::Iterator;
3863 self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
3864 self
3865 }
3866
3867 /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
3868 ///
3869 /// # Example
3870 /// ```ignore,no_run
3871 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3872 /// let x = FormField::new().set_value_type("example");
3873 /// ```
3874 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
3875 mut self,
3876 v: T,
3877 ) -> Self {
3878 self.value_type = v.into();
3879 self
3880 }
3881
3882 /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
3883 ///
3884 /// # Example
3885 /// ```ignore,no_run
3886 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3887 /// let x = FormField::new().set_corrected_key_text("example");
3888 /// ```
3889 pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
3890 mut self,
3891 v: T,
3892 ) -> Self {
3893 self.corrected_key_text = v.into();
3894 self
3895 }
3896
3897 /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
3898 ///
3899 /// # Example
3900 /// ```ignore,no_run
3901 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3902 /// let x = FormField::new().set_corrected_value_text("example");
3903 /// ```
3904 pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
3905 mut self,
3906 v: T,
3907 ) -> Self {
3908 self.corrected_value_text = v.into();
3909 self
3910 }
3911
3912 /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
3913 ///
3914 /// # Example
3915 /// ```ignore,no_run
3916 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3917 /// use google_cloud_documentai_v1::model::document::Provenance;
3918 /// let x = FormField::new().set_provenance(Provenance::default()/* use setters */);
3919 /// ```
3920 pub fn set_provenance<T>(mut self, v: T) -> Self
3921 where
3922 T: std::convert::Into<crate::model::document::Provenance>,
3923 {
3924 self.provenance = std::option::Option::Some(v.into());
3925 self
3926 }
3927
3928 /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
3929 ///
3930 /// # Example
3931 /// ```ignore,no_run
3932 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3933 /// use google_cloud_documentai_v1::model::document::Provenance;
3934 /// let x = FormField::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3935 /// let x = FormField::new().set_or_clear_provenance(None::<Provenance>);
3936 /// ```
3937 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3938 where
3939 T: std::convert::Into<crate::model::document::Provenance>,
3940 {
3941 self.provenance = v.map(|x| x.into());
3942 self
3943 }
3944 }
3945
3946 impl wkt::message::Message for FormField {
3947 fn typename() -> &'static str {
3948 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
3949 }
3950 }
3951
3952 /// A detected barcode.
3953 #[derive(Clone, Default, PartialEq)]
3954 #[non_exhaustive]
3955 pub struct DetectedBarcode {
3956 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3957 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
3958 ///
3959 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
3960 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3961 pub layout: std::option::Option<crate::model::document::page::Layout>,
3962
3963 /// Detailed barcode information of the
3964 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
3965 ///
3966 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
3967 pub barcode: std::option::Option<crate::model::Barcode>,
3968
3969 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3970 }
3971
3972 impl DetectedBarcode {
3973 pub fn new() -> Self {
3974 std::default::Default::default()
3975 }
3976
3977 /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
3978 ///
3979 /// # Example
3980 /// ```ignore,no_run
3981 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
3982 /// use google_cloud_documentai_v1::model::document::page::Layout;
3983 /// let x = DetectedBarcode::new().set_layout(Layout::default()/* use setters */);
3984 /// ```
3985 pub fn set_layout<T>(mut self, v: T) -> Self
3986 where
3987 T: std::convert::Into<crate::model::document::page::Layout>,
3988 {
3989 self.layout = std::option::Option::Some(v.into());
3990 self
3991 }
3992
3993 /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
3994 ///
3995 /// # Example
3996 /// ```ignore,no_run
3997 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
3998 /// use google_cloud_documentai_v1::model::document::page::Layout;
3999 /// let x = DetectedBarcode::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
4000 /// let x = DetectedBarcode::new().set_or_clear_layout(None::<Layout>);
4001 /// ```
4002 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
4003 where
4004 T: std::convert::Into<crate::model::document::page::Layout>,
4005 {
4006 self.layout = v.map(|x| x.into());
4007 self
4008 }
4009
4010 /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4011 ///
4012 /// # Example
4013 /// ```ignore,no_run
4014 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4015 /// use google_cloud_documentai_v1::model::Barcode;
4016 /// let x = DetectedBarcode::new().set_barcode(Barcode::default()/* use setters */);
4017 /// ```
4018 pub fn set_barcode<T>(mut self, v: T) -> Self
4019 where
4020 T: std::convert::Into<crate::model::Barcode>,
4021 {
4022 self.barcode = std::option::Option::Some(v.into());
4023 self
4024 }
4025
4026 /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4027 ///
4028 /// # Example
4029 /// ```ignore,no_run
4030 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4031 /// use google_cloud_documentai_v1::model::Barcode;
4032 /// let x = DetectedBarcode::new().set_or_clear_barcode(Some(Barcode::default()/* use setters */));
4033 /// let x = DetectedBarcode::new().set_or_clear_barcode(None::<Barcode>);
4034 /// ```
4035 pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
4036 where
4037 T: std::convert::Into<crate::model::Barcode>,
4038 {
4039 self.barcode = v.map(|x| x.into());
4040 self
4041 }
4042 }
4043
4044 impl wkt::message::Message for DetectedBarcode {
4045 fn typename() -> &'static str {
4046 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
4047 }
4048 }
4049
4050 /// Detected language for a structural component.
4051 #[derive(Clone, Default, PartialEq)]
4052 #[non_exhaustive]
4053 pub struct DetectedLanguage {
4054 /// The [BCP-47 language
4055 /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
4056 /// such as `en-US` or `sr-Latn`.
4057 pub language_code: std::string::String,
4058
4059 /// Confidence of detected language. Range `[0, 1]`.
4060 pub confidence: f32,
4061
4062 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4063 }
4064
4065 impl DetectedLanguage {
4066 pub fn new() -> Self {
4067 std::default::Default::default()
4068 }
4069
4070 /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
4071 ///
4072 /// # Example
4073 /// ```ignore,no_run
4074 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4075 /// let x = DetectedLanguage::new().set_language_code("example");
4076 /// ```
4077 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4078 mut self,
4079 v: T,
4080 ) -> Self {
4081 self.language_code = v.into();
4082 self
4083 }
4084
4085 /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
4086 ///
4087 /// # Example
4088 /// ```ignore,no_run
4089 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4090 /// let x = DetectedLanguage::new().set_confidence(42.0);
4091 /// ```
4092 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4093 self.confidence = v.into();
4094 self
4095 }
4096 }
4097
4098 impl wkt::message::Message for DetectedLanguage {
4099 fn typename() -> &'static str {
4100 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
4101 }
4102 }
4103
4104 /// Image quality scores for the page image.
4105 #[derive(Clone, Default, PartialEq)]
4106 #[non_exhaustive]
4107 pub struct ImageQualityScores {
4108 /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
4109 pub quality_score: f32,
4110
4111 /// A list of detected defects.
4112 pub detected_defects:
4113 std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
4114
4115 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4116 }
4117
4118 impl ImageQualityScores {
4119 pub fn new() -> Self {
4120 std::default::Default::default()
4121 }
4122
4123 /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
4124 ///
4125 /// # Example
4126 /// ```ignore,no_run
4127 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4128 /// let x = ImageQualityScores::new().set_quality_score(42.0);
4129 /// ```
4130 pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4131 self.quality_score = v.into();
4132 self
4133 }
4134
4135 /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
4136 ///
4137 /// # Example
4138 /// ```ignore,no_run
4139 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4140 /// use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4141 /// let x = ImageQualityScores::new()
4142 /// .set_detected_defects([
4143 /// DetectedDefect::default()/* use setters */,
4144 /// DetectedDefect::default()/* use (different) setters */,
4145 /// ]);
4146 /// ```
4147 pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
4148 where
4149 T: std::iter::IntoIterator<Item = V>,
4150 V: std::convert::Into<
4151 crate::model::document::page::image_quality_scores::DetectedDefect,
4152 >,
4153 {
4154 use std::iter::Iterator;
4155 self.detected_defects = v.into_iter().map(|i| i.into()).collect();
4156 self
4157 }
4158 }
4159
4160 impl wkt::message::Message for ImageQualityScores {
4161 fn typename() -> &'static str {
4162 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
4163 }
4164 }
4165
4166 /// Defines additional types related to [ImageQualityScores].
4167 pub mod image_quality_scores {
4168 #[allow(unused_imports)]
4169 use super::*;
4170
4171 /// Image Quality Defects
4172 #[derive(Clone, Default, PartialEq)]
4173 #[non_exhaustive]
4174 pub struct DetectedDefect {
4175 /// Name of the defect type. Supported values are:
4176 ///
4177 /// - `quality/defect_blurry`
4178 /// - `quality/defect_noisy`
4179 /// - `quality/defect_dark`
4180 /// - `quality/defect_faint`
4181 /// - `quality/defect_text_too_small`
4182 /// - `quality/defect_document_cutoff`
4183 /// - `quality/defect_text_cutoff`
4184 /// - `quality/defect_glare`
4185 pub r#type: std::string::String,
4186
4187 /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
4188 /// strong confidence that the defect exists.
4189 pub confidence: f32,
4190
4191 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4192 }
4193
4194 impl DetectedDefect {
4195 pub fn new() -> Self {
4196 std::default::Default::default()
4197 }
4198
4199 /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
4200 ///
4201 /// # Example
4202 /// ```ignore,no_run
4203 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4204 /// let x = DetectedDefect::new().set_type("example");
4205 /// ```
4206 pub fn set_type<T: std::convert::Into<std::string::String>>(
4207 mut self,
4208 v: T,
4209 ) -> Self {
4210 self.r#type = v.into();
4211 self
4212 }
4213
4214 /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
4215 ///
4216 /// # Example
4217 /// ```ignore,no_run
4218 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4219 /// let x = DetectedDefect::new().set_confidence(42.0);
4220 /// ```
4221 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4222 self.confidence = v.into();
4223 self
4224 }
4225 }
4226
4227 impl wkt::message::Message for DetectedDefect {
4228 fn typename() -> &'static str {
4229 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
4230 }
4231 }
4232 }
4233 }
4234
4235 /// An entity that could be a phrase in the text or a property that belongs to
4236 /// the document. It is a known entity type, such as a person, an organization,
4237 /// or location.
4238 #[derive(Clone, Default, PartialEq)]
4239 #[non_exhaustive]
4240 pub struct Entity {
4241 /// Optional. Provenance of the entity.
4242 /// Text anchor indexing into the
4243 /// [Document.text][google.cloud.documentai.v1.Document.text].
4244 ///
4245 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
4246 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4247
4248 /// Required. Entity type from a schema e.g. `Address`.
4249 pub r#type: std::string::String,
4250
4251 /// Optional. Text value of the entity e.g. `1600 Amphitheatre Pkwy`.
4252 pub mention_text: std::string::String,
4253
4254 /// Optional. Deprecated. Use `id` field instead.
4255 pub mention_id: std::string::String,
4256
4257 /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
4258 pub confidence: f32,
4259
4260 /// Optional. Represents the provenance of this entity wrt. the location on
4261 /// the page where it was found.
4262 pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
4263
4264 /// Optional. Canonical id. This will be a unique value in the entity list
4265 /// for this document.
4266 pub id: std::string::String,
4267
4268 /// Optional. Normalized entity value. Absent if the extracted value could
4269 /// not be converted or the type (e.g. address) is not supported for certain
4270 /// parsers. This field is also only populated for certain supported document
4271 /// types.
4272 pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
4273
4274 /// Optional. Entities can be nested to form a hierarchical data structure
4275 /// representing the content in the document.
4276 pub properties: std::vec::Vec<crate::model::document::Entity>,
4277
4278 /// Optional. The history of this annotation.
4279 pub provenance: std::option::Option<crate::model::document::Provenance>,
4280
4281 /// Optional. Whether the entity will be redacted for de-identification
4282 /// purposes.
4283 pub redacted: bool,
4284
4285 /// Optional. Specifies how the entity's value is obtained.
4286 pub method: crate::model::document::entity::Method,
4287
4288 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4289 }
4290
4291 impl Entity {
4292 pub fn new() -> Self {
4293 std::default::Default::default()
4294 }
4295
4296 /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
4297 ///
4298 /// # Example
4299 /// ```ignore,no_run
4300 /// # use google_cloud_documentai_v1::model::document::Entity;
4301 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4302 /// let x = Entity::new().set_text_anchor(TextAnchor::default()/* use setters */);
4303 /// ```
4304 pub fn set_text_anchor<T>(mut self, v: T) -> Self
4305 where
4306 T: std::convert::Into<crate::model::document::TextAnchor>,
4307 {
4308 self.text_anchor = std::option::Option::Some(v.into());
4309 self
4310 }
4311
4312 /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
4313 ///
4314 /// # Example
4315 /// ```ignore,no_run
4316 /// # use google_cloud_documentai_v1::model::document::Entity;
4317 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4318 /// let x = Entity::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
4319 /// let x = Entity::new().set_or_clear_text_anchor(None::<TextAnchor>);
4320 /// ```
4321 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4322 where
4323 T: std::convert::Into<crate::model::document::TextAnchor>,
4324 {
4325 self.text_anchor = v.map(|x| x.into());
4326 self
4327 }
4328
4329 /// Sets the value of [r#type][crate::model::document::Entity::type].
4330 ///
4331 /// # Example
4332 /// ```ignore,no_run
4333 /// # use google_cloud_documentai_v1::model::document::Entity;
4334 /// let x = Entity::new().set_type("example");
4335 /// ```
4336 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4337 self.r#type = v.into();
4338 self
4339 }
4340
4341 /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
4342 ///
4343 /// # Example
4344 /// ```ignore,no_run
4345 /// # use google_cloud_documentai_v1::model::document::Entity;
4346 /// let x = Entity::new().set_mention_text("example");
4347 /// ```
4348 pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
4349 mut self,
4350 v: T,
4351 ) -> Self {
4352 self.mention_text = v.into();
4353 self
4354 }
4355
4356 /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
4357 ///
4358 /// # Example
4359 /// ```ignore,no_run
4360 /// # use google_cloud_documentai_v1::model::document::Entity;
4361 /// let x = Entity::new().set_mention_id("example");
4362 /// ```
4363 pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4364 self.mention_id = v.into();
4365 self
4366 }
4367
4368 /// Sets the value of [confidence][crate::model::document::Entity::confidence].
4369 ///
4370 /// # Example
4371 /// ```ignore,no_run
4372 /// # use google_cloud_documentai_v1::model::document::Entity;
4373 /// let x = Entity::new().set_confidence(42.0);
4374 /// ```
4375 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4376 self.confidence = v.into();
4377 self
4378 }
4379
4380 /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
4381 ///
4382 /// # Example
4383 /// ```ignore,no_run
4384 /// # use google_cloud_documentai_v1::model::document::Entity;
4385 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4386 /// let x = Entity::new().set_page_anchor(PageAnchor::default()/* use setters */);
4387 /// ```
4388 pub fn set_page_anchor<T>(mut self, v: T) -> Self
4389 where
4390 T: std::convert::Into<crate::model::document::PageAnchor>,
4391 {
4392 self.page_anchor = std::option::Option::Some(v.into());
4393 self
4394 }
4395
4396 /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
4397 ///
4398 /// # Example
4399 /// ```ignore,no_run
4400 /// # use google_cloud_documentai_v1::model::document::Entity;
4401 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4402 /// let x = Entity::new().set_or_clear_page_anchor(Some(PageAnchor::default()/* use setters */));
4403 /// let x = Entity::new().set_or_clear_page_anchor(None::<PageAnchor>);
4404 /// ```
4405 pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4406 where
4407 T: std::convert::Into<crate::model::document::PageAnchor>,
4408 {
4409 self.page_anchor = v.map(|x| x.into());
4410 self
4411 }
4412
4413 /// Sets the value of [id][crate::model::document::Entity::id].
4414 ///
4415 /// # Example
4416 /// ```ignore,no_run
4417 /// # use google_cloud_documentai_v1::model::document::Entity;
4418 /// let x = Entity::new().set_id("example");
4419 /// ```
4420 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4421 self.id = v.into();
4422 self
4423 }
4424
4425 /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
4426 ///
4427 /// # Example
4428 /// ```ignore,no_run
4429 /// # use google_cloud_documentai_v1::model::document::Entity;
4430 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4431 /// let x = Entity::new().set_normalized_value(NormalizedValue::default()/* use setters */);
4432 /// ```
4433 pub fn set_normalized_value<T>(mut self, v: T) -> Self
4434 where
4435 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4436 {
4437 self.normalized_value = std::option::Option::Some(v.into());
4438 self
4439 }
4440
4441 /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
4442 ///
4443 /// # Example
4444 /// ```ignore,no_run
4445 /// # use google_cloud_documentai_v1::model::document::Entity;
4446 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4447 /// let x = Entity::new().set_or_clear_normalized_value(Some(NormalizedValue::default()/* use setters */));
4448 /// let x = Entity::new().set_or_clear_normalized_value(None::<NormalizedValue>);
4449 /// ```
4450 pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
4451 where
4452 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4453 {
4454 self.normalized_value = v.map(|x| x.into());
4455 self
4456 }
4457
4458 /// Sets the value of [properties][crate::model::document::Entity::properties].
4459 ///
4460 /// # Example
4461 /// ```ignore,no_run
4462 /// # use google_cloud_documentai_v1::model::document::Entity;
4463 /// let x = Entity::new()
4464 /// .set_properties([
4465 /// Entity::default()/* use setters */,
4466 /// Entity::default()/* use (different) setters */,
4467 /// ]);
4468 /// ```
4469 pub fn set_properties<T, V>(mut self, v: T) -> Self
4470 where
4471 T: std::iter::IntoIterator<Item = V>,
4472 V: std::convert::Into<crate::model::document::Entity>,
4473 {
4474 use std::iter::Iterator;
4475 self.properties = v.into_iter().map(|i| i.into()).collect();
4476 self
4477 }
4478
4479 /// Sets the value of [provenance][crate::model::document::Entity::provenance].
4480 ///
4481 /// # Example
4482 /// ```ignore,no_run
4483 /// # use google_cloud_documentai_v1::model::document::Entity;
4484 /// use google_cloud_documentai_v1::model::document::Provenance;
4485 /// let x = Entity::new().set_provenance(Provenance::default()/* use setters */);
4486 /// ```
4487 pub fn set_provenance<T>(mut self, v: T) -> Self
4488 where
4489 T: std::convert::Into<crate::model::document::Provenance>,
4490 {
4491 self.provenance = std::option::Option::Some(v.into());
4492 self
4493 }
4494
4495 /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_documentai_v1::model::document::Entity;
4500 /// use google_cloud_documentai_v1::model::document::Provenance;
4501 /// let x = Entity::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
4502 /// let x = Entity::new().set_or_clear_provenance(None::<Provenance>);
4503 /// ```
4504 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
4505 where
4506 T: std::convert::Into<crate::model::document::Provenance>,
4507 {
4508 self.provenance = v.map(|x| x.into());
4509 self
4510 }
4511
4512 /// Sets the value of [redacted][crate::model::document::Entity::redacted].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_documentai_v1::model::document::Entity;
4517 /// let x = Entity::new().set_redacted(true);
4518 /// ```
4519 pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4520 self.redacted = v.into();
4521 self
4522 }
4523
4524 /// Sets the value of [method][crate::model::document::Entity::method].
4525 ///
4526 /// # Example
4527 /// ```ignore,no_run
4528 /// # use google_cloud_documentai_v1::model::document::Entity;
4529 /// use google_cloud_documentai_v1::model::document::entity::Method;
4530 /// let x0 = Entity::new().set_method(Method::Extract);
4531 /// let x1 = Entity::new().set_method(Method::Derive);
4532 /// ```
4533 pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
4534 mut self,
4535 v: T,
4536 ) -> Self {
4537 self.method = v.into();
4538 self
4539 }
4540 }
4541
4542 impl wkt::message::Message for Entity {
4543 fn typename() -> &'static str {
4544 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
4545 }
4546 }
4547
4548 /// Defines additional types related to [Entity].
4549 pub mod entity {
4550 #[allow(unused_imports)]
4551 use super::*;
4552
4553 /// Parsed and normalized entity value.
4554 #[derive(Clone, Default, PartialEq)]
4555 #[non_exhaustive]
4556 pub struct NormalizedValue {
4557 /// Optional. An optional field to store a normalized string.
4558 /// For some entity types, one of respective `structured_value` fields may
4559 /// also be populated. Also not all the types of `structured_value` will be
4560 /// normalized. For example, some processors may not generate `float`
4561 /// or `integer` normalized text by default.
4562 ///
4563 /// Below are sample formats mapped to structured values.
4564 ///
4565 /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
4566 /// - Date type (`date_value`) is in the ISO 8601 text format.
4567 /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
4568 pub text: std::string::String,
4569
4570 /// An optional structured entity value.
4571 /// Must match entity type defined in schema if
4572 /// known. If this field is present, the `text` field could also be
4573 /// populated.
4574 pub structured_value: std::option::Option<
4575 crate::model::document::entity::normalized_value::StructuredValue,
4576 >,
4577
4578 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4579 }
4580
4581 impl NormalizedValue {
4582 pub fn new() -> Self {
4583 std::default::Default::default()
4584 }
4585
4586 /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
4587 ///
4588 /// # Example
4589 /// ```ignore,no_run
4590 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4591 /// let x = NormalizedValue::new().set_text("example");
4592 /// ```
4593 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4594 self.text = v.into();
4595 self
4596 }
4597
4598 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
4599 ///
4600 /// Note that all the setters affecting `structured_value` are mutually
4601 /// exclusive.
4602 ///
4603 /// # Example
4604 /// ```ignore,no_run
4605 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4606 /// use google_cloud_documentai_v1::model::document::entity::normalized_value::StructuredValue;
4607 /// let x = NormalizedValue::new().set_structured_value(Some(StructuredValue::BooleanValue(true)));
4608 /// ```
4609 pub fn set_structured_value<
4610 T: std::convert::Into<
4611 std::option::Option<
4612 crate::model::document::entity::normalized_value::StructuredValue,
4613 >,
4614 >,
4615 >(
4616 mut self,
4617 v: T,
4618 ) -> Self {
4619 self.structured_value = v.into();
4620 self
4621 }
4622
4623 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4624 /// if it holds a `MoneyValue`, `None` if the field is not set or
4625 /// holds a different branch.
4626 pub fn money_value(
4627 &self,
4628 ) -> std::option::Option<&std::boxed::Box<gtype::model::Money>> {
4629 #[allow(unreachable_patterns)]
4630 self.structured_value.as_ref().and_then(|v| match v {
4631 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
4632 _ => std::option::Option::None,
4633 })
4634 }
4635
4636 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4637 /// to hold a `MoneyValue`.
4638 ///
4639 /// Note that all the setters affecting `structured_value` are
4640 /// mutually exclusive.
4641 ///
4642 /// # Example
4643 /// ```ignore,no_run
4644 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4645 /// use gtype::model::Money;
4646 /// let x = NormalizedValue::new().set_money_value(Money::default()/* use setters */);
4647 /// assert!(x.money_value().is_some());
4648 /// assert!(x.date_value().is_none());
4649 /// assert!(x.datetime_value().is_none());
4650 /// assert!(x.address_value().is_none());
4651 /// assert!(x.boolean_value().is_none());
4652 /// assert!(x.integer_value().is_none());
4653 /// assert!(x.float_value().is_none());
4654 /// assert!(x.signature_value().is_none());
4655 /// ```
4656 pub fn set_money_value<T: std::convert::Into<std::boxed::Box<gtype::model::Money>>>(
4657 mut self,
4658 v: T,
4659 ) -> Self {
4660 self.structured_value = std::option::Option::Some(
4661 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
4662 v.into(),
4663 ),
4664 );
4665 self
4666 }
4667
4668 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4669 /// if it holds a `DateValue`, `None` if the field is not set or
4670 /// holds a different branch.
4671 pub fn date_value(&self) -> std::option::Option<&std::boxed::Box<gtype::model::Date>> {
4672 #[allow(unreachable_patterns)]
4673 self.structured_value.as_ref().and_then(|v| match v {
4674 crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
4675 _ => std::option::Option::None,
4676 })
4677 }
4678
4679 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4680 /// to hold a `DateValue`.
4681 ///
4682 /// Note that all the setters affecting `structured_value` are
4683 /// mutually exclusive.
4684 ///
4685 /// # Example
4686 /// ```ignore,no_run
4687 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4688 /// use gtype::model::Date;
4689 /// let x = NormalizedValue::new().set_date_value(Date::default()/* use setters */);
4690 /// assert!(x.date_value().is_some());
4691 /// assert!(x.money_value().is_none());
4692 /// assert!(x.datetime_value().is_none());
4693 /// assert!(x.address_value().is_none());
4694 /// assert!(x.boolean_value().is_none());
4695 /// assert!(x.integer_value().is_none());
4696 /// assert!(x.float_value().is_none());
4697 /// assert!(x.signature_value().is_none());
4698 /// ```
4699 pub fn set_date_value<T: std::convert::Into<std::boxed::Box<gtype::model::Date>>>(
4700 mut self,
4701 v: T,
4702 ) -> Self {
4703 self.structured_value = std::option::Option::Some(
4704 crate::model::document::entity::normalized_value::StructuredValue::DateValue(
4705 v.into(),
4706 ),
4707 );
4708 self
4709 }
4710
4711 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4712 /// if it holds a `DatetimeValue`, `None` if the field is not set or
4713 /// holds a different branch.
4714 pub fn datetime_value(
4715 &self,
4716 ) -> std::option::Option<&std::boxed::Box<gtype::model::DateTime>> {
4717 #[allow(unreachable_patterns)]
4718 self.structured_value.as_ref().and_then(|v| match v {
4719 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
4720 _ => std::option::Option::None,
4721 })
4722 }
4723
4724 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4725 /// to hold a `DatetimeValue`.
4726 ///
4727 /// Note that all the setters affecting `structured_value` are
4728 /// mutually exclusive.
4729 ///
4730 /// # Example
4731 /// ```ignore,no_run
4732 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4733 /// use gtype::model::DateTime;
4734 /// let x = NormalizedValue::new().set_datetime_value(DateTime::default()/* use setters */);
4735 /// assert!(x.datetime_value().is_some());
4736 /// assert!(x.money_value().is_none());
4737 /// assert!(x.date_value().is_none());
4738 /// assert!(x.address_value().is_none());
4739 /// assert!(x.boolean_value().is_none());
4740 /// assert!(x.integer_value().is_none());
4741 /// assert!(x.float_value().is_none());
4742 /// assert!(x.signature_value().is_none());
4743 /// ```
4744 pub fn set_datetime_value<
4745 T: std::convert::Into<std::boxed::Box<gtype::model::DateTime>>,
4746 >(
4747 mut self,
4748 v: T,
4749 ) -> Self {
4750 self.structured_value = std::option::Option::Some(
4751 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
4752 v.into()
4753 )
4754 );
4755 self
4756 }
4757
4758 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4759 /// if it holds a `AddressValue`, `None` if the field is not set or
4760 /// holds a different branch.
4761 pub fn address_value(
4762 &self,
4763 ) -> std::option::Option<&std::boxed::Box<gtype::model::PostalAddress>> {
4764 #[allow(unreachable_patterns)]
4765 self.structured_value.as_ref().and_then(|v| match v {
4766 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
4767 _ => std::option::Option::None,
4768 })
4769 }
4770
4771 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4772 /// to hold a `AddressValue`.
4773 ///
4774 /// Note that all the setters affecting `structured_value` are
4775 /// mutually exclusive.
4776 ///
4777 /// # Example
4778 /// ```ignore,no_run
4779 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4780 /// use gtype::model::PostalAddress;
4781 /// let x = NormalizedValue::new().set_address_value(PostalAddress::default()/* use setters */);
4782 /// assert!(x.address_value().is_some());
4783 /// assert!(x.money_value().is_none());
4784 /// assert!(x.date_value().is_none());
4785 /// assert!(x.datetime_value().is_none());
4786 /// assert!(x.boolean_value().is_none());
4787 /// assert!(x.integer_value().is_none());
4788 /// assert!(x.float_value().is_none());
4789 /// assert!(x.signature_value().is_none());
4790 /// ```
4791 pub fn set_address_value<
4792 T: std::convert::Into<std::boxed::Box<gtype::model::PostalAddress>>,
4793 >(
4794 mut self,
4795 v: T,
4796 ) -> Self {
4797 self.structured_value = std::option::Option::Some(
4798 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
4799 v.into(),
4800 ),
4801 );
4802 self
4803 }
4804
4805 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4806 /// if it holds a `BooleanValue`, `None` if the field is not set or
4807 /// holds a different branch.
4808 pub fn boolean_value(&self) -> std::option::Option<&bool> {
4809 #[allow(unreachable_patterns)]
4810 self.structured_value.as_ref().and_then(|v| match v {
4811 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
4812 _ => std::option::Option::None,
4813 })
4814 }
4815
4816 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4817 /// to hold a `BooleanValue`.
4818 ///
4819 /// Note that all the setters affecting `structured_value` are
4820 /// mutually exclusive.
4821 ///
4822 /// # Example
4823 /// ```ignore,no_run
4824 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4825 /// let x = NormalizedValue::new().set_boolean_value(true);
4826 /// assert!(x.boolean_value().is_some());
4827 /// assert!(x.money_value().is_none());
4828 /// assert!(x.date_value().is_none());
4829 /// assert!(x.datetime_value().is_none());
4830 /// assert!(x.address_value().is_none());
4831 /// assert!(x.integer_value().is_none());
4832 /// assert!(x.float_value().is_none());
4833 /// assert!(x.signature_value().is_none());
4834 /// ```
4835 pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4836 self.structured_value = std::option::Option::Some(
4837 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
4838 v.into(),
4839 ),
4840 );
4841 self
4842 }
4843
4844 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4845 /// if it holds a `IntegerValue`, `None` if the field is not set or
4846 /// holds a different branch.
4847 pub fn integer_value(&self) -> std::option::Option<&i32> {
4848 #[allow(unreachable_patterns)]
4849 self.structured_value.as_ref().and_then(|v| match v {
4850 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
4851 _ => std::option::Option::None,
4852 })
4853 }
4854
4855 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4856 /// to hold a `IntegerValue`.
4857 ///
4858 /// Note that all the setters affecting `structured_value` are
4859 /// mutually exclusive.
4860 ///
4861 /// # Example
4862 /// ```ignore,no_run
4863 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4864 /// let x = NormalizedValue::new().set_integer_value(42);
4865 /// assert!(x.integer_value().is_some());
4866 /// assert!(x.money_value().is_none());
4867 /// assert!(x.date_value().is_none());
4868 /// assert!(x.datetime_value().is_none());
4869 /// assert!(x.address_value().is_none());
4870 /// assert!(x.boolean_value().is_none());
4871 /// assert!(x.float_value().is_none());
4872 /// assert!(x.signature_value().is_none());
4873 /// ```
4874 pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4875 self.structured_value = std::option::Option::Some(
4876 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
4877 v.into(),
4878 ),
4879 );
4880 self
4881 }
4882
4883 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4884 /// if it holds a `FloatValue`, `None` if the field is not set or
4885 /// holds a different branch.
4886 pub fn float_value(&self) -> std::option::Option<&f32> {
4887 #[allow(unreachable_patterns)]
4888 self.structured_value.as_ref().and_then(|v| match v {
4889 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
4890 _ => std::option::Option::None,
4891 })
4892 }
4893
4894 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4895 /// to hold a `FloatValue`.
4896 ///
4897 /// Note that all the setters affecting `structured_value` are
4898 /// mutually exclusive.
4899 ///
4900 /// # Example
4901 /// ```ignore,no_run
4902 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4903 /// let x = NormalizedValue::new().set_float_value(42.0);
4904 /// assert!(x.float_value().is_some());
4905 /// assert!(x.money_value().is_none());
4906 /// assert!(x.date_value().is_none());
4907 /// assert!(x.datetime_value().is_none());
4908 /// assert!(x.address_value().is_none());
4909 /// assert!(x.boolean_value().is_none());
4910 /// assert!(x.integer_value().is_none());
4911 /// assert!(x.signature_value().is_none());
4912 /// ```
4913 pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4914 self.structured_value = std::option::Option::Some(
4915 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
4916 v.into(),
4917 ),
4918 );
4919 self
4920 }
4921
4922 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4923 /// if it holds a `SignatureValue`, `None` if the field is not set or
4924 /// holds a different branch.
4925 pub fn signature_value(&self) -> std::option::Option<&bool> {
4926 #[allow(unreachable_patterns)]
4927 self.structured_value.as_ref().and_then(|v| match v {
4928 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
4929 _ => std::option::Option::None,
4930 })
4931 }
4932
4933 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4934 /// to hold a `SignatureValue`.
4935 ///
4936 /// Note that all the setters affecting `structured_value` are
4937 /// mutually exclusive.
4938 ///
4939 /// # Example
4940 /// ```ignore,no_run
4941 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4942 /// let x = NormalizedValue::new().set_signature_value(true);
4943 /// assert!(x.signature_value().is_some());
4944 /// assert!(x.money_value().is_none());
4945 /// assert!(x.date_value().is_none());
4946 /// assert!(x.datetime_value().is_none());
4947 /// assert!(x.address_value().is_none());
4948 /// assert!(x.boolean_value().is_none());
4949 /// assert!(x.integer_value().is_none());
4950 /// assert!(x.float_value().is_none());
4951 /// ```
4952 pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4953 self.structured_value = std::option::Option::Some(
4954 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
4955 v.into()
4956 )
4957 );
4958 self
4959 }
4960 }
4961
4962 impl wkt::message::Message for NormalizedValue {
4963 fn typename() -> &'static str {
4964 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
4965 }
4966 }
4967
4968 /// Defines additional types related to [NormalizedValue].
4969 pub mod normalized_value {
4970 #[allow(unused_imports)]
4971 use super::*;
4972
4973 /// An optional structured entity value.
4974 /// Must match entity type defined in schema if
4975 /// known. If this field is present, the `text` field could also be
4976 /// populated.
4977 #[derive(Clone, Debug, PartialEq)]
4978 #[non_exhaustive]
4979 pub enum StructuredValue {
4980 /// Money value. See also:
4981 /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
4982 MoneyValue(std::boxed::Box<gtype::model::Money>),
4983 /// Date value. Includes year, month, day. See also:
4984 /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
4985 DateValue(std::boxed::Box<gtype::model::Date>),
4986 /// DateTime value. Includes date, time, and timezone. See also:
4987 /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
4988 DatetimeValue(std::boxed::Box<gtype::model::DateTime>),
4989 /// Postal address. See also:
4990 /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
4991 AddressValue(std::boxed::Box<gtype::model::PostalAddress>),
4992 /// Boolean value. Can be used for entities with binary values, or for
4993 /// checkboxes.
4994 BooleanValue(bool),
4995 /// Integer value.
4996 IntegerValue(i32),
4997 /// Float value.
4998 FloatValue(f32),
4999 SignatureValue(bool),
5000 }
5001 }
5002
5003 /// Specifies how the entity's value is obtained.
5004 ///
5005 /// # Working with unknown values
5006 ///
5007 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5008 /// additional enum variants at any time. Adding new variants is not considered
5009 /// a breaking change. Applications should write their code in anticipation of:
5010 ///
5011 /// - New values appearing in future releases of the client library, **and**
5012 /// - New values received dynamically, without application changes.
5013 ///
5014 /// Please consult the [Working with enums] section in the user guide for some
5015 /// guidelines.
5016 ///
5017 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5018 #[derive(Clone, Debug, PartialEq)]
5019 #[non_exhaustive]
5020 pub enum Method {
5021 /// When the method is not specified, it should be treated as `EXTRACT`.
5022 Unspecified,
5023 /// The entity's value is directly extracted as-is from the document
5024 /// text.
5025 Extract,
5026 /// The entity's value is derived through inference and is not
5027 /// necessarily an exact text extraction from the document.
5028 Derive,
5029 /// If set, the enum was initialized with an unknown value.
5030 ///
5031 /// Applications can examine the value using [Method::value] or
5032 /// [Method::name].
5033 UnknownValue(method::UnknownValue),
5034 }
5035
5036 #[doc(hidden)]
5037 pub mod method {
5038 #[allow(unused_imports)]
5039 use super::*;
5040 #[derive(Clone, Debug, PartialEq)]
5041 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5042 }
5043
5044 impl Method {
5045 /// Gets the enum value.
5046 ///
5047 /// Returns `None` if the enum contains an unknown value deserialized from
5048 /// the string representation of enums.
5049 pub fn value(&self) -> std::option::Option<i32> {
5050 match self {
5051 Self::Unspecified => std::option::Option::Some(0),
5052 Self::Extract => std::option::Option::Some(1),
5053 Self::Derive => std::option::Option::Some(2),
5054 Self::UnknownValue(u) => u.0.value(),
5055 }
5056 }
5057
5058 /// Gets the enum value as a string.
5059 ///
5060 /// Returns `None` if the enum contains an unknown value deserialized from
5061 /// the integer representation of enums.
5062 pub fn name(&self) -> std::option::Option<&str> {
5063 match self {
5064 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
5065 Self::Extract => std::option::Option::Some("EXTRACT"),
5066 Self::Derive => std::option::Option::Some("DERIVE"),
5067 Self::UnknownValue(u) => u.0.name(),
5068 }
5069 }
5070 }
5071
5072 impl std::default::Default for Method {
5073 fn default() -> Self {
5074 use std::convert::From;
5075 Self::from(0)
5076 }
5077 }
5078
5079 impl std::fmt::Display for Method {
5080 fn fmt(
5081 &self,
5082 f: &mut std::fmt::Formatter<'_>,
5083 ) -> std::result::Result<(), std::fmt::Error> {
5084 wkt::internal::display_enum(f, self.name(), self.value())
5085 }
5086 }
5087
5088 impl std::convert::From<i32> for Method {
5089 fn from(value: i32) -> Self {
5090 match value {
5091 0 => Self::Unspecified,
5092 1 => Self::Extract,
5093 2 => Self::Derive,
5094 _ => Self::UnknownValue(method::UnknownValue(
5095 wkt::internal::UnknownEnumValue::Integer(value),
5096 )),
5097 }
5098 }
5099 }
5100
5101 impl std::convert::From<&str> for Method {
5102 fn from(value: &str) -> Self {
5103 use std::string::ToString;
5104 match value {
5105 "METHOD_UNSPECIFIED" => Self::Unspecified,
5106 "EXTRACT" => Self::Extract,
5107 "DERIVE" => Self::Derive,
5108 _ => Self::UnknownValue(method::UnknownValue(
5109 wkt::internal::UnknownEnumValue::String(value.to_string()),
5110 )),
5111 }
5112 }
5113 }
5114
5115 impl serde::ser::Serialize for Method {
5116 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5117 where
5118 S: serde::Serializer,
5119 {
5120 match self {
5121 Self::Unspecified => serializer.serialize_i32(0),
5122 Self::Extract => serializer.serialize_i32(1),
5123 Self::Derive => serializer.serialize_i32(2),
5124 Self::UnknownValue(u) => u.0.serialize(serializer),
5125 }
5126 }
5127 }
5128
5129 impl<'de> serde::de::Deserialize<'de> for Method {
5130 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5131 where
5132 D: serde::Deserializer<'de>,
5133 {
5134 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
5135 ".google.cloud.documentai.v1.Document.Entity.Method",
5136 ))
5137 }
5138 }
5139 }
5140
5141 /// Relationship between
5142 /// [Entities][google.cloud.documentai.v1.Document.Entity].
5143 ///
5144 /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
5145 #[derive(Clone, Default, PartialEq)]
5146 #[non_exhaustive]
5147 pub struct EntityRelation {
5148 /// Subject entity id.
5149 pub subject_id: std::string::String,
5150
5151 /// Object entity id.
5152 pub object_id: std::string::String,
5153
5154 /// Relationship description.
5155 pub relation: std::string::String,
5156
5157 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5158 }
5159
5160 impl EntityRelation {
5161 pub fn new() -> Self {
5162 std::default::Default::default()
5163 }
5164
5165 /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
5166 ///
5167 /// # Example
5168 /// ```ignore,no_run
5169 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5170 /// let x = EntityRelation::new().set_subject_id("example");
5171 /// ```
5172 pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5173 self.subject_id = v.into();
5174 self
5175 }
5176
5177 /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
5178 ///
5179 /// # Example
5180 /// ```ignore,no_run
5181 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5182 /// let x = EntityRelation::new().set_object_id("example");
5183 /// ```
5184 pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5185 self.object_id = v.into();
5186 self
5187 }
5188
5189 /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
5190 ///
5191 /// # Example
5192 /// ```ignore,no_run
5193 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5194 /// let x = EntityRelation::new().set_relation("example");
5195 /// ```
5196 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5197 self.relation = v.into();
5198 self
5199 }
5200 }
5201
5202 impl wkt::message::Message for EntityRelation {
5203 fn typename() -> &'static str {
5204 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
5205 }
5206 }
5207
5208 /// Text reference indexing into the
5209 /// [Document.text][google.cloud.documentai.v1.Document.text].
5210 ///
5211 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5212 #[derive(Clone, Default, PartialEq)]
5213 #[non_exhaustive]
5214 pub struct TextAnchor {
5215 /// The text segments from the
5216 /// [Document.text][google.cloud.documentai.v1.Document.text].
5217 ///
5218 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5219 pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
5220
5221 /// Contains the content of the text span so that users do
5222 /// not have to look it up in the text_segments. It is always
5223 /// populated for formFields.
5224 pub content: std::string::String,
5225
5226 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5227 }
5228
5229 impl TextAnchor {
5230 pub fn new() -> Self {
5231 std::default::Default::default()
5232 }
5233
5234 /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
5235 ///
5236 /// # Example
5237 /// ```ignore,no_run
5238 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5239 /// use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5240 /// let x = TextAnchor::new()
5241 /// .set_text_segments([
5242 /// TextSegment::default()/* use setters */,
5243 /// TextSegment::default()/* use (different) setters */,
5244 /// ]);
5245 /// ```
5246 pub fn set_text_segments<T, V>(mut self, v: T) -> Self
5247 where
5248 T: std::iter::IntoIterator<Item = V>,
5249 V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
5250 {
5251 use std::iter::Iterator;
5252 self.text_segments = v.into_iter().map(|i| i.into()).collect();
5253 self
5254 }
5255
5256 /// Sets the value of [content][crate::model::document::TextAnchor::content].
5257 ///
5258 /// # Example
5259 /// ```ignore,no_run
5260 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5261 /// let x = TextAnchor::new().set_content("example");
5262 /// ```
5263 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5264 self.content = v.into();
5265 self
5266 }
5267 }
5268
5269 impl wkt::message::Message for TextAnchor {
5270 fn typename() -> &'static str {
5271 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
5272 }
5273 }
5274
5275 /// Defines additional types related to [TextAnchor].
5276 pub mod text_anchor {
5277 #[allow(unused_imports)]
5278 use super::*;
5279
5280 /// A text segment in the
5281 /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
5282 /// may be out of bounds which indicate that the text extends into another
5283 /// document shard for large sharded documents. See
5284 /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
5285 ///
5286 /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
5287 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5288 #[derive(Clone, Default, PartialEq)]
5289 #[non_exhaustive]
5290 pub struct TextSegment {
5291 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5292 /// start UTF-8 char index in the
5293 /// [Document.text][google.cloud.documentai.v1.Document.text].
5294 ///
5295 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5296 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5297 pub start_index: i64,
5298
5299 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5300 /// half open end UTF-8 char index in the
5301 /// [Document.text][google.cloud.documentai.v1.Document.text].
5302 ///
5303 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5304 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5305 pub end_index: i64,
5306
5307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5308 }
5309
5310 impl TextSegment {
5311 pub fn new() -> Self {
5312 std::default::Default::default()
5313 }
5314
5315 /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
5316 ///
5317 /// # Example
5318 /// ```ignore,no_run
5319 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5320 /// let x = TextSegment::new().set_start_index(42);
5321 /// ```
5322 pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5323 self.start_index = v.into();
5324 self
5325 }
5326
5327 /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
5328 ///
5329 /// # Example
5330 /// ```ignore,no_run
5331 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5332 /// let x = TextSegment::new().set_end_index(42);
5333 /// ```
5334 pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5335 self.end_index = v.into();
5336 self
5337 }
5338 }
5339
5340 impl wkt::message::Message for TextSegment {
5341 fn typename() -> &'static str {
5342 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
5343 }
5344 }
5345 }
5346
5347 /// Referencing the visual context of the entity in the
5348 /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
5349 /// can be cross-page, consist of multiple bounding polygons and optionally
5350 /// reference specific layout element types.
5351 ///
5352 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5353 #[derive(Clone, Default, PartialEq)]
5354 #[non_exhaustive]
5355 pub struct PageAnchor {
5356 /// One or more references to visual page elements
5357 pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
5358
5359 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5360 }
5361
5362 impl PageAnchor {
5363 pub fn new() -> Self {
5364 std::default::Default::default()
5365 }
5366
5367 /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
5368 ///
5369 /// # Example
5370 /// ```ignore,no_run
5371 /// # use google_cloud_documentai_v1::model::document::PageAnchor;
5372 /// use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5373 /// let x = PageAnchor::new()
5374 /// .set_page_refs([
5375 /// PageRef::default()/* use setters */,
5376 /// PageRef::default()/* use (different) setters */,
5377 /// ]);
5378 /// ```
5379 pub fn set_page_refs<T, V>(mut self, v: T) -> Self
5380 where
5381 T: std::iter::IntoIterator<Item = V>,
5382 V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
5383 {
5384 use std::iter::Iterator;
5385 self.page_refs = v.into_iter().map(|i| i.into()).collect();
5386 self
5387 }
5388 }
5389
5390 impl wkt::message::Message for PageAnchor {
5391 fn typename() -> &'static str {
5392 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
5393 }
5394 }
5395
5396 /// Defines additional types related to [PageAnchor].
5397 pub mod page_anchor {
5398 #[allow(unused_imports)]
5399 use super::*;
5400
5401 /// Represents a weak reference to a page element within a document.
5402 #[derive(Clone, Default, PartialEq)]
5403 #[non_exhaustive]
5404 pub struct PageRef {
5405 /// Required. Index into the
5406 /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
5407 /// for example using
5408 /// `[Document.pages][page_refs.page]` to locate the related page element.
5409 /// This field is skipped when its value is the default `0`. See
5410 /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
5411 ///
5412 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5413 pub page: i64,
5414
5415 /// Optional. The type of the layout element that is being referenced if
5416 /// any.
5417 pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
5418
5419 /// Optional. Deprecated. Use
5420 /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
5421 /// instead.
5422 ///
5423 /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
5424 #[deprecated]
5425 pub layout_id: std::string::String,
5426
5427 /// Optional. Identifies the bounding polygon of a layout element on the
5428 /// page. If `layout_type` is set, the bounding polygon must be exactly the
5429 /// same to the layout element it's referring to.
5430 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
5431
5432 /// Optional. Confidence of detected page element, if applicable. Range
5433 /// `[0, 1]`.
5434 pub confidence: f32,
5435
5436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5437 }
5438
5439 impl PageRef {
5440 pub fn new() -> Self {
5441 std::default::Default::default()
5442 }
5443
5444 /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
5445 ///
5446 /// # Example
5447 /// ```ignore,no_run
5448 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5449 /// let x = PageRef::new().set_page(42);
5450 /// ```
5451 pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5452 self.page = v.into();
5453 self
5454 }
5455
5456 /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
5457 ///
5458 /// # Example
5459 /// ```ignore,no_run
5460 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5461 /// use google_cloud_documentai_v1::model::document::page_anchor::page_ref::LayoutType;
5462 /// let x0 = PageRef::new().set_layout_type(LayoutType::Block);
5463 /// let x1 = PageRef::new().set_layout_type(LayoutType::Paragraph);
5464 /// let x2 = PageRef::new().set_layout_type(LayoutType::Line);
5465 /// ```
5466 pub fn set_layout_type<
5467 T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
5468 >(
5469 mut self,
5470 v: T,
5471 ) -> Self {
5472 self.layout_type = v.into();
5473 self
5474 }
5475
5476 /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
5477 ///
5478 /// # Example
5479 /// ```ignore,no_run
5480 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5481 /// let x = PageRef::new().set_layout_id("example");
5482 /// ```
5483 #[deprecated]
5484 pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
5485 mut self,
5486 v: T,
5487 ) -> Self {
5488 self.layout_id = v.into();
5489 self
5490 }
5491
5492 /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5493 ///
5494 /// # Example
5495 /// ```ignore,no_run
5496 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5497 /// use google_cloud_documentai_v1::model::BoundingPoly;
5498 /// let x = PageRef::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
5499 /// ```
5500 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
5501 where
5502 T: std::convert::Into<crate::model::BoundingPoly>,
5503 {
5504 self.bounding_poly = std::option::Option::Some(v.into());
5505 self
5506 }
5507
5508 /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5509 ///
5510 /// # Example
5511 /// ```ignore,no_run
5512 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5513 /// use google_cloud_documentai_v1::model::BoundingPoly;
5514 /// let x = PageRef::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
5515 /// let x = PageRef::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
5516 /// ```
5517 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
5518 where
5519 T: std::convert::Into<crate::model::BoundingPoly>,
5520 {
5521 self.bounding_poly = v.map(|x| x.into());
5522 self
5523 }
5524
5525 /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
5526 ///
5527 /// # Example
5528 /// ```ignore,no_run
5529 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5530 /// let x = PageRef::new().set_confidence(42.0);
5531 /// ```
5532 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5533 self.confidence = v.into();
5534 self
5535 }
5536 }
5537
5538 impl wkt::message::Message for PageRef {
5539 fn typename() -> &'static str {
5540 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
5541 }
5542 }
5543
5544 /// Defines additional types related to [PageRef].
5545 pub mod page_ref {
5546 #[allow(unused_imports)]
5547 use super::*;
5548
5549 /// The type of layout that is being referenced.
5550 ///
5551 /// # Working with unknown values
5552 ///
5553 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5554 /// additional enum variants at any time. Adding new variants is not considered
5555 /// a breaking change. Applications should write their code in anticipation of:
5556 ///
5557 /// - New values appearing in future releases of the client library, **and**
5558 /// - New values received dynamically, without application changes.
5559 ///
5560 /// Please consult the [Working with enums] section in the user guide for some
5561 /// guidelines.
5562 ///
5563 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5564 #[derive(Clone, Debug, PartialEq)]
5565 #[non_exhaustive]
5566 pub enum LayoutType {
5567 /// Layout Unspecified.
5568 Unspecified,
5569 /// References a
5570 /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
5571 /// element.
5572 ///
5573 /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
5574 Block,
5575 /// References a
5576 /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
5577 /// element.
5578 ///
5579 /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
5580 Paragraph,
5581 /// References a
5582 /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
5583 ///
5584 /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
5585 Line,
5586 /// References a
5587 /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
5588 /// element.
5589 ///
5590 /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
5591 Token,
5592 /// References a
5593 /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
5594 /// element.
5595 ///
5596 /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
5597 VisualElement,
5598 /// Refrrences a
5599 /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
5600 /// element.
5601 ///
5602 /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
5603 Table,
5604 /// References a
5605 /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
5606 /// element.
5607 ///
5608 /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
5609 FormField,
5610 /// If set, the enum was initialized with an unknown value.
5611 ///
5612 /// Applications can examine the value using [LayoutType::value] or
5613 /// [LayoutType::name].
5614 UnknownValue(layout_type::UnknownValue),
5615 }
5616
5617 #[doc(hidden)]
5618 pub mod layout_type {
5619 #[allow(unused_imports)]
5620 use super::*;
5621 #[derive(Clone, Debug, PartialEq)]
5622 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5623 }
5624
5625 impl LayoutType {
5626 /// Gets the enum value.
5627 ///
5628 /// Returns `None` if the enum contains an unknown value deserialized from
5629 /// the string representation of enums.
5630 pub fn value(&self) -> std::option::Option<i32> {
5631 match self {
5632 Self::Unspecified => std::option::Option::Some(0),
5633 Self::Block => std::option::Option::Some(1),
5634 Self::Paragraph => std::option::Option::Some(2),
5635 Self::Line => std::option::Option::Some(3),
5636 Self::Token => std::option::Option::Some(4),
5637 Self::VisualElement => std::option::Option::Some(5),
5638 Self::Table => std::option::Option::Some(6),
5639 Self::FormField => std::option::Option::Some(7),
5640 Self::UnknownValue(u) => u.0.value(),
5641 }
5642 }
5643
5644 /// Gets the enum value as a string.
5645 ///
5646 /// Returns `None` if the enum contains an unknown value deserialized from
5647 /// the integer representation of enums.
5648 pub fn name(&self) -> std::option::Option<&str> {
5649 match self {
5650 Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
5651 Self::Block => std::option::Option::Some("BLOCK"),
5652 Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
5653 Self::Line => std::option::Option::Some("LINE"),
5654 Self::Token => std::option::Option::Some("TOKEN"),
5655 Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
5656 Self::Table => std::option::Option::Some("TABLE"),
5657 Self::FormField => std::option::Option::Some("FORM_FIELD"),
5658 Self::UnknownValue(u) => u.0.name(),
5659 }
5660 }
5661 }
5662
5663 impl std::default::Default for LayoutType {
5664 fn default() -> Self {
5665 use std::convert::From;
5666 Self::from(0)
5667 }
5668 }
5669
5670 impl std::fmt::Display for LayoutType {
5671 fn fmt(
5672 &self,
5673 f: &mut std::fmt::Formatter<'_>,
5674 ) -> std::result::Result<(), std::fmt::Error> {
5675 wkt::internal::display_enum(f, self.name(), self.value())
5676 }
5677 }
5678
5679 impl std::convert::From<i32> for LayoutType {
5680 fn from(value: i32) -> Self {
5681 match value {
5682 0 => Self::Unspecified,
5683 1 => Self::Block,
5684 2 => Self::Paragraph,
5685 3 => Self::Line,
5686 4 => Self::Token,
5687 5 => Self::VisualElement,
5688 6 => Self::Table,
5689 7 => Self::FormField,
5690 _ => Self::UnknownValue(layout_type::UnknownValue(
5691 wkt::internal::UnknownEnumValue::Integer(value),
5692 )),
5693 }
5694 }
5695 }
5696
5697 impl std::convert::From<&str> for LayoutType {
5698 fn from(value: &str) -> Self {
5699 use std::string::ToString;
5700 match value {
5701 "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
5702 "BLOCK" => Self::Block,
5703 "PARAGRAPH" => Self::Paragraph,
5704 "LINE" => Self::Line,
5705 "TOKEN" => Self::Token,
5706 "VISUAL_ELEMENT" => Self::VisualElement,
5707 "TABLE" => Self::Table,
5708 "FORM_FIELD" => Self::FormField,
5709 _ => Self::UnknownValue(layout_type::UnknownValue(
5710 wkt::internal::UnknownEnumValue::String(value.to_string()),
5711 )),
5712 }
5713 }
5714 }
5715
5716 impl serde::ser::Serialize for LayoutType {
5717 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5718 where
5719 S: serde::Serializer,
5720 {
5721 match self {
5722 Self::Unspecified => serializer.serialize_i32(0),
5723 Self::Block => serializer.serialize_i32(1),
5724 Self::Paragraph => serializer.serialize_i32(2),
5725 Self::Line => serializer.serialize_i32(3),
5726 Self::Token => serializer.serialize_i32(4),
5727 Self::VisualElement => serializer.serialize_i32(5),
5728 Self::Table => serializer.serialize_i32(6),
5729 Self::FormField => serializer.serialize_i32(7),
5730 Self::UnknownValue(u) => u.0.serialize(serializer),
5731 }
5732 }
5733 }
5734
5735 impl<'de> serde::de::Deserialize<'de> for LayoutType {
5736 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5737 where
5738 D: serde::Deserializer<'de>,
5739 {
5740 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
5741 ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
5742 ))
5743 }
5744 }
5745 }
5746 }
5747
5748 /// Structure to identify provenance relationships between annotations in
5749 /// different revisions.
5750 #[derive(Clone, Default, PartialEq)]
5751 #[non_exhaustive]
5752 pub struct Provenance {
5753 /// The index of the revision that produced this element.
5754 #[deprecated]
5755 pub revision: i32,
5756
5757 /// The Id of this operation. Needs to be unique within the scope of the
5758 /// revision.
5759 #[deprecated]
5760 pub id: i32,
5761
5762 /// References to the original elements that are replaced.
5763 pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
5764
5765 /// The type of provenance operation.
5766 pub r#type: crate::model::document::provenance::OperationType,
5767
5768 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5769 }
5770
5771 impl Provenance {
5772 pub fn new() -> Self {
5773 std::default::Default::default()
5774 }
5775
5776 /// Sets the value of [revision][crate::model::document::Provenance::revision].
5777 ///
5778 /// # Example
5779 /// ```ignore,no_run
5780 /// # use google_cloud_documentai_v1::model::document::Provenance;
5781 /// let x = Provenance::new().set_revision(42);
5782 /// ```
5783 #[deprecated]
5784 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5785 self.revision = v.into();
5786 self
5787 }
5788
5789 /// Sets the value of [id][crate::model::document::Provenance::id].
5790 ///
5791 /// # Example
5792 /// ```ignore,no_run
5793 /// # use google_cloud_documentai_v1::model::document::Provenance;
5794 /// let x = Provenance::new().set_id(42);
5795 /// ```
5796 #[deprecated]
5797 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5798 self.id = v.into();
5799 self
5800 }
5801
5802 /// Sets the value of [parents][crate::model::document::Provenance::parents].
5803 ///
5804 /// # Example
5805 /// ```ignore,no_run
5806 /// # use google_cloud_documentai_v1::model::document::Provenance;
5807 /// use google_cloud_documentai_v1::model::document::provenance::Parent;
5808 /// let x = Provenance::new()
5809 /// .set_parents([
5810 /// Parent::default()/* use setters */,
5811 /// Parent::default()/* use (different) setters */,
5812 /// ]);
5813 /// ```
5814 pub fn set_parents<T, V>(mut self, v: T) -> Self
5815 where
5816 T: std::iter::IntoIterator<Item = V>,
5817 V: std::convert::Into<crate::model::document::provenance::Parent>,
5818 {
5819 use std::iter::Iterator;
5820 self.parents = v.into_iter().map(|i| i.into()).collect();
5821 self
5822 }
5823
5824 /// Sets the value of [r#type][crate::model::document::Provenance::type].
5825 ///
5826 /// # Example
5827 /// ```ignore,no_run
5828 /// # use google_cloud_documentai_v1::model::document::Provenance;
5829 /// use google_cloud_documentai_v1::model::document::provenance::OperationType;
5830 /// let x0 = Provenance::new().set_type(OperationType::Add);
5831 /// let x1 = Provenance::new().set_type(OperationType::Remove);
5832 /// let x2 = Provenance::new().set_type(OperationType::Update);
5833 /// ```
5834 pub fn set_type<
5835 T: std::convert::Into<crate::model::document::provenance::OperationType>,
5836 >(
5837 mut self,
5838 v: T,
5839 ) -> Self {
5840 self.r#type = v.into();
5841 self
5842 }
5843 }
5844
5845 impl wkt::message::Message for Provenance {
5846 fn typename() -> &'static str {
5847 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
5848 }
5849 }
5850
5851 /// Defines additional types related to [Provenance].
5852 pub mod provenance {
5853 #[allow(unused_imports)]
5854 use super::*;
5855
5856 /// The parent element the current element is based on. Used for
5857 /// referencing/aligning, removal and replacement operations.
5858 #[derive(Clone, Default, PartialEq)]
5859 #[non_exhaustive]
5860 pub struct Parent {
5861 /// The index of the index into current revision's parent_ids list.
5862 pub revision: i32,
5863
5864 /// The index of the parent item in the corresponding item list (eg. list
5865 /// of entities, properties within entities, etc.) in the parent revision.
5866 pub index: i32,
5867
5868 /// The id of the parent provenance.
5869 #[deprecated]
5870 pub id: i32,
5871
5872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5873 }
5874
5875 impl Parent {
5876 pub fn new() -> Self {
5877 std::default::Default::default()
5878 }
5879
5880 /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
5881 ///
5882 /// # Example
5883 /// ```ignore,no_run
5884 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5885 /// let x = Parent::new().set_revision(42);
5886 /// ```
5887 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5888 self.revision = v.into();
5889 self
5890 }
5891
5892 /// Sets the value of [index][crate::model::document::provenance::Parent::index].
5893 ///
5894 /// # Example
5895 /// ```ignore,no_run
5896 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5897 /// let x = Parent::new().set_index(42);
5898 /// ```
5899 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5900 self.index = v.into();
5901 self
5902 }
5903
5904 /// Sets the value of [id][crate::model::document::provenance::Parent::id].
5905 ///
5906 /// # Example
5907 /// ```ignore,no_run
5908 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5909 /// let x = Parent::new().set_id(42);
5910 /// ```
5911 #[deprecated]
5912 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5913 self.id = v.into();
5914 self
5915 }
5916 }
5917
5918 impl wkt::message::Message for Parent {
5919 fn typename() -> &'static str {
5920 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
5921 }
5922 }
5923
5924 /// If a processor or agent does an explicit operation on existing elements.
5925 ///
5926 /// # Working with unknown values
5927 ///
5928 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5929 /// additional enum variants at any time. Adding new variants is not considered
5930 /// a breaking change. Applications should write their code in anticipation of:
5931 ///
5932 /// - New values appearing in future releases of the client library, **and**
5933 /// - New values received dynamically, without application changes.
5934 ///
5935 /// Please consult the [Working with enums] section in the user guide for some
5936 /// guidelines.
5937 ///
5938 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5939 #[derive(Clone, Debug, PartialEq)]
5940 #[non_exhaustive]
5941 pub enum OperationType {
5942 /// Operation type unspecified. If no operation is specified a provenance
5943 /// entry is simply used to match against a `parent`.
5944 Unspecified,
5945 /// Add an element.
5946 Add,
5947 /// Remove an element identified by `parent`.
5948 Remove,
5949 /// Updates any fields within the given provenance scope of the message. It
5950 /// overwrites the fields rather than replacing them. Use this when you
5951 /// want to update a field value of an entity without also updating all the
5952 /// child properties.
5953 Update,
5954 /// Currently unused. Replace an element identified by `parent`.
5955 Replace,
5956 /// Deprecated. Request human review for the element identified by
5957 /// `parent`.
5958 #[deprecated]
5959 EvalRequested,
5960 /// Deprecated. Element is reviewed and approved at human review,
5961 /// confidence will be set to 1.0.
5962 #[deprecated]
5963 EvalApproved,
5964 /// Deprecated. Element is skipped in the validation process.
5965 #[deprecated]
5966 EvalSkipped,
5967 /// If set, the enum was initialized with an unknown value.
5968 ///
5969 /// Applications can examine the value using [OperationType::value] or
5970 /// [OperationType::name].
5971 UnknownValue(operation_type::UnknownValue),
5972 }
5973
5974 #[doc(hidden)]
5975 pub mod operation_type {
5976 #[allow(unused_imports)]
5977 use super::*;
5978 #[derive(Clone, Debug, PartialEq)]
5979 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5980 }
5981
5982 impl OperationType {
5983 /// Gets the enum value.
5984 ///
5985 /// Returns `None` if the enum contains an unknown value deserialized from
5986 /// the string representation of enums.
5987 pub fn value(&self) -> std::option::Option<i32> {
5988 match self {
5989 Self::Unspecified => std::option::Option::Some(0),
5990 Self::Add => std::option::Option::Some(1),
5991 Self::Remove => std::option::Option::Some(2),
5992 Self::Update => std::option::Option::Some(7),
5993 Self::Replace => std::option::Option::Some(3),
5994 Self::EvalRequested => std::option::Option::Some(4),
5995 Self::EvalApproved => std::option::Option::Some(5),
5996 Self::EvalSkipped => std::option::Option::Some(6),
5997 Self::UnknownValue(u) => u.0.value(),
5998 }
5999 }
6000
6001 /// Gets the enum value as a string.
6002 ///
6003 /// Returns `None` if the enum contains an unknown value deserialized from
6004 /// the integer representation of enums.
6005 pub fn name(&self) -> std::option::Option<&str> {
6006 match self {
6007 Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
6008 Self::Add => std::option::Option::Some("ADD"),
6009 Self::Remove => std::option::Option::Some("REMOVE"),
6010 Self::Update => std::option::Option::Some("UPDATE"),
6011 Self::Replace => std::option::Option::Some("REPLACE"),
6012 Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
6013 Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
6014 Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
6015 Self::UnknownValue(u) => u.0.name(),
6016 }
6017 }
6018 }
6019
6020 impl std::default::Default for OperationType {
6021 fn default() -> Self {
6022 use std::convert::From;
6023 Self::from(0)
6024 }
6025 }
6026
6027 impl std::fmt::Display for OperationType {
6028 fn fmt(
6029 &self,
6030 f: &mut std::fmt::Formatter<'_>,
6031 ) -> std::result::Result<(), std::fmt::Error> {
6032 wkt::internal::display_enum(f, self.name(), self.value())
6033 }
6034 }
6035
6036 impl std::convert::From<i32> for OperationType {
6037 fn from(value: i32) -> Self {
6038 match value {
6039 0 => Self::Unspecified,
6040 1 => Self::Add,
6041 2 => Self::Remove,
6042 3 => Self::Replace,
6043 4 => Self::EvalRequested,
6044 5 => Self::EvalApproved,
6045 6 => Self::EvalSkipped,
6046 7 => Self::Update,
6047 _ => Self::UnknownValue(operation_type::UnknownValue(
6048 wkt::internal::UnknownEnumValue::Integer(value),
6049 )),
6050 }
6051 }
6052 }
6053
6054 impl std::convert::From<&str> for OperationType {
6055 fn from(value: &str) -> Self {
6056 use std::string::ToString;
6057 match value {
6058 "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
6059 "ADD" => Self::Add,
6060 "REMOVE" => Self::Remove,
6061 "UPDATE" => Self::Update,
6062 "REPLACE" => Self::Replace,
6063 "EVAL_REQUESTED" => Self::EvalRequested,
6064 "EVAL_APPROVED" => Self::EvalApproved,
6065 "EVAL_SKIPPED" => Self::EvalSkipped,
6066 _ => Self::UnknownValue(operation_type::UnknownValue(
6067 wkt::internal::UnknownEnumValue::String(value.to_string()),
6068 )),
6069 }
6070 }
6071 }
6072
6073 impl serde::ser::Serialize for OperationType {
6074 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6075 where
6076 S: serde::Serializer,
6077 {
6078 match self {
6079 Self::Unspecified => serializer.serialize_i32(0),
6080 Self::Add => serializer.serialize_i32(1),
6081 Self::Remove => serializer.serialize_i32(2),
6082 Self::Update => serializer.serialize_i32(7),
6083 Self::Replace => serializer.serialize_i32(3),
6084 Self::EvalRequested => serializer.serialize_i32(4),
6085 Self::EvalApproved => serializer.serialize_i32(5),
6086 Self::EvalSkipped => serializer.serialize_i32(6),
6087 Self::UnknownValue(u) => u.0.serialize(serializer),
6088 }
6089 }
6090 }
6091
6092 impl<'de> serde::de::Deserialize<'de> for OperationType {
6093 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6094 where
6095 D: serde::Deserializer<'de>,
6096 {
6097 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
6098 ".google.cloud.documentai.v1.Document.Provenance.OperationType",
6099 ))
6100 }
6101 }
6102 }
6103
6104 /// Contains past or forward revisions of this document.
6105 #[derive(Clone, Default, PartialEq)]
6106 #[non_exhaustive]
6107 pub struct Revision {
6108 /// Id of the revision, internally generated by doc proto storage.
6109 /// Unique within the context of the document.
6110 pub id: std::string::String,
6111
6112 /// The revisions that this revision is based on. This can include one or
6113 /// more parent (when documents are merged.) This field represents the
6114 /// index into the `revisions` field.
6115 #[deprecated]
6116 pub parent: std::vec::Vec<i32>,
6117
6118 /// The revisions that this revision is based on. Must include all the ids
6119 /// that have anything to do with this revision - eg. there are
6120 /// `provenance.parent.revision` fields that index into this field.
6121 pub parent_ids: std::vec::Vec<std::string::String>,
6122
6123 /// The time that the revision was created, internally generated by
6124 /// doc proto storage at the time of create.
6125 pub create_time: std::option::Option<wkt::Timestamp>,
6126
6127 /// Human Review information of this revision.
6128 pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
6129
6130 /// Who/what made the change
6131 pub source: std::option::Option<crate::model::document::revision::Source>,
6132
6133 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6134 }
6135
6136 impl Revision {
6137 pub fn new() -> Self {
6138 std::default::Default::default()
6139 }
6140
6141 /// Sets the value of [id][crate::model::document::Revision::id].
6142 ///
6143 /// # Example
6144 /// ```ignore,no_run
6145 /// # use google_cloud_documentai_v1::model::document::Revision;
6146 /// let x = Revision::new().set_id("example");
6147 /// ```
6148 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6149 self.id = v.into();
6150 self
6151 }
6152
6153 /// Sets the value of [parent][crate::model::document::Revision::parent].
6154 ///
6155 /// # Example
6156 /// ```ignore,no_run
6157 /// # use google_cloud_documentai_v1::model::document::Revision;
6158 /// let x = Revision::new().set_parent([1, 2, 3]);
6159 /// ```
6160 #[deprecated]
6161 pub fn set_parent<T, V>(mut self, v: T) -> Self
6162 where
6163 T: std::iter::IntoIterator<Item = V>,
6164 V: std::convert::Into<i32>,
6165 {
6166 use std::iter::Iterator;
6167 self.parent = v.into_iter().map(|i| i.into()).collect();
6168 self
6169 }
6170
6171 /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
6172 ///
6173 /// # Example
6174 /// ```ignore,no_run
6175 /// # use google_cloud_documentai_v1::model::document::Revision;
6176 /// let x = Revision::new().set_parent_ids(["a", "b", "c"]);
6177 /// ```
6178 pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
6179 where
6180 T: std::iter::IntoIterator<Item = V>,
6181 V: std::convert::Into<std::string::String>,
6182 {
6183 use std::iter::Iterator;
6184 self.parent_ids = v.into_iter().map(|i| i.into()).collect();
6185 self
6186 }
6187
6188 /// Sets the value of [create_time][crate::model::document::Revision::create_time].
6189 ///
6190 /// # Example
6191 /// ```ignore,no_run
6192 /// # use google_cloud_documentai_v1::model::document::Revision;
6193 /// use wkt::Timestamp;
6194 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
6195 /// ```
6196 pub fn set_create_time<T>(mut self, v: T) -> Self
6197 where
6198 T: std::convert::Into<wkt::Timestamp>,
6199 {
6200 self.create_time = std::option::Option::Some(v.into());
6201 self
6202 }
6203
6204 /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
6205 ///
6206 /// # Example
6207 /// ```ignore,no_run
6208 /// # use google_cloud_documentai_v1::model::document::Revision;
6209 /// use wkt::Timestamp;
6210 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6211 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
6212 /// ```
6213 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6214 where
6215 T: std::convert::Into<wkt::Timestamp>,
6216 {
6217 self.create_time = v.map(|x| x.into());
6218 self
6219 }
6220
6221 /// Sets the value of [human_review][crate::model::document::Revision::human_review].
6222 ///
6223 /// # Example
6224 /// ```ignore,no_run
6225 /// # use google_cloud_documentai_v1::model::document::Revision;
6226 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6227 /// let x = Revision::new().set_human_review(HumanReview::default()/* use setters */);
6228 /// ```
6229 pub fn set_human_review<T>(mut self, v: T) -> Self
6230 where
6231 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6232 {
6233 self.human_review = std::option::Option::Some(v.into());
6234 self
6235 }
6236
6237 /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
6238 ///
6239 /// # Example
6240 /// ```ignore,no_run
6241 /// # use google_cloud_documentai_v1::model::document::Revision;
6242 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6243 /// let x = Revision::new().set_or_clear_human_review(Some(HumanReview::default()/* use setters */));
6244 /// let x = Revision::new().set_or_clear_human_review(None::<HumanReview>);
6245 /// ```
6246 pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
6247 where
6248 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6249 {
6250 self.human_review = v.map(|x| x.into());
6251 self
6252 }
6253
6254 /// Sets the value of [source][crate::model::document::Revision::source].
6255 ///
6256 /// Note that all the setters affecting `source` are mutually
6257 /// exclusive.
6258 ///
6259 /// # Example
6260 /// ```ignore,no_run
6261 /// # use google_cloud_documentai_v1::model::document::Revision;
6262 /// use google_cloud_documentai_v1::model::document::revision::Source;
6263 /// let x = Revision::new().set_source(Some(Source::Agent("example".to_string())));
6264 /// ```
6265 pub fn set_source<
6266 T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
6267 >(
6268 mut self,
6269 v: T,
6270 ) -> Self {
6271 self.source = v.into();
6272 self
6273 }
6274
6275 /// The value of [source][crate::model::document::Revision::source]
6276 /// if it holds a `Agent`, `None` if the field is not set or
6277 /// holds a different branch.
6278 pub fn agent(&self) -> std::option::Option<&std::string::String> {
6279 #[allow(unreachable_patterns)]
6280 self.source.as_ref().and_then(|v| match v {
6281 crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
6282 _ => std::option::Option::None,
6283 })
6284 }
6285
6286 /// Sets the value of [source][crate::model::document::Revision::source]
6287 /// to hold a `Agent`.
6288 ///
6289 /// Note that all the setters affecting `source` are
6290 /// mutually exclusive.
6291 ///
6292 /// # Example
6293 /// ```ignore,no_run
6294 /// # use google_cloud_documentai_v1::model::document::Revision;
6295 /// let x = Revision::new().set_agent("example");
6296 /// assert!(x.agent().is_some());
6297 /// assert!(x.processor().is_none());
6298 /// ```
6299 pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6300 self.source = std::option::Option::Some(
6301 crate::model::document::revision::Source::Agent(v.into()),
6302 );
6303 self
6304 }
6305
6306 /// The value of [source][crate::model::document::Revision::source]
6307 /// if it holds a `Processor`, `None` if the field is not set or
6308 /// holds a different branch.
6309 pub fn processor(&self) -> std::option::Option<&std::string::String> {
6310 #[allow(unreachable_patterns)]
6311 self.source.as_ref().and_then(|v| match v {
6312 crate::model::document::revision::Source::Processor(v) => {
6313 std::option::Option::Some(v)
6314 }
6315 _ => std::option::Option::None,
6316 })
6317 }
6318
6319 /// Sets the value of [source][crate::model::document::Revision::source]
6320 /// to hold a `Processor`.
6321 ///
6322 /// Note that all the setters affecting `source` are
6323 /// mutually exclusive.
6324 ///
6325 /// # Example
6326 /// ```ignore,no_run
6327 /// # use google_cloud_documentai_v1::model::document::Revision;
6328 /// let x = Revision::new().set_processor("example");
6329 /// assert!(x.processor().is_some());
6330 /// assert!(x.agent().is_none());
6331 /// ```
6332 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6333 self.source = std::option::Option::Some(
6334 crate::model::document::revision::Source::Processor(v.into()),
6335 );
6336 self
6337 }
6338 }
6339
6340 impl wkt::message::Message for Revision {
6341 fn typename() -> &'static str {
6342 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
6343 }
6344 }
6345
6346 /// Defines additional types related to [Revision].
6347 pub mod revision {
6348 #[allow(unused_imports)]
6349 use super::*;
6350
6351 /// Human Review information of the document.
6352 #[derive(Clone, Default, PartialEq)]
6353 #[non_exhaustive]
6354 pub struct HumanReview {
6355 /// Human review state. e.g. `requested`, `succeeded`, `rejected`.
6356 pub state: std::string::String,
6357
6358 /// A message providing more details about the current state of processing.
6359 /// For example, the rejection reason when the state is `rejected`.
6360 pub state_message: std::string::String,
6361
6362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6363 }
6364
6365 impl HumanReview {
6366 pub fn new() -> Self {
6367 std::default::Default::default()
6368 }
6369
6370 /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
6371 ///
6372 /// # Example
6373 /// ```ignore,no_run
6374 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6375 /// let x = HumanReview::new().set_state("example");
6376 /// ```
6377 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6378 self.state = v.into();
6379 self
6380 }
6381
6382 /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
6383 ///
6384 /// # Example
6385 /// ```ignore,no_run
6386 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6387 /// let x = HumanReview::new().set_state_message("example");
6388 /// ```
6389 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
6390 mut self,
6391 v: T,
6392 ) -> Self {
6393 self.state_message = v.into();
6394 self
6395 }
6396 }
6397
6398 impl wkt::message::Message for HumanReview {
6399 fn typename() -> &'static str {
6400 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
6401 }
6402 }
6403
6404 /// Who/what made the change
6405 #[derive(Clone, Debug, PartialEq)]
6406 #[non_exhaustive]
6407 pub enum Source {
6408 /// If the change was made by a person specify the name or id of that
6409 /// person.
6410 Agent(std::string::String),
6411 /// If the annotation was made by processor identify the processor by its
6412 /// resource name.
6413 Processor(std::string::String),
6414 }
6415 }
6416
6417 /// This message is used for text changes aka. OCR corrections.
6418 #[derive(Clone, Default, PartialEq)]
6419 #[non_exhaustive]
6420 pub struct TextChange {
6421 /// Provenance of the correction.
6422 /// Text anchor indexing into the
6423 /// [Document.text][google.cloud.documentai.v1.Document.text]. There can
6424 /// only be a single `TextAnchor.text_segments` element. If the start and
6425 /// end index of the text segment are the same, the text change is inserted
6426 /// before that index.
6427 ///
6428 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
6429 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
6430
6431 /// The text that replaces the text identified in the `text_anchor`.
6432 pub changed_text: std::string::String,
6433
6434 /// The history of this annotation.
6435 #[deprecated]
6436 pub provenance: std::vec::Vec<crate::model::document::Provenance>,
6437
6438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6439 }
6440
6441 impl TextChange {
6442 pub fn new() -> Self {
6443 std::default::Default::default()
6444 }
6445
6446 /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6447 ///
6448 /// # Example
6449 /// ```ignore,no_run
6450 /// # use google_cloud_documentai_v1::model::document::TextChange;
6451 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6452 /// let x = TextChange::new().set_text_anchor(TextAnchor::default()/* use setters */);
6453 /// ```
6454 pub fn set_text_anchor<T>(mut self, v: T) -> Self
6455 where
6456 T: std::convert::Into<crate::model::document::TextAnchor>,
6457 {
6458 self.text_anchor = std::option::Option::Some(v.into());
6459 self
6460 }
6461
6462 /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6463 ///
6464 /// # Example
6465 /// ```ignore,no_run
6466 /// # use google_cloud_documentai_v1::model::document::TextChange;
6467 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6468 /// let x = TextChange::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
6469 /// let x = TextChange::new().set_or_clear_text_anchor(None::<TextAnchor>);
6470 /// ```
6471 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
6472 where
6473 T: std::convert::Into<crate::model::document::TextAnchor>,
6474 {
6475 self.text_anchor = v.map(|x| x.into());
6476 self
6477 }
6478
6479 /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
6480 ///
6481 /// # Example
6482 /// ```ignore,no_run
6483 /// # use google_cloud_documentai_v1::model::document::TextChange;
6484 /// let x = TextChange::new().set_changed_text("example");
6485 /// ```
6486 pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
6487 mut self,
6488 v: T,
6489 ) -> Self {
6490 self.changed_text = v.into();
6491 self
6492 }
6493
6494 /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
6495 ///
6496 /// # Example
6497 /// ```ignore,no_run
6498 /// # use google_cloud_documentai_v1::model::document::TextChange;
6499 /// use google_cloud_documentai_v1::model::document::Provenance;
6500 /// let x = TextChange::new()
6501 /// .set_provenance([
6502 /// Provenance::default()/* use setters */,
6503 /// Provenance::default()/* use (different) setters */,
6504 /// ]);
6505 /// ```
6506 #[deprecated]
6507 pub fn set_provenance<T, V>(mut self, v: T) -> Self
6508 where
6509 T: std::iter::IntoIterator<Item = V>,
6510 V: std::convert::Into<crate::model::document::Provenance>,
6511 {
6512 use std::iter::Iterator;
6513 self.provenance = v.into_iter().map(|i| i.into()).collect();
6514 self
6515 }
6516 }
6517
6518 impl wkt::message::Message for TextChange {
6519 fn typename() -> &'static str {
6520 "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
6521 }
6522 }
6523
6524 /// Represents the parsed layout of a document as a collection of blocks that
6525 /// the document is divided into.
6526 #[derive(Clone, Default, PartialEq)]
6527 #[non_exhaustive]
6528 pub struct DocumentLayout {
6529 /// List of blocks in the document.
6530 pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6531
6532 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6533 }
6534
6535 impl DocumentLayout {
6536 pub fn new() -> Self {
6537 std::default::Default::default()
6538 }
6539
6540 /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
6541 ///
6542 /// # Example
6543 /// ```ignore,no_run
6544 /// # use google_cloud_documentai_v1::model::document::DocumentLayout;
6545 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6546 /// let x = DocumentLayout::new()
6547 /// .set_blocks([
6548 /// DocumentLayoutBlock::default()/* use setters */,
6549 /// DocumentLayoutBlock::default()/* use (different) setters */,
6550 /// ]);
6551 /// ```
6552 pub fn set_blocks<T, V>(mut self, v: T) -> Self
6553 where
6554 T: std::iter::IntoIterator<Item = V>,
6555 V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
6556 {
6557 use std::iter::Iterator;
6558 self.blocks = v.into_iter().map(|i| i.into()).collect();
6559 self
6560 }
6561 }
6562
6563 impl wkt::message::Message for DocumentLayout {
6564 fn typename() -> &'static str {
6565 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
6566 }
6567 }
6568
6569 /// Defines additional types related to [DocumentLayout].
6570 pub mod document_layout {
6571 #[allow(unused_imports)]
6572 use super::*;
6573
6574 /// Represents a block. A block could be one of the various types (text,
6575 /// table, list) supported.
6576 #[derive(Clone, Default, PartialEq)]
6577 #[non_exhaustive]
6578 pub struct DocumentLayoutBlock {
6579 /// ID of the block.
6580 pub block_id: std::string::String,
6581
6582 /// Page span of the block.
6583 pub page_span: std::option::Option<
6584 crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
6585 >,
6586
6587 /// Identifies the bounding box for the block.
6588 pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6589
6590 pub block: std::option::Option<
6591 crate::model::document::document_layout::document_layout_block::Block,
6592 >,
6593
6594 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6595 }
6596
6597 impl DocumentLayoutBlock {
6598 pub fn new() -> Self {
6599 std::default::Default::default()
6600 }
6601
6602 /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
6603 ///
6604 /// # Example
6605 /// ```ignore,no_run
6606 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6607 /// let x = DocumentLayoutBlock::new().set_block_id("example");
6608 /// ```
6609 pub fn set_block_id<T: std::convert::Into<std::string::String>>(
6610 mut self,
6611 v: T,
6612 ) -> Self {
6613 self.block_id = v.into();
6614 self
6615 }
6616
6617 /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6618 ///
6619 /// # Example
6620 /// ```ignore,no_run
6621 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6622 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6623 /// let x = DocumentLayoutBlock::new().set_page_span(LayoutPageSpan::default()/* use setters */);
6624 /// ```
6625 pub fn set_page_span<T>(mut self, v: T) -> Self
6626 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6627 {
6628 self.page_span = std::option::Option::Some(v.into());
6629 self
6630 }
6631
6632 /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6633 ///
6634 /// # Example
6635 /// ```ignore,no_run
6636 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6637 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6638 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(Some(LayoutPageSpan::default()/* use setters */));
6639 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(None::<LayoutPageSpan>);
6640 /// ```
6641 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
6642 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6643 {
6644 self.page_span = v.map(|x| x.into());
6645 self
6646 }
6647
6648 /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6649 ///
6650 /// # Example
6651 /// ```ignore,no_run
6652 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6653 /// use google_cloud_documentai_v1::model::BoundingPoly;
6654 /// let x = DocumentLayoutBlock::new().set_bounding_box(BoundingPoly::default()/* use setters */);
6655 /// ```
6656 pub fn set_bounding_box<T>(mut self, v: T) -> Self
6657 where
6658 T: std::convert::Into<crate::model::BoundingPoly>,
6659 {
6660 self.bounding_box = std::option::Option::Some(v.into());
6661 self
6662 }
6663
6664 /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6665 ///
6666 /// # Example
6667 /// ```ignore,no_run
6668 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6669 /// use google_cloud_documentai_v1::model::BoundingPoly;
6670 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(Some(BoundingPoly::default()/* use setters */));
6671 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(None::<BoundingPoly>);
6672 /// ```
6673 pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6674 where
6675 T: std::convert::Into<crate::model::BoundingPoly>,
6676 {
6677 self.bounding_box = v.map(|x| x.into());
6678 self
6679 }
6680
6681 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
6682 ///
6683 /// Note that all the setters affecting `block` are mutually
6684 /// exclusive.
6685 ///
6686 /// # Example
6687 /// ```ignore,no_run
6688 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6689 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6690 /// let x = DocumentLayoutBlock::new().set_block(Some(
6691 /// google_cloud_documentai_v1::model::document::document_layout::document_layout_block::Block::TextBlock(LayoutTextBlock::default().into())));
6692 /// ```
6693 pub fn set_block<
6694 T: std::convert::Into<
6695 std::option::Option<
6696 crate::model::document::document_layout::document_layout_block::Block,
6697 >,
6698 >,
6699 >(
6700 mut self,
6701 v: T,
6702 ) -> Self {
6703 self.block = v.into();
6704 self
6705 }
6706
6707 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6708 /// if it holds a `TextBlock`, `None` if the field is not set or
6709 /// holds a different branch.
6710 pub fn text_block(
6711 &self,
6712 ) -> std::option::Option<
6713 &std::boxed::Box<
6714 crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
6715 >,
6716 > {
6717 #[allow(unreachable_patterns)]
6718 self.block.as_ref().and_then(|v| match v {
6719 crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
6720 _ => std::option::Option::None,
6721 })
6722 }
6723
6724 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6725 /// to hold a `TextBlock`.
6726 ///
6727 /// Note that all the setters affecting `block` are
6728 /// mutually exclusive.
6729 ///
6730 /// # Example
6731 /// ```ignore,no_run
6732 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6733 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6734 /// let x = DocumentLayoutBlock::new().set_text_block(LayoutTextBlock::default()/* use setters */);
6735 /// assert!(x.text_block().is_some());
6736 /// assert!(x.table_block().is_none());
6737 /// assert!(x.list_block().is_none());
6738 /// ```
6739 pub fn set_text_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>>>(mut self, v: T) -> Self{
6740 self.block = std::option::Option::Some(
6741 crate::model::document::document_layout::document_layout_block::Block::TextBlock(
6742 v.into()
6743 )
6744 );
6745 self
6746 }
6747
6748 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6749 /// if it holds a `TableBlock`, `None` if the field is not set or
6750 /// holds a different branch.
6751 pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
6752 #[allow(unreachable_patterns)]
6753 self.block.as_ref().and_then(|v| match v {
6754 crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
6755 _ => std::option::Option::None,
6756 })
6757 }
6758
6759 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6760 /// to hold a `TableBlock`.
6761 ///
6762 /// Note that all the setters affecting `block` are
6763 /// mutually exclusive.
6764 ///
6765 /// # Example
6766 /// ```ignore,no_run
6767 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6768 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
6769 /// let x = DocumentLayoutBlock::new().set_table_block(LayoutTableBlock::default()/* use setters */);
6770 /// assert!(x.table_block().is_some());
6771 /// assert!(x.text_block().is_none());
6772 /// assert!(x.list_block().is_none());
6773 /// ```
6774 pub fn set_table_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>>(mut self, v: T) -> Self{
6775 self.block = std::option::Option::Some(
6776 crate::model::document::document_layout::document_layout_block::Block::TableBlock(
6777 v.into()
6778 )
6779 );
6780 self
6781 }
6782
6783 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6784 /// if it holds a `ListBlock`, `None` if the field is not set or
6785 /// holds a different branch.
6786 pub fn list_block(
6787 &self,
6788 ) -> std::option::Option<
6789 &std::boxed::Box<
6790 crate::model::document::document_layout::document_layout_block::LayoutListBlock,
6791 >,
6792 > {
6793 #[allow(unreachable_patterns)]
6794 self.block.as_ref().and_then(|v| match v {
6795 crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
6796 _ => std::option::Option::None,
6797 })
6798 }
6799
6800 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6801 /// to hold a `ListBlock`.
6802 ///
6803 /// Note that all the setters affecting `block` are
6804 /// mutually exclusive.
6805 ///
6806 /// # Example
6807 /// ```ignore,no_run
6808 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6809 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
6810 /// let x = DocumentLayoutBlock::new().set_list_block(LayoutListBlock::default()/* use setters */);
6811 /// assert!(x.list_block().is_some());
6812 /// assert!(x.text_block().is_none());
6813 /// assert!(x.table_block().is_none());
6814 /// ```
6815 pub fn set_list_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>>>(mut self, v: T) -> Self{
6816 self.block = std::option::Option::Some(
6817 crate::model::document::document_layout::document_layout_block::Block::ListBlock(
6818 v.into()
6819 )
6820 );
6821 self
6822 }
6823 }
6824
6825 impl wkt::message::Message for DocumentLayoutBlock {
6826 fn typename() -> &'static str {
6827 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
6828 }
6829 }
6830
6831 /// Defines additional types related to [DocumentLayoutBlock].
6832 pub mod document_layout_block {
6833 #[allow(unused_imports)]
6834 use super::*;
6835
6836 /// Represents where the block starts and ends in the document.
6837 #[derive(Clone, Default, PartialEq)]
6838 #[non_exhaustive]
6839 pub struct LayoutPageSpan {
6840 /// Page where block starts in the document.
6841 pub page_start: i32,
6842
6843 /// Page where block ends in the document.
6844 pub page_end: i32,
6845
6846 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6847 }
6848
6849 impl LayoutPageSpan {
6850 pub fn new() -> Self {
6851 std::default::Default::default()
6852 }
6853
6854 /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
6855 ///
6856 /// # Example
6857 /// ```ignore,no_run
6858 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6859 /// let x = LayoutPageSpan::new().set_page_start(42);
6860 /// ```
6861 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6862 self.page_start = v.into();
6863 self
6864 }
6865
6866 /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
6867 ///
6868 /// # Example
6869 /// ```ignore,no_run
6870 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6871 /// let x = LayoutPageSpan::new().set_page_end(42);
6872 /// ```
6873 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6874 self.page_end = v.into();
6875 self
6876 }
6877 }
6878
6879 impl wkt::message::Message for LayoutPageSpan {
6880 fn typename() -> &'static str {
6881 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
6882 }
6883 }
6884
6885 /// Represents a text type block.
6886 #[derive(Clone, Default, PartialEq)]
6887 #[non_exhaustive]
6888 pub struct LayoutTextBlock {
6889 /// Text content stored in the block.
6890 pub text: std::string::String,
6891
6892 /// Type of the text in the block. Available options are: `paragraph`,
6893 /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
6894 /// `heading-5`, `header`, `footer`.
6895 pub r#type: std::string::String,
6896
6897 /// A text block could further have child blocks.
6898 /// Repeated blocks support further hierarchies and nested blocks.
6899 pub blocks:
6900 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6901
6902 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6903 }
6904
6905 impl LayoutTextBlock {
6906 pub fn new() -> Self {
6907 std::default::Default::default()
6908 }
6909
6910 /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
6911 ///
6912 /// # Example
6913 /// ```ignore,no_run
6914 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6915 /// let x = LayoutTextBlock::new().set_text("example");
6916 /// ```
6917 pub fn set_text<T: std::convert::Into<std::string::String>>(
6918 mut self,
6919 v: T,
6920 ) -> Self {
6921 self.text = v.into();
6922 self
6923 }
6924
6925 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
6926 ///
6927 /// # Example
6928 /// ```ignore,no_run
6929 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6930 /// let x = LayoutTextBlock::new().set_type("example");
6931 /// ```
6932 pub fn set_type<T: std::convert::Into<std::string::String>>(
6933 mut self,
6934 v: T,
6935 ) -> Self {
6936 self.r#type = v.into();
6937 self
6938 }
6939
6940 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
6941 ///
6942 /// # Example
6943 /// ```ignore,no_run
6944 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6945 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6946 /// let x = LayoutTextBlock::new()
6947 /// .set_blocks([
6948 /// DocumentLayoutBlock::default()/* use setters */,
6949 /// DocumentLayoutBlock::default()/* use (different) setters */,
6950 /// ]);
6951 /// ```
6952 pub fn set_blocks<T, V>(mut self, v: T) -> Self
6953 where
6954 T: std::iter::IntoIterator<Item = V>,
6955 V: std::convert::Into<
6956 crate::model::document::document_layout::DocumentLayoutBlock,
6957 >,
6958 {
6959 use std::iter::Iterator;
6960 self.blocks = v.into_iter().map(|i| i.into()).collect();
6961 self
6962 }
6963 }
6964
6965 impl wkt::message::Message for LayoutTextBlock {
6966 fn typename() -> &'static str {
6967 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
6968 }
6969 }
6970
6971 /// Represents a table type block.
6972 #[derive(Clone, Default, PartialEq)]
6973 #[non_exhaustive]
6974 pub struct LayoutTableBlock {
6975 /// Header rows at the top of the table.
6976 pub header_rows: std::vec::Vec<
6977 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
6978 >,
6979
6980 /// Body rows containing main table content.
6981 pub body_rows: std::vec::Vec<
6982 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
6983 >,
6984
6985 /// Table caption/title.
6986 pub caption: std::string::String,
6987
6988 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6989 }
6990
6991 impl LayoutTableBlock {
6992 pub fn new() -> Self {
6993 std::default::Default::default()
6994 }
6995
6996 /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
6997 ///
6998 /// # Example
6999 /// ```ignore,no_run
7000 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7001 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7002 /// let x = LayoutTableBlock::new()
7003 /// .set_header_rows([
7004 /// LayoutTableRow::default()/* use setters */,
7005 /// LayoutTableRow::default()/* use (different) setters */,
7006 /// ]);
7007 /// ```
7008 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
7009 where
7010 T: std::iter::IntoIterator<Item = V>,
7011 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7012 {
7013 use std::iter::Iterator;
7014 self.header_rows = v.into_iter().map(|i| i.into()).collect();
7015 self
7016 }
7017
7018 /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
7019 ///
7020 /// # Example
7021 /// ```ignore,no_run
7022 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7023 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7024 /// let x = LayoutTableBlock::new()
7025 /// .set_body_rows([
7026 /// LayoutTableRow::default()/* use setters */,
7027 /// LayoutTableRow::default()/* use (different) setters */,
7028 /// ]);
7029 /// ```
7030 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
7031 where
7032 T: std::iter::IntoIterator<Item = V>,
7033 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7034 {
7035 use std::iter::Iterator;
7036 self.body_rows = v.into_iter().map(|i| i.into()).collect();
7037 self
7038 }
7039
7040 /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
7041 ///
7042 /// # Example
7043 /// ```ignore,no_run
7044 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7045 /// let x = LayoutTableBlock::new().set_caption("example");
7046 /// ```
7047 pub fn set_caption<T: std::convert::Into<std::string::String>>(
7048 mut self,
7049 v: T,
7050 ) -> Self {
7051 self.caption = v.into();
7052 self
7053 }
7054 }
7055
7056 impl wkt::message::Message for LayoutTableBlock {
7057 fn typename() -> &'static str {
7058 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
7059 }
7060 }
7061
7062 /// Represents a row in a table.
7063 #[derive(Clone, Default, PartialEq)]
7064 #[non_exhaustive]
7065 pub struct LayoutTableRow {
7066 /// A table row is a list of table cells.
7067 pub cells: std::vec::Vec<
7068 crate::model::document::document_layout::document_layout_block::LayoutTableCell,
7069 >,
7070
7071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7072 }
7073
7074 impl LayoutTableRow {
7075 pub fn new() -> Self {
7076 std::default::Default::default()
7077 }
7078
7079 /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
7080 ///
7081 /// # Example
7082 /// ```ignore,no_run
7083 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7084 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7085 /// let x = LayoutTableRow::new()
7086 /// .set_cells([
7087 /// LayoutTableCell::default()/* use setters */,
7088 /// LayoutTableCell::default()/* use (different) setters */,
7089 /// ]);
7090 /// ```
7091 pub fn set_cells<T, V>(mut self, v: T) -> Self
7092 where
7093 T: std::iter::IntoIterator<Item = V>,
7094 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
7095 {
7096 use std::iter::Iterator;
7097 self.cells = v.into_iter().map(|i| i.into()).collect();
7098 self
7099 }
7100 }
7101
7102 impl wkt::message::Message for LayoutTableRow {
7103 fn typename() -> &'static str {
7104 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
7105 }
7106 }
7107
7108 /// Represents a cell in a table row.
7109 #[derive(Clone, Default, PartialEq)]
7110 #[non_exhaustive]
7111 pub struct LayoutTableCell {
7112 /// A table cell is a list of blocks.
7113 /// Repeated blocks support further hierarchies and nested blocks.
7114 pub blocks:
7115 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7116
7117 /// How many rows this cell spans.
7118 pub row_span: i32,
7119
7120 /// How many columns this cell spans.
7121 pub col_span: i32,
7122
7123 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7124 }
7125
7126 impl LayoutTableCell {
7127 pub fn new() -> Self {
7128 std::default::Default::default()
7129 }
7130
7131 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
7132 ///
7133 /// # Example
7134 /// ```ignore,no_run
7135 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7136 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7137 /// let x = LayoutTableCell::new()
7138 /// .set_blocks([
7139 /// DocumentLayoutBlock::default()/* use setters */,
7140 /// DocumentLayoutBlock::default()/* use (different) setters */,
7141 /// ]);
7142 /// ```
7143 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7144 where
7145 T: std::iter::IntoIterator<Item = V>,
7146 V: std::convert::Into<
7147 crate::model::document::document_layout::DocumentLayoutBlock,
7148 >,
7149 {
7150 use std::iter::Iterator;
7151 self.blocks = v.into_iter().map(|i| i.into()).collect();
7152 self
7153 }
7154
7155 /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
7156 ///
7157 /// # Example
7158 /// ```ignore,no_run
7159 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7160 /// let x = LayoutTableCell::new().set_row_span(42);
7161 /// ```
7162 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7163 self.row_span = v.into();
7164 self
7165 }
7166
7167 /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
7168 ///
7169 /// # Example
7170 /// ```ignore,no_run
7171 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7172 /// let x = LayoutTableCell::new().set_col_span(42);
7173 /// ```
7174 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7175 self.col_span = v.into();
7176 self
7177 }
7178 }
7179
7180 impl wkt::message::Message for LayoutTableCell {
7181 fn typename() -> &'static str {
7182 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
7183 }
7184 }
7185
7186 /// Represents a list type block.
7187 #[derive(Clone, Default, PartialEq)]
7188 #[non_exhaustive]
7189 pub struct LayoutListBlock {
7190 /// List entries that constitute a list block.
7191 pub list_entries: std::vec::Vec<
7192 crate::model::document::document_layout::document_layout_block::LayoutListEntry,
7193 >,
7194
7195 /// Type of the list_entries (if exist). Available options are `ordered`
7196 /// and `unordered`.
7197 pub r#type: std::string::String,
7198
7199 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7200 }
7201
7202 impl LayoutListBlock {
7203 pub fn new() -> Self {
7204 std::default::Default::default()
7205 }
7206
7207 /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
7208 ///
7209 /// # Example
7210 /// ```ignore,no_run
7211 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7212 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7213 /// let x = LayoutListBlock::new()
7214 /// .set_list_entries([
7215 /// LayoutListEntry::default()/* use setters */,
7216 /// LayoutListEntry::default()/* use (different) setters */,
7217 /// ]);
7218 /// ```
7219 pub fn set_list_entries<T, V>(mut self, v: T) -> Self
7220 where
7221 T: std::iter::IntoIterator<Item = V>,
7222 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
7223 {
7224 use std::iter::Iterator;
7225 self.list_entries = v.into_iter().map(|i| i.into()).collect();
7226 self
7227 }
7228
7229 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
7230 ///
7231 /// # Example
7232 /// ```ignore,no_run
7233 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7234 /// let x = LayoutListBlock::new().set_type("example");
7235 /// ```
7236 pub fn set_type<T: std::convert::Into<std::string::String>>(
7237 mut self,
7238 v: T,
7239 ) -> Self {
7240 self.r#type = v.into();
7241 self
7242 }
7243 }
7244
7245 impl wkt::message::Message for LayoutListBlock {
7246 fn typename() -> &'static str {
7247 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
7248 }
7249 }
7250
7251 /// Represents an entry in the list.
7252 #[derive(Clone, Default, PartialEq)]
7253 #[non_exhaustive]
7254 pub struct LayoutListEntry {
7255 /// A list entry is a list of blocks.
7256 /// Repeated blocks support further hierarchies and nested blocks.
7257 pub blocks:
7258 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7259
7260 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7261 }
7262
7263 impl LayoutListEntry {
7264 pub fn new() -> Self {
7265 std::default::Default::default()
7266 }
7267
7268 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
7269 ///
7270 /// # Example
7271 /// ```ignore,no_run
7272 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7273 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7274 /// let x = LayoutListEntry::new()
7275 /// .set_blocks([
7276 /// DocumentLayoutBlock::default()/* use setters */,
7277 /// DocumentLayoutBlock::default()/* use (different) setters */,
7278 /// ]);
7279 /// ```
7280 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7281 where
7282 T: std::iter::IntoIterator<Item = V>,
7283 V: std::convert::Into<
7284 crate::model::document::document_layout::DocumentLayoutBlock,
7285 >,
7286 {
7287 use std::iter::Iterator;
7288 self.blocks = v.into_iter().map(|i| i.into()).collect();
7289 self
7290 }
7291 }
7292
7293 impl wkt::message::Message for LayoutListEntry {
7294 fn typename() -> &'static str {
7295 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
7296 }
7297 }
7298
7299 #[derive(Clone, Debug, PartialEq)]
7300 #[non_exhaustive]
7301 pub enum Block {
7302 /// Block consisting of text content.
7303 TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
7304 /// Block consisting of table content/structure.
7305 TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
7306 /// Block consisting of list content/structure.
7307 ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
7308 }
7309 }
7310 }
7311
7312 /// Represents the chunks that the document is divided into.
7313 #[derive(Clone, Default, PartialEq)]
7314 #[non_exhaustive]
7315 pub struct ChunkedDocument {
7316 /// List of chunks.
7317 pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
7318
7319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7320 }
7321
7322 impl ChunkedDocument {
7323 pub fn new() -> Self {
7324 std::default::Default::default()
7325 }
7326
7327 /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
7328 ///
7329 /// # Example
7330 /// ```ignore,no_run
7331 /// # use google_cloud_documentai_v1::model::document::ChunkedDocument;
7332 /// use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7333 /// let x = ChunkedDocument::new()
7334 /// .set_chunks([
7335 /// Chunk::default()/* use setters */,
7336 /// Chunk::default()/* use (different) setters */,
7337 /// ]);
7338 /// ```
7339 pub fn set_chunks<T, V>(mut self, v: T) -> Self
7340 where
7341 T: std::iter::IntoIterator<Item = V>,
7342 V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
7343 {
7344 use std::iter::Iterator;
7345 self.chunks = v.into_iter().map(|i| i.into()).collect();
7346 self
7347 }
7348 }
7349
7350 impl wkt::message::Message for ChunkedDocument {
7351 fn typename() -> &'static str {
7352 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
7353 }
7354 }
7355
7356 /// Defines additional types related to [ChunkedDocument].
7357 pub mod chunked_document {
7358 #[allow(unused_imports)]
7359 use super::*;
7360
7361 /// Represents a chunk.
7362 #[derive(Clone, Default, PartialEq)]
7363 #[non_exhaustive]
7364 pub struct Chunk {
7365 /// ID of the chunk.
7366 pub chunk_id: std::string::String,
7367
7368 /// Unused.
7369 pub source_block_ids: std::vec::Vec<std::string::String>,
7370
7371 /// Text content of the chunk.
7372 pub content: std::string::String,
7373
7374 /// Page span of the chunk.
7375 pub page_span:
7376 std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
7377
7378 /// Page headers associated with the chunk.
7379 pub page_headers:
7380 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
7381
7382 /// Page footers associated with the chunk.
7383 pub page_footers:
7384 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
7385
7386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7387 }
7388
7389 impl Chunk {
7390 pub fn new() -> Self {
7391 std::default::Default::default()
7392 }
7393
7394 /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
7395 ///
7396 /// # Example
7397 /// ```ignore,no_run
7398 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7399 /// let x = Chunk::new().set_chunk_id("example");
7400 /// ```
7401 pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
7402 mut self,
7403 v: T,
7404 ) -> Self {
7405 self.chunk_id = v.into();
7406 self
7407 }
7408
7409 /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
7410 ///
7411 /// # Example
7412 /// ```ignore,no_run
7413 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7414 /// let x = Chunk::new().set_source_block_ids(["a", "b", "c"]);
7415 /// ```
7416 pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
7417 where
7418 T: std::iter::IntoIterator<Item = V>,
7419 V: std::convert::Into<std::string::String>,
7420 {
7421 use std::iter::Iterator;
7422 self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
7423 self
7424 }
7425
7426 /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
7427 ///
7428 /// # Example
7429 /// ```ignore,no_run
7430 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7431 /// let x = Chunk::new().set_content("example");
7432 /// ```
7433 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7434 self.content = v.into();
7435 self
7436 }
7437
7438 /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7439 ///
7440 /// # Example
7441 /// ```ignore,no_run
7442 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7443 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7444 /// let x = Chunk::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7445 /// ```
7446 pub fn set_page_span<T>(mut self, v: T) -> Self
7447 where
7448 T: std::convert::Into<
7449 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7450 >,
7451 {
7452 self.page_span = std::option::Option::Some(v.into());
7453 self
7454 }
7455
7456 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7457 ///
7458 /// # Example
7459 /// ```ignore,no_run
7460 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7461 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7462 /// let x = Chunk::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7463 /// let x = Chunk::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7464 /// ```
7465 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7466 where
7467 T: std::convert::Into<
7468 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7469 >,
7470 {
7471 self.page_span = v.map(|x| x.into());
7472 self
7473 }
7474
7475 /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
7476 ///
7477 /// # Example
7478 /// ```ignore,no_run
7479 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7480 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7481 /// let x = Chunk::new()
7482 /// .set_page_headers([
7483 /// ChunkPageHeader::default()/* use setters */,
7484 /// ChunkPageHeader::default()/* use (different) setters */,
7485 /// ]);
7486 /// ```
7487 pub fn set_page_headers<T, V>(mut self, v: T) -> Self
7488 where
7489 T: std::iter::IntoIterator<Item = V>,
7490 V: std::convert::Into<
7491 crate::model::document::chunked_document::chunk::ChunkPageHeader,
7492 >,
7493 {
7494 use std::iter::Iterator;
7495 self.page_headers = v.into_iter().map(|i| i.into()).collect();
7496 self
7497 }
7498
7499 /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
7500 ///
7501 /// # Example
7502 /// ```ignore,no_run
7503 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7504 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7505 /// let x = Chunk::new()
7506 /// .set_page_footers([
7507 /// ChunkPageFooter::default()/* use setters */,
7508 /// ChunkPageFooter::default()/* use (different) setters */,
7509 /// ]);
7510 /// ```
7511 pub fn set_page_footers<T, V>(mut self, v: T) -> Self
7512 where
7513 T: std::iter::IntoIterator<Item = V>,
7514 V: std::convert::Into<
7515 crate::model::document::chunked_document::chunk::ChunkPageFooter,
7516 >,
7517 {
7518 use std::iter::Iterator;
7519 self.page_footers = v.into_iter().map(|i| i.into()).collect();
7520 self
7521 }
7522 }
7523
7524 impl wkt::message::Message for Chunk {
7525 fn typename() -> &'static str {
7526 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
7527 }
7528 }
7529
7530 /// Defines additional types related to [Chunk].
7531 pub mod chunk {
7532 #[allow(unused_imports)]
7533 use super::*;
7534
7535 /// Represents where the chunk starts and ends in the document.
7536 #[derive(Clone, Default, PartialEq)]
7537 #[non_exhaustive]
7538 pub struct ChunkPageSpan {
7539 /// Page where chunk starts in the document.
7540 pub page_start: i32,
7541
7542 /// Page where chunk ends in the document.
7543 pub page_end: i32,
7544
7545 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7546 }
7547
7548 impl ChunkPageSpan {
7549 pub fn new() -> Self {
7550 std::default::Default::default()
7551 }
7552
7553 /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
7554 ///
7555 /// # Example
7556 /// ```ignore,no_run
7557 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7558 /// let x = ChunkPageSpan::new().set_page_start(42);
7559 /// ```
7560 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7561 self.page_start = v.into();
7562 self
7563 }
7564
7565 /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
7566 ///
7567 /// # Example
7568 /// ```ignore,no_run
7569 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7570 /// let x = ChunkPageSpan::new().set_page_end(42);
7571 /// ```
7572 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7573 self.page_end = v.into();
7574 self
7575 }
7576 }
7577
7578 impl wkt::message::Message for ChunkPageSpan {
7579 fn typename() -> &'static str {
7580 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
7581 }
7582 }
7583
7584 /// Represents the page header associated with the chunk.
7585 #[derive(Clone, Default, PartialEq)]
7586 #[non_exhaustive]
7587 pub struct ChunkPageHeader {
7588 /// Header in text format.
7589 pub text: std::string::String,
7590
7591 /// Page span of the header.
7592 pub page_span: std::option::Option<
7593 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7594 >,
7595
7596 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7597 }
7598
7599 impl ChunkPageHeader {
7600 pub fn new() -> Self {
7601 std::default::Default::default()
7602 }
7603
7604 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
7605 ///
7606 /// # Example
7607 /// ```ignore,no_run
7608 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7609 /// let x = ChunkPageHeader::new().set_text("example");
7610 /// ```
7611 pub fn set_text<T: std::convert::Into<std::string::String>>(
7612 mut self,
7613 v: T,
7614 ) -> Self {
7615 self.text = v.into();
7616 self
7617 }
7618
7619 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
7620 ///
7621 /// # Example
7622 /// ```ignore,no_run
7623 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7624 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7625 /// let x = ChunkPageHeader::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7626 /// ```
7627 pub fn set_page_span<T>(mut self, v: T) -> Self
7628 where
7629 T: std::convert::Into<
7630 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7631 >,
7632 {
7633 self.page_span = std::option::Option::Some(v.into());
7634 self
7635 }
7636
7637 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
7638 ///
7639 /// # Example
7640 /// ```ignore,no_run
7641 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7642 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7643 /// let x = ChunkPageHeader::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7644 /// let x = ChunkPageHeader::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7645 /// ```
7646 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7647 where
7648 T: std::convert::Into<
7649 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7650 >,
7651 {
7652 self.page_span = v.map(|x| x.into());
7653 self
7654 }
7655 }
7656
7657 impl wkt::message::Message for ChunkPageHeader {
7658 fn typename() -> &'static str {
7659 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
7660 }
7661 }
7662
7663 /// Represents the page footer associated with the chunk.
7664 #[derive(Clone, Default, PartialEq)]
7665 #[non_exhaustive]
7666 pub struct ChunkPageFooter {
7667 /// Footer in text format.
7668 pub text: std::string::String,
7669
7670 /// Page span of the footer.
7671 pub page_span: std::option::Option<
7672 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7673 >,
7674
7675 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7676 }
7677
7678 impl ChunkPageFooter {
7679 pub fn new() -> Self {
7680 std::default::Default::default()
7681 }
7682
7683 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
7684 ///
7685 /// # Example
7686 /// ```ignore,no_run
7687 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7688 /// let x = ChunkPageFooter::new().set_text("example");
7689 /// ```
7690 pub fn set_text<T: std::convert::Into<std::string::String>>(
7691 mut self,
7692 v: T,
7693 ) -> Self {
7694 self.text = v.into();
7695 self
7696 }
7697
7698 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
7699 ///
7700 /// # Example
7701 /// ```ignore,no_run
7702 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7703 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7704 /// let x = ChunkPageFooter::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7705 /// ```
7706 pub fn set_page_span<T>(mut self, v: T) -> Self
7707 where
7708 T: std::convert::Into<
7709 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7710 >,
7711 {
7712 self.page_span = std::option::Option::Some(v.into());
7713 self
7714 }
7715
7716 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
7717 ///
7718 /// # Example
7719 /// ```ignore,no_run
7720 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7721 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7722 /// let x = ChunkPageFooter::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7723 /// let x = ChunkPageFooter::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7724 /// ```
7725 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7726 where
7727 T: std::convert::Into<
7728 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7729 >,
7730 {
7731 self.page_span = v.map(|x| x.into());
7732 self
7733 }
7734 }
7735
7736 impl wkt::message::Message for ChunkPageFooter {
7737 fn typename() -> &'static str {
7738 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
7739 }
7740 }
7741 }
7742 }
7743
7744 /// The output of the validation given the document and the validation rules.
7745 #[derive(Clone, Default, PartialEq)]
7746 #[non_exhaustive]
7747 pub struct EntityValidationOutput {
7748 /// The result of each validation rule.
7749 pub validation_results:
7750 std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
7751
7752 /// The overall result of the validation, true if all applicable rules are
7753 /// valid.
7754 pub pass_all_rules: bool,
7755
7756 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7757 }
7758
7759 impl EntityValidationOutput {
7760 pub fn new() -> Self {
7761 std::default::Default::default()
7762 }
7763
7764 /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
7765 ///
7766 /// # Example
7767 /// ```ignore,no_run
7768 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
7769 /// use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7770 /// let x = EntityValidationOutput::new()
7771 /// .set_validation_results([
7772 /// ValidationResult::default()/* use setters */,
7773 /// ValidationResult::default()/* use (different) setters */,
7774 /// ]);
7775 /// ```
7776 pub fn set_validation_results<T, V>(mut self, v: T) -> Self
7777 where
7778 T: std::iter::IntoIterator<Item = V>,
7779 V: std::convert::Into<
7780 crate::model::document::entity_validation_output::ValidationResult,
7781 >,
7782 {
7783 use std::iter::Iterator;
7784 self.validation_results = v.into_iter().map(|i| i.into()).collect();
7785 self
7786 }
7787
7788 /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
7789 ///
7790 /// # Example
7791 /// ```ignore,no_run
7792 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
7793 /// let x = EntityValidationOutput::new().set_pass_all_rules(true);
7794 /// ```
7795 pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
7796 self.pass_all_rules = v.into();
7797 self
7798 }
7799 }
7800
7801 impl wkt::message::Message for EntityValidationOutput {
7802 fn typename() -> &'static str {
7803 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
7804 }
7805 }
7806
7807 /// Defines additional types related to [EntityValidationOutput].
7808 pub mod entity_validation_output {
7809 #[allow(unused_imports)]
7810 use super::*;
7811
7812 /// Validation result for a single validation rule.
7813 #[derive(Clone, Default, PartialEq)]
7814 #[non_exhaustive]
7815 pub struct ValidationResult {
7816
7817 /// The name of the validation rule.
7818 pub rule_name: std::string::String,
7819
7820 /// The description of the validation rule.
7821 pub rule_description: std::string::String,
7822
7823 /// The result of the validation rule.
7824 pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
7825
7826 /// The detailed information of the running the validation process using
7827 /// the entity from the document based on the validation rule.
7828 pub validation_details: std::string::String,
7829
7830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7831 }
7832
7833 impl ValidationResult {
7834 pub fn new() -> Self {
7835 std::default::Default::default()
7836 }
7837
7838 /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
7839 ///
7840 /// # Example
7841 /// ```ignore,no_run
7842 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7843 /// let x = ValidationResult::new().set_rule_name("example");
7844 /// ```
7845 pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
7846 mut self,
7847 v: T,
7848 ) -> Self {
7849 self.rule_name = v.into();
7850 self
7851 }
7852
7853 /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
7854 ///
7855 /// # Example
7856 /// ```ignore,no_run
7857 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7858 /// let x = ValidationResult::new().set_rule_description("example");
7859 /// ```
7860 pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
7861 mut self,
7862 v: T,
7863 ) -> Self {
7864 self.rule_description = v.into();
7865 self
7866 }
7867
7868 /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
7869 ///
7870 /// # Example
7871 /// ```ignore,no_run
7872 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7873 /// use google_cloud_documentai_v1::model::document::entity_validation_output::validation_result::ValidationResultType;
7874 /// let x0 = ValidationResult::new().set_validation_result_type(ValidationResultType::Valid);
7875 /// let x1 = ValidationResult::new().set_validation_result_type(ValidationResultType::Invalid);
7876 /// let x2 = ValidationResult::new().set_validation_result_type(ValidationResultType::Skipped);
7877 /// ```
7878 pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
7879 self.validation_result_type = v.into();
7880 self
7881 }
7882
7883 /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
7884 ///
7885 /// # Example
7886 /// ```ignore,no_run
7887 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
7888 /// let x = ValidationResult::new().set_validation_details("example");
7889 /// ```
7890 pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
7891 mut self,
7892 v: T,
7893 ) -> Self {
7894 self.validation_details = v.into();
7895 self
7896 }
7897 }
7898
7899 impl wkt::message::Message for ValidationResult {
7900 fn typename() -> &'static str {
7901 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
7902 }
7903 }
7904
7905 /// Defines additional types related to [ValidationResult].
7906 pub mod validation_result {
7907 #[allow(unused_imports)]
7908 use super::*;
7909
7910 /// The result of the validation rule.
7911 ///
7912 /// # Working with unknown values
7913 ///
7914 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7915 /// additional enum variants at any time. Adding new variants is not considered
7916 /// a breaking change. Applications should write their code in anticipation of:
7917 ///
7918 /// - New values appearing in future releases of the client library, **and**
7919 /// - New values received dynamically, without application changes.
7920 ///
7921 /// Please consult the [Working with enums] section in the user guide for some
7922 /// guidelines.
7923 ///
7924 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7925 #[derive(Clone, Debug, PartialEq)]
7926 #[non_exhaustive]
7927 pub enum ValidationResultType {
7928 /// The validation result type is unspecified.
7929 Unspecified,
7930 /// The validation is valid.
7931 Valid,
7932 /// The validation is invalid.
7933 Invalid,
7934 /// The validation is skipped.
7935 Skipped,
7936 /// The validation is not applicable.
7937 NotApplicable,
7938 /// If set, the enum was initialized with an unknown value.
7939 ///
7940 /// Applications can examine the value using [ValidationResultType::value] or
7941 /// [ValidationResultType::name].
7942 UnknownValue(validation_result_type::UnknownValue),
7943 }
7944
7945 #[doc(hidden)]
7946 pub mod validation_result_type {
7947 #[allow(unused_imports)]
7948 use super::*;
7949 #[derive(Clone, Debug, PartialEq)]
7950 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7951 }
7952
7953 impl ValidationResultType {
7954 /// Gets the enum value.
7955 ///
7956 /// Returns `None` if the enum contains an unknown value deserialized from
7957 /// the string representation of enums.
7958 pub fn value(&self) -> std::option::Option<i32> {
7959 match self {
7960 Self::Unspecified => std::option::Option::Some(0),
7961 Self::Valid => std::option::Option::Some(1),
7962 Self::Invalid => std::option::Option::Some(2),
7963 Self::Skipped => std::option::Option::Some(3),
7964 Self::NotApplicable => std::option::Option::Some(4),
7965 Self::UnknownValue(u) => u.0.value(),
7966 }
7967 }
7968
7969 /// Gets the enum value as a string.
7970 ///
7971 /// Returns `None` if the enum contains an unknown value deserialized from
7972 /// the integer representation of enums.
7973 pub fn name(&self) -> std::option::Option<&str> {
7974 match self {
7975 Self::Unspecified => {
7976 std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
7977 }
7978 Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
7979 Self::Invalid => {
7980 std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
7981 }
7982 Self::Skipped => {
7983 std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
7984 }
7985 Self::NotApplicable => {
7986 std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
7987 }
7988 Self::UnknownValue(u) => u.0.name(),
7989 }
7990 }
7991 }
7992
7993 impl std::default::Default for ValidationResultType {
7994 fn default() -> Self {
7995 use std::convert::From;
7996 Self::from(0)
7997 }
7998 }
7999
8000 impl std::fmt::Display for ValidationResultType {
8001 fn fmt(
8002 &self,
8003 f: &mut std::fmt::Formatter<'_>,
8004 ) -> std::result::Result<(), std::fmt::Error> {
8005 wkt::internal::display_enum(f, self.name(), self.value())
8006 }
8007 }
8008
8009 impl std::convert::From<i32> for ValidationResultType {
8010 fn from(value: i32) -> Self {
8011 match value {
8012 0 => Self::Unspecified,
8013 1 => Self::Valid,
8014 2 => Self::Invalid,
8015 3 => Self::Skipped,
8016 4 => Self::NotApplicable,
8017 _ => Self::UnknownValue(validation_result_type::UnknownValue(
8018 wkt::internal::UnknownEnumValue::Integer(value),
8019 )),
8020 }
8021 }
8022 }
8023
8024 impl std::convert::From<&str> for ValidationResultType {
8025 fn from(value: &str) -> Self {
8026 use std::string::ToString;
8027 match value {
8028 "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
8029 "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
8030 "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
8031 "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
8032 "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
8033 _ => Self::UnknownValue(validation_result_type::UnknownValue(
8034 wkt::internal::UnknownEnumValue::String(value.to_string()),
8035 )),
8036 }
8037 }
8038 }
8039
8040 impl serde::ser::Serialize for ValidationResultType {
8041 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
8042 where
8043 S: serde::Serializer,
8044 {
8045 match self {
8046 Self::Unspecified => serializer.serialize_i32(0),
8047 Self::Valid => serializer.serialize_i32(1),
8048 Self::Invalid => serializer.serialize_i32(2),
8049 Self::Skipped => serializer.serialize_i32(3),
8050 Self::NotApplicable => serializer.serialize_i32(4),
8051 Self::UnknownValue(u) => u.0.serialize(serializer),
8052 }
8053 }
8054 }
8055
8056 impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
8057 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
8058 where
8059 D: serde::Deserializer<'de>,
8060 {
8061 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
8062 ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
8063 }
8064 }
8065 }
8066 }
8067
8068 /// Entity revision.
8069 #[derive(Clone, Default, PartialEq)]
8070 #[non_exhaustive]
8071 pub struct EntitiesRevision {
8072 /// The revision id.
8073 pub revision_id: std::string::String,
8074
8075 /// The entities in this revision.
8076 pub entities: std::vec::Vec<crate::model::document::Entity>,
8077
8078 /// The entity validation output for this revision.
8079 pub entity_validation_output:
8080 std::option::Option<crate::model::document::EntityValidationOutput>,
8081
8082 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8083 }
8084
8085 impl EntitiesRevision {
8086 pub fn new() -> Self {
8087 std::default::Default::default()
8088 }
8089
8090 /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
8091 ///
8092 /// # Example
8093 /// ```ignore,no_run
8094 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8095 /// let x = EntitiesRevision::new().set_revision_id("example");
8096 /// ```
8097 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8098 self.revision_id = v.into();
8099 self
8100 }
8101
8102 /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
8103 ///
8104 /// # Example
8105 /// ```ignore,no_run
8106 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8107 /// use google_cloud_documentai_v1::model::document::Entity;
8108 /// let x = EntitiesRevision::new()
8109 /// .set_entities([
8110 /// Entity::default()/* use setters */,
8111 /// Entity::default()/* use (different) setters */,
8112 /// ]);
8113 /// ```
8114 pub fn set_entities<T, V>(mut self, v: T) -> Self
8115 where
8116 T: std::iter::IntoIterator<Item = V>,
8117 V: std::convert::Into<crate::model::document::Entity>,
8118 {
8119 use std::iter::Iterator;
8120 self.entities = v.into_iter().map(|i| i.into()).collect();
8121 self
8122 }
8123
8124 /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
8125 ///
8126 /// # Example
8127 /// ```ignore,no_run
8128 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8129 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8130 /// let x = EntitiesRevision::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
8131 /// ```
8132 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
8133 where
8134 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
8135 {
8136 self.entity_validation_output = std::option::Option::Some(v.into());
8137 self
8138 }
8139
8140 /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
8141 ///
8142 /// # Example
8143 /// ```ignore,no_run
8144 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
8145 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8146 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
8147 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
8148 /// ```
8149 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
8150 where
8151 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
8152 {
8153 self.entity_validation_output = v.map(|x| x.into());
8154 self
8155 }
8156 }
8157
8158 impl wkt::message::Message for EntitiesRevision {
8159 fn typename() -> &'static str {
8160 "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
8161 }
8162 }
8163
8164 /// Original source document from the user.
8165 #[derive(Clone, Debug, PartialEq)]
8166 #[non_exhaustive]
8167 pub enum Source {
8168 /// Optional. Currently supports Google Cloud Storage URI of the form
8169 /// `gs://bucket_name/object_name`. Object versioning is not supported.
8170 /// For more information, refer to [Google Cloud Storage Request
8171 /// URIs](https://cloud.google.com/storage/docs/reference-uris).
8172 Uri(std::string::String),
8173 /// Optional. Inline document content, represented as a stream of bytes.
8174 /// Note: As with all `bytes` fields, protobuffers use a pure binary
8175 /// representation, whereas JSON representations use base64.
8176 Content(::bytes::Bytes),
8177 }
8178}
8179
8180/// Payload message of raw document content (bytes).
8181#[derive(Clone, Default, PartialEq)]
8182#[non_exhaustive]
8183pub struct RawDocument {
8184 /// Inline document content.
8185 pub content: ::bytes::Bytes,
8186
8187 /// An IANA MIME type (RFC6838) indicating the nature and format of the
8188 /// [content][google.cloud.documentai.v1.RawDocument.content].
8189 ///
8190 /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
8191 pub mime_type: std::string::String,
8192
8193 /// The display name of the document, it supports all Unicode characters except
8194 /// the following:
8195 /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
8196 /// `~`, `=` and `:` are reserved.
8197 /// If not specified, a default ID is generated.
8198 pub display_name: std::string::String,
8199
8200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8201}
8202
8203impl RawDocument {
8204 pub fn new() -> Self {
8205 std::default::Default::default()
8206 }
8207
8208 /// Sets the value of [content][crate::model::RawDocument::content].
8209 ///
8210 /// # Example
8211 /// ```ignore,no_run
8212 /// # use google_cloud_documentai_v1::model::RawDocument;
8213 /// let x = RawDocument::new().set_content(bytes::Bytes::from_static(b"example"));
8214 /// ```
8215 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8216 self.content = v.into();
8217 self
8218 }
8219
8220 /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
8221 ///
8222 /// # Example
8223 /// ```ignore,no_run
8224 /// # use google_cloud_documentai_v1::model::RawDocument;
8225 /// let x = RawDocument::new().set_mime_type("example");
8226 /// ```
8227 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8228 self.mime_type = v.into();
8229 self
8230 }
8231
8232 /// Sets the value of [display_name][crate::model::RawDocument::display_name].
8233 ///
8234 /// # Example
8235 /// ```ignore,no_run
8236 /// # use google_cloud_documentai_v1::model::RawDocument;
8237 /// let x = RawDocument::new().set_display_name("example");
8238 /// ```
8239 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8240 self.display_name = v.into();
8241 self
8242 }
8243}
8244
8245impl wkt::message::Message for RawDocument {
8246 fn typename() -> &'static str {
8247 "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
8248 }
8249}
8250
8251/// Specifies a document stored on Cloud Storage.
8252#[derive(Clone, Default, PartialEq)]
8253#[non_exhaustive]
8254pub struct GcsDocument {
8255 /// The Cloud Storage object uri.
8256 pub gcs_uri: std::string::String,
8257
8258 /// An IANA MIME type (RFC6838) of the content.
8259 pub mime_type: std::string::String,
8260
8261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8262}
8263
8264impl GcsDocument {
8265 pub fn new() -> Self {
8266 std::default::Default::default()
8267 }
8268
8269 /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
8270 ///
8271 /// # Example
8272 /// ```ignore,no_run
8273 /// # use google_cloud_documentai_v1::model::GcsDocument;
8274 /// let x = GcsDocument::new().set_gcs_uri("example");
8275 /// ```
8276 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8277 self.gcs_uri = v.into();
8278 self
8279 }
8280
8281 /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
8282 ///
8283 /// # Example
8284 /// ```ignore,no_run
8285 /// # use google_cloud_documentai_v1::model::GcsDocument;
8286 /// let x = GcsDocument::new().set_mime_type("example");
8287 /// ```
8288 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8289 self.mime_type = v.into();
8290 self
8291 }
8292}
8293
8294impl wkt::message::Message for GcsDocument {
8295 fn typename() -> &'static str {
8296 "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
8297 }
8298}
8299
8300/// Specifies a set of documents on Cloud Storage.
8301#[derive(Clone, Default, PartialEq)]
8302#[non_exhaustive]
8303pub struct GcsDocuments {
8304 /// The list of documents.
8305 pub documents: std::vec::Vec<crate::model::GcsDocument>,
8306
8307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8308}
8309
8310impl GcsDocuments {
8311 pub fn new() -> Self {
8312 std::default::Default::default()
8313 }
8314
8315 /// Sets the value of [documents][crate::model::GcsDocuments::documents].
8316 ///
8317 /// # Example
8318 /// ```ignore,no_run
8319 /// # use google_cloud_documentai_v1::model::GcsDocuments;
8320 /// use google_cloud_documentai_v1::model::GcsDocument;
8321 /// let x = GcsDocuments::new()
8322 /// .set_documents([
8323 /// GcsDocument::default()/* use setters */,
8324 /// GcsDocument::default()/* use (different) setters */,
8325 /// ]);
8326 /// ```
8327 pub fn set_documents<T, V>(mut self, v: T) -> Self
8328 where
8329 T: std::iter::IntoIterator<Item = V>,
8330 V: std::convert::Into<crate::model::GcsDocument>,
8331 {
8332 use std::iter::Iterator;
8333 self.documents = v.into_iter().map(|i| i.into()).collect();
8334 self
8335 }
8336}
8337
8338impl wkt::message::Message for GcsDocuments {
8339 fn typename() -> &'static str {
8340 "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
8341 }
8342}
8343
8344/// Specifies all documents on Cloud Storage with a common prefix.
8345#[derive(Clone, Default, PartialEq)]
8346#[non_exhaustive]
8347pub struct GcsPrefix {
8348 /// The URI prefix.
8349 pub gcs_uri_prefix: std::string::String,
8350
8351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8352}
8353
8354impl GcsPrefix {
8355 pub fn new() -> Self {
8356 std::default::Default::default()
8357 }
8358
8359 /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
8360 ///
8361 /// # Example
8362 /// ```ignore,no_run
8363 /// # use google_cloud_documentai_v1::model::GcsPrefix;
8364 /// let x = GcsPrefix::new().set_gcs_uri_prefix("example");
8365 /// ```
8366 pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8367 self.gcs_uri_prefix = v.into();
8368 self
8369 }
8370}
8371
8372impl wkt::message::Message for GcsPrefix {
8373 fn typename() -> &'static str {
8374 "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
8375 }
8376}
8377
8378/// The common config to specify a set of documents used as input.
8379#[derive(Clone, Default, PartialEq)]
8380#[non_exhaustive]
8381pub struct BatchDocumentsInputConfig {
8382 /// The source. Make sure that the caller of the API has storage.objects.get
8383 /// access to the buckets.
8384 pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
8385
8386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8387}
8388
8389impl BatchDocumentsInputConfig {
8390 pub fn new() -> Self {
8391 std::default::Default::default()
8392 }
8393
8394 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
8395 ///
8396 /// Note that all the setters affecting `source` are mutually
8397 /// exclusive.
8398 ///
8399 /// # Example
8400 /// ```ignore,no_run
8401 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
8402 /// use google_cloud_documentai_v1::model::GcsPrefix;
8403 /// let x = BatchDocumentsInputConfig::new().set_source(Some(
8404 /// google_cloud_documentai_v1::model::batch_documents_input_config::Source::GcsPrefix(GcsPrefix::default().into())));
8405 /// ```
8406 pub fn set_source<
8407 T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
8408 >(
8409 mut self,
8410 v: T,
8411 ) -> Self {
8412 self.source = v.into();
8413 self
8414 }
8415
8416 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
8417 /// if it holds a `GcsPrefix`, `None` if the field is not set or
8418 /// holds a different branch.
8419 pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
8420 #[allow(unreachable_patterns)]
8421 self.source.as_ref().and_then(|v| match v {
8422 crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
8423 std::option::Option::Some(v)
8424 }
8425 _ => std::option::Option::None,
8426 })
8427 }
8428
8429 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
8430 /// to hold a `GcsPrefix`.
8431 ///
8432 /// Note that all the setters affecting `source` are
8433 /// mutually exclusive.
8434 ///
8435 /// # Example
8436 /// ```ignore,no_run
8437 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
8438 /// use google_cloud_documentai_v1::model::GcsPrefix;
8439 /// let x = BatchDocumentsInputConfig::new().set_gcs_prefix(GcsPrefix::default()/* use setters */);
8440 /// assert!(x.gcs_prefix().is_some());
8441 /// assert!(x.gcs_documents().is_none());
8442 /// ```
8443 pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
8444 mut self,
8445 v: T,
8446 ) -> Self {
8447 self.source = std::option::Option::Some(
8448 crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
8449 );
8450 self
8451 }
8452
8453 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
8454 /// if it holds a `GcsDocuments`, `None` if the field is not set or
8455 /// holds a different branch.
8456 pub fn gcs_documents(
8457 &self,
8458 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
8459 #[allow(unreachable_patterns)]
8460 self.source.as_ref().and_then(|v| match v {
8461 crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
8462 std::option::Option::Some(v)
8463 }
8464 _ => std::option::Option::None,
8465 })
8466 }
8467
8468 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
8469 /// to hold a `GcsDocuments`.
8470 ///
8471 /// Note that all the setters affecting `source` are
8472 /// mutually exclusive.
8473 ///
8474 /// # Example
8475 /// ```ignore,no_run
8476 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
8477 /// use google_cloud_documentai_v1::model::GcsDocuments;
8478 /// let x = BatchDocumentsInputConfig::new().set_gcs_documents(GcsDocuments::default()/* use setters */);
8479 /// assert!(x.gcs_documents().is_some());
8480 /// assert!(x.gcs_prefix().is_none());
8481 /// ```
8482 pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
8483 mut self,
8484 v: T,
8485 ) -> Self {
8486 self.source = std::option::Option::Some(
8487 crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
8488 );
8489 self
8490 }
8491}
8492
8493impl wkt::message::Message for BatchDocumentsInputConfig {
8494 fn typename() -> &'static str {
8495 "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
8496 }
8497}
8498
8499/// Defines additional types related to [BatchDocumentsInputConfig].
8500pub mod batch_documents_input_config {
8501 #[allow(unused_imports)]
8502 use super::*;
8503
8504 /// The source. Make sure that the caller of the API has storage.objects.get
8505 /// access to the buckets.
8506 #[derive(Clone, Debug, PartialEq)]
8507 #[non_exhaustive]
8508 pub enum Source {
8509 /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
8510 GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
8511 /// The set of documents individually specified on Cloud Storage.
8512 GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
8513 }
8514}
8515
8516/// Config that controls the output of documents. All documents will be written
8517/// as a JSON file.
8518#[derive(Clone, Default, PartialEq)]
8519#[non_exhaustive]
8520pub struct DocumentOutputConfig {
8521 /// The destination of the results.
8522 pub destination: std::option::Option<crate::model::document_output_config::Destination>,
8523
8524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8525}
8526
8527impl DocumentOutputConfig {
8528 pub fn new() -> Self {
8529 std::default::Default::default()
8530 }
8531
8532 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
8533 ///
8534 /// Note that all the setters affecting `destination` are mutually
8535 /// exclusive.
8536 ///
8537 /// # Example
8538 /// ```ignore,no_run
8539 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
8540 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8541 /// let x = DocumentOutputConfig::new().set_destination(Some(
8542 /// google_cloud_documentai_v1::model::document_output_config::Destination::GcsOutputConfig(GcsOutputConfig::default().into())));
8543 /// ```
8544 pub fn set_destination<
8545 T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
8546 >(
8547 mut self,
8548 v: T,
8549 ) -> Self {
8550 self.destination = v.into();
8551 self
8552 }
8553
8554 /// The value of [destination][crate::model::DocumentOutputConfig::destination]
8555 /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
8556 /// holds a different branch.
8557 pub fn gcs_output_config(
8558 &self,
8559 ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
8560 {
8561 #[allow(unreachable_patterns)]
8562 self.destination.as_ref().and_then(|v| match v {
8563 crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
8564 std::option::Option::Some(v)
8565 }
8566 _ => std::option::Option::None,
8567 })
8568 }
8569
8570 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
8571 /// to hold a `GcsOutputConfig`.
8572 ///
8573 /// Note that all the setters affecting `destination` are
8574 /// mutually exclusive.
8575 ///
8576 /// # Example
8577 /// ```ignore,no_run
8578 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
8579 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8580 /// let x = DocumentOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
8581 /// assert!(x.gcs_output_config().is_some());
8582 /// ```
8583 pub fn set_gcs_output_config<
8584 T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
8585 >(
8586 mut self,
8587 v: T,
8588 ) -> Self {
8589 self.destination = std::option::Option::Some(
8590 crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
8591 );
8592 self
8593 }
8594}
8595
8596impl wkt::message::Message for DocumentOutputConfig {
8597 fn typename() -> &'static str {
8598 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
8599 }
8600}
8601
8602/// Defines additional types related to [DocumentOutputConfig].
8603pub mod document_output_config {
8604 #[allow(unused_imports)]
8605 use super::*;
8606
8607 /// The configuration used when outputting documents.
8608 #[derive(Clone, Default, PartialEq)]
8609 #[non_exhaustive]
8610 pub struct GcsOutputConfig {
8611 /// The Cloud Storage uri (a directory) of the output.
8612 pub gcs_uri: std::string::String,
8613
8614 /// Specifies which fields to include in the output documents.
8615 /// Only supports top level document and pages field so it must be in the
8616 /// form of `{document_field_name}` or `pages.{page_field_name}`.
8617 pub field_mask: std::option::Option<wkt::FieldMask>,
8618
8619 /// Specifies the sharding config for the output document.
8620 pub sharding_config: std::option::Option<
8621 crate::model::document_output_config::gcs_output_config::ShardingConfig,
8622 >,
8623
8624 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8625 }
8626
8627 impl GcsOutputConfig {
8628 pub fn new() -> Self {
8629 std::default::Default::default()
8630 }
8631
8632 /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
8633 ///
8634 /// # Example
8635 /// ```ignore,no_run
8636 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8637 /// let x = GcsOutputConfig::new().set_gcs_uri("example");
8638 /// ```
8639 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8640 self.gcs_uri = v.into();
8641 self
8642 }
8643
8644 /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
8645 ///
8646 /// # Example
8647 /// ```ignore,no_run
8648 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8649 /// use wkt::FieldMask;
8650 /// let x = GcsOutputConfig::new().set_field_mask(FieldMask::default()/* use setters */);
8651 /// ```
8652 pub fn set_field_mask<T>(mut self, v: T) -> Self
8653 where
8654 T: std::convert::Into<wkt::FieldMask>,
8655 {
8656 self.field_mask = std::option::Option::Some(v.into());
8657 self
8658 }
8659
8660 /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
8661 ///
8662 /// # Example
8663 /// ```ignore,no_run
8664 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8665 /// use wkt::FieldMask;
8666 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
8667 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(None::<FieldMask>);
8668 /// ```
8669 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
8670 where
8671 T: std::convert::Into<wkt::FieldMask>,
8672 {
8673 self.field_mask = v.map(|x| x.into());
8674 self
8675 }
8676
8677 /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
8678 ///
8679 /// # Example
8680 /// ```ignore,no_run
8681 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8682 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8683 /// let x = GcsOutputConfig::new().set_sharding_config(ShardingConfig::default()/* use setters */);
8684 /// ```
8685 pub fn set_sharding_config<T>(mut self, v: T) -> Self
8686 where
8687 T: std::convert::Into<
8688 crate::model::document_output_config::gcs_output_config::ShardingConfig,
8689 >,
8690 {
8691 self.sharding_config = std::option::Option::Some(v.into());
8692 self
8693 }
8694
8695 /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
8696 ///
8697 /// # Example
8698 /// ```ignore,no_run
8699 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
8700 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8701 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(Some(ShardingConfig::default()/* use setters */));
8702 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(None::<ShardingConfig>);
8703 /// ```
8704 pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
8705 where
8706 T: std::convert::Into<
8707 crate::model::document_output_config::gcs_output_config::ShardingConfig,
8708 >,
8709 {
8710 self.sharding_config = v.map(|x| x.into());
8711 self
8712 }
8713 }
8714
8715 impl wkt::message::Message for GcsOutputConfig {
8716 fn typename() -> &'static str {
8717 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
8718 }
8719 }
8720
8721 /// Defines additional types related to [GcsOutputConfig].
8722 pub mod gcs_output_config {
8723 #[allow(unused_imports)]
8724 use super::*;
8725
8726 /// The sharding config for the output document.
8727 #[derive(Clone, Default, PartialEq)]
8728 #[non_exhaustive]
8729 pub struct ShardingConfig {
8730 /// The number of pages per shard.
8731 pub pages_per_shard: i32,
8732
8733 /// The number of overlapping pages between consecutive shards.
8734 pub pages_overlap: i32,
8735
8736 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8737 }
8738
8739 impl ShardingConfig {
8740 pub fn new() -> Self {
8741 std::default::Default::default()
8742 }
8743
8744 /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
8745 ///
8746 /// # Example
8747 /// ```ignore,no_run
8748 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8749 /// let x = ShardingConfig::new().set_pages_per_shard(42);
8750 /// ```
8751 pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8752 self.pages_per_shard = v.into();
8753 self
8754 }
8755
8756 /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
8757 ///
8758 /// # Example
8759 /// ```ignore,no_run
8760 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
8761 /// let x = ShardingConfig::new().set_pages_overlap(42);
8762 /// ```
8763 pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8764 self.pages_overlap = v.into();
8765 self
8766 }
8767 }
8768
8769 impl wkt::message::Message for ShardingConfig {
8770 fn typename() -> &'static str {
8771 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
8772 }
8773 }
8774 }
8775
8776 /// The destination of the results.
8777 #[derive(Clone, Debug, PartialEq)]
8778 #[non_exhaustive]
8779 pub enum Destination {
8780 /// Output config to write the results to Cloud Storage.
8781 GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
8782 }
8783}
8784
8785/// Config for Document OCR.
8786#[derive(Clone, Default, PartialEq)]
8787#[non_exhaustive]
8788pub struct OcrConfig {
8789 /// Hints for the OCR model.
8790 pub hints: std::option::Option<crate::model::ocr_config::Hints>,
8791
8792 /// Enables special handling for PDFs with existing text information. Results
8793 /// in better text extraction quality in such PDF inputs.
8794 pub enable_native_pdf_parsing: bool,
8795
8796 /// Enables intelligent document quality scores after OCR. Can help with
8797 /// diagnosing why OCR responses are of poor quality for a given input.
8798 /// Adds additional latency comparable to regular OCR to the process call.
8799 pub enable_image_quality_scores: bool,
8800
8801 /// A list of advanced OCR options to further fine-tune OCR behavior. Current
8802 /// valid values are:
8803 ///
8804 /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
8805 /// an alternative to the current ML-based layout detection algorithm.
8806 /// Customers can choose the best suitable layout algorithm based on their
8807 /// situation.
8808 pub advanced_ocr_options: std::vec::Vec<std::string::String>,
8809
8810 /// Includes symbol level OCR information if set to true.
8811 pub enable_symbol: bool,
8812
8813 /// Turn on font identification model and return font style information.
8814 /// Deprecated, use
8815 /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
8816 /// instead.
8817 ///
8818 /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
8819 #[deprecated]
8820 pub compute_style_info: bool,
8821
8822 /// Turn off character box detector in OCR engine. Character box detection is
8823 /// enabled by default in OCR 2.0 (and later) processors.
8824 pub disable_character_boxes_detection: bool,
8825
8826 /// Configurations for premium OCR features.
8827 pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
8828
8829 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8830}
8831
8832impl OcrConfig {
8833 pub fn new() -> Self {
8834 std::default::Default::default()
8835 }
8836
8837 /// Sets the value of [hints][crate::model::OcrConfig::hints].
8838 ///
8839 /// # Example
8840 /// ```ignore,no_run
8841 /// # use google_cloud_documentai_v1::model::OcrConfig;
8842 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
8843 /// let x = OcrConfig::new().set_hints(Hints::default()/* use setters */);
8844 /// ```
8845 pub fn set_hints<T>(mut self, v: T) -> Self
8846 where
8847 T: std::convert::Into<crate::model::ocr_config::Hints>,
8848 {
8849 self.hints = std::option::Option::Some(v.into());
8850 self
8851 }
8852
8853 /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
8854 ///
8855 /// # Example
8856 /// ```ignore,no_run
8857 /// # use google_cloud_documentai_v1::model::OcrConfig;
8858 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
8859 /// let x = OcrConfig::new().set_or_clear_hints(Some(Hints::default()/* use setters */));
8860 /// let x = OcrConfig::new().set_or_clear_hints(None::<Hints>);
8861 /// ```
8862 pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
8863 where
8864 T: std::convert::Into<crate::model::ocr_config::Hints>,
8865 {
8866 self.hints = v.map(|x| x.into());
8867 self
8868 }
8869
8870 /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
8871 ///
8872 /// # Example
8873 /// ```ignore,no_run
8874 /// # use google_cloud_documentai_v1::model::OcrConfig;
8875 /// let x = OcrConfig::new().set_enable_native_pdf_parsing(true);
8876 /// ```
8877 pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8878 self.enable_native_pdf_parsing = v.into();
8879 self
8880 }
8881
8882 /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
8883 ///
8884 /// # Example
8885 /// ```ignore,no_run
8886 /// # use google_cloud_documentai_v1::model::OcrConfig;
8887 /// let x = OcrConfig::new().set_enable_image_quality_scores(true);
8888 /// ```
8889 pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8890 self.enable_image_quality_scores = v.into();
8891 self
8892 }
8893
8894 /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
8895 ///
8896 /// # Example
8897 /// ```ignore,no_run
8898 /// # use google_cloud_documentai_v1::model::OcrConfig;
8899 /// let x = OcrConfig::new().set_advanced_ocr_options(["a", "b", "c"]);
8900 /// ```
8901 pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
8902 where
8903 T: std::iter::IntoIterator<Item = V>,
8904 V: std::convert::Into<std::string::String>,
8905 {
8906 use std::iter::Iterator;
8907 self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
8908 self
8909 }
8910
8911 /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
8912 ///
8913 /// # Example
8914 /// ```ignore,no_run
8915 /// # use google_cloud_documentai_v1::model::OcrConfig;
8916 /// let x = OcrConfig::new().set_enable_symbol(true);
8917 /// ```
8918 pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8919 self.enable_symbol = v.into();
8920 self
8921 }
8922
8923 /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
8924 ///
8925 /// # Example
8926 /// ```ignore,no_run
8927 /// # use google_cloud_documentai_v1::model::OcrConfig;
8928 /// let x = OcrConfig::new().set_compute_style_info(true);
8929 /// ```
8930 #[deprecated]
8931 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8932 self.compute_style_info = v.into();
8933 self
8934 }
8935
8936 /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
8937 ///
8938 /// # Example
8939 /// ```ignore,no_run
8940 /// # use google_cloud_documentai_v1::model::OcrConfig;
8941 /// let x = OcrConfig::new().set_disable_character_boxes_detection(true);
8942 /// ```
8943 pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
8944 mut self,
8945 v: T,
8946 ) -> Self {
8947 self.disable_character_boxes_detection = v.into();
8948 self
8949 }
8950
8951 /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
8952 ///
8953 /// # Example
8954 /// ```ignore,no_run
8955 /// # use google_cloud_documentai_v1::model::OcrConfig;
8956 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
8957 /// let x = OcrConfig::new().set_premium_features(PremiumFeatures::default()/* use setters */);
8958 /// ```
8959 pub fn set_premium_features<T>(mut self, v: T) -> Self
8960 where
8961 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
8962 {
8963 self.premium_features = std::option::Option::Some(v.into());
8964 self
8965 }
8966
8967 /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
8968 ///
8969 /// # Example
8970 /// ```ignore,no_run
8971 /// # use google_cloud_documentai_v1::model::OcrConfig;
8972 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
8973 /// let x = OcrConfig::new().set_or_clear_premium_features(Some(PremiumFeatures::default()/* use setters */));
8974 /// let x = OcrConfig::new().set_or_clear_premium_features(None::<PremiumFeatures>);
8975 /// ```
8976 pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
8977 where
8978 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
8979 {
8980 self.premium_features = v.map(|x| x.into());
8981 self
8982 }
8983}
8984
8985impl wkt::message::Message for OcrConfig {
8986 fn typename() -> &'static str {
8987 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
8988 }
8989}
8990
8991/// Defines additional types related to [OcrConfig].
8992pub mod ocr_config {
8993 #[allow(unused_imports)]
8994 use super::*;
8995
8996 /// Hints for OCR Engine
8997 #[derive(Clone, Default, PartialEq)]
8998 #[non_exhaustive]
8999 pub struct Hints {
9000 /// List of BCP-47 language codes to use for OCR. In most cases, not
9001 /// specifying it yields the best results since it enables automatic language
9002 /// detection. For languages based on the Latin alphabet, setting hints is
9003 /// not needed. In rare cases, when the language of the text in the
9004 /// image is known, setting a hint will help get better results (although it
9005 /// will be a significant hindrance if the hint is wrong).
9006 pub language_hints: std::vec::Vec<std::string::String>,
9007
9008 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9009 }
9010
9011 impl Hints {
9012 pub fn new() -> Self {
9013 std::default::Default::default()
9014 }
9015
9016 /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
9017 ///
9018 /// # Example
9019 /// ```ignore,no_run
9020 /// # use google_cloud_documentai_v1::model::ocr_config::Hints;
9021 /// let x = Hints::new().set_language_hints(["a", "b", "c"]);
9022 /// ```
9023 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
9024 where
9025 T: std::iter::IntoIterator<Item = V>,
9026 V: std::convert::Into<std::string::String>,
9027 {
9028 use std::iter::Iterator;
9029 self.language_hints = v.into_iter().map(|i| i.into()).collect();
9030 self
9031 }
9032 }
9033
9034 impl wkt::message::Message for Hints {
9035 fn typename() -> &'static str {
9036 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
9037 }
9038 }
9039
9040 /// Configurations for premium OCR features.
9041 #[derive(Clone, Default, PartialEq)]
9042 #[non_exhaustive]
9043 pub struct PremiumFeatures {
9044 /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
9045 /// (and later) processors.
9046 pub enable_selection_mark_detection: bool,
9047
9048 /// Turn on font identification model and return font style information.
9049 pub compute_style_info: bool,
9050
9051 /// Turn on the model that can extract LaTeX math formulas.
9052 pub enable_math_ocr: bool,
9053
9054 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9055 }
9056
9057 impl PremiumFeatures {
9058 pub fn new() -> Self {
9059 std::default::Default::default()
9060 }
9061
9062 /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
9063 ///
9064 /// # Example
9065 /// ```ignore,no_run
9066 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9067 /// let x = PremiumFeatures::new().set_enable_selection_mark_detection(true);
9068 /// ```
9069 pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
9070 mut self,
9071 v: T,
9072 ) -> Self {
9073 self.enable_selection_mark_detection = v.into();
9074 self
9075 }
9076
9077 /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
9078 ///
9079 /// # Example
9080 /// ```ignore,no_run
9081 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9082 /// let x = PremiumFeatures::new().set_compute_style_info(true);
9083 /// ```
9084 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9085 self.compute_style_info = v.into();
9086 self
9087 }
9088
9089 /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
9090 ///
9091 /// # Example
9092 /// ```ignore,no_run
9093 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9094 /// let x = PremiumFeatures::new().set_enable_math_ocr(true);
9095 /// ```
9096 pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9097 self.enable_math_ocr = v.into();
9098 self
9099 }
9100 }
9101
9102 impl wkt::message::Message for PremiumFeatures {
9103 fn typename() -> &'static str {
9104 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
9105 }
9106 }
9107}
9108
9109/// Options for Process API
9110#[derive(Clone, Default, PartialEq)]
9111#[non_exhaustive]
9112pub struct ProcessOptions {
9113 /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
9114 /// Returns error if set on other processor types.
9115 pub ocr_config: std::option::Option<crate::model::OcrConfig>,
9116
9117 /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
9118 /// Returns error if set on other processor types.
9119 pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
9120
9121 /// Optional. Override the schema of the
9122 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
9123 /// return an Invalid Argument error if this field is set when the underlying
9124 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
9125 /// support schema override.
9126 ///
9127 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
9128 pub schema_override: std::option::Option<crate::model::DocumentSchema>,
9129
9130 /// A subset of pages to process. If not specified, all pages are processed.
9131 /// If a page range is set, only the given pages are extracted and processed
9132 /// from the document. In the output document,
9133 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
9134 /// refers to the page number in the original document.
9135 /// This configuration only applies to online processing with
9136 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
9137 ///
9138 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
9139 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
9140 pub page_range: std::option::Option<crate::model::process_options::PageRange>,
9141
9142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9143}
9144
9145impl ProcessOptions {
9146 pub fn new() -> Self {
9147 std::default::Default::default()
9148 }
9149
9150 /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
9151 ///
9152 /// # Example
9153 /// ```ignore,no_run
9154 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9155 /// use google_cloud_documentai_v1::model::OcrConfig;
9156 /// let x = ProcessOptions::new().set_ocr_config(OcrConfig::default()/* use setters */);
9157 /// ```
9158 pub fn set_ocr_config<T>(mut self, v: T) -> Self
9159 where
9160 T: std::convert::Into<crate::model::OcrConfig>,
9161 {
9162 self.ocr_config = std::option::Option::Some(v.into());
9163 self
9164 }
9165
9166 /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
9167 ///
9168 /// # Example
9169 /// ```ignore,no_run
9170 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9171 /// use google_cloud_documentai_v1::model::OcrConfig;
9172 /// let x = ProcessOptions::new().set_or_clear_ocr_config(Some(OcrConfig::default()/* use setters */));
9173 /// let x = ProcessOptions::new().set_or_clear_ocr_config(None::<OcrConfig>);
9174 /// ```
9175 pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
9176 where
9177 T: std::convert::Into<crate::model::OcrConfig>,
9178 {
9179 self.ocr_config = v.map(|x| x.into());
9180 self
9181 }
9182
9183 /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
9184 ///
9185 /// # Example
9186 /// ```ignore,no_run
9187 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9188 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9189 /// let x = ProcessOptions::new().set_layout_config(LayoutConfig::default()/* use setters */);
9190 /// ```
9191 pub fn set_layout_config<T>(mut self, v: T) -> Self
9192 where
9193 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
9194 {
9195 self.layout_config = std::option::Option::Some(v.into());
9196 self
9197 }
9198
9199 /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
9200 ///
9201 /// # Example
9202 /// ```ignore,no_run
9203 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9204 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9205 /// let x = ProcessOptions::new().set_or_clear_layout_config(Some(LayoutConfig::default()/* use setters */));
9206 /// let x = ProcessOptions::new().set_or_clear_layout_config(None::<LayoutConfig>);
9207 /// ```
9208 pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
9209 where
9210 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
9211 {
9212 self.layout_config = v.map(|x| x.into());
9213 self
9214 }
9215
9216 /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
9217 ///
9218 /// # Example
9219 /// ```ignore,no_run
9220 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9221 /// use google_cloud_documentai_v1::model::DocumentSchema;
9222 /// let x = ProcessOptions::new().set_schema_override(DocumentSchema::default()/* use setters */);
9223 /// ```
9224 pub fn set_schema_override<T>(mut self, v: T) -> Self
9225 where
9226 T: std::convert::Into<crate::model::DocumentSchema>,
9227 {
9228 self.schema_override = std::option::Option::Some(v.into());
9229 self
9230 }
9231
9232 /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
9233 ///
9234 /// # Example
9235 /// ```ignore,no_run
9236 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9237 /// use google_cloud_documentai_v1::model::DocumentSchema;
9238 /// let x = ProcessOptions::new().set_or_clear_schema_override(Some(DocumentSchema::default()/* use setters */));
9239 /// let x = ProcessOptions::new().set_or_clear_schema_override(None::<DocumentSchema>);
9240 /// ```
9241 pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
9242 where
9243 T: std::convert::Into<crate::model::DocumentSchema>,
9244 {
9245 self.schema_override = v.map(|x| x.into());
9246 self
9247 }
9248
9249 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
9250 ///
9251 /// Note that all the setters affecting `page_range` are mutually
9252 /// exclusive.
9253 ///
9254 /// # Example
9255 /// ```ignore,no_run
9256 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9257 /// use google_cloud_documentai_v1::model::process_options::PageRange;
9258 /// let x = ProcessOptions::new().set_page_range(Some(PageRange::FromStart(42)));
9259 /// ```
9260 pub fn set_page_range<
9261 T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
9262 >(
9263 mut self,
9264 v: T,
9265 ) -> Self {
9266 self.page_range = v.into();
9267 self
9268 }
9269
9270 /// The value of [page_range][crate::model::ProcessOptions::page_range]
9271 /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
9272 /// holds a different branch.
9273 pub fn individual_page_selector(
9274 &self,
9275 ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
9276 {
9277 #[allow(unreachable_patterns)]
9278 self.page_range.as_ref().and_then(|v| match v {
9279 crate::model::process_options::PageRange::IndividualPageSelector(v) => {
9280 std::option::Option::Some(v)
9281 }
9282 _ => std::option::Option::None,
9283 })
9284 }
9285
9286 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
9287 /// to hold a `IndividualPageSelector`.
9288 ///
9289 /// Note that all the setters affecting `page_range` are
9290 /// mutually exclusive.
9291 ///
9292 /// # Example
9293 /// ```ignore,no_run
9294 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9295 /// use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
9296 /// let x = ProcessOptions::new().set_individual_page_selector(IndividualPageSelector::default()/* use setters */);
9297 /// assert!(x.individual_page_selector().is_some());
9298 /// assert!(x.from_start().is_none());
9299 /// assert!(x.from_end().is_none());
9300 /// ```
9301 pub fn set_individual_page_selector<
9302 T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
9303 >(
9304 mut self,
9305 v: T,
9306 ) -> Self {
9307 self.page_range = std::option::Option::Some(
9308 crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
9309 );
9310 self
9311 }
9312
9313 /// The value of [page_range][crate::model::ProcessOptions::page_range]
9314 /// if it holds a `FromStart`, `None` if the field is not set or
9315 /// holds a different branch.
9316 pub fn from_start(&self) -> std::option::Option<&i32> {
9317 #[allow(unreachable_patterns)]
9318 self.page_range.as_ref().and_then(|v| match v {
9319 crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
9320 _ => std::option::Option::None,
9321 })
9322 }
9323
9324 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
9325 /// to hold a `FromStart`.
9326 ///
9327 /// Note that all the setters affecting `page_range` are
9328 /// mutually exclusive.
9329 ///
9330 /// # Example
9331 /// ```ignore,no_run
9332 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9333 /// let x = ProcessOptions::new().set_from_start(42);
9334 /// assert!(x.from_start().is_some());
9335 /// assert!(x.individual_page_selector().is_none());
9336 /// assert!(x.from_end().is_none());
9337 /// ```
9338 pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9339 self.page_range = std::option::Option::Some(
9340 crate::model::process_options::PageRange::FromStart(v.into()),
9341 );
9342 self
9343 }
9344
9345 /// The value of [page_range][crate::model::ProcessOptions::page_range]
9346 /// if it holds a `FromEnd`, `None` if the field is not set or
9347 /// holds a different branch.
9348 pub fn from_end(&self) -> std::option::Option<&i32> {
9349 #[allow(unreachable_patterns)]
9350 self.page_range.as_ref().and_then(|v| match v {
9351 crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
9352 _ => std::option::Option::None,
9353 })
9354 }
9355
9356 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
9357 /// to hold a `FromEnd`.
9358 ///
9359 /// Note that all the setters affecting `page_range` are
9360 /// mutually exclusive.
9361 ///
9362 /// # Example
9363 /// ```ignore,no_run
9364 /// # use google_cloud_documentai_v1::model::ProcessOptions;
9365 /// let x = ProcessOptions::new().set_from_end(42);
9366 /// assert!(x.from_end().is_some());
9367 /// assert!(x.individual_page_selector().is_none());
9368 /// assert!(x.from_start().is_none());
9369 /// ```
9370 pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9371 self.page_range =
9372 std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
9373 self
9374 }
9375}
9376
9377impl wkt::message::Message for ProcessOptions {
9378 fn typename() -> &'static str {
9379 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
9380 }
9381}
9382
9383/// Defines additional types related to [ProcessOptions].
9384pub mod process_options {
9385 #[allow(unused_imports)]
9386 use super::*;
9387
9388 /// Serving config for layout parser processor.
9389 #[derive(Clone, Default, PartialEq)]
9390 #[non_exhaustive]
9391 pub struct LayoutConfig {
9392 /// Optional. Config for chunking in layout parser processor.
9393 pub chunking_config:
9394 std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
9395
9396 /// Optional. Whether to include images in layout parser processor response.
9397 pub return_images: bool,
9398
9399 /// Optional. Whether to include bounding boxes in layout parser processor
9400 /// response.
9401 pub return_bounding_boxes: bool,
9402
9403 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9404 }
9405
9406 impl LayoutConfig {
9407 pub fn new() -> Self {
9408 std::default::Default::default()
9409 }
9410
9411 /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
9412 ///
9413 /// # Example
9414 /// ```ignore,no_run
9415 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9416 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9417 /// let x = LayoutConfig::new().set_chunking_config(ChunkingConfig::default()/* use setters */);
9418 /// ```
9419 pub fn set_chunking_config<T>(mut self, v: T) -> Self
9420 where
9421 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
9422 {
9423 self.chunking_config = std::option::Option::Some(v.into());
9424 self
9425 }
9426
9427 /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
9428 ///
9429 /// # Example
9430 /// ```ignore,no_run
9431 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9432 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9433 /// let x = LayoutConfig::new().set_or_clear_chunking_config(Some(ChunkingConfig::default()/* use setters */));
9434 /// let x = LayoutConfig::new().set_or_clear_chunking_config(None::<ChunkingConfig>);
9435 /// ```
9436 pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
9437 where
9438 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
9439 {
9440 self.chunking_config = v.map(|x| x.into());
9441 self
9442 }
9443
9444 /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
9445 ///
9446 /// # Example
9447 /// ```ignore,no_run
9448 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9449 /// let x = LayoutConfig::new().set_return_images(true);
9450 /// ```
9451 pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9452 self.return_images = v.into();
9453 self
9454 }
9455
9456 /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
9457 ///
9458 /// # Example
9459 /// ```ignore,no_run
9460 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
9461 /// let x = LayoutConfig::new().set_return_bounding_boxes(true);
9462 /// ```
9463 pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9464 self.return_bounding_boxes = v.into();
9465 self
9466 }
9467 }
9468
9469 impl wkt::message::Message for LayoutConfig {
9470 fn typename() -> &'static str {
9471 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
9472 }
9473 }
9474
9475 /// Defines additional types related to [LayoutConfig].
9476 pub mod layout_config {
9477 #[allow(unused_imports)]
9478 use super::*;
9479
9480 /// Serving config for chunking.
9481 #[derive(Clone, Default, PartialEq)]
9482 #[non_exhaustive]
9483 pub struct ChunkingConfig {
9484 /// Optional. The chunk sizes to use when splitting documents, in order of
9485 /// level.
9486 pub chunk_size: i32,
9487
9488 /// Optional. Whether or not to include ancestor headings when splitting.
9489 pub include_ancestor_headings: bool,
9490
9491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9492 }
9493
9494 impl ChunkingConfig {
9495 pub fn new() -> Self {
9496 std::default::Default::default()
9497 }
9498
9499 /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
9500 ///
9501 /// # Example
9502 /// ```ignore,no_run
9503 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9504 /// let x = ChunkingConfig::new().set_chunk_size(42);
9505 /// ```
9506 pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9507 self.chunk_size = v.into();
9508 self
9509 }
9510
9511 /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
9512 ///
9513 /// # Example
9514 /// ```ignore,no_run
9515 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
9516 /// let x = ChunkingConfig::new().set_include_ancestor_headings(true);
9517 /// ```
9518 pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
9519 mut self,
9520 v: T,
9521 ) -> Self {
9522 self.include_ancestor_headings = v.into();
9523 self
9524 }
9525 }
9526
9527 impl wkt::message::Message for ChunkingConfig {
9528 fn typename() -> &'static str {
9529 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
9530 }
9531 }
9532 }
9533
9534 /// A list of individual page numbers.
9535 #[derive(Clone, Default, PartialEq)]
9536 #[non_exhaustive]
9537 pub struct IndividualPageSelector {
9538 /// Optional. Indices of the pages (starting from 1).
9539 pub pages: std::vec::Vec<i32>,
9540
9541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9542 }
9543
9544 impl IndividualPageSelector {
9545 pub fn new() -> Self {
9546 std::default::Default::default()
9547 }
9548
9549 /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
9550 ///
9551 /// # Example
9552 /// ```ignore,no_run
9553 /// # use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
9554 /// let x = IndividualPageSelector::new().set_pages([1, 2, 3]);
9555 /// ```
9556 pub fn set_pages<T, V>(mut self, v: T) -> Self
9557 where
9558 T: std::iter::IntoIterator<Item = V>,
9559 V: std::convert::Into<i32>,
9560 {
9561 use std::iter::Iterator;
9562 self.pages = v.into_iter().map(|i| i.into()).collect();
9563 self
9564 }
9565 }
9566
9567 impl wkt::message::Message for IndividualPageSelector {
9568 fn typename() -> &'static str {
9569 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
9570 }
9571 }
9572
9573 /// A subset of pages to process. If not specified, all pages are processed.
9574 /// If a page range is set, only the given pages are extracted and processed
9575 /// from the document. In the output document,
9576 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
9577 /// refers to the page number in the original document.
9578 /// This configuration only applies to online processing with
9579 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
9580 ///
9581 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
9582 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
9583 #[derive(Clone, Debug, PartialEq)]
9584 #[non_exhaustive]
9585 pub enum PageRange {
9586 /// Which pages to process (1-indexed).
9587 IndividualPageSelector(
9588 std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
9589 ),
9590 /// Only process certain pages from the start. Process all if the document
9591 /// has fewer pages.
9592 FromStart(i32),
9593 /// Only process certain pages from the end, same as above.
9594 FromEnd(i32),
9595 }
9596}
9597
9598/// Request message for the
9599/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
9600/// method.
9601///
9602/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
9603#[derive(Clone, Default, PartialEq)]
9604#[non_exhaustive]
9605pub struct ProcessRequest {
9606 /// Required. The resource name of the
9607 /// [Processor][google.cloud.documentai.v1.Processor] or
9608 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
9609 /// to use for processing. If a
9610 /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
9611 /// will use its [default
9612 /// version][google.cloud.documentai.v1.Processor.default_processor_version].
9613 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
9614 /// or
9615 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
9616 ///
9617 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
9618 /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
9619 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
9620 pub name: std::string::String,
9621
9622 /// Whether human review should be skipped for this request. Default to
9623 /// `false`.
9624 pub skip_human_review: bool,
9625
9626 /// Specifies which fields to include in the
9627 /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
9628 /// output. Only supports top-level document and pages field, so it must be in
9629 /// the form of `{document_field_name}` or `pages.{page_field_name}`.
9630 ///
9631 /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
9632 pub field_mask: std::option::Option<wkt::FieldMask>,
9633
9634 /// Inference-time options for the process API
9635 pub process_options: std::option::Option<crate::model::ProcessOptions>,
9636
9637 /// Optional. The labels with user-defined metadata for the request.
9638 ///
9639 /// Label keys and values can be no longer than 63 characters
9640 /// (Unicode codepoints) and can only contain lowercase letters, numeric
9641 /// characters, underscores, and dashes. International characters are allowed.
9642 /// Label values are optional. Label keys must start with a letter.
9643 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
9644
9645 /// Optional. Option to remove images from the document.
9646 pub imageless_mode: bool,
9647
9648 /// The document payload.
9649 pub source: std::option::Option<crate::model::process_request::Source>,
9650
9651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9652}
9653
9654impl ProcessRequest {
9655 pub fn new() -> Self {
9656 std::default::Default::default()
9657 }
9658
9659 /// Sets the value of [name][crate::model::ProcessRequest::name].
9660 ///
9661 /// # Example
9662 /// ```ignore,no_run
9663 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9664 /// let x = ProcessRequest::new().set_name("example");
9665 /// ```
9666 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9667 self.name = v.into();
9668 self
9669 }
9670
9671 /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
9672 ///
9673 /// # Example
9674 /// ```ignore,no_run
9675 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9676 /// let x = ProcessRequest::new().set_skip_human_review(true);
9677 /// ```
9678 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9679 self.skip_human_review = v.into();
9680 self
9681 }
9682
9683 /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
9684 ///
9685 /// # Example
9686 /// ```ignore,no_run
9687 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9688 /// use wkt::FieldMask;
9689 /// let x = ProcessRequest::new().set_field_mask(FieldMask::default()/* use setters */);
9690 /// ```
9691 pub fn set_field_mask<T>(mut self, v: T) -> Self
9692 where
9693 T: std::convert::Into<wkt::FieldMask>,
9694 {
9695 self.field_mask = std::option::Option::Some(v.into());
9696 self
9697 }
9698
9699 /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
9700 ///
9701 /// # Example
9702 /// ```ignore,no_run
9703 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9704 /// use wkt::FieldMask;
9705 /// let x = ProcessRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
9706 /// let x = ProcessRequest::new().set_or_clear_field_mask(None::<FieldMask>);
9707 /// ```
9708 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
9709 where
9710 T: std::convert::Into<wkt::FieldMask>,
9711 {
9712 self.field_mask = v.map(|x| x.into());
9713 self
9714 }
9715
9716 /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
9717 ///
9718 /// # Example
9719 /// ```ignore,no_run
9720 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9721 /// use google_cloud_documentai_v1::model::ProcessOptions;
9722 /// let x = ProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
9723 /// ```
9724 pub fn set_process_options<T>(mut self, v: T) -> Self
9725 where
9726 T: std::convert::Into<crate::model::ProcessOptions>,
9727 {
9728 self.process_options = std::option::Option::Some(v.into());
9729 self
9730 }
9731
9732 /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
9733 ///
9734 /// # Example
9735 /// ```ignore,no_run
9736 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9737 /// use google_cloud_documentai_v1::model::ProcessOptions;
9738 /// let x = ProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
9739 /// let x = ProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
9740 /// ```
9741 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
9742 where
9743 T: std::convert::Into<crate::model::ProcessOptions>,
9744 {
9745 self.process_options = v.map(|x| x.into());
9746 self
9747 }
9748
9749 /// Sets the value of [labels][crate::model::ProcessRequest::labels].
9750 ///
9751 /// # Example
9752 /// ```ignore,no_run
9753 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9754 /// let x = ProcessRequest::new().set_labels([
9755 /// ("key0", "abc"),
9756 /// ("key1", "xyz"),
9757 /// ]);
9758 /// ```
9759 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
9760 where
9761 T: std::iter::IntoIterator<Item = (K, V)>,
9762 K: std::convert::Into<std::string::String>,
9763 V: std::convert::Into<std::string::String>,
9764 {
9765 use std::iter::Iterator;
9766 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
9767 self
9768 }
9769
9770 /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
9771 ///
9772 /// # Example
9773 /// ```ignore,no_run
9774 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9775 /// let x = ProcessRequest::new().set_imageless_mode(true);
9776 /// ```
9777 pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9778 self.imageless_mode = v.into();
9779 self
9780 }
9781
9782 /// Sets the value of [source][crate::model::ProcessRequest::source].
9783 ///
9784 /// Note that all the setters affecting `source` are mutually
9785 /// exclusive.
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9790 /// use google_cloud_documentai_v1::model::Document;
9791 /// let x = ProcessRequest::new().set_source(Some(
9792 /// google_cloud_documentai_v1::model::process_request::Source::InlineDocument(Document::default().into())));
9793 /// ```
9794 pub fn set_source<
9795 T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
9796 >(
9797 mut self,
9798 v: T,
9799 ) -> Self {
9800 self.source = v.into();
9801 self
9802 }
9803
9804 /// The value of [source][crate::model::ProcessRequest::source]
9805 /// if it holds a `InlineDocument`, `None` if the field is not set or
9806 /// holds a different branch.
9807 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
9808 #[allow(unreachable_patterns)]
9809 self.source.as_ref().and_then(|v| match v {
9810 crate::model::process_request::Source::InlineDocument(v) => {
9811 std::option::Option::Some(v)
9812 }
9813 _ => std::option::Option::None,
9814 })
9815 }
9816
9817 /// Sets the value of [source][crate::model::ProcessRequest::source]
9818 /// to hold a `InlineDocument`.
9819 ///
9820 /// Note that all the setters affecting `source` are
9821 /// mutually exclusive.
9822 ///
9823 /// # Example
9824 /// ```ignore,no_run
9825 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9826 /// use google_cloud_documentai_v1::model::Document;
9827 /// let x = ProcessRequest::new().set_inline_document(Document::default()/* use setters */);
9828 /// assert!(x.inline_document().is_some());
9829 /// assert!(x.raw_document().is_none());
9830 /// assert!(x.gcs_document().is_none());
9831 /// ```
9832 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
9833 mut self,
9834 v: T,
9835 ) -> Self {
9836 self.source = std::option::Option::Some(
9837 crate::model::process_request::Source::InlineDocument(v.into()),
9838 );
9839 self
9840 }
9841
9842 /// The value of [source][crate::model::ProcessRequest::source]
9843 /// if it holds a `RawDocument`, `None` if the field is not set or
9844 /// holds a different branch.
9845 pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
9846 #[allow(unreachable_patterns)]
9847 self.source.as_ref().and_then(|v| match v {
9848 crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
9849 _ => std::option::Option::None,
9850 })
9851 }
9852
9853 /// Sets the value of [source][crate::model::ProcessRequest::source]
9854 /// to hold a `RawDocument`.
9855 ///
9856 /// Note that all the setters affecting `source` are
9857 /// mutually exclusive.
9858 ///
9859 /// # Example
9860 /// ```ignore,no_run
9861 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9862 /// use google_cloud_documentai_v1::model::RawDocument;
9863 /// let x = ProcessRequest::new().set_raw_document(RawDocument::default()/* use setters */);
9864 /// assert!(x.raw_document().is_some());
9865 /// assert!(x.inline_document().is_none());
9866 /// assert!(x.gcs_document().is_none());
9867 /// ```
9868 pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
9869 mut self,
9870 v: T,
9871 ) -> Self {
9872 self.source =
9873 std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
9874 self
9875 }
9876
9877 /// The value of [source][crate::model::ProcessRequest::source]
9878 /// if it holds a `GcsDocument`, `None` if the field is not set or
9879 /// holds a different branch.
9880 pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
9881 #[allow(unreachable_patterns)]
9882 self.source.as_ref().and_then(|v| match v {
9883 crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
9884 _ => std::option::Option::None,
9885 })
9886 }
9887
9888 /// Sets the value of [source][crate::model::ProcessRequest::source]
9889 /// to hold a `GcsDocument`.
9890 ///
9891 /// Note that all the setters affecting `source` are
9892 /// mutually exclusive.
9893 ///
9894 /// # Example
9895 /// ```ignore,no_run
9896 /// # use google_cloud_documentai_v1::model::ProcessRequest;
9897 /// use google_cloud_documentai_v1::model::GcsDocument;
9898 /// let x = ProcessRequest::new().set_gcs_document(GcsDocument::default()/* use setters */);
9899 /// assert!(x.gcs_document().is_some());
9900 /// assert!(x.inline_document().is_none());
9901 /// assert!(x.raw_document().is_none());
9902 /// ```
9903 pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
9904 mut self,
9905 v: T,
9906 ) -> Self {
9907 self.source =
9908 std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
9909 self
9910 }
9911}
9912
9913impl wkt::message::Message for ProcessRequest {
9914 fn typename() -> &'static str {
9915 "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
9916 }
9917}
9918
9919/// Defines additional types related to [ProcessRequest].
9920pub mod process_request {
9921 #[allow(unused_imports)]
9922 use super::*;
9923
9924 /// The document payload.
9925 #[derive(Clone, Debug, PartialEq)]
9926 #[non_exhaustive]
9927 pub enum Source {
9928 /// An inline document proto.
9929 InlineDocument(std::boxed::Box<crate::model::Document>),
9930 /// A raw document content (bytes).
9931 RawDocument(std::boxed::Box<crate::model::RawDocument>),
9932 /// A raw document on Google Cloud Storage.
9933 GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
9934 }
9935}
9936
9937/// The status of human review on a processed document.
9938#[derive(Clone, Default, PartialEq)]
9939#[non_exhaustive]
9940pub struct HumanReviewStatus {
9941 /// The state of human review on the processing request.
9942 pub state: crate::model::human_review_status::State,
9943
9944 /// A message providing more details about the human review state.
9945 pub state_message: std::string::String,
9946
9947 /// The name of the operation triggered by the processed document. This field
9948 /// is populated only when the
9949 /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
9950 /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
9951 /// the long-running operation returned by
9952 /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
9953 ///
9954 /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
9955 /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
9956 pub human_review_operation: std::string::String,
9957
9958 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9959}
9960
9961impl HumanReviewStatus {
9962 pub fn new() -> Self {
9963 std::default::Default::default()
9964 }
9965
9966 /// Sets the value of [state][crate::model::HumanReviewStatus::state].
9967 ///
9968 /// # Example
9969 /// ```ignore,no_run
9970 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
9971 /// use google_cloud_documentai_v1::model::human_review_status::State;
9972 /// let x0 = HumanReviewStatus::new().set_state(State::Skipped);
9973 /// let x1 = HumanReviewStatus::new().set_state(State::ValidationPassed);
9974 /// let x2 = HumanReviewStatus::new().set_state(State::InProgress);
9975 /// ```
9976 pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
9977 mut self,
9978 v: T,
9979 ) -> Self {
9980 self.state = v.into();
9981 self
9982 }
9983
9984 /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
9985 ///
9986 /// # Example
9987 /// ```ignore,no_run
9988 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
9989 /// let x = HumanReviewStatus::new().set_state_message("example");
9990 /// ```
9991 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9992 self.state_message = v.into();
9993 self
9994 }
9995
9996 /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
9997 ///
9998 /// # Example
9999 /// ```ignore,no_run
10000 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10001 /// let x = HumanReviewStatus::new().set_human_review_operation("example");
10002 /// ```
10003 pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
10004 mut self,
10005 v: T,
10006 ) -> Self {
10007 self.human_review_operation = v.into();
10008 self
10009 }
10010}
10011
10012impl wkt::message::Message for HumanReviewStatus {
10013 fn typename() -> &'static str {
10014 "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
10015 }
10016}
10017
10018/// Defines additional types related to [HumanReviewStatus].
10019pub mod human_review_status {
10020 #[allow(unused_imports)]
10021 use super::*;
10022
10023 /// The final state of human review on a processed document.
10024 ///
10025 /// # Working with unknown values
10026 ///
10027 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10028 /// additional enum variants at any time. Adding new variants is not considered
10029 /// a breaking change. Applications should write their code in anticipation of:
10030 ///
10031 /// - New values appearing in future releases of the client library, **and**
10032 /// - New values received dynamically, without application changes.
10033 ///
10034 /// Please consult the [Working with enums] section in the user guide for some
10035 /// guidelines.
10036 ///
10037 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10038 #[derive(Clone, Debug, PartialEq)]
10039 #[non_exhaustive]
10040 pub enum State {
10041 /// Human review state is unspecified. Most likely due to an internal error.
10042 Unspecified,
10043 /// Human review is skipped for the document. This can happen because human
10044 /// review isn't enabled on the processor or the processing request has
10045 /// been set to skip this document.
10046 Skipped,
10047 /// Human review validation is triggered and passed, so no review is needed.
10048 ValidationPassed,
10049 /// Human review validation is triggered and the document is under review.
10050 InProgress,
10051 /// Some error happened during triggering human review, see the
10052 /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
10053 /// for details.
10054 ///
10055 /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
10056 Error,
10057 /// If set, the enum was initialized with an unknown value.
10058 ///
10059 /// Applications can examine the value using [State::value] or
10060 /// [State::name].
10061 UnknownValue(state::UnknownValue),
10062 }
10063
10064 #[doc(hidden)]
10065 pub mod state {
10066 #[allow(unused_imports)]
10067 use super::*;
10068 #[derive(Clone, Debug, PartialEq)]
10069 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10070 }
10071
10072 impl State {
10073 /// Gets the enum value.
10074 ///
10075 /// Returns `None` if the enum contains an unknown value deserialized from
10076 /// the string representation of enums.
10077 pub fn value(&self) -> std::option::Option<i32> {
10078 match self {
10079 Self::Unspecified => std::option::Option::Some(0),
10080 Self::Skipped => std::option::Option::Some(1),
10081 Self::ValidationPassed => std::option::Option::Some(2),
10082 Self::InProgress => std::option::Option::Some(3),
10083 Self::Error => std::option::Option::Some(4),
10084 Self::UnknownValue(u) => u.0.value(),
10085 }
10086 }
10087
10088 /// Gets the enum value as a string.
10089 ///
10090 /// Returns `None` if the enum contains an unknown value deserialized from
10091 /// the integer representation of enums.
10092 pub fn name(&self) -> std::option::Option<&str> {
10093 match self {
10094 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10095 Self::Skipped => std::option::Option::Some("SKIPPED"),
10096 Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
10097 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
10098 Self::Error => std::option::Option::Some("ERROR"),
10099 Self::UnknownValue(u) => u.0.name(),
10100 }
10101 }
10102 }
10103
10104 impl std::default::Default for State {
10105 fn default() -> Self {
10106 use std::convert::From;
10107 Self::from(0)
10108 }
10109 }
10110
10111 impl std::fmt::Display for State {
10112 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10113 wkt::internal::display_enum(f, self.name(), self.value())
10114 }
10115 }
10116
10117 impl std::convert::From<i32> for State {
10118 fn from(value: i32) -> Self {
10119 match value {
10120 0 => Self::Unspecified,
10121 1 => Self::Skipped,
10122 2 => Self::ValidationPassed,
10123 3 => Self::InProgress,
10124 4 => Self::Error,
10125 _ => Self::UnknownValue(state::UnknownValue(
10126 wkt::internal::UnknownEnumValue::Integer(value),
10127 )),
10128 }
10129 }
10130 }
10131
10132 impl std::convert::From<&str> for State {
10133 fn from(value: &str) -> Self {
10134 use std::string::ToString;
10135 match value {
10136 "STATE_UNSPECIFIED" => Self::Unspecified,
10137 "SKIPPED" => Self::Skipped,
10138 "VALIDATION_PASSED" => Self::ValidationPassed,
10139 "IN_PROGRESS" => Self::InProgress,
10140 "ERROR" => Self::Error,
10141 _ => Self::UnknownValue(state::UnknownValue(
10142 wkt::internal::UnknownEnumValue::String(value.to_string()),
10143 )),
10144 }
10145 }
10146 }
10147
10148 impl serde::ser::Serialize for State {
10149 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10150 where
10151 S: serde::Serializer,
10152 {
10153 match self {
10154 Self::Unspecified => serializer.serialize_i32(0),
10155 Self::Skipped => serializer.serialize_i32(1),
10156 Self::ValidationPassed => serializer.serialize_i32(2),
10157 Self::InProgress => serializer.serialize_i32(3),
10158 Self::Error => serializer.serialize_i32(4),
10159 Self::UnknownValue(u) => u.0.serialize(serializer),
10160 }
10161 }
10162 }
10163
10164 impl<'de> serde::de::Deserialize<'de> for State {
10165 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10166 where
10167 D: serde::Deserializer<'de>,
10168 {
10169 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10170 ".google.cloud.documentai.v1.HumanReviewStatus.State",
10171 ))
10172 }
10173 }
10174}
10175
10176/// Response message for the
10177/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
10178/// method.
10179///
10180/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10181#[derive(Clone, Default, PartialEq)]
10182#[non_exhaustive]
10183pub struct ProcessResponse {
10184 /// The document payload, will populate fields based on the processor's
10185 /// behavior.
10186 pub document: std::option::Option<crate::model::Document>,
10187
10188 /// The status of human review on the processed document.
10189 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
10190
10191 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10192}
10193
10194impl ProcessResponse {
10195 pub fn new() -> Self {
10196 std::default::Default::default()
10197 }
10198
10199 /// Sets the value of [document][crate::model::ProcessResponse::document].
10200 ///
10201 /// # Example
10202 /// ```ignore,no_run
10203 /// # use google_cloud_documentai_v1::model::ProcessResponse;
10204 /// use google_cloud_documentai_v1::model::Document;
10205 /// let x = ProcessResponse::new().set_document(Document::default()/* use setters */);
10206 /// ```
10207 pub fn set_document<T>(mut self, v: T) -> Self
10208 where
10209 T: std::convert::Into<crate::model::Document>,
10210 {
10211 self.document = std::option::Option::Some(v.into());
10212 self
10213 }
10214
10215 /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
10216 ///
10217 /// # Example
10218 /// ```ignore,no_run
10219 /// # use google_cloud_documentai_v1::model::ProcessResponse;
10220 /// use google_cloud_documentai_v1::model::Document;
10221 /// let x = ProcessResponse::new().set_or_clear_document(Some(Document::default()/* use setters */));
10222 /// let x = ProcessResponse::new().set_or_clear_document(None::<Document>);
10223 /// ```
10224 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
10225 where
10226 T: std::convert::Into<crate::model::Document>,
10227 {
10228 self.document = v.map(|x| x.into());
10229 self
10230 }
10231
10232 /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
10233 ///
10234 /// # Example
10235 /// ```ignore,no_run
10236 /// # use google_cloud_documentai_v1::model::ProcessResponse;
10237 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10238 /// let x = ProcessResponse::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
10239 /// ```
10240 pub fn set_human_review_status<T>(mut self, v: T) -> Self
10241 where
10242 T: std::convert::Into<crate::model::HumanReviewStatus>,
10243 {
10244 self.human_review_status = std::option::Option::Some(v.into());
10245 self
10246 }
10247
10248 /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
10249 ///
10250 /// # Example
10251 /// ```ignore,no_run
10252 /// # use google_cloud_documentai_v1::model::ProcessResponse;
10253 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10254 /// let x = ProcessResponse::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
10255 /// let x = ProcessResponse::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
10256 /// ```
10257 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
10258 where
10259 T: std::convert::Into<crate::model::HumanReviewStatus>,
10260 {
10261 self.human_review_status = v.map(|x| x.into());
10262 self
10263 }
10264}
10265
10266impl wkt::message::Message for ProcessResponse {
10267 fn typename() -> &'static str {
10268 "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
10269 }
10270}
10271
10272/// Request message for
10273/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
10274///
10275/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10276#[derive(Clone, Default, PartialEq)]
10277#[non_exhaustive]
10278pub struct BatchProcessRequest {
10279 /// Required. The resource name of
10280 /// [Processor][google.cloud.documentai.v1.Processor] or
10281 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
10282 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
10283 /// or
10284 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
10285 ///
10286 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
10287 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10288 pub name: std::string::String,
10289
10290 /// The input documents for the
10291 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
10292 /// method.
10293 ///
10294 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10295 pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
10296
10297 /// The output configuration for the
10298 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
10299 /// method.
10300 ///
10301 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10302 pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
10303
10304 /// Whether human review should be skipped for this request. Default to
10305 /// `false`.
10306 pub skip_human_review: bool,
10307
10308 /// Inference-time options for the process API
10309 pub process_options: std::option::Option<crate::model::ProcessOptions>,
10310
10311 /// Optional. The labels with user-defined metadata for the request.
10312 ///
10313 /// Label keys and values can be no longer than 63 characters
10314 /// (Unicode codepoints) and can only contain lowercase letters, numeric
10315 /// characters, underscores, and dashes. International characters are allowed.
10316 /// Label values are optional. Label keys must start with a letter.
10317 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10318
10319 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10320}
10321
10322impl BatchProcessRequest {
10323 pub fn new() -> Self {
10324 std::default::Default::default()
10325 }
10326
10327 /// Sets the value of [name][crate::model::BatchProcessRequest::name].
10328 ///
10329 /// # Example
10330 /// ```ignore,no_run
10331 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10332 /// let x = BatchProcessRequest::new().set_name("example");
10333 /// ```
10334 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10335 self.name = v.into();
10336 self
10337 }
10338
10339 /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
10340 ///
10341 /// # Example
10342 /// ```ignore,no_run
10343 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10344 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
10345 /// let x = BatchProcessRequest::new().set_input_documents(BatchDocumentsInputConfig::default()/* use setters */);
10346 /// ```
10347 pub fn set_input_documents<T>(mut self, v: T) -> Self
10348 where
10349 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
10350 {
10351 self.input_documents = std::option::Option::Some(v.into());
10352 self
10353 }
10354
10355 /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
10356 ///
10357 /// # Example
10358 /// ```ignore,no_run
10359 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10360 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
10361 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
10362 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(None::<BatchDocumentsInputConfig>);
10363 /// ```
10364 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
10365 where
10366 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
10367 {
10368 self.input_documents = v.map(|x| x.into());
10369 self
10370 }
10371
10372 /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
10373 ///
10374 /// # Example
10375 /// ```ignore,no_run
10376 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10377 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
10378 /// let x = BatchProcessRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
10379 /// ```
10380 pub fn set_document_output_config<T>(mut self, v: T) -> Self
10381 where
10382 T: std::convert::Into<crate::model::DocumentOutputConfig>,
10383 {
10384 self.document_output_config = std::option::Option::Some(v.into());
10385 self
10386 }
10387
10388 /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
10389 ///
10390 /// # Example
10391 /// ```ignore,no_run
10392 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10393 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
10394 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
10395 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
10396 /// ```
10397 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
10398 where
10399 T: std::convert::Into<crate::model::DocumentOutputConfig>,
10400 {
10401 self.document_output_config = v.map(|x| x.into());
10402 self
10403 }
10404
10405 /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
10406 ///
10407 /// # Example
10408 /// ```ignore,no_run
10409 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10410 /// let x = BatchProcessRequest::new().set_skip_human_review(true);
10411 /// ```
10412 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10413 self.skip_human_review = v.into();
10414 self
10415 }
10416
10417 /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
10418 ///
10419 /// # Example
10420 /// ```ignore,no_run
10421 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10422 /// use google_cloud_documentai_v1::model::ProcessOptions;
10423 /// let x = BatchProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
10424 /// ```
10425 pub fn set_process_options<T>(mut self, v: T) -> Self
10426 where
10427 T: std::convert::Into<crate::model::ProcessOptions>,
10428 {
10429 self.process_options = std::option::Option::Some(v.into());
10430 self
10431 }
10432
10433 /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
10434 ///
10435 /// # Example
10436 /// ```ignore,no_run
10437 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10438 /// use google_cloud_documentai_v1::model::ProcessOptions;
10439 /// let x = BatchProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
10440 /// let x = BatchProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
10441 /// ```
10442 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
10443 where
10444 T: std::convert::Into<crate::model::ProcessOptions>,
10445 {
10446 self.process_options = v.map(|x| x.into());
10447 self
10448 }
10449
10450 /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
10451 ///
10452 /// # Example
10453 /// ```ignore,no_run
10454 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
10455 /// let x = BatchProcessRequest::new().set_labels([
10456 /// ("key0", "abc"),
10457 /// ("key1", "xyz"),
10458 /// ]);
10459 /// ```
10460 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10461 where
10462 T: std::iter::IntoIterator<Item = (K, V)>,
10463 K: std::convert::Into<std::string::String>,
10464 V: std::convert::Into<std::string::String>,
10465 {
10466 use std::iter::Iterator;
10467 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10468 self
10469 }
10470}
10471
10472impl wkt::message::Message for BatchProcessRequest {
10473 fn typename() -> &'static str {
10474 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
10475 }
10476}
10477
10478/// Response message for
10479/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
10480///
10481/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10482#[derive(Clone, Default, PartialEq)]
10483#[non_exhaustive]
10484pub struct BatchProcessResponse {
10485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10486}
10487
10488impl BatchProcessResponse {
10489 pub fn new() -> Self {
10490 std::default::Default::default()
10491 }
10492}
10493
10494impl wkt::message::Message for BatchProcessResponse {
10495 fn typename() -> &'static str {
10496 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
10497 }
10498}
10499
10500/// The long-running operation metadata for
10501/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
10502///
10503/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
10504#[derive(Clone, Default, PartialEq)]
10505#[non_exhaustive]
10506pub struct BatchProcessMetadata {
10507 /// The state of the current batch processing.
10508 pub state: crate::model::batch_process_metadata::State,
10509
10510 /// A message providing more details about the current state of processing.
10511 /// For example, the error message if the operation is failed.
10512 pub state_message: std::string::String,
10513
10514 /// The creation time of the operation.
10515 pub create_time: std::option::Option<wkt::Timestamp>,
10516
10517 /// The last update time of the operation.
10518 pub update_time: std::option::Option<wkt::Timestamp>,
10519
10520 /// The list of response details of each document.
10521 pub individual_process_statuses:
10522 std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
10523
10524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10525}
10526
10527impl BatchProcessMetadata {
10528 pub fn new() -> Self {
10529 std::default::Default::default()
10530 }
10531
10532 /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
10533 ///
10534 /// # Example
10535 /// ```ignore,no_run
10536 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10537 /// use google_cloud_documentai_v1::model::batch_process_metadata::State;
10538 /// let x0 = BatchProcessMetadata::new().set_state(State::Waiting);
10539 /// let x1 = BatchProcessMetadata::new().set_state(State::Running);
10540 /// let x2 = BatchProcessMetadata::new().set_state(State::Succeeded);
10541 /// ```
10542 pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
10543 mut self,
10544 v: T,
10545 ) -> Self {
10546 self.state = v.into();
10547 self
10548 }
10549
10550 /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
10551 ///
10552 /// # Example
10553 /// ```ignore,no_run
10554 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10555 /// let x = BatchProcessMetadata::new().set_state_message("example");
10556 /// ```
10557 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10558 self.state_message = v.into();
10559 self
10560 }
10561
10562 /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
10563 ///
10564 /// # Example
10565 /// ```ignore,no_run
10566 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10567 /// use wkt::Timestamp;
10568 /// let x = BatchProcessMetadata::new().set_create_time(Timestamp::default()/* use setters */);
10569 /// ```
10570 pub fn set_create_time<T>(mut self, v: T) -> Self
10571 where
10572 T: std::convert::Into<wkt::Timestamp>,
10573 {
10574 self.create_time = std::option::Option::Some(v.into());
10575 self
10576 }
10577
10578 /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
10579 ///
10580 /// # Example
10581 /// ```ignore,no_run
10582 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10583 /// use wkt::Timestamp;
10584 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
10585 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(None::<Timestamp>);
10586 /// ```
10587 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
10588 where
10589 T: std::convert::Into<wkt::Timestamp>,
10590 {
10591 self.create_time = v.map(|x| x.into());
10592 self
10593 }
10594
10595 /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
10596 ///
10597 /// # Example
10598 /// ```ignore,no_run
10599 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10600 /// use wkt::Timestamp;
10601 /// let x = BatchProcessMetadata::new().set_update_time(Timestamp::default()/* use setters */);
10602 /// ```
10603 pub fn set_update_time<T>(mut self, v: T) -> Self
10604 where
10605 T: std::convert::Into<wkt::Timestamp>,
10606 {
10607 self.update_time = std::option::Option::Some(v.into());
10608 self
10609 }
10610
10611 /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
10612 ///
10613 /// # Example
10614 /// ```ignore,no_run
10615 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10616 /// use wkt::Timestamp;
10617 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
10618 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(None::<Timestamp>);
10619 /// ```
10620 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
10621 where
10622 T: std::convert::Into<wkt::Timestamp>,
10623 {
10624 self.update_time = v.map(|x| x.into());
10625 self
10626 }
10627
10628 /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
10629 ///
10630 /// # Example
10631 /// ```ignore,no_run
10632 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
10633 /// use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10634 /// let x = BatchProcessMetadata::new()
10635 /// .set_individual_process_statuses([
10636 /// IndividualProcessStatus::default()/* use setters */,
10637 /// IndividualProcessStatus::default()/* use (different) setters */,
10638 /// ]);
10639 /// ```
10640 pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
10641 where
10642 T: std::iter::IntoIterator<Item = V>,
10643 V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
10644 {
10645 use std::iter::Iterator;
10646 self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
10647 self
10648 }
10649}
10650
10651impl wkt::message::Message for BatchProcessMetadata {
10652 fn typename() -> &'static str {
10653 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
10654 }
10655}
10656
10657/// Defines additional types related to [BatchProcessMetadata].
10658pub mod batch_process_metadata {
10659 #[allow(unused_imports)]
10660 use super::*;
10661
10662 /// The status of a each individual document in the batch process.
10663 #[derive(Clone, Default, PartialEq)]
10664 #[non_exhaustive]
10665 pub struct IndividualProcessStatus {
10666 /// The source of the document, same as the
10667 /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
10668 /// field in the request when the batch process started.
10669 ///
10670 /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
10671 pub input_gcs_source: std::string::String,
10672
10673 /// The status processing the document.
10674 pub status: std::option::Option<rpc::model::Status>,
10675
10676 /// The Cloud Storage output destination (in the request as
10677 /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
10678 /// of the processed document if it was successful, otherwise empty.
10679 ///
10680 /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
10681 pub output_gcs_destination: std::string::String,
10682
10683 /// The status of human review on the processed document.
10684 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
10685
10686 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10687 }
10688
10689 impl IndividualProcessStatus {
10690 pub fn new() -> Self {
10691 std::default::Default::default()
10692 }
10693
10694 /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
10695 ///
10696 /// # Example
10697 /// ```ignore,no_run
10698 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10699 /// let x = IndividualProcessStatus::new().set_input_gcs_source("example");
10700 /// ```
10701 pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
10702 mut self,
10703 v: T,
10704 ) -> Self {
10705 self.input_gcs_source = v.into();
10706 self
10707 }
10708
10709 /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
10710 ///
10711 /// # Example
10712 /// ```ignore,no_run
10713 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10714 /// use rpc::model::Status;
10715 /// let x = IndividualProcessStatus::new().set_status(Status::default()/* use setters */);
10716 /// ```
10717 pub fn set_status<T>(mut self, v: T) -> Self
10718 where
10719 T: std::convert::Into<rpc::model::Status>,
10720 {
10721 self.status = std::option::Option::Some(v.into());
10722 self
10723 }
10724
10725 /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
10726 ///
10727 /// # Example
10728 /// ```ignore,no_run
10729 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10730 /// use rpc::model::Status;
10731 /// let x = IndividualProcessStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
10732 /// let x = IndividualProcessStatus::new().set_or_clear_status(None::<Status>);
10733 /// ```
10734 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
10735 where
10736 T: std::convert::Into<rpc::model::Status>,
10737 {
10738 self.status = v.map(|x| x.into());
10739 self
10740 }
10741
10742 /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
10743 ///
10744 /// # Example
10745 /// ```ignore,no_run
10746 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10747 /// let x = IndividualProcessStatus::new().set_output_gcs_destination("example");
10748 /// ```
10749 pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
10750 mut self,
10751 v: T,
10752 ) -> Self {
10753 self.output_gcs_destination = v.into();
10754 self
10755 }
10756
10757 /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
10758 ///
10759 /// # Example
10760 /// ```ignore,no_run
10761 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10762 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10763 /// let x = IndividualProcessStatus::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
10764 /// ```
10765 pub fn set_human_review_status<T>(mut self, v: T) -> Self
10766 where
10767 T: std::convert::Into<crate::model::HumanReviewStatus>,
10768 {
10769 self.human_review_status = std::option::Option::Some(v.into());
10770 self
10771 }
10772
10773 /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
10774 ///
10775 /// # Example
10776 /// ```ignore,no_run
10777 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
10778 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
10779 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
10780 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
10781 /// ```
10782 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
10783 where
10784 T: std::convert::Into<crate::model::HumanReviewStatus>,
10785 {
10786 self.human_review_status = v.map(|x| x.into());
10787 self
10788 }
10789 }
10790
10791 impl wkt::message::Message for IndividualProcessStatus {
10792 fn typename() -> &'static str {
10793 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
10794 }
10795 }
10796
10797 /// Possible states of the batch processing operation.
10798 ///
10799 /// # Working with unknown values
10800 ///
10801 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
10802 /// additional enum variants at any time. Adding new variants is not considered
10803 /// a breaking change. Applications should write their code in anticipation of:
10804 ///
10805 /// - New values appearing in future releases of the client library, **and**
10806 /// - New values received dynamically, without application changes.
10807 ///
10808 /// Please consult the [Working with enums] section in the user guide for some
10809 /// guidelines.
10810 ///
10811 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
10812 #[derive(Clone, Debug, PartialEq)]
10813 #[non_exhaustive]
10814 pub enum State {
10815 /// The default value. This value is used if the state is omitted.
10816 Unspecified,
10817 /// Request operation is waiting for scheduling.
10818 Waiting,
10819 /// Request is being processed.
10820 Running,
10821 /// The batch processing completed successfully.
10822 Succeeded,
10823 /// The batch processing was being cancelled.
10824 Cancelling,
10825 /// The batch processing was cancelled.
10826 Cancelled,
10827 /// The batch processing has failed.
10828 Failed,
10829 /// If set, the enum was initialized with an unknown value.
10830 ///
10831 /// Applications can examine the value using [State::value] or
10832 /// [State::name].
10833 UnknownValue(state::UnknownValue),
10834 }
10835
10836 #[doc(hidden)]
10837 pub mod state {
10838 #[allow(unused_imports)]
10839 use super::*;
10840 #[derive(Clone, Debug, PartialEq)]
10841 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
10842 }
10843
10844 impl State {
10845 /// Gets the enum value.
10846 ///
10847 /// Returns `None` if the enum contains an unknown value deserialized from
10848 /// the string representation of enums.
10849 pub fn value(&self) -> std::option::Option<i32> {
10850 match self {
10851 Self::Unspecified => std::option::Option::Some(0),
10852 Self::Waiting => std::option::Option::Some(1),
10853 Self::Running => std::option::Option::Some(2),
10854 Self::Succeeded => std::option::Option::Some(3),
10855 Self::Cancelling => std::option::Option::Some(4),
10856 Self::Cancelled => std::option::Option::Some(5),
10857 Self::Failed => std::option::Option::Some(6),
10858 Self::UnknownValue(u) => u.0.value(),
10859 }
10860 }
10861
10862 /// Gets the enum value as a string.
10863 ///
10864 /// Returns `None` if the enum contains an unknown value deserialized from
10865 /// the integer representation of enums.
10866 pub fn name(&self) -> std::option::Option<&str> {
10867 match self {
10868 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
10869 Self::Waiting => std::option::Option::Some("WAITING"),
10870 Self::Running => std::option::Option::Some("RUNNING"),
10871 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
10872 Self::Cancelling => std::option::Option::Some("CANCELLING"),
10873 Self::Cancelled => std::option::Option::Some("CANCELLED"),
10874 Self::Failed => std::option::Option::Some("FAILED"),
10875 Self::UnknownValue(u) => u.0.name(),
10876 }
10877 }
10878 }
10879
10880 impl std::default::Default for State {
10881 fn default() -> Self {
10882 use std::convert::From;
10883 Self::from(0)
10884 }
10885 }
10886
10887 impl std::fmt::Display for State {
10888 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
10889 wkt::internal::display_enum(f, self.name(), self.value())
10890 }
10891 }
10892
10893 impl std::convert::From<i32> for State {
10894 fn from(value: i32) -> Self {
10895 match value {
10896 0 => Self::Unspecified,
10897 1 => Self::Waiting,
10898 2 => Self::Running,
10899 3 => Self::Succeeded,
10900 4 => Self::Cancelling,
10901 5 => Self::Cancelled,
10902 6 => Self::Failed,
10903 _ => Self::UnknownValue(state::UnknownValue(
10904 wkt::internal::UnknownEnumValue::Integer(value),
10905 )),
10906 }
10907 }
10908 }
10909
10910 impl std::convert::From<&str> for State {
10911 fn from(value: &str) -> Self {
10912 use std::string::ToString;
10913 match value {
10914 "STATE_UNSPECIFIED" => Self::Unspecified,
10915 "WAITING" => Self::Waiting,
10916 "RUNNING" => Self::Running,
10917 "SUCCEEDED" => Self::Succeeded,
10918 "CANCELLING" => Self::Cancelling,
10919 "CANCELLED" => Self::Cancelled,
10920 "FAILED" => Self::Failed,
10921 _ => Self::UnknownValue(state::UnknownValue(
10922 wkt::internal::UnknownEnumValue::String(value.to_string()),
10923 )),
10924 }
10925 }
10926 }
10927
10928 impl serde::ser::Serialize for State {
10929 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
10930 where
10931 S: serde::Serializer,
10932 {
10933 match self {
10934 Self::Unspecified => serializer.serialize_i32(0),
10935 Self::Waiting => serializer.serialize_i32(1),
10936 Self::Running => serializer.serialize_i32(2),
10937 Self::Succeeded => serializer.serialize_i32(3),
10938 Self::Cancelling => serializer.serialize_i32(4),
10939 Self::Cancelled => serializer.serialize_i32(5),
10940 Self::Failed => serializer.serialize_i32(6),
10941 Self::UnknownValue(u) => u.0.serialize(serializer),
10942 }
10943 }
10944 }
10945
10946 impl<'de> serde::de::Deserialize<'de> for State {
10947 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
10948 where
10949 D: serde::Deserializer<'de>,
10950 {
10951 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
10952 ".google.cloud.documentai.v1.BatchProcessMetadata.State",
10953 ))
10954 }
10955 }
10956}
10957
10958/// Request message for the
10959/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
10960/// method. Some processor types may require the project be added to an
10961/// allowlist.
10962///
10963/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
10964#[derive(Clone, Default, PartialEq)]
10965#[non_exhaustive]
10966pub struct FetchProcessorTypesRequest {
10967 /// Required. The location of processor types to list.
10968 /// Format: `projects/{project}/locations/{location}`.
10969 pub parent: std::string::String,
10970
10971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10972}
10973
10974impl FetchProcessorTypesRequest {
10975 pub fn new() -> Self {
10976 std::default::Default::default()
10977 }
10978
10979 /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
10980 ///
10981 /// # Example
10982 /// ```ignore,no_run
10983 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesRequest;
10984 /// let x = FetchProcessorTypesRequest::new().set_parent("example");
10985 /// ```
10986 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10987 self.parent = v.into();
10988 self
10989 }
10990}
10991
10992impl wkt::message::Message for FetchProcessorTypesRequest {
10993 fn typename() -> &'static str {
10994 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
10995 }
10996}
10997
10998/// Response message for the
10999/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
11000/// method.
11001///
11002/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
11003#[derive(Clone, Default, PartialEq)]
11004#[non_exhaustive]
11005pub struct FetchProcessorTypesResponse {
11006 /// The list of processor types.
11007 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
11008
11009 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11010}
11011
11012impl FetchProcessorTypesResponse {
11013 pub fn new() -> Self {
11014 std::default::Default::default()
11015 }
11016
11017 /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
11018 ///
11019 /// # Example
11020 /// ```ignore,no_run
11021 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesResponse;
11022 /// use google_cloud_documentai_v1::model::ProcessorType;
11023 /// let x = FetchProcessorTypesResponse::new()
11024 /// .set_processor_types([
11025 /// ProcessorType::default()/* use setters */,
11026 /// ProcessorType::default()/* use (different) setters */,
11027 /// ]);
11028 /// ```
11029 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
11030 where
11031 T: std::iter::IntoIterator<Item = V>,
11032 V: std::convert::Into<crate::model::ProcessorType>,
11033 {
11034 use std::iter::Iterator;
11035 self.processor_types = v.into_iter().map(|i| i.into()).collect();
11036 self
11037 }
11038}
11039
11040impl wkt::message::Message for FetchProcessorTypesResponse {
11041 fn typename() -> &'static str {
11042 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
11043 }
11044}
11045
11046/// Request message for the
11047/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
11048/// method. Some processor types may require the project be added to an
11049/// allowlist.
11050///
11051/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
11052#[derive(Clone, Default, PartialEq)]
11053#[non_exhaustive]
11054pub struct ListProcessorTypesRequest {
11055 /// Required. The location of processor types to list.
11056 /// Format: `projects/{project}/locations/{location}`.
11057 pub parent: std::string::String,
11058
11059 /// The maximum number of processor types to return.
11060 /// If unspecified, at most `100` processor types will be returned.
11061 /// The maximum value is `500`. Values above `500` will be coerced to `500`.
11062 pub page_size: i32,
11063
11064 /// Used to retrieve the next page of results, empty if at the end of the list.
11065 pub page_token: std::string::String,
11066
11067 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11068}
11069
11070impl ListProcessorTypesRequest {
11071 pub fn new() -> Self {
11072 std::default::Default::default()
11073 }
11074
11075 /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
11076 ///
11077 /// # Example
11078 /// ```ignore,no_run
11079 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
11080 /// let x = ListProcessorTypesRequest::new().set_parent("example");
11081 /// ```
11082 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11083 self.parent = v.into();
11084 self
11085 }
11086
11087 /// Sets the value of [page_size][crate::model::ListProcessorTypesRequest::page_size].
11088 ///
11089 /// # Example
11090 /// ```ignore,no_run
11091 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
11092 /// let x = ListProcessorTypesRequest::new().set_page_size(42);
11093 /// ```
11094 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11095 self.page_size = v.into();
11096 self
11097 }
11098
11099 /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
11100 ///
11101 /// # Example
11102 /// ```ignore,no_run
11103 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
11104 /// let x = ListProcessorTypesRequest::new().set_page_token("example");
11105 /// ```
11106 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11107 self.page_token = v.into();
11108 self
11109 }
11110}
11111
11112impl wkt::message::Message for ListProcessorTypesRequest {
11113 fn typename() -> &'static str {
11114 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
11115 }
11116}
11117
11118/// Response message for the
11119/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
11120/// method.
11121///
11122/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
11123#[derive(Clone, Default, PartialEq)]
11124#[non_exhaustive]
11125pub struct ListProcessorTypesResponse {
11126 /// The processor types.
11127 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
11128
11129 /// Points to the next page, otherwise empty.
11130 pub next_page_token: std::string::String,
11131
11132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11133}
11134
11135impl ListProcessorTypesResponse {
11136 pub fn new() -> Self {
11137 std::default::Default::default()
11138 }
11139
11140 /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
11141 ///
11142 /// # Example
11143 /// ```ignore,no_run
11144 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
11145 /// use google_cloud_documentai_v1::model::ProcessorType;
11146 /// let x = ListProcessorTypesResponse::new()
11147 /// .set_processor_types([
11148 /// ProcessorType::default()/* use setters */,
11149 /// ProcessorType::default()/* use (different) setters */,
11150 /// ]);
11151 /// ```
11152 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
11153 where
11154 T: std::iter::IntoIterator<Item = V>,
11155 V: std::convert::Into<crate::model::ProcessorType>,
11156 {
11157 use std::iter::Iterator;
11158 self.processor_types = v.into_iter().map(|i| i.into()).collect();
11159 self
11160 }
11161
11162 /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
11163 ///
11164 /// # Example
11165 /// ```ignore,no_run
11166 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
11167 /// let x = ListProcessorTypesResponse::new().set_next_page_token("example");
11168 /// ```
11169 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11170 self.next_page_token = v.into();
11171 self
11172 }
11173}
11174
11175impl wkt::message::Message for ListProcessorTypesResponse {
11176 fn typename() -> &'static str {
11177 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
11178 }
11179}
11180
11181#[doc(hidden)]
11182impl gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
11183 type PageItem = crate::model::ProcessorType;
11184
11185 fn items(self) -> std::vec::Vec<Self::PageItem> {
11186 self.processor_types
11187 }
11188
11189 fn next_page_token(&self) -> std::string::String {
11190 use std::clone::Clone;
11191 self.next_page_token.clone()
11192 }
11193}
11194
11195/// Request message for list all processors belongs to a project.
11196#[derive(Clone, Default, PartialEq)]
11197#[non_exhaustive]
11198pub struct ListProcessorsRequest {
11199 /// Required. The parent (project and location) which owns this collection of
11200 /// Processors. Format: `projects/{project}/locations/{location}`
11201 pub parent: std::string::String,
11202
11203 /// The maximum number of processors to return.
11204 /// If unspecified, at most `50` processors will be returned.
11205 /// The maximum value is `100`. Values above `100` will be coerced to `100`.
11206 pub page_size: i32,
11207
11208 /// We will return the processors sorted by creation time. The page token
11209 /// will point to the next processor.
11210 pub page_token: std::string::String,
11211
11212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11213}
11214
11215impl ListProcessorsRequest {
11216 pub fn new() -> Self {
11217 std::default::Default::default()
11218 }
11219
11220 /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
11221 ///
11222 /// # Example
11223 /// ```ignore,no_run
11224 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
11225 /// let x = ListProcessorsRequest::new().set_parent("example");
11226 /// ```
11227 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11228 self.parent = v.into();
11229 self
11230 }
11231
11232 /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
11233 ///
11234 /// # Example
11235 /// ```ignore,no_run
11236 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
11237 /// let x = ListProcessorsRequest::new().set_page_size(42);
11238 /// ```
11239 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11240 self.page_size = v.into();
11241 self
11242 }
11243
11244 /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
11245 ///
11246 /// # Example
11247 /// ```ignore,no_run
11248 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
11249 /// let x = ListProcessorsRequest::new().set_page_token("example");
11250 /// ```
11251 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11252 self.page_token = v.into();
11253 self
11254 }
11255}
11256
11257impl wkt::message::Message for ListProcessorsRequest {
11258 fn typename() -> &'static str {
11259 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
11260 }
11261}
11262
11263/// Response message for the
11264/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
11265/// method.
11266///
11267/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
11268#[derive(Clone, Default, PartialEq)]
11269#[non_exhaustive]
11270pub struct ListProcessorsResponse {
11271 /// The list of processors.
11272 pub processors: std::vec::Vec<crate::model::Processor>,
11273
11274 /// Points to the next processor, otherwise empty.
11275 pub next_page_token: std::string::String,
11276
11277 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11278}
11279
11280impl ListProcessorsResponse {
11281 pub fn new() -> Self {
11282 std::default::Default::default()
11283 }
11284
11285 /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
11286 ///
11287 /// # Example
11288 /// ```ignore,no_run
11289 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
11290 /// use google_cloud_documentai_v1::model::Processor;
11291 /// let x = ListProcessorsResponse::new()
11292 /// .set_processors([
11293 /// Processor::default()/* use setters */,
11294 /// Processor::default()/* use (different) setters */,
11295 /// ]);
11296 /// ```
11297 pub fn set_processors<T, V>(mut self, v: T) -> Self
11298 where
11299 T: std::iter::IntoIterator<Item = V>,
11300 V: std::convert::Into<crate::model::Processor>,
11301 {
11302 use std::iter::Iterator;
11303 self.processors = v.into_iter().map(|i| i.into()).collect();
11304 self
11305 }
11306
11307 /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
11308 ///
11309 /// # Example
11310 /// ```ignore,no_run
11311 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
11312 /// let x = ListProcessorsResponse::new().set_next_page_token("example");
11313 /// ```
11314 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11315 self.next_page_token = v.into();
11316 self
11317 }
11318}
11319
11320impl wkt::message::Message for ListProcessorsResponse {
11321 fn typename() -> &'static str {
11322 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
11323 }
11324}
11325
11326#[doc(hidden)]
11327impl gax::paginator::internal::PageableResponse for ListProcessorsResponse {
11328 type PageItem = crate::model::Processor;
11329
11330 fn items(self) -> std::vec::Vec<Self::PageItem> {
11331 self.processors
11332 }
11333
11334 fn next_page_token(&self) -> std::string::String {
11335 use std::clone::Clone;
11336 self.next_page_token.clone()
11337 }
11338}
11339
11340/// Request message for the
11341/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
11342/// method.
11343///
11344/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
11345#[derive(Clone, Default, PartialEq)]
11346#[non_exhaustive]
11347pub struct GetProcessorTypeRequest {
11348 /// Required. The processor type resource name.
11349 pub name: std::string::String,
11350
11351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11352}
11353
11354impl GetProcessorTypeRequest {
11355 pub fn new() -> Self {
11356 std::default::Default::default()
11357 }
11358
11359 /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
11360 ///
11361 /// # Example
11362 /// ```ignore,no_run
11363 /// # use google_cloud_documentai_v1::model::GetProcessorTypeRequest;
11364 /// let x = GetProcessorTypeRequest::new().set_name("example");
11365 /// ```
11366 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11367 self.name = v.into();
11368 self
11369 }
11370}
11371
11372impl wkt::message::Message for GetProcessorTypeRequest {
11373 fn typename() -> &'static str {
11374 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
11375 }
11376}
11377
11378/// Request message for the
11379/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
11380/// method.
11381///
11382/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
11383#[derive(Clone, Default, PartialEq)]
11384#[non_exhaustive]
11385pub struct GetProcessorRequest {
11386 /// Required. The processor resource name.
11387 pub name: std::string::String,
11388
11389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11390}
11391
11392impl GetProcessorRequest {
11393 pub fn new() -> Self {
11394 std::default::Default::default()
11395 }
11396
11397 /// Sets the value of [name][crate::model::GetProcessorRequest::name].
11398 ///
11399 /// # Example
11400 /// ```ignore,no_run
11401 /// # use google_cloud_documentai_v1::model::GetProcessorRequest;
11402 /// let x = GetProcessorRequest::new().set_name("example");
11403 /// ```
11404 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11405 self.name = v.into();
11406 self
11407 }
11408}
11409
11410impl wkt::message::Message for GetProcessorRequest {
11411 fn typename() -> &'static str {
11412 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
11413 }
11414}
11415
11416/// Request message for the
11417/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
11418/// method.
11419///
11420/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
11421#[derive(Clone, Default, PartialEq)]
11422#[non_exhaustive]
11423pub struct GetProcessorVersionRequest {
11424 /// Required. The processor resource name.
11425 pub name: std::string::String,
11426
11427 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11428}
11429
11430impl GetProcessorVersionRequest {
11431 pub fn new() -> Self {
11432 std::default::Default::default()
11433 }
11434
11435 /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
11436 ///
11437 /// # Example
11438 /// ```ignore,no_run
11439 /// # use google_cloud_documentai_v1::model::GetProcessorVersionRequest;
11440 /// let x = GetProcessorVersionRequest::new().set_name("example");
11441 /// ```
11442 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11443 self.name = v.into();
11444 self
11445 }
11446}
11447
11448impl wkt::message::Message for GetProcessorVersionRequest {
11449 fn typename() -> &'static str {
11450 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
11451 }
11452}
11453
11454/// Request message for list all processor versions belongs to a processor.
11455#[derive(Clone, Default, PartialEq)]
11456#[non_exhaustive]
11457pub struct ListProcessorVersionsRequest {
11458 /// Required. The parent (project, location and processor) to list all
11459 /// versions. Format:
11460 /// `projects/{project}/locations/{location}/processors/{processor}`
11461 pub parent: std::string::String,
11462
11463 /// The maximum number of processor versions to return.
11464 /// If unspecified, at most `10` processor versions will be returned.
11465 /// The maximum value is `20`. Values above `20` will be coerced to `20`.
11466 pub page_size: i32,
11467
11468 /// We will return the processor versions sorted by creation time. The page
11469 /// token will point to the next processor version.
11470 pub page_token: std::string::String,
11471
11472 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11473}
11474
11475impl ListProcessorVersionsRequest {
11476 pub fn new() -> Self {
11477 std::default::Default::default()
11478 }
11479
11480 /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
11481 ///
11482 /// # Example
11483 /// ```ignore,no_run
11484 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
11485 /// let x = ListProcessorVersionsRequest::new().set_parent("example");
11486 /// ```
11487 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11488 self.parent = v.into();
11489 self
11490 }
11491
11492 /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
11493 ///
11494 /// # Example
11495 /// ```ignore,no_run
11496 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
11497 /// let x = ListProcessorVersionsRequest::new().set_page_size(42);
11498 /// ```
11499 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
11500 self.page_size = v.into();
11501 self
11502 }
11503
11504 /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
11505 ///
11506 /// # Example
11507 /// ```ignore,no_run
11508 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
11509 /// let x = ListProcessorVersionsRequest::new().set_page_token("example");
11510 /// ```
11511 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11512 self.page_token = v.into();
11513 self
11514 }
11515}
11516
11517impl wkt::message::Message for ListProcessorVersionsRequest {
11518 fn typename() -> &'static str {
11519 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
11520 }
11521}
11522
11523/// Response message for the
11524/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
11525/// method.
11526///
11527/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
11528#[derive(Clone, Default, PartialEq)]
11529#[non_exhaustive]
11530pub struct ListProcessorVersionsResponse {
11531 /// The list of processors.
11532 pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
11533
11534 /// Points to the next processor, otherwise empty.
11535 pub next_page_token: std::string::String,
11536
11537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11538}
11539
11540impl ListProcessorVersionsResponse {
11541 pub fn new() -> Self {
11542 std::default::Default::default()
11543 }
11544
11545 /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
11546 ///
11547 /// # Example
11548 /// ```ignore,no_run
11549 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
11550 /// use google_cloud_documentai_v1::model::ProcessorVersion;
11551 /// let x = ListProcessorVersionsResponse::new()
11552 /// .set_processor_versions([
11553 /// ProcessorVersion::default()/* use setters */,
11554 /// ProcessorVersion::default()/* use (different) setters */,
11555 /// ]);
11556 /// ```
11557 pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
11558 where
11559 T: std::iter::IntoIterator<Item = V>,
11560 V: std::convert::Into<crate::model::ProcessorVersion>,
11561 {
11562 use std::iter::Iterator;
11563 self.processor_versions = v.into_iter().map(|i| i.into()).collect();
11564 self
11565 }
11566
11567 /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
11568 ///
11569 /// # Example
11570 /// ```ignore,no_run
11571 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
11572 /// let x = ListProcessorVersionsResponse::new().set_next_page_token("example");
11573 /// ```
11574 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11575 self.next_page_token = v.into();
11576 self
11577 }
11578}
11579
11580impl wkt::message::Message for ListProcessorVersionsResponse {
11581 fn typename() -> &'static str {
11582 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
11583 }
11584}
11585
11586#[doc(hidden)]
11587impl gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
11588 type PageItem = crate::model::ProcessorVersion;
11589
11590 fn items(self) -> std::vec::Vec<Self::PageItem> {
11591 self.processor_versions
11592 }
11593
11594 fn next_page_token(&self) -> std::string::String {
11595 use std::clone::Clone;
11596 self.next_page_token.clone()
11597 }
11598}
11599
11600/// Request message for the
11601/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
11602/// method.
11603///
11604/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
11605#[derive(Clone, Default, PartialEq)]
11606#[non_exhaustive]
11607pub struct DeleteProcessorVersionRequest {
11608 /// Required. The processor version resource name to be deleted.
11609 pub name: std::string::String,
11610
11611 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11612}
11613
11614impl DeleteProcessorVersionRequest {
11615 pub fn new() -> Self {
11616 std::default::Default::default()
11617 }
11618
11619 /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
11620 ///
11621 /// # Example
11622 /// ```ignore,no_run
11623 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionRequest;
11624 /// let x = DeleteProcessorVersionRequest::new().set_name("example");
11625 /// ```
11626 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11627 self.name = v.into();
11628 self
11629 }
11630}
11631
11632impl wkt::message::Message for DeleteProcessorVersionRequest {
11633 fn typename() -> &'static str {
11634 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
11635 }
11636}
11637
11638/// The long-running operation metadata for the
11639/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
11640/// method.
11641///
11642/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
11643#[derive(Clone, Default, PartialEq)]
11644#[non_exhaustive]
11645pub struct DeleteProcessorVersionMetadata {
11646 /// The basic metadata of the long-running operation.
11647 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
11648
11649 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11650}
11651
11652impl DeleteProcessorVersionMetadata {
11653 pub fn new() -> Self {
11654 std::default::Default::default()
11655 }
11656
11657 /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
11658 ///
11659 /// # Example
11660 /// ```ignore,no_run
11661 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
11662 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11663 /// let x = DeleteProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
11664 /// ```
11665 pub fn set_common_metadata<T>(mut self, v: T) -> Self
11666 where
11667 T: std::convert::Into<crate::model::CommonOperationMetadata>,
11668 {
11669 self.common_metadata = std::option::Option::Some(v.into());
11670 self
11671 }
11672
11673 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
11674 ///
11675 /// # Example
11676 /// ```ignore,no_run
11677 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
11678 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11679 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
11680 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
11681 /// ```
11682 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
11683 where
11684 T: std::convert::Into<crate::model::CommonOperationMetadata>,
11685 {
11686 self.common_metadata = v.map(|x| x.into());
11687 self
11688 }
11689}
11690
11691impl wkt::message::Message for DeleteProcessorVersionMetadata {
11692 fn typename() -> &'static str {
11693 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
11694 }
11695}
11696
11697/// Request message for the
11698/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
11699/// method.
11700///
11701/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
11702#[derive(Clone, Default, PartialEq)]
11703#[non_exhaustive]
11704pub struct DeployProcessorVersionRequest {
11705 /// Required. The processor version resource name to be deployed.
11706 pub name: std::string::String,
11707
11708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11709}
11710
11711impl DeployProcessorVersionRequest {
11712 pub fn new() -> Self {
11713 std::default::Default::default()
11714 }
11715
11716 /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
11717 ///
11718 /// # Example
11719 /// ```ignore,no_run
11720 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionRequest;
11721 /// let x = DeployProcessorVersionRequest::new().set_name("example");
11722 /// ```
11723 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11724 self.name = v.into();
11725 self
11726 }
11727}
11728
11729impl wkt::message::Message for DeployProcessorVersionRequest {
11730 fn typename() -> &'static str {
11731 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
11732 }
11733}
11734
11735/// Response message for the
11736/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
11737/// method.
11738///
11739/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
11740#[derive(Clone, Default, PartialEq)]
11741#[non_exhaustive]
11742pub struct DeployProcessorVersionResponse {
11743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11744}
11745
11746impl DeployProcessorVersionResponse {
11747 pub fn new() -> Self {
11748 std::default::Default::default()
11749 }
11750}
11751
11752impl wkt::message::Message for DeployProcessorVersionResponse {
11753 fn typename() -> &'static str {
11754 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
11755 }
11756}
11757
11758/// The long-running operation metadata for the
11759/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
11760/// method.
11761///
11762/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
11763#[derive(Clone, Default, PartialEq)]
11764#[non_exhaustive]
11765pub struct DeployProcessorVersionMetadata {
11766 /// The basic metadata of the long-running operation.
11767 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
11768
11769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11770}
11771
11772impl DeployProcessorVersionMetadata {
11773 pub fn new() -> Self {
11774 std::default::Default::default()
11775 }
11776
11777 /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
11778 ///
11779 /// # Example
11780 /// ```ignore,no_run
11781 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
11782 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11783 /// let x = DeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
11784 /// ```
11785 pub fn set_common_metadata<T>(mut self, v: T) -> Self
11786 where
11787 T: std::convert::Into<crate::model::CommonOperationMetadata>,
11788 {
11789 self.common_metadata = std::option::Option::Some(v.into());
11790 self
11791 }
11792
11793 /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
11794 ///
11795 /// # Example
11796 /// ```ignore,no_run
11797 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
11798 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11799 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
11800 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
11801 /// ```
11802 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
11803 where
11804 T: std::convert::Into<crate::model::CommonOperationMetadata>,
11805 {
11806 self.common_metadata = v.map(|x| x.into());
11807 self
11808 }
11809}
11810
11811impl wkt::message::Message for DeployProcessorVersionMetadata {
11812 fn typename() -> &'static str {
11813 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
11814 }
11815}
11816
11817/// Request message for the
11818/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
11819/// method.
11820///
11821/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
11822#[derive(Clone, Default, PartialEq)]
11823#[non_exhaustive]
11824pub struct UndeployProcessorVersionRequest {
11825 /// Required. The processor version resource name to be undeployed.
11826 pub name: std::string::String,
11827
11828 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11829}
11830
11831impl UndeployProcessorVersionRequest {
11832 pub fn new() -> Self {
11833 std::default::Default::default()
11834 }
11835
11836 /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
11837 ///
11838 /// # Example
11839 /// ```ignore,no_run
11840 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionRequest;
11841 /// let x = UndeployProcessorVersionRequest::new().set_name("example");
11842 /// ```
11843 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11844 self.name = v.into();
11845 self
11846 }
11847}
11848
11849impl wkt::message::Message for UndeployProcessorVersionRequest {
11850 fn typename() -> &'static str {
11851 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
11852 }
11853}
11854
11855/// Response message for the
11856/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
11857/// method.
11858///
11859/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
11860#[derive(Clone, Default, PartialEq)]
11861#[non_exhaustive]
11862pub struct UndeployProcessorVersionResponse {
11863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11864}
11865
11866impl UndeployProcessorVersionResponse {
11867 pub fn new() -> Self {
11868 std::default::Default::default()
11869 }
11870}
11871
11872impl wkt::message::Message for UndeployProcessorVersionResponse {
11873 fn typename() -> &'static str {
11874 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
11875 }
11876}
11877
11878/// The long-running operation metadata for the
11879/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
11880/// method.
11881///
11882/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
11883#[derive(Clone, Default, PartialEq)]
11884#[non_exhaustive]
11885pub struct UndeployProcessorVersionMetadata {
11886 /// The basic metadata of the long-running operation.
11887 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
11888
11889 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11890}
11891
11892impl UndeployProcessorVersionMetadata {
11893 pub fn new() -> Self {
11894 std::default::Default::default()
11895 }
11896
11897 /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
11898 ///
11899 /// # Example
11900 /// ```ignore,no_run
11901 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
11902 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11903 /// let x = UndeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
11904 /// ```
11905 pub fn set_common_metadata<T>(mut self, v: T) -> Self
11906 where
11907 T: std::convert::Into<crate::model::CommonOperationMetadata>,
11908 {
11909 self.common_metadata = std::option::Option::Some(v.into());
11910 self
11911 }
11912
11913 /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
11914 ///
11915 /// # Example
11916 /// ```ignore,no_run
11917 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
11918 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
11919 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
11920 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
11921 /// ```
11922 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
11923 where
11924 T: std::convert::Into<crate::model::CommonOperationMetadata>,
11925 {
11926 self.common_metadata = v.map(|x| x.into());
11927 self
11928 }
11929}
11930
11931impl wkt::message::Message for UndeployProcessorVersionMetadata {
11932 fn typename() -> &'static str {
11933 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
11934 }
11935}
11936
11937/// Request message for the
11938/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
11939/// method. Notice this request is sent to a regionalized backend service. If the
11940/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
11941/// that region, the creation fails.
11942///
11943/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
11944/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
11945#[derive(Clone, Default, PartialEq)]
11946#[non_exhaustive]
11947pub struct CreateProcessorRequest {
11948 /// Required. The parent (project and location) under which to create the
11949 /// processor. Format: `projects/{project}/locations/{location}`
11950 pub parent: std::string::String,
11951
11952 /// Required. The processor to be created, requires
11953 /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
11954 /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
11955 /// to be set. Also, the
11956 /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
11957 /// field must be set if the processor is under CMEK.
11958 ///
11959 /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
11960 /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
11961 /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
11962 pub processor: std::option::Option<crate::model::Processor>,
11963
11964 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11965}
11966
11967impl CreateProcessorRequest {
11968 pub fn new() -> Self {
11969 std::default::Default::default()
11970 }
11971
11972 /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
11973 ///
11974 /// # Example
11975 /// ```ignore,no_run
11976 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
11977 /// let x = CreateProcessorRequest::new().set_parent("example");
11978 /// ```
11979 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11980 self.parent = v.into();
11981 self
11982 }
11983
11984 /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
11985 ///
11986 /// # Example
11987 /// ```ignore,no_run
11988 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
11989 /// use google_cloud_documentai_v1::model::Processor;
11990 /// let x = CreateProcessorRequest::new().set_processor(Processor::default()/* use setters */);
11991 /// ```
11992 pub fn set_processor<T>(mut self, v: T) -> Self
11993 where
11994 T: std::convert::Into<crate::model::Processor>,
11995 {
11996 self.processor = std::option::Option::Some(v.into());
11997 self
11998 }
11999
12000 /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
12001 ///
12002 /// # Example
12003 /// ```ignore,no_run
12004 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12005 /// use google_cloud_documentai_v1::model::Processor;
12006 /// let x = CreateProcessorRequest::new().set_or_clear_processor(Some(Processor::default()/* use setters */));
12007 /// let x = CreateProcessorRequest::new().set_or_clear_processor(None::<Processor>);
12008 /// ```
12009 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
12010 where
12011 T: std::convert::Into<crate::model::Processor>,
12012 {
12013 self.processor = v.map(|x| x.into());
12014 self
12015 }
12016}
12017
12018impl wkt::message::Message for CreateProcessorRequest {
12019 fn typename() -> &'static str {
12020 "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
12021 }
12022}
12023
12024/// Request message for the
12025/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
12026/// method.
12027///
12028/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
12029#[derive(Clone, Default, PartialEq)]
12030#[non_exhaustive]
12031pub struct DeleteProcessorRequest {
12032 /// Required. The processor resource name to be deleted.
12033 pub name: std::string::String,
12034
12035 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12036}
12037
12038impl DeleteProcessorRequest {
12039 pub fn new() -> Self {
12040 std::default::Default::default()
12041 }
12042
12043 /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
12044 ///
12045 /// # Example
12046 /// ```ignore,no_run
12047 /// # use google_cloud_documentai_v1::model::DeleteProcessorRequest;
12048 /// let x = DeleteProcessorRequest::new().set_name("example");
12049 /// ```
12050 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12051 self.name = v.into();
12052 self
12053 }
12054}
12055
12056impl wkt::message::Message for DeleteProcessorRequest {
12057 fn typename() -> &'static str {
12058 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
12059 }
12060}
12061
12062/// The long-running operation metadata for the
12063/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
12064/// method.
12065///
12066/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
12067#[derive(Clone, Default, PartialEq)]
12068#[non_exhaustive]
12069pub struct DeleteProcessorMetadata {
12070 /// The basic metadata of the long-running operation.
12071 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12072
12073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12074}
12075
12076impl DeleteProcessorMetadata {
12077 pub fn new() -> Self {
12078 std::default::Default::default()
12079 }
12080
12081 /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
12082 ///
12083 /// # Example
12084 /// ```ignore,no_run
12085 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
12086 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12087 /// let x = DeleteProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12088 /// ```
12089 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12090 where
12091 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12092 {
12093 self.common_metadata = std::option::Option::Some(v.into());
12094 self
12095 }
12096
12097 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
12098 ///
12099 /// # Example
12100 /// ```ignore,no_run
12101 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
12102 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12103 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12104 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12105 /// ```
12106 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12107 where
12108 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12109 {
12110 self.common_metadata = v.map(|x| x.into());
12111 self
12112 }
12113}
12114
12115impl wkt::message::Message for DeleteProcessorMetadata {
12116 fn typename() -> &'static str {
12117 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
12118 }
12119}
12120
12121/// Request message for the
12122/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
12123/// method.
12124///
12125/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
12126#[derive(Clone, Default, PartialEq)]
12127#[non_exhaustive]
12128pub struct EnableProcessorRequest {
12129 /// Required. The processor resource name to be enabled.
12130 pub name: std::string::String,
12131
12132 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12133}
12134
12135impl EnableProcessorRequest {
12136 pub fn new() -> Self {
12137 std::default::Default::default()
12138 }
12139
12140 /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
12141 ///
12142 /// # Example
12143 /// ```ignore,no_run
12144 /// # use google_cloud_documentai_v1::model::EnableProcessorRequest;
12145 /// let x = EnableProcessorRequest::new().set_name("example");
12146 /// ```
12147 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12148 self.name = v.into();
12149 self
12150 }
12151}
12152
12153impl wkt::message::Message for EnableProcessorRequest {
12154 fn typename() -> &'static str {
12155 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
12156 }
12157}
12158
12159/// Response message for the
12160/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
12161/// method. Intentionally empty proto for adding fields in future.
12162///
12163/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
12164#[derive(Clone, Default, PartialEq)]
12165#[non_exhaustive]
12166pub struct EnableProcessorResponse {
12167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12168}
12169
12170impl EnableProcessorResponse {
12171 pub fn new() -> Self {
12172 std::default::Default::default()
12173 }
12174}
12175
12176impl wkt::message::Message for EnableProcessorResponse {
12177 fn typename() -> &'static str {
12178 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
12179 }
12180}
12181
12182/// The long-running operation metadata for the
12183/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
12184/// method.
12185///
12186/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
12187#[derive(Clone, Default, PartialEq)]
12188#[non_exhaustive]
12189pub struct EnableProcessorMetadata {
12190 /// The basic metadata of the long-running operation.
12191 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12192
12193 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12194}
12195
12196impl EnableProcessorMetadata {
12197 pub fn new() -> Self {
12198 std::default::Default::default()
12199 }
12200
12201 /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
12202 ///
12203 /// # Example
12204 /// ```ignore,no_run
12205 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
12206 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12207 /// let x = EnableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12208 /// ```
12209 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12210 where
12211 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12212 {
12213 self.common_metadata = std::option::Option::Some(v.into());
12214 self
12215 }
12216
12217 /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
12218 ///
12219 /// # Example
12220 /// ```ignore,no_run
12221 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
12222 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12223 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12224 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12225 /// ```
12226 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12227 where
12228 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12229 {
12230 self.common_metadata = v.map(|x| x.into());
12231 self
12232 }
12233}
12234
12235impl wkt::message::Message for EnableProcessorMetadata {
12236 fn typename() -> &'static str {
12237 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
12238 }
12239}
12240
12241/// Request message for the
12242/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
12243/// method.
12244///
12245/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
12246#[derive(Clone, Default, PartialEq)]
12247#[non_exhaustive]
12248pub struct DisableProcessorRequest {
12249 /// Required. The processor resource name to be disabled.
12250 pub name: std::string::String,
12251
12252 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12253}
12254
12255impl DisableProcessorRequest {
12256 pub fn new() -> Self {
12257 std::default::Default::default()
12258 }
12259
12260 /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
12261 ///
12262 /// # Example
12263 /// ```ignore,no_run
12264 /// # use google_cloud_documentai_v1::model::DisableProcessorRequest;
12265 /// let x = DisableProcessorRequest::new().set_name("example");
12266 /// ```
12267 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12268 self.name = v.into();
12269 self
12270 }
12271}
12272
12273impl wkt::message::Message for DisableProcessorRequest {
12274 fn typename() -> &'static str {
12275 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
12276 }
12277}
12278
12279/// Response message for the
12280/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
12281/// method. Intentionally empty proto for adding fields in future.
12282///
12283/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
12284#[derive(Clone, Default, PartialEq)]
12285#[non_exhaustive]
12286pub struct DisableProcessorResponse {
12287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12288}
12289
12290impl DisableProcessorResponse {
12291 pub fn new() -> Self {
12292 std::default::Default::default()
12293 }
12294}
12295
12296impl wkt::message::Message for DisableProcessorResponse {
12297 fn typename() -> &'static str {
12298 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
12299 }
12300}
12301
12302/// The long-running operation metadata for the
12303/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
12304/// method.
12305///
12306/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
12307#[derive(Clone, Default, PartialEq)]
12308#[non_exhaustive]
12309pub struct DisableProcessorMetadata {
12310 /// The basic metadata of the long-running operation.
12311 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12312
12313 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12314}
12315
12316impl DisableProcessorMetadata {
12317 pub fn new() -> Self {
12318 std::default::Default::default()
12319 }
12320
12321 /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
12322 ///
12323 /// # Example
12324 /// ```ignore,no_run
12325 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
12326 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12327 /// let x = DisableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12328 /// ```
12329 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12330 where
12331 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12332 {
12333 self.common_metadata = std::option::Option::Some(v.into());
12334 self
12335 }
12336
12337 /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
12338 ///
12339 /// # Example
12340 /// ```ignore,no_run
12341 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
12342 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12343 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12344 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12345 /// ```
12346 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12347 where
12348 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12349 {
12350 self.common_metadata = v.map(|x| x.into());
12351 self
12352 }
12353}
12354
12355impl wkt::message::Message for DisableProcessorMetadata {
12356 fn typename() -> &'static str {
12357 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
12358 }
12359}
12360
12361/// Request message for the
12362/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
12363/// method.
12364///
12365/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
12366#[derive(Clone, Default, PartialEq)]
12367#[non_exhaustive]
12368pub struct SetDefaultProcessorVersionRequest {
12369 /// Required. The resource name of the
12370 /// [Processor][google.cloud.documentai.v1.Processor] to change default
12371 /// version.
12372 ///
12373 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
12374 pub processor: std::string::String,
12375
12376 /// Required. The resource name of child
12377 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
12378 /// default. Format:
12379 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
12380 ///
12381 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
12382 pub default_processor_version: std::string::String,
12383
12384 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12385}
12386
12387impl SetDefaultProcessorVersionRequest {
12388 pub fn new() -> Self {
12389 std::default::Default::default()
12390 }
12391
12392 /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
12393 ///
12394 /// # Example
12395 /// ```ignore,no_run
12396 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
12397 /// let x = SetDefaultProcessorVersionRequest::new().set_processor("example");
12398 /// ```
12399 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12400 self.processor = v.into();
12401 self
12402 }
12403
12404 /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
12405 ///
12406 /// # Example
12407 /// ```ignore,no_run
12408 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
12409 /// let x = SetDefaultProcessorVersionRequest::new().set_default_processor_version("example");
12410 /// ```
12411 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
12412 mut self,
12413 v: T,
12414 ) -> Self {
12415 self.default_processor_version = v.into();
12416 self
12417 }
12418}
12419
12420impl wkt::message::Message for SetDefaultProcessorVersionRequest {
12421 fn typename() -> &'static str {
12422 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
12423 }
12424}
12425
12426/// Response message for the
12427/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
12428/// method.
12429///
12430/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
12431#[derive(Clone, Default, PartialEq)]
12432#[non_exhaustive]
12433pub struct SetDefaultProcessorVersionResponse {
12434 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12435}
12436
12437impl SetDefaultProcessorVersionResponse {
12438 pub fn new() -> Self {
12439 std::default::Default::default()
12440 }
12441}
12442
12443impl wkt::message::Message for SetDefaultProcessorVersionResponse {
12444 fn typename() -> &'static str {
12445 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
12446 }
12447}
12448
12449/// The long-running operation metadata for the
12450/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
12451/// method.
12452///
12453/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
12454#[derive(Clone, Default, PartialEq)]
12455#[non_exhaustive]
12456pub struct SetDefaultProcessorVersionMetadata {
12457 /// The basic metadata of the long-running operation.
12458 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12459
12460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12461}
12462
12463impl SetDefaultProcessorVersionMetadata {
12464 pub fn new() -> Self {
12465 std::default::Default::default()
12466 }
12467
12468 /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
12469 ///
12470 /// # Example
12471 /// ```ignore,no_run
12472 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
12473 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12474 /// let x = SetDefaultProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12475 /// ```
12476 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12477 where
12478 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12479 {
12480 self.common_metadata = std::option::Option::Some(v.into());
12481 self
12482 }
12483
12484 /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
12485 ///
12486 /// # Example
12487 /// ```ignore,no_run
12488 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
12489 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12490 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12491 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12492 /// ```
12493 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12494 where
12495 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12496 {
12497 self.common_metadata = v.map(|x| x.into());
12498 self
12499 }
12500}
12501
12502impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
12503 fn typename() -> &'static str {
12504 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
12505 }
12506}
12507
12508/// Request message for the
12509/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
12510/// method.
12511///
12512/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
12513#[derive(Clone, Default, PartialEq)]
12514#[non_exhaustive]
12515pub struct TrainProcessorVersionRequest {
12516 /// Required. The parent (project, location and processor) to create the new
12517 /// version for. Format:
12518 /// `projects/{project}/locations/{location}/processors/{processor}`.
12519 pub parent: std::string::String,
12520
12521 /// Required. The processor version to be created.
12522 pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
12523
12524 /// Optional. The schema the processor version will be trained with.
12525 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
12526
12527 /// Optional. The input data used to train the
12528 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
12529 ///
12530 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
12531 pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
12532
12533 /// Optional. The processor version to use as a base for training. This
12534 /// processor version must be a child of `parent`. Format:
12535 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
12536 pub base_processor_version: std::string::String,
12537
12538 pub processor_flags:
12539 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
12540
12541 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12542}
12543
12544impl TrainProcessorVersionRequest {
12545 pub fn new() -> Self {
12546 std::default::Default::default()
12547 }
12548
12549 /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
12550 ///
12551 /// # Example
12552 /// ```ignore,no_run
12553 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12554 /// let x = TrainProcessorVersionRequest::new().set_parent("example");
12555 /// ```
12556 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12557 self.parent = v.into();
12558 self
12559 }
12560
12561 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
12562 ///
12563 /// # Example
12564 /// ```ignore,no_run
12565 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12566 /// use google_cloud_documentai_v1::model::ProcessorVersion;
12567 /// let x = TrainProcessorVersionRequest::new().set_processor_version(ProcessorVersion::default()/* use setters */);
12568 /// ```
12569 pub fn set_processor_version<T>(mut self, v: T) -> Self
12570 where
12571 T: std::convert::Into<crate::model::ProcessorVersion>,
12572 {
12573 self.processor_version = std::option::Option::Some(v.into());
12574 self
12575 }
12576
12577 /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
12578 ///
12579 /// # Example
12580 /// ```ignore,no_run
12581 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12582 /// use google_cloud_documentai_v1::model::ProcessorVersion;
12583 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(Some(ProcessorVersion::default()/* use setters */));
12584 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(None::<ProcessorVersion>);
12585 /// ```
12586 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
12587 where
12588 T: std::convert::Into<crate::model::ProcessorVersion>,
12589 {
12590 self.processor_version = v.map(|x| x.into());
12591 self
12592 }
12593
12594 /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
12595 ///
12596 /// # Example
12597 /// ```ignore,no_run
12598 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12599 /// use google_cloud_documentai_v1::model::DocumentSchema;
12600 /// let x = TrainProcessorVersionRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
12601 /// ```
12602 pub fn set_document_schema<T>(mut self, v: T) -> Self
12603 where
12604 T: std::convert::Into<crate::model::DocumentSchema>,
12605 {
12606 self.document_schema = std::option::Option::Some(v.into());
12607 self
12608 }
12609
12610 /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
12611 ///
12612 /// # Example
12613 /// ```ignore,no_run
12614 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12615 /// use google_cloud_documentai_v1::model::DocumentSchema;
12616 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
12617 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
12618 /// ```
12619 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
12620 where
12621 T: std::convert::Into<crate::model::DocumentSchema>,
12622 {
12623 self.document_schema = v.map(|x| x.into());
12624 self
12625 }
12626
12627 /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
12628 ///
12629 /// # Example
12630 /// ```ignore,no_run
12631 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12632 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12633 /// let x = TrainProcessorVersionRequest::new().set_input_data(InputData::default()/* use setters */);
12634 /// ```
12635 pub fn set_input_data<T>(mut self, v: T) -> Self
12636 where
12637 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
12638 {
12639 self.input_data = std::option::Option::Some(v.into());
12640 self
12641 }
12642
12643 /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
12644 ///
12645 /// # Example
12646 /// ```ignore,no_run
12647 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12648 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12649 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(Some(InputData::default()/* use setters */));
12650 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(None::<InputData>);
12651 /// ```
12652 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
12653 where
12654 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
12655 {
12656 self.input_data = v.map(|x| x.into());
12657 self
12658 }
12659
12660 /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
12661 ///
12662 /// # Example
12663 /// ```ignore,no_run
12664 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12665 /// let x = TrainProcessorVersionRequest::new().set_base_processor_version("example");
12666 /// ```
12667 pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
12668 mut self,
12669 v: T,
12670 ) -> Self {
12671 self.base_processor_version = v.into();
12672 self
12673 }
12674
12675 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
12676 ///
12677 /// Note that all the setters affecting `processor_flags` are mutually
12678 /// exclusive.
12679 ///
12680 /// # Example
12681 /// ```ignore,no_run
12682 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12683 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
12684 /// let x = TrainProcessorVersionRequest::new().set_processor_flags(Some(
12685 /// google_cloud_documentai_v1::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(CustomDocumentExtractionOptions::default().into())));
12686 /// ```
12687 pub fn set_processor_flags<
12688 T: std::convert::Into<
12689 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
12690 >,
12691 >(
12692 mut self,
12693 v: T,
12694 ) -> Self {
12695 self.processor_flags = v.into();
12696 self
12697 }
12698
12699 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12700 /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
12701 /// holds a different branch.
12702 pub fn custom_document_extraction_options(
12703 &self,
12704 ) -> std::option::Option<
12705 &std::boxed::Box<
12706 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
12707 >,
12708 > {
12709 #[allow(unreachable_patterns)]
12710 self.processor_flags.as_ref().and_then(|v| match v {
12711 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
12712 _ => std::option::Option::None,
12713 })
12714 }
12715
12716 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12717 /// to hold a `CustomDocumentExtractionOptions`.
12718 ///
12719 /// Note that all the setters affecting `processor_flags` are
12720 /// mutually exclusive.
12721 ///
12722 /// # Example
12723 /// ```ignore,no_run
12724 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12725 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
12726 /// let x = TrainProcessorVersionRequest::new().set_custom_document_extraction_options(CustomDocumentExtractionOptions::default()/* use setters */);
12727 /// assert!(x.custom_document_extraction_options().is_some());
12728 /// assert!(x.foundation_model_tuning_options().is_none());
12729 /// ```
12730 pub fn set_custom_document_extraction_options<
12731 T: std::convert::Into<
12732 std::boxed::Box<
12733 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
12734 >,
12735 >,
12736 >(
12737 mut self,
12738 v: T,
12739 ) -> Self {
12740 self.processor_flags = std::option::Option::Some(
12741 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
12742 v.into()
12743 )
12744 );
12745 self
12746 }
12747
12748 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12749 /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
12750 /// holds a different branch.
12751 pub fn foundation_model_tuning_options(
12752 &self,
12753 ) -> std::option::Option<
12754 &std::boxed::Box<
12755 crate::model::train_processor_version_request::FoundationModelTuningOptions,
12756 >,
12757 > {
12758 #[allow(unreachable_patterns)]
12759 self.processor_flags.as_ref().and_then(|v| match v {
12760 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
12761 _ => std::option::Option::None,
12762 })
12763 }
12764
12765 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
12766 /// to hold a `FoundationModelTuningOptions`.
12767 ///
12768 /// Note that all the setters affecting `processor_flags` are
12769 /// mutually exclusive.
12770 ///
12771 /// # Example
12772 /// ```ignore,no_run
12773 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
12774 /// use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
12775 /// let x = TrainProcessorVersionRequest::new().set_foundation_model_tuning_options(FoundationModelTuningOptions::default()/* use setters */);
12776 /// assert!(x.foundation_model_tuning_options().is_some());
12777 /// assert!(x.custom_document_extraction_options().is_none());
12778 /// ```
12779 pub fn set_foundation_model_tuning_options<
12780 T: std::convert::Into<
12781 std::boxed::Box<
12782 crate::model::train_processor_version_request::FoundationModelTuningOptions,
12783 >,
12784 >,
12785 >(
12786 mut self,
12787 v: T,
12788 ) -> Self {
12789 self.processor_flags = std::option::Option::Some(
12790 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
12791 v.into()
12792 )
12793 );
12794 self
12795 }
12796}
12797
12798impl wkt::message::Message for TrainProcessorVersionRequest {
12799 fn typename() -> &'static str {
12800 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
12801 }
12802}
12803
12804/// Defines additional types related to [TrainProcessorVersionRequest].
12805pub mod train_processor_version_request {
12806 #[allow(unused_imports)]
12807 use super::*;
12808
12809 /// The input data used to train a new
12810 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
12811 ///
12812 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
12813 #[derive(Clone, Default, PartialEq)]
12814 #[non_exhaustive]
12815 pub struct InputData {
12816 /// The documents used for training the new version.
12817 pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
12818
12819 /// The documents used for testing the trained version.
12820 pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
12821
12822 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12823 }
12824
12825 impl InputData {
12826 pub fn new() -> Self {
12827 std::default::Default::default()
12828 }
12829
12830 /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
12831 ///
12832 /// # Example
12833 /// ```ignore,no_run
12834 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12835 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12836 /// let x = InputData::new().set_training_documents(BatchDocumentsInputConfig::default()/* use setters */);
12837 /// ```
12838 pub fn set_training_documents<T>(mut self, v: T) -> Self
12839 where
12840 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12841 {
12842 self.training_documents = std::option::Option::Some(v.into());
12843 self
12844 }
12845
12846 /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
12847 ///
12848 /// # Example
12849 /// ```ignore,no_run
12850 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12851 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12852 /// let x = InputData::new().set_or_clear_training_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
12853 /// let x = InputData::new().set_or_clear_training_documents(None::<BatchDocumentsInputConfig>);
12854 /// ```
12855 pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
12856 where
12857 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12858 {
12859 self.training_documents = v.map(|x| x.into());
12860 self
12861 }
12862
12863 /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
12864 ///
12865 /// # Example
12866 /// ```ignore,no_run
12867 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12868 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12869 /// let x = InputData::new().set_test_documents(BatchDocumentsInputConfig::default()/* use setters */);
12870 /// ```
12871 pub fn set_test_documents<T>(mut self, v: T) -> Self
12872 where
12873 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12874 {
12875 self.test_documents = std::option::Option::Some(v.into());
12876 self
12877 }
12878
12879 /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
12880 ///
12881 /// # Example
12882 /// ```ignore,no_run
12883 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
12884 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
12885 /// let x = InputData::new().set_or_clear_test_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
12886 /// let x = InputData::new().set_or_clear_test_documents(None::<BatchDocumentsInputConfig>);
12887 /// ```
12888 pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
12889 where
12890 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
12891 {
12892 self.test_documents = v.map(|x| x.into());
12893 self
12894 }
12895 }
12896
12897 impl wkt::message::Message for InputData {
12898 fn typename() -> &'static str {
12899 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
12900 }
12901 }
12902
12903 /// Options to control the training of the Custom Document Extraction (CDE)
12904 /// Processor.
12905 #[derive(Clone, Default, PartialEq)]
12906 #[non_exhaustive]
12907 pub struct CustomDocumentExtractionOptions {
12908
12909 /// Optional. Training method to use for CDE training.
12910 pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
12911
12912 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12913 }
12914
12915 impl CustomDocumentExtractionOptions {
12916 pub fn new() -> Self {
12917 std::default::Default::default()
12918 }
12919
12920 /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
12921 ///
12922 /// # Example
12923 /// ```ignore,no_run
12924 /// # use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
12925 /// use google_cloud_documentai_v1::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod;
12926 /// let x0 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::ModelBased);
12927 /// let x1 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::TemplateBased);
12928 /// ```
12929 pub fn set_training_method<T: std::convert::Into<crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod>>(mut self, v: T) -> Self{
12930 self.training_method = v.into();
12931 self
12932 }
12933 }
12934
12935 impl wkt::message::Message for CustomDocumentExtractionOptions {
12936 fn typename() -> &'static str {
12937 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
12938 }
12939 }
12940
12941 /// Defines additional types related to [CustomDocumentExtractionOptions].
12942 pub mod custom_document_extraction_options {
12943 #[allow(unused_imports)]
12944 use super::*;
12945
12946 /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
12947 /// `MODEL_BASED`.
12948 ///
12949 /// # Working with unknown values
12950 ///
12951 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
12952 /// additional enum variants at any time. Adding new variants is not considered
12953 /// a breaking change. Applications should write their code in anticipation of:
12954 ///
12955 /// - New values appearing in future releases of the client library, **and**
12956 /// - New values received dynamically, without application changes.
12957 ///
12958 /// Please consult the [Working with enums] section in the user guide for some
12959 /// guidelines.
12960 ///
12961 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
12962 #[derive(Clone, Debug, PartialEq)]
12963 #[non_exhaustive]
12964 pub enum TrainingMethod {
12965 Unspecified,
12966 ModelBased,
12967 TemplateBased,
12968 /// If set, the enum was initialized with an unknown value.
12969 ///
12970 /// Applications can examine the value using [TrainingMethod::value] or
12971 /// [TrainingMethod::name].
12972 UnknownValue(training_method::UnknownValue),
12973 }
12974
12975 #[doc(hidden)]
12976 pub mod training_method {
12977 #[allow(unused_imports)]
12978 use super::*;
12979 #[derive(Clone, Debug, PartialEq)]
12980 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
12981 }
12982
12983 impl TrainingMethod {
12984 /// Gets the enum value.
12985 ///
12986 /// Returns `None` if the enum contains an unknown value deserialized from
12987 /// the string representation of enums.
12988 pub fn value(&self) -> std::option::Option<i32> {
12989 match self {
12990 Self::Unspecified => std::option::Option::Some(0),
12991 Self::ModelBased => std::option::Option::Some(1),
12992 Self::TemplateBased => std::option::Option::Some(2),
12993 Self::UnknownValue(u) => u.0.value(),
12994 }
12995 }
12996
12997 /// Gets the enum value as a string.
12998 ///
12999 /// Returns `None` if the enum contains an unknown value deserialized from
13000 /// the integer representation of enums.
13001 pub fn name(&self) -> std::option::Option<&str> {
13002 match self {
13003 Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
13004 Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
13005 Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
13006 Self::UnknownValue(u) => u.0.name(),
13007 }
13008 }
13009 }
13010
13011 impl std::default::Default for TrainingMethod {
13012 fn default() -> Self {
13013 use std::convert::From;
13014 Self::from(0)
13015 }
13016 }
13017
13018 impl std::fmt::Display for TrainingMethod {
13019 fn fmt(
13020 &self,
13021 f: &mut std::fmt::Formatter<'_>,
13022 ) -> std::result::Result<(), std::fmt::Error> {
13023 wkt::internal::display_enum(f, self.name(), self.value())
13024 }
13025 }
13026
13027 impl std::convert::From<i32> for TrainingMethod {
13028 fn from(value: i32) -> Self {
13029 match value {
13030 0 => Self::Unspecified,
13031 1 => Self::ModelBased,
13032 2 => Self::TemplateBased,
13033 _ => Self::UnknownValue(training_method::UnknownValue(
13034 wkt::internal::UnknownEnumValue::Integer(value),
13035 )),
13036 }
13037 }
13038 }
13039
13040 impl std::convert::From<&str> for TrainingMethod {
13041 fn from(value: &str) -> Self {
13042 use std::string::ToString;
13043 match value {
13044 "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
13045 "MODEL_BASED" => Self::ModelBased,
13046 "TEMPLATE_BASED" => Self::TemplateBased,
13047 _ => Self::UnknownValue(training_method::UnknownValue(
13048 wkt::internal::UnknownEnumValue::String(value.to_string()),
13049 )),
13050 }
13051 }
13052 }
13053
13054 impl serde::ser::Serialize for TrainingMethod {
13055 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13056 where
13057 S: serde::Serializer,
13058 {
13059 match self {
13060 Self::Unspecified => serializer.serialize_i32(0),
13061 Self::ModelBased => serializer.serialize_i32(1),
13062 Self::TemplateBased => serializer.serialize_i32(2),
13063 Self::UnknownValue(u) => u.0.serialize(serializer),
13064 }
13065 }
13066 }
13067
13068 impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
13069 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13070 where
13071 D: serde::Deserializer<'de>,
13072 {
13073 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
13074 ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
13075 }
13076 }
13077 }
13078
13079 /// Options to control foundation model tuning of the processor.
13080 #[derive(Clone, Default, PartialEq)]
13081 #[non_exhaustive]
13082 pub struct FoundationModelTuningOptions {
13083 /// Optional. The number of steps to run for model tuning. Valid values are
13084 /// between 1 and 400. If not provided, recommended steps will be used.
13085 pub train_steps: i32,
13086
13087 /// Optional. The multiplier to apply to the recommended learning rate. Valid
13088 /// values are between 0.1 and 10. If not provided, recommended learning rate
13089 /// will be used.
13090 pub learning_rate_multiplier: f32,
13091
13092 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13093 }
13094
13095 impl FoundationModelTuningOptions {
13096 pub fn new() -> Self {
13097 std::default::Default::default()
13098 }
13099
13100 /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
13101 ///
13102 /// # Example
13103 /// ```ignore,no_run
13104 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13105 /// let x = FoundationModelTuningOptions::new().set_train_steps(42);
13106 /// ```
13107 pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13108 self.train_steps = v.into();
13109 self
13110 }
13111
13112 /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
13113 ///
13114 /// # Example
13115 /// ```ignore,no_run
13116 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13117 /// let x = FoundationModelTuningOptions::new().set_learning_rate_multiplier(42.0);
13118 /// ```
13119 pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
13120 self.learning_rate_multiplier = v.into();
13121 self
13122 }
13123 }
13124
13125 impl wkt::message::Message for FoundationModelTuningOptions {
13126 fn typename() -> &'static str {
13127 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
13128 }
13129 }
13130
13131 #[derive(Clone, Debug, PartialEq)]
13132 #[non_exhaustive]
13133 pub enum ProcessorFlags {
13134 /// Options to control Custom Document Extraction (CDE) Processor.
13135 CustomDocumentExtractionOptions(
13136 std::boxed::Box<
13137 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13138 >,
13139 ),
13140 /// Options to control foundation model tuning of a processor.
13141 FoundationModelTuningOptions(
13142 std::boxed::Box<
13143 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13144 >,
13145 ),
13146 }
13147}
13148
13149/// The response for
13150/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
13151///
13152/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
13153#[derive(Clone, Default, PartialEq)]
13154#[non_exhaustive]
13155pub struct TrainProcessorVersionResponse {
13156 /// The resource name of the processor version produced by training.
13157 pub processor_version: std::string::String,
13158
13159 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13160}
13161
13162impl TrainProcessorVersionResponse {
13163 pub fn new() -> Self {
13164 std::default::Default::default()
13165 }
13166
13167 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
13168 ///
13169 /// # Example
13170 /// ```ignore,no_run
13171 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionResponse;
13172 /// let x = TrainProcessorVersionResponse::new().set_processor_version("example");
13173 /// ```
13174 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
13175 mut self,
13176 v: T,
13177 ) -> Self {
13178 self.processor_version = v.into();
13179 self
13180 }
13181}
13182
13183impl wkt::message::Message for TrainProcessorVersionResponse {
13184 fn typename() -> &'static str {
13185 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
13186 }
13187}
13188
13189/// The metadata that represents a processor version being created.
13190#[derive(Clone, Default, PartialEq)]
13191#[non_exhaustive]
13192pub struct TrainProcessorVersionMetadata {
13193 /// The basic metadata of the long-running operation.
13194 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13195
13196 /// The training dataset validation information.
13197 pub training_dataset_validation:
13198 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
13199
13200 /// The test dataset validation information.
13201 pub test_dataset_validation:
13202 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
13203
13204 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13205}
13206
13207impl TrainProcessorVersionMetadata {
13208 pub fn new() -> Self {
13209 std::default::Default::default()
13210 }
13211
13212 /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
13213 ///
13214 /// # Example
13215 /// ```ignore,no_run
13216 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13217 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13218 /// let x = TrainProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13219 /// ```
13220 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13221 where
13222 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13223 {
13224 self.common_metadata = std::option::Option::Some(v.into());
13225 self
13226 }
13227
13228 /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
13229 ///
13230 /// # Example
13231 /// ```ignore,no_run
13232 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13233 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13234 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13235 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13236 /// ```
13237 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13238 where
13239 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13240 {
13241 self.common_metadata = v.map(|x| x.into());
13242 self
13243 }
13244
13245 /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
13246 ///
13247 /// # Example
13248 /// ```ignore,no_run
13249 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13250 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13251 /// let x = TrainProcessorVersionMetadata::new().set_training_dataset_validation(DatasetValidation::default()/* use setters */);
13252 /// ```
13253 pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
13254 where
13255 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13256 {
13257 self.training_dataset_validation = std::option::Option::Some(v.into());
13258 self
13259 }
13260
13261 /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
13262 ///
13263 /// # Example
13264 /// ```ignore,no_run
13265 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13266 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13267 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(Some(DatasetValidation::default()/* use setters */));
13268 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(None::<DatasetValidation>);
13269 /// ```
13270 pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
13271 where
13272 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13273 {
13274 self.training_dataset_validation = v.map(|x| x.into());
13275 self
13276 }
13277
13278 /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
13279 ///
13280 /// # Example
13281 /// ```ignore,no_run
13282 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13283 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13284 /// let x = TrainProcessorVersionMetadata::new().set_test_dataset_validation(DatasetValidation::default()/* use setters */);
13285 /// ```
13286 pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
13287 where
13288 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13289 {
13290 self.test_dataset_validation = std::option::Option::Some(v.into());
13291 self
13292 }
13293
13294 /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
13295 ///
13296 /// # Example
13297 /// ```ignore,no_run
13298 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
13299 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13300 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(Some(DatasetValidation::default()/* use setters */));
13301 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(None::<DatasetValidation>);
13302 /// ```
13303 pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
13304 where
13305 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
13306 {
13307 self.test_dataset_validation = v.map(|x| x.into());
13308 self
13309 }
13310}
13311
13312impl wkt::message::Message for TrainProcessorVersionMetadata {
13313 fn typename() -> &'static str {
13314 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
13315 }
13316}
13317
13318/// Defines additional types related to [TrainProcessorVersionMetadata].
13319pub mod train_processor_version_metadata {
13320 #[allow(unused_imports)]
13321 use super::*;
13322
13323 /// The dataset validation information.
13324 /// This includes any and all errors with documents and the dataset.
13325 #[derive(Clone, Default, PartialEq)]
13326 #[non_exhaustive]
13327 pub struct DatasetValidation {
13328 /// The total number of document errors.
13329 pub document_error_count: i32,
13330
13331 /// The total number of dataset errors.
13332 pub dataset_error_count: i32,
13333
13334 /// Error information pertaining to specific documents. A maximum of 10
13335 /// document errors will be returned.
13336 /// Any document with errors will not be used throughout training.
13337 pub document_errors: std::vec::Vec<rpc::model::Status>,
13338
13339 /// Error information for the dataset as a whole. A maximum of 10 dataset
13340 /// errors will be returned.
13341 /// A single dataset error is terminal for training.
13342 pub dataset_errors: std::vec::Vec<rpc::model::Status>,
13343
13344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13345 }
13346
13347 impl DatasetValidation {
13348 pub fn new() -> Self {
13349 std::default::Default::default()
13350 }
13351
13352 /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
13353 ///
13354 /// # Example
13355 /// ```ignore,no_run
13356 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13357 /// let x = DatasetValidation::new().set_document_error_count(42);
13358 /// ```
13359 pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13360 self.document_error_count = v.into();
13361 self
13362 }
13363
13364 /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
13365 ///
13366 /// # Example
13367 /// ```ignore,no_run
13368 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13369 /// let x = DatasetValidation::new().set_dataset_error_count(42);
13370 /// ```
13371 pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
13372 self.dataset_error_count = v.into();
13373 self
13374 }
13375
13376 /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
13377 ///
13378 /// # Example
13379 /// ```ignore,no_run
13380 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13381 /// use rpc::model::Status;
13382 /// let x = DatasetValidation::new()
13383 /// .set_document_errors([
13384 /// Status::default()/* use setters */,
13385 /// Status::default()/* use (different) setters */,
13386 /// ]);
13387 /// ```
13388 pub fn set_document_errors<T, V>(mut self, v: T) -> Self
13389 where
13390 T: std::iter::IntoIterator<Item = V>,
13391 V: std::convert::Into<rpc::model::Status>,
13392 {
13393 use std::iter::Iterator;
13394 self.document_errors = v.into_iter().map(|i| i.into()).collect();
13395 self
13396 }
13397
13398 /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
13399 ///
13400 /// # Example
13401 /// ```ignore,no_run
13402 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
13403 /// use rpc::model::Status;
13404 /// let x = DatasetValidation::new()
13405 /// .set_dataset_errors([
13406 /// Status::default()/* use setters */,
13407 /// Status::default()/* use (different) setters */,
13408 /// ]);
13409 /// ```
13410 pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
13411 where
13412 T: std::iter::IntoIterator<Item = V>,
13413 V: std::convert::Into<rpc::model::Status>,
13414 {
13415 use std::iter::Iterator;
13416 self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
13417 self
13418 }
13419 }
13420
13421 impl wkt::message::Message for DatasetValidation {
13422 fn typename() -> &'static str {
13423 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
13424 }
13425 }
13426}
13427
13428/// Request message for the
13429/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
13430/// method.
13431///
13432/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
13433#[derive(Clone, Default, PartialEq)]
13434#[non_exhaustive]
13435pub struct ReviewDocumentRequest {
13436 /// Required. The resource name of the
13437 /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
13438 /// document will be reviewed with.
13439 pub human_review_config: std::string::String,
13440
13441 /// Whether the validation should be performed on the ad-hoc review request.
13442 pub enable_schema_validation: bool,
13443
13444 /// The priority of the human review task.
13445 pub priority: crate::model::review_document_request::Priority,
13446
13447 /// The document schema of the human review task.
13448 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
13449
13450 /// The document payload.
13451 pub source: std::option::Option<crate::model::review_document_request::Source>,
13452
13453 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13454}
13455
13456impl ReviewDocumentRequest {
13457 pub fn new() -> Self {
13458 std::default::Default::default()
13459 }
13460
13461 /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
13462 ///
13463 /// # Example
13464 /// ```ignore,no_run
13465 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13466 /// let x = ReviewDocumentRequest::new().set_human_review_config("example");
13467 /// ```
13468 pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
13469 mut self,
13470 v: T,
13471 ) -> Self {
13472 self.human_review_config = v.into();
13473 self
13474 }
13475
13476 /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
13477 ///
13478 /// # Example
13479 /// ```ignore,no_run
13480 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13481 /// let x = ReviewDocumentRequest::new().set_enable_schema_validation(true);
13482 /// ```
13483 pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
13484 self.enable_schema_validation = v.into();
13485 self
13486 }
13487
13488 /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
13489 ///
13490 /// # Example
13491 /// ```ignore,no_run
13492 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13493 /// use google_cloud_documentai_v1::model::review_document_request::Priority;
13494 /// let x0 = ReviewDocumentRequest::new().set_priority(Priority::Urgent);
13495 /// ```
13496 pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
13497 mut self,
13498 v: T,
13499 ) -> Self {
13500 self.priority = v.into();
13501 self
13502 }
13503
13504 /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
13505 ///
13506 /// # Example
13507 /// ```ignore,no_run
13508 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13509 /// use google_cloud_documentai_v1::model::DocumentSchema;
13510 /// let x = ReviewDocumentRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
13511 /// ```
13512 pub fn set_document_schema<T>(mut self, v: T) -> Self
13513 where
13514 T: std::convert::Into<crate::model::DocumentSchema>,
13515 {
13516 self.document_schema = std::option::Option::Some(v.into());
13517 self
13518 }
13519
13520 /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
13521 ///
13522 /// # Example
13523 /// ```ignore,no_run
13524 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13525 /// use google_cloud_documentai_v1::model::DocumentSchema;
13526 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
13527 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
13528 /// ```
13529 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
13530 where
13531 T: std::convert::Into<crate::model::DocumentSchema>,
13532 {
13533 self.document_schema = v.map(|x| x.into());
13534 self
13535 }
13536
13537 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
13538 ///
13539 /// Note that all the setters affecting `source` are mutually
13540 /// exclusive.
13541 ///
13542 /// # Example
13543 /// ```ignore,no_run
13544 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13545 /// use google_cloud_documentai_v1::model::Document;
13546 /// let x = ReviewDocumentRequest::new().set_source(Some(
13547 /// google_cloud_documentai_v1::model::review_document_request::Source::InlineDocument(Document::default().into())));
13548 /// ```
13549 pub fn set_source<
13550 T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
13551 >(
13552 mut self,
13553 v: T,
13554 ) -> Self {
13555 self.source = v.into();
13556 self
13557 }
13558
13559 /// The value of [source][crate::model::ReviewDocumentRequest::source]
13560 /// if it holds a `InlineDocument`, `None` if the field is not set or
13561 /// holds a different branch.
13562 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
13563 #[allow(unreachable_patterns)]
13564 self.source.as_ref().and_then(|v| match v {
13565 crate::model::review_document_request::Source::InlineDocument(v) => {
13566 std::option::Option::Some(v)
13567 }
13568 _ => std::option::Option::None,
13569 })
13570 }
13571
13572 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
13573 /// to hold a `InlineDocument`.
13574 ///
13575 /// Note that all the setters affecting `source` are
13576 /// mutually exclusive.
13577 ///
13578 /// # Example
13579 /// ```ignore,no_run
13580 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
13581 /// use google_cloud_documentai_v1::model::Document;
13582 /// let x = ReviewDocumentRequest::new().set_inline_document(Document::default()/* use setters */);
13583 /// assert!(x.inline_document().is_some());
13584 /// ```
13585 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
13586 mut self,
13587 v: T,
13588 ) -> Self {
13589 self.source = std::option::Option::Some(
13590 crate::model::review_document_request::Source::InlineDocument(v.into()),
13591 );
13592 self
13593 }
13594}
13595
13596impl wkt::message::Message for ReviewDocumentRequest {
13597 fn typename() -> &'static str {
13598 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
13599 }
13600}
13601
13602/// Defines additional types related to [ReviewDocumentRequest].
13603pub mod review_document_request {
13604 #[allow(unused_imports)]
13605 use super::*;
13606
13607 /// The priority level of the human review task.
13608 ///
13609 /// # Working with unknown values
13610 ///
13611 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13612 /// additional enum variants at any time. Adding new variants is not considered
13613 /// a breaking change. Applications should write their code in anticipation of:
13614 ///
13615 /// - New values appearing in future releases of the client library, **and**
13616 /// - New values received dynamically, without application changes.
13617 ///
13618 /// Please consult the [Working with enums] section in the user guide for some
13619 /// guidelines.
13620 ///
13621 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13622 #[derive(Clone, Debug, PartialEq)]
13623 #[non_exhaustive]
13624 pub enum Priority {
13625 /// The default priority level.
13626 Default,
13627 /// The urgent priority level. The labeling manager should allocate labeler
13628 /// resource to the urgent task queue to respect this priority level.
13629 Urgent,
13630 /// If set, the enum was initialized with an unknown value.
13631 ///
13632 /// Applications can examine the value using [Priority::value] or
13633 /// [Priority::name].
13634 UnknownValue(priority::UnknownValue),
13635 }
13636
13637 #[doc(hidden)]
13638 pub mod priority {
13639 #[allow(unused_imports)]
13640 use super::*;
13641 #[derive(Clone, Debug, PartialEq)]
13642 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13643 }
13644
13645 impl Priority {
13646 /// Gets the enum value.
13647 ///
13648 /// Returns `None` if the enum contains an unknown value deserialized from
13649 /// the string representation of enums.
13650 pub fn value(&self) -> std::option::Option<i32> {
13651 match self {
13652 Self::Default => std::option::Option::Some(0),
13653 Self::Urgent => std::option::Option::Some(1),
13654 Self::UnknownValue(u) => u.0.value(),
13655 }
13656 }
13657
13658 /// Gets the enum value as a string.
13659 ///
13660 /// Returns `None` if the enum contains an unknown value deserialized from
13661 /// the integer representation of enums.
13662 pub fn name(&self) -> std::option::Option<&str> {
13663 match self {
13664 Self::Default => std::option::Option::Some("DEFAULT"),
13665 Self::Urgent => std::option::Option::Some("URGENT"),
13666 Self::UnknownValue(u) => u.0.name(),
13667 }
13668 }
13669 }
13670
13671 impl std::default::Default for Priority {
13672 fn default() -> Self {
13673 use std::convert::From;
13674 Self::from(0)
13675 }
13676 }
13677
13678 impl std::fmt::Display for Priority {
13679 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13680 wkt::internal::display_enum(f, self.name(), self.value())
13681 }
13682 }
13683
13684 impl std::convert::From<i32> for Priority {
13685 fn from(value: i32) -> Self {
13686 match value {
13687 0 => Self::Default,
13688 1 => Self::Urgent,
13689 _ => Self::UnknownValue(priority::UnknownValue(
13690 wkt::internal::UnknownEnumValue::Integer(value),
13691 )),
13692 }
13693 }
13694 }
13695
13696 impl std::convert::From<&str> for Priority {
13697 fn from(value: &str) -> Self {
13698 use std::string::ToString;
13699 match value {
13700 "DEFAULT" => Self::Default,
13701 "URGENT" => Self::Urgent,
13702 _ => Self::UnknownValue(priority::UnknownValue(
13703 wkt::internal::UnknownEnumValue::String(value.to_string()),
13704 )),
13705 }
13706 }
13707 }
13708
13709 impl serde::ser::Serialize for Priority {
13710 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13711 where
13712 S: serde::Serializer,
13713 {
13714 match self {
13715 Self::Default => serializer.serialize_i32(0),
13716 Self::Urgent => serializer.serialize_i32(1),
13717 Self::UnknownValue(u) => u.0.serialize(serializer),
13718 }
13719 }
13720 }
13721
13722 impl<'de> serde::de::Deserialize<'de> for Priority {
13723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13724 where
13725 D: serde::Deserializer<'de>,
13726 {
13727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
13728 ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
13729 ))
13730 }
13731 }
13732
13733 /// The document payload.
13734 #[derive(Clone, Debug, PartialEq)]
13735 #[non_exhaustive]
13736 pub enum Source {
13737 /// An inline document proto.
13738 InlineDocument(std::boxed::Box<crate::model::Document>),
13739 }
13740}
13741
13742/// Response message for the
13743/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
13744/// method.
13745///
13746/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
13747#[derive(Clone, Default, PartialEq)]
13748#[non_exhaustive]
13749pub struct ReviewDocumentResponse {
13750 /// The Cloud Storage uri for the human reviewed document if the review is
13751 /// succeeded.
13752 pub gcs_destination: std::string::String,
13753
13754 /// The state of the review operation.
13755 pub state: crate::model::review_document_response::State,
13756
13757 /// The reason why the review is rejected by reviewer.
13758 pub rejection_reason: std::string::String,
13759
13760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13761}
13762
13763impl ReviewDocumentResponse {
13764 pub fn new() -> Self {
13765 std::default::Default::default()
13766 }
13767
13768 /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
13769 ///
13770 /// # Example
13771 /// ```ignore,no_run
13772 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
13773 /// let x = ReviewDocumentResponse::new().set_gcs_destination("example");
13774 /// ```
13775 pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13776 self.gcs_destination = v.into();
13777 self
13778 }
13779
13780 /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
13781 ///
13782 /// # Example
13783 /// ```ignore,no_run
13784 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
13785 /// use google_cloud_documentai_v1::model::review_document_response::State;
13786 /// let x0 = ReviewDocumentResponse::new().set_state(State::Rejected);
13787 /// let x1 = ReviewDocumentResponse::new().set_state(State::Succeeded);
13788 /// ```
13789 pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
13790 mut self,
13791 v: T,
13792 ) -> Self {
13793 self.state = v.into();
13794 self
13795 }
13796
13797 /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
13798 ///
13799 /// # Example
13800 /// ```ignore,no_run
13801 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
13802 /// let x = ReviewDocumentResponse::new().set_rejection_reason("example");
13803 /// ```
13804 pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
13805 mut self,
13806 v: T,
13807 ) -> Self {
13808 self.rejection_reason = v.into();
13809 self
13810 }
13811}
13812
13813impl wkt::message::Message for ReviewDocumentResponse {
13814 fn typename() -> &'static str {
13815 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
13816 }
13817}
13818
13819/// Defines additional types related to [ReviewDocumentResponse].
13820pub mod review_document_response {
13821 #[allow(unused_imports)]
13822 use super::*;
13823
13824 /// Possible states of the review operation.
13825 ///
13826 /// # Working with unknown values
13827 ///
13828 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13829 /// additional enum variants at any time. Adding new variants is not considered
13830 /// a breaking change. Applications should write their code in anticipation of:
13831 ///
13832 /// - New values appearing in future releases of the client library, **and**
13833 /// - New values received dynamically, without application changes.
13834 ///
13835 /// Please consult the [Working with enums] section in the user guide for some
13836 /// guidelines.
13837 ///
13838 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
13839 #[derive(Clone, Debug, PartialEq)]
13840 #[non_exhaustive]
13841 pub enum State {
13842 /// The default value. This value is used if the state is omitted.
13843 Unspecified,
13844 /// The review operation is rejected by the reviewer.
13845 Rejected,
13846 /// The review operation is succeeded.
13847 Succeeded,
13848 /// If set, the enum was initialized with an unknown value.
13849 ///
13850 /// Applications can examine the value using [State::value] or
13851 /// [State::name].
13852 UnknownValue(state::UnknownValue),
13853 }
13854
13855 #[doc(hidden)]
13856 pub mod state {
13857 #[allow(unused_imports)]
13858 use super::*;
13859 #[derive(Clone, Debug, PartialEq)]
13860 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13861 }
13862
13863 impl State {
13864 /// Gets the enum value.
13865 ///
13866 /// Returns `None` if the enum contains an unknown value deserialized from
13867 /// the string representation of enums.
13868 pub fn value(&self) -> std::option::Option<i32> {
13869 match self {
13870 Self::Unspecified => std::option::Option::Some(0),
13871 Self::Rejected => std::option::Option::Some(1),
13872 Self::Succeeded => std::option::Option::Some(2),
13873 Self::UnknownValue(u) => u.0.value(),
13874 }
13875 }
13876
13877 /// Gets the enum value as a string.
13878 ///
13879 /// Returns `None` if the enum contains an unknown value deserialized from
13880 /// the integer representation of enums.
13881 pub fn name(&self) -> std::option::Option<&str> {
13882 match self {
13883 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
13884 Self::Rejected => std::option::Option::Some("REJECTED"),
13885 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
13886 Self::UnknownValue(u) => u.0.name(),
13887 }
13888 }
13889 }
13890
13891 impl std::default::Default for State {
13892 fn default() -> Self {
13893 use std::convert::From;
13894 Self::from(0)
13895 }
13896 }
13897
13898 impl std::fmt::Display for State {
13899 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
13900 wkt::internal::display_enum(f, self.name(), self.value())
13901 }
13902 }
13903
13904 impl std::convert::From<i32> for State {
13905 fn from(value: i32) -> Self {
13906 match value {
13907 0 => Self::Unspecified,
13908 1 => Self::Rejected,
13909 2 => Self::Succeeded,
13910 _ => Self::UnknownValue(state::UnknownValue(
13911 wkt::internal::UnknownEnumValue::Integer(value),
13912 )),
13913 }
13914 }
13915 }
13916
13917 impl std::convert::From<&str> for State {
13918 fn from(value: &str) -> Self {
13919 use std::string::ToString;
13920 match value {
13921 "STATE_UNSPECIFIED" => Self::Unspecified,
13922 "REJECTED" => Self::Rejected,
13923 "SUCCEEDED" => Self::Succeeded,
13924 _ => Self::UnknownValue(state::UnknownValue(
13925 wkt::internal::UnknownEnumValue::String(value.to_string()),
13926 )),
13927 }
13928 }
13929 }
13930
13931 impl serde::ser::Serialize for State {
13932 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
13933 where
13934 S: serde::Serializer,
13935 {
13936 match self {
13937 Self::Unspecified => serializer.serialize_i32(0),
13938 Self::Rejected => serializer.serialize_i32(1),
13939 Self::Succeeded => serializer.serialize_i32(2),
13940 Self::UnknownValue(u) => u.0.serialize(serializer),
13941 }
13942 }
13943 }
13944
13945 impl<'de> serde::de::Deserialize<'de> for State {
13946 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
13947 where
13948 D: serde::Deserializer<'de>,
13949 {
13950 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
13951 ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
13952 ))
13953 }
13954 }
13955}
13956
13957/// The long-running operation metadata for the
13958/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
13959/// method.
13960///
13961/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
13962#[derive(Clone, Default, PartialEq)]
13963#[non_exhaustive]
13964pub struct ReviewDocumentOperationMetadata {
13965 /// The basic metadata of the long-running operation.
13966 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13967
13968 /// The Crowd Compute question ID.
13969 pub question_id: std::string::String,
13970
13971 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13972}
13973
13974impl ReviewDocumentOperationMetadata {
13975 pub fn new() -> Self {
13976 std::default::Default::default()
13977 }
13978
13979 /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
13980 ///
13981 /// # Example
13982 /// ```ignore,no_run
13983 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
13984 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13985 /// let x = ReviewDocumentOperationMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13986 /// ```
13987 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13988 where
13989 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13990 {
13991 self.common_metadata = std::option::Option::Some(v.into());
13992 self
13993 }
13994
13995 /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
13996 ///
13997 /// # Example
13998 /// ```ignore,no_run
13999 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14000 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14001 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14002 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14003 /// ```
14004 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14005 where
14006 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14007 {
14008 self.common_metadata = v.map(|x| x.into());
14009 self
14010 }
14011
14012 /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
14013 ///
14014 /// # Example
14015 /// ```ignore,no_run
14016 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14017 /// let x = ReviewDocumentOperationMetadata::new().set_question_id("example");
14018 /// ```
14019 pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14020 self.question_id = v.into();
14021 self
14022 }
14023}
14024
14025impl wkt::message::Message for ReviewDocumentOperationMetadata {
14026 fn typename() -> &'static str {
14027 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
14028 }
14029}
14030
14031/// Evaluates the given
14032/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
14033/// supplied documents.
14034///
14035/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14036#[derive(Clone, Default, PartialEq)]
14037#[non_exhaustive]
14038pub struct EvaluateProcessorVersionRequest {
14039 /// Required. The resource name of the
14040 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
14041 /// evaluate.
14042 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
14043 ///
14044 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14045 pub processor_version: std::string::String,
14046
14047 /// Optional. The documents used in the evaluation. If unspecified, use the
14048 /// processor's dataset as evaluation input.
14049 pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
14050
14051 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14052}
14053
14054impl EvaluateProcessorVersionRequest {
14055 pub fn new() -> Self {
14056 std::default::Default::default()
14057 }
14058
14059 /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
14060 ///
14061 /// # Example
14062 /// ```ignore,no_run
14063 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
14064 /// let x = EvaluateProcessorVersionRequest::new().set_processor_version("example");
14065 /// ```
14066 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
14067 mut self,
14068 v: T,
14069 ) -> Self {
14070 self.processor_version = v.into();
14071 self
14072 }
14073
14074 /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
14075 ///
14076 /// # Example
14077 /// ```ignore,no_run
14078 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
14079 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14080 /// let x = EvaluateProcessorVersionRequest::new().set_evaluation_documents(BatchDocumentsInputConfig::default()/* use setters */);
14081 /// ```
14082 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
14083 where
14084 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14085 {
14086 self.evaluation_documents = std::option::Option::Some(v.into());
14087 self
14088 }
14089
14090 /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
14091 ///
14092 /// # Example
14093 /// ```ignore,no_run
14094 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
14095 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14096 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
14097 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(None::<BatchDocumentsInputConfig>);
14098 /// ```
14099 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
14100 where
14101 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14102 {
14103 self.evaluation_documents = v.map(|x| x.into());
14104 self
14105 }
14106}
14107
14108impl wkt::message::Message for EvaluateProcessorVersionRequest {
14109 fn typename() -> &'static str {
14110 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
14111 }
14112}
14113
14114/// Metadata of the
14115/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
14116/// method.
14117///
14118/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
14119#[derive(Clone, Default, PartialEq)]
14120#[non_exhaustive]
14121pub struct EvaluateProcessorVersionMetadata {
14122 /// The basic metadata of the long-running operation.
14123 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14124
14125 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14126}
14127
14128impl EvaluateProcessorVersionMetadata {
14129 pub fn new() -> Self {
14130 std::default::Default::default()
14131 }
14132
14133 /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
14134 ///
14135 /// # Example
14136 /// ```ignore,no_run
14137 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
14138 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14139 /// let x = EvaluateProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14140 /// ```
14141 pub fn set_common_metadata<T>(mut self, v: T) -> Self
14142 where
14143 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14144 {
14145 self.common_metadata = std::option::Option::Some(v.into());
14146 self
14147 }
14148
14149 /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
14150 ///
14151 /// # Example
14152 /// ```ignore,no_run
14153 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
14154 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14155 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14156 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14157 /// ```
14158 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14159 where
14160 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14161 {
14162 self.common_metadata = v.map(|x| x.into());
14163 self
14164 }
14165}
14166
14167impl wkt::message::Message for EvaluateProcessorVersionMetadata {
14168 fn typename() -> &'static str {
14169 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
14170 }
14171}
14172
14173/// Response of the
14174/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
14175/// method.
14176///
14177/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
14178#[derive(Clone, Default, PartialEq)]
14179#[non_exhaustive]
14180pub struct EvaluateProcessorVersionResponse {
14181 /// The resource name of the created evaluation.
14182 pub evaluation: std::string::String,
14183
14184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14185}
14186
14187impl EvaluateProcessorVersionResponse {
14188 pub fn new() -> Self {
14189 std::default::Default::default()
14190 }
14191
14192 /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
14193 ///
14194 /// # Example
14195 /// ```ignore,no_run
14196 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionResponse;
14197 /// let x = EvaluateProcessorVersionResponse::new().set_evaluation("example");
14198 /// ```
14199 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14200 self.evaluation = v.into();
14201 self
14202 }
14203}
14204
14205impl wkt::message::Message for EvaluateProcessorVersionResponse {
14206 fn typename() -> &'static str {
14207 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
14208 }
14209}
14210
14211/// Retrieves a specific Evaluation.
14212#[derive(Clone, Default, PartialEq)]
14213#[non_exhaustive]
14214pub struct GetEvaluationRequest {
14215 /// Required. The resource name of the
14216 /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
14217 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
14218 ///
14219 /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
14220 pub name: std::string::String,
14221
14222 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14223}
14224
14225impl GetEvaluationRequest {
14226 pub fn new() -> Self {
14227 std::default::Default::default()
14228 }
14229
14230 /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
14231 ///
14232 /// # Example
14233 /// ```ignore,no_run
14234 /// # use google_cloud_documentai_v1::model::GetEvaluationRequest;
14235 /// let x = GetEvaluationRequest::new().set_name("example");
14236 /// ```
14237 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14238 self.name = v.into();
14239 self
14240 }
14241}
14242
14243impl wkt::message::Message for GetEvaluationRequest {
14244 fn typename() -> &'static str {
14245 "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
14246 }
14247}
14248
14249/// Retrieves a list of evaluations for a given
14250/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
14251///
14252/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14253#[derive(Clone, Default, PartialEq)]
14254#[non_exhaustive]
14255pub struct ListEvaluationsRequest {
14256 /// Required. The resource name of the
14257 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
14258 /// evaluations for.
14259 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
14260 ///
14261 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
14262 pub parent: std::string::String,
14263
14264 /// The standard list page size.
14265 /// If unspecified, at most `5` evaluations are returned.
14266 /// The maximum value is `100`. Values above `100` are coerced to `100`.
14267 pub page_size: i32,
14268
14269 /// A page token, received from a previous `ListEvaluations` call.
14270 /// Provide this to retrieve the subsequent page.
14271 pub page_token: std::string::String,
14272
14273 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14274}
14275
14276impl ListEvaluationsRequest {
14277 pub fn new() -> Self {
14278 std::default::Default::default()
14279 }
14280
14281 /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
14282 ///
14283 /// # Example
14284 /// ```ignore,no_run
14285 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
14286 /// let x = ListEvaluationsRequest::new().set_parent("example");
14287 /// ```
14288 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14289 self.parent = v.into();
14290 self
14291 }
14292
14293 /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
14294 ///
14295 /// # Example
14296 /// ```ignore,no_run
14297 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
14298 /// let x = ListEvaluationsRequest::new().set_page_size(42);
14299 /// ```
14300 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14301 self.page_size = v.into();
14302 self
14303 }
14304
14305 /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
14306 ///
14307 /// # Example
14308 /// ```ignore,no_run
14309 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
14310 /// let x = ListEvaluationsRequest::new().set_page_token("example");
14311 /// ```
14312 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14313 self.page_token = v.into();
14314 self
14315 }
14316}
14317
14318impl wkt::message::Message for ListEvaluationsRequest {
14319 fn typename() -> &'static str {
14320 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
14321 }
14322}
14323
14324/// The response from `ListEvaluations`.
14325#[derive(Clone, Default, PartialEq)]
14326#[non_exhaustive]
14327pub struct ListEvaluationsResponse {
14328 /// The evaluations requested.
14329 pub evaluations: std::vec::Vec<crate::model::Evaluation>,
14330
14331 /// A token, which can be sent as `page_token` to retrieve the next page.
14332 /// If this field is omitted, there are no subsequent pages.
14333 pub next_page_token: std::string::String,
14334
14335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14336}
14337
14338impl ListEvaluationsResponse {
14339 pub fn new() -> Self {
14340 std::default::Default::default()
14341 }
14342
14343 /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
14344 ///
14345 /// # Example
14346 /// ```ignore,no_run
14347 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
14348 /// use google_cloud_documentai_v1::model::Evaluation;
14349 /// let x = ListEvaluationsResponse::new()
14350 /// .set_evaluations([
14351 /// Evaluation::default()/* use setters */,
14352 /// Evaluation::default()/* use (different) setters */,
14353 /// ]);
14354 /// ```
14355 pub fn set_evaluations<T, V>(mut self, v: T) -> Self
14356 where
14357 T: std::iter::IntoIterator<Item = V>,
14358 V: std::convert::Into<crate::model::Evaluation>,
14359 {
14360 use std::iter::Iterator;
14361 self.evaluations = v.into_iter().map(|i| i.into()).collect();
14362 self
14363 }
14364
14365 /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
14366 ///
14367 /// # Example
14368 /// ```ignore,no_run
14369 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
14370 /// let x = ListEvaluationsResponse::new().set_next_page_token("example");
14371 /// ```
14372 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14373 self.next_page_token = v.into();
14374 self
14375 }
14376}
14377
14378impl wkt::message::Message for ListEvaluationsResponse {
14379 fn typename() -> &'static str {
14380 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
14381 }
14382}
14383
14384#[doc(hidden)]
14385impl gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
14386 type PageItem = crate::model::Evaluation;
14387
14388 fn items(self) -> std::vec::Vec<Self::PageItem> {
14389 self.evaluations
14390 }
14391
14392 fn next_page_token(&self) -> std::string::String {
14393 use std::clone::Clone;
14394 self.next_page_token.clone()
14395 }
14396}
14397
14398/// The schema defines the output of the processed document by a processor.
14399#[derive(Clone, Default, PartialEq)]
14400#[non_exhaustive]
14401pub struct DocumentSchema {
14402 /// Display name to show to users.
14403 pub display_name: std::string::String,
14404
14405 /// Description of the schema.
14406 pub description: std::string::String,
14407
14408 /// Entity types of the schema.
14409 pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
14410
14411 /// Metadata of the schema.
14412 pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
14413
14414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14415}
14416
14417impl DocumentSchema {
14418 pub fn new() -> Self {
14419 std::default::Default::default()
14420 }
14421
14422 /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
14423 ///
14424 /// # Example
14425 /// ```ignore,no_run
14426 /// # use google_cloud_documentai_v1::model::DocumentSchema;
14427 /// let x = DocumentSchema::new().set_display_name("example");
14428 /// ```
14429 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14430 self.display_name = v.into();
14431 self
14432 }
14433
14434 /// Sets the value of [description][crate::model::DocumentSchema::description].
14435 ///
14436 /// # Example
14437 /// ```ignore,no_run
14438 /// # use google_cloud_documentai_v1::model::DocumentSchema;
14439 /// let x = DocumentSchema::new().set_description("example");
14440 /// ```
14441 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14442 self.description = v.into();
14443 self
14444 }
14445
14446 /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
14447 ///
14448 /// # Example
14449 /// ```ignore,no_run
14450 /// # use google_cloud_documentai_v1::model::DocumentSchema;
14451 /// use google_cloud_documentai_v1::model::document_schema::EntityType;
14452 /// let x = DocumentSchema::new()
14453 /// .set_entity_types([
14454 /// EntityType::default()/* use setters */,
14455 /// EntityType::default()/* use (different) setters */,
14456 /// ]);
14457 /// ```
14458 pub fn set_entity_types<T, V>(mut self, v: T) -> Self
14459 where
14460 T: std::iter::IntoIterator<Item = V>,
14461 V: std::convert::Into<crate::model::document_schema::EntityType>,
14462 {
14463 use std::iter::Iterator;
14464 self.entity_types = v.into_iter().map(|i| i.into()).collect();
14465 self
14466 }
14467
14468 /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
14469 ///
14470 /// # Example
14471 /// ```ignore,no_run
14472 /// # use google_cloud_documentai_v1::model::DocumentSchema;
14473 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
14474 /// let x = DocumentSchema::new().set_metadata(Metadata::default()/* use setters */);
14475 /// ```
14476 pub fn set_metadata<T>(mut self, v: T) -> Self
14477 where
14478 T: std::convert::Into<crate::model::document_schema::Metadata>,
14479 {
14480 self.metadata = std::option::Option::Some(v.into());
14481 self
14482 }
14483
14484 /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
14485 ///
14486 /// # Example
14487 /// ```ignore,no_run
14488 /// # use google_cloud_documentai_v1::model::DocumentSchema;
14489 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
14490 /// let x = DocumentSchema::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
14491 /// let x = DocumentSchema::new().set_or_clear_metadata(None::<Metadata>);
14492 /// ```
14493 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14494 where
14495 T: std::convert::Into<crate::model::document_schema::Metadata>,
14496 {
14497 self.metadata = v.map(|x| x.into());
14498 self
14499 }
14500}
14501
14502impl wkt::message::Message for DocumentSchema {
14503 fn typename() -> &'static str {
14504 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
14505 }
14506}
14507
14508/// Defines additional types related to [DocumentSchema].
14509pub mod document_schema {
14510 #[allow(unused_imports)]
14511 use super::*;
14512
14513 /// EntityType is the wrapper of a label of the corresponding model with
14514 /// detailed attributes and limitations for entity-based processors. Multiple
14515 /// types can also compose a dependency tree to represent nested types.
14516 #[derive(Clone, Default, PartialEq)]
14517 #[non_exhaustive]
14518 pub struct EntityType {
14519 /// User defined name for the type.
14520 pub display_name: std::string::String,
14521
14522 /// Name of the type. It must be unique within the schema file and
14523 /// cannot be a "Common Type". The following naming conventions are used:
14524 ///
14525 /// - Use `snake_casing`.
14526 /// - Name matching is case-sensitive.
14527 /// - Maximum 64 characters.
14528 /// - Must start with a letter.
14529 /// - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward
14530 /// compatibility internal infrastructure and tooling can handle any ascii
14531 /// character.)
14532 /// - The `/` is sometimes used to denote a property of a type. For example
14533 /// `line_item/amount`. This convention is deprecated, but will still be
14534 /// honored for backward compatibility.
14535 pub name: std::string::String,
14536
14537 /// The entity type that this type is derived from. For now, one and only
14538 /// one should be set.
14539 pub base_types: std::vec::Vec<std::string::String>,
14540
14541 /// Description the nested structure, or composition of an entity.
14542 pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
14543
14544 pub value_source:
14545 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
14546
14547 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14548 }
14549
14550 impl EntityType {
14551 pub fn new() -> Self {
14552 std::default::Default::default()
14553 }
14554
14555 /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
14556 ///
14557 /// # Example
14558 /// ```ignore,no_run
14559 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14560 /// let x = EntityType::new().set_display_name("example");
14561 /// ```
14562 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
14563 mut self,
14564 v: T,
14565 ) -> Self {
14566 self.display_name = v.into();
14567 self
14568 }
14569
14570 /// Sets the value of [name][crate::model::document_schema::EntityType::name].
14571 ///
14572 /// # Example
14573 /// ```ignore,no_run
14574 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14575 /// let x = EntityType::new().set_name("example");
14576 /// ```
14577 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14578 self.name = v.into();
14579 self
14580 }
14581
14582 /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
14583 ///
14584 /// # Example
14585 /// ```ignore,no_run
14586 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14587 /// let x = EntityType::new().set_base_types(["a", "b", "c"]);
14588 /// ```
14589 pub fn set_base_types<T, V>(mut self, v: T) -> Self
14590 where
14591 T: std::iter::IntoIterator<Item = V>,
14592 V: std::convert::Into<std::string::String>,
14593 {
14594 use std::iter::Iterator;
14595 self.base_types = v.into_iter().map(|i| i.into()).collect();
14596 self
14597 }
14598
14599 /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
14600 ///
14601 /// # Example
14602 /// ```ignore,no_run
14603 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14604 /// use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14605 /// let x = EntityType::new()
14606 /// .set_properties([
14607 /// Property::default()/* use setters */,
14608 /// Property::default()/* use (different) setters */,
14609 /// ]);
14610 /// ```
14611 pub fn set_properties<T, V>(mut self, v: T) -> Self
14612 where
14613 T: std::iter::IntoIterator<Item = V>,
14614 V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
14615 {
14616 use std::iter::Iterator;
14617 self.properties = v.into_iter().map(|i| i.into()).collect();
14618 self
14619 }
14620
14621 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
14622 ///
14623 /// Note that all the setters affecting `value_source` are mutually
14624 /// exclusive.
14625 ///
14626 /// # Example
14627 /// ```ignore,no_run
14628 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14629 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
14630 /// let x = EntityType::new().set_value_source(Some(
14631 /// google_cloud_documentai_v1::model::document_schema::entity_type::ValueSource::EnumValues(EnumValues::default().into())));
14632 /// ```
14633 pub fn set_value_source<
14634 T: std::convert::Into<
14635 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
14636 >,
14637 >(
14638 mut self,
14639 v: T,
14640 ) -> Self {
14641 self.value_source = v.into();
14642 self
14643 }
14644
14645 /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
14646 /// if it holds a `EnumValues`, `None` if the field is not set or
14647 /// holds a different branch.
14648 pub fn enum_values(
14649 &self,
14650 ) -> std::option::Option<
14651 &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
14652 > {
14653 #[allow(unreachable_patterns)]
14654 self.value_source.as_ref().and_then(|v| match v {
14655 crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
14656 std::option::Option::Some(v)
14657 }
14658 _ => std::option::Option::None,
14659 })
14660 }
14661
14662 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
14663 /// to hold a `EnumValues`.
14664 ///
14665 /// Note that all the setters affecting `value_source` are
14666 /// mutually exclusive.
14667 ///
14668 /// # Example
14669 /// ```ignore,no_run
14670 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
14671 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
14672 /// let x = EntityType::new().set_enum_values(EnumValues::default()/* use setters */);
14673 /// assert!(x.enum_values().is_some());
14674 /// ```
14675 pub fn set_enum_values<
14676 T: std::convert::Into<
14677 std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
14678 >,
14679 >(
14680 mut self,
14681 v: T,
14682 ) -> Self {
14683 self.value_source = std::option::Option::Some(
14684 crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
14685 );
14686 self
14687 }
14688 }
14689
14690 impl wkt::message::Message for EntityType {
14691 fn typename() -> &'static str {
14692 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
14693 }
14694 }
14695
14696 /// Defines additional types related to [EntityType].
14697 pub mod entity_type {
14698 #[allow(unused_imports)]
14699 use super::*;
14700
14701 /// Defines the a list of enum values.
14702 #[derive(Clone, Default, PartialEq)]
14703 #[non_exhaustive]
14704 pub struct EnumValues {
14705 /// The individual values that this enum values type can include.
14706 pub values: std::vec::Vec<std::string::String>,
14707
14708 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14709 }
14710
14711 impl EnumValues {
14712 pub fn new() -> Self {
14713 std::default::Default::default()
14714 }
14715
14716 /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
14717 ///
14718 /// # Example
14719 /// ```ignore,no_run
14720 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
14721 /// let x = EnumValues::new().set_values(["a", "b", "c"]);
14722 /// ```
14723 pub fn set_values<T, V>(mut self, v: T) -> Self
14724 where
14725 T: std::iter::IntoIterator<Item = V>,
14726 V: std::convert::Into<std::string::String>,
14727 {
14728 use std::iter::Iterator;
14729 self.values = v.into_iter().map(|i| i.into()).collect();
14730 self
14731 }
14732 }
14733
14734 impl wkt::message::Message for EnumValues {
14735 fn typename() -> &'static str {
14736 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
14737 }
14738 }
14739
14740 /// Defines properties that can be part of the entity type.
14741 #[derive(Clone, Default, PartialEq)]
14742 #[non_exhaustive]
14743 pub struct Property {
14744 /// The name of the property. Follows the same guidelines as the
14745 /// EntityType name.
14746 pub name: std::string::String,
14747
14748 /// User defined name for the property.
14749 pub display_name: std::string::String,
14750
14751 /// A reference to the value type of the property. This type is subject
14752 /// to the same conventions as the `Entity.base_types` field.
14753 pub value_type: std::string::String,
14754
14755 /// Occurrence type limits the number of instances an entity type appears
14756 /// in the document.
14757 pub occurrence_type:
14758 crate::model::document_schema::entity_type::property::OccurrenceType,
14759
14760 /// Specifies how the entity's value is obtained.
14761 pub method: crate::model::document_schema::entity_type::property::Method,
14762
14763 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14764 }
14765
14766 impl Property {
14767 pub fn new() -> Self {
14768 std::default::Default::default()
14769 }
14770
14771 /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
14772 ///
14773 /// # Example
14774 /// ```ignore,no_run
14775 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14776 /// let x = Property::new().set_name("example");
14777 /// ```
14778 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14779 self.name = v.into();
14780 self
14781 }
14782
14783 /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
14784 ///
14785 /// # Example
14786 /// ```ignore,no_run
14787 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14788 /// let x = Property::new().set_display_name("example");
14789 /// ```
14790 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
14791 mut self,
14792 v: T,
14793 ) -> Self {
14794 self.display_name = v.into();
14795 self
14796 }
14797
14798 /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
14799 ///
14800 /// # Example
14801 /// ```ignore,no_run
14802 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14803 /// let x = Property::new().set_value_type("example");
14804 /// ```
14805 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
14806 mut self,
14807 v: T,
14808 ) -> Self {
14809 self.value_type = v.into();
14810 self
14811 }
14812
14813 /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
14814 ///
14815 /// # Example
14816 /// ```ignore,no_run
14817 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14818 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::OccurrenceType;
14819 /// let x0 = Property::new().set_occurrence_type(OccurrenceType::OptionalOnce);
14820 /// let x1 = Property::new().set_occurrence_type(OccurrenceType::OptionalMultiple);
14821 /// let x2 = Property::new().set_occurrence_type(OccurrenceType::RequiredOnce);
14822 /// ```
14823 pub fn set_occurrence_type<
14824 T: std::convert::Into<
14825 crate::model::document_schema::entity_type::property::OccurrenceType,
14826 >,
14827 >(
14828 mut self,
14829 v: T,
14830 ) -> Self {
14831 self.occurrence_type = v.into();
14832 self
14833 }
14834
14835 /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
14836 ///
14837 /// # Example
14838 /// ```ignore,no_run
14839 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
14840 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::Method;
14841 /// let x0 = Property::new().set_method(Method::Extract);
14842 /// let x1 = Property::new().set_method(Method::Derive);
14843 /// ```
14844 pub fn set_method<
14845 T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
14846 >(
14847 mut self,
14848 v: T,
14849 ) -> Self {
14850 self.method = v.into();
14851 self
14852 }
14853 }
14854
14855 impl wkt::message::Message for Property {
14856 fn typename() -> &'static str {
14857 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
14858 }
14859 }
14860
14861 /// Defines additional types related to [Property].
14862 pub mod property {
14863 #[allow(unused_imports)]
14864 use super::*;
14865
14866 /// Types of occurrences of the entity type in the document. This
14867 /// represents the number of instances, not mentions, of an entity.
14868 /// For example, a bank statement might only have one
14869 /// `account_number`, but this account number can be mentioned in several
14870 /// places on the document. In this case, the `account_number` is
14871 /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
14872 /// expect a bank statement to contain the status of multiple different
14873 /// accounts for the customers, the occurrence type is set to
14874 /// `REQUIRED_MULTIPLE`.
14875 ///
14876 /// # Working with unknown values
14877 ///
14878 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14879 /// additional enum variants at any time. Adding new variants is not considered
14880 /// a breaking change. Applications should write their code in anticipation of:
14881 ///
14882 /// - New values appearing in future releases of the client library, **and**
14883 /// - New values received dynamically, without application changes.
14884 ///
14885 /// Please consult the [Working with enums] section in the user guide for some
14886 /// guidelines.
14887 ///
14888 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
14889 #[derive(Clone, Debug, PartialEq)]
14890 #[non_exhaustive]
14891 pub enum OccurrenceType {
14892 /// Unspecified occurrence type.
14893 Unspecified,
14894 /// There will be zero or one instance of this entity type. The same
14895 /// entity instance may be mentioned multiple times.
14896 OptionalOnce,
14897 /// The entity type will appear zero or multiple times.
14898 OptionalMultiple,
14899 /// The entity type will only appear exactly once. The same
14900 /// entity instance may be mentioned multiple times.
14901 RequiredOnce,
14902 /// The entity type will appear once or more times.
14903 RequiredMultiple,
14904 /// If set, the enum was initialized with an unknown value.
14905 ///
14906 /// Applications can examine the value using [OccurrenceType::value] or
14907 /// [OccurrenceType::name].
14908 UnknownValue(occurrence_type::UnknownValue),
14909 }
14910
14911 #[doc(hidden)]
14912 pub mod occurrence_type {
14913 #[allow(unused_imports)]
14914 use super::*;
14915 #[derive(Clone, Debug, PartialEq)]
14916 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14917 }
14918
14919 impl OccurrenceType {
14920 /// Gets the enum value.
14921 ///
14922 /// Returns `None` if the enum contains an unknown value deserialized from
14923 /// the string representation of enums.
14924 pub fn value(&self) -> std::option::Option<i32> {
14925 match self {
14926 Self::Unspecified => std::option::Option::Some(0),
14927 Self::OptionalOnce => std::option::Option::Some(1),
14928 Self::OptionalMultiple => std::option::Option::Some(2),
14929 Self::RequiredOnce => std::option::Option::Some(3),
14930 Self::RequiredMultiple => std::option::Option::Some(4),
14931 Self::UnknownValue(u) => u.0.value(),
14932 }
14933 }
14934
14935 /// Gets the enum value as a string.
14936 ///
14937 /// Returns `None` if the enum contains an unknown value deserialized from
14938 /// the integer representation of enums.
14939 pub fn name(&self) -> std::option::Option<&str> {
14940 match self {
14941 Self::Unspecified => {
14942 std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
14943 }
14944 Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
14945 Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
14946 Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
14947 Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
14948 Self::UnknownValue(u) => u.0.name(),
14949 }
14950 }
14951 }
14952
14953 impl std::default::Default for OccurrenceType {
14954 fn default() -> Self {
14955 use std::convert::From;
14956 Self::from(0)
14957 }
14958 }
14959
14960 impl std::fmt::Display for OccurrenceType {
14961 fn fmt(
14962 &self,
14963 f: &mut std::fmt::Formatter<'_>,
14964 ) -> std::result::Result<(), std::fmt::Error> {
14965 wkt::internal::display_enum(f, self.name(), self.value())
14966 }
14967 }
14968
14969 impl std::convert::From<i32> for OccurrenceType {
14970 fn from(value: i32) -> Self {
14971 match value {
14972 0 => Self::Unspecified,
14973 1 => Self::OptionalOnce,
14974 2 => Self::OptionalMultiple,
14975 3 => Self::RequiredOnce,
14976 4 => Self::RequiredMultiple,
14977 _ => Self::UnknownValue(occurrence_type::UnknownValue(
14978 wkt::internal::UnknownEnumValue::Integer(value),
14979 )),
14980 }
14981 }
14982 }
14983
14984 impl std::convert::From<&str> for OccurrenceType {
14985 fn from(value: &str) -> Self {
14986 use std::string::ToString;
14987 match value {
14988 "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
14989 "OPTIONAL_ONCE" => Self::OptionalOnce,
14990 "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
14991 "REQUIRED_ONCE" => Self::RequiredOnce,
14992 "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
14993 _ => Self::UnknownValue(occurrence_type::UnknownValue(
14994 wkt::internal::UnknownEnumValue::String(value.to_string()),
14995 )),
14996 }
14997 }
14998 }
14999
15000 impl serde::ser::Serialize for OccurrenceType {
15001 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15002 where
15003 S: serde::Serializer,
15004 {
15005 match self {
15006 Self::Unspecified => serializer.serialize_i32(0),
15007 Self::OptionalOnce => serializer.serialize_i32(1),
15008 Self::OptionalMultiple => serializer.serialize_i32(2),
15009 Self::RequiredOnce => serializer.serialize_i32(3),
15010 Self::RequiredMultiple => serializer.serialize_i32(4),
15011 Self::UnknownValue(u) => u.0.serialize(serializer),
15012 }
15013 }
15014 }
15015
15016 impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
15017 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15018 where
15019 D: serde::Deserializer<'de>,
15020 {
15021 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
15022 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
15023 }
15024 }
15025
15026 /// Specifies how the entity's value is obtained from the document.
15027 ///
15028 /// # Working with unknown values
15029 ///
15030 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15031 /// additional enum variants at any time. Adding new variants is not considered
15032 /// a breaking change. Applications should write their code in anticipation of:
15033 ///
15034 /// - New values appearing in future releases of the client library, **and**
15035 /// - New values received dynamically, without application changes.
15036 ///
15037 /// Please consult the [Working with enums] section in the user guide for some
15038 /// guidelines.
15039 ///
15040 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
15041 #[derive(Clone, Debug, PartialEq)]
15042 #[non_exhaustive]
15043 pub enum Method {
15044 /// Unspecified method. It defaults to `EXTRACT`.
15045 Unspecified,
15046 /// The entity's value is directly extracted as-is from the document
15047 /// text.
15048 Extract,
15049 /// The entity's value is derived through inference and is not
15050 /// necessarily an exact text extraction from the document.
15051 Derive,
15052 /// If set, the enum was initialized with an unknown value.
15053 ///
15054 /// Applications can examine the value using [Method::value] or
15055 /// [Method::name].
15056 UnknownValue(method::UnknownValue),
15057 }
15058
15059 #[doc(hidden)]
15060 pub mod method {
15061 #[allow(unused_imports)]
15062 use super::*;
15063 #[derive(Clone, Debug, PartialEq)]
15064 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15065 }
15066
15067 impl Method {
15068 /// Gets the enum value.
15069 ///
15070 /// Returns `None` if the enum contains an unknown value deserialized from
15071 /// the string representation of enums.
15072 pub fn value(&self) -> std::option::Option<i32> {
15073 match self {
15074 Self::Unspecified => std::option::Option::Some(0),
15075 Self::Extract => std::option::Option::Some(1),
15076 Self::Derive => std::option::Option::Some(2),
15077 Self::UnknownValue(u) => u.0.value(),
15078 }
15079 }
15080
15081 /// Gets the enum value as a string.
15082 ///
15083 /// Returns `None` if the enum contains an unknown value deserialized from
15084 /// the integer representation of enums.
15085 pub fn name(&self) -> std::option::Option<&str> {
15086 match self {
15087 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
15088 Self::Extract => std::option::Option::Some("EXTRACT"),
15089 Self::Derive => std::option::Option::Some("DERIVE"),
15090 Self::UnknownValue(u) => u.0.name(),
15091 }
15092 }
15093 }
15094
15095 impl std::default::Default for Method {
15096 fn default() -> Self {
15097 use std::convert::From;
15098 Self::from(0)
15099 }
15100 }
15101
15102 impl std::fmt::Display for Method {
15103 fn fmt(
15104 &self,
15105 f: &mut std::fmt::Formatter<'_>,
15106 ) -> std::result::Result<(), std::fmt::Error> {
15107 wkt::internal::display_enum(f, self.name(), self.value())
15108 }
15109 }
15110
15111 impl std::convert::From<i32> for Method {
15112 fn from(value: i32) -> Self {
15113 match value {
15114 0 => Self::Unspecified,
15115 1 => Self::Extract,
15116 2 => Self::Derive,
15117 _ => Self::UnknownValue(method::UnknownValue(
15118 wkt::internal::UnknownEnumValue::Integer(value),
15119 )),
15120 }
15121 }
15122 }
15123
15124 impl std::convert::From<&str> for Method {
15125 fn from(value: &str) -> Self {
15126 use std::string::ToString;
15127 match value {
15128 "METHOD_UNSPECIFIED" => Self::Unspecified,
15129 "EXTRACT" => Self::Extract,
15130 "DERIVE" => Self::Derive,
15131 _ => Self::UnknownValue(method::UnknownValue(
15132 wkt::internal::UnknownEnumValue::String(value.to_string()),
15133 )),
15134 }
15135 }
15136 }
15137
15138 impl serde::ser::Serialize for Method {
15139 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15140 where
15141 S: serde::Serializer,
15142 {
15143 match self {
15144 Self::Unspecified => serializer.serialize_i32(0),
15145 Self::Extract => serializer.serialize_i32(1),
15146 Self::Derive => serializer.serialize_i32(2),
15147 Self::UnknownValue(u) => u.0.serialize(serializer),
15148 }
15149 }
15150 }
15151
15152 impl<'de> serde::de::Deserialize<'de> for Method {
15153 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15154 where
15155 D: serde::Deserializer<'de>,
15156 {
15157 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
15158 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
15159 ))
15160 }
15161 }
15162 }
15163
15164 #[derive(Clone, Debug, PartialEq)]
15165 #[non_exhaustive]
15166 pub enum ValueSource {
15167 /// If specified, lists all the possible values for this entity. This
15168 /// should not be more than a handful of values. If the number of values
15169 /// is >10 or could change frequently use the `EntityType.value_ontology`
15170 /// field and specify a list of all possible values in a value ontology
15171 /// file.
15172 EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
15173 }
15174 }
15175
15176 /// Metadata for global schema behavior.
15177 #[derive(Clone, Default, PartialEq)]
15178 #[non_exhaustive]
15179 pub struct Metadata {
15180 /// If true, a `document` entity type can be applied to subdocument
15181 /// (splitting). Otherwise, it can only be applied to the entire document
15182 /// (classification).
15183 pub document_splitter: bool,
15184
15185 /// If true, on a given page, there can be multiple `document` annotations
15186 /// covering it.
15187 pub document_allow_multiple_labels: bool,
15188
15189 /// If set, all the nested entities must be prefixed with the parents.
15190 pub prefixed_naming_on_properties: bool,
15191
15192 /// If set, we will skip the naming format validation in the schema. So the
15193 /// string values in `DocumentSchema.EntityType.name` and
15194 /// `DocumentSchema.EntityType.Property.name` will not be checked.
15195 pub skip_naming_validation: bool,
15196
15197 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15198 }
15199
15200 impl Metadata {
15201 pub fn new() -> Self {
15202 std::default::Default::default()
15203 }
15204
15205 /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
15206 ///
15207 /// # Example
15208 /// ```ignore,no_run
15209 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15210 /// let x = Metadata::new().set_document_splitter(true);
15211 /// ```
15212 pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15213 self.document_splitter = v.into();
15214 self
15215 }
15216
15217 /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
15218 ///
15219 /// # Example
15220 /// ```ignore,no_run
15221 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15222 /// let x = Metadata::new().set_document_allow_multiple_labels(true);
15223 /// ```
15224 pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
15225 mut self,
15226 v: T,
15227 ) -> Self {
15228 self.document_allow_multiple_labels = v.into();
15229 self
15230 }
15231
15232 /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
15233 ///
15234 /// # Example
15235 /// ```ignore,no_run
15236 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15237 /// let x = Metadata::new().set_prefixed_naming_on_properties(true);
15238 /// ```
15239 pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
15240 mut self,
15241 v: T,
15242 ) -> Self {
15243 self.prefixed_naming_on_properties = v.into();
15244 self
15245 }
15246
15247 /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
15248 ///
15249 /// # Example
15250 /// ```ignore,no_run
15251 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
15252 /// let x = Metadata::new().set_skip_naming_validation(true);
15253 /// ```
15254 pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
15255 self.skip_naming_validation = v.into();
15256 self
15257 }
15258 }
15259
15260 impl wkt::message::Message for Metadata {
15261 fn typename() -> &'static str {
15262 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
15263 }
15264 }
15265}
15266
15267/// Gives a short summary of an evaluation, and links to the evaluation itself.
15268#[derive(Clone, Default, PartialEq)]
15269#[non_exhaustive]
15270pub struct EvaluationReference {
15271 /// The resource name of the Long Running Operation for the evaluation.
15272 pub operation: std::string::String,
15273
15274 /// The resource name of the evaluation.
15275 pub evaluation: std::string::String,
15276
15277 /// An aggregate of the statistics for the evaluation with fuzzy matching on.
15278 pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
15279
15280 /// An aggregate of the statistics for the evaluation with fuzzy matching off.
15281 pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
15282
15283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15284}
15285
15286impl EvaluationReference {
15287 pub fn new() -> Self {
15288 std::default::Default::default()
15289 }
15290
15291 /// Sets the value of [operation][crate::model::EvaluationReference::operation].
15292 ///
15293 /// # Example
15294 /// ```ignore,no_run
15295 /// # use google_cloud_documentai_v1::model::EvaluationReference;
15296 /// let x = EvaluationReference::new().set_operation("example");
15297 /// ```
15298 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15299 self.operation = v.into();
15300 self
15301 }
15302
15303 /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
15304 ///
15305 /// # Example
15306 /// ```ignore,no_run
15307 /// # use google_cloud_documentai_v1::model::EvaluationReference;
15308 /// let x = EvaluationReference::new().set_evaluation("example");
15309 /// ```
15310 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15311 self.evaluation = v.into();
15312 self
15313 }
15314
15315 /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
15316 ///
15317 /// # Example
15318 /// ```ignore,no_run
15319 /// # use google_cloud_documentai_v1::model::EvaluationReference;
15320 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15321 /// let x = EvaluationReference::new().set_aggregate_metrics(Metrics::default()/* use setters */);
15322 /// ```
15323 pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
15324 where
15325 T: std::convert::Into<crate::model::evaluation::Metrics>,
15326 {
15327 self.aggregate_metrics = std::option::Option::Some(v.into());
15328 self
15329 }
15330
15331 /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
15332 ///
15333 /// # Example
15334 /// ```ignore,no_run
15335 /// # use google_cloud_documentai_v1::model::EvaluationReference;
15336 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15337 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(Some(Metrics::default()/* use setters */));
15338 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(None::<Metrics>);
15339 /// ```
15340 pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
15341 where
15342 T: std::convert::Into<crate::model::evaluation::Metrics>,
15343 {
15344 self.aggregate_metrics = v.map(|x| x.into());
15345 self
15346 }
15347
15348 /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
15349 ///
15350 /// # Example
15351 /// ```ignore,no_run
15352 /// # use google_cloud_documentai_v1::model::EvaluationReference;
15353 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15354 /// let x = EvaluationReference::new().set_aggregate_metrics_exact(Metrics::default()/* use setters */);
15355 /// ```
15356 pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
15357 where
15358 T: std::convert::Into<crate::model::evaluation::Metrics>,
15359 {
15360 self.aggregate_metrics_exact = std::option::Option::Some(v.into());
15361 self
15362 }
15363
15364 /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
15365 ///
15366 /// # Example
15367 /// ```ignore,no_run
15368 /// # use google_cloud_documentai_v1::model::EvaluationReference;
15369 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15370 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(Some(Metrics::default()/* use setters */));
15371 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(None::<Metrics>);
15372 /// ```
15373 pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
15374 where
15375 T: std::convert::Into<crate::model::evaluation::Metrics>,
15376 {
15377 self.aggregate_metrics_exact = v.map(|x| x.into());
15378 self
15379 }
15380}
15381
15382impl wkt::message::Message for EvaluationReference {
15383 fn typename() -> &'static str {
15384 "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
15385 }
15386}
15387
15388/// An evaluation of a ProcessorVersion's performance.
15389#[derive(Clone, Default, PartialEq)]
15390#[non_exhaustive]
15391pub struct Evaluation {
15392 /// The resource name of the evaluation.
15393 /// Format:
15394 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
15395 pub name: std::string::String,
15396
15397 /// The time that the evaluation was created.
15398 pub create_time: std::option::Option<wkt::Timestamp>,
15399
15400 /// Counters for the documents used in the evaluation.
15401 pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
15402
15403 /// Metrics for all the entities in aggregate.
15404 pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
15405
15406 /// Metrics across confidence levels, for different entities.
15407 pub entity_metrics: std::collections::HashMap<
15408 std::string::String,
15409 crate::model::evaluation::MultiConfidenceMetrics,
15410 >,
15411
15412 /// The KMS key name used for encryption.
15413 pub kms_key_name: std::string::String,
15414
15415 /// The KMS key version with which data is encrypted.
15416 pub kms_key_version_name: std::string::String,
15417
15418 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15419}
15420
15421impl Evaluation {
15422 pub fn new() -> Self {
15423 std::default::Default::default()
15424 }
15425
15426 /// Sets the value of [name][crate::model::Evaluation::name].
15427 ///
15428 /// # Example
15429 /// ```ignore,no_run
15430 /// # use google_cloud_documentai_v1::model::Evaluation;
15431 /// let x = Evaluation::new().set_name("example");
15432 /// ```
15433 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15434 self.name = v.into();
15435 self
15436 }
15437
15438 /// Sets the value of [create_time][crate::model::Evaluation::create_time].
15439 ///
15440 /// # Example
15441 /// ```ignore,no_run
15442 /// # use google_cloud_documentai_v1::model::Evaluation;
15443 /// use wkt::Timestamp;
15444 /// let x = Evaluation::new().set_create_time(Timestamp::default()/* use setters */);
15445 /// ```
15446 pub fn set_create_time<T>(mut self, v: T) -> Self
15447 where
15448 T: std::convert::Into<wkt::Timestamp>,
15449 {
15450 self.create_time = std::option::Option::Some(v.into());
15451 self
15452 }
15453
15454 /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
15455 ///
15456 /// # Example
15457 /// ```ignore,no_run
15458 /// # use google_cloud_documentai_v1::model::Evaluation;
15459 /// use wkt::Timestamp;
15460 /// let x = Evaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
15461 /// let x = Evaluation::new().set_or_clear_create_time(None::<Timestamp>);
15462 /// ```
15463 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
15464 where
15465 T: std::convert::Into<wkt::Timestamp>,
15466 {
15467 self.create_time = v.map(|x| x.into());
15468 self
15469 }
15470
15471 /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
15472 ///
15473 /// # Example
15474 /// ```ignore,no_run
15475 /// # use google_cloud_documentai_v1::model::Evaluation;
15476 /// use google_cloud_documentai_v1::model::evaluation::Counters;
15477 /// let x = Evaluation::new().set_document_counters(Counters::default()/* use setters */);
15478 /// ```
15479 pub fn set_document_counters<T>(mut self, v: T) -> Self
15480 where
15481 T: std::convert::Into<crate::model::evaluation::Counters>,
15482 {
15483 self.document_counters = std::option::Option::Some(v.into());
15484 self
15485 }
15486
15487 /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
15488 ///
15489 /// # Example
15490 /// ```ignore,no_run
15491 /// # use google_cloud_documentai_v1::model::Evaluation;
15492 /// use google_cloud_documentai_v1::model::evaluation::Counters;
15493 /// let x = Evaluation::new().set_or_clear_document_counters(Some(Counters::default()/* use setters */));
15494 /// let x = Evaluation::new().set_or_clear_document_counters(None::<Counters>);
15495 /// ```
15496 pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
15497 where
15498 T: std::convert::Into<crate::model::evaluation::Counters>,
15499 {
15500 self.document_counters = v.map(|x| x.into());
15501 self
15502 }
15503
15504 /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
15505 ///
15506 /// # Example
15507 /// ```ignore,no_run
15508 /// # use google_cloud_documentai_v1::model::Evaluation;
15509 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15510 /// let x = Evaluation::new().set_all_entities_metrics(MultiConfidenceMetrics::default()/* use setters */);
15511 /// ```
15512 pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
15513 where
15514 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
15515 {
15516 self.all_entities_metrics = std::option::Option::Some(v.into());
15517 self
15518 }
15519
15520 /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
15521 ///
15522 /// # Example
15523 /// ```ignore,no_run
15524 /// # use google_cloud_documentai_v1::model::Evaluation;
15525 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15526 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(Some(MultiConfidenceMetrics::default()/* use setters */));
15527 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(None::<MultiConfidenceMetrics>);
15528 /// ```
15529 pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
15530 where
15531 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
15532 {
15533 self.all_entities_metrics = v.map(|x| x.into());
15534 self
15535 }
15536
15537 /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
15538 ///
15539 /// # Example
15540 /// ```ignore,no_run
15541 /// # use google_cloud_documentai_v1::model::Evaluation;
15542 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15543 /// let x = Evaluation::new().set_entity_metrics([
15544 /// ("key0", MultiConfidenceMetrics::default()/* use setters */),
15545 /// ("key1", MultiConfidenceMetrics::default()/* use (different) setters */),
15546 /// ]);
15547 /// ```
15548 pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
15549 where
15550 T: std::iter::IntoIterator<Item = (K, V)>,
15551 K: std::convert::Into<std::string::String>,
15552 V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
15553 {
15554 use std::iter::Iterator;
15555 self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
15556 self
15557 }
15558
15559 /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
15560 ///
15561 /// # Example
15562 /// ```ignore,no_run
15563 /// # use google_cloud_documentai_v1::model::Evaluation;
15564 /// let x = Evaluation::new().set_kms_key_name("example");
15565 /// ```
15566 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15567 self.kms_key_name = v.into();
15568 self
15569 }
15570
15571 /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
15572 ///
15573 /// # Example
15574 /// ```ignore,no_run
15575 /// # use google_cloud_documentai_v1::model::Evaluation;
15576 /// let x = Evaluation::new().set_kms_key_version_name("example");
15577 /// ```
15578 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
15579 mut self,
15580 v: T,
15581 ) -> Self {
15582 self.kms_key_version_name = v.into();
15583 self
15584 }
15585}
15586
15587impl wkt::message::Message for Evaluation {
15588 fn typename() -> &'static str {
15589 "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
15590 }
15591}
15592
15593/// Defines additional types related to [Evaluation].
15594pub mod evaluation {
15595 #[allow(unused_imports)]
15596 use super::*;
15597
15598 /// Evaluation counters for the documents that were used.
15599 #[derive(Clone, Default, PartialEq)]
15600 #[non_exhaustive]
15601 pub struct Counters {
15602 /// How many documents were sent for evaluation.
15603 pub input_documents_count: i32,
15604
15605 /// How many documents were not included in the evaluation as they didn't
15606 /// pass validation.
15607 pub invalid_documents_count: i32,
15608
15609 /// How many documents were not included in the evaluation as Document AI
15610 /// failed to process them.
15611 pub failed_documents_count: i32,
15612
15613 /// How many documents were used in the evaluation.
15614 pub evaluated_documents_count: i32,
15615
15616 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15617 }
15618
15619 impl Counters {
15620 pub fn new() -> Self {
15621 std::default::Default::default()
15622 }
15623
15624 /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
15625 ///
15626 /// # Example
15627 /// ```ignore,no_run
15628 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15629 /// let x = Counters::new().set_input_documents_count(42);
15630 /// ```
15631 pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15632 self.input_documents_count = v.into();
15633 self
15634 }
15635
15636 /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
15637 ///
15638 /// # Example
15639 /// ```ignore,no_run
15640 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15641 /// let x = Counters::new().set_invalid_documents_count(42);
15642 /// ```
15643 pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15644 self.invalid_documents_count = v.into();
15645 self
15646 }
15647
15648 /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
15649 ///
15650 /// # Example
15651 /// ```ignore,no_run
15652 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15653 /// let x = Counters::new().set_failed_documents_count(42);
15654 /// ```
15655 pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15656 self.failed_documents_count = v.into();
15657 self
15658 }
15659
15660 /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
15661 ///
15662 /// # Example
15663 /// ```ignore,no_run
15664 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
15665 /// let x = Counters::new().set_evaluated_documents_count(42);
15666 /// ```
15667 pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15668 self.evaluated_documents_count = v.into();
15669 self
15670 }
15671 }
15672
15673 impl wkt::message::Message for Counters {
15674 fn typename() -> &'static str {
15675 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
15676 }
15677 }
15678
15679 /// Evaluation metrics, either in aggregate or about a specific entity.
15680 #[derive(Clone, Default, PartialEq)]
15681 #[non_exhaustive]
15682 pub struct Metrics {
15683 /// The calculated precision.
15684 pub precision: f32,
15685
15686 /// The calculated recall.
15687 pub recall: f32,
15688
15689 /// The calculated f1 score.
15690 pub f1_score: f32,
15691
15692 /// The amount of occurrences in predicted documents.
15693 pub predicted_occurrences_count: i32,
15694
15695 /// The amount of occurrences in ground truth documents.
15696 pub ground_truth_occurrences_count: i32,
15697
15698 /// The amount of documents with a predicted occurrence.
15699 pub predicted_document_count: i32,
15700
15701 /// The amount of documents with a ground truth occurrence.
15702 pub ground_truth_document_count: i32,
15703
15704 /// The amount of true positives.
15705 pub true_positives_count: i32,
15706
15707 /// The amount of false positives.
15708 pub false_positives_count: i32,
15709
15710 /// The amount of false negatives.
15711 pub false_negatives_count: i32,
15712
15713 /// The amount of documents that had an occurrence of this label.
15714 pub total_documents_count: i32,
15715
15716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15717 }
15718
15719 impl Metrics {
15720 pub fn new() -> Self {
15721 std::default::Default::default()
15722 }
15723
15724 /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
15725 ///
15726 /// # Example
15727 /// ```ignore,no_run
15728 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15729 /// let x = Metrics::new().set_precision(42.0);
15730 /// ```
15731 pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15732 self.precision = v.into();
15733 self
15734 }
15735
15736 /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
15737 ///
15738 /// # Example
15739 /// ```ignore,no_run
15740 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15741 /// let x = Metrics::new().set_recall(42.0);
15742 /// ```
15743 pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15744 self.recall = v.into();
15745 self
15746 }
15747
15748 /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
15749 ///
15750 /// # Example
15751 /// ```ignore,no_run
15752 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15753 /// let x = Metrics::new().set_f1_score(42.0);
15754 /// ```
15755 pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15756 self.f1_score = v.into();
15757 self
15758 }
15759
15760 /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
15761 ///
15762 /// # Example
15763 /// ```ignore,no_run
15764 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15765 /// let x = Metrics::new().set_predicted_occurrences_count(42);
15766 /// ```
15767 pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15768 self.predicted_occurrences_count = v.into();
15769 self
15770 }
15771
15772 /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
15773 ///
15774 /// # Example
15775 /// ```ignore,no_run
15776 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15777 /// let x = Metrics::new().set_ground_truth_occurrences_count(42);
15778 /// ```
15779 pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
15780 mut self,
15781 v: T,
15782 ) -> Self {
15783 self.ground_truth_occurrences_count = v.into();
15784 self
15785 }
15786
15787 /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
15788 ///
15789 /// # Example
15790 /// ```ignore,no_run
15791 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15792 /// let x = Metrics::new().set_predicted_document_count(42);
15793 /// ```
15794 pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15795 self.predicted_document_count = v.into();
15796 self
15797 }
15798
15799 /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
15800 ///
15801 /// # Example
15802 /// ```ignore,no_run
15803 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15804 /// let x = Metrics::new().set_ground_truth_document_count(42);
15805 /// ```
15806 pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15807 self.ground_truth_document_count = v.into();
15808 self
15809 }
15810
15811 /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
15812 ///
15813 /// # Example
15814 /// ```ignore,no_run
15815 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15816 /// let x = Metrics::new().set_true_positives_count(42);
15817 /// ```
15818 pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15819 self.true_positives_count = v.into();
15820 self
15821 }
15822
15823 /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
15824 ///
15825 /// # Example
15826 /// ```ignore,no_run
15827 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15828 /// let x = Metrics::new().set_false_positives_count(42);
15829 /// ```
15830 pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15831 self.false_positives_count = v.into();
15832 self
15833 }
15834
15835 /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
15836 ///
15837 /// # Example
15838 /// ```ignore,no_run
15839 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15840 /// let x = Metrics::new().set_false_negatives_count(42);
15841 /// ```
15842 pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15843 self.false_negatives_count = v.into();
15844 self
15845 }
15846
15847 /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
15848 ///
15849 /// # Example
15850 /// ```ignore,no_run
15851 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
15852 /// let x = Metrics::new().set_total_documents_count(42);
15853 /// ```
15854 pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15855 self.total_documents_count = v.into();
15856 self
15857 }
15858 }
15859
15860 impl wkt::message::Message for Metrics {
15861 fn typename() -> &'static str {
15862 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
15863 }
15864 }
15865
15866 /// Evaluations metrics, at a specific confidence level.
15867 #[derive(Clone, Default, PartialEq)]
15868 #[non_exhaustive]
15869 pub struct ConfidenceLevelMetrics {
15870 /// The confidence level.
15871 pub confidence_level: f32,
15872
15873 /// The metrics at the specific confidence level.
15874 pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
15875
15876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15877 }
15878
15879 impl ConfidenceLevelMetrics {
15880 pub fn new() -> Self {
15881 std::default::Default::default()
15882 }
15883
15884 /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
15885 ///
15886 /// # Example
15887 /// ```ignore,no_run
15888 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15889 /// let x = ConfidenceLevelMetrics::new().set_confidence_level(42.0);
15890 /// ```
15891 pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
15892 self.confidence_level = v.into();
15893 self
15894 }
15895
15896 /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
15897 ///
15898 /// # Example
15899 /// ```ignore,no_run
15900 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15901 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15902 /// let x = ConfidenceLevelMetrics::new().set_metrics(Metrics::default()/* use setters */);
15903 /// ```
15904 pub fn set_metrics<T>(mut self, v: T) -> Self
15905 where
15906 T: std::convert::Into<crate::model::evaluation::Metrics>,
15907 {
15908 self.metrics = std::option::Option::Some(v.into());
15909 self
15910 }
15911
15912 /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
15913 ///
15914 /// # Example
15915 /// ```ignore,no_run
15916 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15917 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
15918 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(Some(Metrics::default()/* use setters */));
15919 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(None::<Metrics>);
15920 /// ```
15921 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
15922 where
15923 T: std::convert::Into<crate::model::evaluation::Metrics>,
15924 {
15925 self.metrics = v.map(|x| x.into());
15926 self
15927 }
15928 }
15929
15930 impl wkt::message::Message for ConfidenceLevelMetrics {
15931 fn typename() -> &'static str {
15932 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
15933 }
15934 }
15935
15936 /// Metrics across multiple confidence levels.
15937 #[derive(Clone, Default, PartialEq)]
15938 #[non_exhaustive]
15939 pub struct MultiConfidenceMetrics {
15940 /// Metrics across confidence levels with fuzzy matching enabled.
15941 pub confidence_level_metrics:
15942 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
15943
15944 /// Metrics across confidence levels with only exact matching.
15945 pub confidence_level_metrics_exact:
15946 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
15947
15948 /// The calculated area under the precision recall curve (AUPRC), computed by
15949 /// integrating over all confidence thresholds.
15950 pub auprc: f32,
15951
15952 /// The Estimated Calibration Error (ECE) of the confidence of the predicted
15953 /// entities.
15954 pub estimated_calibration_error: f32,
15955
15956 /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
15957 /// only.
15958 pub auprc_exact: f32,
15959
15960 /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
15961 /// exact matching only.
15962 pub estimated_calibration_error_exact: f32,
15963
15964 /// The metrics type for the label.
15965 pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
15966
15967 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15968 }
15969
15970 impl MultiConfidenceMetrics {
15971 pub fn new() -> Self {
15972 std::default::Default::default()
15973 }
15974
15975 /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
15976 ///
15977 /// # Example
15978 /// ```ignore,no_run
15979 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
15980 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
15981 /// let x = MultiConfidenceMetrics::new()
15982 /// .set_confidence_level_metrics([
15983 /// ConfidenceLevelMetrics::default()/* use setters */,
15984 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
15985 /// ]);
15986 /// ```
15987 pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
15988 where
15989 T: std::iter::IntoIterator<Item = V>,
15990 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
15991 {
15992 use std::iter::Iterator;
15993 self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
15994 self
15995 }
15996
15997 /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
15998 ///
15999 /// # Example
16000 /// ```ignore,no_run
16001 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16002 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16003 /// let x = MultiConfidenceMetrics::new()
16004 /// .set_confidence_level_metrics_exact([
16005 /// ConfidenceLevelMetrics::default()/* use setters */,
16006 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
16007 /// ]);
16008 /// ```
16009 pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
16010 where
16011 T: std::iter::IntoIterator<Item = V>,
16012 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
16013 {
16014 use std::iter::Iterator;
16015 self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
16016 self
16017 }
16018
16019 /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
16020 ///
16021 /// # Example
16022 /// ```ignore,no_run
16023 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16024 /// let x = MultiConfidenceMetrics::new().set_auprc(42.0);
16025 /// ```
16026 pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16027 self.auprc = v.into();
16028 self
16029 }
16030
16031 /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
16032 ///
16033 /// # Example
16034 /// ```ignore,no_run
16035 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16036 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error(42.0);
16037 /// ```
16038 pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16039 self.estimated_calibration_error = v.into();
16040 self
16041 }
16042
16043 /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
16044 ///
16045 /// # Example
16046 /// ```ignore,no_run
16047 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16048 /// let x = MultiConfidenceMetrics::new().set_auprc_exact(42.0);
16049 /// ```
16050 pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16051 self.auprc_exact = v.into();
16052 self
16053 }
16054
16055 /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
16056 ///
16057 /// # Example
16058 /// ```ignore,no_run
16059 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16060 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error_exact(42.0);
16061 /// ```
16062 pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
16063 mut self,
16064 v: T,
16065 ) -> Self {
16066 self.estimated_calibration_error_exact = v.into();
16067 self
16068 }
16069
16070 /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
16071 ///
16072 /// # Example
16073 /// ```ignore,no_run
16074 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16075 /// use google_cloud_documentai_v1::model::evaluation::multi_confidence_metrics::MetricsType;
16076 /// let x0 = MultiConfidenceMetrics::new().set_metrics_type(MetricsType::Aggregate);
16077 /// ```
16078 pub fn set_metrics_type<
16079 T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
16080 >(
16081 mut self,
16082 v: T,
16083 ) -> Self {
16084 self.metrics_type = v.into();
16085 self
16086 }
16087 }
16088
16089 impl wkt::message::Message for MultiConfidenceMetrics {
16090 fn typename() -> &'static str {
16091 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
16092 }
16093 }
16094
16095 /// Defines additional types related to [MultiConfidenceMetrics].
16096 pub mod multi_confidence_metrics {
16097 #[allow(unused_imports)]
16098 use super::*;
16099
16100 /// A type that determines how metrics should be interpreted.
16101 ///
16102 /// # Working with unknown values
16103 ///
16104 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16105 /// additional enum variants at any time. Adding new variants is not considered
16106 /// a breaking change. Applications should write their code in anticipation of:
16107 ///
16108 /// - New values appearing in future releases of the client library, **and**
16109 /// - New values received dynamically, without application changes.
16110 ///
16111 /// Please consult the [Working with enums] section in the user guide for some
16112 /// guidelines.
16113 ///
16114 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16115 #[derive(Clone, Debug, PartialEq)]
16116 #[non_exhaustive]
16117 pub enum MetricsType {
16118 /// The metrics type is unspecified. By default, metrics without a
16119 /// particular specification are for leaf entity types (i.e., top-level
16120 /// entity types without child types, or child types which are not
16121 /// parent types themselves).
16122 Unspecified,
16123 /// Indicates whether metrics for this particular label type represent an
16124 /// aggregate of metrics for other types instead of being based on actual
16125 /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
16126 /// entity types are an aggregate of metrics for their children.
16127 Aggregate,
16128 /// If set, the enum was initialized with an unknown value.
16129 ///
16130 /// Applications can examine the value using [MetricsType::value] or
16131 /// [MetricsType::name].
16132 UnknownValue(metrics_type::UnknownValue),
16133 }
16134
16135 #[doc(hidden)]
16136 pub mod metrics_type {
16137 #[allow(unused_imports)]
16138 use super::*;
16139 #[derive(Clone, Debug, PartialEq)]
16140 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16141 }
16142
16143 impl MetricsType {
16144 /// Gets the enum value.
16145 ///
16146 /// Returns `None` if the enum contains an unknown value deserialized from
16147 /// the string representation of enums.
16148 pub fn value(&self) -> std::option::Option<i32> {
16149 match self {
16150 Self::Unspecified => std::option::Option::Some(0),
16151 Self::Aggregate => std::option::Option::Some(1),
16152 Self::UnknownValue(u) => u.0.value(),
16153 }
16154 }
16155
16156 /// Gets the enum value as a string.
16157 ///
16158 /// Returns `None` if the enum contains an unknown value deserialized from
16159 /// the integer representation of enums.
16160 pub fn name(&self) -> std::option::Option<&str> {
16161 match self {
16162 Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
16163 Self::Aggregate => std::option::Option::Some("AGGREGATE"),
16164 Self::UnknownValue(u) => u.0.name(),
16165 }
16166 }
16167 }
16168
16169 impl std::default::Default for MetricsType {
16170 fn default() -> Self {
16171 use std::convert::From;
16172 Self::from(0)
16173 }
16174 }
16175
16176 impl std::fmt::Display for MetricsType {
16177 fn fmt(
16178 &self,
16179 f: &mut std::fmt::Formatter<'_>,
16180 ) -> std::result::Result<(), std::fmt::Error> {
16181 wkt::internal::display_enum(f, self.name(), self.value())
16182 }
16183 }
16184
16185 impl std::convert::From<i32> for MetricsType {
16186 fn from(value: i32) -> Self {
16187 match value {
16188 0 => Self::Unspecified,
16189 1 => Self::Aggregate,
16190 _ => Self::UnknownValue(metrics_type::UnknownValue(
16191 wkt::internal::UnknownEnumValue::Integer(value),
16192 )),
16193 }
16194 }
16195 }
16196
16197 impl std::convert::From<&str> for MetricsType {
16198 fn from(value: &str) -> Self {
16199 use std::string::ToString;
16200 match value {
16201 "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
16202 "AGGREGATE" => Self::Aggregate,
16203 _ => Self::UnknownValue(metrics_type::UnknownValue(
16204 wkt::internal::UnknownEnumValue::String(value.to_string()),
16205 )),
16206 }
16207 }
16208 }
16209
16210 impl serde::ser::Serialize for MetricsType {
16211 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16212 where
16213 S: serde::Serializer,
16214 {
16215 match self {
16216 Self::Unspecified => serializer.serialize_i32(0),
16217 Self::Aggregate => serializer.serialize_i32(1),
16218 Self::UnknownValue(u) => u.0.serialize(serializer),
16219 }
16220 }
16221 }
16222
16223 impl<'de> serde::de::Deserialize<'de> for MetricsType {
16224 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16225 where
16226 D: serde::Deserializer<'de>,
16227 {
16228 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
16229 ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
16230 ))
16231 }
16232 }
16233 }
16234}
16235
16236/// A vertex represents a 2D point in the image.
16237/// NOTE: the vertex coordinates are in the same scale as the original image.
16238#[derive(Clone, Default, PartialEq)]
16239#[non_exhaustive]
16240pub struct Vertex {
16241 /// X coordinate.
16242 pub x: i32,
16243
16244 /// Y coordinate (starts from the top of the image).
16245 pub y: i32,
16246
16247 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16248}
16249
16250impl Vertex {
16251 pub fn new() -> Self {
16252 std::default::Default::default()
16253 }
16254
16255 /// Sets the value of [x][crate::model::Vertex::x].
16256 ///
16257 /// # Example
16258 /// ```ignore,no_run
16259 /// # use google_cloud_documentai_v1::model::Vertex;
16260 /// let x = Vertex::new().set_x(42);
16261 /// ```
16262 pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16263 self.x = v.into();
16264 self
16265 }
16266
16267 /// Sets the value of [y][crate::model::Vertex::y].
16268 ///
16269 /// # Example
16270 /// ```ignore,no_run
16271 /// # use google_cloud_documentai_v1::model::Vertex;
16272 /// let x = Vertex::new().set_y(42);
16273 /// ```
16274 pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16275 self.y = v.into();
16276 self
16277 }
16278}
16279
16280impl wkt::message::Message for Vertex {
16281 fn typename() -> &'static str {
16282 "type.googleapis.com/google.cloud.documentai.v1.Vertex"
16283 }
16284}
16285
16286/// A vertex represents a 2D point in the image.
16287/// NOTE: the normalized vertex coordinates are relative to the original image
16288/// and range from 0 to 1.
16289#[derive(Clone, Default, PartialEq)]
16290#[non_exhaustive]
16291pub struct NormalizedVertex {
16292 /// X coordinate.
16293 pub x: f32,
16294
16295 /// Y coordinate (starts from the top of the image).
16296 pub y: f32,
16297
16298 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16299}
16300
16301impl NormalizedVertex {
16302 pub fn new() -> Self {
16303 std::default::Default::default()
16304 }
16305
16306 /// Sets the value of [x][crate::model::NormalizedVertex::x].
16307 ///
16308 /// # Example
16309 /// ```ignore,no_run
16310 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
16311 /// let x = NormalizedVertex::new().set_x(42.0);
16312 /// ```
16313 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16314 self.x = v.into();
16315 self
16316 }
16317
16318 /// Sets the value of [y][crate::model::NormalizedVertex::y].
16319 ///
16320 /// # Example
16321 /// ```ignore,no_run
16322 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
16323 /// let x = NormalizedVertex::new().set_y(42.0);
16324 /// ```
16325 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16326 self.y = v.into();
16327 self
16328 }
16329}
16330
16331impl wkt::message::Message for NormalizedVertex {
16332 fn typename() -> &'static str {
16333 "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
16334 }
16335}
16336
16337/// A bounding polygon for the detected image annotation.
16338#[derive(Clone, Default, PartialEq)]
16339#[non_exhaustive]
16340pub struct BoundingPoly {
16341 /// The bounding polygon vertices.
16342 pub vertices: std::vec::Vec<crate::model::Vertex>,
16343
16344 /// The bounding polygon normalized vertices.
16345 pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
16346
16347 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16348}
16349
16350impl BoundingPoly {
16351 pub fn new() -> Self {
16352 std::default::Default::default()
16353 }
16354
16355 /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
16356 ///
16357 /// # Example
16358 /// ```ignore,no_run
16359 /// # use google_cloud_documentai_v1::model::BoundingPoly;
16360 /// use google_cloud_documentai_v1::model::Vertex;
16361 /// let x = BoundingPoly::new()
16362 /// .set_vertices([
16363 /// Vertex::default()/* use setters */,
16364 /// Vertex::default()/* use (different) setters */,
16365 /// ]);
16366 /// ```
16367 pub fn set_vertices<T, V>(mut self, v: T) -> Self
16368 where
16369 T: std::iter::IntoIterator<Item = V>,
16370 V: std::convert::Into<crate::model::Vertex>,
16371 {
16372 use std::iter::Iterator;
16373 self.vertices = v.into_iter().map(|i| i.into()).collect();
16374 self
16375 }
16376
16377 /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
16378 ///
16379 /// # Example
16380 /// ```ignore,no_run
16381 /// # use google_cloud_documentai_v1::model::BoundingPoly;
16382 /// use google_cloud_documentai_v1::model::NormalizedVertex;
16383 /// let x = BoundingPoly::new()
16384 /// .set_normalized_vertices([
16385 /// NormalizedVertex::default()/* use setters */,
16386 /// NormalizedVertex::default()/* use (different) setters */,
16387 /// ]);
16388 /// ```
16389 pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
16390 where
16391 T: std::iter::IntoIterator<Item = V>,
16392 V: std::convert::Into<crate::model::NormalizedVertex>,
16393 {
16394 use std::iter::Iterator;
16395 self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
16396 self
16397 }
16398}
16399
16400impl wkt::message::Message for BoundingPoly {
16401 fn typename() -> &'static str {
16402 "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
16403 }
16404}
16405
16406/// The common metadata for long running operations.
16407#[derive(Clone, Default, PartialEq)]
16408#[non_exhaustive]
16409pub struct CommonOperationMetadata {
16410 /// The state of the operation.
16411 pub state: crate::model::common_operation_metadata::State,
16412
16413 /// A message providing more details about the current state of processing.
16414 pub state_message: std::string::String,
16415
16416 /// A related resource to this operation.
16417 pub resource: std::string::String,
16418
16419 /// The creation time of the operation.
16420 pub create_time: std::option::Option<wkt::Timestamp>,
16421
16422 /// The last update time of the operation.
16423 pub update_time: std::option::Option<wkt::Timestamp>,
16424
16425 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16426}
16427
16428impl CommonOperationMetadata {
16429 pub fn new() -> Self {
16430 std::default::Default::default()
16431 }
16432
16433 /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
16434 ///
16435 /// # Example
16436 /// ```ignore,no_run
16437 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16438 /// use google_cloud_documentai_v1::model::common_operation_metadata::State;
16439 /// let x0 = CommonOperationMetadata::new().set_state(State::Running);
16440 /// let x1 = CommonOperationMetadata::new().set_state(State::Cancelling);
16441 /// let x2 = CommonOperationMetadata::new().set_state(State::Succeeded);
16442 /// ```
16443 pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
16444 mut self,
16445 v: T,
16446 ) -> Self {
16447 self.state = v.into();
16448 self
16449 }
16450
16451 /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
16452 ///
16453 /// # Example
16454 /// ```ignore,no_run
16455 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16456 /// let x = CommonOperationMetadata::new().set_state_message("example");
16457 /// ```
16458 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16459 self.state_message = v.into();
16460 self
16461 }
16462
16463 /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
16464 ///
16465 /// # Example
16466 /// ```ignore,no_run
16467 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16468 /// let x = CommonOperationMetadata::new().set_resource("example");
16469 /// ```
16470 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16471 self.resource = v.into();
16472 self
16473 }
16474
16475 /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
16476 ///
16477 /// # Example
16478 /// ```ignore,no_run
16479 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16480 /// use wkt::Timestamp;
16481 /// let x = CommonOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
16482 /// ```
16483 pub fn set_create_time<T>(mut self, v: T) -> Self
16484 where
16485 T: std::convert::Into<wkt::Timestamp>,
16486 {
16487 self.create_time = std::option::Option::Some(v.into());
16488 self
16489 }
16490
16491 /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
16492 ///
16493 /// # Example
16494 /// ```ignore,no_run
16495 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16496 /// use wkt::Timestamp;
16497 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16498 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
16499 /// ```
16500 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16501 where
16502 T: std::convert::Into<wkt::Timestamp>,
16503 {
16504 self.create_time = v.map(|x| x.into());
16505 self
16506 }
16507
16508 /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
16509 ///
16510 /// # Example
16511 /// ```ignore,no_run
16512 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16513 /// use wkt::Timestamp;
16514 /// let x = CommonOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
16515 /// ```
16516 pub fn set_update_time<T>(mut self, v: T) -> Self
16517 where
16518 T: std::convert::Into<wkt::Timestamp>,
16519 {
16520 self.update_time = std::option::Option::Some(v.into());
16521 self
16522 }
16523
16524 /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
16525 ///
16526 /// # Example
16527 /// ```ignore,no_run
16528 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
16529 /// use wkt::Timestamp;
16530 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
16531 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
16532 /// ```
16533 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
16534 where
16535 T: std::convert::Into<wkt::Timestamp>,
16536 {
16537 self.update_time = v.map(|x| x.into());
16538 self
16539 }
16540}
16541
16542impl wkt::message::Message for CommonOperationMetadata {
16543 fn typename() -> &'static str {
16544 "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
16545 }
16546}
16547
16548/// Defines additional types related to [CommonOperationMetadata].
16549pub mod common_operation_metadata {
16550 #[allow(unused_imports)]
16551 use super::*;
16552
16553 /// State of the longrunning operation.
16554 ///
16555 /// # Working with unknown values
16556 ///
16557 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16558 /// additional enum variants at any time. Adding new variants is not considered
16559 /// a breaking change. Applications should write their code in anticipation of:
16560 ///
16561 /// - New values appearing in future releases of the client library, **and**
16562 /// - New values received dynamically, without application changes.
16563 ///
16564 /// Please consult the [Working with enums] section in the user guide for some
16565 /// guidelines.
16566 ///
16567 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
16568 #[derive(Clone, Debug, PartialEq)]
16569 #[non_exhaustive]
16570 pub enum State {
16571 /// Unspecified state.
16572 Unspecified,
16573 /// Operation is still running.
16574 Running,
16575 /// Operation is being cancelled.
16576 Cancelling,
16577 /// Operation succeeded.
16578 Succeeded,
16579 /// Operation failed.
16580 Failed,
16581 /// Operation is cancelled.
16582 Cancelled,
16583 /// If set, the enum was initialized with an unknown value.
16584 ///
16585 /// Applications can examine the value using [State::value] or
16586 /// [State::name].
16587 UnknownValue(state::UnknownValue),
16588 }
16589
16590 #[doc(hidden)]
16591 pub mod state {
16592 #[allow(unused_imports)]
16593 use super::*;
16594 #[derive(Clone, Debug, PartialEq)]
16595 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16596 }
16597
16598 impl State {
16599 /// Gets the enum value.
16600 ///
16601 /// Returns `None` if the enum contains an unknown value deserialized from
16602 /// the string representation of enums.
16603 pub fn value(&self) -> std::option::Option<i32> {
16604 match self {
16605 Self::Unspecified => std::option::Option::Some(0),
16606 Self::Running => std::option::Option::Some(1),
16607 Self::Cancelling => std::option::Option::Some(2),
16608 Self::Succeeded => std::option::Option::Some(3),
16609 Self::Failed => std::option::Option::Some(4),
16610 Self::Cancelled => std::option::Option::Some(5),
16611 Self::UnknownValue(u) => u.0.value(),
16612 }
16613 }
16614
16615 /// Gets the enum value as a string.
16616 ///
16617 /// Returns `None` if the enum contains an unknown value deserialized from
16618 /// the integer representation of enums.
16619 pub fn name(&self) -> std::option::Option<&str> {
16620 match self {
16621 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
16622 Self::Running => std::option::Option::Some("RUNNING"),
16623 Self::Cancelling => std::option::Option::Some("CANCELLING"),
16624 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
16625 Self::Failed => std::option::Option::Some("FAILED"),
16626 Self::Cancelled => std::option::Option::Some("CANCELLED"),
16627 Self::UnknownValue(u) => u.0.name(),
16628 }
16629 }
16630 }
16631
16632 impl std::default::Default for State {
16633 fn default() -> Self {
16634 use std::convert::From;
16635 Self::from(0)
16636 }
16637 }
16638
16639 impl std::fmt::Display for State {
16640 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
16641 wkt::internal::display_enum(f, self.name(), self.value())
16642 }
16643 }
16644
16645 impl std::convert::From<i32> for State {
16646 fn from(value: i32) -> Self {
16647 match value {
16648 0 => Self::Unspecified,
16649 1 => Self::Running,
16650 2 => Self::Cancelling,
16651 3 => Self::Succeeded,
16652 4 => Self::Failed,
16653 5 => Self::Cancelled,
16654 _ => Self::UnknownValue(state::UnknownValue(
16655 wkt::internal::UnknownEnumValue::Integer(value),
16656 )),
16657 }
16658 }
16659 }
16660
16661 impl std::convert::From<&str> for State {
16662 fn from(value: &str) -> Self {
16663 use std::string::ToString;
16664 match value {
16665 "STATE_UNSPECIFIED" => Self::Unspecified,
16666 "RUNNING" => Self::Running,
16667 "CANCELLING" => Self::Cancelling,
16668 "SUCCEEDED" => Self::Succeeded,
16669 "FAILED" => Self::Failed,
16670 "CANCELLED" => Self::Cancelled,
16671 _ => Self::UnknownValue(state::UnknownValue(
16672 wkt::internal::UnknownEnumValue::String(value.to_string()),
16673 )),
16674 }
16675 }
16676 }
16677
16678 impl serde::ser::Serialize for State {
16679 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16680 where
16681 S: serde::Serializer,
16682 {
16683 match self {
16684 Self::Unspecified => serializer.serialize_i32(0),
16685 Self::Running => serializer.serialize_i32(1),
16686 Self::Cancelling => serializer.serialize_i32(2),
16687 Self::Succeeded => serializer.serialize_i32(3),
16688 Self::Failed => serializer.serialize_i32(4),
16689 Self::Cancelled => serializer.serialize_i32(5),
16690 Self::UnknownValue(u) => u.0.serialize(serializer),
16691 }
16692 }
16693 }
16694
16695 impl<'de> serde::de::Deserialize<'de> for State {
16696 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16697 where
16698 D: serde::Deserializer<'de>,
16699 {
16700 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
16701 ".google.cloud.documentai.v1.CommonOperationMetadata.State",
16702 ))
16703 }
16704 }
16705}
16706
16707/// A processor version is an implementation of a processor. Each processor
16708/// can have multiple versions, pretrained by Google internally or uptrained
16709/// by the customer. A processor can only have one default version at a time.
16710/// Its document-processing behavior is defined by that version.
16711#[derive(Clone, Default, PartialEq)]
16712#[non_exhaustive]
16713pub struct ProcessorVersion {
16714 /// Identifier. The resource name of the processor version.
16715 /// Format:
16716 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
16717 pub name: std::string::String,
16718
16719 /// The display name of the processor version.
16720 pub display_name: std::string::String,
16721
16722 /// Output only. The schema of the processor version. Describes the output.
16723 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
16724
16725 /// Output only. The state of the processor version.
16726 pub state: crate::model::processor_version::State,
16727
16728 /// Output only. The time the processor version was created.
16729 pub create_time: std::option::Option<wkt::Timestamp>,
16730
16731 /// Output only. The most recently invoked evaluation for the processor
16732 /// version.
16733 pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
16734
16735 /// Output only. The KMS key name used for encryption.
16736 pub kms_key_name: std::string::String,
16737
16738 /// Output only. The KMS key version with which data is encrypted.
16739 pub kms_key_version_name: std::string::String,
16740
16741 /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
16742 pub google_managed: bool,
16743
16744 /// Output only. If set, information about the eventual deprecation of this
16745 /// version.
16746 pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
16747
16748 /// Output only. The model type of this processor version.
16749 pub model_type: crate::model::processor_version::ModelType,
16750
16751 /// Output only. Reserved for future use.
16752 pub satisfies_pzs: bool,
16753
16754 /// Output only. Reserved for future use.
16755 pub satisfies_pzi: bool,
16756
16757 /// Output only. Information about Generative AI model-based processor
16758 /// versions.
16759 pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
16760
16761 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16762}
16763
16764impl ProcessorVersion {
16765 pub fn new() -> Self {
16766 std::default::Default::default()
16767 }
16768
16769 /// Sets the value of [name][crate::model::ProcessorVersion::name].
16770 ///
16771 /// # Example
16772 /// ```ignore,no_run
16773 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16774 /// let x = ProcessorVersion::new().set_name("example");
16775 /// ```
16776 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16777 self.name = v.into();
16778 self
16779 }
16780
16781 /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
16782 ///
16783 /// # Example
16784 /// ```ignore,no_run
16785 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16786 /// let x = ProcessorVersion::new().set_display_name("example");
16787 /// ```
16788 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16789 self.display_name = v.into();
16790 self
16791 }
16792
16793 /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
16794 ///
16795 /// # Example
16796 /// ```ignore,no_run
16797 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16798 /// use google_cloud_documentai_v1::model::DocumentSchema;
16799 /// let x = ProcessorVersion::new().set_document_schema(DocumentSchema::default()/* use setters */);
16800 /// ```
16801 pub fn set_document_schema<T>(mut self, v: T) -> Self
16802 where
16803 T: std::convert::Into<crate::model::DocumentSchema>,
16804 {
16805 self.document_schema = std::option::Option::Some(v.into());
16806 self
16807 }
16808
16809 /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
16810 ///
16811 /// # Example
16812 /// ```ignore,no_run
16813 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16814 /// use google_cloud_documentai_v1::model::DocumentSchema;
16815 /// let x = ProcessorVersion::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
16816 /// let x = ProcessorVersion::new().set_or_clear_document_schema(None::<DocumentSchema>);
16817 /// ```
16818 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
16819 where
16820 T: std::convert::Into<crate::model::DocumentSchema>,
16821 {
16822 self.document_schema = v.map(|x| x.into());
16823 self
16824 }
16825
16826 /// Sets the value of [state][crate::model::ProcessorVersion::state].
16827 ///
16828 /// # Example
16829 /// ```ignore,no_run
16830 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16831 /// use google_cloud_documentai_v1::model::processor_version::State;
16832 /// let x0 = ProcessorVersion::new().set_state(State::Deployed);
16833 /// let x1 = ProcessorVersion::new().set_state(State::Deploying);
16834 /// let x2 = ProcessorVersion::new().set_state(State::Undeployed);
16835 /// ```
16836 pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
16837 mut self,
16838 v: T,
16839 ) -> Self {
16840 self.state = v.into();
16841 self
16842 }
16843
16844 /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
16845 ///
16846 /// # Example
16847 /// ```ignore,no_run
16848 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16849 /// use wkt::Timestamp;
16850 /// let x = ProcessorVersion::new().set_create_time(Timestamp::default()/* use setters */);
16851 /// ```
16852 pub fn set_create_time<T>(mut self, v: T) -> Self
16853 where
16854 T: std::convert::Into<wkt::Timestamp>,
16855 {
16856 self.create_time = std::option::Option::Some(v.into());
16857 self
16858 }
16859
16860 /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
16861 ///
16862 /// # Example
16863 /// ```ignore,no_run
16864 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16865 /// use wkt::Timestamp;
16866 /// let x = ProcessorVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16867 /// let x = ProcessorVersion::new().set_or_clear_create_time(None::<Timestamp>);
16868 /// ```
16869 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16870 where
16871 T: std::convert::Into<wkt::Timestamp>,
16872 {
16873 self.create_time = v.map(|x| x.into());
16874 self
16875 }
16876
16877 /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
16878 ///
16879 /// # Example
16880 /// ```ignore,no_run
16881 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16882 /// use google_cloud_documentai_v1::model::EvaluationReference;
16883 /// let x = ProcessorVersion::new().set_latest_evaluation(EvaluationReference::default()/* use setters */);
16884 /// ```
16885 pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
16886 where
16887 T: std::convert::Into<crate::model::EvaluationReference>,
16888 {
16889 self.latest_evaluation = std::option::Option::Some(v.into());
16890 self
16891 }
16892
16893 /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
16894 ///
16895 /// # Example
16896 /// ```ignore,no_run
16897 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16898 /// use google_cloud_documentai_v1::model::EvaluationReference;
16899 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(Some(EvaluationReference::default()/* use setters */));
16900 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(None::<EvaluationReference>);
16901 /// ```
16902 pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
16903 where
16904 T: std::convert::Into<crate::model::EvaluationReference>,
16905 {
16906 self.latest_evaluation = v.map(|x| x.into());
16907 self
16908 }
16909
16910 /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
16911 ///
16912 /// # Example
16913 /// ```ignore,no_run
16914 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16915 /// let x = ProcessorVersion::new().set_kms_key_name("example");
16916 /// ```
16917 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16918 self.kms_key_name = v.into();
16919 self
16920 }
16921
16922 /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
16923 ///
16924 /// # Example
16925 /// ```ignore,no_run
16926 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16927 /// let x = ProcessorVersion::new().set_kms_key_version_name("example");
16928 /// ```
16929 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
16930 mut self,
16931 v: T,
16932 ) -> Self {
16933 self.kms_key_version_name = v.into();
16934 self
16935 }
16936
16937 /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
16938 ///
16939 /// # Example
16940 /// ```ignore,no_run
16941 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16942 /// let x = ProcessorVersion::new().set_google_managed(true);
16943 /// ```
16944 pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16945 self.google_managed = v.into();
16946 self
16947 }
16948
16949 /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
16950 ///
16951 /// # Example
16952 /// ```ignore,no_run
16953 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16954 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
16955 /// let x = ProcessorVersion::new().set_deprecation_info(DeprecationInfo::default()/* use setters */);
16956 /// ```
16957 pub fn set_deprecation_info<T>(mut self, v: T) -> Self
16958 where
16959 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
16960 {
16961 self.deprecation_info = std::option::Option::Some(v.into());
16962 self
16963 }
16964
16965 /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
16966 ///
16967 /// # Example
16968 /// ```ignore,no_run
16969 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16970 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
16971 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(Some(DeprecationInfo::default()/* use setters */));
16972 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(None::<DeprecationInfo>);
16973 /// ```
16974 pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
16975 where
16976 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
16977 {
16978 self.deprecation_info = v.map(|x| x.into());
16979 self
16980 }
16981
16982 /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
16983 ///
16984 /// # Example
16985 /// ```ignore,no_run
16986 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
16987 /// use google_cloud_documentai_v1::model::processor_version::ModelType;
16988 /// let x0 = ProcessorVersion::new().set_model_type(ModelType::Generative);
16989 /// let x1 = ProcessorVersion::new().set_model_type(ModelType::Custom);
16990 /// ```
16991 pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
16992 mut self,
16993 v: T,
16994 ) -> Self {
16995 self.model_type = v.into();
16996 self
16997 }
16998
16999 /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
17000 ///
17001 /// # Example
17002 /// ```ignore,no_run
17003 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17004 /// let x = ProcessorVersion::new().set_satisfies_pzs(true);
17005 /// ```
17006 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17007 self.satisfies_pzs = v.into();
17008 self
17009 }
17010
17011 /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
17012 ///
17013 /// # Example
17014 /// ```ignore,no_run
17015 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17016 /// let x = ProcessorVersion::new().set_satisfies_pzi(true);
17017 /// ```
17018 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17019 self.satisfies_pzi = v.into();
17020 self
17021 }
17022
17023 /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
17024 ///
17025 /// # Example
17026 /// ```ignore,no_run
17027 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17028 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17029 /// let x = ProcessorVersion::new().set_gen_ai_model_info(GenAiModelInfo::default()/* use setters */);
17030 /// ```
17031 pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
17032 where
17033 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
17034 {
17035 self.gen_ai_model_info = std::option::Option::Some(v.into());
17036 self
17037 }
17038
17039 /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
17040 ///
17041 /// # Example
17042 /// ```ignore,no_run
17043 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17044 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17045 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(Some(GenAiModelInfo::default()/* use setters */));
17046 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(None::<GenAiModelInfo>);
17047 /// ```
17048 pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
17049 where
17050 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
17051 {
17052 self.gen_ai_model_info = v.map(|x| x.into());
17053 self
17054 }
17055}
17056
17057impl wkt::message::Message for ProcessorVersion {
17058 fn typename() -> &'static str {
17059 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
17060 }
17061}
17062
17063/// Defines additional types related to [ProcessorVersion].
17064pub mod processor_version {
17065 #[allow(unused_imports)]
17066 use super::*;
17067
17068 /// Information about the upcoming deprecation of this processor version.
17069 #[derive(Clone, Default, PartialEq)]
17070 #[non_exhaustive]
17071 pub struct DeprecationInfo {
17072 /// The time at which this processor version will be deprecated.
17073 pub deprecation_time: std::option::Option<wkt::Timestamp>,
17074
17075 /// If set, the processor version that will be used as a replacement.
17076 pub replacement_processor_version: std::string::String,
17077
17078 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17079 }
17080
17081 impl DeprecationInfo {
17082 pub fn new() -> Self {
17083 std::default::Default::default()
17084 }
17085
17086 /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
17087 ///
17088 /// # Example
17089 /// ```ignore,no_run
17090 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17091 /// use wkt::Timestamp;
17092 /// let x = DeprecationInfo::new().set_deprecation_time(Timestamp::default()/* use setters */);
17093 /// ```
17094 pub fn set_deprecation_time<T>(mut self, v: T) -> Self
17095 where
17096 T: std::convert::Into<wkt::Timestamp>,
17097 {
17098 self.deprecation_time = std::option::Option::Some(v.into());
17099 self
17100 }
17101
17102 /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
17103 ///
17104 /// # Example
17105 /// ```ignore,no_run
17106 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17107 /// use wkt::Timestamp;
17108 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(Some(Timestamp::default()/* use setters */));
17109 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(None::<Timestamp>);
17110 /// ```
17111 pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
17112 where
17113 T: std::convert::Into<wkt::Timestamp>,
17114 {
17115 self.deprecation_time = v.map(|x| x.into());
17116 self
17117 }
17118
17119 /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
17120 ///
17121 /// # Example
17122 /// ```ignore,no_run
17123 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17124 /// let x = DeprecationInfo::new().set_replacement_processor_version("example");
17125 /// ```
17126 pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
17127 mut self,
17128 v: T,
17129 ) -> Self {
17130 self.replacement_processor_version = v.into();
17131 self
17132 }
17133 }
17134
17135 impl wkt::message::Message for DeprecationInfo {
17136 fn typename() -> &'static str {
17137 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
17138 }
17139 }
17140
17141 /// Information about Generative AI model-based processor versions.
17142 #[derive(Clone, Default, PartialEq)]
17143 #[non_exhaustive]
17144 pub struct GenAiModelInfo {
17145 /// The processor version is either a pretrained Google-managed foundation
17146 /// model or a custom Generative AI model created by the user.
17147 pub model_info:
17148 std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
17149
17150 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17151 }
17152
17153 impl GenAiModelInfo {
17154 pub fn new() -> Self {
17155 std::default::Default::default()
17156 }
17157
17158 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
17159 ///
17160 /// Note that all the setters affecting `model_info` are mutually
17161 /// exclusive.
17162 ///
17163 /// # Example
17164 /// ```ignore,no_run
17165 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17166 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17167 /// let x = GenAiModelInfo::new().set_model_info(Some(
17168 /// google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(FoundationGenAiModelInfo::default().into())));
17169 /// ```
17170 pub fn set_model_info<
17171 T: std::convert::Into<
17172 std::option::Option<
17173 crate::model::processor_version::gen_ai_model_info::ModelInfo,
17174 >,
17175 >,
17176 >(
17177 mut self,
17178 v: T,
17179 ) -> Self {
17180 self.model_info = v.into();
17181 self
17182 }
17183
17184 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17185 /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
17186 /// holds a different branch.
17187 pub fn foundation_gen_ai_model_info(
17188 &self,
17189 ) -> std::option::Option<
17190 &std::boxed::Box<
17191 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
17192 >,
17193 > {
17194 #[allow(unreachable_patterns)]
17195 self.model_info.as_ref().and_then(|v| match v {
17196 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
17197 _ => std::option::Option::None,
17198 })
17199 }
17200
17201 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17202 /// to hold a `FoundationGenAiModelInfo`.
17203 ///
17204 /// Note that all the setters affecting `model_info` are
17205 /// mutually exclusive.
17206 ///
17207 /// # Example
17208 /// ```ignore,no_run
17209 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17210 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17211 /// let x = GenAiModelInfo::new().set_foundation_gen_ai_model_info(FoundationGenAiModelInfo::default()/* use setters */);
17212 /// assert!(x.foundation_gen_ai_model_info().is_some());
17213 /// assert!(x.custom_gen_ai_model_info().is_none());
17214 /// ```
17215 pub fn set_foundation_gen_ai_model_info<T: std::convert::Into<std::boxed::Box<crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo>>>(mut self, v: T) -> Self{
17216 self.model_info = std::option::Option::Some(
17217 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
17218 v.into()
17219 )
17220 );
17221 self
17222 }
17223
17224 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17225 /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
17226 /// holds a different branch.
17227 pub fn custom_gen_ai_model_info(
17228 &self,
17229 ) -> std::option::Option<
17230 &std::boxed::Box<
17231 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
17232 >,
17233 > {
17234 #[allow(unreachable_patterns)]
17235 self.model_info.as_ref().and_then(|v| match v {
17236 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
17237 _ => std::option::Option::None,
17238 })
17239 }
17240
17241 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
17242 /// to hold a `CustomGenAiModelInfo`.
17243 ///
17244 /// Note that all the setters affecting `model_info` are
17245 /// mutually exclusive.
17246 ///
17247 /// # Example
17248 /// ```ignore,no_run
17249 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
17250 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
17251 /// let x = GenAiModelInfo::new().set_custom_gen_ai_model_info(CustomGenAiModelInfo::default()/* use setters */);
17252 /// assert!(x.custom_gen_ai_model_info().is_some());
17253 /// assert!(x.foundation_gen_ai_model_info().is_none());
17254 /// ```
17255 pub fn set_custom_gen_ai_model_info<
17256 T: std::convert::Into<
17257 std::boxed::Box<
17258 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
17259 >,
17260 >,
17261 >(
17262 mut self,
17263 v: T,
17264 ) -> Self {
17265 self.model_info = std::option::Option::Some(
17266 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
17267 v.into(),
17268 ),
17269 );
17270 self
17271 }
17272 }
17273
17274 impl wkt::message::Message for GenAiModelInfo {
17275 fn typename() -> &'static str {
17276 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
17277 }
17278 }
17279
17280 /// Defines additional types related to [GenAiModelInfo].
17281 pub mod gen_ai_model_info {
17282 #[allow(unused_imports)]
17283 use super::*;
17284
17285 /// Information for a pretrained Google-managed foundation model.
17286 #[derive(Clone, Default, PartialEq)]
17287 #[non_exhaustive]
17288 pub struct FoundationGenAiModelInfo {
17289 /// Whether finetuning is allowed for this base processor version.
17290 pub finetuning_allowed: bool,
17291
17292 /// The minimum number of labeled documents in the training dataset
17293 /// required for finetuning.
17294 pub min_train_labeled_documents: i32,
17295
17296 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17297 }
17298
17299 impl FoundationGenAiModelInfo {
17300 pub fn new() -> Self {
17301 std::default::Default::default()
17302 }
17303
17304 /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
17305 ///
17306 /// # Example
17307 /// ```ignore,no_run
17308 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17309 /// let x = FoundationGenAiModelInfo::new().set_finetuning_allowed(true);
17310 /// ```
17311 pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17312 self.finetuning_allowed = v.into();
17313 self
17314 }
17315
17316 /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
17317 ///
17318 /// # Example
17319 /// ```ignore,no_run
17320 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
17321 /// let x = FoundationGenAiModelInfo::new().set_min_train_labeled_documents(42);
17322 /// ```
17323 pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
17324 mut self,
17325 v: T,
17326 ) -> Self {
17327 self.min_train_labeled_documents = v.into();
17328 self
17329 }
17330 }
17331
17332 impl wkt::message::Message for FoundationGenAiModelInfo {
17333 fn typename() -> &'static str {
17334 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
17335 }
17336 }
17337
17338 /// Information for a custom Generative AI model created by the user. These
17339 /// are created with `Create New Version` in either the `Call foundation
17340 /// model` or `Fine tuning` tabs.
17341 #[derive(Clone, Default, PartialEq)]
17342 #[non_exhaustive]
17343 pub struct CustomGenAiModelInfo {
17344
17345 /// The type of custom model created by the user.
17346 pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
17347
17348 /// The base processor version ID for the custom model.
17349 pub base_processor_version_id: std::string::String,
17350
17351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17352 }
17353
17354 impl CustomGenAiModelInfo {
17355 pub fn new() -> Self {
17356 std::default::Default::default()
17357 }
17358
17359 /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
17360 ///
17361 /// # Example
17362 /// ```ignore,no_run
17363 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
17364 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType;
17365 /// let x0 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::VersionedFoundation);
17366 /// let x1 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::FineTuned);
17367 /// ```
17368 pub fn set_custom_model_type<T: std::convert::Into<crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType>>(mut self, v: T) -> Self{
17369 self.custom_model_type = v.into();
17370 self
17371 }
17372
17373 /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
17374 ///
17375 /// # Example
17376 /// ```ignore,no_run
17377 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
17378 /// let x = CustomGenAiModelInfo::new().set_base_processor_version_id("example");
17379 /// ```
17380 pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
17381 mut self,
17382 v: T,
17383 ) -> Self {
17384 self.base_processor_version_id = v.into();
17385 self
17386 }
17387 }
17388
17389 impl wkt::message::Message for CustomGenAiModelInfo {
17390 fn typename() -> &'static str {
17391 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
17392 }
17393 }
17394
17395 /// Defines additional types related to [CustomGenAiModelInfo].
17396 pub mod custom_gen_ai_model_info {
17397 #[allow(unused_imports)]
17398 use super::*;
17399
17400 /// The type of custom model created by the user.
17401 ///
17402 /// # Working with unknown values
17403 ///
17404 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17405 /// additional enum variants at any time. Adding new variants is not considered
17406 /// a breaking change. Applications should write their code in anticipation of:
17407 ///
17408 /// - New values appearing in future releases of the client library, **and**
17409 /// - New values received dynamically, without application changes.
17410 ///
17411 /// Please consult the [Working with enums] section in the user guide for some
17412 /// guidelines.
17413 ///
17414 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17415 #[derive(Clone, Debug, PartialEq)]
17416 #[non_exhaustive]
17417 pub enum CustomModelType {
17418 /// The model type is unspecified.
17419 Unspecified,
17420 /// The model is a versioned foundation model.
17421 VersionedFoundation,
17422 /// The model is a finetuned foundation model.
17423 FineTuned,
17424 /// If set, the enum was initialized with an unknown value.
17425 ///
17426 /// Applications can examine the value using [CustomModelType::value] or
17427 /// [CustomModelType::name].
17428 UnknownValue(custom_model_type::UnknownValue),
17429 }
17430
17431 #[doc(hidden)]
17432 pub mod custom_model_type {
17433 #[allow(unused_imports)]
17434 use super::*;
17435 #[derive(Clone, Debug, PartialEq)]
17436 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17437 }
17438
17439 impl CustomModelType {
17440 /// Gets the enum value.
17441 ///
17442 /// Returns `None` if the enum contains an unknown value deserialized from
17443 /// the string representation of enums.
17444 pub fn value(&self) -> std::option::Option<i32> {
17445 match self {
17446 Self::Unspecified => std::option::Option::Some(0),
17447 Self::VersionedFoundation => std::option::Option::Some(1),
17448 Self::FineTuned => std::option::Option::Some(2),
17449 Self::UnknownValue(u) => u.0.value(),
17450 }
17451 }
17452
17453 /// Gets the enum value as a string.
17454 ///
17455 /// Returns `None` if the enum contains an unknown value deserialized from
17456 /// the integer representation of enums.
17457 pub fn name(&self) -> std::option::Option<&str> {
17458 match self {
17459 Self::Unspecified => {
17460 std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
17461 }
17462 Self::VersionedFoundation => {
17463 std::option::Option::Some("VERSIONED_FOUNDATION")
17464 }
17465 Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
17466 Self::UnknownValue(u) => u.0.name(),
17467 }
17468 }
17469 }
17470
17471 impl std::default::Default for CustomModelType {
17472 fn default() -> Self {
17473 use std::convert::From;
17474 Self::from(0)
17475 }
17476 }
17477
17478 impl std::fmt::Display for CustomModelType {
17479 fn fmt(
17480 &self,
17481 f: &mut std::fmt::Formatter<'_>,
17482 ) -> std::result::Result<(), std::fmt::Error> {
17483 wkt::internal::display_enum(f, self.name(), self.value())
17484 }
17485 }
17486
17487 impl std::convert::From<i32> for CustomModelType {
17488 fn from(value: i32) -> Self {
17489 match value {
17490 0 => Self::Unspecified,
17491 1 => Self::VersionedFoundation,
17492 2 => Self::FineTuned,
17493 _ => Self::UnknownValue(custom_model_type::UnknownValue(
17494 wkt::internal::UnknownEnumValue::Integer(value),
17495 )),
17496 }
17497 }
17498 }
17499
17500 impl std::convert::From<&str> for CustomModelType {
17501 fn from(value: &str) -> Self {
17502 use std::string::ToString;
17503 match value {
17504 "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
17505 "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
17506 "FINE_TUNED" => Self::FineTuned,
17507 _ => Self::UnknownValue(custom_model_type::UnknownValue(
17508 wkt::internal::UnknownEnumValue::String(value.to_string()),
17509 )),
17510 }
17511 }
17512 }
17513
17514 impl serde::ser::Serialize for CustomModelType {
17515 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17516 where
17517 S: serde::Serializer,
17518 {
17519 match self {
17520 Self::Unspecified => serializer.serialize_i32(0),
17521 Self::VersionedFoundation => serializer.serialize_i32(1),
17522 Self::FineTuned => serializer.serialize_i32(2),
17523 Self::UnknownValue(u) => u.0.serialize(serializer),
17524 }
17525 }
17526 }
17527
17528 impl<'de> serde::de::Deserialize<'de> for CustomModelType {
17529 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17530 where
17531 D: serde::Deserializer<'de>,
17532 {
17533 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
17534 ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
17535 }
17536 }
17537 }
17538
17539 /// The processor version is either a pretrained Google-managed foundation
17540 /// model or a custom Generative AI model created by the user.
17541 #[derive(Clone, Debug, PartialEq)]
17542 #[non_exhaustive]
17543 pub enum ModelInfo {
17544 /// Information for a pretrained Google-managed foundation model.
17545 FoundationGenAiModelInfo(
17546 std::boxed::Box<
17547 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
17548 >,
17549 ),
17550 /// Information for a custom Generative AI model created by the user.
17551 CustomGenAiModelInfo(
17552 std::boxed::Box<
17553 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
17554 >,
17555 ),
17556 }
17557 }
17558
17559 /// The possible states of the processor version.
17560 ///
17561 /// # Working with unknown values
17562 ///
17563 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17564 /// additional enum variants at any time. Adding new variants is not considered
17565 /// a breaking change. Applications should write their code in anticipation of:
17566 ///
17567 /// - New values appearing in future releases of the client library, **and**
17568 /// - New values received dynamically, without application changes.
17569 ///
17570 /// Please consult the [Working with enums] section in the user guide for some
17571 /// guidelines.
17572 ///
17573 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17574 #[derive(Clone, Debug, PartialEq)]
17575 #[non_exhaustive]
17576 pub enum State {
17577 /// The processor version is in an unspecified state.
17578 Unspecified,
17579 /// The processor version is deployed and can be used for processing.
17580 Deployed,
17581 /// The processor version is being deployed.
17582 Deploying,
17583 /// The processor version is not deployed and cannot be used for processing.
17584 Undeployed,
17585 /// The processor version is being undeployed.
17586 Undeploying,
17587 /// The processor version is being created.
17588 Creating,
17589 /// The processor version is being deleted.
17590 Deleting,
17591 /// The processor version failed and is in an indeterminate state.
17592 Failed,
17593 /// The processor version is being imported.
17594 Importing,
17595 /// If set, the enum was initialized with an unknown value.
17596 ///
17597 /// Applications can examine the value using [State::value] or
17598 /// [State::name].
17599 UnknownValue(state::UnknownValue),
17600 }
17601
17602 #[doc(hidden)]
17603 pub mod state {
17604 #[allow(unused_imports)]
17605 use super::*;
17606 #[derive(Clone, Debug, PartialEq)]
17607 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17608 }
17609
17610 impl State {
17611 /// Gets the enum value.
17612 ///
17613 /// Returns `None` if the enum contains an unknown value deserialized from
17614 /// the string representation of enums.
17615 pub fn value(&self) -> std::option::Option<i32> {
17616 match self {
17617 Self::Unspecified => std::option::Option::Some(0),
17618 Self::Deployed => std::option::Option::Some(1),
17619 Self::Deploying => std::option::Option::Some(2),
17620 Self::Undeployed => std::option::Option::Some(3),
17621 Self::Undeploying => std::option::Option::Some(4),
17622 Self::Creating => std::option::Option::Some(5),
17623 Self::Deleting => std::option::Option::Some(6),
17624 Self::Failed => std::option::Option::Some(7),
17625 Self::Importing => std::option::Option::Some(8),
17626 Self::UnknownValue(u) => u.0.value(),
17627 }
17628 }
17629
17630 /// Gets the enum value as a string.
17631 ///
17632 /// Returns `None` if the enum contains an unknown value deserialized from
17633 /// the integer representation of enums.
17634 pub fn name(&self) -> std::option::Option<&str> {
17635 match self {
17636 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17637 Self::Deployed => std::option::Option::Some("DEPLOYED"),
17638 Self::Deploying => std::option::Option::Some("DEPLOYING"),
17639 Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
17640 Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
17641 Self::Creating => std::option::Option::Some("CREATING"),
17642 Self::Deleting => std::option::Option::Some("DELETING"),
17643 Self::Failed => std::option::Option::Some("FAILED"),
17644 Self::Importing => std::option::Option::Some("IMPORTING"),
17645 Self::UnknownValue(u) => u.0.name(),
17646 }
17647 }
17648 }
17649
17650 impl std::default::Default for State {
17651 fn default() -> Self {
17652 use std::convert::From;
17653 Self::from(0)
17654 }
17655 }
17656
17657 impl std::fmt::Display for State {
17658 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17659 wkt::internal::display_enum(f, self.name(), self.value())
17660 }
17661 }
17662
17663 impl std::convert::From<i32> for State {
17664 fn from(value: i32) -> Self {
17665 match value {
17666 0 => Self::Unspecified,
17667 1 => Self::Deployed,
17668 2 => Self::Deploying,
17669 3 => Self::Undeployed,
17670 4 => Self::Undeploying,
17671 5 => Self::Creating,
17672 6 => Self::Deleting,
17673 7 => Self::Failed,
17674 8 => Self::Importing,
17675 _ => Self::UnknownValue(state::UnknownValue(
17676 wkt::internal::UnknownEnumValue::Integer(value),
17677 )),
17678 }
17679 }
17680 }
17681
17682 impl std::convert::From<&str> for State {
17683 fn from(value: &str) -> Self {
17684 use std::string::ToString;
17685 match value {
17686 "STATE_UNSPECIFIED" => Self::Unspecified,
17687 "DEPLOYED" => Self::Deployed,
17688 "DEPLOYING" => Self::Deploying,
17689 "UNDEPLOYED" => Self::Undeployed,
17690 "UNDEPLOYING" => Self::Undeploying,
17691 "CREATING" => Self::Creating,
17692 "DELETING" => Self::Deleting,
17693 "FAILED" => Self::Failed,
17694 "IMPORTING" => Self::Importing,
17695 _ => Self::UnknownValue(state::UnknownValue(
17696 wkt::internal::UnknownEnumValue::String(value.to_string()),
17697 )),
17698 }
17699 }
17700 }
17701
17702 impl serde::ser::Serialize for State {
17703 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17704 where
17705 S: serde::Serializer,
17706 {
17707 match self {
17708 Self::Unspecified => serializer.serialize_i32(0),
17709 Self::Deployed => serializer.serialize_i32(1),
17710 Self::Deploying => serializer.serialize_i32(2),
17711 Self::Undeployed => serializer.serialize_i32(3),
17712 Self::Undeploying => serializer.serialize_i32(4),
17713 Self::Creating => serializer.serialize_i32(5),
17714 Self::Deleting => serializer.serialize_i32(6),
17715 Self::Failed => serializer.serialize_i32(7),
17716 Self::Importing => serializer.serialize_i32(8),
17717 Self::UnknownValue(u) => u.0.serialize(serializer),
17718 }
17719 }
17720 }
17721
17722 impl<'de> serde::de::Deserialize<'de> for State {
17723 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17724 where
17725 D: serde::Deserializer<'de>,
17726 {
17727 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17728 ".google.cloud.documentai.v1.ProcessorVersion.State",
17729 ))
17730 }
17731 }
17732
17733 /// The possible model types of the processor version.
17734 ///
17735 /// # Working with unknown values
17736 ///
17737 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17738 /// additional enum variants at any time. Adding new variants is not considered
17739 /// a breaking change. Applications should write their code in anticipation of:
17740 ///
17741 /// - New values appearing in future releases of the client library, **and**
17742 /// - New values received dynamically, without application changes.
17743 ///
17744 /// Please consult the [Working with enums] section in the user guide for some
17745 /// guidelines.
17746 ///
17747 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
17748 #[derive(Clone, Debug, PartialEq)]
17749 #[non_exhaustive]
17750 pub enum ModelType {
17751 /// The processor version has unspecified model type.
17752 Unspecified,
17753 /// The processor version has generative model type.
17754 Generative,
17755 /// The processor version has custom model type.
17756 Custom,
17757 /// If set, the enum was initialized with an unknown value.
17758 ///
17759 /// Applications can examine the value using [ModelType::value] or
17760 /// [ModelType::name].
17761 UnknownValue(model_type::UnknownValue),
17762 }
17763
17764 #[doc(hidden)]
17765 pub mod model_type {
17766 #[allow(unused_imports)]
17767 use super::*;
17768 #[derive(Clone, Debug, PartialEq)]
17769 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17770 }
17771
17772 impl ModelType {
17773 /// Gets the enum value.
17774 ///
17775 /// Returns `None` if the enum contains an unknown value deserialized from
17776 /// the string representation of enums.
17777 pub fn value(&self) -> std::option::Option<i32> {
17778 match self {
17779 Self::Unspecified => std::option::Option::Some(0),
17780 Self::Generative => std::option::Option::Some(1),
17781 Self::Custom => std::option::Option::Some(2),
17782 Self::UnknownValue(u) => u.0.value(),
17783 }
17784 }
17785
17786 /// Gets the enum value as a string.
17787 ///
17788 /// Returns `None` if the enum contains an unknown value deserialized from
17789 /// the integer representation of enums.
17790 pub fn name(&self) -> std::option::Option<&str> {
17791 match self {
17792 Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
17793 Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
17794 Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
17795 Self::UnknownValue(u) => u.0.name(),
17796 }
17797 }
17798 }
17799
17800 impl std::default::Default for ModelType {
17801 fn default() -> Self {
17802 use std::convert::From;
17803 Self::from(0)
17804 }
17805 }
17806
17807 impl std::fmt::Display for ModelType {
17808 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17809 wkt::internal::display_enum(f, self.name(), self.value())
17810 }
17811 }
17812
17813 impl std::convert::From<i32> for ModelType {
17814 fn from(value: i32) -> Self {
17815 match value {
17816 0 => Self::Unspecified,
17817 1 => Self::Generative,
17818 2 => Self::Custom,
17819 _ => Self::UnknownValue(model_type::UnknownValue(
17820 wkt::internal::UnknownEnumValue::Integer(value),
17821 )),
17822 }
17823 }
17824 }
17825
17826 impl std::convert::From<&str> for ModelType {
17827 fn from(value: &str) -> Self {
17828 use std::string::ToString;
17829 match value {
17830 "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
17831 "MODEL_TYPE_GENERATIVE" => Self::Generative,
17832 "MODEL_TYPE_CUSTOM" => Self::Custom,
17833 _ => Self::UnknownValue(model_type::UnknownValue(
17834 wkt::internal::UnknownEnumValue::String(value.to_string()),
17835 )),
17836 }
17837 }
17838 }
17839
17840 impl serde::ser::Serialize for ModelType {
17841 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17842 where
17843 S: serde::Serializer,
17844 {
17845 match self {
17846 Self::Unspecified => serializer.serialize_i32(0),
17847 Self::Generative => serializer.serialize_i32(1),
17848 Self::Custom => serializer.serialize_i32(2),
17849 Self::UnknownValue(u) => u.0.serialize(serializer),
17850 }
17851 }
17852 }
17853
17854 impl<'de> serde::de::Deserialize<'de> for ModelType {
17855 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17856 where
17857 D: serde::Deserializer<'de>,
17858 {
17859 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
17860 ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
17861 ))
17862 }
17863 }
17864}
17865
17866/// Contains the alias and the aliased resource name of processor version.
17867#[derive(Clone, Default, PartialEq)]
17868#[non_exhaustive]
17869pub struct ProcessorVersionAlias {
17870 /// The alias in the form of `processor_version` resource name.
17871 pub alias: std::string::String,
17872
17873 /// The resource name of aliased processor version.
17874 pub processor_version: std::string::String,
17875
17876 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17877}
17878
17879impl ProcessorVersionAlias {
17880 pub fn new() -> Self {
17881 std::default::Default::default()
17882 }
17883
17884 /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
17885 ///
17886 /// # Example
17887 /// ```ignore,no_run
17888 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
17889 /// let x = ProcessorVersionAlias::new().set_alias("example");
17890 /// ```
17891 pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17892 self.alias = v.into();
17893 self
17894 }
17895
17896 /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
17897 ///
17898 /// # Example
17899 /// ```ignore,no_run
17900 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
17901 /// let x = ProcessorVersionAlias::new().set_processor_version("example");
17902 /// ```
17903 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
17904 mut self,
17905 v: T,
17906 ) -> Self {
17907 self.processor_version = v.into();
17908 self
17909 }
17910}
17911
17912impl wkt::message::Message for ProcessorVersionAlias {
17913 fn typename() -> &'static str {
17914 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
17915 }
17916}
17917
17918/// The first-class citizen for Document AI. Each processor defines how to
17919/// extract structural information from a document.
17920#[derive(Clone, Default, PartialEq)]
17921#[non_exhaustive]
17922pub struct Processor {
17923 /// Output only. Immutable. The resource name of the processor.
17924 /// Format: `projects/{project}/locations/{location}/processors/{processor}`
17925 pub name: std::string::String,
17926
17927 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
17928 /// To get a list of processor types, see
17929 /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
17930 ///
17931 /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
17932 pub r#type: std::string::String,
17933
17934 /// The display name of the processor.
17935 pub display_name: std::string::String,
17936
17937 /// Output only. The state of the processor.
17938 pub state: crate::model::processor::State,
17939
17940 /// The default processor version.
17941 pub default_processor_version: std::string::String,
17942
17943 /// Output only. The processor version aliases.
17944 pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
17945
17946 /// Output only. Immutable. The http endpoint that can be called to invoke
17947 /// processing.
17948 pub process_endpoint: std::string::String,
17949
17950 /// Output only. The time the processor was created.
17951 pub create_time: std::option::Option<wkt::Timestamp>,
17952
17953 /// The [KMS key](https://cloud.google.com/security-key-management) used for
17954 /// encryption and decryption in CMEK scenarios.
17955 pub kms_key_name: std::string::String,
17956
17957 /// Output only. Reserved for future use.
17958 pub satisfies_pzs: bool,
17959
17960 /// Output only. Reserved for future use.
17961 pub satisfies_pzi: bool,
17962
17963 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17964}
17965
17966impl Processor {
17967 pub fn new() -> Self {
17968 std::default::Default::default()
17969 }
17970
17971 /// Sets the value of [name][crate::model::Processor::name].
17972 ///
17973 /// # Example
17974 /// ```ignore,no_run
17975 /// # use google_cloud_documentai_v1::model::Processor;
17976 /// let x = Processor::new().set_name("example");
17977 /// ```
17978 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17979 self.name = v.into();
17980 self
17981 }
17982
17983 /// Sets the value of [r#type][crate::model::Processor::type].
17984 ///
17985 /// # Example
17986 /// ```ignore,no_run
17987 /// # use google_cloud_documentai_v1::model::Processor;
17988 /// let x = Processor::new().set_type("example");
17989 /// ```
17990 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17991 self.r#type = v.into();
17992 self
17993 }
17994
17995 /// Sets the value of [display_name][crate::model::Processor::display_name].
17996 ///
17997 /// # Example
17998 /// ```ignore,no_run
17999 /// # use google_cloud_documentai_v1::model::Processor;
18000 /// let x = Processor::new().set_display_name("example");
18001 /// ```
18002 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18003 self.display_name = v.into();
18004 self
18005 }
18006
18007 /// Sets the value of [state][crate::model::Processor::state].
18008 ///
18009 /// # Example
18010 /// ```ignore,no_run
18011 /// # use google_cloud_documentai_v1::model::Processor;
18012 /// use google_cloud_documentai_v1::model::processor::State;
18013 /// let x0 = Processor::new().set_state(State::Enabled);
18014 /// let x1 = Processor::new().set_state(State::Disabled);
18015 /// let x2 = Processor::new().set_state(State::Enabling);
18016 /// ```
18017 pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
18018 mut self,
18019 v: T,
18020 ) -> Self {
18021 self.state = v.into();
18022 self
18023 }
18024
18025 /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
18026 ///
18027 /// # Example
18028 /// ```ignore,no_run
18029 /// # use google_cloud_documentai_v1::model::Processor;
18030 /// let x = Processor::new().set_default_processor_version("example");
18031 /// ```
18032 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
18033 mut self,
18034 v: T,
18035 ) -> Self {
18036 self.default_processor_version = v.into();
18037 self
18038 }
18039
18040 /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
18041 ///
18042 /// # Example
18043 /// ```ignore,no_run
18044 /// # use google_cloud_documentai_v1::model::Processor;
18045 /// use google_cloud_documentai_v1::model::ProcessorVersionAlias;
18046 /// let x = Processor::new()
18047 /// .set_processor_version_aliases([
18048 /// ProcessorVersionAlias::default()/* use setters */,
18049 /// ProcessorVersionAlias::default()/* use (different) setters */,
18050 /// ]);
18051 /// ```
18052 pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
18053 where
18054 T: std::iter::IntoIterator<Item = V>,
18055 V: std::convert::Into<crate::model::ProcessorVersionAlias>,
18056 {
18057 use std::iter::Iterator;
18058 self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
18059 self
18060 }
18061
18062 /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
18063 ///
18064 /// # Example
18065 /// ```ignore,no_run
18066 /// # use google_cloud_documentai_v1::model::Processor;
18067 /// let x = Processor::new().set_process_endpoint("example");
18068 /// ```
18069 pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
18070 mut self,
18071 v: T,
18072 ) -> Self {
18073 self.process_endpoint = v.into();
18074 self
18075 }
18076
18077 /// Sets the value of [create_time][crate::model::Processor::create_time].
18078 ///
18079 /// # Example
18080 /// ```ignore,no_run
18081 /// # use google_cloud_documentai_v1::model::Processor;
18082 /// use wkt::Timestamp;
18083 /// let x = Processor::new().set_create_time(Timestamp::default()/* use setters */);
18084 /// ```
18085 pub fn set_create_time<T>(mut self, v: T) -> Self
18086 where
18087 T: std::convert::Into<wkt::Timestamp>,
18088 {
18089 self.create_time = std::option::Option::Some(v.into());
18090 self
18091 }
18092
18093 /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
18094 ///
18095 /// # Example
18096 /// ```ignore,no_run
18097 /// # use google_cloud_documentai_v1::model::Processor;
18098 /// use wkt::Timestamp;
18099 /// let x = Processor::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18100 /// let x = Processor::new().set_or_clear_create_time(None::<Timestamp>);
18101 /// ```
18102 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18103 where
18104 T: std::convert::Into<wkt::Timestamp>,
18105 {
18106 self.create_time = v.map(|x| x.into());
18107 self
18108 }
18109
18110 /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
18111 ///
18112 /// # Example
18113 /// ```ignore,no_run
18114 /// # use google_cloud_documentai_v1::model::Processor;
18115 /// let x = Processor::new().set_kms_key_name("example");
18116 /// ```
18117 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18118 self.kms_key_name = v.into();
18119 self
18120 }
18121
18122 /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
18123 ///
18124 /// # Example
18125 /// ```ignore,no_run
18126 /// # use google_cloud_documentai_v1::model::Processor;
18127 /// let x = Processor::new().set_satisfies_pzs(true);
18128 /// ```
18129 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18130 self.satisfies_pzs = v.into();
18131 self
18132 }
18133
18134 /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
18135 ///
18136 /// # Example
18137 /// ```ignore,no_run
18138 /// # use google_cloud_documentai_v1::model::Processor;
18139 /// let x = Processor::new().set_satisfies_pzi(true);
18140 /// ```
18141 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18142 self.satisfies_pzi = v.into();
18143 self
18144 }
18145}
18146
18147impl wkt::message::Message for Processor {
18148 fn typename() -> &'static str {
18149 "type.googleapis.com/google.cloud.documentai.v1.Processor"
18150 }
18151}
18152
18153/// Defines additional types related to [Processor].
18154pub mod processor {
18155 #[allow(unused_imports)]
18156 use super::*;
18157
18158 /// The possible states of the processor.
18159 ///
18160 /// # Working with unknown values
18161 ///
18162 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18163 /// additional enum variants at any time. Adding new variants is not considered
18164 /// a breaking change. Applications should write their code in anticipation of:
18165 ///
18166 /// - New values appearing in future releases of the client library, **and**
18167 /// - New values received dynamically, without application changes.
18168 ///
18169 /// Please consult the [Working with enums] section in the user guide for some
18170 /// guidelines.
18171 ///
18172 /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
18173 #[derive(Clone, Debug, PartialEq)]
18174 #[non_exhaustive]
18175 pub enum State {
18176 /// The processor is in an unspecified state.
18177 Unspecified,
18178 /// The processor is enabled, i.e., has an enabled version which can
18179 /// currently serve processing requests and all the feature dependencies have
18180 /// been successfully initialized.
18181 Enabled,
18182 /// The processor is disabled.
18183 Disabled,
18184 /// The processor is being enabled, will become `ENABLED` if successful.
18185 Enabling,
18186 /// The processor is being disabled, will become `DISABLED` if successful.
18187 Disabling,
18188 /// The processor is being created, will become either `ENABLED` (for
18189 /// successful creation) or `FAILED` (for failed ones).
18190 /// Once a processor is in this state, it can then be used for document
18191 /// processing, but the feature dependencies of the processor might not be
18192 /// fully created yet.
18193 Creating,
18194 /// The processor failed during creation or initialization of feature
18195 /// dependencies. The user should delete the processor and recreate one as
18196 /// all the functionalities of the processor are disabled.
18197 Failed,
18198 /// The processor is being deleted, will be removed if successful.
18199 Deleting,
18200 /// If set, the enum was initialized with an unknown value.
18201 ///
18202 /// Applications can examine the value using [State::value] or
18203 /// [State::name].
18204 UnknownValue(state::UnknownValue),
18205 }
18206
18207 #[doc(hidden)]
18208 pub mod state {
18209 #[allow(unused_imports)]
18210 use super::*;
18211 #[derive(Clone, Debug, PartialEq)]
18212 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18213 }
18214
18215 impl State {
18216 /// Gets the enum value.
18217 ///
18218 /// Returns `None` if the enum contains an unknown value deserialized from
18219 /// the string representation of enums.
18220 pub fn value(&self) -> std::option::Option<i32> {
18221 match self {
18222 Self::Unspecified => std::option::Option::Some(0),
18223 Self::Enabled => std::option::Option::Some(1),
18224 Self::Disabled => std::option::Option::Some(2),
18225 Self::Enabling => std::option::Option::Some(3),
18226 Self::Disabling => std::option::Option::Some(4),
18227 Self::Creating => std::option::Option::Some(5),
18228 Self::Failed => std::option::Option::Some(6),
18229 Self::Deleting => std::option::Option::Some(7),
18230 Self::UnknownValue(u) => u.0.value(),
18231 }
18232 }
18233
18234 /// Gets the enum value as a string.
18235 ///
18236 /// Returns `None` if the enum contains an unknown value deserialized from
18237 /// the integer representation of enums.
18238 pub fn name(&self) -> std::option::Option<&str> {
18239 match self {
18240 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
18241 Self::Enabled => std::option::Option::Some("ENABLED"),
18242 Self::Disabled => std::option::Option::Some("DISABLED"),
18243 Self::Enabling => std::option::Option::Some("ENABLING"),
18244 Self::Disabling => std::option::Option::Some("DISABLING"),
18245 Self::Creating => std::option::Option::Some("CREATING"),
18246 Self::Failed => std::option::Option::Some("FAILED"),
18247 Self::Deleting => std::option::Option::Some("DELETING"),
18248 Self::UnknownValue(u) => u.0.name(),
18249 }
18250 }
18251 }
18252
18253 impl std::default::Default for State {
18254 fn default() -> Self {
18255 use std::convert::From;
18256 Self::from(0)
18257 }
18258 }
18259
18260 impl std::fmt::Display for State {
18261 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18262 wkt::internal::display_enum(f, self.name(), self.value())
18263 }
18264 }
18265
18266 impl std::convert::From<i32> for State {
18267 fn from(value: i32) -> Self {
18268 match value {
18269 0 => Self::Unspecified,
18270 1 => Self::Enabled,
18271 2 => Self::Disabled,
18272 3 => Self::Enabling,
18273 4 => Self::Disabling,
18274 5 => Self::Creating,
18275 6 => Self::Failed,
18276 7 => Self::Deleting,
18277 _ => Self::UnknownValue(state::UnknownValue(
18278 wkt::internal::UnknownEnumValue::Integer(value),
18279 )),
18280 }
18281 }
18282 }
18283
18284 impl std::convert::From<&str> for State {
18285 fn from(value: &str) -> Self {
18286 use std::string::ToString;
18287 match value {
18288 "STATE_UNSPECIFIED" => Self::Unspecified,
18289 "ENABLED" => Self::Enabled,
18290 "DISABLED" => Self::Disabled,
18291 "ENABLING" => Self::Enabling,
18292 "DISABLING" => Self::Disabling,
18293 "CREATING" => Self::Creating,
18294 "FAILED" => Self::Failed,
18295 "DELETING" => Self::Deleting,
18296 _ => Self::UnknownValue(state::UnknownValue(
18297 wkt::internal::UnknownEnumValue::String(value.to_string()),
18298 )),
18299 }
18300 }
18301 }
18302
18303 impl serde::ser::Serialize for State {
18304 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18305 where
18306 S: serde::Serializer,
18307 {
18308 match self {
18309 Self::Unspecified => serializer.serialize_i32(0),
18310 Self::Enabled => serializer.serialize_i32(1),
18311 Self::Disabled => serializer.serialize_i32(2),
18312 Self::Enabling => serializer.serialize_i32(3),
18313 Self::Disabling => serializer.serialize_i32(4),
18314 Self::Creating => serializer.serialize_i32(5),
18315 Self::Failed => serializer.serialize_i32(6),
18316 Self::Deleting => serializer.serialize_i32(7),
18317 Self::UnknownValue(u) => u.0.serialize(serializer),
18318 }
18319 }
18320 }
18321
18322 impl<'de> serde::de::Deserialize<'de> for State {
18323 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18324 where
18325 D: serde::Deserializer<'de>,
18326 {
18327 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18328 ".google.cloud.documentai.v1.Processor.State",
18329 ))
18330 }
18331 }
18332}
18333
18334/// A processor type is responsible for performing a certain document
18335/// understanding task on a certain type of document.
18336#[derive(Clone, Default, PartialEq)]
18337#[non_exhaustive]
18338pub struct ProcessorType {
18339 /// The resource name of the processor type.
18340 /// Format: `projects/{project}/processorTypes/{processor_type}`
18341 pub name: std::string::String,
18342
18343 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
18344 pub r#type: std::string::String,
18345
18346 /// The processor category, used by UI to group processor types.
18347 pub category: std::string::String,
18348
18349 /// The locations in which this processor is available.
18350 pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
18351
18352 /// Whether the processor type allows creation. If true, users can create a
18353 /// processor of this processor type. Otherwise, users need to request access.
18354 pub allow_creation: bool,
18355
18356 /// Launch stage of the processor type
18357 pub launch_stage: api::model::LaunchStage,
18358
18359 /// A set of Cloud Storage URIs of sample documents for this processor.
18360 pub sample_document_uris: std::vec::Vec<std::string::String>,
18361
18362 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18363}
18364
18365impl ProcessorType {
18366 pub fn new() -> Self {
18367 std::default::Default::default()
18368 }
18369
18370 /// Sets the value of [name][crate::model::ProcessorType::name].
18371 ///
18372 /// # Example
18373 /// ```ignore,no_run
18374 /// # use google_cloud_documentai_v1::model::ProcessorType;
18375 /// let x = ProcessorType::new().set_name("example");
18376 /// ```
18377 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18378 self.name = v.into();
18379 self
18380 }
18381
18382 /// Sets the value of [r#type][crate::model::ProcessorType::type].
18383 ///
18384 /// # Example
18385 /// ```ignore,no_run
18386 /// # use google_cloud_documentai_v1::model::ProcessorType;
18387 /// let x = ProcessorType::new().set_type("example");
18388 /// ```
18389 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18390 self.r#type = v.into();
18391 self
18392 }
18393
18394 /// Sets the value of [category][crate::model::ProcessorType::category].
18395 ///
18396 /// # Example
18397 /// ```ignore,no_run
18398 /// # use google_cloud_documentai_v1::model::ProcessorType;
18399 /// let x = ProcessorType::new().set_category("example");
18400 /// ```
18401 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18402 self.category = v.into();
18403 self
18404 }
18405
18406 /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
18407 ///
18408 /// # Example
18409 /// ```ignore,no_run
18410 /// # use google_cloud_documentai_v1::model::ProcessorType;
18411 /// use google_cloud_documentai_v1::model::processor_type::LocationInfo;
18412 /// let x = ProcessorType::new()
18413 /// .set_available_locations([
18414 /// LocationInfo::default()/* use setters */,
18415 /// LocationInfo::default()/* use (different) setters */,
18416 /// ]);
18417 /// ```
18418 pub fn set_available_locations<T, V>(mut self, v: T) -> Self
18419 where
18420 T: std::iter::IntoIterator<Item = V>,
18421 V: std::convert::Into<crate::model::processor_type::LocationInfo>,
18422 {
18423 use std::iter::Iterator;
18424 self.available_locations = v.into_iter().map(|i| i.into()).collect();
18425 self
18426 }
18427
18428 /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
18429 ///
18430 /// # Example
18431 /// ```ignore,no_run
18432 /// # use google_cloud_documentai_v1::model::ProcessorType;
18433 /// let x = ProcessorType::new().set_allow_creation(true);
18434 /// ```
18435 pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18436 self.allow_creation = v.into();
18437 self
18438 }
18439
18440 /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
18441 ///
18442 /// # Example
18443 /// ```ignore,no_run
18444 /// # use google_cloud_documentai_v1::model::ProcessorType;
18445 /// use api::model::LaunchStage;
18446 /// let x0 = ProcessorType::new().set_launch_stage(LaunchStage::Unimplemented);
18447 /// let x1 = ProcessorType::new().set_launch_stage(LaunchStage::Prelaunch);
18448 /// let x2 = ProcessorType::new().set_launch_stage(LaunchStage::EarlyAccess);
18449 /// ```
18450 pub fn set_launch_stage<T: std::convert::Into<api::model::LaunchStage>>(
18451 mut self,
18452 v: T,
18453 ) -> Self {
18454 self.launch_stage = v.into();
18455 self
18456 }
18457
18458 /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
18459 ///
18460 /// # Example
18461 /// ```ignore,no_run
18462 /// # use google_cloud_documentai_v1::model::ProcessorType;
18463 /// let x = ProcessorType::new().set_sample_document_uris(["a", "b", "c"]);
18464 /// ```
18465 pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
18466 where
18467 T: std::iter::IntoIterator<Item = V>,
18468 V: std::convert::Into<std::string::String>,
18469 {
18470 use std::iter::Iterator;
18471 self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
18472 self
18473 }
18474}
18475
18476impl wkt::message::Message for ProcessorType {
18477 fn typename() -> &'static str {
18478 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
18479 }
18480}
18481
18482/// Defines additional types related to [ProcessorType].
18483pub mod processor_type {
18484 #[allow(unused_imports)]
18485 use super::*;
18486
18487 /// The location information about where the processor is available.
18488 #[derive(Clone, Default, PartialEq)]
18489 #[non_exhaustive]
18490 pub struct LocationInfo {
18491 /// The location ID. For supported locations, refer to [regional and
18492 /// multi-regional support](/document-ai/docs/regions).
18493 pub location_id: std::string::String,
18494
18495 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18496 }
18497
18498 impl LocationInfo {
18499 pub fn new() -> Self {
18500 std::default::Default::default()
18501 }
18502
18503 /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
18504 ///
18505 /// # Example
18506 /// ```ignore,no_run
18507 /// # use google_cloud_documentai_v1::model::processor_type::LocationInfo;
18508 /// let x = LocationInfo::new().set_location_id("example");
18509 /// ```
18510 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18511 self.location_id = v.into();
18512 self
18513 }
18514 }
18515
18516 impl wkt::message::Message for LocationInfo {
18517 fn typename() -> &'static str {
18518 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
18519 }
18520 }
18521}