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 async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_rpc;
29extern crate google_cloud_type;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Encodes the detailed information of a barcode.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Barcode {
45 /// Format of a barcode.
46 /// The supported formats are:
47 ///
48 /// - `CODE_128`: Code 128 type.
49 /// - `CODE_39`: Code 39 type.
50 /// - `CODE_93`: Code 93 type.
51 /// - `CODABAR`: Codabar type.
52 /// - `DATA_MATRIX`: 2D Data Matrix type.
53 /// - `ITF`: ITF type.
54 /// - `EAN_13`: EAN-13 type.
55 /// - `EAN_8`: EAN-8 type.
56 /// - `QR_CODE`: 2D QR code type.
57 /// - `UPC_A`: UPC-A type.
58 /// - `UPC_E`: UPC-E type.
59 /// - `PDF417`: PDF417 type.
60 /// - `AZTEC`: 2D Aztec code type.
61 /// - `DATABAR`: GS1 DataBar code type.
62 pub format: std::string::String,
63
64 /// Value format describes the format of the value that a barcode
65 /// encodes.
66 /// The supported formats are:
67 ///
68 /// - `CONTACT_INFO`: Contact information.
69 /// - `EMAIL`: Email address.
70 /// - `ISBN`: ISBN identifier.
71 /// - `PHONE`: Phone number.
72 /// - `PRODUCT`: Product.
73 /// - `SMS`: SMS message.
74 /// - `TEXT`: Text string.
75 /// - `URL`: URL address.
76 /// - `WIFI`: Wifi information.
77 /// - `GEO`: Geo-localization.
78 /// - `CALENDAR_EVENT`: Calendar event.
79 /// - `DRIVER_LICENSE`: Driver's license.
80 pub value_format: std::string::String,
81
82 /// Raw value encoded in the barcode.
83 /// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com>;;'`.
84 pub raw_value: std::string::String,
85
86 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl Barcode {
90 pub fn new() -> Self {
91 std::default::Default::default()
92 }
93
94 /// Sets the value of [format][crate::model::Barcode::format].
95 ///
96 /// # Example
97 /// ```ignore,no_run
98 /// # use google_cloud_documentai_v1::model::Barcode;
99 /// let x = Barcode::new().set_format("example");
100 /// ```
101 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
102 self.format = v.into();
103 self
104 }
105
106 /// Sets the value of [value_format][crate::model::Barcode::value_format].
107 ///
108 /// # Example
109 /// ```ignore,no_run
110 /// # use google_cloud_documentai_v1::model::Barcode;
111 /// let x = Barcode::new().set_value_format("example");
112 /// ```
113 pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
114 self.value_format = v.into();
115 self
116 }
117
118 /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
119 ///
120 /// # Example
121 /// ```ignore,no_run
122 /// # use google_cloud_documentai_v1::model::Barcode;
123 /// let x = Barcode::new().set_raw_value("example");
124 /// ```
125 pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
126 self.raw_value = v.into();
127 self
128 }
129}
130
131impl wkt::message::Message for Barcode {
132 fn typename() -> &'static str {
133 "type.googleapis.com/google.cloud.documentai.v1.Barcode"
134 }
135}
136
137/// Document represents the canonical document resource in Document AI. It is an
138/// interchange format that provides insights into documents and allows for
139/// collaboration between users and Document AI to iterate and optimize for
140/// quality.
141#[derive(Clone, Default, PartialEq)]
142#[non_exhaustive]
143pub struct Document {
144 /// Optional. An internal identifier for document. Should be loggable (no PII).
145 pub docid: std::string::String,
146
147 /// An IANA published [media type (MIME
148 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
149 pub mime_type: std::string::String,
150
151 /// Optional. UTF-8 encoded text in reading order from the document.
152 pub text: std::string::String,
153
154 /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
155 ///
156 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
157 #[deprecated]
158 pub text_styles: std::vec::Vec<crate::model::document::Style>,
159
160 /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
161 ///
162 /// [google.cloud.documentai.v1.Document]: crate::model::Document
163 pub pages: std::vec::Vec<crate::model::document::Page>,
164
165 /// A list of entities detected on
166 /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
167 /// shards, entities in this list may cross shard boundaries.
168 ///
169 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
170 pub entities: std::vec::Vec<crate::model::document::Entity>,
171
172 /// Placeholder. Relationship among
173 /// [Document.entities][google.cloud.documentai.v1.Document.entities].
174 ///
175 /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
176 pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
177
178 /// Placeholder. A list of text corrections made to
179 /// [Document.text][google.cloud.documentai.v1.Document.text]. This is usually
180 /// used for annotating corrections to OCR mistakes. Text changes for a given
181 /// revision may not overlap with each other.
182 ///
183 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
184 pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
185
186 /// Information about the sharding if this document is sharded part of a larger
187 /// document. If the document is not sharded, this message is not specified.
188 pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
189
190 /// Any error that occurred while processing this document.
191 pub error: std::option::Option<google_cloud_rpc::model::Status>,
192
193 /// Placeholder. Revision history of this document.
194 pub revisions: std::vec::Vec<crate::model::document::Revision>,
195
196 /// Parsed layout of the document.
197 pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
198
199 /// Document chunked based on chunking config.
200 pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
201
202 /// Optional. The blob assets in this document. This is used to store the
203 /// content of the inline blobs in this document, for example, image bytes,
204 /// such that it can be referenced by other fields in the document via asset
205 /// id.
206 pub blob_assets: std::vec::Vec<crate::model::document::BlobAsset>,
207
208 /// The entity validation output for the document. This is the validation
209 /// output for `document.entities` field.
210 pub entity_validation_output:
211 std::option::Option<crate::model::document::EntityValidationOutput>,
212
213 /// A list of entity revisions. The entity revisions are appended to the
214 /// document in the processing order. This field can be used for comparing the
215 /// entity extraction results at different stages of the processing.
216 pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
217
218 /// The entity revision ID that `document.entities` field is based on.
219 /// If this field is set and `entities_revisions` is not empty, the entities in
220 /// `document.entities` field are the entities in the entity revision with this
221 /// id and `document.entity_validation_output` field is the
222 /// `entity_validation_output` field in this entity revision.
223 pub entities_revision_id: std::string::String,
224
225 /// Original source document from the user.
226 pub source: std::option::Option<crate::model::document::Source>,
227
228 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
229}
230
231impl Document {
232 pub fn new() -> Self {
233 std::default::Default::default()
234 }
235
236 /// Sets the value of [docid][crate::model::Document::docid].
237 ///
238 /// # Example
239 /// ```ignore,no_run
240 /// # use google_cloud_documentai_v1::model::Document;
241 /// let x = Document::new().set_docid("example");
242 /// ```
243 pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
244 self.docid = v.into();
245 self
246 }
247
248 /// Sets the value of [mime_type][crate::model::Document::mime_type].
249 ///
250 /// # Example
251 /// ```ignore,no_run
252 /// # use google_cloud_documentai_v1::model::Document;
253 /// let x = Document::new().set_mime_type("example");
254 /// ```
255 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
256 self.mime_type = v.into();
257 self
258 }
259
260 /// Sets the value of [text][crate::model::Document::text].
261 ///
262 /// # Example
263 /// ```ignore,no_run
264 /// # use google_cloud_documentai_v1::model::Document;
265 /// let x = Document::new().set_text("example");
266 /// ```
267 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
268 self.text = v.into();
269 self
270 }
271
272 /// Sets the value of [text_styles][crate::model::Document::text_styles].
273 ///
274 /// # Example
275 /// ```ignore,no_run
276 /// # use google_cloud_documentai_v1::model::Document;
277 /// use google_cloud_documentai_v1::model::document::Style;
278 /// let x = Document::new()
279 /// .set_text_styles([
280 /// Style::default()/* use setters */,
281 /// Style::default()/* use (different) setters */,
282 /// ]);
283 /// ```
284 #[deprecated]
285 pub fn set_text_styles<T, V>(mut self, v: T) -> Self
286 where
287 T: std::iter::IntoIterator<Item = V>,
288 V: std::convert::Into<crate::model::document::Style>,
289 {
290 use std::iter::Iterator;
291 self.text_styles = v.into_iter().map(|i| i.into()).collect();
292 self
293 }
294
295 /// Sets the value of [pages][crate::model::Document::pages].
296 ///
297 /// # Example
298 /// ```ignore,no_run
299 /// # use google_cloud_documentai_v1::model::Document;
300 /// use google_cloud_documentai_v1::model::document::Page;
301 /// let x = Document::new()
302 /// .set_pages([
303 /// Page::default()/* use setters */,
304 /// Page::default()/* use (different) setters */,
305 /// ]);
306 /// ```
307 pub fn set_pages<T, V>(mut self, v: T) -> Self
308 where
309 T: std::iter::IntoIterator<Item = V>,
310 V: std::convert::Into<crate::model::document::Page>,
311 {
312 use std::iter::Iterator;
313 self.pages = v.into_iter().map(|i| i.into()).collect();
314 self
315 }
316
317 /// Sets the value of [entities][crate::model::Document::entities].
318 ///
319 /// # Example
320 /// ```ignore,no_run
321 /// # use google_cloud_documentai_v1::model::Document;
322 /// use google_cloud_documentai_v1::model::document::Entity;
323 /// let x = Document::new()
324 /// .set_entities([
325 /// Entity::default()/* use setters */,
326 /// Entity::default()/* use (different) setters */,
327 /// ]);
328 /// ```
329 pub fn set_entities<T, V>(mut self, v: T) -> Self
330 where
331 T: std::iter::IntoIterator<Item = V>,
332 V: std::convert::Into<crate::model::document::Entity>,
333 {
334 use std::iter::Iterator;
335 self.entities = v.into_iter().map(|i| i.into()).collect();
336 self
337 }
338
339 /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
340 ///
341 /// # Example
342 /// ```ignore,no_run
343 /// # use google_cloud_documentai_v1::model::Document;
344 /// use google_cloud_documentai_v1::model::document::EntityRelation;
345 /// let x = Document::new()
346 /// .set_entity_relations([
347 /// EntityRelation::default()/* use setters */,
348 /// EntityRelation::default()/* use (different) setters */,
349 /// ]);
350 /// ```
351 pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
352 where
353 T: std::iter::IntoIterator<Item = V>,
354 V: std::convert::Into<crate::model::document::EntityRelation>,
355 {
356 use std::iter::Iterator;
357 self.entity_relations = v.into_iter().map(|i| i.into()).collect();
358 self
359 }
360
361 /// Sets the value of [text_changes][crate::model::Document::text_changes].
362 ///
363 /// # Example
364 /// ```ignore,no_run
365 /// # use google_cloud_documentai_v1::model::Document;
366 /// use google_cloud_documentai_v1::model::document::TextChange;
367 /// let x = Document::new()
368 /// .set_text_changes([
369 /// TextChange::default()/* use setters */,
370 /// TextChange::default()/* use (different) setters */,
371 /// ]);
372 /// ```
373 pub fn set_text_changes<T, V>(mut self, v: T) -> Self
374 where
375 T: std::iter::IntoIterator<Item = V>,
376 V: std::convert::Into<crate::model::document::TextChange>,
377 {
378 use std::iter::Iterator;
379 self.text_changes = v.into_iter().map(|i| i.into()).collect();
380 self
381 }
382
383 /// Sets the value of [shard_info][crate::model::Document::shard_info].
384 ///
385 /// # Example
386 /// ```ignore,no_run
387 /// # use google_cloud_documentai_v1::model::Document;
388 /// use google_cloud_documentai_v1::model::document::ShardInfo;
389 /// let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);
390 /// ```
391 pub fn set_shard_info<T>(mut self, v: T) -> Self
392 where
393 T: std::convert::Into<crate::model::document::ShardInfo>,
394 {
395 self.shard_info = std::option::Option::Some(v.into());
396 self
397 }
398
399 /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
400 ///
401 /// # Example
402 /// ```ignore,no_run
403 /// # use google_cloud_documentai_v1::model::Document;
404 /// use google_cloud_documentai_v1::model::document::ShardInfo;
405 /// let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
406 /// let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);
407 /// ```
408 pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
409 where
410 T: std::convert::Into<crate::model::document::ShardInfo>,
411 {
412 self.shard_info = v.map(|x| x.into());
413 self
414 }
415
416 /// Sets the value of [error][crate::model::Document::error].
417 ///
418 /// # Example
419 /// ```ignore,no_run
420 /// # use google_cloud_documentai_v1::model::Document;
421 /// use google_cloud_rpc::model::Status;
422 /// let x = Document::new().set_error(Status::default()/* use setters */);
423 /// ```
424 pub fn set_error<T>(mut self, v: T) -> Self
425 where
426 T: std::convert::Into<google_cloud_rpc::model::Status>,
427 {
428 self.error = std::option::Option::Some(v.into());
429 self
430 }
431
432 /// Sets or clears the value of [error][crate::model::Document::error].
433 ///
434 /// # Example
435 /// ```ignore,no_run
436 /// # use google_cloud_documentai_v1::model::Document;
437 /// use google_cloud_rpc::model::Status;
438 /// let x = Document::new().set_or_clear_error(Some(Status::default()/* use setters */));
439 /// let x = Document::new().set_or_clear_error(None::<Status>);
440 /// ```
441 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
442 where
443 T: std::convert::Into<google_cloud_rpc::model::Status>,
444 {
445 self.error = v.map(|x| x.into());
446 self
447 }
448
449 /// Sets the value of [revisions][crate::model::Document::revisions].
450 ///
451 /// # Example
452 /// ```ignore,no_run
453 /// # use google_cloud_documentai_v1::model::Document;
454 /// use google_cloud_documentai_v1::model::document::Revision;
455 /// let x = Document::new()
456 /// .set_revisions([
457 /// Revision::default()/* use setters */,
458 /// Revision::default()/* use (different) setters */,
459 /// ]);
460 /// ```
461 pub fn set_revisions<T, V>(mut self, v: T) -> Self
462 where
463 T: std::iter::IntoIterator<Item = V>,
464 V: std::convert::Into<crate::model::document::Revision>,
465 {
466 use std::iter::Iterator;
467 self.revisions = v.into_iter().map(|i| i.into()).collect();
468 self
469 }
470
471 /// Sets the value of [document_layout][crate::model::Document::document_layout].
472 ///
473 /// # Example
474 /// ```ignore,no_run
475 /// # use google_cloud_documentai_v1::model::Document;
476 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
477 /// let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);
478 /// ```
479 pub fn set_document_layout<T>(mut self, v: T) -> Self
480 where
481 T: std::convert::Into<crate::model::document::DocumentLayout>,
482 {
483 self.document_layout = std::option::Option::Some(v.into());
484 self
485 }
486
487 /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
488 ///
489 /// # Example
490 /// ```ignore,no_run
491 /// # use google_cloud_documentai_v1::model::Document;
492 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
493 /// let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
494 /// let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);
495 /// ```
496 pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
497 where
498 T: std::convert::Into<crate::model::document::DocumentLayout>,
499 {
500 self.document_layout = v.map(|x| x.into());
501 self
502 }
503
504 /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
505 ///
506 /// # Example
507 /// ```ignore,no_run
508 /// # use google_cloud_documentai_v1::model::Document;
509 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
510 /// let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);
511 /// ```
512 pub fn set_chunked_document<T>(mut self, v: T) -> Self
513 where
514 T: std::convert::Into<crate::model::document::ChunkedDocument>,
515 {
516 self.chunked_document = std::option::Option::Some(v.into());
517 self
518 }
519
520 /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
521 ///
522 /// # Example
523 /// ```ignore,no_run
524 /// # use google_cloud_documentai_v1::model::Document;
525 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
526 /// let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
527 /// let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);
528 /// ```
529 pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
530 where
531 T: std::convert::Into<crate::model::document::ChunkedDocument>,
532 {
533 self.chunked_document = v.map(|x| x.into());
534 self
535 }
536
537 /// Sets the value of [blob_assets][crate::model::Document::blob_assets].
538 ///
539 /// # Example
540 /// ```ignore,no_run
541 /// # use google_cloud_documentai_v1::model::Document;
542 /// use google_cloud_documentai_v1::model::document::BlobAsset;
543 /// let x = Document::new()
544 /// .set_blob_assets([
545 /// BlobAsset::default()/* use setters */,
546 /// BlobAsset::default()/* use (different) setters */,
547 /// ]);
548 /// ```
549 pub fn set_blob_assets<T, V>(mut self, v: T) -> Self
550 where
551 T: std::iter::IntoIterator<Item = V>,
552 V: std::convert::Into<crate::model::document::BlobAsset>,
553 {
554 use std::iter::Iterator;
555 self.blob_assets = v.into_iter().map(|i| i.into()).collect();
556 self
557 }
558
559 /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
560 ///
561 /// # Example
562 /// ```ignore,no_run
563 /// # use google_cloud_documentai_v1::model::Document;
564 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
565 /// let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
566 /// ```
567 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
568 where
569 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
570 {
571 self.entity_validation_output = std::option::Option::Some(v.into());
572 self
573 }
574
575 /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
576 ///
577 /// # Example
578 /// ```ignore,no_run
579 /// # use google_cloud_documentai_v1::model::Document;
580 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
581 /// let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
582 /// let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
583 /// ```
584 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
585 where
586 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
587 {
588 self.entity_validation_output = v.map(|x| x.into());
589 self
590 }
591
592 /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
593 ///
594 /// # Example
595 /// ```ignore,no_run
596 /// # use google_cloud_documentai_v1::model::Document;
597 /// use google_cloud_documentai_v1::model::document::EntitiesRevision;
598 /// let x = Document::new()
599 /// .set_entities_revisions([
600 /// EntitiesRevision::default()/* use setters */,
601 /// EntitiesRevision::default()/* use (different) setters */,
602 /// ]);
603 /// ```
604 pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
605 where
606 T: std::iter::IntoIterator<Item = V>,
607 V: std::convert::Into<crate::model::document::EntitiesRevision>,
608 {
609 use std::iter::Iterator;
610 self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
611 self
612 }
613
614 /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
615 ///
616 /// # Example
617 /// ```ignore,no_run
618 /// # use google_cloud_documentai_v1::model::Document;
619 /// let x = Document::new().set_entities_revision_id("example");
620 /// ```
621 pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
622 mut self,
623 v: T,
624 ) -> Self {
625 self.entities_revision_id = v.into();
626 self
627 }
628
629 /// Sets the value of [source][crate::model::Document::source].
630 ///
631 /// Note that all the setters affecting `source` are mutually
632 /// exclusive.
633 ///
634 /// # Example
635 /// ```ignore,no_run
636 /// # use google_cloud_documentai_v1::model::Document;
637 /// use google_cloud_documentai_v1::model::document::Source;
638 /// let x = Document::new().set_source(Some(Source::Uri("example".to_string())));
639 /// ```
640 pub fn set_source<
641 T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
642 >(
643 mut self,
644 v: T,
645 ) -> Self {
646 self.source = v.into();
647 self
648 }
649
650 /// The value of [source][crate::model::Document::source]
651 /// if it holds a `Uri`, `None` if the field is not set or
652 /// holds a different branch.
653 pub fn uri(&self) -> std::option::Option<&std::string::String> {
654 #[allow(unreachable_patterns)]
655 self.source.as_ref().and_then(|v| match v {
656 crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
657 _ => std::option::Option::None,
658 })
659 }
660
661 /// Sets the value of [source][crate::model::Document::source]
662 /// to hold a `Uri`.
663 ///
664 /// Note that all the setters affecting `source` are
665 /// mutually exclusive.
666 ///
667 /// # Example
668 /// ```ignore,no_run
669 /// # use google_cloud_documentai_v1::model::Document;
670 /// let x = Document::new().set_uri("example");
671 /// assert!(x.uri().is_some());
672 /// assert!(x.content().is_none());
673 /// ```
674 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
675 self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
676 self
677 }
678
679 /// The value of [source][crate::model::Document::source]
680 /// if it holds a `Content`, `None` if the field is not set or
681 /// holds a different branch.
682 pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
683 #[allow(unreachable_patterns)]
684 self.source.as_ref().and_then(|v| match v {
685 crate::model::document::Source::Content(v) => std::option::Option::Some(v),
686 _ => std::option::Option::None,
687 })
688 }
689
690 /// Sets the value of [source][crate::model::Document::source]
691 /// to hold a `Content`.
692 ///
693 /// Note that all the setters affecting `source` are
694 /// mutually exclusive.
695 ///
696 /// # Example
697 /// ```ignore,no_run
698 /// # use google_cloud_documentai_v1::model::Document;
699 /// let x = Document::new().set_content(bytes::Bytes::from_static(b"example"));
700 /// assert!(x.content().is_some());
701 /// assert!(x.uri().is_none());
702 /// ```
703 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
704 self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
705 self
706 }
707}
708
709impl wkt::message::Message for Document {
710 fn typename() -> &'static str {
711 "type.googleapis.com/google.cloud.documentai.v1.Document"
712 }
713}
714
715/// Defines additional types related to [Document].
716pub mod document {
717 #[allow(unused_imports)]
718 use super::*;
719
720 /// For a large document, sharding may be performed to produce several
721 /// document shards. Each document shard contains this field to detail which
722 /// shard it is.
723 #[derive(Clone, Default, PartialEq)]
724 #[non_exhaustive]
725 pub struct ShardInfo {
726 /// The 0-based index of this shard.
727 pub shard_index: i64,
728
729 /// Total number of shards.
730 pub shard_count: i64,
731
732 /// The index of the first character in
733 /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
734 /// document global text.
735 ///
736 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
737 pub text_offset: i64,
738
739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
740 }
741
742 impl ShardInfo {
743 pub fn new() -> Self {
744 std::default::Default::default()
745 }
746
747 /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
748 ///
749 /// # Example
750 /// ```ignore,no_run
751 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
752 /// let x = ShardInfo::new().set_shard_index(42);
753 /// ```
754 pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
755 self.shard_index = v.into();
756 self
757 }
758
759 /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
760 ///
761 /// # Example
762 /// ```ignore,no_run
763 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
764 /// let x = ShardInfo::new().set_shard_count(42);
765 /// ```
766 pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
767 self.shard_count = v.into();
768 self
769 }
770
771 /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
772 ///
773 /// # Example
774 /// ```ignore,no_run
775 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
776 /// let x = ShardInfo::new().set_text_offset(42);
777 /// ```
778 pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
779 self.text_offset = v.into();
780 self
781 }
782 }
783
784 impl wkt::message::Message for ShardInfo {
785 fn typename() -> &'static str {
786 "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
787 }
788 }
789
790 /// Annotation for common text style attributes. This adheres to CSS
791 /// conventions as much as possible.
792 #[derive(Clone, Default, PartialEq)]
793 #[non_exhaustive]
794 pub struct Style {
795 /// Text anchor indexing into the
796 /// [Document.text][google.cloud.documentai.v1.Document.text].
797 ///
798 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
799 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
800
801 /// Text color.
802 pub color: std::option::Option<google_cloud_type::model::Color>,
803
804 /// Text background color.
805 pub background_color: std::option::Option<google_cloud_type::model::Color>,
806
807 /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
808 /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
809 pub font_weight: std::string::String,
810
811 /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
812 /// Possible values are `normal`, `italic`, and `oblique`.
813 pub text_style: std::string::String,
814
815 /// [Text
816 /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
817 /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
818 /// \<text-decoration-style\>
819 pub text_decoration: std::string::String,
820
821 /// Font size.
822 pub font_size: std::option::Option<crate::model::document::style::FontSize>,
823
824 /// Font family such as `Arial`, `Times New Roman`.
825 /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
826 pub font_family: std::string::String,
827
828 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
829 }
830
831 impl Style {
832 pub fn new() -> Self {
833 std::default::Default::default()
834 }
835
836 /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
837 ///
838 /// # Example
839 /// ```ignore,no_run
840 /// # use google_cloud_documentai_v1::model::document::Style;
841 /// use google_cloud_documentai_v1::model::document::TextAnchor;
842 /// let x = Style::new().set_text_anchor(TextAnchor::default()/* use setters */);
843 /// ```
844 pub fn set_text_anchor<T>(mut self, v: T) -> Self
845 where
846 T: std::convert::Into<crate::model::document::TextAnchor>,
847 {
848 self.text_anchor = std::option::Option::Some(v.into());
849 self
850 }
851
852 /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
853 ///
854 /// # Example
855 /// ```ignore,no_run
856 /// # use google_cloud_documentai_v1::model::document::Style;
857 /// use google_cloud_documentai_v1::model::document::TextAnchor;
858 /// let x = Style::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
859 /// let x = Style::new().set_or_clear_text_anchor(None::<TextAnchor>);
860 /// ```
861 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
862 where
863 T: std::convert::Into<crate::model::document::TextAnchor>,
864 {
865 self.text_anchor = v.map(|x| x.into());
866 self
867 }
868
869 /// Sets the value of [color][crate::model::document::Style::color].
870 ///
871 /// # Example
872 /// ```ignore,no_run
873 /// # use google_cloud_documentai_v1::model::document::Style;
874 /// use google_cloud_type::model::Color;
875 /// let x = Style::new().set_color(Color::default()/* use setters */);
876 /// ```
877 pub fn set_color<T>(mut self, v: T) -> Self
878 where
879 T: std::convert::Into<google_cloud_type::model::Color>,
880 {
881 self.color = std::option::Option::Some(v.into());
882 self
883 }
884
885 /// Sets or clears the value of [color][crate::model::document::Style::color].
886 ///
887 /// # Example
888 /// ```ignore,no_run
889 /// # use google_cloud_documentai_v1::model::document::Style;
890 /// use google_cloud_type::model::Color;
891 /// let x = Style::new().set_or_clear_color(Some(Color::default()/* use setters */));
892 /// let x = Style::new().set_or_clear_color(None::<Color>);
893 /// ```
894 pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
895 where
896 T: std::convert::Into<google_cloud_type::model::Color>,
897 {
898 self.color = v.map(|x| x.into());
899 self
900 }
901
902 /// Sets the value of [background_color][crate::model::document::Style::background_color].
903 ///
904 /// # Example
905 /// ```ignore,no_run
906 /// # use google_cloud_documentai_v1::model::document::Style;
907 /// use google_cloud_type::model::Color;
908 /// let x = Style::new().set_background_color(Color::default()/* use setters */);
909 /// ```
910 pub fn set_background_color<T>(mut self, v: T) -> Self
911 where
912 T: std::convert::Into<google_cloud_type::model::Color>,
913 {
914 self.background_color = std::option::Option::Some(v.into());
915 self
916 }
917
918 /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
919 ///
920 /// # Example
921 /// ```ignore,no_run
922 /// # use google_cloud_documentai_v1::model::document::Style;
923 /// use google_cloud_type::model::Color;
924 /// let x = Style::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
925 /// let x = Style::new().set_or_clear_background_color(None::<Color>);
926 /// ```
927 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
928 where
929 T: std::convert::Into<google_cloud_type::model::Color>,
930 {
931 self.background_color = v.map(|x| x.into());
932 self
933 }
934
935 /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
936 ///
937 /// # Example
938 /// ```ignore,no_run
939 /// # use google_cloud_documentai_v1::model::document::Style;
940 /// let x = Style::new().set_font_weight("example");
941 /// ```
942 pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
943 self.font_weight = v.into();
944 self
945 }
946
947 /// Sets the value of [text_style][crate::model::document::Style::text_style].
948 ///
949 /// # Example
950 /// ```ignore,no_run
951 /// # use google_cloud_documentai_v1::model::document::Style;
952 /// let x = Style::new().set_text_style("example");
953 /// ```
954 pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
955 self.text_style = v.into();
956 self
957 }
958
959 /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
960 ///
961 /// # Example
962 /// ```ignore,no_run
963 /// # use google_cloud_documentai_v1::model::document::Style;
964 /// let x = Style::new().set_text_decoration("example");
965 /// ```
966 pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
967 mut self,
968 v: T,
969 ) -> Self {
970 self.text_decoration = v.into();
971 self
972 }
973
974 /// Sets the value of [font_size][crate::model::document::Style::font_size].
975 ///
976 /// # Example
977 /// ```ignore,no_run
978 /// # use google_cloud_documentai_v1::model::document::Style;
979 /// use google_cloud_documentai_v1::model::document::style::FontSize;
980 /// let x = Style::new().set_font_size(FontSize::default()/* use setters */);
981 /// ```
982 pub fn set_font_size<T>(mut self, v: T) -> Self
983 where
984 T: std::convert::Into<crate::model::document::style::FontSize>,
985 {
986 self.font_size = std::option::Option::Some(v.into());
987 self
988 }
989
990 /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
991 ///
992 /// # Example
993 /// ```ignore,no_run
994 /// # use google_cloud_documentai_v1::model::document::Style;
995 /// use google_cloud_documentai_v1::model::document::style::FontSize;
996 /// let x = Style::new().set_or_clear_font_size(Some(FontSize::default()/* use setters */));
997 /// let x = Style::new().set_or_clear_font_size(None::<FontSize>);
998 /// ```
999 pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
1000 where
1001 T: std::convert::Into<crate::model::document::style::FontSize>,
1002 {
1003 self.font_size = v.map(|x| x.into());
1004 self
1005 }
1006
1007 /// Sets the value of [font_family][crate::model::document::Style::font_family].
1008 ///
1009 /// # Example
1010 /// ```ignore,no_run
1011 /// # use google_cloud_documentai_v1::model::document::Style;
1012 /// let x = Style::new().set_font_family("example");
1013 /// ```
1014 pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1015 self.font_family = v.into();
1016 self
1017 }
1018 }
1019
1020 impl wkt::message::Message for Style {
1021 fn typename() -> &'static str {
1022 "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
1023 }
1024 }
1025
1026 /// Defines additional types related to [Style].
1027 pub mod style {
1028 #[allow(unused_imports)]
1029 use super::*;
1030
1031 /// Font size with unit.
1032 #[derive(Clone, Default, PartialEq)]
1033 #[non_exhaustive]
1034 pub struct FontSize {
1035 /// Font size for the text.
1036 pub size: f32,
1037
1038 /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
1039 /// `pt`).
1040 pub unit: std::string::String,
1041
1042 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1043 }
1044
1045 impl FontSize {
1046 pub fn new() -> Self {
1047 std::default::Default::default()
1048 }
1049
1050 /// Sets the value of [size][crate::model::document::style::FontSize::size].
1051 ///
1052 /// # Example
1053 /// ```ignore,no_run
1054 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1055 /// let x = FontSize::new().set_size(42.0);
1056 /// ```
1057 pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1058 self.size = v.into();
1059 self
1060 }
1061
1062 /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
1063 ///
1064 /// # Example
1065 /// ```ignore,no_run
1066 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1067 /// let x = FontSize::new().set_unit("example");
1068 /// ```
1069 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1070 self.unit = v.into();
1071 self
1072 }
1073 }
1074
1075 impl wkt::message::Message for FontSize {
1076 fn typename() -> &'static str {
1077 "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
1078 }
1079 }
1080 }
1081
1082 /// A page in a [Document][google.cloud.documentai.v1.Document].
1083 ///
1084 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1085 #[derive(Clone, Default, PartialEq)]
1086 #[non_exhaustive]
1087 pub struct Page {
1088 /// 1-based index for current
1089 /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
1090 /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
1091 /// taken out of a [Document][google.cloud.documentai.v1.Document] for
1092 /// individual processing.
1093 ///
1094 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1095 /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
1096 pub page_number: i32,
1097
1098 /// Rendered image for this page. This image is preprocessed to remove any
1099 /// skew, rotation, and distortions such that the annotation bounding boxes
1100 /// can be upright and axis-aligned.
1101 pub image: std::option::Option<crate::model::document::page::Image>,
1102
1103 /// Transformation matrices that were applied to the original document image
1104 /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
1105 ///
1106 /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
1107 pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
1108
1109 /// Physical dimension of the page.
1110 pub dimension: std::option::Option<crate::model::document::page::Dimension>,
1111
1112 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
1113 ///
1114 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1115 pub layout: std::option::Option<crate::model::document::page::Layout>,
1116
1117 /// A list of detected languages together with confidence.
1118 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1119
1120 /// A list of visually detected text blocks on the page.
1121 /// A block has a set of lines (collected into paragraphs) that have a common
1122 /// line-spacing and orientation.
1123 pub blocks: std::vec::Vec<crate::model::document::page::Block>,
1124
1125 /// A list of visually detected text paragraphs on the page.
1126 /// A collection of lines that a human would perceive as a paragraph.
1127 pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
1128
1129 /// A list of visually detected text lines on the page.
1130 /// A collection of tokens that a human would perceive as a line.
1131 pub lines: std::vec::Vec<crate::model::document::page::Line>,
1132
1133 /// A list of visually detected tokens on the page.
1134 pub tokens: std::vec::Vec<crate::model::document::page::Token>,
1135
1136 /// A list of detected non-text visual elements, for example, checkbox,
1137 /// signature etc. on the page.
1138 pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
1139
1140 /// A list of visually detected tables on the page.
1141 pub tables: std::vec::Vec<crate::model::document::page::Table>,
1142
1143 /// A list of visually detected form fields on the page.
1144 pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
1145
1146 /// A list of visually detected symbols on the page.
1147 pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
1148
1149 /// A list of detected barcodes.
1150 pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
1151
1152 /// Image quality scores.
1153 pub image_quality_scores:
1154 std::option::Option<crate::model::document::page::ImageQualityScores>,
1155
1156 /// The history of this page.
1157 #[deprecated]
1158 pub provenance: std::option::Option<crate::model::document::Provenance>,
1159
1160 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1161 }
1162
1163 impl Page {
1164 pub fn new() -> Self {
1165 std::default::Default::default()
1166 }
1167
1168 /// Sets the value of [page_number][crate::model::document::Page::page_number].
1169 ///
1170 /// # Example
1171 /// ```ignore,no_run
1172 /// # use google_cloud_documentai_v1::model::document::Page;
1173 /// let x = Page::new().set_page_number(42);
1174 /// ```
1175 pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1176 self.page_number = v.into();
1177 self
1178 }
1179
1180 /// Sets the value of [image][crate::model::document::Page::image].
1181 ///
1182 /// # Example
1183 /// ```ignore,no_run
1184 /// # use google_cloud_documentai_v1::model::document::Page;
1185 /// use google_cloud_documentai_v1::model::document::page::Image;
1186 /// let x = Page::new().set_image(Image::default()/* use setters */);
1187 /// ```
1188 pub fn set_image<T>(mut self, v: T) -> Self
1189 where
1190 T: std::convert::Into<crate::model::document::page::Image>,
1191 {
1192 self.image = std::option::Option::Some(v.into());
1193 self
1194 }
1195
1196 /// Sets or clears the value of [image][crate::model::document::Page::image].
1197 ///
1198 /// # Example
1199 /// ```ignore,no_run
1200 /// # use google_cloud_documentai_v1::model::document::Page;
1201 /// use google_cloud_documentai_v1::model::document::page::Image;
1202 /// let x = Page::new().set_or_clear_image(Some(Image::default()/* use setters */));
1203 /// let x = Page::new().set_or_clear_image(None::<Image>);
1204 /// ```
1205 pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
1206 where
1207 T: std::convert::Into<crate::model::document::page::Image>,
1208 {
1209 self.image = v.map(|x| x.into());
1210 self
1211 }
1212
1213 /// Sets the value of [transforms][crate::model::document::Page::transforms].
1214 ///
1215 /// # Example
1216 /// ```ignore,no_run
1217 /// # use google_cloud_documentai_v1::model::document::Page;
1218 /// use google_cloud_documentai_v1::model::document::page::Matrix;
1219 /// let x = Page::new()
1220 /// .set_transforms([
1221 /// Matrix::default()/* use setters */,
1222 /// Matrix::default()/* use (different) setters */,
1223 /// ]);
1224 /// ```
1225 pub fn set_transforms<T, V>(mut self, v: T) -> Self
1226 where
1227 T: std::iter::IntoIterator<Item = V>,
1228 V: std::convert::Into<crate::model::document::page::Matrix>,
1229 {
1230 use std::iter::Iterator;
1231 self.transforms = v.into_iter().map(|i| i.into()).collect();
1232 self
1233 }
1234
1235 /// Sets the value of [dimension][crate::model::document::Page::dimension].
1236 ///
1237 /// # Example
1238 /// ```ignore,no_run
1239 /// # use google_cloud_documentai_v1::model::document::Page;
1240 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1241 /// let x = Page::new().set_dimension(Dimension::default()/* use setters */);
1242 /// ```
1243 pub fn set_dimension<T>(mut self, v: T) -> Self
1244 where
1245 T: std::convert::Into<crate::model::document::page::Dimension>,
1246 {
1247 self.dimension = std::option::Option::Some(v.into());
1248 self
1249 }
1250
1251 /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
1252 ///
1253 /// # Example
1254 /// ```ignore,no_run
1255 /// # use google_cloud_documentai_v1::model::document::Page;
1256 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1257 /// let x = Page::new().set_or_clear_dimension(Some(Dimension::default()/* use setters */));
1258 /// let x = Page::new().set_or_clear_dimension(None::<Dimension>);
1259 /// ```
1260 pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
1261 where
1262 T: std::convert::Into<crate::model::document::page::Dimension>,
1263 {
1264 self.dimension = v.map(|x| x.into());
1265 self
1266 }
1267
1268 /// Sets the value of [layout][crate::model::document::Page::layout].
1269 ///
1270 /// # Example
1271 /// ```ignore,no_run
1272 /// # use google_cloud_documentai_v1::model::document::Page;
1273 /// use google_cloud_documentai_v1::model::document::page::Layout;
1274 /// let x = Page::new().set_layout(Layout::default()/* use setters */);
1275 /// ```
1276 pub fn set_layout<T>(mut self, v: T) -> Self
1277 where
1278 T: std::convert::Into<crate::model::document::page::Layout>,
1279 {
1280 self.layout = std::option::Option::Some(v.into());
1281 self
1282 }
1283
1284 /// Sets or clears the value of [layout][crate::model::document::Page::layout].
1285 ///
1286 /// # Example
1287 /// ```ignore,no_run
1288 /// # use google_cloud_documentai_v1::model::document::Page;
1289 /// use google_cloud_documentai_v1::model::document::page::Layout;
1290 /// let x = Page::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
1291 /// let x = Page::new().set_or_clear_layout(None::<Layout>);
1292 /// ```
1293 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1294 where
1295 T: std::convert::Into<crate::model::document::page::Layout>,
1296 {
1297 self.layout = v.map(|x| x.into());
1298 self
1299 }
1300
1301 /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
1302 ///
1303 /// # Example
1304 /// ```ignore,no_run
1305 /// # use google_cloud_documentai_v1::model::document::Page;
1306 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
1307 /// let x = Page::new()
1308 /// .set_detected_languages([
1309 /// DetectedLanguage::default()/* use setters */,
1310 /// DetectedLanguage::default()/* use (different) setters */,
1311 /// ]);
1312 /// ```
1313 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1314 where
1315 T: std::iter::IntoIterator<Item = V>,
1316 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1317 {
1318 use std::iter::Iterator;
1319 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1320 self
1321 }
1322
1323 /// Sets the value of [blocks][crate::model::document::Page::blocks].
1324 ///
1325 /// # Example
1326 /// ```ignore,no_run
1327 /// # use google_cloud_documentai_v1::model::document::Page;
1328 /// use google_cloud_documentai_v1::model::document::page::Block;
1329 /// let x = Page::new()
1330 /// .set_blocks([
1331 /// Block::default()/* use setters */,
1332 /// Block::default()/* use (different) setters */,
1333 /// ]);
1334 /// ```
1335 pub fn set_blocks<T, V>(mut self, v: T) -> Self
1336 where
1337 T: std::iter::IntoIterator<Item = V>,
1338 V: std::convert::Into<crate::model::document::page::Block>,
1339 {
1340 use std::iter::Iterator;
1341 self.blocks = v.into_iter().map(|i| i.into()).collect();
1342 self
1343 }
1344
1345 /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
1346 ///
1347 /// # Example
1348 /// ```ignore,no_run
1349 /// # use google_cloud_documentai_v1::model::document::Page;
1350 /// use google_cloud_documentai_v1::model::document::page::Paragraph;
1351 /// let x = Page::new()
1352 /// .set_paragraphs([
1353 /// Paragraph::default()/* use setters */,
1354 /// Paragraph::default()/* use (different) setters */,
1355 /// ]);
1356 /// ```
1357 pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
1358 where
1359 T: std::iter::IntoIterator<Item = V>,
1360 V: std::convert::Into<crate::model::document::page::Paragraph>,
1361 {
1362 use std::iter::Iterator;
1363 self.paragraphs = v.into_iter().map(|i| i.into()).collect();
1364 self
1365 }
1366
1367 /// Sets the value of [lines][crate::model::document::Page::lines].
1368 ///
1369 /// # Example
1370 /// ```ignore,no_run
1371 /// # use google_cloud_documentai_v1::model::document::Page;
1372 /// use google_cloud_documentai_v1::model::document::page::Line;
1373 /// let x = Page::new()
1374 /// .set_lines([
1375 /// Line::default()/* use setters */,
1376 /// Line::default()/* use (different) setters */,
1377 /// ]);
1378 /// ```
1379 pub fn set_lines<T, V>(mut self, v: T) -> Self
1380 where
1381 T: std::iter::IntoIterator<Item = V>,
1382 V: std::convert::Into<crate::model::document::page::Line>,
1383 {
1384 use std::iter::Iterator;
1385 self.lines = v.into_iter().map(|i| i.into()).collect();
1386 self
1387 }
1388
1389 /// Sets the value of [tokens][crate::model::document::Page::tokens].
1390 ///
1391 /// # Example
1392 /// ```ignore,no_run
1393 /// # use google_cloud_documentai_v1::model::document::Page;
1394 /// use google_cloud_documentai_v1::model::document::page::Token;
1395 /// let x = Page::new()
1396 /// .set_tokens([
1397 /// Token::default()/* use setters */,
1398 /// Token::default()/* use (different) setters */,
1399 /// ]);
1400 /// ```
1401 pub fn set_tokens<T, V>(mut self, v: T) -> Self
1402 where
1403 T: std::iter::IntoIterator<Item = V>,
1404 V: std::convert::Into<crate::model::document::page::Token>,
1405 {
1406 use std::iter::Iterator;
1407 self.tokens = v.into_iter().map(|i| i.into()).collect();
1408 self
1409 }
1410
1411 /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
1412 ///
1413 /// # Example
1414 /// ```ignore,no_run
1415 /// # use google_cloud_documentai_v1::model::document::Page;
1416 /// use google_cloud_documentai_v1::model::document::page::VisualElement;
1417 /// let x = Page::new()
1418 /// .set_visual_elements([
1419 /// VisualElement::default()/* use setters */,
1420 /// VisualElement::default()/* use (different) setters */,
1421 /// ]);
1422 /// ```
1423 pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
1424 where
1425 T: std::iter::IntoIterator<Item = V>,
1426 V: std::convert::Into<crate::model::document::page::VisualElement>,
1427 {
1428 use std::iter::Iterator;
1429 self.visual_elements = v.into_iter().map(|i| i.into()).collect();
1430 self
1431 }
1432
1433 /// Sets the value of [tables][crate::model::document::Page::tables].
1434 ///
1435 /// # Example
1436 /// ```ignore,no_run
1437 /// # use google_cloud_documentai_v1::model::document::Page;
1438 /// use google_cloud_documentai_v1::model::document::page::Table;
1439 /// let x = Page::new()
1440 /// .set_tables([
1441 /// Table::default()/* use setters */,
1442 /// Table::default()/* use (different) setters */,
1443 /// ]);
1444 /// ```
1445 pub fn set_tables<T, V>(mut self, v: T) -> Self
1446 where
1447 T: std::iter::IntoIterator<Item = V>,
1448 V: std::convert::Into<crate::model::document::page::Table>,
1449 {
1450 use std::iter::Iterator;
1451 self.tables = v.into_iter().map(|i| i.into()).collect();
1452 self
1453 }
1454
1455 /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
1456 ///
1457 /// # Example
1458 /// ```ignore,no_run
1459 /// # use google_cloud_documentai_v1::model::document::Page;
1460 /// use google_cloud_documentai_v1::model::document::page::FormField;
1461 /// let x = Page::new()
1462 /// .set_form_fields([
1463 /// FormField::default()/* use setters */,
1464 /// FormField::default()/* use (different) setters */,
1465 /// ]);
1466 /// ```
1467 pub fn set_form_fields<T, V>(mut self, v: T) -> Self
1468 where
1469 T: std::iter::IntoIterator<Item = V>,
1470 V: std::convert::Into<crate::model::document::page::FormField>,
1471 {
1472 use std::iter::Iterator;
1473 self.form_fields = v.into_iter().map(|i| i.into()).collect();
1474 self
1475 }
1476
1477 /// Sets the value of [symbols][crate::model::document::Page::symbols].
1478 ///
1479 /// # Example
1480 /// ```ignore,no_run
1481 /// # use google_cloud_documentai_v1::model::document::Page;
1482 /// use google_cloud_documentai_v1::model::document::page::Symbol;
1483 /// let x = Page::new()
1484 /// .set_symbols([
1485 /// Symbol::default()/* use setters */,
1486 /// Symbol::default()/* use (different) setters */,
1487 /// ]);
1488 /// ```
1489 pub fn set_symbols<T, V>(mut self, v: T) -> Self
1490 where
1491 T: std::iter::IntoIterator<Item = V>,
1492 V: std::convert::Into<crate::model::document::page::Symbol>,
1493 {
1494 use std::iter::Iterator;
1495 self.symbols = v.into_iter().map(|i| i.into()).collect();
1496 self
1497 }
1498
1499 /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
1500 ///
1501 /// # Example
1502 /// ```ignore,no_run
1503 /// # use google_cloud_documentai_v1::model::document::Page;
1504 /// use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
1505 /// let x = Page::new()
1506 /// .set_detected_barcodes([
1507 /// DetectedBarcode::default()/* use setters */,
1508 /// DetectedBarcode::default()/* use (different) setters */,
1509 /// ]);
1510 /// ```
1511 pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
1512 where
1513 T: std::iter::IntoIterator<Item = V>,
1514 V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
1515 {
1516 use std::iter::Iterator;
1517 self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
1518 self
1519 }
1520
1521 /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1522 ///
1523 /// # Example
1524 /// ```ignore,no_run
1525 /// # use google_cloud_documentai_v1::model::document::Page;
1526 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1527 /// let x = Page::new().set_image_quality_scores(ImageQualityScores::default()/* use setters */);
1528 /// ```
1529 pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
1530 where
1531 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1532 {
1533 self.image_quality_scores = std::option::Option::Some(v.into());
1534 self
1535 }
1536
1537 /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1538 ///
1539 /// # Example
1540 /// ```ignore,no_run
1541 /// # use google_cloud_documentai_v1::model::document::Page;
1542 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1543 /// let x = Page::new().set_or_clear_image_quality_scores(Some(ImageQualityScores::default()/* use setters */));
1544 /// let x = Page::new().set_or_clear_image_quality_scores(None::<ImageQualityScores>);
1545 /// ```
1546 pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1547 where
1548 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1549 {
1550 self.image_quality_scores = v.map(|x| x.into());
1551 self
1552 }
1553
1554 /// Sets the value of [provenance][crate::model::document::Page::provenance].
1555 ///
1556 /// # Example
1557 /// ```ignore,no_run
1558 /// # use google_cloud_documentai_v1::model::document::Page;
1559 /// use google_cloud_documentai_v1::model::document::Provenance;
1560 /// let x = Page::new().set_provenance(Provenance::default()/* use setters */);
1561 /// ```
1562 #[deprecated]
1563 pub fn set_provenance<T>(mut self, v: T) -> Self
1564 where
1565 T: std::convert::Into<crate::model::document::Provenance>,
1566 {
1567 self.provenance = std::option::Option::Some(v.into());
1568 self
1569 }
1570
1571 /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
1572 ///
1573 /// # Example
1574 /// ```ignore,no_run
1575 /// # use google_cloud_documentai_v1::model::document::Page;
1576 /// use google_cloud_documentai_v1::model::document::Provenance;
1577 /// let x = Page::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
1578 /// let x = Page::new().set_or_clear_provenance(None::<Provenance>);
1579 /// ```
1580 #[deprecated]
1581 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1582 where
1583 T: std::convert::Into<crate::model::document::Provenance>,
1584 {
1585 self.provenance = v.map(|x| x.into());
1586 self
1587 }
1588 }
1589
1590 impl wkt::message::Message for Page {
1591 fn typename() -> &'static str {
1592 "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1593 }
1594 }
1595
1596 /// Defines additional types related to [Page].
1597 pub mod page {
1598 #[allow(unused_imports)]
1599 use super::*;
1600
1601 /// Dimension for the page.
1602 #[derive(Clone, Default, PartialEq)]
1603 #[non_exhaustive]
1604 pub struct Dimension {
1605 /// Page width.
1606 pub width: f32,
1607
1608 /// Page height.
1609 pub height: f32,
1610
1611 /// Dimension unit.
1612 pub unit: std::string::String,
1613
1614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1615 }
1616
1617 impl Dimension {
1618 pub fn new() -> Self {
1619 std::default::Default::default()
1620 }
1621
1622 /// Sets the value of [width][crate::model::document::page::Dimension::width].
1623 ///
1624 /// # Example
1625 /// ```ignore,no_run
1626 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1627 /// let x = Dimension::new().set_width(42.0);
1628 /// ```
1629 pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1630 self.width = v.into();
1631 self
1632 }
1633
1634 /// Sets the value of [height][crate::model::document::page::Dimension::height].
1635 ///
1636 /// # Example
1637 /// ```ignore,no_run
1638 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1639 /// let x = Dimension::new().set_height(42.0);
1640 /// ```
1641 pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1642 self.height = v.into();
1643 self
1644 }
1645
1646 /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
1647 ///
1648 /// # Example
1649 /// ```ignore,no_run
1650 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1651 /// let x = Dimension::new().set_unit("example");
1652 /// ```
1653 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1654 self.unit = v.into();
1655 self
1656 }
1657 }
1658
1659 impl wkt::message::Message for Dimension {
1660 fn typename() -> &'static str {
1661 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1662 }
1663 }
1664
1665 /// Rendered image contents for this page.
1666 #[derive(Clone, Default, PartialEq)]
1667 #[non_exhaustive]
1668 pub struct Image {
1669 /// Raw byte content of the image.
1670 pub content: ::bytes::Bytes,
1671
1672 /// Encoding [media type (MIME
1673 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
1674 /// for the image.
1675 pub mime_type: std::string::String,
1676
1677 /// Width of the image in pixels.
1678 pub width: i32,
1679
1680 /// Height of the image in pixels.
1681 pub height: i32,
1682
1683 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1684 }
1685
1686 impl Image {
1687 pub fn new() -> Self {
1688 std::default::Default::default()
1689 }
1690
1691 /// Sets the value of [content][crate::model::document::page::Image::content].
1692 ///
1693 /// # Example
1694 /// ```ignore,no_run
1695 /// # use google_cloud_documentai_v1::model::document::page::Image;
1696 /// let x = Image::new().set_content(bytes::Bytes::from_static(b"example"));
1697 /// ```
1698 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1699 self.content = v.into();
1700 self
1701 }
1702
1703 /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
1704 ///
1705 /// # Example
1706 /// ```ignore,no_run
1707 /// # use google_cloud_documentai_v1::model::document::page::Image;
1708 /// let x = Image::new().set_mime_type("example");
1709 /// ```
1710 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1711 mut self,
1712 v: T,
1713 ) -> Self {
1714 self.mime_type = v.into();
1715 self
1716 }
1717
1718 /// Sets the value of [width][crate::model::document::page::Image::width].
1719 ///
1720 /// # Example
1721 /// ```ignore,no_run
1722 /// # use google_cloud_documentai_v1::model::document::page::Image;
1723 /// let x = Image::new().set_width(42);
1724 /// ```
1725 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1726 self.width = v.into();
1727 self
1728 }
1729
1730 /// Sets the value of [height][crate::model::document::page::Image::height].
1731 ///
1732 /// # Example
1733 /// ```ignore,no_run
1734 /// # use google_cloud_documentai_v1::model::document::page::Image;
1735 /// let x = Image::new().set_height(42);
1736 /// ```
1737 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1738 self.height = v.into();
1739 self
1740 }
1741 }
1742
1743 impl wkt::message::Message for Image {
1744 fn typename() -> &'static str {
1745 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1746 }
1747 }
1748
1749 /// Representation for transformation matrix, intended to be compatible and
1750 /// used with OpenCV format for image manipulation.
1751 #[derive(Clone, Default, PartialEq)]
1752 #[non_exhaustive]
1753 pub struct Matrix {
1754 /// Number of rows in the matrix.
1755 pub rows: i32,
1756
1757 /// Number of columns in the matrix.
1758 pub cols: i32,
1759
1760 /// This encodes information about what data type the matrix uses.
1761 /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
1762 /// of OpenCV primitive data types, please refer to
1763 /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
1764 pub r#type: i32,
1765
1766 /// The matrix data.
1767 pub data: ::bytes::Bytes,
1768
1769 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1770 }
1771
1772 impl Matrix {
1773 pub fn new() -> Self {
1774 std::default::Default::default()
1775 }
1776
1777 /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
1778 ///
1779 /// # Example
1780 /// ```ignore,no_run
1781 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1782 /// let x = Matrix::new().set_rows(42);
1783 /// ```
1784 pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1785 self.rows = v.into();
1786 self
1787 }
1788
1789 /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
1790 ///
1791 /// # Example
1792 /// ```ignore,no_run
1793 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1794 /// let x = Matrix::new().set_cols(42);
1795 /// ```
1796 pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1797 self.cols = v.into();
1798 self
1799 }
1800
1801 /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
1802 ///
1803 /// # Example
1804 /// ```ignore,no_run
1805 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1806 /// let x = Matrix::new().set_type(42);
1807 /// ```
1808 pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1809 self.r#type = v.into();
1810 self
1811 }
1812
1813 /// Sets the value of [data][crate::model::document::page::Matrix::data].
1814 ///
1815 /// # Example
1816 /// ```ignore,no_run
1817 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1818 /// let x = Matrix::new().set_data(bytes::Bytes::from_static(b"example"));
1819 /// ```
1820 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1821 self.data = v.into();
1822 self
1823 }
1824 }
1825
1826 impl wkt::message::Message for Matrix {
1827 fn typename() -> &'static str {
1828 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1829 }
1830 }
1831
1832 /// Visual element describing a layout unit on a page.
1833 #[derive(Clone, Default, PartialEq)]
1834 #[non_exhaustive]
1835 pub struct Layout {
1836 /// Text anchor indexing into the
1837 /// [Document.text][google.cloud.documentai.v1.Document.text].
1838 ///
1839 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
1840 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1841
1842 /// Confidence of the current
1843 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
1844 /// context of the object this layout is for. For example, confidence can
1845 /// be for a single token, a table, a visual element, etc. depending on
1846 /// context. Range `[0, 1]`.
1847 ///
1848 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1849 pub confidence: f32,
1850
1851 /// The bounding polygon for the
1852 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1853 ///
1854 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1855 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1856
1857 /// Detected orientation for the
1858 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1859 ///
1860 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1861 pub orientation: crate::model::document::page::layout::Orientation,
1862
1863 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1864 }
1865
1866 impl Layout {
1867 pub fn new() -> Self {
1868 std::default::Default::default()
1869 }
1870
1871 /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1872 ///
1873 /// # Example
1874 /// ```ignore,no_run
1875 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1876 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1877 /// let x = Layout::new().set_text_anchor(TextAnchor::default()/* use setters */);
1878 /// ```
1879 pub fn set_text_anchor<T>(mut self, v: T) -> Self
1880 where
1881 T: std::convert::Into<crate::model::document::TextAnchor>,
1882 {
1883 self.text_anchor = std::option::Option::Some(v.into());
1884 self
1885 }
1886
1887 /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1888 ///
1889 /// # Example
1890 /// ```ignore,no_run
1891 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1892 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1893 /// let x = Layout::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
1894 /// let x = Layout::new().set_or_clear_text_anchor(None::<TextAnchor>);
1895 /// ```
1896 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1897 where
1898 T: std::convert::Into<crate::model::document::TextAnchor>,
1899 {
1900 self.text_anchor = v.map(|x| x.into());
1901 self
1902 }
1903
1904 /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
1905 ///
1906 /// # Example
1907 /// ```ignore,no_run
1908 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1909 /// let x = Layout::new().set_confidence(42.0);
1910 /// ```
1911 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1912 self.confidence = v.into();
1913 self
1914 }
1915
1916 /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1917 ///
1918 /// # Example
1919 /// ```ignore,no_run
1920 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1921 /// use google_cloud_documentai_v1::model::BoundingPoly;
1922 /// let x = Layout::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
1923 /// ```
1924 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1925 where
1926 T: std::convert::Into<crate::model::BoundingPoly>,
1927 {
1928 self.bounding_poly = std::option::Option::Some(v.into());
1929 self
1930 }
1931
1932 /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1933 ///
1934 /// # Example
1935 /// ```ignore,no_run
1936 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1937 /// use google_cloud_documentai_v1::model::BoundingPoly;
1938 /// let x = Layout::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
1939 /// let x = Layout::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
1940 /// ```
1941 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1942 where
1943 T: std::convert::Into<crate::model::BoundingPoly>,
1944 {
1945 self.bounding_poly = v.map(|x| x.into());
1946 self
1947 }
1948
1949 /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
1950 ///
1951 /// # Example
1952 /// ```ignore,no_run
1953 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1954 /// use google_cloud_documentai_v1::model::document::page::layout::Orientation;
1955 /// let x0 = Layout::new().set_orientation(Orientation::PageUp);
1956 /// let x1 = Layout::new().set_orientation(Orientation::PageRight);
1957 /// let x2 = Layout::new().set_orientation(Orientation::PageDown);
1958 /// ```
1959 pub fn set_orientation<
1960 T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1961 >(
1962 mut self,
1963 v: T,
1964 ) -> Self {
1965 self.orientation = v.into();
1966 self
1967 }
1968 }
1969
1970 impl wkt::message::Message for Layout {
1971 fn typename() -> &'static str {
1972 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1973 }
1974 }
1975
1976 /// Defines additional types related to [Layout].
1977 pub mod layout {
1978 #[allow(unused_imports)]
1979 use super::*;
1980
1981 /// Detected human reading orientation.
1982 ///
1983 /// # Working with unknown values
1984 ///
1985 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1986 /// additional enum variants at any time. Adding new variants is not considered
1987 /// a breaking change. Applications should write their code in anticipation of:
1988 ///
1989 /// - New values appearing in future releases of the client library, **and**
1990 /// - New values received dynamically, without application changes.
1991 ///
1992 /// Please consult the [Working with enums] section in the user guide for some
1993 /// guidelines.
1994 ///
1995 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
1996 #[derive(Clone, Debug, PartialEq)]
1997 #[non_exhaustive]
1998 pub enum Orientation {
1999 /// Unspecified orientation.
2000 Unspecified,
2001 /// Orientation is aligned with page up.
2002 PageUp,
2003 /// Orientation is aligned with page right.
2004 /// Turn the head 90 degrees clockwise from upright to read.
2005 PageRight,
2006 /// Orientation is aligned with page down.
2007 /// Turn the head 180 degrees from upright to read.
2008 PageDown,
2009 /// Orientation is aligned with page left.
2010 /// Turn the head 90 degrees counterclockwise from upright to read.
2011 PageLeft,
2012 /// If set, the enum was initialized with an unknown value.
2013 ///
2014 /// Applications can examine the value using [Orientation::value] or
2015 /// [Orientation::name].
2016 UnknownValue(orientation::UnknownValue),
2017 }
2018
2019 #[doc(hidden)]
2020 pub mod orientation {
2021 #[allow(unused_imports)]
2022 use super::*;
2023 #[derive(Clone, Debug, PartialEq)]
2024 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2025 }
2026
2027 impl Orientation {
2028 /// Gets the enum value.
2029 ///
2030 /// Returns `None` if the enum contains an unknown value deserialized from
2031 /// the string representation of enums.
2032 pub fn value(&self) -> std::option::Option<i32> {
2033 match self {
2034 Self::Unspecified => std::option::Option::Some(0),
2035 Self::PageUp => std::option::Option::Some(1),
2036 Self::PageRight => std::option::Option::Some(2),
2037 Self::PageDown => std::option::Option::Some(3),
2038 Self::PageLeft => std::option::Option::Some(4),
2039 Self::UnknownValue(u) => u.0.value(),
2040 }
2041 }
2042
2043 /// Gets the enum value as a string.
2044 ///
2045 /// Returns `None` if the enum contains an unknown value deserialized from
2046 /// the integer representation of enums.
2047 pub fn name(&self) -> std::option::Option<&str> {
2048 match self {
2049 Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
2050 Self::PageUp => std::option::Option::Some("PAGE_UP"),
2051 Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
2052 Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
2053 Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
2054 Self::UnknownValue(u) => u.0.name(),
2055 }
2056 }
2057 }
2058
2059 impl std::default::Default for Orientation {
2060 fn default() -> Self {
2061 use std::convert::From;
2062 Self::from(0)
2063 }
2064 }
2065
2066 impl std::fmt::Display for Orientation {
2067 fn fmt(
2068 &self,
2069 f: &mut std::fmt::Formatter<'_>,
2070 ) -> std::result::Result<(), std::fmt::Error> {
2071 wkt::internal::display_enum(f, self.name(), self.value())
2072 }
2073 }
2074
2075 impl std::convert::From<i32> for Orientation {
2076 fn from(value: i32) -> Self {
2077 match value {
2078 0 => Self::Unspecified,
2079 1 => Self::PageUp,
2080 2 => Self::PageRight,
2081 3 => Self::PageDown,
2082 4 => Self::PageLeft,
2083 _ => Self::UnknownValue(orientation::UnknownValue(
2084 wkt::internal::UnknownEnumValue::Integer(value),
2085 )),
2086 }
2087 }
2088 }
2089
2090 impl std::convert::From<&str> for Orientation {
2091 fn from(value: &str) -> Self {
2092 use std::string::ToString;
2093 match value {
2094 "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
2095 "PAGE_UP" => Self::PageUp,
2096 "PAGE_RIGHT" => Self::PageRight,
2097 "PAGE_DOWN" => Self::PageDown,
2098 "PAGE_LEFT" => Self::PageLeft,
2099 _ => Self::UnknownValue(orientation::UnknownValue(
2100 wkt::internal::UnknownEnumValue::String(value.to_string()),
2101 )),
2102 }
2103 }
2104 }
2105
2106 impl serde::ser::Serialize for Orientation {
2107 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2108 where
2109 S: serde::Serializer,
2110 {
2111 match self {
2112 Self::Unspecified => serializer.serialize_i32(0),
2113 Self::PageUp => serializer.serialize_i32(1),
2114 Self::PageRight => serializer.serialize_i32(2),
2115 Self::PageDown => serializer.serialize_i32(3),
2116 Self::PageLeft => serializer.serialize_i32(4),
2117 Self::UnknownValue(u) => u.0.serialize(serializer),
2118 }
2119 }
2120 }
2121
2122 impl<'de> serde::de::Deserialize<'de> for Orientation {
2123 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2124 where
2125 D: serde::Deserializer<'de>,
2126 {
2127 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
2128 ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
2129 ))
2130 }
2131 }
2132 }
2133
2134 /// A block has a set of lines (collected into paragraphs) that have a
2135 /// common line-spacing and orientation.
2136 #[derive(Clone, Default, PartialEq)]
2137 #[non_exhaustive]
2138 pub struct Block {
2139 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2140 /// [Block][google.cloud.documentai.v1.Document.Page.Block].
2141 ///
2142 /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
2143 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2144 pub layout: std::option::Option<crate::model::document::page::Layout>,
2145
2146 /// A list of detected languages together with confidence.
2147 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2148
2149 /// The history of this annotation.
2150 #[deprecated]
2151 pub provenance: std::option::Option<crate::model::document::Provenance>,
2152
2153 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2154 }
2155
2156 impl Block {
2157 pub fn new() -> Self {
2158 std::default::Default::default()
2159 }
2160
2161 /// Sets the value of [layout][crate::model::document::page::Block::layout].
2162 ///
2163 /// # Example
2164 /// ```ignore,no_run
2165 /// # use google_cloud_documentai_v1::model::document::page::Block;
2166 /// use google_cloud_documentai_v1::model::document::page::Layout;
2167 /// let x = Block::new().set_layout(Layout::default()/* use setters */);
2168 /// ```
2169 pub fn set_layout<T>(mut self, v: T) -> Self
2170 where
2171 T: std::convert::Into<crate::model::document::page::Layout>,
2172 {
2173 self.layout = std::option::Option::Some(v.into());
2174 self
2175 }
2176
2177 /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
2178 ///
2179 /// # Example
2180 /// ```ignore,no_run
2181 /// # use google_cloud_documentai_v1::model::document::page::Block;
2182 /// use google_cloud_documentai_v1::model::document::page::Layout;
2183 /// let x = Block::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2184 /// let x = Block::new().set_or_clear_layout(None::<Layout>);
2185 /// ```
2186 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2187 where
2188 T: std::convert::Into<crate::model::document::page::Layout>,
2189 {
2190 self.layout = v.map(|x| x.into());
2191 self
2192 }
2193
2194 /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
2195 ///
2196 /// # Example
2197 /// ```ignore,no_run
2198 /// # use google_cloud_documentai_v1::model::document::page::Block;
2199 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2200 /// let x = Block::new()
2201 /// .set_detected_languages([
2202 /// DetectedLanguage::default()/* use setters */,
2203 /// DetectedLanguage::default()/* use (different) setters */,
2204 /// ]);
2205 /// ```
2206 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2207 where
2208 T: std::iter::IntoIterator<Item = V>,
2209 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2210 {
2211 use std::iter::Iterator;
2212 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2213 self
2214 }
2215
2216 /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
2217 ///
2218 /// # Example
2219 /// ```ignore,no_run
2220 /// # use google_cloud_documentai_v1::model::document::page::Block;
2221 /// use google_cloud_documentai_v1::model::document::Provenance;
2222 /// let x = Block::new().set_provenance(Provenance::default()/* use setters */);
2223 /// ```
2224 #[deprecated]
2225 pub fn set_provenance<T>(mut self, v: T) -> Self
2226 where
2227 T: std::convert::Into<crate::model::document::Provenance>,
2228 {
2229 self.provenance = std::option::Option::Some(v.into());
2230 self
2231 }
2232
2233 /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
2234 ///
2235 /// # Example
2236 /// ```ignore,no_run
2237 /// # use google_cloud_documentai_v1::model::document::page::Block;
2238 /// use google_cloud_documentai_v1::model::document::Provenance;
2239 /// let x = Block::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2240 /// let x = Block::new().set_or_clear_provenance(None::<Provenance>);
2241 /// ```
2242 #[deprecated]
2243 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2244 where
2245 T: std::convert::Into<crate::model::document::Provenance>,
2246 {
2247 self.provenance = v.map(|x| x.into());
2248 self
2249 }
2250 }
2251
2252 impl wkt::message::Message for Block {
2253 fn typename() -> &'static str {
2254 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
2255 }
2256 }
2257
2258 /// A collection of lines that a human would perceive as a paragraph.
2259 #[derive(Clone, Default, PartialEq)]
2260 #[non_exhaustive]
2261 pub struct Paragraph {
2262 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2263 /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
2264 ///
2265 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2266 /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
2267 pub layout: std::option::Option<crate::model::document::page::Layout>,
2268
2269 /// A list of detected languages together with confidence.
2270 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2271
2272 /// The history of this annotation.
2273 #[deprecated]
2274 pub provenance: std::option::Option<crate::model::document::Provenance>,
2275
2276 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2277 }
2278
2279 impl Paragraph {
2280 pub fn new() -> Self {
2281 std::default::Default::default()
2282 }
2283
2284 /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
2285 ///
2286 /// # Example
2287 /// ```ignore,no_run
2288 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2289 /// use google_cloud_documentai_v1::model::document::page::Layout;
2290 /// let x = Paragraph::new().set_layout(Layout::default()/* use setters */);
2291 /// ```
2292 pub fn set_layout<T>(mut self, v: T) -> Self
2293 where
2294 T: std::convert::Into<crate::model::document::page::Layout>,
2295 {
2296 self.layout = std::option::Option::Some(v.into());
2297 self
2298 }
2299
2300 /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
2301 ///
2302 /// # Example
2303 /// ```ignore,no_run
2304 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2305 /// use google_cloud_documentai_v1::model::document::page::Layout;
2306 /// let x = Paragraph::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2307 /// let x = Paragraph::new().set_or_clear_layout(None::<Layout>);
2308 /// ```
2309 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2310 where
2311 T: std::convert::Into<crate::model::document::page::Layout>,
2312 {
2313 self.layout = v.map(|x| x.into());
2314 self
2315 }
2316
2317 /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
2318 ///
2319 /// # Example
2320 /// ```ignore,no_run
2321 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2322 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2323 /// let x = Paragraph::new()
2324 /// .set_detected_languages([
2325 /// DetectedLanguage::default()/* use setters */,
2326 /// DetectedLanguage::default()/* use (different) setters */,
2327 /// ]);
2328 /// ```
2329 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2330 where
2331 T: std::iter::IntoIterator<Item = V>,
2332 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2333 {
2334 use std::iter::Iterator;
2335 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2336 self
2337 }
2338
2339 /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
2340 ///
2341 /// # Example
2342 /// ```ignore,no_run
2343 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2344 /// use google_cloud_documentai_v1::model::document::Provenance;
2345 /// let x = Paragraph::new().set_provenance(Provenance::default()/* use setters */);
2346 /// ```
2347 #[deprecated]
2348 pub fn set_provenance<T>(mut self, v: T) -> Self
2349 where
2350 T: std::convert::Into<crate::model::document::Provenance>,
2351 {
2352 self.provenance = std::option::Option::Some(v.into());
2353 self
2354 }
2355
2356 /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
2357 ///
2358 /// # Example
2359 /// ```ignore,no_run
2360 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2361 /// use google_cloud_documentai_v1::model::document::Provenance;
2362 /// let x = Paragraph::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2363 /// let x = Paragraph::new().set_or_clear_provenance(None::<Provenance>);
2364 /// ```
2365 #[deprecated]
2366 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2367 where
2368 T: std::convert::Into<crate::model::document::Provenance>,
2369 {
2370 self.provenance = v.map(|x| x.into());
2371 self
2372 }
2373 }
2374
2375 impl wkt::message::Message for Paragraph {
2376 fn typename() -> &'static str {
2377 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
2378 }
2379 }
2380
2381 /// A collection of tokens that a human would perceive as a line.
2382 /// Does not cross column boundaries, can be horizontal, vertical, etc.
2383 #[derive(Clone, Default, PartialEq)]
2384 #[non_exhaustive]
2385 pub struct Line {
2386 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2387 /// [Line][google.cloud.documentai.v1.Document.Page.Line].
2388 ///
2389 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2390 /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
2391 pub layout: std::option::Option<crate::model::document::page::Layout>,
2392
2393 /// A list of detected languages together with confidence.
2394 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2395
2396 /// The history of this annotation.
2397 #[deprecated]
2398 pub provenance: std::option::Option<crate::model::document::Provenance>,
2399
2400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2401 }
2402
2403 impl Line {
2404 pub fn new() -> Self {
2405 std::default::Default::default()
2406 }
2407
2408 /// Sets the value of [layout][crate::model::document::page::Line::layout].
2409 ///
2410 /// # Example
2411 /// ```ignore,no_run
2412 /// # use google_cloud_documentai_v1::model::document::page::Line;
2413 /// use google_cloud_documentai_v1::model::document::page::Layout;
2414 /// let x = Line::new().set_layout(Layout::default()/* use setters */);
2415 /// ```
2416 pub fn set_layout<T>(mut self, v: T) -> Self
2417 where
2418 T: std::convert::Into<crate::model::document::page::Layout>,
2419 {
2420 self.layout = std::option::Option::Some(v.into());
2421 self
2422 }
2423
2424 /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
2425 ///
2426 /// # Example
2427 /// ```ignore,no_run
2428 /// # use google_cloud_documentai_v1::model::document::page::Line;
2429 /// use google_cloud_documentai_v1::model::document::page::Layout;
2430 /// let x = Line::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2431 /// let x = Line::new().set_or_clear_layout(None::<Layout>);
2432 /// ```
2433 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2434 where
2435 T: std::convert::Into<crate::model::document::page::Layout>,
2436 {
2437 self.layout = v.map(|x| x.into());
2438 self
2439 }
2440
2441 /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
2442 ///
2443 /// # Example
2444 /// ```ignore,no_run
2445 /// # use google_cloud_documentai_v1::model::document::page::Line;
2446 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2447 /// let x = Line::new()
2448 /// .set_detected_languages([
2449 /// DetectedLanguage::default()/* use setters */,
2450 /// DetectedLanguage::default()/* use (different) setters */,
2451 /// ]);
2452 /// ```
2453 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2454 where
2455 T: std::iter::IntoIterator<Item = V>,
2456 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2457 {
2458 use std::iter::Iterator;
2459 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2460 self
2461 }
2462
2463 /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
2464 ///
2465 /// # Example
2466 /// ```ignore,no_run
2467 /// # use google_cloud_documentai_v1::model::document::page::Line;
2468 /// use google_cloud_documentai_v1::model::document::Provenance;
2469 /// let x = Line::new().set_provenance(Provenance::default()/* use setters */);
2470 /// ```
2471 #[deprecated]
2472 pub fn set_provenance<T>(mut self, v: T) -> Self
2473 where
2474 T: std::convert::Into<crate::model::document::Provenance>,
2475 {
2476 self.provenance = std::option::Option::Some(v.into());
2477 self
2478 }
2479
2480 /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
2481 ///
2482 /// # Example
2483 /// ```ignore,no_run
2484 /// # use google_cloud_documentai_v1::model::document::page::Line;
2485 /// use google_cloud_documentai_v1::model::document::Provenance;
2486 /// let x = Line::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2487 /// let x = Line::new().set_or_clear_provenance(None::<Provenance>);
2488 /// ```
2489 #[deprecated]
2490 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2491 where
2492 T: std::convert::Into<crate::model::document::Provenance>,
2493 {
2494 self.provenance = v.map(|x| x.into());
2495 self
2496 }
2497 }
2498
2499 impl wkt::message::Message for Line {
2500 fn typename() -> &'static str {
2501 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
2502 }
2503 }
2504
2505 /// A detected token.
2506 #[derive(Clone, Default, PartialEq)]
2507 #[non_exhaustive]
2508 pub struct Token {
2509 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2510 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2511 ///
2512 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2513 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2514 pub layout: std::option::Option<crate::model::document::page::Layout>,
2515
2516 /// Detected break at the end of a
2517 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2518 ///
2519 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2520 pub detected_break:
2521 std::option::Option<crate::model::document::page::token::DetectedBreak>,
2522
2523 /// A list of detected languages together with confidence.
2524 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2525
2526 /// The history of this annotation.
2527 #[deprecated]
2528 pub provenance: std::option::Option<crate::model::document::Provenance>,
2529
2530 /// Text style attributes.
2531 pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
2532
2533 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2534 }
2535
2536 impl Token {
2537 pub fn new() -> Self {
2538 std::default::Default::default()
2539 }
2540
2541 /// Sets the value of [layout][crate::model::document::page::Token::layout].
2542 ///
2543 /// # Example
2544 /// ```ignore,no_run
2545 /// # use google_cloud_documentai_v1::model::document::page::Token;
2546 /// use google_cloud_documentai_v1::model::document::page::Layout;
2547 /// let x = Token::new().set_layout(Layout::default()/* use setters */);
2548 /// ```
2549 pub fn set_layout<T>(mut self, v: T) -> Self
2550 where
2551 T: std::convert::Into<crate::model::document::page::Layout>,
2552 {
2553 self.layout = std::option::Option::Some(v.into());
2554 self
2555 }
2556
2557 /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
2558 ///
2559 /// # Example
2560 /// ```ignore,no_run
2561 /// # use google_cloud_documentai_v1::model::document::page::Token;
2562 /// use google_cloud_documentai_v1::model::document::page::Layout;
2563 /// let x = Token::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2564 /// let x = Token::new().set_or_clear_layout(None::<Layout>);
2565 /// ```
2566 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2567 where
2568 T: std::convert::Into<crate::model::document::page::Layout>,
2569 {
2570 self.layout = v.map(|x| x.into());
2571 self
2572 }
2573
2574 /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
2575 ///
2576 /// # Example
2577 /// ```ignore,no_run
2578 /// # use google_cloud_documentai_v1::model::document::page::Token;
2579 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2580 /// let x = Token::new().set_detected_break(DetectedBreak::default()/* use setters */);
2581 /// ```
2582 pub fn set_detected_break<T>(mut self, v: T) -> Self
2583 where
2584 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2585 {
2586 self.detected_break = std::option::Option::Some(v.into());
2587 self
2588 }
2589
2590 /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
2591 ///
2592 /// # Example
2593 /// ```ignore,no_run
2594 /// # use google_cloud_documentai_v1::model::document::page::Token;
2595 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2596 /// let x = Token::new().set_or_clear_detected_break(Some(DetectedBreak::default()/* use setters */));
2597 /// let x = Token::new().set_or_clear_detected_break(None::<DetectedBreak>);
2598 /// ```
2599 pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
2600 where
2601 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2602 {
2603 self.detected_break = v.map(|x| x.into());
2604 self
2605 }
2606
2607 /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
2608 ///
2609 /// # Example
2610 /// ```ignore,no_run
2611 /// # use google_cloud_documentai_v1::model::document::page::Token;
2612 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2613 /// let x = Token::new()
2614 /// .set_detected_languages([
2615 /// DetectedLanguage::default()/* use setters */,
2616 /// DetectedLanguage::default()/* use (different) setters */,
2617 /// ]);
2618 /// ```
2619 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2620 where
2621 T: std::iter::IntoIterator<Item = V>,
2622 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2623 {
2624 use std::iter::Iterator;
2625 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2626 self
2627 }
2628
2629 /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
2630 ///
2631 /// # Example
2632 /// ```ignore,no_run
2633 /// # use google_cloud_documentai_v1::model::document::page::Token;
2634 /// use google_cloud_documentai_v1::model::document::Provenance;
2635 /// let x = Token::new().set_provenance(Provenance::default()/* use setters */);
2636 /// ```
2637 #[deprecated]
2638 pub fn set_provenance<T>(mut self, v: T) -> Self
2639 where
2640 T: std::convert::Into<crate::model::document::Provenance>,
2641 {
2642 self.provenance = std::option::Option::Some(v.into());
2643 self
2644 }
2645
2646 /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
2647 ///
2648 /// # Example
2649 /// ```ignore,no_run
2650 /// # use google_cloud_documentai_v1::model::document::page::Token;
2651 /// use google_cloud_documentai_v1::model::document::Provenance;
2652 /// let x = Token::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2653 /// let x = Token::new().set_or_clear_provenance(None::<Provenance>);
2654 /// ```
2655 #[deprecated]
2656 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2657 where
2658 T: std::convert::Into<crate::model::document::Provenance>,
2659 {
2660 self.provenance = v.map(|x| x.into());
2661 self
2662 }
2663
2664 /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
2665 ///
2666 /// # Example
2667 /// ```ignore,no_run
2668 /// # use google_cloud_documentai_v1::model::document::page::Token;
2669 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2670 /// let x = Token::new().set_style_info(StyleInfo::default()/* use setters */);
2671 /// ```
2672 pub fn set_style_info<T>(mut self, v: T) -> Self
2673 where
2674 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2675 {
2676 self.style_info = std::option::Option::Some(v.into());
2677 self
2678 }
2679
2680 /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
2681 ///
2682 /// # Example
2683 /// ```ignore,no_run
2684 /// # use google_cloud_documentai_v1::model::document::page::Token;
2685 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2686 /// let x = Token::new().set_or_clear_style_info(Some(StyleInfo::default()/* use setters */));
2687 /// let x = Token::new().set_or_clear_style_info(None::<StyleInfo>);
2688 /// ```
2689 pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
2690 where
2691 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2692 {
2693 self.style_info = v.map(|x| x.into());
2694 self
2695 }
2696 }
2697
2698 impl wkt::message::Message for Token {
2699 fn typename() -> &'static str {
2700 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
2701 }
2702 }
2703
2704 /// Defines additional types related to [Token].
2705 pub mod token {
2706 #[allow(unused_imports)]
2707 use super::*;
2708
2709 /// Detected break at the end of a
2710 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2711 ///
2712 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2713 #[derive(Clone, Default, PartialEq)]
2714 #[non_exhaustive]
2715 pub struct DetectedBreak {
2716 /// Detected break type.
2717 pub r#type: crate::model::document::page::token::detected_break::Type,
2718
2719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2720 }
2721
2722 impl DetectedBreak {
2723 pub fn new() -> Self {
2724 std::default::Default::default()
2725 }
2726
2727 /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
2728 ///
2729 /// # Example
2730 /// ```ignore,no_run
2731 /// # use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2732 /// use google_cloud_documentai_v1::model::document::page::token::detected_break::Type;
2733 /// let x0 = DetectedBreak::new().set_type(Type::Space);
2734 /// let x1 = DetectedBreak::new().set_type(Type::WideSpace);
2735 /// let x2 = DetectedBreak::new().set_type(Type::Hyphen);
2736 /// ```
2737 pub fn set_type<
2738 T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
2739 >(
2740 mut self,
2741 v: T,
2742 ) -> Self {
2743 self.r#type = v.into();
2744 self
2745 }
2746 }
2747
2748 impl wkt::message::Message for DetectedBreak {
2749 fn typename() -> &'static str {
2750 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
2751 }
2752 }
2753
2754 /// Defines additional types related to [DetectedBreak].
2755 pub mod detected_break {
2756 #[allow(unused_imports)]
2757 use super::*;
2758
2759 /// Enum to denote the type of break found.
2760 ///
2761 /// # Working with unknown values
2762 ///
2763 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2764 /// additional enum variants at any time. Adding new variants is not considered
2765 /// a breaking change. Applications should write their code in anticipation of:
2766 ///
2767 /// - New values appearing in future releases of the client library, **and**
2768 /// - New values received dynamically, without application changes.
2769 ///
2770 /// Please consult the [Working with enums] section in the user guide for some
2771 /// guidelines.
2772 ///
2773 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2774 #[derive(Clone, Debug, PartialEq)]
2775 #[non_exhaustive]
2776 pub enum Type {
2777 /// Unspecified break type.
2778 Unspecified,
2779 /// A single whitespace.
2780 Space,
2781 /// A wider whitespace.
2782 WideSpace,
2783 /// A hyphen that indicates that a token has been split across lines.
2784 Hyphen,
2785 /// If set, the enum was initialized with an unknown value.
2786 ///
2787 /// Applications can examine the value using [Type::value] or
2788 /// [Type::name].
2789 UnknownValue(r#type::UnknownValue),
2790 }
2791
2792 #[doc(hidden)]
2793 pub mod r#type {
2794 #[allow(unused_imports)]
2795 use super::*;
2796 #[derive(Clone, Debug, PartialEq)]
2797 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2798 }
2799
2800 impl Type {
2801 /// Gets the enum value.
2802 ///
2803 /// Returns `None` if the enum contains an unknown value deserialized from
2804 /// the string representation of enums.
2805 pub fn value(&self) -> std::option::Option<i32> {
2806 match self {
2807 Self::Unspecified => std::option::Option::Some(0),
2808 Self::Space => std::option::Option::Some(1),
2809 Self::WideSpace => std::option::Option::Some(2),
2810 Self::Hyphen => std::option::Option::Some(3),
2811 Self::UnknownValue(u) => u.0.value(),
2812 }
2813 }
2814
2815 /// Gets the enum value as a string.
2816 ///
2817 /// Returns `None` if the enum contains an unknown value deserialized from
2818 /// the integer representation of enums.
2819 pub fn name(&self) -> std::option::Option<&str> {
2820 match self {
2821 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2822 Self::Space => std::option::Option::Some("SPACE"),
2823 Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
2824 Self::Hyphen => std::option::Option::Some("HYPHEN"),
2825 Self::UnknownValue(u) => u.0.name(),
2826 }
2827 }
2828 }
2829
2830 impl std::default::Default for Type {
2831 fn default() -> Self {
2832 use std::convert::From;
2833 Self::from(0)
2834 }
2835 }
2836
2837 impl std::fmt::Display for Type {
2838 fn fmt(
2839 &self,
2840 f: &mut std::fmt::Formatter<'_>,
2841 ) -> std::result::Result<(), std::fmt::Error> {
2842 wkt::internal::display_enum(f, self.name(), self.value())
2843 }
2844 }
2845
2846 impl std::convert::From<i32> for Type {
2847 fn from(value: i32) -> Self {
2848 match value {
2849 0 => Self::Unspecified,
2850 1 => Self::Space,
2851 2 => Self::WideSpace,
2852 3 => Self::Hyphen,
2853 _ => Self::UnknownValue(r#type::UnknownValue(
2854 wkt::internal::UnknownEnumValue::Integer(value),
2855 )),
2856 }
2857 }
2858 }
2859
2860 impl std::convert::From<&str> for Type {
2861 fn from(value: &str) -> Self {
2862 use std::string::ToString;
2863 match value {
2864 "TYPE_UNSPECIFIED" => Self::Unspecified,
2865 "SPACE" => Self::Space,
2866 "WIDE_SPACE" => Self::WideSpace,
2867 "HYPHEN" => Self::Hyphen,
2868 _ => Self::UnknownValue(r#type::UnknownValue(
2869 wkt::internal::UnknownEnumValue::String(value.to_string()),
2870 )),
2871 }
2872 }
2873 }
2874
2875 impl serde::ser::Serialize for Type {
2876 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2877 where
2878 S: serde::Serializer,
2879 {
2880 match self {
2881 Self::Unspecified => serializer.serialize_i32(0),
2882 Self::Space => serializer.serialize_i32(1),
2883 Self::WideSpace => serializer.serialize_i32(2),
2884 Self::Hyphen => serializer.serialize_i32(3),
2885 Self::UnknownValue(u) => u.0.serialize(serializer),
2886 }
2887 }
2888 }
2889
2890 impl<'de> serde::de::Deserialize<'de> for Type {
2891 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2892 where
2893 D: serde::Deserializer<'de>,
2894 {
2895 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2896 ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2897 ))
2898 }
2899 }
2900 }
2901
2902 /// Font and other text style attributes.
2903 #[derive(Clone, Default, PartialEq)]
2904 #[non_exhaustive]
2905 pub struct StyleInfo {
2906 /// Font size in points (`1` point is `¹⁄₇₂` inches).
2907 pub font_size: i32,
2908
2909 /// Font size in pixels, equal to _unrounded
2910 /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
2911 ///
2912 /// * _resolution_ ÷ `72.0`.
2913 ///
2914 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
2915 pub pixel_font_size: f64,
2916
2917 /// Letter spacing in points.
2918 pub letter_spacing: f64,
2919
2920 /// Name or style of the font.
2921 pub font_type: std::string::String,
2922
2923 /// Whether the text is bold (equivalent to
2924 /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
2925 /// is at least `700`).
2926 ///
2927 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
2928 pub bold: bool,
2929
2930 /// Whether the text is italic.
2931 pub italic: bool,
2932
2933 /// Whether the text is underlined.
2934 pub underlined: bool,
2935
2936 /// Whether the text is strikethrough. This feature is not supported yet.
2937 pub strikeout: bool,
2938
2939 /// Whether the text is a subscript. This feature is not supported yet.
2940 pub subscript: bool,
2941
2942 /// Whether the text is a superscript. This feature is not supported yet.
2943 pub superscript: bool,
2944
2945 /// Whether the text is in small caps. This feature is not supported yet.
2946 pub smallcaps: bool,
2947
2948 /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
2949 /// Normal is `400`, bold is `700`.
2950 pub font_weight: i32,
2951
2952 /// Whether the text is handwritten.
2953 pub handwritten: bool,
2954
2955 /// Color of the text.
2956 pub text_color: std::option::Option<google_cloud_type::model::Color>,
2957
2958 /// Color of the background.
2959 pub background_color: std::option::Option<google_cloud_type::model::Color>,
2960
2961 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2962 }
2963
2964 impl StyleInfo {
2965 pub fn new() -> Self {
2966 std::default::Default::default()
2967 }
2968
2969 /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
2970 ///
2971 /// # Example
2972 /// ```ignore,no_run
2973 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2974 /// let x = StyleInfo::new().set_font_size(42);
2975 /// ```
2976 pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2977 self.font_size = v.into();
2978 self
2979 }
2980
2981 /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
2982 ///
2983 /// # Example
2984 /// ```ignore,no_run
2985 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2986 /// let x = StyleInfo::new().set_pixel_font_size(42.0);
2987 /// ```
2988 pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
2989 self.pixel_font_size = v.into();
2990 self
2991 }
2992
2993 /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
2994 ///
2995 /// # Example
2996 /// ```ignore,no_run
2997 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2998 /// let x = StyleInfo::new().set_letter_spacing(42.0);
2999 /// ```
3000 pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3001 self.letter_spacing = v.into();
3002 self
3003 }
3004
3005 /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
3006 ///
3007 /// # Example
3008 /// ```ignore,no_run
3009 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3010 /// let x = StyleInfo::new().set_font_type("example");
3011 /// ```
3012 pub fn set_font_type<T: std::convert::Into<std::string::String>>(
3013 mut self,
3014 v: T,
3015 ) -> Self {
3016 self.font_type = v.into();
3017 self
3018 }
3019
3020 /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
3021 ///
3022 /// # Example
3023 /// ```ignore,no_run
3024 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3025 /// let x = StyleInfo::new().set_bold(true);
3026 /// ```
3027 pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3028 self.bold = v.into();
3029 self
3030 }
3031
3032 /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3037 /// let x = StyleInfo::new().set_italic(true);
3038 /// ```
3039 pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3040 self.italic = v.into();
3041 self
3042 }
3043
3044 /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
3045 ///
3046 /// # Example
3047 /// ```ignore,no_run
3048 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3049 /// let x = StyleInfo::new().set_underlined(true);
3050 /// ```
3051 pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3052 self.underlined = v.into();
3053 self
3054 }
3055
3056 /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
3057 ///
3058 /// # Example
3059 /// ```ignore,no_run
3060 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3061 /// let x = StyleInfo::new().set_strikeout(true);
3062 /// ```
3063 pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3064 self.strikeout = v.into();
3065 self
3066 }
3067
3068 /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
3069 ///
3070 /// # Example
3071 /// ```ignore,no_run
3072 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3073 /// let x = StyleInfo::new().set_subscript(true);
3074 /// ```
3075 pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3076 self.subscript = v.into();
3077 self
3078 }
3079
3080 /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
3081 ///
3082 /// # Example
3083 /// ```ignore,no_run
3084 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3085 /// let x = StyleInfo::new().set_superscript(true);
3086 /// ```
3087 pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3088 self.superscript = v.into();
3089 self
3090 }
3091
3092 /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
3093 ///
3094 /// # Example
3095 /// ```ignore,no_run
3096 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3097 /// let x = StyleInfo::new().set_smallcaps(true);
3098 /// ```
3099 pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3100 self.smallcaps = v.into();
3101 self
3102 }
3103
3104 /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
3105 ///
3106 /// # Example
3107 /// ```ignore,no_run
3108 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3109 /// let x = StyleInfo::new().set_font_weight(42);
3110 /// ```
3111 pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3112 self.font_weight = v.into();
3113 self
3114 }
3115
3116 /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
3117 ///
3118 /// # Example
3119 /// ```ignore,no_run
3120 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3121 /// let x = StyleInfo::new().set_handwritten(true);
3122 /// ```
3123 pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3124 self.handwritten = v.into();
3125 self
3126 }
3127
3128 /// Sets the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3129 ///
3130 /// # Example
3131 /// ```ignore,no_run
3132 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3133 /// use google_cloud_type::model::Color;
3134 /// let x = StyleInfo::new().set_text_color(Color::default()/* use setters */);
3135 /// ```
3136 pub fn set_text_color<T>(mut self, v: T) -> Self
3137 where
3138 T: std::convert::Into<google_cloud_type::model::Color>,
3139 {
3140 self.text_color = std::option::Option::Some(v.into());
3141 self
3142 }
3143
3144 /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3145 ///
3146 /// # Example
3147 /// ```ignore,no_run
3148 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3149 /// use google_cloud_type::model::Color;
3150 /// let x = StyleInfo::new().set_or_clear_text_color(Some(Color::default()/* use setters */));
3151 /// let x = StyleInfo::new().set_or_clear_text_color(None::<Color>);
3152 /// ```
3153 pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
3154 where
3155 T: std::convert::Into<google_cloud_type::model::Color>,
3156 {
3157 self.text_color = v.map(|x| x.into());
3158 self
3159 }
3160
3161 /// Sets the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3162 ///
3163 /// # Example
3164 /// ```ignore,no_run
3165 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3166 /// use google_cloud_type::model::Color;
3167 /// let x = StyleInfo::new().set_background_color(Color::default()/* use setters */);
3168 /// ```
3169 pub fn set_background_color<T>(mut self, v: T) -> Self
3170 where
3171 T: std::convert::Into<google_cloud_type::model::Color>,
3172 {
3173 self.background_color = std::option::Option::Some(v.into());
3174 self
3175 }
3176
3177 /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3182 /// use google_cloud_type::model::Color;
3183 /// let x = StyleInfo::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
3184 /// let x = StyleInfo::new().set_or_clear_background_color(None::<Color>);
3185 /// ```
3186 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
3187 where
3188 T: std::convert::Into<google_cloud_type::model::Color>,
3189 {
3190 self.background_color = v.map(|x| x.into());
3191 self
3192 }
3193 }
3194
3195 impl wkt::message::Message for StyleInfo {
3196 fn typename() -> &'static str {
3197 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
3198 }
3199 }
3200 }
3201
3202 /// A detected symbol.
3203 #[derive(Clone, Default, PartialEq)]
3204 #[non_exhaustive]
3205 pub struct Symbol {
3206 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3207 /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
3208 ///
3209 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3210 /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
3211 pub layout: std::option::Option<crate::model::document::page::Layout>,
3212
3213 /// A list of detected languages together with confidence.
3214 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3215
3216 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3217 }
3218
3219 impl Symbol {
3220 pub fn new() -> Self {
3221 std::default::Default::default()
3222 }
3223
3224 /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
3225 ///
3226 /// # Example
3227 /// ```ignore,no_run
3228 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3229 /// use google_cloud_documentai_v1::model::document::page::Layout;
3230 /// let x = Symbol::new().set_layout(Layout::default()/* use setters */);
3231 /// ```
3232 pub fn set_layout<T>(mut self, v: T) -> Self
3233 where
3234 T: std::convert::Into<crate::model::document::page::Layout>,
3235 {
3236 self.layout = std::option::Option::Some(v.into());
3237 self
3238 }
3239
3240 /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
3241 ///
3242 /// # Example
3243 /// ```ignore,no_run
3244 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3245 /// use google_cloud_documentai_v1::model::document::page::Layout;
3246 /// let x = Symbol::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3247 /// let x = Symbol::new().set_or_clear_layout(None::<Layout>);
3248 /// ```
3249 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3250 where
3251 T: std::convert::Into<crate::model::document::page::Layout>,
3252 {
3253 self.layout = v.map(|x| x.into());
3254 self
3255 }
3256
3257 /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
3258 ///
3259 /// # Example
3260 /// ```ignore,no_run
3261 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3262 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3263 /// let x = Symbol::new()
3264 /// .set_detected_languages([
3265 /// DetectedLanguage::default()/* use setters */,
3266 /// DetectedLanguage::default()/* use (different) setters */,
3267 /// ]);
3268 /// ```
3269 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3270 where
3271 T: std::iter::IntoIterator<Item = V>,
3272 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3273 {
3274 use std::iter::Iterator;
3275 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3276 self
3277 }
3278 }
3279
3280 impl wkt::message::Message for Symbol {
3281 fn typename() -> &'static str {
3282 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
3283 }
3284 }
3285
3286 /// Detected non-text visual elements, for example, checkbox, signature etc.
3287 /// on the page.
3288 #[derive(Clone, Default, PartialEq)]
3289 #[non_exhaustive]
3290 pub struct VisualElement {
3291 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3292 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3293 ///
3294 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3295 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3296 pub layout: std::option::Option<crate::model::document::page::Layout>,
3297
3298 /// Type of the
3299 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3300 ///
3301 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3302 pub r#type: std::string::String,
3303
3304 /// A list of detected languages together with confidence.
3305 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3306
3307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3308 }
3309
3310 impl VisualElement {
3311 pub fn new() -> Self {
3312 std::default::Default::default()
3313 }
3314
3315 /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
3316 ///
3317 /// # Example
3318 /// ```ignore,no_run
3319 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3320 /// use google_cloud_documentai_v1::model::document::page::Layout;
3321 /// let x = VisualElement::new().set_layout(Layout::default()/* use setters */);
3322 /// ```
3323 pub fn set_layout<T>(mut self, v: T) -> Self
3324 where
3325 T: std::convert::Into<crate::model::document::page::Layout>,
3326 {
3327 self.layout = std::option::Option::Some(v.into());
3328 self
3329 }
3330
3331 /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
3332 ///
3333 /// # Example
3334 /// ```ignore,no_run
3335 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3336 /// use google_cloud_documentai_v1::model::document::page::Layout;
3337 /// let x = VisualElement::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3338 /// let x = VisualElement::new().set_or_clear_layout(None::<Layout>);
3339 /// ```
3340 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3341 where
3342 T: std::convert::Into<crate::model::document::page::Layout>,
3343 {
3344 self.layout = v.map(|x| x.into());
3345 self
3346 }
3347
3348 /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
3349 ///
3350 /// # Example
3351 /// ```ignore,no_run
3352 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3353 /// let x = VisualElement::new().set_type("example");
3354 /// ```
3355 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3356 self.r#type = v.into();
3357 self
3358 }
3359
3360 /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
3361 ///
3362 /// # Example
3363 /// ```ignore,no_run
3364 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3365 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3366 /// let x = VisualElement::new()
3367 /// .set_detected_languages([
3368 /// DetectedLanguage::default()/* use setters */,
3369 /// DetectedLanguage::default()/* use (different) setters */,
3370 /// ]);
3371 /// ```
3372 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3373 where
3374 T: std::iter::IntoIterator<Item = V>,
3375 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3376 {
3377 use std::iter::Iterator;
3378 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3379 self
3380 }
3381 }
3382
3383 impl wkt::message::Message for VisualElement {
3384 fn typename() -> &'static str {
3385 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
3386 }
3387 }
3388
3389 /// A table representation similar to HTML table structure.
3390 #[derive(Clone, Default, PartialEq)]
3391 #[non_exhaustive]
3392 pub struct Table {
3393 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3394 /// [Table][google.cloud.documentai.v1.Document.Page.Table].
3395 ///
3396 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3397 /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
3398 pub layout: std::option::Option<crate::model::document::page::Layout>,
3399
3400 /// Header rows of the table.
3401 pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3402
3403 /// Body rows of the table.
3404 pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3405
3406 /// A list of detected languages together with confidence.
3407 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3408
3409 /// The history of this table.
3410 #[deprecated]
3411 pub provenance: std::option::Option<crate::model::document::Provenance>,
3412
3413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3414 }
3415
3416 impl Table {
3417 pub fn new() -> Self {
3418 std::default::Default::default()
3419 }
3420
3421 /// Sets the value of [layout][crate::model::document::page::Table::layout].
3422 ///
3423 /// # Example
3424 /// ```ignore,no_run
3425 /// # use google_cloud_documentai_v1::model::document::page::Table;
3426 /// use google_cloud_documentai_v1::model::document::page::Layout;
3427 /// let x = Table::new().set_layout(Layout::default()/* use setters */);
3428 /// ```
3429 pub fn set_layout<T>(mut self, v: T) -> Self
3430 where
3431 T: std::convert::Into<crate::model::document::page::Layout>,
3432 {
3433 self.layout = std::option::Option::Some(v.into());
3434 self
3435 }
3436
3437 /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
3438 ///
3439 /// # Example
3440 /// ```ignore,no_run
3441 /// # use google_cloud_documentai_v1::model::document::page::Table;
3442 /// use google_cloud_documentai_v1::model::document::page::Layout;
3443 /// let x = Table::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3444 /// let x = Table::new().set_or_clear_layout(None::<Layout>);
3445 /// ```
3446 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3447 where
3448 T: std::convert::Into<crate::model::document::page::Layout>,
3449 {
3450 self.layout = v.map(|x| x.into());
3451 self
3452 }
3453
3454 /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
3455 ///
3456 /// # Example
3457 /// ```ignore,no_run
3458 /// # use google_cloud_documentai_v1::model::document::page::Table;
3459 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3460 /// let x = Table::new()
3461 /// .set_header_rows([
3462 /// TableRow::default()/* use setters */,
3463 /// TableRow::default()/* use (different) setters */,
3464 /// ]);
3465 /// ```
3466 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
3467 where
3468 T: std::iter::IntoIterator<Item = V>,
3469 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3470 {
3471 use std::iter::Iterator;
3472 self.header_rows = v.into_iter().map(|i| i.into()).collect();
3473 self
3474 }
3475
3476 /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
3477 ///
3478 /// # Example
3479 /// ```ignore,no_run
3480 /// # use google_cloud_documentai_v1::model::document::page::Table;
3481 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3482 /// let x = Table::new()
3483 /// .set_body_rows([
3484 /// TableRow::default()/* use setters */,
3485 /// TableRow::default()/* use (different) setters */,
3486 /// ]);
3487 /// ```
3488 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
3489 where
3490 T: std::iter::IntoIterator<Item = V>,
3491 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3492 {
3493 use std::iter::Iterator;
3494 self.body_rows = v.into_iter().map(|i| i.into()).collect();
3495 self
3496 }
3497
3498 /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
3499 ///
3500 /// # Example
3501 /// ```ignore,no_run
3502 /// # use google_cloud_documentai_v1::model::document::page::Table;
3503 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3504 /// let x = Table::new()
3505 /// .set_detected_languages([
3506 /// DetectedLanguage::default()/* use setters */,
3507 /// DetectedLanguage::default()/* use (different) setters */,
3508 /// ]);
3509 /// ```
3510 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3511 where
3512 T: std::iter::IntoIterator<Item = V>,
3513 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3514 {
3515 use std::iter::Iterator;
3516 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3517 self
3518 }
3519
3520 /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
3521 ///
3522 /// # Example
3523 /// ```ignore,no_run
3524 /// # use google_cloud_documentai_v1::model::document::page::Table;
3525 /// use google_cloud_documentai_v1::model::document::Provenance;
3526 /// let x = Table::new().set_provenance(Provenance::default()/* use setters */);
3527 /// ```
3528 #[deprecated]
3529 pub fn set_provenance<T>(mut self, v: T) -> Self
3530 where
3531 T: std::convert::Into<crate::model::document::Provenance>,
3532 {
3533 self.provenance = std::option::Option::Some(v.into());
3534 self
3535 }
3536
3537 /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
3538 ///
3539 /// # Example
3540 /// ```ignore,no_run
3541 /// # use google_cloud_documentai_v1::model::document::page::Table;
3542 /// use google_cloud_documentai_v1::model::document::Provenance;
3543 /// let x = Table::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3544 /// let x = Table::new().set_or_clear_provenance(None::<Provenance>);
3545 /// ```
3546 #[deprecated]
3547 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3548 where
3549 T: std::convert::Into<crate::model::document::Provenance>,
3550 {
3551 self.provenance = v.map(|x| x.into());
3552 self
3553 }
3554 }
3555
3556 impl wkt::message::Message for Table {
3557 fn typename() -> &'static str {
3558 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
3559 }
3560 }
3561
3562 /// Defines additional types related to [Table].
3563 pub mod table {
3564 #[allow(unused_imports)]
3565 use super::*;
3566
3567 /// A row of table cells.
3568 #[derive(Clone, Default, PartialEq)]
3569 #[non_exhaustive]
3570 pub struct TableRow {
3571 /// Cells that make up this row.
3572 pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
3573
3574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3575 }
3576
3577 impl TableRow {
3578 pub fn new() -> Self {
3579 std::default::Default::default()
3580 }
3581
3582 /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
3583 ///
3584 /// # Example
3585 /// ```ignore,no_run
3586 /// # use google_cloud_documentai_v1::model::document::page::table::TableRow;
3587 /// use google_cloud_documentai_v1::model::document::page::table::TableCell;
3588 /// let x = TableRow::new()
3589 /// .set_cells([
3590 /// TableCell::default()/* use setters */,
3591 /// TableCell::default()/* use (different) setters */,
3592 /// ]);
3593 /// ```
3594 pub fn set_cells<T, V>(mut self, v: T) -> Self
3595 where
3596 T: std::iter::IntoIterator<Item = V>,
3597 V: std::convert::Into<crate::model::document::page::table::TableCell>,
3598 {
3599 use std::iter::Iterator;
3600 self.cells = v.into_iter().map(|i| i.into()).collect();
3601 self
3602 }
3603 }
3604
3605 impl wkt::message::Message for TableRow {
3606 fn typename() -> &'static str {
3607 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
3608 }
3609 }
3610
3611 /// A cell representation inside the table.
3612 #[derive(Clone, Default, PartialEq)]
3613 #[non_exhaustive]
3614 pub struct TableCell {
3615 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3616 /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
3617 ///
3618 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3619 /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
3620 pub layout: std::option::Option<crate::model::document::page::Layout>,
3621
3622 /// How many rows this cell spans.
3623 pub row_span: i32,
3624
3625 /// How many columns this cell spans.
3626 pub col_span: i32,
3627
3628 /// A list of detected languages together with confidence.
3629 pub detected_languages:
3630 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3631
3632 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3633 }
3634
3635 impl TableCell {
3636 pub fn new() -> Self {
3637 std::default::Default::default()
3638 }
3639
3640 /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
3641 ///
3642 /// # Example
3643 /// ```ignore,no_run
3644 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3645 /// use google_cloud_documentai_v1::model::document::page::Layout;
3646 /// let x = TableCell::new().set_layout(Layout::default()/* use setters */);
3647 /// ```
3648 pub fn set_layout<T>(mut self, v: T) -> Self
3649 where
3650 T: std::convert::Into<crate::model::document::page::Layout>,
3651 {
3652 self.layout = std::option::Option::Some(v.into());
3653 self
3654 }
3655
3656 /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
3657 ///
3658 /// # Example
3659 /// ```ignore,no_run
3660 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3661 /// use google_cloud_documentai_v1::model::document::page::Layout;
3662 /// let x = TableCell::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3663 /// let x = TableCell::new().set_or_clear_layout(None::<Layout>);
3664 /// ```
3665 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3666 where
3667 T: std::convert::Into<crate::model::document::page::Layout>,
3668 {
3669 self.layout = v.map(|x| x.into());
3670 self
3671 }
3672
3673 /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
3674 ///
3675 /// # Example
3676 /// ```ignore,no_run
3677 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3678 /// let x = TableCell::new().set_row_span(42);
3679 /// ```
3680 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3681 self.row_span = v.into();
3682 self
3683 }
3684
3685 /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
3686 ///
3687 /// # Example
3688 /// ```ignore,no_run
3689 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3690 /// let x = TableCell::new().set_col_span(42);
3691 /// ```
3692 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3693 self.col_span = v.into();
3694 self
3695 }
3696
3697 /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
3698 ///
3699 /// # Example
3700 /// ```ignore,no_run
3701 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3702 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3703 /// let x = TableCell::new()
3704 /// .set_detected_languages([
3705 /// DetectedLanguage::default()/* use setters */,
3706 /// DetectedLanguage::default()/* use (different) setters */,
3707 /// ]);
3708 /// ```
3709 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3710 where
3711 T: std::iter::IntoIterator<Item = V>,
3712 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3713 {
3714 use std::iter::Iterator;
3715 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3716 self
3717 }
3718 }
3719
3720 impl wkt::message::Message for TableCell {
3721 fn typename() -> &'static str {
3722 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
3723 }
3724 }
3725 }
3726
3727 /// A form field detected on the page.
3728 #[derive(Clone, Default, PartialEq)]
3729 #[non_exhaustive]
3730 pub struct FormField {
3731 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3732 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
3733 /// For example, `Address`, `Email`, `Grand total`, `Phone number`, etc.
3734 ///
3735 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3736 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3737 pub field_name: std::option::Option<crate::model::document::page::Layout>,
3738
3739 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3740 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
3741 ///
3742 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3743 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3744 pub field_value: std::option::Option<crate::model::document::page::Layout>,
3745
3746 /// A list of detected languages for name together with confidence.
3747 pub name_detected_languages:
3748 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3749
3750 /// A list of detected languages for value together with confidence.
3751 pub value_detected_languages:
3752 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3753
3754 /// If the value is non-textual, this field represents the type. Current
3755 /// valid values are:
3756 ///
3757 /// - blank (this indicates the `field_value` is normal text)
3758 /// - `unfilled_checkbox`
3759 /// - `filled_checkbox`
3760 pub value_type: std::string::String,
3761
3762 /// Created for Labeling UI to export key text.
3763 /// If corrections were made to the text identified by the
3764 /// `field_name.text_anchor`, this field will contain the correction.
3765 pub corrected_key_text: std::string::String,
3766
3767 /// Created for Labeling UI to export value text.
3768 /// If corrections were made to the text identified by the
3769 /// `field_value.text_anchor`, this field will contain the correction.
3770 pub corrected_value_text: std::string::String,
3771
3772 /// The history of this annotation.
3773 pub provenance: std::option::Option<crate::model::document::Provenance>,
3774
3775 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3776 }
3777
3778 impl FormField {
3779 pub fn new() -> Self {
3780 std::default::Default::default()
3781 }
3782
3783 /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
3784 ///
3785 /// # Example
3786 /// ```ignore,no_run
3787 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3788 /// use google_cloud_documentai_v1::model::document::page::Layout;
3789 /// let x = FormField::new().set_field_name(Layout::default()/* use setters */);
3790 /// ```
3791 pub fn set_field_name<T>(mut self, v: T) -> Self
3792 where
3793 T: std::convert::Into<crate::model::document::page::Layout>,
3794 {
3795 self.field_name = std::option::Option::Some(v.into());
3796 self
3797 }
3798
3799 /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
3800 ///
3801 /// # Example
3802 /// ```ignore,no_run
3803 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3804 /// use google_cloud_documentai_v1::model::document::page::Layout;
3805 /// let x = FormField::new().set_or_clear_field_name(Some(Layout::default()/* use setters */));
3806 /// let x = FormField::new().set_or_clear_field_name(None::<Layout>);
3807 /// ```
3808 pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
3809 where
3810 T: std::convert::Into<crate::model::document::page::Layout>,
3811 {
3812 self.field_name = v.map(|x| x.into());
3813 self
3814 }
3815
3816 /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
3817 ///
3818 /// # Example
3819 /// ```ignore,no_run
3820 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3821 /// use google_cloud_documentai_v1::model::document::page::Layout;
3822 /// let x = FormField::new().set_field_value(Layout::default()/* use setters */);
3823 /// ```
3824 pub fn set_field_value<T>(mut self, v: T) -> Self
3825 where
3826 T: std::convert::Into<crate::model::document::page::Layout>,
3827 {
3828 self.field_value = std::option::Option::Some(v.into());
3829 self
3830 }
3831
3832 /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
3833 ///
3834 /// # Example
3835 /// ```ignore,no_run
3836 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3837 /// use google_cloud_documentai_v1::model::document::page::Layout;
3838 /// let x = FormField::new().set_or_clear_field_value(Some(Layout::default()/* use setters */));
3839 /// let x = FormField::new().set_or_clear_field_value(None::<Layout>);
3840 /// ```
3841 pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
3842 where
3843 T: std::convert::Into<crate::model::document::page::Layout>,
3844 {
3845 self.field_value = v.map(|x| x.into());
3846 self
3847 }
3848
3849 /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_detected_languages].
3850 ///
3851 /// # Example
3852 /// ```ignore,no_run
3853 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3854 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3855 /// let x = FormField::new()
3856 /// .set_name_detected_languages([
3857 /// DetectedLanguage::default()/* use setters */,
3858 /// DetectedLanguage::default()/* use (different) setters */,
3859 /// ]);
3860 /// ```
3861 pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
3862 where
3863 T: std::iter::IntoIterator<Item = V>,
3864 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3865 {
3866 use std::iter::Iterator;
3867 self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
3868 self
3869 }
3870
3871 /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
3872 ///
3873 /// # Example
3874 /// ```ignore,no_run
3875 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3876 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3877 /// let x = FormField::new()
3878 /// .set_value_detected_languages([
3879 /// DetectedLanguage::default()/* use setters */,
3880 /// DetectedLanguage::default()/* use (different) setters */,
3881 /// ]);
3882 /// ```
3883 pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
3884 where
3885 T: std::iter::IntoIterator<Item = V>,
3886 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3887 {
3888 use std::iter::Iterator;
3889 self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
3890 self
3891 }
3892
3893 /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
3894 ///
3895 /// # Example
3896 /// ```ignore,no_run
3897 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3898 /// let x = FormField::new().set_value_type("example");
3899 /// ```
3900 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
3901 mut self,
3902 v: T,
3903 ) -> Self {
3904 self.value_type = v.into();
3905 self
3906 }
3907
3908 /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
3909 ///
3910 /// # Example
3911 /// ```ignore,no_run
3912 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3913 /// let x = FormField::new().set_corrected_key_text("example");
3914 /// ```
3915 pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
3916 mut self,
3917 v: T,
3918 ) -> Self {
3919 self.corrected_key_text = v.into();
3920 self
3921 }
3922
3923 /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
3924 ///
3925 /// # Example
3926 /// ```ignore,no_run
3927 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3928 /// let x = FormField::new().set_corrected_value_text("example");
3929 /// ```
3930 pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
3931 mut self,
3932 v: T,
3933 ) -> Self {
3934 self.corrected_value_text = v.into();
3935 self
3936 }
3937
3938 /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
3939 ///
3940 /// # Example
3941 /// ```ignore,no_run
3942 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3943 /// use google_cloud_documentai_v1::model::document::Provenance;
3944 /// let x = FormField::new().set_provenance(Provenance::default()/* use setters */);
3945 /// ```
3946 pub fn set_provenance<T>(mut self, v: T) -> Self
3947 where
3948 T: std::convert::Into<crate::model::document::Provenance>,
3949 {
3950 self.provenance = std::option::Option::Some(v.into());
3951 self
3952 }
3953
3954 /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
3955 ///
3956 /// # Example
3957 /// ```ignore,no_run
3958 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3959 /// use google_cloud_documentai_v1::model::document::Provenance;
3960 /// let x = FormField::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3961 /// let x = FormField::new().set_or_clear_provenance(None::<Provenance>);
3962 /// ```
3963 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3964 where
3965 T: std::convert::Into<crate::model::document::Provenance>,
3966 {
3967 self.provenance = v.map(|x| x.into());
3968 self
3969 }
3970 }
3971
3972 impl wkt::message::Message for FormField {
3973 fn typename() -> &'static str {
3974 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
3975 }
3976 }
3977
3978 /// A detected barcode.
3979 #[derive(Clone, Default, PartialEq)]
3980 #[non_exhaustive]
3981 pub struct DetectedBarcode {
3982 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3983 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
3984 ///
3985 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
3986 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3987 pub layout: std::option::Option<crate::model::document::page::Layout>,
3988
3989 /// Detailed barcode information of the
3990 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
3991 ///
3992 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
3993 pub barcode: std::option::Option<crate::model::Barcode>,
3994
3995 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3996 }
3997
3998 impl DetectedBarcode {
3999 pub fn new() -> Self {
4000 std::default::Default::default()
4001 }
4002
4003 /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4004 ///
4005 /// # Example
4006 /// ```ignore,no_run
4007 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4008 /// use google_cloud_documentai_v1::model::document::page::Layout;
4009 /// let x = DetectedBarcode::new().set_layout(Layout::default()/* use setters */);
4010 /// ```
4011 pub fn set_layout<T>(mut self, v: T) -> Self
4012 where
4013 T: std::convert::Into<crate::model::document::page::Layout>,
4014 {
4015 self.layout = std::option::Option::Some(v.into());
4016 self
4017 }
4018
4019 /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4020 ///
4021 /// # Example
4022 /// ```ignore,no_run
4023 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4024 /// use google_cloud_documentai_v1::model::document::page::Layout;
4025 /// let x = DetectedBarcode::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
4026 /// let x = DetectedBarcode::new().set_or_clear_layout(None::<Layout>);
4027 /// ```
4028 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
4029 where
4030 T: std::convert::Into<crate::model::document::page::Layout>,
4031 {
4032 self.layout = v.map(|x| x.into());
4033 self
4034 }
4035
4036 /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4037 ///
4038 /// # Example
4039 /// ```ignore,no_run
4040 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4041 /// use google_cloud_documentai_v1::model::Barcode;
4042 /// let x = DetectedBarcode::new().set_barcode(Barcode::default()/* use setters */);
4043 /// ```
4044 pub fn set_barcode<T>(mut self, v: T) -> Self
4045 where
4046 T: std::convert::Into<crate::model::Barcode>,
4047 {
4048 self.barcode = std::option::Option::Some(v.into());
4049 self
4050 }
4051
4052 /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4053 ///
4054 /// # Example
4055 /// ```ignore,no_run
4056 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4057 /// use google_cloud_documentai_v1::model::Barcode;
4058 /// let x = DetectedBarcode::new().set_or_clear_barcode(Some(Barcode::default()/* use setters */));
4059 /// let x = DetectedBarcode::new().set_or_clear_barcode(None::<Barcode>);
4060 /// ```
4061 pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
4062 where
4063 T: std::convert::Into<crate::model::Barcode>,
4064 {
4065 self.barcode = v.map(|x| x.into());
4066 self
4067 }
4068 }
4069
4070 impl wkt::message::Message for DetectedBarcode {
4071 fn typename() -> &'static str {
4072 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
4073 }
4074 }
4075
4076 /// Detected language for a structural component.
4077 #[derive(Clone, Default, PartialEq)]
4078 #[non_exhaustive]
4079 pub struct DetectedLanguage {
4080 /// The [BCP-47 language
4081 /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
4082 /// such as `en-US` or `sr-Latn`.
4083 pub language_code: std::string::String,
4084
4085 /// Confidence of detected language. Range `[0, 1]`.
4086 pub confidence: f32,
4087
4088 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4089 }
4090
4091 impl DetectedLanguage {
4092 pub fn new() -> Self {
4093 std::default::Default::default()
4094 }
4095
4096 /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
4097 ///
4098 /// # Example
4099 /// ```ignore,no_run
4100 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4101 /// let x = DetectedLanguage::new().set_language_code("example");
4102 /// ```
4103 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4104 mut self,
4105 v: T,
4106 ) -> Self {
4107 self.language_code = v.into();
4108 self
4109 }
4110
4111 /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
4112 ///
4113 /// # Example
4114 /// ```ignore,no_run
4115 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4116 /// let x = DetectedLanguage::new().set_confidence(42.0);
4117 /// ```
4118 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4119 self.confidence = v.into();
4120 self
4121 }
4122 }
4123
4124 impl wkt::message::Message for DetectedLanguage {
4125 fn typename() -> &'static str {
4126 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
4127 }
4128 }
4129
4130 /// Image quality scores for the page image.
4131 #[derive(Clone, Default, PartialEq)]
4132 #[non_exhaustive]
4133 pub struct ImageQualityScores {
4134 /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
4135 pub quality_score: f32,
4136
4137 /// A list of detected defects.
4138 pub detected_defects:
4139 std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
4140
4141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4142 }
4143
4144 impl ImageQualityScores {
4145 pub fn new() -> Self {
4146 std::default::Default::default()
4147 }
4148
4149 /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
4150 ///
4151 /// # Example
4152 /// ```ignore,no_run
4153 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4154 /// let x = ImageQualityScores::new().set_quality_score(42.0);
4155 /// ```
4156 pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4157 self.quality_score = v.into();
4158 self
4159 }
4160
4161 /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
4162 ///
4163 /// # Example
4164 /// ```ignore,no_run
4165 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4166 /// use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4167 /// let x = ImageQualityScores::new()
4168 /// .set_detected_defects([
4169 /// DetectedDefect::default()/* use setters */,
4170 /// DetectedDefect::default()/* use (different) setters */,
4171 /// ]);
4172 /// ```
4173 pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
4174 where
4175 T: std::iter::IntoIterator<Item = V>,
4176 V: std::convert::Into<
4177 crate::model::document::page::image_quality_scores::DetectedDefect,
4178 >,
4179 {
4180 use std::iter::Iterator;
4181 self.detected_defects = v.into_iter().map(|i| i.into()).collect();
4182 self
4183 }
4184 }
4185
4186 impl wkt::message::Message for ImageQualityScores {
4187 fn typename() -> &'static str {
4188 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
4189 }
4190 }
4191
4192 /// Defines additional types related to [ImageQualityScores].
4193 pub mod image_quality_scores {
4194 #[allow(unused_imports)]
4195 use super::*;
4196
4197 /// Image Quality Defects
4198 #[derive(Clone, Default, PartialEq)]
4199 #[non_exhaustive]
4200 pub struct DetectedDefect {
4201 /// Name of the defect type. Supported values are:
4202 ///
4203 /// - `quality/defect_blurry`
4204 /// - `quality/defect_noisy`
4205 /// - `quality/defect_dark`
4206 /// - `quality/defect_faint`
4207 /// - `quality/defect_text_too_small`
4208 /// - `quality/defect_document_cutoff`
4209 /// - `quality/defect_text_cutoff`
4210 /// - `quality/defect_glare`
4211 pub r#type: std::string::String,
4212
4213 /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
4214 /// strong confidence that the defect exists.
4215 pub confidence: f32,
4216
4217 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4218 }
4219
4220 impl DetectedDefect {
4221 pub fn new() -> Self {
4222 std::default::Default::default()
4223 }
4224
4225 /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
4226 ///
4227 /// # Example
4228 /// ```ignore,no_run
4229 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4230 /// let x = DetectedDefect::new().set_type("example");
4231 /// ```
4232 pub fn set_type<T: std::convert::Into<std::string::String>>(
4233 mut self,
4234 v: T,
4235 ) -> Self {
4236 self.r#type = v.into();
4237 self
4238 }
4239
4240 /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
4241 ///
4242 /// # Example
4243 /// ```ignore,no_run
4244 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4245 /// let x = DetectedDefect::new().set_confidence(42.0);
4246 /// ```
4247 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4248 self.confidence = v.into();
4249 self
4250 }
4251 }
4252
4253 impl wkt::message::Message for DetectedDefect {
4254 fn typename() -> &'static str {
4255 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
4256 }
4257 }
4258 }
4259 }
4260
4261 /// An entity that could be a phrase in the text or a property that belongs to
4262 /// the document. It is a known entity type, such as a person, an organization,
4263 /// or location.
4264 #[derive(Clone, Default, PartialEq)]
4265 #[non_exhaustive]
4266 pub struct Entity {
4267 /// Optional. Provenance of the entity.
4268 /// Text anchor indexing into the
4269 /// [Document.text][google.cloud.documentai.v1.Document.text].
4270 ///
4271 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
4272 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4273
4274 /// Required. Entity type from a schema, for example, `Address`.
4275 pub r#type: std::string::String,
4276
4277 /// Optional. Text value of the entity, for example, `1600 Amphitheatre
4278 /// Pkwy`.
4279 pub mention_text: std::string::String,
4280
4281 /// Optional. Deprecated. Use `id` field instead.
4282 pub mention_id: std::string::String,
4283
4284 /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
4285 pub confidence: f32,
4286
4287 /// Optional. Represents the provenance of this entity wrt. the location on
4288 /// the page where it was found.
4289 pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
4290
4291 /// Optional. Canonical id. This will be a unique value in the entity list
4292 /// for this document.
4293 pub id: std::string::String,
4294
4295 /// Optional. Normalized entity value. Absent if the extracted value could
4296 /// not be converted or the type (for example, address) is not supported for
4297 /// certain parsers. This field is also only populated for certain supported
4298 /// document types.
4299 pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
4300
4301 /// Optional. Entities can be nested to form a hierarchical data structure
4302 /// representing the content in the document.
4303 pub properties: std::vec::Vec<crate::model::document::Entity>,
4304
4305 /// Optional. The history of this annotation.
4306 pub provenance: std::option::Option<crate::model::document::Provenance>,
4307
4308 /// Optional. Whether the entity will be redacted for de-identification
4309 /// purposes.
4310 pub redacted: bool,
4311
4312 /// Optional. Specifies how the entity's value is obtained.
4313 pub method: crate::model::document::entity::Method,
4314
4315 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4316 }
4317
4318 impl Entity {
4319 pub fn new() -> Self {
4320 std::default::Default::default()
4321 }
4322
4323 /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
4324 ///
4325 /// # Example
4326 /// ```ignore,no_run
4327 /// # use google_cloud_documentai_v1::model::document::Entity;
4328 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4329 /// let x = Entity::new().set_text_anchor(TextAnchor::default()/* use setters */);
4330 /// ```
4331 pub fn set_text_anchor<T>(mut self, v: T) -> Self
4332 where
4333 T: std::convert::Into<crate::model::document::TextAnchor>,
4334 {
4335 self.text_anchor = std::option::Option::Some(v.into());
4336 self
4337 }
4338
4339 /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
4340 ///
4341 /// # Example
4342 /// ```ignore,no_run
4343 /// # use google_cloud_documentai_v1::model::document::Entity;
4344 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4345 /// let x = Entity::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
4346 /// let x = Entity::new().set_or_clear_text_anchor(None::<TextAnchor>);
4347 /// ```
4348 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4349 where
4350 T: std::convert::Into<crate::model::document::TextAnchor>,
4351 {
4352 self.text_anchor = v.map(|x| x.into());
4353 self
4354 }
4355
4356 /// Sets the value of [r#type][crate::model::document::Entity::type].
4357 ///
4358 /// # Example
4359 /// ```ignore,no_run
4360 /// # use google_cloud_documentai_v1::model::document::Entity;
4361 /// let x = Entity::new().set_type("example");
4362 /// ```
4363 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4364 self.r#type = v.into();
4365 self
4366 }
4367
4368 /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
4369 ///
4370 /// # Example
4371 /// ```ignore,no_run
4372 /// # use google_cloud_documentai_v1::model::document::Entity;
4373 /// let x = Entity::new().set_mention_text("example");
4374 /// ```
4375 pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
4376 mut self,
4377 v: T,
4378 ) -> Self {
4379 self.mention_text = v.into();
4380 self
4381 }
4382
4383 /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_documentai_v1::model::document::Entity;
4388 /// let x = Entity::new().set_mention_id("example");
4389 /// ```
4390 pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.mention_id = v.into();
4392 self
4393 }
4394
4395 /// Sets the value of [confidence][crate::model::document::Entity::confidence].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_documentai_v1::model::document::Entity;
4400 /// let x = Entity::new().set_confidence(42.0);
4401 /// ```
4402 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4403 self.confidence = v.into();
4404 self
4405 }
4406
4407 /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
4408 ///
4409 /// # Example
4410 /// ```ignore,no_run
4411 /// # use google_cloud_documentai_v1::model::document::Entity;
4412 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4413 /// let x = Entity::new().set_page_anchor(PageAnchor::default()/* use setters */);
4414 /// ```
4415 pub fn set_page_anchor<T>(mut self, v: T) -> Self
4416 where
4417 T: std::convert::Into<crate::model::document::PageAnchor>,
4418 {
4419 self.page_anchor = std::option::Option::Some(v.into());
4420 self
4421 }
4422
4423 /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
4424 ///
4425 /// # Example
4426 /// ```ignore,no_run
4427 /// # use google_cloud_documentai_v1::model::document::Entity;
4428 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4429 /// let x = Entity::new().set_or_clear_page_anchor(Some(PageAnchor::default()/* use setters */));
4430 /// let x = Entity::new().set_or_clear_page_anchor(None::<PageAnchor>);
4431 /// ```
4432 pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4433 where
4434 T: std::convert::Into<crate::model::document::PageAnchor>,
4435 {
4436 self.page_anchor = v.map(|x| x.into());
4437 self
4438 }
4439
4440 /// Sets the value of [id][crate::model::document::Entity::id].
4441 ///
4442 /// # Example
4443 /// ```ignore,no_run
4444 /// # use google_cloud_documentai_v1::model::document::Entity;
4445 /// let x = Entity::new().set_id("example");
4446 /// ```
4447 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4448 self.id = v.into();
4449 self
4450 }
4451
4452 /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
4453 ///
4454 /// # Example
4455 /// ```ignore,no_run
4456 /// # use google_cloud_documentai_v1::model::document::Entity;
4457 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4458 /// let x = Entity::new().set_normalized_value(NormalizedValue::default()/* use setters */);
4459 /// ```
4460 pub fn set_normalized_value<T>(mut self, v: T) -> Self
4461 where
4462 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4463 {
4464 self.normalized_value = std::option::Option::Some(v.into());
4465 self
4466 }
4467
4468 /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
4469 ///
4470 /// # Example
4471 /// ```ignore,no_run
4472 /// # use google_cloud_documentai_v1::model::document::Entity;
4473 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4474 /// let x = Entity::new().set_or_clear_normalized_value(Some(NormalizedValue::default()/* use setters */));
4475 /// let x = Entity::new().set_or_clear_normalized_value(None::<NormalizedValue>);
4476 /// ```
4477 pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
4478 where
4479 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4480 {
4481 self.normalized_value = v.map(|x| x.into());
4482 self
4483 }
4484
4485 /// Sets the value of [properties][crate::model::document::Entity::properties].
4486 ///
4487 /// # Example
4488 /// ```ignore,no_run
4489 /// # use google_cloud_documentai_v1::model::document::Entity;
4490 /// let x = Entity::new()
4491 /// .set_properties([
4492 /// Entity::default()/* use setters */,
4493 /// Entity::default()/* use (different) setters */,
4494 /// ]);
4495 /// ```
4496 pub fn set_properties<T, V>(mut self, v: T) -> Self
4497 where
4498 T: std::iter::IntoIterator<Item = V>,
4499 V: std::convert::Into<crate::model::document::Entity>,
4500 {
4501 use std::iter::Iterator;
4502 self.properties = v.into_iter().map(|i| i.into()).collect();
4503 self
4504 }
4505
4506 /// Sets the value of [provenance][crate::model::document::Entity::provenance].
4507 ///
4508 /// # Example
4509 /// ```ignore,no_run
4510 /// # use google_cloud_documentai_v1::model::document::Entity;
4511 /// use google_cloud_documentai_v1::model::document::Provenance;
4512 /// let x = Entity::new().set_provenance(Provenance::default()/* use setters */);
4513 /// ```
4514 pub fn set_provenance<T>(mut self, v: T) -> Self
4515 where
4516 T: std::convert::Into<crate::model::document::Provenance>,
4517 {
4518 self.provenance = std::option::Option::Some(v.into());
4519 self
4520 }
4521
4522 /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
4523 ///
4524 /// # Example
4525 /// ```ignore,no_run
4526 /// # use google_cloud_documentai_v1::model::document::Entity;
4527 /// use google_cloud_documentai_v1::model::document::Provenance;
4528 /// let x = Entity::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
4529 /// let x = Entity::new().set_or_clear_provenance(None::<Provenance>);
4530 /// ```
4531 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
4532 where
4533 T: std::convert::Into<crate::model::document::Provenance>,
4534 {
4535 self.provenance = v.map(|x| x.into());
4536 self
4537 }
4538
4539 /// Sets the value of [redacted][crate::model::document::Entity::redacted].
4540 ///
4541 /// # Example
4542 /// ```ignore,no_run
4543 /// # use google_cloud_documentai_v1::model::document::Entity;
4544 /// let x = Entity::new().set_redacted(true);
4545 /// ```
4546 pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4547 self.redacted = v.into();
4548 self
4549 }
4550
4551 /// Sets the value of [method][crate::model::document::Entity::method].
4552 ///
4553 /// # Example
4554 /// ```ignore,no_run
4555 /// # use google_cloud_documentai_v1::model::document::Entity;
4556 /// use google_cloud_documentai_v1::model::document::entity::Method;
4557 /// let x0 = Entity::new().set_method(Method::Extract);
4558 /// let x1 = Entity::new().set_method(Method::Derive);
4559 /// ```
4560 pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
4561 mut self,
4562 v: T,
4563 ) -> Self {
4564 self.method = v.into();
4565 self
4566 }
4567 }
4568
4569 impl wkt::message::Message for Entity {
4570 fn typename() -> &'static str {
4571 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
4572 }
4573 }
4574
4575 /// Defines additional types related to [Entity].
4576 pub mod entity {
4577 #[allow(unused_imports)]
4578 use super::*;
4579
4580 /// Parsed and normalized entity value.
4581 #[derive(Clone, Default, PartialEq)]
4582 #[non_exhaustive]
4583 pub struct NormalizedValue {
4584 /// Optional. An optional field to store a normalized string.
4585 /// For some entity types, one of respective `structured_value` fields may
4586 /// also be populated. Also not all the types of `structured_value` will be
4587 /// normalized. For example, some processors may not generate `float`
4588 /// or `integer` normalized text by default.
4589 ///
4590 /// Below are sample formats mapped to structured values.
4591 ///
4592 /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
4593 /// - Date type (`date_value`) is in the ISO 8601 text format.
4594 /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
4595 pub text: std::string::String,
4596
4597 /// An optional structured entity value.
4598 /// Must match entity type defined in schema if
4599 /// known. If this field is present, the `text` field could also be
4600 /// populated.
4601 pub structured_value: std::option::Option<
4602 crate::model::document::entity::normalized_value::StructuredValue,
4603 >,
4604
4605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4606 }
4607
4608 impl NormalizedValue {
4609 pub fn new() -> Self {
4610 std::default::Default::default()
4611 }
4612
4613 /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
4614 ///
4615 /// # Example
4616 /// ```ignore,no_run
4617 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4618 /// let x = NormalizedValue::new().set_text("example");
4619 /// ```
4620 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4621 self.text = v.into();
4622 self
4623 }
4624
4625 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
4626 ///
4627 /// Note that all the setters affecting `structured_value` are mutually
4628 /// exclusive.
4629 ///
4630 /// # Example
4631 /// ```ignore,no_run
4632 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4633 /// use google_cloud_documentai_v1::model::document::entity::normalized_value::StructuredValue;
4634 /// let x = NormalizedValue::new().set_structured_value(Some(StructuredValue::BooleanValue(true)));
4635 /// ```
4636 pub fn set_structured_value<
4637 T: std::convert::Into<
4638 std::option::Option<
4639 crate::model::document::entity::normalized_value::StructuredValue,
4640 >,
4641 >,
4642 >(
4643 mut self,
4644 v: T,
4645 ) -> Self {
4646 self.structured_value = v.into();
4647 self
4648 }
4649
4650 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4651 /// if it holds a `MoneyValue`, `None` if the field is not set or
4652 /// holds a different branch.
4653 pub fn money_value(
4654 &self,
4655 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Money>>
4656 {
4657 #[allow(unreachable_patterns)]
4658 self.structured_value.as_ref().and_then(|v| match v {
4659 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
4660 _ => std::option::Option::None,
4661 })
4662 }
4663
4664 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4665 /// to hold a `MoneyValue`.
4666 ///
4667 /// Note that all the setters affecting `structured_value` are
4668 /// mutually exclusive.
4669 ///
4670 /// # Example
4671 /// ```ignore,no_run
4672 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4673 /// use google_cloud_type::model::Money;
4674 /// let x = NormalizedValue::new().set_money_value(Money::default()/* use setters */);
4675 /// assert!(x.money_value().is_some());
4676 /// assert!(x.date_value().is_none());
4677 /// assert!(x.datetime_value().is_none());
4678 /// assert!(x.address_value().is_none());
4679 /// assert!(x.boolean_value().is_none());
4680 /// assert!(x.integer_value().is_none());
4681 /// assert!(x.float_value().is_none());
4682 /// assert!(x.signature_value().is_none());
4683 /// ```
4684 pub fn set_money_value<
4685 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Money>>,
4686 >(
4687 mut self,
4688 v: T,
4689 ) -> Self {
4690 self.structured_value = std::option::Option::Some(
4691 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
4692 v.into(),
4693 ),
4694 );
4695 self
4696 }
4697
4698 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4699 /// if it holds a `DateValue`, `None` if the field is not set or
4700 /// holds a different branch.
4701 pub fn date_value(
4702 &self,
4703 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
4704 #[allow(unreachable_patterns)]
4705 self.structured_value.as_ref().and_then(|v| match v {
4706 crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
4707 _ => std::option::Option::None,
4708 })
4709 }
4710
4711 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4712 /// to hold a `DateValue`.
4713 ///
4714 /// Note that all the setters affecting `structured_value` are
4715 /// mutually exclusive.
4716 ///
4717 /// # Example
4718 /// ```ignore,no_run
4719 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4720 /// use google_cloud_type::model::Date;
4721 /// let x = NormalizedValue::new().set_date_value(Date::default()/* use setters */);
4722 /// assert!(x.date_value().is_some());
4723 /// assert!(x.money_value().is_none());
4724 /// assert!(x.datetime_value().is_none());
4725 /// assert!(x.address_value().is_none());
4726 /// assert!(x.boolean_value().is_none());
4727 /// assert!(x.integer_value().is_none());
4728 /// assert!(x.float_value().is_none());
4729 /// assert!(x.signature_value().is_none());
4730 /// ```
4731 pub fn set_date_value<
4732 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
4733 >(
4734 mut self,
4735 v: T,
4736 ) -> Self {
4737 self.structured_value = std::option::Option::Some(
4738 crate::model::document::entity::normalized_value::StructuredValue::DateValue(
4739 v.into(),
4740 ),
4741 );
4742 self
4743 }
4744
4745 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4746 /// if it holds a `DatetimeValue`, `None` if the field is not set or
4747 /// holds a different branch.
4748 pub fn datetime_value(
4749 &self,
4750 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::DateTime>>
4751 {
4752 #[allow(unreachable_patterns)]
4753 self.structured_value.as_ref().and_then(|v| match v {
4754 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
4755 _ => std::option::Option::None,
4756 })
4757 }
4758
4759 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4760 /// to hold a `DatetimeValue`.
4761 ///
4762 /// Note that all the setters affecting `structured_value` are
4763 /// mutually exclusive.
4764 ///
4765 /// # Example
4766 /// ```ignore,no_run
4767 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4768 /// use google_cloud_type::model::DateTime;
4769 /// let x = NormalizedValue::new().set_datetime_value(DateTime::default()/* use setters */);
4770 /// assert!(x.datetime_value().is_some());
4771 /// assert!(x.money_value().is_none());
4772 /// assert!(x.date_value().is_none());
4773 /// assert!(x.address_value().is_none());
4774 /// assert!(x.boolean_value().is_none());
4775 /// assert!(x.integer_value().is_none());
4776 /// assert!(x.float_value().is_none());
4777 /// assert!(x.signature_value().is_none());
4778 /// ```
4779 pub fn set_datetime_value<
4780 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::DateTime>>,
4781 >(
4782 mut self,
4783 v: T,
4784 ) -> Self {
4785 self.structured_value = std::option::Option::Some(
4786 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
4787 v.into()
4788 )
4789 );
4790 self
4791 }
4792
4793 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4794 /// if it holds a `AddressValue`, `None` if the field is not set or
4795 /// holds a different branch.
4796 pub fn address_value(
4797 &self,
4798 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>>
4799 {
4800 #[allow(unreachable_patterns)]
4801 self.structured_value.as_ref().and_then(|v| match v {
4802 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
4803 _ => std::option::Option::None,
4804 })
4805 }
4806
4807 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4808 /// to hold a `AddressValue`.
4809 ///
4810 /// Note that all the setters affecting `structured_value` are
4811 /// mutually exclusive.
4812 ///
4813 /// # Example
4814 /// ```ignore,no_run
4815 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4816 /// use google_cloud_type::model::PostalAddress;
4817 /// let x = NormalizedValue::new().set_address_value(PostalAddress::default()/* use setters */);
4818 /// assert!(x.address_value().is_some());
4819 /// assert!(x.money_value().is_none());
4820 /// assert!(x.date_value().is_none());
4821 /// assert!(x.datetime_value().is_none());
4822 /// assert!(x.boolean_value().is_none());
4823 /// assert!(x.integer_value().is_none());
4824 /// assert!(x.float_value().is_none());
4825 /// assert!(x.signature_value().is_none());
4826 /// ```
4827 pub fn set_address_value<
4828 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
4829 >(
4830 mut self,
4831 v: T,
4832 ) -> Self {
4833 self.structured_value = std::option::Option::Some(
4834 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
4835 v.into(),
4836 ),
4837 );
4838 self
4839 }
4840
4841 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4842 /// if it holds a `BooleanValue`, `None` if the field is not set or
4843 /// holds a different branch.
4844 pub fn boolean_value(&self) -> std::option::Option<&bool> {
4845 #[allow(unreachable_patterns)]
4846 self.structured_value.as_ref().and_then(|v| match v {
4847 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
4848 _ => std::option::Option::None,
4849 })
4850 }
4851
4852 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4853 /// to hold a `BooleanValue`.
4854 ///
4855 /// Note that all the setters affecting `structured_value` are
4856 /// mutually exclusive.
4857 ///
4858 /// # Example
4859 /// ```ignore,no_run
4860 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4861 /// let x = NormalizedValue::new().set_boolean_value(true);
4862 /// assert!(x.boolean_value().is_some());
4863 /// assert!(x.money_value().is_none());
4864 /// assert!(x.date_value().is_none());
4865 /// assert!(x.datetime_value().is_none());
4866 /// assert!(x.address_value().is_none());
4867 /// assert!(x.integer_value().is_none());
4868 /// assert!(x.float_value().is_none());
4869 /// assert!(x.signature_value().is_none());
4870 /// ```
4871 pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4872 self.structured_value = std::option::Option::Some(
4873 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
4874 v.into(),
4875 ),
4876 );
4877 self
4878 }
4879
4880 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4881 /// if it holds a `IntegerValue`, `None` if the field is not set or
4882 /// holds a different branch.
4883 pub fn integer_value(&self) -> std::option::Option<&i32> {
4884 #[allow(unreachable_patterns)]
4885 self.structured_value.as_ref().and_then(|v| match v {
4886 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
4887 _ => std::option::Option::None,
4888 })
4889 }
4890
4891 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4892 /// to hold a `IntegerValue`.
4893 ///
4894 /// Note that all the setters affecting `structured_value` are
4895 /// mutually exclusive.
4896 ///
4897 /// # Example
4898 /// ```ignore,no_run
4899 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4900 /// let x = NormalizedValue::new().set_integer_value(42);
4901 /// assert!(x.integer_value().is_some());
4902 /// assert!(x.money_value().is_none());
4903 /// assert!(x.date_value().is_none());
4904 /// assert!(x.datetime_value().is_none());
4905 /// assert!(x.address_value().is_none());
4906 /// assert!(x.boolean_value().is_none());
4907 /// assert!(x.float_value().is_none());
4908 /// assert!(x.signature_value().is_none());
4909 /// ```
4910 pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4911 self.structured_value = std::option::Option::Some(
4912 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
4913 v.into(),
4914 ),
4915 );
4916 self
4917 }
4918
4919 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4920 /// if it holds a `FloatValue`, `None` if the field is not set or
4921 /// holds a different branch.
4922 pub fn float_value(&self) -> std::option::Option<&f32> {
4923 #[allow(unreachable_patterns)]
4924 self.structured_value.as_ref().and_then(|v| match v {
4925 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
4926 _ => std::option::Option::None,
4927 })
4928 }
4929
4930 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4931 /// to hold a `FloatValue`.
4932 ///
4933 /// Note that all the setters affecting `structured_value` are
4934 /// mutually exclusive.
4935 ///
4936 /// # Example
4937 /// ```ignore,no_run
4938 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4939 /// let x = NormalizedValue::new().set_float_value(42.0);
4940 /// assert!(x.float_value().is_some());
4941 /// assert!(x.money_value().is_none());
4942 /// assert!(x.date_value().is_none());
4943 /// assert!(x.datetime_value().is_none());
4944 /// assert!(x.address_value().is_none());
4945 /// assert!(x.boolean_value().is_none());
4946 /// assert!(x.integer_value().is_none());
4947 /// assert!(x.signature_value().is_none());
4948 /// ```
4949 pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4950 self.structured_value = std::option::Option::Some(
4951 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
4952 v.into(),
4953 ),
4954 );
4955 self
4956 }
4957
4958 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4959 /// if it holds a `SignatureValue`, `None` if the field is not set or
4960 /// holds a different branch.
4961 pub fn signature_value(&self) -> std::option::Option<&bool> {
4962 #[allow(unreachable_patterns)]
4963 self.structured_value.as_ref().and_then(|v| match v {
4964 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
4965 _ => std::option::Option::None,
4966 })
4967 }
4968
4969 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4970 /// to hold a `SignatureValue`.
4971 ///
4972 /// Note that all the setters affecting `structured_value` are
4973 /// mutually exclusive.
4974 ///
4975 /// # Example
4976 /// ```ignore,no_run
4977 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4978 /// let x = NormalizedValue::new().set_signature_value(true);
4979 /// assert!(x.signature_value().is_some());
4980 /// assert!(x.money_value().is_none());
4981 /// assert!(x.date_value().is_none());
4982 /// assert!(x.datetime_value().is_none());
4983 /// assert!(x.address_value().is_none());
4984 /// assert!(x.boolean_value().is_none());
4985 /// assert!(x.integer_value().is_none());
4986 /// assert!(x.float_value().is_none());
4987 /// ```
4988 pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4989 self.structured_value = std::option::Option::Some(
4990 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
4991 v.into()
4992 )
4993 );
4994 self
4995 }
4996 }
4997
4998 impl wkt::message::Message for NormalizedValue {
4999 fn typename() -> &'static str {
5000 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
5001 }
5002 }
5003
5004 /// Defines additional types related to [NormalizedValue].
5005 pub mod normalized_value {
5006 #[allow(unused_imports)]
5007 use super::*;
5008
5009 /// An optional structured entity value.
5010 /// Must match entity type defined in schema if
5011 /// known. If this field is present, the `text` field could also be
5012 /// populated.
5013 #[derive(Clone, Debug, PartialEq)]
5014 #[non_exhaustive]
5015 pub enum StructuredValue {
5016 /// Money value. See also:
5017 /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
5018 MoneyValue(std::boxed::Box<google_cloud_type::model::Money>),
5019 /// Date value. Includes year, month, day. See also:
5020 /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
5021 DateValue(std::boxed::Box<google_cloud_type::model::Date>),
5022 /// DateTime value. Includes date, time, and timezone. See also:
5023 /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
5024 DatetimeValue(std::boxed::Box<google_cloud_type::model::DateTime>),
5025 /// Postal address. See also:
5026 /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
5027 AddressValue(std::boxed::Box<google_cloud_type::model::PostalAddress>),
5028 /// Boolean value. Can be used for entities with binary values, or for
5029 /// checkboxes.
5030 BooleanValue(bool),
5031 /// Integer value.
5032 IntegerValue(i32),
5033 /// Float value.
5034 FloatValue(f32),
5035 /// A signature - a graphical representation of a person's name,
5036 /// often used to sign a document.
5037 SignatureValue(bool),
5038 }
5039 }
5040
5041 /// Specifies how the entity's value is obtained.
5042 ///
5043 /// # Working with unknown values
5044 ///
5045 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5046 /// additional enum variants at any time. Adding new variants is not considered
5047 /// a breaking change. Applications should write their code in anticipation of:
5048 ///
5049 /// - New values appearing in future releases of the client library, **and**
5050 /// - New values received dynamically, without application changes.
5051 ///
5052 /// Please consult the [Working with enums] section in the user guide for some
5053 /// guidelines.
5054 ///
5055 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5056 #[derive(Clone, Debug, PartialEq)]
5057 #[non_exhaustive]
5058 pub enum Method {
5059 /// When the method is not specified, it should be treated as `EXTRACT`.
5060 Unspecified,
5061 /// The entity's value is directly extracted as-is from the document
5062 /// text.
5063 Extract,
5064 /// The entity's value is derived through inference and is not
5065 /// necessarily an exact text extraction from the document.
5066 Derive,
5067 /// If set, the enum was initialized with an unknown value.
5068 ///
5069 /// Applications can examine the value using [Method::value] or
5070 /// [Method::name].
5071 UnknownValue(method::UnknownValue),
5072 }
5073
5074 #[doc(hidden)]
5075 pub mod method {
5076 #[allow(unused_imports)]
5077 use super::*;
5078 #[derive(Clone, Debug, PartialEq)]
5079 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5080 }
5081
5082 impl Method {
5083 /// Gets the enum value.
5084 ///
5085 /// Returns `None` if the enum contains an unknown value deserialized from
5086 /// the string representation of enums.
5087 pub fn value(&self) -> std::option::Option<i32> {
5088 match self {
5089 Self::Unspecified => std::option::Option::Some(0),
5090 Self::Extract => std::option::Option::Some(1),
5091 Self::Derive => std::option::Option::Some(2),
5092 Self::UnknownValue(u) => u.0.value(),
5093 }
5094 }
5095
5096 /// Gets the enum value as a string.
5097 ///
5098 /// Returns `None` if the enum contains an unknown value deserialized from
5099 /// the integer representation of enums.
5100 pub fn name(&self) -> std::option::Option<&str> {
5101 match self {
5102 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
5103 Self::Extract => std::option::Option::Some("EXTRACT"),
5104 Self::Derive => std::option::Option::Some("DERIVE"),
5105 Self::UnknownValue(u) => u.0.name(),
5106 }
5107 }
5108 }
5109
5110 impl std::default::Default for Method {
5111 fn default() -> Self {
5112 use std::convert::From;
5113 Self::from(0)
5114 }
5115 }
5116
5117 impl std::fmt::Display for Method {
5118 fn fmt(
5119 &self,
5120 f: &mut std::fmt::Formatter<'_>,
5121 ) -> std::result::Result<(), std::fmt::Error> {
5122 wkt::internal::display_enum(f, self.name(), self.value())
5123 }
5124 }
5125
5126 impl std::convert::From<i32> for Method {
5127 fn from(value: i32) -> Self {
5128 match value {
5129 0 => Self::Unspecified,
5130 1 => Self::Extract,
5131 2 => Self::Derive,
5132 _ => Self::UnknownValue(method::UnknownValue(
5133 wkt::internal::UnknownEnumValue::Integer(value),
5134 )),
5135 }
5136 }
5137 }
5138
5139 impl std::convert::From<&str> for Method {
5140 fn from(value: &str) -> Self {
5141 use std::string::ToString;
5142 match value {
5143 "METHOD_UNSPECIFIED" => Self::Unspecified,
5144 "EXTRACT" => Self::Extract,
5145 "DERIVE" => Self::Derive,
5146 _ => Self::UnknownValue(method::UnknownValue(
5147 wkt::internal::UnknownEnumValue::String(value.to_string()),
5148 )),
5149 }
5150 }
5151 }
5152
5153 impl serde::ser::Serialize for Method {
5154 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5155 where
5156 S: serde::Serializer,
5157 {
5158 match self {
5159 Self::Unspecified => serializer.serialize_i32(0),
5160 Self::Extract => serializer.serialize_i32(1),
5161 Self::Derive => serializer.serialize_i32(2),
5162 Self::UnknownValue(u) => u.0.serialize(serializer),
5163 }
5164 }
5165 }
5166
5167 impl<'de> serde::de::Deserialize<'de> for Method {
5168 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5169 where
5170 D: serde::Deserializer<'de>,
5171 {
5172 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
5173 ".google.cloud.documentai.v1.Document.Entity.Method",
5174 ))
5175 }
5176 }
5177 }
5178
5179 /// Relationship between
5180 /// [Entities][google.cloud.documentai.v1.Document.Entity].
5181 ///
5182 /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
5183 #[derive(Clone, Default, PartialEq)]
5184 #[non_exhaustive]
5185 pub struct EntityRelation {
5186 /// Subject entity id.
5187 pub subject_id: std::string::String,
5188
5189 /// Object entity id.
5190 pub object_id: std::string::String,
5191
5192 /// Relationship description.
5193 pub relation: std::string::String,
5194
5195 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5196 }
5197
5198 impl EntityRelation {
5199 pub fn new() -> Self {
5200 std::default::Default::default()
5201 }
5202
5203 /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
5204 ///
5205 /// # Example
5206 /// ```ignore,no_run
5207 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5208 /// let x = EntityRelation::new().set_subject_id("example");
5209 /// ```
5210 pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5211 self.subject_id = v.into();
5212 self
5213 }
5214
5215 /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
5216 ///
5217 /// # Example
5218 /// ```ignore,no_run
5219 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5220 /// let x = EntityRelation::new().set_object_id("example");
5221 /// ```
5222 pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5223 self.object_id = v.into();
5224 self
5225 }
5226
5227 /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
5228 ///
5229 /// # Example
5230 /// ```ignore,no_run
5231 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5232 /// let x = EntityRelation::new().set_relation("example");
5233 /// ```
5234 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5235 self.relation = v.into();
5236 self
5237 }
5238 }
5239
5240 impl wkt::message::Message for EntityRelation {
5241 fn typename() -> &'static str {
5242 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
5243 }
5244 }
5245
5246 /// Text reference indexing into the
5247 /// [Document.text][google.cloud.documentai.v1.Document.text].
5248 ///
5249 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5250 #[derive(Clone, Default, PartialEq)]
5251 #[non_exhaustive]
5252 pub struct TextAnchor {
5253 /// The text segments from the
5254 /// [Document.text][google.cloud.documentai.v1.Document.text].
5255 ///
5256 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5257 pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
5258
5259 /// Contains the content of the text span so that users do
5260 /// not have to look it up in the text_segments. It is always
5261 /// populated for formFields.
5262 pub content: std::string::String,
5263
5264 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5265 }
5266
5267 impl TextAnchor {
5268 pub fn new() -> Self {
5269 std::default::Default::default()
5270 }
5271
5272 /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
5273 ///
5274 /// # Example
5275 /// ```ignore,no_run
5276 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5277 /// use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5278 /// let x = TextAnchor::new()
5279 /// .set_text_segments([
5280 /// TextSegment::default()/* use setters */,
5281 /// TextSegment::default()/* use (different) setters */,
5282 /// ]);
5283 /// ```
5284 pub fn set_text_segments<T, V>(mut self, v: T) -> Self
5285 where
5286 T: std::iter::IntoIterator<Item = V>,
5287 V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
5288 {
5289 use std::iter::Iterator;
5290 self.text_segments = v.into_iter().map(|i| i.into()).collect();
5291 self
5292 }
5293
5294 /// Sets the value of [content][crate::model::document::TextAnchor::content].
5295 ///
5296 /// # Example
5297 /// ```ignore,no_run
5298 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5299 /// let x = TextAnchor::new().set_content("example");
5300 /// ```
5301 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5302 self.content = v.into();
5303 self
5304 }
5305 }
5306
5307 impl wkt::message::Message for TextAnchor {
5308 fn typename() -> &'static str {
5309 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
5310 }
5311 }
5312
5313 /// Defines additional types related to [TextAnchor].
5314 pub mod text_anchor {
5315 #[allow(unused_imports)]
5316 use super::*;
5317
5318 /// A text segment in the
5319 /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
5320 /// may be out of bounds which indicate that the text extends into another
5321 /// document shard for large sharded documents. See
5322 /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
5323 ///
5324 /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
5325 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5326 #[derive(Clone, Default, PartialEq)]
5327 #[non_exhaustive]
5328 pub struct TextSegment {
5329 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5330 /// start UTF-8 char index in the
5331 /// [Document.text][google.cloud.documentai.v1.Document.text].
5332 ///
5333 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5334 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5335 pub start_index: i64,
5336
5337 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5338 /// half open end UTF-8 char index in the
5339 /// [Document.text][google.cloud.documentai.v1.Document.text].
5340 ///
5341 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5342 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5343 pub end_index: i64,
5344
5345 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5346 }
5347
5348 impl TextSegment {
5349 pub fn new() -> Self {
5350 std::default::Default::default()
5351 }
5352
5353 /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
5354 ///
5355 /// # Example
5356 /// ```ignore,no_run
5357 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5358 /// let x = TextSegment::new().set_start_index(42);
5359 /// ```
5360 pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5361 self.start_index = v.into();
5362 self
5363 }
5364
5365 /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
5366 ///
5367 /// # Example
5368 /// ```ignore,no_run
5369 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5370 /// let x = TextSegment::new().set_end_index(42);
5371 /// ```
5372 pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5373 self.end_index = v.into();
5374 self
5375 }
5376 }
5377
5378 impl wkt::message::Message for TextSegment {
5379 fn typename() -> &'static str {
5380 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
5381 }
5382 }
5383 }
5384
5385 /// Referencing the visual context of the entity in the
5386 /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
5387 /// can be cross-page, consist of multiple bounding polygons and optionally
5388 /// reference specific layout element types.
5389 ///
5390 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5391 #[derive(Clone, Default, PartialEq)]
5392 #[non_exhaustive]
5393 pub struct PageAnchor {
5394 /// One or more references to visual page elements
5395 pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
5396
5397 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5398 }
5399
5400 impl PageAnchor {
5401 pub fn new() -> Self {
5402 std::default::Default::default()
5403 }
5404
5405 /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
5406 ///
5407 /// # Example
5408 /// ```ignore,no_run
5409 /// # use google_cloud_documentai_v1::model::document::PageAnchor;
5410 /// use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5411 /// let x = PageAnchor::new()
5412 /// .set_page_refs([
5413 /// PageRef::default()/* use setters */,
5414 /// PageRef::default()/* use (different) setters */,
5415 /// ]);
5416 /// ```
5417 pub fn set_page_refs<T, V>(mut self, v: T) -> Self
5418 where
5419 T: std::iter::IntoIterator<Item = V>,
5420 V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
5421 {
5422 use std::iter::Iterator;
5423 self.page_refs = v.into_iter().map(|i| i.into()).collect();
5424 self
5425 }
5426 }
5427
5428 impl wkt::message::Message for PageAnchor {
5429 fn typename() -> &'static str {
5430 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
5431 }
5432 }
5433
5434 /// Defines additional types related to [PageAnchor].
5435 pub mod page_anchor {
5436 #[allow(unused_imports)]
5437 use super::*;
5438
5439 /// Represents a weak reference to a page element within a document.
5440 #[derive(Clone, Default, PartialEq)]
5441 #[non_exhaustive]
5442 pub struct PageRef {
5443 /// Required. Index into the
5444 /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
5445 /// for example using
5446 /// `[Document.pages][page_refs.page]` to locate the related page element.
5447 /// This field is skipped when its value is the default `0`. See
5448 /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
5449 ///
5450 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5451 pub page: i64,
5452
5453 /// Optional. The type of the layout element that is being referenced if
5454 /// any.
5455 pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
5456
5457 /// Optional. Deprecated. Use
5458 /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
5459 /// instead.
5460 ///
5461 /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
5462 #[deprecated]
5463 pub layout_id: std::string::String,
5464
5465 /// Optional. Identifies the bounding polygon of a layout element on the
5466 /// page. If `layout_type` is set, the bounding polygon must be exactly the
5467 /// same to the layout element it's referring to.
5468 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
5469
5470 /// Optional. Confidence of detected page element, if applicable. Range
5471 /// `[0, 1]`.
5472 pub confidence: f32,
5473
5474 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5475 }
5476
5477 impl PageRef {
5478 pub fn new() -> Self {
5479 std::default::Default::default()
5480 }
5481
5482 /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
5483 ///
5484 /// # Example
5485 /// ```ignore,no_run
5486 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5487 /// let x = PageRef::new().set_page(42);
5488 /// ```
5489 pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5490 self.page = v.into();
5491 self
5492 }
5493
5494 /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
5495 ///
5496 /// # Example
5497 /// ```ignore,no_run
5498 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5499 /// use google_cloud_documentai_v1::model::document::page_anchor::page_ref::LayoutType;
5500 /// let x0 = PageRef::new().set_layout_type(LayoutType::Block);
5501 /// let x1 = PageRef::new().set_layout_type(LayoutType::Paragraph);
5502 /// let x2 = PageRef::new().set_layout_type(LayoutType::Line);
5503 /// ```
5504 pub fn set_layout_type<
5505 T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
5506 >(
5507 mut self,
5508 v: T,
5509 ) -> Self {
5510 self.layout_type = v.into();
5511 self
5512 }
5513
5514 /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
5515 ///
5516 /// # Example
5517 /// ```ignore,no_run
5518 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5519 /// let x = PageRef::new().set_layout_id("example");
5520 /// ```
5521 #[deprecated]
5522 pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
5523 mut self,
5524 v: T,
5525 ) -> Self {
5526 self.layout_id = v.into();
5527 self
5528 }
5529
5530 /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5531 ///
5532 /// # Example
5533 /// ```ignore,no_run
5534 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5535 /// use google_cloud_documentai_v1::model::BoundingPoly;
5536 /// let x = PageRef::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
5537 /// ```
5538 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
5539 where
5540 T: std::convert::Into<crate::model::BoundingPoly>,
5541 {
5542 self.bounding_poly = std::option::Option::Some(v.into());
5543 self
5544 }
5545
5546 /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5547 ///
5548 /// # Example
5549 /// ```ignore,no_run
5550 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5551 /// use google_cloud_documentai_v1::model::BoundingPoly;
5552 /// let x = PageRef::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
5553 /// let x = PageRef::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
5554 /// ```
5555 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
5556 where
5557 T: std::convert::Into<crate::model::BoundingPoly>,
5558 {
5559 self.bounding_poly = v.map(|x| x.into());
5560 self
5561 }
5562
5563 /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
5564 ///
5565 /// # Example
5566 /// ```ignore,no_run
5567 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5568 /// let x = PageRef::new().set_confidence(42.0);
5569 /// ```
5570 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5571 self.confidence = v.into();
5572 self
5573 }
5574 }
5575
5576 impl wkt::message::Message for PageRef {
5577 fn typename() -> &'static str {
5578 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
5579 }
5580 }
5581
5582 /// Defines additional types related to [PageRef].
5583 pub mod page_ref {
5584 #[allow(unused_imports)]
5585 use super::*;
5586
5587 /// The type of layout that is being referenced.
5588 ///
5589 /// # Working with unknown values
5590 ///
5591 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5592 /// additional enum variants at any time. Adding new variants is not considered
5593 /// a breaking change. Applications should write their code in anticipation of:
5594 ///
5595 /// - New values appearing in future releases of the client library, **and**
5596 /// - New values received dynamically, without application changes.
5597 ///
5598 /// Please consult the [Working with enums] section in the user guide for some
5599 /// guidelines.
5600 ///
5601 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5602 #[derive(Clone, Debug, PartialEq)]
5603 #[non_exhaustive]
5604 pub enum LayoutType {
5605 /// Layout Unspecified.
5606 Unspecified,
5607 /// References a
5608 /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
5609 /// element.
5610 ///
5611 /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
5612 Block,
5613 /// References a
5614 /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
5615 /// element.
5616 ///
5617 /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
5618 Paragraph,
5619 /// References a
5620 /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
5621 ///
5622 /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
5623 Line,
5624 /// References a
5625 /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
5626 /// element.
5627 ///
5628 /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
5629 Token,
5630 /// References a
5631 /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
5632 /// element.
5633 ///
5634 /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
5635 VisualElement,
5636 /// Refrrences a
5637 /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
5638 /// element.
5639 ///
5640 /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
5641 Table,
5642 /// References a
5643 /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
5644 /// element.
5645 ///
5646 /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
5647 FormField,
5648 /// If set, the enum was initialized with an unknown value.
5649 ///
5650 /// Applications can examine the value using [LayoutType::value] or
5651 /// [LayoutType::name].
5652 UnknownValue(layout_type::UnknownValue),
5653 }
5654
5655 #[doc(hidden)]
5656 pub mod layout_type {
5657 #[allow(unused_imports)]
5658 use super::*;
5659 #[derive(Clone, Debug, PartialEq)]
5660 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5661 }
5662
5663 impl LayoutType {
5664 /// Gets the enum value.
5665 ///
5666 /// Returns `None` if the enum contains an unknown value deserialized from
5667 /// the string representation of enums.
5668 pub fn value(&self) -> std::option::Option<i32> {
5669 match self {
5670 Self::Unspecified => std::option::Option::Some(0),
5671 Self::Block => std::option::Option::Some(1),
5672 Self::Paragraph => std::option::Option::Some(2),
5673 Self::Line => std::option::Option::Some(3),
5674 Self::Token => std::option::Option::Some(4),
5675 Self::VisualElement => std::option::Option::Some(5),
5676 Self::Table => std::option::Option::Some(6),
5677 Self::FormField => std::option::Option::Some(7),
5678 Self::UnknownValue(u) => u.0.value(),
5679 }
5680 }
5681
5682 /// Gets the enum value as a string.
5683 ///
5684 /// Returns `None` if the enum contains an unknown value deserialized from
5685 /// the integer representation of enums.
5686 pub fn name(&self) -> std::option::Option<&str> {
5687 match self {
5688 Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
5689 Self::Block => std::option::Option::Some("BLOCK"),
5690 Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
5691 Self::Line => std::option::Option::Some("LINE"),
5692 Self::Token => std::option::Option::Some("TOKEN"),
5693 Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
5694 Self::Table => std::option::Option::Some("TABLE"),
5695 Self::FormField => std::option::Option::Some("FORM_FIELD"),
5696 Self::UnknownValue(u) => u.0.name(),
5697 }
5698 }
5699 }
5700
5701 impl std::default::Default for LayoutType {
5702 fn default() -> Self {
5703 use std::convert::From;
5704 Self::from(0)
5705 }
5706 }
5707
5708 impl std::fmt::Display for LayoutType {
5709 fn fmt(
5710 &self,
5711 f: &mut std::fmt::Formatter<'_>,
5712 ) -> std::result::Result<(), std::fmt::Error> {
5713 wkt::internal::display_enum(f, self.name(), self.value())
5714 }
5715 }
5716
5717 impl std::convert::From<i32> for LayoutType {
5718 fn from(value: i32) -> Self {
5719 match value {
5720 0 => Self::Unspecified,
5721 1 => Self::Block,
5722 2 => Self::Paragraph,
5723 3 => Self::Line,
5724 4 => Self::Token,
5725 5 => Self::VisualElement,
5726 6 => Self::Table,
5727 7 => Self::FormField,
5728 _ => Self::UnknownValue(layout_type::UnknownValue(
5729 wkt::internal::UnknownEnumValue::Integer(value),
5730 )),
5731 }
5732 }
5733 }
5734
5735 impl std::convert::From<&str> for LayoutType {
5736 fn from(value: &str) -> Self {
5737 use std::string::ToString;
5738 match value {
5739 "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
5740 "BLOCK" => Self::Block,
5741 "PARAGRAPH" => Self::Paragraph,
5742 "LINE" => Self::Line,
5743 "TOKEN" => Self::Token,
5744 "VISUAL_ELEMENT" => Self::VisualElement,
5745 "TABLE" => Self::Table,
5746 "FORM_FIELD" => Self::FormField,
5747 _ => Self::UnknownValue(layout_type::UnknownValue(
5748 wkt::internal::UnknownEnumValue::String(value.to_string()),
5749 )),
5750 }
5751 }
5752 }
5753
5754 impl serde::ser::Serialize for LayoutType {
5755 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5756 where
5757 S: serde::Serializer,
5758 {
5759 match self {
5760 Self::Unspecified => serializer.serialize_i32(0),
5761 Self::Block => serializer.serialize_i32(1),
5762 Self::Paragraph => serializer.serialize_i32(2),
5763 Self::Line => serializer.serialize_i32(3),
5764 Self::Token => serializer.serialize_i32(4),
5765 Self::VisualElement => serializer.serialize_i32(5),
5766 Self::Table => serializer.serialize_i32(6),
5767 Self::FormField => serializer.serialize_i32(7),
5768 Self::UnknownValue(u) => u.0.serialize(serializer),
5769 }
5770 }
5771 }
5772
5773 impl<'de> serde::de::Deserialize<'de> for LayoutType {
5774 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5775 where
5776 D: serde::Deserializer<'de>,
5777 {
5778 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
5779 ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
5780 ))
5781 }
5782 }
5783 }
5784 }
5785
5786 /// Structure to identify provenance relationships between annotations in
5787 /// different revisions.
5788 #[derive(Clone, Default, PartialEq)]
5789 #[non_exhaustive]
5790 pub struct Provenance {
5791 /// The index of the revision that produced this element.
5792 #[deprecated]
5793 pub revision: i32,
5794
5795 /// The Id of this operation. Needs to be unique within the scope of the
5796 /// revision.
5797 #[deprecated]
5798 pub id: i32,
5799
5800 /// References to the original elements that are replaced.
5801 pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
5802
5803 /// The type of provenance operation.
5804 pub r#type: crate::model::document::provenance::OperationType,
5805
5806 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5807 }
5808
5809 impl Provenance {
5810 pub fn new() -> Self {
5811 std::default::Default::default()
5812 }
5813
5814 /// Sets the value of [revision][crate::model::document::Provenance::revision].
5815 ///
5816 /// # Example
5817 /// ```ignore,no_run
5818 /// # use google_cloud_documentai_v1::model::document::Provenance;
5819 /// let x = Provenance::new().set_revision(42);
5820 /// ```
5821 #[deprecated]
5822 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5823 self.revision = v.into();
5824 self
5825 }
5826
5827 /// Sets the value of [id][crate::model::document::Provenance::id].
5828 ///
5829 /// # Example
5830 /// ```ignore,no_run
5831 /// # use google_cloud_documentai_v1::model::document::Provenance;
5832 /// let x = Provenance::new().set_id(42);
5833 /// ```
5834 #[deprecated]
5835 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5836 self.id = v.into();
5837 self
5838 }
5839
5840 /// Sets the value of [parents][crate::model::document::Provenance::parents].
5841 ///
5842 /// # Example
5843 /// ```ignore,no_run
5844 /// # use google_cloud_documentai_v1::model::document::Provenance;
5845 /// use google_cloud_documentai_v1::model::document::provenance::Parent;
5846 /// let x = Provenance::new()
5847 /// .set_parents([
5848 /// Parent::default()/* use setters */,
5849 /// Parent::default()/* use (different) setters */,
5850 /// ]);
5851 /// ```
5852 pub fn set_parents<T, V>(mut self, v: T) -> Self
5853 where
5854 T: std::iter::IntoIterator<Item = V>,
5855 V: std::convert::Into<crate::model::document::provenance::Parent>,
5856 {
5857 use std::iter::Iterator;
5858 self.parents = v.into_iter().map(|i| i.into()).collect();
5859 self
5860 }
5861
5862 /// Sets the value of [r#type][crate::model::document::Provenance::type].
5863 ///
5864 /// # Example
5865 /// ```ignore,no_run
5866 /// # use google_cloud_documentai_v1::model::document::Provenance;
5867 /// use google_cloud_documentai_v1::model::document::provenance::OperationType;
5868 /// let x0 = Provenance::new().set_type(OperationType::Add);
5869 /// let x1 = Provenance::new().set_type(OperationType::Remove);
5870 /// let x2 = Provenance::new().set_type(OperationType::Update);
5871 /// ```
5872 pub fn set_type<
5873 T: std::convert::Into<crate::model::document::provenance::OperationType>,
5874 >(
5875 mut self,
5876 v: T,
5877 ) -> Self {
5878 self.r#type = v.into();
5879 self
5880 }
5881 }
5882
5883 impl wkt::message::Message for Provenance {
5884 fn typename() -> &'static str {
5885 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
5886 }
5887 }
5888
5889 /// Defines additional types related to [Provenance].
5890 pub mod provenance {
5891 #[allow(unused_imports)]
5892 use super::*;
5893
5894 /// The parent element the current element is based on. Used for
5895 /// referencing/aligning, removal and replacement operations.
5896 #[derive(Clone, Default, PartialEq)]
5897 #[non_exhaustive]
5898 pub struct Parent {
5899 /// The index of the index into current revision's parent_ids list.
5900 pub revision: i32,
5901
5902 /// The index of the parent item in the corresponding item list (eg. list
5903 /// of entities, properties within entities, etc.) in the parent revision.
5904 pub index: i32,
5905
5906 /// The id of the parent provenance.
5907 #[deprecated]
5908 pub id: i32,
5909
5910 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5911 }
5912
5913 impl Parent {
5914 pub fn new() -> Self {
5915 std::default::Default::default()
5916 }
5917
5918 /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
5919 ///
5920 /// # Example
5921 /// ```ignore,no_run
5922 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5923 /// let x = Parent::new().set_revision(42);
5924 /// ```
5925 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5926 self.revision = v.into();
5927 self
5928 }
5929
5930 /// Sets the value of [index][crate::model::document::provenance::Parent::index].
5931 ///
5932 /// # Example
5933 /// ```ignore,no_run
5934 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5935 /// let x = Parent::new().set_index(42);
5936 /// ```
5937 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5938 self.index = v.into();
5939 self
5940 }
5941
5942 /// Sets the value of [id][crate::model::document::provenance::Parent::id].
5943 ///
5944 /// # Example
5945 /// ```ignore,no_run
5946 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5947 /// let x = Parent::new().set_id(42);
5948 /// ```
5949 #[deprecated]
5950 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5951 self.id = v.into();
5952 self
5953 }
5954 }
5955
5956 impl wkt::message::Message for Parent {
5957 fn typename() -> &'static str {
5958 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
5959 }
5960 }
5961
5962 /// If a processor or agent does an explicit operation on existing elements.
5963 ///
5964 /// # Working with unknown values
5965 ///
5966 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5967 /// additional enum variants at any time. Adding new variants is not considered
5968 /// a breaking change. Applications should write their code in anticipation of:
5969 ///
5970 /// - New values appearing in future releases of the client library, **and**
5971 /// - New values received dynamically, without application changes.
5972 ///
5973 /// Please consult the [Working with enums] section in the user guide for some
5974 /// guidelines.
5975 ///
5976 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5977 #[derive(Clone, Debug, PartialEq)]
5978 #[non_exhaustive]
5979 pub enum OperationType {
5980 /// Operation type unspecified. If no operation is specified a provenance
5981 /// entry is simply used to match against a `parent`.
5982 Unspecified,
5983 /// Add an element.
5984 Add,
5985 /// Remove an element identified by `parent`.
5986 Remove,
5987 /// Updates any fields within the given provenance scope of the message. It
5988 /// overwrites the fields rather than replacing them. Use this when you
5989 /// want to update a field value of an entity without also updating all the
5990 /// child properties.
5991 Update,
5992 /// Currently unused. Replace an element identified by `parent`.
5993 Replace,
5994 /// Deprecated. Request human review for the element identified by
5995 /// `parent`.
5996 #[deprecated]
5997 EvalRequested,
5998 /// Deprecated. Element is reviewed and approved at human review,
5999 /// confidence will be set to 1.0.
6000 #[deprecated]
6001 EvalApproved,
6002 /// Deprecated. Element is skipped in the validation process.
6003 #[deprecated]
6004 EvalSkipped,
6005 /// If set, the enum was initialized with an unknown value.
6006 ///
6007 /// Applications can examine the value using [OperationType::value] or
6008 /// [OperationType::name].
6009 UnknownValue(operation_type::UnknownValue),
6010 }
6011
6012 #[doc(hidden)]
6013 pub mod operation_type {
6014 #[allow(unused_imports)]
6015 use super::*;
6016 #[derive(Clone, Debug, PartialEq)]
6017 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6018 }
6019
6020 impl OperationType {
6021 /// Gets the enum value.
6022 ///
6023 /// Returns `None` if the enum contains an unknown value deserialized from
6024 /// the string representation of enums.
6025 pub fn value(&self) -> std::option::Option<i32> {
6026 match self {
6027 Self::Unspecified => std::option::Option::Some(0),
6028 Self::Add => std::option::Option::Some(1),
6029 Self::Remove => std::option::Option::Some(2),
6030 Self::Update => std::option::Option::Some(7),
6031 Self::Replace => std::option::Option::Some(3),
6032 Self::EvalRequested => std::option::Option::Some(4),
6033 Self::EvalApproved => std::option::Option::Some(5),
6034 Self::EvalSkipped => std::option::Option::Some(6),
6035 Self::UnknownValue(u) => u.0.value(),
6036 }
6037 }
6038
6039 /// Gets the enum value as a string.
6040 ///
6041 /// Returns `None` if the enum contains an unknown value deserialized from
6042 /// the integer representation of enums.
6043 pub fn name(&self) -> std::option::Option<&str> {
6044 match self {
6045 Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
6046 Self::Add => std::option::Option::Some("ADD"),
6047 Self::Remove => std::option::Option::Some("REMOVE"),
6048 Self::Update => std::option::Option::Some("UPDATE"),
6049 Self::Replace => std::option::Option::Some("REPLACE"),
6050 Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
6051 Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
6052 Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
6053 Self::UnknownValue(u) => u.0.name(),
6054 }
6055 }
6056 }
6057
6058 impl std::default::Default for OperationType {
6059 fn default() -> Self {
6060 use std::convert::From;
6061 Self::from(0)
6062 }
6063 }
6064
6065 impl std::fmt::Display for OperationType {
6066 fn fmt(
6067 &self,
6068 f: &mut std::fmt::Formatter<'_>,
6069 ) -> std::result::Result<(), std::fmt::Error> {
6070 wkt::internal::display_enum(f, self.name(), self.value())
6071 }
6072 }
6073
6074 impl std::convert::From<i32> for OperationType {
6075 fn from(value: i32) -> Self {
6076 match value {
6077 0 => Self::Unspecified,
6078 1 => Self::Add,
6079 2 => Self::Remove,
6080 3 => Self::Replace,
6081 4 => Self::EvalRequested,
6082 5 => Self::EvalApproved,
6083 6 => Self::EvalSkipped,
6084 7 => Self::Update,
6085 _ => Self::UnknownValue(operation_type::UnknownValue(
6086 wkt::internal::UnknownEnumValue::Integer(value),
6087 )),
6088 }
6089 }
6090 }
6091
6092 impl std::convert::From<&str> for OperationType {
6093 fn from(value: &str) -> Self {
6094 use std::string::ToString;
6095 match value {
6096 "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
6097 "ADD" => Self::Add,
6098 "REMOVE" => Self::Remove,
6099 "UPDATE" => Self::Update,
6100 "REPLACE" => Self::Replace,
6101 "EVAL_REQUESTED" => Self::EvalRequested,
6102 "EVAL_APPROVED" => Self::EvalApproved,
6103 "EVAL_SKIPPED" => Self::EvalSkipped,
6104 _ => Self::UnknownValue(operation_type::UnknownValue(
6105 wkt::internal::UnknownEnumValue::String(value.to_string()),
6106 )),
6107 }
6108 }
6109 }
6110
6111 impl serde::ser::Serialize for OperationType {
6112 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6113 where
6114 S: serde::Serializer,
6115 {
6116 match self {
6117 Self::Unspecified => serializer.serialize_i32(0),
6118 Self::Add => serializer.serialize_i32(1),
6119 Self::Remove => serializer.serialize_i32(2),
6120 Self::Update => serializer.serialize_i32(7),
6121 Self::Replace => serializer.serialize_i32(3),
6122 Self::EvalRequested => serializer.serialize_i32(4),
6123 Self::EvalApproved => serializer.serialize_i32(5),
6124 Self::EvalSkipped => serializer.serialize_i32(6),
6125 Self::UnknownValue(u) => u.0.serialize(serializer),
6126 }
6127 }
6128 }
6129
6130 impl<'de> serde::de::Deserialize<'de> for OperationType {
6131 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6132 where
6133 D: serde::Deserializer<'de>,
6134 {
6135 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
6136 ".google.cloud.documentai.v1.Document.Provenance.OperationType",
6137 ))
6138 }
6139 }
6140 }
6141
6142 /// Contains past or forward revisions of this document.
6143 #[derive(Clone, Default, PartialEq)]
6144 #[non_exhaustive]
6145 pub struct Revision {
6146 /// Id of the revision, internally generated by doc proto storage.
6147 /// Unique within the context of the document.
6148 pub id: std::string::String,
6149
6150 /// The revisions that this revision is based on. This can include one or
6151 /// more parent (when documents are merged.) This field represents the
6152 /// index into the `revisions` field.
6153 #[deprecated]
6154 pub parent: std::vec::Vec<i32>,
6155
6156 /// The revisions that this revision is based on. Must include all the ids
6157 /// that have anything to do with this revision - eg. there are
6158 /// `provenance.parent.revision` fields that index into this field.
6159 pub parent_ids: std::vec::Vec<std::string::String>,
6160
6161 /// The time that the revision was created, internally generated by
6162 /// doc proto storage at the time of create.
6163 pub create_time: std::option::Option<wkt::Timestamp>,
6164
6165 /// Human Review information of this revision.
6166 pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
6167
6168 /// Who/what made the change
6169 pub source: std::option::Option<crate::model::document::revision::Source>,
6170
6171 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6172 }
6173
6174 impl Revision {
6175 pub fn new() -> Self {
6176 std::default::Default::default()
6177 }
6178
6179 /// Sets the value of [id][crate::model::document::Revision::id].
6180 ///
6181 /// # Example
6182 /// ```ignore,no_run
6183 /// # use google_cloud_documentai_v1::model::document::Revision;
6184 /// let x = Revision::new().set_id("example");
6185 /// ```
6186 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6187 self.id = v.into();
6188 self
6189 }
6190
6191 /// Sets the value of [parent][crate::model::document::Revision::parent].
6192 ///
6193 /// # Example
6194 /// ```ignore,no_run
6195 /// # use google_cloud_documentai_v1::model::document::Revision;
6196 /// let x = Revision::new().set_parent([1, 2, 3]);
6197 /// ```
6198 #[deprecated]
6199 pub fn set_parent<T, V>(mut self, v: T) -> Self
6200 where
6201 T: std::iter::IntoIterator<Item = V>,
6202 V: std::convert::Into<i32>,
6203 {
6204 use std::iter::Iterator;
6205 self.parent = v.into_iter().map(|i| i.into()).collect();
6206 self
6207 }
6208
6209 /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
6210 ///
6211 /// # Example
6212 /// ```ignore,no_run
6213 /// # use google_cloud_documentai_v1::model::document::Revision;
6214 /// let x = Revision::new().set_parent_ids(["a", "b", "c"]);
6215 /// ```
6216 pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
6217 where
6218 T: std::iter::IntoIterator<Item = V>,
6219 V: std::convert::Into<std::string::String>,
6220 {
6221 use std::iter::Iterator;
6222 self.parent_ids = v.into_iter().map(|i| i.into()).collect();
6223 self
6224 }
6225
6226 /// Sets the value of [create_time][crate::model::document::Revision::create_time].
6227 ///
6228 /// # Example
6229 /// ```ignore,no_run
6230 /// # use google_cloud_documentai_v1::model::document::Revision;
6231 /// use wkt::Timestamp;
6232 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
6233 /// ```
6234 pub fn set_create_time<T>(mut self, v: T) -> Self
6235 where
6236 T: std::convert::Into<wkt::Timestamp>,
6237 {
6238 self.create_time = std::option::Option::Some(v.into());
6239 self
6240 }
6241
6242 /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
6243 ///
6244 /// # Example
6245 /// ```ignore,no_run
6246 /// # use google_cloud_documentai_v1::model::document::Revision;
6247 /// use wkt::Timestamp;
6248 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6249 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
6250 /// ```
6251 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6252 where
6253 T: std::convert::Into<wkt::Timestamp>,
6254 {
6255 self.create_time = v.map(|x| x.into());
6256 self
6257 }
6258
6259 /// Sets the value of [human_review][crate::model::document::Revision::human_review].
6260 ///
6261 /// # Example
6262 /// ```ignore,no_run
6263 /// # use google_cloud_documentai_v1::model::document::Revision;
6264 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6265 /// let x = Revision::new().set_human_review(HumanReview::default()/* use setters */);
6266 /// ```
6267 pub fn set_human_review<T>(mut self, v: T) -> Self
6268 where
6269 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6270 {
6271 self.human_review = std::option::Option::Some(v.into());
6272 self
6273 }
6274
6275 /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
6276 ///
6277 /// # Example
6278 /// ```ignore,no_run
6279 /// # use google_cloud_documentai_v1::model::document::Revision;
6280 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6281 /// let x = Revision::new().set_or_clear_human_review(Some(HumanReview::default()/* use setters */));
6282 /// let x = Revision::new().set_or_clear_human_review(None::<HumanReview>);
6283 /// ```
6284 pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
6285 where
6286 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6287 {
6288 self.human_review = v.map(|x| x.into());
6289 self
6290 }
6291
6292 /// Sets the value of [source][crate::model::document::Revision::source].
6293 ///
6294 /// Note that all the setters affecting `source` are mutually
6295 /// exclusive.
6296 ///
6297 /// # Example
6298 /// ```ignore,no_run
6299 /// # use google_cloud_documentai_v1::model::document::Revision;
6300 /// use google_cloud_documentai_v1::model::document::revision::Source;
6301 /// let x = Revision::new().set_source(Some(Source::Agent("example".to_string())));
6302 /// ```
6303 pub fn set_source<
6304 T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
6305 >(
6306 mut self,
6307 v: T,
6308 ) -> Self {
6309 self.source = v.into();
6310 self
6311 }
6312
6313 /// The value of [source][crate::model::document::Revision::source]
6314 /// if it holds a `Agent`, `None` if the field is not set or
6315 /// holds a different branch.
6316 pub fn agent(&self) -> std::option::Option<&std::string::String> {
6317 #[allow(unreachable_patterns)]
6318 self.source.as_ref().and_then(|v| match v {
6319 crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
6320 _ => std::option::Option::None,
6321 })
6322 }
6323
6324 /// Sets the value of [source][crate::model::document::Revision::source]
6325 /// to hold a `Agent`.
6326 ///
6327 /// Note that all the setters affecting `source` are
6328 /// mutually exclusive.
6329 ///
6330 /// # Example
6331 /// ```ignore,no_run
6332 /// # use google_cloud_documentai_v1::model::document::Revision;
6333 /// let x = Revision::new().set_agent("example");
6334 /// assert!(x.agent().is_some());
6335 /// assert!(x.processor().is_none());
6336 /// ```
6337 pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6338 self.source = std::option::Option::Some(
6339 crate::model::document::revision::Source::Agent(v.into()),
6340 );
6341 self
6342 }
6343
6344 /// The value of [source][crate::model::document::Revision::source]
6345 /// if it holds a `Processor`, `None` if the field is not set or
6346 /// holds a different branch.
6347 pub fn processor(&self) -> std::option::Option<&std::string::String> {
6348 #[allow(unreachable_patterns)]
6349 self.source.as_ref().and_then(|v| match v {
6350 crate::model::document::revision::Source::Processor(v) => {
6351 std::option::Option::Some(v)
6352 }
6353 _ => std::option::Option::None,
6354 })
6355 }
6356
6357 /// Sets the value of [source][crate::model::document::Revision::source]
6358 /// to hold a `Processor`.
6359 ///
6360 /// Note that all the setters affecting `source` are
6361 /// mutually exclusive.
6362 ///
6363 /// # Example
6364 /// ```ignore,no_run
6365 /// # use google_cloud_documentai_v1::model::document::Revision;
6366 /// let x = Revision::new().set_processor("example");
6367 /// assert!(x.processor().is_some());
6368 /// assert!(x.agent().is_none());
6369 /// ```
6370 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6371 self.source = std::option::Option::Some(
6372 crate::model::document::revision::Source::Processor(v.into()),
6373 );
6374 self
6375 }
6376 }
6377
6378 impl wkt::message::Message for Revision {
6379 fn typename() -> &'static str {
6380 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
6381 }
6382 }
6383
6384 /// Defines additional types related to [Revision].
6385 pub mod revision {
6386 #[allow(unused_imports)]
6387 use super::*;
6388
6389 /// Human Review information of the document.
6390 #[derive(Clone, Default, PartialEq)]
6391 #[non_exhaustive]
6392 pub struct HumanReview {
6393 /// Human review state. For example, `requested`, `succeeded`, `rejected`.
6394 pub state: std::string::String,
6395
6396 /// A message providing more details about the current state of processing.
6397 /// For example, the rejection reason when the state is `rejected`.
6398 pub state_message: std::string::String,
6399
6400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6401 }
6402
6403 impl HumanReview {
6404 pub fn new() -> Self {
6405 std::default::Default::default()
6406 }
6407
6408 /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
6409 ///
6410 /// # Example
6411 /// ```ignore,no_run
6412 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6413 /// let x = HumanReview::new().set_state("example");
6414 /// ```
6415 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6416 self.state = v.into();
6417 self
6418 }
6419
6420 /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
6421 ///
6422 /// # Example
6423 /// ```ignore,no_run
6424 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6425 /// let x = HumanReview::new().set_state_message("example");
6426 /// ```
6427 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
6428 mut self,
6429 v: T,
6430 ) -> Self {
6431 self.state_message = v.into();
6432 self
6433 }
6434 }
6435
6436 impl wkt::message::Message for HumanReview {
6437 fn typename() -> &'static str {
6438 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
6439 }
6440 }
6441
6442 /// Who/what made the change
6443 #[derive(Clone, Debug, PartialEq)]
6444 #[non_exhaustive]
6445 pub enum Source {
6446 /// If the change was made by a person specify the name or id of that
6447 /// person.
6448 Agent(std::string::String),
6449 /// If the annotation was made by processor identify the processor by its
6450 /// resource name.
6451 Processor(std::string::String),
6452 }
6453 }
6454
6455 /// This message is used for text changes aka. OCR corrections.
6456 #[derive(Clone, Default, PartialEq)]
6457 #[non_exhaustive]
6458 pub struct TextChange {
6459 /// Provenance of the correction.
6460 /// Text anchor indexing into the
6461 /// [Document.text][google.cloud.documentai.v1.Document.text]. There can
6462 /// only be a single `TextAnchor.text_segments` element. If the start and
6463 /// end index of the text segment are the same, the text change is inserted
6464 /// before that index.
6465 ///
6466 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
6467 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
6468
6469 /// The text that replaces the text identified in the `text_anchor`.
6470 pub changed_text: std::string::String,
6471
6472 /// The history of this annotation.
6473 #[deprecated]
6474 pub provenance: std::vec::Vec<crate::model::document::Provenance>,
6475
6476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6477 }
6478
6479 impl TextChange {
6480 pub fn new() -> Self {
6481 std::default::Default::default()
6482 }
6483
6484 /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6485 ///
6486 /// # Example
6487 /// ```ignore,no_run
6488 /// # use google_cloud_documentai_v1::model::document::TextChange;
6489 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6490 /// let x = TextChange::new().set_text_anchor(TextAnchor::default()/* use setters */);
6491 /// ```
6492 pub fn set_text_anchor<T>(mut self, v: T) -> Self
6493 where
6494 T: std::convert::Into<crate::model::document::TextAnchor>,
6495 {
6496 self.text_anchor = std::option::Option::Some(v.into());
6497 self
6498 }
6499
6500 /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6501 ///
6502 /// # Example
6503 /// ```ignore,no_run
6504 /// # use google_cloud_documentai_v1::model::document::TextChange;
6505 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6506 /// let x = TextChange::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
6507 /// let x = TextChange::new().set_or_clear_text_anchor(None::<TextAnchor>);
6508 /// ```
6509 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
6510 where
6511 T: std::convert::Into<crate::model::document::TextAnchor>,
6512 {
6513 self.text_anchor = v.map(|x| x.into());
6514 self
6515 }
6516
6517 /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
6518 ///
6519 /// # Example
6520 /// ```ignore,no_run
6521 /// # use google_cloud_documentai_v1::model::document::TextChange;
6522 /// let x = TextChange::new().set_changed_text("example");
6523 /// ```
6524 pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
6525 mut self,
6526 v: T,
6527 ) -> Self {
6528 self.changed_text = v.into();
6529 self
6530 }
6531
6532 /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
6533 ///
6534 /// # Example
6535 /// ```ignore,no_run
6536 /// # use google_cloud_documentai_v1::model::document::TextChange;
6537 /// use google_cloud_documentai_v1::model::document::Provenance;
6538 /// let x = TextChange::new()
6539 /// .set_provenance([
6540 /// Provenance::default()/* use setters */,
6541 /// Provenance::default()/* use (different) setters */,
6542 /// ]);
6543 /// ```
6544 #[deprecated]
6545 pub fn set_provenance<T, V>(mut self, v: T) -> Self
6546 where
6547 T: std::iter::IntoIterator<Item = V>,
6548 V: std::convert::Into<crate::model::document::Provenance>,
6549 {
6550 use std::iter::Iterator;
6551 self.provenance = v.into_iter().map(|i| i.into()).collect();
6552 self
6553 }
6554 }
6555
6556 impl wkt::message::Message for TextChange {
6557 fn typename() -> &'static str {
6558 "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
6559 }
6560 }
6561
6562 /// Represents the annotation of a block or a chunk.
6563 #[derive(Clone, Default, PartialEq)]
6564 #[non_exhaustive]
6565 pub struct Annotations {
6566 /// The description of the content with this annotation.
6567 pub description: std::string::String,
6568
6569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6570 }
6571
6572 impl Annotations {
6573 pub fn new() -> Self {
6574 std::default::Default::default()
6575 }
6576
6577 /// Sets the value of [description][crate::model::document::Annotations::description].
6578 ///
6579 /// # Example
6580 /// ```ignore,no_run
6581 /// # use google_cloud_documentai_v1::model::document::Annotations;
6582 /// let x = Annotations::new().set_description("example");
6583 /// ```
6584 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6585 self.description = v.into();
6586 self
6587 }
6588 }
6589
6590 impl wkt::message::Message for Annotations {
6591 fn typename() -> &'static str {
6592 "type.googleapis.com/google.cloud.documentai.v1.Document.Annotations"
6593 }
6594 }
6595
6596 /// Represents the parsed layout of a document as a collection of blocks that
6597 /// the document is divided into.
6598 #[derive(Clone, Default, PartialEq)]
6599 #[non_exhaustive]
6600 pub struct DocumentLayout {
6601 /// List of blocks in the document.
6602 pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6603
6604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6605 }
6606
6607 impl DocumentLayout {
6608 pub fn new() -> Self {
6609 std::default::Default::default()
6610 }
6611
6612 /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
6613 ///
6614 /// # Example
6615 /// ```ignore,no_run
6616 /// # use google_cloud_documentai_v1::model::document::DocumentLayout;
6617 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6618 /// let x = DocumentLayout::new()
6619 /// .set_blocks([
6620 /// DocumentLayoutBlock::default()/* use setters */,
6621 /// DocumentLayoutBlock::default()/* use (different) setters */,
6622 /// ]);
6623 /// ```
6624 pub fn set_blocks<T, V>(mut self, v: T) -> Self
6625 where
6626 T: std::iter::IntoIterator<Item = V>,
6627 V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
6628 {
6629 use std::iter::Iterator;
6630 self.blocks = v.into_iter().map(|i| i.into()).collect();
6631 self
6632 }
6633 }
6634
6635 impl wkt::message::Message for DocumentLayout {
6636 fn typename() -> &'static str {
6637 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
6638 }
6639 }
6640
6641 /// Defines additional types related to [DocumentLayout].
6642 pub mod document_layout {
6643 #[allow(unused_imports)]
6644 use super::*;
6645
6646 /// Represents a block. A block could be one of the various types (text,
6647 /// table, list) supported.
6648 #[derive(Clone, Default, PartialEq)]
6649 #[non_exhaustive]
6650 pub struct DocumentLayoutBlock {
6651 /// ID of the block.
6652 pub block_id: std::string::String,
6653
6654 /// Page span of the block.
6655 pub page_span: std::option::Option<
6656 crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
6657 >,
6658
6659 /// Identifies the bounding box for the block.
6660 pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6661
6662 pub block: std::option::Option<
6663 crate::model::document::document_layout::document_layout_block::Block,
6664 >,
6665
6666 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6667 }
6668
6669 impl DocumentLayoutBlock {
6670 pub fn new() -> Self {
6671 std::default::Default::default()
6672 }
6673
6674 /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
6675 ///
6676 /// # Example
6677 /// ```ignore,no_run
6678 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6679 /// let x = DocumentLayoutBlock::new().set_block_id("example");
6680 /// ```
6681 pub fn set_block_id<T: std::convert::Into<std::string::String>>(
6682 mut self,
6683 v: T,
6684 ) -> Self {
6685 self.block_id = v.into();
6686 self
6687 }
6688
6689 /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6690 ///
6691 /// # Example
6692 /// ```ignore,no_run
6693 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6694 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6695 /// let x = DocumentLayoutBlock::new().set_page_span(LayoutPageSpan::default()/* use setters */);
6696 /// ```
6697 pub fn set_page_span<T>(mut self, v: T) -> Self
6698 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6699 {
6700 self.page_span = std::option::Option::Some(v.into());
6701 self
6702 }
6703
6704 /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6705 ///
6706 /// # Example
6707 /// ```ignore,no_run
6708 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6709 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6710 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(Some(LayoutPageSpan::default()/* use setters */));
6711 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(None::<LayoutPageSpan>);
6712 /// ```
6713 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
6714 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6715 {
6716 self.page_span = v.map(|x| x.into());
6717 self
6718 }
6719
6720 /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6721 ///
6722 /// # Example
6723 /// ```ignore,no_run
6724 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6725 /// use google_cloud_documentai_v1::model::BoundingPoly;
6726 /// let x = DocumentLayoutBlock::new().set_bounding_box(BoundingPoly::default()/* use setters */);
6727 /// ```
6728 pub fn set_bounding_box<T>(mut self, v: T) -> Self
6729 where
6730 T: std::convert::Into<crate::model::BoundingPoly>,
6731 {
6732 self.bounding_box = std::option::Option::Some(v.into());
6733 self
6734 }
6735
6736 /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6737 ///
6738 /// # Example
6739 /// ```ignore,no_run
6740 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6741 /// use google_cloud_documentai_v1::model::BoundingPoly;
6742 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(Some(BoundingPoly::default()/* use setters */));
6743 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(None::<BoundingPoly>);
6744 /// ```
6745 pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6746 where
6747 T: std::convert::Into<crate::model::BoundingPoly>,
6748 {
6749 self.bounding_box = v.map(|x| x.into());
6750 self
6751 }
6752
6753 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
6754 ///
6755 /// Note that all the setters affecting `block` are mutually
6756 /// exclusive.
6757 ///
6758 /// # Example
6759 /// ```ignore,no_run
6760 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6761 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6762 /// let x = DocumentLayoutBlock::new().set_block(Some(
6763 /// google_cloud_documentai_v1::model::document::document_layout::document_layout_block::Block::TextBlock(LayoutTextBlock::default().into())));
6764 /// ```
6765 pub fn set_block<
6766 T: std::convert::Into<
6767 std::option::Option<
6768 crate::model::document::document_layout::document_layout_block::Block,
6769 >,
6770 >,
6771 >(
6772 mut self,
6773 v: T,
6774 ) -> Self {
6775 self.block = v.into();
6776 self
6777 }
6778
6779 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6780 /// if it holds a `TextBlock`, `None` if the field is not set or
6781 /// holds a different branch.
6782 pub fn text_block(
6783 &self,
6784 ) -> std::option::Option<
6785 &std::boxed::Box<
6786 crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
6787 >,
6788 > {
6789 #[allow(unreachable_patterns)]
6790 self.block.as_ref().and_then(|v| match v {
6791 crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
6792 _ => std::option::Option::None,
6793 })
6794 }
6795
6796 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6797 /// to hold a `TextBlock`.
6798 ///
6799 /// Note that all the setters affecting `block` are
6800 /// mutually exclusive.
6801 ///
6802 /// # Example
6803 /// ```ignore,no_run
6804 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6805 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6806 /// let x = DocumentLayoutBlock::new().set_text_block(LayoutTextBlock::default()/* use setters */);
6807 /// assert!(x.text_block().is_some());
6808 /// assert!(x.table_block().is_none());
6809 /// assert!(x.list_block().is_none());
6810 /// assert!(x.image_block().is_none());
6811 /// ```
6812 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{
6813 self.block = std::option::Option::Some(
6814 crate::model::document::document_layout::document_layout_block::Block::TextBlock(
6815 v.into()
6816 )
6817 );
6818 self
6819 }
6820
6821 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6822 /// if it holds a `TableBlock`, `None` if the field is not set or
6823 /// holds a different branch.
6824 pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
6825 #[allow(unreachable_patterns)]
6826 self.block.as_ref().and_then(|v| match v {
6827 crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
6828 _ => std::option::Option::None,
6829 })
6830 }
6831
6832 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6833 /// to hold a `TableBlock`.
6834 ///
6835 /// Note that all the setters affecting `block` are
6836 /// mutually exclusive.
6837 ///
6838 /// # Example
6839 /// ```ignore,no_run
6840 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6841 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
6842 /// let x = DocumentLayoutBlock::new().set_table_block(LayoutTableBlock::default()/* use setters */);
6843 /// assert!(x.table_block().is_some());
6844 /// assert!(x.text_block().is_none());
6845 /// assert!(x.list_block().is_none());
6846 /// assert!(x.image_block().is_none());
6847 /// ```
6848 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{
6849 self.block = std::option::Option::Some(
6850 crate::model::document::document_layout::document_layout_block::Block::TableBlock(
6851 v.into()
6852 )
6853 );
6854 self
6855 }
6856
6857 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6858 /// if it holds a `ListBlock`, `None` if the field is not set or
6859 /// holds a different branch.
6860 pub fn list_block(
6861 &self,
6862 ) -> std::option::Option<
6863 &std::boxed::Box<
6864 crate::model::document::document_layout::document_layout_block::LayoutListBlock,
6865 >,
6866 > {
6867 #[allow(unreachable_patterns)]
6868 self.block.as_ref().and_then(|v| match v {
6869 crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
6870 _ => std::option::Option::None,
6871 })
6872 }
6873
6874 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6875 /// to hold a `ListBlock`.
6876 ///
6877 /// Note that all the setters affecting `block` are
6878 /// mutually exclusive.
6879 ///
6880 /// # Example
6881 /// ```ignore,no_run
6882 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6883 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
6884 /// let x = DocumentLayoutBlock::new().set_list_block(LayoutListBlock::default()/* use setters */);
6885 /// assert!(x.list_block().is_some());
6886 /// assert!(x.text_block().is_none());
6887 /// assert!(x.table_block().is_none());
6888 /// assert!(x.image_block().is_none());
6889 /// ```
6890 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{
6891 self.block = std::option::Option::Some(
6892 crate::model::document::document_layout::document_layout_block::Block::ListBlock(
6893 v.into()
6894 )
6895 );
6896 self
6897 }
6898
6899 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6900 /// if it holds a `ImageBlock`, `None` if the field is not set or
6901 /// holds a different branch.
6902 pub fn image_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>>{
6903 #[allow(unreachable_patterns)]
6904 self.block.as_ref().and_then(|v| match v {
6905 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(v) => std::option::Option::Some(v),
6906 _ => std::option::Option::None,
6907 })
6908 }
6909
6910 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6911 /// to hold a `ImageBlock`.
6912 ///
6913 /// Note that all the setters affecting `block` are
6914 /// mutually exclusive.
6915 ///
6916 /// # Example
6917 /// ```ignore,no_run
6918 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6919 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
6920 /// let x = DocumentLayoutBlock::new().set_image_block(LayoutImageBlock::default()/* use setters */);
6921 /// assert!(x.image_block().is_some());
6922 /// assert!(x.text_block().is_none());
6923 /// assert!(x.table_block().is_none());
6924 /// assert!(x.list_block().is_none());
6925 /// ```
6926 pub fn set_image_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>>>(mut self, v: T) -> Self{
6927 self.block = std::option::Option::Some(
6928 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(
6929 v.into()
6930 )
6931 );
6932 self
6933 }
6934 }
6935
6936 impl wkt::message::Message for DocumentLayoutBlock {
6937 fn typename() -> &'static str {
6938 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
6939 }
6940 }
6941
6942 /// Defines additional types related to [DocumentLayoutBlock].
6943 pub mod document_layout_block {
6944 #[allow(unused_imports)]
6945 use super::*;
6946
6947 /// Represents where the block starts and ends in the document.
6948 #[derive(Clone, Default, PartialEq)]
6949 #[non_exhaustive]
6950 pub struct LayoutPageSpan {
6951 /// Page where block starts in the document.
6952 pub page_start: i32,
6953
6954 /// Page where block ends in the document.
6955 pub page_end: i32,
6956
6957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6958 }
6959
6960 impl LayoutPageSpan {
6961 pub fn new() -> Self {
6962 std::default::Default::default()
6963 }
6964
6965 /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
6966 ///
6967 /// # Example
6968 /// ```ignore,no_run
6969 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6970 /// let x = LayoutPageSpan::new().set_page_start(42);
6971 /// ```
6972 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6973 self.page_start = v.into();
6974 self
6975 }
6976
6977 /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
6978 ///
6979 /// # Example
6980 /// ```ignore,no_run
6981 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6982 /// let x = LayoutPageSpan::new().set_page_end(42);
6983 /// ```
6984 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6985 self.page_end = v.into();
6986 self
6987 }
6988 }
6989
6990 impl wkt::message::Message for LayoutPageSpan {
6991 fn typename() -> &'static str {
6992 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
6993 }
6994 }
6995
6996 /// Represents a text type block.
6997 #[derive(Clone, Default, PartialEq)]
6998 #[non_exhaustive]
6999 pub struct LayoutTextBlock {
7000 /// Text content stored in the block.
7001 pub text: std::string::String,
7002
7003 /// Type of the text in the block. Available options are: `paragraph`,
7004 /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
7005 /// `heading-5`, `header`, `footer`.
7006 pub r#type: std::string::String,
7007
7008 /// A text block could further have child blocks.
7009 /// Repeated blocks support further hierarchies and nested blocks.
7010 pub blocks:
7011 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7012
7013 /// Annotation of the text block.
7014 pub annotations: std::option::Option<crate::model::document::Annotations>,
7015
7016 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7017 }
7018
7019 impl LayoutTextBlock {
7020 pub fn new() -> Self {
7021 std::default::Default::default()
7022 }
7023
7024 /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
7025 ///
7026 /// # Example
7027 /// ```ignore,no_run
7028 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7029 /// let x = LayoutTextBlock::new().set_text("example");
7030 /// ```
7031 pub fn set_text<T: std::convert::Into<std::string::String>>(
7032 mut self,
7033 v: T,
7034 ) -> Self {
7035 self.text = v.into();
7036 self
7037 }
7038
7039 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
7040 ///
7041 /// # Example
7042 /// ```ignore,no_run
7043 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7044 /// let x = LayoutTextBlock::new().set_type("example");
7045 /// ```
7046 pub fn set_type<T: std::convert::Into<std::string::String>>(
7047 mut self,
7048 v: T,
7049 ) -> Self {
7050 self.r#type = v.into();
7051 self
7052 }
7053
7054 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
7055 ///
7056 /// # Example
7057 /// ```ignore,no_run
7058 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7059 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7060 /// let x = LayoutTextBlock::new()
7061 /// .set_blocks([
7062 /// DocumentLayoutBlock::default()/* use setters */,
7063 /// DocumentLayoutBlock::default()/* use (different) setters */,
7064 /// ]);
7065 /// ```
7066 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7067 where
7068 T: std::iter::IntoIterator<Item = V>,
7069 V: std::convert::Into<
7070 crate::model::document::document_layout::DocumentLayoutBlock,
7071 >,
7072 {
7073 use std::iter::Iterator;
7074 self.blocks = v.into_iter().map(|i| i.into()).collect();
7075 self
7076 }
7077
7078 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7079 ///
7080 /// # Example
7081 /// ```ignore,no_run
7082 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7083 /// use google_cloud_documentai_v1::model::document::Annotations;
7084 /// let x = LayoutTextBlock::new().set_annotations(Annotations::default()/* use setters */);
7085 /// ```
7086 pub fn set_annotations<T>(mut self, v: T) -> Self
7087 where
7088 T: std::convert::Into<crate::model::document::Annotations>,
7089 {
7090 self.annotations = std::option::Option::Some(v.into());
7091 self
7092 }
7093
7094 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7095 ///
7096 /// # Example
7097 /// ```ignore,no_run
7098 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7099 /// use google_cloud_documentai_v1::model::document::Annotations;
7100 /// let x = LayoutTextBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7101 /// let x = LayoutTextBlock::new().set_or_clear_annotations(None::<Annotations>);
7102 /// ```
7103 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7104 where
7105 T: std::convert::Into<crate::model::document::Annotations>,
7106 {
7107 self.annotations = v.map(|x| x.into());
7108 self
7109 }
7110 }
7111
7112 impl wkt::message::Message for LayoutTextBlock {
7113 fn typename() -> &'static str {
7114 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
7115 }
7116 }
7117
7118 /// Represents a table type block.
7119 #[derive(Clone, Default, PartialEq)]
7120 #[non_exhaustive]
7121 pub struct LayoutTableBlock {
7122 /// Header rows at the top of the table.
7123 pub header_rows: std::vec::Vec<
7124 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7125 >,
7126
7127 /// Body rows containing main table content.
7128 pub body_rows: std::vec::Vec<
7129 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7130 >,
7131
7132 /// Table caption/title.
7133 pub caption: std::string::String,
7134
7135 /// Annotation of the table block.
7136 pub annotations: std::option::Option<crate::model::document::Annotations>,
7137
7138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7139 }
7140
7141 impl LayoutTableBlock {
7142 pub fn new() -> Self {
7143 std::default::Default::default()
7144 }
7145
7146 /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
7147 ///
7148 /// # Example
7149 /// ```ignore,no_run
7150 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7151 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7152 /// let x = LayoutTableBlock::new()
7153 /// .set_header_rows([
7154 /// LayoutTableRow::default()/* use setters */,
7155 /// LayoutTableRow::default()/* use (different) setters */,
7156 /// ]);
7157 /// ```
7158 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
7159 where
7160 T: std::iter::IntoIterator<Item = V>,
7161 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7162 {
7163 use std::iter::Iterator;
7164 self.header_rows = v.into_iter().map(|i| i.into()).collect();
7165 self
7166 }
7167
7168 /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
7169 ///
7170 /// # Example
7171 /// ```ignore,no_run
7172 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7173 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7174 /// let x = LayoutTableBlock::new()
7175 /// .set_body_rows([
7176 /// LayoutTableRow::default()/* use setters */,
7177 /// LayoutTableRow::default()/* use (different) setters */,
7178 /// ]);
7179 /// ```
7180 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
7181 where
7182 T: std::iter::IntoIterator<Item = V>,
7183 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7184 {
7185 use std::iter::Iterator;
7186 self.body_rows = v.into_iter().map(|i| i.into()).collect();
7187 self
7188 }
7189
7190 /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
7191 ///
7192 /// # Example
7193 /// ```ignore,no_run
7194 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7195 /// let x = LayoutTableBlock::new().set_caption("example");
7196 /// ```
7197 pub fn set_caption<T: std::convert::Into<std::string::String>>(
7198 mut self,
7199 v: T,
7200 ) -> Self {
7201 self.caption = v.into();
7202 self
7203 }
7204
7205 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7206 ///
7207 /// # Example
7208 /// ```ignore,no_run
7209 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7210 /// use google_cloud_documentai_v1::model::document::Annotations;
7211 /// let x = LayoutTableBlock::new().set_annotations(Annotations::default()/* use setters */);
7212 /// ```
7213 pub fn set_annotations<T>(mut self, v: T) -> Self
7214 where
7215 T: std::convert::Into<crate::model::document::Annotations>,
7216 {
7217 self.annotations = std::option::Option::Some(v.into());
7218 self
7219 }
7220
7221 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7222 ///
7223 /// # Example
7224 /// ```ignore,no_run
7225 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7226 /// use google_cloud_documentai_v1::model::document::Annotations;
7227 /// let x = LayoutTableBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7228 /// let x = LayoutTableBlock::new().set_or_clear_annotations(None::<Annotations>);
7229 /// ```
7230 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7231 where
7232 T: std::convert::Into<crate::model::document::Annotations>,
7233 {
7234 self.annotations = v.map(|x| x.into());
7235 self
7236 }
7237 }
7238
7239 impl wkt::message::Message for LayoutTableBlock {
7240 fn typename() -> &'static str {
7241 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
7242 }
7243 }
7244
7245 /// Represents a row in a table.
7246 #[derive(Clone, Default, PartialEq)]
7247 #[non_exhaustive]
7248 pub struct LayoutTableRow {
7249 /// A table row is a list of table cells.
7250 pub cells: std::vec::Vec<
7251 crate::model::document::document_layout::document_layout_block::LayoutTableCell,
7252 >,
7253
7254 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7255 }
7256
7257 impl LayoutTableRow {
7258 pub fn new() -> Self {
7259 std::default::Default::default()
7260 }
7261
7262 /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
7263 ///
7264 /// # Example
7265 /// ```ignore,no_run
7266 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7267 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7268 /// let x = LayoutTableRow::new()
7269 /// .set_cells([
7270 /// LayoutTableCell::default()/* use setters */,
7271 /// LayoutTableCell::default()/* use (different) setters */,
7272 /// ]);
7273 /// ```
7274 pub fn set_cells<T, V>(mut self, v: T) -> Self
7275 where
7276 T: std::iter::IntoIterator<Item = V>,
7277 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
7278 {
7279 use std::iter::Iterator;
7280 self.cells = v.into_iter().map(|i| i.into()).collect();
7281 self
7282 }
7283 }
7284
7285 impl wkt::message::Message for LayoutTableRow {
7286 fn typename() -> &'static str {
7287 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
7288 }
7289 }
7290
7291 /// Represents a cell in a table row.
7292 #[derive(Clone, Default, PartialEq)]
7293 #[non_exhaustive]
7294 pub struct LayoutTableCell {
7295 /// A table cell is a list of blocks.
7296 /// Repeated blocks support further hierarchies and nested blocks.
7297 pub blocks:
7298 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7299
7300 /// How many rows this cell spans.
7301 pub row_span: i32,
7302
7303 /// How many columns this cell spans.
7304 pub col_span: i32,
7305
7306 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7307 }
7308
7309 impl LayoutTableCell {
7310 pub fn new() -> Self {
7311 std::default::Default::default()
7312 }
7313
7314 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
7315 ///
7316 /// # Example
7317 /// ```ignore,no_run
7318 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7319 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7320 /// let x = LayoutTableCell::new()
7321 /// .set_blocks([
7322 /// DocumentLayoutBlock::default()/* use setters */,
7323 /// DocumentLayoutBlock::default()/* use (different) setters */,
7324 /// ]);
7325 /// ```
7326 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7327 where
7328 T: std::iter::IntoIterator<Item = V>,
7329 V: std::convert::Into<
7330 crate::model::document::document_layout::DocumentLayoutBlock,
7331 >,
7332 {
7333 use std::iter::Iterator;
7334 self.blocks = v.into_iter().map(|i| i.into()).collect();
7335 self
7336 }
7337
7338 /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
7339 ///
7340 /// # Example
7341 /// ```ignore,no_run
7342 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7343 /// let x = LayoutTableCell::new().set_row_span(42);
7344 /// ```
7345 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7346 self.row_span = v.into();
7347 self
7348 }
7349
7350 /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
7351 ///
7352 /// # Example
7353 /// ```ignore,no_run
7354 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7355 /// let x = LayoutTableCell::new().set_col_span(42);
7356 /// ```
7357 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7358 self.col_span = v.into();
7359 self
7360 }
7361 }
7362
7363 impl wkt::message::Message for LayoutTableCell {
7364 fn typename() -> &'static str {
7365 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
7366 }
7367 }
7368
7369 /// Represents a list type block.
7370 #[derive(Clone, Default, PartialEq)]
7371 #[non_exhaustive]
7372 pub struct LayoutListBlock {
7373 /// List entries that constitute a list block.
7374 pub list_entries: std::vec::Vec<
7375 crate::model::document::document_layout::document_layout_block::LayoutListEntry,
7376 >,
7377
7378 /// Type of the list_entries (if exist). Available options are `ordered`
7379 /// and `unordered`.
7380 pub r#type: std::string::String,
7381
7382 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7383 }
7384
7385 impl LayoutListBlock {
7386 pub fn new() -> Self {
7387 std::default::Default::default()
7388 }
7389
7390 /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
7391 ///
7392 /// # Example
7393 /// ```ignore,no_run
7394 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7395 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7396 /// let x = LayoutListBlock::new()
7397 /// .set_list_entries([
7398 /// LayoutListEntry::default()/* use setters */,
7399 /// LayoutListEntry::default()/* use (different) setters */,
7400 /// ]);
7401 /// ```
7402 pub fn set_list_entries<T, V>(mut self, v: T) -> Self
7403 where
7404 T: std::iter::IntoIterator<Item = V>,
7405 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
7406 {
7407 use std::iter::Iterator;
7408 self.list_entries = v.into_iter().map(|i| i.into()).collect();
7409 self
7410 }
7411
7412 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
7413 ///
7414 /// # Example
7415 /// ```ignore,no_run
7416 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7417 /// let x = LayoutListBlock::new().set_type("example");
7418 /// ```
7419 pub fn set_type<T: std::convert::Into<std::string::String>>(
7420 mut self,
7421 v: T,
7422 ) -> Self {
7423 self.r#type = v.into();
7424 self
7425 }
7426 }
7427
7428 impl wkt::message::Message for LayoutListBlock {
7429 fn typename() -> &'static str {
7430 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
7431 }
7432 }
7433
7434 /// Represents an entry in the list.
7435 #[derive(Clone, Default, PartialEq)]
7436 #[non_exhaustive]
7437 pub struct LayoutListEntry {
7438 /// A list entry is a list of blocks.
7439 /// Repeated blocks support further hierarchies and nested blocks.
7440 pub blocks:
7441 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7442
7443 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7444 }
7445
7446 impl LayoutListEntry {
7447 pub fn new() -> Self {
7448 std::default::Default::default()
7449 }
7450
7451 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
7452 ///
7453 /// # Example
7454 /// ```ignore,no_run
7455 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7456 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7457 /// let x = LayoutListEntry::new()
7458 /// .set_blocks([
7459 /// DocumentLayoutBlock::default()/* use setters */,
7460 /// DocumentLayoutBlock::default()/* use (different) setters */,
7461 /// ]);
7462 /// ```
7463 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7464 where
7465 T: std::iter::IntoIterator<Item = V>,
7466 V: std::convert::Into<
7467 crate::model::document::document_layout::DocumentLayoutBlock,
7468 >,
7469 {
7470 use std::iter::Iterator;
7471 self.blocks = v.into_iter().map(|i| i.into()).collect();
7472 self
7473 }
7474 }
7475
7476 impl wkt::message::Message for LayoutListEntry {
7477 fn typename() -> &'static str {
7478 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
7479 }
7480 }
7481
7482 /// Represents an image type block.
7483 #[derive(Clone, Default, PartialEq)]
7484 #[non_exhaustive]
7485 pub struct LayoutImageBlock {
7486
7487 /// Mime type of the image. An IANA published [media type (MIME type)]
7488 /// (<https://www.iana.org/assignments/media-types/media-types.xhtml>).
7489 pub mime_type: std::string::String,
7490
7491 /// Text extracted from the image using OCR or alt text describing the
7492 /// image.
7493 pub image_text: std::string::String,
7494
7495 /// Annotation of the image block.
7496 pub annotations: std::option::Option<crate::model::document::Annotations>,
7497
7498 /// Source of the image.
7499 pub image_source: std::option::Option<crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource>,
7500
7501 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7502 }
7503
7504 impl LayoutImageBlock {
7505 pub fn new() -> Self {
7506 std::default::Default::default()
7507 }
7508
7509 /// Sets the value of [mime_type][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::mime_type].
7510 ///
7511 /// # Example
7512 /// ```ignore,no_run
7513 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7514 /// let x = LayoutImageBlock::new().set_mime_type("example");
7515 /// ```
7516 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
7517 mut self,
7518 v: T,
7519 ) -> Self {
7520 self.mime_type = v.into();
7521 self
7522 }
7523
7524 /// Sets the value of [image_text][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_text].
7525 ///
7526 /// # Example
7527 /// ```ignore,no_run
7528 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7529 /// let x = LayoutImageBlock::new().set_image_text("example");
7530 /// ```
7531 pub fn set_image_text<T: std::convert::Into<std::string::String>>(
7532 mut self,
7533 v: T,
7534 ) -> Self {
7535 self.image_text = v.into();
7536 self
7537 }
7538
7539 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7540 ///
7541 /// # Example
7542 /// ```ignore,no_run
7543 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7544 /// use google_cloud_documentai_v1::model::document::Annotations;
7545 /// let x = LayoutImageBlock::new().set_annotations(Annotations::default()/* use setters */);
7546 /// ```
7547 pub fn set_annotations<T>(mut self, v: T) -> Self
7548 where
7549 T: std::convert::Into<crate::model::document::Annotations>,
7550 {
7551 self.annotations = std::option::Option::Some(v.into());
7552 self
7553 }
7554
7555 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7556 ///
7557 /// # Example
7558 /// ```ignore,no_run
7559 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7560 /// use google_cloud_documentai_v1::model::document::Annotations;
7561 /// let x = LayoutImageBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7562 /// let x = LayoutImageBlock::new().set_or_clear_annotations(None::<Annotations>);
7563 /// ```
7564 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7565 where
7566 T: std::convert::Into<crate::model::document::Annotations>,
7567 {
7568 self.annotations = v.map(|x| x.into());
7569 self
7570 }
7571
7572 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source].
7573 ///
7574 /// Note that all the setters affecting `image_source` are mutually
7575 /// exclusive.
7576 ///
7577 /// # Example
7578 /// ```ignore,no_run
7579 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7580 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::layout_image_block::ImageSource;
7581 /// let x = LayoutImageBlock::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
7582 /// ```
7583 pub fn set_image_source<T: std::convert::Into<std::option::Option<crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource>>>(mut self, v: T) -> Self
7584 {
7585 self.image_source = v.into();
7586 self
7587 }
7588
7589 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7590 /// if it holds a `BlobAssetId`, `None` if the field is not set or
7591 /// holds a different branch.
7592 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
7593 #[allow(unreachable_patterns)]
7594 self.image_source.as_ref().and_then(|v| match v {
7595 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
7596 _ => std::option::Option::None,
7597 })
7598 }
7599
7600 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7601 /// to hold a `BlobAssetId`.
7602 ///
7603 /// Note that all the setters affecting `image_source` are
7604 /// mutually exclusive.
7605 ///
7606 /// # Example
7607 /// ```ignore,no_run
7608 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7609 /// let x = LayoutImageBlock::new().set_blob_asset_id("example");
7610 /// assert!(x.blob_asset_id().is_some());
7611 /// assert!(x.gcs_uri().is_none());
7612 /// assert!(x.data_uri().is_none());
7613 /// ```
7614 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
7615 mut self,
7616 v: T,
7617 ) -> Self {
7618 self.image_source = std::option::Option::Some(
7619 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(
7620 v.into()
7621 )
7622 );
7623 self
7624 }
7625
7626 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7627 /// if it holds a `GcsUri`, `None` if the field is not set or
7628 /// holds a different branch.
7629 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
7630 #[allow(unreachable_patterns)]
7631 self.image_source.as_ref().and_then(|v| match v {
7632 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(v) => std::option::Option::Some(v),
7633 _ => std::option::Option::None,
7634 })
7635 }
7636
7637 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7638 /// to hold a `GcsUri`.
7639 ///
7640 /// Note that all the setters affecting `image_source` are
7641 /// mutually exclusive.
7642 ///
7643 /// # Example
7644 /// ```ignore,no_run
7645 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7646 /// let x = LayoutImageBlock::new().set_gcs_uri("example");
7647 /// assert!(x.gcs_uri().is_some());
7648 /// assert!(x.blob_asset_id().is_none());
7649 /// assert!(x.data_uri().is_none());
7650 /// ```
7651 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
7652 mut self,
7653 v: T,
7654 ) -> Self {
7655 self.image_source = std::option::Option::Some(
7656 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(
7657 v.into()
7658 )
7659 );
7660 self
7661 }
7662
7663 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7664 /// if it holds a `DataUri`, `None` if the field is not set or
7665 /// holds a different branch.
7666 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
7667 #[allow(unreachable_patterns)]
7668 self.image_source.as_ref().and_then(|v| match v {
7669 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(v) => std::option::Option::Some(v),
7670 _ => std::option::Option::None,
7671 })
7672 }
7673
7674 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7675 /// to hold a `DataUri`.
7676 ///
7677 /// Note that all the setters affecting `image_source` are
7678 /// mutually exclusive.
7679 ///
7680 /// # Example
7681 /// ```ignore,no_run
7682 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7683 /// let x = LayoutImageBlock::new().set_data_uri("example");
7684 /// assert!(x.data_uri().is_some());
7685 /// assert!(x.blob_asset_id().is_none());
7686 /// assert!(x.gcs_uri().is_none());
7687 /// ```
7688 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
7689 mut self,
7690 v: T,
7691 ) -> Self {
7692 self.image_source = std::option::Option::Some(
7693 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(
7694 v.into()
7695 )
7696 );
7697 self
7698 }
7699 }
7700
7701 impl wkt::message::Message for LayoutImageBlock {
7702 fn typename() -> &'static str {
7703 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutImageBlock"
7704 }
7705 }
7706
7707 /// Defines additional types related to [LayoutImageBlock].
7708 pub mod layout_image_block {
7709 #[allow(unused_imports)]
7710 use super::*;
7711
7712 /// Source of the image.
7713 #[derive(Clone, Debug, PartialEq)]
7714 #[non_exhaustive]
7715 pub enum ImageSource {
7716 /// Optional. Asset id of the inline image. If set, find the image
7717 /// content in the blob_assets field.
7718 BlobAssetId(std::string::String),
7719 /// Optional. Google Cloud Storage uri of the image.
7720 GcsUri(std::string::String),
7721 /// Optional. Data uri of the image.
7722 /// It is composed of four parts: a prefix (data:), a MIME type
7723 /// indicating the type of data, an optional base64 token if
7724 /// non-textual, and the data itself:
7725 /// data:[\<mediatype\>][;base64],\<data\>
7726 DataUri(std::string::String),
7727 }
7728 }
7729
7730 #[derive(Clone, Debug, PartialEq)]
7731 #[non_exhaustive]
7732 pub enum Block {
7733 /// Block consisting of text content.
7734 TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
7735 /// Block consisting of table content/structure.
7736 TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
7737 /// Block consisting of list content/structure.
7738 ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
7739 /// Block consisting of image content.
7740 ImageBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>),
7741 }
7742 }
7743 }
7744
7745 /// Represents the chunks that the document is divided into.
7746 #[derive(Clone, Default, PartialEq)]
7747 #[non_exhaustive]
7748 pub struct ChunkedDocument {
7749 /// List of chunks.
7750 pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
7751
7752 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7753 }
7754
7755 impl ChunkedDocument {
7756 pub fn new() -> Self {
7757 std::default::Default::default()
7758 }
7759
7760 /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
7761 ///
7762 /// # Example
7763 /// ```ignore,no_run
7764 /// # use google_cloud_documentai_v1::model::document::ChunkedDocument;
7765 /// use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7766 /// let x = ChunkedDocument::new()
7767 /// .set_chunks([
7768 /// Chunk::default()/* use setters */,
7769 /// Chunk::default()/* use (different) setters */,
7770 /// ]);
7771 /// ```
7772 pub fn set_chunks<T, V>(mut self, v: T) -> Self
7773 where
7774 T: std::iter::IntoIterator<Item = V>,
7775 V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
7776 {
7777 use std::iter::Iterator;
7778 self.chunks = v.into_iter().map(|i| i.into()).collect();
7779 self
7780 }
7781 }
7782
7783 impl wkt::message::Message for ChunkedDocument {
7784 fn typename() -> &'static str {
7785 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
7786 }
7787 }
7788
7789 /// Defines additional types related to [ChunkedDocument].
7790 pub mod chunked_document {
7791 #[allow(unused_imports)]
7792 use super::*;
7793
7794 /// Represents a chunk.
7795 #[derive(Clone, Default, PartialEq)]
7796 #[non_exhaustive]
7797 pub struct Chunk {
7798 /// ID of the chunk.
7799 pub chunk_id: std::string::String,
7800
7801 /// Unused.
7802 pub source_block_ids: std::vec::Vec<std::string::String>,
7803
7804 /// Text content of the chunk.
7805 pub content: std::string::String,
7806
7807 /// Page span of the chunk.
7808 pub page_span:
7809 std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
7810
7811 /// Page headers associated with the chunk.
7812 pub page_headers:
7813 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
7814
7815 /// Page footers associated with the chunk.
7816 pub page_footers:
7817 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
7818
7819 /// Chunk fields inside this chunk.
7820 pub chunk_fields:
7821 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkField>,
7822
7823 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7824 }
7825
7826 impl Chunk {
7827 pub fn new() -> Self {
7828 std::default::Default::default()
7829 }
7830
7831 /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
7832 ///
7833 /// # Example
7834 /// ```ignore,no_run
7835 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7836 /// let x = Chunk::new().set_chunk_id("example");
7837 /// ```
7838 pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
7839 mut self,
7840 v: T,
7841 ) -> Self {
7842 self.chunk_id = v.into();
7843 self
7844 }
7845
7846 /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
7847 ///
7848 /// # Example
7849 /// ```ignore,no_run
7850 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7851 /// let x = Chunk::new().set_source_block_ids(["a", "b", "c"]);
7852 /// ```
7853 pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
7854 where
7855 T: std::iter::IntoIterator<Item = V>,
7856 V: std::convert::Into<std::string::String>,
7857 {
7858 use std::iter::Iterator;
7859 self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
7860 self
7861 }
7862
7863 /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
7864 ///
7865 /// # Example
7866 /// ```ignore,no_run
7867 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7868 /// let x = Chunk::new().set_content("example");
7869 /// ```
7870 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7871 self.content = v.into();
7872 self
7873 }
7874
7875 /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7876 ///
7877 /// # Example
7878 /// ```ignore,no_run
7879 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7880 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7881 /// let x = Chunk::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7882 /// ```
7883 pub fn set_page_span<T>(mut self, v: T) -> Self
7884 where
7885 T: std::convert::Into<
7886 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7887 >,
7888 {
7889 self.page_span = std::option::Option::Some(v.into());
7890 self
7891 }
7892
7893 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7894 ///
7895 /// # Example
7896 /// ```ignore,no_run
7897 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7898 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7899 /// let x = Chunk::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7900 /// let x = Chunk::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7901 /// ```
7902 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7903 where
7904 T: std::convert::Into<
7905 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7906 >,
7907 {
7908 self.page_span = v.map(|x| x.into());
7909 self
7910 }
7911
7912 /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
7913 ///
7914 /// # Example
7915 /// ```ignore,no_run
7916 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7917 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7918 /// let x = Chunk::new()
7919 /// .set_page_headers([
7920 /// ChunkPageHeader::default()/* use setters */,
7921 /// ChunkPageHeader::default()/* use (different) setters */,
7922 /// ]);
7923 /// ```
7924 pub fn set_page_headers<T, V>(mut self, v: T) -> Self
7925 where
7926 T: std::iter::IntoIterator<Item = V>,
7927 V: std::convert::Into<
7928 crate::model::document::chunked_document::chunk::ChunkPageHeader,
7929 >,
7930 {
7931 use std::iter::Iterator;
7932 self.page_headers = v.into_iter().map(|i| i.into()).collect();
7933 self
7934 }
7935
7936 /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
7937 ///
7938 /// # Example
7939 /// ```ignore,no_run
7940 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7941 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7942 /// let x = Chunk::new()
7943 /// .set_page_footers([
7944 /// ChunkPageFooter::default()/* use setters */,
7945 /// ChunkPageFooter::default()/* use (different) setters */,
7946 /// ]);
7947 /// ```
7948 pub fn set_page_footers<T, V>(mut self, v: T) -> Self
7949 where
7950 T: std::iter::IntoIterator<Item = V>,
7951 V: std::convert::Into<
7952 crate::model::document::chunked_document::chunk::ChunkPageFooter,
7953 >,
7954 {
7955 use std::iter::Iterator;
7956 self.page_footers = v.into_iter().map(|i| i.into()).collect();
7957 self
7958 }
7959
7960 /// Sets the value of [chunk_fields][crate::model::document::chunked_document::Chunk::chunk_fields].
7961 ///
7962 /// # Example
7963 /// ```ignore,no_run
7964 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7965 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
7966 /// let x = Chunk::new()
7967 /// .set_chunk_fields([
7968 /// ChunkField::default()/* use setters */,
7969 /// ChunkField::default()/* use (different) setters */,
7970 /// ]);
7971 /// ```
7972 pub fn set_chunk_fields<T, V>(mut self, v: T) -> Self
7973 where
7974 T: std::iter::IntoIterator<Item = V>,
7975 V: std::convert::Into<crate::model::document::chunked_document::chunk::ChunkField>,
7976 {
7977 use std::iter::Iterator;
7978 self.chunk_fields = v.into_iter().map(|i| i.into()).collect();
7979 self
7980 }
7981 }
7982
7983 impl wkt::message::Message for Chunk {
7984 fn typename() -> &'static str {
7985 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
7986 }
7987 }
7988
7989 /// Defines additional types related to [Chunk].
7990 pub mod chunk {
7991 #[allow(unused_imports)]
7992 use super::*;
7993
7994 /// Represents where the chunk starts and ends in the document.
7995 #[derive(Clone, Default, PartialEq)]
7996 #[non_exhaustive]
7997 pub struct ChunkPageSpan {
7998 /// Page where chunk starts in the document.
7999 pub page_start: i32,
8000
8001 /// Page where chunk ends in the document.
8002 pub page_end: i32,
8003
8004 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8005 }
8006
8007 impl ChunkPageSpan {
8008 pub fn new() -> Self {
8009 std::default::Default::default()
8010 }
8011
8012 /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
8013 ///
8014 /// # Example
8015 /// ```ignore,no_run
8016 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8017 /// let x = ChunkPageSpan::new().set_page_start(42);
8018 /// ```
8019 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8020 self.page_start = v.into();
8021 self
8022 }
8023
8024 /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
8025 ///
8026 /// # Example
8027 /// ```ignore,no_run
8028 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8029 /// let x = ChunkPageSpan::new().set_page_end(42);
8030 /// ```
8031 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8032 self.page_end = v.into();
8033 self
8034 }
8035 }
8036
8037 impl wkt::message::Message for ChunkPageSpan {
8038 fn typename() -> &'static str {
8039 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
8040 }
8041 }
8042
8043 /// Represents the page header associated with the chunk.
8044 #[derive(Clone, Default, PartialEq)]
8045 #[non_exhaustive]
8046 pub struct ChunkPageHeader {
8047 /// Header in text format.
8048 pub text: std::string::String,
8049
8050 /// Page span of the header.
8051 pub page_span: std::option::Option<
8052 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8053 >,
8054
8055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8056 }
8057
8058 impl ChunkPageHeader {
8059 pub fn new() -> Self {
8060 std::default::Default::default()
8061 }
8062
8063 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
8064 ///
8065 /// # Example
8066 /// ```ignore,no_run
8067 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8068 /// let x = ChunkPageHeader::new().set_text("example");
8069 /// ```
8070 pub fn set_text<T: std::convert::Into<std::string::String>>(
8071 mut self,
8072 v: T,
8073 ) -> Self {
8074 self.text = v.into();
8075 self
8076 }
8077
8078 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8079 ///
8080 /// # Example
8081 /// ```ignore,no_run
8082 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8083 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8084 /// let x = ChunkPageHeader::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8085 /// ```
8086 pub fn set_page_span<T>(mut self, v: T) -> Self
8087 where
8088 T: std::convert::Into<
8089 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8090 >,
8091 {
8092 self.page_span = std::option::Option::Some(v.into());
8093 self
8094 }
8095
8096 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8097 ///
8098 /// # Example
8099 /// ```ignore,no_run
8100 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8101 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8102 /// let x = ChunkPageHeader::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8103 /// let x = ChunkPageHeader::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8104 /// ```
8105 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8106 where
8107 T: std::convert::Into<
8108 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8109 >,
8110 {
8111 self.page_span = v.map(|x| x.into());
8112 self
8113 }
8114 }
8115
8116 impl wkt::message::Message for ChunkPageHeader {
8117 fn typename() -> &'static str {
8118 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
8119 }
8120 }
8121
8122 /// Represents the page footer associated with the chunk.
8123 #[derive(Clone, Default, PartialEq)]
8124 #[non_exhaustive]
8125 pub struct ChunkPageFooter {
8126 /// Footer in text format.
8127 pub text: std::string::String,
8128
8129 /// Page span of the footer.
8130 pub page_span: std::option::Option<
8131 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8132 >,
8133
8134 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8135 }
8136
8137 impl ChunkPageFooter {
8138 pub fn new() -> Self {
8139 std::default::Default::default()
8140 }
8141
8142 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
8143 ///
8144 /// # Example
8145 /// ```ignore,no_run
8146 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8147 /// let x = ChunkPageFooter::new().set_text("example");
8148 /// ```
8149 pub fn set_text<T: std::convert::Into<std::string::String>>(
8150 mut self,
8151 v: T,
8152 ) -> Self {
8153 self.text = v.into();
8154 self
8155 }
8156
8157 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8158 ///
8159 /// # Example
8160 /// ```ignore,no_run
8161 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8162 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8163 /// let x = ChunkPageFooter::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8164 /// ```
8165 pub fn set_page_span<T>(mut self, v: T) -> Self
8166 where
8167 T: std::convert::Into<
8168 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8169 >,
8170 {
8171 self.page_span = std::option::Option::Some(v.into());
8172 self
8173 }
8174
8175 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8176 ///
8177 /// # Example
8178 /// ```ignore,no_run
8179 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8180 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8181 /// let x = ChunkPageFooter::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8182 /// let x = ChunkPageFooter::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8183 /// ```
8184 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8185 where
8186 T: std::convert::Into<
8187 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8188 >,
8189 {
8190 self.page_span = v.map(|x| x.into());
8191 self
8192 }
8193 }
8194
8195 impl wkt::message::Message for ChunkPageFooter {
8196 fn typename() -> &'static str {
8197 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
8198 }
8199 }
8200
8201 /// The image chunk field in the chunk.
8202 #[derive(Clone, Default, PartialEq)]
8203 #[non_exhaustive]
8204 pub struct ImageChunkField {
8205 /// Annotation of the image chunk field.
8206 pub annotations: std::option::Option<crate::model::document::Annotations>,
8207
8208 /// Source of the image.
8209 pub image_source: std::option::Option<
8210 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource,
8211 >,
8212
8213 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8214 }
8215
8216 impl ImageChunkField {
8217 pub fn new() -> Self {
8218 std::default::Default::default()
8219 }
8220
8221 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8222 ///
8223 /// # Example
8224 /// ```ignore,no_run
8225 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8226 /// use google_cloud_documentai_v1::model::document::Annotations;
8227 /// let x = ImageChunkField::new().set_annotations(Annotations::default()/* use setters */);
8228 /// ```
8229 pub fn set_annotations<T>(mut self, v: T) -> Self
8230 where
8231 T: std::convert::Into<crate::model::document::Annotations>,
8232 {
8233 self.annotations = std::option::Option::Some(v.into());
8234 self
8235 }
8236
8237 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8238 ///
8239 /// # Example
8240 /// ```ignore,no_run
8241 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8242 /// use google_cloud_documentai_v1::model::document::Annotations;
8243 /// let x = ImageChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8244 /// let x = ImageChunkField::new().set_or_clear_annotations(None::<Annotations>);
8245 /// ```
8246 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8247 where
8248 T: std::convert::Into<crate::model::document::Annotations>,
8249 {
8250 self.annotations = v.map(|x| x.into());
8251 self
8252 }
8253
8254 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source].
8255 ///
8256 /// Note that all the setters affecting `image_source` are mutually
8257 /// exclusive.
8258 ///
8259 /// # Example
8260 /// ```ignore,no_run
8261 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8262 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::image_chunk_field::ImageSource;
8263 /// let x = ImageChunkField::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
8264 /// ```
8265 pub fn set_image_source<T: std::convert::Into<std::option::Option<crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource>>>(mut self, v: T) -> Self
8266 {
8267 self.image_source = v.into();
8268 self
8269 }
8270
8271 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8272 /// if it holds a `BlobAssetId`, `None` if the field is not set or
8273 /// holds a different branch.
8274 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
8275 #[allow(unreachable_patterns)]
8276 self.image_source.as_ref().and_then(|v| match v {
8277 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
8278 _ => std::option::Option::None,
8279 })
8280 }
8281
8282 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8283 /// to hold a `BlobAssetId`.
8284 ///
8285 /// Note that all the setters affecting `image_source` are
8286 /// mutually exclusive.
8287 ///
8288 /// # Example
8289 /// ```ignore,no_run
8290 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8291 /// let x = ImageChunkField::new().set_blob_asset_id("example");
8292 /// assert!(x.blob_asset_id().is_some());
8293 /// assert!(x.gcs_uri().is_none());
8294 /// assert!(x.data_uri().is_none());
8295 /// ```
8296 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
8297 mut self,
8298 v: T,
8299 ) -> Self {
8300 self.image_source = std::option::Option::Some(
8301 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(
8302 v.into()
8303 )
8304 );
8305 self
8306 }
8307
8308 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8309 /// if it holds a `GcsUri`, `None` if the field is not set or
8310 /// holds a different branch.
8311 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
8312 #[allow(unreachable_patterns)]
8313 self.image_source.as_ref().and_then(|v| match v {
8314 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(v) => std::option::Option::Some(v),
8315 _ => std::option::Option::None,
8316 })
8317 }
8318
8319 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8320 /// to hold a `GcsUri`.
8321 ///
8322 /// Note that all the setters affecting `image_source` are
8323 /// mutually exclusive.
8324 ///
8325 /// # Example
8326 /// ```ignore,no_run
8327 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8328 /// let x = ImageChunkField::new().set_gcs_uri("example");
8329 /// assert!(x.gcs_uri().is_some());
8330 /// assert!(x.blob_asset_id().is_none());
8331 /// assert!(x.data_uri().is_none());
8332 /// ```
8333 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
8334 mut self,
8335 v: T,
8336 ) -> Self {
8337 self.image_source = std::option::Option::Some(
8338 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(
8339 v.into()
8340 )
8341 );
8342 self
8343 }
8344
8345 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8346 /// if it holds a `DataUri`, `None` if the field is not set or
8347 /// holds a different branch.
8348 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
8349 #[allow(unreachable_patterns)]
8350 self.image_source.as_ref().and_then(|v| match v {
8351 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(v) => std::option::Option::Some(v),
8352 _ => std::option::Option::None,
8353 })
8354 }
8355
8356 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8357 /// to hold a `DataUri`.
8358 ///
8359 /// Note that all the setters affecting `image_source` are
8360 /// mutually exclusive.
8361 ///
8362 /// # Example
8363 /// ```ignore,no_run
8364 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8365 /// let x = ImageChunkField::new().set_data_uri("example");
8366 /// assert!(x.data_uri().is_some());
8367 /// assert!(x.blob_asset_id().is_none());
8368 /// assert!(x.gcs_uri().is_none());
8369 /// ```
8370 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
8371 mut self,
8372 v: T,
8373 ) -> Self {
8374 self.image_source = std::option::Option::Some(
8375 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(
8376 v.into()
8377 )
8378 );
8379 self
8380 }
8381 }
8382
8383 impl wkt::message::Message for ImageChunkField {
8384 fn typename() -> &'static str {
8385 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ImageChunkField"
8386 }
8387 }
8388
8389 /// Defines additional types related to [ImageChunkField].
8390 pub mod image_chunk_field {
8391 #[allow(unused_imports)]
8392 use super::*;
8393
8394 /// Source of the image.
8395 #[derive(Clone, Debug, PartialEq)]
8396 #[non_exhaustive]
8397 pub enum ImageSource {
8398 /// Optional. Asset id of the inline image. If set, find the image
8399 /// content in the blob_assets field.
8400 BlobAssetId(std::string::String),
8401 /// Optional. Google Cloud Storage uri of the image.
8402 GcsUri(std::string::String),
8403 /// Optional. Data uri of the image.
8404 /// It is composed of four parts: a prefix (data:), a MIME type
8405 /// indicating the type of data, an optional base64 token if
8406 /// non-textual, and the data itself:
8407 /// data:[\<mediatype\>][;base64],\<data\>
8408 DataUri(std::string::String),
8409 }
8410 }
8411
8412 /// The table chunk field in the chunk.
8413 #[derive(Clone, Default, PartialEq)]
8414 #[non_exhaustive]
8415 pub struct TableChunkField {
8416 /// Annotation of the table chunk field.
8417 pub annotations: std::option::Option<crate::model::document::Annotations>,
8418
8419 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8420 }
8421
8422 impl TableChunkField {
8423 pub fn new() -> Self {
8424 std::default::Default::default()
8425 }
8426
8427 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8428 ///
8429 /// # Example
8430 /// ```ignore,no_run
8431 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8432 /// use google_cloud_documentai_v1::model::document::Annotations;
8433 /// let x = TableChunkField::new().set_annotations(Annotations::default()/* use setters */);
8434 /// ```
8435 pub fn set_annotations<T>(mut self, v: T) -> Self
8436 where
8437 T: std::convert::Into<crate::model::document::Annotations>,
8438 {
8439 self.annotations = std::option::Option::Some(v.into());
8440 self
8441 }
8442
8443 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8444 ///
8445 /// # Example
8446 /// ```ignore,no_run
8447 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8448 /// use google_cloud_documentai_v1::model::document::Annotations;
8449 /// let x = TableChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8450 /// let x = TableChunkField::new().set_or_clear_annotations(None::<Annotations>);
8451 /// ```
8452 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8453 where
8454 T: std::convert::Into<crate::model::document::Annotations>,
8455 {
8456 self.annotations = v.map(|x| x.into());
8457 self
8458 }
8459 }
8460
8461 impl wkt::message::Message for TableChunkField {
8462 fn typename() -> &'static str {
8463 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.TableChunkField"
8464 }
8465 }
8466
8467 /// The chunk field in the chunk. A chunk field could be one of the various
8468 /// types (for example, image, table) supported.
8469 #[derive(Clone, Default, PartialEq)]
8470 #[non_exhaustive]
8471 pub struct ChunkField {
8472 /// The type of the chunk field.
8473 pub field_type: std::option::Option<
8474 crate::model::document::chunked_document::chunk::chunk_field::FieldType,
8475 >,
8476
8477 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8478 }
8479
8480 impl ChunkField {
8481 pub fn new() -> Self {
8482 std::default::Default::default()
8483 }
8484
8485 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type].
8486 ///
8487 /// Note that all the setters affecting `field_type` are mutually
8488 /// exclusive.
8489 ///
8490 /// # Example
8491 /// ```ignore,no_run
8492 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8493 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8494 /// let x = ChunkField::new().set_field_type(Some(
8495 /// google_cloud_documentai_v1::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(ImageChunkField::default().into())));
8496 /// ```
8497 pub fn set_field_type<T: std::convert::Into<std::option::Option<crate::model::document::chunked_document::chunk::chunk_field::FieldType>>>(mut self, v: T) -> Self
8498 {
8499 self.field_type = v.into();
8500 self
8501 }
8502
8503 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8504 /// if it holds a `ImageChunkField`, `None` if the field is not set or
8505 /// holds a different branch.
8506 pub fn image_chunk_field(
8507 &self,
8508 ) -> std::option::Option<
8509 &std::boxed::Box<
8510 crate::model::document::chunked_document::chunk::ImageChunkField,
8511 >,
8512 > {
8513 #[allow(unreachable_patterns)]
8514 self.field_type.as_ref().and_then(|v| match v {
8515 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(v) => std::option::Option::Some(v),
8516 _ => std::option::Option::None,
8517 })
8518 }
8519
8520 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8521 /// to hold a `ImageChunkField`.
8522 ///
8523 /// Note that all the setters affecting `field_type` are
8524 /// mutually exclusive.
8525 ///
8526 /// # Example
8527 /// ```ignore,no_run
8528 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8529 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8530 /// let x = ChunkField::new().set_image_chunk_field(ImageChunkField::default()/* use setters */);
8531 /// assert!(x.image_chunk_field().is_some());
8532 /// assert!(x.table_chunk_field().is_none());
8533 /// ```
8534 pub fn set_image_chunk_field<
8535 T: std::convert::Into<
8536 std::boxed::Box<
8537 crate::model::document::chunked_document::chunk::ImageChunkField,
8538 >,
8539 >,
8540 >(
8541 mut self,
8542 v: T,
8543 ) -> Self {
8544 self.field_type = std::option::Option::Some(
8545 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(
8546 v.into()
8547 )
8548 );
8549 self
8550 }
8551
8552 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8553 /// if it holds a `TableChunkField`, `None` if the field is not set or
8554 /// holds a different branch.
8555 pub fn table_chunk_field(
8556 &self,
8557 ) -> std::option::Option<
8558 &std::boxed::Box<
8559 crate::model::document::chunked_document::chunk::TableChunkField,
8560 >,
8561 > {
8562 #[allow(unreachable_patterns)]
8563 self.field_type.as_ref().and_then(|v| match v {
8564 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(v) => std::option::Option::Some(v),
8565 _ => std::option::Option::None,
8566 })
8567 }
8568
8569 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8570 /// to hold a `TableChunkField`.
8571 ///
8572 /// Note that all the setters affecting `field_type` are
8573 /// mutually exclusive.
8574 ///
8575 /// # Example
8576 /// ```ignore,no_run
8577 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8578 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8579 /// let x = ChunkField::new().set_table_chunk_field(TableChunkField::default()/* use setters */);
8580 /// assert!(x.table_chunk_field().is_some());
8581 /// assert!(x.image_chunk_field().is_none());
8582 /// ```
8583 pub fn set_table_chunk_field<
8584 T: std::convert::Into<
8585 std::boxed::Box<
8586 crate::model::document::chunked_document::chunk::TableChunkField,
8587 >,
8588 >,
8589 >(
8590 mut self,
8591 v: T,
8592 ) -> Self {
8593 self.field_type = std::option::Option::Some(
8594 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(
8595 v.into()
8596 )
8597 );
8598 self
8599 }
8600 }
8601
8602 impl wkt::message::Message for ChunkField {
8603 fn typename() -> &'static str {
8604 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkField"
8605 }
8606 }
8607
8608 /// Defines additional types related to [ChunkField].
8609 pub mod chunk_field {
8610 #[allow(unused_imports)]
8611 use super::*;
8612
8613 /// The type of the chunk field.
8614 #[derive(Clone, Debug, PartialEq)]
8615 #[non_exhaustive]
8616 pub enum FieldType {
8617 /// The image chunk field in the chunk.
8618 ImageChunkField(
8619 std::boxed::Box<
8620 crate::model::document::chunked_document::chunk::ImageChunkField,
8621 >,
8622 ),
8623 /// The table chunk field in the chunk.
8624 TableChunkField(
8625 std::boxed::Box<
8626 crate::model::document::chunked_document::chunk::TableChunkField,
8627 >,
8628 ),
8629 }
8630 }
8631 }
8632 }
8633
8634 /// Represents a blob asset. It's used to store the content of the inline blob
8635 /// in this document, for example, image bytes, such that it can be referenced
8636 /// by other fields in the document via asset ID.
8637 #[derive(Clone, Default, PartialEq)]
8638 #[non_exhaustive]
8639 pub struct BlobAsset {
8640 /// Optional. The id of the blob asset.
8641 pub asset_id: std::string::String,
8642
8643 /// Optional. The content of the blob asset, for example, image bytes.
8644 pub content: ::bytes::Bytes,
8645
8646 /// The mime type of the blob asset.
8647 /// An IANA published [media type (MIME
8648 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
8649 pub mime_type: std::string::String,
8650
8651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8652 }
8653
8654 impl BlobAsset {
8655 pub fn new() -> Self {
8656 std::default::Default::default()
8657 }
8658
8659 /// Sets the value of [asset_id][crate::model::document::BlobAsset::asset_id].
8660 ///
8661 /// # Example
8662 /// ```ignore,no_run
8663 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8664 /// let x = BlobAsset::new().set_asset_id("example");
8665 /// ```
8666 pub fn set_asset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8667 self.asset_id = v.into();
8668 self
8669 }
8670
8671 /// Sets the value of [content][crate::model::document::BlobAsset::content].
8672 ///
8673 /// # Example
8674 /// ```ignore,no_run
8675 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8676 /// let x = BlobAsset::new().set_content(bytes::Bytes::from_static(b"example"));
8677 /// ```
8678 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8679 self.content = v.into();
8680 self
8681 }
8682
8683 /// Sets the value of [mime_type][crate::model::document::BlobAsset::mime_type].
8684 ///
8685 /// # Example
8686 /// ```ignore,no_run
8687 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8688 /// let x = BlobAsset::new().set_mime_type("example");
8689 /// ```
8690 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8691 self.mime_type = v.into();
8692 self
8693 }
8694 }
8695
8696 impl wkt::message::Message for BlobAsset {
8697 fn typename() -> &'static str {
8698 "type.googleapis.com/google.cloud.documentai.v1.Document.BlobAsset"
8699 }
8700 }
8701
8702 /// The output of the validation given the document and the validation rules.
8703 #[derive(Clone, Default, PartialEq)]
8704 #[non_exhaustive]
8705 pub struct EntityValidationOutput {
8706 /// The result of each validation rule.
8707 pub validation_results:
8708 std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
8709
8710 /// The overall result of the validation, true if all applicable rules are
8711 /// valid.
8712 pub pass_all_rules: bool,
8713
8714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8715 }
8716
8717 impl EntityValidationOutput {
8718 pub fn new() -> Self {
8719 std::default::Default::default()
8720 }
8721
8722 /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
8723 ///
8724 /// # Example
8725 /// ```ignore,no_run
8726 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8727 /// use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8728 /// let x = EntityValidationOutput::new()
8729 /// .set_validation_results([
8730 /// ValidationResult::default()/* use setters */,
8731 /// ValidationResult::default()/* use (different) setters */,
8732 /// ]);
8733 /// ```
8734 pub fn set_validation_results<T, V>(mut self, v: T) -> Self
8735 where
8736 T: std::iter::IntoIterator<Item = V>,
8737 V: std::convert::Into<
8738 crate::model::document::entity_validation_output::ValidationResult,
8739 >,
8740 {
8741 use std::iter::Iterator;
8742 self.validation_results = v.into_iter().map(|i| i.into()).collect();
8743 self
8744 }
8745
8746 /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
8747 ///
8748 /// # Example
8749 /// ```ignore,no_run
8750 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8751 /// let x = EntityValidationOutput::new().set_pass_all_rules(true);
8752 /// ```
8753 pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8754 self.pass_all_rules = v.into();
8755 self
8756 }
8757 }
8758
8759 impl wkt::message::Message for EntityValidationOutput {
8760 fn typename() -> &'static str {
8761 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
8762 }
8763 }
8764
8765 /// Defines additional types related to [EntityValidationOutput].
8766 pub mod entity_validation_output {
8767 #[allow(unused_imports)]
8768 use super::*;
8769
8770 /// Validation result for a single validation rule.
8771 #[derive(Clone, Default, PartialEq)]
8772 #[non_exhaustive]
8773 pub struct ValidationResult {
8774
8775 /// The name of the validation rule.
8776 pub rule_name: std::string::String,
8777
8778 /// The description of the validation rule.
8779 pub rule_description: std::string::String,
8780
8781 /// The result of the validation rule.
8782 pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
8783
8784 /// The detailed information of the running the validation process using
8785 /// the entity from the document based on the validation rule.
8786 pub validation_details: std::string::String,
8787
8788 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8789 }
8790
8791 impl ValidationResult {
8792 pub fn new() -> Self {
8793 std::default::Default::default()
8794 }
8795
8796 /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
8797 ///
8798 /// # Example
8799 /// ```ignore,no_run
8800 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8801 /// let x = ValidationResult::new().set_rule_name("example");
8802 /// ```
8803 pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
8804 mut self,
8805 v: T,
8806 ) -> Self {
8807 self.rule_name = v.into();
8808 self
8809 }
8810
8811 /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
8812 ///
8813 /// # Example
8814 /// ```ignore,no_run
8815 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8816 /// let x = ValidationResult::new().set_rule_description("example");
8817 /// ```
8818 pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
8819 mut self,
8820 v: T,
8821 ) -> Self {
8822 self.rule_description = v.into();
8823 self
8824 }
8825
8826 /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
8827 ///
8828 /// # Example
8829 /// ```ignore,no_run
8830 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8831 /// use google_cloud_documentai_v1::model::document::entity_validation_output::validation_result::ValidationResultType;
8832 /// let x0 = ValidationResult::new().set_validation_result_type(ValidationResultType::Valid);
8833 /// let x1 = ValidationResult::new().set_validation_result_type(ValidationResultType::Invalid);
8834 /// let x2 = ValidationResult::new().set_validation_result_type(ValidationResultType::Skipped);
8835 /// ```
8836 pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
8837 self.validation_result_type = v.into();
8838 self
8839 }
8840
8841 /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
8842 ///
8843 /// # Example
8844 /// ```ignore,no_run
8845 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8846 /// let x = ValidationResult::new().set_validation_details("example");
8847 /// ```
8848 pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
8849 mut self,
8850 v: T,
8851 ) -> Self {
8852 self.validation_details = v.into();
8853 self
8854 }
8855 }
8856
8857 impl wkt::message::Message for ValidationResult {
8858 fn typename() -> &'static str {
8859 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
8860 }
8861 }
8862
8863 /// Defines additional types related to [ValidationResult].
8864 pub mod validation_result {
8865 #[allow(unused_imports)]
8866 use super::*;
8867
8868 /// The result of the validation rule.
8869 ///
8870 /// # Working with unknown values
8871 ///
8872 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8873 /// additional enum variants at any time. Adding new variants is not considered
8874 /// a breaking change. Applications should write their code in anticipation of:
8875 ///
8876 /// - New values appearing in future releases of the client library, **and**
8877 /// - New values received dynamically, without application changes.
8878 ///
8879 /// Please consult the [Working with enums] section in the user guide for some
8880 /// guidelines.
8881 ///
8882 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8883 #[derive(Clone, Debug, PartialEq)]
8884 #[non_exhaustive]
8885 pub enum ValidationResultType {
8886 /// The validation result type is unspecified.
8887 Unspecified,
8888 /// The validation is valid.
8889 Valid,
8890 /// The validation is invalid.
8891 Invalid,
8892 /// The validation is skipped.
8893 Skipped,
8894 /// The validation is not applicable.
8895 NotApplicable,
8896 /// If set, the enum was initialized with an unknown value.
8897 ///
8898 /// Applications can examine the value using [ValidationResultType::value] or
8899 /// [ValidationResultType::name].
8900 UnknownValue(validation_result_type::UnknownValue),
8901 }
8902
8903 #[doc(hidden)]
8904 pub mod validation_result_type {
8905 #[allow(unused_imports)]
8906 use super::*;
8907 #[derive(Clone, Debug, PartialEq)]
8908 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8909 }
8910
8911 impl ValidationResultType {
8912 /// Gets the enum value.
8913 ///
8914 /// Returns `None` if the enum contains an unknown value deserialized from
8915 /// the string representation of enums.
8916 pub fn value(&self) -> std::option::Option<i32> {
8917 match self {
8918 Self::Unspecified => std::option::Option::Some(0),
8919 Self::Valid => std::option::Option::Some(1),
8920 Self::Invalid => std::option::Option::Some(2),
8921 Self::Skipped => std::option::Option::Some(3),
8922 Self::NotApplicable => std::option::Option::Some(4),
8923 Self::UnknownValue(u) => u.0.value(),
8924 }
8925 }
8926
8927 /// Gets the enum value as a string.
8928 ///
8929 /// Returns `None` if the enum contains an unknown value deserialized from
8930 /// the integer representation of enums.
8931 pub fn name(&self) -> std::option::Option<&str> {
8932 match self {
8933 Self::Unspecified => {
8934 std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
8935 }
8936 Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
8937 Self::Invalid => {
8938 std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
8939 }
8940 Self::Skipped => {
8941 std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
8942 }
8943 Self::NotApplicable => {
8944 std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
8945 }
8946 Self::UnknownValue(u) => u.0.name(),
8947 }
8948 }
8949 }
8950
8951 impl std::default::Default for ValidationResultType {
8952 fn default() -> Self {
8953 use std::convert::From;
8954 Self::from(0)
8955 }
8956 }
8957
8958 impl std::fmt::Display for ValidationResultType {
8959 fn fmt(
8960 &self,
8961 f: &mut std::fmt::Formatter<'_>,
8962 ) -> std::result::Result<(), std::fmt::Error> {
8963 wkt::internal::display_enum(f, self.name(), self.value())
8964 }
8965 }
8966
8967 impl std::convert::From<i32> for ValidationResultType {
8968 fn from(value: i32) -> Self {
8969 match value {
8970 0 => Self::Unspecified,
8971 1 => Self::Valid,
8972 2 => Self::Invalid,
8973 3 => Self::Skipped,
8974 4 => Self::NotApplicable,
8975 _ => Self::UnknownValue(validation_result_type::UnknownValue(
8976 wkt::internal::UnknownEnumValue::Integer(value),
8977 )),
8978 }
8979 }
8980 }
8981
8982 impl std::convert::From<&str> for ValidationResultType {
8983 fn from(value: &str) -> Self {
8984 use std::string::ToString;
8985 match value {
8986 "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
8987 "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
8988 "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
8989 "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
8990 "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
8991 _ => Self::UnknownValue(validation_result_type::UnknownValue(
8992 wkt::internal::UnknownEnumValue::String(value.to_string()),
8993 )),
8994 }
8995 }
8996 }
8997
8998 impl serde::ser::Serialize for ValidationResultType {
8999 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9000 where
9001 S: serde::Serializer,
9002 {
9003 match self {
9004 Self::Unspecified => serializer.serialize_i32(0),
9005 Self::Valid => serializer.serialize_i32(1),
9006 Self::Invalid => serializer.serialize_i32(2),
9007 Self::Skipped => serializer.serialize_i32(3),
9008 Self::NotApplicable => serializer.serialize_i32(4),
9009 Self::UnknownValue(u) => u.0.serialize(serializer),
9010 }
9011 }
9012 }
9013
9014 impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
9015 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9016 where
9017 D: serde::Deserializer<'de>,
9018 {
9019 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
9020 ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
9021 }
9022 }
9023 }
9024 }
9025
9026 /// Entity revision.
9027 #[derive(Clone, Default, PartialEq)]
9028 #[non_exhaustive]
9029 pub struct EntitiesRevision {
9030 /// The revision id.
9031 pub revision_id: std::string::String,
9032
9033 /// The entities in this revision.
9034 pub entities: std::vec::Vec<crate::model::document::Entity>,
9035
9036 /// The entity validation output for this revision.
9037 pub entity_validation_output:
9038 std::option::Option<crate::model::document::EntityValidationOutput>,
9039
9040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9041 }
9042
9043 impl EntitiesRevision {
9044 pub fn new() -> Self {
9045 std::default::Default::default()
9046 }
9047
9048 /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
9049 ///
9050 /// # Example
9051 /// ```ignore,no_run
9052 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9053 /// let x = EntitiesRevision::new().set_revision_id("example");
9054 /// ```
9055 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9056 self.revision_id = v.into();
9057 self
9058 }
9059
9060 /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
9061 ///
9062 /// # Example
9063 /// ```ignore,no_run
9064 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9065 /// use google_cloud_documentai_v1::model::document::Entity;
9066 /// let x = EntitiesRevision::new()
9067 /// .set_entities([
9068 /// Entity::default()/* use setters */,
9069 /// Entity::default()/* use (different) setters */,
9070 /// ]);
9071 /// ```
9072 pub fn set_entities<T, V>(mut self, v: T) -> Self
9073 where
9074 T: std::iter::IntoIterator<Item = V>,
9075 V: std::convert::Into<crate::model::document::Entity>,
9076 {
9077 use std::iter::Iterator;
9078 self.entities = v.into_iter().map(|i| i.into()).collect();
9079 self
9080 }
9081
9082 /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9083 ///
9084 /// # Example
9085 /// ```ignore,no_run
9086 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9087 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9088 /// let x = EntitiesRevision::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
9089 /// ```
9090 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
9091 where
9092 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9093 {
9094 self.entity_validation_output = std::option::Option::Some(v.into());
9095 self
9096 }
9097
9098 /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9099 ///
9100 /// # Example
9101 /// ```ignore,no_run
9102 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9103 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9104 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
9105 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
9106 /// ```
9107 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
9108 where
9109 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9110 {
9111 self.entity_validation_output = v.map(|x| x.into());
9112 self
9113 }
9114 }
9115
9116 impl wkt::message::Message for EntitiesRevision {
9117 fn typename() -> &'static str {
9118 "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
9119 }
9120 }
9121
9122 /// Original source document from the user.
9123 #[derive(Clone, Debug, PartialEq)]
9124 #[non_exhaustive]
9125 pub enum Source {
9126 /// Optional. Currently supports Google Cloud Storage URI of the form
9127 /// `gs://bucket_name/object_name`. Object versioning is not supported.
9128 /// For more information, refer to [Google Cloud Storage Request
9129 /// URIs](https://cloud.google.com/storage/docs/reference-uris).
9130 Uri(std::string::String),
9131 /// Optional. Inline document content, represented as a stream of bytes.
9132 /// Note: As with all `bytes` fields, protobuffers use a pure binary
9133 /// representation, whereas JSON representations use base64.
9134 Content(::bytes::Bytes),
9135 }
9136}
9137
9138/// Payload message of raw document content (bytes).
9139#[derive(Clone, Default, PartialEq)]
9140#[non_exhaustive]
9141pub struct RawDocument {
9142 /// Inline document content.
9143 pub content: ::bytes::Bytes,
9144
9145 /// An IANA MIME type (RFC6838) indicating the nature and format of the
9146 /// [content][google.cloud.documentai.v1.RawDocument.content].
9147 ///
9148 /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
9149 pub mime_type: std::string::String,
9150
9151 /// The display name of the document, it supports all Unicode characters except
9152 /// the following:
9153 /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
9154 /// `~`, `=` and `:` are reserved.
9155 /// If not specified, a default ID is generated.
9156 pub display_name: std::string::String,
9157
9158 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9159}
9160
9161impl RawDocument {
9162 pub fn new() -> Self {
9163 std::default::Default::default()
9164 }
9165
9166 /// Sets the value of [content][crate::model::RawDocument::content].
9167 ///
9168 /// # Example
9169 /// ```ignore,no_run
9170 /// # use google_cloud_documentai_v1::model::RawDocument;
9171 /// let x = RawDocument::new().set_content(bytes::Bytes::from_static(b"example"));
9172 /// ```
9173 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9174 self.content = v.into();
9175 self
9176 }
9177
9178 /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
9179 ///
9180 /// # Example
9181 /// ```ignore,no_run
9182 /// # use google_cloud_documentai_v1::model::RawDocument;
9183 /// let x = RawDocument::new().set_mime_type("example");
9184 /// ```
9185 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9186 self.mime_type = v.into();
9187 self
9188 }
9189
9190 /// Sets the value of [display_name][crate::model::RawDocument::display_name].
9191 ///
9192 /// # Example
9193 /// ```ignore,no_run
9194 /// # use google_cloud_documentai_v1::model::RawDocument;
9195 /// let x = RawDocument::new().set_display_name("example");
9196 /// ```
9197 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9198 self.display_name = v.into();
9199 self
9200 }
9201}
9202
9203impl wkt::message::Message for RawDocument {
9204 fn typename() -> &'static str {
9205 "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
9206 }
9207}
9208
9209/// Specifies a document stored on Cloud Storage.
9210#[derive(Clone, Default, PartialEq)]
9211#[non_exhaustive]
9212pub struct GcsDocument {
9213 /// The Cloud Storage object uri.
9214 pub gcs_uri: std::string::String,
9215
9216 /// An IANA MIME type (RFC6838) of the content.
9217 pub mime_type: std::string::String,
9218
9219 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9220}
9221
9222impl GcsDocument {
9223 pub fn new() -> Self {
9224 std::default::Default::default()
9225 }
9226
9227 /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
9228 ///
9229 /// # Example
9230 /// ```ignore,no_run
9231 /// # use google_cloud_documentai_v1::model::GcsDocument;
9232 /// let x = GcsDocument::new().set_gcs_uri("example");
9233 /// ```
9234 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9235 self.gcs_uri = v.into();
9236 self
9237 }
9238
9239 /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
9240 ///
9241 /// # Example
9242 /// ```ignore,no_run
9243 /// # use google_cloud_documentai_v1::model::GcsDocument;
9244 /// let x = GcsDocument::new().set_mime_type("example");
9245 /// ```
9246 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9247 self.mime_type = v.into();
9248 self
9249 }
9250}
9251
9252impl wkt::message::Message for GcsDocument {
9253 fn typename() -> &'static str {
9254 "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
9255 }
9256}
9257
9258/// Specifies a set of documents on Cloud Storage.
9259#[derive(Clone, Default, PartialEq)]
9260#[non_exhaustive]
9261pub struct GcsDocuments {
9262 /// The list of documents.
9263 pub documents: std::vec::Vec<crate::model::GcsDocument>,
9264
9265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9266}
9267
9268impl GcsDocuments {
9269 pub fn new() -> Self {
9270 std::default::Default::default()
9271 }
9272
9273 /// Sets the value of [documents][crate::model::GcsDocuments::documents].
9274 ///
9275 /// # Example
9276 /// ```ignore,no_run
9277 /// # use google_cloud_documentai_v1::model::GcsDocuments;
9278 /// use google_cloud_documentai_v1::model::GcsDocument;
9279 /// let x = GcsDocuments::new()
9280 /// .set_documents([
9281 /// GcsDocument::default()/* use setters */,
9282 /// GcsDocument::default()/* use (different) setters */,
9283 /// ]);
9284 /// ```
9285 pub fn set_documents<T, V>(mut self, v: T) -> Self
9286 where
9287 T: std::iter::IntoIterator<Item = V>,
9288 V: std::convert::Into<crate::model::GcsDocument>,
9289 {
9290 use std::iter::Iterator;
9291 self.documents = v.into_iter().map(|i| i.into()).collect();
9292 self
9293 }
9294}
9295
9296impl wkt::message::Message for GcsDocuments {
9297 fn typename() -> &'static str {
9298 "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
9299 }
9300}
9301
9302/// Specifies all documents on Cloud Storage with a common prefix.
9303#[derive(Clone, Default, PartialEq)]
9304#[non_exhaustive]
9305pub struct GcsPrefix {
9306 /// The URI prefix.
9307 pub gcs_uri_prefix: std::string::String,
9308
9309 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9310}
9311
9312impl GcsPrefix {
9313 pub fn new() -> Self {
9314 std::default::Default::default()
9315 }
9316
9317 /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
9318 ///
9319 /// # Example
9320 /// ```ignore,no_run
9321 /// # use google_cloud_documentai_v1::model::GcsPrefix;
9322 /// let x = GcsPrefix::new().set_gcs_uri_prefix("example");
9323 /// ```
9324 pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9325 self.gcs_uri_prefix = v.into();
9326 self
9327 }
9328}
9329
9330impl wkt::message::Message for GcsPrefix {
9331 fn typename() -> &'static str {
9332 "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
9333 }
9334}
9335
9336/// The common config to specify a set of documents used as input.
9337#[derive(Clone, Default, PartialEq)]
9338#[non_exhaustive]
9339pub struct BatchDocumentsInputConfig {
9340 /// The source. Make sure that the caller of the API has storage.objects.get
9341 /// access to the buckets.
9342 pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
9343
9344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9345}
9346
9347impl BatchDocumentsInputConfig {
9348 pub fn new() -> Self {
9349 std::default::Default::default()
9350 }
9351
9352 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
9353 ///
9354 /// Note that all the setters affecting `source` are mutually
9355 /// exclusive.
9356 ///
9357 /// # Example
9358 /// ```ignore,no_run
9359 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9360 /// use google_cloud_documentai_v1::model::GcsPrefix;
9361 /// let x = BatchDocumentsInputConfig::new().set_source(Some(
9362 /// google_cloud_documentai_v1::model::batch_documents_input_config::Source::GcsPrefix(GcsPrefix::default().into())));
9363 /// ```
9364 pub fn set_source<
9365 T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
9366 >(
9367 mut self,
9368 v: T,
9369 ) -> Self {
9370 self.source = v.into();
9371 self
9372 }
9373
9374 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9375 /// if it holds a `GcsPrefix`, `None` if the field is not set or
9376 /// holds a different branch.
9377 pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
9378 #[allow(unreachable_patterns)]
9379 self.source.as_ref().and_then(|v| match v {
9380 crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
9381 std::option::Option::Some(v)
9382 }
9383 _ => std::option::Option::None,
9384 })
9385 }
9386
9387 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9388 /// to hold a `GcsPrefix`.
9389 ///
9390 /// Note that all the setters affecting `source` are
9391 /// mutually exclusive.
9392 ///
9393 /// # Example
9394 /// ```ignore,no_run
9395 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9396 /// use google_cloud_documentai_v1::model::GcsPrefix;
9397 /// let x = BatchDocumentsInputConfig::new().set_gcs_prefix(GcsPrefix::default()/* use setters */);
9398 /// assert!(x.gcs_prefix().is_some());
9399 /// assert!(x.gcs_documents().is_none());
9400 /// ```
9401 pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
9402 mut self,
9403 v: T,
9404 ) -> Self {
9405 self.source = std::option::Option::Some(
9406 crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
9407 );
9408 self
9409 }
9410
9411 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9412 /// if it holds a `GcsDocuments`, `None` if the field is not set or
9413 /// holds a different branch.
9414 pub fn gcs_documents(
9415 &self,
9416 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
9417 #[allow(unreachable_patterns)]
9418 self.source.as_ref().and_then(|v| match v {
9419 crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
9420 std::option::Option::Some(v)
9421 }
9422 _ => std::option::Option::None,
9423 })
9424 }
9425
9426 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9427 /// to hold a `GcsDocuments`.
9428 ///
9429 /// Note that all the setters affecting `source` are
9430 /// mutually exclusive.
9431 ///
9432 /// # Example
9433 /// ```ignore,no_run
9434 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9435 /// use google_cloud_documentai_v1::model::GcsDocuments;
9436 /// let x = BatchDocumentsInputConfig::new().set_gcs_documents(GcsDocuments::default()/* use setters */);
9437 /// assert!(x.gcs_documents().is_some());
9438 /// assert!(x.gcs_prefix().is_none());
9439 /// ```
9440 pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
9441 mut self,
9442 v: T,
9443 ) -> Self {
9444 self.source = std::option::Option::Some(
9445 crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
9446 );
9447 self
9448 }
9449}
9450
9451impl wkt::message::Message for BatchDocumentsInputConfig {
9452 fn typename() -> &'static str {
9453 "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
9454 }
9455}
9456
9457/// Defines additional types related to [BatchDocumentsInputConfig].
9458pub mod batch_documents_input_config {
9459 #[allow(unused_imports)]
9460 use super::*;
9461
9462 /// The source. Make sure that the caller of the API has storage.objects.get
9463 /// access to the buckets.
9464 #[derive(Clone, Debug, PartialEq)]
9465 #[non_exhaustive]
9466 pub enum Source {
9467 /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
9468 GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
9469 /// The set of documents individually specified on Cloud Storage.
9470 GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
9471 }
9472}
9473
9474/// Config that controls the output of documents. All documents will be written
9475/// as a JSON file.
9476#[derive(Clone, Default, PartialEq)]
9477#[non_exhaustive]
9478pub struct DocumentOutputConfig {
9479 /// The destination of the results.
9480 pub destination: std::option::Option<crate::model::document_output_config::Destination>,
9481
9482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9483}
9484
9485impl DocumentOutputConfig {
9486 pub fn new() -> Self {
9487 std::default::Default::default()
9488 }
9489
9490 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
9491 ///
9492 /// Note that all the setters affecting `destination` are mutually
9493 /// exclusive.
9494 ///
9495 /// # Example
9496 /// ```ignore,no_run
9497 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9498 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9499 /// let x = DocumentOutputConfig::new().set_destination(Some(
9500 /// google_cloud_documentai_v1::model::document_output_config::Destination::GcsOutputConfig(GcsOutputConfig::default().into())));
9501 /// ```
9502 pub fn set_destination<
9503 T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
9504 >(
9505 mut self,
9506 v: T,
9507 ) -> Self {
9508 self.destination = v.into();
9509 self
9510 }
9511
9512 /// The value of [destination][crate::model::DocumentOutputConfig::destination]
9513 /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
9514 /// holds a different branch.
9515 pub fn gcs_output_config(
9516 &self,
9517 ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
9518 {
9519 #[allow(unreachable_patterns)]
9520 self.destination.as_ref().and_then(|v| match v {
9521 crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
9522 std::option::Option::Some(v)
9523 }
9524 _ => std::option::Option::None,
9525 })
9526 }
9527
9528 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
9529 /// to hold a `GcsOutputConfig`.
9530 ///
9531 /// Note that all the setters affecting `destination` are
9532 /// mutually exclusive.
9533 ///
9534 /// # Example
9535 /// ```ignore,no_run
9536 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9537 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9538 /// let x = DocumentOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
9539 /// assert!(x.gcs_output_config().is_some());
9540 /// ```
9541 pub fn set_gcs_output_config<
9542 T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
9543 >(
9544 mut self,
9545 v: T,
9546 ) -> Self {
9547 self.destination = std::option::Option::Some(
9548 crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
9549 );
9550 self
9551 }
9552}
9553
9554impl wkt::message::Message for DocumentOutputConfig {
9555 fn typename() -> &'static str {
9556 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
9557 }
9558}
9559
9560/// Defines additional types related to [DocumentOutputConfig].
9561pub mod document_output_config {
9562 #[allow(unused_imports)]
9563 use super::*;
9564
9565 /// The configuration used when outputting documents.
9566 #[derive(Clone, Default, PartialEq)]
9567 #[non_exhaustive]
9568 pub struct GcsOutputConfig {
9569 /// The Cloud Storage uri (a directory) of the output.
9570 pub gcs_uri: std::string::String,
9571
9572 /// Specifies which fields to include in the output documents.
9573 /// Only supports top level document and pages field so it must be in the
9574 /// form of `{document_field_name}` or `pages.{page_field_name}`.
9575 pub field_mask: std::option::Option<wkt::FieldMask>,
9576
9577 /// Specifies the sharding config for the output document.
9578 pub sharding_config: std::option::Option<
9579 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9580 >,
9581
9582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9583 }
9584
9585 impl GcsOutputConfig {
9586 pub fn new() -> Self {
9587 std::default::Default::default()
9588 }
9589
9590 /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
9591 ///
9592 /// # Example
9593 /// ```ignore,no_run
9594 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9595 /// let x = GcsOutputConfig::new().set_gcs_uri("example");
9596 /// ```
9597 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9598 self.gcs_uri = v.into();
9599 self
9600 }
9601
9602 /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9603 ///
9604 /// # Example
9605 /// ```ignore,no_run
9606 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9607 /// use wkt::FieldMask;
9608 /// let x = GcsOutputConfig::new().set_field_mask(FieldMask::default()/* use setters */);
9609 /// ```
9610 pub fn set_field_mask<T>(mut self, v: T) -> Self
9611 where
9612 T: std::convert::Into<wkt::FieldMask>,
9613 {
9614 self.field_mask = std::option::Option::Some(v.into());
9615 self
9616 }
9617
9618 /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9619 ///
9620 /// # Example
9621 /// ```ignore,no_run
9622 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9623 /// use wkt::FieldMask;
9624 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
9625 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(None::<FieldMask>);
9626 /// ```
9627 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
9628 where
9629 T: std::convert::Into<wkt::FieldMask>,
9630 {
9631 self.field_mask = v.map(|x| x.into());
9632 self
9633 }
9634
9635 /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9636 ///
9637 /// # Example
9638 /// ```ignore,no_run
9639 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9640 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9641 /// let x = GcsOutputConfig::new().set_sharding_config(ShardingConfig::default()/* use setters */);
9642 /// ```
9643 pub fn set_sharding_config<T>(mut self, v: T) -> Self
9644 where
9645 T: std::convert::Into<
9646 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9647 >,
9648 {
9649 self.sharding_config = std::option::Option::Some(v.into());
9650 self
9651 }
9652
9653 /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9654 ///
9655 /// # Example
9656 /// ```ignore,no_run
9657 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9658 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9659 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(Some(ShardingConfig::default()/* use setters */));
9660 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(None::<ShardingConfig>);
9661 /// ```
9662 pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
9663 where
9664 T: std::convert::Into<
9665 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9666 >,
9667 {
9668 self.sharding_config = v.map(|x| x.into());
9669 self
9670 }
9671 }
9672
9673 impl wkt::message::Message for GcsOutputConfig {
9674 fn typename() -> &'static str {
9675 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
9676 }
9677 }
9678
9679 /// Defines additional types related to [GcsOutputConfig].
9680 pub mod gcs_output_config {
9681 #[allow(unused_imports)]
9682 use super::*;
9683
9684 /// The sharding config for the output document.
9685 #[derive(Clone, Default, PartialEq)]
9686 #[non_exhaustive]
9687 pub struct ShardingConfig {
9688 /// The number of pages per shard.
9689 pub pages_per_shard: i32,
9690
9691 /// The number of overlapping pages between consecutive shards.
9692 pub pages_overlap: i32,
9693
9694 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9695 }
9696
9697 impl ShardingConfig {
9698 pub fn new() -> Self {
9699 std::default::Default::default()
9700 }
9701
9702 /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
9703 ///
9704 /// # Example
9705 /// ```ignore,no_run
9706 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9707 /// let x = ShardingConfig::new().set_pages_per_shard(42);
9708 /// ```
9709 pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9710 self.pages_per_shard = v.into();
9711 self
9712 }
9713
9714 /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
9715 ///
9716 /// # Example
9717 /// ```ignore,no_run
9718 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9719 /// let x = ShardingConfig::new().set_pages_overlap(42);
9720 /// ```
9721 pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9722 self.pages_overlap = v.into();
9723 self
9724 }
9725 }
9726
9727 impl wkt::message::Message for ShardingConfig {
9728 fn typename() -> &'static str {
9729 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
9730 }
9731 }
9732 }
9733
9734 /// The destination of the results.
9735 #[derive(Clone, Debug, PartialEq)]
9736 #[non_exhaustive]
9737 pub enum Destination {
9738 /// Output config to write the results to Cloud Storage.
9739 GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
9740 }
9741}
9742
9743/// Config for Document OCR.
9744#[derive(Clone, Default, PartialEq)]
9745#[non_exhaustive]
9746pub struct OcrConfig {
9747 /// Hints for the OCR model.
9748 pub hints: std::option::Option<crate::model::ocr_config::Hints>,
9749
9750 /// Enables special handling for PDFs with existing text information. Results
9751 /// in better text extraction quality in such PDF inputs.
9752 pub enable_native_pdf_parsing: bool,
9753
9754 /// Enables intelligent document quality scores after OCR. Can help with
9755 /// diagnosing why OCR responses are of poor quality for a given input.
9756 /// Adds additional latency comparable to regular OCR to the process call.
9757 pub enable_image_quality_scores: bool,
9758
9759 /// A list of advanced OCR options to further fine-tune OCR behavior. Current
9760 /// valid values are:
9761 ///
9762 /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
9763 /// an alternative to the current ML-based layout detection algorithm.
9764 /// Customers can choose the best suitable layout algorithm based on their
9765 /// situation.
9766 pub advanced_ocr_options: std::vec::Vec<std::string::String>,
9767
9768 /// Includes symbol level OCR information if set to true.
9769 pub enable_symbol: bool,
9770
9771 /// Turn on font identification model and return font style information.
9772 /// Deprecated, use
9773 /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
9774 /// instead.
9775 ///
9776 /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
9777 #[deprecated]
9778 pub compute_style_info: bool,
9779
9780 /// Turn off character box detector in OCR engine. Character box detection is
9781 /// enabled by default in OCR 2.0 (and later) processors.
9782 pub disable_character_boxes_detection: bool,
9783
9784 /// Configurations for premium OCR features.
9785 pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
9786
9787 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9788}
9789
9790impl OcrConfig {
9791 pub fn new() -> Self {
9792 std::default::Default::default()
9793 }
9794
9795 /// Sets the value of [hints][crate::model::OcrConfig::hints].
9796 ///
9797 /// # Example
9798 /// ```ignore,no_run
9799 /// # use google_cloud_documentai_v1::model::OcrConfig;
9800 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9801 /// let x = OcrConfig::new().set_hints(Hints::default()/* use setters */);
9802 /// ```
9803 pub fn set_hints<T>(mut self, v: T) -> Self
9804 where
9805 T: std::convert::Into<crate::model::ocr_config::Hints>,
9806 {
9807 self.hints = std::option::Option::Some(v.into());
9808 self
9809 }
9810
9811 /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
9812 ///
9813 /// # Example
9814 /// ```ignore,no_run
9815 /// # use google_cloud_documentai_v1::model::OcrConfig;
9816 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9817 /// let x = OcrConfig::new().set_or_clear_hints(Some(Hints::default()/* use setters */));
9818 /// let x = OcrConfig::new().set_or_clear_hints(None::<Hints>);
9819 /// ```
9820 pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
9821 where
9822 T: std::convert::Into<crate::model::ocr_config::Hints>,
9823 {
9824 self.hints = v.map(|x| x.into());
9825 self
9826 }
9827
9828 /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
9829 ///
9830 /// # Example
9831 /// ```ignore,no_run
9832 /// # use google_cloud_documentai_v1::model::OcrConfig;
9833 /// let x = OcrConfig::new().set_enable_native_pdf_parsing(true);
9834 /// ```
9835 pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9836 self.enable_native_pdf_parsing = v.into();
9837 self
9838 }
9839
9840 /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
9841 ///
9842 /// # Example
9843 /// ```ignore,no_run
9844 /// # use google_cloud_documentai_v1::model::OcrConfig;
9845 /// let x = OcrConfig::new().set_enable_image_quality_scores(true);
9846 /// ```
9847 pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9848 self.enable_image_quality_scores = v.into();
9849 self
9850 }
9851
9852 /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
9853 ///
9854 /// # Example
9855 /// ```ignore,no_run
9856 /// # use google_cloud_documentai_v1::model::OcrConfig;
9857 /// let x = OcrConfig::new().set_advanced_ocr_options(["a", "b", "c"]);
9858 /// ```
9859 pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
9860 where
9861 T: std::iter::IntoIterator<Item = V>,
9862 V: std::convert::Into<std::string::String>,
9863 {
9864 use std::iter::Iterator;
9865 self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
9866 self
9867 }
9868
9869 /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
9870 ///
9871 /// # Example
9872 /// ```ignore,no_run
9873 /// # use google_cloud_documentai_v1::model::OcrConfig;
9874 /// let x = OcrConfig::new().set_enable_symbol(true);
9875 /// ```
9876 pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9877 self.enable_symbol = v.into();
9878 self
9879 }
9880
9881 /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
9882 ///
9883 /// # Example
9884 /// ```ignore,no_run
9885 /// # use google_cloud_documentai_v1::model::OcrConfig;
9886 /// let x = OcrConfig::new().set_compute_style_info(true);
9887 /// ```
9888 #[deprecated]
9889 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9890 self.compute_style_info = v.into();
9891 self
9892 }
9893
9894 /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
9895 ///
9896 /// # Example
9897 /// ```ignore,no_run
9898 /// # use google_cloud_documentai_v1::model::OcrConfig;
9899 /// let x = OcrConfig::new().set_disable_character_boxes_detection(true);
9900 /// ```
9901 pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
9902 mut self,
9903 v: T,
9904 ) -> Self {
9905 self.disable_character_boxes_detection = v.into();
9906 self
9907 }
9908
9909 /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
9910 ///
9911 /// # Example
9912 /// ```ignore,no_run
9913 /// # use google_cloud_documentai_v1::model::OcrConfig;
9914 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9915 /// let x = OcrConfig::new().set_premium_features(PremiumFeatures::default()/* use setters */);
9916 /// ```
9917 pub fn set_premium_features<T>(mut self, v: T) -> Self
9918 where
9919 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
9920 {
9921 self.premium_features = std::option::Option::Some(v.into());
9922 self
9923 }
9924
9925 /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
9926 ///
9927 /// # Example
9928 /// ```ignore,no_run
9929 /// # use google_cloud_documentai_v1::model::OcrConfig;
9930 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9931 /// let x = OcrConfig::new().set_or_clear_premium_features(Some(PremiumFeatures::default()/* use setters */));
9932 /// let x = OcrConfig::new().set_or_clear_premium_features(None::<PremiumFeatures>);
9933 /// ```
9934 pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
9935 where
9936 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
9937 {
9938 self.premium_features = v.map(|x| x.into());
9939 self
9940 }
9941}
9942
9943impl wkt::message::Message for OcrConfig {
9944 fn typename() -> &'static str {
9945 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
9946 }
9947}
9948
9949/// Defines additional types related to [OcrConfig].
9950pub mod ocr_config {
9951 #[allow(unused_imports)]
9952 use super::*;
9953
9954 /// Hints for OCR Engine
9955 #[derive(Clone, Default, PartialEq)]
9956 #[non_exhaustive]
9957 pub struct Hints {
9958 /// List of BCP-47 language codes to use for OCR. In most cases, not
9959 /// specifying it yields the best results since it enables automatic language
9960 /// detection. For languages based on the Latin alphabet, setting hints is
9961 /// not needed. In rare cases, when the language of the text in the
9962 /// image is known, setting a hint will help get better results (although it
9963 /// will be a significant hindrance if the hint is wrong).
9964 pub language_hints: std::vec::Vec<std::string::String>,
9965
9966 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9967 }
9968
9969 impl Hints {
9970 pub fn new() -> Self {
9971 std::default::Default::default()
9972 }
9973
9974 /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
9975 ///
9976 /// # Example
9977 /// ```ignore,no_run
9978 /// # use google_cloud_documentai_v1::model::ocr_config::Hints;
9979 /// let x = Hints::new().set_language_hints(["a", "b", "c"]);
9980 /// ```
9981 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
9982 where
9983 T: std::iter::IntoIterator<Item = V>,
9984 V: std::convert::Into<std::string::String>,
9985 {
9986 use std::iter::Iterator;
9987 self.language_hints = v.into_iter().map(|i| i.into()).collect();
9988 self
9989 }
9990 }
9991
9992 impl wkt::message::Message for Hints {
9993 fn typename() -> &'static str {
9994 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
9995 }
9996 }
9997
9998 /// Configurations for premium OCR features.
9999 #[derive(Clone, Default, PartialEq)]
10000 #[non_exhaustive]
10001 pub struct PremiumFeatures {
10002 /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
10003 /// (and later) processors.
10004 pub enable_selection_mark_detection: bool,
10005
10006 /// Turn on font identification model and return font style information.
10007 pub compute_style_info: bool,
10008
10009 /// Turn on the model that can extract LaTeX math formulas.
10010 pub enable_math_ocr: bool,
10011
10012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10013 }
10014
10015 impl PremiumFeatures {
10016 pub fn new() -> Self {
10017 std::default::Default::default()
10018 }
10019
10020 /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
10021 ///
10022 /// # Example
10023 /// ```ignore,no_run
10024 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10025 /// let x = PremiumFeatures::new().set_enable_selection_mark_detection(true);
10026 /// ```
10027 pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
10028 mut self,
10029 v: T,
10030 ) -> Self {
10031 self.enable_selection_mark_detection = v.into();
10032 self
10033 }
10034
10035 /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
10036 ///
10037 /// # Example
10038 /// ```ignore,no_run
10039 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10040 /// let x = PremiumFeatures::new().set_compute_style_info(true);
10041 /// ```
10042 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10043 self.compute_style_info = v.into();
10044 self
10045 }
10046
10047 /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
10048 ///
10049 /// # Example
10050 /// ```ignore,no_run
10051 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10052 /// let x = PremiumFeatures::new().set_enable_math_ocr(true);
10053 /// ```
10054 pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10055 self.enable_math_ocr = v.into();
10056 self
10057 }
10058 }
10059
10060 impl wkt::message::Message for PremiumFeatures {
10061 fn typename() -> &'static str {
10062 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
10063 }
10064 }
10065}
10066
10067/// Options for Process API
10068#[derive(Clone, Default, PartialEq)]
10069#[non_exhaustive]
10070pub struct ProcessOptions {
10071 /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
10072 /// Returns error if set on other processor types.
10073 pub ocr_config: std::option::Option<crate::model::OcrConfig>,
10074
10075 /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
10076 /// Returns error if set on other processor types.
10077 pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
10078
10079 /// Optional. Override the schema of the
10080 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
10081 /// return an Invalid Argument error if this field is set when the underlying
10082 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
10083 /// support schema override.
10084 ///
10085 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10086 pub schema_override: std::option::Option<crate::model::DocumentSchema>,
10087
10088 /// A subset of pages to process. If not specified, all pages are processed.
10089 /// If a page range is set, only the given pages are extracted and processed
10090 /// from the document. In the output document,
10091 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10092 /// refers to the page number in the original document.
10093 /// This configuration only applies to online processing with
10094 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10095 ///
10096 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10097 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10098 pub page_range: std::option::Option<crate::model::process_options::PageRange>,
10099
10100 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10101}
10102
10103impl ProcessOptions {
10104 pub fn new() -> Self {
10105 std::default::Default::default()
10106 }
10107
10108 /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10109 ///
10110 /// # Example
10111 /// ```ignore,no_run
10112 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10113 /// use google_cloud_documentai_v1::model::OcrConfig;
10114 /// let x = ProcessOptions::new().set_ocr_config(OcrConfig::default()/* use setters */);
10115 /// ```
10116 pub fn set_ocr_config<T>(mut self, v: T) -> Self
10117 where
10118 T: std::convert::Into<crate::model::OcrConfig>,
10119 {
10120 self.ocr_config = std::option::Option::Some(v.into());
10121 self
10122 }
10123
10124 /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10125 ///
10126 /// # Example
10127 /// ```ignore,no_run
10128 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10129 /// use google_cloud_documentai_v1::model::OcrConfig;
10130 /// let x = ProcessOptions::new().set_or_clear_ocr_config(Some(OcrConfig::default()/* use setters */));
10131 /// let x = ProcessOptions::new().set_or_clear_ocr_config(None::<OcrConfig>);
10132 /// ```
10133 pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
10134 where
10135 T: std::convert::Into<crate::model::OcrConfig>,
10136 {
10137 self.ocr_config = v.map(|x| x.into());
10138 self
10139 }
10140
10141 /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
10142 ///
10143 /// # Example
10144 /// ```ignore,no_run
10145 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10146 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10147 /// let x = ProcessOptions::new().set_layout_config(LayoutConfig::default()/* use setters */);
10148 /// ```
10149 pub fn set_layout_config<T>(mut self, v: T) -> Self
10150 where
10151 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10152 {
10153 self.layout_config = std::option::Option::Some(v.into());
10154 self
10155 }
10156
10157 /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
10158 ///
10159 /// # Example
10160 /// ```ignore,no_run
10161 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10162 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10163 /// let x = ProcessOptions::new().set_or_clear_layout_config(Some(LayoutConfig::default()/* use setters */));
10164 /// let x = ProcessOptions::new().set_or_clear_layout_config(None::<LayoutConfig>);
10165 /// ```
10166 pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
10167 where
10168 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10169 {
10170 self.layout_config = v.map(|x| x.into());
10171 self
10172 }
10173
10174 /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
10175 ///
10176 /// # Example
10177 /// ```ignore,no_run
10178 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10179 /// use google_cloud_documentai_v1::model::DocumentSchema;
10180 /// let x = ProcessOptions::new().set_schema_override(DocumentSchema::default()/* use setters */);
10181 /// ```
10182 pub fn set_schema_override<T>(mut self, v: T) -> Self
10183 where
10184 T: std::convert::Into<crate::model::DocumentSchema>,
10185 {
10186 self.schema_override = std::option::Option::Some(v.into());
10187 self
10188 }
10189
10190 /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
10191 ///
10192 /// # Example
10193 /// ```ignore,no_run
10194 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10195 /// use google_cloud_documentai_v1::model::DocumentSchema;
10196 /// let x = ProcessOptions::new().set_or_clear_schema_override(Some(DocumentSchema::default()/* use setters */));
10197 /// let x = ProcessOptions::new().set_or_clear_schema_override(None::<DocumentSchema>);
10198 /// ```
10199 pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
10200 where
10201 T: std::convert::Into<crate::model::DocumentSchema>,
10202 {
10203 self.schema_override = v.map(|x| x.into());
10204 self
10205 }
10206
10207 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
10208 ///
10209 /// Note that all the setters affecting `page_range` are mutually
10210 /// exclusive.
10211 ///
10212 /// # Example
10213 /// ```ignore,no_run
10214 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10215 /// use google_cloud_documentai_v1::model::process_options::PageRange;
10216 /// let x = ProcessOptions::new().set_page_range(Some(PageRange::FromStart(42)));
10217 /// ```
10218 pub fn set_page_range<
10219 T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
10220 >(
10221 mut self,
10222 v: T,
10223 ) -> Self {
10224 self.page_range = v.into();
10225 self
10226 }
10227
10228 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10229 /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
10230 /// holds a different branch.
10231 pub fn individual_page_selector(
10232 &self,
10233 ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
10234 {
10235 #[allow(unreachable_patterns)]
10236 self.page_range.as_ref().and_then(|v| match v {
10237 crate::model::process_options::PageRange::IndividualPageSelector(v) => {
10238 std::option::Option::Some(v)
10239 }
10240 _ => std::option::Option::None,
10241 })
10242 }
10243
10244 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10245 /// to hold a `IndividualPageSelector`.
10246 ///
10247 /// Note that all the setters affecting `page_range` are
10248 /// mutually exclusive.
10249 ///
10250 /// # Example
10251 /// ```ignore,no_run
10252 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10253 /// use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10254 /// let x = ProcessOptions::new().set_individual_page_selector(IndividualPageSelector::default()/* use setters */);
10255 /// assert!(x.individual_page_selector().is_some());
10256 /// assert!(x.from_start().is_none());
10257 /// assert!(x.from_end().is_none());
10258 /// ```
10259 pub fn set_individual_page_selector<
10260 T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
10261 >(
10262 mut self,
10263 v: T,
10264 ) -> Self {
10265 self.page_range = std::option::Option::Some(
10266 crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
10267 );
10268 self
10269 }
10270
10271 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10272 /// if it holds a `FromStart`, `None` if the field is not set or
10273 /// holds a different branch.
10274 pub fn from_start(&self) -> std::option::Option<&i32> {
10275 #[allow(unreachable_patterns)]
10276 self.page_range.as_ref().and_then(|v| match v {
10277 crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
10278 _ => std::option::Option::None,
10279 })
10280 }
10281
10282 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10283 /// to hold a `FromStart`.
10284 ///
10285 /// Note that all the setters affecting `page_range` are
10286 /// mutually exclusive.
10287 ///
10288 /// # Example
10289 /// ```ignore,no_run
10290 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10291 /// let x = ProcessOptions::new().set_from_start(42);
10292 /// assert!(x.from_start().is_some());
10293 /// assert!(x.individual_page_selector().is_none());
10294 /// assert!(x.from_end().is_none());
10295 /// ```
10296 pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10297 self.page_range = std::option::Option::Some(
10298 crate::model::process_options::PageRange::FromStart(v.into()),
10299 );
10300 self
10301 }
10302
10303 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10304 /// if it holds a `FromEnd`, `None` if the field is not set or
10305 /// holds a different branch.
10306 pub fn from_end(&self) -> std::option::Option<&i32> {
10307 #[allow(unreachable_patterns)]
10308 self.page_range.as_ref().and_then(|v| match v {
10309 crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
10310 _ => std::option::Option::None,
10311 })
10312 }
10313
10314 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10315 /// to hold a `FromEnd`.
10316 ///
10317 /// Note that all the setters affecting `page_range` are
10318 /// mutually exclusive.
10319 ///
10320 /// # Example
10321 /// ```ignore,no_run
10322 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10323 /// let x = ProcessOptions::new().set_from_end(42);
10324 /// assert!(x.from_end().is_some());
10325 /// assert!(x.individual_page_selector().is_none());
10326 /// assert!(x.from_start().is_none());
10327 /// ```
10328 pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10329 self.page_range =
10330 std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
10331 self
10332 }
10333}
10334
10335impl wkt::message::Message for ProcessOptions {
10336 fn typename() -> &'static str {
10337 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
10338 }
10339}
10340
10341/// Defines additional types related to [ProcessOptions].
10342pub mod process_options {
10343 #[allow(unused_imports)]
10344 use super::*;
10345
10346 /// Serving config for layout parser processor.
10347 #[derive(Clone, Default, PartialEq)]
10348 #[non_exhaustive]
10349 pub struct LayoutConfig {
10350 /// Optional. Config for chunking in layout parser processor.
10351 pub chunking_config:
10352 std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
10353
10354 /// Optional. Whether to include images in layout parser processor response.
10355 pub return_images: bool,
10356
10357 /// Optional. Whether to include bounding boxes in layout parser processor
10358 /// response.
10359 pub return_bounding_boxes: bool,
10360
10361 /// Optional. Whether to include image annotations in layout parser response.
10362 pub enable_image_annotation: bool,
10363
10364 /// Optional. Whether to include table annotations in layout parser response.
10365 pub enable_table_annotation: bool,
10366
10367 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10368 }
10369
10370 impl LayoutConfig {
10371 pub fn new() -> Self {
10372 std::default::Default::default()
10373 }
10374
10375 /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10376 ///
10377 /// # Example
10378 /// ```ignore,no_run
10379 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10380 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10381 /// let x = LayoutConfig::new().set_chunking_config(ChunkingConfig::default()/* use setters */);
10382 /// ```
10383 pub fn set_chunking_config<T>(mut self, v: T) -> Self
10384 where
10385 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10386 {
10387 self.chunking_config = std::option::Option::Some(v.into());
10388 self
10389 }
10390
10391 /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10392 ///
10393 /// # Example
10394 /// ```ignore,no_run
10395 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10396 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10397 /// let x = LayoutConfig::new().set_or_clear_chunking_config(Some(ChunkingConfig::default()/* use setters */));
10398 /// let x = LayoutConfig::new().set_or_clear_chunking_config(None::<ChunkingConfig>);
10399 /// ```
10400 pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
10401 where
10402 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10403 {
10404 self.chunking_config = v.map(|x| x.into());
10405 self
10406 }
10407
10408 /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
10409 ///
10410 /// # Example
10411 /// ```ignore,no_run
10412 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10413 /// let x = LayoutConfig::new().set_return_images(true);
10414 /// ```
10415 pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10416 self.return_images = v.into();
10417 self
10418 }
10419
10420 /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
10421 ///
10422 /// # Example
10423 /// ```ignore,no_run
10424 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10425 /// let x = LayoutConfig::new().set_return_bounding_boxes(true);
10426 /// ```
10427 pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10428 self.return_bounding_boxes = v.into();
10429 self
10430 }
10431
10432 /// Sets the value of [enable_image_annotation][crate::model::process_options::LayoutConfig::enable_image_annotation].
10433 ///
10434 /// # Example
10435 /// ```ignore,no_run
10436 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10437 /// let x = LayoutConfig::new().set_enable_image_annotation(true);
10438 /// ```
10439 pub fn set_enable_image_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10440 self.enable_image_annotation = v.into();
10441 self
10442 }
10443
10444 /// Sets the value of [enable_table_annotation][crate::model::process_options::LayoutConfig::enable_table_annotation].
10445 ///
10446 /// # Example
10447 /// ```ignore,no_run
10448 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10449 /// let x = LayoutConfig::new().set_enable_table_annotation(true);
10450 /// ```
10451 pub fn set_enable_table_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10452 self.enable_table_annotation = v.into();
10453 self
10454 }
10455 }
10456
10457 impl wkt::message::Message for LayoutConfig {
10458 fn typename() -> &'static str {
10459 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
10460 }
10461 }
10462
10463 /// Defines additional types related to [LayoutConfig].
10464 pub mod layout_config {
10465 #[allow(unused_imports)]
10466 use super::*;
10467
10468 /// Serving config for chunking.
10469 #[derive(Clone, Default, PartialEq)]
10470 #[non_exhaustive]
10471 pub struct ChunkingConfig {
10472 /// Optional. The chunk sizes to use when splitting documents, in order of
10473 /// level.
10474 pub chunk_size: i32,
10475
10476 /// Optional. Whether or not to include ancestor headings when splitting.
10477 pub include_ancestor_headings: bool,
10478
10479 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10480 }
10481
10482 impl ChunkingConfig {
10483 pub fn new() -> Self {
10484 std::default::Default::default()
10485 }
10486
10487 /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
10488 ///
10489 /// # Example
10490 /// ```ignore,no_run
10491 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10492 /// let x = ChunkingConfig::new().set_chunk_size(42);
10493 /// ```
10494 pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10495 self.chunk_size = v.into();
10496 self
10497 }
10498
10499 /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
10500 ///
10501 /// # Example
10502 /// ```ignore,no_run
10503 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10504 /// let x = ChunkingConfig::new().set_include_ancestor_headings(true);
10505 /// ```
10506 pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
10507 mut self,
10508 v: T,
10509 ) -> Self {
10510 self.include_ancestor_headings = v.into();
10511 self
10512 }
10513 }
10514
10515 impl wkt::message::Message for ChunkingConfig {
10516 fn typename() -> &'static str {
10517 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
10518 }
10519 }
10520 }
10521
10522 /// A list of individual page numbers.
10523 #[derive(Clone, Default, PartialEq)]
10524 #[non_exhaustive]
10525 pub struct IndividualPageSelector {
10526 /// Optional. Indices of the pages (starting from 1).
10527 pub pages: std::vec::Vec<i32>,
10528
10529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10530 }
10531
10532 impl IndividualPageSelector {
10533 pub fn new() -> Self {
10534 std::default::Default::default()
10535 }
10536
10537 /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
10538 ///
10539 /// # Example
10540 /// ```ignore,no_run
10541 /// # use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10542 /// let x = IndividualPageSelector::new().set_pages([1, 2, 3]);
10543 /// ```
10544 pub fn set_pages<T, V>(mut self, v: T) -> Self
10545 where
10546 T: std::iter::IntoIterator<Item = V>,
10547 V: std::convert::Into<i32>,
10548 {
10549 use std::iter::Iterator;
10550 self.pages = v.into_iter().map(|i| i.into()).collect();
10551 self
10552 }
10553 }
10554
10555 impl wkt::message::Message for IndividualPageSelector {
10556 fn typename() -> &'static str {
10557 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
10558 }
10559 }
10560
10561 /// A subset of pages to process. If not specified, all pages are processed.
10562 /// If a page range is set, only the given pages are extracted and processed
10563 /// from the document. In the output document,
10564 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10565 /// refers to the page number in the original document.
10566 /// This configuration only applies to online processing with
10567 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10568 ///
10569 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10570 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10571 #[derive(Clone, Debug, PartialEq)]
10572 #[non_exhaustive]
10573 pub enum PageRange {
10574 /// Which pages to process (1-indexed).
10575 IndividualPageSelector(
10576 std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
10577 ),
10578 /// Only process certain pages from the start. Process all if the document
10579 /// has fewer pages.
10580 FromStart(i32),
10581 /// Only process certain pages from the end, same as above.
10582 FromEnd(i32),
10583 }
10584}
10585
10586/// Request message for the
10587/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
10588/// method.
10589///
10590/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10591#[derive(Clone, Default, PartialEq)]
10592#[non_exhaustive]
10593pub struct ProcessRequest {
10594 /// Required. The resource name of the
10595 /// [Processor][google.cloud.documentai.v1.Processor] or
10596 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
10597 /// to use for processing. If a
10598 /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
10599 /// will use its [default
10600 /// version][google.cloud.documentai.v1.Processor.default_processor_version].
10601 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
10602 /// or
10603 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
10604 ///
10605 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
10606 /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
10607 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10608 pub name: std::string::String,
10609
10610 /// Whether human review should be skipped for this request. Default to
10611 /// `false`.
10612 pub skip_human_review: bool,
10613
10614 /// Specifies which fields to include in the
10615 /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
10616 /// output. Only supports top-level document and pages field, so it must be in
10617 /// the form of `{document_field_name}` or `pages.{page_field_name}`.
10618 ///
10619 /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
10620 pub field_mask: std::option::Option<wkt::FieldMask>,
10621
10622 /// Inference-time options for the process API
10623 pub process_options: std::option::Option<crate::model::ProcessOptions>,
10624
10625 /// Optional. The labels with user-defined metadata for the request.
10626 ///
10627 /// Label keys and values can be no longer than 63 characters
10628 /// (Unicode codepoints) and can only contain lowercase letters, numeric
10629 /// characters, underscores, and dashes. International characters are allowed.
10630 /// Label values are optional. Label keys must start with a letter.
10631 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10632
10633 /// Optional. Option to remove images from the document.
10634 pub imageless_mode: bool,
10635
10636 /// The document payload.
10637 pub source: std::option::Option<crate::model::process_request::Source>,
10638
10639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10640}
10641
10642impl ProcessRequest {
10643 pub fn new() -> Self {
10644 std::default::Default::default()
10645 }
10646
10647 /// Sets the value of [name][crate::model::ProcessRequest::name].
10648 ///
10649 /// # Example
10650 /// ```ignore,no_run
10651 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10652 /// let x = ProcessRequest::new().set_name("example");
10653 /// ```
10654 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10655 self.name = v.into();
10656 self
10657 }
10658
10659 /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
10660 ///
10661 /// # Example
10662 /// ```ignore,no_run
10663 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10664 /// let x = ProcessRequest::new().set_skip_human_review(true);
10665 /// ```
10666 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10667 self.skip_human_review = v.into();
10668 self
10669 }
10670
10671 /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
10672 ///
10673 /// # Example
10674 /// ```ignore,no_run
10675 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10676 /// use wkt::FieldMask;
10677 /// let x = ProcessRequest::new().set_field_mask(FieldMask::default()/* use setters */);
10678 /// ```
10679 pub fn set_field_mask<T>(mut self, v: T) -> Self
10680 where
10681 T: std::convert::Into<wkt::FieldMask>,
10682 {
10683 self.field_mask = std::option::Option::Some(v.into());
10684 self
10685 }
10686
10687 /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
10688 ///
10689 /// # Example
10690 /// ```ignore,no_run
10691 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10692 /// use wkt::FieldMask;
10693 /// let x = ProcessRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
10694 /// let x = ProcessRequest::new().set_or_clear_field_mask(None::<FieldMask>);
10695 /// ```
10696 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
10697 where
10698 T: std::convert::Into<wkt::FieldMask>,
10699 {
10700 self.field_mask = v.map(|x| x.into());
10701 self
10702 }
10703
10704 /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
10705 ///
10706 /// # Example
10707 /// ```ignore,no_run
10708 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10709 /// use google_cloud_documentai_v1::model::ProcessOptions;
10710 /// let x = ProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
10711 /// ```
10712 pub fn set_process_options<T>(mut self, v: T) -> Self
10713 where
10714 T: std::convert::Into<crate::model::ProcessOptions>,
10715 {
10716 self.process_options = std::option::Option::Some(v.into());
10717 self
10718 }
10719
10720 /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
10721 ///
10722 /// # Example
10723 /// ```ignore,no_run
10724 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10725 /// use google_cloud_documentai_v1::model::ProcessOptions;
10726 /// let x = ProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
10727 /// let x = ProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
10728 /// ```
10729 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
10730 where
10731 T: std::convert::Into<crate::model::ProcessOptions>,
10732 {
10733 self.process_options = v.map(|x| x.into());
10734 self
10735 }
10736
10737 /// Sets the value of [labels][crate::model::ProcessRequest::labels].
10738 ///
10739 /// # Example
10740 /// ```ignore,no_run
10741 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10742 /// let x = ProcessRequest::new().set_labels([
10743 /// ("key0", "abc"),
10744 /// ("key1", "xyz"),
10745 /// ]);
10746 /// ```
10747 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10748 where
10749 T: std::iter::IntoIterator<Item = (K, V)>,
10750 K: std::convert::Into<std::string::String>,
10751 V: std::convert::Into<std::string::String>,
10752 {
10753 use std::iter::Iterator;
10754 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10755 self
10756 }
10757
10758 /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
10759 ///
10760 /// # Example
10761 /// ```ignore,no_run
10762 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10763 /// let x = ProcessRequest::new().set_imageless_mode(true);
10764 /// ```
10765 pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10766 self.imageless_mode = v.into();
10767 self
10768 }
10769
10770 /// Sets the value of [source][crate::model::ProcessRequest::source].
10771 ///
10772 /// Note that all the setters affecting `source` are mutually
10773 /// exclusive.
10774 ///
10775 /// # Example
10776 /// ```ignore,no_run
10777 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10778 /// use google_cloud_documentai_v1::model::Document;
10779 /// let x = ProcessRequest::new().set_source(Some(
10780 /// google_cloud_documentai_v1::model::process_request::Source::InlineDocument(Document::default().into())));
10781 /// ```
10782 pub fn set_source<
10783 T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
10784 >(
10785 mut self,
10786 v: T,
10787 ) -> Self {
10788 self.source = v.into();
10789 self
10790 }
10791
10792 /// The value of [source][crate::model::ProcessRequest::source]
10793 /// if it holds a `InlineDocument`, `None` if the field is not set or
10794 /// holds a different branch.
10795 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
10796 #[allow(unreachable_patterns)]
10797 self.source.as_ref().and_then(|v| match v {
10798 crate::model::process_request::Source::InlineDocument(v) => {
10799 std::option::Option::Some(v)
10800 }
10801 _ => std::option::Option::None,
10802 })
10803 }
10804
10805 /// Sets the value of [source][crate::model::ProcessRequest::source]
10806 /// to hold a `InlineDocument`.
10807 ///
10808 /// Note that all the setters affecting `source` are
10809 /// mutually exclusive.
10810 ///
10811 /// # Example
10812 /// ```ignore,no_run
10813 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10814 /// use google_cloud_documentai_v1::model::Document;
10815 /// let x = ProcessRequest::new().set_inline_document(Document::default()/* use setters */);
10816 /// assert!(x.inline_document().is_some());
10817 /// assert!(x.raw_document().is_none());
10818 /// assert!(x.gcs_document().is_none());
10819 /// ```
10820 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
10821 mut self,
10822 v: T,
10823 ) -> Self {
10824 self.source = std::option::Option::Some(
10825 crate::model::process_request::Source::InlineDocument(v.into()),
10826 );
10827 self
10828 }
10829
10830 /// The value of [source][crate::model::ProcessRequest::source]
10831 /// if it holds a `RawDocument`, `None` if the field is not set or
10832 /// holds a different branch.
10833 pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
10834 #[allow(unreachable_patterns)]
10835 self.source.as_ref().and_then(|v| match v {
10836 crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
10837 _ => std::option::Option::None,
10838 })
10839 }
10840
10841 /// Sets the value of [source][crate::model::ProcessRequest::source]
10842 /// to hold a `RawDocument`.
10843 ///
10844 /// Note that all the setters affecting `source` are
10845 /// mutually exclusive.
10846 ///
10847 /// # Example
10848 /// ```ignore,no_run
10849 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10850 /// use google_cloud_documentai_v1::model::RawDocument;
10851 /// let x = ProcessRequest::new().set_raw_document(RawDocument::default()/* use setters */);
10852 /// assert!(x.raw_document().is_some());
10853 /// assert!(x.inline_document().is_none());
10854 /// assert!(x.gcs_document().is_none());
10855 /// ```
10856 pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
10857 mut self,
10858 v: T,
10859 ) -> Self {
10860 self.source =
10861 std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
10862 self
10863 }
10864
10865 /// The value of [source][crate::model::ProcessRequest::source]
10866 /// if it holds a `GcsDocument`, `None` if the field is not set or
10867 /// holds a different branch.
10868 pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
10869 #[allow(unreachable_patterns)]
10870 self.source.as_ref().and_then(|v| match v {
10871 crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
10872 _ => std::option::Option::None,
10873 })
10874 }
10875
10876 /// Sets the value of [source][crate::model::ProcessRequest::source]
10877 /// to hold a `GcsDocument`.
10878 ///
10879 /// Note that all the setters affecting `source` are
10880 /// mutually exclusive.
10881 ///
10882 /// # Example
10883 /// ```ignore,no_run
10884 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10885 /// use google_cloud_documentai_v1::model::GcsDocument;
10886 /// let x = ProcessRequest::new().set_gcs_document(GcsDocument::default()/* use setters */);
10887 /// assert!(x.gcs_document().is_some());
10888 /// assert!(x.inline_document().is_none());
10889 /// assert!(x.raw_document().is_none());
10890 /// ```
10891 pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
10892 mut self,
10893 v: T,
10894 ) -> Self {
10895 self.source =
10896 std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
10897 self
10898 }
10899}
10900
10901impl wkt::message::Message for ProcessRequest {
10902 fn typename() -> &'static str {
10903 "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
10904 }
10905}
10906
10907/// Defines additional types related to [ProcessRequest].
10908pub mod process_request {
10909 #[allow(unused_imports)]
10910 use super::*;
10911
10912 /// The document payload.
10913 #[derive(Clone, Debug, PartialEq)]
10914 #[non_exhaustive]
10915 pub enum Source {
10916 /// An inline document proto.
10917 InlineDocument(std::boxed::Box<crate::model::Document>),
10918 /// A raw document content (bytes).
10919 RawDocument(std::boxed::Box<crate::model::RawDocument>),
10920 /// A raw document on Google Cloud Storage.
10921 GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
10922 }
10923}
10924
10925/// The status of human review on a processed document.
10926#[derive(Clone, Default, PartialEq)]
10927#[non_exhaustive]
10928pub struct HumanReviewStatus {
10929 /// The state of human review on the processing request.
10930 pub state: crate::model::human_review_status::State,
10931
10932 /// A message providing more details about the human review state.
10933 pub state_message: std::string::String,
10934
10935 /// The name of the operation triggered by the processed document. This field
10936 /// is populated only when the
10937 /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
10938 /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
10939 /// the long-running operation returned by
10940 /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
10941 ///
10942 /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
10943 /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
10944 pub human_review_operation: std::string::String,
10945
10946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10947}
10948
10949impl HumanReviewStatus {
10950 pub fn new() -> Self {
10951 std::default::Default::default()
10952 }
10953
10954 /// Sets the value of [state][crate::model::HumanReviewStatus::state].
10955 ///
10956 /// # Example
10957 /// ```ignore,no_run
10958 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10959 /// use google_cloud_documentai_v1::model::human_review_status::State;
10960 /// let x0 = HumanReviewStatus::new().set_state(State::Skipped);
10961 /// let x1 = HumanReviewStatus::new().set_state(State::ValidationPassed);
10962 /// let x2 = HumanReviewStatus::new().set_state(State::InProgress);
10963 /// ```
10964 pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
10965 mut self,
10966 v: T,
10967 ) -> Self {
10968 self.state = v.into();
10969 self
10970 }
10971
10972 /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
10973 ///
10974 /// # Example
10975 /// ```ignore,no_run
10976 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10977 /// let x = HumanReviewStatus::new().set_state_message("example");
10978 /// ```
10979 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10980 self.state_message = v.into();
10981 self
10982 }
10983
10984 /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
10985 ///
10986 /// # Example
10987 /// ```ignore,no_run
10988 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
10989 /// let x = HumanReviewStatus::new().set_human_review_operation("example");
10990 /// ```
10991 pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
10992 mut self,
10993 v: T,
10994 ) -> Self {
10995 self.human_review_operation = v.into();
10996 self
10997 }
10998}
10999
11000impl wkt::message::Message for HumanReviewStatus {
11001 fn typename() -> &'static str {
11002 "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
11003 }
11004}
11005
11006/// Defines additional types related to [HumanReviewStatus].
11007pub mod human_review_status {
11008 #[allow(unused_imports)]
11009 use super::*;
11010
11011 /// The final state of human review on a processed document.
11012 ///
11013 /// # Working with unknown values
11014 ///
11015 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11016 /// additional enum variants at any time. Adding new variants is not considered
11017 /// a breaking change. Applications should write their code in anticipation of:
11018 ///
11019 /// - New values appearing in future releases of the client library, **and**
11020 /// - New values received dynamically, without application changes.
11021 ///
11022 /// Please consult the [Working with enums] section in the user guide for some
11023 /// guidelines.
11024 ///
11025 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11026 #[derive(Clone, Debug, PartialEq)]
11027 #[non_exhaustive]
11028 pub enum State {
11029 /// Human review state is unspecified. Most likely due to an internal error.
11030 Unspecified,
11031 /// Human review is skipped for the document. This can happen because human
11032 /// review isn't enabled on the processor or the processing request has
11033 /// been set to skip this document.
11034 Skipped,
11035 /// Human review validation is triggered and passed, so no review is needed.
11036 ValidationPassed,
11037 /// Human review validation is triggered and the document is under review.
11038 InProgress,
11039 /// Some error happened during triggering human review, see the
11040 /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
11041 /// for details.
11042 ///
11043 /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
11044 Error,
11045 /// If set, the enum was initialized with an unknown value.
11046 ///
11047 /// Applications can examine the value using [State::value] or
11048 /// [State::name].
11049 UnknownValue(state::UnknownValue),
11050 }
11051
11052 #[doc(hidden)]
11053 pub mod state {
11054 #[allow(unused_imports)]
11055 use super::*;
11056 #[derive(Clone, Debug, PartialEq)]
11057 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11058 }
11059
11060 impl State {
11061 /// Gets the enum value.
11062 ///
11063 /// Returns `None` if the enum contains an unknown value deserialized from
11064 /// the string representation of enums.
11065 pub fn value(&self) -> std::option::Option<i32> {
11066 match self {
11067 Self::Unspecified => std::option::Option::Some(0),
11068 Self::Skipped => std::option::Option::Some(1),
11069 Self::ValidationPassed => std::option::Option::Some(2),
11070 Self::InProgress => std::option::Option::Some(3),
11071 Self::Error => std::option::Option::Some(4),
11072 Self::UnknownValue(u) => u.0.value(),
11073 }
11074 }
11075
11076 /// Gets the enum value as a string.
11077 ///
11078 /// Returns `None` if the enum contains an unknown value deserialized from
11079 /// the integer representation of enums.
11080 pub fn name(&self) -> std::option::Option<&str> {
11081 match self {
11082 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11083 Self::Skipped => std::option::Option::Some("SKIPPED"),
11084 Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
11085 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
11086 Self::Error => std::option::Option::Some("ERROR"),
11087 Self::UnknownValue(u) => u.0.name(),
11088 }
11089 }
11090 }
11091
11092 impl std::default::Default for State {
11093 fn default() -> Self {
11094 use std::convert::From;
11095 Self::from(0)
11096 }
11097 }
11098
11099 impl std::fmt::Display for State {
11100 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11101 wkt::internal::display_enum(f, self.name(), self.value())
11102 }
11103 }
11104
11105 impl std::convert::From<i32> for State {
11106 fn from(value: i32) -> Self {
11107 match value {
11108 0 => Self::Unspecified,
11109 1 => Self::Skipped,
11110 2 => Self::ValidationPassed,
11111 3 => Self::InProgress,
11112 4 => Self::Error,
11113 _ => Self::UnknownValue(state::UnknownValue(
11114 wkt::internal::UnknownEnumValue::Integer(value),
11115 )),
11116 }
11117 }
11118 }
11119
11120 impl std::convert::From<&str> for State {
11121 fn from(value: &str) -> Self {
11122 use std::string::ToString;
11123 match value {
11124 "STATE_UNSPECIFIED" => Self::Unspecified,
11125 "SKIPPED" => Self::Skipped,
11126 "VALIDATION_PASSED" => Self::ValidationPassed,
11127 "IN_PROGRESS" => Self::InProgress,
11128 "ERROR" => Self::Error,
11129 _ => Self::UnknownValue(state::UnknownValue(
11130 wkt::internal::UnknownEnumValue::String(value.to_string()),
11131 )),
11132 }
11133 }
11134 }
11135
11136 impl serde::ser::Serialize for State {
11137 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11138 where
11139 S: serde::Serializer,
11140 {
11141 match self {
11142 Self::Unspecified => serializer.serialize_i32(0),
11143 Self::Skipped => serializer.serialize_i32(1),
11144 Self::ValidationPassed => serializer.serialize_i32(2),
11145 Self::InProgress => serializer.serialize_i32(3),
11146 Self::Error => serializer.serialize_i32(4),
11147 Self::UnknownValue(u) => u.0.serialize(serializer),
11148 }
11149 }
11150 }
11151
11152 impl<'de> serde::de::Deserialize<'de> for State {
11153 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11154 where
11155 D: serde::Deserializer<'de>,
11156 {
11157 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11158 ".google.cloud.documentai.v1.HumanReviewStatus.State",
11159 ))
11160 }
11161 }
11162}
11163
11164/// Response message for the
11165/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
11166/// method.
11167///
11168/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
11169#[derive(Clone, Default, PartialEq)]
11170#[non_exhaustive]
11171pub struct ProcessResponse {
11172 /// The document payload, will populate fields based on the processor's
11173 /// behavior.
11174 pub document: std::option::Option<crate::model::Document>,
11175
11176 /// The status of human review on the processed document.
11177 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11178
11179 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11180}
11181
11182impl ProcessResponse {
11183 pub fn new() -> Self {
11184 std::default::Default::default()
11185 }
11186
11187 /// Sets the value of [document][crate::model::ProcessResponse::document].
11188 ///
11189 /// # Example
11190 /// ```ignore,no_run
11191 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11192 /// use google_cloud_documentai_v1::model::Document;
11193 /// let x = ProcessResponse::new().set_document(Document::default()/* use setters */);
11194 /// ```
11195 pub fn set_document<T>(mut self, v: T) -> Self
11196 where
11197 T: std::convert::Into<crate::model::Document>,
11198 {
11199 self.document = std::option::Option::Some(v.into());
11200 self
11201 }
11202
11203 /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
11204 ///
11205 /// # Example
11206 /// ```ignore,no_run
11207 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11208 /// use google_cloud_documentai_v1::model::Document;
11209 /// let x = ProcessResponse::new().set_or_clear_document(Some(Document::default()/* use setters */));
11210 /// let x = ProcessResponse::new().set_or_clear_document(None::<Document>);
11211 /// ```
11212 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
11213 where
11214 T: std::convert::Into<crate::model::Document>,
11215 {
11216 self.document = v.map(|x| x.into());
11217 self
11218 }
11219
11220 /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11221 ///
11222 /// # Example
11223 /// ```ignore,no_run
11224 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11225 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11226 /// let x = ProcessResponse::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11227 /// ```
11228 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11229 where
11230 T: std::convert::Into<crate::model::HumanReviewStatus>,
11231 {
11232 self.human_review_status = std::option::Option::Some(v.into());
11233 self
11234 }
11235
11236 /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11237 ///
11238 /// # Example
11239 /// ```ignore,no_run
11240 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11241 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11242 /// let x = ProcessResponse::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11243 /// let x = ProcessResponse::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11244 /// ```
11245 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11246 where
11247 T: std::convert::Into<crate::model::HumanReviewStatus>,
11248 {
11249 self.human_review_status = v.map(|x| x.into());
11250 self
11251 }
11252}
11253
11254impl wkt::message::Message for ProcessResponse {
11255 fn typename() -> &'static str {
11256 "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
11257 }
11258}
11259
11260/// Request message for
11261/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11262///
11263/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11264#[derive(Clone, Default, PartialEq)]
11265#[non_exhaustive]
11266pub struct BatchProcessRequest {
11267 /// Required. The resource name of
11268 /// [Processor][google.cloud.documentai.v1.Processor] or
11269 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
11270 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
11271 /// or
11272 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
11273 ///
11274 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
11275 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
11276 pub name: std::string::String,
11277
11278 /// The input documents for the
11279 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11280 /// method.
11281 ///
11282 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11283 pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
11284
11285 /// The output configuration for the
11286 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11287 /// method.
11288 ///
11289 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11290 pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
11291
11292 /// Whether human review should be skipped for this request. Default to
11293 /// `false`.
11294 pub skip_human_review: bool,
11295
11296 /// Inference-time options for the process API
11297 pub process_options: std::option::Option<crate::model::ProcessOptions>,
11298
11299 /// Optional. The labels with user-defined metadata for the request.
11300 ///
11301 /// Label keys and values can be no longer than 63 characters
11302 /// (Unicode codepoints) and can only contain lowercase letters, numeric
11303 /// characters, underscores, and dashes. International characters are allowed.
11304 /// Label values are optional. Label keys must start with a letter.
11305 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11306
11307 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11308}
11309
11310impl BatchProcessRequest {
11311 pub fn new() -> Self {
11312 std::default::Default::default()
11313 }
11314
11315 /// Sets the value of [name][crate::model::BatchProcessRequest::name].
11316 ///
11317 /// # Example
11318 /// ```ignore,no_run
11319 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11320 /// let x = BatchProcessRequest::new().set_name("example");
11321 /// ```
11322 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11323 self.name = v.into();
11324 self
11325 }
11326
11327 /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11328 ///
11329 /// # Example
11330 /// ```ignore,no_run
11331 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11332 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11333 /// let x = BatchProcessRequest::new().set_input_documents(BatchDocumentsInputConfig::default()/* use setters */);
11334 /// ```
11335 pub fn set_input_documents<T>(mut self, v: T) -> Self
11336 where
11337 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11338 {
11339 self.input_documents = std::option::Option::Some(v.into());
11340 self
11341 }
11342
11343 /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11344 ///
11345 /// # Example
11346 /// ```ignore,no_run
11347 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11348 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11349 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
11350 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(None::<BatchDocumentsInputConfig>);
11351 /// ```
11352 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
11353 where
11354 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11355 {
11356 self.input_documents = v.map(|x| x.into());
11357 self
11358 }
11359
11360 /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11361 ///
11362 /// # Example
11363 /// ```ignore,no_run
11364 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11365 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11366 /// let x = BatchProcessRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
11367 /// ```
11368 pub fn set_document_output_config<T>(mut self, v: T) -> Self
11369 where
11370 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11371 {
11372 self.document_output_config = std::option::Option::Some(v.into());
11373 self
11374 }
11375
11376 /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11377 ///
11378 /// # Example
11379 /// ```ignore,no_run
11380 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11381 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11382 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
11383 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
11384 /// ```
11385 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
11386 where
11387 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11388 {
11389 self.document_output_config = v.map(|x| x.into());
11390 self
11391 }
11392
11393 /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
11394 ///
11395 /// # Example
11396 /// ```ignore,no_run
11397 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11398 /// let x = BatchProcessRequest::new().set_skip_human_review(true);
11399 /// ```
11400 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11401 self.skip_human_review = v.into();
11402 self
11403 }
11404
11405 /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
11406 ///
11407 /// # Example
11408 /// ```ignore,no_run
11409 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11410 /// use google_cloud_documentai_v1::model::ProcessOptions;
11411 /// let x = BatchProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
11412 /// ```
11413 pub fn set_process_options<T>(mut self, v: T) -> Self
11414 where
11415 T: std::convert::Into<crate::model::ProcessOptions>,
11416 {
11417 self.process_options = std::option::Option::Some(v.into());
11418 self
11419 }
11420
11421 /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
11422 ///
11423 /// # Example
11424 /// ```ignore,no_run
11425 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11426 /// use google_cloud_documentai_v1::model::ProcessOptions;
11427 /// let x = BatchProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
11428 /// let x = BatchProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
11429 /// ```
11430 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
11431 where
11432 T: std::convert::Into<crate::model::ProcessOptions>,
11433 {
11434 self.process_options = v.map(|x| x.into());
11435 self
11436 }
11437
11438 /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
11439 ///
11440 /// # Example
11441 /// ```ignore,no_run
11442 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11443 /// let x = BatchProcessRequest::new().set_labels([
11444 /// ("key0", "abc"),
11445 /// ("key1", "xyz"),
11446 /// ]);
11447 /// ```
11448 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11449 where
11450 T: std::iter::IntoIterator<Item = (K, V)>,
11451 K: std::convert::Into<std::string::String>,
11452 V: std::convert::Into<std::string::String>,
11453 {
11454 use std::iter::Iterator;
11455 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11456 self
11457 }
11458}
11459
11460impl wkt::message::Message for BatchProcessRequest {
11461 fn typename() -> &'static str {
11462 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
11463 }
11464}
11465
11466/// Response message for
11467/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11468///
11469/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11470#[derive(Clone, Default, PartialEq)]
11471#[non_exhaustive]
11472pub struct BatchProcessResponse {
11473 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11474}
11475
11476impl BatchProcessResponse {
11477 pub fn new() -> Self {
11478 std::default::Default::default()
11479 }
11480}
11481
11482impl wkt::message::Message for BatchProcessResponse {
11483 fn typename() -> &'static str {
11484 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
11485 }
11486}
11487
11488/// The long-running operation metadata for
11489/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11490///
11491/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11492#[derive(Clone, Default, PartialEq)]
11493#[non_exhaustive]
11494pub struct BatchProcessMetadata {
11495 /// The state of the current batch processing.
11496 pub state: crate::model::batch_process_metadata::State,
11497
11498 /// A message providing more details about the current state of processing.
11499 /// For example, the error message if the operation is failed.
11500 pub state_message: std::string::String,
11501
11502 /// The creation time of the operation.
11503 pub create_time: std::option::Option<wkt::Timestamp>,
11504
11505 /// The last update time of the operation.
11506 pub update_time: std::option::Option<wkt::Timestamp>,
11507
11508 /// The list of response details of each document.
11509 pub individual_process_statuses:
11510 std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
11511
11512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11513}
11514
11515impl BatchProcessMetadata {
11516 pub fn new() -> Self {
11517 std::default::Default::default()
11518 }
11519
11520 /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
11521 ///
11522 /// # Example
11523 /// ```ignore,no_run
11524 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11525 /// use google_cloud_documentai_v1::model::batch_process_metadata::State;
11526 /// let x0 = BatchProcessMetadata::new().set_state(State::Waiting);
11527 /// let x1 = BatchProcessMetadata::new().set_state(State::Running);
11528 /// let x2 = BatchProcessMetadata::new().set_state(State::Succeeded);
11529 /// ```
11530 pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
11531 mut self,
11532 v: T,
11533 ) -> Self {
11534 self.state = v.into();
11535 self
11536 }
11537
11538 /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
11539 ///
11540 /// # Example
11541 /// ```ignore,no_run
11542 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11543 /// let x = BatchProcessMetadata::new().set_state_message("example");
11544 /// ```
11545 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11546 self.state_message = v.into();
11547 self
11548 }
11549
11550 /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11551 ///
11552 /// # Example
11553 /// ```ignore,no_run
11554 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11555 /// use wkt::Timestamp;
11556 /// let x = BatchProcessMetadata::new().set_create_time(Timestamp::default()/* use setters */);
11557 /// ```
11558 pub fn set_create_time<T>(mut self, v: T) -> Self
11559 where
11560 T: std::convert::Into<wkt::Timestamp>,
11561 {
11562 self.create_time = std::option::Option::Some(v.into());
11563 self
11564 }
11565
11566 /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11567 ///
11568 /// # Example
11569 /// ```ignore,no_run
11570 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11571 /// use wkt::Timestamp;
11572 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11573 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(None::<Timestamp>);
11574 /// ```
11575 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11576 where
11577 T: std::convert::Into<wkt::Timestamp>,
11578 {
11579 self.create_time = v.map(|x| x.into());
11580 self
11581 }
11582
11583 /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11584 ///
11585 /// # Example
11586 /// ```ignore,no_run
11587 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11588 /// use wkt::Timestamp;
11589 /// let x = BatchProcessMetadata::new().set_update_time(Timestamp::default()/* use setters */);
11590 /// ```
11591 pub fn set_update_time<T>(mut self, v: T) -> Self
11592 where
11593 T: std::convert::Into<wkt::Timestamp>,
11594 {
11595 self.update_time = std::option::Option::Some(v.into());
11596 self
11597 }
11598
11599 /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11600 ///
11601 /// # Example
11602 /// ```ignore,no_run
11603 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11604 /// use wkt::Timestamp;
11605 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11606 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(None::<Timestamp>);
11607 /// ```
11608 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11609 where
11610 T: std::convert::Into<wkt::Timestamp>,
11611 {
11612 self.update_time = v.map(|x| x.into());
11613 self
11614 }
11615
11616 /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
11617 ///
11618 /// # Example
11619 /// ```ignore,no_run
11620 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11621 /// use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11622 /// let x = BatchProcessMetadata::new()
11623 /// .set_individual_process_statuses([
11624 /// IndividualProcessStatus::default()/* use setters */,
11625 /// IndividualProcessStatus::default()/* use (different) setters */,
11626 /// ]);
11627 /// ```
11628 pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
11629 where
11630 T: std::iter::IntoIterator<Item = V>,
11631 V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
11632 {
11633 use std::iter::Iterator;
11634 self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
11635 self
11636 }
11637}
11638
11639impl wkt::message::Message for BatchProcessMetadata {
11640 fn typename() -> &'static str {
11641 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
11642 }
11643}
11644
11645/// Defines additional types related to [BatchProcessMetadata].
11646pub mod batch_process_metadata {
11647 #[allow(unused_imports)]
11648 use super::*;
11649
11650 /// The status of a each individual document in the batch process.
11651 #[derive(Clone, Default, PartialEq)]
11652 #[non_exhaustive]
11653 pub struct IndividualProcessStatus {
11654 /// The source of the document, same as the
11655 /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
11656 /// field in the request when the batch process started.
11657 ///
11658 /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
11659 pub input_gcs_source: std::string::String,
11660
11661 /// The status processing the document.
11662 pub status: std::option::Option<google_cloud_rpc::model::Status>,
11663
11664 /// The Cloud Storage output destination (in the request as
11665 /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
11666 /// of the processed document if it was successful, otherwise empty.
11667 ///
11668 /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
11669 pub output_gcs_destination: std::string::String,
11670
11671 /// The status of human review on the processed document.
11672 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11673
11674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11675 }
11676
11677 impl IndividualProcessStatus {
11678 pub fn new() -> Self {
11679 std::default::Default::default()
11680 }
11681
11682 /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
11683 ///
11684 /// # Example
11685 /// ```ignore,no_run
11686 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11687 /// let x = IndividualProcessStatus::new().set_input_gcs_source("example");
11688 /// ```
11689 pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
11690 mut self,
11691 v: T,
11692 ) -> Self {
11693 self.input_gcs_source = v.into();
11694 self
11695 }
11696
11697 /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11698 ///
11699 /// # Example
11700 /// ```ignore,no_run
11701 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11702 /// use google_cloud_rpc::model::Status;
11703 /// let x = IndividualProcessStatus::new().set_status(Status::default()/* use setters */);
11704 /// ```
11705 pub fn set_status<T>(mut self, v: T) -> Self
11706 where
11707 T: std::convert::Into<google_cloud_rpc::model::Status>,
11708 {
11709 self.status = std::option::Option::Some(v.into());
11710 self
11711 }
11712
11713 /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11714 ///
11715 /// # Example
11716 /// ```ignore,no_run
11717 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11718 /// use google_cloud_rpc::model::Status;
11719 /// let x = IndividualProcessStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
11720 /// let x = IndividualProcessStatus::new().set_or_clear_status(None::<Status>);
11721 /// ```
11722 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
11723 where
11724 T: std::convert::Into<google_cloud_rpc::model::Status>,
11725 {
11726 self.status = v.map(|x| x.into());
11727 self
11728 }
11729
11730 /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
11731 ///
11732 /// # Example
11733 /// ```ignore,no_run
11734 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11735 /// let x = IndividualProcessStatus::new().set_output_gcs_destination("example");
11736 /// ```
11737 pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
11738 mut self,
11739 v: T,
11740 ) -> Self {
11741 self.output_gcs_destination = v.into();
11742 self
11743 }
11744
11745 /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11746 ///
11747 /// # Example
11748 /// ```ignore,no_run
11749 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11750 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11751 /// let x = IndividualProcessStatus::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11752 /// ```
11753 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11754 where
11755 T: std::convert::Into<crate::model::HumanReviewStatus>,
11756 {
11757 self.human_review_status = std::option::Option::Some(v.into());
11758 self
11759 }
11760
11761 /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11762 ///
11763 /// # Example
11764 /// ```ignore,no_run
11765 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11766 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11767 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11768 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11769 /// ```
11770 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11771 where
11772 T: std::convert::Into<crate::model::HumanReviewStatus>,
11773 {
11774 self.human_review_status = v.map(|x| x.into());
11775 self
11776 }
11777 }
11778
11779 impl wkt::message::Message for IndividualProcessStatus {
11780 fn typename() -> &'static str {
11781 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
11782 }
11783 }
11784
11785 /// Possible states of the batch processing operation.
11786 ///
11787 /// # Working with unknown values
11788 ///
11789 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11790 /// additional enum variants at any time. Adding new variants is not considered
11791 /// a breaking change. Applications should write their code in anticipation of:
11792 ///
11793 /// - New values appearing in future releases of the client library, **and**
11794 /// - New values received dynamically, without application changes.
11795 ///
11796 /// Please consult the [Working with enums] section in the user guide for some
11797 /// guidelines.
11798 ///
11799 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11800 #[derive(Clone, Debug, PartialEq)]
11801 #[non_exhaustive]
11802 pub enum State {
11803 /// The default value. This value is used if the state is omitted.
11804 Unspecified,
11805 /// Request operation is waiting for scheduling.
11806 Waiting,
11807 /// Request is being processed.
11808 Running,
11809 /// The batch processing completed successfully.
11810 Succeeded,
11811 /// The batch processing was being cancelled.
11812 Cancelling,
11813 /// The batch processing was cancelled.
11814 Cancelled,
11815 /// The batch processing has failed.
11816 Failed,
11817 /// If set, the enum was initialized with an unknown value.
11818 ///
11819 /// Applications can examine the value using [State::value] or
11820 /// [State::name].
11821 UnknownValue(state::UnknownValue),
11822 }
11823
11824 #[doc(hidden)]
11825 pub mod state {
11826 #[allow(unused_imports)]
11827 use super::*;
11828 #[derive(Clone, Debug, PartialEq)]
11829 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11830 }
11831
11832 impl State {
11833 /// Gets the enum value.
11834 ///
11835 /// Returns `None` if the enum contains an unknown value deserialized from
11836 /// the string representation of enums.
11837 pub fn value(&self) -> std::option::Option<i32> {
11838 match self {
11839 Self::Unspecified => std::option::Option::Some(0),
11840 Self::Waiting => std::option::Option::Some(1),
11841 Self::Running => std::option::Option::Some(2),
11842 Self::Succeeded => std::option::Option::Some(3),
11843 Self::Cancelling => std::option::Option::Some(4),
11844 Self::Cancelled => std::option::Option::Some(5),
11845 Self::Failed => std::option::Option::Some(6),
11846 Self::UnknownValue(u) => u.0.value(),
11847 }
11848 }
11849
11850 /// Gets the enum value as a string.
11851 ///
11852 /// Returns `None` if the enum contains an unknown value deserialized from
11853 /// the integer representation of enums.
11854 pub fn name(&self) -> std::option::Option<&str> {
11855 match self {
11856 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11857 Self::Waiting => std::option::Option::Some("WAITING"),
11858 Self::Running => std::option::Option::Some("RUNNING"),
11859 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
11860 Self::Cancelling => std::option::Option::Some("CANCELLING"),
11861 Self::Cancelled => std::option::Option::Some("CANCELLED"),
11862 Self::Failed => std::option::Option::Some("FAILED"),
11863 Self::UnknownValue(u) => u.0.name(),
11864 }
11865 }
11866 }
11867
11868 impl std::default::Default for State {
11869 fn default() -> Self {
11870 use std::convert::From;
11871 Self::from(0)
11872 }
11873 }
11874
11875 impl std::fmt::Display for State {
11876 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11877 wkt::internal::display_enum(f, self.name(), self.value())
11878 }
11879 }
11880
11881 impl std::convert::From<i32> for State {
11882 fn from(value: i32) -> Self {
11883 match value {
11884 0 => Self::Unspecified,
11885 1 => Self::Waiting,
11886 2 => Self::Running,
11887 3 => Self::Succeeded,
11888 4 => Self::Cancelling,
11889 5 => Self::Cancelled,
11890 6 => Self::Failed,
11891 _ => Self::UnknownValue(state::UnknownValue(
11892 wkt::internal::UnknownEnumValue::Integer(value),
11893 )),
11894 }
11895 }
11896 }
11897
11898 impl std::convert::From<&str> for State {
11899 fn from(value: &str) -> Self {
11900 use std::string::ToString;
11901 match value {
11902 "STATE_UNSPECIFIED" => Self::Unspecified,
11903 "WAITING" => Self::Waiting,
11904 "RUNNING" => Self::Running,
11905 "SUCCEEDED" => Self::Succeeded,
11906 "CANCELLING" => Self::Cancelling,
11907 "CANCELLED" => Self::Cancelled,
11908 "FAILED" => Self::Failed,
11909 _ => Self::UnknownValue(state::UnknownValue(
11910 wkt::internal::UnknownEnumValue::String(value.to_string()),
11911 )),
11912 }
11913 }
11914 }
11915
11916 impl serde::ser::Serialize for State {
11917 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11918 where
11919 S: serde::Serializer,
11920 {
11921 match self {
11922 Self::Unspecified => serializer.serialize_i32(0),
11923 Self::Waiting => serializer.serialize_i32(1),
11924 Self::Running => serializer.serialize_i32(2),
11925 Self::Succeeded => serializer.serialize_i32(3),
11926 Self::Cancelling => serializer.serialize_i32(4),
11927 Self::Cancelled => serializer.serialize_i32(5),
11928 Self::Failed => serializer.serialize_i32(6),
11929 Self::UnknownValue(u) => u.0.serialize(serializer),
11930 }
11931 }
11932 }
11933
11934 impl<'de> serde::de::Deserialize<'de> for State {
11935 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11936 where
11937 D: serde::Deserializer<'de>,
11938 {
11939 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11940 ".google.cloud.documentai.v1.BatchProcessMetadata.State",
11941 ))
11942 }
11943 }
11944}
11945
11946/// Request message for the
11947/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
11948/// method. Some processor types may require the project be added to an
11949/// allowlist.
11950///
11951/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
11952#[derive(Clone, Default, PartialEq)]
11953#[non_exhaustive]
11954pub struct FetchProcessorTypesRequest {
11955 /// Required. The location of processor types to list.
11956 /// Format: `projects/{project}/locations/{location}`.
11957 pub parent: std::string::String,
11958
11959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11960}
11961
11962impl FetchProcessorTypesRequest {
11963 pub fn new() -> Self {
11964 std::default::Default::default()
11965 }
11966
11967 /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
11968 ///
11969 /// # Example
11970 /// ```ignore,no_run
11971 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesRequest;
11972 /// let x = FetchProcessorTypesRequest::new().set_parent("example");
11973 /// ```
11974 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11975 self.parent = v.into();
11976 self
11977 }
11978}
11979
11980impl wkt::message::Message for FetchProcessorTypesRequest {
11981 fn typename() -> &'static str {
11982 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
11983 }
11984}
11985
11986/// Response message for the
11987/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
11988/// method.
11989///
11990/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
11991#[derive(Clone, Default, PartialEq)]
11992#[non_exhaustive]
11993pub struct FetchProcessorTypesResponse {
11994 /// The list of processor types.
11995 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
11996
11997 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11998}
11999
12000impl FetchProcessorTypesResponse {
12001 pub fn new() -> Self {
12002 std::default::Default::default()
12003 }
12004
12005 /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
12006 ///
12007 /// # Example
12008 /// ```ignore,no_run
12009 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesResponse;
12010 /// use google_cloud_documentai_v1::model::ProcessorType;
12011 /// let x = FetchProcessorTypesResponse::new()
12012 /// .set_processor_types([
12013 /// ProcessorType::default()/* use setters */,
12014 /// ProcessorType::default()/* use (different) setters */,
12015 /// ]);
12016 /// ```
12017 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12018 where
12019 T: std::iter::IntoIterator<Item = V>,
12020 V: std::convert::Into<crate::model::ProcessorType>,
12021 {
12022 use std::iter::Iterator;
12023 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12024 self
12025 }
12026}
12027
12028impl wkt::message::Message for FetchProcessorTypesResponse {
12029 fn typename() -> &'static str {
12030 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
12031 }
12032}
12033
12034/// Request message for the
12035/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12036/// method. Some processor types may require the project be added to an
12037/// allowlist.
12038///
12039/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12040#[derive(Clone, Default, PartialEq)]
12041#[non_exhaustive]
12042pub struct ListProcessorTypesRequest {
12043 /// Required. The location of processor types to list.
12044 /// Format: `projects/{project}/locations/{location}`.
12045 pub parent: std::string::String,
12046
12047 /// The maximum number of processor types to return.
12048 /// If unspecified, at most `100` processor types will be returned.
12049 /// The maximum value is `500`. Values above `500` will be coerced to `500`.
12050 pub page_size: i32,
12051
12052 /// Used to retrieve the next page of results, empty if at the end of the list.
12053 pub page_token: std::string::String,
12054
12055 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12056}
12057
12058impl ListProcessorTypesRequest {
12059 pub fn new() -> Self {
12060 std::default::Default::default()
12061 }
12062
12063 /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
12064 ///
12065 /// # Example
12066 /// ```ignore,no_run
12067 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12068 /// let x = ListProcessorTypesRequest::new().set_parent("example");
12069 /// ```
12070 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12071 self.parent = v.into();
12072 self
12073 }
12074
12075 /// Sets the value of [page_size][crate::model::ListProcessorTypesRequest::page_size].
12076 ///
12077 /// # Example
12078 /// ```ignore,no_run
12079 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12080 /// let x = ListProcessorTypesRequest::new().set_page_size(42);
12081 /// ```
12082 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12083 self.page_size = v.into();
12084 self
12085 }
12086
12087 /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
12088 ///
12089 /// # Example
12090 /// ```ignore,no_run
12091 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12092 /// let x = ListProcessorTypesRequest::new().set_page_token("example");
12093 /// ```
12094 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12095 self.page_token = v.into();
12096 self
12097 }
12098}
12099
12100impl wkt::message::Message for ListProcessorTypesRequest {
12101 fn typename() -> &'static str {
12102 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
12103 }
12104}
12105
12106/// Response message for the
12107/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12108/// method.
12109///
12110/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12111#[derive(Clone, Default, PartialEq)]
12112#[non_exhaustive]
12113pub struct ListProcessorTypesResponse {
12114 /// The processor types.
12115 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12116
12117 /// Points to the next page, otherwise empty.
12118 pub next_page_token: std::string::String,
12119
12120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12121}
12122
12123impl ListProcessorTypesResponse {
12124 pub fn new() -> Self {
12125 std::default::Default::default()
12126 }
12127
12128 /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
12129 ///
12130 /// # Example
12131 /// ```ignore,no_run
12132 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12133 /// use google_cloud_documentai_v1::model::ProcessorType;
12134 /// let x = ListProcessorTypesResponse::new()
12135 /// .set_processor_types([
12136 /// ProcessorType::default()/* use setters */,
12137 /// ProcessorType::default()/* use (different) setters */,
12138 /// ]);
12139 /// ```
12140 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12141 where
12142 T: std::iter::IntoIterator<Item = V>,
12143 V: std::convert::Into<crate::model::ProcessorType>,
12144 {
12145 use std::iter::Iterator;
12146 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12147 self
12148 }
12149
12150 /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
12151 ///
12152 /// # Example
12153 /// ```ignore,no_run
12154 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12155 /// let x = ListProcessorTypesResponse::new().set_next_page_token("example");
12156 /// ```
12157 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12158 self.next_page_token = v.into();
12159 self
12160 }
12161}
12162
12163impl wkt::message::Message for ListProcessorTypesResponse {
12164 fn typename() -> &'static str {
12165 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
12166 }
12167}
12168
12169#[doc(hidden)]
12170impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
12171 type PageItem = crate::model::ProcessorType;
12172
12173 fn items(self) -> std::vec::Vec<Self::PageItem> {
12174 self.processor_types
12175 }
12176
12177 fn next_page_token(&self) -> std::string::String {
12178 use std::clone::Clone;
12179 self.next_page_token.clone()
12180 }
12181}
12182
12183/// Request message for list all processors belongs to a project.
12184#[derive(Clone, Default, PartialEq)]
12185#[non_exhaustive]
12186pub struct ListProcessorsRequest {
12187 /// Required. The parent (project and location) which owns this collection of
12188 /// Processors. Format: `projects/{project}/locations/{location}`
12189 pub parent: std::string::String,
12190
12191 /// The maximum number of processors to return.
12192 /// If unspecified, at most `50` processors will be returned.
12193 /// The maximum value is `100`. Values above `100` will be coerced to `100`.
12194 pub page_size: i32,
12195
12196 /// We will return the processors sorted by creation time. The page token
12197 /// will point to the next processor.
12198 pub page_token: std::string::String,
12199
12200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12201}
12202
12203impl ListProcessorsRequest {
12204 pub fn new() -> Self {
12205 std::default::Default::default()
12206 }
12207
12208 /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
12209 ///
12210 /// # Example
12211 /// ```ignore,no_run
12212 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12213 /// let x = ListProcessorsRequest::new().set_parent("example");
12214 /// ```
12215 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12216 self.parent = v.into();
12217 self
12218 }
12219
12220 /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
12221 ///
12222 /// # Example
12223 /// ```ignore,no_run
12224 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12225 /// let x = ListProcessorsRequest::new().set_page_size(42);
12226 /// ```
12227 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12228 self.page_size = v.into();
12229 self
12230 }
12231
12232 /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
12233 ///
12234 /// # Example
12235 /// ```ignore,no_run
12236 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12237 /// let x = ListProcessorsRequest::new().set_page_token("example");
12238 /// ```
12239 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12240 self.page_token = v.into();
12241 self
12242 }
12243}
12244
12245impl wkt::message::Message for ListProcessorsRequest {
12246 fn typename() -> &'static str {
12247 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
12248 }
12249}
12250
12251/// Response message for the
12252/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
12253/// method.
12254///
12255/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
12256#[derive(Clone, Default, PartialEq)]
12257#[non_exhaustive]
12258pub struct ListProcessorsResponse {
12259 /// The list of processors.
12260 pub processors: std::vec::Vec<crate::model::Processor>,
12261
12262 /// Points to the next processor, otherwise empty.
12263 pub next_page_token: std::string::String,
12264
12265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12266}
12267
12268impl ListProcessorsResponse {
12269 pub fn new() -> Self {
12270 std::default::Default::default()
12271 }
12272
12273 /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
12274 ///
12275 /// # Example
12276 /// ```ignore,no_run
12277 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12278 /// use google_cloud_documentai_v1::model::Processor;
12279 /// let x = ListProcessorsResponse::new()
12280 /// .set_processors([
12281 /// Processor::default()/* use setters */,
12282 /// Processor::default()/* use (different) setters */,
12283 /// ]);
12284 /// ```
12285 pub fn set_processors<T, V>(mut self, v: T) -> Self
12286 where
12287 T: std::iter::IntoIterator<Item = V>,
12288 V: std::convert::Into<crate::model::Processor>,
12289 {
12290 use std::iter::Iterator;
12291 self.processors = v.into_iter().map(|i| i.into()).collect();
12292 self
12293 }
12294
12295 /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
12296 ///
12297 /// # Example
12298 /// ```ignore,no_run
12299 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12300 /// let x = ListProcessorsResponse::new().set_next_page_token("example");
12301 /// ```
12302 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12303 self.next_page_token = v.into();
12304 self
12305 }
12306}
12307
12308impl wkt::message::Message for ListProcessorsResponse {
12309 fn typename() -> &'static str {
12310 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
12311 }
12312}
12313
12314#[doc(hidden)]
12315impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorsResponse {
12316 type PageItem = crate::model::Processor;
12317
12318 fn items(self) -> std::vec::Vec<Self::PageItem> {
12319 self.processors
12320 }
12321
12322 fn next_page_token(&self) -> std::string::String {
12323 use std::clone::Clone;
12324 self.next_page_token.clone()
12325 }
12326}
12327
12328/// Request message for the
12329/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
12330/// method.
12331///
12332/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
12333#[derive(Clone, Default, PartialEq)]
12334#[non_exhaustive]
12335pub struct GetProcessorTypeRequest {
12336 /// Required. The processor type resource name.
12337 pub name: std::string::String,
12338
12339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12340}
12341
12342impl GetProcessorTypeRequest {
12343 pub fn new() -> Self {
12344 std::default::Default::default()
12345 }
12346
12347 /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
12348 ///
12349 /// # Example
12350 /// ```ignore,no_run
12351 /// # use google_cloud_documentai_v1::model::GetProcessorTypeRequest;
12352 /// let x = GetProcessorTypeRequest::new().set_name("example");
12353 /// ```
12354 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12355 self.name = v.into();
12356 self
12357 }
12358}
12359
12360impl wkt::message::Message for GetProcessorTypeRequest {
12361 fn typename() -> &'static str {
12362 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
12363 }
12364}
12365
12366/// Request message for the
12367/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
12368/// method.
12369///
12370/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
12371#[derive(Clone, Default, PartialEq)]
12372#[non_exhaustive]
12373pub struct GetProcessorRequest {
12374 /// Required. The processor resource name.
12375 pub name: std::string::String,
12376
12377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12378}
12379
12380impl GetProcessorRequest {
12381 pub fn new() -> Self {
12382 std::default::Default::default()
12383 }
12384
12385 /// Sets the value of [name][crate::model::GetProcessorRequest::name].
12386 ///
12387 /// # Example
12388 /// ```ignore,no_run
12389 /// # use google_cloud_documentai_v1::model::GetProcessorRequest;
12390 /// let x = GetProcessorRequest::new().set_name("example");
12391 /// ```
12392 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12393 self.name = v.into();
12394 self
12395 }
12396}
12397
12398impl wkt::message::Message for GetProcessorRequest {
12399 fn typename() -> &'static str {
12400 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
12401 }
12402}
12403
12404/// Request message for the
12405/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
12406/// method.
12407///
12408/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
12409#[derive(Clone, Default, PartialEq)]
12410#[non_exhaustive]
12411pub struct GetProcessorVersionRequest {
12412 /// Required. The processor resource name.
12413 pub name: std::string::String,
12414
12415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12416}
12417
12418impl GetProcessorVersionRequest {
12419 pub fn new() -> Self {
12420 std::default::Default::default()
12421 }
12422
12423 /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
12424 ///
12425 /// # Example
12426 /// ```ignore,no_run
12427 /// # use google_cloud_documentai_v1::model::GetProcessorVersionRequest;
12428 /// let x = GetProcessorVersionRequest::new().set_name("example");
12429 /// ```
12430 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12431 self.name = v.into();
12432 self
12433 }
12434}
12435
12436impl wkt::message::Message for GetProcessorVersionRequest {
12437 fn typename() -> &'static str {
12438 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
12439 }
12440}
12441
12442/// Request message for list all processor versions belongs to a processor.
12443#[derive(Clone, Default, PartialEq)]
12444#[non_exhaustive]
12445pub struct ListProcessorVersionsRequest {
12446 /// Required. The parent (project, location and processor) to list all
12447 /// versions. Format:
12448 /// `projects/{project}/locations/{location}/processors/{processor}`
12449 pub parent: std::string::String,
12450
12451 /// The maximum number of processor versions to return.
12452 /// If unspecified, at most `10` processor versions will be returned.
12453 /// The maximum value is `20`. Values above `20` will be coerced to `20`.
12454 pub page_size: i32,
12455
12456 /// We will return the processor versions sorted by creation time. The page
12457 /// token will point to the next processor version.
12458 pub page_token: std::string::String,
12459
12460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12461}
12462
12463impl ListProcessorVersionsRequest {
12464 pub fn new() -> Self {
12465 std::default::Default::default()
12466 }
12467
12468 /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
12469 ///
12470 /// # Example
12471 /// ```ignore,no_run
12472 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12473 /// let x = ListProcessorVersionsRequest::new().set_parent("example");
12474 /// ```
12475 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12476 self.parent = v.into();
12477 self
12478 }
12479
12480 /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
12481 ///
12482 /// # Example
12483 /// ```ignore,no_run
12484 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12485 /// let x = ListProcessorVersionsRequest::new().set_page_size(42);
12486 /// ```
12487 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12488 self.page_size = v.into();
12489 self
12490 }
12491
12492 /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
12493 ///
12494 /// # Example
12495 /// ```ignore,no_run
12496 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12497 /// let x = ListProcessorVersionsRequest::new().set_page_token("example");
12498 /// ```
12499 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12500 self.page_token = v.into();
12501 self
12502 }
12503}
12504
12505impl wkt::message::Message for ListProcessorVersionsRequest {
12506 fn typename() -> &'static str {
12507 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
12508 }
12509}
12510
12511/// Response message for the
12512/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
12513/// method.
12514///
12515/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
12516#[derive(Clone, Default, PartialEq)]
12517#[non_exhaustive]
12518pub struct ListProcessorVersionsResponse {
12519 /// The list of processors.
12520 pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
12521
12522 /// Points to the next processor, otherwise empty.
12523 pub next_page_token: std::string::String,
12524
12525 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12526}
12527
12528impl ListProcessorVersionsResponse {
12529 pub fn new() -> Self {
12530 std::default::Default::default()
12531 }
12532
12533 /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
12534 ///
12535 /// # Example
12536 /// ```ignore,no_run
12537 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12538 /// use google_cloud_documentai_v1::model::ProcessorVersion;
12539 /// let x = ListProcessorVersionsResponse::new()
12540 /// .set_processor_versions([
12541 /// ProcessorVersion::default()/* use setters */,
12542 /// ProcessorVersion::default()/* use (different) setters */,
12543 /// ]);
12544 /// ```
12545 pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
12546 where
12547 T: std::iter::IntoIterator<Item = V>,
12548 V: std::convert::Into<crate::model::ProcessorVersion>,
12549 {
12550 use std::iter::Iterator;
12551 self.processor_versions = v.into_iter().map(|i| i.into()).collect();
12552 self
12553 }
12554
12555 /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
12556 ///
12557 /// # Example
12558 /// ```ignore,no_run
12559 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12560 /// let x = ListProcessorVersionsResponse::new().set_next_page_token("example");
12561 /// ```
12562 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12563 self.next_page_token = v.into();
12564 self
12565 }
12566}
12567
12568impl wkt::message::Message for ListProcessorVersionsResponse {
12569 fn typename() -> &'static str {
12570 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
12571 }
12572}
12573
12574#[doc(hidden)]
12575impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
12576 type PageItem = crate::model::ProcessorVersion;
12577
12578 fn items(self) -> std::vec::Vec<Self::PageItem> {
12579 self.processor_versions
12580 }
12581
12582 fn next_page_token(&self) -> std::string::String {
12583 use std::clone::Clone;
12584 self.next_page_token.clone()
12585 }
12586}
12587
12588/// Request message for the
12589/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12590/// method.
12591///
12592/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12593#[derive(Clone, Default, PartialEq)]
12594#[non_exhaustive]
12595pub struct DeleteProcessorVersionRequest {
12596 /// Required. The processor version resource name to be deleted.
12597 pub name: std::string::String,
12598
12599 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12600}
12601
12602impl DeleteProcessorVersionRequest {
12603 pub fn new() -> Self {
12604 std::default::Default::default()
12605 }
12606
12607 /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
12608 ///
12609 /// # Example
12610 /// ```ignore,no_run
12611 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionRequest;
12612 /// let x = DeleteProcessorVersionRequest::new().set_name("example");
12613 /// ```
12614 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12615 self.name = v.into();
12616 self
12617 }
12618}
12619
12620impl wkt::message::Message for DeleteProcessorVersionRequest {
12621 fn typename() -> &'static str {
12622 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
12623 }
12624}
12625
12626/// The long-running operation metadata for the
12627/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12628/// method.
12629///
12630/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12631#[derive(Clone, Default, PartialEq)]
12632#[non_exhaustive]
12633pub struct DeleteProcessorVersionMetadata {
12634 /// The basic metadata of the long-running operation.
12635 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12636
12637 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12638}
12639
12640impl DeleteProcessorVersionMetadata {
12641 pub fn new() -> Self {
12642 std::default::Default::default()
12643 }
12644
12645 /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12646 ///
12647 /// # Example
12648 /// ```ignore,no_run
12649 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12650 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12651 /// let x = DeleteProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12652 /// ```
12653 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12654 where
12655 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12656 {
12657 self.common_metadata = std::option::Option::Some(v.into());
12658 self
12659 }
12660
12661 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12662 ///
12663 /// # Example
12664 /// ```ignore,no_run
12665 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12666 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12667 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12668 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12669 /// ```
12670 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12671 where
12672 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12673 {
12674 self.common_metadata = v.map(|x| x.into());
12675 self
12676 }
12677}
12678
12679impl wkt::message::Message for DeleteProcessorVersionMetadata {
12680 fn typename() -> &'static str {
12681 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
12682 }
12683}
12684
12685/// Request message for the
12686/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12687/// method.
12688///
12689/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12690#[derive(Clone, Default, PartialEq)]
12691#[non_exhaustive]
12692pub struct DeployProcessorVersionRequest {
12693 /// Required. The processor version resource name to be deployed.
12694 pub name: std::string::String,
12695
12696 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12697}
12698
12699impl DeployProcessorVersionRequest {
12700 pub fn new() -> Self {
12701 std::default::Default::default()
12702 }
12703
12704 /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
12705 ///
12706 /// # Example
12707 /// ```ignore,no_run
12708 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionRequest;
12709 /// let x = DeployProcessorVersionRequest::new().set_name("example");
12710 /// ```
12711 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12712 self.name = v.into();
12713 self
12714 }
12715}
12716
12717impl wkt::message::Message for DeployProcessorVersionRequest {
12718 fn typename() -> &'static str {
12719 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
12720 }
12721}
12722
12723/// Response message for the
12724/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12725/// method.
12726///
12727/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12728#[derive(Clone, Default, PartialEq)]
12729#[non_exhaustive]
12730pub struct DeployProcessorVersionResponse {
12731 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12732}
12733
12734impl DeployProcessorVersionResponse {
12735 pub fn new() -> Self {
12736 std::default::Default::default()
12737 }
12738}
12739
12740impl wkt::message::Message for DeployProcessorVersionResponse {
12741 fn typename() -> &'static str {
12742 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
12743 }
12744}
12745
12746/// The long-running operation metadata for the
12747/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12748/// method.
12749///
12750/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12751#[derive(Clone, Default, PartialEq)]
12752#[non_exhaustive]
12753pub struct DeployProcessorVersionMetadata {
12754 /// The basic metadata of the long-running operation.
12755 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12756
12757 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12758}
12759
12760impl DeployProcessorVersionMetadata {
12761 pub fn new() -> Self {
12762 std::default::Default::default()
12763 }
12764
12765 /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12766 ///
12767 /// # Example
12768 /// ```ignore,no_run
12769 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12770 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12771 /// let x = DeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12772 /// ```
12773 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12774 where
12775 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12776 {
12777 self.common_metadata = std::option::Option::Some(v.into());
12778 self
12779 }
12780
12781 /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12782 ///
12783 /// # Example
12784 /// ```ignore,no_run
12785 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12786 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12787 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12788 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12789 /// ```
12790 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12791 where
12792 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12793 {
12794 self.common_metadata = v.map(|x| x.into());
12795 self
12796 }
12797}
12798
12799impl wkt::message::Message for DeployProcessorVersionMetadata {
12800 fn typename() -> &'static str {
12801 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
12802 }
12803}
12804
12805/// Request message for the
12806/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12807/// method.
12808///
12809/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12810#[derive(Clone, Default, PartialEq)]
12811#[non_exhaustive]
12812pub struct UndeployProcessorVersionRequest {
12813 /// Required. The processor version resource name to be undeployed.
12814 pub name: std::string::String,
12815
12816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12817}
12818
12819impl UndeployProcessorVersionRequest {
12820 pub fn new() -> Self {
12821 std::default::Default::default()
12822 }
12823
12824 /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
12825 ///
12826 /// # Example
12827 /// ```ignore,no_run
12828 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionRequest;
12829 /// let x = UndeployProcessorVersionRequest::new().set_name("example");
12830 /// ```
12831 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12832 self.name = v.into();
12833 self
12834 }
12835}
12836
12837impl wkt::message::Message for UndeployProcessorVersionRequest {
12838 fn typename() -> &'static str {
12839 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
12840 }
12841}
12842
12843/// Response message for the
12844/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12845/// method.
12846///
12847/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12848#[derive(Clone, Default, PartialEq)]
12849#[non_exhaustive]
12850pub struct UndeployProcessorVersionResponse {
12851 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12852}
12853
12854impl UndeployProcessorVersionResponse {
12855 pub fn new() -> Self {
12856 std::default::Default::default()
12857 }
12858}
12859
12860impl wkt::message::Message for UndeployProcessorVersionResponse {
12861 fn typename() -> &'static str {
12862 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
12863 }
12864}
12865
12866/// The long-running operation metadata for the
12867/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12868/// method.
12869///
12870/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12871#[derive(Clone, Default, PartialEq)]
12872#[non_exhaustive]
12873pub struct UndeployProcessorVersionMetadata {
12874 /// The basic metadata of the long-running operation.
12875 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12876
12877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12878}
12879
12880impl UndeployProcessorVersionMetadata {
12881 pub fn new() -> Self {
12882 std::default::Default::default()
12883 }
12884
12885 /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
12886 ///
12887 /// # Example
12888 /// ```ignore,no_run
12889 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
12890 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12891 /// let x = UndeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12892 /// ```
12893 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12894 where
12895 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12896 {
12897 self.common_metadata = std::option::Option::Some(v.into());
12898 self
12899 }
12900
12901 /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
12902 ///
12903 /// # Example
12904 /// ```ignore,no_run
12905 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
12906 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12907 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12908 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12909 /// ```
12910 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12911 where
12912 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12913 {
12914 self.common_metadata = v.map(|x| x.into());
12915 self
12916 }
12917}
12918
12919impl wkt::message::Message for UndeployProcessorVersionMetadata {
12920 fn typename() -> &'static str {
12921 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
12922 }
12923}
12924
12925/// Request message for the
12926/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
12927/// method. Notice this request is sent to a regionalized backend service. If the
12928/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
12929/// that region, the creation fails.
12930///
12931/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
12932/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
12933#[derive(Clone, Default, PartialEq)]
12934#[non_exhaustive]
12935pub struct CreateProcessorRequest {
12936 /// Required. The parent (project and location) under which to create the
12937 /// processor. Format: `projects/{project}/locations/{location}`
12938 pub parent: std::string::String,
12939
12940 /// Required. The processor to be created, requires
12941 /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
12942 /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
12943 /// to be set. Also, the
12944 /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
12945 /// field must be set if the processor is under CMEK.
12946 ///
12947 /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
12948 /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
12949 /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
12950 pub processor: std::option::Option<crate::model::Processor>,
12951
12952 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12953}
12954
12955impl CreateProcessorRequest {
12956 pub fn new() -> Self {
12957 std::default::Default::default()
12958 }
12959
12960 /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
12961 ///
12962 /// # Example
12963 /// ```ignore,no_run
12964 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12965 /// let x = CreateProcessorRequest::new().set_parent("example");
12966 /// ```
12967 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12968 self.parent = v.into();
12969 self
12970 }
12971
12972 /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
12973 ///
12974 /// # Example
12975 /// ```ignore,no_run
12976 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12977 /// use google_cloud_documentai_v1::model::Processor;
12978 /// let x = CreateProcessorRequest::new().set_processor(Processor::default()/* use setters */);
12979 /// ```
12980 pub fn set_processor<T>(mut self, v: T) -> Self
12981 where
12982 T: std::convert::Into<crate::model::Processor>,
12983 {
12984 self.processor = std::option::Option::Some(v.into());
12985 self
12986 }
12987
12988 /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
12989 ///
12990 /// # Example
12991 /// ```ignore,no_run
12992 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
12993 /// use google_cloud_documentai_v1::model::Processor;
12994 /// let x = CreateProcessorRequest::new().set_or_clear_processor(Some(Processor::default()/* use setters */));
12995 /// let x = CreateProcessorRequest::new().set_or_clear_processor(None::<Processor>);
12996 /// ```
12997 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
12998 where
12999 T: std::convert::Into<crate::model::Processor>,
13000 {
13001 self.processor = v.map(|x| x.into());
13002 self
13003 }
13004}
13005
13006impl wkt::message::Message for CreateProcessorRequest {
13007 fn typename() -> &'static str {
13008 "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
13009 }
13010}
13011
13012/// Request message for the
13013/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13014/// method.
13015///
13016/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13017#[derive(Clone, Default, PartialEq)]
13018#[non_exhaustive]
13019pub struct DeleteProcessorRequest {
13020 /// Required. The processor resource name to be deleted.
13021 pub name: std::string::String,
13022
13023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13024}
13025
13026impl DeleteProcessorRequest {
13027 pub fn new() -> Self {
13028 std::default::Default::default()
13029 }
13030
13031 /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
13032 ///
13033 /// # Example
13034 /// ```ignore,no_run
13035 /// # use google_cloud_documentai_v1::model::DeleteProcessorRequest;
13036 /// let x = DeleteProcessorRequest::new().set_name("example");
13037 /// ```
13038 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13039 self.name = v.into();
13040 self
13041 }
13042}
13043
13044impl wkt::message::Message for DeleteProcessorRequest {
13045 fn typename() -> &'static str {
13046 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
13047 }
13048}
13049
13050/// The long-running operation metadata for the
13051/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13052/// method.
13053///
13054/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13055#[derive(Clone, Default, PartialEq)]
13056#[non_exhaustive]
13057pub struct DeleteProcessorMetadata {
13058 /// The basic metadata of the long-running operation.
13059 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13060
13061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13062}
13063
13064impl DeleteProcessorMetadata {
13065 pub fn new() -> Self {
13066 std::default::Default::default()
13067 }
13068
13069 /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13070 ///
13071 /// # Example
13072 /// ```ignore,no_run
13073 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13074 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13075 /// let x = DeleteProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13076 /// ```
13077 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13078 where
13079 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13080 {
13081 self.common_metadata = std::option::Option::Some(v.into());
13082 self
13083 }
13084
13085 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13086 ///
13087 /// # Example
13088 /// ```ignore,no_run
13089 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13090 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13091 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13092 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13093 /// ```
13094 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13095 where
13096 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13097 {
13098 self.common_metadata = v.map(|x| x.into());
13099 self
13100 }
13101}
13102
13103impl wkt::message::Message for DeleteProcessorMetadata {
13104 fn typename() -> &'static str {
13105 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
13106 }
13107}
13108
13109/// Request message for the
13110/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13111/// method.
13112///
13113/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13114#[derive(Clone, Default, PartialEq)]
13115#[non_exhaustive]
13116pub struct EnableProcessorRequest {
13117 /// Required. The processor resource name to be enabled.
13118 pub name: std::string::String,
13119
13120 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13121}
13122
13123impl EnableProcessorRequest {
13124 pub fn new() -> Self {
13125 std::default::Default::default()
13126 }
13127
13128 /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
13129 ///
13130 /// # Example
13131 /// ```ignore,no_run
13132 /// # use google_cloud_documentai_v1::model::EnableProcessorRequest;
13133 /// let x = EnableProcessorRequest::new().set_name("example");
13134 /// ```
13135 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13136 self.name = v.into();
13137 self
13138 }
13139}
13140
13141impl wkt::message::Message for EnableProcessorRequest {
13142 fn typename() -> &'static str {
13143 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
13144 }
13145}
13146
13147/// Response message for the
13148/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13149/// method. Intentionally empty proto for adding fields in future.
13150///
13151/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13152#[derive(Clone, Default, PartialEq)]
13153#[non_exhaustive]
13154pub struct EnableProcessorResponse {
13155 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13156}
13157
13158impl EnableProcessorResponse {
13159 pub fn new() -> Self {
13160 std::default::Default::default()
13161 }
13162}
13163
13164impl wkt::message::Message for EnableProcessorResponse {
13165 fn typename() -> &'static str {
13166 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
13167 }
13168}
13169
13170/// The long-running operation metadata for the
13171/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13172/// method.
13173///
13174/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13175#[derive(Clone, Default, PartialEq)]
13176#[non_exhaustive]
13177pub struct EnableProcessorMetadata {
13178 /// The basic metadata of the long-running operation.
13179 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13180
13181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13182}
13183
13184impl EnableProcessorMetadata {
13185 pub fn new() -> Self {
13186 std::default::Default::default()
13187 }
13188
13189 /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13190 ///
13191 /// # Example
13192 /// ```ignore,no_run
13193 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13194 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13195 /// let x = EnableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13196 /// ```
13197 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13198 where
13199 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13200 {
13201 self.common_metadata = std::option::Option::Some(v.into());
13202 self
13203 }
13204
13205 /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13206 ///
13207 /// # Example
13208 /// ```ignore,no_run
13209 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13210 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13211 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13212 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13213 /// ```
13214 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13215 where
13216 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13217 {
13218 self.common_metadata = v.map(|x| x.into());
13219 self
13220 }
13221}
13222
13223impl wkt::message::Message for EnableProcessorMetadata {
13224 fn typename() -> &'static str {
13225 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
13226 }
13227}
13228
13229/// Request message for the
13230/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13231/// method.
13232///
13233/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13234#[derive(Clone, Default, PartialEq)]
13235#[non_exhaustive]
13236pub struct DisableProcessorRequest {
13237 /// Required. The processor resource name to be disabled.
13238 pub name: std::string::String,
13239
13240 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13241}
13242
13243impl DisableProcessorRequest {
13244 pub fn new() -> Self {
13245 std::default::Default::default()
13246 }
13247
13248 /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
13249 ///
13250 /// # Example
13251 /// ```ignore,no_run
13252 /// # use google_cloud_documentai_v1::model::DisableProcessorRequest;
13253 /// let x = DisableProcessorRequest::new().set_name("example");
13254 /// ```
13255 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13256 self.name = v.into();
13257 self
13258 }
13259}
13260
13261impl wkt::message::Message for DisableProcessorRequest {
13262 fn typename() -> &'static str {
13263 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
13264 }
13265}
13266
13267/// Response message for the
13268/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13269/// method. Intentionally empty proto for adding fields in future.
13270///
13271/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13272#[derive(Clone, Default, PartialEq)]
13273#[non_exhaustive]
13274pub struct DisableProcessorResponse {
13275 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13276}
13277
13278impl DisableProcessorResponse {
13279 pub fn new() -> Self {
13280 std::default::Default::default()
13281 }
13282}
13283
13284impl wkt::message::Message for DisableProcessorResponse {
13285 fn typename() -> &'static str {
13286 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
13287 }
13288}
13289
13290/// The long-running operation metadata for the
13291/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13292/// method.
13293///
13294/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13295#[derive(Clone, Default, PartialEq)]
13296#[non_exhaustive]
13297pub struct DisableProcessorMetadata {
13298 /// The basic metadata of the long-running operation.
13299 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13300
13301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13302}
13303
13304impl DisableProcessorMetadata {
13305 pub fn new() -> Self {
13306 std::default::Default::default()
13307 }
13308
13309 /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13310 ///
13311 /// # Example
13312 /// ```ignore,no_run
13313 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13314 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13315 /// let x = DisableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13316 /// ```
13317 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13318 where
13319 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13320 {
13321 self.common_metadata = std::option::Option::Some(v.into());
13322 self
13323 }
13324
13325 /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13326 ///
13327 /// # Example
13328 /// ```ignore,no_run
13329 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13330 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13331 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13332 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13333 /// ```
13334 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13335 where
13336 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13337 {
13338 self.common_metadata = v.map(|x| x.into());
13339 self
13340 }
13341}
13342
13343impl wkt::message::Message for DisableProcessorMetadata {
13344 fn typename() -> &'static str {
13345 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
13346 }
13347}
13348
13349/// Request message for the
13350/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13351/// method.
13352///
13353/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13354#[derive(Clone, Default, PartialEq)]
13355#[non_exhaustive]
13356pub struct SetDefaultProcessorVersionRequest {
13357 /// Required. The resource name of the
13358 /// [Processor][google.cloud.documentai.v1.Processor] to change default
13359 /// version.
13360 ///
13361 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
13362 pub processor: std::string::String,
13363
13364 /// Required. The resource name of child
13365 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
13366 /// default. Format:
13367 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
13368 ///
13369 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13370 pub default_processor_version: std::string::String,
13371
13372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13373}
13374
13375impl SetDefaultProcessorVersionRequest {
13376 pub fn new() -> Self {
13377 std::default::Default::default()
13378 }
13379
13380 /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
13381 ///
13382 /// # Example
13383 /// ```ignore,no_run
13384 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13385 /// let x = SetDefaultProcessorVersionRequest::new().set_processor("example");
13386 /// ```
13387 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13388 self.processor = v.into();
13389 self
13390 }
13391
13392 /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
13393 ///
13394 /// # Example
13395 /// ```ignore,no_run
13396 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13397 /// let x = SetDefaultProcessorVersionRequest::new().set_default_processor_version("example");
13398 /// ```
13399 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
13400 mut self,
13401 v: T,
13402 ) -> Self {
13403 self.default_processor_version = v.into();
13404 self
13405 }
13406}
13407
13408impl wkt::message::Message for SetDefaultProcessorVersionRequest {
13409 fn typename() -> &'static str {
13410 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
13411 }
13412}
13413
13414/// Response message for the
13415/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13416/// method.
13417///
13418/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13419#[derive(Clone, Default, PartialEq)]
13420#[non_exhaustive]
13421pub struct SetDefaultProcessorVersionResponse {
13422 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13423}
13424
13425impl SetDefaultProcessorVersionResponse {
13426 pub fn new() -> Self {
13427 std::default::Default::default()
13428 }
13429}
13430
13431impl wkt::message::Message for SetDefaultProcessorVersionResponse {
13432 fn typename() -> &'static str {
13433 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
13434 }
13435}
13436
13437/// The long-running operation metadata for the
13438/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13439/// method.
13440///
13441/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13442#[derive(Clone, Default, PartialEq)]
13443#[non_exhaustive]
13444pub struct SetDefaultProcessorVersionMetadata {
13445 /// The basic metadata of the long-running operation.
13446 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13447
13448 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13449}
13450
13451impl SetDefaultProcessorVersionMetadata {
13452 pub fn new() -> Self {
13453 std::default::Default::default()
13454 }
13455
13456 /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13457 ///
13458 /// # Example
13459 /// ```ignore,no_run
13460 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13461 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13462 /// let x = SetDefaultProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13463 /// ```
13464 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13465 where
13466 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13467 {
13468 self.common_metadata = std::option::Option::Some(v.into());
13469 self
13470 }
13471
13472 /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13473 ///
13474 /// # Example
13475 /// ```ignore,no_run
13476 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13477 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13478 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13479 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13480 /// ```
13481 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13482 where
13483 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13484 {
13485 self.common_metadata = v.map(|x| x.into());
13486 self
13487 }
13488}
13489
13490impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
13491 fn typename() -> &'static str {
13492 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
13493 }
13494}
13495
13496/// Request message for the
13497/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
13498/// method.
13499///
13500/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
13501#[derive(Clone, Default, PartialEq)]
13502#[non_exhaustive]
13503pub struct TrainProcessorVersionRequest {
13504 /// Required. The parent (project, location and processor) to create the new
13505 /// version for. Format:
13506 /// `projects/{project}/locations/{location}/processors/{processor}`.
13507 pub parent: std::string::String,
13508
13509 /// Required. The processor version to be created.
13510 pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
13511
13512 /// Optional. The schema the processor version will be trained with.
13513 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
13514
13515 /// Optional. The input data used to train the
13516 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13517 ///
13518 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13519 pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
13520
13521 /// Optional. The processor version to use as a base for training. This
13522 /// processor version must be a child of `parent`. Format:
13523 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
13524 pub base_processor_version: std::string::String,
13525
13526 pub processor_flags:
13527 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13528
13529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13530}
13531
13532impl TrainProcessorVersionRequest {
13533 pub fn new() -> Self {
13534 std::default::Default::default()
13535 }
13536
13537 /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
13538 ///
13539 /// # Example
13540 /// ```ignore,no_run
13541 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13542 /// let x = TrainProcessorVersionRequest::new().set_parent("example");
13543 /// ```
13544 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13545 self.parent = v.into();
13546 self
13547 }
13548
13549 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13550 ///
13551 /// # Example
13552 /// ```ignore,no_run
13553 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13554 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13555 /// let x = TrainProcessorVersionRequest::new().set_processor_version(ProcessorVersion::default()/* use setters */);
13556 /// ```
13557 pub fn set_processor_version<T>(mut self, v: T) -> Self
13558 where
13559 T: std::convert::Into<crate::model::ProcessorVersion>,
13560 {
13561 self.processor_version = std::option::Option::Some(v.into());
13562 self
13563 }
13564
13565 /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13566 ///
13567 /// # Example
13568 /// ```ignore,no_run
13569 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13570 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13571 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(Some(ProcessorVersion::default()/* use setters */));
13572 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(None::<ProcessorVersion>);
13573 /// ```
13574 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
13575 where
13576 T: std::convert::Into<crate::model::ProcessorVersion>,
13577 {
13578 self.processor_version = v.map(|x| x.into());
13579 self
13580 }
13581
13582 /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13583 ///
13584 /// # Example
13585 /// ```ignore,no_run
13586 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13587 /// use google_cloud_documentai_v1::model::DocumentSchema;
13588 /// let x = TrainProcessorVersionRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
13589 /// ```
13590 pub fn set_document_schema<T>(mut self, v: T) -> Self
13591 where
13592 T: std::convert::Into<crate::model::DocumentSchema>,
13593 {
13594 self.document_schema = std::option::Option::Some(v.into());
13595 self
13596 }
13597
13598 /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13599 ///
13600 /// # Example
13601 /// ```ignore,no_run
13602 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13603 /// use google_cloud_documentai_v1::model::DocumentSchema;
13604 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
13605 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
13606 /// ```
13607 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
13608 where
13609 T: std::convert::Into<crate::model::DocumentSchema>,
13610 {
13611 self.document_schema = v.map(|x| x.into());
13612 self
13613 }
13614
13615 /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13616 ///
13617 /// # Example
13618 /// ```ignore,no_run
13619 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13620 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13621 /// let x = TrainProcessorVersionRequest::new().set_input_data(InputData::default()/* use setters */);
13622 /// ```
13623 pub fn set_input_data<T>(mut self, v: T) -> Self
13624 where
13625 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13626 {
13627 self.input_data = std::option::Option::Some(v.into());
13628 self
13629 }
13630
13631 /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13632 ///
13633 /// # Example
13634 /// ```ignore,no_run
13635 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13636 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13637 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(Some(InputData::default()/* use setters */));
13638 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(None::<InputData>);
13639 /// ```
13640 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
13641 where
13642 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13643 {
13644 self.input_data = v.map(|x| x.into());
13645 self
13646 }
13647
13648 /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
13649 ///
13650 /// # Example
13651 /// ```ignore,no_run
13652 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13653 /// let x = TrainProcessorVersionRequest::new().set_base_processor_version("example");
13654 /// ```
13655 pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
13656 mut self,
13657 v: T,
13658 ) -> Self {
13659 self.base_processor_version = v.into();
13660 self
13661 }
13662
13663 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
13664 ///
13665 /// Note that all the setters affecting `processor_flags` are mutually
13666 /// exclusive.
13667 ///
13668 /// # Example
13669 /// ```ignore,no_run
13670 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13671 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13672 /// let x = TrainProcessorVersionRequest::new().set_processor_flags(Some(
13673 /// google_cloud_documentai_v1::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(CustomDocumentExtractionOptions::default().into())));
13674 /// ```
13675 pub fn set_processor_flags<
13676 T: std::convert::Into<
13677 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13678 >,
13679 >(
13680 mut self,
13681 v: T,
13682 ) -> Self {
13683 self.processor_flags = v.into();
13684 self
13685 }
13686
13687 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13688 /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
13689 /// holds a different branch.
13690 pub fn custom_document_extraction_options(
13691 &self,
13692 ) -> std::option::Option<
13693 &std::boxed::Box<
13694 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13695 >,
13696 > {
13697 #[allow(unreachable_patterns)]
13698 self.processor_flags.as_ref().and_then(|v| match v {
13699 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
13700 _ => std::option::Option::None,
13701 })
13702 }
13703
13704 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13705 /// to hold a `CustomDocumentExtractionOptions`.
13706 ///
13707 /// Note that all the setters affecting `processor_flags` are
13708 /// mutually exclusive.
13709 ///
13710 /// # Example
13711 /// ```ignore,no_run
13712 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13713 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13714 /// let x = TrainProcessorVersionRequest::new().set_custom_document_extraction_options(CustomDocumentExtractionOptions::default()/* use setters */);
13715 /// assert!(x.custom_document_extraction_options().is_some());
13716 /// assert!(x.foundation_model_tuning_options().is_none());
13717 /// ```
13718 pub fn set_custom_document_extraction_options<
13719 T: std::convert::Into<
13720 std::boxed::Box<
13721 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13722 >,
13723 >,
13724 >(
13725 mut self,
13726 v: T,
13727 ) -> Self {
13728 self.processor_flags = std::option::Option::Some(
13729 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
13730 v.into()
13731 )
13732 );
13733 self
13734 }
13735
13736 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13737 /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
13738 /// holds a different branch.
13739 pub fn foundation_model_tuning_options(
13740 &self,
13741 ) -> std::option::Option<
13742 &std::boxed::Box<
13743 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13744 >,
13745 > {
13746 #[allow(unreachable_patterns)]
13747 self.processor_flags.as_ref().and_then(|v| match v {
13748 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
13749 _ => std::option::Option::None,
13750 })
13751 }
13752
13753 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13754 /// to hold a `FoundationModelTuningOptions`.
13755 ///
13756 /// Note that all the setters affecting `processor_flags` are
13757 /// mutually exclusive.
13758 ///
13759 /// # Example
13760 /// ```ignore,no_run
13761 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13762 /// use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13763 /// let x = TrainProcessorVersionRequest::new().set_foundation_model_tuning_options(FoundationModelTuningOptions::default()/* use setters */);
13764 /// assert!(x.foundation_model_tuning_options().is_some());
13765 /// assert!(x.custom_document_extraction_options().is_none());
13766 /// ```
13767 pub fn set_foundation_model_tuning_options<
13768 T: std::convert::Into<
13769 std::boxed::Box<
13770 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13771 >,
13772 >,
13773 >(
13774 mut self,
13775 v: T,
13776 ) -> Self {
13777 self.processor_flags = std::option::Option::Some(
13778 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
13779 v.into()
13780 )
13781 );
13782 self
13783 }
13784}
13785
13786impl wkt::message::Message for TrainProcessorVersionRequest {
13787 fn typename() -> &'static str {
13788 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
13789 }
13790}
13791
13792/// Defines additional types related to [TrainProcessorVersionRequest].
13793pub mod train_processor_version_request {
13794 #[allow(unused_imports)]
13795 use super::*;
13796
13797 /// The input data used to train a new
13798 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13799 ///
13800 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13801 #[derive(Clone, Default, PartialEq)]
13802 #[non_exhaustive]
13803 pub struct InputData {
13804 /// The documents used for training the new version.
13805 pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13806
13807 /// The documents used for testing the trained version.
13808 pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13809
13810 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13811 }
13812
13813 impl InputData {
13814 pub fn new() -> Self {
13815 std::default::Default::default()
13816 }
13817
13818 /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
13819 ///
13820 /// # Example
13821 /// ```ignore,no_run
13822 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13823 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13824 /// let x = InputData::new().set_training_documents(BatchDocumentsInputConfig::default()/* use setters */);
13825 /// ```
13826 pub fn set_training_documents<T>(mut self, v: T) -> Self
13827 where
13828 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13829 {
13830 self.training_documents = std::option::Option::Some(v.into());
13831 self
13832 }
13833
13834 /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
13835 ///
13836 /// # Example
13837 /// ```ignore,no_run
13838 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13839 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13840 /// let x = InputData::new().set_or_clear_training_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
13841 /// let x = InputData::new().set_or_clear_training_documents(None::<BatchDocumentsInputConfig>);
13842 /// ```
13843 pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
13844 where
13845 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13846 {
13847 self.training_documents = v.map(|x| x.into());
13848 self
13849 }
13850
13851 /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
13852 ///
13853 /// # Example
13854 /// ```ignore,no_run
13855 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13856 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13857 /// let x = InputData::new().set_test_documents(BatchDocumentsInputConfig::default()/* use setters */);
13858 /// ```
13859 pub fn set_test_documents<T>(mut self, v: T) -> Self
13860 where
13861 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13862 {
13863 self.test_documents = std::option::Option::Some(v.into());
13864 self
13865 }
13866
13867 /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
13868 ///
13869 /// # Example
13870 /// ```ignore,no_run
13871 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13872 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13873 /// let x = InputData::new().set_or_clear_test_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
13874 /// let x = InputData::new().set_or_clear_test_documents(None::<BatchDocumentsInputConfig>);
13875 /// ```
13876 pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
13877 where
13878 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13879 {
13880 self.test_documents = v.map(|x| x.into());
13881 self
13882 }
13883 }
13884
13885 impl wkt::message::Message for InputData {
13886 fn typename() -> &'static str {
13887 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
13888 }
13889 }
13890
13891 /// Options to control the training of the Custom Document Extraction (CDE)
13892 /// Processor.
13893 #[derive(Clone, Default, PartialEq)]
13894 #[non_exhaustive]
13895 pub struct CustomDocumentExtractionOptions {
13896
13897 /// Optional. Training method to use for CDE training.
13898 pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
13899
13900 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13901 }
13902
13903 impl CustomDocumentExtractionOptions {
13904 pub fn new() -> Self {
13905 std::default::Default::default()
13906 }
13907
13908 /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
13909 ///
13910 /// # Example
13911 /// ```ignore,no_run
13912 /// # use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13913 /// use google_cloud_documentai_v1::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod;
13914 /// let x0 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::ModelBased);
13915 /// let x1 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::TemplateBased);
13916 /// ```
13917 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{
13918 self.training_method = v.into();
13919 self
13920 }
13921 }
13922
13923 impl wkt::message::Message for CustomDocumentExtractionOptions {
13924 fn typename() -> &'static str {
13925 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
13926 }
13927 }
13928
13929 /// Defines additional types related to [CustomDocumentExtractionOptions].
13930 pub mod custom_document_extraction_options {
13931 #[allow(unused_imports)]
13932 use super::*;
13933
13934 /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
13935 /// `MODEL_BASED`.
13936 ///
13937 /// # Working with unknown values
13938 ///
13939 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
13940 /// additional enum variants at any time. Adding new variants is not considered
13941 /// a breaking change. Applications should write their code in anticipation of:
13942 ///
13943 /// - New values appearing in future releases of the client library, **and**
13944 /// - New values received dynamically, without application changes.
13945 ///
13946 /// Please consult the [Working with enums] section in the user guide for some
13947 /// guidelines.
13948 ///
13949 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
13950 #[derive(Clone, Debug, PartialEq)]
13951 #[non_exhaustive]
13952 pub enum TrainingMethod {
13953 Unspecified,
13954 ModelBased,
13955 TemplateBased,
13956 /// If set, the enum was initialized with an unknown value.
13957 ///
13958 /// Applications can examine the value using [TrainingMethod::value] or
13959 /// [TrainingMethod::name].
13960 UnknownValue(training_method::UnknownValue),
13961 }
13962
13963 #[doc(hidden)]
13964 pub mod training_method {
13965 #[allow(unused_imports)]
13966 use super::*;
13967 #[derive(Clone, Debug, PartialEq)]
13968 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
13969 }
13970
13971 impl TrainingMethod {
13972 /// Gets the enum value.
13973 ///
13974 /// Returns `None` if the enum contains an unknown value deserialized from
13975 /// the string representation of enums.
13976 pub fn value(&self) -> std::option::Option<i32> {
13977 match self {
13978 Self::Unspecified => std::option::Option::Some(0),
13979 Self::ModelBased => std::option::Option::Some(1),
13980 Self::TemplateBased => std::option::Option::Some(2),
13981 Self::UnknownValue(u) => u.0.value(),
13982 }
13983 }
13984
13985 /// Gets the enum value as a string.
13986 ///
13987 /// Returns `None` if the enum contains an unknown value deserialized from
13988 /// the integer representation of enums.
13989 pub fn name(&self) -> std::option::Option<&str> {
13990 match self {
13991 Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
13992 Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
13993 Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
13994 Self::UnknownValue(u) => u.0.name(),
13995 }
13996 }
13997 }
13998
13999 impl std::default::Default for TrainingMethod {
14000 fn default() -> Self {
14001 use std::convert::From;
14002 Self::from(0)
14003 }
14004 }
14005
14006 impl std::fmt::Display for TrainingMethod {
14007 fn fmt(
14008 &self,
14009 f: &mut std::fmt::Formatter<'_>,
14010 ) -> std::result::Result<(), std::fmt::Error> {
14011 wkt::internal::display_enum(f, self.name(), self.value())
14012 }
14013 }
14014
14015 impl std::convert::From<i32> for TrainingMethod {
14016 fn from(value: i32) -> Self {
14017 match value {
14018 0 => Self::Unspecified,
14019 1 => Self::ModelBased,
14020 2 => Self::TemplateBased,
14021 _ => Self::UnknownValue(training_method::UnknownValue(
14022 wkt::internal::UnknownEnumValue::Integer(value),
14023 )),
14024 }
14025 }
14026 }
14027
14028 impl std::convert::From<&str> for TrainingMethod {
14029 fn from(value: &str) -> Self {
14030 use std::string::ToString;
14031 match value {
14032 "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
14033 "MODEL_BASED" => Self::ModelBased,
14034 "TEMPLATE_BASED" => Self::TemplateBased,
14035 _ => Self::UnknownValue(training_method::UnknownValue(
14036 wkt::internal::UnknownEnumValue::String(value.to_string()),
14037 )),
14038 }
14039 }
14040 }
14041
14042 impl serde::ser::Serialize for TrainingMethod {
14043 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14044 where
14045 S: serde::Serializer,
14046 {
14047 match self {
14048 Self::Unspecified => serializer.serialize_i32(0),
14049 Self::ModelBased => serializer.serialize_i32(1),
14050 Self::TemplateBased => serializer.serialize_i32(2),
14051 Self::UnknownValue(u) => u.0.serialize(serializer),
14052 }
14053 }
14054 }
14055
14056 impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
14057 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14058 where
14059 D: serde::Deserializer<'de>,
14060 {
14061 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
14062 ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
14063 }
14064 }
14065 }
14066
14067 /// Options to control foundation model tuning of the processor.
14068 #[derive(Clone, Default, PartialEq)]
14069 #[non_exhaustive]
14070 pub struct FoundationModelTuningOptions {
14071 /// Optional. The number of steps to run for model tuning. Valid values are
14072 /// between 1 and 400. If not provided, recommended steps will be used.
14073 pub train_steps: i32,
14074
14075 /// Optional. The multiplier to apply to the recommended learning rate. Valid
14076 /// values are between 0.1 and 10. If not provided, recommended learning rate
14077 /// will be used.
14078 pub learning_rate_multiplier: f32,
14079
14080 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14081 }
14082
14083 impl FoundationModelTuningOptions {
14084 pub fn new() -> Self {
14085 std::default::Default::default()
14086 }
14087
14088 /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
14089 ///
14090 /// # Example
14091 /// ```ignore,no_run
14092 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14093 /// let x = FoundationModelTuningOptions::new().set_train_steps(42);
14094 /// ```
14095 pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14096 self.train_steps = v.into();
14097 self
14098 }
14099
14100 /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
14101 ///
14102 /// # Example
14103 /// ```ignore,no_run
14104 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14105 /// let x = FoundationModelTuningOptions::new().set_learning_rate_multiplier(42.0);
14106 /// ```
14107 pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14108 self.learning_rate_multiplier = v.into();
14109 self
14110 }
14111 }
14112
14113 impl wkt::message::Message for FoundationModelTuningOptions {
14114 fn typename() -> &'static str {
14115 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
14116 }
14117 }
14118
14119 #[derive(Clone, Debug, PartialEq)]
14120 #[non_exhaustive]
14121 pub enum ProcessorFlags {
14122 /// Options to control Custom Document Extraction (CDE) Processor.
14123 CustomDocumentExtractionOptions(
14124 std::boxed::Box<
14125 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
14126 >,
14127 ),
14128 /// Options to control foundation model tuning of a processor.
14129 FoundationModelTuningOptions(
14130 std::boxed::Box<
14131 crate::model::train_processor_version_request::FoundationModelTuningOptions,
14132 >,
14133 ),
14134 }
14135}
14136
14137/// The response for
14138/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
14139///
14140/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
14141#[derive(Clone, Default, PartialEq)]
14142#[non_exhaustive]
14143pub struct TrainProcessorVersionResponse {
14144 /// The resource name of the processor version produced by training.
14145 pub processor_version: std::string::String,
14146
14147 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14148}
14149
14150impl TrainProcessorVersionResponse {
14151 pub fn new() -> Self {
14152 std::default::Default::default()
14153 }
14154
14155 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
14156 ///
14157 /// # Example
14158 /// ```ignore,no_run
14159 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionResponse;
14160 /// let x = TrainProcessorVersionResponse::new().set_processor_version("example");
14161 /// ```
14162 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
14163 mut self,
14164 v: T,
14165 ) -> Self {
14166 self.processor_version = v.into();
14167 self
14168 }
14169}
14170
14171impl wkt::message::Message for TrainProcessorVersionResponse {
14172 fn typename() -> &'static str {
14173 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
14174 }
14175}
14176
14177/// The metadata that represents a processor version being created.
14178#[derive(Clone, Default, PartialEq)]
14179#[non_exhaustive]
14180pub struct TrainProcessorVersionMetadata {
14181 /// The basic metadata of the long-running operation.
14182 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14183
14184 /// The training dataset validation information.
14185 pub training_dataset_validation:
14186 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14187
14188 /// The test dataset validation information.
14189 pub test_dataset_validation:
14190 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14191
14192 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14193}
14194
14195impl TrainProcessorVersionMetadata {
14196 pub fn new() -> Self {
14197 std::default::Default::default()
14198 }
14199
14200 /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14201 ///
14202 /// # Example
14203 /// ```ignore,no_run
14204 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14205 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14206 /// let x = TrainProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14207 /// ```
14208 pub fn set_common_metadata<T>(mut self, v: T) -> Self
14209 where
14210 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14211 {
14212 self.common_metadata = std::option::Option::Some(v.into());
14213 self
14214 }
14215
14216 /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14217 ///
14218 /// # Example
14219 /// ```ignore,no_run
14220 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14221 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14222 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14223 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14224 /// ```
14225 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14226 where
14227 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14228 {
14229 self.common_metadata = v.map(|x| x.into());
14230 self
14231 }
14232
14233 /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14234 ///
14235 /// # Example
14236 /// ```ignore,no_run
14237 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14238 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14239 /// let x = TrainProcessorVersionMetadata::new().set_training_dataset_validation(DatasetValidation::default()/* use setters */);
14240 /// ```
14241 pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
14242 where
14243 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14244 {
14245 self.training_dataset_validation = std::option::Option::Some(v.into());
14246 self
14247 }
14248
14249 /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14250 ///
14251 /// # Example
14252 /// ```ignore,no_run
14253 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14254 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14255 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14256 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(None::<DatasetValidation>);
14257 /// ```
14258 pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14259 where
14260 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14261 {
14262 self.training_dataset_validation = v.map(|x| x.into());
14263 self
14264 }
14265
14266 /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14267 ///
14268 /// # Example
14269 /// ```ignore,no_run
14270 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14271 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14272 /// let x = TrainProcessorVersionMetadata::new().set_test_dataset_validation(DatasetValidation::default()/* use setters */);
14273 /// ```
14274 pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
14275 where
14276 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14277 {
14278 self.test_dataset_validation = std::option::Option::Some(v.into());
14279 self
14280 }
14281
14282 /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14283 ///
14284 /// # Example
14285 /// ```ignore,no_run
14286 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14287 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14288 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14289 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(None::<DatasetValidation>);
14290 /// ```
14291 pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14292 where
14293 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14294 {
14295 self.test_dataset_validation = v.map(|x| x.into());
14296 self
14297 }
14298}
14299
14300impl wkt::message::Message for TrainProcessorVersionMetadata {
14301 fn typename() -> &'static str {
14302 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
14303 }
14304}
14305
14306/// Defines additional types related to [TrainProcessorVersionMetadata].
14307pub mod train_processor_version_metadata {
14308 #[allow(unused_imports)]
14309 use super::*;
14310
14311 /// The dataset validation information.
14312 /// This includes any and all errors with documents and the dataset.
14313 #[derive(Clone, Default, PartialEq)]
14314 #[non_exhaustive]
14315 pub struct DatasetValidation {
14316 /// The total number of document errors.
14317 pub document_error_count: i32,
14318
14319 /// The total number of dataset errors.
14320 pub dataset_error_count: i32,
14321
14322 /// Error information pertaining to specific documents. A maximum of 10
14323 /// document errors will be returned.
14324 /// Any document with errors will not be used throughout training.
14325 pub document_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14326
14327 /// Error information for the dataset as a whole. A maximum of 10 dataset
14328 /// errors will be returned.
14329 /// A single dataset error is terminal for training.
14330 pub dataset_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14331
14332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14333 }
14334
14335 impl DatasetValidation {
14336 pub fn new() -> Self {
14337 std::default::Default::default()
14338 }
14339
14340 /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
14341 ///
14342 /// # Example
14343 /// ```ignore,no_run
14344 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14345 /// let x = DatasetValidation::new().set_document_error_count(42);
14346 /// ```
14347 pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14348 self.document_error_count = v.into();
14349 self
14350 }
14351
14352 /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
14353 ///
14354 /// # Example
14355 /// ```ignore,no_run
14356 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14357 /// let x = DatasetValidation::new().set_dataset_error_count(42);
14358 /// ```
14359 pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14360 self.dataset_error_count = v.into();
14361 self
14362 }
14363
14364 /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
14365 ///
14366 /// # Example
14367 /// ```ignore,no_run
14368 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14369 /// use google_cloud_rpc::model::Status;
14370 /// let x = DatasetValidation::new()
14371 /// .set_document_errors([
14372 /// Status::default()/* use setters */,
14373 /// Status::default()/* use (different) setters */,
14374 /// ]);
14375 /// ```
14376 pub fn set_document_errors<T, V>(mut self, v: T) -> Self
14377 where
14378 T: std::iter::IntoIterator<Item = V>,
14379 V: std::convert::Into<google_cloud_rpc::model::Status>,
14380 {
14381 use std::iter::Iterator;
14382 self.document_errors = v.into_iter().map(|i| i.into()).collect();
14383 self
14384 }
14385
14386 /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
14387 ///
14388 /// # Example
14389 /// ```ignore,no_run
14390 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14391 /// use google_cloud_rpc::model::Status;
14392 /// let x = DatasetValidation::new()
14393 /// .set_dataset_errors([
14394 /// Status::default()/* use setters */,
14395 /// Status::default()/* use (different) setters */,
14396 /// ]);
14397 /// ```
14398 pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
14399 where
14400 T: std::iter::IntoIterator<Item = V>,
14401 V: std::convert::Into<google_cloud_rpc::model::Status>,
14402 {
14403 use std::iter::Iterator;
14404 self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
14405 self
14406 }
14407 }
14408
14409 impl wkt::message::Message for DatasetValidation {
14410 fn typename() -> &'static str {
14411 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
14412 }
14413 }
14414}
14415
14416/// Request message for the
14417/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14418/// method.
14419///
14420/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14421#[derive(Clone, Default, PartialEq)]
14422#[non_exhaustive]
14423pub struct ReviewDocumentRequest {
14424 /// Required. The resource name of the
14425 /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
14426 /// document will be reviewed with.
14427 pub human_review_config: std::string::String,
14428
14429 /// Whether the validation should be performed on the ad-hoc review request.
14430 pub enable_schema_validation: bool,
14431
14432 /// The priority of the human review task.
14433 pub priority: crate::model::review_document_request::Priority,
14434
14435 /// The document schema of the human review task.
14436 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
14437
14438 /// The document payload.
14439 pub source: std::option::Option<crate::model::review_document_request::Source>,
14440
14441 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14442}
14443
14444impl ReviewDocumentRequest {
14445 pub fn new() -> Self {
14446 std::default::Default::default()
14447 }
14448
14449 /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
14450 ///
14451 /// # Example
14452 /// ```ignore,no_run
14453 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14454 /// let x = ReviewDocumentRequest::new().set_human_review_config("example");
14455 /// ```
14456 pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
14457 mut self,
14458 v: T,
14459 ) -> Self {
14460 self.human_review_config = v.into();
14461 self
14462 }
14463
14464 /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
14465 ///
14466 /// # Example
14467 /// ```ignore,no_run
14468 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14469 /// let x = ReviewDocumentRequest::new().set_enable_schema_validation(true);
14470 /// ```
14471 pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14472 self.enable_schema_validation = v.into();
14473 self
14474 }
14475
14476 /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
14477 ///
14478 /// # Example
14479 /// ```ignore,no_run
14480 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14481 /// use google_cloud_documentai_v1::model::review_document_request::Priority;
14482 /// let x0 = ReviewDocumentRequest::new().set_priority(Priority::Urgent);
14483 /// ```
14484 pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
14485 mut self,
14486 v: T,
14487 ) -> Self {
14488 self.priority = v.into();
14489 self
14490 }
14491
14492 /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14493 ///
14494 /// # Example
14495 /// ```ignore,no_run
14496 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14497 /// use google_cloud_documentai_v1::model::DocumentSchema;
14498 /// let x = ReviewDocumentRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
14499 /// ```
14500 pub fn set_document_schema<T>(mut self, v: T) -> Self
14501 where
14502 T: std::convert::Into<crate::model::DocumentSchema>,
14503 {
14504 self.document_schema = std::option::Option::Some(v.into());
14505 self
14506 }
14507
14508 /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14509 ///
14510 /// # Example
14511 /// ```ignore,no_run
14512 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14513 /// use google_cloud_documentai_v1::model::DocumentSchema;
14514 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
14515 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
14516 /// ```
14517 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
14518 where
14519 T: std::convert::Into<crate::model::DocumentSchema>,
14520 {
14521 self.document_schema = v.map(|x| x.into());
14522 self
14523 }
14524
14525 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
14526 ///
14527 /// Note that all the setters affecting `source` are mutually
14528 /// exclusive.
14529 ///
14530 /// # Example
14531 /// ```ignore,no_run
14532 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14533 /// use google_cloud_documentai_v1::model::Document;
14534 /// let x = ReviewDocumentRequest::new().set_source(Some(
14535 /// google_cloud_documentai_v1::model::review_document_request::Source::InlineDocument(Document::default().into())));
14536 /// ```
14537 pub fn set_source<
14538 T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
14539 >(
14540 mut self,
14541 v: T,
14542 ) -> Self {
14543 self.source = v.into();
14544 self
14545 }
14546
14547 /// The value of [source][crate::model::ReviewDocumentRequest::source]
14548 /// if it holds a `InlineDocument`, `None` if the field is not set or
14549 /// holds a different branch.
14550 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
14551 #[allow(unreachable_patterns)]
14552 self.source.as_ref().and_then(|v| match v {
14553 crate::model::review_document_request::Source::InlineDocument(v) => {
14554 std::option::Option::Some(v)
14555 }
14556 _ => std::option::Option::None,
14557 })
14558 }
14559
14560 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
14561 /// to hold a `InlineDocument`.
14562 ///
14563 /// Note that all the setters affecting `source` are
14564 /// mutually exclusive.
14565 ///
14566 /// # Example
14567 /// ```ignore,no_run
14568 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14569 /// use google_cloud_documentai_v1::model::Document;
14570 /// let x = ReviewDocumentRequest::new().set_inline_document(Document::default()/* use setters */);
14571 /// assert!(x.inline_document().is_some());
14572 /// ```
14573 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
14574 mut self,
14575 v: T,
14576 ) -> Self {
14577 self.source = std::option::Option::Some(
14578 crate::model::review_document_request::Source::InlineDocument(v.into()),
14579 );
14580 self
14581 }
14582}
14583
14584impl wkt::message::Message for ReviewDocumentRequest {
14585 fn typename() -> &'static str {
14586 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
14587 }
14588}
14589
14590/// Defines additional types related to [ReviewDocumentRequest].
14591pub mod review_document_request {
14592 #[allow(unused_imports)]
14593 use super::*;
14594
14595 /// The priority level of the human review task.
14596 ///
14597 /// # Working with unknown values
14598 ///
14599 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14600 /// additional enum variants at any time. Adding new variants is not considered
14601 /// a breaking change. Applications should write their code in anticipation of:
14602 ///
14603 /// - New values appearing in future releases of the client library, **and**
14604 /// - New values received dynamically, without application changes.
14605 ///
14606 /// Please consult the [Working with enums] section in the user guide for some
14607 /// guidelines.
14608 ///
14609 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14610 #[derive(Clone, Debug, PartialEq)]
14611 #[non_exhaustive]
14612 pub enum Priority {
14613 /// The default priority level.
14614 Default,
14615 /// The urgent priority level. The labeling manager should allocate labeler
14616 /// resource to the urgent task queue to respect this priority level.
14617 Urgent,
14618 /// If set, the enum was initialized with an unknown value.
14619 ///
14620 /// Applications can examine the value using [Priority::value] or
14621 /// [Priority::name].
14622 UnknownValue(priority::UnknownValue),
14623 }
14624
14625 #[doc(hidden)]
14626 pub mod priority {
14627 #[allow(unused_imports)]
14628 use super::*;
14629 #[derive(Clone, Debug, PartialEq)]
14630 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14631 }
14632
14633 impl Priority {
14634 /// Gets the enum value.
14635 ///
14636 /// Returns `None` if the enum contains an unknown value deserialized from
14637 /// the string representation of enums.
14638 pub fn value(&self) -> std::option::Option<i32> {
14639 match self {
14640 Self::Default => std::option::Option::Some(0),
14641 Self::Urgent => std::option::Option::Some(1),
14642 Self::UnknownValue(u) => u.0.value(),
14643 }
14644 }
14645
14646 /// Gets the enum value as a string.
14647 ///
14648 /// Returns `None` if the enum contains an unknown value deserialized from
14649 /// the integer representation of enums.
14650 pub fn name(&self) -> std::option::Option<&str> {
14651 match self {
14652 Self::Default => std::option::Option::Some("DEFAULT"),
14653 Self::Urgent => std::option::Option::Some("URGENT"),
14654 Self::UnknownValue(u) => u.0.name(),
14655 }
14656 }
14657 }
14658
14659 impl std::default::Default for Priority {
14660 fn default() -> Self {
14661 use std::convert::From;
14662 Self::from(0)
14663 }
14664 }
14665
14666 impl std::fmt::Display for Priority {
14667 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14668 wkt::internal::display_enum(f, self.name(), self.value())
14669 }
14670 }
14671
14672 impl std::convert::From<i32> for Priority {
14673 fn from(value: i32) -> Self {
14674 match value {
14675 0 => Self::Default,
14676 1 => Self::Urgent,
14677 _ => Self::UnknownValue(priority::UnknownValue(
14678 wkt::internal::UnknownEnumValue::Integer(value),
14679 )),
14680 }
14681 }
14682 }
14683
14684 impl std::convert::From<&str> for Priority {
14685 fn from(value: &str) -> Self {
14686 use std::string::ToString;
14687 match value {
14688 "DEFAULT" => Self::Default,
14689 "URGENT" => Self::Urgent,
14690 _ => Self::UnknownValue(priority::UnknownValue(
14691 wkt::internal::UnknownEnumValue::String(value.to_string()),
14692 )),
14693 }
14694 }
14695 }
14696
14697 impl serde::ser::Serialize for Priority {
14698 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14699 where
14700 S: serde::Serializer,
14701 {
14702 match self {
14703 Self::Default => serializer.serialize_i32(0),
14704 Self::Urgent => serializer.serialize_i32(1),
14705 Self::UnknownValue(u) => u.0.serialize(serializer),
14706 }
14707 }
14708 }
14709
14710 impl<'de> serde::de::Deserialize<'de> for Priority {
14711 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14712 where
14713 D: serde::Deserializer<'de>,
14714 {
14715 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
14716 ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
14717 ))
14718 }
14719 }
14720
14721 /// The document payload.
14722 #[derive(Clone, Debug, PartialEq)]
14723 #[non_exhaustive]
14724 pub enum Source {
14725 /// An inline document proto.
14726 InlineDocument(std::boxed::Box<crate::model::Document>),
14727 }
14728}
14729
14730/// Response message for the
14731/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14732/// method.
14733///
14734/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14735#[derive(Clone, Default, PartialEq)]
14736#[non_exhaustive]
14737pub struct ReviewDocumentResponse {
14738 /// The Cloud Storage uri for the human reviewed document if the review is
14739 /// succeeded.
14740 pub gcs_destination: std::string::String,
14741
14742 /// The state of the review operation.
14743 pub state: crate::model::review_document_response::State,
14744
14745 /// The reason why the review is rejected by reviewer.
14746 pub rejection_reason: std::string::String,
14747
14748 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14749}
14750
14751impl ReviewDocumentResponse {
14752 pub fn new() -> Self {
14753 std::default::Default::default()
14754 }
14755
14756 /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
14757 ///
14758 /// # Example
14759 /// ```ignore,no_run
14760 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14761 /// let x = ReviewDocumentResponse::new().set_gcs_destination("example");
14762 /// ```
14763 pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14764 self.gcs_destination = v.into();
14765 self
14766 }
14767
14768 /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
14769 ///
14770 /// # Example
14771 /// ```ignore,no_run
14772 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14773 /// use google_cloud_documentai_v1::model::review_document_response::State;
14774 /// let x0 = ReviewDocumentResponse::new().set_state(State::Rejected);
14775 /// let x1 = ReviewDocumentResponse::new().set_state(State::Succeeded);
14776 /// ```
14777 pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
14778 mut self,
14779 v: T,
14780 ) -> Self {
14781 self.state = v.into();
14782 self
14783 }
14784
14785 /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
14786 ///
14787 /// # Example
14788 /// ```ignore,no_run
14789 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14790 /// let x = ReviewDocumentResponse::new().set_rejection_reason("example");
14791 /// ```
14792 pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
14793 mut self,
14794 v: T,
14795 ) -> Self {
14796 self.rejection_reason = v.into();
14797 self
14798 }
14799}
14800
14801impl wkt::message::Message for ReviewDocumentResponse {
14802 fn typename() -> &'static str {
14803 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
14804 }
14805}
14806
14807/// Defines additional types related to [ReviewDocumentResponse].
14808pub mod review_document_response {
14809 #[allow(unused_imports)]
14810 use super::*;
14811
14812 /// Possible states of the review operation.
14813 ///
14814 /// # Working with unknown values
14815 ///
14816 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14817 /// additional enum variants at any time. Adding new variants is not considered
14818 /// a breaking change. Applications should write their code in anticipation of:
14819 ///
14820 /// - New values appearing in future releases of the client library, **and**
14821 /// - New values received dynamically, without application changes.
14822 ///
14823 /// Please consult the [Working with enums] section in the user guide for some
14824 /// guidelines.
14825 ///
14826 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14827 #[derive(Clone, Debug, PartialEq)]
14828 #[non_exhaustive]
14829 pub enum State {
14830 /// The default value. This value is used if the state is omitted.
14831 Unspecified,
14832 /// The review operation is rejected by the reviewer.
14833 Rejected,
14834 /// The review operation is succeeded.
14835 Succeeded,
14836 /// If set, the enum was initialized with an unknown value.
14837 ///
14838 /// Applications can examine the value using [State::value] or
14839 /// [State::name].
14840 UnknownValue(state::UnknownValue),
14841 }
14842
14843 #[doc(hidden)]
14844 pub mod state {
14845 #[allow(unused_imports)]
14846 use super::*;
14847 #[derive(Clone, Debug, PartialEq)]
14848 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14849 }
14850
14851 impl State {
14852 /// Gets the enum value.
14853 ///
14854 /// Returns `None` if the enum contains an unknown value deserialized from
14855 /// the string representation of enums.
14856 pub fn value(&self) -> std::option::Option<i32> {
14857 match self {
14858 Self::Unspecified => std::option::Option::Some(0),
14859 Self::Rejected => std::option::Option::Some(1),
14860 Self::Succeeded => std::option::Option::Some(2),
14861 Self::UnknownValue(u) => u.0.value(),
14862 }
14863 }
14864
14865 /// Gets the enum value as a string.
14866 ///
14867 /// Returns `None` if the enum contains an unknown value deserialized from
14868 /// the integer representation of enums.
14869 pub fn name(&self) -> std::option::Option<&str> {
14870 match self {
14871 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
14872 Self::Rejected => std::option::Option::Some("REJECTED"),
14873 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
14874 Self::UnknownValue(u) => u.0.name(),
14875 }
14876 }
14877 }
14878
14879 impl std::default::Default for State {
14880 fn default() -> Self {
14881 use std::convert::From;
14882 Self::from(0)
14883 }
14884 }
14885
14886 impl std::fmt::Display for State {
14887 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14888 wkt::internal::display_enum(f, self.name(), self.value())
14889 }
14890 }
14891
14892 impl std::convert::From<i32> for State {
14893 fn from(value: i32) -> Self {
14894 match value {
14895 0 => Self::Unspecified,
14896 1 => Self::Rejected,
14897 2 => Self::Succeeded,
14898 _ => Self::UnknownValue(state::UnknownValue(
14899 wkt::internal::UnknownEnumValue::Integer(value),
14900 )),
14901 }
14902 }
14903 }
14904
14905 impl std::convert::From<&str> for State {
14906 fn from(value: &str) -> Self {
14907 use std::string::ToString;
14908 match value {
14909 "STATE_UNSPECIFIED" => Self::Unspecified,
14910 "REJECTED" => Self::Rejected,
14911 "SUCCEEDED" => Self::Succeeded,
14912 _ => Self::UnknownValue(state::UnknownValue(
14913 wkt::internal::UnknownEnumValue::String(value.to_string()),
14914 )),
14915 }
14916 }
14917 }
14918
14919 impl serde::ser::Serialize for State {
14920 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14921 where
14922 S: serde::Serializer,
14923 {
14924 match self {
14925 Self::Unspecified => serializer.serialize_i32(0),
14926 Self::Rejected => serializer.serialize_i32(1),
14927 Self::Succeeded => serializer.serialize_i32(2),
14928 Self::UnknownValue(u) => u.0.serialize(serializer),
14929 }
14930 }
14931 }
14932
14933 impl<'de> serde::de::Deserialize<'de> for State {
14934 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14935 where
14936 D: serde::Deserializer<'de>,
14937 {
14938 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
14939 ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
14940 ))
14941 }
14942 }
14943}
14944
14945/// The long-running operation metadata for the
14946/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14947/// method.
14948///
14949/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14950#[derive(Clone, Default, PartialEq)]
14951#[non_exhaustive]
14952pub struct ReviewDocumentOperationMetadata {
14953 /// The basic metadata of the long-running operation.
14954 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14955
14956 /// The Crowd Compute question ID.
14957 pub question_id: std::string::String,
14958
14959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14960}
14961
14962impl ReviewDocumentOperationMetadata {
14963 pub fn new() -> Self {
14964 std::default::Default::default()
14965 }
14966
14967 /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
14968 ///
14969 /// # Example
14970 /// ```ignore,no_run
14971 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14972 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14973 /// let x = ReviewDocumentOperationMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14974 /// ```
14975 pub fn set_common_metadata<T>(mut self, v: T) -> Self
14976 where
14977 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14978 {
14979 self.common_metadata = std::option::Option::Some(v.into());
14980 self
14981 }
14982
14983 /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
14984 ///
14985 /// # Example
14986 /// ```ignore,no_run
14987 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
14988 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14989 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14990 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14991 /// ```
14992 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14993 where
14994 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14995 {
14996 self.common_metadata = v.map(|x| x.into());
14997 self
14998 }
14999
15000 /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
15001 ///
15002 /// # Example
15003 /// ```ignore,no_run
15004 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15005 /// let x = ReviewDocumentOperationMetadata::new().set_question_id("example");
15006 /// ```
15007 pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15008 self.question_id = v.into();
15009 self
15010 }
15011}
15012
15013impl wkt::message::Message for ReviewDocumentOperationMetadata {
15014 fn typename() -> &'static str {
15015 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
15016 }
15017}
15018
15019/// Evaluates the given
15020/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
15021/// supplied documents.
15022///
15023/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15024#[derive(Clone, Default, PartialEq)]
15025#[non_exhaustive]
15026pub struct EvaluateProcessorVersionRequest {
15027 /// Required. The resource name of the
15028 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
15029 /// evaluate.
15030 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15031 ///
15032 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15033 pub processor_version: std::string::String,
15034
15035 /// Optional. The documents used in the evaluation. If unspecified, use the
15036 /// processor's dataset as evaluation input.
15037 pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
15038
15039 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15040}
15041
15042impl EvaluateProcessorVersionRequest {
15043 pub fn new() -> Self {
15044 std::default::Default::default()
15045 }
15046
15047 /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
15048 ///
15049 /// # Example
15050 /// ```ignore,no_run
15051 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15052 /// let x = EvaluateProcessorVersionRequest::new().set_processor_version("example");
15053 /// ```
15054 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
15055 mut self,
15056 v: T,
15057 ) -> Self {
15058 self.processor_version = v.into();
15059 self
15060 }
15061
15062 /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15063 ///
15064 /// # Example
15065 /// ```ignore,no_run
15066 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15067 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15068 /// let x = EvaluateProcessorVersionRequest::new().set_evaluation_documents(BatchDocumentsInputConfig::default()/* use setters */);
15069 /// ```
15070 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
15071 where
15072 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15073 {
15074 self.evaluation_documents = std::option::Option::Some(v.into());
15075 self
15076 }
15077
15078 /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15079 ///
15080 /// # Example
15081 /// ```ignore,no_run
15082 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15083 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15084 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
15085 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(None::<BatchDocumentsInputConfig>);
15086 /// ```
15087 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
15088 where
15089 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15090 {
15091 self.evaluation_documents = v.map(|x| x.into());
15092 self
15093 }
15094}
15095
15096impl wkt::message::Message for EvaluateProcessorVersionRequest {
15097 fn typename() -> &'static str {
15098 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
15099 }
15100}
15101
15102/// Metadata of the
15103/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15104/// method.
15105///
15106/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15107#[derive(Clone, Default, PartialEq)]
15108#[non_exhaustive]
15109pub struct EvaluateProcessorVersionMetadata {
15110 /// The basic metadata of the long-running operation.
15111 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15112
15113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15114}
15115
15116impl EvaluateProcessorVersionMetadata {
15117 pub fn new() -> Self {
15118 std::default::Default::default()
15119 }
15120
15121 /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15122 ///
15123 /// # Example
15124 /// ```ignore,no_run
15125 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15126 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15127 /// let x = EvaluateProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15128 /// ```
15129 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15130 where
15131 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15132 {
15133 self.common_metadata = std::option::Option::Some(v.into());
15134 self
15135 }
15136
15137 /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15138 ///
15139 /// # Example
15140 /// ```ignore,no_run
15141 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15142 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15143 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15144 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15145 /// ```
15146 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15147 where
15148 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15149 {
15150 self.common_metadata = v.map(|x| x.into());
15151 self
15152 }
15153}
15154
15155impl wkt::message::Message for EvaluateProcessorVersionMetadata {
15156 fn typename() -> &'static str {
15157 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
15158 }
15159}
15160
15161/// Response of the
15162/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15163/// method.
15164///
15165/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15166#[derive(Clone, Default, PartialEq)]
15167#[non_exhaustive]
15168pub struct EvaluateProcessorVersionResponse {
15169 /// The resource name of the created evaluation.
15170 pub evaluation: std::string::String,
15171
15172 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15173}
15174
15175impl EvaluateProcessorVersionResponse {
15176 pub fn new() -> Self {
15177 std::default::Default::default()
15178 }
15179
15180 /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
15181 ///
15182 /// # Example
15183 /// ```ignore,no_run
15184 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionResponse;
15185 /// let x = EvaluateProcessorVersionResponse::new().set_evaluation("example");
15186 /// ```
15187 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15188 self.evaluation = v.into();
15189 self
15190 }
15191}
15192
15193impl wkt::message::Message for EvaluateProcessorVersionResponse {
15194 fn typename() -> &'static str {
15195 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
15196 }
15197}
15198
15199/// Retrieves a specific Evaluation.
15200#[derive(Clone, Default, PartialEq)]
15201#[non_exhaustive]
15202pub struct GetEvaluationRequest {
15203 /// Required. The resource name of the
15204 /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
15205 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
15206 ///
15207 /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
15208 pub name: std::string::String,
15209
15210 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15211}
15212
15213impl GetEvaluationRequest {
15214 pub fn new() -> Self {
15215 std::default::Default::default()
15216 }
15217
15218 /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
15219 ///
15220 /// # Example
15221 /// ```ignore,no_run
15222 /// # use google_cloud_documentai_v1::model::GetEvaluationRequest;
15223 /// let x = GetEvaluationRequest::new().set_name("example");
15224 /// ```
15225 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15226 self.name = v.into();
15227 self
15228 }
15229}
15230
15231impl wkt::message::Message for GetEvaluationRequest {
15232 fn typename() -> &'static str {
15233 "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
15234 }
15235}
15236
15237/// Retrieves a list of evaluations for a given
15238/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
15239///
15240/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15241#[derive(Clone, Default, PartialEq)]
15242#[non_exhaustive]
15243pub struct ListEvaluationsRequest {
15244 /// Required. The resource name of the
15245 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
15246 /// evaluations for.
15247 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15248 ///
15249 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15250 pub parent: std::string::String,
15251
15252 /// The standard list page size.
15253 /// If unspecified, at most `5` evaluations are returned.
15254 /// The maximum value is `100`. Values above `100` are coerced to `100`.
15255 pub page_size: i32,
15256
15257 /// A page token, received from a previous `ListEvaluations` call.
15258 /// Provide this to retrieve the subsequent page.
15259 pub page_token: std::string::String,
15260
15261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15262}
15263
15264impl ListEvaluationsRequest {
15265 pub fn new() -> Self {
15266 std::default::Default::default()
15267 }
15268
15269 /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
15270 ///
15271 /// # Example
15272 /// ```ignore,no_run
15273 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15274 /// let x = ListEvaluationsRequest::new().set_parent("example");
15275 /// ```
15276 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15277 self.parent = v.into();
15278 self
15279 }
15280
15281 /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
15282 ///
15283 /// # Example
15284 /// ```ignore,no_run
15285 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15286 /// let x = ListEvaluationsRequest::new().set_page_size(42);
15287 /// ```
15288 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15289 self.page_size = v.into();
15290 self
15291 }
15292
15293 /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
15294 ///
15295 /// # Example
15296 /// ```ignore,no_run
15297 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15298 /// let x = ListEvaluationsRequest::new().set_page_token("example");
15299 /// ```
15300 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15301 self.page_token = v.into();
15302 self
15303 }
15304}
15305
15306impl wkt::message::Message for ListEvaluationsRequest {
15307 fn typename() -> &'static str {
15308 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
15309 }
15310}
15311
15312/// The response from `ListEvaluations`.
15313#[derive(Clone, Default, PartialEq)]
15314#[non_exhaustive]
15315pub struct ListEvaluationsResponse {
15316 /// The evaluations requested.
15317 pub evaluations: std::vec::Vec<crate::model::Evaluation>,
15318
15319 /// A token, which can be sent as `page_token` to retrieve the next page.
15320 /// If this field is omitted, there are no subsequent pages.
15321 pub next_page_token: std::string::String,
15322
15323 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15324}
15325
15326impl ListEvaluationsResponse {
15327 pub fn new() -> Self {
15328 std::default::Default::default()
15329 }
15330
15331 /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
15332 ///
15333 /// # Example
15334 /// ```ignore,no_run
15335 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15336 /// use google_cloud_documentai_v1::model::Evaluation;
15337 /// let x = ListEvaluationsResponse::new()
15338 /// .set_evaluations([
15339 /// Evaluation::default()/* use setters */,
15340 /// Evaluation::default()/* use (different) setters */,
15341 /// ]);
15342 /// ```
15343 pub fn set_evaluations<T, V>(mut self, v: T) -> Self
15344 where
15345 T: std::iter::IntoIterator<Item = V>,
15346 V: std::convert::Into<crate::model::Evaluation>,
15347 {
15348 use std::iter::Iterator;
15349 self.evaluations = v.into_iter().map(|i| i.into()).collect();
15350 self
15351 }
15352
15353 /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
15354 ///
15355 /// # Example
15356 /// ```ignore,no_run
15357 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15358 /// let x = ListEvaluationsResponse::new().set_next_page_token("example");
15359 /// ```
15360 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15361 self.next_page_token = v.into();
15362 self
15363 }
15364}
15365
15366impl wkt::message::Message for ListEvaluationsResponse {
15367 fn typename() -> &'static str {
15368 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
15369 }
15370}
15371
15372#[doc(hidden)]
15373impl google_cloud_gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
15374 type PageItem = crate::model::Evaluation;
15375
15376 fn items(self) -> std::vec::Vec<Self::PageItem> {
15377 self.evaluations
15378 }
15379
15380 fn next_page_token(&self) -> std::string::String {
15381 use std::clone::Clone;
15382 self.next_page_token.clone()
15383 }
15384}
15385
15386/// The schema defines the output of the processed document by a processor.
15387#[derive(Clone, Default, PartialEq)]
15388#[non_exhaustive]
15389pub struct DocumentSchema {
15390 /// Display name to show to users.
15391 pub display_name: std::string::String,
15392
15393 /// Description of the schema.
15394 pub description: std::string::String,
15395
15396 /// Entity types of the schema.
15397 pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
15398
15399 /// Metadata of the schema.
15400 pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
15401
15402 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15403}
15404
15405impl DocumentSchema {
15406 pub fn new() -> Self {
15407 std::default::Default::default()
15408 }
15409
15410 /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
15411 ///
15412 /// # Example
15413 /// ```ignore,no_run
15414 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15415 /// let x = DocumentSchema::new().set_display_name("example");
15416 /// ```
15417 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15418 self.display_name = v.into();
15419 self
15420 }
15421
15422 /// Sets the value of [description][crate::model::DocumentSchema::description].
15423 ///
15424 /// # Example
15425 /// ```ignore,no_run
15426 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15427 /// let x = DocumentSchema::new().set_description("example");
15428 /// ```
15429 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15430 self.description = v.into();
15431 self
15432 }
15433
15434 /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
15435 ///
15436 /// # Example
15437 /// ```ignore,no_run
15438 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15439 /// use google_cloud_documentai_v1::model::document_schema::EntityType;
15440 /// let x = DocumentSchema::new()
15441 /// .set_entity_types([
15442 /// EntityType::default()/* use setters */,
15443 /// EntityType::default()/* use (different) setters */,
15444 /// ]);
15445 /// ```
15446 pub fn set_entity_types<T, V>(mut self, v: T) -> Self
15447 where
15448 T: std::iter::IntoIterator<Item = V>,
15449 V: std::convert::Into<crate::model::document_schema::EntityType>,
15450 {
15451 use std::iter::Iterator;
15452 self.entity_types = v.into_iter().map(|i| i.into()).collect();
15453 self
15454 }
15455
15456 /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
15457 ///
15458 /// # Example
15459 /// ```ignore,no_run
15460 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15461 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15462 /// let x = DocumentSchema::new().set_metadata(Metadata::default()/* use setters */);
15463 /// ```
15464 pub fn set_metadata<T>(mut self, v: T) -> Self
15465 where
15466 T: std::convert::Into<crate::model::document_schema::Metadata>,
15467 {
15468 self.metadata = std::option::Option::Some(v.into());
15469 self
15470 }
15471
15472 /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
15473 ///
15474 /// # Example
15475 /// ```ignore,no_run
15476 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15477 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15478 /// let x = DocumentSchema::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
15479 /// let x = DocumentSchema::new().set_or_clear_metadata(None::<Metadata>);
15480 /// ```
15481 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15482 where
15483 T: std::convert::Into<crate::model::document_schema::Metadata>,
15484 {
15485 self.metadata = v.map(|x| x.into());
15486 self
15487 }
15488}
15489
15490impl wkt::message::Message for DocumentSchema {
15491 fn typename() -> &'static str {
15492 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
15493 }
15494}
15495
15496/// Defines additional types related to [DocumentSchema].
15497pub mod document_schema {
15498 #[allow(unused_imports)]
15499 use super::*;
15500
15501 /// EntityType is the wrapper of a label of the corresponding model with
15502 /// detailed attributes and limitations for entity-based processors. Multiple
15503 /// types can also compose a dependency tree to represent nested types.
15504 #[derive(Clone, Default, PartialEq)]
15505 #[non_exhaustive]
15506 pub struct EntityType {
15507 /// User defined name for the type.
15508 pub display_name: std::string::String,
15509
15510 /// Name of the type. It must be unique within the schema file and
15511 /// cannot be a "Common Type". The following naming conventions are used:
15512 ///
15513 /// - Use `snake_casing`.
15514 /// - Name matching is case-sensitive.
15515 /// - Maximum 64 characters.
15516 /// - Must start with a letter.
15517 /// - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward
15518 /// compatibility internal infrastructure and tooling can handle any ascii
15519 /// character.)
15520 /// - The `/` is sometimes used to denote a property of a type. For example
15521 /// `line_item/amount`. This convention is deprecated, but will still be
15522 /// honored for backward compatibility.
15523 pub name: std::string::String,
15524
15525 /// The entity type that this type is derived from. For now, one and only
15526 /// one should be set.
15527 pub base_types: std::vec::Vec<std::string::String>,
15528
15529 /// Description the nested structure, or composition of an entity.
15530 pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
15531
15532 pub value_source:
15533 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15534
15535 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15536 }
15537
15538 impl EntityType {
15539 pub fn new() -> Self {
15540 std::default::Default::default()
15541 }
15542
15543 /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
15544 ///
15545 /// # Example
15546 /// ```ignore,no_run
15547 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15548 /// let x = EntityType::new().set_display_name("example");
15549 /// ```
15550 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15551 mut self,
15552 v: T,
15553 ) -> Self {
15554 self.display_name = v.into();
15555 self
15556 }
15557
15558 /// Sets the value of [name][crate::model::document_schema::EntityType::name].
15559 ///
15560 /// # Example
15561 /// ```ignore,no_run
15562 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15563 /// let x = EntityType::new().set_name("example");
15564 /// ```
15565 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15566 self.name = v.into();
15567 self
15568 }
15569
15570 /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
15571 ///
15572 /// # Example
15573 /// ```ignore,no_run
15574 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15575 /// let x = EntityType::new().set_base_types(["a", "b", "c"]);
15576 /// ```
15577 pub fn set_base_types<T, V>(mut self, v: T) -> Self
15578 where
15579 T: std::iter::IntoIterator<Item = V>,
15580 V: std::convert::Into<std::string::String>,
15581 {
15582 use std::iter::Iterator;
15583 self.base_types = v.into_iter().map(|i| i.into()).collect();
15584 self
15585 }
15586
15587 /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
15588 ///
15589 /// # Example
15590 /// ```ignore,no_run
15591 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15592 /// use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15593 /// let x = EntityType::new()
15594 /// .set_properties([
15595 /// Property::default()/* use setters */,
15596 /// Property::default()/* use (different) setters */,
15597 /// ]);
15598 /// ```
15599 pub fn set_properties<T, V>(mut self, v: T) -> Self
15600 where
15601 T: std::iter::IntoIterator<Item = V>,
15602 V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
15603 {
15604 use std::iter::Iterator;
15605 self.properties = v.into_iter().map(|i| i.into()).collect();
15606 self
15607 }
15608
15609 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
15610 ///
15611 /// Note that all the setters affecting `value_source` are mutually
15612 /// exclusive.
15613 ///
15614 /// # Example
15615 /// ```ignore,no_run
15616 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15617 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15618 /// let x = EntityType::new().set_value_source(Some(
15619 /// google_cloud_documentai_v1::model::document_schema::entity_type::ValueSource::EnumValues(EnumValues::default().into())));
15620 /// ```
15621 pub fn set_value_source<
15622 T: std::convert::Into<
15623 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15624 >,
15625 >(
15626 mut self,
15627 v: T,
15628 ) -> Self {
15629 self.value_source = v.into();
15630 self
15631 }
15632
15633 /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
15634 /// if it holds a `EnumValues`, `None` if the field is not set or
15635 /// holds a different branch.
15636 pub fn enum_values(
15637 &self,
15638 ) -> std::option::Option<
15639 &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15640 > {
15641 #[allow(unreachable_patterns)]
15642 self.value_source.as_ref().and_then(|v| match v {
15643 crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
15644 std::option::Option::Some(v)
15645 }
15646 _ => std::option::Option::None,
15647 })
15648 }
15649
15650 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
15651 /// to hold a `EnumValues`.
15652 ///
15653 /// Note that all the setters affecting `value_source` are
15654 /// mutually exclusive.
15655 ///
15656 /// # Example
15657 /// ```ignore,no_run
15658 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15659 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15660 /// let x = EntityType::new().set_enum_values(EnumValues::default()/* use setters */);
15661 /// assert!(x.enum_values().is_some());
15662 /// ```
15663 pub fn set_enum_values<
15664 T: std::convert::Into<
15665 std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15666 >,
15667 >(
15668 mut self,
15669 v: T,
15670 ) -> Self {
15671 self.value_source = std::option::Option::Some(
15672 crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
15673 );
15674 self
15675 }
15676 }
15677
15678 impl wkt::message::Message for EntityType {
15679 fn typename() -> &'static str {
15680 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
15681 }
15682 }
15683
15684 /// Defines additional types related to [EntityType].
15685 pub mod entity_type {
15686 #[allow(unused_imports)]
15687 use super::*;
15688
15689 /// Defines the a list of enum values.
15690 #[derive(Clone, Default, PartialEq)]
15691 #[non_exhaustive]
15692 pub struct EnumValues {
15693 /// The individual values that this enum values type can include.
15694 pub values: std::vec::Vec<std::string::String>,
15695
15696 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15697 }
15698
15699 impl EnumValues {
15700 pub fn new() -> Self {
15701 std::default::Default::default()
15702 }
15703
15704 /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
15705 ///
15706 /// # Example
15707 /// ```ignore,no_run
15708 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15709 /// let x = EnumValues::new().set_values(["a", "b", "c"]);
15710 /// ```
15711 pub fn set_values<T, V>(mut self, v: T) -> Self
15712 where
15713 T: std::iter::IntoIterator<Item = V>,
15714 V: std::convert::Into<std::string::String>,
15715 {
15716 use std::iter::Iterator;
15717 self.values = v.into_iter().map(|i| i.into()).collect();
15718 self
15719 }
15720 }
15721
15722 impl wkt::message::Message for EnumValues {
15723 fn typename() -> &'static str {
15724 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
15725 }
15726 }
15727
15728 /// Defines properties that can be part of the entity type.
15729 #[derive(Clone, Default, PartialEq)]
15730 #[non_exhaustive]
15731 pub struct Property {
15732 /// The name of the property. Follows the same guidelines as the
15733 /// EntityType name.
15734 pub name: std::string::String,
15735
15736 /// User defined name for the property.
15737 pub display_name: std::string::String,
15738
15739 /// A reference to the value type of the property. This type is subject
15740 /// to the same conventions as the `Entity.base_types` field.
15741 pub value_type: std::string::String,
15742
15743 /// Occurrence type limits the number of instances an entity type appears
15744 /// in the document.
15745 pub occurrence_type:
15746 crate::model::document_schema::entity_type::property::OccurrenceType,
15747
15748 /// Specifies how the entity's value is obtained.
15749 pub method: crate::model::document_schema::entity_type::property::Method,
15750
15751 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15752 }
15753
15754 impl Property {
15755 pub fn new() -> Self {
15756 std::default::Default::default()
15757 }
15758
15759 /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
15760 ///
15761 /// # Example
15762 /// ```ignore,no_run
15763 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15764 /// let x = Property::new().set_name("example");
15765 /// ```
15766 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15767 self.name = v.into();
15768 self
15769 }
15770
15771 /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
15772 ///
15773 /// # Example
15774 /// ```ignore,no_run
15775 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15776 /// let x = Property::new().set_display_name("example");
15777 /// ```
15778 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15779 mut self,
15780 v: T,
15781 ) -> Self {
15782 self.display_name = v.into();
15783 self
15784 }
15785
15786 /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
15787 ///
15788 /// # Example
15789 /// ```ignore,no_run
15790 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15791 /// let x = Property::new().set_value_type("example");
15792 /// ```
15793 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
15794 mut self,
15795 v: T,
15796 ) -> Self {
15797 self.value_type = v.into();
15798 self
15799 }
15800
15801 /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
15802 ///
15803 /// # Example
15804 /// ```ignore,no_run
15805 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15806 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::OccurrenceType;
15807 /// let x0 = Property::new().set_occurrence_type(OccurrenceType::OptionalOnce);
15808 /// let x1 = Property::new().set_occurrence_type(OccurrenceType::OptionalMultiple);
15809 /// let x2 = Property::new().set_occurrence_type(OccurrenceType::RequiredOnce);
15810 /// ```
15811 pub fn set_occurrence_type<
15812 T: std::convert::Into<
15813 crate::model::document_schema::entity_type::property::OccurrenceType,
15814 >,
15815 >(
15816 mut self,
15817 v: T,
15818 ) -> Self {
15819 self.occurrence_type = v.into();
15820 self
15821 }
15822
15823 /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
15824 ///
15825 /// # Example
15826 /// ```ignore,no_run
15827 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15828 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::Method;
15829 /// let x0 = Property::new().set_method(Method::Extract);
15830 /// let x1 = Property::new().set_method(Method::Derive);
15831 /// ```
15832 pub fn set_method<
15833 T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
15834 >(
15835 mut self,
15836 v: T,
15837 ) -> Self {
15838 self.method = v.into();
15839 self
15840 }
15841 }
15842
15843 impl wkt::message::Message for Property {
15844 fn typename() -> &'static str {
15845 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
15846 }
15847 }
15848
15849 /// Defines additional types related to [Property].
15850 pub mod property {
15851 #[allow(unused_imports)]
15852 use super::*;
15853
15854 /// Types of occurrences of the entity type in the document. This
15855 /// represents the number of instances, not mentions, of an entity.
15856 /// For example, a bank statement might only have one
15857 /// `account_number`, but this account number can be mentioned in several
15858 /// places on the document. In this case, the `account_number` is
15859 /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
15860 /// expect a bank statement to contain the status of multiple different
15861 /// accounts for the customers, the occurrence type is set to
15862 /// `REQUIRED_MULTIPLE`.
15863 ///
15864 /// # Working with unknown values
15865 ///
15866 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15867 /// additional enum variants at any time. Adding new variants is not considered
15868 /// a breaking change. Applications should write their code in anticipation of:
15869 ///
15870 /// - New values appearing in future releases of the client library, **and**
15871 /// - New values received dynamically, without application changes.
15872 ///
15873 /// Please consult the [Working with enums] section in the user guide for some
15874 /// guidelines.
15875 ///
15876 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15877 #[derive(Clone, Debug, PartialEq)]
15878 #[non_exhaustive]
15879 pub enum OccurrenceType {
15880 /// Unspecified occurrence type.
15881 Unspecified,
15882 /// There will be zero or one instance of this entity type. The same
15883 /// entity instance may be mentioned multiple times.
15884 OptionalOnce,
15885 /// The entity type will appear zero or multiple times.
15886 OptionalMultiple,
15887 /// The entity type will only appear exactly once. The same
15888 /// entity instance may be mentioned multiple times.
15889 RequiredOnce,
15890 /// The entity type will appear once or more times.
15891 RequiredMultiple,
15892 /// If set, the enum was initialized with an unknown value.
15893 ///
15894 /// Applications can examine the value using [OccurrenceType::value] or
15895 /// [OccurrenceType::name].
15896 UnknownValue(occurrence_type::UnknownValue),
15897 }
15898
15899 #[doc(hidden)]
15900 pub mod occurrence_type {
15901 #[allow(unused_imports)]
15902 use super::*;
15903 #[derive(Clone, Debug, PartialEq)]
15904 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15905 }
15906
15907 impl OccurrenceType {
15908 /// Gets the enum value.
15909 ///
15910 /// Returns `None` if the enum contains an unknown value deserialized from
15911 /// the string representation of enums.
15912 pub fn value(&self) -> std::option::Option<i32> {
15913 match self {
15914 Self::Unspecified => std::option::Option::Some(0),
15915 Self::OptionalOnce => std::option::Option::Some(1),
15916 Self::OptionalMultiple => std::option::Option::Some(2),
15917 Self::RequiredOnce => std::option::Option::Some(3),
15918 Self::RequiredMultiple => std::option::Option::Some(4),
15919 Self::UnknownValue(u) => u.0.value(),
15920 }
15921 }
15922
15923 /// Gets the enum value as a string.
15924 ///
15925 /// Returns `None` if the enum contains an unknown value deserialized from
15926 /// the integer representation of enums.
15927 pub fn name(&self) -> std::option::Option<&str> {
15928 match self {
15929 Self::Unspecified => {
15930 std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
15931 }
15932 Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
15933 Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
15934 Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
15935 Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
15936 Self::UnknownValue(u) => u.0.name(),
15937 }
15938 }
15939 }
15940
15941 impl std::default::Default for OccurrenceType {
15942 fn default() -> Self {
15943 use std::convert::From;
15944 Self::from(0)
15945 }
15946 }
15947
15948 impl std::fmt::Display for OccurrenceType {
15949 fn fmt(
15950 &self,
15951 f: &mut std::fmt::Formatter<'_>,
15952 ) -> std::result::Result<(), std::fmt::Error> {
15953 wkt::internal::display_enum(f, self.name(), self.value())
15954 }
15955 }
15956
15957 impl std::convert::From<i32> for OccurrenceType {
15958 fn from(value: i32) -> Self {
15959 match value {
15960 0 => Self::Unspecified,
15961 1 => Self::OptionalOnce,
15962 2 => Self::OptionalMultiple,
15963 3 => Self::RequiredOnce,
15964 4 => Self::RequiredMultiple,
15965 _ => Self::UnknownValue(occurrence_type::UnknownValue(
15966 wkt::internal::UnknownEnumValue::Integer(value),
15967 )),
15968 }
15969 }
15970 }
15971
15972 impl std::convert::From<&str> for OccurrenceType {
15973 fn from(value: &str) -> Self {
15974 use std::string::ToString;
15975 match value {
15976 "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
15977 "OPTIONAL_ONCE" => Self::OptionalOnce,
15978 "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
15979 "REQUIRED_ONCE" => Self::RequiredOnce,
15980 "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
15981 _ => Self::UnknownValue(occurrence_type::UnknownValue(
15982 wkt::internal::UnknownEnumValue::String(value.to_string()),
15983 )),
15984 }
15985 }
15986 }
15987
15988 impl serde::ser::Serialize for OccurrenceType {
15989 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15990 where
15991 S: serde::Serializer,
15992 {
15993 match self {
15994 Self::Unspecified => serializer.serialize_i32(0),
15995 Self::OptionalOnce => serializer.serialize_i32(1),
15996 Self::OptionalMultiple => serializer.serialize_i32(2),
15997 Self::RequiredOnce => serializer.serialize_i32(3),
15998 Self::RequiredMultiple => serializer.serialize_i32(4),
15999 Self::UnknownValue(u) => u.0.serialize(serializer),
16000 }
16001 }
16002 }
16003
16004 impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
16005 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16006 where
16007 D: serde::Deserializer<'de>,
16008 {
16009 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
16010 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
16011 }
16012 }
16013
16014 /// Specifies how the entity's value is obtained from the document.
16015 ///
16016 /// # Working with unknown values
16017 ///
16018 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16019 /// additional enum variants at any time. Adding new variants is not considered
16020 /// a breaking change. Applications should write their code in anticipation of:
16021 ///
16022 /// - New values appearing in future releases of the client library, **and**
16023 /// - New values received dynamically, without application changes.
16024 ///
16025 /// Please consult the [Working with enums] section in the user guide for some
16026 /// guidelines.
16027 ///
16028 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16029 #[derive(Clone, Debug, PartialEq)]
16030 #[non_exhaustive]
16031 pub enum Method {
16032 /// Unspecified method. It defaults to `EXTRACT`.
16033 Unspecified,
16034 /// The entity's value is directly extracted as-is from the document
16035 /// text.
16036 Extract,
16037 /// The entity's value is derived through inference and is not
16038 /// necessarily an exact text extraction from the document.
16039 Derive,
16040 /// If set, the enum was initialized with an unknown value.
16041 ///
16042 /// Applications can examine the value using [Method::value] or
16043 /// [Method::name].
16044 UnknownValue(method::UnknownValue),
16045 }
16046
16047 #[doc(hidden)]
16048 pub mod method {
16049 #[allow(unused_imports)]
16050 use super::*;
16051 #[derive(Clone, Debug, PartialEq)]
16052 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16053 }
16054
16055 impl Method {
16056 /// Gets the enum value.
16057 ///
16058 /// Returns `None` if the enum contains an unknown value deserialized from
16059 /// the string representation of enums.
16060 pub fn value(&self) -> std::option::Option<i32> {
16061 match self {
16062 Self::Unspecified => std::option::Option::Some(0),
16063 Self::Extract => std::option::Option::Some(1),
16064 Self::Derive => std::option::Option::Some(2),
16065 Self::UnknownValue(u) => u.0.value(),
16066 }
16067 }
16068
16069 /// Gets the enum value as a string.
16070 ///
16071 /// Returns `None` if the enum contains an unknown value deserialized from
16072 /// the integer representation of enums.
16073 pub fn name(&self) -> std::option::Option<&str> {
16074 match self {
16075 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
16076 Self::Extract => std::option::Option::Some("EXTRACT"),
16077 Self::Derive => std::option::Option::Some("DERIVE"),
16078 Self::UnknownValue(u) => u.0.name(),
16079 }
16080 }
16081 }
16082
16083 impl std::default::Default for Method {
16084 fn default() -> Self {
16085 use std::convert::From;
16086 Self::from(0)
16087 }
16088 }
16089
16090 impl std::fmt::Display for Method {
16091 fn fmt(
16092 &self,
16093 f: &mut std::fmt::Formatter<'_>,
16094 ) -> std::result::Result<(), std::fmt::Error> {
16095 wkt::internal::display_enum(f, self.name(), self.value())
16096 }
16097 }
16098
16099 impl std::convert::From<i32> for Method {
16100 fn from(value: i32) -> Self {
16101 match value {
16102 0 => Self::Unspecified,
16103 1 => Self::Extract,
16104 2 => Self::Derive,
16105 _ => Self::UnknownValue(method::UnknownValue(
16106 wkt::internal::UnknownEnumValue::Integer(value),
16107 )),
16108 }
16109 }
16110 }
16111
16112 impl std::convert::From<&str> for Method {
16113 fn from(value: &str) -> Self {
16114 use std::string::ToString;
16115 match value {
16116 "METHOD_UNSPECIFIED" => Self::Unspecified,
16117 "EXTRACT" => Self::Extract,
16118 "DERIVE" => Self::Derive,
16119 _ => Self::UnknownValue(method::UnknownValue(
16120 wkt::internal::UnknownEnumValue::String(value.to_string()),
16121 )),
16122 }
16123 }
16124 }
16125
16126 impl serde::ser::Serialize for Method {
16127 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16128 where
16129 S: serde::Serializer,
16130 {
16131 match self {
16132 Self::Unspecified => serializer.serialize_i32(0),
16133 Self::Extract => serializer.serialize_i32(1),
16134 Self::Derive => serializer.serialize_i32(2),
16135 Self::UnknownValue(u) => u.0.serialize(serializer),
16136 }
16137 }
16138 }
16139
16140 impl<'de> serde::de::Deserialize<'de> for Method {
16141 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16142 where
16143 D: serde::Deserializer<'de>,
16144 {
16145 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
16146 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
16147 ))
16148 }
16149 }
16150 }
16151
16152 #[derive(Clone, Debug, PartialEq)]
16153 #[non_exhaustive]
16154 pub enum ValueSource {
16155 /// If specified, lists all the possible values for this entity. This
16156 /// should not be more than a handful of values. If the number of values
16157 /// is >10 or could change frequently use the `EntityType.value_ontology`
16158 /// field and specify a list of all possible values in a value ontology
16159 /// file.
16160 EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
16161 }
16162 }
16163
16164 /// Metadata for global schema behavior.
16165 #[derive(Clone, Default, PartialEq)]
16166 #[non_exhaustive]
16167 pub struct Metadata {
16168 /// If true, a `document` entity type can be applied to subdocument
16169 /// (splitting). Otherwise, it can only be applied to the entire document
16170 /// (classification).
16171 pub document_splitter: bool,
16172
16173 /// If true, on a given page, there can be multiple `document` annotations
16174 /// covering it.
16175 pub document_allow_multiple_labels: bool,
16176
16177 /// If set, all the nested entities must be prefixed with the parents.
16178 pub prefixed_naming_on_properties: bool,
16179
16180 /// If set, we will skip the naming format validation in the schema. So the
16181 /// string values in `DocumentSchema.EntityType.name` and
16182 /// `DocumentSchema.EntityType.Property.name` will not be checked.
16183 pub skip_naming_validation: bool,
16184
16185 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16186 }
16187
16188 impl Metadata {
16189 pub fn new() -> Self {
16190 std::default::Default::default()
16191 }
16192
16193 /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
16194 ///
16195 /// # Example
16196 /// ```ignore,no_run
16197 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16198 /// let x = Metadata::new().set_document_splitter(true);
16199 /// ```
16200 pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16201 self.document_splitter = v.into();
16202 self
16203 }
16204
16205 /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
16206 ///
16207 /// # Example
16208 /// ```ignore,no_run
16209 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16210 /// let x = Metadata::new().set_document_allow_multiple_labels(true);
16211 /// ```
16212 pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
16213 mut self,
16214 v: T,
16215 ) -> Self {
16216 self.document_allow_multiple_labels = v.into();
16217 self
16218 }
16219
16220 /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
16221 ///
16222 /// # Example
16223 /// ```ignore,no_run
16224 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16225 /// let x = Metadata::new().set_prefixed_naming_on_properties(true);
16226 /// ```
16227 pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
16228 mut self,
16229 v: T,
16230 ) -> Self {
16231 self.prefixed_naming_on_properties = v.into();
16232 self
16233 }
16234
16235 /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
16236 ///
16237 /// # Example
16238 /// ```ignore,no_run
16239 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16240 /// let x = Metadata::new().set_skip_naming_validation(true);
16241 /// ```
16242 pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16243 self.skip_naming_validation = v.into();
16244 self
16245 }
16246 }
16247
16248 impl wkt::message::Message for Metadata {
16249 fn typename() -> &'static str {
16250 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
16251 }
16252 }
16253}
16254
16255/// Gives a short summary of an evaluation, and links to the evaluation itself.
16256#[derive(Clone, Default, PartialEq)]
16257#[non_exhaustive]
16258pub struct EvaluationReference {
16259 /// The resource name of the Long Running Operation for the evaluation.
16260 pub operation: std::string::String,
16261
16262 /// The resource name of the evaluation.
16263 pub evaluation: std::string::String,
16264
16265 /// An aggregate of the statistics for the evaluation with fuzzy matching on.
16266 pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
16267
16268 /// An aggregate of the statistics for the evaluation with fuzzy matching off.
16269 pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
16270
16271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16272}
16273
16274impl EvaluationReference {
16275 pub fn new() -> Self {
16276 std::default::Default::default()
16277 }
16278
16279 /// Sets the value of [operation][crate::model::EvaluationReference::operation].
16280 ///
16281 /// # Example
16282 /// ```ignore,no_run
16283 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16284 /// let x = EvaluationReference::new().set_operation("example");
16285 /// ```
16286 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16287 self.operation = v.into();
16288 self
16289 }
16290
16291 /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
16292 ///
16293 /// # Example
16294 /// ```ignore,no_run
16295 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16296 /// let x = EvaluationReference::new().set_evaluation("example");
16297 /// ```
16298 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16299 self.evaluation = v.into();
16300 self
16301 }
16302
16303 /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16304 ///
16305 /// # Example
16306 /// ```ignore,no_run
16307 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16308 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16309 /// let x = EvaluationReference::new().set_aggregate_metrics(Metrics::default()/* use setters */);
16310 /// ```
16311 pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
16312 where
16313 T: std::convert::Into<crate::model::evaluation::Metrics>,
16314 {
16315 self.aggregate_metrics = std::option::Option::Some(v.into());
16316 self
16317 }
16318
16319 /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16320 ///
16321 /// # Example
16322 /// ```ignore,no_run
16323 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16324 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16325 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(Some(Metrics::default()/* use setters */));
16326 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(None::<Metrics>);
16327 /// ```
16328 pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16329 where
16330 T: std::convert::Into<crate::model::evaluation::Metrics>,
16331 {
16332 self.aggregate_metrics = v.map(|x| x.into());
16333 self
16334 }
16335
16336 /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16337 ///
16338 /// # Example
16339 /// ```ignore,no_run
16340 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16341 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16342 /// let x = EvaluationReference::new().set_aggregate_metrics_exact(Metrics::default()/* use setters */);
16343 /// ```
16344 pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
16345 where
16346 T: std::convert::Into<crate::model::evaluation::Metrics>,
16347 {
16348 self.aggregate_metrics_exact = std::option::Option::Some(v.into());
16349 self
16350 }
16351
16352 /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16353 ///
16354 /// # Example
16355 /// ```ignore,no_run
16356 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16357 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16358 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(Some(Metrics::default()/* use setters */));
16359 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(None::<Metrics>);
16360 /// ```
16361 pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
16362 where
16363 T: std::convert::Into<crate::model::evaluation::Metrics>,
16364 {
16365 self.aggregate_metrics_exact = v.map(|x| x.into());
16366 self
16367 }
16368}
16369
16370impl wkt::message::Message for EvaluationReference {
16371 fn typename() -> &'static str {
16372 "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
16373 }
16374}
16375
16376/// An evaluation of a ProcessorVersion's performance.
16377#[derive(Clone, Default, PartialEq)]
16378#[non_exhaustive]
16379pub struct Evaluation {
16380 /// The resource name of the evaluation.
16381 /// Format:
16382 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
16383 pub name: std::string::String,
16384
16385 /// The time that the evaluation was created.
16386 pub create_time: std::option::Option<wkt::Timestamp>,
16387
16388 /// Counters for the documents used in the evaluation.
16389 pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
16390
16391 /// Metrics for all the entities in aggregate.
16392 pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
16393
16394 /// Metrics across confidence levels, for different entities.
16395 pub entity_metrics: std::collections::HashMap<
16396 std::string::String,
16397 crate::model::evaluation::MultiConfidenceMetrics,
16398 >,
16399
16400 /// The KMS key name used for encryption.
16401 pub kms_key_name: std::string::String,
16402
16403 /// The KMS key version with which data is encrypted.
16404 pub kms_key_version_name: std::string::String,
16405
16406 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16407}
16408
16409impl Evaluation {
16410 pub fn new() -> Self {
16411 std::default::Default::default()
16412 }
16413
16414 /// Sets the value of [name][crate::model::Evaluation::name].
16415 ///
16416 /// # Example
16417 /// ```ignore,no_run
16418 /// # use google_cloud_documentai_v1::model::Evaluation;
16419 /// let x = Evaluation::new().set_name("example");
16420 /// ```
16421 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16422 self.name = v.into();
16423 self
16424 }
16425
16426 /// Sets the value of [create_time][crate::model::Evaluation::create_time].
16427 ///
16428 /// # Example
16429 /// ```ignore,no_run
16430 /// # use google_cloud_documentai_v1::model::Evaluation;
16431 /// use wkt::Timestamp;
16432 /// let x = Evaluation::new().set_create_time(Timestamp::default()/* use setters */);
16433 /// ```
16434 pub fn set_create_time<T>(mut self, v: T) -> Self
16435 where
16436 T: std::convert::Into<wkt::Timestamp>,
16437 {
16438 self.create_time = std::option::Option::Some(v.into());
16439 self
16440 }
16441
16442 /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
16443 ///
16444 /// # Example
16445 /// ```ignore,no_run
16446 /// # use google_cloud_documentai_v1::model::Evaluation;
16447 /// use wkt::Timestamp;
16448 /// let x = Evaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16449 /// let x = Evaluation::new().set_or_clear_create_time(None::<Timestamp>);
16450 /// ```
16451 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16452 where
16453 T: std::convert::Into<wkt::Timestamp>,
16454 {
16455 self.create_time = v.map(|x| x.into());
16456 self
16457 }
16458
16459 /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
16460 ///
16461 /// # Example
16462 /// ```ignore,no_run
16463 /// # use google_cloud_documentai_v1::model::Evaluation;
16464 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16465 /// let x = Evaluation::new().set_document_counters(Counters::default()/* use setters */);
16466 /// ```
16467 pub fn set_document_counters<T>(mut self, v: T) -> Self
16468 where
16469 T: std::convert::Into<crate::model::evaluation::Counters>,
16470 {
16471 self.document_counters = std::option::Option::Some(v.into());
16472 self
16473 }
16474
16475 /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
16476 ///
16477 /// # Example
16478 /// ```ignore,no_run
16479 /// # use google_cloud_documentai_v1::model::Evaluation;
16480 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16481 /// let x = Evaluation::new().set_or_clear_document_counters(Some(Counters::default()/* use setters */));
16482 /// let x = Evaluation::new().set_or_clear_document_counters(None::<Counters>);
16483 /// ```
16484 pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
16485 where
16486 T: std::convert::Into<crate::model::evaluation::Counters>,
16487 {
16488 self.document_counters = v.map(|x| x.into());
16489 self
16490 }
16491
16492 /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16493 ///
16494 /// # Example
16495 /// ```ignore,no_run
16496 /// # use google_cloud_documentai_v1::model::Evaluation;
16497 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16498 /// let x = Evaluation::new().set_all_entities_metrics(MultiConfidenceMetrics::default()/* use setters */);
16499 /// ```
16500 pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
16501 where
16502 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16503 {
16504 self.all_entities_metrics = std::option::Option::Some(v.into());
16505 self
16506 }
16507
16508 /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16509 ///
16510 /// # Example
16511 /// ```ignore,no_run
16512 /// # use google_cloud_documentai_v1::model::Evaluation;
16513 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16514 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(Some(MultiConfidenceMetrics::default()/* use setters */));
16515 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(None::<MultiConfidenceMetrics>);
16516 /// ```
16517 pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16518 where
16519 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16520 {
16521 self.all_entities_metrics = v.map(|x| x.into());
16522 self
16523 }
16524
16525 /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
16526 ///
16527 /// # Example
16528 /// ```ignore,no_run
16529 /// # use google_cloud_documentai_v1::model::Evaluation;
16530 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16531 /// let x = Evaluation::new().set_entity_metrics([
16532 /// ("key0", MultiConfidenceMetrics::default()/* use setters */),
16533 /// ("key1", MultiConfidenceMetrics::default()/* use (different) setters */),
16534 /// ]);
16535 /// ```
16536 pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
16537 where
16538 T: std::iter::IntoIterator<Item = (K, V)>,
16539 K: std::convert::Into<std::string::String>,
16540 V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16541 {
16542 use std::iter::Iterator;
16543 self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16544 self
16545 }
16546
16547 /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
16548 ///
16549 /// # Example
16550 /// ```ignore,no_run
16551 /// # use google_cloud_documentai_v1::model::Evaluation;
16552 /// let x = Evaluation::new().set_kms_key_name("example");
16553 /// ```
16554 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16555 self.kms_key_name = v.into();
16556 self
16557 }
16558
16559 /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
16560 ///
16561 /// # Example
16562 /// ```ignore,no_run
16563 /// # use google_cloud_documentai_v1::model::Evaluation;
16564 /// let x = Evaluation::new().set_kms_key_version_name("example");
16565 /// ```
16566 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
16567 mut self,
16568 v: T,
16569 ) -> Self {
16570 self.kms_key_version_name = v.into();
16571 self
16572 }
16573}
16574
16575impl wkt::message::Message for Evaluation {
16576 fn typename() -> &'static str {
16577 "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
16578 }
16579}
16580
16581/// Defines additional types related to [Evaluation].
16582pub mod evaluation {
16583 #[allow(unused_imports)]
16584 use super::*;
16585
16586 /// Evaluation counters for the documents that were used.
16587 #[derive(Clone, Default, PartialEq)]
16588 #[non_exhaustive]
16589 pub struct Counters {
16590 /// How many documents were sent for evaluation.
16591 pub input_documents_count: i32,
16592
16593 /// How many documents were not included in the evaluation as they didn't
16594 /// pass validation.
16595 pub invalid_documents_count: i32,
16596
16597 /// How many documents were not included in the evaluation as Document AI
16598 /// failed to process them.
16599 pub failed_documents_count: i32,
16600
16601 /// How many documents were used in the evaluation.
16602 pub evaluated_documents_count: i32,
16603
16604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16605 }
16606
16607 impl Counters {
16608 pub fn new() -> Self {
16609 std::default::Default::default()
16610 }
16611
16612 /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
16613 ///
16614 /// # Example
16615 /// ```ignore,no_run
16616 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16617 /// let x = Counters::new().set_input_documents_count(42);
16618 /// ```
16619 pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16620 self.input_documents_count = v.into();
16621 self
16622 }
16623
16624 /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
16625 ///
16626 /// # Example
16627 /// ```ignore,no_run
16628 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16629 /// let x = Counters::new().set_invalid_documents_count(42);
16630 /// ```
16631 pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16632 self.invalid_documents_count = v.into();
16633 self
16634 }
16635
16636 /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
16637 ///
16638 /// # Example
16639 /// ```ignore,no_run
16640 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16641 /// let x = Counters::new().set_failed_documents_count(42);
16642 /// ```
16643 pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16644 self.failed_documents_count = v.into();
16645 self
16646 }
16647
16648 /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
16649 ///
16650 /// # Example
16651 /// ```ignore,no_run
16652 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16653 /// let x = Counters::new().set_evaluated_documents_count(42);
16654 /// ```
16655 pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16656 self.evaluated_documents_count = v.into();
16657 self
16658 }
16659 }
16660
16661 impl wkt::message::Message for Counters {
16662 fn typename() -> &'static str {
16663 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
16664 }
16665 }
16666
16667 /// Evaluation metrics, either in aggregate or about a specific entity.
16668 #[derive(Clone, Default, PartialEq)]
16669 #[non_exhaustive]
16670 pub struct Metrics {
16671 /// The calculated precision.
16672 pub precision: f32,
16673
16674 /// The calculated recall.
16675 pub recall: f32,
16676
16677 /// The calculated f1 score.
16678 pub f1_score: f32,
16679
16680 /// The amount of occurrences in predicted documents.
16681 pub predicted_occurrences_count: i32,
16682
16683 /// The amount of occurrences in ground truth documents.
16684 pub ground_truth_occurrences_count: i32,
16685
16686 /// The amount of documents with a predicted occurrence.
16687 pub predicted_document_count: i32,
16688
16689 /// The amount of documents with a ground truth occurrence.
16690 pub ground_truth_document_count: i32,
16691
16692 /// The amount of true positives.
16693 pub true_positives_count: i32,
16694
16695 /// The amount of false positives.
16696 pub false_positives_count: i32,
16697
16698 /// The amount of false negatives.
16699 pub false_negatives_count: i32,
16700
16701 /// The amount of documents that had an occurrence of this label.
16702 pub total_documents_count: i32,
16703
16704 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16705 }
16706
16707 impl Metrics {
16708 pub fn new() -> Self {
16709 std::default::Default::default()
16710 }
16711
16712 /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
16713 ///
16714 /// # Example
16715 /// ```ignore,no_run
16716 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16717 /// let x = Metrics::new().set_precision(42.0);
16718 /// ```
16719 pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16720 self.precision = v.into();
16721 self
16722 }
16723
16724 /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
16725 ///
16726 /// # Example
16727 /// ```ignore,no_run
16728 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16729 /// let x = Metrics::new().set_recall(42.0);
16730 /// ```
16731 pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16732 self.recall = v.into();
16733 self
16734 }
16735
16736 /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
16737 ///
16738 /// # Example
16739 /// ```ignore,no_run
16740 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16741 /// let x = Metrics::new().set_f1_score(42.0);
16742 /// ```
16743 pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16744 self.f1_score = v.into();
16745 self
16746 }
16747
16748 /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
16749 ///
16750 /// # Example
16751 /// ```ignore,no_run
16752 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16753 /// let x = Metrics::new().set_predicted_occurrences_count(42);
16754 /// ```
16755 pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16756 self.predicted_occurrences_count = v.into();
16757 self
16758 }
16759
16760 /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
16761 ///
16762 /// # Example
16763 /// ```ignore,no_run
16764 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16765 /// let x = Metrics::new().set_ground_truth_occurrences_count(42);
16766 /// ```
16767 pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
16768 mut self,
16769 v: T,
16770 ) -> Self {
16771 self.ground_truth_occurrences_count = v.into();
16772 self
16773 }
16774
16775 /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
16776 ///
16777 /// # Example
16778 /// ```ignore,no_run
16779 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16780 /// let x = Metrics::new().set_predicted_document_count(42);
16781 /// ```
16782 pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16783 self.predicted_document_count = v.into();
16784 self
16785 }
16786
16787 /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
16788 ///
16789 /// # Example
16790 /// ```ignore,no_run
16791 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16792 /// let x = Metrics::new().set_ground_truth_document_count(42);
16793 /// ```
16794 pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16795 self.ground_truth_document_count = v.into();
16796 self
16797 }
16798
16799 /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
16800 ///
16801 /// # Example
16802 /// ```ignore,no_run
16803 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16804 /// let x = Metrics::new().set_true_positives_count(42);
16805 /// ```
16806 pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16807 self.true_positives_count = v.into();
16808 self
16809 }
16810
16811 /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
16812 ///
16813 /// # Example
16814 /// ```ignore,no_run
16815 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16816 /// let x = Metrics::new().set_false_positives_count(42);
16817 /// ```
16818 pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16819 self.false_positives_count = v.into();
16820 self
16821 }
16822
16823 /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
16824 ///
16825 /// # Example
16826 /// ```ignore,no_run
16827 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16828 /// let x = Metrics::new().set_false_negatives_count(42);
16829 /// ```
16830 pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16831 self.false_negatives_count = v.into();
16832 self
16833 }
16834
16835 /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
16836 ///
16837 /// # Example
16838 /// ```ignore,no_run
16839 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16840 /// let x = Metrics::new().set_total_documents_count(42);
16841 /// ```
16842 pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16843 self.total_documents_count = v.into();
16844 self
16845 }
16846 }
16847
16848 impl wkt::message::Message for Metrics {
16849 fn typename() -> &'static str {
16850 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
16851 }
16852 }
16853
16854 /// Evaluations metrics, at a specific confidence level.
16855 #[derive(Clone, Default, PartialEq)]
16856 #[non_exhaustive]
16857 pub struct ConfidenceLevelMetrics {
16858 /// The confidence level.
16859 pub confidence_level: f32,
16860
16861 /// The metrics at the specific confidence level.
16862 pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
16863
16864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16865 }
16866
16867 impl ConfidenceLevelMetrics {
16868 pub fn new() -> Self {
16869 std::default::Default::default()
16870 }
16871
16872 /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
16873 ///
16874 /// # Example
16875 /// ```ignore,no_run
16876 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16877 /// let x = ConfidenceLevelMetrics::new().set_confidence_level(42.0);
16878 /// ```
16879 pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16880 self.confidence_level = v.into();
16881 self
16882 }
16883
16884 /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
16885 ///
16886 /// # Example
16887 /// ```ignore,no_run
16888 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16889 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16890 /// let x = ConfidenceLevelMetrics::new().set_metrics(Metrics::default()/* use setters */);
16891 /// ```
16892 pub fn set_metrics<T>(mut self, v: T) -> Self
16893 where
16894 T: std::convert::Into<crate::model::evaluation::Metrics>,
16895 {
16896 self.metrics = std::option::Option::Some(v.into());
16897 self
16898 }
16899
16900 /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
16901 ///
16902 /// # Example
16903 /// ```ignore,no_run
16904 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16905 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16906 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(Some(Metrics::default()/* use setters */));
16907 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(None::<Metrics>);
16908 /// ```
16909 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16910 where
16911 T: std::convert::Into<crate::model::evaluation::Metrics>,
16912 {
16913 self.metrics = v.map(|x| x.into());
16914 self
16915 }
16916 }
16917
16918 impl wkt::message::Message for ConfidenceLevelMetrics {
16919 fn typename() -> &'static str {
16920 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
16921 }
16922 }
16923
16924 /// Metrics across multiple confidence levels.
16925 #[derive(Clone, Default, PartialEq)]
16926 #[non_exhaustive]
16927 pub struct MultiConfidenceMetrics {
16928 /// Metrics across confidence levels with fuzzy matching enabled.
16929 pub confidence_level_metrics:
16930 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
16931
16932 /// Metrics across confidence levels with only exact matching.
16933 pub confidence_level_metrics_exact:
16934 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
16935
16936 /// The calculated area under the precision recall curve (AUPRC), computed by
16937 /// integrating over all confidence thresholds.
16938 pub auprc: f32,
16939
16940 /// The Estimated Calibration Error (ECE) of the confidence of the predicted
16941 /// entities.
16942 pub estimated_calibration_error: f32,
16943
16944 /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
16945 /// only.
16946 pub auprc_exact: f32,
16947
16948 /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
16949 /// exact matching only.
16950 pub estimated_calibration_error_exact: f32,
16951
16952 /// The metrics type for the label.
16953 pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
16954
16955 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16956 }
16957
16958 impl MultiConfidenceMetrics {
16959 pub fn new() -> Self {
16960 std::default::Default::default()
16961 }
16962
16963 /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
16964 ///
16965 /// # Example
16966 /// ```ignore,no_run
16967 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16968 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16969 /// let x = MultiConfidenceMetrics::new()
16970 /// .set_confidence_level_metrics([
16971 /// ConfidenceLevelMetrics::default()/* use setters */,
16972 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
16973 /// ]);
16974 /// ```
16975 pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
16976 where
16977 T: std::iter::IntoIterator<Item = V>,
16978 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
16979 {
16980 use std::iter::Iterator;
16981 self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
16982 self
16983 }
16984
16985 /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
16986 ///
16987 /// # Example
16988 /// ```ignore,no_run
16989 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16990 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
16991 /// let x = MultiConfidenceMetrics::new()
16992 /// .set_confidence_level_metrics_exact([
16993 /// ConfidenceLevelMetrics::default()/* use setters */,
16994 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
16995 /// ]);
16996 /// ```
16997 pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
16998 where
16999 T: std::iter::IntoIterator<Item = V>,
17000 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17001 {
17002 use std::iter::Iterator;
17003 self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
17004 self
17005 }
17006
17007 /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
17008 ///
17009 /// # Example
17010 /// ```ignore,no_run
17011 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17012 /// let x = MultiConfidenceMetrics::new().set_auprc(42.0);
17013 /// ```
17014 pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17015 self.auprc = v.into();
17016 self
17017 }
17018
17019 /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
17020 ///
17021 /// # Example
17022 /// ```ignore,no_run
17023 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17024 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error(42.0);
17025 /// ```
17026 pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17027 self.estimated_calibration_error = v.into();
17028 self
17029 }
17030
17031 /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
17032 ///
17033 /// # Example
17034 /// ```ignore,no_run
17035 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17036 /// let x = MultiConfidenceMetrics::new().set_auprc_exact(42.0);
17037 /// ```
17038 pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17039 self.auprc_exact = v.into();
17040 self
17041 }
17042
17043 /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
17044 ///
17045 /// # Example
17046 /// ```ignore,no_run
17047 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17048 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error_exact(42.0);
17049 /// ```
17050 pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
17051 mut self,
17052 v: T,
17053 ) -> Self {
17054 self.estimated_calibration_error_exact = v.into();
17055 self
17056 }
17057
17058 /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
17059 ///
17060 /// # Example
17061 /// ```ignore,no_run
17062 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17063 /// use google_cloud_documentai_v1::model::evaluation::multi_confidence_metrics::MetricsType;
17064 /// let x0 = MultiConfidenceMetrics::new().set_metrics_type(MetricsType::Aggregate);
17065 /// ```
17066 pub fn set_metrics_type<
17067 T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
17068 >(
17069 mut self,
17070 v: T,
17071 ) -> Self {
17072 self.metrics_type = v.into();
17073 self
17074 }
17075 }
17076
17077 impl wkt::message::Message for MultiConfidenceMetrics {
17078 fn typename() -> &'static str {
17079 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
17080 }
17081 }
17082
17083 /// Defines additional types related to [MultiConfidenceMetrics].
17084 pub mod multi_confidence_metrics {
17085 #[allow(unused_imports)]
17086 use super::*;
17087
17088 /// A type that determines how metrics should be interpreted.
17089 ///
17090 /// # Working with unknown values
17091 ///
17092 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17093 /// additional enum variants at any time. Adding new variants is not considered
17094 /// a breaking change. Applications should write their code in anticipation of:
17095 ///
17096 /// - New values appearing in future releases of the client library, **and**
17097 /// - New values received dynamically, without application changes.
17098 ///
17099 /// Please consult the [Working with enums] section in the user guide for some
17100 /// guidelines.
17101 ///
17102 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17103 #[derive(Clone, Debug, PartialEq)]
17104 #[non_exhaustive]
17105 pub enum MetricsType {
17106 /// The metrics type is unspecified. By default, metrics without a
17107 /// particular specification are for leaf entity types (i.e., top-level
17108 /// entity types without child types, or child types which are not
17109 /// parent types themselves).
17110 Unspecified,
17111 /// Indicates whether metrics for this particular label type represent an
17112 /// aggregate of metrics for other types instead of being based on actual
17113 /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
17114 /// entity types are an aggregate of metrics for their children.
17115 Aggregate,
17116 /// If set, the enum was initialized with an unknown value.
17117 ///
17118 /// Applications can examine the value using [MetricsType::value] or
17119 /// [MetricsType::name].
17120 UnknownValue(metrics_type::UnknownValue),
17121 }
17122
17123 #[doc(hidden)]
17124 pub mod metrics_type {
17125 #[allow(unused_imports)]
17126 use super::*;
17127 #[derive(Clone, Debug, PartialEq)]
17128 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17129 }
17130
17131 impl MetricsType {
17132 /// Gets the enum value.
17133 ///
17134 /// Returns `None` if the enum contains an unknown value deserialized from
17135 /// the string representation of enums.
17136 pub fn value(&self) -> std::option::Option<i32> {
17137 match self {
17138 Self::Unspecified => std::option::Option::Some(0),
17139 Self::Aggregate => std::option::Option::Some(1),
17140 Self::UnknownValue(u) => u.0.value(),
17141 }
17142 }
17143
17144 /// Gets the enum value as a string.
17145 ///
17146 /// Returns `None` if the enum contains an unknown value deserialized from
17147 /// the integer representation of enums.
17148 pub fn name(&self) -> std::option::Option<&str> {
17149 match self {
17150 Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
17151 Self::Aggregate => std::option::Option::Some("AGGREGATE"),
17152 Self::UnknownValue(u) => u.0.name(),
17153 }
17154 }
17155 }
17156
17157 impl std::default::Default for MetricsType {
17158 fn default() -> Self {
17159 use std::convert::From;
17160 Self::from(0)
17161 }
17162 }
17163
17164 impl std::fmt::Display for MetricsType {
17165 fn fmt(
17166 &self,
17167 f: &mut std::fmt::Formatter<'_>,
17168 ) -> std::result::Result<(), std::fmt::Error> {
17169 wkt::internal::display_enum(f, self.name(), self.value())
17170 }
17171 }
17172
17173 impl std::convert::From<i32> for MetricsType {
17174 fn from(value: i32) -> Self {
17175 match value {
17176 0 => Self::Unspecified,
17177 1 => Self::Aggregate,
17178 _ => Self::UnknownValue(metrics_type::UnknownValue(
17179 wkt::internal::UnknownEnumValue::Integer(value),
17180 )),
17181 }
17182 }
17183 }
17184
17185 impl std::convert::From<&str> for MetricsType {
17186 fn from(value: &str) -> Self {
17187 use std::string::ToString;
17188 match value {
17189 "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
17190 "AGGREGATE" => Self::Aggregate,
17191 _ => Self::UnknownValue(metrics_type::UnknownValue(
17192 wkt::internal::UnknownEnumValue::String(value.to_string()),
17193 )),
17194 }
17195 }
17196 }
17197
17198 impl serde::ser::Serialize for MetricsType {
17199 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17200 where
17201 S: serde::Serializer,
17202 {
17203 match self {
17204 Self::Unspecified => serializer.serialize_i32(0),
17205 Self::Aggregate => serializer.serialize_i32(1),
17206 Self::UnknownValue(u) => u.0.serialize(serializer),
17207 }
17208 }
17209 }
17210
17211 impl<'de> serde::de::Deserialize<'de> for MetricsType {
17212 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17213 where
17214 D: serde::Deserializer<'de>,
17215 {
17216 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
17217 ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
17218 ))
17219 }
17220 }
17221 }
17222}
17223
17224/// A vertex represents a 2D point in the image.
17225/// NOTE: the vertex coordinates are in the same scale as the original image.
17226#[derive(Clone, Default, PartialEq)]
17227#[non_exhaustive]
17228pub struct Vertex {
17229 /// X coordinate.
17230 pub x: i32,
17231
17232 /// Y coordinate (starts from the top of the image).
17233 pub y: i32,
17234
17235 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17236}
17237
17238impl Vertex {
17239 pub fn new() -> Self {
17240 std::default::Default::default()
17241 }
17242
17243 /// Sets the value of [x][crate::model::Vertex::x].
17244 ///
17245 /// # Example
17246 /// ```ignore,no_run
17247 /// # use google_cloud_documentai_v1::model::Vertex;
17248 /// let x = Vertex::new().set_x(42);
17249 /// ```
17250 pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17251 self.x = v.into();
17252 self
17253 }
17254
17255 /// Sets the value of [y][crate::model::Vertex::y].
17256 ///
17257 /// # Example
17258 /// ```ignore,no_run
17259 /// # use google_cloud_documentai_v1::model::Vertex;
17260 /// let x = Vertex::new().set_y(42);
17261 /// ```
17262 pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17263 self.y = v.into();
17264 self
17265 }
17266}
17267
17268impl wkt::message::Message for Vertex {
17269 fn typename() -> &'static str {
17270 "type.googleapis.com/google.cloud.documentai.v1.Vertex"
17271 }
17272}
17273
17274/// A vertex represents a 2D point in the image.
17275/// NOTE: the normalized vertex coordinates are relative to the original image
17276/// and range from 0 to 1.
17277#[derive(Clone, Default, PartialEq)]
17278#[non_exhaustive]
17279pub struct NormalizedVertex {
17280 /// X coordinate.
17281 pub x: f32,
17282
17283 /// Y coordinate (starts from the top of the image).
17284 pub y: f32,
17285
17286 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17287}
17288
17289impl NormalizedVertex {
17290 pub fn new() -> Self {
17291 std::default::Default::default()
17292 }
17293
17294 /// Sets the value of [x][crate::model::NormalizedVertex::x].
17295 ///
17296 /// # Example
17297 /// ```ignore,no_run
17298 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17299 /// let x = NormalizedVertex::new().set_x(42.0);
17300 /// ```
17301 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17302 self.x = v.into();
17303 self
17304 }
17305
17306 /// Sets the value of [y][crate::model::NormalizedVertex::y].
17307 ///
17308 /// # Example
17309 /// ```ignore,no_run
17310 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17311 /// let x = NormalizedVertex::new().set_y(42.0);
17312 /// ```
17313 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17314 self.y = v.into();
17315 self
17316 }
17317}
17318
17319impl wkt::message::Message for NormalizedVertex {
17320 fn typename() -> &'static str {
17321 "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
17322 }
17323}
17324
17325/// A bounding polygon for the detected image annotation.
17326#[derive(Clone, Default, PartialEq)]
17327#[non_exhaustive]
17328pub struct BoundingPoly {
17329 /// The bounding polygon vertices.
17330 pub vertices: std::vec::Vec<crate::model::Vertex>,
17331
17332 /// The bounding polygon normalized vertices.
17333 pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
17334
17335 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17336}
17337
17338impl BoundingPoly {
17339 pub fn new() -> Self {
17340 std::default::Default::default()
17341 }
17342
17343 /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
17344 ///
17345 /// # Example
17346 /// ```ignore,no_run
17347 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17348 /// use google_cloud_documentai_v1::model::Vertex;
17349 /// let x = BoundingPoly::new()
17350 /// .set_vertices([
17351 /// Vertex::default()/* use setters */,
17352 /// Vertex::default()/* use (different) setters */,
17353 /// ]);
17354 /// ```
17355 pub fn set_vertices<T, V>(mut self, v: T) -> Self
17356 where
17357 T: std::iter::IntoIterator<Item = V>,
17358 V: std::convert::Into<crate::model::Vertex>,
17359 {
17360 use std::iter::Iterator;
17361 self.vertices = v.into_iter().map(|i| i.into()).collect();
17362 self
17363 }
17364
17365 /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
17366 ///
17367 /// # Example
17368 /// ```ignore,no_run
17369 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17370 /// use google_cloud_documentai_v1::model::NormalizedVertex;
17371 /// let x = BoundingPoly::new()
17372 /// .set_normalized_vertices([
17373 /// NormalizedVertex::default()/* use setters */,
17374 /// NormalizedVertex::default()/* use (different) setters */,
17375 /// ]);
17376 /// ```
17377 pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
17378 where
17379 T: std::iter::IntoIterator<Item = V>,
17380 V: std::convert::Into<crate::model::NormalizedVertex>,
17381 {
17382 use std::iter::Iterator;
17383 self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
17384 self
17385 }
17386}
17387
17388impl wkt::message::Message for BoundingPoly {
17389 fn typename() -> &'static str {
17390 "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
17391 }
17392}
17393
17394/// The common metadata for long running operations.
17395#[derive(Clone, Default, PartialEq)]
17396#[non_exhaustive]
17397pub struct CommonOperationMetadata {
17398 /// The state of the operation.
17399 pub state: crate::model::common_operation_metadata::State,
17400
17401 /// A message providing more details about the current state of processing.
17402 pub state_message: std::string::String,
17403
17404 /// A related resource to this operation.
17405 pub resource: std::string::String,
17406
17407 /// The creation time of the operation.
17408 pub create_time: std::option::Option<wkt::Timestamp>,
17409
17410 /// The last update time of the operation.
17411 pub update_time: std::option::Option<wkt::Timestamp>,
17412
17413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17414}
17415
17416impl CommonOperationMetadata {
17417 pub fn new() -> Self {
17418 std::default::Default::default()
17419 }
17420
17421 /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
17422 ///
17423 /// # Example
17424 /// ```ignore,no_run
17425 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17426 /// use google_cloud_documentai_v1::model::common_operation_metadata::State;
17427 /// let x0 = CommonOperationMetadata::new().set_state(State::Running);
17428 /// let x1 = CommonOperationMetadata::new().set_state(State::Cancelling);
17429 /// let x2 = CommonOperationMetadata::new().set_state(State::Succeeded);
17430 /// ```
17431 pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
17432 mut self,
17433 v: T,
17434 ) -> Self {
17435 self.state = v.into();
17436 self
17437 }
17438
17439 /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
17440 ///
17441 /// # Example
17442 /// ```ignore,no_run
17443 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17444 /// let x = CommonOperationMetadata::new().set_state_message("example");
17445 /// ```
17446 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17447 self.state_message = v.into();
17448 self
17449 }
17450
17451 /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
17452 ///
17453 /// # Example
17454 /// ```ignore,no_run
17455 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17456 /// let x = CommonOperationMetadata::new().set_resource("example");
17457 /// ```
17458 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17459 self.resource = v.into();
17460 self
17461 }
17462
17463 /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17464 ///
17465 /// # Example
17466 /// ```ignore,no_run
17467 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17468 /// use wkt::Timestamp;
17469 /// let x = CommonOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17470 /// ```
17471 pub fn set_create_time<T>(mut self, v: T) -> Self
17472 where
17473 T: std::convert::Into<wkt::Timestamp>,
17474 {
17475 self.create_time = std::option::Option::Some(v.into());
17476 self
17477 }
17478
17479 /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17480 ///
17481 /// # Example
17482 /// ```ignore,no_run
17483 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17484 /// use wkt::Timestamp;
17485 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17486 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17487 /// ```
17488 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17489 where
17490 T: std::convert::Into<wkt::Timestamp>,
17491 {
17492 self.create_time = v.map(|x| x.into());
17493 self
17494 }
17495
17496 /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17497 ///
17498 /// # Example
17499 /// ```ignore,no_run
17500 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17501 /// use wkt::Timestamp;
17502 /// let x = CommonOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
17503 /// ```
17504 pub fn set_update_time<T>(mut self, v: T) -> Self
17505 where
17506 T: std::convert::Into<wkt::Timestamp>,
17507 {
17508 self.update_time = std::option::Option::Some(v.into());
17509 self
17510 }
17511
17512 /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17513 ///
17514 /// # Example
17515 /// ```ignore,no_run
17516 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17517 /// use wkt::Timestamp;
17518 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17519 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
17520 /// ```
17521 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17522 where
17523 T: std::convert::Into<wkt::Timestamp>,
17524 {
17525 self.update_time = v.map(|x| x.into());
17526 self
17527 }
17528}
17529
17530impl wkt::message::Message for CommonOperationMetadata {
17531 fn typename() -> &'static str {
17532 "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
17533 }
17534}
17535
17536/// Defines additional types related to [CommonOperationMetadata].
17537pub mod common_operation_metadata {
17538 #[allow(unused_imports)]
17539 use super::*;
17540
17541 /// State of the longrunning operation.
17542 ///
17543 /// # Working with unknown values
17544 ///
17545 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17546 /// additional enum variants at any time. Adding new variants is not considered
17547 /// a breaking change. Applications should write their code in anticipation of:
17548 ///
17549 /// - New values appearing in future releases of the client library, **and**
17550 /// - New values received dynamically, without application changes.
17551 ///
17552 /// Please consult the [Working with enums] section in the user guide for some
17553 /// guidelines.
17554 ///
17555 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17556 #[derive(Clone, Debug, PartialEq)]
17557 #[non_exhaustive]
17558 pub enum State {
17559 /// Unspecified state.
17560 Unspecified,
17561 /// Operation is still running.
17562 Running,
17563 /// Operation is being cancelled.
17564 Cancelling,
17565 /// Operation succeeded.
17566 Succeeded,
17567 /// Operation failed.
17568 Failed,
17569 /// Operation is cancelled.
17570 Cancelled,
17571 /// If set, the enum was initialized with an unknown value.
17572 ///
17573 /// Applications can examine the value using [State::value] or
17574 /// [State::name].
17575 UnknownValue(state::UnknownValue),
17576 }
17577
17578 #[doc(hidden)]
17579 pub mod state {
17580 #[allow(unused_imports)]
17581 use super::*;
17582 #[derive(Clone, Debug, PartialEq)]
17583 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17584 }
17585
17586 impl State {
17587 /// Gets the enum value.
17588 ///
17589 /// Returns `None` if the enum contains an unknown value deserialized from
17590 /// the string representation of enums.
17591 pub fn value(&self) -> std::option::Option<i32> {
17592 match self {
17593 Self::Unspecified => std::option::Option::Some(0),
17594 Self::Running => std::option::Option::Some(1),
17595 Self::Cancelling => std::option::Option::Some(2),
17596 Self::Succeeded => std::option::Option::Some(3),
17597 Self::Failed => std::option::Option::Some(4),
17598 Self::Cancelled => std::option::Option::Some(5),
17599 Self::UnknownValue(u) => u.0.value(),
17600 }
17601 }
17602
17603 /// Gets the enum value as a string.
17604 ///
17605 /// Returns `None` if the enum contains an unknown value deserialized from
17606 /// the integer representation of enums.
17607 pub fn name(&self) -> std::option::Option<&str> {
17608 match self {
17609 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17610 Self::Running => std::option::Option::Some("RUNNING"),
17611 Self::Cancelling => std::option::Option::Some("CANCELLING"),
17612 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
17613 Self::Failed => std::option::Option::Some("FAILED"),
17614 Self::Cancelled => std::option::Option::Some("CANCELLED"),
17615 Self::UnknownValue(u) => u.0.name(),
17616 }
17617 }
17618 }
17619
17620 impl std::default::Default for State {
17621 fn default() -> Self {
17622 use std::convert::From;
17623 Self::from(0)
17624 }
17625 }
17626
17627 impl std::fmt::Display for State {
17628 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17629 wkt::internal::display_enum(f, self.name(), self.value())
17630 }
17631 }
17632
17633 impl std::convert::From<i32> for State {
17634 fn from(value: i32) -> Self {
17635 match value {
17636 0 => Self::Unspecified,
17637 1 => Self::Running,
17638 2 => Self::Cancelling,
17639 3 => Self::Succeeded,
17640 4 => Self::Failed,
17641 5 => Self::Cancelled,
17642 _ => Self::UnknownValue(state::UnknownValue(
17643 wkt::internal::UnknownEnumValue::Integer(value),
17644 )),
17645 }
17646 }
17647 }
17648
17649 impl std::convert::From<&str> for State {
17650 fn from(value: &str) -> Self {
17651 use std::string::ToString;
17652 match value {
17653 "STATE_UNSPECIFIED" => Self::Unspecified,
17654 "RUNNING" => Self::Running,
17655 "CANCELLING" => Self::Cancelling,
17656 "SUCCEEDED" => Self::Succeeded,
17657 "FAILED" => Self::Failed,
17658 "CANCELLED" => Self::Cancelled,
17659 _ => Self::UnknownValue(state::UnknownValue(
17660 wkt::internal::UnknownEnumValue::String(value.to_string()),
17661 )),
17662 }
17663 }
17664 }
17665
17666 impl serde::ser::Serialize for State {
17667 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17668 where
17669 S: serde::Serializer,
17670 {
17671 match self {
17672 Self::Unspecified => serializer.serialize_i32(0),
17673 Self::Running => serializer.serialize_i32(1),
17674 Self::Cancelling => serializer.serialize_i32(2),
17675 Self::Succeeded => serializer.serialize_i32(3),
17676 Self::Failed => serializer.serialize_i32(4),
17677 Self::Cancelled => serializer.serialize_i32(5),
17678 Self::UnknownValue(u) => u.0.serialize(serializer),
17679 }
17680 }
17681 }
17682
17683 impl<'de> serde::de::Deserialize<'de> for State {
17684 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17685 where
17686 D: serde::Deserializer<'de>,
17687 {
17688 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17689 ".google.cloud.documentai.v1.CommonOperationMetadata.State",
17690 ))
17691 }
17692 }
17693}
17694
17695/// A processor version is an implementation of a processor. Each processor
17696/// can have multiple versions, pretrained by Google internally or uptrained
17697/// by the customer. A processor can only have one default version at a time.
17698/// Its document-processing behavior is defined by that version.
17699#[derive(Clone, Default, PartialEq)]
17700#[non_exhaustive]
17701pub struct ProcessorVersion {
17702 /// Identifier. The resource name of the processor version.
17703 /// Format:
17704 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
17705 pub name: std::string::String,
17706
17707 /// The display name of the processor version.
17708 pub display_name: std::string::String,
17709
17710 /// Output only. The schema of the processor version. Describes the output.
17711 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
17712
17713 /// Output only. The state of the processor version.
17714 pub state: crate::model::processor_version::State,
17715
17716 /// Output only. The time the processor version was created.
17717 pub create_time: std::option::Option<wkt::Timestamp>,
17718
17719 /// Output only. The most recently invoked evaluation for the processor
17720 /// version.
17721 pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
17722
17723 /// Output only. The KMS key name used for encryption.
17724 pub kms_key_name: std::string::String,
17725
17726 /// Output only. The KMS key version with which data is encrypted.
17727 pub kms_key_version_name: std::string::String,
17728
17729 /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
17730 pub google_managed: bool,
17731
17732 /// Output only. If set, information about the eventual deprecation of this
17733 /// version.
17734 pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
17735
17736 /// Output only. The model type of this processor version.
17737 pub model_type: crate::model::processor_version::ModelType,
17738
17739 /// Output only. Reserved for future use.
17740 pub satisfies_pzs: bool,
17741
17742 /// Output only. Reserved for future use.
17743 pub satisfies_pzi: bool,
17744
17745 /// Output only. Information about Generative AI model-based processor
17746 /// versions.
17747 pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
17748
17749 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17750}
17751
17752impl ProcessorVersion {
17753 pub fn new() -> Self {
17754 std::default::Default::default()
17755 }
17756
17757 /// Sets the value of [name][crate::model::ProcessorVersion::name].
17758 ///
17759 /// # Example
17760 /// ```ignore,no_run
17761 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17762 /// let x = ProcessorVersion::new().set_name("example");
17763 /// ```
17764 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17765 self.name = v.into();
17766 self
17767 }
17768
17769 /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
17770 ///
17771 /// # Example
17772 /// ```ignore,no_run
17773 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17774 /// let x = ProcessorVersion::new().set_display_name("example");
17775 /// ```
17776 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17777 self.display_name = v.into();
17778 self
17779 }
17780
17781 /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
17782 ///
17783 /// # Example
17784 /// ```ignore,no_run
17785 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17786 /// use google_cloud_documentai_v1::model::DocumentSchema;
17787 /// let x = ProcessorVersion::new().set_document_schema(DocumentSchema::default()/* use setters */);
17788 /// ```
17789 pub fn set_document_schema<T>(mut self, v: T) -> Self
17790 where
17791 T: std::convert::Into<crate::model::DocumentSchema>,
17792 {
17793 self.document_schema = std::option::Option::Some(v.into());
17794 self
17795 }
17796
17797 /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
17798 ///
17799 /// # Example
17800 /// ```ignore,no_run
17801 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17802 /// use google_cloud_documentai_v1::model::DocumentSchema;
17803 /// let x = ProcessorVersion::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
17804 /// let x = ProcessorVersion::new().set_or_clear_document_schema(None::<DocumentSchema>);
17805 /// ```
17806 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
17807 where
17808 T: std::convert::Into<crate::model::DocumentSchema>,
17809 {
17810 self.document_schema = v.map(|x| x.into());
17811 self
17812 }
17813
17814 /// Sets the value of [state][crate::model::ProcessorVersion::state].
17815 ///
17816 /// # Example
17817 /// ```ignore,no_run
17818 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17819 /// use google_cloud_documentai_v1::model::processor_version::State;
17820 /// let x0 = ProcessorVersion::new().set_state(State::Deployed);
17821 /// let x1 = ProcessorVersion::new().set_state(State::Deploying);
17822 /// let x2 = ProcessorVersion::new().set_state(State::Undeployed);
17823 /// ```
17824 pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
17825 mut self,
17826 v: T,
17827 ) -> Self {
17828 self.state = v.into();
17829 self
17830 }
17831
17832 /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
17833 ///
17834 /// # Example
17835 /// ```ignore,no_run
17836 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17837 /// use wkt::Timestamp;
17838 /// let x = ProcessorVersion::new().set_create_time(Timestamp::default()/* use setters */);
17839 /// ```
17840 pub fn set_create_time<T>(mut self, v: T) -> Self
17841 where
17842 T: std::convert::Into<wkt::Timestamp>,
17843 {
17844 self.create_time = std::option::Option::Some(v.into());
17845 self
17846 }
17847
17848 /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
17849 ///
17850 /// # Example
17851 /// ```ignore,no_run
17852 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17853 /// use wkt::Timestamp;
17854 /// let x = ProcessorVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17855 /// let x = ProcessorVersion::new().set_or_clear_create_time(None::<Timestamp>);
17856 /// ```
17857 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17858 where
17859 T: std::convert::Into<wkt::Timestamp>,
17860 {
17861 self.create_time = v.map(|x| x.into());
17862 self
17863 }
17864
17865 /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
17866 ///
17867 /// # Example
17868 /// ```ignore,no_run
17869 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17870 /// use google_cloud_documentai_v1::model::EvaluationReference;
17871 /// let x = ProcessorVersion::new().set_latest_evaluation(EvaluationReference::default()/* use setters */);
17872 /// ```
17873 pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
17874 where
17875 T: std::convert::Into<crate::model::EvaluationReference>,
17876 {
17877 self.latest_evaluation = std::option::Option::Some(v.into());
17878 self
17879 }
17880
17881 /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
17882 ///
17883 /// # Example
17884 /// ```ignore,no_run
17885 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17886 /// use google_cloud_documentai_v1::model::EvaluationReference;
17887 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(Some(EvaluationReference::default()/* use setters */));
17888 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(None::<EvaluationReference>);
17889 /// ```
17890 pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
17891 where
17892 T: std::convert::Into<crate::model::EvaluationReference>,
17893 {
17894 self.latest_evaluation = v.map(|x| x.into());
17895 self
17896 }
17897
17898 /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
17899 ///
17900 /// # Example
17901 /// ```ignore,no_run
17902 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17903 /// let x = ProcessorVersion::new().set_kms_key_name("example");
17904 /// ```
17905 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17906 self.kms_key_name = v.into();
17907 self
17908 }
17909
17910 /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
17911 ///
17912 /// # Example
17913 /// ```ignore,no_run
17914 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17915 /// let x = ProcessorVersion::new().set_kms_key_version_name("example");
17916 /// ```
17917 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
17918 mut self,
17919 v: T,
17920 ) -> Self {
17921 self.kms_key_version_name = v.into();
17922 self
17923 }
17924
17925 /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
17926 ///
17927 /// # Example
17928 /// ```ignore,no_run
17929 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17930 /// let x = ProcessorVersion::new().set_google_managed(true);
17931 /// ```
17932 pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17933 self.google_managed = v.into();
17934 self
17935 }
17936
17937 /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
17938 ///
17939 /// # Example
17940 /// ```ignore,no_run
17941 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17942 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17943 /// let x = ProcessorVersion::new().set_deprecation_info(DeprecationInfo::default()/* use setters */);
17944 /// ```
17945 pub fn set_deprecation_info<T>(mut self, v: T) -> Self
17946 where
17947 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
17948 {
17949 self.deprecation_info = std::option::Option::Some(v.into());
17950 self
17951 }
17952
17953 /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
17954 ///
17955 /// # Example
17956 /// ```ignore,no_run
17957 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17958 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
17959 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(Some(DeprecationInfo::default()/* use setters */));
17960 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(None::<DeprecationInfo>);
17961 /// ```
17962 pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
17963 where
17964 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
17965 {
17966 self.deprecation_info = v.map(|x| x.into());
17967 self
17968 }
17969
17970 /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
17971 ///
17972 /// # Example
17973 /// ```ignore,no_run
17974 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17975 /// use google_cloud_documentai_v1::model::processor_version::ModelType;
17976 /// let x0 = ProcessorVersion::new().set_model_type(ModelType::Generative);
17977 /// let x1 = ProcessorVersion::new().set_model_type(ModelType::Custom);
17978 /// ```
17979 pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
17980 mut self,
17981 v: T,
17982 ) -> Self {
17983 self.model_type = v.into();
17984 self
17985 }
17986
17987 /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
17988 ///
17989 /// # Example
17990 /// ```ignore,no_run
17991 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17992 /// let x = ProcessorVersion::new().set_satisfies_pzs(true);
17993 /// ```
17994 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
17995 self.satisfies_pzs = v.into();
17996 self
17997 }
17998
17999 /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
18000 ///
18001 /// # Example
18002 /// ```ignore,no_run
18003 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18004 /// let x = ProcessorVersion::new().set_satisfies_pzi(true);
18005 /// ```
18006 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18007 self.satisfies_pzi = v.into();
18008 self
18009 }
18010
18011 /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18012 ///
18013 /// # Example
18014 /// ```ignore,no_run
18015 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18016 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18017 /// let x = ProcessorVersion::new().set_gen_ai_model_info(GenAiModelInfo::default()/* use setters */);
18018 /// ```
18019 pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
18020 where
18021 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18022 {
18023 self.gen_ai_model_info = std::option::Option::Some(v.into());
18024 self
18025 }
18026
18027 /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18028 ///
18029 /// # Example
18030 /// ```ignore,no_run
18031 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18032 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18033 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(Some(GenAiModelInfo::default()/* use setters */));
18034 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(None::<GenAiModelInfo>);
18035 /// ```
18036 pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
18037 where
18038 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18039 {
18040 self.gen_ai_model_info = v.map(|x| x.into());
18041 self
18042 }
18043}
18044
18045impl wkt::message::Message for ProcessorVersion {
18046 fn typename() -> &'static str {
18047 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
18048 }
18049}
18050
18051/// Defines additional types related to [ProcessorVersion].
18052pub mod processor_version {
18053 #[allow(unused_imports)]
18054 use super::*;
18055
18056 /// Information about the upcoming deprecation of this processor version.
18057 #[derive(Clone, Default, PartialEq)]
18058 #[non_exhaustive]
18059 pub struct DeprecationInfo {
18060 /// The time at which this processor version will be deprecated.
18061 pub deprecation_time: std::option::Option<wkt::Timestamp>,
18062
18063 /// If set, the processor version that will be used as a replacement.
18064 pub replacement_processor_version: std::string::String,
18065
18066 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18067 }
18068
18069 impl DeprecationInfo {
18070 pub fn new() -> Self {
18071 std::default::Default::default()
18072 }
18073
18074 /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18075 ///
18076 /// # Example
18077 /// ```ignore,no_run
18078 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18079 /// use wkt::Timestamp;
18080 /// let x = DeprecationInfo::new().set_deprecation_time(Timestamp::default()/* use setters */);
18081 /// ```
18082 pub fn set_deprecation_time<T>(mut self, v: T) -> Self
18083 where
18084 T: std::convert::Into<wkt::Timestamp>,
18085 {
18086 self.deprecation_time = std::option::Option::Some(v.into());
18087 self
18088 }
18089
18090 /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18091 ///
18092 /// # Example
18093 /// ```ignore,no_run
18094 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18095 /// use wkt::Timestamp;
18096 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(Some(Timestamp::default()/* use setters */));
18097 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(None::<Timestamp>);
18098 /// ```
18099 pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
18100 where
18101 T: std::convert::Into<wkt::Timestamp>,
18102 {
18103 self.deprecation_time = v.map(|x| x.into());
18104 self
18105 }
18106
18107 /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
18108 ///
18109 /// # Example
18110 /// ```ignore,no_run
18111 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18112 /// let x = DeprecationInfo::new().set_replacement_processor_version("example");
18113 /// ```
18114 pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
18115 mut self,
18116 v: T,
18117 ) -> Self {
18118 self.replacement_processor_version = v.into();
18119 self
18120 }
18121 }
18122
18123 impl wkt::message::Message for DeprecationInfo {
18124 fn typename() -> &'static str {
18125 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
18126 }
18127 }
18128
18129 /// Information about Generative AI model-based processor versions.
18130 #[derive(Clone, Default, PartialEq)]
18131 #[non_exhaustive]
18132 pub struct GenAiModelInfo {
18133 /// The processor version is either a pretrained Google-managed foundation
18134 /// model or a custom Generative AI model created by the user.
18135 pub model_info:
18136 std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
18137
18138 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18139 }
18140
18141 impl GenAiModelInfo {
18142 pub fn new() -> Self {
18143 std::default::Default::default()
18144 }
18145
18146 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
18147 ///
18148 /// Note that all the setters affecting `model_info` are mutually
18149 /// exclusive.
18150 ///
18151 /// # Example
18152 /// ```ignore,no_run
18153 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18154 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18155 /// let x = GenAiModelInfo::new().set_model_info(Some(
18156 /// google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(FoundationGenAiModelInfo::default().into())));
18157 /// ```
18158 pub fn set_model_info<
18159 T: std::convert::Into<
18160 std::option::Option<
18161 crate::model::processor_version::gen_ai_model_info::ModelInfo,
18162 >,
18163 >,
18164 >(
18165 mut self,
18166 v: T,
18167 ) -> Self {
18168 self.model_info = v.into();
18169 self
18170 }
18171
18172 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18173 /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
18174 /// holds a different branch.
18175 pub fn foundation_gen_ai_model_info(
18176 &self,
18177 ) -> std::option::Option<
18178 &std::boxed::Box<
18179 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18180 >,
18181 > {
18182 #[allow(unreachable_patterns)]
18183 self.model_info.as_ref().and_then(|v| match v {
18184 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
18185 _ => std::option::Option::None,
18186 })
18187 }
18188
18189 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18190 /// to hold a `FoundationGenAiModelInfo`.
18191 ///
18192 /// Note that all the setters affecting `model_info` are
18193 /// mutually exclusive.
18194 ///
18195 /// # Example
18196 /// ```ignore,no_run
18197 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18198 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18199 /// let x = GenAiModelInfo::new().set_foundation_gen_ai_model_info(FoundationGenAiModelInfo::default()/* use setters */);
18200 /// assert!(x.foundation_gen_ai_model_info().is_some());
18201 /// assert!(x.custom_gen_ai_model_info().is_none());
18202 /// ```
18203 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{
18204 self.model_info = std::option::Option::Some(
18205 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
18206 v.into()
18207 )
18208 );
18209 self
18210 }
18211
18212 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18213 /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
18214 /// holds a different branch.
18215 pub fn custom_gen_ai_model_info(
18216 &self,
18217 ) -> std::option::Option<
18218 &std::boxed::Box<
18219 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18220 >,
18221 > {
18222 #[allow(unreachable_patterns)]
18223 self.model_info.as_ref().and_then(|v| match v {
18224 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
18225 _ => std::option::Option::None,
18226 })
18227 }
18228
18229 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18230 /// to hold a `CustomGenAiModelInfo`.
18231 ///
18232 /// Note that all the setters affecting `model_info` are
18233 /// mutually exclusive.
18234 ///
18235 /// # Example
18236 /// ```ignore,no_run
18237 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18238 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18239 /// let x = GenAiModelInfo::new().set_custom_gen_ai_model_info(CustomGenAiModelInfo::default()/* use setters */);
18240 /// assert!(x.custom_gen_ai_model_info().is_some());
18241 /// assert!(x.foundation_gen_ai_model_info().is_none());
18242 /// ```
18243 pub fn set_custom_gen_ai_model_info<
18244 T: std::convert::Into<
18245 std::boxed::Box<
18246 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18247 >,
18248 >,
18249 >(
18250 mut self,
18251 v: T,
18252 ) -> Self {
18253 self.model_info = std::option::Option::Some(
18254 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
18255 v.into(),
18256 ),
18257 );
18258 self
18259 }
18260 }
18261
18262 impl wkt::message::Message for GenAiModelInfo {
18263 fn typename() -> &'static str {
18264 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
18265 }
18266 }
18267
18268 /// Defines additional types related to [GenAiModelInfo].
18269 pub mod gen_ai_model_info {
18270 #[allow(unused_imports)]
18271 use super::*;
18272
18273 /// Information for a pretrained Google-managed foundation model.
18274 #[derive(Clone, Default, PartialEq)]
18275 #[non_exhaustive]
18276 pub struct FoundationGenAiModelInfo {
18277 /// Whether finetuning is allowed for this base processor version.
18278 pub finetuning_allowed: bool,
18279
18280 /// The minimum number of labeled documents in the training dataset
18281 /// required for finetuning.
18282 pub min_train_labeled_documents: i32,
18283
18284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18285 }
18286
18287 impl FoundationGenAiModelInfo {
18288 pub fn new() -> Self {
18289 std::default::Default::default()
18290 }
18291
18292 /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
18293 ///
18294 /// # Example
18295 /// ```ignore,no_run
18296 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18297 /// let x = FoundationGenAiModelInfo::new().set_finetuning_allowed(true);
18298 /// ```
18299 pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18300 self.finetuning_allowed = v.into();
18301 self
18302 }
18303
18304 /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
18305 ///
18306 /// # Example
18307 /// ```ignore,no_run
18308 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18309 /// let x = FoundationGenAiModelInfo::new().set_min_train_labeled_documents(42);
18310 /// ```
18311 pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
18312 mut self,
18313 v: T,
18314 ) -> Self {
18315 self.min_train_labeled_documents = v.into();
18316 self
18317 }
18318 }
18319
18320 impl wkt::message::Message for FoundationGenAiModelInfo {
18321 fn typename() -> &'static str {
18322 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
18323 }
18324 }
18325
18326 /// Information for a custom Generative AI model created by the user. These
18327 /// are created with `Create New Version` in either the `Call foundation
18328 /// model` or `Fine tuning` tabs.
18329 #[derive(Clone, Default, PartialEq)]
18330 #[non_exhaustive]
18331 pub struct CustomGenAiModelInfo {
18332
18333 /// The type of custom model created by the user.
18334 pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
18335
18336 /// The base processor version ID for the custom model.
18337 pub base_processor_version_id: std::string::String,
18338
18339 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18340 }
18341
18342 impl CustomGenAiModelInfo {
18343 pub fn new() -> Self {
18344 std::default::Default::default()
18345 }
18346
18347 /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
18348 ///
18349 /// # Example
18350 /// ```ignore,no_run
18351 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18352 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType;
18353 /// let x0 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::VersionedFoundation);
18354 /// let x1 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::FineTuned);
18355 /// ```
18356 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{
18357 self.custom_model_type = v.into();
18358 self
18359 }
18360
18361 /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
18362 ///
18363 /// # Example
18364 /// ```ignore,no_run
18365 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18366 /// let x = CustomGenAiModelInfo::new().set_base_processor_version_id("example");
18367 /// ```
18368 pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
18369 mut self,
18370 v: T,
18371 ) -> Self {
18372 self.base_processor_version_id = v.into();
18373 self
18374 }
18375 }
18376
18377 impl wkt::message::Message for CustomGenAiModelInfo {
18378 fn typename() -> &'static str {
18379 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
18380 }
18381 }
18382
18383 /// Defines additional types related to [CustomGenAiModelInfo].
18384 pub mod custom_gen_ai_model_info {
18385 #[allow(unused_imports)]
18386 use super::*;
18387
18388 /// The type of custom model created by the user.
18389 ///
18390 /// # Working with unknown values
18391 ///
18392 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18393 /// additional enum variants at any time. Adding new variants is not considered
18394 /// a breaking change. Applications should write their code in anticipation of:
18395 ///
18396 /// - New values appearing in future releases of the client library, **and**
18397 /// - New values received dynamically, without application changes.
18398 ///
18399 /// Please consult the [Working with enums] section in the user guide for some
18400 /// guidelines.
18401 ///
18402 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18403 #[derive(Clone, Debug, PartialEq)]
18404 #[non_exhaustive]
18405 pub enum CustomModelType {
18406 /// The model type is unspecified.
18407 Unspecified,
18408 /// The model is a versioned foundation model.
18409 VersionedFoundation,
18410 /// The model is a finetuned foundation model.
18411 FineTuned,
18412 /// If set, the enum was initialized with an unknown value.
18413 ///
18414 /// Applications can examine the value using [CustomModelType::value] or
18415 /// [CustomModelType::name].
18416 UnknownValue(custom_model_type::UnknownValue),
18417 }
18418
18419 #[doc(hidden)]
18420 pub mod custom_model_type {
18421 #[allow(unused_imports)]
18422 use super::*;
18423 #[derive(Clone, Debug, PartialEq)]
18424 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18425 }
18426
18427 impl CustomModelType {
18428 /// Gets the enum value.
18429 ///
18430 /// Returns `None` if the enum contains an unknown value deserialized from
18431 /// the string representation of enums.
18432 pub fn value(&self) -> std::option::Option<i32> {
18433 match self {
18434 Self::Unspecified => std::option::Option::Some(0),
18435 Self::VersionedFoundation => std::option::Option::Some(1),
18436 Self::FineTuned => std::option::Option::Some(2),
18437 Self::UnknownValue(u) => u.0.value(),
18438 }
18439 }
18440
18441 /// Gets the enum value as a string.
18442 ///
18443 /// Returns `None` if the enum contains an unknown value deserialized from
18444 /// the integer representation of enums.
18445 pub fn name(&self) -> std::option::Option<&str> {
18446 match self {
18447 Self::Unspecified => {
18448 std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
18449 }
18450 Self::VersionedFoundation => {
18451 std::option::Option::Some("VERSIONED_FOUNDATION")
18452 }
18453 Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
18454 Self::UnknownValue(u) => u.0.name(),
18455 }
18456 }
18457 }
18458
18459 impl std::default::Default for CustomModelType {
18460 fn default() -> Self {
18461 use std::convert::From;
18462 Self::from(0)
18463 }
18464 }
18465
18466 impl std::fmt::Display for CustomModelType {
18467 fn fmt(
18468 &self,
18469 f: &mut std::fmt::Formatter<'_>,
18470 ) -> std::result::Result<(), std::fmt::Error> {
18471 wkt::internal::display_enum(f, self.name(), self.value())
18472 }
18473 }
18474
18475 impl std::convert::From<i32> for CustomModelType {
18476 fn from(value: i32) -> Self {
18477 match value {
18478 0 => Self::Unspecified,
18479 1 => Self::VersionedFoundation,
18480 2 => Self::FineTuned,
18481 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18482 wkt::internal::UnknownEnumValue::Integer(value),
18483 )),
18484 }
18485 }
18486 }
18487
18488 impl std::convert::From<&str> for CustomModelType {
18489 fn from(value: &str) -> Self {
18490 use std::string::ToString;
18491 match value {
18492 "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
18493 "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
18494 "FINE_TUNED" => Self::FineTuned,
18495 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18496 wkt::internal::UnknownEnumValue::String(value.to_string()),
18497 )),
18498 }
18499 }
18500 }
18501
18502 impl serde::ser::Serialize for CustomModelType {
18503 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18504 where
18505 S: serde::Serializer,
18506 {
18507 match self {
18508 Self::Unspecified => serializer.serialize_i32(0),
18509 Self::VersionedFoundation => serializer.serialize_i32(1),
18510 Self::FineTuned => serializer.serialize_i32(2),
18511 Self::UnknownValue(u) => u.0.serialize(serializer),
18512 }
18513 }
18514 }
18515
18516 impl<'de> serde::de::Deserialize<'de> for CustomModelType {
18517 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18518 where
18519 D: serde::Deserializer<'de>,
18520 {
18521 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
18522 ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
18523 }
18524 }
18525 }
18526
18527 /// The processor version is either a pretrained Google-managed foundation
18528 /// model or a custom Generative AI model created by the user.
18529 #[derive(Clone, Debug, PartialEq)]
18530 #[non_exhaustive]
18531 pub enum ModelInfo {
18532 /// Information for a pretrained Google-managed foundation model.
18533 FoundationGenAiModelInfo(
18534 std::boxed::Box<
18535 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18536 >,
18537 ),
18538 /// Information for a custom Generative AI model created by the user.
18539 CustomGenAiModelInfo(
18540 std::boxed::Box<
18541 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18542 >,
18543 ),
18544 }
18545 }
18546
18547 /// The possible states of the processor version.
18548 ///
18549 /// # Working with unknown values
18550 ///
18551 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18552 /// additional enum variants at any time. Adding new variants is not considered
18553 /// a breaking change. Applications should write their code in anticipation of:
18554 ///
18555 /// - New values appearing in future releases of the client library, **and**
18556 /// - New values received dynamically, without application changes.
18557 ///
18558 /// Please consult the [Working with enums] section in the user guide for some
18559 /// guidelines.
18560 ///
18561 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18562 #[derive(Clone, Debug, PartialEq)]
18563 #[non_exhaustive]
18564 pub enum State {
18565 /// The processor version is in an unspecified state.
18566 Unspecified,
18567 /// The processor version is deployed and can be used for processing.
18568 Deployed,
18569 /// The processor version is being deployed.
18570 Deploying,
18571 /// The processor version is not deployed and cannot be used for processing.
18572 Undeployed,
18573 /// The processor version is being undeployed.
18574 Undeploying,
18575 /// The processor version is being created.
18576 Creating,
18577 /// The processor version is being deleted.
18578 Deleting,
18579 /// The processor version failed and is in an indeterminate state.
18580 Failed,
18581 /// The processor version is being imported.
18582 Importing,
18583 /// If set, the enum was initialized with an unknown value.
18584 ///
18585 /// Applications can examine the value using [State::value] or
18586 /// [State::name].
18587 UnknownValue(state::UnknownValue),
18588 }
18589
18590 #[doc(hidden)]
18591 pub mod state {
18592 #[allow(unused_imports)]
18593 use super::*;
18594 #[derive(Clone, Debug, PartialEq)]
18595 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18596 }
18597
18598 impl State {
18599 /// Gets the enum value.
18600 ///
18601 /// Returns `None` if the enum contains an unknown value deserialized from
18602 /// the string representation of enums.
18603 pub fn value(&self) -> std::option::Option<i32> {
18604 match self {
18605 Self::Unspecified => std::option::Option::Some(0),
18606 Self::Deployed => std::option::Option::Some(1),
18607 Self::Deploying => std::option::Option::Some(2),
18608 Self::Undeployed => std::option::Option::Some(3),
18609 Self::Undeploying => std::option::Option::Some(4),
18610 Self::Creating => std::option::Option::Some(5),
18611 Self::Deleting => std::option::Option::Some(6),
18612 Self::Failed => std::option::Option::Some(7),
18613 Self::Importing => std::option::Option::Some(8),
18614 Self::UnknownValue(u) => u.0.value(),
18615 }
18616 }
18617
18618 /// Gets the enum value as a string.
18619 ///
18620 /// Returns `None` if the enum contains an unknown value deserialized from
18621 /// the integer representation of enums.
18622 pub fn name(&self) -> std::option::Option<&str> {
18623 match self {
18624 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
18625 Self::Deployed => std::option::Option::Some("DEPLOYED"),
18626 Self::Deploying => std::option::Option::Some("DEPLOYING"),
18627 Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
18628 Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
18629 Self::Creating => std::option::Option::Some("CREATING"),
18630 Self::Deleting => std::option::Option::Some("DELETING"),
18631 Self::Failed => std::option::Option::Some("FAILED"),
18632 Self::Importing => std::option::Option::Some("IMPORTING"),
18633 Self::UnknownValue(u) => u.0.name(),
18634 }
18635 }
18636 }
18637
18638 impl std::default::Default for State {
18639 fn default() -> Self {
18640 use std::convert::From;
18641 Self::from(0)
18642 }
18643 }
18644
18645 impl std::fmt::Display for State {
18646 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18647 wkt::internal::display_enum(f, self.name(), self.value())
18648 }
18649 }
18650
18651 impl std::convert::From<i32> for State {
18652 fn from(value: i32) -> Self {
18653 match value {
18654 0 => Self::Unspecified,
18655 1 => Self::Deployed,
18656 2 => Self::Deploying,
18657 3 => Self::Undeployed,
18658 4 => Self::Undeploying,
18659 5 => Self::Creating,
18660 6 => Self::Deleting,
18661 7 => Self::Failed,
18662 8 => Self::Importing,
18663 _ => Self::UnknownValue(state::UnknownValue(
18664 wkt::internal::UnknownEnumValue::Integer(value),
18665 )),
18666 }
18667 }
18668 }
18669
18670 impl std::convert::From<&str> for State {
18671 fn from(value: &str) -> Self {
18672 use std::string::ToString;
18673 match value {
18674 "STATE_UNSPECIFIED" => Self::Unspecified,
18675 "DEPLOYED" => Self::Deployed,
18676 "DEPLOYING" => Self::Deploying,
18677 "UNDEPLOYED" => Self::Undeployed,
18678 "UNDEPLOYING" => Self::Undeploying,
18679 "CREATING" => Self::Creating,
18680 "DELETING" => Self::Deleting,
18681 "FAILED" => Self::Failed,
18682 "IMPORTING" => Self::Importing,
18683 _ => Self::UnknownValue(state::UnknownValue(
18684 wkt::internal::UnknownEnumValue::String(value.to_string()),
18685 )),
18686 }
18687 }
18688 }
18689
18690 impl serde::ser::Serialize for State {
18691 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18692 where
18693 S: serde::Serializer,
18694 {
18695 match self {
18696 Self::Unspecified => serializer.serialize_i32(0),
18697 Self::Deployed => serializer.serialize_i32(1),
18698 Self::Deploying => serializer.serialize_i32(2),
18699 Self::Undeployed => serializer.serialize_i32(3),
18700 Self::Undeploying => serializer.serialize_i32(4),
18701 Self::Creating => serializer.serialize_i32(5),
18702 Self::Deleting => serializer.serialize_i32(6),
18703 Self::Failed => serializer.serialize_i32(7),
18704 Self::Importing => serializer.serialize_i32(8),
18705 Self::UnknownValue(u) => u.0.serialize(serializer),
18706 }
18707 }
18708 }
18709
18710 impl<'de> serde::de::Deserialize<'de> for State {
18711 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18712 where
18713 D: serde::Deserializer<'de>,
18714 {
18715 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18716 ".google.cloud.documentai.v1.ProcessorVersion.State",
18717 ))
18718 }
18719 }
18720
18721 /// The possible model types of the processor version.
18722 ///
18723 /// # Working with unknown values
18724 ///
18725 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18726 /// additional enum variants at any time. Adding new variants is not considered
18727 /// a breaking change. Applications should write their code in anticipation of:
18728 ///
18729 /// - New values appearing in future releases of the client library, **and**
18730 /// - New values received dynamically, without application changes.
18731 ///
18732 /// Please consult the [Working with enums] section in the user guide for some
18733 /// guidelines.
18734 ///
18735 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18736 #[derive(Clone, Debug, PartialEq)]
18737 #[non_exhaustive]
18738 pub enum ModelType {
18739 /// The processor version has unspecified model type.
18740 Unspecified,
18741 /// The processor version has generative model type.
18742 Generative,
18743 /// The processor version has custom model type.
18744 Custom,
18745 /// If set, the enum was initialized with an unknown value.
18746 ///
18747 /// Applications can examine the value using [ModelType::value] or
18748 /// [ModelType::name].
18749 UnknownValue(model_type::UnknownValue),
18750 }
18751
18752 #[doc(hidden)]
18753 pub mod model_type {
18754 #[allow(unused_imports)]
18755 use super::*;
18756 #[derive(Clone, Debug, PartialEq)]
18757 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18758 }
18759
18760 impl ModelType {
18761 /// Gets the enum value.
18762 ///
18763 /// Returns `None` if the enum contains an unknown value deserialized from
18764 /// the string representation of enums.
18765 pub fn value(&self) -> std::option::Option<i32> {
18766 match self {
18767 Self::Unspecified => std::option::Option::Some(0),
18768 Self::Generative => std::option::Option::Some(1),
18769 Self::Custom => std::option::Option::Some(2),
18770 Self::UnknownValue(u) => u.0.value(),
18771 }
18772 }
18773
18774 /// Gets the enum value as a string.
18775 ///
18776 /// Returns `None` if the enum contains an unknown value deserialized from
18777 /// the integer representation of enums.
18778 pub fn name(&self) -> std::option::Option<&str> {
18779 match self {
18780 Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
18781 Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
18782 Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
18783 Self::UnknownValue(u) => u.0.name(),
18784 }
18785 }
18786 }
18787
18788 impl std::default::Default for ModelType {
18789 fn default() -> Self {
18790 use std::convert::From;
18791 Self::from(0)
18792 }
18793 }
18794
18795 impl std::fmt::Display for ModelType {
18796 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18797 wkt::internal::display_enum(f, self.name(), self.value())
18798 }
18799 }
18800
18801 impl std::convert::From<i32> for ModelType {
18802 fn from(value: i32) -> Self {
18803 match value {
18804 0 => Self::Unspecified,
18805 1 => Self::Generative,
18806 2 => Self::Custom,
18807 _ => Self::UnknownValue(model_type::UnknownValue(
18808 wkt::internal::UnknownEnumValue::Integer(value),
18809 )),
18810 }
18811 }
18812 }
18813
18814 impl std::convert::From<&str> for ModelType {
18815 fn from(value: &str) -> Self {
18816 use std::string::ToString;
18817 match value {
18818 "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
18819 "MODEL_TYPE_GENERATIVE" => Self::Generative,
18820 "MODEL_TYPE_CUSTOM" => Self::Custom,
18821 _ => Self::UnknownValue(model_type::UnknownValue(
18822 wkt::internal::UnknownEnumValue::String(value.to_string()),
18823 )),
18824 }
18825 }
18826 }
18827
18828 impl serde::ser::Serialize for ModelType {
18829 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18830 where
18831 S: serde::Serializer,
18832 {
18833 match self {
18834 Self::Unspecified => serializer.serialize_i32(0),
18835 Self::Generative => serializer.serialize_i32(1),
18836 Self::Custom => serializer.serialize_i32(2),
18837 Self::UnknownValue(u) => u.0.serialize(serializer),
18838 }
18839 }
18840 }
18841
18842 impl<'de> serde::de::Deserialize<'de> for ModelType {
18843 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18844 where
18845 D: serde::Deserializer<'de>,
18846 {
18847 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
18848 ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
18849 ))
18850 }
18851 }
18852}
18853
18854/// Contains the alias and the aliased resource name of processor version.
18855#[derive(Clone, Default, PartialEq)]
18856#[non_exhaustive]
18857pub struct ProcessorVersionAlias {
18858 /// The alias in the form of `processor_version` resource name.
18859 pub alias: std::string::String,
18860
18861 /// The resource name of aliased processor version.
18862 pub processor_version: std::string::String,
18863
18864 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18865}
18866
18867impl ProcessorVersionAlias {
18868 pub fn new() -> Self {
18869 std::default::Default::default()
18870 }
18871
18872 /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
18873 ///
18874 /// # Example
18875 /// ```ignore,no_run
18876 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
18877 /// let x = ProcessorVersionAlias::new().set_alias("example");
18878 /// ```
18879 pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18880 self.alias = v.into();
18881 self
18882 }
18883
18884 /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
18885 ///
18886 /// # Example
18887 /// ```ignore,no_run
18888 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
18889 /// let x = ProcessorVersionAlias::new().set_processor_version("example");
18890 /// ```
18891 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
18892 mut self,
18893 v: T,
18894 ) -> Self {
18895 self.processor_version = v.into();
18896 self
18897 }
18898}
18899
18900impl wkt::message::Message for ProcessorVersionAlias {
18901 fn typename() -> &'static str {
18902 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
18903 }
18904}
18905
18906/// The first-class citizen for Document AI. Each processor defines how to
18907/// extract structural information from a document.
18908#[derive(Clone, Default, PartialEq)]
18909#[non_exhaustive]
18910pub struct Processor {
18911 /// Output only. Immutable. The resource name of the processor.
18912 /// Format: `projects/{project}/locations/{location}/processors/{processor}`
18913 pub name: std::string::String,
18914
18915 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
18916 /// To get a list of processor types, see
18917 /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
18918 ///
18919 /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
18920 pub r#type: std::string::String,
18921
18922 /// The display name of the processor.
18923 pub display_name: std::string::String,
18924
18925 /// Output only. The state of the processor.
18926 pub state: crate::model::processor::State,
18927
18928 /// The default processor version.
18929 pub default_processor_version: std::string::String,
18930
18931 /// Output only. The processor version aliases.
18932 pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
18933
18934 /// Output only. Immutable. The http endpoint that can be called to invoke
18935 /// processing.
18936 pub process_endpoint: std::string::String,
18937
18938 /// Output only. The time the processor was created.
18939 pub create_time: std::option::Option<wkt::Timestamp>,
18940
18941 /// The [KMS key](https://cloud.google.com/security-key-management) used for
18942 /// encryption and decryption in CMEK scenarios.
18943 pub kms_key_name: std::string::String,
18944
18945 /// Output only. Reserved for future use.
18946 pub satisfies_pzs: bool,
18947
18948 /// Output only. Reserved for future use.
18949 pub satisfies_pzi: bool,
18950
18951 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18952}
18953
18954impl Processor {
18955 pub fn new() -> Self {
18956 std::default::Default::default()
18957 }
18958
18959 /// Sets the value of [name][crate::model::Processor::name].
18960 ///
18961 /// # Example
18962 /// ```ignore,no_run
18963 /// # use google_cloud_documentai_v1::model::Processor;
18964 /// let x = Processor::new().set_name("example");
18965 /// ```
18966 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18967 self.name = v.into();
18968 self
18969 }
18970
18971 /// Sets the value of [r#type][crate::model::Processor::type].
18972 ///
18973 /// # Example
18974 /// ```ignore,no_run
18975 /// # use google_cloud_documentai_v1::model::Processor;
18976 /// let x = Processor::new().set_type("example");
18977 /// ```
18978 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18979 self.r#type = v.into();
18980 self
18981 }
18982
18983 /// Sets the value of [display_name][crate::model::Processor::display_name].
18984 ///
18985 /// # Example
18986 /// ```ignore,no_run
18987 /// # use google_cloud_documentai_v1::model::Processor;
18988 /// let x = Processor::new().set_display_name("example");
18989 /// ```
18990 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18991 self.display_name = v.into();
18992 self
18993 }
18994
18995 /// Sets the value of [state][crate::model::Processor::state].
18996 ///
18997 /// # Example
18998 /// ```ignore,no_run
18999 /// # use google_cloud_documentai_v1::model::Processor;
19000 /// use google_cloud_documentai_v1::model::processor::State;
19001 /// let x0 = Processor::new().set_state(State::Enabled);
19002 /// let x1 = Processor::new().set_state(State::Disabled);
19003 /// let x2 = Processor::new().set_state(State::Enabling);
19004 /// ```
19005 pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
19006 mut self,
19007 v: T,
19008 ) -> Self {
19009 self.state = v.into();
19010 self
19011 }
19012
19013 /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
19014 ///
19015 /// # Example
19016 /// ```ignore,no_run
19017 /// # use google_cloud_documentai_v1::model::Processor;
19018 /// let x = Processor::new().set_default_processor_version("example");
19019 /// ```
19020 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
19021 mut self,
19022 v: T,
19023 ) -> Self {
19024 self.default_processor_version = v.into();
19025 self
19026 }
19027
19028 /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
19029 ///
19030 /// # Example
19031 /// ```ignore,no_run
19032 /// # use google_cloud_documentai_v1::model::Processor;
19033 /// use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19034 /// let x = Processor::new()
19035 /// .set_processor_version_aliases([
19036 /// ProcessorVersionAlias::default()/* use setters */,
19037 /// ProcessorVersionAlias::default()/* use (different) setters */,
19038 /// ]);
19039 /// ```
19040 pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
19041 where
19042 T: std::iter::IntoIterator<Item = V>,
19043 V: std::convert::Into<crate::model::ProcessorVersionAlias>,
19044 {
19045 use std::iter::Iterator;
19046 self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
19047 self
19048 }
19049
19050 /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
19051 ///
19052 /// # Example
19053 /// ```ignore,no_run
19054 /// # use google_cloud_documentai_v1::model::Processor;
19055 /// let x = Processor::new().set_process_endpoint("example");
19056 /// ```
19057 pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
19058 mut self,
19059 v: T,
19060 ) -> Self {
19061 self.process_endpoint = v.into();
19062 self
19063 }
19064
19065 /// Sets the value of [create_time][crate::model::Processor::create_time].
19066 ///
19067 /// # Example
19068 /// ```ignore,no_run
19069 /// # use google_cloud_documentai_v1::model::Processor;
19070 /// use wkt::Timestamp;
19071 /// let x = Processor::new().set_create_time(Timestamp::default()/* use setters */);
19072 /// ```
19073 pub fn set_create_time<T>(mut self, v: T) -> Self
19074 where
19075 T: std::convert::Into<wkt::Timestamp>,
19076 {
19077 self.create_time = std::option::Option::Some(v.into());
19078 self
19079 }
19080
19081 /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
19082 ///
19083 /// # Example
19084 /// ```ignore,no_run
19085 /// # use google_cloud_documentai_v1::model::Processor;
19086 /// use wkt::Timestamp;
19087 /// let x = Processor::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19088 /// let x = Processor::new().set_or_clear_create_time(None::<Timestamp>);
19089 /// ```
19090 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19091 where
19092 T: std::convert::Into<wkt::Timestamp>,
19093 {
19094 self.create_time = v.map(|x| x.into());
19095 self
19096 }
19097
19098 /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
19099 ///
19100 /// # Example
19101 /// ```ignore,no_run
19102 /// # use google_cloud_documentai_v1::model::Processor;
19103 /// let x = Processor::new().set_kms_key_name("example");
19104 /// ```
19105 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19106 self.kms_key_name = v.into();
19107 self
19108 }
19109
19110 /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
19111 ///
19112 /// # Example
19113 /// ```ignore,no_run
19114 /// # use google_cloud_documentai_v1::model::Processor;
19115 /// let x = Processor::new().set_satisfies_pzs(true);
19116 /// ```
19117 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19118 self.satisfies_pzs = v.into();
19119 self
19120 }
19121
19122 /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
19123 ///
19124 /// # Example
19125 /// ```ignore,no_run
19126 /// # use google_cloud_documentai_v1::model::Processor;
19127 /// let x = Processor::new().set_satisfies_pzi(true);
19128 /// ```
19129 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19130 self.satisfies_pzi = v.into();
19131 self
19132 }
19133}
19134
19135impl wkt::message::Message for Processor {
19136 fn typename() -> &'static str {
19137 "type.googleapis.com/google.cloud.documentai.v1.Processor"
19138 }
19139}
19140
19141/// Defines additional types related to [Processor].
19142pub mod processor {
19143 #[allow(unused_imports)]
19144 use super::*;
19145
19146 /// The possible states of the processor.
19147 ///
19148 /// # Working with unknown values
19149 ///
19150 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19151 /// additional enum variants at any time. Adding new variants is not considered
19152 /// a breaking change. Applications should write their code in anticipation of:
19153 ///
19154 /// - New values appearing in future releases of the client library, **and**
19155 /// - New values received dynamically, without application changes.
19156 ///
19157 /// Please consult the [Working with enums] section in the user guide for some
19158 /// guidelines.
19159 ///
19160 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19161 #[derive(Clone, Debug, PartialEq)]
19162 #[non_exhaustive]
19163 pub enum State {
19164 /// The processor is in an unspecified state.
19165 Unspecified,
19166 /// The processor is enabled, i.e., has an enabled version which can
19167 /// currently serve processing requests and all the feature dependencies have
19168 /// been successfully initialized.
19169 Enabled,
19170 /// The processor is disabled.
19171 Disabled,
19172 /// The processor is being enabled, will become `ENABLED` if successful.
19173 Enabling,
19174 /// The processor is being disabled, will become `DISABLED` if successful.
19175 Disabling,
19176 /// The processor is being created, will become either `ENABLED` (for
19177 /// successful creation) or `FAILED` (for failed ones).
19178 /// Once a processor is in this state, it can then be used for document
19179 /// processing, but the feature dependencies of the processor might not be
19180 /// fully created yet.
19181 Creating,
19182 /// The processor failed during creation or initialization of feature
19183 /// dependencies. The user should delete the processor and recreate one as
19184 /// all the functionalities of the processor are disabled.
19185 Failed,
19186 /// The processor is being deleted, will be removed if successful.
19187 Deleting,
19188 /// If set, the enum was initialized with an unknown value.
19189 ///
19190 /// Applications can examine the value using [State::value] or
19191 /// [State::name].
19192 UnknownValue(state::UnknownValue),
19193 }
19194
19195 #[doc(hidden)]
19196 pub mod state {
19197 #[allow(unused_imports)]
19198 use super::*;
19199 #[derive(Clone, Debug, PartialEq)]
19200 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19201 }
19202
19203 impl State {
19204 /// Gets the enum value.
19205 ///
19206 /// Returns `None` if the enum contains an unknown value deserialized from
19207 /// the string representation of enums.
19208 pub fn value(&self) -> std::option::Option<i32> {
19209 match self {
19210 Self::Unspecified => std::option::Option::Some(0),
19211 Self::Enabled => std::option::Option::Some(1),
19212 Self::Disabled => std::option::Option::Some(2),
19213 Self::Enabling => std::option::Option::Some(3),
19214 Self::Disabling => std::option::Option::Some(4),
19215 Self::Creating => std::option::Option::Some(5),
19216 Self::Failed => std::option::Option::Some(6),
19217 Self::Deleting => std::option::Option::Some(7),
19218 Self::UnknownValue(u) => u.0.value(),
19219 }
19220 }
19221
19222 /// Gets the enum value as a string.
19223 ///
19224 /// Returns `None` if the enum contains an unknown value deserialized from
19225 /// the integer representation of enums.
19226 pub fn name(&self) -> std::option::Option<&str> {
19227 match self {
19228 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19229 Self::Enabled => std::option::Option::Some("ENABLED"),
19230 Self::Disabled => std::option::Option::Some("DISABLED"),
19231 Self::Enabling => std::option::Option::Some("ENABLING"),
19232 Self::Disabling => std::option::Option::Some("DISABLING"),
19233 Self::Creating => std::option::Option::Some("CREATING"),
19234 Self::Failed => std::option::Option::Some("FAILED"),
19235 Self::Deleting => std::option::Option::Some("DELETING"),
19236 Self::UnknownValue(u) => u.0.name(),
19237 }
19238 }
19239 }
19240
19241 impl std::default::Default for State {
19242 fn default() -> Self {
19243 use std::convert::From;
19244 Self::from(0)
19245 }
19246 }
19247
19248 impl std::fmt::Display for State {
19249 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19250 wkt::internal::display_enum(f, self.name(), self.value())
19251 }
19252 }
19253
19254 impl std::convert::From<i32> for State {
19255 fn from(value: i32) -> Self {
19256 match value {
19257 0 => Self::Unspecified,
19258 1 => Self::Enabled,
19259 2 => Self::Disabled,
19260 3 => Self::Enabling,
19261 4 => Self::Disabling,
19262 5 => Self::Creating,
19263 6 => Self::Failed,
19264 7 => Self::Deleting,
19265 _ => Self::UnknownValue(state::UnknownValue(
19266 wkt::internal::UnknownEnumValue::Integer(value),
19267 )),
19268 }
19269 }
19270 }
19271
19272 impl std::convert::From<&str> for State {
19273 fn from(value: &str) -> Self {
19274 use std::string::ToString;
19275 match value {
19276 "STATE_UNSPECIFIED" => Self::Unspecified,
19277 "ENABLED" => Self::Enabled,
19278 "DISABLED" => Self::Disabled,
19279 "ENABLING" => Self::Enabling,
19280 "DISABLING" => Self::Disabling,
19281 "CREATING" => Self::Creating,
19282 "FAILED" => Self::Failed,
19283 "DELETING" => Self::Deleting,
19284 _ => Self::UnknownValue(state::UnknownValue(
19285 wkt::internal::UnknownEnumValue::String(value.to_string()),
19286 )),
19287 }
19288 }
19289 }
19290
19291 impl serde::ser::Serialize for State {
19292 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19293 where
19294 S: serde::Serializer,
19295 {
19296 match self {
19297 Self::Unspecified => serializer.serialize_i32(0),
19298 Self::Enabled => serializer.serialize_i32(1),
19299 Self::Disabled => serializer.serialize_i32(2),
19300 Self::Enabling => serializer.serialize_i32(3),
19301 Self::Disabling => serializer.serialize_i32(4),
19302 Self::Creating => serializer.serialize_i32(5),
19303 Self::Failed => serializer.serialize_i32(6),
19304 Self::Deleting => serializer.serialize_i32(7),
19305 Self::UnknownValue(u) => u.0.serialize(serializer),
19306 }
19307 }
19308 }
19309
19310 impl<'de> serde::de::Deserialize<'de> for State {
19311 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19312 where
19313 D: serde::Deserializer<'de>,
19314 {
19315 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19316 ".google.cloud.documentai.v1.Processor.State",
19317 ))
19318 }
19319 }
19320}
19321
19322/// A processor type is responsible for performing a certain document
19323/// understanding task on a certain type of document.
19324#[derive(Clone, Default, PartialEq)]
19325#[non_exhaustive]
19326pub struct ProcessorType {
19327 /// The resource name of the processor type.
19328 /// Format: `projects/{project}/processorTypes/{processor_type}`
19329 pub name: std::string::String,
19330
19331 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19332 pub r#type: std::string::String,
19333
19334 /// The processor category, used by UI to group processor types.
19335 pub category: std::string::String,
19336
19337 /// The locations in which this processor is available.
19338 pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
19339
19340 /// Whether the processor type allows creation. If true, users can create a
19341 /// processor of this processor type. Otherwise, users need to request access.
19342 pub allow_creation: bool,
19343
19344 /// Launch stage of the processor type
19345 pub launch_stage: google_cloud_api::model::LaunchStage,
19346
19347 /// A set of Cloud Storage URIs of sample documents for this processor.
19348 pub sample_document_uris: std::vec::Vec<std::string::String>,
19349
19350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19351}
19352
19353impl ProcessorType {
19354 pub fn new() -> Self {
19355 std::default::Default::default()
19356 }
19357
19358 /// Sets the value of [name][crate::model::ProcessorType::name].
19359 ///
19360 /// # Example
19361 /// ```ignore,no_run
19362 /// # use google_cloud_documentai_v1::model::ProcessorType;
19363 /// let x = ProcessorType::new().set_name("example");
19364 /// ```
19365 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19366 self.name = v.into();
19367 self
19368 }
19369
19370 /// Sets the value of [r#type][crate::model::ProcessorType::type].
19371 ///
19372 /// # Example
19373 /// ```ignore,no_run
19374 /// # use google_cloud_documentai_v1::model::ProcessorType;
19375 /// let x = ProcessorType::new().set_type("example");
19376 /// ```
19377 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19378 self.r#type = v.into();
19379 self
19380 }
19381
19382 /// Sets the value of [category][crate::model::ProcessorType::category].
19383 ///
19384 /// # Example
19385 /// ```ignore,no_run
19386 /// # use google_cloud_documentai_v1::model::ProcessorType;
19387 /// let x = ProcessorType::new().set_category("example");
19388 /// ```
19389 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19390 self.category = v.into();
19391 self
19392 }
19393
19394 /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
19395 ///
19396 /// # Example
19397 /// ```ignore,no_run
19398 /// # use google_cloud_documentai_v1::model::ProcessorType;
19399 /// use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19400 /// let x = ProcessorType::new()
19401 /// .set_available_locations([
19402 /// LocationInfo::default()/* use setters */,
19403 /// LocationInfo::default()/* use (different) setters */,
19404 /// ]);
19405 /// ```
19406 pub fn set_available_locations<T, V>(mut self, v: T) -> Self
19407 where
19408 T: std::iter::IntoIterator<Item = V>,
19409 V: std::convert::Into<crate::model::processor_type::LocationInfo>,
19410 {
19411 use std::iter::Iterator;
19412 self.available_locations = v.into_iter().map(|i| i.into()).collect();
19413 self
19414 }
19415
19416 /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
19417 ///
19418 /// # Example
19419 /// ```ignore,no_run
19420 /// # use google_cloud_documentai_v1::model::ProcessorType;
19421 /// let x = ProcessorType::new().set_allow_creation(true);
19422 /// ```
19423 pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19424 self.allow_creation = v.into();
19425 self
19426 }
19427
19428 /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
19429 ///
19430 /// # Example
19431 /// ```ignore,no_run
19432 /// # use google_cloud_documentai_v1::model::ProcessorType;
19433 /// use google_cloud_api::model::LaunchStage;
19434 /// let x0 = ProcessorType::new().set_launch_stage(LaunchStage::Unimplemented);
19435 /// let x1 = ProcessorType::new().set_launch_stage(LaunchStage::Prelaunch);
19436 /// let x2 = ProcessorType::new().set_launch_stage(LaunchStage::EarlyAccess);
19437 /// ```
19438 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
19439 mut self,
19440 v: T,
19441 ) -> Self {
19442 self.launch_stage = v.into();
19443 self
19444 }
19445
19446 /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
19447 ///
19448 /// # Example
19449 /// ```ignore,no_run
19450 /// # use google_cloud_documentai_v1::model::ProcessorType;
19451 /// let x = ProcessorType::new().set_sample_document_uris(["a", "b", "c"]);
19452 /// ```
19453 pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
19454 where
19455 T: std::iter::IntoIterator<Item = V>,
19456 V: std::convert::Into<std::string::String>,
19457 {
19458 use std::iter::Iterator;
19459 self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
19460 self
19461 }
19462}
19463
19464impl wkt::message::Message for ProcessorType {
19465 fn typename() -> &'static str {
19466 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
19467 }
19468}
19469
19470/// Defines additional types related to [ProcessorType].
19471pub mod processor_type {
19472 #[allow(unused_imports)]
19473 use super::*;
19474
19475 /// The location information about where the processor is available.
19476 #[derive(Clone, Default, PartialEq)]
19477 #[non_exhaustive]
19478 pub struct LocationInfo {
19479 /// The location ID. For supported locations, refer to [regional and
19480 /// multi-regional support](/document-ai/docs/regions).
19481 pub location_id: std::string::String,
19482
19483 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19484 }
19485
19486 impl LocationInfo {
19487 pub fn new() -> Self {
19488 std::default::Default::default()
19489 }
19490
19491 /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
19492 ///
19493 /// # Example
19494 /// ```ignore,no_run
19495 /// # use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19496 /// let x = LocationInfo::new().set_location_id("example");
19497 /// ```
19498 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19499 self.location_id = v.into();
19500 self
19501 }
19502 }
19503
19504 impl wkt::message::Message for LocationInfo {
19505 fn typename() -> &'static str {
19506 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
19507 }
19508 }
19509}