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 /// Creates a new default instance.
91 pub fn new() -> Self {
92 std::default::Default::default()
93 }
94
95 /// Sets the value of [format][crate::model::Barcode::format].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_documentai_v1::model::Barcode;
100 /// let x = Barcode::new().set_format("example");
101 /// ```
102 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103 self.format = v.into();
104 self
105 }
106
107 /// Sets the value of [value_format][crate::model::Barcode::value_format].
108 ///
109 /// # Example
110 /// ```ignore,no_run
111 /// # use google_cloud_documentai_v1::model::Barcode;
112 /// let x = Barcode::new().set_value_format("example");
113 /// ```
114 pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115 self.value_format = v.into();
116 self
117 }
118
119 /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
120 ///
121 /// # Example
122 /// ```ignore,no_run
123 /// # use google_cloud_documentai_v1::model::Barcode;
124 /// let x = Barcode::new().set_raw_value("example");
125 /// ```
126 pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
127 self.raw_value = v.into();
128 self
129 }
130}
131
132impl wkt::message::Message for Barcode {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.documentai.v1.Barcode"
135 }
136}
137
138/// Document represents the canonical document resource in Document AI. It is an
139/// interchange format that provides insights into documents and allows for
140/// collaboration between users and Document AI to iterate and optimize for
141/// quality.
142#[derive(Clone, Default, PartialEq)]
143#[non_exhaustive]
144pub struct Document {
145 /// Optional. An internal identifier for document. Should be loggable (no PII).
146 pub docid: std::string::String,
147
148 /// An IANA published [media type (MIME
149 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
150 pub mime_type: std::string::String,
151
152 /// Optional. UTF-8 encoded text in reading order from the document.
153 pub text: std::string::String,
154
155 /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
156 ///
157 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
158 #[deprecated]
159 pub text_styles: std::vec::Vec<crate::model::document::Style>,
160
161 /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
162 ///
163 /// [google.cloud.documentai.v1.Document]: crate::model::Document
164 pub pages: std::vec::Vec<crate::model::document::Page>,
165
166 /// A list of entities detected on
167 /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
168 /// shards, entities in this list may cross shard boundaries.
169 ///
170 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
171 pub entities: std::vec::Vec<crate::model::document::Entity>,
172
173 /// Placeholder. Relationship among
174 /// [Document.entities][google.cloud.documentai.v1.Document.entities].
175 ///
176 /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
177 pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
178
179 /// Placeholder. A list of text corrections made to
180 /// [Document.text][google.cloud.documentai.v1.Document.text]. This is usually
181 /// used for annotating corrections to OCR mistakes. Text changes for a given
182 /// revision may not overlap with each other.
183 ///
184 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
185 pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
186
187 /// Information about the sharding if this document is sharded part of a larger
188 /// document. If the document is not sharded, this message is not specified.
189 pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
190
191 /// Any error that occurred while processing this document.
192 pub error: std::option::Option<google_cloud_rpc::model::Status>,
193
194 /// Placeholder. Revision history of this document.
195 pub revisions: std::vec::Vec<crate::model::document::Revision>,
196
197 /// Parsed layout of the document.
198 pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
199
200 /// Document chunked based on chunking config.
201 pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
202
203 /// Optional. The blob assets in this document. This is used to store the
204 /// content of the inline blobs in this document, for example, image bytes,
205 /// such that it can be referenced by other fields in the document via asset
206 /// id.
207 pub blob_assets: std::vec::Vec<crate::model::document::BlobAsset>,
208
209 /// The entity validation output for the document. This is the validation
210 /// output for `document.entities` field.
211 pub entity_validation_output:
212 std::option::Option<crate::model::document::EntityValidationOutput>,
213
214 /// A list of entity revisions. The entity revisions are appended to the
215 /// document in the processing order. This field can be used for comparing the
216 /// entity extraction results at different stages of the processing.
217 pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
218
219 /// The entity revision ID that `document.entities` field is based on.
220 /// If this field is set and `entities_revisions` is not empty, the entities in
221 /// `document.entities` field are the entities in the entity revision with this
222 /// id and `document.entity_validation_output` field is the
223 /// `entity_validation_output` field in this entity revision.
224 pub entities_revision_id: std::string::String,
225
226 /// Original source document from the user.
227 pub source: std::option::Option<crate::model::document::Source>,
228
229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
230}
231
232impl Document {
233 /// Creates a new default instance.
234 pub fn new() -> Self {
235 std::default::Default::default()
236 }
237
238 /// Sets the value of [docid][crate::model::Document::docid].
239 ///
240 /// # Example
241 /// ```ignore,no_run
242 /// # use google_cloud_documentai_v1::model::Document;
243 /// let x = Document::new().set_docid("example");
244 /// ```
245 pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
246 self.docid = v.into();
247 self
248 }
249
250 /// Sets the value of [mime_type][crate::model::Document::mime_type].
251 ///
252 /// # Example
253 /// ```ignore,no_run
254 /// # use google_cloud_documentai_v1::model::Document;
255 /// let x = Document::new().set_mime_type("example");
256 /// ```
257 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
258 self.mime_type = v.into();
259 self
260 }
261
262 /// Sets the value of [text][crate::model::Document::text].
263 ///
264 /// # Example
265 /// ```ignore,no_run
266 /// # use google_cloud_documentai_v1::model::Document;
267 /// let x = Document::new().set_text("example");
268 /// ```
269 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
270 self.text = v.into();
271 self
272 }
273
274 /// Sets the value of [text_styles][crate::model::Document::text_styles].
275 ///
276 /// # Example
277 /// ```ignore,no_run
278 /// # use google_cloud_documentai_v1::model::Document;
279 /// use google_cloud_documentai_v1::model::document::Style;
280 /// let x = Document::new()
281 /// .set_text_styles([
282 /// Style::default()/* use setters */,
283 /// Style::default()/* use (different) setters */,
284 /// ]);
285 /// ```
286 #[deprecated]
287 pub fn set_text_styles<T, V>(mut self, v: T) -> Self
288 where
289 T: std::iter::IntoIterator<Item = V>,
290 V: std::convert::Into<crate::model::document::Style>,
291 {
292 use std::iter::Iterator;
293 self.text_styles = v.into_iter().map(|i| i.into()).collect();
294 self
295 }
296
297 /// Sets the value of [pages][crate::model::Document::pages].
298 ///
299 /// # Example
300 /// ```ignore,no_run
301 /// # use google_cloud_documentai_v1::model::Document;
302 /// use google_cloud_documentai_v1::model::document::Page;
303 /// let x = Document::new()
304 /// .set_pages([
305 /// Page::default()/* use setters */,
306 /// Page::default()/* use (different) setters */,
307 /// ]);
308 /// ```
309 pub fn set_pages<T, V>(mut self, v: T) -> Self
310 where
311 T: std::iter::IntoIterator<Item = V>,
312 V: std::convert::Into<crate::model::document::Page>,
313 {
314 use std::iter::Iterator;
315 self.pages = v.into_iter().map(|i| i.into()).collect();
316 self
317 }
318
319 /// Sets the value of [entities][crate::model::Document::entities].
320 ///
321 /// # Example
322 /// ```ignore,no_run
323 /// # use google_cloud_documentai_v1::model::Document;
324 /// use google_cloud_documentai_v1::model::document::Entity;
325 /// let x = Document::new()
326 /// .set_entities([
327 /// Entity::default()/* use setters */,
328 /// Entity::default()/* use (different) setters */,
329 /// ]);
330 /// ```
331 pub fn set_entities<T, V>(mut self, v: T) -> Self
332 where
333 T: std::iter::IntoIterator<Item = V>,
334 V: std::convert::Into<crate::model::document::Entity>,
335 {
336 use std::iter::Iterator;
337 self.entities = v.into_iter().map(|i| i.into()).collect();
338 self
339 }
340
341 /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
342 ///
343 /// # Example
344 /// ```ignore,no_run
345 /// # use google_cloud_documentai_v1::model::Document;
346 /// use google_cloud_documentai_v1::model::document::EntityRelation;
347 /// let x = Document::new()
348 /// .set_entity_relations([
349 /// EntityRelation::default()/* use setters */,
350 /// EntityRelation::default()/* use (different) setters */,
351 /// ]);
352 /// ```
353 pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
354 where
355 T: std::iter::IntoIterator<Item = V>,
356 V: std::convert::Into<crate::model::document::EntityRelation>,
357 {
358 use std::iter::Iterator;
359 self.entity_relations = v.into_iter().map(|i| i.into()).collect();
360 self
361 }
362
363 /// Sets the value of [text_changes][crate::model::Document::text_changes].
364 ///
365 /// # Example
366 /// ```ignore,no_run
367 /// # use google_cloud_documentai_v1::model::Document;
368 /// use google_cloud_documentai_v1::model::document::TextChange;
369 /// let x = Document::new()
370 /// .set_text_changes([
371 /// TextChange::default()/* use setters */,
372 /// TextChange::default()/* use (different) setters */,
373 /// ]);
374 /// ```
375 pub fn set_text_changes<T, V>(mut self, v: T) -> Self
376 where
377 T: std::iter::IntoIterator<Item = V>,
378 V: std::convert::Into<crate::model::document::TextChange>,
379 {
380 use std::iter::Iterator;
381 self.text_changes = v.into_iter().map(|i| i.into()).collect();
382 self
383 }
384
385 /// Sets the value of [shard_info][crate::model::Document::shard_info].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_documentai_v1::model::Document;
390 /// use google_cloud_documentai_v1::model::document::ShardInfo;
391 /// let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);
392 /// ```
393 pub fn set_shard_info<T>(mut self, v: T) -> Self
394 where
395 T: std::convert::Into<crate::model::document::ShardInfo>,
396 {
397 self.shard_info = std::option::Option::Some(v.into());
398 self
399 }
400
401 /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
402 ///
403 /// # Example
404 /// ```ignore,no_run
405 /// # use google_cloud_documentai_v1::model::Document;
406 /// use google_cloud_documentai_v1::model::document::ShardInfo;
407 /// let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
408 /// let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);
409 /// ```
410 pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
411 where
412 T: std::convert::Into<crate::model::document::ShardInfo>,
413 {
414 self.shard_info = v.map(|x| x.into());
415 self
416 }
417
418 /// Sets the value of [error][crate::model::Document::error].
419 ///
420 /// # Example
421 /// ```ignore,no_run
422 /// # use google_cloud_documentai_v1::model::Document;
423 /// use google_cloud_rpc::model::Status;
424 /// let x = Document::new().set_error(Status::default()/* use setters */);
425 /// ```
426 pub fn set_error<T>(mut self, v: T) -> Self
427 where
428 T: std::convert::Into<google_cloud_rpc::model::Status>,
429 {
430 self.error = std::option::Option::Some(v.into());
431 self
432 }
433
434 /// Sets or clears the value of [error][crate::model::Document::error].
435 ///
436 /// # Example
437 /// ```ignore,no_run
438 /// # use google_cloud_documentai_v1::model::Document;
439 /// use google_cloud_rpc::model::Status;
440 /// let x = Document::new().set_or_clear_error(Some(Status::default()/* use setters */));
441 /// let x = Document::new().set_or_clear_error(None::<Status>);
442 /// ```
443 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
444 where
445 T: std::convert::Into<google_cloud_rpc::model::Status>,
446 {
447 self.error = v.map(|x| x.into());
448 self
449 }
450
451 /// Sets the value of [revisions][crate::model::Document::revisions].
452 ///
453 /// # Example
454 /// ```ignore,no_run
455 /// # use google_cloud_documentai_v1::model::Document;
456 /// use google_cloud_documentai_v1::model::document::Revision;
457 /// let x = Document::new()
458 /// .set_revisions([
459 /// Revision::default()/* use setters */,
460 /// Revision::default()/* use (different) setters */,
461 /// ]);
462 /// ```
463 pub fn set_revisions<T, V>(mut self, v: T) -> Self
464 where
465 T: std::iter::IntoIterator<Item = V>,
466 V: std::convert::Into<crate::model::document::Revision>,
467 {
468 use std::iter::Iterator;
469 self.revisions = v.into_iter().map(|i| i.into()).collect();
470 self
471 }
472
473 /// Sets the value of [document_layout][crate::model::Document::document_layout].
474 ///
475 /// # Example
476 /// ```ignore,no_run
477 /// # use google_cloud_documentai_v1::model::Document;
478 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
479 /// let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);
480 /// ```
481 pub fn set_document_layout<T>(mut self, v: T) -> Self
482 where
483 T: std::convert::Into<crate::model::document::DocumentLayout>,
484 {
485 self.document_layout = std::option::Option::Some(v.into());
486 self
487 }
488
489 /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_documentai_v1::model::Document;
494 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
495 /// let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
496 /// let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);
497 /// ```
498 pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
499 where
500 T: std::convert::Into<crate::model::document::DocumentLayout>,
501 {
502 self.document_layout = v.map(|x| x.into());
503 self
504 }
505
506 /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
507 ///
508 /// # Example
509 /// ```ignore,no_run
510 /// # use google_cloud_documentai_v1::model::Document;
511 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
512 /// let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);
513 /// ```
514 pub fn set_chunked_document<T>(mut self, v: T) -> Self
515 where
516 T: std::convert::Into<crate::model::document::ChunkedDocument>,
517 {
518 self.chunked_document = std::option::Option::Some(v.into());
519 self
520 }
521
522 /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
523 ///
524 /// # Example
525 /// ```ignore,no_run
526 /// # use google_cloud_documentai_v1::model::Document;
527 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
528 /// let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
529 /// let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);
530 /// ```
531 pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
532 where
533 T: std::convert::Into<crate::model::document::ChunkedDocument>,
534 {
535 self.chunked_document = v.map(|x| x.into());
536 self
537 }
538
539 /// Sets the value of [blob_assets][crate::model::Document::blob_assets].
540 ///
541 /// # Example
542 /// ```ignore,no_run
543 /// # use google_cloud_documentai_v1::model::Document;
544 /// use google_cloud_documentai_v1::model::document::BlobAsset;
545 /// let x = Document::new()
546 /// .set_blob_assets([
547 /// BlobAsset::default()/* use setters */,
548 /// BlobAsset::default()/* use (different) setters */,
549 /// ]);
550 /// ```
551 pub fn set_blob_assets<T, V>(mut self, v: T) -> Self
552 where
553 T: std::iter::IntoIterator<Item = V>,
554 V: std::convert::Into<crate::model::document::BlobAsset>,
555 {
556 use std::iter::Iterator;
557 self.blob_assets = v.into_iter().map(|i| i.into()).collect();
558 self
559 }
560
561 /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
562 ///
563 /// # Example
564 /// ```ignore,no_run
565 /// # use google_cloud_documentai_v1::model::Document;
566 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
567 /// let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
568 /// ```
569 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
570 where
571 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
572 {
573 self.entity_validation_output = std::option::Option::Some(v.into());
574 self
575 }
576
577 /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
578 ///
579 /// # Example
580 /// ```ignore,no_run
581 /// # use google_cloud_documentai_v1::model::Document;
582 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
583 /// let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
584 /// let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
585 /// ```
586 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
587 where
588 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
589 {
590 self.entity_validation_output = v.map(|x| x.into());
591 self
592 }
593
594 /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
595 ///
596 /// # Example
597 /// ```ignore,no_run
598 /// # use google_cloud_documentai_v1::model::Document;
599 /// use google_cloud_documentai_v1::model::document::EntitiesRevision;
600 /// let x = Document::new()
601 /// .set_entities_revisions([
602 /// EntitiesRevision::default()/* use setters */,
603 /// EntitiesRevision::default()/* use (different) setters */,
604 /// ]);
605 /// ```
606 pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
607 where
608 T: std::iter::IntoIterator<Item = V>,
609 V: std::convert::Into<crate::model::document::EntitiesRevision>,
610 {
611 use std::iter::Iterator;
612 self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
613 self
614 }
615
616 /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
617 ///
618 /// # Example
619 /// ```ignore,no_run
620 /// # use google_cloud_documentai_v1::model::Document;
621 /// let x = Document::new().set_entities_revision_id("example");
622 /// ```
623 pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
624 mut self,
625 v: T,
626 ) -> Self {
627 self.entities_revision_id = v.into();
628 self
629 }
630
631 /// Sets the value of [source][crate::model::Document::source].
632 ///
633 /// Note that all the setters affecting `source` are mutually
634 /// exclusive.
635 ///
636 /// # Example
637 /// ```ignore,no_run
638 /// # use google_cloud_documentai_v1::model::Document;
639 /// use google_cloud_documentai_v1::model::document::Source;
640 /// let x = Document::new().set_source(Some(Source::Uri("example".to_string())));
641 /// ```
642 pub fn set_source<
643 T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
644 >(
645 mut self,
646 v: T,
647 ) -> Self {
648 self.source = v.into();
649 self
650 }
651
652 /// The value of [source][crate::model::Document::source]
653 /// if it holds a `Uri`, `None` if the field is not set or
654 /// holds a different branch.
655 pub fn uri(&self) -> std::option::Option<&std::string::String> {
656 #[allow(unreachable_patterns)]
657 self.source.as_ref().and_then(|v| match v {
658 crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
659 _ => std::option::Option::None,
660 })
661 }
662
663 /// Sets the value of [source][crate::model::Document::source]
664 /// to hold a `Uri`.
665 ///
666 /// Note that all the setters affecting `source` are
667 /// mutually exclusive.
668 ///
669 /// # Example
670 /// ```ignore,no_run
671 /// # use google_cloud_documentai_v1::model::Document;
672 /// let x = Document::new().set_uri("example");
673 /// assert!(x.uri().is_some());
674 /// assert!(x.content().is_none());
675 /// ```
676 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
677 self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
678 self
679 }
680
681 /// The value of [source][crate::model::Document::source]
682 /// if it holds a `Content`, `None` if the field is not set or
683 /// holds a different branch.
684 pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
685 #[allow(unreachable_patterns)]
686 self.source.as_ref().and_then(|v| match v {
687 crate::model::document::Source::Content(v) => std::option::Option::Some(v),
688 _ => std::option::Option::None,
689 })
690 }
691
692 /// Sets the value of [source][crate::model::Document::source]
693 /// to hold a `Content`.
694 ///
695 /// Note that all the setters affecting `source` are
696 /// mutually exclusive.
697 ///
698 /// # Example
699 /// ```ignore,no_run
700 /// # use google_cloud_documentai_v1::model::Document;
701 /// let x = Document::new().set_content(bytes::Bytes::from_static(b"example"));
702 /// assert!(x.content().is_some());
703 /// assert!(x.uri().is_none());
704 /// ```
705 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
706 self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
707 self
708 }
709}
710
711impl wkt::message::Message for Document {
712 fn typename() -> &'static str {
713 "type.googleapis.com/google.cloud.documentai.v1.Document"
714 }
715}
716
717/// Defines additional types related to [Document].
718pub mod document {
719 #[allow(unused_imports)]
720 use super::*;
721
722 /// For a large document, sharding may be performed to produce several
723 /// document shards. Each document shard contains this field to detail which
724 /// shard it is.
725 #[derive(Clone, Default, PartialEq)]
726 #[non_exhaustive]
727 pub struct ShardInfo {
728 /// The 0-based index of this shard.
729 pub shard_index: i64,
730
731 /// Total number of shards.
732 pub shard_count: i64,
733
734 /// The index of the first character in
735 /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
736 /// document global text.
737 ///
738 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
739 pub text_offset: i64,
740
741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
742 }
743
744 impl ShardInfo {
745 /// Creates a new default instance.
746 pub fn new() -> Self {
747 std::default::Default::default()
748 }
749
750 /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
751 ///
752 /// # Example
753 /// ```ignore,no_run
754 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
755 /// let x = ShardInfo::new().set_shard_index(42);
756 /// ```
757 pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
758 self.shard_index = v.into();
759 self
760 }
761
762 /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
763 ///
764 /// # Example
765 /// ```ignore,no_run
766 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
767 /// let x = ShardInfo::new().set_shard_count(42);
768 /// ```
769 pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
770 self.shard_count = v.into();
771 self
772 }
773
774 /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
775 ///
776 /// # Example
777 /// ```ignore,no_run
778 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
779 /// let x = ShardInfo::new().set_text_offset(42);
780 /// ```
781 pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
782 self.text_offset = v.into();
783 self
784 }
785 }
786
787 impl wkt::message::Message for ShardInfo {
788 fn typename() -> &'static str {
789 "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
790 }
791 }
792
793 /// Annotation for common text style attributes. This adheres to CSS
794 /// conventions as much as possible.
795 #[derive(Clone, Default, PartialEq)]
796 #[non_exhaustive]
797 pub struct Style {
798 /// Text anchor indexing into the
799 /// [Document.text][google.cloud.documentai.v1.Document.text].
800 ///
801 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
802 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
803
804 /// Text color.
805 pub color: std::option::Option<google_cloud_type::model::Color>,
806
807 /// Text background color.
808 pub background_color: std::option::Option<google_cloud_type::model::Color>,
809
810 /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
811 /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
812 pub font_weight: std::string::String,
813
814 /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
815 /// Possible values are `normal`, `italic`, and `oblique`.
816 pub text_style: std::string::String,
817
818 /// [Text
819 /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
820 /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
821 /// \<text-decoration-style\>
822 pub text_decoration: std::string::String,
823
824 /// Font size.
825 pub font_size: std::option::Option<crate::model::document::style::FontSize>,
826
827 /// Font family such as `Arial`, `Times New Roman`.
828 /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
829 pub font_family: std::string::String,
830
831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
832 }
833
834 impl Style {
835 /// Creates a new default instance.
836 pub fn new() -> Self {
837 std::default::Default::default()
838 }
839
840 /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
841 ///
842 /// # Example
843 /// ```ignore,no_run
844 /// # use google_cloud_documentai_v1::model::document::Style;
845 /// use google_cloud_documentai_v1::model::document::TextAnchor;
846 /// let x = Style::new().set_text_anchor(TextAnchor::default()/* use setters */);
847 /// ```
848 pub fn set_text_anchor<T>(mut self, v: T) -> Self
849 where
850 T: std::convert::Into<crate::model::document::TextAnchor>,
851 {
852 self.text_anchor = std::option::Option::Some(v.into());
853 self
854 }
855
856 /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
857 ///
858 /// # Example
859 /// ```ignore,no_run
860 /// # use google_cloud_documentai_v1::model::document::Style;
861 /// use google_cloud_documentai_v1::model::document::TextAnchor;
862 /// let x = Style::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
863 /// let x = Style::new().set_or_clear_text_anchor(None::<TextAnchor>);
864 /// ```
865 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
866 where
867 T: std::convert::Into<crate::model::document::TextAnchor>,
868 {
869 self.text_anchor = v.map(|x| x.into());
870 self
871 }
872
873 /// Sets the value of [color][crate::model::document::Style::color].
874 ///
875 /// # Example
876 /// ```ignore,no_run
877 /// # use google_cloud_documentai_v1::model::document::Style;
878 /// use google_cloud_type::model::Color;
879 /// let x = Style::new().set_color(Color::default()/* use setters */);
880 /// ```
881 pub fn set_color<T>(mut self, v: T) -> Self
882 where
883 T: std::convert::Into<google_cloud_type::model::Color>,
884 {
885 self.color = std::option::Option::Some(v.into());
886 self
887 }
888
889 /// Sets or clears the value of [color][crate::model::document::Style::color].
890 ///
891 /// # Example
892 /// ```ignore,no_run
893 /// # use google_cloud_documentai_v1::model::document::Style;
894 /// use google_cloud_type::model::Color;
895 /// let x = Style::new().set_or_clear_color(Some(Color::default()/* use setters */));
896 /// let x = Style::new().set_or_clear_color(None::<Color>);
897 /// ```
898 pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
899 where
900 T: std::convert::Into<google_cloud_type::model::Color>,
901 {
902 self.color = v.map(|x| x.into());
903 self
904 }
905
906 /// Sets the value of [background_color][crate::model::document::Style::background_color].
907 ///
908 /// # Example
909 /// ```ignore,no_run
910 /// # use google_cloud_documentai_v1::model::document::Style;
911 /// use google_cloud_type::model::Color;
912 /// let x = Style::new().set_background_color(Color::default()/* use setters */);
913 /// ```
914 pub fn set_background_color<T>(mut self, v: T) -> Self
915 where
916 T: std::convert::Into<google_cloud_type::model::Color>,
917 {
918 self.background_color = std::option::Option::Some(v.into());
919 self
920 }
921
922 /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
923 ///
924 /// # Example
925 /// ```ignore,no_run
926 /// # use google_cloud_documentai_v1::model::document::Style;
927 /// use google_cloud_type::model::Color;
928 /// let x = Style::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
929 /// let x = Style::new().set_or_clear_background_color(None::<Color>);
930 /// ```
931 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
932 where
933 T: std::convert::Into<google_cloud_type::model::Color>,
934 {
935 self.background_color = v.map(|x| x.into());
936 self
937 }
938
939 /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
940 ///
941 /// # Example
942 /// ```ignore,no_run
943 /// # use google_cloud_documentai_v1::model::document::Style;
944 /// let x = Style::new().set_font_weight("example");
945 /// ```
946 pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
947 self.font_weight = v.into();
948 self
949 }
950
951 /// Sets the value of [text_style][crate::model::document::Style::text_style].
952 ///
953 /// # Example
954 /// ```ignore,no_run
955 /// # use google_cloud_documentai_v1::model::document::Style;
956 /// let x = Style::new().set_text_style("example");
957 /// ```
958 pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
959 self.text_style = v.into();
960 self
961 }
962
963 /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
964 ///
965 /// # Example
966 /// ```ignore,no_run
967 /// # use google_cloud_documentai_v1::model::document::Style;
968 /// let x = Style::new().set_text_decoration("example");
969 /// ```
970 pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
971 mut self,
972 v: T,
973 ) -> Self {
974 self.text_decoration = v.into();
975 self
976 }
977
978 /// Sets the value of [font_size][crate::model::document::Style::font_size].
979 ///
980 /// # Example
981 /// ```ignore,no_run
982 /// # use google_cloud_documentai_v1::model::document::Style;
983 /// use google_cloud_documentai_v1::model::document::style::FontSize;
984 /// let x = Style::new().set_font_size(FontSize::default()/* use setters */);
985 /// ```
986 pub fn set_font_size<T>(mut self, v: T) -> Self
987 where
988 T: std::convert::Into<crate::model::document::style::FontSize>,
989 {
990 self.font_size = std::option::Option::Some(v.into());
991 self
992 }
993
994 /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
995 ///
996 /// # Example
997 /// ```ignore,no_run
998 /// # use google_cloud_documentai_v1::model::document::Style;
999 /// use google_cloud_documentai_v1::model::document::style::FontSize;
1000 /// let x = Style::new().set_or_clear_font_size(Some(FontSize::default()/* use setters */));
1001 /// let x = Style::new().set_or_clear_font_size(None::<FontSize>);
1002 /// ```
1003 pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
1004 where
1005 T: std::convert::Into<crate::model::document::style::FontSize>,
1006 {
1007 self.font_size = v.map(|x| x.into());
1008 self
1009 }
1010
1011 /// Sets the value of [font_family][crate::model::document::Style::font_family].
1012 ///
1013 /// # Example
1014 /// ```ignore,no_run
1015 /// # use google_cloud_documentai_v1::model::document::Style;
1016 /// let x = Style::new().set_font_family("example");
1017 /// ```
1018 pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1019 self.font_family = v.into();
1020 self
1021 }
1022 }
1023
1024 impl wkt::message::Message for Style {
1025 fn typename() -> &'static str {
1026 "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
1027 }
1028 }
1029
1030 /// Defines additional types related to [Style].
1031 pub mod style {
1032 #[allow(unused_imports)]
1033 use super::*;
1034
1035 /// Font size with unit.
1036 #[derive(Clone, Default, PartialEq)]
1037 #[non_exhaustive]
1038 pub struct FontSize {
1039 /// Font size for the text.
1040 pub size: f32,
1041
1042 /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
1043 /// `pt`).
1044 pub unit: std::string::String,
1045
1046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1047 }
1048
1049 impl FontSize {
1050 /// Creates a new default instance.
1051 pub fn new() -> Self {
1052 std::default::Default::default()
1053 }
1054
1055 /// Sets the value of [size][crate::model::document::style::FontSize::size].
1056 ///
1057 /// # Example
1058 /// ```ignore,no_run
1059 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1060 /// let x = FontSize::new().set_size(42.0);
1061 /// ```
1062 pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1063 self.size = v.into();
1064 self
1065 }
1066
1067 /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
1068 ///
1069 /// # Example
1070 /// ```ignore,no_run
1071 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1072 /// let x = FontSize::new().set_unit("example");
1073 /// ```
1074 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1075 self.unit = v.into();
1076 self
1077 }
1078 }
1079
1080 impl wkt::message::Message for FontSize {
1081 fn typename() -> &'static str {
1082 "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
1083 }
1084 }
1085 }
1086
1087 /// A page in a [Document][google.cloud.documentai.v1.Document].
1088 ///
1089 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1090 #[derive(Clone, Default, PartialEq)]
1091 #[non_exhaustive]
1092 pub struct Page {
1093 /// 1-based index for current
1094 /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
1095 /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
1096 /// taken out of a [Document][google.cloud.documentai.v1.Document] for
1097 /// individual processing.
1098 ///
1099 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1100 /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
1101 pub page_number: i32,
1102
1103 /// Rendered image for this page. This image is preprocessed to remove any
1104 /// skew, rotation, and distortions such that the annotation bounding boxes
1105 /// can be upright and axis-aligned.
1106 pub image: std::option::Option<crate::model::document::page::Image>,
1107
1108 /// Transformation matrices that were applied to the original document image
1109 /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
1110 ///
1111 /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
1112 pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
1113
1114 /// Physical dimension of the page.
1115 pub dimension: std::option::Option<crate::model::document::page::Dimension>,
1116
1117 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
1118 ///
1119 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1120 pub layout: std::option::Option<crate::model::document::page::Layout>,
1121
1122 /// A list of detected languages together with confidence.
1123 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1124
1125 /// A list of visually detected text blocks on the page.
1126 /// A block has a set of lines (collected into paragraphs) that have a common
1127 /// line-spacing and orientation.
1128 pub blocks: std::vec::Vec<crate::model::document::page::Block>,
1129
1130 /// A list of visually detected text paragraphs on the page.
1131 /// A collection of lines that a human would perceive as a paragraph.
1132 pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
1133
1134 /// A list of visually detected text lines on the page.
1135 /// A collection of tokens that a human would perceive as a line.
1136 pub lines: std::vec::Vec<crate::model::document::page::Line>,
1137
1138 /// A list of visually detected tokens on the page.
1139 pub tokens: std::vec::Vec<crate::model::document::page::Token>,
1140
1141 /// A list of detected non-text visual elements, for example, checkbox,
1142 /// signature etc. on the page.
1143 pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
1144
1145 /// A list of visually detected tables on the page.
1146 pub tables: std::vec::Vec<crate::model::document::page::Table>,
1147
1148 /// A list of visually detected form fields on the page.
1149 pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
1150
1151 /// A list of visually detected symbols on the page.
1152 pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
1153
1154 /// A list of detected barcodes.
1155 pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
1156
1157 /// Image quality scores.
1158 pub image_quality_scores:
1159 std::option::Option<crate::model::document::page::ImageQualityScores>,
1160
1161 /// The history of this page.
1162 #[deprecated]
1163 pub provenance: std::option::Option<crate::model::document::Provenance>,
1164
1165 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1166 }
1167
1168 impl Page {
1169 /// Creates a new default instance.
1170 pub fn new() -> Self {
1171 std::default::Default::default()
1172 }
1173
1174 /// Sets the value of [page_number][crate::model::document::Page::page_number].
1175 ///
1176 /// # Example
1177 /// ```ignore,no_run
1178 /// # use google_cloud_documentai_v1::model::document::Page;
1179 /// let x = Page::new().set_page_number(42);
1180 /// ```
1181 pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1182 self.page_number = v.into();
1183 self
1184 }
1185
1186 /// Sets the value of [image][crate::model::document::Page::image].
1187 ///
1188 /// # Example
1189 /// ```ignore,no_run
1190 /// # use google_cloud_documentai_v1::model::document::Page;
1191 /// use google_cloud_documentai_v1::model::document::page::Image;
1192 /// let x = Page::new().set_image(Image::default()/* use setters */);
1193 /// ```
1194 pub fn set_image<T>(mut self, v: T) -> Self
1195 where
1196 T: std::convert::Into<crate::model::document::page::Image>,
1197 {
1198 self.image = std::option::Option::Some(v.into());
1199 self
1200 }
1201
1202 /// Sets or clears the value of [image][crate::model::document::Page::image].
1203 ///
1204 /// # Example
1205 /// ```ignore,no_run
1206 /// # use google_cloud_documentai_v1::model::document::Page;
1207 /// use google_cloud_documentai_v1::model::document::page::Image;
1208 /// let x = Page::new().set_or_clear_image(Some(Image::default()/* use setters */));
1209 /// let x = Page::new().set_or_clear_image(None::<Image>);
1210 /// ```
1211 pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
1212 where
1213 T: std::convert::Into<crate::model::document::page::Image>,
1214 {
1215 self.image = v.map(|x| x.into());
1216 self
1217 }
1218
1219 /// Sets the value of [transforms][crate::model::document::Page::transforms].
1220 ///
1221 /// # Example
1222 /// ```ignore,no_run
1223 /// # use google_cloud_documentai_v1::model::document::Page;
1224 /// use google_cloud_documentai_v1::model::document::page::Matrix;
1225 /// let x = Page::new()
1226 /// .set_transforms([
1227 /// Matrix::default()/* use setters */,
1228 /// Matrix::default()/* use (different) setters */,
1229 /// ]);
1230 /// ```
1231 pub fn set_transforms<T, V>(mut self, v: T) -> Self
1232 where
1233 T: std::iter::IntoIterator<Item = V>,
1234 V: std::convert::Into<crate::model::document::page::Matrix>,
1235 {
1236 use std::iter::Iterator;
1237 self.transforms = v.into_iter().map(|i| i.into()).collect();
1238 self
1239 }
1240
1241 /// Sets the value of [dimension][crate::model::document::Page::dimension].
1242 ///
1243 /// # Example
1244 /// ```ignore,no_run
1245 /// # use google_cloud_documentai_v1::model::document::Page;
1246 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1247 /// let x = Page::new().set_dimension(Dimension::default()/* use setters */);
1248 /// ```
1249 pub fn set_dimension<T>(mut self, v: T) -> Self
1250 where
1251 T: std::convert::Into<crate::model::document::page::Dimension>,
1252 {
1253 self.dimension = std::option::Option::Some(v.into());
1254 self
1255 }
1256
1257 /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
1258 ///
1259 /// # Example
1260 /// ```ignore,no_run
1261 /// # use google_cloud_documentai_v1::model::document::Page;
1262 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1263 /// let x = Page::new().set_or_clear_dimension(Some(Dimension::default()/* use setters */));
1264 /// let x = Page::new().set_or_clear_dimension(None::<Dimension>);
1265 /// ```
1266 pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
1267 where
1268 T: std::convert::Into<crate::model::document::page::Dimension>,
1269 {
1270 self.dimension = v.map(|x| x.into());
1271 self
1272 }
1273
1274 /// Sets the value of [layout][crate::model::document::Page::layout].
1275 ///
1276 /// # Example
1277 /// ```ignore,no_run
1278 /// # use google_cloud_documentai_v1::model::document::Page;
1279 /// use google_cloud_documentai_v1::model::document::page::Layout;
1280 /// let x = Page::new().set_layout(Layout::default()/* use setters */);
1281 /// ```
1282 pub fn set_layout<T>(mut self, v: T) -> Self
1283 where
1284 T: std::convert::Into<crate::model::document::page::Layout>,
1285 {
1286 self.layout = std::option::Option::Some(v.into());
1287 self
1288 }
1289
1290 /// Sets or clears the value of [layout][crate::model::document::Page::layout].
1291 ///
1292 /// # Example
1293 /// ```ignore,no_run
1294 /// # use google_cloud_documentai_v1::model::document::Page;
1295 /// use google_cloud_documentai_v1::model::document::page::Layout;
1296 /// let x = Page::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
1297 /// let x = Page::new().set_or_clear_layout(None::<Layout>);
1298 /// ```
1299 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1300 where
1301 T: std::convert::Into<crate::model::document::page::Layout>,
1302 {
1303 self.layout = v.map(|x| x.into());
1304 self
1305 }
1306
1307 /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
1308 ///
1309 /// # Example
1310 /// ```ignore,no_run
1311 /// # use google_cloud_documentai_v1::model::document::Page;
1312 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
1313 /// let x = Page::new()
1314 /// .set_detected_languages([
1315 /// DetectedLanguage::default()/* use setters */,
1316 /// DetectedLanguage::default()/* use (different) setters */,
1317 /// ]);
1318 /// ```
1319 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1320 where
1321 T: std::iter::IntoIterator<Item = V>,
1322 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1323 {
1324 use std::iter::Iterator;
1325 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1326 self
1327 }
1328
1329 /// Sets the value of [blocks][crate::model::document::Page::blocks].
1330 ///
1331 /// # Example
1332 /// ```ignore,no_run
1333 /// # use google_cloud_documentai_v1::model::document::Page;
1334 /// use google_cloud_documentai_v1::model::document::page::Block;
1335 /// let x = Page::new()
1336 /// .set_blocks([
1337 /// Block::default()/* use setters */,
1338 /// Block::default()/* use (different) setters */,
1339 /// ]);
1340 /// ```
1341 pub fn set_blocks<T, V>(mut self, v: T) -> Self
1342 where
1343 T: std::iter::IntoIterator<Item = V>,
1344 V: std::convert::Into<crate::model::document::page::Block>,
1345 {
1346 use std::iter::Iterator;
1347 self.blocks = v.into_iter().map(|i| i.into()).collect();
1348 self
1349 }
1350
1351 /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
1352 ///
1353 /// # Example
1354 /// ```ignore,no_run
1355 /// # use google_cloud_documentai_v1::model::document::Page;
1356 /// use google_cloud_documentai_v1::model::document::page::Paragraph;
1357 /// let x = Page::new()
1358 /// .set_paragraphs([
1359 /// Paragraph::default()/* use setters */,
1360 /// Paragraph::default()/* use (different) setters */,
1361 /// ]);
1362 /// ```
1363 pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
1364 where
1365 T: std::iter::IntoIterator<Item = V>,
1366 V: std::convert::Into<crate::model::document::page::Paragraph>,
1367 {
1368 use std::iter::Iterator;
1369 self.paragraphs = v.into_iter().map(|i| i.into()).collect();
1370 self
1371 }
1372
1373 /// Sets the value of [lines][crate::model::document::Page::lines].
1374 ///
1375 /// # Example
1376 /// ```ignore,no_run
1377 /// # use google_cloud_documentai_v1::model::document::Page;
1378 /// use google_cloud_documentai_v1::model::document::page::Line;
1379 /// let x = Page::new()
1380 /// .set_lines([
1381 /// Line::default()/* use setters */,
1382 /// Line::default()/* use (different) setters */,
1383 /// ]);
1384 /// ```
1385 pub fn set_lines<T, V>(mut self, v: T) -> Self
1386 where
1387 T: std::iter::IntoIterator<Item = V>,
1388 V: std::convert::Into<crate::model::document::page::Line>,
1389 {
1390 use std::iter::Iterator;
1391 self.lines = v.into_iter().map(|i| i.into()).collect();
1392 self
1393 }
1394
1395 /// Sets the value of [tokens][crate::model::document::Page::tokens].
1396 ///
1397 /// # Example
1398 /// ```ignore,no_run
1399 /// # use google_cloud_documentai_v1::model::document::Page;
1400 /// use google_cloud_documentai_v1::model::document::page::Token;
1401 /// let x = Page::new()
1402 /// .set_tokens([
1403 /// Token::default()/* use setters */,
1404 /// Token::default()/* use (different) setters */,
1405 /// ]);
1406 /// ```
1407 pub fn set_tokens<T, V>(mut self, v: T) -> Self
1408 where
1409 T: std::iter::IntoIterator<Item = V>,
1410 V: std::convert::Into<crate::model::document::page::Token>,
1411 {
1412 use std::iter::Iterator;
1413 self.tokens = v.into_iter().map(|i| i.into()).collect();
1414 self
1415 }
1416
1417 /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
1418 ///
1419 /// # Example
1420 /// ```ignore,no_run
1421 /// # use google_cloud_documentai_v1::model::document::Page;
1422 /// use google_cloud_documentai_v1::model::document::page::VisualElement;
1423 /// let x = Page::new()
1424 /// .set_visual_elements([
1425 /// VisualElement::default()/* use setters */,
1426 /// VisualElement::default()/* use (different) setters */,
1427 /// ]);
1428 /// ```
1429 pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
1430 where
1431 T: std::iter::IntoIterator<Item = V>,
1432 V: std::convert::Into<crate::model::document::page::VisualElement>,
1433 {
1434 use std::iter::Iterator;
1435 self.visual_elements = v.into_iter().map(|i| i.into()).collect();
1436 self
1437 }
1438
1439 /// Sets the value of [tables][crate::model::document::Page::tables].
1440 ///
1441 /// # Example
1442 /// ```ignore,no_run
1443 /// # use google_cloud_documentai_v1::model::document::Page;
1444 /// use google_cloud_documentai_v1::model::document::page::Table;
1445 /// let x = Page::new()
1446 /// .set_tables([
1447 /// Table::default()/* use setters */,
1448 /// Table::default()/* use (different) setters */,
1449 /// ]);
1450 /// ```
1451 pub fn set_tables<T, V>(mut self, v: T) -> Self
1452 where
1453 T: std::iter::IntoIterator<Item = V>,
1454 V: std::convert::Into<crate::model::document::page::Table>,
1455 {
1456 use std::iter::Iterator;
1457 self.tables = v.into_iter().map(|i| i.into()).collect();
1458 self
1459 }
1460
1461 /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
1462 ///
1463 /// # Example
1464 /// ```ignore,no_run
1465 /// # use google_cloud_documentai_v1::model::document::Page;
1466 /// use google_cloud_documentai_v1::model::document::page::FormField;
1467 /// let x = Page::new()
1468 /// .set_form_fields([
1469 /// FormField::default()/* use setters */,
1470 /// FormField::default()/* use (different) setters */,
1471 /// ]);
1472 /// ```
1473 pub fn set_form_fields<T, V>(mut self, v: T) -> Self
1474 where
1475 T: std::iter::IntoIterator<Item = V>,
1476 V: std::convert::Into<crate::model::document::page::FormField>,
1477 {
1478 use std::iter::Iterator;
1479 self.form_fields = v.into_iter().map(|i| i.into()).collect();
1480 self
1481 }
1482
1483 /// Sets the value of [symbols][crate::model::document::Page::symbols].
1484 ///
1485 /// # Example
1486 /// ```ignore,no_run
1487 /// # use google_cloud_documentai_v1::model::document::Page;
1488 /// use google_cloud_documentai_v1::model::document::page::Symbol;
1489 /// let x = Page::new()
1490 /// .set_symbols([
1491 /// Symbol::default()/* use setters */,
1492 /// Symbol::default()/* use (different) setters */,
1493 /// ]);
1494 /// ```
1495 pub fn set_symbols<T, V>(mut self, v: T) -> Self
1496 where
1497 T: std::iter::IntoIterator<Item = V>,
1498 V: std::convert::Into<crate::model::document::page::Symbol>,
1499 {
1500 use std::iter::Iterator;
1501 self.symbols = v.into_iter().map(|i| i.into()).collect();
1502 self
1503 }
1504
1505 /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
1506 ///
1507 /// # Example
1508 /// ```ignore,no_run
1509 /// # use google_cloud_documentai_v1::model::document::Page;
1510 /// use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
1511 /// let x = Page::new()
1512 /// .set_detected_barcodes([
1513 /// DetectedBarcode::default()/* use setters */,
1514 /// DetectedBarcode::default()/* use (different) setters */,
1515 /// ]);
1516 /// ```
1517 pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
1518 where
1519 T: std::iter::IntoIterator<Item = V>,
1520 V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
1521 {
1522 use std::iter::Iterator;
1523 self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
1524 self
1525 }
1526
1527 /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1528 ///
1529 /// # Example
1530 /// ```ignore,no_run
1531 /// # use google_cloud_documentai_v1::model::document::Page;
1532 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1533 /// let x = Page::new().set_image_quality_scores(ImageQualityScores::default()/* use setters */);
1534 /// ```
1535 pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
1536 where
1537 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1538 {
1539 self.image_quality_scores = std::option::Option::Some(v.into());
1540 self
1541 }
1542
1543 /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_documentai_v1::model::document::Page;
1548 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1549 /// let x = Page::new().set_or_clear_image_quality_scores(Some(ImageQualityScores::default()/* use setters */));
1550 /// let x = Page::new().set_or_clear_image_quality_scores(None::<ImageQualityScores>);
1551 /// ```
1552 pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1553 where
1554 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1555 {
1556 self.image_quality_scores = v.map(|x| x.into());
1557 self
1558 }
1559
1560 /// Sets the value of [provenance][crate::model::document::Page::provenance].
1561 ///
1562 /// # Example
1563 /// ```ignore,no_run
1564 /// # use google_cloud_documentai_v1::model::document::Page;
1565 /// use google_cloud_documentai_v1::model::document::Provenance;
1566 /// let x = Page::new().set_provenance(Provenance::default()/* use setters */);
1567 /// ```
1568 #[deprecated]
1569 pub fn set_provenance<T>(mut self, v: T) -> Self
1570 where
1571 T: std::convert::Into<crate::model::document::Provenance>,
1572 {
1573 self.provenance = std::option::Option::Some(v.into());
1574 self
1575 }
1576
1577 /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
1578 ///
1579 /// # Example
1580 /// ```ignore,no_run
1581 /// # use google_cloud_documentai_v1::model::document::Page;
1582 /// use google_cloud_documentai_v1::model::document::Provenance;
1583 /// let x = Page::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
1584 /// let x = Page::new().set_or_clear_provenance(None::<Provenance>);
1585 /// ```
1586 #[deprecated]
1587 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1588 where
1589 T: std::convert::Into<crate::model::document::Provenance>,
1590 {
1591 self.provenance = v.map(|x| x.into());
1592 self
1593 }
1594 }
1595
1596 impl wkt::message::Message for Page {
1597 fn typename() -> &'static str {
1598 "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1599 }
1600 }
1601
1602 /// Defines additional types related to [Page].
1603 pub mod page {
1604 #[allow(unused_imports)]
1605 use super::*;
1606
1607 /// Dimension for the page.
1608 #[derive(Clone, Default, PartialEq)]
1609 #[non_exhaustive]
1610 pub struct Dimension {
1611 /// Page width.
1612 pub width: f32,
1613
1614 /// Page height.
1615 pub height: f32,
1616
1617 /// Dimension unit.
1618 pub unit: std::string::String,
1619
1620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1621 }
1622
1623 impl Dimension {
1624 /// Creates a new default instance.
1625 pub fn new() -> Self {
1626 std::default::Default::default()
1627 }
1628
1629 /// Sets the value of [width][crate::model::document::page::Dimension::width].
1630 ///
1631 /// # Example
1632 /// ```ignore,no_run
1633 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1634 /// let x = Dimension::new().set_width(42.0);
1635 /// ```
1636 pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1637 self.width = v.into();
1638 self
1639 }
1640
1641 /// Sets the value of [height][crate::model::document::page::Dimension::height].
1642 ///
1643 /// # Example
1644 /// ```ignore,no_run
1645 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1646 /// let x = Dimension::new().set_height(42.0);
1647 /// ```
1648 pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1649 self.height = v.into();
1650 self
1651 }
1652
1653 /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
1654 ///
1655 /// # Example
1656 /// ```ignore,no_run
1657 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1658 /// let x = Dimension::new().set_unit("example");
1659 /// ```
1660 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1661 self.unit = v.into();
1662 self
1663 }
1664 }
1665
1666 impl wkt::message::Message for Dimension {
1667 fn typename() -> &'static str {
1668 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1669 }
1670 }
1671
1672 /// Rendered image contents for this page.
1673 #[derive(Clone, Default, PartialEq)]
1674 #[non_exhaustive]
1675 pub struct Image {
1676 /// Raw byte content of the image.
1677 pub content: ::bytes::Bytes,
1678
1679 /// Encoding [media type (MIME
1680 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
1681 /// for the image.
1682 pub mime_type: std::string::String,
1683
1684 /// Width of the image in pixels.
1685 pub width: i32,
1686
1687 /// Height of the image in pixels.
1688 pub height: i32,
1689
1690 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1691 }
1692
1693 impl Image {
1694 /// Creates a new default instance.
1695 pub fn new() -> Self {
1696 std::default::Default::default()
1697 }
1698
1699 /// Sets the value of [content][crate::model::document::page::Image::content].
1700 ///
1701 /// # Example
1702 /// ```ignore,no_run
1703 /// # use google_cloud_documentai_v1::model::document::page::Image;
1704 /// let x = Image::new().set_content(bytes::Bytes::from_static(b"example"));
1705 /// ```
1706 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1707 self.content = v.into();
1708 self
1709 }
1710
1711 /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
1712 ///
1713 /// # Example
1714 /// ```ignore,no_run
1715 /// # use google_cloud_documentai_v1::model::document::page::Image;
1716 /// let x = Image::new().set_mime_type("example");
1717 /// ```
1718 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1719 mut self,
1720 v: T,
1721 ) -> Self {
1722 self.mime_type = v.into();
1723 self
1724 }
1725
1726 /// Sets the value of [width][crate::model::document::page::Image::width].
1727 ///
1728 /// # Example
1729 /// ```ignore,no_run
1730 /// # use google_cloud_documentai_v1::model::document::page::Image;
1731 /// let x = Image::new().set_width(42);
1732 /// ```
1733 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1734 self.width = v.into();
1735 self
1736 }
1737
1738 /// Sets the value of [height][crate::model::document::page::Image::height].
1739 ///
1740 /// # Example
1741 /// ```ignore,no_run
1742 /// # use google_cloud_documentai_v1::model::document::page::Image;
1743 /// let x = Image::new().set_height(42);
1744 /// ```
1745 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1746 self.height = v.into();
1747 self
1748 }
1749 }
1750
1751 impl wkt::message::Message for Image {
1752 fn typename() -> &'static str {
1753 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1754 }
1755 }
1756
1757 /// Representation for transformation matrix, intended to be compatible and
1758 /// used with OpenCV format for image manipulation.
1759 #[derive(Clone, Default, PartialEq)]
1760 #[non_exhaustive]
1761 pub struct Matrix {
1762 /// Number of rows in the matrix.
1763 pub rows: i32,
1764
1765 /// Number of columns in the matrix.
1766 pub cols: i32,
1767
1768 /// This encodes information about what data type the matrix uses.
1769 /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
1770 /// of OpenCV primitive data types, please refer to
1771 /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
1772 pub r#type: i32,
1773
1774 /// The matrix data.
1775 pub data: ::bytes::Bytes,
1776
1777 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1778 }
1779
1780 impl Matrix {
1781 /// Creates a new default instance.
1782 pub fn new() -> Self {
1783 std::default::Default::default()
1784 }
1785
1786 /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
1787 ///
1788 /// # Example
1789 /// ```ignore,no_run
1790 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1791 /// let x = Matrix::new().set_rows(42);
1792 /// ```
1793 pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1794 self.rows = v.into();
1795 self
1796 }
1797
1798 /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
1799 ///
1800 /// # Example
1801 /// ```ignore,no_run
1802 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1803 /// let x = Matrix::new().set_cols(42);
1804 /// ```
1805 pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1806 self.cols = v.into();
1807 self
1808 }
1809
1810 /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
1811 ///
1812 /// # Example
1813 /// ```ignore,no_run
1814 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1815 /// let x = Matrix::new().set_type(42);
1816 /// ```
1817 pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1818 self.r#type = v.into();
1819 self
1820 }
1821
1822 /// Sets the value of [data][crate::model::document::page::Matrix::data].
1823 ///
1824 /// # Example
1825 /// ```ignore,no_run
1826 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1827 /// let x = Matrix::new().set_data(bytes::Bytes::from_static(b"example"));
1828 /// ```
1829 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1830 self.data = v.into();
1831 self
1832 }
1833 }
1834
1835 impl wkt::message::Message for Matrix {
1836 fn typename() -> &'static str {
1837 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1838 }
1839 }
1840
1841 /// Visual element describing a layout unit on a page.
1842 #[derive(Clone, Default, PartialEq)]
1843 #[non_exhaustive]
1844 pub struct Layout {
1845 /// Text anchor indexing into the
1846 /// [Document.text][google.cloud.documentai.v1.Document.text].
1847 ///
1848 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
1849 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1850
1851 /// Confidence of the current
1852 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
1853 /// context of the object this layout is for. For example, confidence can
1854 /// be for a single token, a table, a visual element, etc. depending on
1855 /// context. Range `[0, 1]`.
1856 ///
1857 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1858 pub confidence: f32,
1859
1860 /// The bounding polygon for the
1861 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1862 ///
1863 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1864 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1865
1866 /// Detected orientation for the
1867 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1868 ///
1869 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1870 pub orientation: crate::model::document::page::layout::Orientation,
1871
1872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1873 }
1874
1875 impl Layout {
1876 /// Creates a new default instance.
1877 pub fn new() -> Self {
1878 std::default::Default::default()
1879 }
1880
1881 /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1882 ///
1883 /// # Example
1884 /// ```ignore,no_run
1885 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1886 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1887 /// let x = Layout::new().set_text_anchor(TextAnchor::default()/* use setters */);
1888 /// ```
1889 pub fn set_text_anchor<T>(mut self, v: T) -> Self
1890 where
1891 T: std::convert::Into<crate::model::document::TextAnchor>,
1892 {
1893 self.text_anchor = std::option::Option::Some(v.into());
1894 self
1895 }
1896
1897 /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1898 ///
1899 /// # Example
1900 /// ```ignore,no_run
1901 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1902 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1903 /// let x = Layout::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
1904 /// let x = Layout::new().set_or_clear_text_anchor(None::<TextAnchor>);
1905 /// ```
1906 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1907 where
1908 T: std::convert::Into<crate::model::document::TextAnchor>,
1909 {
1910 self.text_anchor = v.map(|x| x.into());
1911 self
1912 }
1913
1914 /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
1915 ///
1916 /// # Example
1917 /// ```ignore,no_run
1918 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1919 /// let x = Layout::new().set_confidence(42.0);
1920 /// ```
1921 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1922 self.confidence = v.into();
1923 self
1924 }
1925
1926 /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1927 ///
1928 /// # Example
1929 /// ```ignore,no_run
1930 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1931 /// use google_cloud_documentai_v1::model::BoundingPoly;
1932 /// let x = Layout::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
1933 /// ```
1934 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1935 where
1936 T: std::convert::Into<crate::model::BoundingPoly>,
1937 {
1938 self.bounding_poly = std::option::Option::Some(v.into());
1939 self
1940 }
1941
1942 /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1943 ///
1944 /// # Example
1945 /// ```ignore,no_run
1946 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1947 /// use google_cloud_documentai_v1::model::BoundingPoly;
1948 /// let x = Layout::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
1949 /// let x = Layout::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
1950 /// ```
1951 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1952 where
1953 T: std::convert::Into<crate::model::BoundingPoly>,
1954 {
1955 self.bounding_poly = v.map(|x| x.into());
1956 self
1957 }
1958
1959 /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
1960 ///
1961 /// # Example
1962 /// ```ignore,no_run
1963 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1964 /// use google_cloud_documentai_v1::model::document::page::layout::Orientation;
1965 /// let x0 = Layout::new().set_orientation(Orientation::PageUp);
1966 /// let x1 = Layout::new().set_orientation(Orientation::PageRight);
1967 /// let x2 = Layout::new().set_orientation(Orientation::PageDown);
1968 /// ```
1969 pub fn set_orientation<
1970 T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1971 >(
1972 mut self,
1973 v: T,
1974 ) -> Self {
1975 self.orientation = v.into();
1976 self
1977 }
1978 }
1979
1980 impl wkt::message::Message for Layout {
1981 fn typename() -> &'static str {
1982 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1983 }
1984 }
1985
1986 /// Defines additional types related to [Layout].
1987 pub mod layout {
1988 #[allow(unused_imports)]
1989 use super::*;
1990
1991 /// Detected human reading orientation.
1992 ///
1993 /// # Working with unknown values
1994 ///
1995 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1996 /// additional enum variants at any time. Adding new variants is not considered
1997 /// a breaking change. Applications should write their code in anticipation of:
1998 ///
1999 /// - New values appearing in future releases of the client library, **and**
2000 /// - New values received dynamically, without application changes.
2001 ///
2002 /// Please consult the [Working with enums] section in the user guide for some
2003 /// guidelines.
2004 ///
2005 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2006 #[derive(Clone, Debug, PartialEq)]
2007 #[non_exhaustive]
2008 pub enum Orientation {
2009 /// Unspecified orientation.
2010 Unspecified,
2011 /// Orientation is aligned with page up.
2012 PageUp,
2013 /// Orientation is aligned with page right.
2014 /// Turn the head 90 degrees clockwise from upright to read.
2015 PageRight,
2016 /// Orientation is aligned with page down.
2017 /// Turn the head 180 degrees from upright to read.
2018 PageDown,
2019 /// Orientation is aligned with page left.
2020 /// Turn the head 90 degrees counterclockwise from upright to read.
2021 PageLeft,
2022 /// If set, the enum was initialized with an unknown value.
2023 ///
2024 /// Applications can examine the value using [Orientation::value] or
2025 /// [Orientation::name].
2026 UnknownValue(orientation::UnknownValue),
2027 }
2028
2029 #[doc(hidden)]
2030 pub mod orientation {
2031 #[allow(unused_imports)]
2032 use super::*;
2033 #[derive(Clone, Debug, PartialEq)]
2034 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2035 }
2036
2037 impl Orientation {
2038 /// Gets the enum value.
2039 ///
2040 /// Returns `None` if the enum contains an unknown value deserialized from
2041 /// the string representation of enums.
2042 pub fn value(&self) -> std::option::Option<i32> {
2043 match self {
2044 Self::Unspecified => std::option::Option::Some(0),
2045 Self::PageUp => std::option::Option::Some(1),
2046 Self::PageRight => std::option::Option::Some(2),
2047 Self::PageDown => std::option::Option::Some(3),
2048 Self::PageLeft => std::option::Option::Some(4),
2049 Self::UnknownValue(u) => u.0.value(),
2050 }
2051 }
2052
2053 /// Gets the enum value as a string.
2054 ///
2055 /// Returns `None` if the enum contains an unknown value deserialized from
2056 /// the integer representation of enums.
2057 pub fn name(&self) -> std::option::Option<&str> {
2058 match self {
2059 Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
2060 Self::PageUp => std::option::Option::Some("PAGE_UP"),
2061 Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
2062 Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
2063 Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
2064 Self::UnknownValue(u) => u.0.name(),
2065 }
2066 }
2067 }
2068
2069 impl std::default::Default for Orientation {
2070 fn default() -> Self {
2071 use std::convert::From;
2072 Self::from(0)
2073 }
2074 }
2075
2076 impl std::fmt::Display for Orientation {
2077 fn fmt(
2078 &self,
2079 f: &mut std::fmt::Formatter<'_>,
2080 ) -> std::result::Result<(), std::fmt::Error> {
2081 wkt::internal::display_enum(f, self.name(), self.value())
2082 }
2083 }
2084
2085 impl std::convert::From<i32> for Orientation {
2086 fn from(value: i32) -> Self {
2087 match value {
2088 0 => Self::Unspecified,
2089 1 => Self::PageUp,
2090 2 => Self::PageRight,
2091 3 => Self::PageDown,
2092 4 => Self::PageLeft,
2093 _ => Self::UnknownValue(orientation::UnknownValue(
2094 wkt::internal::UnknownEnumValue::Integer(value),
2095 )),
2096 }
2097 }
2098 }
2099
2100 impl std::convert::From<&str> for Orientation {
2101 fn from(value: &str) -> Self {
2102 use std::string::ToString;
2103 match value {
2104 "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
2105 "PAGE_UP" => Self::PageUp,
2106 "PAGE_RIGHT" => Self::PageRight,
2107 "PAGE_DOWN" => Self::PageDown,
2108 "PAGE_LEFT" => Self::PageLeft,
2109 _ => Self::UnknownValue(orientation::UnknownValue(
2110 wkt::internal::UnknownEnumValue::String(value.to_string()),
2111 )),
2112 }
2113 }
2114 }
2115
2116 impl serde::ser::Serialize for Orientation {
2117 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2118 where
2119 S: serde::Serializer,
2120 {
2121 match self {
2122 Self::Unspecified => serializer.serialize_i32(0),
2123 Self::PageUp => serializer.serialize_i32(1),
2124 Self::PageRight => serializer.serialize_i32(2),
2125 Self::PageDown => serializer.serialize_i32(3),
2126 Self::PageLeft => serializer.serialize_i32(4),
2127 Self::UnknownValue(u) => u.0.serialize(serializer),
2128 }
2129 }
2130 }
2131
2132 impl<'de> serde::de::Deserialize<'de> for Orientation {
2133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2134 where
2135 D: serde::Deserializer<'de>,
2136 {
2137 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
2138 ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
2139 ))
2140 }
2141 }
2142 }
2143
2144 /// A block has a set of lines (collected into paragraphs) that have a
2145 /// common line-spacing and orientation.
2146 #[derive(Clone, Default, PartialEq)]
2147 #[non_exhaustive]
2148 pub struct Block {
2149 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2150 /// [Block][google.cloud.documentai.v1.Document.Page.Block].
2151 ///
2152 /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
2153 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2154 pub layout: std::option::Option<crate::model::document::page::Layout>,
2155
2156 /// A list of detected languages together with confidence.
2157 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2158
2159 /// The history of this annotation.
2160 #[deprecated]
2161 pub provenance: std::option::Option<crate::model::document::Provenance>,
2162
2163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2164 }
2165
2166 impl Block {
2167 /// Creates a new default instance.
2168 pub fn new() -> Self {
2169 std::default::Default::default()
2170 }
2171
2172 /// Sets the value of [layout][crate::model::document::page::Block::layout].
2173 ///
2174 /// # Example
2175 /// ```ignore,no_run
2176 /// # use google_cloud_documentai_v1::model::document::page::Block;
2177 /// use google_cloud_documentai_v1::model::document::page::Layout;
2178 /// let x = Block::new().set_layout(Layout::default()/* use setters */);
2179 /// ```
2180 pub fn set_layout<T>(mut self, v: T) -> Self
2181 where
2182 T: std::convert::Into<crate::model::document::page::Layout>,
2183 {
2184 self.layout = std::option::Option::Some(v.into());
2185 self
2186 }
2187
2188 /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
2189 ///
2190 /// # Example
2191 /// ```ignore,no_run
2192 /// # use google_cloud_documentai_v1::model::document::page::Block;
2193 /// use google_cloud_documentai_v1::model::document::page::Layout;
2194 /// let x = Block::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2195 /// let x = Block::new().set_or_clear_layout(None::<Layout>);
2196 /// ```
2197 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2198 where
2199 T: std::convert::Into<crate::model::document::page::Layout>,
2200 {
2201 self.layout = v.map(|x| x.into());
2202 self
2203 }
2204
2205 /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
2206 ///
2207 /// # Example
2208 /// ```ignore,no_run
2209 /// # use google_cloud_documentai_v1::model::document::page::Block;
2210 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2211 /// let x = Block::new()
2212 /// .set_detected_languages([
2213 /// DetectedLanguage::default()/* use setters */,
2214 /// DetectedLanguage::default()/* use (different) setters */,
2215 /// ]);
2216 /// ```
2217 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2218 where
2219 T: std::iter::IntoIterator<Item = V>,
2220 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2221 {
2222 use std::iter::Iterator;
2223 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2224 self
2225 }
2226
2227 /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
2228 ///
2229 /// # Example
2230 /// ```ignore,no_run
2231 /// # use google_cloud_documentai_v1::model::document::page::Block;
2232 /// use google_cloud_documentai_v1::model::document::Provenance;
2233 /// let x = Block::new().set_provenance(Provenance::default()/* use setters */);
2234 /// ```
2235 #[deprecated]
2236 pub fn set_provenance<T>(mut self, v: T) -> Self
2237 where
2238 T: std::convert::Into<crate::model::document::Provenance>,
2239 {
2240 self.provenance = std::option::Option::Some(v.into());
2241 self
2242 }
2243
2244 /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
2245 ///
2246 /// # Example
2247 /// ```ignore,no_run
2248 /// # use google_cloud_documentai_v1::model::document::page::Block;
2249 /// use google_cloud_documentai_v1::model::document::Provenance;
2250 /// let x = Block::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2251 /// let x = Block::new().set_or_clear_provenance(None::<Provenance>);
2252 /// ```
2253 #[deprecated]
2254 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2255 where
2256 T: std::convert::Into<crate::model::document::Provenance>,
2257 {
2258 self.provenance = v.map(|x| x.into());
2259 self
2260 }
2261 }
2262
2263 impl wkt::message::Message for Block {
2264 fn typename() -> &'static str {
2265 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
2266 }
2267 }
2268
2269 /// A collection of lines that a human would perceive as a paragraph.
2270 #[derive(Clone, Default, PartialEq)]
2271 #[non_exhaustive]
2272 pub struct Paragraph {
2273 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2274 /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
2275 ///
2276 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2277 /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
2278 pub layout: std::option::Option<crate::model::document::page::Layout>,
2279
2280 /// A list of detected languages together with confidence.
2281 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2282
2283 /// The history of this annotation.
2284 #[deprecated]
2285 pub provenance: std::option::Option<crate::model::document::Provenance>,
2286
2287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2288 }
2289
2290 impl Paragraph {
2291 /// Creates a new default instance.
2292 pub fn new() -> Self {
2293 std::default::Default::default()
2294 }
2295
2296 /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
2297 ///
2298 /// # Example
2299 /// ```ignore,no_run
2300 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2301 /// use google_cloud_documentai_v1::model::document::page::Layout;
2302 /// let x = Paragraph::new().set_layout(Layout::default()/* use setters */);
2303 /// ```
2304 pub fn set_layout<T>(mut self, v: T) -> Self
2305 where
2306 T: std::convert::Into<crate::model::document::page::Layout>,
2307 {
2308 self.layout = std::option::Option::Some(v.into());
2309 self
2310 }
2311
2312 /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
2313 ///
2314 /// # Example
2315 /// ```ignore,no_run
2316 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2317 /// use google_cloud_documentai_v1::model::document::page::Layout;
2318 /// let x = Paragraph::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2319 /// let x = Paragraph::new().set_or_clear_layout(None::<Layout>);
2320 /// ```
2321 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2322 where
2323 T: std::convert::Into<crate::model::document::page::Layout>,
2324 {
2325 self.layout = v.map(|x| x.into());
2326 self
2327 }
2328
2329 /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
2330 ///
2331 /// # Example
2332 /// ```ignore,no_run
2333 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2334 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2335 /// let x = Paragraph::new()
2336 /// .set_detected_languages([
2337 /// DetectedLanguage::default()/* use setters */,
2338 /// DetectedLanguage::default()/* use (different) setters */,
2339 /// ]);
2340 /// ```
2341 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2342 where
2343 T: std::iter::IntoIterator<Item = V>,
2344 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2345 {
2346 use std::iter::Iterator;
2347 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2348 self
2349 }
2350
2351 /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
2352 ///
2353 /// # Example
2354 /// ```ignore,no_run
2355 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2356 /// use google_cloud_documentai_v1::model::document::Provenance;
2357 /// let x = Paragraph::new().set_provenance(Provenance::default()/* use setters */);
2358 /// ```
2359 #[deprecated]
2360 pub fn set_provenance<T>(mut self, v: T) -> Self
2361 where
2362 T: std::convert::Into<crate::model::document::Provenance>,
2363 {
2364 self.provenance = std::option::Option::Some(v.into());
2365 self
2366 }
2367
2368 /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
2369 ///
2370 /// # Example
2371 /// ```ignore,no_run
2372 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2373 /// use google_cloud_documentai_v1::model::document::Provenance;
2374 /// let x = Paragraph::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2375 /// let x = Paragraph::new().set_or_clear_provenance(None::<Provenance>);
2376 /// ```
2377 #[deprecated]
2378 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2379 where
2380 T: std::convert::Into<crate::model::document::Provenance>,
2381 {
2382 self.provenance = v.map(|x| x.into());
2383 self
2384 }
2385 }
2386
2387 impl wkt::message::Message for Paragraph {
2388 fn typename() -> &'static str {
2389 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
2390 }
2391 }
2392
2393 /// A collection of tokens that a human would perceive as a line.
2394 /// Does not cross column boundaries, can be horizontal, vertical, etc.
2395 #[derive(Clone, Default, PartialEq)]
2396 #[non_exhaustive]
2397 pub struct Line {
2398 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2399 /// [Line][google.cloud.documentai.v1.Document.Page.Line].
2400 ///
2401 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2402 /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
2403 pub layout: std::option::Option<crate::model::document::page::Layout>,
2404
2405 /// A list of detected languages together with confidence.
2406 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2407
2408 /// The history of this annotation.
2409 #[deprecated]
2410 pub provenance: std::option::Option<crate::model::document::Provenance>,
2411
2412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2413 }
2414
2415 impl Line {
2416 /// Creates a new default instance.
2417 pub fn new() -> Self {
2418 std::default::Default::default()
2419 }
2420
2421 /// Sets the value of [layout][crate::model::document::page::Line::layout].
2422 ///
2423 /// # Example
2424 /// ```ignore,no_run
2425 /// # use google_cloud_documentai_v1::model::document::page::Line;
2426 /// use google_cloud_documentai_v1::model::document::page::Layout;
2427 /// let x = Line::new().set_layout(Layout::default()/* use setters */);
2428 /// ```
2429 pub fn set_layout<T>(mut self, v: T) -> Self
2430 where
2431 T: std::convert::Into<crate::model::document::page::Layout>,
2432 {
2433 self.layout = std::option::Option::Some(v.into());
2434 self
2435 }
2436
2437 /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
2438 ///
2439 /// # Example
2440 /// ```ignore,no_run
2441 /// # use google_cloud_documentai_v1::model::document::page::Line;
2442 /// use google_cloud_documentai_v1::model::document::page::Layout;
2443 /// let x = Line::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2444 /// let x = Line::new().set_or_clear_layout(None::<Layout>);
2445 /// ```
2446 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2447 where
2448 T: std::convert::Into<crate::model::document::page::Layout>,
2449 {
2450 self.layout = v.map(|x| x.into());
2451 self
2452 }
2453
2454 /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
2455 ///
2456 /// # Example
2457 /// ```ignore,no_run
2458 /// # use google_cloud_documentai_v1::model::document::page::Line;
2459 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2460 /// let x = Line::new()
2461 /// .set_detected_languages([
2462 /// DetectedLanguage::default()/* use setters */,
2463 /// DetectedLanguage::default()/* use (different) setters */,
2464 /// ]);
2465 /// ```
2466 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2467 where
2468 T: std::iter::IntoIterator<Item = V>,
2469 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2470 {
2471 use std::iter::Iterator;
2472 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2473 self
2474 }
2475
2476 /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
2477 ///
2478 /// # Example
2479 /// ```ignore,no_run
2480 /// # use google_cloud_documentai_v1::model::document::page::Line;
2481 /// use google_cloud_documentai_v1::model::document::Provenance;
2482 /// let x = Line::new().set_provenance(Provenance::default()/* use setters */);
2483 /// ```
2484 #[deprecated]
2485 pub fn set_provenance<T>(mut self, v: T) -> Self
2486 where
2487 T: std::convert::Into<crate::model::document::Provenance>,
2488 {
2489 self.provenance = std::option::Option::Some(v.into());
2490 self
2491 }
2492
2493 /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
2494 ///
2495 /// # Example
2496 /// ```ignore,no_run
2497 /// # use google_cloud_documentai_v1::model::document::page::Line;
2498 /// use google_cloud_documentai_v1::model::document::Provenance;
2499 /// let x = Line::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2500 /// let x = Line::new().set_or_clear_provenance(None::<Provenance>);
2501 /// ```
2502 #[deprecated]
2503 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2504 where
2505 T: std::convert::Into<crate::model::document::Provenance>,
2506 {
2507 self.provenance = v.map(|x| x.into());
2508 self
2509 }
2510 }
2511
2512 impl wkt::message::Message for Line {
2513 fn typename() -> &'static str {
2514 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
2515 }
2516 }
2517
2518 /// A detected token.
2519 #[derive(Clone, Default, PartialEq)]
2520 #[non_exhaustive]
2521 pub struct Token {
2522 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2523 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2524 ///
2525 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2526 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2527 pub layout: std::option::Option<crate::model::document::page::Layout>,
2528
2529 /// Detected break at the end of a
2530 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2531 ///
2532 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2533 pub detected_break:
2534 std::option::Option<crate::model::document::page::token::DetectedBreak>,
2535
2536 /// A list of detected languages together with confidence.
2537 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2538
2539 /// The history of this annotation.
2540 #[deprecated]
2541 pub provenance: std::option::Option<crate::model::document::Provenance>,
2542
2543 /// Text style attributes.
2544 pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
2545
2546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2547 }
2548
2549 impl Token {
2550 /// Creates a new default instance.
2551 pub fn new() -> Self {
2552 std::default::Default::default()
2553 }
2554
2555 /// Sets the value of [layout][crate::model::document::page::Token::layout].
2556 ///
2557 /// # Example
2558 /// ```ignore,no_run
2559 /// # use google_cloud_documentai_v1::model::document::page::Token;
2560 /// use google_cloud_documentai_v1::model::document::page::Layout;
2561 /// let x = Token::new().set_layout(Layout::default()/* use setters */);
2562 /// ```
2563 pub fn set_layout<T>(mut self, v: T) -> Self
2564 where
2565 T: std::convert::Into<crate::model::document::page::Layout>,
2566 {
2567 self.layout = std::option::Option::Some(v.into());
2568 self
2569 }
2570
2571 /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
2572 ///
2573 /// # Example
2574 /// ```ignore,no_run
2575 /// # use google_cloud_documentai_v1::model::document::page::Token;
2576 /// use google_cloud_documentai_v1::model::document::page::Layout;
2577 /// let x = Token::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2578 /// let x = Token::new().set_or_clear_layout(None::<Layout>);
2579 /// ```
2580 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2581 where
2582 T: std::convert::Into<crate::model::document::page::Layout>,
2583 {
2584 self.layout = v.map(|x| x.into());
2585 self
2586 }
2587
2588 /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
2589 ///
2590 /// # Example
2591 /// ```ignore,no_run
2592 /// # use google_cloud_documentai_v1::model::document::page::Token;
2593 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2594 /// let x = Token::new().set_detected_break(DetectedBreak::default()/* use setters */);
2595 /// ```
2596 pub fn set_detected_break<T>(mut self, v: T) -> Self
2597 where
2598 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2599 {
2600 self.detected_break = std::option::Option::Some(v.into());
2601 self
2602 }
2603
2604 /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
2605 ///
2606 /// # Example
2607 /// ```ignore,no_run
2608 /// # use google_cloud_documentai_v1::model::document::page::Token;
2609 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2610 /// let x = Token::new().set_or_clear_detected_break(Some(DetectedBreak::default()/* use setters */));
2611 /// let x = Token::new().set_or_clear_detected_break(None::<DetectedBreak>);
2612 /// ```
2613 pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
2614 where
2615 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2616 {
2617 self.detected_break = v.map(|x| x.into());
2618 self
2619 }
2620
2621 /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
2622 ///
2623 /// # Example
2624 /// ```ignore,no_run
2625 /// # use google_cloud_documentai_v1::model::document::page::Token;
2626 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2627 /// let x = Token::new()
2628 /// .set_detected_languages([
2629 /// DetectedLanguage::default()/* use setters */,
2630 /// DetectedLanguage::default()/* use (different) setters */,
2631 /// ]);
2632 /// ```
2633 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2634 where
2635 T: std::iter::IntoIterator<Item = V>,
2636 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2637 {
2638 use std::iter::Iterator;
2639 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2640 self
2641 }
2642
2643 /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
2644 ///
2645 /// # Example
2646 /// ```ignore,no_run
2647 /// # use google_cloud_documentai_v1::model::document::page::Token;
2648 /// use google_cloud_documentai_v1::model::document::Provenance;
2649 /// let x = Token::new().set_provenance(Provenance::default()/* use setters */);
2650 /// ```
2651 #[deprecated]
2652 pub fn set_provenance<T>(mut self, v: T) -> Self
2653 where
2654 T: std::convert::Into<crate::model::document::Provenance>,
2655 {
2656 self.provenance = std::option::Option::Some(v.into());
2657 self
2658 }
2659
2660 /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
2661 ///
2662 /// # Example
2663 /// ```ignore,no_run
2664 /// # use google_cloud_documentai_v1::model::document::page::Token;
2665 /// use google_cloud_documentai_v1::model::document::Provenance;
2666 /// let x = Token::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2667 /// let x = Token::new().set_or_clear_provenance(None::<Provenance>);
2668 /// ```
2669 #[deprecated]
2670 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2671 where
2672 T: std::convert::Into<crate::model::document::Provenance>,
2673 {
2674 self.provenance = v.map(|x| x.into());
2675 self
2676 }
2677
2678 /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
2679 ///
2680 /// # Example
2681 /// ```ignore,no_run
2682 /// # use google_cloud_documentai_v1::model::document::page::Token;
2683 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2684 /// let x = Token::new().set_style_info(StyleInfo::default()/* use setters */);
2685 /// ```
2686 pub fn set_style_info<T>(mut self, v: T) -> Self
2687 where
2688 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2689 {
2690 self.style_info = std::option::Option::Some(v.into());
2691 self
2692 }
2693
2694 /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
2695 ///
2696 /// # Example
2697 /// ```ignore,no_run
2698 /// # use google_cloud_documentai_v1::model::document::page::Token;
2699 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2700 /// let x = Token::new().set_or_clear_style_info(Some(StyleInfo::default()/* use setters */));
2701 /// let x = Token::new().set_or_clear_style_info(None::<StyleInfo>);
2702 /// ```
2703 pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
2704 where
2705 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2706 {
2707 self.style_info = v.map(|x| x.into());
2708 self
2709 }
2710 }
2711
2712 impl wkt::message::Message for Token {
2713 fn typename() -> &'static str {
2714 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
2715 }
2716 }
2717
2718 /// Defines additional types related to [Token].
2719 pub mod token {
2720 #[allow(unused_imports)]
2721 use super::*;
2722
2723 /// Detected break at the end of a
2724 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2725 ///
2726 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2727 #[derive(Clone, Default, PartialEq)]
2728 #[non_exhaustive]
2729 pub struct DetectedBreak {
2730 /// Detected break type.
2731 pub r#type: crate::model::document::page::token::detected_break::Type,
2732
2733 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2734 }
2735
2736 impl DetectedBreak {
2737 /// Creates a new default instance.
2738 pub fn new() -> Self {
2739 std::default::Default::default()
2740 }
2741
2742 /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
2743 ///
2744 /// # Example
2745 /// ```ignore,no_run
2746 /// # use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2747 /// use google_cloud_documentai_v1::model::document::page::token::detected_break::Type;
2748 /// let x0 = DetectedBreak::new().set_type(Type::Space);
2749 /// let x1 = DetectedBreak::new().set_type(Type::WideSpace);
2750 /// let x2 = DetectedBreak::new().set_type(Type::Hyphen);
2751 /// ```
2752 pub fn set_type<
2753 T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
2754 >(
2755 mut self,
2756 v: T,
2757 ) -> Self {
2758 self.r#type = v.into();
2759 self
2760 }
2761 }
2762
2763 impl wkt::message::Message for DetectedBreak {
2764 fn typename() -> &'static str {
2765 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
2766 }
2767 }
2768
2769 /// Defines additional types related to [DetectedBreak].
2770 pub mod detected_break {
2771 #[allow(unused_imports)]
2772 use super::*;
2773
2774 /// Enum to denote the type of break found.
2775 ///
2776 /// # Working with unknown values
2777 ///
2778 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2779 /// additional enum variants at any time. Adding new variants is not considered
2780 /// a breaking change. Applications should write their code in anticipation of:
2781 ///
2782 /// - New values appearing in future releases of the client library, **and**
2783 /// - New values received dynamically, without application changes.
2784 ///
2785 /// Please consult the [Working with enums] section in the user guide for some
2786 /// guidelines.
2787 ///
2788 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2789 #[derive(Clone, Debug, PartialEq)]
2790 #[non_exhaustive]
2791 pub enum Type {
2792 /// Unspecified break type.
2793 Unspecified,
2794 /// A single whitespace.
2795 Space,
2796 /// A wider whitespace.
2797 WideSpace,
2798 /// A hyphen that indicates that a token has been split across lines.
2799 Hyphen,
2800 /// If set, the enum was initialized with an unknown value.
2801 ///
2802 /// Applications can examine the value using [Type::value] or
2803 /// [Type::name].
2804 UnknownValue(r#type::UnknownValue),
2805 }
2806
2807 #[doc(hidden)]
2808 pub mod r#type {
2809 #[allow(unused_imports)]
2810 use super::*;
2811 #[derive(Clone, Debug, PartialEq)]
2812 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2813 }
2814
2815 impl Type {
2816 /// Gets the enum value.
2817 ///
2818 /// Returns `None` if the enum contains an unknown value deserialized from
2819 /// the string representation of enums.
2820 pub fn value(&self) -> std::option::Option<i32> {
2821 match self {
2822 Self::Unspecified => std::option::Option::Some(0),
2823 Self::Space => std::option::Option::Some(1),
2824 Self::WideSpace => std::option::Option::Some(2),
2825 Self::Hyphen => std::option::Option::Some(3),
2826 Self::UnknownValue(u) => u.0.value(),
2827 }
2828 }
2829
2830 /// Gets the enum value as a string.
2831 ///
2832 /// Returns `None` if the enum contains an unknown value deserialized from
2833 /// the integer representation of enums.
2834 pub fn name(&self) -> std::option::Option<&str> {
2835 match self {
2836 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2837 Self::Space => std::option::Option::Some("SPACE"),
2838 Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
2839 Self::Hyphen => std::option::Option::Some("HYPHEN"),
2840 Self::UnknownValue(u) => u.0.name(),
2841 }
2842 }
2843 }
2844
2845 impl std::default::Default for Type {
2846 fn default() -> Self {
2847 use std::convert::From;
2848 Self::from(0)
2849 }
2850 }
2851
2852 impl std::fmt::Display for Type {
2853 fn fmt(
2854 &self,
2855 f: &mut std::fmt::Formatter<'_>,
2856 ) -> std::result::Result<(), std::fmt::Error> {
2857 wkt::internal::display_enum(f, self.name(), self.value())
2858 }
2859 }
2860
2861 impl std::convert::From<i32> for Type {
2862 fn from(value: i32) -> Self {
2863 match value {
2864 0 => Self::Unspecified,
2865 1 => Self::Space,
2866 2 => Self::WideSpace,
2867 3 => Self::Hyphen,
2868 _ => Self::UnknownValue(r#type::UnknownValue(
2869 wkt::internal::UnknownEnumValue::Integer(value),
2870 )),
2871 }
2872 }
2873 }
2874
2875 impl std::convert::From<&str> for Type {
2876 fn from(value: &str) -> Self {
2877 use std::string::ToString;
2878 match value {
2879 "TYPE_UNSPECIFIED" => Self::Unspecified,
2880 "SPACE" => Self::Space,
2881 "WIDE_SPACE" => Self::WideSpace,
2882 "HYPHEN" => Self::Hyphen,
2883 _ => Self::UnknownValue(r#type::UnknownValue(
2884 wkt::internal::UnknownEnumValue::String(value.to_string()),
2885 )),
2886 }
2887 }
2888 }
2889
2890 impl serde::ser::Serialize for Type {
2891 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2892 where
2893 S: serde::Serializer,
2894 {
2895 match self {
2896 Self::Unspecified => serializer.serialize_i32(0),
2897 Self::Space => serializer.serialize_i32(1),
2898 Self::WideSpace => serializer.serialize_i32(2),
2899 Self::Hyphen => serializer.serialize_i32(3),
2900 Self::UnknownValue(u) => u.0.serialize(serializer),
2901 }
2902 }
2903 }
2904
2905 impl<'de> serde::de::Deserialize<'de> for Type {
2906 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2907 where
2908 D: serde::Deserializer<'de>,
2909 {
2910 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2911 ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2912 ))
2913 }
2914 }
2915 }
2916
2917 /// Font and other text style attributes.
2918 #[derive(Clone, Default, PartialEq)]
2919 #[non_exhaustive]
2920 pub struct StyleInfo {
2921 /// Font size in points (`1` point is `¹⁄₇₂` inches).
2922 pub font_size: i32,
2923
2924 /// Font size in pixels, equal to _unrounded
2925 /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
2926 ///
2927 /// * _resolution_ ÷ `72.0`.
2928 ///
2929 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
2930 pub pixel_font_size: f64,
2931
2932 /// Letter spacing in points.
2933 pub letter_spacing: f64,
2934
2935 /// Name or style of the font.
2936 pub font_type: std::string::String,
2937
2938 /// Whether the text is bold (equivalent to
2939 /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
2940 /// is at least `700`).
2941 ///
2942 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
2943 pub bold: bool,
2944
2945 /// Whether the text is italic.
2946 pub italic: bool,
2947
2948 /// Whether the text is underlined.
2949 pub underlined: bool,
2950
2951 /// Whether the text is strikethrough. This feature is not supported yet.
2952 pub strikeout: bool,
2953
2954 /// Whether the text is a subscript. This feature is not supported yet.
2955 pub subscript: bool,
2956
2957 /// Whether the text is a superscript. This feature is not supported yet.
2958 pub superscript: bool,
2959
2960 /// Whether the text is in small caps. This feature is not supported yet.
2961 pub smallcaps: bool,
2962
2963 /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
2964 /// Normal is `400`, bold is `700`.
2965 pub font_weight: i32,
2966
2967 /// Whether the text is handwritten.
2968 pub handwritten: bool,
2969
2970 /// Color of the text.
2971 pub text_color: std::option::Option<google_cloud_type::model::Color>,
2972
2973 /// Color of the background.
2974 pub background_color: std::option::Option<google_cloud_type::model::Color>,
2975
2976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2977 }
2978
2979 impl StyleInfo {
2980 /// Creates a new default instance.
2981 pub fn new() -> Self {
2982 std::default::Default::default()
2983 }
2984
2985 /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
2986 ///
2987 /// # Example
2988 /// ```ignore,no_run
2989 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2990 /// let x = StyleInfo::new().set_font_size(42);
2991 /// ```
2992 pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2993 self.font_size = v.into();
2994 self
2995 }
2996
2997 /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
2998 ///
2999 /// # Example
3000 /// ```ignore,no_run
3001 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3002 /// let x = StyleInfo::new().set_pixel_font_size(42.0);
3003 /// ```
3004 pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3005 self.pixel_font_size = v.into();
3006 self
3007 }
3008
3009 /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
3010 ///
3011 /// # Example
3012 /// ```ignore,no_run
3013 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3014 /// let x = StyleInfo::new().set_letter_spacing(42.0);
3015 /// ```
3016 pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3017 self.letter_spacing = v.into();
3018 self
3019 }
3020
3021 /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
3022 ///
3023 /// # Example
3024 /// ```ignore,no_run
3025 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3026 /// let x = StyleInfo::new().set_font_type("example");
3027 /// ```
3028 pub fn set_font_type<T: std::convert::Into<std::string::String>>(
3029 mut self,
3030 v: T,
3031 ) -> Self {
3032 self.font_type = v.into();
3033 self
3034 }
3035
3036 /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
3037 ///
3038 /// # Example
3039 /// ```ignore,no_run
3040 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3041 /// let x = StyleInfo::new().set_bold(true);
3042 /// ```
3043 pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3044 self.bold = v.into();
3045 self
3046 }
3047
3048 /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
3049 ///
3050 /// # Example
3051 /// ```ignore,no_run
3052 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3053 /// let x = StyleInfo::new().set_italic(true);
3054 /// ```
3055 pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3056 self.italic = v.into();
3057 self
3058 }
3059
3060 /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
3061 ///
3062 /// # Example
3063 /// ```ignore,no_run
3064 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3065 /// let x = StyleInfo::new().set_underlined(true);
3066 /// ```
3067 pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3068 self.underlined = v.into();
3069 self
3070 }
3071
3072 /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
3073 ///
3074 /// # Example
3075 /// ```ignore,no_run
3076 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3077 /// let x = StyleInfo::new().set_strikeout(true);
3078 /// ```
3079 pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3080 self.strikeout = v.into();
3081 self
3082 }
3083
3084 /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
3085 ///
3086 /// # Example
3087 /// ```ignore,no_run
3088 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3089 /// let x = StyleInfo::new().set_subscript(true);
3090 /// ```
3091 pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3092 self.subscript = v.into();
3093 self
3094 }
3095
3096 /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3101 /// let x = StyleInfo::new().set_superscript(true);
3102 /// ```
3103 pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3104 self.superscript = v.into();
3105 self
3106 }
3107
3108 /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
3109 ///
3110 /// # Example
3111 /// ```ignore,no_run
3112 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3113 /// let x = StyleInfo::new().set_smallcaps(true);
3114 /// ```
3115 pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3116 self.smallcaps = v.into();
3117 self
3118 }
3119
3120 /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
3121 ///
3122 /// # Example
3123 /// ```ignore,no_run
3124 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3125 /// let x = StyleInfo::new().set_font_weight(42);
3126 /// ```
3127 pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3128 self.font_weight = v.into();
3129 self
3130 }
3131
3132 /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
3133 ///
3134 /// # Example
3135 /// ```ignore,no_run
3136 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3137 /// let x = StyleInfo::new().set_handwritten(true);
3138 /// ```
3139 pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3140 self.handwritten = v.into();
3141 self
3142 }
3143
3144 /// Sets 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_text_color(Color::default()/* use setters */);
3151 /// ```
3152 pub fn set_text_color<T>(mut self, v: T) -> Self
3153 where
3154 T: std::convert::Into<google_cloud_type::model::Color>,
3155 {
3156 self.text_color = std::option::Option::Some(v.into());
3157 self
3158 }
3159
3160 /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3161 ///
3162 /// # Example
3163 /// ```ignore,no_run
3164 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3165 /// use google_cloud_type::model::Color;
3166 /// let x = StyleInfo::new().set_or_clear_text_color(Some(Color::default()/* use setters */));
3167 /// let x = StyleInfo::new().set_or_clear_text_color(None::<Color>);
3168 /// ```
3169 pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
3170 where
3171 T: std::convert::Into<google_cloud_type::model::Color>,
3172 {
3173 self.text_color = v.map(|x| x.into());
3174 self
3175 }
3176
3177 /// Sets 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_background_color(Color::default()/* use setters */);
3184 /// ```
3185 pub fn set_background_color<T>(mut self, v: T) -> Self
3186 where
3187 T: std::convert::Into<google_cloud_type::model::Color>,
3188 {
3189 self.background_color = std::option::Option::Some(v.into());
3190 self
3191 }
3192
3193 /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3194 ///
3195 /// # Example
3196 /// ```ignore,no_run
3197 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3198 /// use google_cloud_type::model::Color;
3199 /// let x = StyleInfo::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
3200 /// let x = StyleInfo::new().set_or_clear_background_color(None::<Color>);
3201 /// ```
3202 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
3203 where
3204 T: std::convert::Into<google_cloud_type::model::Color>,
3205 {
3206 self.background_color = v.map(|x| x.into());
3207 self
3208 }
3209 }
3210
3211 impl wkt::message::Message for StyleInfo {
3212 fn typename() -> &'static str {
3213 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
3214 }
3215 }
3216 }
3217
3218 /// A detected symbol.
3219 #[derive(Clone, Default, PartialEq)]
3220 #[non_exhaustive]
3221 pub struct Symbol {
3222 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3223 /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
3224 ///
3225 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3226 /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
3227 pub layout: std::option::Option<crate::model::document::page::Layout>,
3228
3229 /// A list of detected languages together with confidence.
3230 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3231
3232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3233 }
3234
3235 impl Symbol {
3236 /// Creates a new default instance.
3237 pub fn new() -> Self {
3238 std::default::Default::default()
3239 }
3240
3241 /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
3242 ///
3243 /// # Example
3244 /// ```ignore,no_run
3245 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3246 /// use google_cloud_documentai_v1::model::document::page::Layout;
3247 /// let x = Symbol::new().set_layout(Layout::default()/* use setters */);
3248 /// ```
3249 pub fn set_layout<T>(mut self, v: T) -> Self
3250 where
3251 T: std::convert::Into<crate::model::document::page::Layout>,
3252 {
3253 self.layout = std::option::Option::Some(v.into());
3254 self
3255 }
3256
3257 /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
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::Layout;
3263 /// let x = Symbol::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3264 /// let x = Symbol::new().set_or_clear_layout(None::<Layout>);
3265 /// ```
3266 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3267 where
3268 T: std::convert::Into<crate::model::document::page::Layout>,
3269 {
3270 self.layout = v.map(|x| x.into());
3271 self
3272 }
3273
3274 /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
3275 ///
3276 /// # Example
3277 /// ```ignore,no_run
3278 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3279 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3280 /// let x = Symbol::new()
3281 /// .set_detected_languages([
3282 /// DetectedLanguage::default()/* use setters */,
3283 /// DetectedLanguage::default()/* use (different) setters */,
3284 /// ]);
3285 /// ```
3286 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3287 where
3288 T: std::iter::IntoIterator<Item = V>,
3289 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3290 {
3291 use std::iter::Iterator;
3292 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3293 self
3294 }
3295 }
3296
3297 impl wkt::message::Message for Symbol {
3298 fn typename() -> &'static str {
3299 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
3300 }
3301 }
3302
3303 /// Detected non-text visual elements, for example, checkbox, signature etc.
3304 /// on the page.
3305 #[derive(Clone, Default, PartialEq)]
3306 #[non_exhaustive]
3307 pub struct VisualElement {
3308 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3309 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3310 ///
3311 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3312 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3313 pub layout: std::option::Option<crate::model::document::page::Layout>,
3314
3315 /// Type of the
3316 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3317 ///
3318 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3319 pub r#type: std::string::String,
3320
3321 /// A list of detected languages together with confidence.
3322 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3323
3324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3325 }
3326
3327 impl VisualElement {
3328 /// Creates a new default instance.
3329 pub fn new() -> Self {
3330 std::default::Default::default()
3331 }
3332
3333 /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
3334 ///
3335 /// # Example
3336 /// ```ignore,no_run
3337 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3338 /// use google_cloud_documentai_v1::model::document::page::Layout;
3339 /// let x = VisualElement::new().set_layout(Layout::default()/* use setters */);
3340 /// ```
3341 pub fn set_layout<T>(mut self, v: T) -> Self
3342 where
3343 T: std::convert::Into<crate::model::document::page::Layout>,
3344 {
3345 self.layout = std::option::Option::Some(v.into());
3346 self
3347 }
3348
3349 /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
3350 ///
3351 /// # Example
3352 /// ```ignore,no_run
3353 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3354 /// use google_cloud_documentai_v1::model::document::page::Layout;
3355 /// let x = VisualElement::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3356 /// let x = VisualElement::new().set_or_clear_layout(None::<Layout>);
3357 /// ```
3358 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3359 where
3360 T: std::convert::Into<crate::model::document::page::Layout>,
3361 {
3362 self.layout = v.map(|x| x.into());
3363 self
3364 }
3365
3366 /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
3367 ///
3368 /// # Example
3369 /// ```ignore,no_run
3370 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3371 /// let x = VisualElement::new().set_type("example");
3372 /// ```
3373 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3374 self.r#type = v.into();
3375 self
3376 }
3377
3378 /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
3379 ///
3380 /// # Example
3381 /// ```ignore,no_run
3382 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3383 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3384 /// let x = VisualElement::new()
3385 /// .set_detected_languages([
3386 /// DetectedLanguage::default()/* use setters */,
3387 /// DetectedLanguage::default()/* use (different) setters */,
3388 /// ]);
3389 /// ```
3390 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3391 where
3392 T: std::iter::IntoIterator<Item = V>,
3393 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3394 {
3395 use std::iter::Iterator;
3396 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3397 self
3398 }
3399 }
3400
3401 impl wkt::message::Message for VisualElement {
3402 fn typename() -> &'static str {
3403 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
3404 }
3405 }
3406
3407 /// A table representation similar to HTML table structure.
3408 #[derive(Clone, Default, PartialEq)]
3409 #[non_exhaustive]
3410 pub struct Table {
3411 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3412 /// [Table][google.cloud.documentai.v1.Document.Page.Table].
3413 ///
3414 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3415 /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
3416 pub layout: std::option::Option<crate::model::document::page::Layout>,
3417
3418 /// Header rows of the table.
3419 pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3420
3421 /// Body rows of the table.
3422 pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3423
3424 /// A list of detected languages together with confidence.
3425 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3426
3427 /// The history of this table.
3428 #[deprecated]
3429 pub provenance: std::option::Option<crate::model::document::Provenance>,
3430
3431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3432 }
3433
3434 impl Table {
3435 /// Creates a new default instance.
3436 pub fn new() -> Self {
3437 std::default::Default::default()
3438 }
3439
3440 /// Sets the value of [layout][crate::model::document::page::Table::layout].
3441 ///
3442 /// # Example
3443 /// ```ignore,no_run
3444 /// # use google_cloud_documentai_v1::model::document::page::Table;
3445 /// use google_cloud_documentai_v1::model::document::page::Layout;
3446 /// let x = Table::new().set_layout(Layout::default()/* use setters */);
3447 /// ```
3448 pub fn set_layout<T>(mut self, v: T) -> Self
3449 where
3450 T: std::convert::Into<crate::model::document::page::Layout>,
3451 {
3452 self.layout = std::option::Option::Some(v.into());
3453 self
3454 }
3455
3456 /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
3457 ///
3458 /// # Example
3459 /// ```ignore,no_run
3460 /// # use google_cloud_documentai_v1::model::document::page::Table;
3461 /// use google_cloud_documentai_v1::model::document::page::Layout;
3462 /// let x = Table::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3463 /// let x = Table::new().set_or_clear_layout(None::<Layout>);
3464 /// ```
3465 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3466 where
3467 T: std::convert::Into<crate::model::document::page::Layout>,
3468 {
3469 self.layout = v.map(|x| x.into());
3470 self
3471 }
3472
3473 /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
3474 ///
3475 /// # Example
3476 /// ```ignore,no_run
3477 /// # use google_cloud_documentai_v1::model::document::page::Table;
3478 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3479 /// let x = Table::new()
3480 /// .set_header_rows([
3481 /// TableRow::default()/* use setters */,
3482 /// TableRow::default()/* use (different) setters */,
3483 /// ]);
3484 /// ```
3485 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
3486 where
3487 T: std::iter::IntoIterator<Item = V>,
3488 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3489 {
3490 use std::iter::Iterator;
3491 self.header_rows = v.into_iter().map(|i| i.into()).collect();
3492 self
3493 }
3494
3495 /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
3496 ///
3497 /// # Example
3498 /// ```ignore,no_run
3499 /// # use google_cloud_documentai_v1::model::document::page::Table;
3500 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3501 /// let x = Table::new()
3502 /// .set_body_rows([
3503 /// TableRow::default()/* use setters */,
3504 /// TableRow::default()/* use (different) setters */,
3505 /// ]);
3506 /// ```
3507 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
3508 where
3509 T: std::iter::IntoIterator<Item = V>,
3510 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3511 {
3512 use std::iter::Iterator;
3513 self.body_rows = v.into_iter().map(|i| i.into()).collect();
3514 self
3515 }
3516
3517 /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_documentai_v1::model::document::page::Table;
3522 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3523 /// let x = Table::new()
3524 /// .set_detected_languages([
3525 /// DetectedLanguage::default()/* use setters */,
3526 /// DetectedLanguage::default()/* use (different) setters */,
3527 /// ]);
3528 /// ```
3529 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3530 where
3531 T: std::iter::IntoIterator<Item = V>,
3532 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3533 {
3534 use std::iter::Iterator;
3535 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3536 self
3537 }
3538
3539 /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
3540 ///
3541 /// # Example
3542 /// ```ignore,no_run
3543 /// # use google_cloud_documentai_v1::model::document::page::Table;
3544 /// use google_cloud_documentai_v1::model::document::Provenance;
3545 /// let x = Table::new().set_provenance(Provenance::default()/* use setters */);
3546 /// ```
3547 #[deprecated]
3548 pub fn set_provenance<T>(mut self, v: T) -> Self
3549 where
3550 T: std::convert::Into<crate::model::document::Provenance>,
3551 {
3552 self.provenance = std::option::Option::Some(v.into());
3553 self
3554 }
3555
3556 /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
3557 ///
3558 /// # Example
3559 /// ```ignore,no_run
3560 /// # use google_cloud_documentai_v1::model::document::page::Table;
3561 /// use google_cloud_documentai_v1::model::document::Provenance;
3562 /// let x = Table::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3563 /// let x = Table::new().set_or_clear_provenance(None::<Provenance>);
3564 /// ```
3565 #[deprecated]
3566 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3567 where
3568 T: std::convert::Into<crate::model::document::Provenance>,
3569 {
3570 self.provenance = v.map(|x| x.into());
3571 self
3572 }
3573 }
3574
3575 impl wkt::message::Message for Table {
3576 fn typename() -> &'static str {
3577 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
3578 }
3579 }
3580
3581 /// Defines additional types related to [Table].
3582 pub mod table {
3583 #[allow(unused_imports)]
3584 use super::*;
3585
3586 /// A row of table cells.
3587 #[derive(Clone, Default, PartialEq)]
3588 #[non_exhaustive]
3589 pub struct TableRow {
3590 /// Cells that make up this row.
3591 pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
3592
3593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3594 }
3595
3596 impl TableRow {
3597 /// Creates a new default instance.
3598 pub fn new() -> Self {
3599 std::default::Default::default()
3600 }
3601
3602 /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
3603 ///
3604 /// # Example
3605 /// ```ignore,no_run
3606 /// # use google_cloud_documentai_v1::model::document::page::table::TableRow;
3607 /// use google_cloud_documentai_v1::model::document::page::table::TableCell;
3608 /// let x = TableRow::new()
3609 /// .set_cells([
3610 /// TableCell::default()/* use setters */,
3611 /// TableCell::default()/* use (different) setters */,
3612 /// ]);
3613 /// ```
3614 pub fn set_cells<T, V>(mut self, v: T) -> Self
3615 where
3616 T: std::iter::IntoIterator<Item = V>,
3617 V: std::convert::Into<crate::model::document::page::table::TableCell>,
3618 {
3619 use std::iter::Iterator;
3620 self.cells = v.into_iter().map(|i| i.into()).collect();
3621 self
3622 }
3623 }
3624
3625 impl wkt::message::Message for TableRow {
3626 fn typename() -> &'static str {
3627 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
3628 }
3629 }
3630
3631 /// A cell representation inside the table.
3632 #[derive(Clone, Default, PartialEq)]
3633 #[non_exhaustive]
3634 pub struct TableCell {
3635 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3636 /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
3637 ///
3638 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3639 /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
3640 pub layout: std::option::Option<crate::model::document::page::Layout>,
3641
3642 /// How many rows this cell spans.
3643 pub row_span: i32,
3644
3645 /// How many columns this cell spans.
3646 pub col_span: i32,
3647
3648 /// A list of detected languages together with confidence.
3649 pub detected_languages:
3650 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3651
3652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3653 }
3654
3655 impl TableCell {
3656 /// Creates a new default instance.
3657 pub fn new() -> Self {
3658 std::default::Default::default()
3659 }
3660
3661 /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
3662 ///
3663 /// # Example
3664 /// ```ignore,no_run
3665 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3666 /// use google_cloud_documentai_v1::model::document::page::Layout;
3667 /// let x = TableCell::new().set_layout(Layout::default()/* use setters */);
3668 /// ```
3669 pub fn set_layout<T>(mut self, v: T) -> Self
3670 where
3671 T: std::convert::Into<crate::model::document::page::Layout>,
3672 {
3673 self.layout = std::option::Option::Some(v.into());
3674 self
3675 }
3676
3677 /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
3678 ///
3679 /// # Example
3680 /// ```ignore,no_run
3681 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3682 /// use google_cloud_documentai_v1::model::document::page::Layout;
3683 /// let x = TableCell::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3684 /// let x = TableCell::new().set_or_clear_layout(None::<Layout>);
3685 /// ```
3686 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3687 where
3688 T: std::convert::Into<crate::model::document::page::Layout>,
3689 {
3690 self.layout = v.map(|x| x.into());
3691 self
3692 }
3693
3694 /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
3695 ///
3696 /// # Example
3697 /// ```ignore,no_run
3698 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3699 /// let x = TableCell::new().set_row_span(42);
3700 /// ```
3701 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3702 self.row_span = v.into();
3703 self
3704 }
3705
3706 /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
3707 ///
3708 /// # Example
3709 /// ```ignore,no_run
3710 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3711 /// let x = TableCell::new().set_col_span(42);
3712 /// ```
3713 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3714 self.col_span = v.into();
3715 self
3716 }
3717
3718 /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
3719 ///
3720 /// # Example
3721 /// ```ignore,no_run
3722 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3723 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3724 /// let x = TableCell::new()
3725 /// .set_detected_languages([
3726 /// DetectedLanguage::default()/* use setters */,
3727 /// DetectedLanguage::default()/* use (different) setters */,
3728 /// ]);
3729 /// ```
3730 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3731 where
3732 T: std::iter::IntoIterator<Item = V>,
3733 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3734 {
3735 use std::iter::Iterator;
3736 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3737 self
3738 }
3739 }
3740
3741 impl wkt::message::Message for TableCell {
3742 fn typename() -> &'static str {
3743 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
3744 }
3745 }
3746 }
3747
3748 /// A form field detected on the page.
3749 #[derive(Clone, Default, PartialEq)]
3750 #[non_exhaustive]
3751 pub struct FormField {
3752 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3753 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
3754 /// For example, `Address`, `Email`, `Grand total`, `Phone number`, etc.
3755 ///
3756 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3757 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3758 pub field_name: std::option::Option<crate::model::document::page::Layout>,
3759
3760 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3761 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
3762 ///
3763 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3764 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3765 pub field_value: std::option::Option<crate::model::document::page::Layout>,
3766
3767 /// A list of detected languages for name together with confidence.
3768 pub name_detected_languages:
3769 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3770
3771 /// A list of detected languages for value together with confidence.
3772 pub value_detected_languages:
3773 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3774
3775 /// If the value is non-textual, this field represents the type. Current
3776 /// valid values are:
3777 ///
3778 /// - blank (this indicates the `field_value` is normal text)
3779 /// - `unfilled_checkbox`
3780 /// - `filled_checkbox`
3781 pub value_type: std::string::String,
3782
3783 /// Created for Labeling UI to export key text.
3784 /// If corrections were made to the text identified by the
3785 /// `field_name.text_anchor`, this field will contain the correction.
3786 pub corrected_key_text: std::string::String,
3787
3788 /// Created for Labeling UI to export value text.
3789 /// If corrections were made to the text identified by the
3790 /// `field_value.text_anchor`, this field will contain the correction.
3791 pub corrected_value_text: std::string::String,
3792
3793 /// The history of this annotation.
3794 pub provenance: std::option::Option<crate::model::document::Provenance>,
3795
3796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3797 }
3798
3799 impl FormField {
3800 /// Creates a new default instance.
3801 pub fn new() -> Self {
3802 std::default::Default::default()
3803 }
3804
3805 /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
3806 ///
3807 /// # Example
3808 /// ```ignore,no_run
3809 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3810 /// use google_cloud_documentai_v1::model::document::page::Layout;
3811 /// let x = FormField::new().set_field_name(Layout::default()/* use setters */);
3812 /// ```
3813 pub fn set_field_name<T>(mut self, v: T) -> Self
3814 where
3815 T: std::convert::Into<crate::model::document::page::Layout>,
3816 {
3817 self.field_name = std::option::Option::Some(v.into());
3818 self
3819 }
3820
3821 /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
3822 ///
3823 /// # Example
3824 /// ```ignore,no_run
3825 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3826 /// use google_cloud_documentai_v1::model::document::page::Layout;
3827 /// let x = FormField::new().set_or_clear_field_name(Some(Layout::default()/* use setters */));
3828 /// let x = FormField::new().set_or_clear_field_name(None::<Layout>);
3829 /// ```
3830 pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
3831 where
3832 T: std::convert::Into<crate::model::document::page::Layout>,
3833 {
3834 self.field_name = v.map(|x| x.into());
3835 self
3836 }
3837
3838 /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
3839 ///
3840 /// # Example
3841 /// ```ignore,no_run
3842 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3843 /// use google_cloud_documentai_v1::model::document::page::Layout;
3844 /// let x = FormField::new().set_field_value(Layout::default()/* use setters */);
3845 /// ```
3846 pub fn set_field_value<T>(mut self, v: T) -> Self
3847 where
3848 T: std::convert::Into<crate::model::document::page::Layout>,
3849 {
3850 self.field_value = std::option::Option::Some(v.into());
3851 self
3852 }
3853
3854 /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
3855 ///
3856 /// # Example
3857 /// ```ignore,no_run
3858 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3859 /// use google_cloud_documentai_v1::model::document::page::Layout;
3860 /// let x = FormField::new().set_or_clear_field_value(Some(Layout::default()/* use setters */));
3861 /// let x = FormField::new().set_or_clear_field_value(None::<Layout>);
3862 /// ```
3863 pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
3864 where
3865 T: std::convert::Into<crate::model::document::page::Layout>,
3866 {
3867 self.field_value = v.map(|x| x.into());
3868 self
3869 }
3870
3871 /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_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_name_detected_languages([
3879 /// DetectedLanguage::default()/* use setters */,
3880 /// DetectedLanguage::default()/* use (different) setters */,
3881 /// ]);
3882 /// ```
3883 pub fn set_name_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.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
3890 self
3891 }
3892
3893 /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
3894 ///
3895 /// # Example
3896 /// ```ignore,no_run
3897 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3898 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3899 /// let x = FormField::new()
3900 /// .set_value_detected_languages([
3901 /// DetectedLanguage::default()/* use setters */,
3902 /// DetectedLanguage::default()/* use (different) setters */,
3903 /// ]);
3904 /// ```
3905 pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
3906 where
3907 T: std::iter::IntoIterator<Item = V>,
3908 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3909 {
3910 use std::iter::Iterator;
3911 self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
3912 self
3913 }
3914
3915 /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
3916 ///
3917 /// # Example
3918 /// ```ignore,no_run
3919 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3920 /// let x = FormField::new().set_value_type("example");
3921 /// ```
3922 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
3923 mut self,
3924 v: T,
3925 ) -> Self {
3926 self.value_type = v.into();
3927 self
3928 }
3929
3930 /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
3931 ///
3932 /// # Example
3933 /// ```ignore,no_run
3934 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3935 /// let x = FormField::new().set_corrected_key_text("example");
3936 /// ```
3937 pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
3938 mut self,
3939 v: T,
3940 ) -> Self {
3941 self.corrected_key_text = v.into();
3942 self
3943 }
3944
3945 /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
3946 ///
3947 /// # Example
3948 /// ```ignore,no_run
3949 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3950 /// let x = FormField::new().set_corrected_value_text("example");
3951 /// ```
3952 pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
3953 mut self,
3954 v: T,
3955 ) -> Self {
3956 self.corrected_value_text = v.into();
3957 self
3958 }
3959
3960 /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
3961 ///
3962 /// # Example
3963 /// ```ignore,no_run
3964 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3965 /// use google_cloud_documentai_v1::model::document::Provenance;
3966 /// let x = FormField::new().set_provenance(Provenance::default()/* use setters */);
3967 /// ```
3968 pub fn set_provenance<T>(mut self, v: T) -> Self
3969 where
3970 T: std::convert::Into<crate::model::document::Provenance>,
3971 {
3972 self.provenance = std::option::Option::Some(v.into());
3973 self
3974 }
3975
3976 /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
3977 ///
3978 /// # Example
3979 /// ```ignore,no_run
3980 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3981 /// use google_cloud_documentai_v1::model::document::Provenance;
3982 /// let x = FormField::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3983 /// let x = FormField::new().set_or_clear_provenance(None::<Provenance>);
3984 /// ```
3985 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3986 where
3987 T: std::convert::Into<crate::model::document::Provenance>,
3988 {
3989 self.provenance = v.map(|x| x.into());
3990 self
3991 }
3992 }
3993
3994 impl wkt::message::Message for FormField {
3995 fn typename() -> &'static str {
3996 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
3997 }
3998 }
3999
4000 /// A detected barcode.
4001 #[derive(Clone, Default, PartialEq)]
4002 #[non_exhaustive]
4003 pub struct DetectedBarcode {
4004 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
4005 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
4006 ///
4007 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
4008 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
4009 pub layout: std::option::Option<crate::model::document::page::Layout>,
4010
4011 /// Detailed barcode information of the
4012 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
4013 ///
4014 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
4015 pub barcode: std::option::Option<crate::model::Barcode>,
4016
4017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4018 }
4019
4020 impl DetectedBarcode {
4021 /// Creates a new default instance.
4022 pub fn new() -> Self {
4023 std::default::Default::default()
4024 }
4025
4026 /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4027 ///
4028 /// # Example
4029 /// ```ignore,no_run
4030 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4031 /// use google_cloud_documentai_v1::model::document::page::Layout;
4032 /// let x = DetectedBarcode::new().set_layout(Layout::default()/* use setters */);
4033 /// ```
4034 pub fn set_layout<T>(mut self, v: T) -> Self
4035 where
4036 T: std::convert::Into<crate::model::document::page::Layout>,
4037 {
4038 self.layout = std::option::Option::Some(v.into());
4039 self
4040 }
4041
4042 /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4043 ///
4044 /// # Example
4045 /// ```ignore,no_run
4046 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4047 /// use google_cloud_documentai_v1::model::document::page::Layout;
4048 /// let x = DetectedBarcode::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
4049 /// let x = DetectedBarcode::new().set_or_clear_layout(None::<Layout>);
4050 /// ```
4051 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
4052 where
4053 T: std::convert::Into<crate::model::document::page::Layout>,
4054 {
4055 self.layout = v.map(|x| x.into());
4056 self
4057 }
4058
4059 /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4060 ///
4061 /// # Example
4062 /// ```ignore,no_run
4063 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4064 /// use google_cloud_documentai_v1::model::Barcode;
4065 /// let x = DetectedBarcode::new().set_barcode(Barcode::default()/* use setters */);
4066 /// ```
4067 pub fn set_barcode<T>(mut self, v: T) -> Self
4068 where
4069 T: std::convert::Into<crate::model::Barcode>,
4070 {
4071 self.barcode = std::option::Option::Some(v.into());
4072 self
4073 }
4074
4075 /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4076 ///
4077 /// # Example
4078 /// ```ignore,no_run
4079 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4080 /// use google_cloud_documentai_v1::model::Barcode;
4081 /// let x = DetectedBarcode::new().set_or_clear_barcode(Some(Barcode::default()/* use setters */));
4082 /// let x = DetectedBarcode::new().set_or_clear_barcode(None::<Barcode>);
4083 /// ```
4084 pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
4085 where
4086 T: std::convert::Into<crate::model::Barcode>,
4087 {
4088 self.barcode = v.map(|x| x.into());
4089 self
4090 }
4091 }
4092
4093 impl wkt::message::Message for DetectedBarcode {
4094 fn typename() -> &'static str {
4095 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
4096 }
4097 }
4098
4099 /// Detected language for a structural component.
4100 #[derive(Clone, Default, PartialEq)]
4101 #[non_exhaustive]
4102 pub struct DetectedLanguage {
4103 /// The [BCP-47 language
4104 /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
4105 /// such as `en-US` or `sr-Latn`.
4106 pub language_code: std::string::String,
4107
4108 /// Confidence of detected language. Range `[0, 1]`.
4109 pub confidence: f32,
4110
4111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4112 }
4113
4114 impl DetectedLanguage {
4115 /// Creates a new default instance.
4116 pub fn new() -> Self {
4117 std::default::Default::default()
4118 }
4119
4120 /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
4121 ///
4122 /// # Example
4123 /// ```ignore,no_run
4124 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4125 /// let x = DetectedLanguage::new().set_language_code("example");
4126 /// ```
4127 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4128 mut self,
4129 v: T,
4130 ) -> Self {
4131 self.language_code = v.into();
4132 self
4133 }
4134
4135 /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
4136 ///
4137 /// # Example
4138 /// ```ignore,no_run
4139 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4140 /// let x = DetectedLanguage::new().set_confidence(42.0);
4141 /// ```
4142 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4143 self.confidence = v.into();
4144 self
4145 }
4146 }
4147
4148 impl wkt::message::Message for DetectedLanguage {
4149 fn typename() -> &'static str {
4150 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
4151 }
4152 }
4153
4154 /// Image quality scores for the page image.
4155 #[derive(Clone, Default, PartialEq)]
4156 #[non_exhaustive]
4157 pub struct ImageQualityScores {
4158 /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
4159 pub quality_score: f32,
4160
4161 /// A list of detected defects.
4162 pub detected_defects:
4163 std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
4164
4165 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4166 }
4167
4168 impl ImageQualityScores {
4169 /// Creates a new default instance.
4170 pub fn new() -> Self {
4171 std::default::Default::default()
4172 }
4173
4174 /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
4175 ///
4176 /// # Example
4177 /// ```ignore,no_run
4178 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4179 /// let x = ImageQualityScores::new().set_quality_score(42.0);
4180 /// ```
4181 pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4182 self.quality_score = v.into();
4183 self
4184 }
4185
4186 /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
4187 ///
4188 /// # Example
4189 /// ```ignore,no_run
4190 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4191 /// use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4192 /// let x = ImageQualityScores::new()
4193 /// .set_detected_defects([
4194 /// DetectedDefect::default()/* use setters */,
4195 /// DetectedDefect::default()/* use (different) setters */,
4196 /// ]);
4197 /// ```
4198 pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
4199 where
4200 T: std::iter::IntoIterator<Item = V>,
4201 V: std::convert::Into<
4202 crate::model::document::page::image_quality_scores::DetectedDefect,
4203 >,
4204 {
4205 use std::iter::Iterator;
4206 self.detected_defects = v.into_iter().map(|i| i.into()).collect();
4207 self
4208 }
4209 }
4210
4211 impl wkt::message::Message for ImageQualityScores {
4212 fn typename() -> &'static str {
4213 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
4214 }
4215 }
4216
4217 /// Defines additional types related to [ImageQualityScores].
4218 pub mod image_quality_scores {
4219 #[allow(unused_imports)]
4220 use super::*;
4221
4222 /// Image Quality Defects
4223 #[derive(Clone, Default, PartialEq)]
4224 #[non_exhaustive]
4225 pub struct DetectedDefect {
4226 /// Name of the defect type. Supported values are:
4227 ///
4228 /// - `quality/defect_blurry`
4229 /// - `quality/defect_noisy`
4230 /// - `quality/defect_dark`
4231 /// - `quality/defect_faint`
4232 /// - `quality/defect_text_too_small`
4233 /// - `quality/defect_document_cutoff`
4234 /// - `quality/defect_text_cutoff`
4235 /// - `quality/defect_glare`
4236 pub r#type: std::string::String,
4237
4238 /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
4239 /// strong confidence that the defect exists.
4240 pub confidence: f32,
4241
4242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4243 }
4244
4245 impl DetectedDefect {
4246 /// Creates a new default instance.
4247 pub fn new() -> Self {
4248 std::default::Default::default()
4249 }
4250
4251 /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4256 /// let x = DetectedDefect::new().set_type("example");
4257 /// ```
4258 pub fn set_type<T: std::convert::Into<std::string::String>>(
4259 mut self,
4260 v: T,
4261 ) -> Self {
4262 self.r#type = v.into();
4263 self
4264 }
4265
4266 /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
4267 ///
4268 /// # Example
4269 /// ```ignore,no_run
4270 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4271 /// let x = DetectedDefect::new().set_confidence(42.0);
4272 /// ```
4273 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4274 self.confidence = v.into();
4275 self
4276 }
4277 }
4278
4279 impl wkt::message::Message for DetectedDefect {
4280 fn typename() -> &'static str {
4281 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
4282 }
4283 }
4284 }
4285 }
4286
4287 /// An entity that could be a phrase in the text or a property that belongs to
4288 /// the document. It is a known entity type, such as a person, an organization,
4289 /// or location.
4290 #[derive(Clone, Default, PartialEq)]
4291 #[non_exhaustive]
4292 pub struct Entity {
4293 /// Optional. Provenance of the entity.
4294 /// Text anchor indexing into the
4295 /// [Document.text][google.cloud.documentai.v1.Document.text].
4296 ///
4297 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
4298 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4299
4300 /// Required. Entity type from a schema, for example, `Address`.
4301 pub r#type: std::string::String,
4302
4303 /// Optional. Text value of the entity, for example, `1600 Amphitheatre
4304 /// Pkwy`.
4305 pub mention_text: std::string::String,
4306
4307 /// Optional. Deprecated. Use `id` field instead.
4308 pub mention_id: std::string::String,
4309
4310 /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
4311 pub confidence: f32,
4312
4313 /// Optional. Represents the provenance of this entity wrt. the location on
4314 /// the page where it was found.
4315 pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
4316
4317 /// Optional. Canonical id. This will be a unique value in the entity list
4318 /// for this document.
4319 pub id: std::string::String,
4320
4321 /// Optional. Normalized entity value. Absent if the extracted value could
4322 /// not be converted or the type (for example, address) is not supported for
4323 /// certain parsers. This field is also only populated for certain supported
4324 /// document types.
4325 pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
4326
4327 /// Optional. Entities can be nested to form a hierarchical data structure
4328 /// representing the content in the document.
4329 pub properties: std::vec::Vec<crate::model::document::Entity>,
4330
4331 /// Optional. The history of this annotation.
4332 pub provenance: std::option::Option<crate::model::document::Provenance>,
4333
4334 /// Optional. Whether the entity will be redacted for de-identification
4335 /// purposes.
4336 pub redacted: bool,
4337
4338 /// Optional. Specifies how the entity's value is obtained.
4339 pub method: crate::model::document::entity::Method,
4340
4341 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4342 }
4343
4344 impl Entity {
4345 /// Creates a new default instance.
4346 pub fn new() -> Self {
4347 std::default::Default::default()
4348 }
4349
4350 /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
4351 ///
4352 /// # Example
4353 /// ```ignore,no_run
4354 /// # use google_cloud_documentai_v1::model::document::Entity;
4355 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4356 /// let x = Entity::new().set_text_anchor(TextAnchor::default()/* use setters */);
4357 /// ```
4358 pub fn set_text_anchor<T>(mut self, v: T) -> Self
4359 where
4360 T: std::convert::Into<crate::model::document::TextAnchor>,
4361 {
4362 self.text_anchor = std::option::Option::Some(v.into());
4363 self
4364 }
4365
4366 /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
4367 ///
4368 /// # Example
4369 /// ```ignore,no_run
4370 /// # use google_cloud_documentai_v1::model::document::Entity;
4371 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4372 /// let x = Entity::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
4373 /// let x = Entity::new().set_or_clear_text_anchor(None::<TextAnchor>);
4374 /// ```
4375 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4376 where
4377 T: std::convert::Into<crate::model::document::TextAnchor>,
4378 {
4379 self.text_anchor = v.map(|x| x.into());
4380 self
4381 }
4382
4383 /// Sets the value of [r#type][crate::model::document::Entity::type].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_documentai_v1::model::document::Entity;
4388 /// let x = Entity::new().set_type("example");
4389 /// ```
4390 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.r#type = v.into();
4392 self
4393 }
4394
4395 /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_documentai_v1::model::document::Entity;
4400 /// let x = Entity::new().set_mention_text("example");
4401 /// ```
4402 pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
4403 mut self,
4404 v: T,
4405 ) -> Self {
4406 self.mention_text = v.into();
4407 self
4408 }
4409
4410 /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_documentai_v1::model::document::Entity;
4415 /// let x = Entity::new().set_mention_id("example");
4416 /// ```
4417 pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4418 self.mention_id = v.into();
4419 self
4420 }
4421
4422 /// Sets the value of [confidence][crate::model::document::Entity::confidence].
4423 ///
4424 /// # Example
4425 /// ```ignore,no_run
4426 /// # use google_cloud_documentai_v1::model::document::Entity;
4427 /// let x = Entity::new().set_confidence(42.0);
4428 /// ```
4429 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4430 self.confidence = v.into();
4431 self
4432 }
4433
4434 /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
4435 ///
4436 /// # Example
4437 /// ```ignore,no_run
4438 /// # use google_cloud_documentai_v1::model::document::Entity;
4439 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4440 /// let x = Entity::new().set_page_anchor(PageAnchor::default()/* use setters */);
4441 /// ```
4442 pub fn set_page_anchor<T>(mut self, v: T) -> Self
4443 where
4444 T: std::convert::Into<crate::model::document::PageAnchor>,
4445 {
4446 self.page_anchor = std::option::Option::Some(v.into());
4447 self
4448 }
4449
4450 /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
4451 ///
4452 /// # Example
4453 /// ```ignore,no_run
4454 /// # use google_cloud_documentai_v1::model::document::Entity;
4455 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4456 /// let x = Entity::new().set_or_clear_page_anchor(Some(PageAnchor::default()/* use setters */));
4457 /// let x = Entity::new().set_or_clear_page_anchor(None::<PageAnchor>);
4458 /// ```
4459 pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4460 where
4461 T: std::convert::Into<crate::model::document::PageAnchor>,
4462 {
4463 self.page_anchor = v.map(|x| x.into());
4464 self
4465 }
4466
4467 /// Sets the value of [id][crate::model::document::Entity::id].
4468 ///
4469 /// # Example
4470 /// ```ignore,no_run
4471 /// # use google_cloud_documentai_v1::model::document::Entity;
4472 /// let x = Entity::new().set_id("example");
4473 /// ```
4474 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4475 self.id = v.into();
4476 self
4477 }
4478
4479 /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
4480 ///
4481 /// # Example
4482 /// ```ignore,no_run
4483 /// # use google_cloud_documentai_v1::model::document::Entity;
4484 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4485 /// let x = Entity::new().set_normalized_value(NormalizedValue::default()/* use setters */);
4486 /// ```
4487 pub fn set_normalized_value<T>(mut self, v: T) -> Self
4488 where
4489 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4490 {
4491 self.normalized_value = std::option::Option::Some(v.into());
4492 self
4493 }
4494
4495 /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_documentai_v1::model::document::Entity;
4500 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4501 /// let x = Entity::new().set_or_clear_normalized_value(Some(NormalizedValue::default()/* use setters */));
4502 /// let x = Entity::new().set_or_clear_normalized_value(None::<NormalizedValue>);
4503 /// ```
4504 pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
4505 where
4506 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4507 {
4508 self.normalized_value = v.map(|x| x.into());
4509 self
4510 }
4511
4512 /// Sets the value of [properties][crate::model::document::Entity::properties].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_documentai_v1::model::document::Entity;
4517 /// let x = Entity::new()
4518 /// .set_properties([
4519 /// Entity::default()/* use setters */,
4520 /// Entity::default()/* use (different) setters */,
4521 /// ]);
4522 /// ```
4523 pub fn set_properties<T, V>(mut self, v: T) -> Self
4524 where
4525 T: std::iter::IntoIterator<Item = V>,
4526 V: std::convert::Into<crate::model::document::Entity>,
4527 {
4528 use std::iter::Iterator;
4529 self.properties = v.into_iter().map(|i| i.into()).collect();
4530 self
4531 }
4532
4533 /// Sets the value of [provenance][crate::model::document::Entity::provenance].
4534 ///
4535 /// # Example
4536 /// ```ignore,no_run
4537 /// # use google_cloud_documentai_v1::model::document::Entity;
4538 /// use google_cloud_documentai_v1::model::document::Provenance;
4539 /// let x = Entity::new().set_provenance(Provenance::default()/* use setters */);
4540 /// ```
4541 pub fn set_provenance<T>(mut self, v: T) -> Self
4542 where
4543 T: std::convert::Into<crate::model::document::Provenance>,
4544 {
4545 self.provenance = std::option::Option::Some(v.into());
4546 self
4547 }
4548
4549 /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
4550 ///
4551 /// # Example
4552 /// ```ignore,no_run
4553 /// # use google_cloud_documentai_v1::model::document::Entity;
4554 /// use google_cloud_documentai_v1::model::document::Provenance;
4555 /// let x = Entity::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
4556 /// let x = Entity::new().set_or_clear_provenance(None::<Provenance>);
4557 /// ```
4558 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
4559 where
4560 T: std::convert::Into<crate::model::document::Provenance>,
4561 {
4562 self.provenance = v.map(|x| x.into());
4563 self
4564 }
4565
4566 /// Sets the value of [redacted][crate::model::document::Entity::redacted].
4567 ///
4568 /// # Example
4569 /// ```ignore,no_run
4570 /// # use google_cloud_documentai_v1::model::document::Entity;
4571 /// let x = Entity::new().set_redacted(true);
4572 /// ```
4573 pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4574 self.redacted = v.into();
4575 self
4576 }
4577
4578 /// Sets the value of [method][crate::model::document::Entity::method].
4579 ///
4580 /// # Example
4581 /// ```ignore,no_run
4582 /// # use google_cloud_documentai_v1::model::document::Entity;
4583 /// use google_cloud_documentai_v1::model::document::entity::Method;
4584 /// let x0 = Entity::new().set_method(Method::Extract);
4585 /// let x1 = Entity::new().set_method(Method::Derive);
4586 /// ```
4587 pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
4588 mut self,
4589 v: T,
4590 ) -> Self {
4591 self.method = v.into();
4592 self
4593 }
4594 }
4595
4596 impl wkt::message::Message for Entity {
4597 fn typename() -> &'static str {
4598 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
4599 }
4600 }
4601
4602 /// Defines additional types related to [Entity].
4603 pub mod entity {
4604 #[allow(unused_imports)]
4605 use super::*;
4606
4607 /// Parsed and normalized entity value.
4608 #[derive(Clone, Default, PartialEq)]
4609 #[non_exhaustive]
4610 pub struct NormalizedValue {
4611 /// Optional. An optional field to store a normalized string.
4612 /// For some entity types, one of respective `structured_value` fields may
4613 /// also be populated. Also not all the types of `structured_value` will be
4614 /// normalized. For example, some processors may not generate `float`
4615 /// or `integer` normalized text by default.
4616 ///
4617 /// Below are sample formats mapped to structured values.
4618 ///
4619 /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
4620 /// - Date type (`date_value`) is in the ISO 8601 text format.
4621 /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
4622 pub text: std::string::String,
4623
4624 /// An optional structured entity value.
4625 /// Must match entity type defined in schema if
4626 /// known. If this field is present, the `text` field could also be
4627 /// populated.
4628 pub structured_value: std::option::Option<
4629 crate::model::document::entity::normalized_value::StructuredValue,
4630 >,
4631
4632 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4633 }
4634
4635 impl NormalizedValue {
4636 /// Creates a new default instance.
4637 pub fn new() -> Self {
4638 std::default::Default::default()
4639 }
4640
4641 /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
4642 ///
4643 /// # Example
4644 /// ```ignore,no_run
4645 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4646 /// let x = NormalizedValue::new().set_text("example");
4647 /// ```
4648 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4649 self.text = v.into();
4650 self
4651 }
4652
4653 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
4654 ///
4655 /// Note that all the setters affecting `structured_value` are mutually
4656 /// exclusive.
4657 ///
4658 /// # Example
4659 /// ```ignore,no_run
4660 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4661 /// use google_cloud_documentai_v1::model::document::entity::normalized_value::StructuredValue;
4662 /// let x = NormalizedValue::new().set_structured_value(Some(StructuredValue::BooleanValue(true)));
4663 /// ```
4664 pub fn set_structured_value<
4665 T: std::convert::Into<
4666 std::option::Option<
4667 crate::model::document::entity::normalized_value::StructuredValue,
4668 >,
4669 >,
4670 >(
4671 mut self,
4672 v: T,
4673 ) -> Self {
4674 self.structured_value = v.into();
4675 self
4676 }
4677
4678 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4679 /// if it holds a `MoneyValue`, `None` if the field is not set or
4680 /// holds a different branch.
4681 pub fn money_value(
4682 &self,
4683 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Money>>
4684 {
4685 #[allow(unreachable_patterns)]
4686 self.structured_value.as_ref().and_then(|v| match v {
4687 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
4688 _ => std::option::Option::None,
4689 })
4690 }
4691
4692 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4693 /// to hold a `MoneyValue`.
4694 ///
4695 /// Note that all the setters affecting `structured_value` are
4696 /// mutually exclusive.
4697 ///
4698 /// # Example
4699 /// ```ignore,no_run
4700 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4701 /// use google_cloud_type::model::Money;
4702 /// let x = NormalizedValue::new().set_money_value(Money::default()/* use setters */);
4703 /// assert!(x.money_value().is_some());
4704 /// assert!(x.date_value().is_none());
4705 /// assert!(x.datetime_value().is_none());
4706 /// assert!(x.address_value().is_none());
4707 /// assert!(x.boolean_value().is_none());
4708 /// assert!(x.integer_value().is_none());
4709 /// assert!(x.float_value().is_none());
4710 /// assert!(x.signature_value().is_none());
4711 /// ```
4712 pub fn set_money_value<
4713 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Money>>,
4714 >(
4715 mut self,
4716 v: T,
4717 ) -> Self {
4718 self.structured_value = std::option::Option::Some(
4719 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
4720 v.into(),
4721 ),
4722 );
4723 self
4724 }
4725
4726 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4727 /// if it holds a `DateValue`, `None` if the field is not set or
4728 /// holds a different branch.
4729 pub fn date_value(
4730 &self,
4731 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
4732 #[allow(unreachable_patterns)]
4733 self.structured_value.as_ref().and_then(|v| match v {
4734 crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
4735 _ => std::option::Option::None,
4736 })
4737 }
4738
4739 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4740 /// to hold a `DateValue`.
4741 ///
4742 /// Note that all the setters affecting `structured_value` are
4743 /// mutually exclusive.
4744 ///
4745 /// # Example
4746 /// ```ignore,no_run
4747 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4748 /// use google_cloud_type::model::Date;
4749 /// let x = NormalizedValue::new().set_date_value(Date::default()/* use setters */);
4750 /// assert!(x.date_value().is_some());
4751 /// assert!(x.money_value().is_none());
4752 /// assert!(x.datetime_value().is_none());
4753 /// assert!(x.address_value().is_none());
4754 /// assert!(x.boolean_value().is_none());
4755 /// assert!(x.integer_value().is_none());
4756 /// assert!(x.float_value().is_none());
4757 /// assert!(x.signature_value().is_none());
4758 /// ```
4759 pub fn set_date_value<
4760 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
4761 >(
4762 mut self,
4763 v: T,
4764 ) -> Self {
4765 self.structured_value = std::option::Option::Some(
4766 crate::model::document::entity::normalized_value::StructuredValue::DateValue(
4767 v.into(),
4768 ),
4769 );
4770 self
4771 }
4772
4773 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4774 /// if it holds a `DatetimeValue`, `None` if the field is not set or
4775 /// holds a different branch.
4776 pub fn datetime_value(
4777 &self,
4778 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::DateTime>>
4779 {
4780 #[allow(unreachable_patterns)]
4781 self.structured_value.as_ref().and_then(|v| match v {
4782 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
4783 _ => std::option::Option::None,
4784 })
4785 }
4786
4787 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4788 /// to hold a `DatetimeValue`.
4789 ///
4790 /// Note that all the setters affecting `structured_value` are
4791 /// mutually exclusive.
4792 ///
4793 /// # Example
4794 /// ```ignore,no_run
4795 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4796 /// use google_cloud_type::model::DateTime;
4797 /// let x = NormalizedValue::new().set_datetime_value(DateTime::default()/* use setters */);
4798 /// assert!(x.datetime_value().is_some());
4799 /// assert!(x.money_value().is_none());
4800 /// assert!(x.date_value().is_none());
4801 /// assert!(x.address_value().is_none());
4802 /// assert!(x.boolean_value().is_none());
4803 /// assert!(x.integer_value().is_none());
4804 /// assert!(x.float_value().is_none());
4805 /// assert!(x.signature_value().is_none());
4806 /// ```
4807 pub fn set_datetime_value<
4808 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::DateTime>>,
4809 >(
4810 mut self,
4811 v: T,
4812 ) -> Self {
4813 self.structured_value = std::option::Option::Some(
4814 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
4815 v.into()
4816 )
4817 );
4818 self
4819 }
4820
4821 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4822 /// if it holds a `AddressValue`, `None` if the field is not set or
4823 /// holds a different branch.
4824 pub fn address_value(
4825 &self,
4826 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>>
4827 {
4828 #[allow(unreachable_patterns)]
4829 self.structured_value.as_ref().and_then(|v| match v {
4830 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
4831 _ => std::option::Option::None,
4832 })
4833 }
4834
4835 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4836 /// to hold a `AddressValue`.
4837 ///
4838 /// Note that all the setters affecting `structured_value` are
4839 /// mutually exclusive.
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4844 /// use google_cloud_type::model::PostalAddress;
4845 /// let x = NormalizedValue::new().set_address_value(PostalAddress::default()/* use setters */);
4846 /// assert!(x.address_value().is_some());
4847 /// assert!(x.money_value().is_none());
4848 /// assert!(x.date_value().is_none());
4849 /// assert!(x.datetime_value().is_none());
4850 /// assert!(x.boolean_value().is_none());
4851 /// assert!(x.integer_value().is_none());
4852 /// assert!(x.float_value().is_none());
4853 /// assert!(x.signature_value().is_none());
4854 /// ```
4855 pub fn set_address_value<
4856 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
4857 >(
4858 mut self,
4859 v: T,
4860 ) -> Self {
4861 self.structured_value = std::option::Option::Some(
4862 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
4863 v.into(),
4864 ),
4865 );
4866 self
4867 }
4868
4869 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4870 /// if it holds a `BooleanValue`, `None` if the field is not set or
4871 /// holds a different branch.
4872 pub fn boolean_value(&self) -> std::option::Option<&bool> {
4873 #[allow(unreachable_patterns)]
4874 self.structured_value.as_ref().and_then(|v| match v {
4875 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
4876 _ => std::option::Option::None,
4877 })
4878 }
4879
4880 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4881 /// to hold a `BooleanValue`.
4882 ///
4883 /// Note that all the setters affecting `structured_value` are
4884 /// mutually exclusive.
4885 ///
4886 /// # Example
4887 /// ```ignore,no_run
4888 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4889 /// let x = NormalizedValue::new().set_boolean_value(true);
4890 /// assert!(x.boolean_value().is_some());
4891 /// assert!(x.money_value().is_none());
4892 /// assert!(x.date_value().is_none());
4893 /// assert!(x.datetime_value().is_none());
4894 /// assert!(x.address_value().is_none());
4895 /// assert!(x.integer_value().is_none());
4896 /// assert!(x.float_value().is_none());
4897 /// assert!(x.signature_value().is_none());
4898 /// ```
4899 pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4900 self.structured_value = std::option::Option::Some(
4901 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
4902 v.into(),
4903 ),
4904 );
4905 self
4906 }
4907
4908 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4909 /// if it holds a `IntegerValue`, `None` if the field is not set or
4910 /// holds a different branch.
4911 pub fn integer_value(&self) -> std::option::Option<&i32> {
4912 #[allow(unreachable_patterns)]
4913 self.structured_value.as_ref().and_then(|v| match v {
4914 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
4915 _ => std::option::Option::None,
4916 })
4917 }
4918
4919 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4920 /// to hold a `IntegerValue`.
4921 ///
4922 /// Note that all the setters affecting `structured_value` are
4923 /// mutually exclusive.
4924 ///
4925 /// # Example
4926 /// ```ignore,no_run
4927 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4928 /// let x = NormalizedValue::new().set_integer_value(42);
4929 /// assert!(x.integer_value().is_some());
4930 /// assert!(x.money_value().is_none());
4931 /// assert!(x.date_value().is_none());
4932 /// assert!(x.datetime_value().is_none());
4933 /// assert!(x.address_value().is_none());
4934 /// assert!(x.boolean_value().is_none());
4935 /// assert!(x.float_value().is_none());
4936 /// assert!(x.signature_value().is_none());
4937 /// ```
4938 pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4939 self.structured_value = std::option::Option::Some(
4940 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
4941 v.into(),
4942 ),
4943 );
4944 self
4945 }
4946
4947 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4948 /// if it holds a `FloatValue`, `None` if the field is not set or
4949 /// holds a different branch.
4950 pub fn float_value(&self) -> std::option::Option<&f32> {
4951 #[allow(unreachable_patterns)]
4952 self.structured_value.as_ref().and_then(|v| match v {
4953 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
4954 _ => std::option::Option::None,
4955 })
4956 }
4957
4958 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4959 /// to hold a `FloatValue`.
4960 ///
4961 /// Note that all the setters affecting `structured_value` are
4962 /// mutually exclusive.
4963 ///
4964 /// # Example
4965 /// ```ignore,no_run
4966 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4967 /// let x = NormalizedValue::new().set_float_value(42.0);
4968 /// assert!(x.float_value().is_some());
4969 /// assert!(x.money_value().is_none());
4970 /// assert!(x.date_value().is_none());
4971 /// assert!(x.datetime_value().is_none());
4972 /// assert!(x.address_value().is_none());
4973 /// assert!(x.boolean_value().is_none());
4974 /// assert!(x.integer_value().is_none());
4975 /// assert!(x.signature_value().is_none());
4976 /// ```
4977 pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4978 self.structured_value = std::option::Option::Some(
4979 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
4980 v.into(),
4981 ),
4982 );
4983 self
4984 }
4985
4986 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4987 /// if it holds a `SignatureValue`, `None` if the field is not set or
4988 /// holds a different branch.
4989 pub fn signature_value(&self) -> std::option::Option<&bool> {
4990 #[allow(unreachable_patterns)]
4991 self.structured_value.as_ref().and_then(|v| match v {
4992 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
4993 _ => std::option::Option::None,
4994 })
4995 }
4996
4997 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4998 /// to hold a `SignatureValue`.
4999 ///
5000 /// Note that all the setters affecting `structured_value` are
5001 /// mutually exclusive.
5002 ///
5003 /// # Example
5004 /// ```ignore,no_run
5005 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
5006 /// let x = NormalizedValue::new().set_signature_value(true);
5007 /// assert!(x.signature_value().is_some());
5008 /// assert!(x.money_value().is_none());
5009 /// assert!(x.date_value().is_none());
5010 /// assert!(x.datetime_value().is_none());
5011 /// assert!(x.address_value().is_none());
5012 /// assert!(x.boolean_value().is_none());
5013 /// assert!(x.integer_value().is_none());
5014 /// assert!(x.float_value().is_none());
5015 /// ```
5016 pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5017 self.structured_value = std::option::Option::Some(
5018 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
5019 v.into()
5020 )
5021 );
5022 self
5023 }
5024 }
5025
5026 impl wkt::message::Message for NormalizedValue {
5027 fn typename() -> &'static str {
5028 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
5029 }
5030 }
5031
5032 /// Defines additional types related to [NormalizedValue].
5033 pub mod normalized_value {
5034 #[allow(unused_imports)]
5035 use super::*;
5036
5037 /// An optional structured entity value.
5038 /// Must match entity type defined in schema if
5039 /// known. If this field is present, the `text` field could also be
5040 /// populated.
5041 #[derive(Clone, Debug, PartialEq)]
5042 #[non_exhaustive]
5043 pub enum StructuredValue {
5044 /// Money value. See also:
5045 /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
5046 MoneyValue(std::boxed::Box<google_cloud_type::model::Money>),
5047 /// Date value. Includes year, month, day. See also:
5048 /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
5049 DateValue(std::boxed::Box<google_cloud_type::model::Date>),
5050 /// DateTime value. Includes date, time, and timezone. See also:
5051 /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
5052 DatetimeValue(std::boxed::Box<google_cloud_type::model::DateTime>),
5053 /// Postal address. See also:
5054 /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
5055 AddressValue(std::boxed::Box<google_cloud_type::model::PostalAddress>),
5056 /// Boolean value. Can be used for entities with binary values, or for
5057 /// checkboxes.
5058 BooleanValue(bool),
5059 /// Integer value.
5060 IntegerValue(i32),
5061 /// Float value.
5062 FloatValue(f32),
5063 /// A signature - a graphical representation of a person's name,
5064 /// often used to sign a document.
5065 SignatureValue(bool),
5066 }
5067 }
5068
5069 /// Specifies how the entity's value is obtained.
5070 ///
5071 /// # Working with unknown values
5072 ///
5073 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5074 /// additional enum variants at any time. Adding new variants is not considered
5075 /// a breaking change. Applications should write their code in anticipation of:
5076 ///
5077 /// - New values appearing in future releases of the client library, **and**
5078 /// - New values received dynamically, without application changes.
5079 ///
5080 /// Please consult the [Working with enums] section in the user guide for some
5081 /// guidelines.
5082 ///
5083 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5084 #[derive(Clone, Debug, PartialEq)]
5085 #[non_exhaustive]
5086 pub enum Method {
5087 /// When the method is not specified, it should be treated as `EXTRACT`.
5088 Unspecified,
5089 /// The entity's value is directly extracted as-is from the document
5090 /// text.
5091 Extract,
5092 /// The entity's value is derived through inference and is not
5093 /// necessarily an exact text extraction from the document.
5094 Derive,
5095 /// If set, the enum was initialized with an unknown value.
5096 ///
5097 /// Applications can examine the value using [Method::value] or
5098 /// [Method::name].
5099 UnknownValue(method::UnknownValue),
5100 }
5101
5102 #[doc(hidden)]
5103 pub mod method {
5104 #[allow(unused_imports)]
5105 use super::*;
5106 #[derive(Clone, Debug, PartialEq)]
5107 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5108 }
5109
5110 impl Method {
5111 /// Gets the enum value.
5112 ///
5113 /// Returns `None` if the enum contains an unknown value deserialized from
5114 /// the string representation of enums.
5115 pub fn value(&self) -> std::option::Option<i32> {
5116 match self {
5117 Self::Unspecified => std::option::Option::Some(0),
5118 Self::Extract => std::option::Option::Some(1),
5119 Self::Derive => std::option::Option::Some(2),
5120 Self::UnknownValue(u) => u.0.value(),
5121 }
5122 }
5123
5124 /// Gets the enum value as a string.
5125 ///
5126 /// Returns `None` if the enum contains an unknown value deserialized from
5127 /// the integer representation of enums.
5128 pub fn name(&self) -> std::option::Option<&str> {
5129 match self {
5130 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
5131 Self::Extract => std::option::Option::Some("EXTRACT"),
5132 Self::Derive => std::option::Option::Some("DERIVE"),
5133 Self::UnknownValue(u) => u.0.name(),
5134 }
5135 }
5136 }
5137
5138 impl std::default::Default for Method {
5139 fn default() -> Self {
5140 use std::convert::From;
5141 Self::from(0)
5142 }
5143 }
5144
5145 impl std::fmt::Display for Method {
5146 fn fmt(
5147 &self,
5148 f: &mut std::fmt::Formatter<'_>,
5149 ) -> std::result::Result<(), std::fmt::Error> {
5150 wkt::internal::display_enum(f, self.name(), self.value())
5151 }
5152 }
5153
5154 impl std::convert::From<i32> for Method {
5155 fn from(value: i32) -> Self {
5156 match value {
5157 0 => Self::Unspecified,
5158 1 => Self::Extract,
5159 2 => Self::Derive,
5160 _ => Self::UnknownValue(method::UnknownValue(
5161 wkt::internal::UnknownEnumValue::Integer(value),
5162 )),
5163 }
5164 }
5165 }
5166
5167 impl std::convert::From<&str> for Method {
5168 fn from(value: &str) -> Self {
5169 use std::string::ToString;
5170 match value {
5171 "METHOD_UNSPECIFIED" => Self::Unspecified,
5172 "EXTRACT" => Self::Extract,
5173 "DERIVE" => Self::Derive,
5174 _ => Self::UnknownValue(method::UnknownValue(
5175 wkt::internal::UnknownEnumValue::String(value.to_string()),
5176 )),
5177 }
5178 }
5179 }
5180
5181 impl serde::ser::Serialize for Method {
5182 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5183 where
5184 S: serde::Serializer,
5185 {
5186 match self {
5187 Self::Unspecified => serializer.serialize_i32(0),
5188 Self::Extract => serializer.serialize_i32(1),
5189 Self::Derive => serializer.serialize_i32(2),
5190 Self::UnknownValue(u) => u.0.serialize(serializer),
5191 }
5192 }
5193 }
5194
5195 impl<'de> serde::de::Deserialize<'de> for Method {
5196 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5197 where
5198 D: serde::Deserializer<'de>,
5199 {
5200 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
5201 ".google.cloud.documentai.v1.Document.Entity.Method",
5202 ))
5203 }
5204 }
5205 }
5206
5207 /// Relationship between
5208 /// [Entities][google.cloud.documentai.v1.Document.Entity].
5209 ///
5210 /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
5211 #[derive(Clone, Default, PartialEq)]
5212 #[non_exhaustive]
5213 pub struct EntityRelation {
5214 /// Subject entity id.
5215 pub subject_id: std::string::String,
5216
5217 /// Object entity id.
5218 pub object_id: std::string::String,
5219
5220 /// Relationship description.
5221 pub relation: std::string::String,
5222
5223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5224 }
5225
5226 impl EntityRelation {
5227 /// Creates a new default instance.
5228 pub fn new() -> Self {
5229 std::default::Default::default()
5230 }
5231
5232 /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
5233 ///
5234 /// # Example
5235 /// ```ignore,no_run
5236 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5237 /// let x = EntityRelation::new().set_subject_id("example");
5238 /// ```
5239 pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5240 self.subject_id = v.into();
5241 self
5242 }
5243
5244 /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
5245 ///
5246 /// # Example
5247 /// ```ignore,no_run
5248 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5249 /// let x = EntityRelation::new().set_object_id("example");
5250 /// ```
5251 pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5252 self.object_id = v.into();
5253 self
5254 }
5255
5256 /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
5257 ///
5258 /// # Example
5259 /// ```ignore,no_run
5260 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5261 /// let x = EntityRelation::new().set_relation("example");
5262 /// ```
5263 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5264 self.relation = v.into();
5265 self
5266 }
5267 }
5268
5269 impl wkt::message::Message for EntityRelation {
5270 fn typename() -> &'static str {
5271 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
5272 }
5273 }
5274
5275 /// Text reference indexing into the
5276 /// [Document.text][google.cloud.documentai.v1.Document.text].
5277 ///
5278 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5279 #[derive(Clone, Default, PartialEq)]
5280 #[non_exhaustive]
5281 pub struct TextAnchor {
5282 /// The text segments from the
5283 /// [Document.text][google.cloud.documentai.v1.Document.text].
5284 ///
5285 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5286 pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
5287
5288 /// Contains the content of the text span so that users do
5289 /// not have to look it up in the text_segments. It is always
5290 /// populated for formFields.
5291 pub content: std::string::String,
5292
5293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5294 }
5295
5296 impl TextAnchor {
5297 /// Creates a new default instance.
5298 pub fn new() -> Self {
5299 std::default::Default::default()
5300 }
5301
5302 /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
5303 ///
5304 /// # Example
5305 /// ```ignore,no_run
5306 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5307 /// use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5308 /// let x = TextAnchor::new()
5309 /// .set_text_segments([
5310 /// TextSegment::default()/* use setters */,
5311 /// TextSegment::default()/* use (different) setters */,
5312 /// ]);
5313 /// ```
5314 pub fn set_text_segments<T, V>(mut self, v: T) -> Self
5315 where
5316 T: std::iter::IntoIterator<Item = V>,
5317 V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
5318 {
5319 use std::iter::Iterator;
5320 self.text_segments = v.into_iter().map(|i| i.into()).collect();
5321 self
5322 }
5323
5324 /// Sets the value of [content][crate::model::document::TextAnchor::content].
5325 ///
5326 /// # Example
5327 /// ```ignore,no_run
5328 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5329 /// let x = TextAnchor::new().set_content("example");
5330 /// ```
5331 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5332 self.content = v.into();
5333 self
5334 }
5335 }
5336
5337 impl wkt::message::Message for TextAnchor {
5338 fn typename() -> &'static str {
5339 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
5340 }
5341 }
5342
5343 /// Defines additional types related to [TextAnchor].
5344 pub mod text_anchor {
5345 #[allow(unused_imports)]
5346 use super::*;
5347
5348 /// A text segment in the
5349 /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
5350 /// may be out of bounds which indicate that the text extends into another
5351 /// document shard for large sharded documents. See
5352 /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
5353 ///
5354 /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
5355 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5356 #[derive(Clone, Default, PartialEq)]
5357 #[non_exhaustive]
5358 pub struct TextSegment {
5359 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5360 /// start UTF-8 char index in the
5361 /// [Document.text][google.cloud.documentai.v1.Document.text].
5362 ///
5363 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5364 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5365 pub start_index: i64,
5366
5367 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5368 /// half open end UTF-8 char index in the
5369 /// [Document.text][google.cloud.documentai.v1.Document.text].
5370 ///
5371 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5372 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5373 pub end_index: i64,
5374
5375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5376 }
5377
5378 impl TextSegment {
5379 /// Creates a new default instance.
5380 pub fn new() -> Self {
5381 std::default::Default::default()
5382 }
5383
5384 /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
5385 ///
5386 /// # Example
5387 /// ```ignore,no_run
5388 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5389 /// let x = TextSegment::new().set_start_index(42);
5390 /// ```
5391 pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5392 self.start_index = v.into();
5393 self
5394 }
5395
5396 /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
5397 ///
5398 /// # Example
5399 /// ```ignore,no_run
5400 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5401 /// let x = TextSegment::new().set_end_index(42);
5402 /// ```
5403 pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5404 self.end_index = v.into();
5405 self
5406 }
5407 }
5408
5409 impl wkt::message::Message for TextSegment {
5410 fn typename() -> &'static str {
5411 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
5412 }
5413 }
5414 }
5415
5416 /// Referencing the visual context of the entity in the
5417 /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
5418 /// can be cross-page, consist of multiple bounding polygons and optionally
5419 /// reference specific layout element types.
5420 ///
5421 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5422 #[derive(Clone, Default, PartialEq)]
5423 #[non_exhaustive]
5424 pub struct PageAnchor {
5425 /// One or more references to visual page elements
5426 pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
5427
5428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5429 }
5430
5431 impl PageAnchor {
5432 /// Creates a new default instance.
5433 pub fn new() -> Self {
5434 std::default::Default::default()
5435 }
5436
5437 /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_documentai_v1::model::document::PageAnchor;
5442 /// use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5443 /// let x = PageAnchor::new()
5444 /// .set_page_refs([
5445 /// PageRef::default()/* use setters */,
5446 /// PageRef::default()/* use (different) setters */,
5447 /// ]);
5448 /// ```
5449 pub fn set_page_refs<T, V>(mut self, v: T) -> Self
5450 where
5451 T: std::iter::IntoIterator<Item = V>,
5452 V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
5453 {
5454 use std::iter::Iterator;
5455 self.page_refs = v.into_iter().map(|i| i.into()).collect();
5456 self
5457 }
5458 }
5459
5460 impl wkt::message::Message for PageAnchor {
5461 fn typename() -> &'static str {
5462 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
5463 }
5464 }
5465
5466 /// Defines additional types related to [PageAnchor].
5467 pub mod page_anchor {
5468 #[allow(unused_imports)]
5469 use super::*;
5470
5471 /// Represents a weak reference to a page element within a document.
5472 #[derive(Clone, Default, PartialEq)]
5473 #[non_exhaustive]
5474 pub struct PageRef {
5475 /// Required. Index into the
5476 /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
5477 /// for example using
5478 /// `[Document.pages][page_refs.page]` to locate the related page element.
5479 /// This field is skipped when its value is the default `0`. See
5480 /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
5481 ///
5482 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5483 pub page: i64,
5484
5485 /// Optional. The type of the layout element that is being referenced if
5486 /// any.
5487 pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
5488
5489 /// Optional. Deprecated. Use
5490 /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
5491 /// instead.
5492 ///
5493 /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
5494 #[deprecated]
5495 pub layout_id: std::string::String,
5496
5497 /// Optional. Identifies the bounding polygon of a layout element on the
5498 /// page. If `layout_type` is set, the bounding polygon must be exactly the
5499 /// same to the layout element it's referring to.
5500 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
5501
5502 /// Optional. Confidence of detected page element, if applicable. Range
5503 /// `[0, 1]`.
5504 pub confidence: f32,
5505
5506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5507 }
5508
5509 impl PageRef {
5510 /// Creates a new default instance.
5511 pub fn new() -> Self {
5512 std::default::Default::default()
5513 }
5514
5515 /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
5516 ///
5517 /// # Example
5518 /// ```ignore,no_run
5519 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5520 /// let x = PageRef::new().set_page(42);
5521 /// ```
5522 pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5523 self.page = v.into();
5524 self
5525 }
5526
5527 /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
5528 ///
5529 /// # Example
5530 /// ```ignore,no_run
5531 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5532 /// use google_cloud_documentai_v1::model::document::page_anchor::page_ref::LayoutType;
5533 /// let x0 = PageRef::new().set_layout_type(LayoutType::Block);
5534 /// let x1 = PageRef::new().set_layout_type(LayoutType::Paragraph);
5535 /// let x2 = PageRef::new().set_layout_type(LayoutType::Line);
5536 /// ```
5537 pub fn set_layout_type<
5538 T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
5539 >(
5540 mut self,
5541 v: T,
5542 ) -> Self {
5543 self.layout_type = v.into();
5544 self
5545 }
5546
5547 /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
5548 ///
5549 /// # Example
5550 /// ```ignore,no_run
5551 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5552 /// let x = PageRef::new().set_layout_id("example");
5553 /// ```
5554 #[deprecated]
5555 pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
5556 mut self,
5557 v: T,
5558 ) -> Self {
5559 self.layout_id = v.into();
5560 self
5561 }
5562
5563 /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5564 ///
5565 /// # Example
5566 /// ```ignore,no_run
5567 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5568 /// use google_cloud_documentai_v1::model::BoundingPoly;
5569 /// let x = PageRef::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
5570 /// ```
5571 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
5572 where
5573 T: std::convert::Into<crate::model::BoundingPoly>,
5574 {
5575 self.bounding_poly = std::option::Option::Some(v.into());
5576 self
5577 }
5578
5579 /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5580 ///
5581 /// # Example
5582 /// ```ignore,no_run
5583 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5584 /// use google_cloud_documentai_v1::model::BoundingPoly;
5585 /// let x = PageRef::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
5586 /// let x = PageRef::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
5587 /// ```
5588 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
5589 where
5590 T: std::convert::Into<crate::model::BoundingPoly>,
5591 {
5592 self.bounding_poly = v.map(|x| x.into());
5593 self
5594 }
5595
5596 /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
5597 ///
5598 /// # Example
5599 /// ```ignore,no_run
5600 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5601 /// let x = PageRef::new().set_confidence(42.0);
5602 /// ```
5603 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5604 self.confidence = v.into();
5605 self
5606 }
5607 }
5608
5609 impl wkt::message::Message for PageRef {
5610 fn typename() -> &'static str {
5611 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
5612 }
5613 }
5614
5615 /// Defines additional types related to [PageRef].
5616 pub mod page_ref {
5617 #[allow(unused_imports)]
5618 use super::*;
5619
5620 /// The type of layout that is being referenced.
5621 ///
5622 /// # Working with unknown values
5623 ///
5624 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5625 /// additional enum variants at any time. Adding new variants is not considered
5626 /// a breaking change. Applications should write their code in anticipation of:
5627 ///
5628 /// - New values appearing in future releases of the client library, **and**
5629 /// - New values received dynamically, without application changes.
5630 ///
5631 /// Please consult the [Working with enums] section in the user guide for some
5632 /// guidelines.
5633 ///
5634 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5635 #[derive(Clone, Debug, PartialEq)]
5636 #[non_exhaustive]
5637 pub enum LayoutType {
5638 /// Layout Unspecified.
5639 Unspecified,
5640 /// References a
5641 /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
5642 /// element.
5643 ///
5644 /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
5645 Block,
5646 /// References a
5647 /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
5648 /// element.
5649 ///
5650 /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
5651 Paragraph,
5652 /// References a
5653 /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
5654 ///
5655 /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
5656 Line,
5657 /// References a
5658 /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
5659 /// element.
5660 ///
5661 /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
5662 Token,
5663 /// References a
5664 /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
5665 /// element.
5666 ///
5667 /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
5668 VisualElement,
5669 /// Refrrences a
5670 /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
5671 /// element.
5672 ///
5673 /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
5674 Table,
5675 /// References a
5676 /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
5677 /// element.
5678 ///
5679 /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
5680 FormField,
5681 /// If set, the enum was initialized with an unknown value.
5682 ///
5683 /// Applications can examine the value using [LayoutType::value] or
5684 /// [LayoutType::name].
5685 UnknownValue(layout_type::UnknownValue),
5686 }
5687
5688 #[doc(hidden)]
5689 pub mod layout_type {
5690 #[allow(unused_imports)]
5691 use super::*;
5692 #[derive(Clone, Debug, PartialEq)]
5693 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5694 }
5695
5696 impl LayoutType {
5697 /// Gets the enum value.
5698 ///
5699 /// Returns `None` if the enum contains an unknown value deserialized from
5700 /// the string representation of enums.
5701 pub fn value(&self) -> std::option::Option<i32> {
5702 match self {
5703 Self::Unspecified => std::option::Option::Some(0),
5704 Self::Block => std::option::Option::Some(1),
5705 Self::Paragraph => std::option::Option::Some(2),
5706 Self::Line => std::option::Option::Some(3),
5707 Self::Token => std::option::Option::Some(4),
5708 Self::VisualElement => std::option::Option::Some(5),
5709 Self::Table => std::option::Option::Some(6),
5710 Self::FormField => std::option::Option::Some(7),
5711 Self::UnknownValue(u) => u.0.value(),
5712 }
5713 }
5714
5715 /// Gets the enum value as a string.
5716 ///
5717 /// Returns `None` if the enum contains an unknown value deserialized from
5718 /// the integer representation of enums.
5719 pub fn name(&self) -> std::option::Option<&str> {
5720 match self {
5721 Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
5722 Self::Block => std::option::Option::Some("BLOCK"),
5723 Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
5724 Self::Line => std::option::Option::Some("LINE"),
5725 Self::Token => std::option::Option::Some("TOKEN"),
5726 Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
5727 Self::Table => std::option::Option::Some("TABLE"),
5728 Self::FormField => std::option::Option::Some("FORM_FIELD"),
5729 Self::UnknownValue(u) => u.0.name(),
5730 }
5731 }
5732 }
5733
5734 impl std::default::Default for LayoutType {
5735 fn default() -> Self {
5736 use std::convert::From;
5737 Self::from(0)
5738 }
5739 }
5740
5741 impl std::fmt::Display for LayoutType {
5742 fn fmt(
5743 &self,
5744 f: &mut std::fmt::Formatter<'_>,
5745 ) -> std::result::Result<(), std::fmt::Error> {
5746 wkt::internal::display_enum(f, self.name(), self.value())
5747 }
5748 }
5749
5750 impl std::convert::From<i32> for LayoutType {
5751 fn from(value: i32) -> Self {
5752 match value {
5753 0 => Self::Unspecified,
5754 1 => Self::Block,
5755 2 => Self::Paragraph,
5756 3 => Self::Line,
5757 4 => Self::Token,
5758 5 => Self::VisualElement,
5759 6 => Self::Table,
5760 7 => Self::FormField,
5761 _ => Self::UnknownValue(layout_type::UnknownValue(
5762 wkt::internal::UnknownEnumValue::Integer(value),
5763 )),
5764 }
5765 }
5766 }
5767
5768 impl std::convert::From<&str> for LayoutType {
5769 fn from(value: &str) -> Self {
5770 use std::string::ToString;
5771 match value {
5772 "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
5773 "BLOCK" => Self::Block,
5774 "PARAGRAPH" => Self::Paragraph,
5775 "LINE" => Self::Line,
5776 "TOKEN" => Self::Token,
5777 "VISUAL_ELEMENT" => Self::VisualElement,
5778 "TABLE" => Self::Table,
5779 "FORM_FIELD" => Self::FormField,
5780 _ => Self::UnknownValue(layout_type::UnknownValue(
5781 wkt::internal::UnknownEnumValue::String(value.to_string()),
5782 )),
5783 }
5784 }
5785 }
5786
5787 impl serde::ser::Serialize for LayoutType {
5788 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5789 where
5790 S: serde::Serializer,
5791 {
5792 match self {
5793 Self::Unspecified => serializer.serialize_i32(0),
5794 Self::Block => serializer.serialize_i32(1),
5795 Self::Paragraph => serializer.serialize_i32(2),
5796 Self::Line => serializer.serialize_i32(3),
5797 Self::Token => serializer.serialize_i32(4),
5798 Self::VisualElement => serializer.serialize_i32(5),
5799 Self::Table => serializer.serialize_i32(6),
5800 Self::FormField => serializer.serialize_i32(7),
5801 Self::UnknownValue(u) => u.0.serialize(serializer),
5802 }
5803 }
5804 }
5805
5806 impl<'de> serde::de::Deserialize<'de> for LayoutType {
5807 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5808 where
5809 D: serde::Deserializer<'de>,
5810 {
5811 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
5812 ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
5813 ))
5814 }
5815 }
5816 }
5817 }
5818
5819 /// Structure to identify provenance relationships between annotations in
5820 /// different revisions.
5821 #[derive(Clone, Default, PartialEq)]
5822 #[non_exhaustive]
5823 pub struct Provenance {
5824 /// The index of the revision that produced this element.
5825 #[deprecated]
5826 pub revision: i32,
5827
5828 /// The Id of this operation. Needs to be unique within the scope of the
5829 /// revision.
5830 #[deprecated]
5831 pub id: i32,
5832
5833 /// References to the original elements that are replaced.
5834 pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
5835
5836 /// The type of provenance operation.
5837 pub r#type: crate::model::document::provenance::OperationType,
5838
5839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5840 }
5841
5842 impl Provenance {
5843 /// Creates a new default instance.
5844 pub fn new() -> Self {
5845 std::default::Default::default()
5846 }
5847
5848 /// Sets the value of [revision][crate::model::document::Provenance::revision].
5849 ///
5850 /// # Example
5851 /// ```ignore,no_run
5852 /// # use google_cloud_documentai_v1::model::document::Provenance;
5853 /// let x = Provenance::new().set_revision(42);
5854 /// ```
5855 #[deprecated]
5856 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5857 self.revision = v.into();
5858 self
5859 }
5860
5861 /// Sets the value of [id][crate::model::document::Provenance::id].
5862 ///
5863 /// # Example
5864 /// ```ignore,no_run
5865 /// # use google_cloud_documentai_v1::model::document::Provenance;
5866 /// let x = Provenance::new().set_id(42);
5867 /// ```
5868 #[deprecated]
5869 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5870 self.id = v.into();
5871 self
5872 }
5873
5874 /// Sets the value of [parents][crate::model::document::Provenance::parents].
5875 ///
5876 /// # Example
5877 /// ```ignore,no_run
5878 /// # use google_cloud_documentai_v1::model::document::Provenance;
5879 /// use google_cloud_documentai_v1::model::document::provenance::Parent;
5880 /// let x = Provenance::new()
5881 /// .set_parents([
5882 /// Parent::default()/* use setters */,
5883 /// Parent::default()/* use (different) setters */,
5884 /// ]);
5885 /// ```
5886 pub fn set_parents<T, V>(mut self, v: T) -> Self
5887 where
5888 T: std::iter::IntoIterator<Item = V>,
5889 V: std::convert::Into<crate::model::document::provenance::Parent>,
5890 {
5891 use std::iter::Iterator;
5892 self.parents = v.into_iter().map(|i| i.into()).collect();
5893 self
5894 }
5895
5896 /// Sets the value of [r#type][crate::model::document::Provenance::type].
5897 ///
5898 /// # Example
5899 /// ```ignore,no_run
5900 /// # use google_cloud_documentai_v1::model::document::Provenance;
5901 /// use google_cloud_documentai_v1::model::document::provenance::OperationType;
5902 /// let x0 = Provenance::new().set_type(OperationType::Add);
5903 /// let x1 = Provenance::new().set_type(OperationType::Remove);
5904 /// let x2 = Provenance::new().set_type(OperationType::Update);
5905 /// ```
5906 pub fn set_type<
5907 T: std::convert::Into<crate::model::document::provenance::OperationType>,
5908 >(
5909 mut self,
5910 v: T,
5911 ) -> Self {
5912 self.r#type = v.into();
5913 self
5914 }
5915 }
5916
5917 impl wkt::message::Message for Provenance {
5918 fn typename() -> &'static str {
5919 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
5920 }
5921 }
5922
5923 /// Defines additional types related to [Provenance].
5924 pub mod provenance {
5925 #[allow(unused_imports)]
5926 use super::*;
5927
5928 /// The parent element the current element is based on. Used for
5929 /// referencing/aligning, removal and replacement operations.
5930 #[derive(Clone, Default, PartialEq)]
5931 #[non_exhaustive]
5932 pub struct Parent {
5933 /// The index of the index into current revision's parent_ids list.
5934 pub revision: i32,
5935
5936 /// The index of the parent item in the corresponding item list (eg. list
5937 /// of entities, properties within entities, etc.) in the parent revision.
5938 pub index: i32,
5939
5940 /// The id of the parent provenance.
5941 #[deprecated]
5942 pub id: i32,
5943
5944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5945 }
5946
5947 impl Parent {
5948 /// Creates a new default instance.
5949 pub fn new() -> Self {
5950 std::default::Default::default()
5951 }
5952
5953 /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
5954 ///
5955 /// # Example
5956 /// ```ignore,no_run
5957 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5958 /// let x = Parent::new().set_revision(42);
5959 /// ```
5960 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5961 self.revision = v.into();
5962 self
5963 }
5964
5965 /// Sets the value of [index][crate::model::document::provenance::Parent::index].
5966 ///
5967 /// # Example
5968 /// ```ignore,no_run
5969 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5970 /// let x = Parent::new().set_index(42);
5971 /// ```
5972 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5973 self.index = v.into();
5974 self
5975 }
5976
5977 /// Sets the value of [id][crate::model::document::provenance::Parent::id].
5978 ///
5979 /// # Example
5980 /// ```ignore,no_run
5981 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5982 /// let x = Parent::new().set_id(42);
5983 /// ```
5984 #[deprecated]
5985 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5986 self.id = v.into();
5987 self
5988 }
5989 }
5990
5991 impl wkt::message::Message for Parent {
5992 fn typename() -> &'static str {
5993 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
5994 }
5995 }
5996
5997 /// If a processor or agent does an explicit operation on existing elements.
5998 ///
5999 /// # Working with unknown values
6000 ///
6001 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6002 /// additional enum variants at any time. Adding new variants is not considered
6003 /// a breaking change. Applications should write their code in anticipation of:
6004 ///
6005 /// - New values appearing in future releases of the client library, **and**
6006 /// - New values received dynamically, without application changes.
6007 ///
6008 /// Please consult the [Working with enums] section in the user guide for some
6009 /// guidelines.
6010 ///
6011 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6012 #[derive(Clone, Debug, PartialEq)]
6013 #[non_exhaustive]
6014 pub enum OperationType {
6015 /// Operation type unspecified. If no operation is specified a provenance
6016 /// entry is simply used to match against a `parent`.
6017 Unspecified,
6018 /// Add an element.
6019 Add,
6020 /// Remove an element identified by `parent`.
6021 Remove,
6022 /// Updates any fields within the given provenance scope of the message. It
6023 /// overwrites the fields rather than replacing them. Use this when you
6024 /// want to update a field value of an entity without also updating all the
6025 /// child properties.
6026 Update,
6027 /// Currently unused. Replace an element identified by `parent`.
6028 Replace,
6029 /// Deprecated. Request human review for the element identified by
6030 /// `parent`.
6031 #[deprecated]
6032 EvalRequested,
6033 /// Deprecated. Element is reviewed and approved at human review,
6034 /// confidence will be set to 1.0.
6035 #[deprecated]
6036 EvalApproved,
6037 /// Deprecated. Element is skipped in the validation process.
6038 #[deprecated]
6039 EvalSkipped,
6040 /// If set, the enum was initialized with an unknown value.
6041 ///
6042 /// Applications can examine the value using [OperationType::value] or
6043 /// [OperationType::name].
6044 UnknownValue(operation_type::UnknownValue),
6045 }
6046
6047 #[doc(hidden)]
6048 pub mod operation_type {
6049 #[allow(unused_imports)]
6050 use super::*;
6051 #[derive(Clone, Debug, PartialEq)]
6052 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6053 }
6054
6055 impl OperationType {
6056 /// Gets the enum value.
6057 ///
6058 /// Returns `None` if the enum contains an unknown value deserialized from
6059 /// the string representation of enums.
6060 pub fn value(&self) -> std::option::Option<i32> {
6061 match self {
6062 Self::Unspecified => std::option::Option::Some(0),
6063 Self::Add => std::option::Option::Some(1),
6064 Self::Remove => std::option::Option::Some(2),
6065 Self::Update => std::option::Option::Some(7),
6066 Self::Replace => std::option::Option::Some(3),
6067 Self::EvalRequested => std::option::Option::Some(4),
6068 Self::EvalApproved => std::option::Option::Some(5),
6069 Self::EvalSkipped => std::option::Option::Some(6),
6070 Self::UnknownValue(u) => u.0.value(),
6071 }
6072 }
6073
6074 /// Gets the enum value as a string.
6075 ///
6076 /// Returns `None` if the enum contains an unknown value deserialized from
6077 /// the integer representation of enums.
6078 pub fn name(&self) -> std::option::Option<&str> {
6079 match self {
6080 Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
6081 Self::Add => std::option::Option::Some("ADD"),
6082 Self::Remove => std::option::Option::Some("REMOVE"),
6083 Self::Update => std::option::Option::Some("UPDATE"),
6084 Self::Replace => std::option::Option::Some("REPLACE"),
6085 Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
6086 Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
6087 Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
6088 Self::UnknownValue(u) => u.0.name(),
6089 }
6090 }
6091 }
6092
6093 impl std::default::Default for OperationType {
6094 fn default() -> Self {
6095 use std::convert::From;
6096 Self::from(0)
6097 }
6098 }
6099
6100 impl std::fmt::Display for OperationType {
6101 fn fmt(
6102 &self,
6103 f: &mut std::fmt::Formatter<'_>,
6104 ) -> std::result::Result<(), std::fmt::Error> {
6105 wkt::internal::display_enum(f, self.name(), self.value())
6106 }
6107 }
6108
6109 impl std::convert::From<i32> for OperationType {
6110 fn from(value: i32) -> Self {
6111 match value {
6112 0 => Self::Unspecified,
6113 1 => Self::Add,
6114 2 => Self::Remove,
6115 3 => Self::Replace,
6116 4 => Self::EvalRequested,
6117 5 => Self::EvalApproved,
6118 6 => Self::EvalSkipped,
6119 7 => Self::Update,
6120 _ => Self::UnknownValue(operation_type::UnknownValue(
6121 wkt::internal::UnknownEnumValue::Integer(value),
6122 )),
6123 }
6124 }
6125 }
6126
6127 impl std::convert::From<&str> for OperationType {
6128 fn from(value: &str) -> Self {
6129 use std::string::ToString;
6130 match value {
6131 "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
6132 "ADD" => Self::Add,
6133 "REMOVE" => Self::Remove,
6134 "UPDATE" => Self::Update,
6135 "REPLACE" => Self::Replace,
6136 "EVAL_REQUESTED" => Self::EvalRequested,
6137 "EVAL_APPROVED" => Self::EvalApproved,
6138 "EVAL_SKIPPED" => Self::EvalSkipped,
6139 _ => Self::UnknownValue(operation_type::UnknownValue(
6140 wkt::internal::UnknownEnumValue::String(value.to_string()),
6141 )),
6142 }
6143 }
6144 }
6145
6146 impl serde::ser::Serialize for OperationType {
6147 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6148 where
6149 S: serde::Serializer,
6150 {
6151 match self {
6152 Self::Unspecified => serializer.serialize_i32(0),
6153 Self::Add => serializer.serialize_i32(1),
6154 Self::Remove => serializer.serialize_i32(2),
6155 Self::Update => serializer.serialize_i32(7),
6156 Self::Replace => serializer.serialize_i32(3),
6157 Self::EvalRequested => serializer.serialize_i32(4),
6158 Self::EvalApproved => serializer.serialize_i32(5),
6159 Self::EvalSkipped => serializer.serialize_i32(6),
6160 Self::UnknownValue(u) => u.0.serialize(serializer),
6161 }
6162 }
6163 }
6164
6165 impl<'de> serde::de::Deserialize<'de> for OperationType {
6166 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6167 where
6168 D: serde::Deserializer<'de>,
6169 {
6170 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
6171 ".google.cloud.documentai.v1.Document.Provenance.OperationType",
6172 ))
6173 }
6174 }
6175 }
6176
6177 /// Contains past or forward revisions of this document.
6178 #[derive(Clone, Default, PartialEq)]
6179 #[non_exhaustive]
6180 pub struct Revision {
6181 /// Id of the revision, internally generated by doc proto storage.
6182 /// Unique within the context of the document.
6183 pub id: std::string::String,
6184
6185 /// The revisions that this revision is based on. This can include one or
6186 /// more parent (when documents are merged.) This field represents the
6187 /// index into the `revisions` field.
6188 #[deprecated]
6189 pub parent: std::vec::Vec<i32>,
6190
6191 /// The revisions that this revision is based on. Must include all the ids
6192 /// that have anything to do with this revision - eg. there are
6193 /// `provenance.parent.revision` fields that index into this field.
6194 pub parent_ids: std::vec::Vec<std::string::String>,
6195
6196 /// The time that the revision was created, internally generated by
6197 /// doc proto storage at the time of create.
6198 pub create_time: std::option::Option<wkt::Timestamp>,
6199
6200 /// Human Review information of this revision.
6201 pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
6202
6203 /// Who/what made the change
6204 pub source: std::option::Option<crate::model::document::revision::Source>,
6205
6206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6207 }
6208
6209 impl Revision {
6210 /// Creates a new default instance.
6211 pub fn new() -> Self {
6212 std::default::Default::default()
6213 }
6214
6215 /// Sets the value of [id][crate::model::document::Revision::id].
6216 ///
6217 /// # Example
6218 /// ```ignore,no_run
6219 /// # use google_cloud_documentai_v1::model::document::Revision;
6220 /// let x = Revision::new().set_id("example");
6221 /// ```
6222 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6223 self.id = v.into();
6224 self
6225 }
6226
6227 /// Sets the value of [parent][crate::model::document::Revision::parent].
6228 ///
6229 /// # Example
6230 /// ```ignore,no_run
6231 /// # use google_cloud_documentai_v1::model::document::Revision;
6232 /// let x = Revision::new().set_parent([1, 2, 3]);
6233 /// ```
6234 #[deprecated]
6235 pub fn set_parent<T, V>(mut self, v: T) -> Self
6236 where
6237 T: std::iter::IntoIterator<Item = V>,
6238 V: std::convert::Into<i32>,
6239 {
6240 use std::iter::Iterator;
6241 self.parent = v.into_iter().map(|i| i.into()).collect();
6242 self
6243 }
6244
6245 /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
6246 ///
6247 /// # Example
6248 /// ```ignore,no_run
6249 /// # use google_cloud_documentai_v1::model::document::Revision;
6250 /// let x = Revision::new().set_parent_ids(["a", "b", "c"]);
6251 /// ```
6252 pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
6253 where
6254 T: std::iter::IntoIterator<Item = V>,
6255 V: std::convert::Into<std::string::String>,
6256 {
6257 use std::iter::Iterator;
6258 self.parent_ids = v.into_iter().map(|i| i.into()).collect();
6259 self
6260 }
6261
6262 /// Sets the value of [create_time][crate::model::document::Revision::create_time].
6263 ///
6264 /// # Example
6265 /// ```ignore,no_run
6266 /// # use google_cloud_documentai_v1::model::document::Revision;
6267 /// use wkt::Timestamp;
6268 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
6269 /// ```
6270 pub fn set_create_time<T>(mut self, v: T) -> Self
6271 where
6272 T: std::convert::Into<wkt::Timestamp>,
6273 {
6274 self.create_time = std::option::Option::Some(v.into());
6275 self
6276 }
6277
6278 /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
6279 ///
6280 /// # Example
6281 /// ```ignore,no_run
6282 /// # use google_cloud_documentai_v1::model::document::Revision;
6283 /// use wkt::Timestamp;
6284 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6285 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
6286 /// ```
6287 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6288 where
6289 T: std::convert::Into<wkt::Timestamp>,
6290 {
6291 self.create_time = v.map(|x| x.into());
6292 self
6293 }
6294
6295 /// Sets the value of [human_review][crate::model::document::Revision::human_review].
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::HumanReview;
6301 /// let x = Revision::new().set_human_review(HumanReview::default()/* use setters */);
6302 /// ```
6303 pub fn set_human_review<T>(mut self, v: T) -> Self
6304 where
6305 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6306 {
6307 self.human_review = std::option::Option::Some(v.into());
6308 self
6309 }
6310
6311 /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
6312 ///
6313 /// # Example
6314 /// ```ignore,no_run
6315 /// # use google_cloud_documentai_v1::model::document::Revision;
6316 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6317 /// let x = Revision::new().set_or_clear_human_review(Some(HumanReview::default()/* use setters */));
6318 /// let x = Revision::new().set_or_clear_human_review(None::<HumanReview>);
6319 /// ```
6320 pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
6321 where
6322 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6323 {
6324 self.human_review = v.map(|x| x.into());
6325 self
6326 }
6327
6328 /// Sets the value of [source][crate::model::document::Revision::source].
6329 ///
6330 /// Note that all the setters affecting `source` are mutually
6331 /// exclusive.
6332 ///
6333 /// # Example
6334 /// ```ignore,no_run
6335 /// # use google_cloud_documentai_v1::model::document::Revision;
6336 /// use google_cloud_documentai_v1::model::document::revision::Source;
6337 /// let x = Revision::new().set_source(Some(Source::Agent("example".to_string())));
6338 /// ```
6339 pub fn set_source<
6340 T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
6341 >(
6342 mut self,
6343 v: T,
6344 ) -> Self {
6345 self.source = v.into();
6346 self
6347 }
6348
6349 /// The value of [source][crate::model::document::Revision::source]
6350 /// if it holds a `Agent`, `None` if the field is not set or
6351 /// holds a different branch.
6352 pub fn agent(&self) -> std::option::Option<&std::string::String> {
6353 #[allow(unreachable_patterns)]
6354 self.source.as_ref().and_then(|v| match v {
6355 crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
6356 _ => std::option::Option::None,
6357 })
6358 }
6359
6360 /// Sets the value of [source][crate::model::document::Revision::source]
6361 /// to hold a `Agent`.
6362 ///
6363 /// Note that all the setters affecting `source` are
6364 /// mutually exclusive.
6365 ///
6366 /// # Example
6367 /// ```ignore,no_run
6368 /// # use google_cloud_documentai_v1::model::document::Revision;
6369 /// let x = Revision::new().set_agent("example");
6370 /// assert!(x.agent().is_some());
6371 /// assert!(x.processor().is_none());
6372 /// ```
6373 pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6374 self.source = std::option::Option::Some(
6375 crate::model::document::revision::Source::Agent(v.into()),
6376 );
6377 self
6378 }
6379
6380 /// The value of [source][crate::model::document::Revision::source]
6381 /// if it holds a `Processor`, `None` if the field is not set or
6382 /// holds a different branch.
6383 pub fn processor(&self) -> std::option::Option<&std::string::String> {
6384 #[allow(unreachable_patterns)]
6385 self.source.as_ref().and_then(|v| match v {
6386 crate::model::document::revision::Source::Processor(v) => {
6387 std::option::Option::Some(v)
6388 }
6389 _ => std::option::Option::None,
6390 })
6391 }
6392
6393 /// Sets the value of [source][crate::model::document::Revision::source]
6394 /// to hold a `Processor`.
6395 ///
6396 /// Note that all the setters affecting `source` are
6397 /// mutually exclusive.
6398 ///
6399 /// # Example
6400 /// ```ignore,no_run
6401 /// # use google_cloud_documentai_v1::model::document::Revision;
6402 /// let x = Revision::new().set_processor("example");
6403 /// assert!(x.processor().is_some());
6404 /// assert!(x.agent().is_none());
6405 /// ```
6406 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6407 self.source = std::option::Option::Some(
6408 crate::model::document::revision::Source::Processor(v.into()),
6409 );
6410 self
6411 }
6412 }
6413
6414 impl wkt::message::Message for Revision {
6415 fn typename() -> &'static str {
6416 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
6417 }
6418 }
6419
6420 /// Defines additional types related to [Revision].
6421 pub mod revision {
6422 #[allow(unused_imports)]
6423 use super::*;
6424
6425 /// Human Review information of the document.
6426 #[derive(Clone, Default, PartialEq)]
6427 #[non_exhaustive]
6428 pub struct HumanReview {
6429 /// Human review state. For example, `requested`, `succeeded`, `rejected`.
6430 pub state: std::string::String,
6431
6432 /// A message providing more details about the current state of processing.
6433 /// For example, the rejection reason when the state is `rejected`.
6434 pub state_message: std::string::String,
6435
6436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6437 }
6438
6439 impl HumanReview {
6440 /// Creates a new default instance.
6441 pub fn new() -> Self {
6442 std::default::Default::default()
6443 }
6444
6445 /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
6446 ///
6447 /// # Example
6448 /// ```ignore,no_run
6449 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6450 /// let x = HumanReview::new().set_state("example");
6451 /// ```
6452 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6453 self.state = v.into();
6454 self
6455 }
6456
6457 /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
6458 ///
6459 /// # Example
6460 /// ```ignore,no_run
6461 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6462 /// let x = HumanReview::new().set_state_message("example");
6463 /// ```
6464 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
6465 mut self,
6466 v: T,
6467 ) -> Self {
6468 self.state_message = v.into();
6469 self
6470 }
6471 }
6472
6473 impl wkt::message::Message for HumanReview {
6474 fn typename() -> &'static str {
6475 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
6476 }
6477 }
6478
6479 /// Who/what made the change
6480 #[derive(Clone, Debug, PartialEq)]
6481 #[non_exhaustive]
6482 pub enum Source {
6483 /// If the change was made by a person specify the name or id of that
6484 /// person.
6485 Agent(std::string::String),
6486 /// If the annotation was made by processor identify the processor by its
6487 /// resource name.
6488 Processor(std::string::String),
6489 }
6490 }
6491
6492 /// This message is used for text changes aka. OCR corrections.
6493 #[derive(Clone, Default, PartialEq)]
6494 #[non_exhaustive]
6495 pub struct TextChange {
6496 /// Provenance of the correction.
6497 /// Text anchor indexing into the
6498 /// [Document.text][google.cloud.documentai.v1.Document.text]. There can
6499 /// only be a single `TextAnchor.text_segments` element. If the start and
6500 /// end index of the text segment are the same, the text change is inserted
6501 /// before that index.
6502 ///
6503 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
6504 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
6505
6506 /// The text that replaces the text identified in the `text_anchor`.
6507 pub changed_text: std::string::String,
6508
6509 /// The history of this annotation.
6510 #[deprecated]
6511 pub provenance: std::vec::Vec<crate::model::document::Provenance>,
6512
6513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6514 }
6515
6516 impl TextChange {
6517 /// Creates a new default instance.
6518 pub fn new() -> Self {
6519 std::default::Default::default()
6520 }
6521
6522 /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6523 ///
6524 /// # Example
6525 /// ```ignore,no_run
6526 /// # use google_cloud_documentai_v1::model::document::TextChange;
6527 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6528 /// let x = TextChange::new().set_text_anchor(TextAnchor::default()/* use setters */);
6529 /// ```
6530 pub fn set_text_anchor<T>(mut self, v: T) -> Self
6531 where
6532 T: std::convert::Into<crate::model::document::TextAnchor>,
6533 {
6534 self.text_anchor = std::option::Option::Some(v.into());
6535 self
6536 }
6537
6538 /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6539 ///
6540 /// # Example
6541 /// ```ignore,no_run
6542 /// # use google_cloud_documentai_v1::model::document::TextChange;
6543 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6544 /// let x = TextChange::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
6545 /// let x = TextChange::new().set_or_clear_text_anchor(None::<TextAnchor>);
6546 /// ```
6547 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
6548 where
6549 T: std::convert::Into<crate::model::document::TextAnchor>,
6550 {
6551 self.text_anchor = v.map(|x| x.into());
6552 self
6553 }
6554
6555 /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
6556 ///
6557 /// # Example
6558 /// ```ignore,no_run
6559 /// # use google_cloud_documentai_v1::model::document::TextChange;
6560 /// let x = TextChange::new().set_changed_text("example");
6561 /// ```
6562 pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
6563 mut self,
6564 v: T,
6565 ) -> Self {
6566 self.changed_text = v.into();
6567 self
6568 }
6569
6570 /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
6571 ///
6572 /// # Example
6573 /// ```ignore,no_run
6574 /// # use google_cloud_documentai_v1::model::document::TextChange;
6575 /// use google_cloud_documentai_v1::model::document::Provenance;
6576 /// let x = TextChange::new()
6577 /// .set_provenance([
6578 /// Provenance::default()/* use setters */,
6579 /// Provenance::default()/* use (different) setters */,
6580 /// ]);
6581 /// ```
6582 #[deprecated]
6583 pub fn set_provenance<T, V>(mut self, v: T) -> Self
6584 where
6585 T: std::iter::IntoIterator<Item = V>,
6586 V: std::convert::Into<crate::model::document::Provenance>,
6587 {
6588 use std::iter::Iterator;
6589 self.provenance = v.into_iter().map(|i| i.into()).collect();
6590 self
6591 }
6592 }
6593
6594 impl wkt::message::Message for TextChange {
6595 fn typename() -> &'static str {
6596 "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
6597 }
6598 }
6599
6600 /// Represents the annotation of a block or a chunk.
6601 #[derive(Clone, Default, PartialEq)]
6602 #[non_exhaustive]
6603 pub struct Annotations {
6604 /// The description of the content with this annotation.
6605 pub description: std::string::String,
6606
6607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6608 }
6609
6610 impl Annotations {
6611 /// Creates a new default instance.
6612 pub fn new() -> Self {
6613 std::default::Default::default()
6614 }
6615
6616 /// Sets the value of [description][crate::model::document::Annotations::description].
6617 ///
6618 /// # Example
6619 /// ```ignore,no_run
6620 /// # use google_cloud_documentai_v1::model::document::Annotations;
6621 /// let x = Annotations::new().set_description("example");
6622 /// ```
6623 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6624 self.description = v.into();
6625 self
6626 }
6627 }
6628
6629 impl wkt::message::Message for Annotations {
6630 fn typename() -> &'static str {
6631 "type.googleapis.com/google.cloud.documentai.v1.Document.Annotations"
6632 }
6633 }
6634
6635 /// Represents the parsed layout of a document as a collection of blocks that
6636 /// the document is divided into.
6637 #[derive(Clone, Default, PartialEq)]
6638 #[non_exhaustive]
6639 pub struct DocumentLayout {
6640 /// List of blocks in the document.
6641 pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6642
6643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6644 }
6645
6646 impl DocumentLayout {
6647 /// Creates a new default instance.
6648 pub fn new() -> Self {
6649 std::default::Default::default()
6650 }
6651
6652 /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
6653 ///
6654 /// # Example
6655 /// ```ignore,no_run
6656 /// # use google_cloud_documentai_v1::model::document::DocumentLayout;
6657 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6658 /// let x = DocumentLayout::new()
6659 /// .set_blocks([
6660 /// DocumentLayoutBlock::default()/* use setters */,
6661 /// DocumentLayoutBlock::default()/* use (different) setters */,
6662 /// ]);
6663 /// ```
6664 pub fn set_blocks<T, V>(mut self, v: T) -> Self
6665 where
6666 T: std::iter::IntoIterator<Item = V>,
6667 V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
6668 {
6669 use std::iter::Iterator;
6670 self.blocks = v.into_iter().map(|i| i.into()).collect();
6671 self
6672 }
6673 }
6674
6675 impl wkt::message::Message for DocumentLayout {
6676 fn typename() -> &'static str {
6677 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
6678 }
6679 }
6680
6681 /// Defines additional types related to [DocumentLayout].
6682 pub mod document_layout {
6683 #[allow(unused_imports)]
6684 use super::*;
6685
6686 /// Represents a block. A block could be one of the various types (text,
6687 /// table, list) supported.
6688 #[derive(Clone, Default, PartialEq)]
6689 #[non_exhaustive]
6690 pub struct DocumentLayoutBlock {
6691 /// ID of the block.
6692 pub block_id: std::string::String,
6693
6694 /// Page span of the block.
6695 pub page_span: std::option::Option<
6696 crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
6697 >,
6698
6699 /// Identifies the bounding box for the block.
6700 pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6701
6702 #[allow(missing_docs)]
6703 pub block: std::option::Option<
6704 crate::model::document::document_layout::document_layout_block::Block,
6705 >,
6706
6707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6708 }
6709
6710 impl DocumentLayoutBlock {
6711 /// Creates a new default instance.
6712 pub fn new() -> Self {
6713 std::default::Default::default()
6714 }
6715
6716 /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
6717 ///
6718 /// # Example
6719 /// ```ignore,no_run
6720 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6721 /// let x = DocumentLayoutBlock::new().set_block_id("example");
6722 /// ```
6723 pub fn set_block_id<T: std::convert::Into<std::string::String>>(
6724 mut self,
6725 v: T,
6726 ) -> Self {
6727 self.block_id = v.into();
6728 self
6729 }
6730
6731 /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6736 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6737 /// let x = DocumentLayoutBlock::new().set_page_span(LayoutPageSpan::default()/* use setters */);
6738 /// ```
6739 pub fn set_page_span<T>(mut self, v: T) -> Self
6740 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6741 {
6742 self.page_span = std::option::Option::Some(v.into());
6743 self
6744 }
6745
6746 /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6747 ///
6748 /// # Example
6749 /// ```ignore,no_run
6750 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6751 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6752 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(Some(LayoutPageSpan::default()/* use setters */));
6753 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(None::<LayoutPageSpan>);
6754 /// ```
6755 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
6756 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6757 {
6758 self.page_span = v.map(|x| x.into());
6759 self
6760 }
6761
6762 /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6763 ///
6764 /// # Example
6765 /// ```ignore,no_run
6766 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6767 /// use google_cloud_documentai_v1::model::BoundingPoly;
6768 /// let x = DocumentLayoutBlock::new().set_bounding_box(BoundingPoly::default()/* use setters */);
6769 /// ```
6770 pub fn set_bounding_box<T>(mut self, v: T) -> Self
6771 where
6772 T: std::convert::Into<crate::model::BoundingPoly>,
6773 {
6774 self.bounding_box = std::option::Option::Some(v.into());
6775 self
6776 }
6777
6778 /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6779 ///
6780 /// # Example
6781 /// ```ignore,no_run
6782 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6783 /// use google_cloud_documentai_v1::model::BoundingPoly;
6784 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(Some(BoundingPoly::default()/* use setters */));
6785 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(None::<BoundingPoly>);
6786 /// ```
6787 pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6788 where
6789 T: std::convert::Into<crate::model::BoundingPoly>,
6790 {
6791 self.bounding_box = v.map(|x| x.into());
6792 self
6793 }
6794
6795 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
6796 ///
6797 /// Note that all the setters affecting `block` are mutually
6798 /// exclusive.
6799 ///
6800 /// # Example
6801 /// ```ignore,no_run
6802 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6803 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6804 /// let x = DocumentLayoutBlock::new().set_block(Some(
6805 /// google_cloud_documentai_v1::model::document::document_layout::document_layout_block::Block::TextBlock(LayoutTextBlock::default().into())));
6806 /// ```
6807 pub fn set_block<
6808 T: std::convert::Into<
6809 std::option::Option<
6810 crate::model::document::document_layout::document_layout_block::Block,
6811 >,
6812 >,
6813 >(
6814 mut self,
6815 v: T,
6816 ) -> Self {
6817 self.block = v.into();
6818 self
6819 }
6820
6821 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6822 /// if it holds a `TextBlock`, `None` if the field is not set or
6823 /// holds a different branch.
6824 pub fn text_block(
6825 &self,
6826 ) -> std::option::Option<
6827 &std::boxed::Box<
6828 crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
6829 >,
6830 > {
6831 #[allow(unreachable_patterns)]
6832 self.block.as_ref().and_then(|v| match v {
6833 crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
6834 _ => std::option::Option::None,
6835 })
6836 }
6837
6838 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6839 /// to hold a `TextBlock`.
6840 ///
6841 /// Note that all the setters affecting `block` are
6842 /// mutually exclusive.
6843 ///
6844 /// # Example
6845 /// ```ignore,no_run
6846 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6847 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6848 /// let x = DocumentLayoutBlock::new().set_text_block(LayoutTextBlock::default()/* use setters */);
6849 /// assert!(x.text_block().is_some());
6850 /// assert!(x.table_block().is_none());
6851 /// assert!(x.list_block().is_none());
6852 /// assert!(x.image_block().is_none());
6853 /// ```
6854 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{
6855 self.block = std::option::Option::Some(
6856 crate::model::document::document_layout::document_layout_block::Block::TextBlock(
6857 v.into()
6858 )
6859 );
6860 self
6861 }
6862
6863 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6864 /// if it holds a `TableBlock`, `None` if the field is not set or
6865 /// holds a different branch.
6866 pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
6867 #[allow(unreachable_patterns)]
6868 self.block.as_ref().and_then(|v| match v {
6869 crate::model::document::document_layout::document_layout_block::Block::TableBlock(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 `TableBlock`.
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::LayoutTableBlock;
6884 /// let x = DocumentLayoutBlock::new().set_table_block(LayoutTableBlock::default()/* use setters */);
6885 /// assert!(x.table_block().is_some());
6886 /// assert!(x.text_block().is_none());
6887 /// assert!(x.list_block().is_none());
6888 /// assert!(x.image_block().is_none());
6889 /// ```
6890 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{
6891 self.block = std::option::Option::Some(
6892 crate::model::document::document_layout::document_layout_block::Block::TableBlock(
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 `ListBlock`, `None` if the field is not set or
6901 /// holds a different branch.
6902 pub fn list_block(
6903 &self,
6904 ) -> std::option::Option<
6905 &std::boxed::Box<
6906 crate::model::document::document_layout::document_layout_block::LayoutListBlock,
6907 >,
6908 > {
6909 #[allow(unreachable_patterns)]
6910 self.block.as_ref().and_then(|v| match v {
6911 crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
6912 _ => std::option::Option::None,
6913 })
6914 }
6915
6916 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6917 /// to hold a `ListBlock`.
6918 ///
6919 /// Note that all the setters affecting `block` are
6920 /// mutually exclusive.
6921 ///
6922 /// # Example
6923 /// ```ignore,no_run
6924 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6925 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
6926 /// let x = DocumentLayoutBlock::new().set_list_block(LayoutListBlock::default()/* use setters */);
6927 /// assert!(x.list_block().is_some());
6928 /// assert!(x.text_block().is_none());
6929 /// assert!(x.table_block().is_none());
6930 /// assert!(x.image_block().is_none());
6931 /// ```
6932 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{
6933 self.block = std::option::Option::Some(
6934 crate::model::document::document_layout::document_layout_block::Block::ListBlock(
6935 v.into()
6936 )
6937 );
6938 self
6939 }
6940
6941 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6942 /// if it holds a `ImageBlock`, `None` if the field is not set or
6943 /// holds a different branch.
6944 pub fn image_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>>{
6945 #[allow(unreachable_patterns)]
6946 self.block.as_ref().and_then(|v| match v {
6947 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(v) => std::option::Option::Some(v),
6948 _ => std::option::Option::None,
6949 })
6950 }
6951
6952 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6953 /// to hold a `ImageBlock`.
6954 ///
6955 /// Note that all the setters affecting `block` are
6956 /// mutually exclusive.
6957 ///
6958 /// # Example
6959 /// ```ignore,no_run
6960 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6961 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
6962 /// let x = DocumentLayoutBlock::new().set_image_block(LayoutImageBlock::default()/* use setters */);
6963 /// assert!(x.image_block().is_some());
6964 /// assert!(x.text_block().is_none());
6965 /// assert!(x.table_block().is_none());
6966 /// assert!(x.list_block().is_none());
6967 /// ```
6968 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{
6969 self.block = std::option::Option::Some(
6970 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(
6971 v.into()
6972 )
6973 );
6974 self
6975 }
6976 }
6977
6978 impl wkt::message::Message for DocumentLayoutBlock {
6979 fn typename() -> &'static str {
6980 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
6981 }
6982 }
6983
6984 /// Defines additional types related to [DocumentLayoutBlock].
6985 pub mod document_layout_block {
6986 #[allow(unused_imports)]
6987 use super::*;
6988
6989 /// Represents where the block starts and ends in the document.
6990 #[derive(Clone, Default, PartialEq)]
6991 #[non_exhaustive]
6992 pub struct LayoutPageSpan {
6993 /// Page where block starts in the document.
6994 pub page_start: i32,
6995
6996 /// Page where block ends in the document.
6997 pub page_end: i32,
6998
6999 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7000 }
7001
7002 impl LayoutPageSpan {
7003 /// Creates a new default instance.
7004 pub fn new() -> Self {
7005 std::default::Default::default()
7006 }
7007
7008 /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
7009 ///
7010 /// # Example
7011 /// ```ignore,no_run
7012 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
7013 /// let x = LayoutPageSpan::new().set_page_start(42);
7014 /// ```
7015 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7016 self.page_start = v.into();
7017 self
7018 }
7019
7020 /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
7021 ///
7022 /// # Example
7023 /// ```ignore,no_run
7024 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
7025 /// let x = LayoutPageSpan::new().set_page_end(42);
7026 /// ```
7027 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7028 self.page_end = v.into();
7029 self
7030 }
7031 }
7032
7033 impl wkt::message::Message for LayoutPageSpan {
7034 fn typename() -> &'static str {
7035 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
7036 }
7037 }
7038
7039 /// Represents a text type block.
7040 #[derive(Clone, Default, PartialEq)]
7041 #[non_exhaustive]
7042 pub struct LayoutTextBlock {
7043 /// Text content stored in the block.
7044 pub text: std::string::String,
7045
7046 /// Type of the text in the block. Available options are: `paragraph`,
7047 /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
7048 /// `heading-5`, `header`, `footer`.
7049 pub r#type: std::string::String,
7050
7051 /// A text block could further have child blocks.
7052 /// Repeated blocks support further hierarchies and nested blocks.
7053 pub blocks:
7054 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7055
7056 /// Annotation of the text block.
7057 pub annotations: std::option::Option<crate::model::document::Annotations>,
7058
7059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7060 }
7061
7062 impl LayoutTextBlock {
7063 /// Creates a new default instance.
7064 pub fn new() -> Self {
7065 std::default::Default::default()
7066 }
7067
7068 /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
7069 ///
7070 /// # Example
7071 /// ```ignore,no_run
7072 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7073 /// let x = LayoutTextBlock::new().set_text("example");
7074 /// ```
7075 pub fn set_text<T: std::convert::Into<std::string::String>>(
7076 mut self,
7077 v: T,
7078 ) -> Self {
7079 self.text = v.into();
7080 self
7081 }
7082
7083 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
7084 ///
7085 /// # Example
7086 /// ```ignore,no_run
7087 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7088 /// let x = LayoutTextBlock::new().set_type("example");
7089 /// ```
7090 pub fn set_type<T: std::convert::Into<std::string::String>>(
7091 mut self,
7092 v: T,
7093 ) -> Self {
7094 self.r#type = v.into();
7095 self
7096 }
7097
7098 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
7099 ///
7100 /// # Example
7101 /// ```ignore,no_run
7102 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7103 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7104 /// let x = LayoutTextBlock::new()
7105 /// .set_blocks([
7106 /// DocumentLayoutBlock::default()/* use setters */,
7107 /// DocumentLayoutBlock::default()/* use (different) setters */,
7108 /// ]);
7109 /// ```
7110 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7111 where
7112 T: std::iter::IntoIterator<Item = V>,
7113 V: std::convert::Into<
7114 crate::model::document::document_layout::DocumentLayoutBlock,
7115 >,
7116 {
7117 use std::iter::Iterator;
7118 self.blocks = v.into_iter().map(|i| i.into()).collect();
7119 self
7120 }
7121
7122 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7123 ///
7124 /// # Example
7125 /// ```ignore,no_run
7126 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7127 /// use google_cloud_documentai_v1::model::document::Annotations;
7128 /// let x = LayoutTextBlock::new().set_annotations(Annotations::default()/* use setters */);
7129 /// ```
7130 pub fn set_annotations<T>(mut self, v: T) -> Self
7131 where
7132 T: std::convert::Into<crate::model::document::Annotations>,
7133 {
7134 self.annotations = std::option::Option::Some(v.into());
7135 self
7136 }
7137
7138 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7139 ///
7140 /// # Example
7141 /// ```ignore,no_run
7142 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7143 /// use google_cloud_documentai_v1::model::document::Annotations;
7144 /// let x = LayoutTextBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7145 /// let x = LayoutTextBlock::new().set_or_clear_annotations(None::<Annotations>);
7146 /// ```
7147 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7148 where
7149 T: std::convert::Into<crate::model::document::Annotations>,
7150 {
7151 self.annotations = v.map(|x| x.into());
7152 self
7153 }
7154 }
7155
7156 impl wkt::message::Message for LayoutTextBlock {
7157 fn typename() -> &'static str {
7158 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
7159 }
7160 }
7161
7162 /// Represents a table type block.
7163 #[derive(Clone, Default, PartialEq)]
7164 #[non_exhaustive]
7165 pub struct LayoutTableBlock {
7166 /// Header rows at the top of the table.
7167 pub header_rows: std::vec::Vec<
7168 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7169 >,
7170
7171 /// Body rows containing main table content.
7172 pub body_rows: std::vec::Vec<
7173 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7174 >,
7175
7176 /// Table caption/title.
7177 pub caption: std::string::String,
7178
7179 /// Annotation of the table block.
7180 pub annotations: std::option::Option<crate::model::document::Annotations>,
7181
7182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7183 }
7184
7185 impl LayoutTableBlock {
7186 /// Creates a new default instance.
7187 pub fn new() -> Self {
7188 std::default::Default::default()
7189 }
7190
7191 /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
7192 ///
7193 /// # Example
7194 /// ```ignore,no_run
7195 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7196 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7197 /// let x = LayoutTableBlock::new()
7198 /// .set_header_rows([
7199 /// LayoutTableRow::default()/* use setters */,
7200 /// LayoutTableRow::default()/* use (different) setters */,
7201 /// ]);
7202 /// ```
7203 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
7204 where
7205 T: std::iter::IntoIterator<Item = V>,
7206 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7207 {
7208 use std::iter::Iterator;
7209 self.header_rows = v.into_iter().map(|i| i.into()).collect();
7210 self
7211 }
7212
7213 /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
7214 ///
7215 /// # Example
7216 /// ```ignore,no_run
7217 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7218 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7219 /// let x = LayoutTableBlock::new()
7220 /// .set_body_rows([
7221 /// LayoutTableRow::default()/* use setters */,
7222 /// LayoutTableRow::default()/* use (different) setters */,
7223 /// ]);
7224 /// ```
7225 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
7226 where
7227 T: std::iter::IntoIterator<Item = V>,
7228 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7229 {
7230 use std::iter::Iterator;
7231 self.body_rows = v.into_iter().map(|i| i.into()).collect();
7232 self
7233 }
7234
7235 /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
7236 ///
7237 /// # Example
7238 /// ```ignore,no_run
7239 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7240 /// let x = LayoutTableBlock::new().set_caption("example");
7241 /// ```
7242 pub fn set_caption<T: std::convert::Into<std::string::String>>(
7243 mut self,
7244 v: T,
7245 ) -> Self {
7246 self.caption = v.into();
7247 self
7248 }
7249
7250 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7251 ///
7252 /// # Example
7253 /// ```ignore,no_run
7254 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7255 /// use google_cloud_documentai_v1::model::document::Annotations;
7256 /// let x = LayoutTableBlock::new().set_annotations(Annotations::default()/* use setters */);
7257 /// ```
7258 pub fn set_annotations<T>(mut self, v: T) -> Self
7259 where
7260 T: std::convert::Into<crate::model::document::Annotations>,
7261 {
7262 self.annotations = std::option::Option::Some(v.into());
7263 self
7264 }
7265
7266 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7267 ///
7268 /// # Example
7269 /// ```ignore,no_run
7270 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7271 /// use google_cloud_documentai_v1::model::document::Annotations;
7272 /// let x = LayoutTableBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7273 /// let x = LayoutTableBlock::new().set_or_clear_annotations(None::<Annotations>);
7274 /// ```
7275 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7276 where
7277 T: std::convert::Into<crate::model::document::Annotations>,
7278 {
7279 self.annotations = v.map(|x| x.into());
7280 self
7281 }
7282 }
7283
7284 impl wkt::message::Message for LayoutTableBlock {
7285 fn typename() -> &'static str {
7286 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
7287 }
7288 }
7289
7290 /// Represents a row in a table.
7291 #[derive(Clone, Default, PartialEq)]
7292 #[non_exhaustive]
7293 pub struct LayoutTableRow {
7294 /// A table row is a list of table cells.
7295 pub cells: std::vec::Vec<
7296 crate::model::document::document_layout::document_layout_block::LayoutTableCell,
7297 >,
7298
7299 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7300 }
7301
7302 impl LayoutTableRow {
7303 /// Creates a new default instance.
7304 pub fn new() -> Self {
7305 std::default::Default::default()
7306 }
7307
7308 /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
7309 ///
7310 /// # Example
7311 /// ```ignore,no_run
7312 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7313 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7314 /// let x = LayoutTableRow::new()
7315 /// .set_cells([
7316 /// LayoutTableCell::default()/* use setters */,
7317 /// LayoutTableCell::default()/* use (different) setters */,
7318 /// ]);
7319 /// ```
7320 pub fn set_cells<T, V>(mut self, v: T) -> Self
7321 where
7322 T: std::iter::IntoIterator<Item = V>,
7323 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
7324 {
7325 use std::iter::Iterator;
7326 self.cells = v.into_iter().map(|i| i.into()).collect();
7327 self
7328 }
7329 }
7330
7331 impl wkt::message::Message for LayoutTableRow {
7332 fn typename() -> &'static str {
7333 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
7334 }
7335 }
7336
7337 /// Represents a cell in a table row.
7338 #[derive(Clone, Default, PartialEq)]
7339 #[non_exhaustive]
7340 pub struct LayoutTableCell {
7341 /// A table cell is a list of blocks.
7342 /// Repeated blocks support further hierarchies and nested blocks.
7343 pub blocks:
7344 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7345
7346 /// How many rows this cell spans.
7347 pub row_span: i32,
7348
7349 /// How many columns this cell spans.
7350 pub col_span: i32,
7351
7352 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7353 }
7354
7355 impl LayoutTableCell {
7356 /// Creates a new default instance.
7357 pub fn new() -> Self {
7358 std::default::Default::default()
7359 }
7360
7361 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
7362 ///
7363 /// # Example
7364 /// ```ignore,no_run
7365 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7366 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7367 /// let x = LayoutTableCell::new()
7368 /// .set_blocks([
7369 /// DocumentLayoutBlock::default()/* use setters */,
7370 /// DocumentLayoutBlock::default()/* use (different) setters */,
7371 /// ]);
7372 /// ```
7373 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7374 where
7375 T: std::iter::IntoIterator<Item = V>,
7376 V: std::convert::Into<
7377 crate::model::document::document_layout::DocumentLayoutBlock,
7378 >,
7379 {
7380 use std::iter::Iterator;
7381 self.blocks = v.into_iter().map(|i| i.into()).collect();
7382 self
7383 }
7384
7385 /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
7386 ///
7387 /// # Example
7388 /// ```ignore,no_run
7389 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7390 /// let x = LayoutTableCell::new().set_row_span(42);
7391 /// ```
7392 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7393 self.row_span = v.into();
7394 self
7395 }
7396
7397 /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
7398 ///
7399 /// # Example
7400 /// ```ignore,no_run
7401 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7402 /// let x = LayoutTableCell::new().set_col_span(42);
7403 /// ```
7404 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7405 self.col_span = v.into();
7406 self
7407 }
7408 }
7409
7410 impl wkt::message::Message for LayoutTableCell {
7411 fn typename() -> &'static str {
7412 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
7413 }
7414 }
7415
7416 /// Represents a list type block.
7417 #[derive(Clone, Default, PartialEq)]
7418 #[non_exhaustive]
7419 pub struct LayoutListBlock {
7420 /// List entries that constitute a list block.
7421 pub list_entries: std::vec::Vec<
7422 crate::model::document::document_layout::document_layout_block::LayoutListEntry,
7423 >,
7424
7425 /// Type of the list_entries (if exist). Available options are `ordered`
7426 /// and `unordered`.
7427 pub r#type: std::string::String,
7428
7429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7430 }
7431
7432 impl LayoutListBlock {
7433 /// Creates a new default instance.
7434 pub fn new() -> Self {
7435 std::default::Default::default()
7436 }
7437
7438 /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
7439 ///
7440 /// # Example
7441 /// ```ignore,no_run
7442 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7443 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7444 /// let x = LayoutListBlock::new()
7445 /// .set_list_entries([
7446 /// LayoutListEntry::default()/* use setters */,
7447 /// LayoutListEntry::default()/* use (different) setters */,
7448 /// ]);
7449 /// ```
7450 pub fn set_list_entries<T, V>(mut self, v: T) -> Self
7451 where
7452 T: std::iter::IntoIterator<Item = V>,
7453 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
7454 {
7455 use std::iter::Iterator;
7456 self.list_entries = v.into_iter().map(|i| i.into()).collect();
7457 self
7458 }
7459
7460 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
7461 ///
7462 /// # Example
7463 /// ```ignore,no_run
7464 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7465 /// let x = LayoutListBlock::new().set_type("example");
7466 /// ```
7467 pub fn set_type<T: std::convert::Into<std::string::String>>(
7468 mut self,
7469 v: T,
7470 ) -> Self {
7471 self.r#type = v.into();
7472 self
7473 }
7474 }
7475
7476 impl wkt::message::Message for LayoutListBlock {
7477 fn typename() -> &'static str {
7478 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
7479 }
7480 }
7481
7482 /// Represents an entry in the list.
7483 #[derive(Clone, Default, PartialEq)]
7484 #[non_exhaustive]
7485 pub struct LayoutListEntry {
7486 /// A list entry is a list of blocks.
7487 /// Repeated blocks support further hierarchies and nested blocks.
7488 pub blocks:
7489 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7490
7491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7492 }
7493
7494 impl LayoutListEntry {
7495 /// Creates a new default instance.
7496 pub fn new() -> Self {
7497 std::default::Default::default()
7498 }
7499
7500 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
7501 ///
7502 /// # Example
7503 /// ```ignore,no_run
7504 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7505 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7506 /// let x = LayoutListEntry::new()
7507 /// .set_blocks([
7508 /// DocumentLayoutBlock::default()/* use setters */,
7509 /// DocumentLayoutBlock::default()/* use (different) setters */,
7510 /// ]);
7511 /// ```
7512 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7513 where
7514 T: std::iter::IntoIterator<Item = V>,
7515 V: std::convert::Into<
7516 crate::model::document::document_layout::DocumentLayoutBlock,
7517 >,
7518 {
7519 use std::iter::Iterator;
7520 self.blocks = v.into_iter().map(|i| i.into()).collect();
7521 self
7522 }
7523 }
7524
7525 impl wkt::message::Message for LayoutListEntry {
7526 fn typename() -> &'static str {
7527 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
7528 }
7529 }
7530
7531 /// Represents an image type block.
7532 #[derive(Clone, Default, PartialEq)]
7533 #[non_exhaustive]
7534 pub struct LayoutImageBlock {
7535
7536 /// Mime type of the image. An IANA published [media type (MIME type)]
7537 /// (<https://www.iana.org/assignments/media-types/media-types.xhtml>).
7538 pub mime_type: std::string::String,
7539
7540 /// Text extracted from the image using OCR or alt text describing the
7541 /// image.
7542 pub image_text: std::string::String,
7543
7544 /// Annotation of the image block.
7545 pub annotations: std::option::Option<crate::model::document::Annotations>,
7546
7547 /// Source of the image.
7548 pub image_source: std::option::Option<crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource>,
7549
7550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7551 }
7552
7553 impl LayoutImageBlock {
7554 /// Creates a new default instance.
7555 pub fn new() -> Self {
7556 std::default::Default::default()
7557 }
7558
7559 /// Sets the value of [mime_type][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::mime_type].
7560 ///
7561 /// # Example
7562 /// ```ignore,no_run
7563 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7564 /// let x = LayoutImageBlock::new().set_mime_type("example");
7565 /// ```
7566 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
7567 mut self,
7568 v: T,
7569 ) -> Self {
7570 self.mime_type = v.into();
7571 self
7572 }
7573
7574 /// Sets the value of [image_text][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_text].
7575 ///
7576 /// # Example
7577 /// ```ignore,no_run
7578 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7579 /// let x = LayoutImageBlock::new().set_image_text("example");
7580 /// ```
7581 pub fn set_image_text<T: std::convert::Into<std::string::String>>(
7582 mut self,
7583 v: T,
7584 ) -> Self {
7585 self.image_text = v.into();
7586 self
7587 }
7588
7589 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7590 ///
7591 /// # Example
7592 /// ```ignore,no_run
7593 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7594 /// use google_cloud_documentai_v1::model::document::Annotations;
7595 /// let x = LayoutImageBlock::new().set_annotations(Annotations::default()/* use setters */);
7596 /// ```
7597 pub fn set_annotations<T>(mut self, v: T) -> Self
7598 where
7599 T: std::convert::Into<crate::model::document::Annotations>,
7600 {
7601 self.annotations = std::option::Option::Some(v.into());
7602 self
7603 }
7604
7605 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7606 ///
7607 /// # Example
7608 /// ```ignore,no_run
7609 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7610 /// use google_cloud_documentai_v1::model::document::Annotations;
7611 /// let x = LayoutImageBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7612 /// let x = LayoutImageBlock::new().set_or_clear_annotations(None::<Annotations>);
7613 /// ```
7614 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7615 where
7616 T: std::convert::Into<crate::model::document::Annotations>,
7617 {
7618 self.annotations = v.map(|x| x.into());
7619 self
7620 }
7621
7622 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source].
7623 ///
7624 /// Note that all the setters affecting `image_source` are mutually
7625 /// exclusive.
7626 ///
7627 /// # Example
7628 /// ```ignore,no_run
7629 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7630 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::layout_image_block::ImageSource;
7631 /// let x = LayoutImageBlock::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
7632 /// ```
7633 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
7634 {
7635 self.image_source = v.into();
7636 self
7637 }
7638
7639 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7640 /// if it holds a `BlobAssetId`, `None` if the field is not set or
7641 /// holds a different branch.
7642 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
7643 #[allow(unreachable_patterns)]
7644 self.image_source.as_ref().and_then(|v| match v {
7645 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
7646 _ => std::option::Option::None,
7647 })
7648 }
7649
7650 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7651 /// to hold a `BlobAssetId`.
7652 ///
7653 /// Note that all the setters affecting `image_source` are
7654 /// mutually exclusive.
7655 ///
7656 /// # Example
7657 /// ```ignore,no_run
7658 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7659 /// let x = LayoutImageBlock::new().set_blob_asset_id("example");
7660 /// assert!(x.blob_asset_id().is_some());
7661 /// assert!(x.gcs_uri().is_none());
7662 /// assert!(x.data_uri().is_none());
7663 /// ```
7664 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
7665 mut self,
7666 v: T,
7667 ) -> Self {
7668 self.image_source = std::option::Option::Some(
7669 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(
7670 v.into()
7671 )
7672 );
7673 self
7674 }
7675
7676 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7677 /// if it holds a `GcsUri`, `None` if the field is not set or
7678 /// holds a different branch.
7679 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
7680 #[allow(unreachable_patterns)]
7681 self.image_source.as_ref().and_then(|v| match v {
7682 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(v) => std::option::Option::Some(v),
7683 _ => std::option::Option::None,
7684 })
7685 }
7686
7687 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7688 /// to hold a `GcsUri`.
7689 ///
7690 /// Note that all the setters affecting `image_source` are
7691 /// mutually exclusive.
7692 ///
7693 /// # Example
7694 /// ```ignore,no_run
7695 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7696 /// let x = LayoutImageBlock::new().set_gcs_uri("example");
7697 /// assert!(x.gcs_uri().is_some());
7698 /// assert!(x.blob_asset_id().is_none());
7699 /// assert!(x.data_uri().is_none());
7700 /// ```
7701 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
7702 mut self,
7703 v: T,
7704 ) -> Self {
7705 self.image_source = std::option::Option::Some(
7706 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(
7707 v.into()
7708 )
7709 );
7710 self
7711 }
7712
7713 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7714 /// if it holds a `DataUri`, `None` if the field is not set or
7715 /// holds a different branch.
7716 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
7717 #[allow(unreachable_patterns)]
7718 self.image_source.as_ref().and_then(|v| match v {
7719 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(v) => std::option::Option::Some(v),
7720 _ => std::option::Option::None,
7721 })
7722 }
7723
7724 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7725 /// to hold a `DataUri`.
7726 ///
7727 /// Note that all the setters affecting `image_source` are
7728 /// mutually exclusive.
7729 ///
7730 /// # Example
7731 /// ```ignore,no_run
7732 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7733 /// let x = LayoutImageBlock::new().set_data_uri("example");
7734 /// assert!(x.data_uri().is_some());
7735 /// assert!(x.blob_asset_id().is_none());
7736 /// assert!(x.gcs_uri().is_none());
7737 /// ```
7738 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
7739 mut self,
7740 v: T,
7741 ) -> Self {
7742 self.image_source = std::option::Option::Some(
7743 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(
7744 v.into()
7745 )
7746 );
7747 self
7748 }
7749 }
7750
7751 impl wkt::message::Message for LayoutImageBlock {
7752 fn typename() -> &'static str {
7753 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutImageBlock"
7754 }
7755 }
7756
7757 /// Defines additional types related to [LayoutImageBlock].
7758 pub mod layout_image_block {
7759 #[allow(unused_imports)]
7760 use super::*;
7761
7762 /// Source of the image.
7763 #[derive(Clone, Debug, PartialEq)]
7764 #[non_exhaustive]
7765 pub enum ImageSource {
7766 /// Optional. Asset id of the inline image. If set, find the image
7767 /// content in the blob_assets field.
7768 BlobAssetId(std::string::String),
7769 /// Optional. Google Cloud Storage uri of the image.
7770 GcsUri(std::string::String),
7771 /// Optional. Data uri of the image.
7772 /// It is composed of four parts: a prefix (data:), a MIME type
7773 /// indicating the type of data, an optional base64 token if
7774 /// non-textual, and the data itself:
7775 /// data:[\<mediatype\>][;base64],\<data\>
7776 DataUri(std::string::String),
7777 }
7778 }
7779
7780 #[allow(missing_docs)]
7781 #[derive(Clone, Debug, PartialEq)]
7782 #[non_exhaustive]
7783 pub enum Block {
7784 /// Block consisting of text content.
7785 TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
7786 /// Block consisting of table content/structure.
7787 TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
7788 /// Block consisting of list content/structure.
7789 ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
7790 /// Block consisting of image content.
7791 ImageBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>),
7792 }
7793 }
7794 }
7795
7796 /// Represents the chunks that the document is divided into.
7797 #[derive(Clone, Default, PartialEq)]
7798 #[non_exhaustive]
7799 pub struct ChunkedDocument {
7800 /// List of chunks.
7801 pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
7802
7803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7804 }
7805
7806 impl ChunkedDocument {
7807 /// Creates a new default instance.
7808 pub fn new() -> Self {
7809 std::default::Default::default()
7810 }
7811
7812 /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
7813 ///
7814 /// # Example
7815 /// ```ignore,no_run
7816 /// # use google_cloud_documentai_v1::model::document::ChunkedDocument;
7817 /// use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7818 /// let x = ChunkedDocument::new()
7819 /// .set_chunks([
7820 /// Chunk::default()/* use setters */,
7821 /// Chunk::default()/* use (different) setters */,
7822 /// ]);
7823 /// ```
7824 pub fn set_chunks<T, V>(mut self, v: T) -> Self
7825 where
7826 T: std::iter::IntoIterator<Item = V>,
7827 V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
7828 {
7829 use std::iter::Iterator;
7830 self.chunks = v.into_iter().map(|i| i.into()).collect();
7831 self
7832 }
7833 }
7834
7835 impl wkt::message::Message for ChunkedDocument {
7836 fn typename() -> &'static str {
7837 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
7838 }
7839 }
7840
7841 /// Defines additional types related to [ChunkedDocument].
7842 pub mod chunked_document {
7843 #[allow(unused_imports)]
7844 use super::*;
7845
7846 /// Represents a chunk.
7847 #[derive(Clone, Default, PartialEq)]
7848 #[non_exhaustive]
7849 pub struct Chunk {
7850 /// ID of the chunk.
7851 pub chunk_id: std::string::String,
7852
7853 /// Unused.
7854 pub source_block_ids: std::vec::Vec<std::string::String>,
7855
7856 /// Text content of the chunk.
7857 pub content: std::string::String,
7858
7859 /// Page span of the chunk.
7860 pub page_span:
7861 std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
7862
7863 /// Page headers associated with the chunk.
7864 pub page_headers:
7865 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
7866
7867 /// Page footers associated with the chunk.
7868 pub page_footers:
7869 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
7870
7871 /// Chunk fields inside this chunk.
7872 pub chunk_fields:
7873 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkField>,
7874
7875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7876 }
7877
7878 impl Chunk {
7879 /// Creates a new default instance.
7880 pub fn new() -> Self {
7881 std::default::Default::default()
7882 }
7883
7884 /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
7885 ///
7886 /// # Example
7887 /// ```ignore,no_run
7888 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7889 /// let x = Chunk::new().set_chunk_id("example");
7890 /// ```
7891 pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
7892 mut self,
7893 v: T,
7894 ) -> Self {
7895 self.chunk_id = v.into();
7896 self
7897 }
7898
7899 /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
7900 ///
7901 /// # Example
7902 /// ```ignore,no_run
7903 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7904 /// let x = Chunk::new().set_source_block_ids(["a", "b", "c"]);
7905 /// ```
7906 pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
7907 where
7908 T: std::iter::IntoIterator<Item = V>,
7909 V: std::convert::Into<std::string::String>,
7910 {
7911 use std::iter::Iterator;
7912 self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
7913 self
7914 }
7915
7916 /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
7917 ///
7918 /// # Example
7919 /// ```ignore,no_run
7920 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7921 /// let x = Chunk::new().set_content("example");
7922 /// ```
7923 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7924 self.content = v.into();
7925 self
7926 }
7927
7928 /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7929 ///
7930 /// # Example
7931 /// ```ignore,no_run
7932 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7933 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7934 /// let x = Chunk::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7935 /// ```
7936 pub fn set_page_span<T>(mut self, v: T) -> Self
7937 where
7938 T: std::convert::Into<
7939 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7940 >,
7941 {
7942 self.page_span = std::option::Option::Some(v.into());
7943 self
7944 }
7945
7946 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7947 ///
7948 /// # Example
7949 /// ```ignore,no_run
7950 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7951 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7952 /// let x = Chunk::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7953 /// let x = Chunk::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7954 /// ```
7955 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7956 where
7957 T: std::convert::Into<
7958 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7959 >,
7960 {
7961 self.page_span = v.map(|x| x.into());
7962 self
7963 }
7964
7965 /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
7966 ///
7967 /// # Example
7968 /// ```ignore,no_run
7969 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7970 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7971 /// let x = Chunk::new()
7972 /// .set_page_headers([
7973 /// ChunkPageHeader::default()/* use setters */,
7974 /// ChunkPageHeader::default()/* use (different) setters */,
7975 /// ]);
7976 /// ```
7977 pub fn set_page_headers<T, V>(mut self, v: T) -> Self
7978 where
7979 T: std::iter::IntoIterator<Item = V>,
7980 V: std::convert::Into<
7981 crate::model::document::chunked_document::chunk::ChunkPageHeader,
7982 >,
7983 {
7984 use std::iter::Iterator;
7985 self.page_headers = v.into_iter().map(|i| i.into()).collect();
7986 self
7987 }
7988
7989 /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
7990 ///
7991 /// # Example
7992 /// ```ignore,no_run
7993 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7994 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7995 /// let x = Chunk::new()
7996 /// .set_page_footers([
7997 /// ChunkPageFooter::default()/* use setters */,
7998 /// ChunkPageFooter::default()/* use (different) setters */,
7999 /// ]);
8000 /// ```
8001 pub fn set_page_footers<T, V>(mut self, v: T) -> Self
8002 where
8003 T: std::iter::IntoIterator<Item = V>,
8004 V: std::convert::Into<
8005 crate::model::document::chunked_document::chunk::ChunkPageFooter,
8006 >,
8007 {
8008 use std::iter::Iterator;
8009 self.page_footers = v.into_iter().map(|i| i.into()).collect();
8010 self
8011 }
8012
8013 /// Sets the value of [chunk_fields][crate::model::document::chunked_document::Chunk::chunk_fields].
8014 ///
8015 /// # Example
8016 /// ```ignore,no_run
8017 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
8018 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8019 /// let x = Chunk::new()
8020 /// .set_chunk_fields([
8021 /// ChunkField::default()/* use setters */,
8022 /// ChunkField::default()/* use (different) setters */,
8023 /// ]);
8024 /// ```
8025 pub fn set_chunk_fields<T, V>(mut self, v: T) -> Self
8026 where
8027 T: std::iter::IntoIterator<Item = V>,
8028 V: std::convert::Into<crate::model::document::chunked_document::chunk::ChunkField>,
8029 {
8030 use std::iter::Iterator;
8031 self.chunk_fields = v.into_iter().map(|i| i.into()).collect();
8032 self
8033 }
8034 }
8035
8036 impl wkt::message::Message for Chunk {
8037 fn typename() -> &'static str {
8038 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
8039 }
8040 }
8041
8042 /// Defines additional types related to [Chunk].
8043 pub mod chunk {
8044 #[allow(unused_imports)]
8045 use super::*;
8046
8047 /// Represents where the chunk starts and ends in the document.
8048 #[derive(Clone, Default, PartialEq)]
8049 #[non_exhaustive]
8050 pub struct ChunkPageSpan {
8051 /// Page where chunk starts in the document.
8052 pub page_start: i32,
8053
8054 /// Page where chunk ends in the document.
8055 pub page_end: i32,
8056
8057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8058 }
8059
8060 impl ChunkPageSpan {
8061 /// Creates a new default instance.
8062 pub fn new() -> Self {
8063 std::default::Default::default()
8064 }
8065
8066 /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
8067 ///
8068 /// # Example
8069 /// ```ignore,no_run
8070 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8071 /// let x = ChunkPageSpan::new().set_page_start(42);
8072 /// ```
8073 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8074 self.page_start = v.into();
8075 self
8076 }
8077
8078 /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
8079 ///
8080 /// # Example
8081 /// ```ignore,no_run
8082 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8083 /// let x = ChunkPageSpan::new().set_page_end(42);
8084 /// ```
8085 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8086 self.page_end = v.into();
8087 self
8088 }
8089 }
8090
8091 impl wkt::message::Message for ChunkPageSpan {
8092 fn typename() -> &'static str {
8093 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
8094 }
8095 }
8096
8097 /// Represents the page header associated with the chunk.
8098 #[derive(Clone, Default, PartialEq)]
8099 #[non_exhaustive]
8100 pub struct ChunkPageHeader {
8101 /// Header in text format.
8102 pub text: std::string::String,
8103
8104 /// Page span of the header.
8105 pub page_span: std::option::Option<
8106 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8107 >,
8108
8109 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8110 }
8111
8112 impl ChunkPageHeader {
8113 /// Creates a new default instance.
8114 pub fn new() -> Self {
8115 std::default::Default::default()
8116 }
8117
8118 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
8119 ///
8120 /// # Example
8121 /// ```ignore,no_run
8122 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8123 /// let x = ChunkPageHeader::new().set_text("example");
8124 /// ```
8125 pub fn set_text<T: std::convert::Into<std::string::String>>(
8126 mut self,
8127 v: T,
8128 ) -> Self {
8129 self.text = v.into();
8130 self
8131 }
8132
8133 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8134 ///
8135 /// # Example
8136 /// ```ignore,no_run
8137 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8138 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8139 /// let x = ChunkPageHeader::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8140 /// ```
8141 pub fn set_page_span<T>(mut self, v: T) -> Self
8142 where
8143 T: std::convert::Into<
8144 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8145 >,
8146 {
8147 self.page_span = std::option::Option::Some(v.into());
8148 self
8149 }
8150
8151 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8152 ///
8153 /// # Example
8154 /// ```ignore,no_run
8155 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8156 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8157 /// let x = ChunkPageHeader::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8158 /// let x = ChunkPageHeader::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8159 /// ```
8160 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8161 where
8162 T: std::convert::Into<
8163 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8164 >,
8165 {
8166 self.page_span = v.map(|x| x.into());
8167 self
8168 }
8169 }
8170
8171 impl wkt::message::Message for ChunkPageHeader {
8172 fn typename() -> &'static str {
8173 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
8174 }
8175 }
8176
8177 /// Represents the page footer associated with the chunk.
8178 #[derive(Clone, Default, PartialEq)]
8179 #[non_exhaustive]
8180 pub struct ChunkPageFooter {
8181 /// Footer in text format.
8182 pub text: std::string::String,
8183
8184 /// Page span of the footer.
8185 pub page_span: std::option::Option<
8186 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8187 >,
8188
8189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8190 }
8191
8192 impl ChunkPageFooter {
8193 /// Creates a new default instance.
8194 pub fn new() -> Self {
8195 std::default::Default::default()
8196 }
8197
8198 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
8199 ///
8200 /// # Example
8201 /// ```ignore,no_run
8202 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8203 /// let x = ChunkPageFooter::new().set_text("example");
8204 /// ```
8205 pub fn set_text<T: std::convert::Into<std::string::String>>(
8206 mut self,
8207 v: T,
8208 ) -> Self {
8209 self.text = v.into();
8210 self
8211 }
8212
8213 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8214 ///
8215 /// # Example
8216 /// ```ignore,no_run
8217 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8218 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8219 /// let x = ChunkPageFooter::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8220 /// ```
8221 pub fn set_page_span<T>(mut self, v: T) -> Self
8222 where
8223 T: std::convert::Into<
8224 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8225 >,
8226 {
8227 self.page_span = std::option::Option::Some(v.into());
8228 self
8229 }
8230
8231 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8232 ///
8233 /// # Example
8234 /// ```ignore,no_run
8235 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8236 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8237 /// let x = ChunkPageFooter::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8238 /// let x = ChunkPageFooter::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8239 /// ```
8240 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8241 where
8242 T: std::convert::Into<
8243 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8244 >,
8245 {
8246 self.page_span = v.map(|x| x.into());
8247 self
8248 }
8249 }
8250
8251 impl wkt::message::Message for ChunkPageFooter {
8252 fn typename() -> &'static str {
8253 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
8254 }
8255 }
8256
8257 /// The image chunk field in the chunk.
8258 #[derive(Clone, Default, PartialEq)]
8259 #[non_exhaustive]
8260 pub struct ImageChunkField {
8261 /// Annotation of the image chunk field.
8262 pub annotations: std::option::Option<crate::model::document::Annotations>,
8263
8264 /// Source of the image.
8265 pub image_source: std::option::Option<
8266 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource,
8267 >,
8268
8269 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8270 }
8271
8272 impl ImageChunkField {
8273 /// Creates a new default instance.
8274 pub fn new() -> Self {
8275 std::default::Default::default()
8276 }
8277
8278 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8279 ///
8280 /// # Example
8281 /// ```ignore,no_run
8282 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8283 /// use google_cloud_documentai_v1::model::document::Annotations;
8284 /// let x = ImageChunkField::new().set_annotations(Annotations::default()/* use setters */);
8285 /// ```
8286 pub fn set_annotations<T>(mut self, v: T) -> Self
8287 where
8288 T: std::convert::Into<crate::model::document::Annotations>,
8289 {
8290 self.annotations = std::option::Option::Some(v.into());
8291 self
8292 }
8293
8294 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8295 ///
8296 /// # Example
8297 /// ```ignore,no_run
8298 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8299 /// use google_cloud_documentai_v1::model::document::Annotations;
8300 /// let x = ImageChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8301 /// let x = ImageChunkField::new().set_or_clear_annotations(None::<Annotations>);
8302 /// ```
8303 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8304 where
8305 T: std::convert::Into<crate::model::document::Annotations>,
8306 {
8307 self.annotations = v.map(|x| x.into());
8308 self
8309 }
8310
8311 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source].
8312 ///
8313 /// Note that all the setters affecting `image_source` are mutually
8314 /// exclusive.
8315 ///
8316 /// # Example
8317 /// ```ignore,no_run
8318 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8319 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::image_chunk_field::ImageSource;
8320 /// let x = ImageChunkField::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
8321 /// ```
8322 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
8323 {
8324 self.image_source = v.into();
8325 self
8326 }
8327
8328 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8329 /// if it holds a `BlobAssetId`, `None` if the field is not set or
8330 /// holds a different branch.
8331 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
8332 #[allow(unreachable_patterns)]
8333 self.image_source.as_ref().and_then(|v| match v {
8334 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
8335 _ => std::option::Option::None,
8336 })
8337 }
8338
8339 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8340 /// to hold a `BlobAssetId`.
8341 ///
8342 /// Note that all the setters affecting `image_source` are
8343 /// mutually exclusive.
8344 ///
8345 /// # Example
8346 /// ```ignore,no_run
8347 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8348 /// let x = ImageChunkField::new().set_blob_asset_id("example");
8349 /// assert!(x.blob_asset_id().is_some());
8350 /// assert!(x.gcs_uri().is_none());
8351 /// assert!(x.data_uri().is_none());
8352 /// ```
8353 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
8354 mut self,
8355 v: T,
8356 ) -> Self {
8357 self.image_source = std::option::Option::Some(
8358 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(
8359 v.into()
8360 )
8361 );
8362 self
8363 }
8364
8365 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8366 /// if it holds a `GcsUri`, `None` if the field is not set or
8367 /// holds a different branch.
8368 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
8369 #[allow(unreachable_patterns)]
8370 self.image_source.as_ref().and_then(|v| match v {
8371 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(v) => std::option::Option::Some(v),
8372 _ => std::option::Option::None,
8373 })
8374 }
8375
8376 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8377 /// to hold a `GcsUri`.
8378 ///
8379 /// Note that all the setters affecting `image_source` are
8380 /// mutually exclusive.
8381 ///
8382 /// # Example
8383 /// ```ignore,no_run
8384 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8385 /// let x = ImageChunkField::new().set_gcs_uri("example");
8386 /// assert!(x.gcs_uri().is_some());
8387 /// assert!(x.blob_asset_id().is_none());
8388 /// assert!(x.data_uri().is_none());
8389 /// ```
8390 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
8391 mut self,
8392 v: T,
8393 ) -> Self {
8394 self.image_source = std::option::Option::Some(
8395 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(
8396 v.into()
8397 )
8398 );
8399 self
8400 }
8401
8402 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8403 /// if it holds a `DataUri`, `None` if the field is not set or
8404 /// holds a different branch.
8405 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
8406 #[allow(unreachable_patterns)]
8407 self.image_source.as_ref().and_then(|v| match v {
8408 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(v) => std::option::Option::Some(v),
8409 _ => std::option::Option::None,
8410 })
8411 }
8412
8413 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8414 /// to hold a `DataUri`.
8415 ///
8416 /// Note that all the setters affecting `image_source` are
8417 /// mutually exclusive.
8418 ///
8419 /// # Example
8420 /// ```ignore,no_run
8421 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8422 /// let x = ImageChunkField::new().set_data_uri("example");
8423 /// assert!(x.data_uri().is_some());
8424 /// assert!(x.blob_asset_id().is_none());
8425 /// assert!(x.gcs_uri().is_none());
8426 /// ```
8427 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
8428 mut self,
8429 v: T,
8430 ) -> Self {
8431 self.image_source = std::option::Option::Some(
8432 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(
8433 v.into()
8434 )
8435 );
8436 self
8437 }
8438 }
8439
8440 impl wkt::message::Message for ImageChunkField {
8441 fn typename() -> &'static str {
8442 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ImageChunkField"
8443 }
8444 }
8445
8446 /// Defines additional types related to [ImageChunkField].
8447 pub mod image_chunk_field {
8448 #[allow(unused_imports)]
8449 use super::*;
8450
8451 /// Source of the image.
8452 #[derive(Clone, Debug, PartialEq)]
8453 #[non_exhaustive]
8454 pub enum ImageSource {
8455 /// Optional. Asset id of the inline image. If set, find the image
8456 /// content in the blob_assets field.
8457 BlobAssetId(std::string::String),
8458 /// Optional. Google Cloud Storage uri of the image.
8459 GcsUri(std::string::String),
8460 /// Optional. Data uri of the image.
8461 /// It is composed of four parts: a prefix (data:), a MIME type
8462 /// indicating the type of data, an optional base64 token if
8463 /// non-textual, and the data itself:
8464 /// data:[\<mediatype\>][;base64],\<data\>
8465 DataUri(std::string::String),
8466 }
8467 }
8468
8469 /// The table chunk field in the chunk.
8470 #[derive(Clone, Default, PartialEq)]
8471 #[non_exhaustive]
8472 pub struct TableChunkField {
8473 /// Annotation of the table chunk field.
8474 pub annotations: std::option::Option<crate::model::document::Annotations>,
8475
8476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8477 }
8478
8479 impl TableChunkField {
8480 /// Creates a new default instance.
8481 pub fn new() -> Self {
8482 std::default::Default::default()
8483 }
8484
8485 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8486 ///
8487 /// # Example
8488 /// ```ignore,no_run
8489 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8490 /// use google_cloud_documentai_v1::model::document::Annotations;
8491 /// let x = TableChunkField::new().set_annotations(Annotations::default()/* use setters */);
8492 /// ```
8493 pub fn set_annotations<T>(mut self, v: T) -> Self
8494 where
8495 T: std::convert::Into<crate::model::document::Annotations>,
8496 {
8497 self.annotations = std::option::Option::Some(v.into());
8498 self
8499 }
8500
8501 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8502 ///
8503 /// # Example
8504 /// ```ignore,no_run
8505 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8506 /// use google_cloud_documentai_v1::model::document::Annotations;
8507 /// let x = TableChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8508 /// let x = TableChunkField::new().set_or_clear_annotations(None::<Annotations>);
8509 /// ```
8510 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8511 where
8512 T: std::convert::Into<crate::model::document::Annotations>,
8513 {
8514 self.annotations = v.map(|x| x.into());
8515 self
8516 }
8517 }
8518
8519 impl wkt::message::Message for TableChunkField {
8520 fn typename() -> &'static str {
8521 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.TableChunkField"
8522 }
8523 }
8524
8525 /// The chunk field in the chunk. A chunk field could be one of the various
8526 /// types (for example, image, table) supported.
8527 #[derive(Clone, Default, PartialEq)]
8528 #[non_exhaustive]
8529 pub struct ChunkField {
8530 /// The type of the chunk field.
8531 pub field_type: std::option::Option<
8532 crate::model::document::chunked_document::chunk::chunk_field::FieldType,
8533 >,
8534
8535 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8536 }
8537
8538 impl ChunkField {
8539 /// Creates a new default instance.
8540 pub fn new() -> Self {
8541 std::default::Default::default()
8542 }
8543
8544 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type].
8545 ///
8546 /// Note that all the setters affecting `field_type` are mutually
8547 /// exclusive.
8548 ///
8549 /// # Example
8550 /// ```ignore,no_run
8551 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8552 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8553 /// let x = ChunkField::new().set_field_type(Some(
8554 /// google_cloud_documentai_v1::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(ImageChunkField::default().into())));
8555 /// ```
8556 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
8557 {
8558 self.field_type = v.into();
8559 self
8560 }
8561
8562 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8563 /// if it holds a `ImageChunkField`, `None` if the field is not set or
8564 /// holds a different branch.
8565 pub fn image_chunk_field(
8566 &self,
8567 ) -> std::option::Option<
8568 &std::boxed::Box<
8569 crate::model::document::chunked_document::chunk::ImageChunkField,
8570 >,
8571 > {
8572 #[allow(unreachable_patterns)]
8573 self.field_type.as_ref().and_then(|v| match v {
8574 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(v) => std::option::Option::Some(v),
8575 _ => std::option::Option::None,
8576 })
8577 }
8578
8579 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8580 /// to hold a `ImageChunkField`.
8581 ///
8582 /// Note that all the setters affecting `field_type` are
8583 /// mutually exclusive.
8584 ///
8585 /// # Example
8586 /// ```ignore,no_run
8587 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8588 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8589 /// let x = ChunkField::new().set_image_chunk_field(ImageChunkField::default()/* use setters */);
8590 /// assert!(x.image_chunk_field().is_some());
8591 /// assert!(x.table_chunk_field().is_none());
8592 /// ```
8593 pub fn set_image_chunk_field<
8594 T: std::convert::Into<
8595 std::boxed::Box<
8596 crate::model::document::chunked_document::chunk::ImageChunkField,
8597 >,
8598 >,
8599 >(
8600 mut self,
8601 v: T,
8602 ) -> Self {
8603 self.field_type = std::option::Option::Some(
8604 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(
8605 v.into()
8606 )
8607 );
8608 self
8609 }
8610
8611 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8612 /// if it holds a `TableChunkField`, `None` if the field is not set or
8613 /// holds a different branch.
8614 pub fn table_chunk_field(
8615 &self,
8616 ) -> std::option::Option<
8617 &std::boxed::Box<
8618 crate::model::document::chunked_document::chunk::TableChunkField,
8619 >,
8620 > {
8621 #[allow(unreachable_patterns)]
8622 self.field_type.as_ref().and_then(|v| match v {
8623 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(v) => std::option::Option::Some(v),
8624 _ => std::option::Option::None,
8625 })
8626 }
8627
8628 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8629 /// to hold a `TableChunkField`.
8630 ///
8631 /// Note that all the setters affecting `field_type` are
8632 /// mutually exclusive.
8633 ///
8634 /// # Example
8635 /// ```ignore,no_run
8636 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8637 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8638 /// let x = ChunkField::new().set_table_chunk_field(TableChunkField::default()/* use setters */);
8639 /// assert!(x.table_chunk_field().is_some());
8640 /// assert!(x.image_chunk_field().is_none());
8641 /// ```
8642 pub fn set_table_chunk_field<
8643 T: std::convert::Into<
8644 std::boxed::Box<
8645 crate::model::document::chunked_document::chunk::TableChunkField,
8646 >,
8647 >,
8648 >(
8649 mut self,
8650 v: T,
8651 ) -> Self {
8652 self.field_type = std::option::Option::Some(
8653 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(
8654 v.into()
8655 )
8656 );
8657 self
8658 }
8659 }
8660
8661 impl wkt::message::Message for ChunkField {
8662 fn typename() -> &'static str {
8663 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkField"
8664 }
8665 }
8666
8667 /// Defines additional types related to [ChunkField].
8668 pub mod chunk_field {
8669 #[allow(unused_imports)]
8670 use super::*;
8671
8672 /// The type of the chunk field.
8673 #[derive(Clone, Debug, PartialEq)]
8674 #[non_exhaustive]
8675 pub enum FieldType {
8676 /// The image chunk field in the chunk.
8677 ImageChunkField(
8678 std::boxed::Box<
8679 crate::model::document::chunked_document::chunk::ImageChunkField,
8680 >,
8681 ),
8682 /// The table chunk field in the chunk.
8683 TableChunkField(
8684 std::boxed::Box<
8685 crate::model::document::chunked_document::chunk::TableChunkField,
8686 >,
8687 ),
8688 }
8689 }
8690 }
8691 }
8692
8693 /// Represents a blob asset. It's used to store the content of the inline blob
8694 /// in this document, for example, image bytes, such that it can be referenced
8695 /// by other fields in the document via asset ID.
8696 #[derive(Clone, Default, PartialEq)]
8697 #[non_exhaustive]
8698 pub struct BlobAsset {
8699 /// Optional. The id of the blob asset.
8700 pub asset_id: std::string::String,
8701
8702 /// Optional. The content of the blob asset, for example, image bytes.
8703 pub content: ::bytes::Bytes,
8704
8705 /// The mime type of the blob asset.
8706 /// An IANA published [media type (MIME
8707 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
8708 pub mime_type: std::string::String,
8709
8710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8711 }
8712
8713 impl BlobAsset {
8714 /// Creates a new default instance.
8715 pub fn new() -> Self {
8716 std::default::Default::default()
8717 }
8718
8719 /// Sets the value of [asset_id][crate::model::document::BlobAsset::asset_id].
8720 ///
8721 /// # Example
8722 /// ```ignore,no_run
8723 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8724 /// let x = BlobAsset::new().set_asset_id("example");
8725 /// ```
8726 pub fn set_asset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8727 self.asset_id = v.into();
8728 self
8729 }
8730
8731 /// Sets the value of [content][crate::model::document::BlobAsset::content].
8732 ///
8733 /// # Example
8734 /// ```ignore,no_run
8735 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8736 /// let x = BlobAsset::new().set_content(bytes::Bytes::from_static(b"example"));
8737 /// ```
8738 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8739 self.content = v.into();
8740 self
8741 }
8742
8743 /// Sets the value of [mime_type][crate::model::document::BlobAsset::mime_type].
8744 ///
8745 /// # Example
8746 /// ```ignore,no_run
8747 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8748 /// let x = BlobAsset::new().set_mime_type("example");
8749 /// ```
8750 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8751 self.mime_type = v.into();
8752 self
8753 }
8754 }
8755
8756 impl wkt::message::Message for BlobAsset {
8757 fn typename() -> &'static str {
8758 "type.googleapis.com/google.cloud.documentai.v1.Document.BlobAsset"
8759 }
8760 }
8761
8762 /// The output of the validation given the document and the validation rules.
8763 #[derive(Clone, Default, PartialEq)]
8764 #[non_exhaustive]
8765 pub struct EntityValidationOutput {
8766 /// The result of each validation rule.
8767 pub validation_results:
8768 std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
8769
8770 /// The overall result of the validation, true if all applicable rules are
8771 /// valid.
8772 pub pass_all_rules: bool,
8773
8774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8775 }
8776
8777 impl EntityValidationOutput {
8778 /// Creates a new default instance.
8779 pub fn new() -> Self {
8780 std::default::Default::default()
8781 }
8782
8783 /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
8784 ///
8785 /// # Example
8786 /// ```ignore,no_run
8787 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8788 /// use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8789 /// let x = EntityValidationOutput::new()
8790 /// .set_validation_results([
8791 /// ValidationResult::default()/* use setters */,
8792 /// ValidationResult::default()/* use (different) setters */,
8793 /// ]);
8794 /// ```
8795 pub fn set_validation_results<T, V>(mut self, v: T) -> Self
8796 where
8797 T: std::iter::IntoIterator<Item = V>,
8798 V: std::convert::Into<
8799 crate::model::document::entity_validation_output::ValidationResult,
8800 >,
8801 {
8802 use std::iter::Iterator;
8803 self.validation_results = v.into_iter().map(|i| i.into()).collect();
8804 self
8805 }
8806
8807 /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
8808 ///
8809 /// # Example
8810 /// ```ignore,no_run
8811 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8812 /// let x = EntityValidationOutput::new().set_pass_all_rules(true);
8813 /// ```
8814 pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8815 self.pass_all_rules = v.into();
8816 self
8817 }
8818 }
8819
8820 impl wkt::message::Message for EntityValidationOutput {
8821 fn typename() -> &'static str {
8822 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
8823 }
8824 }
8825
8826 /// Defines additional types related to [EntityValidationOutput].
8827 pub mod entity_validation_output {
8828 #[allow(unused_imports)]
8829 use super::*;
8830
8831 /// Validation result for a single validation rule.
8832 #[derive(Clone, Default, PartialEq)]
8833 #[non_exhaustive]
8834 pub struct ValidationResult {
8835
8836 /// The name of the validation rule.
8837 pub rule_name: std::string::String,
8838
8839 /// The description of the validation rule.
8840 pub rule_description: std::string::String,
8841
8842 /// The result of the validation rule.
8843 pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
8844
8845 /// The detailed information of the running the validation process using
8846 /// the entity from the document based on the validation rule.
8847 pub validation_details: std::string::String,
8848
8849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8850 }
8851
8852 impl ValidationResult {
8853 /// Creates a new default instance.
8854 pub fn new() -> Self {
8855 std::default::Default::default()
8856 }
8857
8858 /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
8859 ///
8860 /// # Example
8861 /// ```ignore,no_run
8862 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8863 /// let x = ValidationResult::new().set_rule_name("example");
8864 /// ```
8865 pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
8866 mut self,
8867 v: T,
8868 ) -> Self {
8869 self.rule_name = v.into();
8870 self
8871 }
8872
8873 /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
8874 ///
8875 /// # Example
8876 /// ```ignore,no_run
8877 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8878 /// let x = ValidationResult::new().set_rule_description("example");
8879 /// ```
8880 pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
8881 mut self,
8882 v: T,
8883 ) -> Self {
8884 self.rule_description = v.into();
8885 self
8886 }
8887
8888 /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
8889 ///
8890 /// # Example
8891 /// ```ignore,no_run
8892 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8893 /// use google_cloud_documentai_v1::model::document::entity_validation_output::validation_result::ValidationResultType;
8894 /// let x0 = ValidationResult::new().set_validation_result_type(ValidationResultType::Valid);
8895 /// let x1 = ValidationResult::new().set_validation_result_type(ValidationResultType::Invalid);
8896 /// let x2 = ValidationResult::new().set_validation_result_type(ValidationResultType::Skipped);
8897 /// ```
8898 pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
8899 self.validation_result_type = v.into();
8900 self
8901 }
8902
8903 /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
8904 ///
8905 /// # Example
8906 /// ```ignore,no_run
8907 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8908 /// let x = ValidationResult::new().set_validation_details("example");
8909 /// ```
8910 pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
8911 mut self,
8912 v: T,
8913 ) -> Self {
8914 self.validation_details = v.into();
8915 self
8916 }
8917 }
8918
8919 impl wkt::message::Message for ValidationResult {
8920 fn typename() -> &'static str {
8921 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
8922 }
8923 }
8924
8925 /// Defines additional types related to [ValidationResult].
8926 pub mod validation_result {
8927 #[allow(unused_imports)]
8928 use super::*;
8929
8930 /// The result of the validation rule.
8931 ///
8932 /// # Working with unknown values
8933 ///
8934 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8935 /// additional enum variants at any time. Adding new variants is not considered
8936 /// a breaking change. Applications should write their code in anticipation of:
8937 ///
8938 /// - New values appearing in future releases of the client library, **and**
8939 /// - New values received dynamically, without application changes.
8940 ///
8941 /// Please consult the [Working with enums] section in the user guide for some
8942 /// guidelines.
8943 ///
8944 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8945 #[derive(Clone, Debug, PartialEq)]
8946 #[non_exhaustive]
8947 pub enum ValidationResultType {
8948 /// The validation result type is unspecified.
8949 Unspecified,
8950 /// The validation is valid.
8951 Valid,
8952 /// The validation is invalid.
8953 Invalid,
8954 /// The validation is skipped.
8955 Skipped,
8956 /// The validation is not applicable.
8957 NotApplicable,
8958 /// If set, the enum was initialized with an unknown value.
8959 ///
8960 /// Applications can examine the value using [ValidationResultType::value] or
8961 /// [ValidationResultType::name].
8962 UnknownValue(validation_result_type::UnknownValue),
8963 }
8964
8965 #[doc(hidden)]
8966 pub mod validation_result_type {
8967 #[allow(unused_imports)]
8968 use super::*;
8969 #[derive(Clone, Debug, PartialEq)]
8970 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8971 }
8972
8973 impl ValidationResultType {
8974 /// Gets the enum value.
8975 ///
8976 /// Returns `None` if the enum contains an unknown value deserialized from
8977 /// the string representation of enums.
8978 pub fn value(&self) -> std::option::Option<i32> {
8979 match self {
8980 Self::Unspecified => std::option::Option::Some(0),
8981 Self::Valid => std::option::Option::Some(1),
8982 Self::Invalid => std::option::Option::Some(2),
8983 Self::Skipped => std::option::Option::Some(3),
8984 Self::NotApplicable => std::option::Option::Some(4),
8985 Self::UnknownValue(u) => u.0.value(),
8986 }
8987 }
8988
8989 /// Gets the enum value as a string.
8990 ///
8991 /// Returns `None` if the enum contains an unknown value deserialized from
8992 /// the integer representation of enums.
8993 pub fn name(&self) -> std::option::Option<&str> {
8994 match self {
8995 Self::Unspecified => {
8996 std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
8997 }
8998 Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
8999 Self::Invalid => {
9000 std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
9001 }
9002 Self::Skipped => {
9003 std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
9004 }
9005 Self::NotApplicable => {
9006 std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
9007 }
9008 Self::UnknownValue(u) => u.0.name(),
9009 }
9010 }
9011 }
9012
9013 impl std::default::Default for ValidationResultType {
9014 fn default() -> Self {
9015 use std::convert::From;
9016 Self::from(0)
9017 }
9018 }
9019
9020 impl std::fmt::Display for ValidationResultType {
9021 fn fmt(
9022 &self,
9023 f: &mut std::fmt::Formatter<'_>,
9024 ) -> std::result::Result<(), std::fmt::Error> {
9025 wkt::internal::display_enum(f, self.name(), self.value())
9026 }
9027 }
9028
9029 impl std::convert::From<i32> for ValidationResultType {
9030 fn from(value: i32) -> Self {
9031 match value {
9032 0 => Self::Unspecified,
9033 1 => Self::Valid,
9034 2 => Self::Invalid,
9035 3 => Self::Skipped,
9036 4 => Self::NotApplicable,
9037 _ => Self::UnknownValue(validation_result_type::UnknownValue(
9038 wkt::internal::UnknownEnumValue::Integer(value),
9039 )),
9040 }
9041 }
9042 }
9043
9044 impl std::convert::From<&str> for ValidationResultType {
9045 fn from(value: &str) -> Self {
9046 use std::string::ToString;
9047 match value {
9048 "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
9049 "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
9050 "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
9051 "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
9052 "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
9053 _ => Self::UnknownValue(validation_result_type::UnknownValue(
9054 wkt::internal::UnknownEnumValue::String(value.to_string()),
9055 )),
9056 }
9057 }
9058 }
9059
9060 impl serde::ser::Serialize for ValidationResultType {
9061 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9062 where
9063 S: serde::Serializer,
9064 {
9065 match self {
9066 Self::Unspecified => serializer.serialize_i32(0),
9067 Self::Valid => serializer.serialize_i32(1),
9068 Self::Invalid => serializer.serialize_i32(2),
9069 Self::Skipped => serializer.serialize_i32(3),
9070 Self::NotApplicable => serializer.serialize_i32(4),
9071 Self::UnknownValue(u) => u.0.serialize(serializer),
9072 }
9073 }
9074 }
9075
9076 impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
9077 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9078 where
9079 D: serde::Deserializer<'de>,
9080 {
9081 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
9082 ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
9083 }
9084 }
9085 }
9086 }
9087
9088 /// Entity revision.
9089 #[derive(Clone, Default, PartialEq)]
9090 #[non_exhaustive]
9091 pub struct EntitiesRevision {
9092 /// The revision id.
9093 pub revision_id: std::string::String,
9094
9095 /// The entities in this revision.
9096 pub entities: std::vec::Vec<crate::model::document::Entity>,
9097
9098 /// The entity validation output for this revision.
9099 pub entity_validation_output:
9100 std::option::Option<crate::model::document::EntityValidationOutput>,
9101
9102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9103 }
9104
9105 impl EntitiesRevision {
9106 /// Creates a new default instance.
9107 pub fn new() -> Self {
9108 std::default::Default::default()
9109 }
9110
9111 /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
9112 ///
9113 /// # Example
9114 /// ```ignore,no_run
9115 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9116 /// let x = EntitiesRevision::new().set_revision_id("example");
9117 /// ```
9118 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9119 self.revision_id = v.into();
9120 self
9121 }
9122
9123 /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
9124 ///
9125 /// # Example
9126 /// ```ignore,no_run
9127 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9128 /// use google_cloud_documentai_v1::model::document::Entity;
9129 /// let x = EntitiesRevision::new()
9130 /// .set_entities([
9131 /// Entity::default()/* use setters */,
9132 /// Entity::default()/* use (different) setters */,
9133 /// ]);
9134 /// ```
9135 pub fn set_entities<T, V>(mut self, v: T) -> Self
9136 where
9137 T: std::iter::IntoIterator<Item = V>,
9138 V: std::convert::Into<crate::model::document::Entity>,
9139 {
9140 use std::iter::Iterator;
9141 self.entities = v.into_iter().map(|i| i.into()).collect();
9142 self
9143 }
9144
9145 /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9146 ///
9147 /// # Example
9148 /// ```ignore,no_run
9149 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9150 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9151 /// let x = EntitiesRevision::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
9152 /// ```
9153 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
9154 where
9155 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9156 {
9157 self.entity_validation_output = std::option::Option::Some(v.into());
9158 self
9159 }
9160
9161 /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9162 ///
9163 /// # Example
9164 /// ```ignore,no_run
9165 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9166 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9167 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
9168 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
9169 /// ```
9170 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
9171 where
9172 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9173 {
9174 self.entity_validation_output = v.map(|x| x.into());
9175 self
9176 }
9177 }
9178
9179 impl wkt::message::Message for EntitiesRevision {
9180 fn typename() -> &'static str {
9181 "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
9182 }
9183 }
9184
9185 /// Original source document from the user.
9186 #[derive(Clone, Debug, PartialEq)]
9187 #[non_exhaustive]
9188 pub enum Source {
9189 /// Optional. Currently supports Google Cloud Storage URI of the form
9190 /// `gs://bucket_name/object_name`. Object versioning is not supported.
9191 /// For more information, refer to [Google Cloud Storage Request
9192 /// URIs](https://cloud.google.com/storage/docs/reference-uris).
9193 Uri(std::string::String),
9194 /// Optional. Inline document content, represented as a stream of bytes.
9195 /// Note: As with all `bytes` fields, protobuffers use a pure binary
9196 /// representation, whereas JSON representations use base64.
9197 Content(::bytes::Bytes),
9198 }
9199}
9200
9201/// Payload message of raw document content (bytes).
9202#[derive(Clone, Default, PartialEq)]
9203#[non_exhaustive]
9204pub struct RawDocument {
9205 /// Inline document content.
9206 pub content: ::bytes::Bytes,
9207
9208 /// An IANA MIME type (RFC6838) indicating the nature and format of the
9209 /// [content][google.cloud.documentai.v1.RawDocument.content].
9210 ///
9211 /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
9212 pub mime_type: std::string::String,
9213
9214 /// The display name of the document, it supports all Unicode characters except
9215 /// the following:
9216 /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
9217 /// `~`, `=` and `:` are reserved.
9218 /// If not specified, a default ID is generated.
9219 pub display_name: std::string::String,
9220
9221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9222}
9223
9224impl RawDocument {
9225 /// Creates a new default instance.
9226 pub fn new() -> Self {
9227 std::default::Default::default()
9228 }
9229
9230 /// Sets the value of [content][crate::model::RawDocument::content].
9231 ///
9232 /// # Example
9233 /// ```ignore,no_run
9234 /// # use google_cloud_documentai_v1::model::RawDocument;
9235 /// let x = RawDocument::new().set_content(bytes::Bytes::from_static(b"example"));
9236 /// ```
9237 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9238 self.content = v.into();
9239 self
9240 }
9241
9242 /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
9243 ///
9244 /// # Example
9245 /// ```ignore,no_run
9246 /// # use google_cloud_documentai_v1::model::RawDocument;
9247 /// let x = RawDocument::new().set_mime_type("example");
9248 /// ```
9249 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9250 self.mime_type = v.into();
9251 self
9252 }
9253
9254 /// Sets the value of [display_name][crate::model::RawDocument::display_name].
9255 ///
9256 /// # Example
9257 /// ```ignore,no_run
9258 /// # use google_cloud_documentai_v1::model::RawDocument;
9259 /// let x = RawDocument::new().set_display_name("example");
9260 /// ```
9261 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9262 self.display_name = v.into();
9263 self
9264 }
9265}
9266
9267impl wkt::message::Message for RawDocument {
9268 fn typename() -> &'static str {
9269 "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
9270 }
9271}
9272
9273/// Specifies a document stored on Cloud Storage.
9274#[derive(Clone, Default, PartialEq)]
9275#[non_exhaustive]
9276pub struct GcsDocument {
9277 /// The Cloud Storage object uri.
9278 pub gcs_uri: std::string::String,
9279
9280 /// An IANA MIME type (RFC6838) of the content.
9281 pub mime_type: std::string::String,
9282
9283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9284}
9285
9286impl GcsDocument {
9287 /// Creates a new default instance.
9288 pub fn new() -> Self {
9289 std::default::Default::default()
9290 }
9291
9292 /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
9293 ///
9294 /// # Example
9295 /// ```ignore,no_run
9296 /// # use google_cloud_documentai_v1::model::GcsDocument;
9297 /// let x = GcsDocument::new().set_gcs_uri("example");
9298 /// ```
9299 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9300 self.gcs_uri = v.into();
9301 self
9302 }
9303
9304 /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
9305 ///
9306 /// # Example
9307 /// ```ignore,no_run
9308 /// # use google_cloud_documentai_v1::model::GcsDocument;
9309 /// let x = GcsDocument::new().set_mime_type("example");
9310 /// ```
9311 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9312 self.mime_type = v.into();
9313 self
9314 }
9315}
9316
9317impl wkt::message::Message for GcsDocument {
9318 fn typename() -> &'static str {
9319 "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
9320 }
9321}
9322
9323/// Specifies a set of documents on Cloud Storage.
9324#[derive(Clone, Default, PartialEq)]
9325#[non_exhaustive]
9326pub struct GcsDocuments {
9327 /// The list of documents.
9328 pub documents: std::vec::Vec<crate::model::GcsDocument>,
9329
9330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9331}
9332
9333impl GcsDocuments {
9334 /// Creates a new default instance.
9335 pub fn new() -> Self {
9336 std::default::Default::default()
9337 }
9338
9339 /// Sets the value of [documents][crate::model::GcsDocuments::documents].
9340 ///
9341 /// # Example
9342 /// ```ignore,no_run
9343 /// # use google_cloud_documentai_v1::model::GcsDocuments;
9344 /// use google_cloud_documentai_v1::model::GcsDocument;
9345 /// let x = GcsDocuments::new()
9346 /// .set_documents([
9347 /// GcsDocument::default()/* use setters */,
9348 /// GcsDocument::default()/* use (different) setters */,
9349 /// ]);
9350 /// ```
9351 pub fn set_documents<T, V>(mut self, v: T) -> Self
9352 where
9353 T: std::iter::IntoIterator<Item = V>,
9354 V: std::convert::Into<crate::model::GcsDocument>,
9355 {
9356 use std::iter::Iterator;
9357 self.documents = v.into_iter().map(|i| i.into()).collect();
9358 self
9359 }
9360}
9361
9362impl wkt::message::Message for GcsDocuments {
9363 fn typename() -> &'static str {
9364 "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
9365 }
9366}
9367
9368/// Specifies all documents on Cloud Storage with a common prefix.
9369#[derive(Clone, Default, PartialEq)]
9370#[non_exhaustive]
9371pub struct GcsPrefix {
9372 /// The URI prefix.
9373 pub gcs_uri_prefix: std::string::String,
9374
9375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9376}
9377
9378impl GcsPrefix {
9379 /// Creates a new default instance.
9380 pub fn new() -> Self {
9381 std::default::Default::default()
9382 }
9383
9384 /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
9385 ///
9386 /// # Example
9387 /// ```ignore,no_run
9388 /// # use google_cloud_documentai_v1::model::GcsPrefix;
9389 /// let x = GcsPrefix::new().set_gcs_uri_prefix("example");
9390 /// ```
9391 pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9392 self.gcs_uri_prefix = v.into();
9393 self
9394 }
9395}
9396
9397impl wkt::message::Message for GcsPrefix {
9398 fn typename() -> &'static str {
9399 "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
9400 }
9401}
9402
9403/// The common config to specify a set of documents used as input.
9404#[derive(Clone, Default, PartialEq)]
9405#[non_exhaustive]
9406pub struct BatchDocumentsInputConfig {
9407 /// The source. Make sure that the caller of the API has storage.objects.get
9408 /// access to the buckets.
9409 pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
9410
9411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9412}
9413
9414impl BatchDocumentsInputConfig {
9415 /// Creates a new default instance.
9416 pub fn new() -> Self {
9417 std::default::Default::default()
9418 }
9419
9420 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
9421 ///
9422 /// Note that all the setters affecting `source` are mutually
9423 /// exclusive.
9424 ///
9425 /// # Example
9426 /// ```ignore,no_run
9427 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9428 /// use google_cloud_documentai_v1::model::GcsPrefix;
9429 /// let x = BatchDocumentsInputConfig::new().set_source(Some(
9430 /// google_cloud_documentai_v1::model::batch_documents_input_config::Source::GcsPrefix(GcsPrefix::default().into())));
9431 /// ```
9432 pub fn set_source<
9433 T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
9434 >(
9435 mut self,
9436 v: T,
9437 ) -> Self {
9438 self.source = v.into();
9439 self
9440 }
9441
9442 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9443 /// if it holds a `GcsPrefix`, `None` if the field is not set or
9444 /// holds a different branch.
9445 pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
9446 #[allow(unreachable_patterns)]
9447 self.source.as_ref().and_then(|v| match v {
9448 crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
9449 std::option::Option::Some(v)
9450 }
9451 _ => std::option::Option::None,
9452 })
9453 }
9454
9455 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9456 /// to hold a `GcsPrefix`.
9457 ///
9458 /// Note that all the setters affecting `source` are
9459 /// mutually exclusive.
9460 ///
9461 /// # Example
9462 /// ```ignore,no_run
9463 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9464 /// use google_cloud_documentai_v1::model::GcsPrefix;
9465 /// let x = BatchDocumentsInputConfig::new().set_gcs_prefix(GcsPrefix::default()/* use setters */);
9466 /// assert!(x.gcs_prefix().is_some());
9467 /// assert!(x.gcs_documents().is_none());
9468 /// ```
9469 pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
9470 mut self,
9471 v: T,
9472 ) -> Self {
9473 self.source = std::option::Option::Some(
9474 crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
9475 );
9476 self
9477 }
9478
9479 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9480 /// if it holds a `GcsDocuments`, `None` if the field is not set or
9481 /// holds a different branch.
9482 pub fn gcs_documents(
9483 &self,
9484 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
9485 #[allow(unreachable_patterns)]
9486 self.source.as_ref().and_then(|v| match v {
9487 crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
9488 std::option::Option::Some(v)
9489 }
9490 _ => std::option::Option::None,
9491 })
9492 }
9493
9494 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9495 /// to hold a `GcsDocuments`.
9496 ///
9497 /// Note that all the setters affecting `source` are
9498 /// mutually exclusive.
9499 ///
9500 /// # Example
9501 /// ```ignore,no_run
9502 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9503 /// use google_cloud_documentai_v1::model::GcsDocuments;
9504 /// let x = BatchDocumentsInputConfig::new().set_gcs_documents(GcsDocuments::default()/* use setters */);
9505 /// assert!(x.gcs_documents().is_some());
9506 /// assert!(x.gcs_prefix().is_none());
9507 /// ```
9508 pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
9509 mut self,
9510 v: T,
9511 ) -> Self {
9512 self.source = std::option::Option::Some(
9513 crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
9514 );
9515 self
9516 }
9517}
9518
9519impl wkt::message::Message for BatchDocumentsInputConfig {
9520 fn typename() -> &'static str {
9521 "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
9522 }
9523}
9524
9525/// Defines additional types related to [BatchDocumentsInputConfig].
9526pub mod batch_documents_input_config {
9527 #[allow(unused_imports)]
9528 use super::*;
9529
9530 /// The source. Make sure that the caller of the API has storage.objects.get
9531 /// access to the buckets.
9532 #[derive(Clone, Debug, PartialEq)]
9533 #[non_exhaustive]
9534 pub enum Source {
9535 /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
9536 GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
9537 /// The set of documents individually specified on Cloud Storage.
9538 GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
9539 }
9540}
9541
9542/// Config that controls the output of documents. All documents will be written
9543/// as a JSON file.
9544#[derive(Clone, Default, PartialEq)]
9545#[non_exhaustive]
9546pub struct DocumentOutputConfig {
9547 /// The destination of the results.
9548 pub destination: std::option::Option<crate::model::document_output_config::Destination>,
9549
9550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9551}
9552
9553impl DocumentOutputConfig {
9554 /// Creates a new default instance.
9555 pub fn new() -> Self {
9556 std::default::Default::default()
9557 }
9558
9559 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
9560 ///
9561 /// Note that all the setters affecting `destination` are mutually
9562 /// exclusive.
9563 ///
9564 /// # Example
9565 /// ```ignore,no_run
9566 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9567 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9568 /// let x = DocumentOutputConfig::new().set_destination(Some(
9569 /// google_cloud_documentai_v1::model::document_output_config::Destination::GcsOutputConfig(GcsOutputConfig::default().into())));
9570 /// ```
9571 pub fn set_destination<
9572 T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
9573 >(
9574 mut self,
9575 v: T,
9576 ) -> Self {
9577 self.destination = v.into();
9578 self
9579 }
9580
9581 /// The value of [destination][crate::model::DocumentOutputConfig::destination]
9582 /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
9583 /// holds a different branch.
9584 pub fn gcs_output_config(
9585 &self,
9586 ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
9587 {
9588 #[allow(unreachable_patterns)]
9589 self.destination.as_ref().and_then(|v| match v {
9590 crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
9591 std::option::Option::Some(v)
9592 }
9593 _ => std::option::Option::None,
9594 })
9595 }
9596
9597 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
9598 /// to hold a `GcsOutputConfig`.
9599 ///
9600 /// Note that all the setters affecting `destination` are
9601 /// mutually exclusive.
9602 ///
9603 /// # Example
9604 /// ```ignore,no_run
9605 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9606 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9607 /// let x = DocumentOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
9608 /// assert!(x.gcs_output_config().is_some());
9609 /// ```
9610 pub fn set_gcs_output_config<
9611 T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
9612 >(
9613 mut self,
9614 v: T,
9615 ) -> Self {
9616 self.destination = std::option::Option::Some(
9617 crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
9618 );
9619 self
9620 }
9621}
9622
9623impl wkt::message::Message for DocumentOutputConfig {
9624 fn typename() -> &'static str {
9625 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
9626 }
9627}
9628
9629/// Defines additional types related to [DocumentOutputConfig].
9630pub mod document_output_config {
9631 #[allow(unused_imports)]
9632 use super::*;
9633
9634 /// The configuration used when outputting documents.
9635 #[derive(Clone, Default, PartialEq)]
9636 #[non_exhaustive]
9637 pub struct GcsOutputConfig {
9638 /// The Cloud Storage uri (a directory) of the output.
9639 pub gcs_uri: std::string::String,
9640
9641 /// Specifies which fields to include in the output documents.
9642 /// Only supports top level document and pages field so it must be in the
9643 /// form of `{document_field_name}` or `pages.{page_field_name}`.
9644 pub field_mask: std::option::Option<wkt::FieldMask>,
9645
9646 /// Specifies the sharding config for the output document.
9647 pub sharding_config: std::option::Option<
9648 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9649 >,
9650
9651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9652 }
9653
9654 impl GcsOutputConfig {
9655 /// Creates a new default instance.
9656 pub fn new() -> Self {
9657 std::default::Default::default()
9658 }
9659
9660 /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
9661 ///
9662 /// # Example
9663 /// ```ignore,no_run
9664 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9665 /// let x = GcsOutputConfig::new().set_gcs_uri("example");
9666 /// ```
9667 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9668 self.gcs_uri = v.into();
9669 self
9670 }
9671
9672 /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9673 ///
9674 /// # Example
9675 /// ```ignore,no_run
9676 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9677 /// use wkt::FieldMask;
9678 /// let x = GcsOutputConfig::new().set_field_mask(FieldMask::default()/* use setters */);
9679 /// ```
9680 pub fn set_field_mask<T>(mut self, v: T) -> Self
9681 where
9682 T: std::convert::Into<wkt::FieldMask>,
9683 {
9684 self.field_mask = std::option::Option::Some(v.into());
9685 self
9686 }
9687
9688 /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9689 ///
9690 /// # Example
9691 /// ```ignore,no_run
9692 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9693 /// use wkt::FieldMask;
9694 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
9695 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(None::<FieldMask>);
9696 /// ```
9697 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
9698 where
9699 T: std::convert::Into<wkt::FieldMask>,
9700 {
9701 self.field_mask = v.map(|x| x.into());
9702 self
9703 }
9704
9705 /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9706 ///
9707 /// # Example
9708 /// ```ignore,no_run
9709 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9710 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9711 /// let x = GcsOutputConfig::new().set_sharding_config(ShardingConfig::default()/* use setters */);
9712 /// ```
9713 pub fn set_sharding_config<T>(mut self, v: T) -> Self
9714 where
9715 T: std::convert::Into<
9716 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9717 >,
9718 {
9719 self.sharding_config = std::option::Option::Some(v.into());
9720 self
9721 }
9722
9723 /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9724 ///
9725 /// # Example
9726 /// ```ignore,no_run
9727 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9728 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9729 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(Some(ShardingConfig::default()/* use setters */));
9730 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(None::<ShardingConfig>);
9731 /// ```
9732 pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
9733 where
9734 T: std::convert::Into<
9735 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9736 >,
9737 {
9738 self.sharding_config = v.map(|x| x.into());
9739 self
9740 }
9741 }
9742
9743 impl wkt::message::Message for GcsOutputConfig {
9744 fn typename() -> &'static str {
9745 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
9746 }
9747 }
9748
9749 /// Defines additional types related to [GcsOutputConfig].
9750 pub mod gcs_output_config {
9751 #[allow(unused_imports)]
9752 use super::*;
9753
9754 /// The sharding config for the output document.
9755 #[derive(Clone, Default, PartialEq)]
9756 #[non_exhaustive]
9757 pub struct ShardingConfig {
9758 /// The number of pages per shard.
9759 pub pages_per_shard: i32,
9760
9761 /// The number of overlapping pages between consecutive shards.
9762 pub pages_overlap: i32,
9763
9764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9765 }
9766
9767 impl ShardingConfig {
9768 /// Creates a new default instance.
9769 pub fn new() -> Self {
9770 std::default::Default::default()
9771 }
9772
9773 /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
9774 ///
9775 /// # Example
9776 /// ```ignore,no_run
9777 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9778 /// let x = ShardingConfig::new().set_pages_per_shard(42);
9779 /// ```
9780 pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9781 self.pages_per_shard = v.into();
9782 self
9783 }
9784
9785 /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9790 /// let x = ShardingConfig::new().set_pages_overlap(42);
9791 /// ```
9792 pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9793 self.pages_overlap = v.into();
9794 self
9795 }
9796 }
9797
9798 impl wkt::message::Message for ShardingConfig {
9799 fn typename() -> &'static str {
9800 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
9801 }
9802 }
9803 }
9804
9805 /// The destination of the results.
9806 #[derive(Clone, Debug, PartialEq)]
9807 #[non_exhaustive]
9808 pub enum Destination {
9809 /// Output config to write the results to Cloud Storage.
9810 GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
9811 }
9812}
9813
9814/// Config for Document OCR.
9815#[derive(Clone, Default, PartialEq)]
9816#[non_exhaustive]
9817pub struct OcrConfig {
9818 /// Hints for the OCR model.
9819 pub hints: std::option::Option<crate::model::ocr_config::Hints>,
9820
9821 /// Enables special handling for PDFs with existing text information. Results
9822 /// in better text extraction quality in such PDF inputs.
9823 pub enable_native_pdf_parsing: bool,
9824
9825 /// Enables intelligent document quality scores after OCR. Can help with
9826 /// diagnosing why OCR responses are of poor quality for a given input.
9827 /// Adds additional latency comparable to regular OCR to the process call.
9828 pub enable_image_quality_scores: bool,
9829
9830 /// A list of advanced OCR options to further fine-tune OCR behavior. Current
9831 /// valid values are:
9832 ///
9833 /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
9834 /// an alternative to the current ML-based layout detection algorithm.
9835 /// Customers can choose the best suitable layout algorithm based on their
9836 /// situation.
9837 pub advanced_ocr_options: std::vec::Vec<std::string::String>,
9838
9839 /// Includes symbol level OCR information if set to true.
9840 pub enable_symbol: bool,
9841
9842 /// Turn on font identification model and return font style information.
9843 /// Deprecated, use
9844 /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
9845 /// instead.
9846 ///
9847 /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
9848 #[deprecated]
9849 pub compute_style_info: bool,
9850
9851 /// Turn off character box detector in OCR engine. Character box detection is
9852 /// enabled by default in OCR 2.0 (and later) processors.
9853 pub disable_character_boxes_detection: bool,
9854
9855 /// Configurations for premium OCR features.
9856 pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
9857
9858 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9859}
9860
9861impl OcrConfig {
9862 /// Creates a new default instance.
9863 pub fn new() -> Self {
9864 std::default::Default::default()
9865 }
9866
9867 /// Sets the value of [hints][crate::model::OcrConfig::hints].
9868 ///
9869 /// # Example
9870 /// ```ignore,no_run
9871 /// # use google_cloud_documentai_v1::model::OcrConfig;
9872 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9873 /// let x = OcrConfig::new().set_hints(Hints::default()/* use setters */);
9874 /// ```
9875 pub fn set_hints<T>(mut self, v: T) -> Self
9876 where
9877 T: std::convert::Into<crate::model::ocr_config::Hints>,
9878 {
9879 self.hints = std::option::Option::Some(v.into());
9880 self
9881 }
9882
9883 /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
9884 ///
9885 /// # Example
9886 /// ```ignore,no_run
9887 /// # use google_cloud_documentai_v1::model::OcrConfig;
9888 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9889 /// let x = OcrConfig::new().set_or_clear_hints(Some(Hints::default()/* use setters */));
9890 /// let x = OcrConfig::new().set_or_clear_hints(None::<Hints>);
9891 /// ```
9892 pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
9893 where
9894 T: std::convert::Into<crate::model::ocr_config::Hints>,
9895 {
9896 self.hints = v.map(|x| x.into());
9897 self
9898 }
9899
9900 /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
9901 ///
9902 /// # Example
9903 /// ```ignore,no_run
9904 /// # use google_cloud_documentai_v1::model::OcrConfig;
9905 /// let x = OcrConfig::new().set_enable_native_pdf_parsing(true);
9906 /// ```
9907 pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9908 self.enable_native_pdf_parsing = v.into();
9909 self
9910 }
9911
9912 /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
9913 ///
9914 /// # Example
9915 /// ```ignore,no_run
9916 /// # use google_cloud_documentai_v1::model::OcrConfig;
9917 /// let x = OcrConfig::new().set_enable_image_quality_scores(true);
9918 /// ```
9919 pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9920 self.enable_image_quality_scores = v.into();
9921 self
9922 }
9923
9924 /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
9925 ///
9926 /// # Example
9927 /// ```ignore,no_run
9928 /// # use google_cloud_documentai_v1::model::OcrConfig;
9929 /// let x = OcrConfig::new().set_advanced_ocr_options(["a", "b", "c"]);
9930 /// ```
9931 pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
9932 where
9933 T: std::iter::IntoIterator<Item = V>,
9934 V: std::convert::Into<std::string::String>,
9935 {
9936 use std::iter::Iterator;
9937 self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
9938 self
9939 }
9940
9941 /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_documentai_v1::model::OcrConfig;
9946 /// let x = OcrConfig::new().set_enable_symbol(true);
9947 /// ```
9948 pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9949 self.enable_symbol = v.into();
9950 self
9951 }
9952
9953 /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
9954 ///
9955 /// # Example
9956 /// ```ignore,no_run
9957 /// # use google_cloud_documentai_v1::model::OcrConfig;
9958 /// let x = OcrConfig::new().set_compute_style_info(true);
9959 /// ```
9960 #[deprecated]
9961 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9962 self.compute_style_info = v.into();
9963 self
9964 }
9965
9966 /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
9967 ///
9968 /// # Example
9969 /// ```ignore,no_run
9970 /// # use google_cloud_documentai_v1::model::OcrConfig;
9971 /// let x = OcrConfig::new().set_disable_character_boxes_detection(true);
9972 /// ```
9973 pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
9974 mut self,
9975 v: T,
9976 ) -> Self {
9977 self.disable_character_boxes_detection = v.into();
9978 self
9979 }
9980
9981 /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
9982 ///
9983 /// # Example
9984 /// ```ignore,no_run
9985 /// # use google_cloud_documentai_v1::model::OcrConfig;
9986 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9987 /// let x = OcrConfig::new().set_premium_features(PremiumFeatures::default()/* use setters */);
9988 /// ```
9989 pub fn set_premium_features<T>(mut self, v: T) -> Self
9990 where
9991 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
9992 {
9993 self.premium_features = std::option::Option::Some(v.into());
9994 self
9995 }
9996
9997 /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
9998 ///
9999 /// # Example
10000 /// ```ignore,no_run
10001 /// # use google_cloud_documentai_v1::model::OcrConfig;
10002 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10003 /// let x = OcrConfig::new().set_or_clear_premium_features(Some(PremiumFeatures::default()/* use setters */));
10004 /// let x = OcrConfig::new().set_or_clear_premium_features(None::<PremiumFeatures>);
10005 /// ```
10006 pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
10007 where
10008 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
10009 {
10010 self.premium_features = v.map(|x| x.into());
10011 self
10012 }
10013}
10014
10015impl wkt::message::Message for OcrConfig {
10016 fn typename() -> &'static str {
10017 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
10018 }
10019}
10020
10021/// Defines additional types related to [OcrConfig].
10022pub mod ocr_config {
10023 #[allow(unused_imports)]
10024 use super::*;
10025
10026 /// Hints for OCR Engine
10027 #[derive(Clone, Default, PartialEq)]
10028 #[non_exhaustive]
10029 pub struct Hints {
10030 /// List of BCP-47 language codes to use for OCR. In most cases, not
10031 /// specifying it yields the best results since it enables automatic language
10032 /// detection. For languages based on the Latin alphabet, setting hints is
10033 /// not needed. In rare cases, when the language of the text in the
10034 /// image is known, setting a hint will help get better results (although it
10035 /// will be a significant hindrance if the hint is wrong).
10036 pub language_hints: std::vec::Vec<std::string::String>,
10037
10038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10039 }
10040
10041 impl Hints {
10042 /// Creates a new default instance.
10043 pub fn new() -> Self {
10044 std::default::Default::default()
10045 }
10046
10047 /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
10048 ///
10049 /// # Example
10050 /// ```ignore,no_run
10051 /// # use google_cloud_documentai_v1::model::ocr_config::Hints;
10052 /// let x = Hints::new().set_language_hints(["a", "b", "c"]);
10053 /// ```
10054 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
10055 where
10056 T: std::iter::IntoIterator<Item = V>,
10057 V: std::convert::Into<std::string::String>,
10058 {
10059 use std::iter::Iterator;
10060 self.language_hints = v.into_iter().map(|i| i.into()).collect();
10061 self
10062 }
10063 }
10064
10065 impl wkt::message::Message for Hints {
10066 fn typename() -> &'static str {
10067 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
10068 }
10069 }
10070
10071 /// Configurations for premium OCR features.
10072 #[derive(Clone, Default, PartialEq)]
10073 #[non_exhaustive]
10074 pub struct PremiumFeatures {
10075 /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
10076 /// (and later) processors.
10077 pub enable_selection_mark_detection: bool,
10078
10079 /// Turn on font identification model and return font style information.
10080 pub compute_style_info: bool,
10081
10082 /// Turn on the model that can extract LaTeX math formulas.
10083 pub enable_math_ocr: bool,
10084
10085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10086 }
10087
10088 impl PremiumFeatures {
10089 /// Creates a new default instance.
10090 pub fn new() -> Self {
10091 std::default::Default::default()
10092 }
10093
10094 /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
10095 ///
10096 /// # Example
10097 /// ```ignore,no_run
10098 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10099 /// let x = PremiumFeatures::new().set_enable_selection_mark_detection(true);
10100 /// ```
10101 pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
10102 mut self,
10103 v: T,
10104 ) -> Self {
10105 self.enable_selection_mark_detection = v.into();
10106 self
10107 }
10108
10109 /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
10110 ///
10111 /// # Example
10112 /// ```ignore,no_run
10113 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10114 /// let x = PremiumFeatures::new().set_compute_style_info(true);
10115 /// ```
10116 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10117 self.compute_style_info = v.into();
10118 self
10119 }
10120
10121 /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
10122 ///
10123 /// # Example
10124 /// ```ignore,no_run
10125 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10126 /// let x = PremiumFeatures::new().set_enable_math_ocr(true);
10127 /// ```
10128 pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10129 self.enable_math_ocr = v.into();
10130 self
10131 }
10132 }
10133
10134 impl wkt::message::Message for PremiumFeatures {
10135 fn typename() -> &'static str {
10136 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
10137 }
10138 }
10139}
10140
10141/// Options for Process API
10142#[derive(Clone, Default, PartialEq)]
10143#[non_exhaustive]
10144pub struct ProcessOptions {
10145 /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
10146 /// Returns error if set on other processor types.
10147 pub ocr_config: std::option::Option<crate::model::OcrConfig>,
10148
10149 /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
10150 /// Returns error if set on other processor types.
10151 pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
10152
10153 /// Optional. Override the schema of the
10154 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
10155 /// return an Invalid Argument error if this field is set when the underlying
10156 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
10157 /// support schema override.
10158 ///
10159 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10160 pub schema_override: std::option::Option<crate::model::DocumentSchema>,
10161
10162 /// A subset of pages to process. If not specified, all pages are processed.
10163 /// If a page range is set, only the given pages are extracted and processed
10164 /// from the document. In the output document,
10165 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10166 /// refers to the page number in the original document.
10167 /// This configuration only applies to online processing with
10168 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10169 ///
10170 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10171 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10172 pub page_range: std::option::Option<crate::model::process_options::PageRange>,
10173
10174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10175}
10176
10177impl ProcessOptions {
10178 /// Creates a new default instance.
10179 pub fn new() -> Self {
10180 std::default::Default::default()
10181 }
10182
10183 /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10184 ///
10185 /// # Example
10186 /// ```ignore,no_run
10187 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10188 /// use google_cloud_documentai_v1::model::OcrConfig;
10189 /// let x = ProcessOptions::new().set_ocr_config(OcrConfig::default()/* use setters */);
10190 /// ```
10191 pub fn set_ocr_config<T>(mut self, v: T) -> Self
10192 where
10193 T: std::convert::Into<crate::model::OcrConfig>,
10194 {
10195 self.ocr_config = std::option::Option::Some(v.into());
10196 self
10197 }
10198
10199 /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10200 ///
10201 /// # Example
10202 /// ```ignore,no_run
10203 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10204 /// use google_cloud_documentai_v1::model::OcrConfig;
10205 /// let x = ProcessOptions::new().set_or_clear_ocr_config(Some(OcrConfig::default()/* use setters */));
10206 /// let x = ProcessOptions::new().set_or_clear_ocr_config(None::<OcrConfig>);
10207 /// ```
10208 pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
10209 where
10210 T: std::convert::Into<crate::model::OcrConfig>,
10211 {
10212 self.ocr_config = v.map(|x| x.into());
10213 self
10214 }
10215
10216 /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
10217 ///
10218 /// # Example
10219 /// ```ignore,no_run
10220 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10221 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10222 /// let x = ProcessOptions::new().set_layout_config(LayoutConfig::default()/* use setters */);
10223 /// ```
10224 pub fn set_layout_config<T>(mut self, v: T) -> Self
10225 where
10226 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10227 {
10228 self.layout_config = std::option::Option::Some(v.into());
10229 self
10230 }
10231
10232 /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
10233 ///
10234 /// # Example
10235 /// ```ignore,no_run
10236 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10237 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10238 /// let x = ProcessOptions::new().set_or_clear_layout_config(Some(LayoutConfig::default()/* use setters */));
10239 /// let x = ProcessOptions::new().set_or_clear_layout_config(None::<LayoutConfig>);
10240 /// ```
10241 pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
10242 where
10243 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10244 {
10245 self.layout_config = v.map(|x| x.into());
10246 self
10247 }
10248
10249 /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
10250 ///
10251 /// # Example
10252 /// ```ignore,no_run
10253 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10254 /// use google_cloud_documentai_v1::model::DocumentSchema;
10255 /// let x = ProcessOptions::new().set_schema_override(DocumentSchema::default()/* use setters */);
10256 /// ```
10257 pub fn set_schema_override<T>(mut self, v: T) -> Self
10258 where
10259 T: std::convert::Into<crate::model::DocumentSchema>,
10260 {
10261 self.schema_override = std::option::Option::Some(v.into());
10262 self
10263 }
10264
10265 /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
10266 ///
10267 /// # Example
10268 /// ```ignore,no_run
10269 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10270 /// use google_cloud_documentai_v1::model::DocumentSchema;
10271 /// let x = ProcessOptions::new().set_or_clear_schema_override(Some(DocumentSchema::default()/* use setters */));
10272 /// let x = ProcessOptions::new().set_or_clear_schema_override(None::<DocumentSchema>);
10273 /// ```
10274 pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
10275 where
10276 T: std::convert::Into<crate::model::DocumentSchema>,
10277 {
10278 self.schema_override = v.map(|x| x.into());
10279 self
10280 }
10281
10282 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
10283 ///
10284 /// Note that all the setters affecting `page_range` are mutually
10285 /// exclusive.
10286 ///
10287 /// # Example
10288 /// ```ignore,no_run
10289 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10290 /// use google_cloud_documentai_v1::model::process_options::PageRange;
10291 /// let x = ProcessOptions::new().set_page_range(Some(PageRange::FromStart(42)));
10292 /// ```
10293 pub fn set_page_range<
10294 T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
10295 >(
10296 mut self,
10297 v: T,
10298 ) -> Self {
10299 self.page_range = v.into();
10300 self
10301 }
10302
10303 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10304 /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
10305 /// holds a different branch.
10306 pub fn individual_page_selector(
10307 &self,
10308 ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
10309 {
10310 #[allow(unreachable_patterns)]
10311 self.page_range.as_ref().and_then(|v| match v {
10312 crate::model::process_options::PageRange::IndividualPageSelector(v) => {
10313 std::option::Option::Some(v)
10314 }
10315 _ => std::option::Option::None,
10316 })
10317 }
10318
10319 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10320 /// to hold a `IndividualPageSelector`.
10321 ///
10322 /// Note that all the setters affecting `page_range` are
10323 /// mutually exclusive.
10324 ///
10325 /// # Example
10326 /// ```ignore,no_run
10327 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10328 /// use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10329 /// let x = ProcessOptions::new().set_individual_page_selector(IndividualPageSelector::default()/* use setters */);
10330 /// assert!(x.individual_page_selector().is_some());
10331 /// assert!(x.from_start().is_none());
10332 /// assert!(x.from_end().is_none());
10333 /// ```
10334 pub fn set_individual_page_selector<
10335 T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
10336 >(
10337 mut self,
10338 v: T,
10339 ) -> Self {
10340 self.page_range = std::option::Option::Some(
10341 crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
10342 );
10343 self
10344 }
10345
10346 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10347 /// if it holds a `FromStart`, `None` if the field is not set or
10348 /// holds a different branch.
10349 pub fn from_start(&self) -> std::option::Option<&i32> {
10350 #[allow(unreachable_patterns)]
10351 self.page_range.as_ref().and_then(|v| match v {
10352 crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
10353 _ => std::option::Option::None,
10354 })
10355 }
10356
10357 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10358 /// to hold a `FromStart`.
10359 ///
10360 /// Note that all the setters affecting `page_range` are
10361 /// mutually exclusive.
10362 ///
10363 /// # Example
10364 /// ```ignore,no_run
10365 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10366 /// let x = ProcessOptions::new().set_from_start(42);
10367 /// assert!(x.from_start().is_some());
10368 /// assert!(x.individual_page_selector().is_none());
10369 /// assert!(x.from_end().is_none());
10370 /// ```
10371 pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10372 self.page_range = std::option::Option::Some(
10373 crate::model::process_options::PageRange::FromStart(v.into()),
10374 );
10375 self
10376 }
10377
10378 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10379 /// if it holds a `FromEnd`, `None` if the field is not set or
10380 /// holds a different branch.
10381 pub fn from_end(&self) -> std::option::Option<&i32> {
10382 #[allow(unreachable_patterns)]
10383 self.page_range.as_ref().and_then(|v| match v {
10384 crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
10385 _ => std::option::Option::None,
10386 })
10387 }
10388
10389 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10390 /// to hold a `FromEnd`.
10391 ///
10392 /// Note that all the setters affecting `page_range` are
10393 /// mutually exclusive.
10394 ///
10395 /// # Example
10396 /// ```ignore,no_run
10397 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10398 /// let x = ProcessOptions::new().set_from_end(42);
10399 /// assert!(x.from_end().is_some());
10400 /// assert!(x.individual_page_selector().is_none());
10401 /// assert!(x.from_start().is_none());
10402 /// ```
10403 pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10404 self.page_range =
10405 std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
10406 self
10407 }
10408}
10409
10410impl wkt::message::Message for ProcessOptions {
10411 fn typename() -> &'static str {
10412 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
10413 }
10414}
10415
10416/// Defines additional types related to [ProcessOptions].
10417pub mod process_options {
10418 #[allow(unused_imports)]
10419 use super::*;
10420
10421 /// Serving config for layout parser processor.
10422 #[derive(Clone, Default, PartialEq)]
10423 #[non_exhaustive]
10424 pub struct LayoutConfig {
10425 /// Optional. Config for chunking in layout parser processor.
10426 pub chunking_config:
10427 std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
10428
10429 /// Optional. Whether to include images in layout parser processor response.
10430 pub return_images: bool,
10431
10432 /// Optional. Whether to include bounding boxes in layout parser processor
10433 /// response.
10434 pub return_bounding_boxes: bool,
10435
10436 /// Optional. Whether to include image annotations in layout parser response.
10437 pub enable_image_annotation: bool,
10438
10439 /// Optional. Whether to include table annotations in layout parser response.
10440 pub enable_table_annotation: bool,
10441
10442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10443 }
10444
10445 impl LayoutConfig {
10446 /// Creates a new default instance.
10447 pub fn new() -> Self {
10448 std::default::Default::default()
10449 }
10450
10451 /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10452 ///
10453 /// # Example
10454 /// ```ignore,no_run
10455 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10456 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10457 /// let x = LayoutConfig::new().set_chunking_config(ChunkingConfig::default()/* use setters */);
10458 /// ```
10459 pub fn set_chunking_config<T>(mut self, v: T) -> Self
10460 where
10461 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10462 {
10463 self.chunking_config = std::option::Option::Some(v.into());
10464 self
10465 }
10466
10467 /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10468 ///
10469 /// # Example
10470 /// ```ignore,no_run
10471 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10472 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10473 /// let x = LayoutConfig::new().set_or_clear_chunking_config(Some(ChunkingConfig::default()/* use setters */));
10474 /// let x = LayoutConfig::new().set_or_clear_chunking_config(None::<ChunkingConfig>);
10475 /// ```
10476 pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
10477 where
10478 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10479 {
10480 self.chunking_config = v.map(|x| x.into());
10481 self
10482 }
10483
10484 /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
10485 ///
10486 /// # Example
10487 /// ```ignore,no_run
10488 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10489 /// let x = LayoutConfig::new().set_return_images(true);
10490 /// ```
10491 pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10492 self.return_images = v.into();
10493 self
10494 }
10495
10496 /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10501 /// let x = LayoutConfig::new().set_return_bounding_boxes(true);
10502 /// ```
10503 pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10504 self.return_bounding_boxes = v.into();
10505 self
10506 }
10507
10508 /// Sets the value of [enable_image_annotation][crate::model::process_options::LayoutConfig::enable_image_annotation].
10509 ///
10510 /// # Example
10511 /// ```ignore,no_run
10512 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10513 /// let x = LayoutConfig::new().set_enable_image_annotation(true);
10514 /// ```
10515 pub fn set_enable_image_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10516 self.enable_image_annotation = v.into();
10517 self
10518 }
10519
10520 /// Sets the value of [enable_table_annotation][crate::model::process_options::LayoutConfig::enable_table_annotation].
10521 ///
10522 /// # Example
10523 /// ```ignore,no_run
10524 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10525 /// let x = LayoutConfig::new().set_enable_table_annotation(true);
10526 /// ```
10527 pub fn set_enable_table_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10528 self.enable_table_annotation = v.into();
10529 self
10530 }
10531 }
10532
10533 impl wkt::message::Message for LayoutConfig {
10534 fn typename() -> &'static str {
10535 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
10536 }
10537 }
10538
10539 /// Defines additional types related to [LayoutConfig].
10540 pub mod layout_config {
10541 #[allow(unused_imports)]
10542 use super::*;
10543
10544 /// Serving config for chunking.
10545 #[derive(Clone, Default, PartialEq)]
10546 #[non_exhaustive]
10547 pub struct ChunkingConfig {
10548 /// Optional. The chunk sizes to use when splitting documents, in order of
10549 /// level.
10550 pub chunk_size: i32,
10551
10552 /// Optional. Whether or not to include ancestor headings when splitting.
10553 pub include_ancestor_headings: bool,
10554
10555 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10556 }
10557
10558 impl ChunkingConfig {
10559 /// Creates a new default instance.
10560 pub fn new() -> Self {
10561 std::default::Default::default()
10562 }
10563
10564 /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
10565 ///
10566 /// # Example
10567 /// ```ignore,no_run
10568 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10569 /// let x = ChunkingConfig::new().set_chunk_size(42);
10570 /// ```
10571 pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10572 self.chunk_size = v.into();
10573 self
10574 }
10575
10576 /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
10577 ///
10578 /// # Example
10579 /// ```ignore,no_run
10580 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10581 /// let x = ChunkingConfig::new().set_include_ancestor_headings(true);
10582 /// ```
10583 pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
10584 mut self,
10585 v: T,
10586 ) -> Self {
10587 self.include_ancestor_headings = v.into();
10588 self
10589 }
10590 }
10591
10592 impl wkt::message::Message for ChunkingConfig {
10593 fn typename() -> &'static str {
10594 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
10595 }
10596 }
10597 }
10598
10599 /// A list of individual page numbers.
10600 #[derive(Clone, Default, PartialEq)]
10601 #[non_exhaustive]
10602 pub struct IndividualPageSelector {
10603 /// Optional. Indices of the pages (starting from 1).
10604 pub pages: std::vec::Vec<i32>,
10605
10606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10607 }
10608
10609 impl IndividualPageSelector {
10610 /// Creates a new default instance.
10611 pub fn new() -> Self {
10612 std::default::Default::default()
10613 }
10614
10615 /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
10616 ///
10617 /// # Example
10618 /// ```ignore,no_run
10619 /// # use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10620 /// let x = IndividualPageSelector::new().set_pages([1, 2, 3]);
10621 /// ```
10622 pub fn set_pages<T, V>(mut self, v: T) -> Self
10623 where
10624 T: std::iter::IntoIterator<Item = V>,
10625 V: std::convert::Into<i32>,
10626 {
10627 use std::iter::Iterator;
10628 self.pages = v.into_iter().map(|i| i.into()).collect();
10629 self
10630 }
10631 }
10632
10633 impl wkt::message::Message for IndividualPageSelector {
10634 fn typename() -> &'static str {
10635 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
10636 }
10637 }
10638
10639 /// A subset of pages to process. If not specified, all pages are processed.
10640 /// If a page range is set, only the given pages are extracted and processed
10641 /// from the document. In the output document,
10642 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10643 /// refers to the page number in the original document.
10644 /// This configuration only applies to online processing with
10645 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10646 ///
10647 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10648 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10649 #[derive(Clone, Debug, PartialEq)]
10650 #[non_exhaustive]
10651 pub enum PageRange {
10652 /// Which pages to process (1-indexed).
10653 IndividualPageSelector(
10654 std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
10655 ),
10656 /// Only process certain pages from the start. Process all if the document
10657 /// has fewer pages.
10658 FromStart(i32),
10659 /// Only process certain pages from the end, same as above.
10660 FromEnd(i32),
10661 }
10662}
10663
10664/// Request message for the
10665/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
10666/// method.
10667///
10668/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10669#[derive(Clone, Default, PartialEq)]
10670#[non_exhaustive]
10671pub struct ProcessRequest {
10672 /// Required. The resource name of the
10673 /// [Processor][google.cloud.documentai.v1.Processor] or
10674 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
10675 /// to use for processing. If a
10676 /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
10677 /// will use its [default
10678 /// version][google.cloud.documentai.v1.Processor.default_processor_version].
10679 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
10680 /// or
10681 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
10682 ///
10683 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
10684 /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
10685 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10686 pub name: std::string::String,
10687
10688 /// Whether human review should be skipped for this request. Default to
10689 /// `false`.
10690 pub skip_human_review: bool,
10691
10692 /// Specifies which fields to include in the
10693 /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
10694 /// output. Only supports top-level document and pages field, so it must be in
10695 /// the form of `{document_field_name}` or `pages.{page_field_name}`.
10696 ///
10697 /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
10698 pub field_mask: std::option::Option<wkt::FieldMask>,
10699
10700 /// Inference-time options for the process API
10701 pub process_options: std::option::Option<crate::model::ProcessOptions>,
10702
10703 /// Optional. The labels with user-defined metadata for the request.
10704 ///
10705 /// Label keys and values can be no longer than 63 characters
10706 /// (Unicode codepoints) and can only contain lowercase letters, numeric
10707 /// characters, underscores, and dashes. International characters are allowed.
10708 /// Label values are optional. Label keys must start with a letter.
10709 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10710
10711 /// Optional. Option to remove images from the document.
10712 pub imageless_mode: bool,
10713
10714 /// The document payload.
10715 pub source: std::option::Option<crate::model::process_request::Source>,
10716
10717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10718}
10719
10720impl ProcessRequest {
10721 /// Creates a new default instance.
10722 pub fn new() -> Self {
10723 std::default::Default::default()
10724 }
10725
10726 /// Sets the value of [name][crate::model::ProcessRequest::name].
10727 ///
10728 /// # Example
10729 /// ```ignore,no_run
10730 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10731 /// let x = ProcessRequest::new().set_name("example");
10732 /// ```
10733 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10734 self.name = v.into();
10735 self
10736 }
10737
10738 /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
10739 ///
10740 /// # Example
10741 /// ```ignore,no_run
10742 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10743 /// let x = ProcessRequest::new().set_skip_human_review(true);
10744 /// ```
10745 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10746 self.skip_human_review = v.into();
10747 self
10748 }
10749
10750 /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
10751 ///
10752 /// # Example
10753 /// ```ignore,no_run
10754 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10755 /// use wkt::FieldMask;
10756 /// let x = ProcessRequest::new().set_field_mask(FieldMask::default()/* use setters */);
10757 /// ```
10758 pub fn set_field_mask<T>(mut self, v: T) -> Self
10759 where
10760 T: std::convert::Into<wkt::FieldMask>,
10761 {
10762 self.field_mask = std::option::Option::Some(v.into());
10763 self
10764 }
10765
10766 /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
10767 ///
10768 /// # Example
10769 /// ```ignore,no_run
10770 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10771 /// use wkt::FieldMask;
10772 /// let x = ProcessRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
10773 /// let x = ProcessRequest::new().set_or_clear_field_mask(None::<FieldMask>);
10774 /// ```
10775 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
10776 where
10777 T: std::convert::Into<wkt::FieldMask>,
10778 {
10779 self.field_mask = v.map(|x| x.into());
10780 self
10781 }
10782
10783 /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
10784 ///
10785 /// # Example
10786 /// ```ignore,no_run
10787 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10788 /// use google_cloud_documentai_v1::model::ProcessOptions;
10789 /// let x = ProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
10790 /// ```
10791 pub fn set_process_options<T>(mut self, v: T) -> Self
10792 where
10793 T: std::convert::Into<crate::model::ProcessOptions>,
10794 {
10795 self.process_options = std::option::Option::Some(v.into());
10796 self
10797 }
10798
10799 /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
10800 ///
10801 /// # Example
10802 /// ```ignore,no_run
10803 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10804 /// use google_cloud_documentai_v1::model::ProcessOptions;
10805 /// let x = ProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
10806 /// let x = ProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
10807 /// ```
10808 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
10809 where
10810 T: std::convert::Into<crate::model::ProcessOptions>,
10811 {
10812 self.process_options = v.map(|x| x.into());
10813 self
10814 }
10815
10816 /// Sets the value of [labels][crate::model::ProcessRequest::labels].
10817 ///
10818 /// # Example
10819 /// ```ignore,no_run
10820 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10821 /// let x = ProcessRequest::new().set_labels([
10822 /// ("key0", "abc"),
10823 /// ("key1", "xyz"),
10824 /// ]);
10825 /// ```
10826 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10827 where
10828 T: std::iter::IntoIterator<Item = (K, V)>,
10829 K: std::convert::Into<std::string::String>,
10830 V: std::convert::Into<std::string::String>,
10831 {
10832 use std::iter::Iterator;
10833 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10834 self
10835 }
10836
10837 /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
10838 ///
10839 /// # Example
10840 /// ```ignore,no_run
10841 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10842 /// let x = ProcessRequest::new().set_imageless_mode(true);
10843 /// ```
10844 pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10845 self.imageless_mode = v.into();
10846 self
10847 }
10848
10849 /// Sets the value of [source][crate::model::ProcessRequest::source].
10850 ///
10851 /// Note that all the setters affecting `source` are mutually
10852 /// exclusive.
10853 ///
10854 /// # Example
10855 /// ```ignore,no_run
10856 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10857 /// use google_cloud_documentai_v1::model::Document;
10858 /// let x = ProcessRequest::new().set_source(Some(
10859 /// google_cloud_documentai_v1::model::process_request::Source::InlineDocument(Document::default().into())));
10860 /// ```
10861 pub fn set_source<
10862 T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
10863 >(
10864 mut self,
10865 v: T,
10866 ) -> Self {
10867 self.source = v.into();
10868 self
10869 }
10870
10871 /// The value of [source][crate::model::ProcessRequest::source]
10872 /// if it holds a `InlineDocument`, `None` if the field is not set or
10873 /// holds a different branch.
10874 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
10875 #[allow(unreachable_patterns)]
10876 self.source.as_ref().and_then(|v| match v {
10877 crate::model::process_request::Source::InlineDocument(v) => {
10878 std::option::Option::Some(v)
10879 }
10880 _ => std::option::Option::None,
10881 })
10882 }
10883
10884 /// Sets the value of [source][crate::model::ProcessRequest::source]
10885 /// to hold a `InlineDocument`.
10886 ///
10887 /// Note that all the setters affecting `source` are
10888 /// mutually exclusive.
10889 ///
10890 /// # Example
10891 /// ```ignore,no_run
10892 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10893 /// use google_cloud_documentai_v1::model::Document;
10894 /// let x = ProcessRequest::new().set_inline_document(Document::default()/* use setters */);
10895 /// assert!(x.inline_document().is_some());
10896 /// assert!(x.raw_document().is_none());
10897 /// assert!(x.gcs_document().is_none());
10898 /// ```
10899 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
10900 mut self,
10901 v: T,
10902 ) -> Self {
10903 self.source = std::option::Option::Some(
10904 crate::model::process_request::Source::InlineDocument(v.into()),
10905 );
10906 self
10907 }
10908
10909 /// The value of [source][crate::model::ProcessRequest::source]
10910 /// if it holds a `RawDocument`, `None` if the field is not set or
10911 /// holds a different branch.
10912 pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
10913 #[allow(unreachable_patterns)]
10914 self.source.as_ref().and_then(|v| match v {
10915 crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
10916 _ => std::option::Option::None,
10917 })
10918 }
10919
10920 /// Sets the value of [source][crate::model::ProcessRequest::source]
10921 /// to hold a `RawDocument`.
10922 ///
10923 /// Note that all the setters affecting `source` are
10924 /// mutually exclusive.
10925 ///
10926 /// # Example
10927 /// ```ignore,no_run
10928 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10929 /// use google_cloud_documentai_v1::model::RawDocument;
10930 /// let x = ProcessRequest::new().set_raw_document(RawDocument::default()/* use setters */);
10931 /// assert!(x.raw_document().is_some());
10932 /// assert!(x.inline_document().is_none());
10933 /// assert!(x.gcs_document().is_none());
10934 /// ```
10935 pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
10936 mut self,
10937 v: T,
10938 ) -> Self {
10939 self.source =
10940 std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
10941 self
10942 }
10943
10944 /// The value of [source][crate::model::ProcessRequest::source]
10945 /// if it holds a `GcsDocument`, `None` if the field is not set or
10946 /// holds a different branch.
10947 pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
10948 #[allow(unreachable_patterns)]
10949 self.source.as_ref().and_then(|v| match v {
10950 crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
10951 _ => std::option::Option::None,
10952 })
10953 }
10954
10955 /// Sets the value of [source][crate::model::ProcessRequest::source]
10956 /// to hold a `GcsDocument`.
10957 ///
10958 /// Note that all the setters affecting `source` are
10959 /// mutually exclusive.
10960 ///
10961 /// # Example
10962 /// ```ignore,no_run
10963 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10964 /// use google_cloud_documentai_v1::model::GcsDocument;
10965 /// let x = ProcessRequest::new().set_gcs_document(GcsDocument::default()/* use setters */);
10966 /// assert!(x.gcs_document().is_some());
10967 /// assert!(x.inline_document().is_none());
10968 /// assert!(x.raw_document().is_none());
10969 /// ```
10970 pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
10971 mut self,
10972 v: T,
10973 ) -> Self {
10974 self.source =
10975 std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
10976 self
10977 }
10978}
10979
10980impl wkt::message::Message for ProcessRequest {
10981 fn typename() -> &'static str {
10982 "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
10983 }
10984}
10985
10986/// Defines additional types related to [ProcessRequest].
10987pub mod process_request {
10988 #[allow(unused_imports)]
10989 use super::*;
10990
10991 /// The document payload.
10992 #[derive(Clone, Debug, PartialEq)]
10993 #[non_exhaustive]
10994 pub enum Source {
10995 /// An inline document proto.
10996 InlineDocument(std::boxed::Box<crate::model::Document>),
10997 /// A raw document content (bytes).
10998 RawDocument(std::boxed::Box<crate::model::RawDocument>),
10999 /// A raw document on Google Cloud Storage.
11000 GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
11001 }
11002}
11003
11004/// The status of human review on a processed document.
11005#[derive(Clone, Default, PartialEq)]
11006#[non_exhaustive]
11007pub struct HumanReviewStatus {
11008 /// The state of human review on the processing request.
11009 pub state: crate::model::human_review_status::State,
11010
11011 /// A message providing more details about the human review state.
11012 pub state_message: std::string::String,
11013
11014 /// The name of the operation triggered by the processed document. This field
11015 /// is populated only when the
11016 /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
11017 /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
11018 /// the long-running operation returned by
11019 /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
11020 ///
11021 /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
11022 /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
11023 pub human_review_operation: std::string::String,
11024
11025 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11026}
11027
11028impl HumanReviewStatus {
11029 /// Creates a new default instance.
11030 pub fn new() -> Self {
11031 std::default::Default::default()
11032 }
11033
11034 /// Sets the value of [state][crate::model::HumanReviewStatus::state].
11035 ///
11036 /// # Example
11037 /// ```ignore,no_run
11038 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11039 /// use google_cloud_documentai_v1::model::human_review_status::State;
11040 /// let x0 = HumanReviewStatus::new().set_state(State::Skipped);
11041 /// let x1 = HumanReviewStatus::new().set_state(State::ValidationPassed);
11042 /// let x2 = HumanReviewStatus::new().set_state(State::InProgress);
11043 /// ```
11044 pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
11045 mut self,
11046 v: T,
11047 ) -> Self {
11048 self.state = v.into();
11049 self
11050 }
11051
11052 /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
11053 ///
11054 /// # Example
11055 /// ```ignore,no_run
11056 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11057 /// let x = HumanReviewStatus::new().set_state_message("example");
11058 /// ```
11059 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11060 self.state_message = v.into();
11061 self
11062 }
11063
11064 /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
11065 ///
11066 /// # Example
11067 /// ```ignore,no_run
11068 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11069 /// let x = HumanReviewStatus::new().set_human_review_operation("example");
11070 /// ```
11071 pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
11072 mut self,
11073 v: T,
11074 ) -> Self {
11075 self.human_review_operation = v.into();
11076 self
11077 }
11078}
11079
11080impl wkt::message::Message for HumanReviewStatus {
11081 fn typename() -> &'static str {
11082 "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
11083 }
11084}
11085
11086/// Defines additional types related to [HumanReviewStatus].
11087pub mod human_review_status {
11088 #[allow(unused_imports)]
11089 use super::*;
11090
11091 /// The final state of human review on a processed document.
11092 ///
11093 /// # Working with unknown values
11094 ///
11095 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11096 /// additional enum variants at any time. Adding new variants is not considered
11097 /// a breaking change. Applications should write their code in anticipation of:
11098 ///
11099 /// - New values appearing in future releases of the client library, **and**
11100 /// - New values received dynamically, without application changes.
11101 ///
11102 /// Please consult the [Working with enums] section in the user guide for some
11103 /// guidelines.
11104 ///
11105 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11106 #[derive(Clone, Debug, PartialEq)]
11107 #[non_exhaustive]
11108 pub enum State {
11109 /// Human review state is unspecified. Most likely due to an internal error.
11110 Unspecified,
11111 /// Human review is skipped for the document. This can happen because human
11112 /// review isn't enabled on the processor or the processing request has
11113 /// been set to skip this document.
11114 Skipped,
11115 /// Human review validation is triggered and passed, so no review is needed.
11116 ValidationPassed,
11117 /// Human review validation is triggered and the document is under review.
11118 InProgress,
11119 /// Some error happened during triggering human review, see the
11120 /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
11121 /// for details.
11122 ///
11123 /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
11124 Error,
11125 /// If set, the enum was initialized with an unknown value.
11126 ///
11127 /// Applications can examine the value using [State::value] or
11128 /// [State::name].
11129 UnknownValue(state::UnknownValue),
11130 }
11131
11132 #[doc(hidden)]
11133 pub mod state {
11134 #[allow(unused_imports)]
11135 use super::*;
11136 #[derive(Clone, Debug, PartialEq)]
11137 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11138 }
11139
11140 impl State {
11141 /// Gets the enum value.
11142 ///
11143 /// Returns `None` if the enum contains an unknown value deserialized from
11144 /// the string representation of enums.
11145 pub fn value(&self) -> std::option::Option<i32> {
11146 match self {
11147 Self::Unspecified => std::option::Option::Some(0),
11148 Self::Skipped => std::option::Option::Some(1),
11149 Self::ValidationPassed => std::option::Option::Some(2),
11150 Self::InProgress => std::option::Option::Some(3),
11151 Self::Error => std::option::Option::Some(4),
11152 Self::UnknownValue(u) => u.0.value(),
11153 }
11154 }
11155
11156 /// Gets the enum value as a string.
11157 ///
11158 /// Returns `None` if the enum contains an unknown value deserialized from
11159 /// the integer representation of enums.
11160 pub fn name(&self) -> std::option::Option<&str> {
11161 match self {
11162 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11163 Self::Skipped => std::option::Option::Some("SKIPPED"),
11164 Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
11165 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
11166 Self::Error => std::option::Option::Some("ERROR"),
11167 Self::UnknownValue(u) => u.0.name(),
11168 }
11169 }
11170 }
11171
11172 impl std::default::Default for State {
11173 fn default() -> Self {
11174 use std::convert::From;
11175 Self::from(0)
11176 }
11177 }
11178
11179 impl std::fmt::Display for State {
11180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11181 wkt::internal::display_enum(f, self.name(), self.value())
11182 }
11183 }
11184
11185 impl std::convert::From<i32> for State {
11186 fn from(value: i32) -> Self {
11187 match value {
11188 0 => Self::Unspecified,
11189 1 => Self::Skipped,
11190 2 => Self::ValidationPassed,
11191 3 => Self::InProgress,
11192 4 => Self::Error,
11193 _ => Self::UnknownValue(state::UnknownValue(
11194 wkt::internal::UnknownEnumValue::Integer(value),
11195 )),
11196 }
11197 }
11198 }
11199
11200 impl std::convert::From<&str> for State {
11201 fn from(value: &str) -> Self {
11202 use std::string::ToString;
11203 match value {
11204 "STATE_UNSPECIFIED" => Self::Unspecified,
11205 "SKIPPED" => Self::Skipped,
11206 "VALIDATION_PASSED" => Self::ValidationPassed,
11207 "IN_PROGRESS" => Self::InProgress,
11208 "ERROR" => Self::Error,
11209 _ => Self::UnknownValue(state::UnknownValue(
11210 wkt::internal::UnknownEnumValue::String(value.to_string()),
11211 )),
11212 }
11213 }
11214 }
11215
11216 impl serde::ser::Serialize for State {
11217 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11218 where
11219 S: serde::Serializer,
11220 {
11221 match self {
11222 Self::Unspecified => serializer.serialize_i32(0),
11223 Self::Skipped => serializer.serialize_i32(1),
11224 Self::ValidationPassed => serializer.serialize_i32(2),
11225 Self::InProgress => serializer.serialize_i32(3),
11226 Self::Error => serializer.serialize_i32(4),
11227 Self::UnknownValue(u) => u.0.serialize(serializer),
11228 }
11229 }
11230 }
11231
11232 impl<'de> serde::de::Deserialize<'de> for State {
11233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11234 where
11235 D: serde::Deserializer<'de>,
11236 {
11237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11238 ".google.cloud.documentai.v1.HumanReviewStatus.State",
11239 ))
11240 }
11241 }
11242}
11243
11244/// Response message for the
11245/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
11246/// method.
11247///
11248/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
11249#[derive(Clone, Default, PartialEq)]
11250#[non_exhaustive]
11251pub struct ProcessResponse {
11252 /// The document payload, will populate fields based on the processor's
11253 /// behavior.
11254 pub document: std::option::Option<crate::model::Document>,
11255
11256 /// The status of human review on the processed document.
11257 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11258
11259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11260}
11261
11262impl ProcessResponse {
11263 /// Creates a new default instance.
11264 pub fn new() -> Self {
11265 std::default::Default::default()
11266 }
11267
11268 /// Sets the value of [document][crate::model::ProcessResponse::document].
11269 ///
11270 /// # Example
11271 /// ```ignore,no_run
11272 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11273 /// use google_cloud_documentai_v1::model::Document;
11274 /// let x = ProcessResponse::new().set_document(Document::default()/* use setters */);
11275 /// ```
11276 pub fn set_document<T>(mut self, v: T) -> Self
11277 where
11278 T: std::convert::Into<crate::model::Document>,
11279 {
11280 self.document = std::option::Option::Some(v.into());
11281 self
11282 }
11283
11284 /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
11285 ///
11286 /// # Example
11287 /// ```ignore,no_run
11288 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11289 /// use google_cloud_documentai_v1::model::Document;
11290 /// let x = ProcessResponse::new().set_or_clear_document(Some(Document::default()/* use setters */));
11291 /// let x = ProcessResponse::new().set_or_clear_document(None::<Document>);
11292 /// ```
11293 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
11294 where
11295 T: std::convert::Into<crate::model::Document>,
11296 {
11297 self.document = v.map(|x| x.into());
11298 self
11299 }
11300
11301 /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11302 ///
11303 /// # Example
11304 /// ```ignore,no_run
11305 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11306 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11307 /// let x = ProcessResponse::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11308 /// ```
11309 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11310 where
11311 T: std::convert::Into<crate::model::HumanReviewStatus>,
11312 {
11313 self.human_review_status = std::option::Option::Some(v.into());
11314 self
11315 }
11316
11317 /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11318 ///
11319 /// # Example
11320 /// ```ignore,no_run
11321 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11322 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11323 /// let x = ProcessResponse::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11324 /// let x = ProcessResponse::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11325 /// ```
11326 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11327 where
11328 T: std::convert::Into<crate::model::HumanReviewStatus>,
11329 {
11330 self.human_review_status = v.map(|x| x.into());
11331 self
11332 }
11333}
11334
11335impl wkt::message::Message for ProcessResponse {
11336 fn typename() -> &'static str {
11337 "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
11338 }
11339}
11340
11341/// Request message for
11342/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11343///
11344/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11345#[derive(Clone, Default, PartialEq)]
11346#[non_exhaustive]
11347pub struct BatchProcessRequest {
11348 /// Required. The resource name of
11349 /// [Processor][google.cloud.documentai.v1.Processor] or
11350 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
11351 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
11352 /// or
11353 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
11354 ///
11355 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
11356 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
11357 pub name: std::string::String,
11358
11359 /// The input documents for the
11360 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11361 /// method.
11362 ///
11363 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11364 pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
11365
11366 /// The output configuration for the
11367 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11368 /// method.
11369 ///
11370 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11371 pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
11372
11373 /// Whether human review should be skipped for this request. Default to
11374 /// `false`.
11375 pub skip_human_review: bool,
11376
11377 /// Inference-time options for the process API
11378 pub process_options: std::option::Option<crate::model::ProcessOptions>,
11379
11380 /// Optional. The labels with user-defined metadata for the request.
11381 ///
11382 /// Label keys and values can be no longer than 63 characters
11383 /// (Unicode codepoints) and can only contain lowercase letters, numeric
11384 /// characters, underscores, and dashes. International characters are allowed.
11385 /// Label values are optional. Label keys must start with a letter.
11386 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11387
11388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11389}
11390
11391impl BatchProcessRequest {
11392 /// Creates a new default instance.
11393 pub fn new() -> Self {
11394 std::default::Default::default()
11395 }
11396
11397 /// Sets the value of [name][crate::model::BatchProcessRequest::name].
11398 ///
11399 /// # Example
11400 /// ```ignore,no_run
11401 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11402 /// let x = BatchProcessRequest::new().set_name("example");
11403 /// ```
11404 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11405 self.name = v.into();
11406 self
11407 }
11408
11409 /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11410 ///
11411 /// # Example
11412 /// ```ignore,no_run
11413 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11414 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11415 /// let x = BatchProcessRequest::new().set_input_documents(BatchDocumentsInputConfig::default()/* use setters */);
11416 /// ```
11417 pub fn set_input_documents<T>(mut self, v: T) -> Self
11418 where
11419 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11420 {
11421 self.input_documents = std::option::Option::Some(v.into());
11422 self
11423 }
11424
11425 /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11426 ///
11427 /// # Example
11428 /// ```ignore,no_run
11429 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11430 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11431 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
11432 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(None::<BatchDocumentsInputConfig>);
11433 /// ```
11434 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
11435 where
11436 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11437 {
11438 self.input_documents = v.map(|x| x.into());
11439 self
11440 }
11441
11442 /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11443 ///
11444 /// # Example
11445 /// ```ignore,no_run
11446 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11447 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11448 /// let x = BatchProcessRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
11449 /// ```
11450 pub fn set_document_output_config<T>(mut self, v: T) -> Self
11451 where
11452 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11453 {
11454 self.document_output_config = std::option::Option::Some(v.into());
11455 self
11456 }
11457
11458 /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11459 ///
11460 /// # Example
11461 /// ```ignore,no_run
11462 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11463 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11464 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
11465 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
11466 /// ```
11467 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
11468 where
11469 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11470 {
11471 self.document_output_config = v.map(|x| x.into());
11472 self
11473 }
11474
11475 /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
11476 ///
11477 /// # Example
11478 /// ```ignore,no_run
11479 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11480 /// let x = BatchProcessRequest::new().set_skip_human_review(true);
11481 /// ```
11482 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11483 self.skip_human_review = v.into();
11484 self
11485 }
11486
11487 /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
11488 ///
11489 /// # Example
11490 /// ```ignore,no_run
11491 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11492 /// use google_cloud_documentai_v1::model::ProcessOptions;
11493 /// let x = BatchProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
11494 /// ```
11495 pub fn set_process_options<T>(mut self, v: T) -> Self
11496 where
11497 T: std::convert::Into<crate::model::ProcessOptions>,
11498 {
11499 self.process_options = std::option::Option::Some(v.into());
11500 self
11501 }
11502
11503 /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
11504 ///
11505 /// # Example
11506 /// ```ignore,no_run
11507 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11508 /// use google_cloud_documentai_v1::model::ProcessOptions;
11509 /// let x = BatchProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
11510 /// let x = BatchProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
11511 /// ```
11512 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
11513 where
11514 T: std::convert::Into<crate::model::ProcessOptions>,
11515 {
11516 self.process_options = v.map(|x| x.into());
11517 self
11518 }
11519
11520 /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
11521 ///
11522 /// # Example
11523 /// ```ignore,no_run
11524 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11525 /// let x = BatchProcessRequest::new().set_labels([
11526 /// ("key0", "abc"),
11527 /// ("key1", "xyz"),
11528 /// ]);
11529 /// ```
11530 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11531 where
11532 T: std::iter::IntoIterator<Item = (K, V)>,
11533 K: std::convert::Into<std::string::String>,
11534 V: std::convert::Into<std::string::String>,
11535 {
11536 use std::iter::Iterator;
11537 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11538 self
11539 }
11540}
11541
11542impl wkt::message::Message for BatchProcessRequest {
11543 fn typename() -> &'static str {
11544 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
11545 }
11546}
11547
11548/// Response message for
11549/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11550///
11551/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11552#[derive(Clone, Default, PartialEq)]
11553#[non_exhaustive]
11554pub struct BatchProcessResponse {
11555 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11556}
11557
11558impl BatchProcessResponse {
11559 /// Creates a new default instance.
11560 pub fn new() -> Self {
11561 std::default::Default::default()
11562 }
11563}
11564
11565impl wkt::message::Message for BatchProcessResponse {
11566 fn typename() -> &'static str {
11567 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
11568 }
11569}
11570
11571/// The long-running operation metadata for
11572/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11573///
11574/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11575#[derive(Clone, Default, PartialEq)]
11576#[non_exhaustive]
11577pub struct BatchProcessMetadata {
11578 /// The state of the current batch processing.
11579 pub state: crate::model::batch_process_metadata::State,
11580
11581 /// A message providing more details about the current state of processing.
11582 /// For example, the error message if the operation is failed.
11583 pub state_message: std::string::String,
11584
11585 /// The creation time of the operation.
11586 pub create_time: std::option::Option<wkt::Timestamp>,
11587
11588 /// The last update time of the operation.
11589 pub update_time: std::option::Option<wkt::Timestamp>,
11590
11591 /// The list of response details of each document.
11592 pub individual_process_statuses:
11593 std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
11594
11595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11596}
11597
11598impl BatchProcessMetadata {
11599 /// Creates a new default instance.
11600 pub fn new() -> Self {
11601 std::default::Default::default()
11602 }
11603
11604 /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
11605 ///
11606 /// # Example
11607 /// ```ignore,no_run
11608 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11609 /// use google_cloud_documentai_v1::model::batch_process_metadata::State;
11610 /// let x0 = BatchProcessMetadata::new().set_state(State::Waiting);
11611 /// let x1 = BatchProcessMetadata::new().set_state(State::Running);
11612 /// let x2 = BatchProcessMetadata::new().set_state(State::Succeeded);
11613 /// ```
11614 pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
11615 mut self,
11616 v: T,
11617 ) -> Self {
11618 self.state = v.into();
11619 self
11620 }
11621
11622 /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
11623 ///
11624 /// # Example
11625 /// ```ignore,no_run
11626 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11627 /// let x = BatchProcessMetadata::new().set_state_message("example");
11628 /// ```
11629 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11630 self.state_message = v.into();
11631 self
11632 }
11633
11634 /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11635 ///
11636 /// # Example
11637 /// ```ignore,no_run
11638 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11639 /// use wkt::Timestamp;
11640 /// let x = BatchProcessMetadata::new().set_create_time(Timestamp::default()/* use setters */);
11641 /// ```
11642 pub fn set_create_time<T>(mut self, v: T) -> Self
11643 where
11644 T: std::convert::Into<wkt::Timestamp>,
11645 {
11646 self.create_time = std::option::Option::Some(v.into());
11647 self
11648 }
11649
11650 /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11651 ///
11652 /// # Example
11653 /// ```ignore,no_run
11654 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11655 /// use wkt::Timestamp;
11656 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11657 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(None::<Timestamp>);
11658 /// ```
11659 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11660 where
11661 T: std::convert::Into<wkt::Timestamp>,
11662 {
11663 self.create_time = v.map(|x| x.into());
11664 self
11665 }
11666
11667 /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11668 ///
11669 /// # Example
11670 /// ```ignore,no_run
11671 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11672 /// use wkt::Timestamp;
11673 /// let x = BatchProcessMetadata::new().set_update_time(Timestamp::default()/* use setters */);
11674 /// ```
11675 pub fn set_update_time<T>(mut self, v: T) -> Self
11676 where
11677 T: std::convert::Into<wkt::Timestamp>,
11678 {
11679 self.update_time = std::option::Option::Some(v.into());
11680 self
11681 }
11682
11683 /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11684 ///
11685 /// # Example
11686 /// ```ignore,no_run
11687 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11688 /// use wkt::Timestamp;
11689 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11690 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(None::<Timestamp>);
11691 /// ```
11692 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11693 where
11694 T: std::convert::Into<wkt::Timestamp>,
11695 {
11696 self.update_time = v.map(|x| x.into());
11697 self
11698 }
11699
11700 /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
11701 ///
11702 /// # Example
11703 /// ```ignore,no_run
11704 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11705 /// use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11706 /// let x = BatchProcessMetadata::new()
11707 /// .set_individual_process_statuses([
11708 /// IndividualProcessStatus::default()/* use setters */,
11709 /// IndividualProcessStatus::default()/* use (different) setters */,
11710 /// ]);
11711 /// ```
11712 pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
11713 where
11714 T: std::iter::IntoIterator<Item = V>,
11715 V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
11716 {
11717 use std::iter::Iterator;
11718 self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
11719 self
11720 }
11721}
11722
11723impl wkt::message::Message for BatchProcessMetadata {
11724 fn typename() -> &'static str {
11725 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
11726 }
11727}
11728
11729/// Defines additional types related to [BatchProcessMetadata].
11730pub mod batch_process_metadata {
11731 #[allow(unused_imports)]
11732 use super::*;
11733
11734 /// The status of a each individual document in the batch process.
11735 #[derive(Clone, Default, PartialEq)]
11736 #[non_exhaustive]
11737 pub struct IndividualProcessStatus {
11738 /// The source of the document, same as the
11739 /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
11740 /// field in the request when the batch process started.
11741 ///
11742 /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
11743 pub input_gcs_source: std::string::String,
11744
11745 /// The status processing the document.
11746 pub status: std::option::Option<google_cloud_rpc::model::Status>,
11747
11748 /// The Cloud Storage output destination (in the request as
11749 /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
11750 /// of the processed document if it was successful, otherwise empty.
11751 ///
11752 /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
11753 pub output_gcs_destination: std::string::String,
11754
11755 /// The status of human review on the processed document.
11756 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11757
11758 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11759 }
11760
11761 impl IndividualProcessStatus {
11762 /// Creates a new default instance.
11763 pub fn new() -> Self {
11764 std::default::Default::default()
11765 }
11766
11767 /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
11768 ///
11769 /// # Example
11770 /// ```ignore,no_run
11771 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11772 /// let x = IndividualProcessStatus::new().set_input_gcs_source("example");
11773 /// ```
11774 pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
11775 mut self,
11776 v: T,
11777 ) -> Self {
11778 self.input_gcs_source = v.into();
11779 self
11780 }
11781
11782 /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11783 ///
11784 /// # Example
11785 /// ```ignore,no_run
11786 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11787 /// use google_cloud_rpc::model::Status;
11788 /// let x = IndividualProcessStatus::new().set_status(Status::default()/* use setters */);
11789 /// ```
11790 pub fn set_status<T>(mut self, v: T) -> Self
11791 where
11792 T: std::convert::Into<google_cloud_rpc::model::Status>,
11793 {
11794 self.status = std::option::Option::Some(v.into());
11795 self
11796 }
11797
11798 /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11799 ///
11800 /// # Example
11801 /// ```ignore,no_run
11802 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11803 /// use google_cloud_rpc::model::Status;
11804 /// let x = IndividualProcessStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
11805 /// let x = IndividualProcessStatus::new().set_or_clear_status(None::<Status>);
11806 /// ```
11807 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
11808 where
11809 T: std::convert::Into<google_cloud_rpc::model::Status>,
11810 {
11811 self.status = v.map(|x| x.into());
11812 self
11813 }
11814
11815 /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
11816 ///
11817 /// # Example
11818 /// ```ignore,no_run
11819 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11820 /// let x = IndividualProcessStatus::new().set_output_gcs_destination("example");
11821 /// ```
11822 pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
11823 mut self,
11824 v: T,
11825 ) -> Self {
11826 self.output_gcs_destination = v.into();
11827 self
11828 }
11829
11830 /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11835 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11836 /// let x = IndividualProcessStatus::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11837 /// ```
11838 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11839 where
11840 T: std::convert::Into<crate::model::HumanReviewStatus>,
11841 {
11842 self.human_review_status = std::option::Option::Some(v.into());
11843 self
11844 }
11845
11846 /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11847 ///
11848 /// # Example
11849 /// ```ignore,no_run
11850 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11851 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11852 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11853 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11854 /// ```
11855 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11856 where
11857 T: std::convert::Into<crate::model::HumanReviewStatus>,
11858 {
11859 self.human_review_status = v.map(|x| x.into());
11860 self
11861 }
11862 }
11863
11864 impl wkt::message::Message for IndividualProcessStatus {
11865 fn typename() -> &'static str {
11866 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
11867 }
11868 }
11869
11870 /// Possible states of the batch processing operation.
11871 ///
11872 /// # Working with unknown values
11873 ///
11874 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11875 /// additional enum variants at any time. Adding new variants is not considered
11876 /// a breaking change. Applications should write their code in anticipation of:
11877 ///
11878 /// - New values appearing in future releases of the client library, **and**
11879 /// - New values received dynamically, without application changes.
11880 ///
11881 /// Please consult the [Working with enums] section in the user guide for some
11882 /// guidelines.
11883 ///
11884 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11885 #[derive(Clone, Debug, PartialEq)]
11886 #[non_exhaustive]
11887 pub enum State {
11888 /// The default value. This value is used if the state is omitted.
11889 Unspecified,
11890 /// Request operation is waiting for scheduling.
11891 Waiting,
11892 /// Request is being processed.
11893 Running,
11894 /// The batch processing completed successfully.
11895 Succeeded,
11896 /// The batch processing was being cancelled.
11897 Cancelling,
11898 /// The batch processing was cancelled.
11899 Cancelled,
11900 /// The batch processing has failed.
11901 Failed,
11902 /// If set, the enum was initialized with an unknown value.
11903 ///
11904 /// Applications can examine the value using [State::value] or
11905 /// [State::name].
11906 UnknownValue(state::UnknownValue),
11907 }
11908
11909 #[doc(hidden)]
11910 pub mod state {
11911 #[allow(unused_imports)]
11912 use super::*;
11913 #[derive(Clone, Debug, PartialEq)]
11914 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11915 }
11916
11917 impl State {
11918 /// Gets the enum value.
11919 ///
11920 /// Returns `None` if the enum contains an unknown value deserialized from
11921 /// the string representation of enums.
11922 pub fn value(&self) -> std::option::Option<i32> {
11923 match self {
11924 Self::Unspecified => std::option::Option::Some(0),
11925 Self::Waiting => std::option::Option::Some(1),
11926 Self::Running => std::option::Option::Some(2),
11927 Self::Succeeded => std::option::Option::Some(3),
11928 Self::Cancelling => std::option::Option::Some(4),
11929 Self::Cancelled => std::option::Option::Some(5),
11930 Self::Failed => std::option::Option::Some(6),
11931 Self::UnknownValue(u) => u.0.value(),
11932 }
11933 }
11934
11935 /// Gets the enum value as a string.
11936 ///
11937 /// Returns `None` if the enum contains an unknown value deserialized from
11938 /// the integer representation of enums.
11939 pub fn name(&self) -> std::option::Option<&str> {
11940 match self {
11941 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11942 Self::Waiting => std::option::Option::Some("WAITING"),
11943 Self::Running => std::option::Option::Some("RUNNING"),
11944 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
11945 Self::Cancelling => std::option::Option::Some("CANCELLING"),
11946 Self::Cancelled => std::option::Option::Some("CANCELLED"),
11947 Self::Failed => std::option::Option::Some("FAILED"),
11948 Self::UnknownValue(u) => u.0.name(),
11949 }
11950 }
11951 }
11952
11953 impl std::default::Default for State {
11954 fn default() -> Self {
11955 use std::convert::From;
11956 Self::from(0)
11957 }
11958 }
11959
11960 impl std::fmt::Display for State {
11961 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11962 wkt::internal::display_enum(f, self.name(), self.value())
11963 }
11964 }
11965
11966 impl std::convert::From<i32> for State {
11967 fn from(value: i32) -> Self {
11968 match value {
11969 0 => Self::Unspecified,
11970 1 => Self::Waiting,
11971 2 => Self::Running,
11972 3 => Self::Succeeded,
11973 4 => Self::Cancelling,
11974 5 => Self::Cancelled,
11975 6 => Self::Failed,
11976 _ => Self::UnknownValue(state::UnknownValue(
11977 wkt::internal::UnknownEnumValue::Integer(value),
11978 )),
11979 }
11980 }
11981 }
11982
11983 impl std::convert::From<&str> for State {
11984 fn from(value: &str) -> Self {
11985 use std::string::ToString;
11986 match value {
11987 "STATE_UNSPECIFIED" => Self::Unspecified,
11988 "WAITING" => Self::Waiting,
11989 "RUNNING" => Self::Running,
11990 "SUCCEEDED" => Self::Succeeded,
11991 "CANCELLING" => Self::Cancelling,
11992 "CANCELLED" => Self::Cancelled,
11993 "FAILED" => Self::Failed,
11994 _ => Self::UnknownValue(state::UnknownValue(
11995 wkt::internal::UnknownEnumValue::String(value.to_string()),
11996 )),
11997 }
11998 }
11999 }
12000
12001 impl serde::ser::Serialize for State {
12002 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12003 where
12004 S: serde::Serializer,
12005 {
12006 match self {
12007 Self::Unspecified => serializer.serialize_i32(0),
12008 Self::Waiting => serializer.serialize_i32(1),
12009 Self::Running => serializer.serialize_i32(2),
12010 Self::Succeeded => serializer.serialize_i32(3),
12011 Self::Cancelling => serializer.serialize_i32(4),
12012 Self::Cancelled => serializer.serialize_i32(5),
12013 Self::Failed => serializer.serialize_i32(6),
12014 Self::UnknownValue(u) => u.0.serialize(serializer),
12015 }
12016 }
12017 }
12018
12019 impl<'de> serde::de::Deserialize<'de> for State {
12020 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12021 where
12022 D: serde::Deserializer<'de>,
12023 {
12024 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12025 ".google.cloud.documentai.v1.BatchProcessMetadata.State",
12026 ))
12027 }
12028 }
12029}
12030
12031/// Request message for the
12032/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
12033/// method. Some processor types may require the project be added to an
12034/// allowlist.
12035///
12036/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
12037#[derive(Clone, Default, PartialEq)]
12038#[non_exhaustive]
12039pub struct FetchProcessorTypesRequest {
12040 /// Required. The location of processor types to list.
12041 /// Format: `projects/{project}/locations/{location}`.
12042 pub parent: std::string::String,
12043
12044 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12045}
12046
12047impl FetchProcessorTypesRequest {
12048 /// Creates a new default instance.
12049 pub fn new() -> Self {
12050 std::default::Default::default()
12051 }
12052
12053 /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
12054 ///
12055 /// # Example
12056 /// ```ignore,no_run
12057 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesRequest;
12058 /// let x = FetchProcessorTypesRequest::new().set_parent("example");
12059 /// ```
12060 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12061 self.parent = v.into();
12062 self
12063 }
12064}
12065
12066impl wkt::message::Message for FetchProcessorTypesRequest {
12067 fn typename() -> &'static str {
12068 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
12069 }
12070}
12071
12072/// Response message for the
12073/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
12074/// method.
12075///
12076/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
12077#[derive(Clone, Default, PartialEq)]
12078#[non_exhaustive]
12079pub struct FetchProcessorTypesResponse {
12080 /// The list of processor types.
12081 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12082
12083 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12084}
12085
12086impl FetchProcessorTypesResponse {
12087 /// Creates a new default instance.
12088 pub fn new() -> Self {
12089 std::default::Default::default()
12090 }
12091
12092 /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
12093 ///
12094 /// # Example
12095 /// ```ignore,no_run
12096 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesResponse;
12097 /// use google_cloud_documentai_v1::model::ProcessorType;
12098 /// let x = FetchProcessorTypesResponse::new()
12099 /// .set_processor_types([
12100 /// ProcessorType::default()/* use setters */,
12101 /// ProcessorType::default()/* use (different) setters */,
12102 /// ]);
12103 /// ```
12104 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12105 where
12106 T: std::iter::IntoIterator<Item = V>,
12107 V: std::convert::Into<crate::model::ProcessorType>,
12108 {
12109 use std::iter::Iterator;
12110 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12111 self
12112 }
12113}
12114
12115impl wkt::message::Message for FetchProcessorTypesResponse {
12116 fn typename() -> &'static str {
12117 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
12118 }
12119}
12120
12121/// Request message for the
12122/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12123/// method. Some processor types may require the project be added to an
12124/// allowlist.
12125///
12126/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12127#[derive(Clone, Default, PartialEq)]
12128#[non_exhaustive]
12129pub struct ListProcessorTypesRequest {
12130 /// Required. The location of processor types to list.
12131 /// Format: `projects/{project}/locations/{location}`.
12132 pub parent: std::string::String,
12133
12134 /// The maximum number of processor types to return.
12135 /// If unspecified, at most `100` processor types will be returned.
12136 /// The maximum value is `500`. Values above `500` will be coerced to `500`.
12137 pub page_size: i32,
12138
12139 /// Used to retrieve the next page of results, empty if at the end of the list.
12140 pub page_token: std::string::String,
12141
12142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12143}
12144
12145impl ListProcessorTypesRequest {
12146 /// Creates a new default instance.
12147 pub fn new() -> Self {
12148 std::default::Default::default()
12149 }
12150
12151 /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
12152 ///
12153 /// # Example
12154 /// ```ignore,no_run
12155 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12156 /// let x = ListProcessorTypesRequest::new().set_parent("example");
12157 /// ```
12158 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12159 self.parent = v.into();
12160 self
12161 }
12162
12163 /// Sets the value of [page_size][crate::model::ListProcessorTypesRequest::page_size].
12164 ///
12165 /// # Example
12166 /// ```ignore,no_run
12167 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12168 /// let x = ListProcessorTypesRequest::new().set_page_size(42);
12169 /// ```
12170 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12171 self.page_size = v.into();
12172 self
12173 }
12174
12175 /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
12176 ///
12177 /// # Example
12178 /// ```ignore,no_run
12179 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12180 /// let x = ListProcessorTypesRequest::new().set_page_token("example");
12181 /// ```
12182 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12183 self.page_token = v.into();
12184 self
12185 }
12186}
12187
12188impl wkt::message::Message for ListProcessorTypesRequest {
12189 fn typename() -> &'static str {
12190 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
12191 }
12192}
12193
12194/// Response message for the
12195/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12196/// method.
12197///
12198/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12199#[derive(Clone, Default, PartialEq)]
12200#[non_exhaustive]
12201pub struct ListProcessorTypesResponse {
12202 /// The processor types.
12203 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12204
12205 /// Points to the next page, otherwise empty.
12206 pub next_page_token: std::string::String,
12207
12208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12209}
12210
12211impl ListProcessorTypesResponse {
12212 /// Creates a new default instance.
12213 pub fn new() -> Self {
12214 std::default::Default::default()
12215 }
12216
12217 /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
12218 ///
12219 /// # Example
12220 /// ```ignore,no_run
12221 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12222 /// use google_cloud_documentai_v1::model::ProcessorType;
12223 /// let x = ListProcessorTypesResponse::new()
12224 /// .set_processor_types([
12225 /// ProcessorType::default()/* use setters */,
12226 /// ProcessorType::default()/* use (different) setters */,
12227 /// ]);
12228 /// ```
12229 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12230 where
12231 T: std::iter::IntoIterator<Item = V>,
12232 V: std::convert::Into<crate::model::ProcessorType>,
12233 {
12234 use std::iter::Iterator;
12235 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12236 self
12237 }
12238
12239 /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
12240 ///
12241 /// # Example
12242 /// ```ignore,no_run
12243 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12244 /// let x = ListProcessorTypesResponse::new().set_next_page_token("example");
12245 /// ```
12246 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12247 self.next_page_token = v.into();
12248 self
12249 }
12250}
12251
12252impl wkt::message::Message for ListProcessorTypesResponse {
12253 fn typename() -> &'static str {
12254 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
12255 }
12256}
12257
12258#[doc(hidden)]
12259impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
12260 type PageItem = crate::model::ProcessorType;
12261
12262 fn items(self) -> std::vec::Vec<Self::PageItem> {
12263 self.processor_types
12264 }
12265
12266 fn next_page_token(&self) -> std::string::String {
12267 use std::clone::Clone;
12268 self.next_page_token.clone()
12269 }
12270}
12271
12272/// Request message for list all processors belongs to a project.
12273#[derive(Clone, Default, PartialEq)]
12274#[non_exhaustive]
12275pub struct ListProcessorsRequest {
12276 /// Required. The parent (project and location) which owns this collection of
12277 /// Processors. Format: `projects/{project}/locations/{location}`
12278 pub parent: std::string::String,
12279
12280 /// The maximum number of processors to return.
12281 /// If unspecified, at most `50` processors will be returned.
12282 /// The maximum value is `100`. Values above `100` will be coerced to `100`.
12283 pub page_size: i32,
12284
12285 /// We will return the processors sorted by creation time. The page token
12286 /// will point to the next processor.
12287 pub page_token: std::string::String,
12288
12289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12290}
12291
12292impl ListProcessorsRequest {
12293 /// Creates a new default instance.
12294 pub fn new() -> Self {
12295 std::default::Default::default()
12296 }
12297
12298 /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
12299 ///
12300 /// # Example
12301 /// ```ignore,no_run
12302 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12303 /// let x = ListProcessorsRequest::new().set_parent("example");
12304 /// ```
12305 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12306 self.parent = v.into();
12307 self
12308 }
12309
12310 /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
12311 ///
12312 /// # Example
12313 /// ```ignore,no_run
12314 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12315 /// let x = ListProcessorsRequest::new().set_page_size(42);
12316 /// ```
12317 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12318 self.page_size = v.into();
12319 self
12320 }
12321
12322 /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
12323 ///
12324 /// # Example
12325 /// ```ignore,no_run
12326 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12327 /// let x = ListProcessorsRequest::new().set_page_token("example");
12328 /// ```
12329 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12330 self.page_token = v.into();
12331 self
12332 }
12333}
12334
12335impl wkt::message::Message for ListProcessorsRequest {
12336 fn typename() -> &'static str {
12337 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
12338 }
12339}
12340
12341/// Response message for the
12342/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
12343/// method.
12344///
12345/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
12346#[derive(Clone, Default, PartialEq)]
12347#[non_exhaustive]
12348pub struct ListProcessorsResponse {
12349 /// The list of processors.
12350 pub processors: std::vec::Vec<crate::model::Processor>,
12351
12352 /// Points to the next processor, otherwise empty.
12353 pub next_page_token: std::string::String,
12354
12355 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12356}
12357
12358impl ListProcessorsResponse {
12359 /// Creates a new default instance.
12360 pub fn new() -> Self {
12361 std::default::Default::default()
12362 }
12363
12364 /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
12365 ///
12366 /// # Example
12367 /// ```ignore,no_run
12368 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12369 /// use google_cloud_documentai_v1::model::Processor;
12370 /// let x = ListProcessorsResponse::new()
12371 /// .set_processors([
12372 /// Processor::default()/* use setters */,
12373 /// Processor::default()/* use (different) setters */,
12374 /// ]);
12375 /// ```
12376 pub fn set_processors<T, V>(mut self, v: T) -> Self
12377 where
12378 T: std::iter::IntoIterator<Item = V>,
12379 V: std::convert::Into<crate::model::Processor>,
12380 {
12381 use std::iter::Iterator;
12382 self.processors = v.into_iter().map(|i| i.into()).collect();
12383 self
12384 }
12385
12386 /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
12387 ///
12388 /// # Example
12389 /// ```ignore,no_run
12390 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12391 /// let x = ListProcessorsResponse::new().set_next_page_token("example");
12392 /// ```
12393 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12394 self.next_page_token = v.into();
12395 self
12396 }
12397}
12398
12399impl wkt::message::Message for ListProcessorsResponse {
12400 fn typename() -> &'static str {
12401 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
12402 }
12403}
12404
12405#[doc(hidden)]
12406impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorsResponse {
12407 type PageItem = crate::model::Processor;
12408
12409 fn items(self) -> std::vec::Vec<Self::PageItem> {
12410 self.processors
12411 }
12412
12413 fn next_page_token(&self) -> std::string::String {
12414 use std::clone::Clone;
12415 self.next_page_token.clone()
12416 }
12417}
12418
12419/// Request message for the
12420/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
12421/// method.
12422///
12423/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
12424#[derive(Clone, Default, PartialEq)]
12425#[non_exhaustive]
12426pub struct GetProcessorTypeRequest {
12427 /// Required. The processor type resource name.
12428 pub name: std::string::String,
12429
12430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12431}
12432
12433impl GetProcessorTypeRequest {
12434 /// Creates a new default instance.
12435 pub fn new() -> Self {
12436 std::default::Default::default()
12437 }
12438
12439 /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
12440 ///
12441 /// # Example
12442 /// ```ignore,no_run
12443 /// # use google_cloud_documentai_v1::model::GetProcessorTypeRequest;
12444 /// let x = GetProcessorTypeRequest::new().set_name("example");
12445 /// ```
12446 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12447 self.name = v.into();
12448 self
12449 }
12450}
12451
12452impl wkt::message::Message for GetProcessorTypeRequest {
12453 fn typename() -> &'static str {
12454 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
12455 }
12456}
12457
12458/// Request message for the
12459/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
12460/// method.
12461///
12462/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
12463#[derive(Clone, Default, PartialEq)]
12464#[non_exhaustive]
12465pub struct GetProcessorRequest {
12466 /// Required. The processor resource name.
12467 pub name: std::string::String,
12468
12469 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12470}
12471
12472impl GetProcessorRequest {
12473 /// Creates a new default instance.
12474 pub fn new() -> Self {
12475 std::default::Default::default()
12476 }
12477
12478 /// Sets the value of [name][crate::model::GetProcessorRequest::name].
12479 ///
12480 /// # Example
12481 /// ```ignore,no_run
12482 /// # use google_cloud_documentai_v1::model::GetProcessorRequest;
12483 /// let x = GetProcessorRequest::new().set_name("example");
12484 /// ```
12485 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12486 self.name = v.into();
12487 self
12488 }
12489}
12490
12491impl wkt::message::Message for GetProcessorRequest {
12492 fn typename() -> &'static str {
12493 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
12494 }
12495}
12496
12497/// Request message for the
12498/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
12499/// method.
12500///
12501/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
12502#[derive(Clone, Default, PartialEq)]
12503#[non_exhaustive]
12504pub struct GetProcessorVersionRequest {
12505 /// Required. The processor resource name.
12506 pub name: std::string::String,
12507
12508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12509}
12510
12511impl GetProcessorVersionRequest {
12512 /// Creates a new default instance.
12513 pub fn new() -> Self {
12514 std::default::Default::default()
12515 }
12516
12517 /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
12518 ///
12519 /// # Example
12520 /// ```ignore,no_run
12521 /// # use google_cloud_documentai_v1::model::GetProcessorVersionRequest;
12522 /// let x = GetProcessorVersionRequest::new().set_name("example");
12523 /// ```
12524 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12525 self.name = v.into();
12526 self
12527 }
12528}
12529
12530impl wkt::message::Message for GetProcessorVersionRequest {
12531 fn typename() -> &'static str {
12532 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
12533 }
12534}
12535
12536/// Request message for list all processor versions belongs to a processor.
12537#[derive(Clone, Default, PartialEq)]
12538#[non_exhaustive]
12539pub struct ListProcessorVersionsRequest {
12540 /// Required. The parent (project, location and processor) to list all
12541 /// versions. Format:
12542 /// `projects/{project}/locations/{location}/processors/{processor}`
12543 pub parent: std::string::String,
12544
12545 /// The maximum number of processor versions to return.
12546 /// If unspecified, at most `10` processor versions will be returned.
12547 /// The maximum value is `20`. Values above `20` will be coerced to `20`.
12548 pub page_size: i32,
12549
12550 /// We will return the processor versions sorted by creation time. The page
12551 /// token will point to the next processor version.
12552 pub page_token: std::string::String,
12553
12554 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12555}
12556
12557impl ListProcessorVersionsRequest {
12558 /// Creates a new default instance.
12559 pub fn new() -> Self {
12560 std::default::Default::default()
12561 }
12562
12563 /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
12564 ///
12565 /// # Example
12566 /// ```ignore,no_run
12567 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12568 /// let x = ListProcessorVersionsRequest::new().set_parent("example");
12569 /// ```
12570 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12571 self.parent = v.into();
12572 self
12573 }
12574
12575 /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
12576 ///
12577 /// # Example
12578 /// ```ignore,no_run
12579 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12580 /// let x = ListProcessorVersionsRequest::new().set_page_size(42);
12581 /// ```
12582 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12583 self.page_size = v.into();
12584 self
12585 }
12586
12587 /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
12588 ///
12589 /// # Example
12590 /// ```ignore,no_run
12591 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12592 /// let x = ListProcessorVersionsRequest::new().set_page_token("example");
12593 /// ```
12594 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12595 self.page_token = v.into();
12596 self
12597 }
12598}
12599
12600impl wkt::message::Message for ListProcessorVersionsRequest {
12601 fn typename() -> &'static str {
12602 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
12603 }
12604}
12605
12606/// Response message for the
12607/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
12608/// method.
12609///
12610/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
12611#[derive(Clone, Default, PartialEq)]
12612#[non_exhaustive]
12613pub struct ListProcessorVersionsResponse {
12614 /// The list of processors.
12615 pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
12616
12617 /// Points to the next processor, otherwise empty.
12618 pub next_page_token: std::string::String,
12619
12620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12621}
12622
12623impl ListProcessorVersionsResponse {
12624 /// Creates a new default instance.
12625 pub fn new() -> Self {
12626 std::default::Default::default()
12627 }
12628
12629 /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
12630 ///
12631 /// # Example
12632 /// ```ignore,no_run
12633 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12634 /// use google_cloud_documentai_v1::model::ProcessorVersion;
12635 /// let x = ListProcessorVersionsResponse::new()
12636 /// .set_processor_versions([
12637 /// ProcessorVersion::default()/* use setters */,
12638 /// ProcessorVersion::default()/* use (different) setters */,
12639 /// ]);
12640 /// ```
12641 pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
12642 where
12643 T: std::iter::IntoIterator<Item = V>,
12644 V: std::convert::Into<crate::model::ProcessorVersion>,
12645 {
12646 use std::iter::Iterator;
12647 self.processor_versions = v.into_iter().map(|i| i.into()).collect();
12648 self
12649 }
12650
12651 /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
12652 ///
12653 /// # Example
12654 /// ```ignore,no_run
12655 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12656 /// let x = ListProcessorVersionsResponse::new().set_next_page_token("example");
12657 /// ```
12658 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12659 self.next_page_token = v.into();
12660 self
12661 }
12662}
12663
12664impl wkt::message::Message for ListProcessorVersionsResponse {
12665 fn typename() -> &'static str {
12666 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
12667 }
12668}
12669
12670#[doc(hidden)]
12671impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
12672 type PageItem = crate::model::ProcessorVersion;
12673
12674 fn items(self) -> std::vec::Vec<Self::PageItem> {
12675 self.processor_versions
12676 }
12677
12678 fn next_page_token(&self) -> std::string::String {
12679 use std::clone::Clone;
12680 self.next_page_token.clone()
12681 }
12682}
12683
12684/// Request message for the
12685/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12686/// method.
12687///
12688/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12689#[derive(Clone, Default, PartialEq)]
12690#[non_exhaustive]
12691pub struct DeleteProcessorVersionRequest {
12692 /// Required. The processor version resource name to be deleted.
12693 pub name: std::string::String,
12694
12695 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12696}
12697
12698impl DeleteProcessorVersionRequest {
12699 /// Creates a new default instance.
12700 pub fn new() -> Self {
12701 std::default::Default::default()
12702 }
12703
12704 /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
12705 ///
12706 /// # Example
12707 /// ```ignore,no_run
12708 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionRequest;
12709 /// let x = DeleteProcessorVersionRequest::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 DeleteProcessorVersionRequest {
12718 fn typename() -> &'static str {
12719 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
12720 }
12721}
12722
12723/// The long-running operation metadata for the
12724/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12725/// method.
12726///
12727/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12728#[derive(Clone, Default, PartialEq)]
12729#[non_exhaustive]
12730pub struct DeleteProcessorVersionMetadata {
12731 /// The basic metadata of the long-running operation.
12732 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12733
12734 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12735}
12736
12737impl DeleteProcessorVersionMetadata {
12738 /// Creates a new default instance.
12739 pub fn new() -> Self {
12740 std::default::Default::default()
12741 }
12742
12743 /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12744 ///
12745 /// # Example
12746 /// ```ignore,no_run
12747 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12748 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12749 /// let x = DeleteProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12750 /// ```
12751 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12752 where
12753 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12754 {
12755 self.common_metadata = std::option::Option::Some(v.into());
12756 self
12757 }
12758
12759 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12760 ///
12761 /// # Example
12762 /// ```ignore,no_run
12763 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12764 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12765 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12766 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12767 /// ```
12768 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12769 where
12770 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12771 {
12772 self.common_metadata = v.map(|x| x.into());
12773 self
12774 }
12775}
12776
12777impl wkt::message::Message for DeleteProcessorVersionMetadata {
12778 fn typename() -> &'static str {
12779 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
12780 }
12781}
12782
12783/// Request message for the
12784/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12785/// method.
12786///
12787/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12788#[derive(Clone, Default, PartialEq)]
12789#[non_exhaustive]
12790pub struct DeployProcessorVersionRequest {
12791 /// Required. The processor version resource name to be deployed.
12792 pub name: std::string::String,
12793
12794 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12795}
12796
12797impl DeployProcessorVersionRequest {
12798 /// Creates a new default instance.
12799 pub fn new() -> Self {
12800 std::default::Default::default()
12801 }
12802
12803 /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
12804 ///
12805 /// # Example
12806 /// ```ignore,no_run
12807 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionRequest;
12808 /// let x = DeployProcessorVersionRequest::new().set_name("example");
12809 /// ```
12810 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12811 self.name = v.into();
12812 self
12813 }
12814}
12815
12816impl wkt::message::Message for DeployProcessorVersionRequest {
12817 fn typename() -> &'static str {
12818 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
12819 }
12820}
12821
12822/// Response message for the
12823/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12824/// method.
12825///
12826/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12827#[derive(Clone, Default, PartialEq)]
12828#[non_exhaustive]
12829pub struct DeployProcessorVersionResponse {
12830 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12831}
12832
12833impl DeployProcessorVersionResponse {
12834 /// Creates a new default instance.
12835 pub fn new() -> Self {
12836 std::default::Default::default()
12837 }
12838}
12839
12840impl wkt::message::Message for DeployProcessorVersionResponse {
12841 fn typename() -> &'static str {
12842 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
12843 }
12844}
12845
12846/// The long-running operation metadata for the
12847/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12848/// method.
12849///
12850/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12851#[derive(Clone, Default, PartialEq)]
12852#[non_exhaustive]
12853pub struct DeployProcessorVersionMetadata {
12854 /// The basic metadata of the long-running operation.
12855 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12856
12857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12858}
12859
12860impl DeployProcessorVersionMetadata {
12861 /// Creates a new default instance.
12862 pub fn new() -> Self {
12863 std::default::Default::default()
12864 }
12865
12866 /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12867 ///
12868 /// # Example
12869 /// ```ignore,no_run
12870 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12871 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12872 /// let x = DeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12873 /// ```
12874 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12875 where
12876 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12877 {
12878 self.common_metadata = std::option::Option::Some(v.into());
12879 self
12880 }
12881
12882 /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12883 ///
12884 /// # Example
12885 /// ```ignore,no_run
12886 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12887 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12888 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12889 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12890 /// ```
12891 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12892 where
12893 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12894 {
12895 self.common_metadata = v.map(|x| x.into());
12896 self
12897 }
12898}
12899
12900impl wkt::message::Message for DeployProcessorVersionMetadata {
12901 fn typename() -> &'static str {
12902 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
12903 }
12904}
12905
12906/// Request message for the
12907/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12908/// method.
12909///
12910/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12911#[derive(Clone, Default, PartialEq)]
12912#[non_exhaustive]
12913pub struct UndeployProcessorVersionRequest {
12914 /// Required. The processor version resource name to be undeployed.
12915 pub name: std::string::String,
12916
12917 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12918}
12919
12920impl UndeployProcessorVersionRequest {
12921 /// Creates a new default instance.
12922 pub fn new() -> Self {
12923 std::default::Default::default()
12924 }
12925
12926 /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
12927 ///
12928 /// # Example
12929 /// ```ignore,no_run
12930 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionRequest;
12931 /// let x = UndeployProcessorVersionRequest::new().set_name("example");
12932 /// ```
12933 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12934 self.name = v.into();
12935 self
12936 }
12937}
12938
12939impl wkt::message::Message for UndeployProcessorVersionRequest {
12940 fn typename() -> &'static str {
12941 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
12942 }
12943}
12944
12945/// Response message for the
12946/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12947/// method.
12948///
12949/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12950#[derive(Clone, Default, PartialEq)]
12951#[non_exhaustive]
12952pub struct UndeployProcessorVersionResponse {
12953 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12954}
12955
12956impl UndeployProcessorVersionResponse {
12957 /// Creates a new default instance.
12958 pub fn new() -> Self {
12959 std::default::Default::default()
12960 }
12961}
12962
12963impl wkt::message::Message for UndeployProcessorVersionResponse {
12964 fn typename() -> &'static str {
12965 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
12966 }
12967}
12968
12969/// The long-running operation metadata for the
12970/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12971/// method.
12972///
12973/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12974#[derive(Clone, Default, PartialEq)]
12975#[non_exhaustive]
12976pub struct UndeployProcessorVersionMetadata {
12977 /// The basic metadata of the long-running operation.
12978 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12979
12980 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12981}
12982
12983impl UndeployProcessorVersionMetadata {
12984 /// Creates a new default instance.
12985 pub fn new() -> Self {
12986 std::default::Default::default()
12987 }
12988
12989 /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
12990 ///
12991 /// # Example
12992 /// ```ignore,no_run
12993 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
12994 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12995 /// let x = UndeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12996 /// ```
12997 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12998 where
12999 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13000 {
13001 self.common_metadata = std::option::Option::Some(v.into());
13002 self
13003 }
13004
13005 /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
13006 ///
13007 /// # Example
13008 /// ```ignore,no_run
13009 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
13010 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13011 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13012 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13013 /// ```
13014 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13015 where
13016 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13017 {
13018 self.common_metadata = v.map(|x| x.into());
13019 self
13020 }
13021}
13022
13023impl wkt::message::Message for UndeployProcessorVersionMetadata {
13024 fn typename() -> &'static str {
13025 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
13026 }
13027}
13028
13029/// Request message for the
13030/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
13031/// method. Notice this request is sent to a regionalized backend service. If the
13032/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
13033/// that region, the creation fails.
13034///
13035/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
13036/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
13037#[derive(Clone, Default, PartialEq)]
13038#[non_exhaustive]
13039pub struct CreateProcessorRequest {
13040 /// Required. The parent (project and location) under which to create the
13041 /// processor. Format: `projects/{project}/locations/{location}`
13042 pub parent: std::string::String,
13043
13044 /// Required. The processor to be created, requires
13045 /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
13046 /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
13047 /// to be set. Also, the
13048 /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
13049 /// field must be set if the processor is under CMEK.
13050 ///
13051 /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
13052 /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
13053 /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
13054 pub processor: std::option::Option<crate::model::Processor>,
13055
13056 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13057}
13058
13059impl CreateProcessorRequest {
13060 /// Creates a new default instance.
13061 pub fn new() -> Self {
13062 std::default::Default::default()
13063 }
13064
13065 /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
13066 ///
13067 /// # Example
13068 /// ```ignore,no_run
13069 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13070 /// let x = CreateProcessorRequest::new().set_parent("example");
13071 /// ```
13072 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13073 self.parent = v.into();
13074 self
13075 }
13076
13077 /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
13078 ///
13079 /// # Example
13080 /// ```ignore,no_run
13081 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13082 /// use google_cloud_documentai_v1::model::Processor;
13083 /// let x = CreateProcessorRequest::new().set_processor(Processor::default()/* use setters */);
13084 /// ```
13085 pub fn set_processor<T>(mut self, v: T) -> Self
13086 where
13087 T: std::convert::Into<crate::model::Processor>,
13088 {
13089 self.processor = std::option::Option::Some(v.into());
13090 self
13091 }
13092
13093 /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
13094 ///
13095 /// # Example
13096 /// ```ignore,no_run
13097 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13098 /// use google_cloud_documentai_v1::model::Processor;
13099 /// let x = CreateProcessorRequest::new().set_or_clear_processor(Some(Processor::default()/* use setters */));
13100 /// let x = CreateProcessorRequest::new().set_or_clear_processor(None::<Processor>);
13101 /// ```
13102 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
13103 where
13104 T: std::convert::Into<crate::model::Processor>,
13105 {
13106 self.processor = v.map(|x| x.into());
13107 self
13108 }
13109}
13110
13111impl wkt::message::Message for CreateProcessorRequest {
13112 fn typename() -> &'static str {
13113 "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
13114 }
13115}
13116
13117/// Request message for the
13118/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13119/// method.
13120///
13121/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13122#[derive(Clone, Default, PartialEq)]
13123#[non_exhaustive]
13124pub struct DeleteProcessorRequest {
13125 /// Required. The processor resource name to be deleted.
13126 pub name: std::string::String,
13127
13128 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13129}
13130
13131impl DeleteProcessorRequest {
13132 /// Creates a new default instance.
13133 pub fn new() -> Self {
13134 std::default::Default::default()
13135 }
13136
13137 /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
13138 ///
13139 /// # Example
13140 /// ```ignore,no_run
13141 /// # use google_cloud_documentai_v1::model::DeleteProcessorRequest;
13142 /// let x = DeleteProcessorRequest::new().set_name("example");
13143 /// ```
13144 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13145 self.name = v.into();
13146 self
13147 }
13148}
13149
13150impl wkt::message::Message for DeleteProcessorRequest {
13151 fn typename() -> &'static str {
13152 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
13153 }
13154}
13155
13156/// The long-running operation metadata for the
13157/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13158/// method.
13159///
13160/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13161#[derive(Clone, Default, PartialEq)]
13162#[non_exhaustive]
13163pub struct DeleteProcessorMetadata {
13164 /// The basic metadata of the long-running operation.
13165 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13166
13167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13168}
13169
13170impl DeleteProcessorMetadata {
13171 /// Creates a new default instance.
13172 pub fn new() -> Self {
13173 std::default::Default::default()
13174 }
13175
13176 /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13177 ///
13178 /// # Example
13179 /// ```ignore,no_run
13180 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13181 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13182 /// let x = DeleteProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13183 /// ```
13184 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13185 where
13186 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13187 {
13188 self.common_metadata = std::option::Option::Some(v.into());
13189 self
13190 }
13191
13192 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13193 ///
13194 /// # Example
13195 /// ```ignore,no_run
13196 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13197 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13198 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13199 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13200 /// ```
13201 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13202 where
13203 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13204 {
13205 self.common_metadata = v.map(|x| x.into());
13206 self
13207 }
13208}
13209
13210impl wkt::message::Message for DeleteProcessorMetadata {
13211 fn typename() -> &'static str {
13212 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
13213 }
13214}
13215
13216/// Request message for the
13217/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13218/// method.
13219///
13220/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13221#[derive(Clone, Default, PartialEq)]
13222#[non_exhaustive]
13223pub struct EnableProcessorRequest {
13224 /// Required. The processor resource name to be enabled.
13225 pub name: std::string::String,
13226
13227 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13228}
13229
13230impl EnableProcessorRequest {
13231 /// Creates a new default instance.
13232 pub fn new() -> Self {
13233 std::default::Default::default()
13234 }
13235
13236 /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
13237 ///
13238 /// # Example
13239 /// ```ignore,no_run
13240 /// # use google_cloud_documentai_v1::model::EnableProcessorRequest;
13241 /// let x = EnableProcessorRequest::new().set_name("example");
13242 /// ```
13243 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13244 self.name = v.into();
13245 self
13246 }
13247}
13248
13249impl wkt::message::Message for EnableProcessorRequest {
13250 fn typename() -> &'static str {
13251 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
13252 }
13253}
13254
13255/// Response message for the
13256/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13257/// method. Intentionally empty proto for adding fields in future.
13258///
13259/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13260#[derive(Clone, Default, PartialEq)]
13261#[non_exhaustive]
13262pub struct EnableProcessorResponse {
13263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13264}
13265
13266impl EnableProcessorResponse {
13267 /// Creates a new default instance.
13268 pub fn new() -> Self {
13269 std::default::Default::default()
13270 }
13271}
13272
13273impl wkt::message::Message for EnableProcessorResponse {
13274 fn typename() -> &'static str {
13275 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
13276 }
13277}
13278
13279/// The long-running operation metadata for the
13280/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13281/// method.
13282///
13283/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13284#[derive(Clone, Default, PartialEq)]
13285#[non_exhaustive]
13286pub struct EnableProcessorMetadata {
13287 /// The basic metadata of the long-running operation.
13288 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13289
13290 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13291}
13292
13293impl EnableProcessorMetadata {
13294 /// Creates a new default instance.
13295 pub fn new() -> Self {
13296 std::default::Default::default()
13297 }
13298
13299 /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13300 ///
13301 /// # Example
13302 /// ```ignore,no_run
13303 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13304 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13305 /// let x = EnableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13306 /// ```
13307 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13308 where
13309 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13310 {
13311 self.common_metadata = std::option::Option::Some(v.into());
13312 self
13313 }
13314
13315 /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13316 ///
13317 /// # Example
13318 /// ```ignore,no_run
13319 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13320 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13321 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13322 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13323 /// ```
13324 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13325 where
13326 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13327 {
13328 self.common_metadata = v.map(|x| x.into());
13329 self
13330 }
13331}
13332
13333impl wkt::message::Message for EnableProcessorMetadata {
13334 fn typename() -> &'static str {
13335 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
13336 }
13337}
13338
13339/// Request message for the
13340/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13341/// method.
13342///
13343/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13344#[derive(Clone, Default, PartialEq)]
13345#[non_exhaustive]
13346pub struct DisableProcessorRequest {
13347 /// Required. The processor resource name to be disabled.
13348 pub name: std::string::String,
13349
13350 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13351}
13352
13353impl DisableProcessorRequest {
13354 /// Creates a new default instance.
13355 pub fn new() -> Self {
13356 std::default::Default::default()
13357 }
13358
13359 /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
13360 ///
13361 /// # Example
13362 /// ```ignore,no_run
13363 /// # use google_cloud_documentai_v1::model::DisableProcessorRequest;
13364 /// let x = DisableProcessorRequest::new().set_name("example");
13365 /// ```
13366 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13367 self.name = v.into();
13368 self
13369 }
13370}
13371
13372impl wkt::message::Message for DisableProcessorRequest {
13373 fn typename() -> &'static str {
13374 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
13375 }
13376}
13377
13378/// Response message for the
13379/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13380/// method. Intentionally empty proto for adding fields in future.
13381///
13382/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13383#[derive(Clone, Default, PartialEq)]
13384#[non_exhaustive]
13385pub struct DisableProcessorResponse {
13386 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13387}
13388
13389impl DisableProcessorResponse {
13390 /// Creates a new default instance.
13391 pub fn new() -> Self {
13392 std::default::Default::default()
13393 }
13394}
13395
13396impl wkt::message::Message for DisableProcessorResponse {
13397 fn typename() -> &'static str {
13398 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
13399 }
13400}
13401
13402/// The long-running operation metadata for the
13403/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13404/// method.
13405///
13406/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13407#[derive(Clone, Default, PartialEq)]
13408#[non_exhaustive]
13409pub struct DisableProcessorMetadata {
13410 /// The basic metadata of the long-running operation.
13411 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13412
13413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13414}
13415
13416impl DisableProcessorMetadata {
13417 /// Creates a new default instance.
13418 pub fn new() -> Self {
13419 std::default::Default::default()
13420 }
13421
13422 /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13423 ///
13424 /// # Example
13425 /// ```ignore,no_run
13426 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13427 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13428 /// let x = DisableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13429 /// ```
13430 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13431 where
13432 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13433 {
13434 self.common_metadata = std::option::Option::Some(v.into());
13435 self
13436 }
13437
13438 /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13439 ///
13440 /// # Example
13441 /// ```ignore,no_run
13442 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13443 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13444 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13445 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13446 /// ```
13447 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13448 where
13449 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13450 {
13451 self.common_metadata = v.map(|x| x.into());
13452 self
13453 }
13454}
13455
13456impl wkt::message::Message for DisableProcessorMetadata {
13457 fn typename() -> &'static str {
13458 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
13459 }
13460}
13461
13462/// Request message for the
13463/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13464/// method.
13465///
13466/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13467#[derive(Clone, Default, PartialEq)]
13468#[non_exhaustive]
13469pub struct SetDefaultProcessorVersionRequest {
13470 /// Required. The resource name of the
13471 /// [Processor][google.cloud.documentai.v1.Processor] to change default
13472 /// version.
13473 ///
13474 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
13475 pub processor: std::string::String,
13476
13477 /// Required. The resource name of child
13478 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
13479 /// default. Format:
13480 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
13481 ///
13482 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13483 pub default_processor_version: std::string::String,
13484
13485 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13486}
13487
13488impl SetDefaultProcessorVersionRequest {
13489 /// Creates a new default instance.
13490 pub fn new() -> Self {
13491 std::default::Default::default()
13492 }
13493
13494 /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
13495 ///
13496 /// # Example
13497 /// ```ignore,no_run
13498 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13499 /// let x = SetDefaultProcessorVersionRequest::new().set_processor("example");
13500 /// ```
13501 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13502 self.processor = v.into();
13503 self
13504 }
13505
13506 /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
13507 ///
13508 /// # Example
13509 /// ```ignore,no_run
13510 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13511 /// let x = SetDefaultProcessorVersionRequest::new().set_default_processor_version("example");
13512 /// ```
13513 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
13514 mut self,
13515 v: T,
13516 ) -> Self {
13517 self.default_processor_version = v.into();
13518 self
13519 }
13520}
13521
13522impl wkt::message::Message for SetDefaultProcessorVersionRequest {
13523 fn typename() -> &'static str {
13524 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
13525 }
13526}
13527
13528/// Response message for the
13529/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13530/// method.
13531///
13532/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13533#[derive(Clone, Default, PartialEq)]
13534#[non_exhaustive]
13535pub struct SetDefaultProcessorVersionResponse {
13536 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13537}
13538
13539impl SetDefaultProcessorVersionResponse {
13540 /// Creates a new default instance.
13541 pub fn new() -> Self {
13542 std::default::Default::default()
13543 }
13544}
13545
13546impl wkt::message::Message for SetDefaultProcessorVersionResponse {
13547 fn typename() -> &'static str {
13548 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
13549 }
13550}
13551
13552/// The long-running operation metadata for the
13553/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13554/// method.
13555///
13556/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13557#[derive(Clone, Default, PartialEq)]
13558#[non_exhaustive]
13559pub struct SetDefaultProcessorVersionMetadata {
13560 /// The basic metadata of the long-running operation.
13561 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13562
13563 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13564}
13565
13566impl SetDefaultProcessorVersionMetadata {
13567 /// Creates a new default instance.
13568 pub fn new() -> Self {
13569 std::default::Default::default()
13570 }
13571
13572 /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13573 ///
13574 /// # Example
13575 /// ```ignore,no_run
13576 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13577 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13578 /// let x = SetDefaultProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13579 /// ```
13580 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13581 where
13582 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13583 {
13584 self.common_metadata = std::option::Option::Some(v.into());
13585 self
13586 }
13587
13588 /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13589 ///
13590 /// # Example
13591 /// ```ignore,no_run
13592 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13593 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13594 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13595 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13596 /// ```
13597 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13598 where
13599 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13600 {
13601 self.common_metadata = v.map(|x| x.into());
13602 self
13603 }
13604}
13605
13606impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
13607 fn typename() -> &'static str {
13608 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
13609 }
13610}
13611
13612/// Request message for the
13613/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
13614/// method.
13615///
13616/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
13617#[derive(Clone, Default, PartialEq)]
13618#[non_exhaustive]
13619pub struct TrainProcessorVersionRequest {
13620 /// Required. The parent (project, location and processor) to create the new
13621 /// version for. Format:
13622 /// `projects/{project}/locations/{location}/processors/{processor}`.
13623 pub parent: std::string::String,
13624
13625 /// Required. The processor version to be created.
13626 pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
13627
13628 /// Optional. The schema the processor version will be trained with.
13629 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
13630
13631 /// Optional. The input data used to train the
13632 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13633 ///
13634 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13635 pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
13636
13637 /// Optional. The processor version to use as a base for training. This
13638 /// processor version must be a child of `parent`. Format:
13639 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
13640 pub base_processor_version: std::string::String,
13641
13642 #[allow(missing_docs)]
13643 pub processor_flags:
13644 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13645
13646 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13647}
13648
13649impl TrainProcessorVersionRequest {
13650 /// Creates a new default instance.
13651 pub fn new() -> Self {
13652 std::default::Default::default()
13653 }
13654
13655 /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
13656 ///
13657 /// # Example
13658 /// ```ignore,no_run
13659 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13660 /// let x = TrainProcessorVersionRequest::new().set_parent("example");
13661 /// ```
13662 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13663 self.parent = v.into();
13664 self
13665 }
13666
13667 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13668 ///
13669 /// # Example
13670 /// ```ignore,no_run
13671 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13672 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13673 /// let x = TrainProcessorVersionRequest::new().set_processor_version(ProcessorVersion::default()/* use setters */);
13674 /// ```
13675 pub fn set_processor_version<T>(mut self, v: T) -> Self
13676 where
13677 T: std::convert::Into<crate::model::ProcessorVersion>,
13678 {
13679 self.processor_version = std::option::Option::Some(v.into());
13680 self
13681 }
13682
13683 /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13684 ///
13685 /// # Example
13686 /// ```ignore,no_run
13687 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13688 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13689 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(Some(ProcessorVersion::default()/* use setters */));
13690 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(None::<ProcessorVersion>);
13691 /// ```
13692 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
13693 where
13694 T: std::convert::Into<crate::model::ProcessorVersion>,
13695 {
13696 self.processor_version = v.map(|x| x.into());
13697 self
13698 }
13699
13700 /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13701 ///
13702 /// # Example
13703 /// ```ignore,no_run
13704 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13705 /// use google_cloud_documentai_v1::model::DocumentSchema;
13706 /// let x = TrainProcessorVersionRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
13707 /// ```
13708 pub fn set_document_schema<T>(mut self, v: T) -> Self
13709 where
13710 T: std::convert::Into<crate::model::DocumentSchema>,
13711 {
13712 self.document_schema = std::option::Option::Some(v.into());
13713 self
13714 }
13715
13716 /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13717 ///
13718 /// # Example
13719 /// ```ignore,no_run
13720 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13721 /// use google_cloud_documentai_v1::model::DocumentSchema;
13722 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
13723 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
13724 /// ```
13725 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
13726 where
13727 T: std::convert::Into<crate::model::DocumentSchema>,
13728 {
13729 self.document_schema = v.map(|x| x.into());
13730 self
13731 }
13732
13733 /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13734 ///
13735 /// # Example
13736 /// ```ignore,no_run
13737 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13738 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13739 /// let x = TrainProcessorVersionRequest::new().set_input_data(InputData::default()/* use setters */);
13740 /// ```
13741 pub fn set_input_data<T>(mut self, v: T) -> Self
13742 where
13743 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13744 {
13745 self.input_data = std::option::Option::Some(v.into());
13746 self
13747 }
13748
13749 /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13750 ///
13751 /// # Example
13752 /// ```ignore,no_run
13753 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13754 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13755 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(Some(InputData::default()/* use setters */));
13756 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(None::<InputData>);
13757 /// ```
13758 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
13759 where
13760 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13761 {
13762 self.input_data = v.map(|x| x.into());
13763 self
13764 }
13765
13766 /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
13767 ///
13768 /// # Example
13769 /// ```ignore,no_run
13770 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13771 /// let x = TrainProcessorVersionRequest::new().set_base_processor_version("example");
13772 /// ```
13773 pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
13774 mut self,
13775 v: T,
13776 ) -> Self {
13777 self.base_processor_version = v.into();
13778 self
13779 }
13780
13781 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
13782 ///
13783 /// Note that all the setters affecting `processor_flags` are mutually
13784 /// exclusive.
13785 ///
13786 /// # Example
13787 /// ```ignore,no_run
13788 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13789 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13790 /// let x = TrainProcessorVersionRequest::new().set_processor_flags(Some(
13791 /// google_cloud_documentai_v1::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(CustomDocumentExtractionOptions::default().into())));
13792 /// ```
13793 pub fn set_processor_flags<
13794 T: std::convert::Into<
13795 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13796 >,
13797 >(
13798 mut self,
13799 v: T,
13800 ) -> Self {
13801 self.processor_flags = v.into();
13802 self
13803 }
13804
13805 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13806 /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
13807 /// holds a different branch.
13808 pub fn custom_document_extraction_options(
13809 &self,
13810 ) -> std::option::Option<
13811 &std::boxed::Box<
13812 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13813 >,
13814 > {
13815 #[allow(unreachable_patterns)]
13816 self.processor_flags.as_ref().and_then(|v| match v {
13817 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
13818 _ => std::option::Option::None,
13819 })
13820 }
13821
13822 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13823 /// to hold a `CustomDocumentExtractionOptions`.
13824 ///
13825 /// Note that all the setters affecting `processor_flags` are
13826 /// mutually exclusive.
13827 ///
13828 /// # Example
13829 /// ```ignore,no_run
13830 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13831 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13832 /// let x = TrainProcessorVersionRequest::new().set_custom_document_extraction_options(CustomDocumentExtractionOptions::default()/* use setters */);
13833 /// assert!(x.custom_document_extraction_options().is_some());
13834 /// assert!(x.foundation_model_tuning_options().is_none());
13835 /// ```
13836 pub fn set_custom_document_extraction_options<
13837 T: std::convert::Into<
13838 std::boxed::Box<
13839 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13840 >,
13841 >,
13842 >(
13843 mut self,
13844 v: T,
13845 ) -> Self {
13846 self.processor_flags = std::option::Option::Some(
13847 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
13848 v.into()
13849 )
13850 );
13851 self
13852 }
13853
13854 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13855 /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
13856 /// holds a different branch.
13857 pub fn foundation_model_tuning_options(
13858 &self,
13859 ) -> std::option::Option<
13860 &std::boxed::Box<
13861 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13862 >,
13863 > {
13864 #[allow(unreachable_patterns)]
13865 self.processor_flags.as_ref().and_then(|v| match v {
13866 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
13867 _ => std::option::Option::None,
13868 })
13869 }
13870
13871 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13872 /// to hold a `FoundationModelTuningOptions`.
13873 ///
13874 /// Note that all the setters affecting `processor_flags` are
13875 /// mutually exclusive.
13876 ///
13877 /// # Example
13878 /// ```ignore,no_run
13879 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13880 /// use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13881 /// let x = TrainProcessorVersionRequest::new().set_foundation_model_tuning_options(FoundationModelTuningOptions::default()/* use setters */);
13882 /// assert!(x.foundation_model_tuning_options().is_some());
13883 /// assert!(x.custom_document_extraction_options().is_none());
13884 /// ```
13885 pub fn set_foundation_model_tuning_options<
13886 T: std::convert::Into<
13887 std::boxed::Box<
13888 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13889 >,
13890 >,
13891 >(
13892 mut self,
13893 v: T,
13894 ) -> Self {
13895 self.processor_flags = std::option::Option::Some(
13896 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
13897 v.into()
13898 )
13899 );
13900 self
13901 }
13902}
13903
13904impl wkt::message::Message for TrainProcessorVersionRequest {
13905 fn typename() -> &'static str {
13906 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
13907 }
13908}
13909
13910/// Defines additional types related to [TrainProcessorVersionRequest].
13911pub mod train_processor_version_request {
13912 #[allow(unused_imports)]
13913 use super::*;
13914
13915 /// The input data used to train a new
13916 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13917 ///
13918 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13919 #[derive(Clone, Default, PartialEq)]
13920 #[non_exhaustive]
13921 pub struct InputData {
13922 /// The documents used for training the new version.
13923 pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13924
13925 /// The documents used for testing the trained version.
13926 pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13927
13928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13929 }
13930
13931 impl InputData {
13932 /// Creates a new default instance.
13933 pub fn new() -> Self {
13934 std::default::Default::default()
13935 }
13936
13937 /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
13938 ///
13939 /// # Example
13940 /// ```ignore,no_run
13941 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13942 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13943 /// let x = InputData::new().set_training_documents(BatchDocumentsInputConfig::default()/* use setters */);
13944 /// ```
13945 pub fn set_training_documents<T>(mut self, v: T) -> Self
13946 where
13947 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13948 {
13949 self.training_documents = std::option::Option::Some(v.into());
13950 self
13951 }
13952
13953 /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
13954 ///
13955 /// # Example
13956 /// ```ignore,no_run
13957 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13958 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13959 /// let x = InputData::new().set_or_clear_training_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
13960 /// let x = InputData::new().set_or_clear_training_documents(None::<BatchDocumentsInputConfig>);
13961 /// ```
13962 pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
13963 where
13964 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13965 {
13966 self.training_documents = v.map(|x| x.into());
13967 self
13968 }
13969
13970 /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
13971 ///
13972 /// # Example
13973 /// ```ignore,no_run
13974 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13975 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13976 /// let x = InputData::new().set_test_documents(BatchDocumentsInputConfig::default()/* use setters */);
13977 /// ```
13978 pub fn set_test_documents<T>(mut self, v: T) -> Self
13979 where
13980 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13981 {
13982 self.test_documents = std::option::Option::Some(v.into());
13983 self
13984 }
13985
13986 /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
13987 ///
13988 /// # Example
13989 /// ```ignore,no_run
13990 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13991 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13992 /// let x = InputData::new().set_or_clear_test_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
13993 /// let x = InputData::new().set_or_clear_test_documents(None::<BatchDocumentsInputConfig>);
13994 /// ```
13995 pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
13996 where
13997 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
13998 {
13999 self.test_documents = v.map(|x| x.into());
14000 self
14001 }
14002 }
14003
14004 impl wkt::message::Message for InputData {
14005 fn typename() -> &'static str {
14006 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
14007 }
14008 }
14009
14010 /// Options to control the training of the Custom Document Extraction (CDE)
14011 /// Processor.
14012 #[derive(Clone, Default, PartialEq)]
14013 #[non_exhaustive]
14014 pub struct CustomDocumentExtractionOptions {
14015
14016 /// Optional. Training method to use for CDE training.
14017 pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
14018
14019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14020 }
14021
14022 impl CustomDocumentExtractionOptions {
14023 /// Creates a new default instance.
14024 pub fn new() -> Self {
14025 std::default::Default::default()
14026 }
14027
14028 /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
14029 ///
14030 /// # Example
14031 /// ```ignore,no_run
14032 /// # use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
14033 /// use google_cloud_documentai_v1::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod;
14034 /// let x0 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::ModelBased);
14035 /// let x1 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::TemplateBased);
14036 /// ```
14037 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{
14038 self.training_method = v.into();
14039 self
14040 }
14041 }
14042
14043 impl wkt::message::Message for CustomDocumentExtractionOptions {
14044 fn typename() -> &'static str {
14045 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
14046 }
14047 }
14048
14049 /// Defines additional types related to [CustomDocumentExtractionOptions].
14050 pub mod custom_document_extraction_options {
14051 #[allow(unused_imports)]
14052 use super::*;
14053
14054 /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
14055 /// `MODEL_BASED`.
14056 ///
14057 /// # Working with unknown values
14058 ///
14059 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14060 /// additional enum variants at any time. Adding new variants is not considered
14061 /// a breaking change. Applications should write their code in anticipation of:
14062 ///
14063 /// - New values appearing in future releases of the client library, **and**
14064 /// - New values received dynamically, without application changes.
14065 ///
14066 /// Please consult the [Working with enums] section in the user guide for some
14067 /// guidelines.
14068 ///
14069 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14070 #[derive(Clone, Debug, PartialEq)]
14071 #[non_exhaustive]
14072 pub enum TrainingMethod {
14073 #[allow(missing_docs)]
14074 Unspecified,
14075 #[allow(missing_docs)]
14076 ModelBased,
14077 #[allow(missing_docs)]
14078 TemplateBased,
14079 /// If set, the enum was initialized with an unknown value.
14080 ///
14081 /// Applications can examine the value using [TrainingMethod::value] or
14082 /// [TrainingMethod::name].
14083 UnknownValue(training_method::UnknownValue),
14084 }
14085
14086 #[doc(hidden)]
14087 pub mod training_method {
14088 #[allow(unused_imports)]
14089 use super::*;
14090 #[derive(Clone, Debug, PartialEq)]
14091 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14092 }
14093
14094 impl TrainingMethod {
14095 /// Gets the enum value.
14096 ///
14097 /// Returns `None` if the enum contains an unknown value deserialized from
14098 /// the string representation of enums.
14099 pub fn value(&self) -> std::option::Option<i32> {
14100 match self {
14101 Self::Unspecified => std::option::Option::Some(0),
14102 Self::ModelBased => std::option::Option::Some(1),
14103 Self::TemplateBased => std::option::Option::Some(2),
14104 Self::UnknownValue(u) => u.0.value(),
14105 }
14106 }
14107
14108 /// Gets the enum value as a string.
14109 ///
14110 /// Returns `None` if the enum contains an unknown value deserialized from
14111 /// the integer representation of enums.
14112 pub fn name(&self) -> std::option::Option<&str> {
14113 match self {
14114 Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
14115 Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
14116 Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
14117 Self::UnknownValue(u) => u.0.name(),
14118 }
14119 }
14120 }
14121
14122 impl std::default::Default for TrainingMethod {
14123 fn default() -> Self {
14124 use std::convert::From;
14125 Self::from(0)
14126 }
14127 }
14128
14129 impl std::fmt::Display for TrainingMethod {
14130 fn fmt(
14131 &self,
14132 f: &mut std::fmt::Formatter<'_>,
14133 ) -> std::result::Result<(), std::fmt::Error> {
14134 wkt::internal::display_enum(f, self.name(), self.value())
14135 }
14136 }
14137
14138 impl std::convert::From<i32> for TrainingMethod {
14139 fn from(value: i32) -> Self {
14140 match value {
14141 0 => Self::Unspecified,
14142 1 => Self::ModelBased,
14143 2 => Self::TemplateBased,
14144 _ => Self::UnknownValue(training_method::UnknownValue(
14145 wkt::internal::UnknownEnumValue::Integer(value),
14146 )),
14147 }
14148 }
14149 }
14150
14151 impl std::convert::From<&str> for TrainingMethod {
14152 fn from(value: &str) -> Self {
14153 use std::string::ToString;
14154 match value {
14155 "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
14156 "MODEL_BASED" => Self::ModelBased,
14157 "TEMPLATE_BASED" => Self::TemplateBased,
14158 _ => Self::UnknownValue(training_method::UnknownValue(
14159 wkt::internal::UnknownEnumValue::String(value.to_string()),
14160 )),
14161 }
14162 }
14163 }
14164
14165 impl serde::ser::Serialize for TrainingMethod {
14166 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14167 where
14168 S: serde::Serializer,
14169 {
14170 match self {
14171 Self::Unspecified => serializer.serialize_i32(0),
14172 Self::ModelBased => serializer.serialize_i32(1),
14173 Self::TemplateBased => serializer.serialize_i32(2),
14174 Self::UnknownValue(u) => u.0.serialize(serializer),
14175 }
14176 }
14177 }
14178
14179 impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
14180 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14181 where
14182 D: serde::Deserializer<'de>,
14183 {
14184 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
14185 ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
14186 }
14187 }
14188 }
14189
14190 /// Options to control foundation model tuning of the processor.
14191 #[derive(Clone, Default, PartialEq)]
14192 #[non_exhaustive]
14193 pub struct FoundationModelTuningOptions {
14194 /// Optional. The number of steps to run for model tuning. Valid values are
14195 /// between 1 and 400. If not provided, recommended steps will be used.
14196 pub train_steps: i32,
14197
14198 /// Optional. The multiplier to apply to the recommended learning rate. Valid
14199 /// values are between 0.1 and 10. If not provided, recommended learning rate
14200 /// will be used.
14201 pub learning_rate_multiplier: f32,
14202
14203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14204 }
14205
14206 impl FoundationModelTuningOptions {
14207 /// Creates a new default instance.
14208 pub fn new() -> Self {
14209 std::default::Default::default()
14210 }
14211
14212 /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
14213 ///
14214 /// # Example
14215 /// ```ignore,no_run
14216 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14217 /// let x = FoundationModelTuningOptions::new().set_train_steps(42);
14218 /// ```
14219 pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14220 self.train_steps = v.into();
14221 self
14222 }
14223
14224 /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
14225 ///
14226 /// # Example
14227 /// ```ignore,no_run
14228 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14229 /// let x = FoundationModelTuningOptions::new().set_learning_rate_multiplier(42.0);
14230 /// ```
14231 pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14232 self.learning_rate_multiplier = v.into();
14233 self
14234 }
14235 }
14236
14237 impl wkt::message::Message for FoundationModelTuningOptions {
14238 fn typename() -> &'static str {
14239 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
14240 }
14241 }
14242
14243 #[allow(missing_docs)]
14244 #[derive(Clone, Debug, PartialEq)]
14245 #[non_exhaustive]
14246 pub enum ProcessorFlags {
14247 /// Options to control Custom Document Extraction (CDE) Processor.
14248 CustomDocumentExtractionOptions(
14249 std::boxed::Box<
14250 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
14251 >,
14252 ),
14253 /// Options to control foundation model tuning of a processor.
14254 FoundationModelTuningOptions(
14255 std::boxed::Box<
14256 crate::model::train_processor_version_request::FoundationModelTuningOptions,
14257 >,
14258 ),
14259 }
14260}
14261
14262/// The response for
14263/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
14264///
14265/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
14266#[derive(Clone, Default, PartialEq)]
14267#[non_exhaustive]
14268pub struct TrainProcessorVersionResponse {
14269 /// The resource name of the processor version produced by training.
14270 pub processor_version: std::string::String,
14271
14272 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14273}
14274
14275impl TrainProcessorVersionResponse {
14276 /// Creates a new default instance.
14277 pub fn new() -> Self {
14278 std::default::Default::default()
14279 }
14280
14281 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
14282 ///
14283 /// # Example
14284 /// ```ignore,no_run
14285 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionResponse;
14286 /// let x = TrainProcessorVersionResponse::new().set_processor_version("example");
14287 /// ```
14288 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
14289 mut self,
14290 v: T,
14291 ) -> Self {
14292 self.processor_version = v.into();
14293 self
14294 }
14295}
14296
14297impl wkt::message::Message for TrainProcessorVersionResponse {
14298 fn typename() -> &'static str {
14299 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
14300 }
14301}
14302
14303/// The metadata that represents a processor version being created.
14304#[derive(Clone, Default, PartialEq)]
14305#[non_exhaustive]
14306pub struct TrainProcessorVersionMetadata {
14307 /// The basic metadata of the long-running operation.
14308 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14309
14310 /// The training dataset validation information.
14311 pub training_dataset_validation:
14312 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14313
14314 /// The test dataset validation information.
14315 pub test_dataset_validation:
14316 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14317
14318 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14319}
14320
14321impl TrainProcessorVersionMetadata {
14322 /// Creates a new default instance.
14323 pub fn new() -> Self {
14324 std::default::Default::default()
14325 }
14326
14327 /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14328 ///
14329 /// # Example
14330 /// ```ignore,no_run
14331 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14332 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14333 /// let x = TrainProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14334 /// ```
14335 pub fn set_common_metadata<T>(mut self, v: T) -> Self
14336 where
14337 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14338 {
14339 self.common_metadata = std::option::Option::Some(v.into());
14340 self
14341 }
14342
14343 /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14344 ///
14345 /// # Example
14346 /// ```ignore,no_run
14347 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14348 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14349 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14350 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14351 /// ```
14352 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14353 where
14354 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14355 {
14356 self.common_metadata = v.map(|x| x.into());
14357 self
14358 }
14359
14360 /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14361 ///
14362 /// # Example
14363 /// ```ignore,no_run
14364 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14365 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14366 /// let x = TrainProcessorVersionMetadata::new().set_training_dataset_validation(DatasetValidation::default()/* use setters */);
14367 /// ```
14368 pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
14369 where
14370 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14371 {
14372 self.training_dataset_validation = std::option::Option::Some(v.into());
14373 self
14374 }
14375
14376 /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14377 ///
14378 /// # Example
14379 /// ```ignore,no_run
14380 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14381 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14382 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14383 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(None::<DatasetValidation>);
14384 /// ```
14385 pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14386 where
14387 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14388 {
14389 self.training_dataset_validation = v.map(|x| x.into());
14390 self
14391 }
14392
14393 /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14394 ///
14395 /// # Example
14396 /// ```ignore,no_run
14397 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14398 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14399 /// let x = TrainProcessorVersionMetadata::new().set_test_dataset_validation(DatasetValidation::default()/* use setters */);
14400 /// ```
14401 pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
14402 where
14403 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14404 {
14405 self.test_dataset_validation = std::option::Option::Some(v.into());
14406 self
14407 }
14408
14409 /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14410 ///
14411 /// # Example
14412 /// ```ignore,no_run
14413 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14414 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14415 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14416 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(None::<DatasetValidation>);
14417 /// ```
14418 pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14419 where
14420 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14421 {
14422 self.test_dataset_validation = v.map(|x| x.into());
14423 self
14424 }
14425}
14426
14427impl wkt::message::Message for TrainProcessorVersionMetadata {
14428 fn typename() -> &'static str {
14429 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
14430 }
14431}
14432
14433/// Defines additional types related to [TrainProcessorVersionMetadata].
14434pub mod train_processor_version_metadata {
14435 #[allow(unused_imports)]
14436 use super::*;
14437
14438 /// The dataset validation information.
14439 /// This includes any and all errors with documents and the dataset.
14440 #[derive(Clone, Default, PartialEq)]
14441 #[non_exhaustive]
14442 pub struct DatasetValidation {
14443 /// The total number of document errors.
14444 pub document_error_count: i32,
14445
14446 /// The total number of dataset errors.
14447 pub dataset_error_count: i32,
14448
14449 /// Error information pertaining to specific documents. A maximum of 10
14450 /// document errors will be returned.
14451 /// Any document with errors will not be used throughout training.
14452 pub document_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14453
14454 /// Error information for the dataset as a whole. A maximum of 10 dataset
14455 /// errors will be returned.
14456 /// A single dataset error is terminal for training.
14457 pub dataset_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14458
14459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14460 }
14461
14462 impl DatasetValidation {
14463 /// Creates a new default instance.
14464 pub fn new() -> Self {
14465 std::default::Default::default()
14466 }
14467
14468 /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
14469 ///
14470 /// # Example
14471 /// ```ignore,no_run
14472 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14473 /// let x = DatasetValidation::new().set_document_error_count(42);
14474 /// ```
14475 pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14476 self.document_error_count = v.into();
14477 self
14478 }
14479
14480 /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
14481 ///
14482 /// # Example
14483 /// ```ignore,no_run
14484 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14485 /// let x = DatasetValidation::new().set_dataset_error_count(42);
14486 /// ```
14487 pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14488 self.dataset_error_count = v.into();
14489 self
14490 }
14491
14492 /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
14493 ///
14494 /// # Example
14495 /// ```ignore,no_run
14496 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14497 /// use google_cloud_rpc::model::Status;
14498 /// let x = DatasetValidation::new()
14499 /// .set_document_errors([
14500 /// Status::default()/* use setters */,
14501 /// Status::default()/* use (different) setters */,
14502 /// ]);
14503 /// ```
14504 pub fn set_document_errors<T, V>(mut self, v: T) -> Self
14505 where
14506 T: std::iter::IntoIterator<Item = V>,
14507 V: std::convert::Into<google_cloud_rpc::model::Status>,
14508 {
14509 use std::iter::Iterator;
14510 self.document_errors = v.into_iter().map(|i| i.into()).collect();
14511 self
14512 }
14513
14514 /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
14515 ///
14516 /// # Example
14517 /// ```ignore,no_run
14518 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14519 /// use google_cloud_rpc::model::Status;
14520 /// let x = DatasetValidation::new()
14521 /// .set_dataset_errors([
14522 /// Status::default()/* use setters */,
14523 /// Status::default()/* use (different) setters */,
14524 /// ]);
14525 /// ```
14526 pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
14527 where
14528 T: std::iter::IntoIterator<Item = V>,
14529 V: std::convert::Into<google_cloud_rpc::model::Status>,
14530 {
14531 use std::iter::Iterator;
14532 self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
14533 self
14534 }
14535 }
14536
14537 impl wkt::message::Message for DatasetValidation {
14538 fn typename() -> &'static str {
14539 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
14540 }
14541 }
14542}
14543
14544/// Request message for the
14545/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14546/// method.
14547///
14548/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14549#[derive(Clone, Default, PartialEq)]
14550#[non_exhaustive]
14551pub struct ReviewDocumentRequest {
14552 /// Required. The resource name of the
14553 /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
14554 /// document will be reviewed with.
14555 pub human_review_config: std::string::String,
14556
14557 /// Whether the validation should be performed on the ad-hoc review request.
14558 pub enable_schema_validation: bool,
14559
14560 /// The priority of the human review task.
14561 pub priority: crate::model::review_document_request::Priority,
14562
14563 /// The document schema of the human review task.
14564 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
14565
14566 /// The document payload.
14567 pub source: std::option::Option<crate::model::review_document_request::Source>,
14568
14569 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14570}
14571
14572impl ReviewDocumentRequest {
14573 /// Creates a new default instance.
14574 pub fn new() -> Self {
14575 std::default::Default::default()
14576 }
14577
14578 /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
14579 ///
14580 /// # Example
14581 /// ```ignore,no_run
14582 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14583 /// let x = ReviewDocumentRequest::new().set_human_review_config("example");
14584 /// ```
14585 pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
14586 mut self,
14587 v: T,
14588 ) -> Self {
14589 self.human_review_config = v.into();
14590 self
14591 }
14592
14593 /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
14594 ///
14595 /// # Example
14596 /// ```ignore,no_run
14597 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14598 /// let x = ReviewDocumentRequest::new().set_enable_schema_validation(true);
14599 /// ```
14600 pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14601 self.enable_schema_validation = v.into();
14602 self
14603 }
14604
14605 /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
14606 ///
14607 /// # Example
14608 /// ```ignore,no_run
14609 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14610 /// use google_cloud_documentai_v1::model::review_document_request::Priority;
14611 /// let x0 = ReviewDocumentRequest::new().set_priority(Priority::Urgent);
14612 /// ```
14613 pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
14614 mut self,
14615 v: T,
14616 ) -> Self {
14617 self.priority = v.into();
14618 self
14619 }
14620
14621 /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14622 ///
14623 /// # Example
14624 /// ```ignore,no_run
14625 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14626 /// use google_cloud_documentai_v1::model::DocumentSchema;
14627 /// let x = ReviewDocumentRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
14628 /// ```
14629 pub fn set_document_schema<T>(mut self, v: T) -> Self
14630 where
14631 T: std::convert::Into<crate::model::DocumentSchema>,
14632 {
14633 self.document_schema = std::option::Option::Some(v.into());
14634 self
14635 }
14636
14637 /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14638 ///
14639 /// # Example
14640 /// ```ignore,no_run
14641 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14642 /// use google_cloud_documentai_v1::model::DocumentSchema;
14643 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
14644 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
14645 /// ```
14646 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
14647 where
14648 T: std::convert::Into<crate::model::DocumentSchema>,
14649 {
14650 self.document_schema = v.map(|x| x.into());
14651 self
14652 }
14653
14654 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
14655 ///
14656 /// Note that all the setters affecting `source` are mutually
14657 /// exclusive.
14658 ///
14659 /// # Example
14660 /// ```ignore,no_run
14661 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14662 /// use google_cloud_documentai_v1::model::Document;
14663 /// let x = ReviewDocumentRequest::new().set_source(Some(
14664 /// google_cloud_documentai_v1::model::review_document_request::Source::InlineDocument(Document::default().into())));
14665 /// ```
14666 pub fn set_source<
14667 T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
14668 >(
14669 mut self,
14670 v: T,
14671 ) -> Self {
14672 self.source = v.into();
14673 self
14674 }
14675
14676 /// The value of [source][crate::model::ReviewDocumentRequest::source]
14677 /// if it holds a `InlineDocument`, `None` if the field is not set or
14678 /// holds a different branch.
14679 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
14680 #[allow(unreachable_patterns)]
14681 self.source.as_ref().and_then(|v| match v {
14682 crate::model::review_document_request::Source::InlineDocument(v) => {
14683 std::option::Option::Some(v)
14684 }
14685 _ => std::option::Option::None,
14686 })
14687 }
14688
14689 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
14690 /// to hold a `InlineDocument`.
14691 ///
14692 /// Note that all the setters affecting `source` are
14693 /// mutually exclusive.
14694 ///
14695 /// # Example
14696 /// ```ignore,no_run
14697 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14698 /// use google_cloud_documentai_v1::model::Document;
14699 /// let x = ReviewDocumentRequest::new().set_inline_document(Document::default()/* use setters */);
14700 /// assert!(x.inline_document().is_some());
14701 /// ```
14702 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
14703 mut self,
14704 v: T,
14705 ) -> Self {
14706 self.source = std::option::Option::Some(
14707 crate::model::review_document_request::Source::InlineDocument(v.into()),
14708 );
14709 self
14710 }
14711}
14712
14713impl wkt::message::Message for ReviewDocumentRequest {
14714 fn typename() -> &'static str {
14715 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
14716 }
14717}
14718
14719/// Defines additional types related to [ReviewDocumentRequest].
14720pub mod review_document_request {
14721 #[allow(unused_imports)]
14722 use super::*;
14723
14724 /// The priority level of the human review task.
14725 ///
14726 /// # Working with unknown values
14727 ///
14728 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14729 /// additional enum variants at any time. Adding new variants is not considered
14730 /// a breaking change. Applications should write their code in anticipation of:
14731 ///
14732 /// - New values appearing in future releases of the client library, **and**
14733 /// - New values received dynamically, without application changes.
14734 ///
14735 /// Please consult the [Working with enums] section in the user guide for some
14736 /// guidelines.
14737 ///
14738 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14739 #[derive(Clone, Debug, PartialEq)]
14740 #[non_exhaustive]
14741 pub enum Priority {
14742 /// The default priority level.
14743 Default,
14744 /// The urgent priority level. The labeling manager should allocate labeler
14745 /// resource to the urgent task queue to respect this priority level.
14746 Urgent,
14747 /// If set, the enum was initialized with an unknown value.
14748 ///
14749 /// Applications can examine the value using [Priority::value] or
14750 /// [Priority::name].
14751 UnknownValue(priority::UnknownValue),
14752 }
14753
14754 #[doc(hidden)]
14755 pub mod priority {
14756 #[allow(unused_imports)]
14757 use super::*;
14758 #[derive(Clone, Debug, PartialEq)]
14759 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14760 }
14761
14762 impl Priority {
14763 /// Gets the enum value.
14764 ///
14765 /// Returns `None` if the enum contains an unknown value deserialized from
14766 /// the string representation of enums.
14767 pub fn value(&self) -> std::option::Option<i32> {
14768 match self {
14769 Self::Default => std::option::Option::Some(0),
14770 Self::Urgent => std::option::Option::Some(1),
14771 Self::UnknownValue(u) => u.0.value(),
14772 }
14773 }
14774
14775 /// Gets the enum value as a string.
14776 ///
14777 /// Returns `None` if the enum contains an unknown value deserialized from
14778 /// the integer representation of enums.
14779 pub fn name(&self) -> std::option::Option<&str> {
14780 match self {
14781 Self::Default => std::option::Option::Some("DEFAULT"),
14782 Self::Urgent => std::option::Option::Some("URGENT"),
14783 Self::UnknownValue(u) => u.0.name(),
14784 }
14785 }
14786 }
14787
14788 impl std::default::Default for Priority {
14789 fn default() -> Self {
14790 use std::convert::From;
14791 Self::from(0)
14792 }
14793 }
14794
14795 impl std::fmt::Display for Priority {
14796 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14797 wkt::internal::display_enum(f, self.name(), self.value())
14798 }
14799 }
14800
14801 impl std::convert::From<i32> for Priority {
14802 fn from(value: i32) -> Self {
14803 match value {
14804 0 => Self::Default,
14805 1 => Self::Urgent,
14806 _ => Self::UnknownValue(priority::UnknownValue(
14807 wkt::internal::UnknownEnumValue::Integer(value),
14808 )),
14809 }
14810 }
14811 }
14812
14813 impl std::convert::From<&str> for Priority {
14814 fn from(value: &str) -> Self {
14815 use std::string::ToString;
14816 match value {
14817 "DEFAULT" => Self::Default,
14818 "URGENT" => Self::Urgent,
14819 _ => Self::UnknownValue(priority::UnknownValue(
14820 wkt::internal::UnknownEnumValue::String(value.to_string()),
14821 )),
14822 }
14823 }
14824 }
14825
14826 impl serde::ser::Serialize for Priority {
14827 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14828 where
14829 S: serde::Serializer,
14830 {
14831 match self {
14832 Self::Default => serializer.serialize_i32(0),
14833 Self::Urgent => serializer.serialize_i32(1),
14834 Self::UnknownValue(u) => u.0.serialize(serializer),
14835 }
14836 }
14837 }
14838
14839 impl<'de> serde::de::Deserialize<'de> for Priority {
14840 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14841 where
14842 D: serde::Deserializer<'de>,
14843 {
14844 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
14845 ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
14846 ))
14847 }
14848 }
14849
14850 /// The document payload.
14851 #[derive(Clone, Debug, PartialEq)]
14852 #[non_exhaustive]
14853 pub enum Source {
14854 /// An inline document proto.
14855 InlineDocument(std::boxed::Box<crate::model::Document>),
14856 }
14857}
14858
14859/// Response message for the
14860/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14861/// method.
14862///
14863/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14864#[derive(Clone, Default, PartialEq)]
14865#[non_exhaustive]
14866pub struct ReviewDocumentResponse {
14867 /// The Cloud Storage uri for the human reviewed document if the review is
14868 /// succeeded.
14869 pub gcs_destination: std::string::String,
14870
14871 /// The state of the review operation.
14872 pub state: crate::model::review_document_response::State,
14873
14874 /// The reason why the review is rejected by reviewer.
14875 pub rejection_reason: std::string::String,
14876
14877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14878}
14879
14880impl ReviewDocumentResponse {
14881 /// Creates a new default instance.
14882 pub fn new() -> Self {
14883 std::default::Default::default()
14884 }
14885
14886 /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
14887 ///
14888 /// # Example
14889 /// ```ignore,no_run
14890 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14891 /// let x = ReviewDocumentResponse::new().set_gcs_destination("example");
14892 /// ```
14893 pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14894 self.gcs_destination = v.into();
14895 self
14896 }
14897
14898 /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
14899 ///
14900 /// # Example
14901 /// ```ignore,no_run
14902 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14903 /// use google_cloud_documentai_v1::model::review_document_response::State;
14904 /// let x0 = ReviewDocumentResponse::new().set_state(State::Rejected);
14905 /// let x1 = ReviewDocumentResponse::new().set_state(State::Succeeded);
14906 /// ```
14907 pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
14908 mut self,
14909 v: T,
14910 ) -> Self {
14911 self.state = v.into();
14912 self
14913 }
14914
14915 /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
14916 ///
14917 /// # Example
14918 /// ```ignore,no_run
14919 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14920 /// let x = ReviewDocumentResponse::new().set_rejection_reason("example");
14921 /// ```
14922 pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
14923 mut self,
14924 v: T,
14925 ) -> Self {
14926 self.rejection_reason = v.into();
14927 self
14928 }
14929}
14930
14931impl wkt::message::Message for ReviewDocumentResponse {
14932 fn typename() -> &'static str {
14933 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
14934 }
14935}
14936
14937/// Defines additional types related to [ReviewDocumentResponse].
14938pub mod review_document_response {
14939 #[allow(unused_imports)]
14940 use super::*;
14941
14942 /// Possible states of the review operation.
14943 ///
14944 /// # Working with unknown values
14945 ///
14946 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14947 /// additional enum variants at any time. Adding new variants is not considered
14948 /// a breaking change. Applications should write their code in anticipation of:
14949 ///
14950 /// - New values appearing in future releases of the client library, **and**
14951 /// - New values received dynamically, without application changes.
14952 ///
14953 /// Please consult the [Working with enums] section in the user guide for some
14954 /// guidelines.
14955 ///
14956 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14957 #[derive(Clone, Debug, PartialEq)]
14958 #[non_exhaustive]
14959 pub enum State {
14960 /// The default value. This value is used if the state is omitted.
14961 Unspecified,
14962 /// The review operation is rejected by the reviewer.
14963 Rejected,
14964 /// The review operation is succeeded.
14965 Succeeded,
14966 /// If set, the enum was initialized with an unknown value.
14967 ///
14968 /// Applications can examine the value using [State::value] or
14969 /// [State::name].
14970 UnknownValue(state::UnknownValue),
14971 }
14972
14973 #[doc(hidden)]
14974 pub mod state {
14975 #[allow(unused_imports)]
14976 use super::*;
14977 #[derive(Clone, Debug, PartialEq)]
14978 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14979 }
14980
14981 impl State {
14982 /// Gets the enum value.
14983 ///
14984 /// Returns `None` if the enum contains an unknown value deserialized from
14985 /// the string representation of enums.
14986 pub fn value(&self) -> std::option::Option<i32> {
14987 match self {
14988 Self::Unspecified => std::option::Option::Some(0),
14989 Self::Rejected => std::option::Option::Some(1),
14990 Self::Succeeded => std::option::Option::Some(2),
14991 Self::UnknownValue(u) => u.0.value(),
14992 }
14993 }
14994
14995 /// Gets the enum value as a string.
14996 ///
14997 /// Returns `None` if the enum contains an unknown value deserialized from
14998 /// the integer representation of enums.
14999 pub fn name(&self) -> std::option::Option<&str> {
15000 match self {
15001 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
15002 Self::Rejected => std::option::Option::Some("REJECTED"),
15003 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
15004 Self::UnknownValue(u) => u.0.name(),
15005 }
15006 }
15007 }
15008
15009 impl std::default::Default for State {
15010 fn default() -> Self {
15011 use std::convert::From;
15012 Self::from(0)
15013 }
15014 }
15015
15016 impl std::fmt::Display for State {
15017 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15018 wkt::internal::display_enum(f, self.name(), self.value())
15019 }
15020 }
15021
15022 impl std::convert::From<i32> for State {
15023 fn from(value: i32) -> Self {
15024 match value {
15025 0 => Self::Unspecified,
15026 1 => Self::Rejected,
15027 2 => Self::Succeeded,
15028 _ => Self::UnknownValue(state::UnknownValue(
15029 wkt::internal::UnknownEnumValue::Integer(value),
15030 )),
15031 }
15032 }
15033 }
15034
15035 impl std::convert::From<&str> for State {
15036 fn from(value: &str) -> Self {
15037 use std::string::ToString;
15038 match value {
15039 "STATE_UNSPECIFIED" => Self::Unspecified,
15040 "REJECTED" => Self::Rejected,
15041 "SUCCEEDED" => Self::Succeeded,
15042 _ => Self::UnknownValue(state::UnknownValue(
15043 wkt::internal::UnknownEnumValue::String(value.to_string()),
15044 )),
15045 }
15046 }
15047 }
15048
15049 impl serde::ser::Serialize for State {
15050 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15051 where
15052 S: serde::Serializer,
15053 {
15054 match self {
15055 Self::Unspecified => serializer.serialize_i32(0),
15056 Self::Rejected => serializer.serialize_i32(1),
15057 Self::Succeeded => serializer.serialize_i32(2),
15058 Self::UnknownValue(u) => u.0.serialize(serializer),
15059 }
15060 }
15061 }
15062
15063 impl<'de> serde::de::Deserialize<'de> for State {
15064 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15065 where
15066 D: serde::Deserializer<'de>,
15067 {
15068 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
15069 ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
15070 ))
15071 }
15072 }
15073}
15074
15075/// The long-running operation metadata for the
15076/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
15077/// method.
15078///
15079/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
15080#[derive(Clone, Default, PartialEq)]
15081#[non_exhaustive]
15082pub struct ReviewDocumentOperationMetadata {
15083 /// The basic metadata of the long-running operation.
15084 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15085
15086 /// The Crowd Compute question ID.
15087 pub question_id: std::string::String,
15088
15089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15090}
15091
15092impl ReviewDocumentOperationMetadata {
15093 /// Creates a new default instance.
15094 pub fn new() -> Self {
15095 std::default::Default::default()
15096 }
15097
15098 /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
15099 ///
15100 /// # Example
15101 /// ```ignore,no_run
15102 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15103 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15104 /// let x = ReviewDocumentOperationMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15105 /// ```
15106 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15107 where
15108 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15109 {
15110 self.common_metadata = std::option::Option::Some(v.into());
15111 self
15112 }
15113
15114 /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
15115 ///
15116 /// # Example
15117 /// ```ignore,no_run
15118 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15119 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15120 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15121 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15122 /// ```
15123 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15124 where
15125 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15126 {
15127 self.common_metadata = v.map(|x| x.into());
15128 self
15129 }
15130
15131 /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
15132 ///
15133 /// # Example
15134 /// ```ignore,no_run
15135 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15136 /// let x = ReviewDocumentOperationMetadata::new().set_question_id("example");
15137 /// ```
15138 pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15139 self.question_id = v.into();
15140 self
15141 }
15142}
15143
15144impl wkt::message::Message for ReviewDocumentOperationMetadata {
15145 fn typename() -> &'static str {
15146 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
15147 }
15148}
15149
15150/// Evaluates the given
15151/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
15152/// supplied documents.
15153///
15154/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15155#[derive(Clone, Default, PartialEq)]
15156#[non_exhaustive]
15157pub struct EvaluateProcessorVersionRequest {
15158 /// Required. The resource name of the
15159 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
15160 /// evaluate.
15161 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15162 ///
15163 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15164 pub processor_version: std::string::String,
15165
15166 /// Optional. The documents used in the evaluation. If unspecified, use the
15167 /// processor's dataset as evaluation input.
15168 pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
15169
15170 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15171}
15172
15173impl EvaluateProcessorVersionRequest {
15174 /// Creates a new default instance.
15175 pub fn new() -> Self {
15176 std::default::Default::default()
15177 }
15178
15179 /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
15180 ///
15181 /// # Example
15182 /// ```ignore,no_run
15183 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15184 /// let x = EvaluateProcessorVersionRequest::new().set_processor_version("example");
15185 /// ```
15186 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
15187 mut self,
15188 v: T,
15189 ) -> Self {
15190 self.processor_version = v.into();
15191 self
15192 }
15193
15194 /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15195 ///
15196 /// # Example
15197 /// ```ignore,no_run
15198 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15199 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15200 /// let x = EvaluateProcessorVersionRequest::new().set_evaluation_documents(BatchDocumentsInputConfig::default()/* use setters */);
15201 /// ```
15202 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
15203 where
15204 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15205 {
15206 self.evaluation_documents = std::option::Option::Some(v.into());
15207 self
15208 }
15209
15210 /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15211 ///
15212 /// # Example
15213 /// ```ignore,no_run
15214 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15215 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15216 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
15217 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(None::<BatchDocumentsInputConfig>);
15218 /// ```
15219 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
15220 where
15221 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15222 {
15223 self.evaluation_documents = v.map(|x| x.into());
15224 self
15225 }
15226}
15227
15228impl wkt::message::Message for EvaluateProcessorVersionRequest {
15229 fn typename() -> &'static str {
15230 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
15231 }
15232}
15233
15234/// Metadata of the
15235/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15236/// method.
15237///
15238/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15239#[derive(Clone, Default, PartialEq)]
15240#[non_exhaustive]
15241pub struct EvaluateProcessorVersionMetadata {
15242 /// The basic metadata of the long-running operation.
15243 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15244
15245 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15246}
15247
15248impl EvaluateProcessorVersionMetadata {
15249 /// Creates a new default instance.
15250 pub fn new() -> Self {
15251 std::default::Default::default()
15252 }
15253
15254 /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15255 ///
15256 /// # Example
15257 /// ```ignore,no_run
15258 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15259 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15260 /// let x = EvaluateProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15261 /// ```
15262 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15263 where
15264 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15265 {
15266 self.common_metadata = std::option::Option::Some(v.into());
15267 self
15268 }
15269
15270 /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15271 ///
15272 /// # Example
15273 /// ```ignore,no_run
15274 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15275 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15276 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15277 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15278 /// ```
15279 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15280 where
15281 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15282 {
15283 self.common_metadata = v.map(|x| x.into());
15284 self
15285 }
15286}
15287
15288impl wkt::message::Message for EvaluateProcessorVersionMetadata {
15289 fn typename() -> &'static str {
15290 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
15291 }
15292}
15293
15294/// Response of the
15295/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15296/// method.
15297///
15298/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15299#[derive(Clone, Default, PartialEq)]
15300#[non_exhaustive]
15301pub struct EvaluateProcessorVersionResponse {
15302 /// The resource name of the created evaluation.
15303 pub evaluation: std::string::String,
15304
15305 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15306}
15307
15308impl EvaluateProcessorVersionResponse {
15309 /// Creates a new default instance.
15310 pub fn new() -> Self {
15311 std::default::Default::default()
15312 }
15313
15314 /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
15315 ///
15316 /// # Example
15317 /// ```ignore,no_run
15318 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionResponse;
15319 /// let x = EvaluateProcessorVersionResponse::new().set_evaluation("example");
15320 /// ```
15321 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15322 self.evaluation = v.into();
15323 self
15324 }
15325}
15326
15327impl wkt::message::Message for EvaluateProcessorVersionResponse {
15328 fn typename() -> &'static str {
15329 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
15330 }
15331}
15332
15333/// Retrieves a specific Evaluation.
15334#[derive(Clone, Default, PartialEq)]
15335#[non_exhaustive]
15336pub struct GetEvaluationRequest {
15337 /// Required. The resource name of the
15338 /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
15339 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
15340 ///
15341 /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
15342 pub name: std::string::String,
15343
15344 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15345}
15346
15347impl GetEvaluationRequest {
15348 /// Creates a new default instance.
15349 pub fn new() -> Self {
15350 std::default::Default::default()
15351 }
15352
15353 /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
15354 ///
15355 /// # Example
15356 /// ```ignore,no_run
15357 /// # use google_cloud_documentai_v1::model::GetEvaluationRequest;
15358 /// let x = GetEvaluationRequest::new().set_name("example");
15359 /// ```
15360 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15361 self.name = v.into();
15362 self
15363 }
15364}
15365
15366impl wkt::message::Message for GetEvaluationRequest {
15367 fn typename() -> &'static str {
15368 "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
15369 }
15370}
15371
15372/// Retrieves a list of evaluations for a given
15373/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
15374///
15375/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15376#[derive(Clone, Default, PartialEq)]
15377#[non_exhaustive]
15378pub struct ListEvaluationsRequest {
15379 /// Required. The resource name of the
15380 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
15381 /// evaluations for.
15382 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15383 ///
15384 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15385 pub parent: std::string::String,
15386
15387 /// The standard list page size.
15388 /// If unspecified, at most `5` evaluations are returned.
15389 /// The maximum value is `100`. Values above `100` are coerced to `100`.
15390 pub page_size: i32,
15391
15392 /// A page token, received from a previous `ListEvaluations` call.
15393 /// Provide this to retrieve the subsequent page.
15394 pub page_token: std::string::String,
15395
15396 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15397}
15398
15399impl ListEvaluationsRequest {
15400 /// Creates a new default instance.
15401 pub fn new() -> Self {
15402 std::default::Default::default()
15403 }
15404
15405 /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
15406 ///
15407 /// # Example
15408 /// ```ignore,no_run
15409 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15410 /// let x = ListEvaluationsRequest::new().set_parent("example");
15411 /// ```
15412 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15413 self.parent = v.into();
15414 self
15415 }
15416
15417 /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
15418 ///
15419 /// # Example
15420 /// ```ignore,no_run
15421 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15422 /// let x = ListEvaluationsRequest::new().set_page_size(42);
15423 /// ```
15424 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15425 self.page_size = v.into();
15426 self
15427 }
15428
15429 /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
15430 ///
15431 /// # Example
15432 /// ```ignore,no_run
15433 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15434 /// let x = ListEvaluationsRequest::new().set_page_token("example");
15435 /// ```
15436 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15437 self.page_token = v.into();
15438 self
15439 }
15440}
15441
15442impl wkt::message::Message for ListEvaluationsRequest {
15443 fn typename() -> &'static str {
15444 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
15445 }
15446}
15447
15448/// The response from `ListEvaluations`.
15449#[derive(Clone, Default, PartialEq)]
15450#[non_exhaustive]
15451pub struct ListEvaluationsResponse {
15452 /// The evaluations requested.
15453 pub evaluations: std::vec::Vec<crate::model::Evaluation>,
15454
15455 /// A token, which can be sent as `page_token` to retrieve the next page.
15456 /// If this field is omitted, there are no subsequent pages.
15457 pub next_page_token: std::string::String,
15458
15459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15460}
15461
15462impl ListEvaluationsResponse {
15463 /// Creates a new default instance.
15464 pub fn new() -> Self {
15465 std::default::Default::default()
15466 }
15467
15468 /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
15469 ///
15470 /// # Example
15471 /// ```ignore,no_run
15472 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15473 /// use google_cloud_documentai_v1::model::Evaluation;
15474 /// let x = ListEvaluationsResponse::new()
15475 /// .set_evaluations([
15476 /// Evaluation::default()/* use setters */,
15477 /// Evaluation::default()/* use (different) setters */,
15478 /// ]);
15479 /// ```
15480 pub fn set_evaluations<T, V>(mut self, v: T) -> Self
15481 where
15482 T: std::iter::IntoIterator<Item = V>,
15483 V: std::convert::Into<crate::model::Evaluation>,
15484 {
15485 use std::iter::Iterator;
15486 self.evaluations = v.into_iter().map(|i| i.into()).collect();
15487 self
15488 }
15489
15490 /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
15491 ///
15492 /// # Example
15493 /// ```ignore,no_run
15494 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15495 /// let x = ListEvaluationsResponse::new().set_next_page_token("example");
15496 /// ```
15497 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15498 self.next_page_token = v.into();
15499 self
15500 }
15501}
15502
15503impl wkt::message::Message for ListEvaluationsResponse {
15504 fn typename() -> &'static str {
15505 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
15506 }
15507}
15508
15509#[doc(hidden)]
15510impl google_cloud_gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
15511 type PageItem = crate::model::Evaluation;
15512
15513 fn items(self) -> std::vec::Vec<Self::PageItem> {
15514 self.evaluations
15515 }
15516
15517 fn next_page_token(&self) -> std::string::String {
15518 use std::clone::Clone;
15519 self.next_page_token.clone()
15520 }
15521}
15522
15523/// The schema defines the output of the processed document by a processor.
15524#[derive(Clone, Default, PartialEq)]
15525#[non_exhaustive]
15526pub struct DocumentSchema {
15527 /// Display name to show to users.
15528 pub display_name: std::string::String,
15529
15530 /// Description of the schema.
15531 pub description: std::string::String,
15532
15533 /// Entity types of the schema.
15534 pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
15535
15536 /// Metadata of the schema.
15537 pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
15538
15539 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15540}
15541
15542impl DocumentSchema {
15543 /// Creates a new default instance.
15544 pub fn new() -> Self {
15545 std::default::Default::default()
15546 }
15547
15548 /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
15549 ///
15550 /// # Example
15551 /// ```ignore,no_run
15552 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15553 /// let x = DocumentSchema::new().set_display_name("example");
15554 /// ```
15555 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15556 self.display_name = v.into();
15557 self
15558 }
15559
15560 /// Sets the value of [description][crate::model::DocumentSchema::description].
15561 ///
15562 /// # Example
15563 /// ```ignore,no_run
15564 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15565 /// let x = DocumentSchema::new().set_description("example");
15566 /// ```
15567 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15568 self.description = v.into();
15569 self
15570 }
15571
15572 /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
15573 ///
15574 /// # Example
15575 /// ```ignore,no_run
15576 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15577 /// use google_cloud_documentai_v1::model::document_schema::EntityType;
15578 /// let x = DocumentSchema::new()
15579 /// .set_entity_types([
15580 /// EntityType::default()/* use setters */,
15581 /// EntityType::default()/* use (different) setters */,
15582 /// ]);
15583 /// ```
15584 pub fn set_entity_types<T, V>(mut self, v: T) -> Self
15585 where
15586 T: std::iter::IntoIterator<Item = V>,
15587 V: std::convert::Into<crate::model::document_schema::EntityType>,
15588 {
15589 use std::iter::Iterator;
15590 self.entity_types = v.into_iter().map(|i| i.into()).collect();
15591 self
15592 }
15593
15594 /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
15595 ///
15596 /// # Example
15597 /// ```ignore,no_run
15598 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15599 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15600 /// let x = DocumentSchema::new().set_metadata(Metadata::default()/* use setters */);
15601 /// ```
15602 pub fn set_metadata<T>(mut self, v: T) -> Self
15603 where
15604 T: std::convert::Into<crate::model::document_schema::Metadata>,
15605 {
15606 self.metadata = std::option::Option::Some(v.into());
15607 self
15608 }
15609
15610 /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
15611 ///
15612 /// # Example
15613 /// ```ignore,no_run
15614 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15615 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15616 /// let x = DocumentSchema::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
15617 /// let x = DocumentSchema::new().set_or_clear_metadata(None::<Metadata>);
15618 /// ```
15619 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15620 where
15621 T: std::convert::Into<crate::model::document_schema::Metadata>,
15622 {
15623 self.metadata = v.map(|x| x.into());
15624 self
15625 }
15626}
15627
15628impl wkt::message::Message for DocumentSchema {
15629 fn typename() -> &'static str {
15630 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
15631 }
15632}
15633
15634/// Defines additional types related to [DocumentSchema].
15635pub mod document_schema {
15636 #[allow(unused_imports)]
15637 use super::*;
15638
15639 /// EntityType is the wrapper of a label of the corresponding model with
15640 /// detailed attributes and limitations for entity-based processors. Multiple
15641 /// types can also compose a dependency tree to represent nested types.
15642 #[derive(Clone, Default, PartialEq)]
15643 #[non_exhaustive]
15644 pub struct EntityType {
15645 /// User defined name for the type.
15646 pub display_name: std::string::String,
15647
15648 /// Name of the type. It must be unique within the schema file and
15649 /// cannot be a "Common Type". The following naming conventions are used:
15650 ///
15651 /// - Use `snake_casing`.
15652 /// - Name matching is case-sensitive.
15653 /// - Maximum 64 characters.
15654 /// - Must start with a letter.
15655 /// - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward
15656 /// compatibility internal infrastructure and tooling can handle any ascii
15657 /// character.)
15658 /// - The `/` is sometimes used to denote a property of a type. For example
15659 /// `line_item/amount`. This convention is deprecated, but will still be
15660 /// honored for backward compatibility.
15661 pub name: std::string::String,
15662
15663 /// The entity type that this type is derived from. For now, one and only
15664 /// one should be set.
15665 pub base_types: std::vec::Vec<std::string::String>,
15666
15667 /// Description the nested structure, or composition of an entity.
15668 pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
15669
15670 #[allow(missing_docs)]
15671 pub value_source:
15672 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15673
15674 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15675 }
15676
15677 impl EntityType {
15678 /// Creates a new default instance.
15679 pub fn new() -> Self {
15680 std::default::Default::default()
15681 }
15682
15683 /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
15684 ///
15685 /// # Example
15686 /// ```ignore,no_run
15687 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15688 /// let x = EntityType::new().set_display_name("example");
15689 /// ```
15690 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15691 mut self,
15692 v: T,
15693 ) -> Self {
15694 self.display_name = v.into();
15695 self
15696 }
15697
15698 /// Sets the value of [name][crate::model::document_schema::EntityType::name].
15699 ///
15700 /// # Example
15701 /// ```ignore,no_run
15702 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15703 /// let x = EntityType::new().set_name("example");
15704 /// ```
15705 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15706 self.name = v.into();
15707 self
15708 }
15709
15710 /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
15711 ///
15712 /// # Example
15713 /// ```ignore,no_run
15714 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15715 /// let x = EntityType::new().set_base_types(["a", "b", "c"]);
15716 /// ```
15717 pub fn set_base_types<T, V>(mut self, v: T) -> Self
15718 where
15719 T: std::iter::IntoIterator<Item = V>,
15720 V: std::convert::Into<std::string::String>,
15721 {
15722 use std::iter::Iterator;
15723 self.base_types = v.into_iter().map(|i| i.into()).collect();
15724 self
15725 }
15726
15727 /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
15728 ///
15729 /// # Example
15730 /// ```ignore,no_run
15731 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15732 /// use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15733 /// let x = EntityType::new()
15734 /// .set_properties([
15735 /// Property::default()/* use setters */,
15736 /// Property::default()/* use (different) setters */,
15737 /// ]);
15738 /// ```
15739 pub fn set_properties<T, V>(mut self, v: T) -> Self
15740 where
15741 T: std::iter::IntoIterator<Item = V>,
15742 V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
15743 {
15744 use std::iter::Iterator;
15745 self.properties = v.into_iter().map(|i| i.into()).collect();
15746 self
15747 }
15748
15749 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
15750 ///
15751 /// Note that all the setters affecting `value_source` are mutually
15752 /// exclusive.
15753 ///
15754 /// # Example
15755 /// ```ignore,no_run
15756 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15757 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15758 /// let x = EntityType::new().set_value_source(Some(
15759 /// google_cloud_documentai_v1::model::document_schema::entity_type::ValueSource::EnumValues(EnumValues::default().into())));
15760 /// ```
15761 pub fn set_value_source<
15762 T: std::convert::Into<
15763 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15764 >,
15765 >(
15766 mut self,
15767 v: T,
15768 ) -> Self {
15769 self.value_source = v.into();
15770 self
15771 }
15772
15773 /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
15774 /// if it holds a `EnumValues`, `None` if the field is not set or
15775 /// holds a different branch.
15776 pub fn enum_values(
15777 &self,
15778 ) -> std::option::Option<
15779 &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15780 > {
15781 #[allow(unreachable_patterns)]
15782 self.value_source.as_ref().and_then(|v| match v {
15783 crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
15784 std::option::Option::Some(v)
15785 }
15786 _ => std::option::Option::None,
15787 })
15788 }
15789
15790 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
15791 /// to hold a `EnumValues`.
15792 ///
15793 /// Note that all the setters affecting `value_source` are
15794 /// mutually exclusive.
15795 ///
15796 /// # Example
15797 /// ```ignore,no_run
15798 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15799 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15800 /// let x = EntityType::new().set_enum_values(EnumValues::default()/* use setters */);
15801 /// assert!(x.enum_values().is_some());
15802 /// ```
15803 pub fn set_enum_values<
15804 T: std::convert::Into<
15805 std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15806 >,
15807 >(
15808 mut self,
15809 v: T,
15810 ) -> Self {
15811 self.value_source = std::option::Option::Some(
15812 crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
15813 );
15814 self
15815 }
15816 }
15817
15818 impl wkt::message::Message for EntityType {
15819 fn typename() -> &'static str {
15820 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
15821 }
15822 }
15823
15824 /// Defines additional types related to [EntityType].
15825 pub mod entity_type {
15826 #[allow(unused_imports)]
15827 use super::*;
15828
15829 /// Defines the a list of enum values.
15830 #[derive(Clone, Default, PartialEq)]
15831 #[non_exhaustive]
15832 pub struct EnumValues {
15833 /// The individual values that this enum values type can include.
15834 pub values: std::vec::Vec<std::string::String>,
15835
15836 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15837 }
15838
15839 impl EnumValues {
15840 /// Creates a new default instance.
15841 pub fn new() -> Self {
15842 std::default::Default::default()
15843 }
15844
15845 /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
15846 ///
15847 /// # Example
15848 /// ```ignore,no_run
15849 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15850 /// let x = EnumValues::new().set_values(["a", "b", "c"]);
15851 /// ```
15852 pub fn set_values<T, V>(mut self, v: T) -> Self
15853 where
15854 T: std::iter::IntoIterator<Item = V>,
15855 V: std::convert::Into<std::string::String>,
15856 {
15857 use std::iter::Iterator;
15858 self.values = v.into_iter().map(|i| i.into()).collect();
15859 self
15860 }
15861 }
15862
15863 impl wkt::message::Message for EnumValues {
15864 fn typename() -> &'static str {
15865 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
15866 }
15867 }
15868
15869 /// Defines properties that can be part of the entity type.
15870 #[derive(Clone, Default, PartialEq)]
15871 #[non_exhaustive]
15872 pub struct Property {
15873 /// The name of the property. Follows the same guidelines as the
15874 /// EntityType name.
15875 pub name: std::string::String,
15876
15877 /// User defined name for the property.
15878 pub display_name: std::string::String,
15879
15880 /// A reference to the value type of the property. This type is subject
15881 /// to the same conventions as the `Entity.base_types` field.
15882 pub value_type: std::string::String,
15883
15884 /// Occurrence type limits the number of instances an entity type appears
15885 /// in the document.
15886 pub occurrence_type:
15887 crate::model::document_schema::entity_type::property::OccurrenceType,
15888
15889 /// Specifies how the entity's value is obtained.
15890 pub method: crate::model::document_schema::entity_type::property::Method,
15891
15892 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15893 }
15894
15895 impl Property {
15896 /// Creates a new default instance.
15897 pub fn new() -> Self {
15898 std::default::Default::default()
15899 }
15900
15901 /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
15902 ///
15903 /// # Example
15904 /// ```ignore,no_run
15905 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15906 /// let x = Property::new().set_name("example");
15907 /// ```
15908 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15909 self.name = v.into();
15910 self
15911 }
15912
15913 /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
15914 ///
15915 /// # Example
15916 /// ```ignore,no_run
15917 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15918 /// let x = Property::new().set_display_name("example");
15919 /// ```
15920 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15921 mut self,
15922 v: T,
15923 ) -> Self {
15924 self.display_name = v.into();
15925 self
15926 }
15927
15928 /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
15929 ///
15930 /// # Example
15931 /// ```ignore,no_run
15932 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15933 /// let x = Property::new().set_value_type("example");
15934 /// ```
15935 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
15936 mut self,
15937 v: T,
15938 ) -> Self {
15939 self.value_type = v.into();
15940 self
15941 }
15942
15943 /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
15944 ///
15945 /// # Example
15946 /// ```ignore,no_run
15947 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15948 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::OccurrenceType;
15949 /// let x0 = Property::new().set_occurrence_type(OccurrenceType::OptionalOnce);
15950 /// let x1 = Property::new().set_occurrence_type(OccurrenceType::OptionalMultiple);
15951 /// let x2 = Property::new().set_occurrence_type(OccurrenceType::RequiredOnce);
15952 /// ```
15953 pub fn set_occurrence_type<
15954 T: std::convert::Into<
15955 crate::model::document_schema::entity_type::property::OccurrenceType,
15956 >,
15957 >(
15958 mut self,
15959 v: T,
15960 ) -> Self {
15961 self.occurrence_type = v.into();
15962 self
15963 }
15964
15965 /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
15966 ///
15967 /// # Example
15968 /// ```ignore,no_run
15969 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15970 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::Method;
15971 /// let x0 = Property::new().set_method(Method::Extract);
15972 /// let x1 = Property::new().set_method(Method::Derive);
15973 /// ```
15974 pub fn set_method<
15975 T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
15976 >(
15977 mut self,
15978 v: T,
15979 ) -> Self {
15980 self.method = v.into();
15981 self
15982 }
15983 }
15984
15985 impl wkt::message::Message for Property {
15986 fn typename() -> &'static str {
15987 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
15988 }
15989 }
15990
15991 /// Defines additional types related to [Property].
15992 pub mod property {
15993 #[allow(unused_imports)]
15994 use super::*;
15995
15996 /// Types of occurrences of the entity type in the document. This
15997 /// represents the number of instances, not mentions, of an entity.
15998 /// For example, a bank statement might only have one
15999 /// `account_number`, but this account number can be mentioned in several
16000 /// places on the document. In this case, the `account_number` is
16001 /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
16002 /// expect a bank statement to contain the status of multiple different
16003 /// accounts for the customers, the occurrence type is set to
16004 /// `REQUIRED_MULTIPLE`.
16005 ///
16006 /// # Working with unknown values
16007 ///
16008 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16009 /// additional enum variants at any time. Adding new variants is not considered
16010 /// a breaking change. Applications should write their code in anticipation of:
16011 ///
16012 /// - New values appearing in future releases of the client library, **and**
16013 /// - New values received dynamically, without application changes.
16014 ///
16015 /// Please consult the [Working with enums] section in the user guide for some
16016 /// guidelines.
16017 ///
16018 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16019 #[derive(Clone, Debug, PartialEq)]
16020 #[non_exhaustive]
16021 pub enum OccurrenceType {
16022 /// Unspecified occurrence type.
16023 Unspecified,
16024 /// There will be zero or one instance of this entity type. The same
16025 /// entity instance may be mentioned multiple times.
16026 OptionalOnce,
16027 /// The entity type will appear zero or multiple times.
16028 OptionalMultiple,
16029 /// The entity type will only appear exactly once. The same
16030 /// entity instance may be mentioned multiple times.
16031 RequiredOnce,
16032 /// The entity type will appear once or more times.
16033 RequiredMultiple,
16034 /// If set, the enum was initialized with an unknown value.
16035 ///
16036 /// Applications can examine the value using [OccurrenceType::value] or
16037 /// [OccurrenceType::name].
16038 UnknownValue(occurrence_type::UnknownValue),
16039 }
16040
16041 #[doc(hidden)]
16042 pub mod occurrence_type {
16043 #[allow(unused_imports)]
16044 use super::*;
16045 #[derive(Clone, Debug, PartialEq)]
16046 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16047 }
16048
16049 impl OccurrenceType {
16050 /// Gets the enum value.
16051 ///
16052 /// Returns `None` if the enum contains an unknown value deserialized from
16053 /// the string representation of enums.
16054 pub fn value(&self) -> std::option::Option<i32> {
16055 match self {
16056 Self::Unspecified => std::option::Option::Some(0),
16057 Self::OptionalOnce => std::option::Option::Some(1),
16058 Self::OptionalMultiple => std::option::Option::Some(2),
16059 Self::RequiredOnce => std::option::Option::Some(3),
16060 Self::RequiredMultiple => std::option::Option::Some(4),
16061 Self::UnknownValue(u) => u.0.value(),
16062 }
16063 }
16064
16065 /// Gets the enum value as a string.
16066 ///
16067 /// Returns `None` if the enum contains an unknown value deserialized from
16068 /// the integer representation of enums.
16069 pub fn name(&self) -> std::option::Option<&str> {
16070 match self {
16071 Self::Unspecified => {
16072 std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
16073 }
16074 Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
16075 Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
16076 Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
16077 Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
16078 Self::UnknownValue(u) => u.0.name(),
16079 }
16080 }
16081 }
16082
16083 impl std::default::Default for OccurrenceType {
16084 fn default() -> Self {
16085 use std::convert::From;
16086 Self::from(0)
16087 }
16088 }
16089
16090 impl std::fmt::Display for OccurrenceType {
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 OccurrenceType {
16100 fn from(value: i32) -> Self {
16101 match value {
16102 0 => Self::Unspecified,
16103 1 => Self::OptionalOnce,
16104 2 => Self::OptionalMultiple,
16105 3 => Self::RequiredOnce,
16106 4 => Self::RequiredMultiple,
16107 _ => Self::UnknownValue(occurrence_type::UnknownValue(
16108 wkt::internal::UnknownEnumValue::Integer(value),
16109 )),
16110 }
16111 }
16112 }
16113
16114 impl std::convert::From<&str> for OccurrenceType {
16115 fn from(value: &str) -> Self {
16116 use std::string::ToString;
16117 match value {
16118 "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
16119 "OPTIONAL_ONCE" => Self::OptionalOnce,
16120 "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
16121 "REQUIRED_ONCE" => Self::RequiredOnce,
16122 "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
16123 _ => Self::UnknownValue(occurrence_type::UnknownValue(
16124 wkt::internal::UnknownEnumValue::String(value.to_string()),
16125 )),
16126 }
16127 }
16128 }
16129
16130 impl serde::ser::Serialize for OccurrenceType {
16131 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16132 where
16133 S: serde::Serializer,
16134 {
16135 match self {
16136 Self::Unspecified => serializer.serialize_i32(0),
16137 Self::OptionalOnce => serializer.serialize_i32(1),
16138 Self::OptionalMultiple => serializer.serialize_i32(2),
16139 Self::RequiredOnce => serializer.serialize_i32(3),
16140 Self::RequiredMultiple => serializer.serialize_i32(4),
16141 Self::UnknownValue(u) => u.0.serialize(serializer),
16142 }
16143 }
16144 }
16145
16146 impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
16147 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16148 where
16149 D: serde::Deserializer<'de>,
16150 {
16151 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
16152 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
16153 }
16154 }
16155
16156 /// Specifies how the entity's value is obtained from the document.
16157 ///
16158 /// # Working with unknown values
16159 ///
16160 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16161 /// additional enum variants at any time. Adding new variants is not considered
16162 /// a breaking change. Applications should write their code in anticipation of:
16163 ///
16164 /// - New values appearing in future releases of the client library, **and**
16165 /// - New values received dynamically, without application changes.
16166 ///
16167 /// Please consult the [Working with enums] section in the user guide for some
16168 /// guidelines.
16169 ///
16170 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16171 #[derive(Clone, Debug, PartialEq)]
16172 #[non_exhaustive]
16173 pub enum Method {
16174 /// Unspecified method. It defaults to `EXTRACT`.
16175 Unspecified,
16176 /// The entity's value is directly extracted as-is from the document
16177 /// text.
16178 Extract,
16179 /// The entity's value is derived through inference and is not
16180 /// necessarily an exact text extraction from the document.
16181 Derive,
16182 /// If set, the enum was initialized with an unknown value.
16183 ///
16184 /// Applications can examine the value using [Method::value] or
16185 /// [Method::name].
16186 UnknownValue(method::UnknownValue),
16187 }
16188
16189 #[doc(hidden)]
16190 pub mod method {
16191 #[allow(unused_imports)]
16192 use super::*;
16193 #[derive(Clone, Debug, PartialEq)]
16194 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16195 }
16196
16197 impl Method {
16198 /// Gets the enum value.
16199 ///
16200 /// Returns `None` if the enum contains an unknown value deserialized from
16201 /// the string representation of enums.
16202 pub fn value(&self) -> std::option::Option<i32> {
16203 match self {
16204 Self::Unspecified => std::option::Option::Some(0),
16205 Self::Extract => std::option::Option::Some(1),
16206 Self::Derive => std::option::Option::Some(2),
16207 Self::UnknownValue(u) => u.0.value(),
16208 }
16209 }
16210
16211 /// Gets the enum value as a string.
16212 ///
16213 /// Returns `None` if the enum contains an unknown value deserialized from
16214 /// the integer representation of enums.
16215 pub fn name(&self) -> std::option::Option<&str> {
16216 match self {
16217 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
16218 Self::Extract => std::option::Option::Some("EXTRACT"),
16219 Self::Derive => std::option::Option::Some("DERIVE"),
16220 Self::UnknownValue(u) => u.0.name(),
16221 }
16222 }
16223 }
16224
16225 impl std::default::Default for Method {
16226 fn default() -> Self {
16227 use std::convert::From;
16228 Self::from(0)
16229 }
16230 }
16231
16232 impl std::fmt::Display for Method {
16233 fn fmt(
16234 &self,
16235 f: &mut std::fmt::Formatter<'_>,
16236 ) -> std::result::Result<(), std::fmt::Error> {
16237 wkt::internal::display_enum(f, self.name(), self.value())
16238 }
16239 }
16240
16241 impl std::convert::From<i32> for Method {
16242 fn from(value: i32) -> Self {
16243 match value {
16244 0 => Self::Unspecified,
16245 1 => Self::Extract,
16246 2 => Self::Derive,
16247 _ => Self::UnknownValue(method::UnknownValue(
16248 wkt::internal::UnknownEnumValue::Integer(value),
16249 )),
16250 }
16251 }
16252 }
16253
16254 impl std::convert::From<&str> for Method {
16255 fn from(value: &str) -> Self {
16256 use std::string::ToString;
16257 match value {
16258 "METHOD_UNSPECIFIED" => Self::Unspecified,
16259 "EXTRACT" => Self::Extract,
16260 "DERIVE" => Self::Derive,
16261 _ => Self::UnknownValue(method::UnknownValue(
16262 wkt::internal::UnknownEnumValue::String(value.to_string()),
16263 )),
16264 }
16265 }
16266 }
16267
16268 impl serde::ser::Serialize for Method {
16269 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16270 where
16271 S: serde::Serializer,
16272 {
16273 match self {
16274 Self::Unspecified => serializer.serialize_i32(0),
16275 Self::Extract => serializer.serialize_i32(1),
16276 Self::Derive => serializer.serialize_i32(2),
16277 Self::UnknownValue(u) => u.0.serialize(serializer),
16278 }
16279 }
16280 }
16281
16282 impl<'de> serde::de::Deserialize<'de> for Method {
16283 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16284 where
16285 D: serde::Deserializer<'de>,
16286 {
16287 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
16288 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
16289 ))
16290 }
16291 }
16292 }
16293
16294 #[allow(missing_docs)]
16295 #[derive(Clone, Debug, PartialEq)]
16296 #[non_exhaustive]
16297 pub enum ValueSource {
16298 /// If specified, lists all the possible values for this entity. This
16299 /// should not be more than a handful of values. If the number of values
16300 /// is >10 or could change frequently use the `EntityType.value_ontology`
16301 /// field and specify a list of all possible values in a value ontology
16302 /// file.
16303 EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
16304 }
16305 }
16306
16307 /// Metadata for global schema behavior.
16308 #[derive(Clone, Default, PartialEq)]
16309 #[non_exhaustive]
16310 pub struct Metadata {
16311 /// If true, a `document` entity type can be applied to subdocument
16312 /// (splitting). Otherwise, it can only be applied to the entire document
16313 /// (classification).
16314 pub document_splitter: bool,
16315
16316 /// If true, on a given page, there can be multiple `document` annotations
16317 /// covering it.
16318 pub document_allow_multiple_labels: bool,
16319
16320 /// If set, all the nested entities must be prefixed with the parents.
16321 pub prefixed_naming_on_properties: bool,
16322
16323 /// If set, we will skip the naming format validation in the schema. So the
16324 /// string values in `DocumentSchema.EntityType.name` and
16325 /// `DocumentSchema.EntityType.Property.name` will not be checked.
16326 pub skip_naming_validation: bool,
16327
16328 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16329 }
16330
16331 impl Metadata {
16332 /// Creates a new default instance.
16333 pub fn new() -> Self {
16334 std::default::Default::default()
16335 }
16336
16337 /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
16338 ///
16339 /// # Example
16340 /// ```ignore,no_run
16341 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16342 /// let x = Metadata::new().set_document_splitter(true);
16343 /// ```
16344 pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16345 self.document_splitter = v.into();
16346 self
16347 }
16348
16349 /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
16350 ///
16351 /// # Example
16352 /// ```ignore,no_run
16353 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16354 /// let x = Metadata::new().set_document_allow_multiple_labels(true);
16355 /// ```
16356 pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
16357 mut self,
16358 v: T,
16359 ) -> Self {
16360 self.document_allow_multiple_labels = v.into();
16361 self
16362 }
16363
16364 /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
16365 ///
16366 /// # Example
16367 /// ```ignore,no_run
16368 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16369 /// let x = Metadata::new().set_prefixed_naming_on_properties(true);
16370 /// ```
16371 pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
16372 mut self,
16373 v: T,
16374 ) -> Self {
16375 self.prefixed_naming_on_properties = v.into();
16376 self
16377 }
16378
16379 /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
16380 ///
16381 /// # Example
16382 /// ```ignore,no_run
16383 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16384 /// let x = Metadata::new().set_skip_naming_validation(true);
16385 /// ```
16386 pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16387 self.skip_naming_validation = v.into();
16388 self
16389 }
16390 }
16391
16392 impl wkt::message::Message for Metadata {
16393 fn typename() -> &'static str {
16394 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
16395 }
16396 }
16397}
16398
16399/// Gives a short summary of an evaluation, and links to the evaluation itself.
16400#[derive(Clone, Default, PartialEq)]
16401#[non_exhaustive]
16402pub struct EvaluationReference {
16403 /// The resource name of the Long Running Operation for the evaluation.
16404 pub operation: std::string::String,
16405
16406 /// The resource name of the evaluation.
16407 pub evaluation: std::string::String,
16408
16409 /// An aggregate of the statistics for the evaluation with fuzzy matching on.
16410 pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
16411
16412 /// An aggregate of the statistics for the evaluation with fuzzy matching off.
16413 pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
16414
16415 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16416}
16417
16418impl EvaluationReference {
16419 /// Creates a new default instance.
16420 pub fn new() -> Self {
16421 std::default::Default::default()
16422 }
16423
16424 /// Sets the value of [operation][crate::model::EvaluationReference::operation].
16425 ///
16426 /// # Example
16427 /// ```ignore,no_run
16428 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16429 /// let x = EvaluationReference::new().set_operation("example");
16430 /// ```
16431 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16432 self.operation = v.into();
16433 self
16434 }
16435
16436 /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
16437 ///
16438 /// # Example
16439 /// ```ignore,no_run
16440 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16441 /// let x = EvaluationReference::new().set_evaluation("example");
16442 /// ```
16443 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16444 self.evaluation = v.into();
16445 self
16446 }
16447
16448 /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16449 ///
16450 /// # Example
16451 /// ```ignore,no_run
16452 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16453 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16454 /// let x = EvaluationReference::new().set_aggregate_metrics(Metrics::default()/* use setters */);
16455 /// ```
16456 pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
16457 where
16458 T: std::convert::Into<crate::model::evaluation::Metrics>,
16459 {
16460 self.aggregate_metrics = std::option::Option::Some(v.into());
16461 self
16462 }
16463
16464 /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16465 ///
16466 /// # Example
16467 /// ```ignore,no_run
16468 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16469 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16470 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(Some(Metrics::default()/* use setters */));
16471 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(None::<Metrics>);
16472 /// ```
16473 pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16474 where
16475 T: std::convert::Into<crate::model::evaluation::Metrics>,
16476 {
16477 self.aggregate_metrics = v.map(|x| x.into());
16478 self
16479 }
16480
16481 /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16482 ///
16483 /// # Example
16484 /// ```ignore,no_run
16485 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16486 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16487 /// let x = EvaluationReference::new().set_aggregate_metrics_exact(Metrics::default()/* use setters */);
16488 /// ```
16489 pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
16490 where
16491 T: std::convert::Into<crate::model::evaluation::Metrics>,
16492 {
16493 self.aggregate_metrics_exact = std::option::Option::Some(v.into());
16494 self
16495 }
16496
16497 /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16498 ///
16499 /// # Example
16500 /// ```ignore,no_run
16501 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16502 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16503 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(Some(Metrics::default()/* use setters */));
16504 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(None::<Metrics>);
16505 /// ```
16506 pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
16507 where
16508 T: std::convert::Into<crate::model::evaluation::Metrics>,
16509 {
16510 self.aggregate_metrics_exact = v.map(|x| x.into());
16511 self
16512 }
16513}
16514
16515impl wkt::message::Message for EvaluationReference {
16516 fn typename() -> &'static str {
16517 "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
16518 }
16519}
16520
16521/// An evaluation of a ProcessorVersion's performance.
16522#[derive(Clone, Default, PartialEq)]
16523#[non_exhaustive]
16524pub struct Evaluation {
16525 /// The resource name of the evaluation.
16526 /// Format:
16527 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
16528 pub name: std::string::String,
16529
16530 /// The time that the evaluation was created.
16531 pub create_time: std::option::Option<wkt::Timestamp>,
16532
16533 /// Counters for the documents used in the evaluation.
16534 pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
16535
16536 /// Metrics for all the entities in aggregate.
16537 pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
16538
16539 /// Metrics across confidence levels, for different entities.
16540 pub entity_metrics: std::collections::HashMap<
16541 std::string::String,
16542 crate::model::evaluation::MultiConfidenceMetrics,
16543 >,
16544
16545 /// The KMS key name used for encryption.
16546 pub kms_key_name: std::string::String,
16547
16548 /// The KMS key version with which data is encrypted.
16549 pub kms_key_version_name: std::string::String,
16550
16551 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16552}
16553
16554impl Evaluation {
16555 /// Creates a new default instance.
16556 pub fn new() -> Self {
16557 std::default::Default::default()
16558 }
16559
16560 /// Sets the value of [name][crate::model::Evaluation::name].
16561 ///
16562 /// # Example
16563 /// ```ignore,no_run
16564 /// # use google_cloud_documentai_v1::model::Evaluation;
16565 /// let x = Evaluation::new().set_name("example");
16566 /// ```
16567 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16568 self.name = v.into();
16569 self
16570 }
16571
16572 /// Sets the value of [create_time][crate::model::Evaluation::create_time].
16573 ///
16574 /// # Example
16575 /// ```ignore,no_run
16576 /// # use google_cloud_documentai_v1::model::Evaluation;
16577 /// use wkt::Timestamp;
16578 /// let x = Evaluation::new().set_create_time(Timestamp::default()/* use setters */);
16579 /// ```
16580 pub fn set_create_time<T>(mut self, v: T) -> Self
16581 where
16582 T: std::convert::Into<wkt::Timestamp>,
16583 {
16584 self.create_time = std::option::Option::Some(v.into());
16585 self
16586 }
16587
16588 /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
16589 ///
16590 /// # Example
16591 /// ```ignore,no_run
16592 /// # use google_cloud_documentai_v1::model::Evaluation;
16593 /// use wkt::Timestamp;
16594 /// let x = Evaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16595 /// let x = Evaluation::new().set_or_clear_create_time(None::<Timestamp>);
16596 /// ```
16597 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16598 where
16599 T: std::convert::Into<wkt::Timestamp>,
16600 {
16601 self.create_time = v.map(|x| x.into());
16602 self
16603 }
16604
16605 /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
16606 ///
16607 /// # Example
16608 /// ```ignore,no_run
16609 /// # use google_cloud_documentai_v1::model::Evaluation;
16610 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16611 /// let x = Evaluation::new().set_document_counters(Counters::default()/* use setters */);
16612 /// ```
16613 pub fn set_document_counters<T>(mut self, v: T) -> Self
16614 where
16615 T: std::convert::Into<crate::model::evaluation::Counters>,
16616 {
16617 self.document_counters = std::option::Option::Some(v.into());
16618 self
16619 }
16620
16621 /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
16622 ///
16623 /// # Example
16624 /// ```ignore,no_run
16625 /// # use google_cloud_documentai_v1::model::Evaluation;
16626 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16627 /// let x = Evaluation::new().set_or_clear_document_counters(Some(Counters::default()/* use setters */));
16628 /// let x = Evaluation::new().set_or_clear_document_counters(None::<Counters>);
16629 /// ```
16630 pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
16631 where
16632 T: std::convert::Into<crate::model::evaluation::Counters>,
16633 {
16634 self.document_counters = v.map(|x| x.into());
16635 self
16636 }
16637
16638 /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16639 ///
16640 /// # Example
16641 /// ```ignore,no_run
16642 /// # use google_cloud_documentai_v1::model::Evaluation;
16643 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16644 /// let x = Evaluation::new().set_all_entities_metrics(MultiConfidenceMetrics::default()/* use setters */);
16645 /// ```
16646 pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
16647 where
16648 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16649 {
16650 self.all_entities_metrics = std::option::Option::Some(v.into());
16651 self
16652 }
16653
16654 /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16655 ///
16656 /// # Example
16657 /// ```ignore,no_run
16658 /// # use google_cloud_documentai_v1::model::Evaluation;
16659 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16660 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(Some(MultiConfidenceMetrics::default()/* use setters */));
16661 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(None::<MultiConfidenceMetrics>);
16662 /// ```
16663 pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16664 where
16665 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16666 {
16667 self.all_entities_metrics = v.map(|x| x.into());
16668 self
16669 }
16670
16671 /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
16672 ///
16673 /// # Example
16674 /// ```ignore,no_run
16675 /// # use google_cloud_documentai_v1::model::Evaluation;
16676 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16677 /// let x = Evaluation::new().set_entity_metrics([
16678 /// ("key0", MultiConfidenceMetrics::default()/* use setters */),
16679 /// ("key1", MultiConfidenceMetrics::default()/* use (different) setters */),
16680 /// ]);
16681 /// ```
16682 pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
16683 where
16684 T: std::iter::IntoIterator<Item = (K, V)>,
16685 K: std::convert::Into<std::string::String>,
16686 V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16687 {
16688 use std::iter::Iterator;
16689 self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16690 self
16691 }
16692
16693 /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
16694 ///
16695 /// # Example
16696 /// ```ignore,no_run
16697 /// # use google_cloud_documentai_v1::model::Evaluation;
16698 /// let x = Evaluation::new().set_kms_key_name("example");
16699 /// ```
16700 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16701 self.kms_key_name = v.into();
16702 self
16703 }
16704
16705 /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
16706 ///
16707 /// # Example
16708 /// ```ignore,no_run
16709 /// # use google_cloud_documentai_v1::model::Evaluation;
16710 /// let x = Evaluation::new().set_kms_key_version_name("example");
16711 /// ```
16712 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
16713 mut self,
16714 v: T,
16715 ) -> Self {
16716 self.kms_key_version_name = v.into();
16717 self
16718 }
16719}
16720
16721impl wkt::message::Message for Evaluation {
16722 fn typename() -> &'static str {
16723 "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
16724 }
16725}
16726
16727/// Defines additional types related to [Evaluation].
16728pub mod evaluation {
16729 #[allow(unused_imports)]
16730 use super::*;
16731
16732 /// Evaluation counters for the documents that were used.
16733 #[derive(Clone, Default, PartialEq)]
16734 #[non_exhaustive]
16735 pub struct Counters {
16736 /// How many documents were sent for evaluation.
16737 pub input_documents_count: i32,
16738
16739 /// How many documents were not included in the evaluation as they didn't
16740 /// pass validation.
16741 pub invalid_documents_count: i32,
16742
16743 /// How many documents were not included in the evaluation as Document AI
16744 /// failed to process them.
16745 pub failed_documents_count: i32,
16746
16747 /// How many documents were used in the evaluation.
16748 pub evaluated_documents_count: i32,
16749
16750 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16751 }
16752
16753 impl Counters {
16754 /// Creates a new default instance.
16755 pub fn new() -> Self {
16756 std::default::Default::default()
16757 }
16758
16759 /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
16760 ///
16761 /// # Example
16762 /// ```ignore,no_run
16763 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16764 /// let x = Counters::new().set_input_documents_count(42);
16765 /// ```
16766 pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16767 self.input_documents_count = v.into();
16768 self
16769 }
16770
16771 /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
16772 ///
16773 /// # Example
16774 /// ```ignore,no_run
16775 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16776 /// let x = Counters::new().set_invalid_documents_count(42);
16777 /// ```
16778 pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16779 self.invalid_documents_count = v.into();
16780 self
16781 }
16782
16783 /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
16784 ///
16785 /// # Example
16786 /// ```ignore,no_run
16787 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16788 /// let x = Counters::new().set_failed_documents_count(42);
16789 /// ```
16790 pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16791 self.failed_documents_count = v.into();
16792 self
16793 }
16794
16795 /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
16796 ///
16797 /// # Example
16798 /// ```ignore,no_run
16799 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16800 /// let x = Counters::new().set_evaluated_documents_count(42);
16801 /// ```
16802 pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16803 self.evaluated_documents_count = v.into();
16804 self
16805 }
16806 }
16807
16808 impl wkt::message::Message for Counters {
16809 fn typename() -> &'static str {
16810 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
16811 }
16812 }
16813
16814 /// Evaluation metrics, either in aggregate or about a specific entity.
16815 #[derive(Clone, Default, PartialEq)]
16816 #[non_exhaustive]
16817 pub struct Metrics {
16818 /// The calculated precision.
16819 pub precision: f32,
16820
16821 /// The calculated recall.
16822 pub recall: f32,
16823
16824 /// The calculated f1 score.
16825 pub f1_score: f32,
16826
16827 /// The amount of occurrences in predicted documents.
16828 pub predicted_occurrences_count: i32,
16829
16830 /// The amount of occurrences in ground truth documents.
16831 pub ground_truth_occurrences_count: i32,
16832
16833 /// The amount of documents with a predicted occurrence.
16834 pub predicted_document_count: i32,
16835
16836 /// The amount of documents with a ground truth occurrence.
16837 pub ground_truth_document_count: i32,
16838
16839 /// The amount of true positives.
16840 pub true_positives_count: i32,
16841
16842 /// The amount of false positives.
16843 pub false_positives_count: i32,
16844
16845 /// The amount of false negatives.
16846 pub false_negatives_count: i32,
16847
16848 /// The amount of documents that had an occurrence of this label.
16849 pub total_documents_count: i32,
16850
16851 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16852 }
16853
16854 impl Metrics {
16855 /// Creates a new default instance.
16856 pub fn new() -> Self {
16857 std::default::Default::default()
16858 }
16859
16860 /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
16861 ///
16862 /// # Example
16863 /// ```ignore,no_run
16864 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16865 /// let x = Metrics::new().set_precision(42.0);
16866 /// ```
16867 pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16868 self.precision = v.into();
16869 self
16870 }
16871
16872 /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
16873 ///
16874 /// # Example
16875 /// ```ignore,no_run
16876 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16877 /// let x = Metrics::new().set_recall(42.0);
16878 /// ```
16879 pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16880 self.recall = v.into();
16881 self
16882 }
16883
16884 /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
16885 ///
16886 /// # Example
16887 /// ```ignore,no_run
16888 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16889 /// let x = Metrics::new().set_f1_score(42.0);
16890 /// ```
16891 pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16892 self.f1_score = v.into();
16893 self
16894 }
16895
16896 /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
16897 ///
16898 /// # Example
16899 /// ```ignore,no_run
16900 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16901 /// let x = Metrics::new().set_predicted_occurrences_count(42);
16902 /// ```
16903 pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16904 self.predicted_occurrences_count = v.into();
16905 self
16906 }
16907
16908 /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
16909 ///
16910 /// # Example
16911 /// ```ignore,no_run
16912 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16913 /// let x = Metrics::new().set_ground_truth_occurrences_count(42);
16914 /// ```
16915 pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
16916 mut self,
16917 v: T,
16918 ) -> Self {
16919 self.ground_truth_occurrences_count = v.into();
16920 self
16921 }
16922
16923 /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
16924 ///
16925 /// # Example
16926 /// ```ignore,no_run
16927 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16928 /// let x = Metrics::new().set_predicted_document_count(42);
16929 /// ```
16930 pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16931 self.predicted_document_count = v.into();
16932 self
16933 }
16934
16935 /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
16936 ///
16937 /// # Example
16938 /// ```ignore,no_run
16939 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16940 /// let x = Metrics::new().set_ground_truth_document_count(42);
16941 /// ```
16942 pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16943 self.ground_truth_document_count = v.into();
16944 self
16945 }
16946
16947 /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
16948 ///
16949 /// # Example
16950 /// ```ignore,no_run
16951 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16952 /// let x = Metrics::new().set_true_positives_count(42);
16953 /// ```
16954 pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16955 self.true_positives_count = v.into();
16956 self
16957 }
16958
16959 /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
16960 ///
16961 /// # Example
16962 /// ```ignore,no_run
16963 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16964 /// let x = Metrics::new().set_false_positives_count(42);
16965 /// ```
16966 pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16967 self.false_positives_count = v.into();
16968 self
16969 }
16970
16971 /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
16972 ///
16973 /// # Example
16974 /// ```ignore,no_run
16975 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16976 /// let x = Metrics::new().set_false_negatives_count(42);
16977 /// ```
16978 pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16979 self.false_negatives_count = v.into();
16980 self
16981 }
16982
16983 /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
16984 ///
16985 /// # Example
16986 /// ```ignore,no_run
16987 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16988 /// let x = Metrics::new().set_total_documents_count(42);
16989 /// ```
16990 pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16991 self.total_documents_count = v.into();
16992 self
16993 }
16994 }
16995
16996 impl wkt::message::Message for Metrics {
16997 fn typename() -> &'static str {
16998 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
16999 }
17000 }
17001
17002 /// Evaluations metrics, at a specific confidence level.
17003 #[derive(Clone, Default, PartialEq)]
17004 #[non_exhaustive]
17005 pub struct ConfidenceLevelMetrics {
17006 /// The confidence level.
17007 pub confidence_level: f32,
17008
17009 /// The metrics at the specific confidence level.
17010 pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
17011
17012 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17013 }
17014
17015 impl ConfidenceLevelMetrics {
17016 /// Creates a new default instance.
17017 pub fn new() -> Self {
17018 std::default::Default::default()
17019 }
17020
17021 /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
17022 ///
17023 /// # Example
17024 /// ```ignore,no_run
17025 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17026 /// let x = ConfidenceLevelMetrics::new().set_confidence_level(42.0);
17027 /// ```
17028 pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17029 self.confidence_level = v.into();
17030 self
17031 }
17032
17033 /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
17034 ///
17035 /// # Example
17036 /// ```ignore,no_run
17037 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17038 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
17039 /// let x = ConfidenceLevelMetrics::new().set_metrics(Metrics::default()/* use setters */);
17040 /// ```
17041 pub fn set_metrics<T>(mut self, v: T) -> Self
17042 where
17043 T: std::convert::Into<crate::model::evaluation::Metrics>,
17044 {
17045 self.metrics = std::option::Option::Some(v.into());
17046 self
17047 }
17048
17049 /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
17050 ///
17051 /// # Example
17052 /// ```ignore,no_run
17053 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17054 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
17055 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(Some(Metrics::default()/* use setters */));
17056 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(None::<Metrics>);
17057 /// ```
17058 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
17059 where
17060 T: std::convert::Into<crate::model::evaluation::Metrics>,
17061 {
17062 self.metrics = v.map(|x| x.into());
17063 self
17064 }
17065 }
17066
17067 impl wkt::message::Message for ConfidenceLevelMetrics {
17068 fn typename() -> &'static str {
17069 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
17070 }
17071 }
17072
17073 /// Metrics across multiple confidence levels.
17074 #[derive(Clone, Default, PartialEq)]
17075 #[non_exhaustive]
17076 pub struct MultiConfidenceMetrics {
17077 /// Metrics across confidence levels with fuzzy matching enabled.
17078 pub confidence_level_metrics:
17079 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
17080
17081 /// Metrics across confidence levels with only exact matching.
17082 pub confidence_level_metrics_exact:
17083 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
17084
17085 /// The calculated area under the precision recall curve (AUPRC), computed by
17086 /// integrating over all confidence thresholds.
17087 pub auprc: f32,
17088
17089 /// The Estimated Calibration Error (ECE) of the confidence of the predicted
17090 /// entities.
17091 pub estimated_calibration_error: f32,
17092
17093 /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
17094 /// only.
17095 pub auprc_exact: f32,
17096
17097 /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
17098 /// exact matching only.
17099 pub estimated_calibration_error_exact: f32,
17100
17101 /// The metrics type for the label.
17102 pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
17103
17104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17105 }
17106
17107 impl MultiConfidenceMetrics {
17108 /// Creates a new default instance.
17109 pub fn new() -> Self {
17110 std::default::Default::default()
17111 }
17112
17113 /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
17114 ///
17115 /// # Example
17116 /// ```ignore,no_run
17117 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17118 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17119 /// let x = MultiConfidenceMetrics::new()
17120 /// .set_confidence_level_metrics([
17121 /// ConfidenceLevelMetrics::default()/* use setters */,
17122 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
17123 /// ]);
17124 /// ```
17125 pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
17126 where
17127 T: std::iter::IntoIterator<Item = V>,
17128 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17129 {
17130 use std::iter::Iterator;
17131 self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
17132 self
17133 }
17134
17135 /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
17136 ///
17137 /// # Example
17138 /// ```ignore,no_run
17139 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17140 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17141 /// let x = MultiConfidenceMetrics::new()
17142 /// .set_confidence_level_metrics_exact([
17143 /// ConfidenceLevelMetrics::default()/* use setters */,
17144 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
17145 /// ]);
17146 /// ```
17147 pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
17148 where
17149 T: std::iter::IntoIterator<Item = V>,
17150 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17151 {
17152 use std::iter::Iterator;
17153 self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
17154 self
17155 }
17156
17157 /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
17158 ///
17159 /// # Example
17160 /// ```ignore,no_run
17161 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17162 /// let x = MultiConfidenceMetrics::new().set_auprc(42.0);
17163 /// ```
17164 pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17165 self.auprc = v.into();
17166 self
17167 }
17168
17169 /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
17170 ///
17171 /// # Example
17172 /// ```ignore,no_run
17173 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17174 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error(42.0);
17175 /// ```
17176 pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17177 self.estimated_calibration_error = v.into();
17178 self
17179 }
17180
17181 /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
17182 ///
17183 /// # Example
17184 /// ```ignore,no_run
17185 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17186 /// let x = MultiConfidenceMetrics::new().set_auprc_exact(42.0);
17187 /// ```
17188 pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17189 self.auprc_exact = v.into();
17190 self
17191 }
17192
17193 /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
17194 ///
17195 /// # Example
17196 /// ```ignore,no_run
17197 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17198 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error_exact(42.0);
17199 /// ```
17200 pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
17201 mut self,
17202 v: T,
17203 ) -> Self {
17204 self.estimated_calibration_error_exact = v.into();
17205 self
17206 }
17207
17208 /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
17209 ///
17210 /// # Example
17211 /// ```ignore,no_run
17212 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17213 /// use google_cloud_documentai_v1::model::evaluation::multi_confidence_metrics::MetricsType;
17214 /// let x0 = MultiConfidenceMetrics::new().set_metrics_type(MetricsType::Aggregate);
17215 /// ```
17216 pub fn set_metrics_type<
17217 T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
17218 >(
17219 mut self,
17220 v: T,
17221 ) -> Self {
17222 self.metrics_type = v.into();
17223 self
17224 }
17225 }
17226
17227 impl wkt::message::Message for MultiConfidenceMetrics {
17228 fn typename() -> &'static str {
17229 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
17230 }
17231 }
17232
17233 /// Defines additional types related to [MultiConfidenceMetrics].
17234 pub mod multi_confidence_metrics {
17235 #[allow(unused_imports)]
17236 use super::*;
17237
17238 /// A type that determines how metrics should be interpreted.
17239 ///
17240 /// # Working with unknown values
17241 ///
17242 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17243 /// additional enum variants at any time. Adding new variants is not considered
17244 /// a breaking change. Applications should write their code in anticipation of:
17245 ///
17246 /// - New values appearing in future releases of the client library, **and**
17247 /// - New values received dynamically, without application changes.
17248 ///
17249 /// Please consult the [Working with enums] section in the user guide for some
17250 /// guidelines.
17251 ///
17252 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17253 #[derive(Clone, Debug, PartialEq)]
17254 #[non_exhaustive]
17255 pub enum MetricsType {
17256 /// The metrics type is unspecified. By default, metrics without a
17257 /// particular specification are for leaf entity types (i.e., top-level
17258 /// entity types without child types, or child types which are not
17259 /// parent types themselves).
17260 Unspecified,
17261 /// Indicates whether metrics for this particular label type represent an
17262 /// aggregate of metrics for other types instead of being based on actual
17263 /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
17264 /// entity types are an aggregate of metrics for their children.
17265 Aggregate,
17266 /// If set, the enum was initialized with an unknown value.
17267 ///
17268 /// Applications can examine the value using [MetricsType::value] or
17269 /// [MetricsType::name].
17270 UnknownValue(metrics_type::UnknownValue),
17271 }
17272
17273 #[doc(hidden)]
17274 pub mod metrics_type {
17275 #[allow(unused_imports)]
17276 use super::*;
17277 #[derive(Clone, Debug, PartialEq)]
17278 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17279 }
17280
17281 impl MetricsType {
17282 /// Gets the enum value.
17283 ///
17284 /// Returns `None` if the enum contains an unknown value deserialized from
17285 /// the string representation of enums.
17286 pub fn value(&self) -> std::option::Option<i32> {
17287 match self {
17288 Self::Unspecified => std::option::Option::Some(0),
17289 Self::Aggregate => std::option::Option::Some(1),
17290 Self::UnknownValue(u) => u.0.value(),
17291 }
17292 }
17293
17294 /// Gets the enum value as a string.
17295 ///
17296 /// Returns `None` if the enum contains an unknown value deserialized from
17297 /// the integer representation of enums.
17298 pub fn name(&self) -> std::option::Option<&str> {
17299 match self {
17300 Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
17301 Self::Aggregate => std::option::Option::Some("AGGREGATE"),
17302 Self::UnknownValue(u) => u.0.name(),
17303 }
17304 }
17305 }
17306
17307 impl std::default::Default for MetricsType {
17308 fn default() -> Self {
17309 use std::convert::From;
17310 Self::from(0)
17311 }
17312 }
17313
17314 impl std::fmt::Display for MetricsType {
17315 fn fmt(
17316 &self,
17317 f: &mut std::fmt::Formatter<'_>,
17318 ) -> std::result::Result<(), std::fmt::Error> {
17319 wkt::internal::display_enum(f, self.name(), self.value())
17320 }
17321 }
17322
17323 impl std::convert::From<i32> for MetricsType {
17324 fn from(value: i32) -> Self {
17325 match value {
17326 0 => Self::Unspecified,
17327 1 => Self::Aggregate,
17328 _ => Self::UnknownValue(metrics_type::UnknownValue(
17329 wkt::internal::UnknownEnumValue::Integer(value),
17330 )),
17331 }
17332 }
17333 }
17334
17335 impl std::convert::From<&str> for MetricsType {
17336 fn from(value: &str) -> Self {
17337 use std::string::ToString;
17338 match value {
17339 "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
17340 "AGGREGATE" => Self::Aggregate,
17341 _ => Self::UnknownValue(metrics_type::UnknownValue(
17342 wkt::internal::UnknownEnumValue::String(value.to_string()),
17343 )),
17344 }
17345 }
17346 }
17347
17348 impl serde::ser::Serialize for MetricsType {
17349 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17350 where
17351 S: serde::Serializer,
17352 {
17353 match self {
17354 Self::Unspecified => serializer.serialize_i32(0),
17355 Self::Aggregate => serializer.serialize_i32(1),
17356 Self::UnknownValue(u) => u.0.serialize(serializer),
17357 }
17358 }
17359 }
17360
17361 impl<'de> serde::de::Deserialize<'de> for MetricsType {
17362 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17363 where
17364 D: serde::Deserializer<'de>,
17365 {
17366 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
17367 ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
17368 ))
17369 }
17370 }
17371 }
17372}
17373
17374/// A vertex represents a 2D point in the image.
17375/// NOTE: the vertex coordinates are in the same scale as the original image.
17376#[derive(Clone, Default, PartialEq)]
17377#[non_exhaustive]
17378pub struct Vertex {
17379 /// X coordinate.
17380 pub x: i32,
17381
17382 /// Y coordinate (starts from the top of the image).
17383 pub y: i32,
17384
17385 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17386}
17387
17388impl Vertex {
17389 /// Creates a new default instance.
17390 pub fn new() -> Self {
17391 std::default::Default::default()
17392 }
17393
17394 /// Sets the value of [x][crate::model::Vertex::x].
17395 ///
17396 /// # Example
17397 /// ```ignore,no_run
17398 /// # use google_cloud_documentai_v1::model::Vertex;
17399 /// let x = Vertex::new().set_x(42);
17400 /// ```
17401 pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17402 self.x = v.into();
17403 self
17404 }
17405
17406 /// Sets the value of [y][crate::model::Vertex::y].
17407 ///
17408 /// # Example
17409 /// ```ignore,no_run
17410 /// # use google_cloud_documentai_v1::model::Vertex;
17411 /// let x = Vertex::new().set_y(42);
17412 /// ```
17413 pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17414 self.y = v.into();
17415 self
17416 }
17417}
17418
17419impl wkt::message::Message for Vertex {
17420 fn typename() -> &'static str {
17421 "type.googleapis.com/google.cloud.documentai.v1.Vertex"
17422 }
17423}
17424
17425/// A vertex represents a 2D point in the image.
17426/// NOTE: the normalized vertex coordinates are relative to the original image
17427/// and range from 0 to 1.
17428#[derive(Clone, Default, PartialEq)]
17429#[non_exhaustive]
17430pub struct NormalizedVertex {
17431 /// X coordinate.
17432 pub x: f32,
17433
17434 /// Y coordinate (starts from the top of the image).
17435 pub y: f32,
17436
17437 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17438}
17439
17440impl NormalizedVertex {
17441 /// Creates a new default instance.
17442 pub fn new() -> Self {
17443 std::default::Default::default()
17444 }
17445
17446 /// Sets the value of [x][crate::model::NormalizedVertex::x].
17447 ///
17448 /// # Example
17449 /// ```ignore,no_run
17450 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17451 /// let x = NormalizedVertex::new().set_x(42.0);
17452 /// ```
17453 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17454 self.x = v.into();
17455 self
17456 }
17457
17458 /// Sets the value of [y][crate::model::NormalizedVertex::y].
17459 ///
17460 /// # Example
17461 /// ```ignore,no_run
17462 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17463 /// let x = NormalizedVertex::new().set_y(42.0);
17464 /// ```
17465 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17466 self.y = v.into();
17467 self
17468 }
17469}
17470
17471impl wkt::message::Message for NormalizedVertex {
17472 fn typename() -> &'static str {
17473 "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
17474 }
17475}
17476
17477/// A bounding polygon for the detected image annotation.
17478#[derive(Clone, Default, PartialEq)]
17479#[non_exhaustive]
17480pub struct BoundingPoly {
17481 /// The bounding polygon vertices.
17482 pub vertices: std::vec::Vec<crate::model::Vertex>,
17483
17484 /// The bounding polygon normalized vertices.
17485 pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
17486
17487 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17488}
17489
17490impl BoundingPoly {
17491 /// Creates a new default instance.
17492 pub fn new() -> Self {
17493 std::default::Default::default()
17494 }
17495
17496 /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
17497 ///
17498 /// # Example
17499 /// ```ignore,no_run
17500 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17501 /// use google_cloud_documentai_v1::model::Vertex;
17502 /// let x = BoundingPoly::new()
17503 /// .set_vertices([
17504 /// Vertex::default()/* use setters */,
17505 /// Vertex::default()/* use (different) setters */,
17506 /// ]);
17507 /// ```
17508 pub fn set_vertices<T, V>(mut self, v: T) -> Self
17509 where
17510 T: std::iter::IntoIterator<Item = V>,
17511 V: std::convert::Into<crate::model::Vertex>,
17512 {
17513 use std::iter::Iterator;
17514 self.vertices = v.into_iter().map(|i| i.into()).collect();
17515 self
17516 }
17517
17518 /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
17519 ///
17520 /// # Example
17521 /// ```ignore,no_run
17522 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17523 /// use google_cloud_documentai_v1::model::NormalizedVertex;
17524 /// let x = BoundingPoly::new()
17525 /// .set_normalized_vertices([
17526 /// NormalizedVertex::default()/* use setters */,
17527 /// NormalizedVertex::default()/* use (different) setters */,
17528 /// ]);
17529 /// ```
17530 pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
17531 where
17532 T: std::iter::IntoIterator<Item = V>,
17533 V: std::convert::Into<crate::model::NormalizedVertex>,
17534 {
17535 use std::iter::Iterator;
17536 self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
17537 self
17538 }
17539}
17540
17541impl wkt::message::Message for BoundingPoly {
17542 fn typename() -> &'static str {
17543 "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
17544 }
17545}
17546
17547/// The common metadata for long running operations.
17548#[derive(Clone, Default, PartialEq)]
17549#[non_exhaustive]
17550pub struct CommonOperationMetadata {
17551 /// The state of the operation.
17552 pub state: crate::model::common_operation_metadata::State,
17553
17554 /// A message providing more details about the current state of processing.
17555 pub state_message: std::string::String,
17556
17557 /// A related resource to this operation.
17558 pub resource: std::string::String,
17559
17560 /// The creation time of the operation.
17561 pub create_time: std::option::Option<wkt::Timestamp>,
17562
17563 /// The last update time of the operation.
17564 pub update_time: std::option::Option<wkt::Timestamp>,
17565
17566 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17567}
17568
17569impl CommonOperationMetadata {
17570 /// Creates a new default instance.
17571 pub fn new() -> Self {
17572 std::default::Default::default()
17573 }
17574
17575 /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
17576 ///
17577 /// # Example
17578 /// ```ignore,no_run
17579 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17580 /// use google_cloud_documentai_v1::model::common_operation_metadata::State;
17581 /// let x0 = CommonOperationMetadata::new().set_state(State::Running);
17582 /// let x1 = CommonOperationMetadata::new().set_state(State::Cancelling);
17583 /// let x2 = CommonOperationMetadata::new().set_state(State::Succeeded);
17584 /// ```
17585 pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
17586 mut self,
17587 v: T,
17588 ) -> Self {
17589 self.state = v.into();
17590 self
17591 }
17592
17593 /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
17594 ///
17595 /// # Example
17596 /// ```ignore,no_run
17597 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17598 /// let x = CommonOperationMetadata::new().set_state_message("example");
17599 /// ```
17600 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17601 self.state_message = v.into();
17602 self
17603 }
17604
17605 /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
17606 ///
17607 /// # Example
17608 /// ```ignore,no_run
17609 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17610 /// let x = CommonOperationMetadata::new().set_resource("example");
17611 /// ```
17612 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17613 self.resource = v.into();
17614 self
17615 }
17616
17617 /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17618 ///
17619 /// # Example
17620 /// ```ignore,no_run
17621 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17622 /// use wkt::Timestamp;
17623 /// let x = CommonOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17624 /// ```
17625 pub fn set_create_time<T>(mut self, v: T) -> Self
17626 where
17627 T: std::convert::Into<wkt::Timestamp>,
17628 {
17629 self.create_time = std::option::Option::Some(v.into());
17630 self
17631 }
17632
17633 /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17634 ///
17635 /// # Example
17636 /// ```ignore,no_run
17637 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17638 /// use wkt::Timestamp;
17639 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17640 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17641 /// ```
17642 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17643 where
17644 T: std::convert::Into<wkt::Timestamp>,
17645 {
17646 self.create_time = v.map(|x| x.into());
17647 self
17648 }
17649
17650 /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17651 ///
17652 /// # Example
17653 /// ```ignore,no_run
17654 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17655 /// use wkt::Timestamp;
17656 /// let x = CommonOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
17657 /// ```
17658 pub fn set_update_time<T>(mut self, v: T) -> Self
17659 where
17660 T: std::convert::Into<wkt::Timestamp>,
17661 {
17662 self.update_time = std::option::Option::Some(v.into());
17663 self
17664 }
17665
17666 /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17667 ///
17668 /// # Example
17669 /// ```ignore,no_run
17670 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17671 /// use wkt::Timestamp;
17672 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17673 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
17674 /// ```
17675 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17676 where
17677 T: std::convert::Into<wkt::Timestamp>,
17678 {
17679 self.update_time = v.map(|x| x.into());
17680 self
17681 }
17682}
17683
17684impl wkt::message::Message for CommonOperationMetadata {
17685 fn typename() -> &'static str {
17686 "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
17687 }
17688}
17689
17690/// Defines additional types related to [CommonOperationMetadata].
17691pub mod common_operation_metadata {
17692 #[allow(unused_imports)]
17693 use super::*;
17694
17695 /// State of the longrunning operation.
17696 ///
17697 /// # Working with unknown values
17698 ///
17699 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17700 /// additional enum variants at any time. Adding new variants is not considered
17701 /// a breaking change. Applications should write their code in anticipation of:
17702 ///
17703 /// - New values appearing in future releases of the client library, **and**
17704 /// - New values received dynamically, without application changes.
17705 ///
17706 /// Please consult the [Working with enums] section in the user guide for some
17707 /// guidelines.
17708 ///
17709 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17710 #[derive(Clone, Debug, PartialEq)]
17711 #[non_exhaustive]
17712 pub enum State {
17713 /// Unspecified state.
17714 Unspecified,
17715 /// Operation is still running.
17716 Running,
17717 /// Operation is being cancelled.
17718 Cancelling,
17719 /// Operation succeeded.
17720 Succeeded,
17721 /// Operation failed.
17722 Failed,
17723 /// Operation is cancelled.
17724 Cancelled,
17725 /// If set, the enum was initialized with an unknown value.
17726 ///
17727 /// Applications can examine the value using [State::value] or
17728 /// [State::name].
17729 UnknownValue(state::UnknownValue),
17730 }
17731
17732 #[doc(hidden)]
17733 pub mod state {
17734 #[allow(unused_imports)]
17735 use super::*;
17736 #[derive(Clone, Debug, PartialEq)]
17737 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17738 }
17739
17740 impl State {
17741 /// Gets the enum value.
17742 ///
17743 /// Returns `None` if the enum contains an unknown value deserialized from
17744 /// the string representation of enums.
17745 pub fn value(&self) -> std::option::Option<i32> {
17746 match self {
17747 Self::Unspecified => std::option::Option::Some(0),
17748 Self::Running => std::option::Option::Some(1),
17749 Self::Cancelling => std::option::Option::Some(2),
17750 Self::Succeeded => std::option::Option::Some(3),
17751 Self::Failed => std::option::Option::Some(4),
17752 Self::Cancelled => std::option::Option::Some(5),
17753 Self::UnknownValue(u) => u.0.value(),
17754 }
17755 }
17756
17757 /// Gets the enum value as a string.
17758 ///
17759 /// Returns `None` if the enum contains an unknown value deserialized from
17760 /// the integer representation of enums.
17761 pub fn name(&self) -> std::option::Option<&str> {
17762 match self {
17763 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17764 Self::Running => std::option::Option::Some("RUNNING"),
17765 Self::Cancelling => std::option::Option::Some("CANCELLING"),
17766 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
17767 Self::Failed => std::option::Option::Some("FAILED"),
17768 Self::Cancelled => std::option::Option::Some("CANCELLED"),
17769 Self::UnknownValue(u) => u.0.name(),
17770 }
17771 }
17772 }
17773
17774 impl std::default::Default for State {
17775 fn default() -> Self {
17776 use std::convert::From;
17777 Self::from(0)
17778 }
17779 }
17780
17781 impl std::fmt::Display for State {
17782 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17783 wkt::internal::display_enum(f, self.name(), self.value())
17784 }
17785 }
17786
17787 impl std::convert::From<i32> for State {
17788 fn from(value: i32) -> Self {
17789 match value {
17790 0 => Self::Unspecified,
17791 1 => Self::Running,
17792 2 => Self::Cancelling,
17793 3 => Self::Succeeded,
17794 4 => Self::Failed,
17795 5 => Self::Cancelled,
17796 _ => Self::UnknownValue(state::UnknownValue(
17797 wkt::internal::UnknownEnumValue::Integer(value),
17798 )),
17799 }
17800 }
17801 }
17802
17803 impl std::convert::From<&str> for State {
17804 fn from(value: &str) -> Self {
17805 use std::string::ToString;
17806 match value {
17807 "STATE_UNSPECIFIED" => Self::Unspecified,
17808 "RUNNING" => Self::Running,
17809 "CANCELLING" => Self::Cancelling,
17810 "SUCCEEDED" => Self::Succeeded,
17811 "FAILED" => Self::Failed,
17812 "CANCELLED" => Self::Cancelled,
17813 _ => Self::UnknownValue(state::UnknownValue(
17814 wkt::internal::UnknownEnumValue::String(value.to_string()),
17815 )),
17816 }
17817 }
17818 }
17819
17820 impl serde::ser::Serialize for State {
17821 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17822 where
17823 S: serde::Serializer,
17824 {
17825 match self {
17826 Self::Unspecified => serializer.serialize_i32(0),
17827 Self::Running => serializer.serialize_i32(1),
17828 Self::Cancelling => serializer.serialize_i32(2),
17829 Self::Succeeded => serializer.serialize_i32(3),
17830 Self::Failed => serializer.serialize_i32(4),
17831 Self::Cancelled => serializer.serialize_i32(5),
17832 Self::UnknownValue(u) => u.0.serialize(serializer),
17833 }
17834 }
17835 }
17836
17837 impl<'de> serde::de::Deserialize<'de> for State {
17838 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17839 where
17840 D: serde::Deserializer<'de>,
17841 {
17842 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17843 ".google.cloud.documentai.v1.CommonOperationMetadata.State",
17844 ))
17845 }
17846 }
17847}
17848
17849/// A processor version is an implementation of a processor. Each processor
17850/// can have multiple versions, pretrained by Google internally or uptrained
17851/// by the customer. A processor can only have one default version at a time.
17852/// Its document-processing behavior is defined by that version.
17853#[derive(Clone, Default, PartialEq)]
17854#[non_exhaustive]
17855pub struct ProcessorVersion {
17856 /// Identifier. The resource name of the processor version.
17857 /// Format:
17858 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
17859 pub name: std::string::String,
17860
17861 /// The display name of the processor version.
17862 pub display_name: std::string::String,
17863
17864 /// Output only. The schema of the processor version. Describes the output.
17865 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
17866
17867 /// Output only. The state of the processor version.
17868 pub state: crate::model::processor_version::State,
17869
17870 /// Output only. The time the processor version was created.
17871 pub create_time: std::option::Option<wkt::Timestamp>,
17872
17873 /// Output only. The most recently invoked evaluation for the processor
17874 /// version.
17875 pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
17876
17877 /// Output only. The KMS key name used for encryption.
17878 pub kms_key_name: std::string::String,
17879
17880 /// Output only. The KMS key version with which data is encrypted.
17881 pub kms_key_version_name: std::string::String,
17882
17883 /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
17884 pub google_managed: bool,
17885
17886 /// Output only. If set, information about the eventual deprecation of this
17887 /// version.
17888 pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
17889
17890 /// Output only. The model type of this processor version.
17891 pub model_type: crate::model::processor_version::ModelType,
17892
17893 /// Output only. Reserved for future use.
17894 pub satisfies_pzs: bool,
17895
17896 /// Output only. Reserved for future use.
17897 pub satisfies_pzi: bool,
17898
17899 /// Output only. Information about Generative AI model-based processor
17900 /// versions.
17901 pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
17902
17903 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17904}
17905
17906impl ProcessorVersion {
17907 /// Creates a new default instance.
17908 pub fn new() -> Self {
17909 std::default::Default::default()
17910 }
17911
17912 /// Sets the value of [name][crate::model::ProcessorVersion::name].
17913 ///
17914 /// # Example
17915 /// ```ignore,no_run
17916 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17917 /// let x = ProcessorVersion::new().set_name("example");
17918 /// ```
17919 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17920 self.name = v.into();
17921 self
17922 }
17923
17924 /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
17925 ///
17926 /// # Example
17927 /// ```ignore,no_run
17928 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17929 /// let x = ProcessorVersion::new().set_display_name("example");
17930 /// ```
17931 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17932 self.display_name = v.into();
17933 self
17934 }
17935
17936 /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
17937 ///
17938 /// # Example
17939 /// ```ignore,no_run
17940 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17941 /// use google_cloud_documentai_v1::model::DocumentSchema;
17942 /// let x = ProcessorVersion::new().set_document_schema(DocumentSchema::default()/* use setters */);
17943 /// ```
17944 pub fn set_document_schema<T>(mut self, v: T) -> Self
17945 where
17946 T: std::convert::Into<crate::model::DocumentSchema>,
17947 {
17948 self.document_schema = std::option::Option::Some(v.into());
17949 self
17950 }
17951
17952 /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
17953 ///
17954 /// # Example
17955 /// ```ignore,no_run
17956 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17957 /// use google_cloud_documentai_v1::model::DocumentSchema;
17958 /// let x = ProcessorVersion::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
17959 /// let x = ProcessorVersion::new().set_or_clear_document_schema(None::<DocumentSchema>);
17960 /// ```
17961 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
17962 where
17963 T: std::convert::Into<crate::model::DocumentSchema>,
17964 {
17965 self.document_schema = v.map(|x| x.into());
17966 self
17967 }
17968
17969 /// Sets the value of [state][crate::model::ProcessorVersion::state].
17970 ///
17971 /// # Example
17972 /// ```ignore,no_run
17973 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17974 /// use google_cloud_documentai_v1::model::processor_version::State;
17975 /// let x0 = ProcessorVersion::new().set_state(State::Deployed);
17976 /// let x1 = ProcessorVersion::new().set_state(State::Deploying);
17977 /// let x2 = ProcessorVersion::new().set_state(State::Undeployed);
17978 /// ```
17979 pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
17980 mut self,
17981 v: T,
17982 ) -> Self {
17983 self.state = v.into();
17984 self
17985 }
17986
17987 /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
17988 ///
17989 /// # Example
17990 /// ```ignore,no_run
17991 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17992 /// use wkt::Timestamp;
17993 /// let x = ProcessorVersion::new().set_create_time(Timestamp::default()/* use setters */);
17994 /// ```
17995 pub fn set_create_time<T>(mut self, v: T) -> Self
17996 where
17997 T: std::convert::Into<wkt::Timestamp>,
17998 {
17999 self.create_time = std::option::Option::Some(v.into());
18000 self
18001 }
18002
18003 /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
18004 ///
18005 /// # Example
18006 /// ```ignore,no_run
18007 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18008 /// use wkt::Timestamp;
18009 /// let x = ProcessorVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18010 /// let x = ProcessorVersion::new().set_or_clear_create_time(None::<Timestamp>);
18011 /// ```
18012 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18013 where
18014 T: std::convert::Into<wkt::Timestamp>,
18015 {
18016 self.create_time = v.map(|x| x.into());
18017 self
18018 }
18019
18020 /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
18021 ///
18022 /// # Example
18023 /// ```ignore,no_run
18024 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18025 /// use google_cloud_documentai_v1::model::EvaluationReference;
18026 /// let x = ProcessorVersion::new().set_latest_evaluation(EvaluationReference::default()/* use setters */);
18027 /// ```
18028 pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
18029 where
18030 T: std::convert::Into<crate::model::EvaluationReference>,
18031 {
18032 self.latest_evaluation = std::option::Option::Some(v.into());
18033 self
18034 }
18035
18036 /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
18037 ///
18038 /// # Example
18039 /// ```ignore,no_run
18040 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18041 /// use google_cloud_documentai_v1::model::EvaluationReference;
18042 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(Some(EvaluationReference::default()/* use setters */));
18043 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(None::<EvaluationReference>);
18044 /// ```
18045 pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
18046 where
18047 T: std::convert::Into<crate::model::EvaluationReference>,
18048 {
18049 self.latest_evaluation = v.map(|x| x.into());
18050 self
18051 }
18052
18053 /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
18054 ///
18055 /// # Example
18056 /// ```ignore,no_run
18057 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18058 /// let x = ProcessorVersion::new().set_kms_key_name("example");
18059 /// ```
18060 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18061 self.kms_key_name = v.into();
18062 self
18063 }
18064
18065 /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
18066 ///
18067 /// # Example
18068 /// ```ignore,no_run
18069 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18070 /// let x = ProcessorVersion::new().set_kms_key_version_name("example");
18071 /// ```
18072 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
18073 mut self,
18074 v: T,
18075 ) -> Self {
18076 self.kms_key_version_name = v.into();
18077 self
18078 }
18079
18080 /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
18081 ///
18082 /// # Example
18083 /// ```ignore,no_run
18084 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18085 /// let x = ProcessorVersion::new().set_google_managed(true);
18086 /// ```
18087 pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18088 self.google_managed = v.into();
18089 self
18090 }
18091
18092 /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
18093 ///
18094 /// # Example
18095 /// ```ignore,no_run
18096 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18097 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18098 /// let x = ProcessorVersion::new().set_deprecation_info(DeprecationInfo::default()/* use setters */);
18099 /// ```
18100 pub fn set_deprecation_info<T>(mut self, v: T) -> Self
18101 where
18102 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
18103 {
18104 self.deprecation_info = std::option::Option::Some(v.into());
18105 self
18106 }
18107
18108 /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
18109 ///
18110 /// # Example
18111 /// ```ignore,no_run
18112 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18113 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18114 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(Some(DeprecationInfo::default()/* use setters */));
18115 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(None::<DeprecationInfo>);
18116 /// ```
18117 pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
18118 where
18119 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
18120 {
18121 self.deprecation_info = v.map(|x| x.into());
18122 self
18123 }
18124
18125 /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
18126 ///
18127 /// # Example
18128 /// ```ignore,no_run
18129 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18130 /// use google_cloud_documentai_v1::model::processor_version::ModelType;
18131 /// let x0 = ProcessorVersion::new().set_model_type(ModelType::Generative);
18132 /// let x1 = ProcessorVersion::new().set_model_type(ModelType::Custom);
18133 /// ```
18134 pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
18135 mut self,
18136 v: T,
18137 ) -> Self {
18138 self.model_type = v.into();
18139 self
18140 }
18141
18142 /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
18143 ///
18144 /// # Example
18145 /// ```ignore,no_run
18146 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18147 /// let x = ProcessorVersion::new().set_satisfies_pzs(true);
18148 /// ```
18149 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18150 self.satisfies_pzs = v.into();
18151 self
18152 }
18153
18154 /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
18155 ///
18156 /// # Example
18157 /// ```ignore,no_run
18158 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18159 /// let x = ProcessorVersion::new().set_satisfies_pzi(true);
18160 /// ```
18161 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18162 self.satisfies_pzi = v.into();
18163 self
18164 }
18165
18166 /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18167 ///
18168 /// # Example
18169 /// ```ignore,no_run
18170 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18171 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18172 /// let x = ProcessorVersion::new().set_gen_ai_model_info(GenAiModelInfo::default()/* use setters */);
18173 /// ```
18174 pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
18175 where
18176 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18177 {
18178 self.gen_ai_model_info = std::option::Option::Some(v.into());
18179 self
18180 }
18181
18182 /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18183 ///
18184 /// # Example
18185 /// ```ignore,no_run
18186 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18187 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18188 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(Some(GenAiModelInfo::default()/* use setters */));
18189 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(None::<GenAiModelInfo>);
18190 /// ```
18191 pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
18192 where
18193 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18194 {
18195 self.gen_ai_model_info = v.map(|x| x.into());
18196 self
18197 }
18198}
18199
18200impl wkt::message::Message for ProcessorVersion {
18201 fn typename() -> &'static str {
18202 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
18203 }
18204}
18205
18206/// Defines additional types related to [ProcessorVersion].
18207pub mod processor_version {
18208 #[allow(unused_imports)]
18209 use super::*;
18210
18211 /// Information about the upcoming deprecation of this processor version.
18212 #[derive(Clone, Default, PartialEq)]
18213 #[non_exhaustive]
18214 pub struct DeprecationInfo {
18215 /// The time at which this processor version will be deprecated.
18216 pub deprecation_time: std::option::Option<wkt::Timestamp>,
18217
18218 /// If set, the processor version that will be used as a replacement.
18219 pub replacement_processor_version: std::string::String,
18220
18221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18222 }
18223
18224 impl DeprecationInfo {
18225 /// Creates a new default instance.
18226 pub fn new() -> Self {
18227 std::default::Default::default()
18228 }
18229
18230 /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18231 ///
18232 /// # Example
18233 /// ```ignore,no_run
18234 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18235 /// use wkt::Timestamp;
18236 /// let x = DeprecationInfo::new().set_deprecation_time(Timestamp::default()/* use setters */);
18237 /// ```
18238 pub fn set_deprecation_time<T>(mut self, v: T) -> Self
18239 where
18240 T: std::convert::Into<wkt::Timestamp>,
18241 {
18242 self.deprecation_time = std::option::Option::Some(v.into());
18243 self
18244 }
18245
18246 /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18247 ///
18248 /// # Example
18249 /// ```ignore,no_run
18250 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18251 /// use wkt::Timestamp;
18252 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(Some(Timestamp::default()/* use setters */));
18253 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(None::<Timestamp>);
18254 /// ```
18255 pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
18256 where
18257 T: std::convert::Into<wkt::Timestamp>,
18258 {
18259 self.deprecation_time = v.map(|x| x.into());
18260 self
18261 }
18262
18263 /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
18264 ///
18265 /// # Example
18266 /// ```ignore,no_run
18267 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18268 /// let x = DeprecationInfo::new().set_replacement_processor_version("example");
18269 /// ```
18270 pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
18271 mut self,
18272 v: T,
18273 ) -> Self {
18274 self.replacement_processor_version = v.into();
18275 self
18276 }
18277 }
18278
18279 impl wkt::message::Message for DeprecationInfo {
18280 fn typename() -> &'static str {
18281 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
18282 }
18283 }
18284
18285 /// Information about Generative AI model-based processor versions.
18286 #[derive(Clone, Default, PartialEq)]
18287 #[non_exhaustive]
18288 pub struct GenAiModelInfo {
18289 /// The processor version is either a pretrained Google-managed foundation
18290 /// model or a custom Generative AI model created by the user.
18291 pub model_info:
18292 std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
18293
18294 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18295 }
18296
18297 impl GenAiModelInfo {
18298 /// Creates a new default instance.
18299 pub fn new() -> Self {
18300 std::default::Default::default()
18301 }
18302
18303 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
18304 ///
18305 /// Note that all the setters affecting `model_info` are mutually
18306 /// exclusive.
18307 ///
18308 /// # Example
18309 /// ```ignore,no_run
18310 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18311 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18312 /// let x = GenAiModelInfo::new().set_model_info(Some(
18313 /// google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(FoundationGenAiModelInfo::default().into())));
18314 /// ```
18315 pub fn set_model_info<
18316 T: std::convert::Into<
18317 std::option::Option<
18318 crate::model::processor_version::gen_ai_model_info::ModelInfo,
18319 >,
18320 >,
18321 >(
18322 mut self,
18323 v: T,
18324 ) -> Self {
18325 self.model_info = v.into();
18326 self
18327 }
18328
18329 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18330 /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
18331 /// holds a different branch.
18332 pub fn foundation_gen_ai_model_info(
18333 &self,
18334 ) -> std::option::Option<
18335 &std::boxed::Box<
18336 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18337 >,
18338 > {
18339 #[allow(unreachable_patterns)]
18340 self.model_info.as_ref().and_then(|v| match v {
18341 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
18342 _ => std::option::Option::None,
18343 })
18344 }
18345
18346 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18347 /// to hold a `FoundationGenAiModelInfo`.
18348 ///
18349 /// Note that all the setters affecting `model_info` are
18350 /// mutually exclusive.
18351 ///
18352 /// # Example
18353 /// ```ignore,no_run
18354 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18355 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18356 /// let x = GenAiModelInfo::new().set_foundation_gen_ai_model_info(FoundationGenAiModelInfo::default()/* use setters */);
18357 /// assert!(x.foundation_gen_ai_model_info().is_some());
18358 /// assert!(x.custom_gen_ai_model_info().is_none());
18359 /// ```
18360 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{
18361 self.model_info = std::option::Option::Some(
18362 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
18363 v.into()
18364 )
18365 );
18366 self
18367 }
18368
18369 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18370 /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
18371 /// holds a different branch.
18372 pub fn custom_gen_ai_model_info(
18373 &self,
18374 ) -> std::option::Option<
18375 &std::boxed::Box<
18376 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18377 >,
18378 > {
18379 #[allow(unreachable_patterns)]
18380 self.model_info.as_ref().and_then(|v| match v {
18381 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
18382 _ => std::option::Option::None,
18383 })
18384 }
18385
18386 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18387 /// to hold a `CustomGenAiModelInfo`.
18388 ///
18389 /// Note that all the setters affecting `model_info` are
18390 /// mutually exclusive.
18391 ///
18392 /// # Example
18393 /// ```ignore,no_run
18394 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18395 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18396 /// let x = GenAiModelInfo::new().set_custom_gen_ai_model_info(CustomGenAiModelInfo::default()/* use setters */);
18397 /// assert!(x.custom_gen_ai_model_info().is_some());
18398 /// assert!(x.foundation_gen_ai_model_info().is_none());
18399 /// ```
18400 pub fn set_custom_gen_ai_model_info<
18401 T: std::convert::Into<
18402 std::boxed::Box<
18403 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18404 >,
18405 >,
18406 >(
18407 mut self,
18408 v: T,
18409 ) -> Self {
18410 self.model_info = std::option::Option::Some(
18411 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
18412 v.into(),
18413 ),
18414 );
18415 self
18416 }
18417 }
18418
18419 impl wkt::message::Message for GenAiModelInfo {
18420 fn typename() -> &'static str {
18421 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
18422 }
18423 }
18424
18425 /// Defines additional types related to [GenAiModelInfo].
18426 pub mod gen_ai_model_info {
18427 #[allow(unused_imports)]
18428 use super::*;
18429
18430 /// Information for a pretrained Google-managed foundation model.
18431 #[derive(Clone, Default, PartialEq)]
18432 #[non_exhaustive]
18433 pub struct FoundationGenAiModelInfo {
18434 /// Whether finetuning is allowed for this base processor version.
18435 pub finetuning_allowed: bool,
18436
18437 /// The minimum number of labeled documents in the training dataset
18438 /// required for finetuning.
18439 pub min_train_labeled_documents: i32,
18440
18441 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18442 }
18443
18444 impl FoundationGenAiModelInfo {
18445 /// Creates a new default instance.
18446 pub fn new() -> Self {
18447 std::default::Default::default()
18448 }
18449
18450 /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
18451 ///
18452 /// # Example
18453 /// ```ignore,no_run
18454 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18455 /// let x = FoundationGenAiModelInfo::new().set_finetuning_allowed(true);
18456 /// ```
18457 pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18458 self.finetuning_allowed = v.into();
18459 self
18460 }
18461
18462 /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
18463 ///
18464 /// # Example
18465 /// ```ignore,no_run
18466 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18467 /// let x = FoundationGenAiModelInfo::new().set_min_train_labeled_documents(42);
18468 /// ```
18469 pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
18470 mut self,
18471 v: T,
18472 ) -> Self {
18473 self.min_train_labeled_documents = v.into();
18474 self
18475 }
18476 }
18477
18478 impl wkt::message::Message for FoundationGenAiModelInfo {
18479 fn typename() -> &'static str {
18480 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
18481 }
18482 }
18483
18484 /// Information for a custom Generative AI model created by the user. These
18485 /// are created with `Create New Version` in either the `Call foundation
18486 /// model` or `Fine tuning` tabs.
18487 #[derive(Clone, Default, PartialEq)]
18488 #[non_exhaustive]
18489 pub struct CustomGenAiModelInfo {
18490
18491 /// The type of custom model created by the user.
18492 pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
18493
18494 /// The base processor version ID for the custom model.
18495 pub base_processor_version_id: std::string::String,
18496
18497 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18498 }
18499
18500 impl CustomGenAiModelInfo {
18501 /// Creates a new default instance.
18502 pub fn new() -> Self {
18503 std::default::Default::default()
18504 }
18505
18506 /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
18507 ///
18508 /// # Example
18509 /// ```ignore,no_run
18510 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18511 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType;
18512 /// let x0 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::VersionedFoundation);
18513 /// let x1 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::FineTuned);
18514 /// ```
18515 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{
18516 self.custom_model_type = v.into();
18517 self
18518 }
18519
18520 /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
18521 ///
18522 /// # Example
18523 /// ```ignore,no_run
18524 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18525 /// let x = CustomGenAiModelInfo::new().set_base_processor_version_id("example");
18526 /// ```
18527 pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
18528 mut self,
18529 v: T,
18530 ) -> Self {
18531 self.base_processor_version_id = v.into();
18532 self
18533 }
18534 }
18535
18536 impl wkt::message::Message for CustomGenAiModelInfo {
18537 fn typename() -> &'static str {
18538 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
18539 }
18540 }
18541
18542 /// Defines additional types related to [CustomGenAiModelInfo].
18543 pub mod custom_gen_ai_model_info {
18544 #[allow(unused_imports)]
18545 use super::*;
18546
18547 /// The type of custom model created by the user.
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 CustomModelType {
18565 /// The model type is unspecified.
18566 Unspecified,
18567 /// The model is a versioned foundation model.
18568 VersionedFoundation,
18569 /// The model is a finetuned foundation model.
18570 FineTuned,
18571 /// If set, the enum was initialized with an unknown value.
18572 ///
18573 /// Applications can examine the value using [CustomModelType::value] or
18574 /// [CustomModelType::name].
18575 UnknownValue(custom_model_type::UnknownValue),
18576 }
18577
18578 #[doc(hidden)]
18579 pub mod custom_model_type {
18580 #[allow(unused_imports)]
18581 use super::*;
18582 #[derive(Clone, Debug, PartialEq)]
18583 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18584 }
18585
18586 impl CustomModelType {
18587 /// Gets the enum value.
18588 ///
18589 /// Returns `None` if the enum contains an unknown value deserialized from
18590 /// the string representation of enums.
18591 pub fn value(&self) -> std::option::Option<i32> {
18592 match self {
18593 Self::Unspecified => std::option::Option::Some(0),
18594 Self::VersionedFoundation => std::option::Option::Some(1),
18595 Self::FineTuned => std::option::Option::Some(2),
18596 Self::UnknownValue(u) => u.0.value(),
18597 }
18598 }
18599
18600 /// Gets the enum value as a string.
18601 ///
18602 /// Returns `None` if the enum contains an unknown value deserialized from
18603 /// the integer representation of enums.
18604 pub fn name(&self) -> std::option::Option<&str> {
18605 match self {
18606 Self::Unspecified => {
18607 std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
18608 }
18609 Self::VersionedFoundation => {
18610 std::option::Option::Some("VERSIONED_FOUNDATION")
18611 }
18612 Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
18613 Self::UnknownValue(u) => u.0.name(),
18614 }
18615 }
18616 }
18617
18618 impl std::default::Default for CustomModelType {
18619 fn default() -> Self {
18620 use std::convert::From;
18621 Self::from(0)
18622 }
18623 }
18624
18625 impl std::fmt::Display for CustomModelType {
18626 fn fmt(
18627 &self,
18628 f: &mut std::fmt::Formatter<'_>,
18629 ) -> std::result::Result<(), std::fmt::Error> {
18630 wkt::internal::display_enum(f, self.name(), self.value())
18631 }
18632 }
18633
18634 impl std::convert::From<i32> for CustomModelType {
18635 fn from(value: i32) -> Self {
18636 match value {
18637 0 => Self::Unspecified,
18638 1 => Self::VersionedFoundation,
18639 2 => Self::FineTuned,
18640 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18641 wkt::internal::UnknownEnumValue::Integer(value),
18642 )),
18643 }
18644 }
18645 }
18646
18647 impl std::convert::From<&str> for CustomModelType {
18648 fn from(value: &str) -> Self {
18649 use std::string::ToString;
18650 match value {
18651 "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
18652 "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
18653 "FINE_TUNED" => Self::FineTuned,
18654 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18655 wkt::internal::UnknownEnumValue::String(value.to_string()),
18656 )),
18657 }
18658 }
18659 }
18660
18661 impl serde::ser::Serialize for CustomModelType {
18662 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18663 where
18664 S: serde::Serializer,
18665 {
18666 match self {
18667 Self::Unspecified => serializer.serialize_i32(0),
18668 Self::VersionedFoundation => serializer.serialize_i32(1),
18669 Self::FineTuned => serializer.serialize_i32(2),
18670 Self::UnknownValue(u) => u.0.serialize(serializer),
18671 }
18672 }
18673 }
18674
18675 impl<'de> serde::de::Deserialize<'de> for CustomModelType {
18676 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18677 where
18678 D: serde::Deserializer<'de>,
18679 {
18680 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
18681 ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
18682 }
18683 }
18684 }
18685
18686 /// The processor version is either a pretrained Google-managed foundation
18687 /// model or a custom Generative AI model created by the user.
18688 #[derive(Clone, Debug, PartialEq)]
18689 #[non_exhaustive]
18690 pub enum ModelInfo {
18691 /// Information for a pretrained Google-managed foundation model.
18692 FoundationGenAiModelInfo(
18693 std::boxed::Box<
18694 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18695 >,
18696 ),
18697 /// Information for a custom Generative AI model created by the user.
18698 CustomGenAiModelInfo(
18699 std::boxed::Box<
18700 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18701 >,
18702 ),
18703 }
18704 }
18705
18706 /// The possible states of the processor version.
18707 ///
18708 /// # Working with unknown values
18709 ///
18710 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18711 /// additional enum variants at any time. Adding new variants is not considered
18712 /// a breaking change. Applications should write their code in anticipation of:
18713 ///
18714 /// - New values appearing in future releases of the client library, **and**
18715 /// - New values received dynamically, without application changes.
18716 ///
18717 /// Please consult the [Working with enums] section in the user guide for some
18718 /// guidelines.
18719 ///
18720 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18721 #[derive(Clone, Debug, PartialEq)]
18722 #[non_exhaustive]
18723 pub enum State {
18724 /// The processor version is in an unspecified state.
18725 Unspecified,
18726 /// The processor version is deployed and can be used for processing.
18727 Deployed,
18728 /// The processor version is being deployed.
18729 Deploying,
18730 /// The processor version is not deployed and cannot be used for processing.
18731 Undeployed,
18732 /// The processor version is being undeployed.
18733 Undeploying,
18734 /// The processor version is being created.
18735 Creating,
18736 /// The processor version is being deleted.
18737 Deleting,
18738 /// The processor version failed and is in an indeterminate state.
18739 Failed,
18740 /// The processor version is being imported.
18741 Importing,
18742 /// If set, the enum was initialized with an unknown value.
18743 ///
18744 /// Applications can examine the value using [State::value] or
18745 /// [State::name].
18746 UnknownValue(state::UnknownValue),
18747 }
18748
18749 #[doc(hidden)]
18750 pub mod state {
18751 #[allow(unused_imports)]
18752 use super::*;
18753 #[derive(Clone, Debug, PartialEq)]
18754 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18755 }
18756
18757 impl State {
18758 /// Gets the enum value.
18759 ///
18760 /// Returns `None` if the enum contains an unknown value deserialized from
18761 /// the string representation of enums.
18762 pub fn value(&self) -> std::option::Option<i32> {
18763 match self {
18764 Self::Unspecified => std::option::Option::Some(0),
18765 Self::Deployed => std::option::Option::Some(1),
18766 Self::Deploying => std::option::Option::Some(2),
18767 Self::Undeployed => std::option::Option::Some(3),
18768 Self::Undeploying => std::option::Option::Some(4),
18769 Self::Creating => std::option::Option::Some(5),
18770 Self::Deleting => std::option::Option::Some(6),
18771 Self::Failed => std::option::Option::Some(7),
18772 Self::Importing => std::option::Option::Some(8),
18773 Self::UnknownValue(u) => u.0.value(),
18774 }
18775 }
18776
18777 /// Gets the enum value as a string.
18778 ///
18779 /// Returns `None` if the enum contains an unknown value deserialized from
18780 /// the integer representation of enums.
18781 pub fn name(&self) -> std::option::Option<&str> {
18782 match self {
18783 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
18784 Self::Deployed => std::option::Option::Some("DEPLOYED"),
18785 Self::Deploying => std::option::Option::Some("DEPLOYING"),
18786 Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
18787 Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
18788 Self::Creating => std::option::Option::Some("CREATING"),
18789 Self::Deleting => std::option::Option::Some("DELETING"),
18790 Self::Failed => std::option::Option::Some("FAILED"),
18791 Self::Importing => std::option::Option::Some("IMPORTING"),
18792 Self::UnknownValue(u) => u.0.name(),
18793 }
18794 }
18795 }
18796
18797 impl std::default::Default for State {
18798 fn default() -> Self {
18799 use std::convert::From;
18800 Self::from(0)
18801 }
18802 }
18803
18804 impl std::fmt::Display for State {
18805 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18806 wkt::internal::display_enum(f, self.name(), self.value())
18807 }
18808 }
18809
18810 impl std::convert::From<i32> for State {
18811 fn from(value: i32) -> Self {
18812 match value {
18813 0 => Self::Unspecified,
18814 1 => Self::Deployed,
18815 2 => Self::Deploying,
18816 3 => Self::Undeployed,
18817 4 => Self::Undeploying,
18818 5 => Self::Creating,
18819 6 => Self::Deleting,
18820 7 => Self::Failed,
18821 8 => Self::Importing,
18822 _ => Self::UnknownValue(state::UnknownValue(
18823 wkt::internal::UnknownEnumValue::Integer(value),
18824 )),
18825 }
18826 }
18827 }
18828
18829 impl std::convert::From<&str> for State {
18830 fn from(value: &str) -> Self {
18831 use std::string::ToString;
18832 match value {
18833 "STATE_UNSPECIFIED" => Self::Unspecified,
18834 "DEPLOYED" => Self::Deployed,
18835 "DEPLOYING" => Self::Deploying,
18836 "UNDEPLOYED" => Self::Undeployed,
18837 "UNDEPLOYING" => Self::Undeploying,
18838 "CREATING" => Self::Creating,
18839 "DELETING" => Self::Deleting,
18840 "FAILED" => Self::Failed,
18841 "IMPORTING" => Self::Importing,
18842 _ => Self::UnknownValue(state::UnknownValue(
18843 wkt::internal::UnknownEnumValue::String(value.to_string()),
18844 )),
18845 }
18846 }
18847 }
18848
18849 impl serde::ser::Serialize for State {
18850 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18851 where
18852 S: serde::Serializer,
18853 {
18854 match self {
18855 Self::Unspecified => serializer.serialize_i32(0),
18856 Self::Deployed => serializer.serialize_i32(1),
18857 Self::Deploying => serializer.serialize_i32(2),
18858 Self::Undeployed => serializer.serialize_i32(3),
18859 Self::Undeploying => serializer.serialize_i32(4),
18860 Self::Creating => serializer.serialize_i32(5),
18861 Self::Deleting => serializer.serialize_i32(6),
18862 Self::Failed => serializer.serialize_i32(7),
18863 Self::Importing => serializer.serialize_i32(8),
18864 Self::UnknownValue(u) => u.0.serialize(serializer),
18865 }
18866 }
18867 }
18868
18869 impl<'de> serde::de::Deserialize<'de> for State {
18870 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18871 where
18872 D: serde::Deserializer<'de>,
18873 {
18874 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18875 ".google.cloud.documentai.v1.ProcessorVersion.State",
18876 ))
18877 }
18878 }
18879
18880 /// The possible model types of the processor version.
18881 ///
18882 /// # Working with unknown values
18883 ///
18884 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18885 /// additional enum variants at any time. Adding new variants is not considered
18886 /// a breaking change. Applications should write their code in anticipation of:
18887 ///
18888 /// - New values appearing in future releases of the client library, **and**
18889 /// - New values received dynamically, without application changes.
18890 ///
18891 /// Please consult the [Working with enums] section in the user guide for some
18892 /// guidelines.
18893 ///
18894 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18895 #[derive(Clone, Debug, PartialEq)]
18896 #[non_exhaustive]
18897 pub enum ModelType {
18898 /// The processor version has unspecified model type.
18899 Unspecified,
18900 /// The processor version has generative model type.
18901 Generative,
18902 /// The processor version has custom model type.
18903 Custom,
18904 /// If set, the enum was initialized with an unknown value.
18905 ///
18906 /// Applications can examine the value using [ModelType::value] or
18907 /// [ModelType::name].
18908 UnknownValue(model_type::UnknownValue),
18909 }
18910
18911 #[doc(hidden)]
18912 pub mod model_type {
18913 #[allow(unused_imports)]
18914 use super::*;
18915 #[derive(Clone, Debug, PartialEq)]
18916 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18917 }
18918
18919 impl ModelType {
18920 /// Gets the enum value.
18921 ///
18922 /// Returns `None` if the enum contains an unknown value deserialized from
18923 /// the string representation of enums.
18924 pub fn value(&self) -> std::option::Option<i32> {
18925 match self {
18926 Self::Unspecified => std::option::Option::Some(0),
18927 Self::Generative => std::option::Option::Some(1),
18928 Self::Custom => std::option::Option::Some(2),
18929 Self::UnknownValue(u) => u.0.value(),
18930 }
18931 }
18932
18933 /// Gets the enum value as a string.
18934 ///
18935 /// Returns `None` if the enum contains an unknown value deserialized from
18936 /// the integer representation of enums.
18937 pub fn name(&self) -> std::option::Option<&str> {
18938 match self {
18939 Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
18940 Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
18941 Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
18942 Self::UnknownValue(u) => u.0.name(),
18943 }
18944 }
18945 }
18946
18947 impl std::default::Default for ModelType {
18948 fn default() -> Self {
18949 use std::convert::From;
18950 Self::from(0)
18951 }
18952 }
18953
18954 impl std::fmt::Display for ModelType {
18955 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18956 wkt::internal::display_enum(f, self.name(), self.value())
18957 }
18958 }
18959
18960 impl std::convert::From<i32> for ModelType {
18961 fn from(value: i32) -> Self {
18962 match value {
18963 0 => Self::Unspecified,
18964 1 => Self::Generative,
18965 2 => Self::Custom,
18966 _ => Self::UnknownValue(model_type::UnknownValue(
18967 wkt::internal::UnknownEnumValue::Integer(value),
18968 )),
18969 }
18970 }
18971 }
18972
18973 impl std::convert::From<&str> for ModelType {
18974 fn from(value: &str) -> Self {
18975 use std::string::ToString;
18976 match value {
18977 "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
18978 "MODEL_TYPE_GENERATIVE" => Self::Generative,
18979 "MODEL_TYPE_CUSTOM" => Self::Custom,
18980 _ => Self::UnknownValue(model_type::UnknownValue(
18981 wkt::internal::UnknownEnumValue::String(value.to_string()),
18982 )),
18983 }
18984 }
18985 }
18986
18987 impl serde::ser::Serialize for ModelType {
18988 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18989 where
18990 S: serde::Serializer,
18991 {
18992 match self {
18993 Self::Unspecified => serializer.serialize_i32(0),
18994 Self::Generative => serializer.serialize_i32(1),
18995 Self::Custom => serializer.serialize_i32(2),
18996 Self::UnknownValue(u) => u.0.serialize(serializer),
18997 }
18998 }
18999 }
19000
19001 impl<'de> serde::de::Deserialize<'de> for ModelType {
19002 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19003 where
19004 D: serde::Deserializer<'de>,
19005 {
19006 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
19007 ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
19008 ))
19009 }
19010 }
19011}
19012
19013/// Contains the alias and the aliased resource name of processor version.
19014#[derive(Clone, Default, PartialEq)]
19015#[non_exhaustive]
19016pub struct ProcessorVersionAlias {
19017 /// The alias in the form of `processor_version` resource name.
19018 pub alias: std::string::String,
19019
19020 /// The resource name of aliased processor version.
19021 pub processor_version: std::string::String,
19022
19023 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19024}
19025
19026impl ProcessorVersionAlias {
19027 /// Creates a new default instance.
19028 pub fn new() -> Self {
19029 std::default::Default::default()
19030 }
19031
19032 /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
19033 ///
19034 /// # Example
19035 /// ```ignore,no_run
19036 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19037 /// let x = ProcessorVersionAlias::new().set_alias("example");
19038 /// ```
19039 pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19040 self.alias = v.into();
19041 self
19042 }
19043
19044 /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
19045 ///
19046 /// # Example
19047 /// ```ignore,no_run
19048 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19049 /// let x = ProcessorVersionAlias::new().set_processor_version("example");
19050 /// ```
19051 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
19052 mut self,
19053 v: T,
19054 ) -> Self {
19055 self.processor_version = v.into();
19056 self
19057 }
19058}
19059
19060impl wkt::message::Message for ProcessorVersionAlias {
19061 fn typename() -> &'static str {
19062 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
19063 }
19064}
19065
19066/// The first-class citizen for Document AI. Each processor defines how to
19067/// extract structural information from a document.
19068#[derive(Clone, Default, PartialEq)]
19069#[non_exhaustive]
19070pub struct Processor {
19071 /// Output only. Immutable. The resource name of the processor.
19072 /// Format: `projects/{project}/locations/{location}/processors/{processor}`
19073 pub name: std::string::String,
19074
19075 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19076 /// To get a list of processor types, see
19077 /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
19078 ///
19079 /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
19080 pub r#type: std::string::String,
19081
19082 /// The display name of the processor.
19083 pub display_name: std::string::String,
19084
19085 /// Output only. The state of the processor.
19086 pub state: crate::model::processor::State,
19087
19088 /// The default processor version.
19089 pub default_processor_version: std::string::String,
19090
19091 /// Output only. The processor version aliases.
19092 pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
19093
19094 /// Output only. Immutable. The http endpoint that can be called to invoke
19095 /// processing.
19096 pub process_endpoint: std::string::String,
19097
19098 /// Output only. The time the processor was created.
19099 pub create_time: std::option::Option<wkt::Timestamp>,
19100
19101 /// The [KMS key](https://cloud.google.com/security-key-management) used for
19102 /// encryption and decryption in CMEK scenarios.
19103 pub kms_key_name: std::string::String,
19104
19105 /// Output only. Reserved for future use.
19106 pub satisfies_pzs: bool,
19107
19108 /// Output only. Reserved for future use.
19109 pub satisfies_pzi: bool,
19110
19111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19112}
19113
19114impl Processor {
19115 /// Creates a new default instance.
19116 pub fn new() -> Self {
19117 std::default::Default::default()
19118 }
19119
19120 /// Sets the value of [name][crate::model::Processor::name].
19121 ///
19122 /// # Example
19123 /// ```ignore,no_run
19124 /// # use google_cloud_documentai_v1::model::Processor;
19125 /// let x = Processor::new().set_name("example");
19126 /// ```
19127 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19128 self.name = v.into();
19129 self
19130 }
19131
19132 /// Sets the value of [r#type][crate::model::Processor::type].
19133 ///
19134 /// # Example
19135 /// ```ignore,no_run
19136 /// # use google_cloud_documentai_v1::model::Processor;
19137 /// let x = Processor::new().set_type("example");
19138 /// ```
19139 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19140 self.r#type = v.into();
19141 self
19142 }
19143
19144 /// Sets the value of [display_name][crate::model::Processor::display_name].
19145 ///
19146 /// # Example
19147 /// ```ignore,no_run
19148 /// # use google_cloud_documentai_v1::model::Processor;
19149 /// let x = Processor::new().set_display_name("example");
19150 /// ```
19151 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19152 self.display_name = v.into();
19153 self
19154 }
19155
19156 /// Sets the value of [state][crate::model::Processor::state].
19157 ///
19158 /// # Example
19159 /// ```ignore,no_run
19160 /// # use google_cloud_documentai_v1::model::Processor;
19161 /// use google_cloud_documentai_v1::model::processor::State;
19162 /// let x0 = Processor::new().set_state(State::Enabled);
19163 /// let x1 = Processor::new().set_state(State::Disabled);
19164 /// let x2 = Processor::new().set_state(State::Enabling);
19165 /// ```
19166 pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
19167 mut self,
19168 v: T,
19169 ) -> Self {
19170 self.state = v.into();
19171 self
19172 }
19173
19174 /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
19175 ///
19176 /// # Example
19177 /// ```ignore,no_run
19178 /// # use google_cloud_documentai_v1::model::Processor;
19179 /// let x = Processor::new().set_default_processor_version("example");
19180 /// ```
19181 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
19182 mut self,
19183 v: T,
19184 ) -> Self {
19185 self.default_processor_version = v.into();
19186 self
19187 }
19188
19189 /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
19190 ///
19191 /// # Example
19192 /// ```ignore,no_run
19193 /// # use google_cloud_documentai_v1::model::Processor;
19194 /// use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19195 /// let x = Processor::new()
19196 /// .set_processor_version_aliases([
19197 /// ProcessorVersionAlias::default()/* use setters */,
19198 /// ProcessorVersionAlias::default()/* use (different) setters */,
19199 /// ]);
19200 /// ```
19201 pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
19202 where
19203 T: std::iter::IntoIterator<Item = V>,
19204 V: std::convert::Into<crate::model::ProcessorVersionAlias>,
19205 {
19206 use std::iter::Iterator;
19207 self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
19208 self
19209 }
19210
19211 /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
19212 ///
19213 /// # Example
19214 /// ```ignore,no_run
19215 /// # use google_cloud_documentai_v1::model::Processor;
19216 /// let x = Processor::new().set_process_endpoint("example");
19217 /// ```
19218 pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
19219 mut self,
19220 v: T,
19221 ) -> Self {
19222 self.process_endpoint = v.into();
19223 self
19224 }
19225
19226 /// Sets the value of [create_time][crate::model::Processor::create_time].
19227 ///
19228 /// # Example
19229 /// ```ignore,no_run
19230 /// # use google_cloud_documentai_v1::model::Processor;
19231 /// use wkt::Timestamp;
19232 /// let x = Processor::new().set_create_time(Timestamp::default()/* use setters */);
19233 /// ```
19234 pub fn set_create_time<T>(mut self, v: T) -> Self
19235 where
19236 T: std::convert::Into<wkt::Timestamp>,
19237 {
19238 self.create_time = std::option::Option::Some(v.into());
19239 self
19240 }
19241
19242 /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
19243 ///
19244 /// # Example
19245 /// ```ignore,no_run
19246 /// # use google_cloud_documentai_v1::model::Processor;
19247 /// use wkt::Timestamp;
19248 /// let x = Processor::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19249 /// let x = Processor::new().set_or_clear_create_time(None::<Timestamp>);
19250 /// ```
19251 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19252 where
19253 T: std::convert::Into<wkt::Timestamp>,
19254 {
19255 self.create_time = v.map(|x| x.into());
19256 self
19257 }
19258
19259 /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
19260 ///
19261 /// # Example
19262 /// ```ignore,no_run
19263 /// # use google_cloud_documentai_v1::model::Processor;
19264 /// let x = Processor::new().set_kms_key_name("example");
19265 /// ```
19266 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19267 self.kms_key_name = v.into();
19268 self
19269 }
19270
19271 /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
19272 ///
19273 /// # Example
19274 /// ```ignore,no_run
19275 /// # use google_cloud_documentai_v1::model::Processor;
19276 /// let x = Processor::new().set_satisfies_pzs(true);
19277 /// ```
19278 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19279 self.satisfies_pzs = v.into();
19280 self
19281 }
19282
19283 /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
19284 ///
19285 /// # Example
19286 /// ```ignore,no_run
19287 /// # use google_cloud_documentai_v1::model::Processor;
19288 /// let x = Processor::new().set_satisfies_pzi(true);
19289 /// ```
19290 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19291 self.satisfies_pzi = v.into();
19292 self
19293 }
19294}
19295
19296impl wkt::message::Message for Processor {
19297 fn typename() -> &'static str {
19298 "type.googleapis.com/google.cloud.documentai.v1.Processor"
19299 }
19300}
19301
19302/// Defines additional types related to [Processor].
19303pub mod processor {
19304 #[allow(unused_imports)]
19305 use super::*;
19306
19307 /// The possible states of the processor.
19308 ///
19309 /// # Working with unknown values
19310 ///
19311 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19312 /// additional enum variants at any time. Adding new variants is not considered
19313 /// a breaking change. Applications should write their code in anticipation of:
19314 ///
19315 /// - New values appearing in future releases of the client library, **and**
19316 /// - New values received dynamically, without application changes.
19317 ///
19318 /// Please consult the [Working with enums] section in the user guide for some
19319 /// guidelines.
19320 ///
19321 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19322 #[derive(Clone, Debug, PartialEq)]
19323 #[non_exhaustive]
19324 pub enum State {
19325 /// The processor is in an unspecified state.
19326 Unspecified,
19327 /// The processor is enabled, i.e., has an enabled version which can
19328 /// currently serve processing requests and all the feature dependencies have
19329 /// been successfully initialized.
19330 Enabled,
19331 /// The processor is disabled.
19332 Disabled,
19333 /// The processor is being enabled, will become `ENABLED` if successful.
19334 Enabling,
19335 /// The processor is being disabled, will become `DISABLED` if successful.
19336 Disabling,
19337 /// The processor is being created, will become either `ENABLED` (for
19338 /// successful creation) or `FAILED` (for failed ones).
19339 /// Once a processor is in this state, it can then be used for document
19340 /// processing, but the feature dependencies of the processor might not be
19341 /// fully created yet.
19342 Creating,
19343 /// The processor failed during creation or initialization of feature
19344 /// dependencies. The user should delete the processor and recreate one as
19345 /// all the functionalities of the processor are disabled.
19346 Failed,
19347 /// The processor is being deleted, will be removed if successful.
19348 Deleting,
19349 /// If set, the enum was initialized with an unknown value.
19350 ///
19351 /// Applications can examine the value using [State::value] or
19352 /// [State::name].
19353 UnknownValue(state::UnknownValue),
19354 }
19355
19356 #[doc(hidden)]
19357 pub mod state {
19358 #[allow(unused_imports)]
19359 use super::*;
19360 #[derive(Clone, Debug, PartialEq)]
19361 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19362 }
19363
19364 impl State {
19365 /// Gets the enum value.
19366 ///
19367 /// Returns `None` if the enum contains an unknown value deserialized from
19368 /// the string representation of enums.
19369 pub fn value(&self) -> std::option::Option<i32> {
19370 match self {
19371 Self::Unspecified => std::option::Option::Some(0),
19372 Self::Enabled => std::option::Option::Some(1),
19373 Self::Disabled => std::option::Option::Some(2),
19374 Self::Enabling => std::option::Option::Some(3),
19375 Self::Disabling => std::option::Option::Some(4),
19376 Self::Creating => std::option::Option::Some(5),
19377 Self::Failed => std::option::Option::Some(6),
19378 Self::Deleting => std::option::Option::Some(7),
19379 Self::UnknownValue(u) => u.0.value(),
19380 }
19381 }
19382
19383 /// Gets the enum value as a string.
19384 ///
19385 /// Returns `None` if the enum contains an unknown value deserialized from
19386 /// the integer representation of enums.
19387 pub fn name(&self) -> std::option::Option<&str> {
19388 match self {
19389 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19390 Self::Enabled => std::option::Option::Some("ENABLED"),
19391 Self::Disabled => std::option::Option::Some("DISABLED"),
19392 Self::Enabling => std::option::Option::Some("ENABLING"),
19393 Self::Disabling => std::option::Option::Some("DISABLING"),
19394 Self::Creating => std::option::Option::Some("CREATING"),
19395 Self::Failed => std::option::Option::Some("FAILED"),
19396 Self::Deleting => std::option::Option::Some("DELETING"),
19397 Self::UnknownValue(u) => u.0.name(),
19398 }
19399 }
19400 }
19401
19402 impl std::default::Default for State {
19403 fn default() -> Self {
19404 use std::convert::From;
19405 Self::from(0)
19406 }
19407 }
19408
19409 impl std::fmt::Display for State {
19410 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19411 wkt::internal::display_enum(f, self.name(), self.value())
19412 }
19413 }
19414
19415 impl std::convert::From<i32> for State {
19416 fn from(value: i32) -> Self {
19417 match value {
19418 0 => Self::Unspecified,
19419 1 => Self::Enabled,
19420 2 => Self::Disabled,
19421 3 => Self::Enabling,
19422 4 => Self::Disabling,
19423 5 => Self::Creating,
19424 6 => Self::Failed,
19425 7 => Self::Deleting,
19426 _ => Self::UnknownValue(state::UnknownValue(
19427 wkt::internal::UnknownEnumValue::Integer(value),
19428 )),
19429 }
19430 }
19431 }
19432
19433 impl std::convert::From<&str> for State {
19434 fn from(value: &str) -> Self {
19435 use std::string::ToString;
19436 match value {
19437 "STATE_UNSPECIFIED" => Self::Unspecified,
19438 "ENABLED" => Self::Enabled,
19439 "DISABLED" => Self::Disabled,
19440 "ENABLING" => Self::Enabling,
19441 "DISABLING" => Self::Disabling,
19442 "CREATING" => Self::Creating,
19443 "FAILED" => Self::Failed,
19444 "DELETING" => Self::Deleting,
19445 _ => Self::UnknownValue(state::UnknownValue(
19446 wkt::internal::UnknownEnumValue::String(value.to_string()),
19447 )),
19448 }
19449 }
19450 }
19451
19452 impl serde::ser::Serialize for State {
19453 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19454 where
19455 S: serde::Serializer,
19456 {
19457 match self {
19458 Self::Unspecified => serializer.serialize_i32(0),
19459 Self::Enabled => serializer.serialize_i32(1),
19460 Self::Disabled => serializer.serialize_i32(2),
19461 Self::Enabling => serializer.serialize_i32(3),
19462 Self::Disabling => serializer.serialize_i32(4),
19463 Self::Creating => serializer.serialize_i32(5),
19464 Self::Failed => serializer.serialize_i32(6),
19465 Self::Deleting => serializer.serialize_i32(7),
19466 Self::UnknownValue(u) => u.0.serialize(serializer),
19467 }
19468 }
19469 }
19470
19471 impl<'de> serde::de::Deserialize<'de> for State {
19472 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19473 where
19474 D: serde::Deserializer<'de>,
19475 {
19476 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19477 ".google.cloud.documentai.v1.Processor.State",
19478 ))
19479 }
19480 }
19481}
19482
19483/// A processor type is responsible for performing a certain document
19484/// understanding task on a certain type of document.
19485#[derive(Clone, Default, PartialEq)]
19486#[non_exhaustive]
19487pub struct ProcessorType {
19488 /// The resource name of the processor type.
19489 /// Format: `projects/{project}/processorTypes/{processor_type}`
19490 pub name: std::string::String,
19491
19492 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19493 pub r#type: std::string::String,
19494
19495 /// The processor category, used by UI to group processor types.
19496 pub category: std::string::String,
19497
19498 /// The locations in which this processor is available.
19499 pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
19500
19501 /// Whether the processor type allows creation. If true, users can create a
19502 /// processor of this processor type. Otherwise, users need to request access.
19503 pub allow_creation: bool,
19504
19505 /// Launch stage of the processor type
19506 pub launch_stage: google_cloud_api::model::LaunchStage,
19507
19508 /// A set of Cloud Storage URIs of sample documents for this processor.
19509 pub sample_document_uris: std::vec::Vec<std::string::String>,
19510
19511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19512}
19513
19514impl ProcessorType {
19515 /// Creates a new default instance.
19516 pub fn new() -> Self {
19517 std::default::Default::default()
19518 }
19519
19520 /// Sets the value of [name][crate::model::ProcessorType::name].
19521 ///
19522 /// # Example
19523 /// ```ignore,no_run
19524 /// # use google_cloud_documentai_v1::model::ProcessorType;
19525 /// let x = ProcessorType::new().set_name("example");
19526 /// ```
19527 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19528 self.name = v.into();
19529 self
19530 }
19531
19532 /// Sets the value of [r#type][crate::model::ProcessorType::type].
19533 ///
19534 /// # Example
19535 /// ```ignore,no_run
19536 /// # use google_cloud_documentai_v1::model::ProcessorType;
19537 /// let x = ProcessorType::new().set_type("example");
19538 /// ```
19539 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19540 self.r#type = v.into();
19541 self
19542 }
19543
19544 /// Sets the value of [category][crate::model::ProcessorType::category].
19545 ///
19546 /// # Example
19547 /// ```ignore,no_run
19548 /// # use google_cloud_documentai_v1::model::ProcessorType;
19549 /// let x = ProcessorType::new().set_category("example");
19550 /// ```
19551 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19552 self.category = v.into();
19553 self
19554 }
19555
19556 /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
19557 ///
19558 /// # Example
19559 /// ```ignore,no_run
19560 /// # use google_cloud_documentai_v1::model::ProcessorType;
19561 /// use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19562 /// let x = ProcessorType::new()
19563 /// .set_available_locations([
19564 /// LocationInfo::default()/* use setters */,
19565 /// LocationInfo::default()/* use (different) setters */,
19566 /// ]);
19567 /// ```
19568 pub fn set_available_locations<T, V>(mut self, v: T) -> Self
19569 where
19570 T: std::iter::IntoIterator<Item = V>,
19571 V: std::convert::Into<crate::model::processor_type::LocationInfo>,
19572 {
19573 use std::iter::Iterator;
19574 self.available_locations = v.into_iter().map(|i| i.into()).collect();
19575 self
19576 }
19577
19578 /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
19579 ///
19580 /// # Example
19581 /// ```ignore,no_run
19582 /// # use google_cloud_documentai_v1::model::ProcessorType;
19583 /// let x = ProcessorType::new().set_allow_creation(true);
19584 /// ```
19585 pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19586 self.allow_creation = v.into();
19587 self
19588 }
19589
19590 /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
19591 ///
19592 /// # Example
19593 /// ```ignore,no_run
19594 /// # use google_cloud_documentai_v1::model::ProcessorType;
19595 /// use google_cloud_api::model::LaunchStage;
19596 /// let x0 = ProcessorType::new().set_launch_stage(LaunchStage::Unimplemented);
19597 /// let x1 = ProcessorType::new().set_launch_stage(LaunchStage::Prelaunch);
19598 /// let x2 = ProcessorType::new().set_launch_stage(LaunchStage::EarlyAccess);
19599 /// ```
19600 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
19601 mut self,
19602 v: T,
19603 ) -> Self {
19604 self.launch_stage = v.into();
19605 self
19606 }
19607
19608 /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
19609 ///
19610 /// # Example
19611 /// ```ignore,no_run
19612 /// # use google_cloud_documentai_v1::model::ProcessorType;
19613 /// let x = ProcessorType::new().set_sample_document_uris(["a", "b", "c"]);
19614 /// ```
19615 pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
19616 where
19617 T: std::iter::IntoIterator<Item = V>,
19618 V: std::convert::Into<std::string::String>,
19619 {
19620 use std::iter::Iterator;
19621 self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
19622 self
19623 }
19624}
19625
19626impl wkt::message::Message for ProcessorType {
19627 fn typename() -> &'static str {
19628 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
19629 }
19630}
19631
19632/// Defines additional types related to [ProcessorType].
19633pub mod processor_type {
19634 #[allow(unused_imports)]
19635 use super::*;
19636
19637 /// The location information about where the processor is available.
19638 #[derive(Clone, Default, PartialEq)]
19639 #[non_exhaustive]
19640 pub struct LocationInfo {
19641 /// The location ID. For supported locations, refer to [regional and
19642 /// multi-regional support](/document-ai/docs/regions).
19643 pub location_id: std::string::String,
19644
19645 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19646 }
19647
19648 impl LocationInfo {
19649 /// Creates a new default instance.
19650 pub fn new() -> Self {
19651 std::default::Default::default()
19652 }
19653
19654 /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
19655 ///
19656 /// # Example
19657 /// ```ignore,no_run
19658 /// # use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19659 /// let x = LocationInfo::new().set_location_id("example");
19660 /// ```
19661 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19662 self.location_id = v.into();
19663 self
19664 }
19665 }
19666
19667 impl wkt::message::Message for LocationInfo {
19668 fn typename() -> &'static str {
19669 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
19670 }
19671 }
19672}