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::bare_urls)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![allow(rustdoc::invalid_html_tags)]
20#![allow(rustdoc::redundant_explicit_links)]
21#![no_implicit_prelude]
22extern crate async_trait;
23extern crate bytes;
24extern crate gaxi;
25extern crate google_cloud_api;
26extern crate google_cloud_gax;
27extern crate google_cloud_location;
28extern crate google_cloud_longrunning;
29extern crate google_cloud_lro;
30extern crate google_cloud_rpc;
31extern crate google_cloud_type;
32extern crate serde;
33extern crate serde_json;
34extern crate serde_with;
35extern crate std;
36extern crate tracing;
37extern crate wkt;
38
39mod debug;
40mod deserialize;
41mod serialize;
42
43/// Encodes the detailed information of a barcode.
44#[derive(Clone, Default, PartialEq)]
45#[non_exhaustive]
46pub struct Barcode {
47 /// Format of a barcode.
48 /// The supported formats are:
49 ///
50 /// - `CODE_128`: Code 128 type.
51 /// - `CODE_39`: Code 39 type.
52 /// - `CODE_93`: Code 93 type.
53 /// - `CODABAR`: Codabar type.
54 /// - `DATA_MATRIX`: 2D Data Matrix type.
55 /// - `ITF`: ITF type.
56 /// - `EAN_13`: EAN-13 type.
57 /// - `EAN_8`: EAN-8 type.
58 /// - `QR_CODE`: 2D QR code type.
59 /// - `UPC_A`: UPC-A type.
60 /// - `UPC_E`: UPC-E type.
61 /// - `PDF417`: PDF417 type.
62 /// - `AZTEC`: 2D Aztec code type.
63 /// - `DATABAR`: GS1 DataBar code type.
64 pub format: std::string::String,
65
66 /// Value format describes the format of the value that a barcode
67 /// encodes.
68 /// The supported formats are:
69 ///
70 /// - `CONTACT_INFO`: Contact information.
71 /// - `EMAIL`: Email address.
72 /// - `ISBN`: ISBN identifier.
73 /// - `PHONE`: Phone number.
74 /// - `PRODUCT`: Product.
75 /// - `SMS`: SMS message.
76 /// - `TEXT`: Text string.
77 /// - `URL`: URL address.
78 /// - `WIFI`: Wifi information.
79 /// - `GEO`: Geo-localization.
80 /// - `CALENDAR_EVENT`: Calendar event.
81 /// - `DRIVER_LICENSE`: Driver's license.
82 pub value_format: std::string::String,
83
84 /// Raw value encoded in the barcode.
85 /// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com>;;'`.
86 pub raw_value: std::string::String,
87
88 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
89}
90
91impl Barcode {
92 /// Creates a new default instance.
93 pub fn new() -> Self {
94 std::default::Default::default()
95 }
96
97 /// Sets the value of [format][crate::model::Barcode::format].
98 ///
99 /// # Example
100 /// ```ignore,no_run
101 /// # use google_cloud_documentai_v1::model::Barcode;
102 /// let x = Barcode::new().set_format("example");
103 /// ```
104 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
105 self.format = v.into();
106 self
107 }
108
109 /// Sets the value of [value_format][crate::model::Barcode::value_format].
110 ///
111 /// # Example
112 /// ```ignore,no_run
113 /// # use google_cloud_documentai_v1::model::Barcode;
114 /// let x = Barcode::new().set_value_format("example");
115 /// ```
116 pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
117 self.value_format = v.into();
118 self
119 }
120
121 /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
122 ///
123 /// # Example
124 /// ```ignore,no_run
125 /// # use google_cloud_documentai_v1::model::Barcode;
126 /// let x = Barcode::new().set_raw_value("example");
127 /// ```
128 pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
129 self.raw_value = v.into();
130 self
131 }
132}
133
134impl wkt::message::Message for Barcode {
135 fn typename() -> &'static str {
136 "type.googleapis.com/google.cloud.documentai.v1.Barcode"
137 }
138}
139
140/// Document represents the canonical document resource in Document AI. It is an
141/// interchange format that provides insights into documents and allows for
142/// collaboration between users and Document AI to iterate and optimize for
143/// quality.
144#[derive(Clone, Default, PartialEq)]
145#[non_exhaustive]
146pub struct Document {
147 /// Optional. An internal identifier for document. Should be loggable (no PII).
148 pub docid: std::string::String,
149
150 /// An IANA published [media type (MIME
151 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
152 pub mime_type: std::string::String,
153
154 /// Optional. UTF-8 encoded text in reading order from the document.
155 pub text: std::string::String,
156
157 /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
158 ///
159 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
160 #[deprecated]
161 pub text_styles: std::vec::Vec<crate::model::document::Style>,
162
163 /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
164 ///
165 /// [google.cloud.documentai.v1.Document]: crate::model::Document
166 pub pages: std::vec::Vec<crate::model::document::Page>,
167
168 /// A list of entities detected on
169 /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
170 /// shards, entities in this list may cross shard boundaries.
171 ///
172 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
173 pub entities: std::vec::Vec<crate::model::document::Entity>,
174
175 /// Placeholder. Relationship among
176 /// [Document.entities][google.cloud.documentai.v1.Document.entities].
177 ///
178 /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
179 pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
180
181 /// Placeholder. A list of text corrections made to
182 /// [Document.text][google.cloud.documentai.v1.Document.text]. This is usually
183 /// used for annotating corrections to OCR mistakes. Text changes for a given
184 /// revision may not overlap with each other.
185 ///
186 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
187 pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
188
189 /// Information about the sharding if this document is sharded part of a larger
190 /// document. If the document is not sharded, this message is not specified.
191 pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
192
193 /// Any error that occurred while processing this document.
194 pub error: std::option::Option<google_cloud_rpc::model::Status>,
195
196 /// Placeholder. Revision history of this document.
197 pub revisions: std::vec::Vec<crate::model::document::Revision>,
198
199 /// Parsed layout of the document.
200 pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
201
202 /// Document chunked based on chunking config.
203 pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
204
205 /// Optional. The blob assets in this document. This is used to store the
206 /// content of the inline blobs in this document, for example, image bytes,
207 /// such that it can be referenced by other fields in the document via asset
208 /// id.
209 pub blob_assets: std::vec::Vec<crate::model::document::BlobAsset>,
210
211 /// The entity validation output for the document. This is the validation
212 /// output for `document.entities` field.
213 pub entity_validation_output:
214 std::option::Option<crate::model::document::EntityValidationOutput>,
215
216 /// A list of entity revisions. The entity revisions are appended to the
217 /// document in the processing order. This field can be used for comparing the
218 /// entity extraction results at different stages of the processing.
219 pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
220
221 /// The entity revision ID that `document.entities` field is based on.
222 /// If this field is set and `entities_revisions` is not empty, the entities in
223 /// `document.entities` field are the entities in the entity revision with this
224 /// id and `document.entity_validation_output` field is the
225 /// `entity_validation_output` field in this entity revision.
226 pub entities_revision_id: std::string::String,
227
228 /// Original source document from the user.
229 pub source: std::option::Option<crate::model::document::Source>,
230
231 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
232}
233
234impl Document {
235 /// Creates a new default instance.
236 pub fn new() -> Self {
237 std::default::Default::default()
238 }
239
240 /// Sets the value of [docid][crate::model::Document::docid].
241 ///
242 /// # Example
243 /// ```ignore,no_run
244 /// # use google_cloud_documentai_v1::model::Document;
245 /// let x = Document::new().set_docid("example");
246 /// ```
247 pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
248 self.docid = v.into();
249 self
250 }
251
252 /// Sets the value of [mime_type][crate::model::Document::mime_type].
253 ///
254 /// # Example
255 /// ```ignore,no_run
256 /// # use google_cloud_documentai_v1::model::Document;
257 /// let x = Document::new().set_mime_type("example");
258 /// ```
259 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
260 self.mime_type = v.into();
261 self
262 }
263
264 /// Sets the value of [text][crate::model::Document::text].
265 ///
266 /// # Example
267 /// ```ignore,no_run
268 /// # use google_cloud_documentai_v1::model::Document;
269 /// let x = Document::new().set_text("example");
270 /// ```
271 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
272 self.text = v.into();
273 self
274 }
275
276 /// Sets the value of [text_styles][crate::model::Document::text_styles].
277 ///
278 /// # Example
279 /// ```ignore,no_run
280 /// # use google_cloud_documentai_v1::model::Document;
281 /// use google_cloud_documentai_v1::model::document::Style;
282 /// let x = Document::new()
283 /// .set_text_styles([
284 /// Style::default()/* use setters */,
285 /// Style::default()/* use (different) setters */,
286 /// ]);
287 /// ```
288 #[deprecated]
289 pub fn set_text_styles<T, V>(mut self, v: T) -> Self
290 where
291 T: std::iter::IntoIterator<Item = V>,
292 V: std::convert::Into<crate::model::document::Style>,
293 {
294 use std::iter::Iterator;
295 self.text_styles = v.into_iter().map(|i| i.into()).collect();
296 self
297 }
298
299 /// Sets the value of [pages][crate::model::Document::pages].
300 ///
301 /// # Example
302 /// ```ignore,no_run
303 /// # use google_cloud_documentai_v1::model::Document;
304 /// use google_cloud_documentai_v1::model::document::Page;
305 /// let x = Document::new()
306 /// .set_pages([
307 /// Page::default()/* use setters */,
308 /// Page::default()/* use (different) setters */,
309 /// ]);
310 /// ```
311 pub fn set_pages<T, V>(mut self, v: T) -> Self
312 where
313 T: std::iter::IntoIterator<Item = V>,
314 V: std::convert::Into<crate::model::document::Page>,
315 {
316 use std::iter::Iterator;
317 self.pages = v.into_iter().map(|i| i.into()).collect();
318 self
319 }
320
321 /// Sets the value of [entities][crate::model::Document::entities].
322 ///
323 /// # Example
324 /// ```ignore,no_run
325 /// # use google_cloud_documentai_v1::model::Document;
326 /// use google_cloud_documentai_v1::model::document::Entity;
327 /// let x = Document::new()
328 /// .set_entities([
329 /// Entity::default()/* use setters */,
330 /// Entity::default()/* use (different) setters */,
331 /// ]);
332 /// ```
333 pub fn set_entities<T, V>(mut self, v: T) -> Self
334 where
335 T: std::iter::IntoIterator<Item = V>,
336 V: std::convert::Into<crate::model::document::Entity>,
337 {
338 use std::iter::Iterator;
339 self.entities = v.into_iter().map(|i| i.into()).collect();
340 self
341 }
342
343 /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
344 ///
345 /// # Example
346 /// ```ignore,no_run
347 /// # use google_cloud_documentai_v1::model::Document;
348 /// use google_cloud_documentai_v1::model::document::EntityRelation;
349 /// let x = Document::new()
350 /// .set_entity_relations([
351 /// EntityRelation::default()/* use setters */,
352 /// EntityRelation::default()/* use (different) setters */,
353 /// ]);
354 /// ```
355 pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
356 where
357 T: std::iter::IntoIterator<Item = V>,
358 V: std::convert::Into<crate::model::document::EntityRelation>,
359 {
360 use std::iter::Iterator;
361 self.entity_relations = v.into_iter().map(|i| i.into()).collect();
362 self
363 }
364
365 /// Sets the value of [text_changes][crate::model::Document::text_changes].
366 ///
367 /// # Example
368 /// ```ignore,no_run
369 /// # use google_cloud_documentai_v1::model::Document;
370 /// use google_cloud_documentai_v1::model::document::TextChange;
371 /// let x = Document::new()
372 /// .set_text_changes([
373 /// TextChange::default()/* use setters */,
374 /// TextChange::default()/* use (different) setters */,
375 /// ]);
376 /// ```
377 pub fn set_text_changes<T, V>(mut self, v: T) -> Self
378 where
379 T: std::iter::IntoIterator<Item = V>,
380 V: std::convert::Into<crate::model::document::TextChange>,
381 {
382 use std::iter::Iterator;
383 self.text_changes = v.into_iter().map(|i| i.into()).collect();
384 self
385 }
386
387 /// Sets the value of [shard_info][crate::model::Document::shard_info].
388 ///
389 /// # Example
390 /// ```ignore,no_run
391 /// # use google_cloud_documentai_v1::model::Document;
392 /// use google_cloud_documentai_v1::model::document::ShardInfo;
393 /// let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);
394 /// ```
395 pub fn set_shard_info<T>(mut self, v: T) -> Self
396 where
397 T: std::convert::Into<crate::model::document::ShardInfo>,
398 {
399 self.shard_info = std::option::Option::Some(v.into());
400 self
401 }
402
403 /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
404 ///
405 /// # Example
406 /// ```ignore,no_run
407 /// # use google_cloud_documentai_v1::model::Document;
408 /// use google_cloud_documentai_v1::model::document::ShardInfo;
409 /// let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
410 /// let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);
411 /// ```
412 pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
413 where
414 T: std::convert::Into<crate::model::document::ShardInfo>,
415 {
416 self.shard_info = v.map(|x| x.into());
417 self
418 }
419
420 /// Sets the value of [error][crate::model::Document::error].
421 ///
422 /// # Example
423 /// ```ignore,no_run
424 /// # use google_cloud_documentai_v1::model::Document;
425 /// use google_cloud_rpc::model::Status;
426 /// let x = Document::new().set_error(Status::default()/* use setters */);
427 /// ```
428 pub fn set_error<T>(mut self, v: T) -> Self
429 where
430 T: std::convert::Into<google_cloud_rpc::model::Status>,
431 {
432 self.error = std::option::Option::Some(v.into());
433 self
434 }
435
436 /// Sets or clears the value of [error][crate::model::Document::error].
437 ///
438 /// # Example
439 /// ```ignore,no_run
440 /// # use google_cloud_documentai_v1::model::Document;
441 /// use google_cloud_rpc::model::Status;
442 /// let x = Document::new().set_or_clear_error(Some(Status::default()/* use setters */));
443 /// let x = Document::new().set_or_clear_error(None::<Status>);
444 /// ```
445 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
446 where
447 T: std::convert::Into<google_cloud_rpc::model::Status>,
448 {
449 self.error = v.map(|x| x.into());
450 self
451 }
452
453 /// Sets the value of [revisions][crate::model::Document::revisions].
454 ///
455 /// # Example
456 /// ```ignore,no_run
457 /// # use google_cloud_documentai_v1::model::Document;
458 /// use google_cloud_documentai_v1::model::document::Revision;
459 /// let x = Document::new()
460 /// .set_revisions([
461 /// Revision::default()/* use setters */,
462 /// Revision::default()/* use (different) setters */,
463 /// ]);
464 /// ```
465 pub fn set_revisions<T, V>(mut self, v: T) -> Self
466 where
467 T: std::iter::IntoIterator<Item = V>,
468 V: std::convert::Into<crate::model::document::Revision>,
469 {
470 use std::iter::Iterator;
471 self.revisions = v.into_iter().map(|i| i.into()).collect();
472 self
473 }
474
475 /// Sets the value of [document_layout][crate::model::Document::document_layout].
476 ///
477 /// # Example
478 /// ```ignore,no_run
479 /// # use google_cloud_documentai_v1::model::Document;
480 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
481 /// let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);
482 /// ```
483 pub fn set_document_layout<T>(mut self, v: T) -> Self
484 where
485 T: std::convert::Into<crate::model::document::DocumentLayout>,
486 {
487 self.document_layout = std::option::Option::Some(v.into());
488 self
489 }
490
491 /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
492 ///
493 /// # Example
494 /// ```ignore,no_run
495 /// # use google_cloud_documentai_v1::model::Document;
496 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
497 /// let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
498 /// let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);
499 /// ```
500 pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
501 where
502 T: std::convert::Into<crate::model::document::DocumentLayout>,
503 {
504 self.document_layout = v.map(|x| x.into());
505 self
506 }
507
508 /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
509 ///
510 /// # Example
511 /// ```ignore,no_run
512 /// # use google_cloud_documentai_v1::model::Document;
513 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
514 /// let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);
515 /// ```
516 pub fn set_chunked_document<T>(mut self, v: T) -> Self
517 where
518 T: std::convert::Into<crate::model::document::ChunkedDocument>,
519 {
520 self.chunked_document = std::option::Option::Some(v.into());
521 self
522 }
523
524 /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
525 ///
526 /// # Example
527 /// ```ignore,no_run
528 /// # use google_cloud_documentai_v1::model::Document;
529 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
530 /// let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
531 /// let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);
532 /// ```
533 pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
534 where
535 T: std::convert::Into<crate::model::document::ChunkedDocument>,
536 {
537 self.chunked_document = v.map(|x| x.into());
538 self
539 }
540
541 /// Sets the value of [blob_assets][crate::model::Document::blob_assets].
542 ///
543 /// # Example
544 /// ```ignore,no_run
545 /// # use google_cloud_documentai_v1::model::Document;
546 /// use google_cloud_documentai_v1::model::document::BlobAsset;
547 /// let x = Document::new()
548 /// .set_blob_assets([
549 /// BlobAsset::default()/* use setters */,
550 /// BlobAsset::default()/* use (different) setters */,
551 /// ]);
552 /// ```
553 pub fn set_blob_assets<T, V>(mut self, v: T) -> Self
554 where
555 T: std::iter::IntoIterator<Item = V>,
556 V: std::convert::Into<crate::model::document::BlobAsset>,
557 {
558 use std::iter::Iterator;
559 self.blob_assets = v.into_iter().map(|i| i.into()).collect();
560 self
561 }
562
563 /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
564 ///
565 /// # Example
566 /// ```ignore,no_run
567 /// # use google_cloud_documentai_v1::model::Document;
568 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
569 /// let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
570 /// ```
571 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
572 where
573 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
574 {
575 self.entity_validation_output = std::option::Option::Some(v.into());
576 self
577 }
578
579 /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
580 ///
581 /// # Example
582 /// ```ignore,no_run
583 /// # use google_cloud_documentai_v1::model::Document;
584 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
585 /// let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
586 /// let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
587 /// ```
588 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
589 where
590 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
591 {
592 self.entity_validation_output = v.map(|x| x.into());
593 self
594 }
595
596 /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
597 ///
598 /// # Example
599 /// ```ignore,no_run
600 /// # use google_cloud_documentai_v1::model::Document;
601 /// use google_cloud_documentai_v1::model::document::EntitiesRevision;
602 /// let x = Document::new()
603 /// .set_entities_revisions([
604 /// EntitiesRevision::default()/* use setters */,
605 /// EntitiesRevision::default()/* use (different) setters */,
606 /// ]);
607 /// ```
608 pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
609 where
610 T: std::iter::IntoIterator<Item = V>,
611 V: std::convert::Into<crate::model::document::EntitiesRevision>,
612 {
613 use std::iter::Iterator;
614 self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
615 self
616 }
617
618 /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
619 ///
620 /// # Example
621 /// ```ignore,no_run
622 /// # use google_cloud_documentai_v1::model::Document;
623 /// let x = Document::new().set_entities_revision_id("example");
624 /// ```
625 pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
626 mut self,
627 v: T,
628 ) -> Self {
629 self.entities_revision_id = v.into();
630 self
631 }
632
633 /// Sets the value of [source][crate::model::Document::source].
634 ///
635 /// Note that all the setters affecting `source` are mutually
636 /// exclusive.
637 ///
638 /// # Example
639 /// ```ignore,no_run
640 /// # use google_cloud_documentai_v1::model::Document;
641 /// use google_cloud_documentai_v1::model::document::Source;
642 /// let x = Document::new().set_source(Some(Source::Uri("example".to_string())));
643 /// ```
644 pub fn set_source<
645 T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
646 >(
647 mut self,
648 v: T,
649 ) -> Self {
650 self.source = v.into();
651 self
652 }
653
654 /// The value of [source][crate::model::Document::source]
655 /// if it holds a `Uri`, `None` if the field is not set or
656 /// holds a different branch.
657 pub fn uri(&self) -> std::option::Option<&std::string::String> {
658 #[allow(unreachable_patterns)]
659 self.source.as_ref().and_then(|v| match v {
660 crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
661 _ => std::option::Option::None,
662 })
663 }
664
665 /// Sets the value of [source][crate::model::Document::source]
666 /// to hold a `Uri`.
667 ///
668 /// Note that all the setters affecting `source` are
669 /// mutually exclusive.
670 ///
671 /// # Example
672 /// ```ignore,no_run
673 /// # use google_cloud_documentai_v1::model::Document;
674 /// let x = Document::new().set_uri("example");
675 /// assert!(x.uri().is_some());
676 /// assert!(x.content().is_none());
677 /// ```
678 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
679 self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
680 self
681 }
682
683 /// The value of [source][crate::model::Document::source]
684 /// if it holds a `Content`, `None` if the field is not set or
685 /// holds a different branch.
686 pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
687 #[allow(unreachable_patterns)]
688 self.source.as_ref().and_then(|v| match v {
689 crate::model::document::Source::Content(v) => std::option::Option::Some(v),
690 _ => std::option::Option::None,
691 })
692 }
693
694 /// Sets the value of [source][crate::model::Document::source]
695 /// to hold a `Content`.
696 ///
697 /// Note that all the setters affecting `source` are
698 /// mutually exclusive.
699 ///
700 /// # Example
701 /// ```ignore,no_run
702 /// # use google_cloud_documentai_v1::model::Document;
703 /// let x = Document::new().set_content(bytes::Bytes::from_static(b"example"));
704 /// assert!(x.content().is_some());
705 /// assert!(x.uri().is_none());
706 /// ```
707 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
708 self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
709 self
710 }
711}
712
713impl wkt::message::Message for Document {
714 fn typename() -> &'static str {
715 "type.googleapis.com/google.cloud.documentai.v1.Document"
716 }
717}
718
719/// Defines additional types related to [Document].
720pub mod document {
721 #[allow(unused_imports)]
722 use super::*;
723
724 /// For a large document, sharding may be performed to produce several
725 /// document shards. Each document shard contains this field to detail which
726 /// shard it is.
727 #[derive(Clone, Default, PartialEq)]
728 #[non_exhaustive]
729 pub struct ShardInfo {
730 /// The 0-based index of this shard.
731 pub shard_index: i64,
732
733 /// Total number of shards.
734 pub shard_count: i64,
735
736 /// The index of the first character in
737 /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
738 /// document global text.
739 ///
740 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
741 pub text_offset: i64,
742
743 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
744 }
745
746 impl ShardInfo {
747 /// Creates a new default instance.
748 pub fn new() -> Self {
749 std::default::Default::default()
750 }
751
752 /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
753 ///
754 /// # Example
755 /// ```ignore,no_run
756 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
757 /// let x = ShardInfo::new().set_shard_index(42);
758 /// ```
759 pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
760 self.shard_index = v.into();
761 self
762 }
763
764 /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
765 ///
766 /// # Example
767 /// ```ignore,no_run
768 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
769 /// let x = ShardInfo::new().set_shard_count(42);
770 /// ```
771 pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
772 self.shard_count = v.into();
773 self
774 }
775
776 /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
777 ///
778 /// # Example
779 /// ```ignore,no_run
780 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
781 /// let x = ShardInfo::new().set_text_offset(42);
782 /// ```
783 pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
784 self.text_offset = v.into();
785 self
786 }
787 }
788
789 impl wkt::message::Message for ShardInfo {
790 fn typename() -> &'static str {
791 "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
792 }
793 }
794
795 /// Annotation for common text style attributes. This adheres to CSS
796 /// conventions as much as possible.
797 #[derive(Clone, Default, PartialEq)]
798 #[non_exhaustive]
799 pub struct Style {
800 /// Text anchor indexing into the
801 /// [Document.text][google.cloud.documentai.v1.Document.text].
802 ///
803 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
804 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
805
806 /// Text color.
807 pub color: std::option::Option<google_cloud_type::model::Color>,
808
809 /// Text background color.
810 pub background_color: std::option::Option<google_cloud_type::model::Color>,
811
812 /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
813 /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
814 pub font_weight: std::string::String,
815
816 /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
817 /// Possible values are `normal`, `italic`, and `oblique`.
818 pub text_style: std::string::String,
819
820 /// [Text
821 /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
822 /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
823 /// \<text-decoration-style\>
824 pub text_decoration: std::string::String,
825
826 /// Font size.
827 pub font_size: std::option::Option<crate::model::document::style::FontSize>,
828
829 /// Font family such as `Arial`, `Times New Roman`.
830 /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
831 pub font_family: std::string::String,
832
833 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
834 }
835
836 impl Style {
837 /// Creates a new default instance.
838 pub fn new() -> Self {
839 std::default::Default::default()
840 }
841
842 /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
843 ///
844 /// # Example
845 /// ```ignore,no_run
846 /// # use google_cloud_documentai_v1::model::document::Style;
847 /// use google_cloud_documentai_v1::model::document::TextAnchor;
848 /// let x = Style::new().set_text_anchor(TextAnchor::default()/* use setters */);
849 /// ```
850 pub fn set_text_anchor<T>(mut self, v: T) -> Self
851 where
852 T: std::convert::Into<crate::model::document::TextAnchor>,
853 {
854 self.text_anchor = std::option::Option::Some(v.into());
855 self
856 }
857
858 /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
859 ///
860 /// # Example
861 /// ```ignore,no_run
862 /// # use google_cloud_documentai_v1::model::document::Style;
863 /// use google_cloud_documentai_v1::model::document::TextAnchor;
864 /// let x = Style::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
865 /// let x = Style::new().set_or_clear_text_anchor(None::<TextAnchor>);
866 /// ```
867 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
868 where
869 T: std::convert::Into<crate::model::document::TextAnchor>,
870 {
871 self.text_anchor = v.map(|x| x.into());
872 self
873 }
874
875 /// Sets the value of [color][crate::model::document::Style::color].
876 ///
877 /// # Example
878 /// ```ignore,no_run
879 /// # use google_cloud_documentai_v1::model::document::Style;
880 /// use google_cloud_type::model::Color;
881 /// let x = Style::new().set_color(Color::default()/* use setters */);
882 /// ```
883 pub fn set_color<T>(mut self, v: T) -> Self
884 where
885 T: std::convert::Into<google_cloud_type::model::Color>,
886 {
887 self.color = std::option::Option::Some(v.into());
888 self
889 }
890
891 /// Sets or clears the value of [color][crate::model::document::Style::color].
892 ///
893 /// # Example
894 /// ```ignore,no_run
895 /// # use google_cloud_documentai_v1::model::document::Style;
896 /// use google_cloud_type::model::Color;
897 /// let x = Style::new().set_or_clear_color(Some(Color::default()/* use setters */));
898 /// let x = Style::new().set_or_clear_color(None::<Color>);
899 /// ```
900 pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
901 where
902 T: std::convert::Into<google_cloud_type::model::Color>,
903 {
904 self.color = v.map(|x| x.into());
905 self
906 }
907
908 /// Sets the value of [background_color][crate::model::document::Style::background_color].
909 ///
910 /// # Example
911 /// ```ignore,no_run
912 /// # use google_cloud_documentai_v1::model::document::Style;
913 /// use google_cloud_type::model::Color;
914 /// let x = Style::new().set_background_color(Color::default()/* use setters */);
915 /// ```
916 pub fn set_background_color<T>(mut self, v: T) -> Self
917 where
918 T: std::convert::Into<google_cloud_type::model::Color>,
919 {
920 self.background_color = std::option::Option::Some(v.into());
921 self
922 }
923
924 /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
925 ///
926 /// # Example
927 /// ```ignore,no_run
928 /// # use google_cloud_documentai_v1::model::document::Style;
929 /// use google_cloud_type::model::Color;
930 /// let x = Style::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
931 /// let x = Style::new().set_or_clear_background_color(None::<Color>);
932 /// ```
933 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
934 where
935 T: std::convert::Into<google_cloud_type::model::Color>,
936 {
937 self.background_color = v.map(|x| x.into());
938 self
939 }
940
941 /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
942 ///
943 /// # Example
944 /// ```ignore,no_run
945 /// # use google_cloud_documentai_v1::model::document::Style;
946 /// let x = Style::new().set_font_weight("example");
947 /// ```
948 pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
949 self.font_weight = v.into();
950 self
951 }
952
953 /// Sets the value of [text_style][crate::model::document::Style::text_style].
954 ///
955 /// # Example
956 /// ```ignore,no_run
957 /// # use google_cloud_documentai_v1::model::document::Style;
958 /// let x = Style::new().set_text_style("example");
959 /// ```
960 pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
961 self.text_style = v.into();
962 self
963 }
964
965 /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
966 ///
967 /// # Example
968 /// ```ignore,no_run
969 /// # use google_cloud_documentai_v1::model::document::Style;
970 /// let x = Style::new().set_text_decoration("example");
971 /// ```
972 pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
973 mut self,
974 v: T,
975 ) -> Self {
976 self.text_decoration = v.into();
977 self
978 }
979
980 /// Sets the value of [font_size][crate::model::document::Style::font_size].
981 ///
982 /// # Example
983 /// ```ignore,no_run
984 /// # use google_cloud_documentai_v1::model::document::Style;
985 /// use google_cloud_documentai_v1::model::document::style::FontSize;
986 /// let x = Style::new().set_font_size(FontSize::default()/* use setters */);
987 /// ```
988 pub fn set_font_size<T>(mut self, v: T) -> Self
989 where
990 T: std::convert::Into<crate::model::document::style::FontSize>,
991 {
992 self.font_size = std::option::Option::Some(v.into());
993 self
994 }
995
996 /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
997 ///
998 /// # Example
999 /// ```ignore,no_run
1000 /// # use google_cloud_documentai_v1::model::document::Style;
1001 /// use google_cloud_documentai_v1::model::document::style::FontSize;
1002 /// let x = Style::new().set_or_clear_font_size(Some(FontSize::default()/* use setters */));
1003 /// let x = Style::new().set_or_clear_font_size(None::<FontSize>);
1004 /// ```
1005 pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
1006 where
1007 T: std::convert::Into<crate::model::document::style::FontSize>,
1008 {
1009 self.font_size = v.map(|x| x.into());
1010 self
1011 }
1012
1013 /// Sets the value of [font_family][crate::model::document::Style::font_family].
1014 ///
1015 /// # Example
1016 /// ```ignore,no_run
1017 /// # use google_cloud_documentai_v1::model::document::Style;
1018 /// let x = Style::new().set_font_family("example");
1019 /// ```
1020 pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1021 self.font_family = v.into();
1022 self
1023 }
1024 }
1025
1026 impl wkt::message::Message for Style {
1027 fn typename() -> &'static str {
1028 "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
1029 }
1030 }
1031
1032 /// Defines additional types related to [Style].
1033 pub mod style {
1034 #[allow(unused_imports)]
1035 use super::*;
1036
1037 /// Font size with unit.
1038 #[derive(Clone, Default, PartialEq)]
1039 #[non_exhaustive]
1040 pub struct FontSize {
1041 /// Font size for the text.
1042 pub size: f32,
1043
1044 /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
1045 /// `pt`).
1046 pub unit: std::string::String,
1047
1048 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1049 }
1050
1051 impl FontSize {
1052 /// Creates a new default instance.
1053 pub fn new() -> Self {
1054 std::default::Default::default()
1055 }
1056
1057 /// Sets the value of [size][crate::model::document::style::FontSize::size].
1058 ///
1059 /// # Example
1060 /// ```ignore,no_run
1061 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1062 /// let x = FontSize::new().set_size(42.0);
1063 /// ```
1064 pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1065 self.size = v.into();
1066 self
1067 }
1068
1069 /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
1070 ///
1071 /// # Example
1072 /// ```ignore,no_run
1073 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1074 /// let x = FontSize::new().set_unit("example");
1075 /// ```
1076 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1077 self.unit = v.into();
1078 self
1079 }
1080 }
1081
1082 impl wkt::message::Message for FontSize {
1083 fn typename() -> &'static str {
1084 "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
1085 }
1086 }
1087 }
1088
1089 /// A page in a [Document][google.cloud.documentai.v1.Document].
1090 ///
1091 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1092 #[derive(Clone, Default, PartialEq)]
1093 #[non_exhaustive]
1094 pub struct Page {
1095 /// 1-based index for current
1096 /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
1097 /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
1098 /// taken out of a [Document][google.cloud.documentai.v1.Document] for
1099 /// individual processing.
1100 ///
1101 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1102 /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
1103 pub page_number: i32,
1104
1105 /// Rendered image for this page. This image is preprocessed to remove any
1106 /// skew, rotation, and distortions such that the annotation bounding boxes
1107 /// can be upright and axis-aligned.
1108 pub image: std::option::Option<crate::model::document::page::Image>,
1109
1110 /// Transformation matrices that were applied to the original document image
1111 /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
1112 ///
1113 /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
1114 pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
1115
1116 /// Physical dimension of the page.
1117 pub dimension: std::option::Option<crate::model::document::page::Dimension>,
1118
1119 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
1120 ///
1121 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1122 pub layout: std::option::Option<crate::model::document::page::Layout>,
1123
1124 /// A list of detected languages together with confidence.
1125 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1126
1127 /// A list of visually detected text blocks on the page.
1128 /// A block has a set of lines (collected into paragraphs) that have a common
1129 /// line-spacing and orientation.
1130 pub blocks: std::vec::Vec<crate::model::document::page::Block>,
1131
1132 /// A list of visually detected text paragraphs on the page.
1133 /// A collection of lines that a human would perceive as a paragraph.
1134 pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
1135
1136 /// A list of visually detected text lines on the page.
1137 /// A collection of tokens that a human would perceive as a line.
1138 pub lines: std::vec::Vec<crate::model::document::page::Line>,
1139
1140 /// A list of visually detected tokens on the page.
1141 pub tokens: std::vec::Vec<crate::model::document::page::Token>,
1142
1143 /// A list of detected non-text visual elements, for example, checkbox,
1144 /// signature etc. on the page.
1145 pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
1146
1147 /// A list of visually detected tables on the page.
1148 pub tables: std::vec::Vec<crate::model::document::page::Table>,
1149
1150 /// A list of visually detected form fields on the page.
1151 pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
1152
1153 /// A list of visually detected symbols on the page.
1154 pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
1155
1156 /// A list of detected barcodes.
1157 pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
1158
1159 /// Image quality scores.
1160 pub image_quality_scores:
1161 std::option::Option<crate::model::document::page::ImageQualityScores>,
1162
1163 /// The history of this page.
1164 #[deprecated]
1165 pub provenance: std::option::Option<crate::model::document::Provenance>,
1166
1167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1168 }
1169
1170 impl Page {
1171 /// Creates a new default instance.
1172 pub fn new() -> Self {
1173 std::default::Default::default()
1174 }
1175
1176 /// Sets the value of [page_number][crate::model::document::Page::page_number].
1177 ///
1178 /// # Example
1179 /// ```ignore,no_run
1180 /// # use google_cloud_documentai_v1::model::document::Page;
1181 /// let x = Page::new().set_page_number(42);
1182 /// ```
1183 pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1184 self.page_number = v.into();
1185 self
1186 }
1187
1188 /// Sets the value of [image][crate::model::document::Page::image].
1189 ///
1190 /// # Example
1191 /// ```ignore,no_run
1192 /// # use google_cloud_documentai_v1::model::document::Page;
1193 /// use google_cloud_documentai_v1::model::document::page::Image;
1194 /// let x = Page::new().set_image(Image::default()/* use setters */);
1195 /// ```
1196 pub fn set_image<T>(mut self, v: T) -> Self
1197 where
1198 T: std::convert::Into<crate::model::document::page::Image>,
1199 {
1200 self.image = std::option::Option::Some(v.into());
1201 self
1202 }
1203
1204 /// Sets or clears the value of [image][crate::model::document::Page::image].
1205 ///
1206 /// # Example
1207 /// ```ignore,no_run
1208 /// # use google_cloud_documentai_v1::model::document::Page;
1209 /// use google_cloud_documentai_v1::model::document::page::Image;
1210 /// let x = Page::new().set_or_clear_image(Some(Image::default()/* use setters */));
1211 /// let x = Page::new().set_or_clear_image(None::<Image>);
1212 /// ```
1213 pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
1214 where
1215 T: std::convert::Into<crate::model::document::page::Image>,
1216 {
1217 self.image = v.map(|x| x.into());
1218 self
1219 }
1220
1221 /// Sets the value of [transforms][crate::model::document::Page::transforms].
1222 ///
1223 /// # Example
1224 /// ```ignore,no_run
1225 /// # use google_cloud_documentai_v1::model::document::Page;
1226 /// use google_cloud_documentai_v1::model::document::page::Matrix;
1227 /// let x = Page::new()
1228 /// .set_transforms([
1229 /// Matrix::default()/* use setters */,
1230 /// Matrix::default()/* use (different) setters */,
1231 /// ]);
1232 /// ```
1233 pub fn set_transforms<T, V>(mut self, v: T) -> Self
1234 where
1235 T: std::iter::IntoIterator<Item = V>,
1236 V: std::convert::Into<crate::model::document::page::Matrix>,
1237 {
1238 use std::iter::Iterator;
1239 self.transforms = v.into_iter().map(|i| i.into()).collect();
1240 self
1241 }
1242
1243 /// Sets the value of [dimension][crate::model::document::Page::dimension].
1244 ///
1245 /// # Example
1246 /// ```ignore,no_run
1247 /// # use google_cloud_documentai_v1::model::document::Page;
1248 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1249 /// let x = Page::new().set_dimension(Dimension::default()/* use setters */);
1250 /// ```
1251 pub fn set_dimension<T>(mut self, v: T) -> Self
1252 where
1253 T: std::convert::Into<crate::model::document::page::Dimension>,
1254 {
1255 self.dimension = std::option::Option::Some(v.into());
1256 self
1257 }
1258
1259 /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
1260 ///
1261 /// # Example
1262 /// ```ignore,no_run
1263 /// # use google_cloud_documentai_v1::model::document::Page;
1264 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1265 /// let x = Page::new().set_or_clear_dimension(Some(Dimension::default()/* use setters */));
1266 /// let x = Page::new().set_or_clear_dimension(None::<Dimension>);
1267 /// ```
1268 pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
1269 where
1270 T: std::convert::Into<crate::model::document::page::Dimension>,
1271 {
1272 self.dimension = v.map(|x| x.into());
1273 self
1274 }
1275
1276 /// Sets the value of [layout][crate::model::document::Page::layout].
1277 ///
1278 /// # Example
1279 /// ```ignore,no_run
1280 /// # use google_cloud_documentai_v1::model::document::Page;
1281 /// use google_cloud_documentai_v1::model::document::page::Layout;
1282 /// let x = Page::new().set_layout(Layout::default()/* use setters */);
1283 /// ```
1284 pub fn set_layout<T>(mut self, v: T) -> Self
1285 where
1286 T: std::convert::Into<crate::model::document::page::Layout>,
1287 {
1288 self.layout = std::option::Option::Some(v.into());
1289 self
1290 }
1291
1292 /// Sets or clears the value of [layout][crate::model::document::Page::layout].
1293 ///
1294 /// # Example
1295 /// ```ignore,no_run
1296 /// # use google_cloud_documentai_v1::model::document::Page;
1297 /// use google_cloud_documentai_v1::model::document::page::Layout;
1298 /// let x = Page::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
1299 /// let x = Page::new().set_or_clear_layout(None::<Layout>);
1300 /// ```
1301 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1302 where
1303 T: std::convert::Into<crate::model::document::page::Layout>,
1304 {
1305 self.layout = v.map(|x| x.into());
1306 self
1307 }
1308
1309 /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
1310 ///
1311 /// # Example
1312 /// ```ignore,no_run
1313 /// # use google_cloud_documentai_v1::model::document::Page;
1314 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
1315 /// let x = Page::new()
1316 /// .set_detected_languages([
1317 /// DetectedLanguage::default()/* use setters */,
1318 /// DetectedLanguage::default()/* use (different) setters */,
1319 /// ]);
1320 /// ```
1321 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1322 where
1323 T: std::iter::IntoIterator<Item = V>,
1324 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1325 {
1326 use std::iter::Iterator;
1327 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1328 self
1329 }
1330
1331 /// Sets the value of [blocks][crate::model::document::Page::blocks].
1332 ///
1333 /// # Example
1334 /// ```ignore,no_run
1335 /// # use google_cloud_documentai_v1::model::document::Page;
1336 /// use google_cloud_documentai_v1::model::document::page::Block;
1337 /// let x = Page::new()
1338 /// .set_blocks([
1339 /// Block::default()/* use setters */,
1340 /// Block::default()/* use (different) setters */,
1341 /// ]);
1342 /// ```
1343 pub fn set_blocks<T, V>(mut self, v: T) -> Self
1344 where
1345 T: std::iter::IntoIterator<Item = V>,
1346 V: std::convert::Into<crate::model::document::page::Block>,
1347 {
1348 use std::iter::Iterator;
1349 self.blocks = v.into_iter().map(|i| i.into()).collect();
1350 self
1351 }
1352
1353 /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
1354 ///
1355 /// # Example
1356 /// ```ignore,no_run
1357 /// # use google_cloud_documentai_v1::model::document::Page;
1358 /// use google_cloud_documentai_v1::model::document::page::Paragraph;
1359 /// let x = Page::new()
1360 /// .set_paragraphs([
1361 /// Paragraph::default()/* use setters */,
1362 /// Paragraph::default()/* use (different) setters */,
1363 /// ]);
1364 /// ```
1365 pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
1366 where
1367 T: std::iter::IntoIterator<Item = V>,
1368 V: std::convert::Into<crate::model::document::page::Paragraph>,
1369 {
1370 use std::iter::Iterator;
1371 self.paragraphs = v.into_iter().map(|i| i.into()).collect();
1372 self
1373 }
1374
1375 /// Sets the value of [lines][crate::model::document::Page::lines].
1376 ///
1377 /// # Example
1378 /// ```ignore,no_run
1379 /// # use google_cloud_documentai_v1::model::document::Page;
1380 /// use google_cloud_documentai_v1::model::document::page::Line;
1381 /// let x = Page::new()
1382 /// .set_lines([
1383 /// Line::default()/* use setters */,
1384 /// Line::default()/* use (different) setters */,
1385 /// ]);
1386 /// ```
1387 pub fn set_lines<T, V>(mut self, v: T) -> Self
1388 where
1389 T: std::iter::IntoIterator<Item = V>,
1390 V: std::convert::Into<crate::model::document::page::Line>,
1391 {
1392 use std::iter::Iterator;
1393 self.lines = v.into_iter().map(|i| i.into()).collect();
1394 self
1395 }
1396
1397 /// Sets the value of [tokens][crate::model::document::Page::tokens].
1398 ///
1399 /// # Example
1400 /// ```ignore,no_run
1401 /// # use google_cloud_documentai_v1::model::document::Page;
1402 /// use google_cloud_documentai_v1::model::document::page::Token;
1403 /// let x = Page::new()
1404 /// .set_tokens([
1405 /// Token::default()/* use setters */,
1406 /// Token::default()/* use (different) setters */,
1407 /// ]);
1408 /// ```
1409 pub fn set_tokens<T, V>(mut self, v: T) -> Self
1410 where
1411 T: std::iter::IntoIterator<Item = V>,
1412 V: std::convert::Into<crate::model::document::page::Token>,
1413 {
1414 use std::iter::Iterator;
1415 self.tokens = v.into_iter().map(|i| i.into()).collect();
1416 self
1417 }
1418
1419 /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
1420 ///
1421 /// # Example
1422 /// ```ignore,no_run
1423 /// # use google_cloud_documentai_v1::model::document::Page;
1424 /// use google_cloud_documentai_v1::model::document::page::VisualElement;
1425 /// let x = Page::new()
1426 /// .set_visual_elements([
1427 /// VisualElement::default()/* use setters */,
1428 /// VisualElement::default()/* use (different) setters */,
1429 /// ]);
1430 /// ```
1431 pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
1432 where
1433 T: std::iter::IntoIterator<Item = V>,
1434 V: std::convert::Into<crate::model::document::page::VisualElement>,
1435 {
1436 use std::iter::Iterator;
1437 self.visual_elements = v.into_iter().map(|i| i.into()).collect();
1438 self
1439 }
1440
1441 /// Sets the value of [tables][crate::model::document::Page::tables].
1442 ///
1443 /// # Example
1444 /// ```ignore,no_run
1445 /// # use google_cloud_documentai_v1::model::document::Page;
1446 /// use google_cloud_documentai_v1::model::document::page::Table;
1447 /// let x = Page::new()
1448 /// .set_tables([
1449 /// Table::default()/* use setters */,
1450 /// Table::default()/* use (different) setters */,
1451 /// ]);
1452 /// ```
1453 pub fn set_tables<T, V>(mut self, v: T) -> Self
1454 where
1455 T: std::iter::IntoIterator<Item = V>,
1456 V: std::convert::Into<crate::model::document::page::Table>,
1457 {
1458 use std::iter::Iterator;
1459 self.tables = v.into_iter().map(|i| i.into()).collect();
1460 self
1461 }
1462
1463 /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
1464 ///
1465 /// # Example
1466 /// ```ignore,no_run
1467 /// # use google_cloud_documentai_v1::model::document::Page;
1468 /// use google_cloud_documentai_v1::model::document::page::FormField;
1469 /// let x = Page::new()
1470 /// .set_form_fields([
1471 /// FormField::default()/* use setters */,
1472 /// FormField::default()/* use (different) setters */,
1473 /// ]);
1474 /// ```
1475 pub fn set_form_fields<T, V>(mut self, v: T) -> Self
1476 where
1477 T: std::iter::IntoIterator<Item = V>,
1478 V: std::convert::Into<crate::model::document::page::FormField>,
1479 {
1480 use std::iter::Iterator;
1481 self.form_fields = v.into_iter().map(|i| i.into()).collect();
1482 self
1483 }
1484
1485 /// Sets the value of [symbols][crate::model::document::Page::symbols].
1486 ///
1487 /// # Example
1488 /// ```ignore,no_run
1489 /// # use google_cloud_documentai_v1::model::document::Page;
1490 /// use google_cloud_documentai_v1::model::document::page::Symbol;
1491 /// let x = Page::new()
1492 /// .set_symbols([
1493 /// Symbol::default()/* use setters */,
1494 /// Symbol::default()/* use (different) setters */,
1495 /// ]);
1496 /// ```
1497 pub fn set_symbols<T, V>(mut self, v: T) -> Self
1498 where
1499 T: std::iter::IntoIterator<Item = V>,
1500 V: std::convert::Into<crate::model::document::page::Symbol>,
1501 {
1502 use std::iter::Iterator;
1503 self.symbols = v.into_iter().map(|i| i.into()).collect();
1504 self
1505 }
1506
1507 /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
1508 ///
1509 /// # Example
1510 /// ```ignore,no_run
1511 /// # use google_cloud_documentai_v1::model::document::Page;
1512 /// use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
1513 /// let x = Page::new()
1514 /// .set_detected_barcodes([
1515 /// DetectedBarcode::default()/* use setters */,
1516 /// DetectedBarcode::default()/* use (different) setters */,
1517 /// ]);
1518 /// ```
1519 pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
1520 where
1521 T: std::iter::IntoIterator<Item = V>,
1522 V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
1523 {
1524 use std::iter::Iterator;
1525 self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
1526 self
1527 }
1528
1529 /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1530 ///
1531 /// # Example
1532 /// ```ignore,no_run
1533 /// # use google_cloud_documentai_v1::model::document::Page;
1534 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1535 /// let x = Page::new().set_image_quality_scores(ImageQualityScores::default()/* use setters */);
1536 /// ```
1537 pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
1538 where
1539 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1540 {
1541 self.image_quality_scores = std::option::Option::Some(v.into());
1542 self
1543 }
1544
1545 /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1546 ///
1547 /// # Example
1548 /// ```ignore,no_run
1549 /// # use google_cloud_documentai_v1::model::document::Page;
1550 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1551 /// let x = Page::new().set_or_clear_image_quality_scores(Some(ImageQualityScores::default()/* use setters */));
1552 /// let x = Page::new().set_or_clear_image_quality_scores(None::<ImageQualityScores>);
1553 /// ```
1554 pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1555 where
1556 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1557 {
1558 self.image_quality_scores = v.map(|x| x.into());
1559 self
1560 }
1561
1562 /// Sets the value of [provenance][crate::model::document::Page::provenance].
1563 ///
1564 /// # Example
1565 /// ```ignore,no_run
1566 /// # use google_cloud_documentai_v1::model::document::Page;
1567 /// use google_cloud_documentai_v1::model::document::Provenance;
1568 /// let x = Page::new().set_provenance(Provenance::default()/* use setters */);
1569 /// ```
1570 #[deprecated]
1571 pub fn set_provenance<T>(mut self, v: T) -> Self
1572 where
1573 T: std::convert::Into<crate::model::document::Provenance>,
1574 {
1575 self.provenance = std::option::Option::Some(v.into());
1576 self
1577 }
1578
1579 /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
1580 ///
1581 /// # Example
1582 /// ```ignore,no_run
1583 /// # use google_cloud_documentai_v1::model::document::Page;
1584 /// use google_cloud_documentai_v1::model::document::Provenance;
1585 /// let x = Page::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
1586 /// let x = Page::new().set_or_clear_provenance(None::<Provenance>);
1587 /// ```
1588 #[deprecated]
1589 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1590 where
1591 T: std::convert::Into<crate::model::document::Provenance>,
1592 {
1593 self.provenance = v.map(|x| x.into());
1594 self
1595 }
1596 }
1597
1598 impl wkt::message::Message for Page {
1599 fn typename() -> &'static str {
1600 "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1601 }
1602 }
1603
1604 /// Defines additional types related to [Page].
1605 pub mod page {
1606 #[allow(unused_imports)]
1607 use super::*;
1608
1609 /// Dimension for the page.
1610 #[derive(Clone, Default, PartialEq)]
1611 #[non_exhaustive]
1612 pub struct Dimension {
1613 /// Page width.
1614 pub width: f32,
1615
1616 /// Page height.
1617 pub height: f32,
1618
1619 /// Dimension unit.
1620 pub unit: std::string::String,
1621
1622 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1623 }
1624
1625 impl Dimension {
1626 /// Creates a new default instance.
1627 pub fn new() -> Self {
1628 std::default::Default::default()
1629 }
1630
1631 /// Sets the value of [width][crate::model::document::page::Dimension::width].
1632 ///
1633 /// # Example
1634 /// ```ignore,no_run
1635 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1636 /// let x = Dimension::new().set_width(42.0);
1637 /// ```
1638 pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1639 self.width = v.into();
1640 self
1641 }
1642
1643 /// Sets the value of [height][crate::model::document::page::Dimension::height].
1644 ///
1645 /// # Example
1646 /// ```ignore,no_run
1647 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1648 /// let x = Dimension::new().set_height(42.0);
1649 /// ```
1650 pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1651 self.height = v.into();
1652 self
1653 }
1654
1655 /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
1656 ///
1657 /// # Example
1658 /// ```ignore,no_run
1659 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1660 /// let x = Dimension::new().set_unit("example");
1661 /// ```
1662 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1663 self.unit = v.into();
1664 self
1665 }
1666 }
1667
1668 impl wkt::message::Message for Dimension {
1669 fn typename() -> &'static str {
1670 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1671 }
1672 }
1673
1674 /// Rendered image contents for this page.
1675 #[derive(Clone, Default, PartialEq)]
1676 #[non_exhaustive]
1677 pub struct Image {
1678 /// Raw byte content of the image.
1679 pub content: ::bytes::Bytes,
1680
1681 /// Encoding [media type (MIME
1682 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
1683 /// for the image.
1684 pub mime_type: std::string::String,
1685
1686 /// Width of the image in pixels.
1687 pub width: i32,
1688
1689 /// Height of the image in pixels.
1690 pub height: i32,
1691
1692 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1693 }
1694
1695 impl Image {
1696 /// Creates a new default instance.
1697 pub fn new() -> Self {
1698 std::default::Default::default()
1699 }
1700
1701 /// Sets the value of [content][crate::model::document::page::Image::content].
1702 ///
1703 /// # Example
1704 /// ```ignore,no_run
1705 /// # use google_cloud_documentai_v1::model::document::page::Image;
1706 /// let x = Image::new().set_content(bytes::Bytes::from_static(b"example"));
1707 /// ```
1708 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1709 self.content = v.into();
1710 self
1711 }
1712
1713 /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
1714 ///
1715 /// # Example
1716 /// ```ignore,no_run
1717 /// # use google_cloud_documentai_v1::model::document::page::Image;
1718 /// let x = Image::new().set_mime_type("example");
1719 /// ```
1720 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1721 mut self,
1722 v: T,
1723 ) -> Self {
1724 self.mime_type = v.into();
1725 self
1726 }
1727
1728 /// Sets the value of [width][crate::model::document::page::Image::width].
1729 ///
1730 /// # Example
1731 /// ```ignore,no_run
1732 /// # use google_cloud_documentai_v1::model::document::page::Image;
1733 /// let x = Image::new().set_width(42);
1734 /// ```
1735 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1736 self.width = v.into();
1737 self
1738 }
1739
1740 /// Sets the value of [height][crate::model::document::page::Image::height].
1741 ///
1742 /// # Example
1743 /// ```ignore,no_run
1744 /// # use google_cloud_documentai_v1::model::document::page::Image;
1745 /// let x = Image::new().set_height(42);
1746 /// ```
1747 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1748 self.height = v.into();
1749 self
1750 }
1751 }
1752
1753 impl wkt::message::Message for Image {
1754 fn typename() -> &'static str {
1755 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1756 }
1757 }
1758
1759 /// Representation for transformation matrix, intended to be compatible and
1760 /// used with OpenCV format for image manipulation.
1761 #[derive(Clone, Default, PartialEq)]
1762 #[non_exhaustive]
1763 pub struct Matrix {
1764 /// Number of rows in the matrix.
1765 pub rows: i32,
1766
1767 /// Number of columns in the matrix.
1768 pub cols: i32,
1769
1770 /// This encodes information about what data type the matrix uses.
1771 /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
1772 /// of OpenCV primitive data types, please refer to
1773 /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
1774 pub r#type: i32,
1775
1776 /// The matrix data.
1777 pub data: ::bytes::Bytes,
1778
1779 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1780 }
1781
1782 impl Matrix {
1783 /// Creates a new default instance.
1784 pub fn new() -> Self {
1785 std::default::Default::default()
1786 }
1787
1788 /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
1789 ///
1790 /// # Example
1791 /// ```ignore,no_run
1792 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1793 /// let x = Matrix::new().set_rows(42);
1794 /// ```
1795 pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1796 self.rows = v.into();
1797 self
1798 }
1799
1800 /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
1801 ///
1802 /// # Example
1803 /// ```ignore,no_run
1804 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1805 /// let x = Matrix::new().set_cols(42);
1806 /// ```
1807 pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1808 self.cols = v.into();
1809 self
1810 }
1811
1812 /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
1813 ///
1814 /// # Example
1815 /// ```ignore,no_run
1816 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1817 /// let x = Matrix::new().set_type(42);
1818 /// ```
1819 pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1820 self.r#type = v.into();
1821 self
1822 }
1823
1824 /// Sets the value of [data][crate::model::document::page::Matrix::data].
1825 ///
1826 /// # Example
1827 /// ```ignore,no_run
1828 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1829 /// let x = Matrix::new().set_data(bytes::Bytes::from_static(b"example"));
1830 /// ```
1831 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1832 self.data = v.into();
1833 self
1834 }
1835 }
1836
1837 impl wkt::message::Message for Matrix {
1838 fn typename() -> &'static str {
1839 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1840 }
1841 }
1842
1843 /// Visual element describing a layout unit on a page.
1844 #[derive(Clone, Default, PartialEq)]
1845 #[non_exhaustive]
1846 pub struct Layout {
1847 /// Text anchor indexing into the
1848 /// [Document.text][google.cloud.documentai.v1.Document.text].
1849 ///
1850 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
1851 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1852
1853 /// Confidence of the current
1854 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
1855 /// context of the object this layout is for. For example, confidence can
1856 /// be for a single token, a table, a visual element, etc. depending on
1857 /// context. Range `[0, 1]`.
1858 ///
1859 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1860 pub confidence: f32,
1861
1862 /// The bounding polygon for the
1863 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1864 ///
1865 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1866 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1867
1868 /// Detected orientation for the
1869 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1870 ///
1871 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1872 pub orientation: crate::model::document::page::layout::Orientation,
1873
1874 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1875 }
1876
1877 impl Layout {
1878 /// Creates a new default instance.
1879 pub fn new() -> Self {
1880 std::default::Default::default()
1881 }
1882
1883 /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1884 ///
1885 /// # Example
1886 /// ```ignore,no_run
1887 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1888 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1889 /// let x = Layout::new().set_text_anchor(TextAnchor::default()/* use setters */);
1890 /// ```
1891 pub fn set_text_anchor<T>(mut self, v: T) -> Self
1892 where
1893 T: std::convert::Into<crate::model::document::TextAnchor>,
1894 {
1895 self.text_anchor = std::option::Option::Some(v.into());
1896 self
1897 }
1898
1899 /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1900 ///
1901 /// # Example
1902 /// ```ignore,no_run
1903 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1904 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1905 /// let x = Layout::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
1906 /// let x = Layout::new().set_or_clear_text_anchor(None::<TextAnchor>);
1907 /// ```
1908 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1909 where
1910 T: std::convert::Into<crate::model::document::TextAnchor>,
1911 {
1912 self.text_anchor = v.map(|x| x.into());
1913 self
1914 }
1915
1916 /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
1917 ///
1918 /// # Example
1919 /// ```ignore,no_run
1920 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1921 /// let x = Layout::new().set_confidence(42.0);
1922 /// ```
1923 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1924 self.confidence = v.into();
1925 self
1926 }
1927
1928 /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1929 ///
1930 /// # Example
1931 /// ```ignore,no_run
1932 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1933 /// use google_cloud_documentai_v1::model::BoundingPoly;
1934 /// let x = Layout::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
1935 /// ```
1936 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1937 where
1938 T: std::convert::Into<crate::model::BoundingPoly>,
1939 {
1940 self.bounding_poly = std::option::Option::Some(v.into());
1941 self
1942 }
1943
1944 /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1945 ///
1946 /// # Example
1947 /// ```ignore,no_run
1948 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1949 /// use google_cloud_documentai_v1::model::BoundingPoly;
1950 /// let x = Layout::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
1951 /// let x = Layout::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
1952 /// ```
1953 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1954 where
1955 T: std::convert::Into<crate::model::BoundingPoly>,
1956 {
1957 self.bounding_poly = v.map(|x| x.into());
1958 self
1959 }
1960
1961 /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
1962 ///
1963 /// # Example
1964 /// ```ignore,no_run
1965 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1966 /// use google_cloud_documentai_v1::model::document::page::layout::Orientation;
1967 /// let x0 = Layout::new().set_orientation(Orientation::PageUp);
1968 /// let x1 = Layout::new().set_orientation(Orientation::PageRight);
1969 /// let x2 = Layout::new().set_orientation(Orientation::PageDown);
1970 /// ```
1971 pub fn set_orientation<
1972 T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1973 >(
1974 mut self,
1975 v: T,
1976 ) -> Self {
1977 self.orientation = v.into();
1978 self
1979 }
1980 }
1981
1982 impl wkt::message::Message for Layout {
1983 fn typename() -> &'static str {
1984 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1985 }
1986 }
1987
1988 /// Defines additional types related to [Layout].
1989 pub mod layout {
1990 #[allow(unused_imports)]
1991 use super::*;
1992
1993 /// Detected human reading orientation.
1994 ///
1995 /// # Working with unknown values
1996 ///
1997 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1998 /// additional enum variants at any time. Adding new variants is not considered
1999 /// a breaking change. Applications should write their code in anticipation of:
2000 ///
2001 /// - New values appearing in future releases of the client library, **and**
2002 /// - New values received dynamically, without application changes.
2003 ///
2004 /// Please consult the [Working with enums] section in the user guide for some
2005 /// guidelines.
2006 ///
2007 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2008 #[derive(Clone, Debug, PartialEq)]
2009 #[non_exhaustive]
2010 pub enum Orientation {
2011 /// Unspecified orientation.
2012 Unspecified,
2013 /// Orientation is aligned with page up.
2014 PageUp,
2015 /// Orientation is aligned with page right.
2016 /// Turn the head 90 degrees clockwise from upright to read.
2017 PageRight,
2018 /// Orientation is aligned with page down.
2019 /// Turn the head 180 degrees from upright to read.
2020 PageDown,
2021 /// Orientation is aligned with page left.
2022 /// Turn the head 90 degrees counterclockwise from upright to read.
2023 PageLeft,
2024 /// If set, the enum was initialized with an unknown value.
2025 ///
2026 /// Applications can examine the value using [Orientation::value] or
2027 /// [Orientation::name].
2028 UnknownValue(orientation::UnknownValue),
2029 }
2030
2031 #[doc(hidden)]
2032 pub mod orientation {
2033 #[allow(unused_imports)]
2034 use super::*;
2035 #[derive(Clone, Debug, PartialEq)]
2036 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2037 }
2038
2039 impl Orientation {
2040 /// Gets the enum value.
2041 ///
2042 /// Returns `None` if the enum contains an unknown value deserialized from
2043 /// the string representation of enums.
2044 pub fn value(&self) -> std::option::Option<i32> {
2045 match self {
2046 Self::Unspecified => std::option::Option::Some(0),
2047 Self::PageUp => std::option::Option::Some(1),
2048 Self::PageRight => std::option::Option::Some(2),
2049 Self::PageDown => std::option::Option::Some(3),
2050 Self::PageLeft => std::option::Option::Some(4),
2051 Self::UnknownValue(u) => u.0.value(),
2052 }
2053 }
2054
2055 /// Gets the enum value as a string.
2056 ///
2057 /// Returns `None` if the enum contains an unknown value deserialized from
2058 /// the integer representation of enums.
2059 pub fn name(&self) -> std::option::Option<&str> {
2060 match self {
2061 Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
2062 Self::PageUp => std::option::Option::Some("PAGE_UP"),
2063 Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
2064 Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
2065 Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
2066 Self::UnknownValue(u) => u.0.name(),
2067 }
2068 }
2069 }
2070
2071 impl std::default::Default for Orientation {
2072 fn default() -> Self {
2073 use std::convert::From;
2074 Self::from(0)
2075 }
2076 }
2077
2078 impl std::fmt::Display for Orientation {
2079 fn fmt(
2080 &self,
2081 f: &mut std::fmt::Formatter<'_>,
2082 ) -> std::result::Result<(), std::fmt::Error> {
2083 wkt::internal::display_enum(f, self.name(), self.value())
2084 }
2085 }
2086
2087 impl std::convert::From<i32> for Orientation {
2088 fn from(value: i32) -> Self {
2089 match value {
2090 0 => Self::Unspecified,
2091 1 => Self::PageUp,
2092 2 => Self::PageRight,
2093 3 => Self::PageDown,
2094 4 => Self::PageLeft,
2095 _ => Self::UnknownValue(orientation::UnknownValue(
2096 wkt::internal::UnknownEnumValue::Integer(value),
2097 )),
2098 }
2099 }
2100 }
2101
2102 impl std::convert::From<&str> for Orientation {
2103 fn from(value: &str) -> Self {
2104 use std::string::ToString;
2105 match value {
2106 "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
2107 "PAGE_UP" => Self::PageUp,
2108 "PAGE_RIGHT" => Self::PageRight,
2109 "PAGE_DOWN" => Self::PageDown,
2110 "PAGE_LEFT" => Self::PageLeft,
2111 _ => Self::UnknownValue(orientation::UnknownValue(
2112 wkt::internal::UnknownEnumValue::String(value.to_string()),
2113 )),
2114 }
2115 }
2116 }
2117
2118 impl serde::ser::Serialize for Orientation {
2119 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2120 where
2121 S: serde::Serializer,
2122 {
2123 match self {
2124 Self::Unspecified => serializer.serialize_i32(0),
2125 Self::PageUp => serializer.serialize_i32(1),
2126 Self::PageRight => serializer.serialize_i32(2),
2127 Self::PageDown => serializer.serialize_i32(3),
2128 Self::PageLeft => serializer.serialize_i32(4),
2129 Self::UnknownValue(u) => u.0.serialize(serializer),
2130 }
2131 }
2132 }
2133
2134 impl<'de> serde::de::Deserialize<'de> for Orientation {
2135 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2136 where
2137 D: serde::Deserializer<'de>,
2138 {
2139 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
2140 ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
2141 ))
2142 }
2143 }
2144 }
2145
2146 /// A block has a set of lines (collected into paragraphs) that have a
2147 /// common line-spacing and orientation.
2148 #[derive(Clone, Default, PartialEq)]
2149 #[non_exhaustive]
2150 pub struct Block {
2151 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2152 /// [Block][google.cloud.documentai.v1.Document.Page.Block].
2153 ///
2154 /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
2155 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2156 pub layout: std::option::Option<crate::model::document::page::Layout>,
2157
2158 /// A list of detected languages together with confidence.
2159 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2160
2161 /// The history of this annotation.
2162 #[deprecated]
2163 pub provenance: std::option::Option<crate::model::document::Provenance>,
2164
2165 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2166 }
2167
2168 impl Block {
2169 /// Creates a new default instance.
2170 pub fn new() -> Self {
2171 std::default::Default::default()
2172 }
2173
2174 /// Sets the value of [layout][crate::model::document::page::Block::layout].
2175 ///
2176 /// # Example
2177 /// ```ignore,no_run
2178 /// # use google_cloud_documentai_v1::model::document::page::Block;
2179 /// use google_cloud_documentai_v1::model::document::page::Layout;
2180 /// let x = Block::new().set_layout(Layout::default()/* use setters */);
2181 /// ```
2182 pub fn set_layout<T>(mut self, v: T) -> Self
2183 where
2184 T: std::convert::Into<crate::model::document::page::Layout>,
2185 {
2186 self.layout = std::option::Option::Some(v.into());
2187 self
2188 }
2189
2190 /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
2191 ///
2192 /// # Example
2193 /// ```ignore,no_run
2194 /// # use google_cloud_documentai_v1::model::document::page::Block;
2195 /// use google_cloud_documentai_v1::model::document::page::Layout;
2196 /// let x = Block::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2197 /// let x = Block::new().set_or_clear_layout(None::<Layout>);
2198 /// ```
2199 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2200 where
2201 T: std::convert::Into<crate::model::document::page::Layout>,
2202 {
2203 self.layout = v.map(|x| x.into());
2204 self
2205 }
2206
2207 /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
2208 ///
2209 /// # Example
2210 /// ```ignore,no_run
2211 /// # use google_cloud_documentai_v1::model::document::page::Block;
2212 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2213 /// let x = Block::new()
2214 /// .set_detected_languages([
2215 /// DetectedLanguage::default()/* use setters */,
2216 /// DetectedLanguage::default()/* use (different) setters */,
2217 /// ]);
2218 /// ```
2219 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2220 where
2221 T: std::iter::IntoIterator<Item = V>,
2222 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2223 {
2224 use std::iter::Iterator;
2225 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2226 self
2227 }
2228
2229 /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
2230 ///
2231 /// # Example
2232 /// ```ignore,no_run
2233 /// # use google_cloud_documentai_v1::model::document::page::Block;
2234 /// use google_cloud_documentai_v1::model::document::Provenance;
2235 /// let x = Block::new().set_provenance(Provenance::default()/* use setters */);
2236 /// ```
2237 #[deprecated]
2238 pub fn set_provenance<T>(mut self, v: T) -> Self
2239 where
2240 T: std::convert::Into<crate::model::document::Provenance>,
2241 {
2242 self.provenance = std::option::Option::Some(v.into());
2243 self
2244 }
2245
2246 /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
2247 ///
2248 /// # Example
2249 /// ```ignore,no_run
2250 /// # use google_cloud_documentai_v1::model::document::page::Block;
2251 /// use google_cloud_documentai_v1::model::document::Provenance;
2252 /// let x = Block::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2253 /// let x = Block::new().set_or_clear_provenance(None::<Provenance>);
2254 /// ```
2255 #[deprecated]
2256 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2257 where
2258 T: std::convert::Into<crate::model::document::Provenance>,
2259 {
2260 self.provenance = v.map(|x| x.into());
2261 self
2262 }
2263 }
2264
2265 impl wkt::message::Message for Block {
2266 fn typename() -> &'static str {
2267 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
2268 }
2269 }
2270
2271 /// A collection of lines that a human would perceive as a paragraph.
2272 #[derive(Clone, Default, PartialEq)]
2273 #[non_exhaustive]
2274 pub struct Paragraph {
2275 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2276 /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
2277 ///
2278 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2279 /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
2280 pub layout: std::option::Option<crate::model::document::page::Layout>,
2281
2282 /// A list of detected languages together with confidence.
2283 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2284
2285 /// The history of this annotation.
2286 #[deprecated]
2287 pub provenance: std::option::Option<crate::model::document::Provenance>,
2288
2289 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2290 }
2291
2292 impl Paragraph {
2293 /// Creates a new default instance.
2294 pub fn new() -> Self {
2295 std::default::Default::default()
2296 }
2297
2298 /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
2299 ///
2300 /// # Example
2301 /// ```ignore,no_run
2302 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2303 /// use google_cloud_documentai_v1::model::document::page::Layout;
2304 /// let x = Paragraph::new().set_layout(Layout::default()/* use setters */);
2305 /// ```
2306 pub fn set_layout<T>(mut self, v: T) -> Self
2307 where
2308 T: std::convert::Into<crate::model::document::page::Layout>,
2309 {
2310 self.layout = std::option::Option::Some(v.into());
2311 self
2312 }
2313
2314 /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
2315 ///
2316 /// # Example
2317 /// ```ignore,no_run
2318 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2319 /// use google_cloud_documentai_v1::model::document::page::Layout;
2320 /// let x = Paragraph::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2321 /// let x = Paragraph::new().set_or_clear_layout(None::<Layout>);
2322 /// ```
2323 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2324 where
2325 T: std::convert::Into<crate::model::document::page::Layout>,
2326 {
2327 self.layout = v.map(|x| x.into());
2328 self
2329 }
2330
2331 /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
2332 ///
2333 /// # Example
2334 /// ```ignore,no_run
2335 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2336 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2337 /// let x = Paragraph::new()
2338 /// .set_detected_languages([
2339 /// DetectedLanguage::default()/* use setters */,
2340 /// DetectedLanguage::default()/* use (different) setters */,
2341 /// ]);
2342 /// ```
2343 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2344 where
2345 T: std::iter::IntoIterator<Item = V>,
2346 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2347 {
2348 use std::iter::Iterator;
2349 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2350 self
2351 }
2352
2353 /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
2354 ///
2355 /// # Example
2356 /// ```ignore,no_run
2357 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2358 /// use google_cloud_documentai_v1::model::document::Provenance;
2359 /// let x = Paragraph::new().set_provenance(Provenance::default()/* use setters */);
2360 /// ```
2361 #[deprecated]
2362 pub fn set_provenance<T>(mut self, v: T) -> Self
2363 where
2364 T: std::convert::Into<crate::model::document::Provenance>,
2365 {
2366 self.provenance = std::option::Option::Some(v.into());
2367 self
2368 }
2369
2370 /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
2371 ///
2372 /// # Example
2373 /// ```ignore,no_run
2374 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2375 /// use google_cloud_documentai_v1::model::document::Provenance;
2376 /// let x = Paragraph::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2377 /// let x = Paragraph::new().set_or_clear_provenance(None::<Provenance>);
2378 /// ```
2379 #[deprecated]
2380 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2381 where
2382 T: std::convert::Into<crate::model::document::Provenance>,
2383 {
2384 self.provenance = v.map(|x| x.into());
2385 self
2386 }
2387 }
2388
2389 impl wkt::message::Message for Paragraph {
2390 fn typename() -> &'static str {
2391 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
2392 }
2393 }
2394
2395 /// A collection of tokens that a human would perceive as a line.
2396 /// Does not cross column boundaries, can be horizontal, vertical, etc.
2397 #[derive(Clone, Default, PartialEq)]
2398 #[non_exhaustive]
2399 pub struct Line {
2400 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2401 /// [Line][google.cloud.documentai.v1.Document.Page.Line].
2402 ///
2403 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2404 /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
2405 pub layout: std::option::Option<crate::model::document::page::Layout>,
2406
2407 /// A list of detected languages together with confidence.
2408 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2409
2410 /// The history of this annotation.
2411 #[deprecated]
2412 pub provenance: std::option::Option<crate::model::document::Provenance>,
2413
2414 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2415 }
2416
2417 impl Line {
2418 /// Creates a new default instance.
2419 pub fn new() -> Self {
2420 std::default::Default::default()
2421 }
2422
2423 /// Sets the value of [layout][crate::model::document::page::Line::layout].
2424 ///
2425 /// # Example
2426 /// ```ignore,no_run
2427 /// # use google_cloud_documentai_v1::model::document::page::Line;
2428 /// use google_cloud_documentai_v1::model::document::page::Layout;
2429 /// let x = Line::new().set_layout(Layout::default()/* use setters */);
2430 /// ```
2431 pub fn set_layout<T>(mut self, v: T) -> Self
2432 where
2433 T: std::convert::Into<crate::model::document::page::Layout>,
2434 {
2435 self.layout = std::option::Option::Some(v.into());
2436 self
2437 }
2438
2439 /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
2440 ///
2441 /// # Example
2442 /// ```ignore,no_run
2443 /// # use google_cloud_documentai_v1::model::document::page::Line;
2444 /// use google_cloud_documentai_v1::model::document::page::Layout;
2445 /// let x = Line::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2446 /// let x = Line::new().set_or_clear_layout(None::<Layout>);
2447 /// ```
2448 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2449 where
2450 T: std::convert::Into<crate::model::document::page::Layout>,
2451 {
2452 self.layout = v.map(|x| x.into());
2453 self
2454 }
2455
2456 /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
2457 ///
2458 /// # Example
2459 /// ```ignore,no_run
2460 /// # use google_cloud_documentai_v1::model::document::page::Line;
2461 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2462 /// let x = Line::new()
2463 /// .set_detected_languages([
2464 /// DetectedLanguage::default()/* use setters */,
2465 /// DetectedLanguage::default()/* use (different) setters */,
2466 /// ]);
2467 /// ```
2468 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2469 where
2470 T: std::iter::IntoIterator<Item = V>,
2471 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2472 {
2473 use std::iter::Iterator;
2474 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2475 self
2476 }
2477
2478 /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
2479 ///
2480 /// # Example
2481 /// ```ignore,no_run
2482 /// # use google_cloud_documentai_v1::model::document::page::Line;
2483 /// use google_cloud_documentai_v1::model::document::Provenance;
2484 /// let x = Line::new().set_provenance(Provenance::default()/* use setters */);
2485 /// ```
2486 #[deprecated]
2487 pub fn set_provenance<T>(mut self, v: T) -> Self
2488 where
2489 T: std::convert::Into<crate::model::document::Provenance>,
2490 {
2491 self.provenance = std::option::Option::Some(v.into());
2492 self
2493 }
2494
2495 /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
2496 ///
2497 /// # Example
2498 /// ```ignore,no_run
2499 /// # use google_cloud_documentai_v1::model::document::page::Line;
2500 /// use google_cloud_documentai_v1::model::document::Provenance;
2501 /// let x = Line::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2502 /// let x = Line::new().set_or_clear_provenance(None::<Provenance>);
2503 /// ```
2504 #[deprecated]
2505 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2506 where
2507 T: std::convert::Into<crate::model::document::Provenance>,
2508 {
2509 self.provenance = v.map(|x| x.into());
2510 self
2511 }
2512 }
2513
2514 impl wkt::message::Message for Line {
2515 fn typename() -> &'static str {
2516 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
2517 }
2518 }
2519
2520 /// A detected token.
2521 #[derive(Clone, Default, PartialEq)]
2522 #[non_exhaustive]
2523 pub struct Token {
2524 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2525 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2526 ///
2527 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2528 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2529 pub layout: std::option::Option<crate::model::document::page::Layout>,
2530
2531 /// Detected break at the end of a
2532 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2533 ///
2534 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2535 pub detected_break:
2536 std::option::Option<crate::model::document::page::token::DetectedBreak>,
2537
2538 /// A list of detected languages together with confidence.
2539 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2540
2541 /// The history of this annotation.
2542 #[deprecated]
2543 pub provenance: std::option::Option<crate::model::document::Provenance>,
2544
2545 /// Text style attributes.
2546 pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
2547
2548 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2549 }
2550
2551 impl Token {
2552 /// Creates a new default instance.
2553 pub fn new() -> Self {
2554 std::default::Default::default()
2555 }
2556
2557 /// Sets the value of [layout][crate::model::document::page::Token::layout].
2558 ///
2559 /// # Example
2560 /// ```ignore,no_run
2561 /// # use google_cloud_documentai_v1::model::document::page::Token;
2562 /// use google_cloud_documentai_v1::model::document::page::Layout;
2563 /// let x = Token::new().set_layout(Layout::default()/* use setters */);
2564 /// ```
2565 pub fn set_layout<T>(mut self, v: T) -> Self
2566 where
2567 T: std::convert::Into<crate::model::document::page::Layout>,
2568 {
2569 self.layout = std::option::Option::Some(v.into());
2570 self
2571 }
2572
2573 /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
2574 ///
2575 /// # Example
2576 /// ```ignore,no_run
2577 /// # use google_cloud_documentai_v1::model::document::page::Token;
2578 /// use google_cloud_documentai_v1::model::document::page::Layout;
2579 /// let x = Token::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2580 /// let x = Token::new().set_or_clear_layout(None::<Layout>);
2581 /// ```
2582 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2583 where
2584 T: std::convert::Into<crate::model::document::page::Layout>,
2585 {
2586 self.layout = v.map(|x| x.into());
2587 self
2588 }
2589
2590 /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
2591 ///
2592 /// # Example
2593 /// ```ignore,no_run
2594 /// # use google_cloud_documentai_v1::model::document::page::Token;
2595 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2596 /// let x = Token::new().set_detected_break(DetectedBreak::default()/* use setters */);
2597 /// ```
2598 pub fn set_detected_break<T>(mut self, v: T) -> Self
2599 where
2600 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2601 {
2602 self.detected_break = std::option::Option::Some(v.into());
2603 self
2604 }
2605
2606 /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
2607 ///
2608 /// # Example
2609 /// ```ignore,no_run
2610 /// # use google_cloud_documentai_v1::model::document::page::Token;
2611 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2612 /// let x = Token::new().set_or_clear_detected_break(Some(DetectedBreak::default()/* use setters */));
2613 /// let x = Token::new().set_or_clear_detected_break(None::<DetectedBreak>);
2614 /// ```
2615 pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
2616 where
2617 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2618 {
2619 self.detected_break = v.map(|x| x.into());
2620 self
2621 }
2622
2623 /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
2624 ///
2625 /// # Example
2626 /// ```ignore,no_run
2627 /// # use google_cloud_documentai_v1::model::document::page::Token;
2628 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2629 /// let x = Token::new()
2630 /// .set_detected_languages([
2631 /// DetectedLanguage::default()/* use setters */,
2632 /// DetectedLanguage::default()/* use (different) setters */,
2633 /// ]);
2634 /// ```
2635 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2636 where
2637 T: std::iter::IntoIterator<Item = V>,
2638 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2639 {
2640 use std::iter::Iterator;
2641 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2642 self
2643 }
2644
2645 /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
2646 ///
2647 /// # Example
2648 /// ```ignore,no_run
2649 /// # use google_cloud_documentai_v1::model::document::page::Token;
2650 /// use google_cloud_documentai_v1::model::document::Provenance;
2651 /// let x = Token::new().set_provenance(Provenance::default()/* use setters */);
2652 /// ```
2653 #[deprecated]
2654 pub fn set_provenance<T>(mut self, v: T) -> Self
2655 where
2656 T: std::convert::Into<crate::model::document::Provenance>,
2657 {
2658 self.provenance = std::option::Option::Some(v.into());
2659 self
2660 }
2661
2662 /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
2663 ///
2664 /// # Example
2665 /// ```ignore,no_run
2666 /// # use google_cloud_documentai_v1::model::document::page::Token;
2667 /// use google_cloud_documentai_v1::model::document::Provenance;
2668 /// let x = Token::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2669 /// let x = Token::new().set_or_clear_provenance(None::<Provenance>);
2670 /// ```
2671 #[deprecated]
2672 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2673 where
2674 T: std::convert::Into<crate::model::document::Provenance>,
2675 {
2676 self.provenance = v.map(|x| x.into());
2677 self
2678 }
2679
2680 /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
2681 ///
2682 /// # Example
2683 /// ```ignore,no_run
2684 /// # use google_cloud_documentai_v1::model::document::page::Token;
2685 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2686 /// let x = Token::new().set_style_info(StyleInfo::default()/* use setters */);
2687 /// ```
2688 pub fn set_style_info<T>(mut self, v: T) -> Self
2689 where
2690 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2691 {
2692 self.style_info = std::option::Option::Some(v.into());
2693 self
2694 }
2695
2696 /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
2697 ///
2698 /// # Example
2699 /// ```ignore,no_run
2700 /// # use google_cloud_documentai_v1::model::document::page::Token;
2701 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2702 /// let x = Token::new().set_or_clear_style_info(Some(StyleInfo::default()/* use setters */));
2703 /// let x = Token::new().set_or_clear_style_info(None::<StyleInfo>);
2704 /// ```
2705 pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
2706 where
2707 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2708 {
2709 self.style_info = v.map(|x| x.into());
2710 self
2711 }
2712 }
2713
2714 impl wkt::message::Message for Token {
2715 fn typename() -> &'static str {
2716 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
2717 }
2718 }
2719
2720 /// Defines additional types related to [Token].
2721 pub mod token {
2722 #[allow(unused_imports)]
2723 use super::*;
2724
2725 /// Detected break at the end of a
2726 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2727 ///
2728 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2729 #[derive(Clone, Default, PartialEq)]
2730 #[non_exhaustive]
2731 pub struct DetectedBreak {
2732 /// Detected break type.
2733 pub r#type: crate::model::document::page::token::detected_break::Type,
2734
2735 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2736 }
2737
2738 impl DetectedBreak {
2739 /// Creates a new default instance.
2740 pub fn new() -> Self {
2741 std::default::Default::default()
2742 }
2743
2744 /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
2745 ///
2746 /// # Example
2747 /// ```ignore,no_run
2748 /// # use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2749 /// use google_cloud_documentai_v1::model::document::page::token::detected_break::Type;
2750 /// let x0 = DetectedBreak::new().set_type(Type::Space);
2751 /// let x1 = DetectedBreak::new().set_type(Type::WideSpace);
2752 /// let x2 = DetectedBreak::new().set_type(Type::Hyphen);
2753 /// ```
2754 pub fn set_type<
2755 T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
2756 >(
2757 mut self,
2758 v: T,
2759 ) -> Self {
2760 self.r#type = v.into();
2761 self
2762 }
2763 }
2764
2765 impl wkt::message::Message for DetectedBreak {
2766 fn typename() -> &'static str {
2767 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
2768 }
2769 }
2770
2771 /// Defines additional types related to [DetectedBreak].
2772 pub mod detected_break {
2773 #[allow(unused_imports)]
2774 use super::*;
2775
2776 /// Enum to denote the type of break found.
2777 ///
2778 /// # Working with unknown values
2779 ///
2780 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2781 /// additional enum variants at any time. Adding new variants is not considered
2782 /// a breaking change. Applications should write their code in anticipation of:
2783 ///
2784 /// - New values appearing in future releases of the client library, **and**
2785 /// - New values received dynamically, without application changes.
2786 ///
2787 /// Please consult the [Working with enums] section in the user guide for some
2788 /// guidelines.
2789 ///
2790 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2791 #[derive(Clone, Debug, PartialEq)]
2792 #[non_exhaustive]
2793 pub enum Type {
2794 /// Unspecified break type.
2795 Unspecified,
2796 /// A single whitespace.
2797 Space,
2798 /// A wider whitespace.
2799 WideSpace,
2800 /// A hyphen that indicates that a token has been split across lines.
2801 Hyphen,
2802 /// If set, the enum was initialized with an unknown value.
2803 ///
2804 /// Applications can examine the value using [Type::value] or
2805 /// [Type::name].
2806 UnknownValue(r#type::UnknownValue),
2807 }
2808
2809 #[doc(hidden)]
2810 pub mod r#type {
2811 #[allow(unused_imports)]
2812 use super::*;
2813 #[derive(Clone, Debug, PartialEq)]
2814 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2815 }
2816
2817 impl Type {
2818 /// Gets the enum value.
2819 ///
2820 /// Returns `None` if the enum contains an unknown value deserialized from
2821 /// the string representation of enums.
2822 pub fn value(&self) -> std::option::Option<i32> {
2823 match self {
2824 Self::Unspecified => std::option::Option::Some(0),
2825 Self::Space => std::option::Option::Some(1),
2826 Self::WideSpace => std::option::Option::Some(2),
2827 Self::Hyphen => std::option::Option::Some(3),
2828 Self::UnknownValue(u) => u.0.value(),
2829 }
2830 }
2831
2832 /// Gets the enum value as a string.
2833 ///
2834 /// Returns `None` if the enum contains an unknown value deserialized from
2835 /// the integer representation of enums.
2836 pub fn name(&self) -> std::option::Option<&str> {
2837 match self {
2838 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2839 Self::Space => std::option::Option::Some("SPACE"),
2840 Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
2841 Self::Hyphen => std::option::Option::Some("HYPHEN"),
2842 Self::UnknownValue(u) => u.0.name(),
2843 }
2844 }
2845 }
2846
2847 impl std::default::Default for Type {
2848 fn default() -> Self {
2849 use std::convert::From;
2850 Self::from(0)
2851 }
2852 }
2853
2854 impl std::fmt::Display for Type {
2855 fn fmt(
2856 &self,
2857 f: &mut std::fmt::Formatter<'_>,
2858 ) -> std::result::Result<(), std::fmt::Error> {
2859 wkt::internal::display_enum(f, self.name(), self.value())
2860 }
2861 }
2862
2863 impl std::convert::From<i32> for Type {
2864 fn from(value: i32) -> Self {
2865 match value {
2866 0 => Self::Unspecified,
2867 1 => Self::Space,
2868 2 => Self::WideSpace,
2869 3 => Self::Hyphen,
2870 _ => Self::UnknownValue(r#type::UnknownValue(
2871 wkt::internal::UnknownEnumValue::Integer(value),
2872 )),
2873 }
2874 }
2875 }
2876
2877 impl std::convert::From<&str> for Type {
2878 fn from(value: &str) -> Self {
2879 use std::string::ToString;
2880 match value {
2881 "TYPE_UNSPECIFIED" => Self::Unspecified,
2882 "SPACE" => Self::Space,
2883 "WIDE_SPACE" => Self::WideSpace,
2884 "HYPHEN" => Self::Hyphen,
2885 _ => Self::UnknownValue(r#type::UnknownValue(
2886 wkt::internal::UnknownEnumValue::String(value.to_string()),
2887 )),
2888 }
2889 }
2890 }
2891
2892 impl serde::ser::Serialize for Type {
2893 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2894 where
2895 S: serde::Serializer,
2896 {
2897 match self {
2898 Self::Unspecified => serializer.serialize_i32(0),
2899 Self::Space => serializer.serialize_i32(1),
2900 Self::WideSpace => serializer.serialize_i32(2),
2901 Self::Hyphen => serializer.serialize_i32(3),
2902 Self::UnknownValue(u) => u.0.serialize(serializer),
2903 }
2904 }
2905 }
2906
2907 impl<'de> serde::de::Deserialize<'de> for Type {
2908 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2909 where
2910 D: serde::Deserializer<'de>,
2911 {
2912 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2913 ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2914 ))
2915 }
2916 }
2917 }
2918
2919 /// Font and other text style attributes.
2920 #[derive(Clone, Default, PartialEq)]
2921 #[non_exhaustive]
2922 pub struct StyleInfo {
2923 /// Font size in points (`1` point is `¹⁄₇₂` inches).
2924 pub font_size: i32,
2925
2926 /// Font size in pixels, equal to _unrounded
2927 /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
2928 ///
2929 /// * _resolution_ ÷ `72.0`.
2930 ///
2931 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
2932 pub pixel_font_size: f64,
2933
2934 /// Letter spacing in points.
2935 pub letter_spacing: f64,
2936
2937 /// Name or style of the font.
2938 pub font_type: std::string::String,
2939
2940 /// Whether the text is bold (equivalent to
2941 /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
2942 /// is at least `700`).
2943 ///
2944 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
2945 pub bold: bool,
2946
2947 /// Whether the text is italic.
2948 pub italic: bool,
2949
2950 /// Whether the text is underlined.
2951 pub underlined: bool,
2952
2953 /// Whether the text is strikethrough. This feature is not supported yet.
2954 pub strikeout: bool,
2955
2956 /// Whether the text is a subscript. This feature is not supported yet.
2957 pub subscript: bool,
2958
2959 /// Whether the text is a superscript. This feature is not supported yet.
2960 pub superscript: bool,
2961
2962 /// Whether the text is in small caps. This feature is not supported yet.
2963 pub smallcaps: bool,
2964
2965 /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
2966 /// Normal is `400`, bold is `700`.
2967 pub font_weight: i32,
2968
2969 /// Whether the text is handwritten.
2970 pub handwritten: bool,
2971
2972 /// Color of the text.
2973 pub text_color: std::option::Option<google_cloud_type::model::Color>,
2974
2975 /// Color of the background.
2976 pub background_color: std::option::Option<google_cloud_type::model::Color>,
2977
2978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2979 }
2980
2981 impl StyleInfo {
2982 /// Creates a new default instance.
2983 pub fn new() -> Self {
2984 std::default::Default::default()
2985 }
2986
2987 /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
2988 ///
2989 /// # Example
2990 /// ```ignore,no_run
2991 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2992 /// let x = StyleInfo::new().set_font_size(42);
2993 /// ```
2994 pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2995 self.font_size = v.into();
2996 self
2997 }
2998
2999 /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
3000 ///
3001 /// # Example
3002 /// ```ignore,no_run
3003 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3004 /// let x = StyleInfo::new().set_pixel_font_size(42.0);
3005 /// ```
3006 pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3007 self.pixel_font_size = v.into();
3008 self
3009 }
3010
3011 /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
3012 ///
3013 /// # Example
3014 /// ```ignore,no_run
3015 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3016 /// let x = StyleInfo::new().set_letter_spacing(42.0);
3017 /// ```
3018 pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3019 self.letter_spacing = v.into();
3020 self
3021 }
3022
3023 /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
3024 ///
3025 /// # Example
3026 /// ```ignore,no_run
3027 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3028 /// let x = StyleInfo::new().set_font_type("example");
3029 /// ```
3030 pub fn set_font_type<T: std::convert::Into<std::string::String>>(
3031 mut self,
3032 v: T,
3033 ) -> Self {
3034 self.font_type = v.into();
3035 self
3036 }
3037
3038 /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
3039 ///
3040 /// # Example
3041 /// ```ignore,no_run
3042 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3043 /// let x = StyleInfo::new().set_bold(true);
3044 /// ```
3045 pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3046 self.bold = v.into();
3047 self
3048 }
3049
3050 /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
3051 ///
3052 /// # Example
3053 /// ```ignore,no_run
3054 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3055 /// let x = StyleInfo::new().set_italic(true);
3056 /// ```
3057 pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3058 self.italic = v.into();
3059 self
3060 }
3061
3062 /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
3063 ///
3064 /// # Example
3065 /// ```ignore,no_run
3066 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3067 /// let x = StyleInfo::new().set_underlined(true);
3068 /// ```
3069 pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3070 self.underlined = v.into();
3071 self
3072 }
3073
3074 /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
3075 ///
3076 /// # Example
3077 /// ```ignore,no_run
3078 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3079 /// let x = StyleInfo::new().set_strikeout(true);
3080 /// ```
3081 pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3082 self.strikeout = v.into();
3083 self
3084 }
3085
3086 /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
3087 ///
3088 /// # Example
3089 /// ```ignore,no_run
3090 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3091 /// let x = StyleInfo::new().set_subscript(true);
3092 /// ```
3093 pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3094 self.subscript = v.into();
3095 self
3096 }
3097
3098 /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
3099 ///
3100 /// # Example
3101 /// ```ignore,no_run
3102 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3103 /// let x = StyleInfo::new().set_superscript(true);
3104 /// ```
3105 pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3106 self.superscript = v.into();
3107 self
3108 }
3109
3110 /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
3111 ///
3112 /// # Example
3113 /// ```ignore,no_run
3114 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3115 /// let x = StyleInfo::new().set_smallcaps(true);
3116 /// ```
3117 pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3118 self.smallcaps = v.into();
3119 self
3120 }
3121
3122 /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
3123 ///
3124 /// # Example
3125 /// ```ignore,no_run
3126 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3127 /// let x = StyleInfo::new().set_font_weight(42);
3128 /// ```
3129 pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3130 self.font_weight = v.into();
3131 self
3132 }
3133
3134 /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
3135 ///
3136 /// # Example
3137 /// ```ignore,no_run
3138 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3139 /// let x = StyleInfo::new().set_handwritten(true);
3140 /// ```
3141 pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3142 self.handwritten = v.into();
3143 self
3144 }
3145
3146 /// Sets the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3147 ///
3148 /// # Example
3149 /// ```ignore,no_run
3150 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3151 /// use google_cloud_type::model::Color;
3152 /// let x = StyleInfo::new().set_text_color(Color::default()/* use setters */);
3153 /// ```
3154 pub fn set_text_color<T>(mut self, v: T) -> Self
3155 where
3156 T: std::convert::Into<google_cloud_type::model::Color>,
3157 {
3158 self.text_color = std::option::Option::Some(v.into());
3159 self
3160 }
3161
3162 /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3163 ///
3164 /// # Example
3165 /// ```ignore,no_run
3166 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3167 /// use google_cloud_type::model::Color;
3168 /// let x = StyleInfo::new().set_or_clear_text_color(Some(Color::default()/* use setters */));
3169 /// let x = StyleInfo::new().set_or_clear_text_color(None::<Color>);
3170 /// ```
3171 pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
3172 where
3173 T: std::convert::Into<google_cloud_type::model::Color>,
3174 {
3175 self.text_color = v.map(|x| x.into());
3176 self
3177 }
3178
3179 /// Sets the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3180 ///
3181 /// # Example
3182 /// ```ignore,no_run
3183 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3184 /// use google_cloud_type::model::Color;
3185 /// let x = StyleInfo::new().set_background_color(Color::default()/* use setters */);
3186 /// ```
3187 pub fn set_background_color<T>(mut self, v: T) -> Self
3188 where
3189 T: std::convert::Into<google_cloud_type::model::Color>,
3190 {
3191 self.background_color = std::option::Option::Some(v.into());
3192 self
3193 }
3194
3195 /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3196 ///
3197 /// # Example
3198 /// ```ignore,no_run
3199 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3200 /// use google_cloud_type::model::Color;
3201 /// let x = StyleInfo::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
3202 /// let x = StyleInfo::new().set_or_clear_background_color(None::<Color>);
3203 /// ```
3204 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
3205 where
3206 T: std::convert::Into<google_cloud_type::model::Color>,
3207 {
3208 self.background_color = v.map(|x| x.into());
3209 self
3210 }
3211 }
3212
3213 impl wkt::message::Message for StyleInfo {
3214 fn typename() -> &'static str {
3215 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
3216 }
3217 }
3218 }
3219
3220 /// A detected symbol.
3221 #[derive(Clone, Default, PartialEq)]
3222 #[non_exhaustive]
3223 pub struct Symbol {
3224 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3225 /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
3226 ///
3227 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3228 /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
3229 pub layout: std::option::Option<crate::model::document::page::Layout>,
3230
3231 /// A list of detected languages together with confidence.
3232 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3233
3234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3235 }
3236
3237 impl Symbol {
3238 /// Creates a new default instance.
3239 pub fn new() -> Self {
3240 std::default::Default::default()
3241 }
3242
3243 /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
3244 ///
3245 /// # Example
3246 /// ```ignore,no_run
3247 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3248 /// use google_cloud_documentai_v1::model::document::page::Layout;
3249 /// let x = Symbol::new().set_layout(Layout::default()/* use setters */);
3250 /// ```
3251 pub fn set_layout<T>(mut self, v: T) -> Self
3252 where
3253 T: std::convert::Into<crate::model::document::page::Layout>,
3254 {
3255 self.layout = std::option::Option::Some(v.into());
3256 self
3257 }
3258
3259 /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
3260 ///
3261 /// # Example
3262 /// ```ignore,no_run
3263 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3264 /// use google_cloud_documentai_v1::model::document::page::Layout;
3265 /// let x = Symbol::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3266 /// let x = Symbol::new().set_or_clear_layout(None::<Layout>);
3267 /// ```
3268 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3269 where
3270 T: std::convert::Into<crate::model::document::page::Layout>,
3271 {
3272 self.layout = v.map(|x| x.into());
3273 self
3274 }
3275
3276 /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
3277 ///
3278 /// # Example
3279 /// ```ignore,no_run
3280 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3281 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3282 /// let x = Symbol::new()
3283 /// .set_detected_languages([
3284 /// DetectedLanguage::default()/* use setters */,
3285 /// DetectedLanguage::default()/* use (different) setters */,
3286 /// ]);
3287 /// ```
3288 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3289 where
3290 T: std::iter::IntoIterator<Item = V>,
3291 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3292 {
3293 use std::iter::Iterator;
3294 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3295 self
3296 }
3297 }
3298
3299 impl wkt::message::Message for Symbol {
3300 fn typename() -> &'static str {
3301 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
3302 }
3303 }
3304
3305 /// Detected non-text visual elements, for example, checkbox, signature etc.
3306 /// on the page.
3307 #[derive(Clone, Default, PartialEq)]
3308 #[non_exhaustive]
3309 pub struct VisualElement {
3310 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3311 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3312 ///
3313 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3314 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3315 pub layout: std::option::Option<crate::model::document::page::Layout>,
3316
3317 /// Type of the
3318 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3319 ///
3320 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3321 pub r#type: std::string::String,
3322
3323 /// A list of detected languages together with confidence.
3324 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3325
3326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3327 }
3328
3329 impl VisualElement {
3330 /// Creates a new default instance.
3331 pub fn new() -> Self {
3332 std::default::Default::default()
3333 }
3334
3335 /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
3336 ///
3337 /// # Example
3338 /// ```ignore,no_run
3339 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3340 /// use google_cloud_documentai_v1::model::document::page::Layout;
3341 /// let x = VisualElement::new().set_layout(Layout::default()/* use setters */);
3342 /// ```
3343 pub fn set_layout<T>(mut self, v: T) -> Self
3344 where
3345 T: std::convert::Into<crate::model::document::page::Layout>,
3346 {
3347 self.layout = std::option::Option::Some(v.into());
3348 self
3349 }
3350
3351 /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
3352 ///
3353 /// # Example
3354 /// ```ignore,no_run
3355 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3356 /// use google_cloud_documentai_v1::model::document::page::Layout;
3357 /// let x = VisualElement::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3358 /// let x = VisualElement::new().set_or_clear_layout(None::<Layout>);
3359 /// ```
3360 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3361 where
3362 T: std::convert::Into<crate::model::document::page::Layout>,
3363 {
3364 self.layout = v.map(|x| x.into());
3365 self
3366 }
3367
3368 /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
3369 ///
3370 /// # Example
3371 /// ```ignore,no_run
3372 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3373 /// let x = VisualElement::new().set_type("example");
3374 /// ```
3375 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3376 self.r#type = v.into();
3377 self
3378 }
3379
3380 /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
3381 ///
3382 /// # Example
3383 /// ```ignore,no_run
3384 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3385 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3386 /// let x = VisualElement::new()
3387 /// .set_detected_languages([
3388 /// DetectedLanguage::default()/* use setters */,
3389 /// DetectedLanguage::default()/* use (different) setters */,
3390 /// ]);
3391 /// ```
3392 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3393 where
3394 T: std::iter::IntoIterator<Item = V>,
3395 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3396 {
3397 use std::iter::Iterator;
3398 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3399 self
3400 }
3401 }
3402
3403 impl wkt::message::Message for VisualElement {
3404 fn typename() -> &'static str {
3405 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
3406 }
3407 }
3408
3409 /// A table representation similar to HTML table structure.
3410 #[derive(Clone, Default, PartialEq)]
3411 #[non_exhaustive]
3412 pub struct Table {
3413 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3414 /// [Table][google.cloud.documentai.v1.Document.Page.Table].
3415 ///
3416 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3417 /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
3418 pub layout: std::option::Option<crate::model::document::page::Layout>,
3419
3420 /// Header rows of the table.
3421 pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3422
3423 /// Body rows of the table.
3424 pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3425
3426 /// A list of detected languages together with confidence.
3427 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3428
3429 /// The history of this table.
3430 #[deprecated]
3431 pub provenance: std::option::Option<crate::model::document::Provenance>,
3432
3433 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3434 }
3435
3436 impl Table {
3437 /// Creates a new default instance.
3438 pub fn new() -> Self {
3439 std::default::Default::default()
3440 }
3441
3442 /// Sets the value of [layout][crate::model::document::page::Table::layout].
3443 ///
3444 /// # Example
3445 /// ```ignore,no_run
3446 /// # use google_cloud_documentai_v1::model::document::page::Table;
3447 /// use google_cloud_documentai_v1::model::document::page::Layout;
3448 /// let x = Table::new().set_layout(Layout::default()/* use setters */);
3449 /// ```
3450 pub fn set_layout<T>(mut self, v: T) -> Self
3451 where
3452 T: std::convert::Into<crate::model::document::page::Layout>,
3453 {
3454 self.layout = std::option::Option::Some(v.into());
3455 self
3456 }
3457
3458 /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
3459 ///
3460 /// # Example
3461 /// ```ignore,no_run
3462 /// # use google_cloud_documentai_v1::model::document::page::Table;
3463 /// use google_cloud_documentai_v1::model::document::page::Layout;
3464 /// let x = Table::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3465 /// let x = Table::new().set_or_clear_layout(None::<Layout>);
3466 /// ```
3467 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3468 where
3469 T: std::convert::Into<crate::model::document::page::Layout>,
3470 {
3471 self.layout = v.map(|x| x.into());
3472 self
3473 }
3474
3475 /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
3476 ///
3477 /// # Example
3478 /// ```ignore,no_run
3479 /// # use google_cloud_documentai_v1::model::document::page::Table;
3480 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3481 /// let x = Table::new()
3482 /// .set_header_rows([
3483 /// TableRow::default()/* use setters */,
3484 /// TableRow::default()/* use (different) setters */,
3485 /// ]);
3486 /// ```
3487 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
3488 where
3489 T: std::iter::IntoIterator<Item = V>,
3490 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3491 {
3492 use std::iter::Iterator;
3493 self.header_rows = v.into_iter().map(|i| i.into()).collect();
3494 self
3495 }
3496
3497 /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
3498 ///
3499 /// # Example
3500 /// ```ignore,no_run
3501 /// # use google_cloud_documentai_v1::model::document::page::Table;
3502 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3503 /// let x = Table::new()
3504 /// .set_body_rows([
3505 /// TableRow::default()/* use setters */,
3506 /// TableRow::default()/* use (different) setters */,
3507 /// ]);
3508 /// ```
3509 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
3510 where
3511 T: std::iter::IntoIterator<Item = V>,
3512 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3513 {
3514 use std::iter::Iterator;
3515 self.body_rows = v.into_iter().map(|i| i.into()).collect();
3516 self
3517 }
3518
3519 /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
3520 ///
3521 /// # Example
3522 /// ```ignore,no_run
3523 /// # use google_cloud_documentai_v1::model::document::page::Table;
3524 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3525 /// let x = Table::new()
3526 /// .set_detected_languages([
3527 /// DetectedLanguage::default()/* use setters */,
3528 /// DetectedLanguage::default()/* use (different) setters */,
3529 /// ]);
3530 /// ```
3531 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3532 where
3533 T: std::iter::IntoIterator<Item = V>,
3534 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3535 {
3536 use std::iter::Iterator;
3537 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3538 self
3539 }
3540
3541 /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
3542 ///
3543 /// # Example
3544 /// ```ignore,no_run
3545 /// # use google_cloud_documentai_v1::model::document::page::Table;
3546 /// use google_cloud_documentai_v1::model::document::Provenance;
3547 /// let x = Table::new().set_provenance(Provenance::default()/* use setters */);
3548 /// ```
3549 #[deprecated]
3550 pub fn set_provenance<T>(mut self, v: T) -> Self
3551 where
3552 T: std::convert::Into<crate::model::document::Provenance>,
3553 {
3554 self.provenance = std::option::Option::Some(v.into());
3555 self
3556 }
3557
3558 /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
3559 ///
3560 /// # Example
3561 /// ```ignore,no_run
3562 /// # use google_cloud_documentai_v1::model::document::page::Table;
3563 /// use google_cloud_documentai_v1::model::document::Provenance;
3564 /// let x = Table::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3565 /// let x = Table::new().set_or_clear_provenance(None::<Provenance>);
3566 /// ```
3567 #[deprecated]
3568 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3569 where
3570 T: std::convert::Into<crate::model::document::Provenance>,
3571 {
3572 self.provenance = v.map(|x| x.into());
3573 self
3574 }
3575 }
3576
3577 impl wkt::message::Message for Table {
3578 fn typename() -> &'static str {
3579 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
3580 }
3581 }
3582
3583 /// Defines additional types related to [Table].
3584 pub mod table {
3585 #[allow(unused_imports)]
3586 use super::*;
3587
3588 /// A row of table cells.
3589 #[derive(Clone, Default, PartialEq)]
3590 #[non_exhaustive]
3591 pub struct TableRow {
3592 /// Cells that make up this row.
3593 pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
3594
3595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3596 }
3597
3598 impl TableRow {
3599 /// Creates a new default instance.
3600 pub fn new() -> Self {
3601 std::default::Default::default()
3602 }
3603
3604 /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
3605 ///
3606 /// # Example
3607 /// ```ignore,no_run
3608 /// # use google_cloud_documentai_v1::model::document::page::table::TableRow;
3609 /// use google_cloud_documentai_v1::model::document::page::table::TableCell;
3610 /// let x = TableRow::new()
3611 /// .set_cells([
3612 /// TableCell::default()/* use setters */,
3613 /// TableCell::default()/* use (different) setters */,
3614 /// ]);
3615 /// ```
3616 pub fn set_cells<T, V>(mut self, v: T) -> Self
3617 where
3618 T: std::iter::IntoIterator<Item = V>,
3619 V: std::convert::Into<crate::model::document::page::table::TableCell>,
3620 {
3621 use std::iter::Iterator;
3622 self.cells = v.into_iter().map(|i| i.into()).collect();
3623 self
3624 }
3625 }
3626
3627 impl wkt::message::Message for TableRow {
3628 fn typename() -> &'static str {
3629 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
3630 }
3631 }
3632
3633 /// A cell representation inside the table.
3634 #[derive(Clone, Default, PartialEq)]
3635 #[non_exhaustive]
3636 pub struct TableCell {
3637 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3638 /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
3639 ///
3640 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3641 /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
3642 pub layout: std::option::Option<crate::model::document::page::Layout>,
3643
3644 /// How many rows this cell spans.
3645 pub row_span: i32,
3646
3647 /// How many columns this cell spans.
3648 pub col_span: i32,
3649
3650 /// A list of detected languages together with confidence.
3651 pub detected_languages:
3652 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3653
3654 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3655 }
3656
3657 impl TableCell {
3658 /// Creates a new default instance.
3659 pub fn new() -> Self {
3660 std::default::Default::default()
3661 }
3662
3663 /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
3664 ///
3665 /// # Example
3666 /// ```ignore,no_run
3667 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3668 /// use google_cloud_documentai_v1::model::document::page::Layout;
3669 /// let x = TableCell::new().set_layout(Layout::default()/* use setters */);
3670 /// ```
3671 pub fn set_layout<T>(mut self, v: T) -> Self
3672 where
3673 T: std::convert::Into<crate::model::document::page::Layout>,
3674 {
3675 self.layout = std::option::Option::Some(v.into());
3676 self
3677 }
3678
3679 /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
3680 ///
3681 /// # Example
3682 /// ```ignore,no_run
3683 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3684 /// use google_cloud_documentai_v1::model::document::page::Layout;
3685 /// let x = TableCell::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3686 /// let x = TableCell::new().set_or_clear_layout(None::<Layout>);
3687 /// ```
3688 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3689 where
3690 T: std::convert::Into<crate::model::document::page::Layout>,
3691 {
3692 self.layout = v.map(|x| x.into());
3693 self
3694 }
3695
3696 /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
3697 ///
3698 /// # Example
3699 /// ```ignore,no_run
3700 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3701 /// let x = TableCell::new().set_row_span(42);
3702 /// ```
3703 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3704 self.row_span = v.into();
3705 self
3706 }
3707
3708 /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
3709 ///
3710 /// # Example
3711 /// ```ignore,no_run
3712 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3713 /// let x = TableCell::new().set_col_span(42);
3714 /// ```
3715 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3716 self.col_span = v.into();
3717 self
3718 }
3719
3720 /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
3721 ///
3722 /// # Example
3723 /// ```ignore,no_run
3724 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3725 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3726 /// let x = TableCell::new()
3727 /// .set_detected_languages([
3728 /// DetectedLanguage::default()/* use setters */,
3729 /// DetectedLanguage::default()/* use (different) setters */,
3730 /// ]);
3731 /// ```
3732 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3733 where
3734 T: std::iter::IntoIterator<Item = V>,
3735 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3736 {
3737 use std::iter::Iterator;
3738 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3739 self
3740 }
3741 }
3742
3743 impl wkt::message::Message for TableCell {
3744 fn typename() -> &'static str {
3745 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
3746 }
3747 }
3748 }
3749
3750 /// A form field detected on the page.
3751 #[derive(Clone, Default, PartialEq)]
3752 #[non_exhaustive]
3753 pub struct FormField {
3754 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3755 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
3756 /// For example, `Address`, `Email`, `Grand total`, `Phone number`, etc.
3757 ///
3758 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3759 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3760 pub field_name: std::option::Option<crate::model::document::page::Layout>,
3761
3762 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3763 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
3764 ///
3765 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3766 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3767 pub field_value: std::option::Option<crate::model::document::page::Layout>,
3768
3769 /// A list of detected languages for name together with confidence.
3770 pub name_detected_languages:
3771 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3772
3773 /// A list of detected languages for value together with confidence.
3774 pub value_detected_languages:
3775 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3776
3777 /// If the value is non-textual, this field represents the type. Current
3778 /// valid values are:
3779 ///
3780 /// - blank (this indicates the `field_value` is normal text)
3781 /// - `unfilled_checkbox`
3782 /// - `filled_checkbox`
3783 pub value_type: std::string::String,
3784
3785 /// Created for Labeling UI to export key text.
3786 /// If corrections were made to the text identified by the
3787 /// `field_name.text_anchor`, this field will contain the correction.
3788 pub corrected_key_text: std::string::String,
3789
3790 /// Created for Labeling UI to export value text.
3791 /// If corrections were made to the text identified by the
3792 /// `field_value.text_anchor`, this field will contain the correction.
3793 pub corrected_value_text: std::string::String,
3794
3795 /// The history of this annotation.
3796 pub provenance: std::option::Option<crate::model::document::Provenance>,
3797
3798 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3799 }
3800
3801 impl FormField {
3802 /// Creates a new default instance.
3803 pub fn new() -> Self {
3804 std::default::Default::default()
3805 }
3806
3807 /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
3808 ///
3809 /// # Example
3810 /// ```ignore,no_run
3811 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3812 /// use google_cloud_documentai_v1::model::document::page::Layout;
3813 /// let x = FormField::new().set_field_name(Layout::default()/* use setters */);
3814 /// ```
3815 pub fn set_field_name<T>(mut self, v: T) -> Self
3816 where
3817 T: std::convert::Into<crate::model::document::page::Layout>,
3818 {
3819 self.field_name = std::option::Option::Some(v.into());
3820 self
3821 }
3822
3823 /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
3824 ///
3825 /// # Example
3826 /// ```ignore,no_run
3827 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3828 /// use google_cloud_documentai_v1::model::document::page::Layout;
3829 /// let x = FormField::new().set_or_clear_field_name(Some(Layout::default()/* use setters */));
3830 /// let x = FormField::new().set_or_clear_field_name(None::<Layout>);
3831 /// ```
3832 pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
3833 where
3834 T: std::convert::Into<crate::model::document::page::Layout>,
3835 {
3836 self.field_name = v.map(|x| x.into());
3837 self
3838 }
3839
3840 /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
3841 ///
3842 /// # Example
3843 /// ```ignore,no_run
3844 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3845 /// use google_cloud_documentai_v1::model::document::page::Layout;
3846 /// let x = FormField::new().set_field_value(Layout::default()/* use setters */);
3847 /// ```
3848 pub fn set_field_value<T>(mut self, v: T) -> Self
3849 where
3850 T: std::convert::Into<crate::model::document::page::Layout>,
3851 {
3852 self.field_value = std::option::Option::Some(v.into());
3853 self
3854 }
3855
3856 /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
3857 ///
3858 /// # Example
3859 /// ```ignore,no_run
3860 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3861 /// use google_cloud_documentai_v1::model::document::page::Layout;
3862 /// let x = FormField::new().set_or_clear_field_value(Some(Layout::default()/* use setters */));
3863 /// let x = FormField::new().set_or_clear_field_value(None::<Layout>);
3864 /// ```
3865 pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
3866 where
3867 T: std::convert::Into<crate::model::document::page::Layout>,
3868 {
3869 self.field_value = v.map(|x| x.into());
3870 self
3871 }
3872
3873 /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_detected_languages].
3874 ///
3875 /// # Example
3876 /// ```ignore,no_run
3877 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3878 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3879 /// let x = FormField::new()
3880 /// .set_name_detected_languages([
3881 /// DetectedLanguage::default()/* use setters */,
3882 /// DetectedLanguage::default()/* use (different) setters */,
3883 /// ]);
3884 /// ```
3885 pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
3886 where
3887 T: std::iter::IntoIterator<Item = V>,
3888 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3889 {
3890 use std::iter::Iterator;
3891 self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
3892 self
3893 }
3894
3895 /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
3896 ///
3897 /// # Example
3898 /// ```ignore,no_run
3899 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3900 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3901 /// let x = FormField::new()
3902 /// .set_value_detected_languages([
3903 /// DetectedLanguage::default()/* use setters */,
3904 /// DetectedLanguage::default()/* use (different) setters */,
3905 /// ]);
3906 /// ```
3907 pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
3908 where
3909 T: std::iter::IntoIterator<Item = V>,
3910 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3911 {
3912 use std::iter::Iterator;
3913 self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
3914 self
3915 }
3916
3917 /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
3918 ///
3919 /// # Example
3920 /// ```ignore,no_run
3921 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3922 /// let x = FormField::new().set_value_type("example");
3923 /// ```
3924 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
3925 mut self,
3926 v: T,
3927 ) -> Self {
3928 self.value_type = v.into();
3929 self
3930 }
3931
3932 /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
3933 ///
3934 /// # Example
3935 /// ```ignore,no_run
3936 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3937 /// let x = FormField::new().set_corrected_key_text("example");
3938 /// ```
3939 pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
3940 mut self,
3941 v: T,
3942 ) -> Self {
3943 self.corrected_key_text = v.into();
3944 self
3945 }
3946
3947 /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
3948 ///
3949 /// # Example
3950 /// ```ignore,no_run
3951 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3952 /// let x = FormField::new().set_corrected_value_text("example");
3953 /// ```
3954 pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
3955 mut self,
3956 v: T,
3957 ) -> Self {
3958 self.corrected_value_text = v.into();
3959 self
3960 }
3961
3962 /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
3963 ///
3964 /// # Example
3965 /// ```ignore,no_run
3966 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3967 /// use google_cloud_documentai_v1::model::document::Provenance;
3968 /// let x = FormField::new().set_provenance(Provenance::default()/* use setters */);
3969 /// ```
3970 pub fn set_provenance<T>(mut self, v: T) -> Self
3971 where
3972 T: std::convert::Into<crate::model::document::Provenance>,
3973 {
3974 self.provenance = std::option::Option::Some(v.into());
3975 self
3976 }
3977
3978 /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
3979 ///
3980 /// # Example
3981 /// ```ignore,no_run
3982 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3983 /// use google_cloud_documentai_v1::model::document::Provenance;
3984 /// let x = FormField::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3985 /// let x = FormField::new().set_or_clear_provenance(None::<Provenance>);
3986 /// ```
3987 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3988 where
3989 T: std::convert::Into<crate::model::document::Provenance>,
3990 {
3991 self.provenance = v.map(|x| x.into());
3992 self
3993 }
3994 }
3995
3996 impl wkt::message::Message for FormField {
3997 fn typename() -> &'static str {
3998 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
3999 }
4000 }
4001
4002 /// A detected barcode.
4003 #[derive(Clone, Default, PartialEq)]
4004 #[non_exhaustive]
4005 pub struct DetectedBarcode {
4006 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
4007 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
4008 ///
4009 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
4010 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
4011 pub layout: std::option::Option<crate::model::document::page::Layout>,
4012
4013 /// Detailed barcode information of the
4014 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
4015 ///
4016 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
4017 pub barcode: std::option::Option<crate::model::Barcode>,
4018
4019 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4020 }
4021
4022 impl DetectedBarcode {
4023 /// Creates a new default instance.
4024 pub fn new() -> Self {
4025 std::default::Default::default()
4026 }
4027
4028 /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4029 ///
4030 /// # Example
4031 /// ```ignore,no_run
4032 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4033 /// use google_cloud_documentai_v1::model::document::page::Layout;
4034 /// let x = DetectedBarcode::new().set_layout(Layout::default()/* use setters */);
4035 /// ```
4036 pub fn set_layout<T>(mut self, v: T) -> Self
4037 where
4038 T: std::convert::Into<crate::model::document::page::Layout>,
4039 {
4040 self.layout = std::option::Option::Some(v.into());
4041 self
4042 }
4043
4044 /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4045 ///
4046 /// # Example
4047 /// ```ignore,no_run
4048 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4049 /// use google_cloud_documentai_v1::model::document::page::Layout;
4050 /// let x = DetectedBarcode::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
4051 /// let x = DetectedBarcode::new().set_or_clear_layout(None::<Layout>);
4052 /// ```
4053 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
4054 where
4055 T: std::convert::Into<crate::model::document::page::Layout>,
4056 {
4057 self.layout = v.map(|x| x.into());
4058 self
4059 }
4060
4061 /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4062 ///
4063 /// # Example
4064 /// ```ignore,no_run
4065 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4066 /// use google_cloud_documentai_v1::model::Barcode;
4067 /// let x = DetectedBarcode::new().set_barcode(Barcode::default()/* use setters */);
4068 /// ```
4069 pub fn set_barcode<T>(mut self, v: T) -> Self
4070 where
4071 T: std::convert::Into<crate::model::Barcode>,
4072 {
4073 self.barcode = std::option::Option::Some(v.into());
4074 self
4075 }
4076
4077 /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4078 ///
4079 /// # Example
4080 /// ```ignore,no_run
4081 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4082 /// use google_cloud_documentai_v1::model::Barcode;
4083 /// let x = DetectedBarcode::new().set_or_clear_barcode(Some(Barcode::default()/* use setters */));
4084 /// let x = DetectedBarcode::new().set_or_clear_barcode(None::<Barcode>);
4085 /// ```
4086 pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
4087 where
4088 T: std::convert::Into<crate::model::Barcode>,
4089 {
4090 self.barcode = v.map(|x| x.into());
4091 self
4092 }
4093 }
4094
4095 impl wkt::message::Message for DetectedBarcode {
4096 fn typename() -> &'static str {
4097 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
4098 }
4099 }
4100
4101 /// Detected language for a structural component.
4102 #[derive(Clone, Default, PartialEq)]
4103 #[non_exhaustive]
4104 pub struct DetectedLanguage {
4105 /// The [BCP-47 language
4106 /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
4107 /// such as `en-US` or `sr-Latn`.
4108 pub language_code: std::string::String,
4109
4110 /// Confidence of detected language. Range `[0, 1]`.
4111 pub confidence: f32,
4112
4113 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4114 }
4115
4116 impl DetectedLanguage {
4117 /// Creates a new default instance.
4118 pub fn new() -> Self {
4119 std::default::Default::default()
4120 }
4121
4122 /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
4123 ///
4124 /// # Example
4125 /// ```ignore,no_run
4126 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4127 /// let x = DetectedLanguage::new().set_language_code("example");
4128 /// ```
4129 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4130 mut self,
4131 v: T,
4132 ) -> Self {
4133 self.language_code = v.into();
4134 self
4135 }
4136
4137 /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
4138 ///
4139 /// # Example
4140 /// ```ignore,no_run
4141 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4142 /// let x = DetectedLanguage::new().set_confidence(42.0);
4143 /// ```
4144 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4145 self.confidence = v.into();
4146 self
4147 }
4148 }
4149
4150 impl wkt::message::Message for DetectedLanguage {
4151 fn typename() -> &'static str {
4152 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
4153 }
4154 }
4155
4156 /// Image quality scores for the page image.
4157 #[derive(Clone, Default, PartialEq)]
4158 #[non_exhaustive]
4159 pub struct ImageQualityScores {
4160 /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
4161 pub quality_score: f32,
4162
4163 /// A list of detected defects.
4164 pub detected_defects:
4165 std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
4166
4167 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4168 }
4169
4170 impl ImageQualityScores {
4171 /// Creates a new default instance.
4172 pub fn new() -> Self {
4173 std::default::Default::default()
4174 }
4175
4176 /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
4177 ///
4178 /// # Example
4179 /// ```ignore,no_run
4180 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4181 /// let x = ImageQualityScores::new().set_quality_score(42.0);
4182 /// ```
4183 pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4184 self.quality_score = v.into();
4185 self
4186 }
4187
4188 /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
4189 ///
4190 /// # Example
4191 /// ```ignore,no_run
4192 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4193 /// use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4194 /// let x = ImageQualityScores::new()
4195 /// .set_detected_defects([
4196 /// DetectedDefect::default()/* use setters */,
4197 /// DetectedDefect::default()/* use (different) setters */,
4198 /// ]);
4199 /// ```
4200 pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
4201 where
4202 T: std::iter::IntoIterator<Item = V>,
4203 V: std::convert::Into<
4204 crate::model::document::page::image_quality_scores::DetectedDefect,
4205 >,
4206 {
4207 use std::iter::Iterator;
4208 self.detected_defects = v.into_iter().map(|i| i.into()).collect();
4209 self
4210 }
4211 }
4212
4213 impl wkt::message::Message for ImageQualityScores {
4214 fn typename() -> &'static str {
4215 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
4216 }
4217 }
4218
4219 /// Defines additional types related to [ImageQualityScores].
4220 pub mod image_quality_scores {
4221 #[allow(unused_imports)]
4222 use super::*;
4223
4224 /// Image Quality Defects
4225 #[derive(Clone, Default, PartialEq)]
4226 #[non_exhaustive]
4227 pub struct DetectedDefect {
4228 /// Name of the defect type. Supported values are:
4229 ///
4230 /// - `quality/defect_blurry`
4231 /// - `quality/defect_noisy`
4232 /// - `quality/defect_dark`
4233 /// - `quality/defect_faint`
4234 /// - `quality/defect_text_too_small`
4235 /// - `quality/defect_document_cutoff`
4236 /// - `quality/defect_text_cutoff`
4237 /// - `quality/defect_glare`
4238 pub r#type: std::string::String,
4239
4240 /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
4241 /// strong confidence that the defect exists.
4242 pub confidence: f32,
4243
4244 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4245 }
4246
4247 impl DetectedDefect {
4248 /// Creates a new default instance.
4249 pub fn new() -> Self {
4250 std::default::Default::default()
4251 }
4252
4253 /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
4254 ///
4255 /// # Example
4256 /// ```ignore,no_run
4257 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4258 /// let x = DetectedDefect::new().set_type("example");
4259 /// ```
4260 pub fn set_type<T: std::convert::Into<std::string::String>>(
4261 mut self,
4262 v: T,
4263 ) -> Self {
4264 self.r#type = v.into();
4265 self
4266 }
4267
4268 /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
4269 ///
4270 /// # Example
4271 /// ```ignore,no_run
4272 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4273 /// let x = DetectedDefect::new().set_confidence(42.0);
4274 /// ```
4275 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4276 self.confidence = v.into();
4277 self
4278 }
4279 }
4280
4281 impl wkt::message::Message for DetectedDefect {
4282 fn typename() -> &'static str {
4283 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
4284 }
4285 }
4286 }
4287 }
4288
4289 /// An entity that could be a phrase in the text or a property that belongs to
4290 /// the document. It is a known entity type, such as a person, an organization,
4291 /// or location.
4292 #[derive(Clone, Default, PartialEq)]
4293 #[non_exhaustive]
4294 pub struct Entity {
4295 /// Optional. Provenance of the entity.
4296 /// Text anchor indexing into the
4297 /// [Document.text][google.cloud.documentai.v1.Document.text].
4298 ///
4299 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
4300 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4301
4302 /// Required. Entity type from a schema, for example, `Address`.
4303 pub r#type: std::string::String,
4304
4305 /// Optional. Text value of the entity, for example, `1600 Amphitheatre
4306 /// Pkwy`.
4307 pub mention_text: std::string::String,
4308
4309 /// Optional. Deprecated. Use `id` field instead.
4310 pub mention_id: std::string::String,
4311
4312 /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
4313 pub confidence: f32,
4314
4315 /// Optional. Represents the provenance of this entity wrt. the location on
4316 /// the page where it was found.
4317 pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
4318
4319 /// Optional. Canonical id. This will be a unique value in the entity list
4320 /// for this document.
4321 pub id: std::string::String,
4322
4323 /// Optional. Normalized entity value. Absent if the extracted value could
4324 /// not be converted or the type (for example, address) is not supported for
4325 /// certain parsers. This field is also only populated for certain supported
4326 /// document types.
4327 pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
4328
4329 /// Optional. Entities can be nested to form a hierarchical data structure
4330 /// representing the content in the document.
4331 pub properties: std::vec::Vec<crate::model::document::Entity>,
4332
4333 /// Optional. The history of this annotation.
4334 pub provenance: std::option::Option<crate::model::document::Provenance>,
4335
4336 /// Optional. Whether the entity will be redacted for de-identification
4337 /// purposes.
4338 pub redacted: bool,
4339
4340 /// Optional. Specifies how the entity's value is obtained.
4341 pub method: crate::model::document::entity::Method,
4342
4343 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4344 }
4345
4346 impl Entity {
4347 /// Creates a new default instance.
4348 pub fn new() -> Self {
4349 std::default::Default::default()
4350 }
4351
4352 /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
4353 ///
4354 /// # Example
4355 /// ```ignore,no_run
4356 /// # use google_cloud_documentai_v1::model::document::Entity;
4357 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4358 /// let x = Entity::new().set_text_anchor(TextAnchor::default()/* use setters */);
4359 /// ```
4360 pub fn set_text_anchor<T>(mut self, v: T) -> Self
4361 where
4362 T: std::convert::Into<crate::model::document::TextAnchor>,
4363 {
4364 self.text_anchor = std::option::Option::Some(v.into());
4365 self
4366 }
4367
4368 /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
4369 ///
4370 /// # Example
4371 /// ```ignore,no_run
4372 /// # use google_cloud_documentai_v1::model::document::Entity;
4373 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4374 /// let x = Entity::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
4375 /// let x = Entity::new().set_or_clear_text_anchor(None::<TextAnchor>);
4376 /// ```
4377 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4378 where
4379 T: std::convert::Into<crate::model::document::TextAnchor>,
4380 {
4381 self.text_anchor = v.map(|x| x.into());
4382 self
4383 }
4384
4385 /// Sets the value of [r#type][crate::model::document::Entity::type].
4386 ///
4387 /// # Example
4388 /// ```ignore,no_run
4389 /// # use google_cloud_documentai_v1::model::document::Entity;
4390 /// let x = Entity::new().set_type("example");
4391 /// ```
4392 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4393 self.r#type = v.into();
4394 self
4395 }
4396
4397 /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
4398 ///
4399 /// # Example
4400 /// ```ignore,no_run
4401 /// # use google_cloud_documentai_v1::model::document::Entity;
4402 /// let x = Entity::new().set_mention_text("example");
4403 /// ```
4404 pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
4405 mut self,
4406 v: T,
4407 ) -> Self {
4408 self.mention_text = v.into();
4409 self
4410 }
4411
4412 /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
4413 ///
4414 /// # Example
4415 /// ```ignore,no_run
4416 /// # use google_cloud_documentai_v1::model::document::Entity;
4417 /// let x = Entity::new().set_mention_id("example");
4418 /// ```
4419 pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4420 self.mention_id = v.into();
4421 self
4422 }
4423
4424 /// Sets the value of [confidence][crate::model::document::Entity::confidence].
4425 ///
4426 /// # Example
4427 /// ```ignore,no_run
4428 /// # use google_cloud_documentai_v1::model::document::Entity;
4429 /// let x = Entity::new().set_confidence(42.0);
4430 /// ```
4431 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4432 self.confidence = v.into();
4433 self
4434 }
4435
4436 /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
4437 ///
4438 /// # Example
4439 /// ```ignore,no_run
4440 /// # use google_cloud_documentai_v1::model::document::Entity;
4441 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4442 /// let x = Entity::new().set_page_anchor(PageAnchor::default()/* use setters */);
4443 /// ```
4444 pub fn set_page_anchor<T>(mut self, v: T) -> Self
4445 where
4446 T: std::convert::Into<crate::model::document::PageAnchor>,
4447 {
4448 self.page_anchor = std::option::Option::Some(v.into());
4449 self
4450 }
4451
4452 /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
4453 ///
4454 /// # Example
4455 /// ```ignore,no_run
4456 /// # use google_cloud_documentai_v1::model::document::Entity;
4457 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4458 /// let x = Entity::new().set_or_clear_page_anchor(Some(PageAnchor::default()/* use setters */));
4459 /// let x = Entity::new().set_or_clear_page_anchor(None::<PageAnchor>);
4460 /// ```
4461 pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4462 where
4463 T: std::convert::Into<crate::model::document::PageAnchor>,
4464 {
4465 self.page_anchor = v.map(|x| x.into());
4466 self
4467 }
4468
4469 /// Sets the value of [id][crate::model::document::Entity::id].
4470 ///
4471 /// # Example
4472 /// ```ignore,no_run
4473 /// # use google_cloud_documentai_v1::model::document::Entity;
4474 /// let x = Entity::new().set_id("example");
4475 /// ```
4476 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4477 self.id = v.into();
4478 self
4479 }
4480
4481 /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
4482 ///
4483 /// # Example
4484 /// ```ignore,no_run
4485 /// # use google_cloud_documentai_v1::model::document::Entity;
4486 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4487 /// let x = Entity::new().set_normalized_value(NormalizedValue::default()/* use setters */);
4488 /// ```
4489 pub fn set_normalized_value<T>(mut self, v: T) -> Self
4490 where
4491 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4492 {
4493 self.normalized_value = std::option::Option::Some(v.into());
4494 self
4495 }
4496
4497 /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
4498 ///
4499 /// # Example
4500 /// ```ignore,no_run
4501 /// # use google_cloud_documentai_v1::model::document::Entity;
4502 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4503 /// let x = Entity::new().set_or_clear_normalized_value(Some(NormalizedValue::default()/* use setters */));
4504 /// let x = Entity::new().set_or_clear_normalized_value(None::<NormalizedValue>);
4505 /// ```
4506 pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
4507 where
4508 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4509 {
4510 self.normalized_value = v.map(|x| x.into());
4511 self
4512 }
4513
4514 /// Sets the value of [properties][crate::model::document::Entity::properties].
4515 ///
4516 /// # Example
4517 /// ```ignore,no_run
4518 /// # use google_cloud_documentai_v1::model::document::Entity;
4519 /// let x = Entity::new()
4520 /// .set_properties([
4521 /// Entity::default()/* use setters */,
4522 /// Entity::default()/* use (different) setters */,
4523 /// ]);
4524 /// ```
4525 pub fn set_properties<T, V>(mut self, v: T) -> Self
4526 where
4527 T: std::iter::IntoIterator<Item = V>,
4528 V: std::convert::Into<crate::model::document::Entity>,
4529 {
4530 use std::iter::Iterator;
4531 self.properties = v.into_iter().map(|i| i.into()).collect();
4532 self
4533 }
4534
4535 /// Sets the value of [provenance][crate::model::document::Entity::provenance].
4536 ///
4537 /// # Example
4538 /// ```ignore,no_run
4539 /// # use google_cloud_documentai_v1::model::document::Entity;
4540 /// use google_cloud_documentai_v1::model::document::Provenance;
4541 /// let x = Entity::new().set_provenance(Provenance::default()/* use setters */);
4542 /// ```
4543 pub fn set_provenance<T>(mut self, v: T) -> Self
4544 where
4545 T: std::convert::Into<crate::model::document::Provenance>,
4546 {
4547 self.provenance = std::option::Option::Some(v.into());
4548 self
4549 }
4550
4551 /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
4552 ///
4553 /// # Example
4554 /// ```ignore,no_run
4555 /// # use google_cloud_documentai_v1::model::document::Entity;
4556 /// use google_cloud_documentai_v1::model::document::Provenance;
4557 /// let x = Entity::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
4558 /// let x = Entity::new().set_or_clear_provenance(None::<Provenance>);
4559 /// ```
4560 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
4561 where
4562 T: std::convert::Into<crate::model::document::Provenance>,
4563 {
4564 self.provenance = v.map(|x| x.into());
4565 self
4566 }
4567
4568 /// Sets the value of [redacted][crate::model::document::Entity::redacted].
4569 ///
4570 /// # Example
4571 /// ```ignore,no_run
4572 /// # use google_cloud_documentai_v1::model::document::Entity;
4573 /// let x = Entity::new().set_redacted(true);
4574 /// ```
4575 pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4576 self.redacted = v.into();
4577 self
4578 }
4579
4580 /// Sets the value of [method][crate::model::document::Entity::method].
4581 ///
4582 /// # Example
4583 /// ```ignore,no_run
4584 /// # use google_cloud_documentai_v1::model::document::Entity;
4585 /// use google_cloud_documentai_v1::model::document::entity::Method;
4586 /// let x0 = Entity::new().set_method(Method::Extract);
4587 /// let x1 = Entity::new().set_method(Method::Derive);
4588 /// ```
4589 pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
4590 mut self,
4591 v: T,
4592 ) -> Self {
4593 self.method = v.into();
4594 self
4595 }
4596 }
4597
4598 impl wkt::message::Message for Entity {
4599 fn typename() -> &'static str {
4600 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
4601 }
4602 }
4603
4604 /// Defines additional types related to [Entity].
4605 pub mod entity {
4606 #[allow(unused_imports)]
4607 use super::*;
4608
4609 /// Parsed and normalized entity value.
4610 #[derive(Clone, Default, PartialEq)]
4611 #[non_exhaustive]
4612 pub struct NormalizedValue {
4613 /// Optional. An optional field to store a normalized string.
4614 /// For some entity types, one of respective `structured_value` fields may
4615 /// also be populated. Also not all the types of `structured_value` will be
4616 /// normalized. For example, some processors may not generate `float`
4617 /// or `integer` normalized text by default.
4618 ///
4619 /// Below are sample formats mapped to structured values.
4620 ///
4621 /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
4622 /// - Date type (`date_value`) is in the ISO 8601 text format.
4623 /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
4624 pub text: std::string::String,
4625
4626 /// An optional structured entity value.
4627 /// Must match entity type defined in schema if
4628 /// known. If this field is present, the `text` field could also be
4629 /// populated.
4630 pub structured_value: std::option::Option<
4631 crate::model::document::entity::normalized_value::StructuredValue,
4632 >,
4633
4634 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4635 }
4636
4637 impl NormalizedValue {
4638 /// Creates a new default instance.
4639 pub fn new() -> Self {
4640 std::default::Default::default()
4641 }
4642
4643 /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
4644 ///
4645 /// # Example
4646 /// ```ignore,no_run
4647 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4648 /// let x = NormalizedValue::new().set_text("example");
4649 /// ```
4650 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4651 self.text = v.into();
4652 self
4653 }
4654
4655 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
4656 ///
4657 /// Note that all the setters affecting `structured_value` are mutually
4658 /// exclusive.
4659 ///
4660 /// # Example
4661 /// ```ignore,no_run
4662 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4663 /// use google_cloud_documentai_v1::model::document::entity::normalized_value::StructuredValue;
4664 /// let x = NormalizedValue::new().set_structured_value(Some(StructuredValue::BooleanValue(true)));
4665 /// ```
4666 pub fn set_structured_value<
4667 T: std::convert::Into<
4668 std::option::Option<
4669 crate::model::document::entity::normalized_value::StructuredValue,
4670 >,
4671 >,
4672 >(
4673 mut self,
4674 v: T,
4675 ) -> Self {
4676 self.structured_value = v.into();
4677 self
4678 }
4679
4680 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4681 /// if it holds a `MoneyValue`, `None` if the field is not set or
4682 /// holds a different branch.
4683 pub fn money_value(
4684 &self,
4685 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Money>>
4686 {
4687 #[allow(unreachable_patterns)]
4688 self.structured_value.as_ref().and_then(|v| match v {
4689 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
4690 _ => std::option::Option::None,
4691 })
4692 }
4693
4694 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4695 /// to hold a `MoneyValue`.
4696 ///
4697 /// Note that all the setters affecting `structured_value` are
4698 /// mutually exclusive.
4699 ///
4700 /// # Example
4701 /// ```ignore,no_run
4702 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4703 /// use google_cloud_type::model::Money;
4704 /// let x = NormalizedValue::new().set_money_value(Money::default()/* use setters */);
4705 /// assert!(x.money_value().is_some());
4706 /// assert!(x.date_value().is_none());
4707 /// assert!(x.datetime_value().is_none());
4708 /// assert!(x.address_value().is_none());
4709 /// assert!(x.boolean_value().is_none());
4710 /// assert!(x.integer_value().is_none());
4711 /// assert!(x.float_value().is_none());
4712 /// assert!(x.signature_value().is_none());
4713 /// ```
4714 pub fn set_money_value<
4715 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Money>>,
4716 >(
4717 mut self,
4718 v: T,
4719 ) -> Self {
4720 self.structured_value = std::option::Option::Some(
4721 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
4722 v.into(),
4723 ),
4724 );
4725 self
4726 }
4727
4728 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4729 /// if it holds a `DateValue`, `None` if the field is not set or
4730 /// holds a different branch.
4731 pub fn date_value(
4732 &self,
4733 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
4734 #[allow(unreachable_patterns)]
4735 self.structured_value.as_ref().and_then(|v| match v {
4736 crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
4737 _ => std::option::Option::None,
4738 })
4739 }
4740
4741 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4742 /// to hold a `DateValue`.
4743 ///
4744 /// Note that all the setters affecting `structured_value` are
4745 /// mutually exclusive.
4746 ///
4747 /// # Example
4748 /// ```ignore,no_run
4749 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4750 /// use google_cloud_type::model::Date;
4751 /// let x = NormalizedValue::new().set_date_value(Date::default()/* use setters */);
4752 /// assert!(x.date_value().is_some());
4753 /// assert!(x.money_value().is_none());
4754 /// assert!(x.datetime_value().is_none());
4755 /// assert!(x.address_value().is_none());
4756 /// assert!(x.boolean_value().is_none());
4757 /// assert!(x.integer_value().is_none());
4758 /// assert!(x.float_value().is_none());
4759 /// assert!(x.signature_value().is_none());
4760 /// ```
4761 pub fn set_date_value<
4762 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
4763 >(
4764 mut self,
4765 v: T,
4766 ) -> Self {
4767 self.structured_value = std::option::Option::Some(
4768 crate::model::document::entity::normalized_value::StructuredValue::DateValue(
4769 v.into(),
4770 ),
4771 );
4772 self
4773 }
4774
4775 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4776 /// if it holds a `DatetimeValue`, `None` if the field is not set or
4777 /// holds a different branch.
4778 pub fn datetime_value(
4779 &self,
4780 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::DateTime>>
4781 {
4782 #[allow(unreachable_patterns)]
4783 self.structured_value.as_ref().and_then(|v| match v {
4784 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
4785 _ => std::option::Option::None,
4786 })
4787 }
4788
4789 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4790 /// to hold a `DatetimeValue`.
4791 ///
4792 /// Note that all the setters affecting `structured_value` are
4793 /// mutually exclusive.
4794 ///
4795 /// # Example
4796 /// ```ignore,no_run
4797 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4798 /// use google_cloud_type::model::DateTime;
4799 /// let x = NormalizedValue::new().set_datetime_value(DateTime::default()/* use setters */);
4800 /// assert!(x.datetime_value().is_some());
4801 /// assert!(x.money_value().is_none());
4802 /// assert!(x.date_value().is_none());
4803 /// assert!(x.address_value().is_none());
4804 /// assert!(x.boolean_value().is_none());
4805 /// assert!(x.integer_value().is_none());
4806 /// assert!(x.float_value().is_none());
4807 /// assert!(x.signature_value().is_none());
4808 /// ```
4809 pub fn set_datetime_value<
4810 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::DateTime>>,
4811 >(
4812 mut self,
4813 v: T,
4814 ) -> Self {
4815 self.structured_value = std::option::Option::Some(
4816 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
4817 v.into()
4818 )
4819 );
4820 self
4821 }
4822
4823 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4824 /// if it holds a `AddressValue`, `None` if the field is not set or
4825 /// holds a different branch.
4826 pub fn address_value(
4827 &self,
4828 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>>
4829 {
4830 #[allow(unreachable_patterns)]
4831 self.structured_value.as_ref().and_then(|v| match v {
4832 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
4833 _ => std::option::Option::None,
4834 })
4835 }
4836
4837 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4838 /// to hold a `AddressValue`.
4839 ///
4840 /// Note that all the setters affecting `structured_value` are
4841 /// mutually exclusive.
4842 ///
4843 /// # Example
4844 /// ```ignore,no_run
4845 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4846 /// use google_cloud_type::model::PostalAddress;
4847 /// let x = NormalizedValue::new().set_address_value(PostalAddress::default()/* use setters */);
4848 /// assert!(x.address_value().is_some());
4849 /// assert!(x.money_value().is_none());
4850 /// assert!(x.date_value().is_none());
4851 /// assert!(x.datetime_value().is_none());
4852 /// assert!(x.boolean_value().is_none());
4853 /// assert!(x.integer_value().is_none());
4854 /// assert!(x.float_value().is_none());
4855 /// assert!(x.signature_value().is_none());
4856 /// ```
4857 pub fn set_address_value<
4858 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
4859 >(
4860 mut self,
4861 v: T,
4862 ) -> Self {
4863 self.structured_value = std::option::Option::Some(
4864 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
4865 v.into(),
4866 ),
4867 );
4868 self
4869 }
4870
4871 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4872 /// if it holds a `BooleanValue`, `None` if the field is not set or
4873 /// holds a different branch.
4874 pub fn boolean_value(&self) -> std::option::Option<&bool> {
4875 #[allow(unreachable_patterns)]
4876 self.structured_value.as_ref().and_then(|v| match v {
4877 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
4878 _ => std::option::Option::None,
4879 })
4880 }
4881
4882 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4883 /// to hold a `BooleanValue`.
4884 ///
4885 /// Note that all the setters affecting `structured_value` are
4886 /// mutually exclusive.
4887 ///
4888 /// # Example
4889 /// ```ignore,no_run
4890 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4891 /// let x = NormalizedValue::new().set_boolean_value(true);
4892 /// assert!(x.boolean_value().is_some());
4893 /// assert!(x.money_value().is_none());
4894 /// assert!(x.date_value().is_none());
4895 /// assert!(x.datetime_value().is_none());
4896 /// assert!(x.address_value().is_none());
4897 /// assert!(x.integer_value().is_none());
4898 /// assert!(x.float_value().is_none());
4899 /// assert!(x.signature_value().is_none());
4900 /// ```
4901 pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4902 self.structured_value = std::option::Option::Some(
4903 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
4904 v.into(),
4905 ),
4906 );
4907 self
4908 }
4909
4910 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4911 /// if it holds a `IntegerValue`, `None` if the field is not set or
4912 /// holds a different branch.
4913 pub fn integer_value(&self) -> std::option::Option<&i32> {
4914 #[allow(unreachable_patterns)]
4915 self.structured_value.as_ref().and_then(|v| match v {
4916 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
4917 _ => std::option::Option::None,
4918 })
4919 }
4920
4921 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4922 /// to hold a `IntegerValue`.
4923 ///
4924 /// Note that all the setters affecting `structured_value` are
4925 /// mutually exclusive.
4926 ///
4927 /// # Example
4928 /// ```ignore,no_run
4929 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4930 /// let x = NormalizedValue::new().set_integer_value(42);
4931 /// assert!(x.integer_value().is_some());
4932 /// assert!(x.money_value().is_none());
4933 /// assert!(x.date_value().is_none());
4934 /// assert!(x.datetime_value().is_none());
4935 /// assert!(x.address_value().is_none());
4936 /// assert!(x.boolean_value().is_none());
4937 /// assert!(x.float_value().is_none());
4938 /// assert!(x.signature_value().is_none());
4939 /// ```
4940 pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4941 self.structured_value = std::option::Option::Some(
4942 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
4943 v.into(),
4944 ),
4945 );
4946 self
4947 }
4948
4949 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4950 /// if it holds a `FloatValue`, `None` if the field is not set or
4951 /// holds a different branch.
4952 pub fn float_value(&self) -> std::option::Option<&f32> {
4953 #[allow(unreachable_patterns)]
4954 self.structured_value.as_ref().and_then(|v| match v {
4955 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
4956 _ => std::option::Option::None,
4957 })
4958 }
4959
4960 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4961 /// to hold a `FloatValue`.
4962 ///
4963 /// Note that all the setters affecting `structured_value` are
4964 /// mutually exclusive.
4965 ///
4966 /// # Example
4967 /// ```ignore,no_run
4968 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4969 /// let x = NormalizedValue::new().set_float_value(42.0);
4970 /// assert!(x.float_value().is_some());
4971 /// assert!(x.money_value().is_none());
4972 /// assert!(x.date_value().is_none());
4973 /// assert!(x.datetime_value().is_none());
4974 /// assert!(x.address_value().is_none());
4975 /// assert!(x.boolean_value().is_none());
4976 /// assert!(x.integer_value().is_none());
4977 /// assert!(x.signature_value().is_none());
4978 /// ```
4979 pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4980 self.structured_value = std::option::Option::Some(
4981 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
4982 v.into(),
4983 ),
4984 );
4985 self
4986 }
4987
4988 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4989 /// if it holds a `SignatureValue`, `None` if the field is not set or
4990 /// holds a different branch.
4991 pub fn signature_value(&self) -> std::option::Option<&bool> {
4992 #[allow(unreachable_patterns)]
4993 self.structured_value.as_ref().and_then(|v| match v {
4994 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
4995 _ => std::option::Option::None,
4996 })
4997 }
4998
4999 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
5000 /// to hold a `SignatureValue`.
5001 ///
5002 /// Note that all the setters affecting `structured_value` are
5003 /// mutually exclusive.
5004 ///
5005 /// # Example
5006 /// ```ignore,no_run
5007 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
5008 /// let x = NormalizedValue::new().set_signature_value(true);
5009 /// assert!(x.signature_value().is_some());
5010 /// assert!(x.money_value().is_none());
5011 /// assert!(x.date_value().is_none());
5012 /// assert!(x.datetime_value().is_none());
5013 /// assert!(x.address_value().is_none());
5014 /// assert!(x.boolean_value().is_none());
5015 /// assert!(x.integer_value().is_none());
5016 /// assert!(x.float_value().is_none());
5017 /// ```
5018 pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5019 self.structured_value = std::option::Option::Some(
5020 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
5021 v.into()
5022 )
5023 );
5024 self
5025 }
5026 }
5027
5028 impl wkt::message::Message for NormalizedValue {
5029 fn typename() -> &'static str {
5030 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
5031 }
5032 }
5033
5034 /// Defines additional types related to [NormalizedValue].
5035 pub mod normalized_value {
5036 #[allow(unused_imports)]
5037 use super::*;
5038
5039 /// An optional structured entity value.
5040 /// Must match entity type defined in schema if
5041 /// known. If this field is present, the `text` field could also be
5042 /// populated.
5043 #[derive(Clone, Debug, PartialEq)]
5044 #[non_exhaustive]
5045 pub enum StructuredValue {
5046 /// Money value. See also:
5047 /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
5048 MoneyValue(std::boxed::Box<google_cloud_type::model::Money>),
5049 /// Date value. Includes year, month, day. See also:
5050 /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
5051 DateValue(std::boxed::Box<google_cloud_type::model::Date>),
5052 /// DateTime value. Includes date, time, and timezone. See also:
5053 /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
5054 DatetimeValue(std::boxed::Box<google_cloud_type::model::DateTime>),
5055 /// Postal address. See also:
5056 /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
5057 AddressValue(std::boxed::Box<google_cloud_type::model::PostalAddress>),
5058 /// Boolean value. Can be used for entities with binary values, or for
5059 /// checkboxes.
5060 BooleanValue(bool),
5061 /// Integer value.
5062 IntegerValue(i32),
5063 /// Float value.
5064 FloatValue(f32),
5065 /// A signature - a graphical representation of a person's name,
5066 /// often used to sign a document.
5067 SignatureValue(bool),
5068 }
5069 }
5070
5071 /// Specifies how the entity's value is obtained.
5072 ///
5073 /// # Working with unknown values
5074 ///
5075 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5076 /// additional enum variants at any time. Adding new variants is not considered
5077 /// a breaking change. Applications should write their code in anticipation of:
5078 ///
5079 /// - New values appearing in future releases of the client library, **and**
5080 /// - New values received dynamically, without application changes.
5081 ///
5082 /// Please consult the [Working with enums] section in the user guide for some
5083 /// guidelines.
5084 ///
5085 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5086 #[derive(Clone, Debug, PartialEq)]
5087 #[non_exhaustive]
5088 pub enum Method {
5089 /// When the method is not specified, it should be treated as `EXTRACT`.
5090 Unspecified,
5091 /// The entity's value is directly extracted as-is from the document
5092 /// text.
5093 Extract,
5094 /// The entity's value is derived through inference and is not
5095 /// necessarily an exact text extraction from the document.
5096 Derive,
5097 /// If set, the enum was initialized with an unknown value.
5098 ///
5099 /// Applications can examine the value using [Method::value] or
5100 /// [Method::name].
5101 UnknownValue(method::UnknownValue),
5102 }
5103
5104 #[doc(hidden)]
5105 pub mod method {
5106 #[allow(unused_imports)]
5107 use super::*;
5108 #[derive(Clone, Debug, PartialEq)]
5109 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5110 }
5111
5112 impl Method {
5113 /// Gets the enum value.
5114 ///
5115 /// Returns `None` if the enum contains an unknown value deserialized from
5116 /// the string representation of enums.
5117 pub fn value(&self) -> std::option::Option<i32> {
5118 match self {
5119 Self::Unspecified => std::option::Option::Some(0),
5120 Self::Extract => std::option::Option::Some(1),
5121 Self::Derive => std::option::Option::Some(2),
5122 Self::UnknownValue(u) => u.0.value(),
5123 }
5124 }
5125
5126 /// Gets the enum value as a string.
5127 ///
5128 /// Returns `None` if the enum contains an unknown value deserialized from
5129 /// the integer representation of enums.
5130 pub fn name(&self) -> std::option::Option<&str> {
5131 match self {
5132 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
5133 Self::Extract => std::option::Option::Some("EXTRACT"),
5134 Self::Derive => std::option::Option::Some("DERIVE"),
5135 Self::UnknownValue(u) => u.0.name(),
5136 }
5137 }
5138 }
5139
5140 impl std::default::Default for Method {
5141 fn default() -> Self {
5142 use std::convert::From;
5143 Self::from(0)
5144 }
5145 }
5146
5147 impl std::fmt::Display for Method {
5148 fn fmt(
5149 &self,
5150 f: &mut std::fmt::Formatter<'_>,
5151 ) -> std::result::Result<(), std::fmt::Error> {
5152 wkt::internal::display_enum(f, self.name(), self.value())
5153 }
5154 }
5155
5156 impl std::convert::From<i32> for Method {
5157 fn from(value: i32) -> Self {
5158 match value {
5159 0 => Self::Unspecified,
5160 1 => Self::Extract,
5161 2 => Self::Derive,
5162 _ => Self::UnknownValue(method::UnknownValue(
5163 wkt::internal::UnknownEnumValue::Integer(value),
5164 )),
5165 }
5166 }
5167 }
5168
5169 impl std::convert::From<&str> for Method {
5170 fn from(value: &str) -> Self {
5171 use std::string::ToString;
5172 match value {
5173 "METHOD_UNSPECIFIED" => Self::Unspecified,
5174 "EXTRACT" => Self::Extract,
5175 "DERIVE" => Self::Derive,
5176 _ => Self::UnknownValue(method::UnknownValue(
5177 wkt::internal::UnknownEnumValue::String(value.to_string()),
5178 )),
5179 }
5180 }
5181 }
5182
5183 impl serde::ser::Serialize for Method {
5184 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5185 where
5186 S: serde::Serializer,
5187 {
5188 match self {
5189 Self::Unspecified => serializer.serialize_i32(0),
5190 Self::Extract => serializer.serialize_i32(1),
5191 Self::Derive => serializer.serialize_i32(2),
5192 Self::UnknownValue(u) => u.0.serialize(serializer),
5193 }
5194 }
5195 }
5196
5197 impl<'de> serde::de::Deserialize<'de> for Method {
5198 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5199 where
5200 D: serde::Deserializer<'de>,
5201 {
5202 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
5203 ".google.cloud.documentai.v1.Document.Entity.Method",
5204 ))
5205 }
5206 }
5207 }
5208
5209 /// Relationship between
5210 /// [Entities][google.cloud.documentai.v1.Document.Entity].
5211 ///
5212 /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
5213 #[derive(Clone, Default, PartialEq)]
5214 #[non_exhaustive]
5215 pub struct EntityRelation {
5216 /// Subject entity id.
5217 pub subject_id: std::string::String,
5218
5219 /// Object entity id.
5220 pub object_id: std::string::String,
5221
5222 /// Relationship description.
5223 pub relation: std::string::String,
5224
5225 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5226 }
5227
5228 impl EntityRelation {
5229 /// Creates a new default instance.
5230 pub fn new() -> Self {
5231 std::default::Default::default()
5232 }
5233
5234 /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
5235 ///
5236 /// # Example
5237 /// ```ignore,no_run
5238 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5239 /// let x = EntityRelation::new().set_subject_id("example");
5240 /// ```
5241 pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5242 self.subject_id = v.into();
5243 self
5244 }
5245
5246 /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
5247 ///
5248 /// # Example
5249 /// ```ignore,no_run
5250 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5251 /// let x = EntityRelation::new().set_object_id("example");
5252 /// ```
5253 pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5254 self.object_id = v.into();
5255 self
5256 }
5257
5258 /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
5259 ///
5260 /// # Example
5261 /// ```ignore,no_run
5262 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5263 /// let x = EntityRelation::new().set_relation("example");
5264 /// ```
5265 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5266 self.relation = v.into();
5267 self
5268 }
5269 }
5270
5271 impl wkt::message::Message for EntityRelation {
5272 fn typename() -> &'static str {
5273 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
5274 }
5275 }
5276
5277 /// Text reference indexing into the
5278 /// [Document.text][google.cloud.documentai.v1.Document.text].
5279 ///
5280 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5281 #[derive(Clone, Default, PartialEq)]
5282 #[non_exhaustive]
5283 pub struct TextAnchor {
5284 /// The text segments from the
5285 /// [Document.text][google.cloud.documentai.v1.Document.text].
5286 ///
5287 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5288 pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
5289
5290 /// Contains the content of the text span so that users do
5291 /// not have to look it up in the text_segments. It is always
5292 /// populated for formFields.
5293 pub content: std::string::String,
5294
5295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5296 }
5297
5298 impl TextAnchor {
5299 /// Creates a new default instance.
5300 pub fn new() -> Self {
5301 std::default::Default::default()
5302 }
5303
5304 /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
5305 ///
5306 /// # Example
5307 /// ```ignore,no_run
5308 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5309 /// use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5310 /// let x = TextAnchor::new()
5311 /// .set_text_segments([
5312 /// TextSegment::default()/* use setters */,
5313 /// TextSegment::default()/* use (different) setters */,
5314 /// ]);
5315 /// ```
5316 pub fn set_text_segments<T, V>(mut self, v: T) -> Self
5317 where
5318 T: std::iter::IntoIterator<Item = V>,
5319 V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
5320 {
5321 use std::iter::Iterator;
5322 self.text_segments = v.into_iter().map(|i| i.into()).collect();
5323 self
5324 }
5325
5326 /// Sets the value of [content][crate::model::document::TextAnchor::content].
5327 ///
5328 /// # Example
5329 /// ```ignore,no_run
5330 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5331 /// let x = TextAnchor::new().set_content("example");
5332 /// ```
5333 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5334 self.content = v.into();
5335 self
5336 }
5337 }
5338
5339 impl wkt::message::Message for TextAnchor {
5340 fn typename() -> &'static str {
5341 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
5342 }
5343 }
5344
5345 /// Defines additional types related to [TextAnchor].
5346 pub mod text_anchor {
5347 #[allow(unused_imports)]
5348 use super::*;
5349
5350 /// A text segment in the
5351 /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
5352 /// may be out of bounds which indicate that the text extends into another
5353 /// document shard for large sharded documents. See
5354 /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
5355 ///
5356 /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
5357 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5358 #[derive(Clone, Default, PartialEq)]
5359 #[non_exhaustive]
5360 pub struct TextSegment {
5361 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5362 /// start UTF-8 char index in the
5363 /// [Document.text][google.cloud.documentai.v1.Document.text].
5364 ///
5365 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5366 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5367 pub start_index: i64,
5368
5369 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5370 /// half open end UTF-8 char index in the
5371 /// [Document.text][google.cloud.documentai.v1.Document.text].
5372 ///
5373 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5374 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5375 pub end_index: i64,
5376
5377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5378 }
5379
5380 impl TextSegment {
5381 /// Creates a new default instance.
5382 pub fn new() -> Self {
5383 std::default::Default::default()
5384 }
5385
5386 /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
5387 ///
5388 /// # Example
5389 /// ```ignore,no_run
5390 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5391 /// let x = TextSegment::new().set_start_index(42);
5392 /// ```
5393 pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5394 self.start_index = v.into();
5395 self
5396 }
5397
5398 /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
5399 ///
5400 /// # Example
5401 /// ```ignore,no_run
5402 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5403 /// let x = TextSegment::new().set_end_index(42);
5404 /// ```
5405 pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5406 self.end_index = v.into();
5407 self
5408 }
5409 }
5410
5411 impl wkt::message::Message for TextSegment {
5412 fn typename() -> &'static str {
5413 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
5414 }
5415 }
5416 }
5417
5418 /// Referencing the visual context of the entity in the
5419 /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
5420 /// can be cross-page, consist of multiple bounding polygons and optionally
5421 /// reference specific layout element types.
5422 ///
5423 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5424 #[derive(Clone, Default, PartialEq)]
5425 #[non_exhaustive]
5426 pub struct PageAnchor {
5427 /// One or more references to visual page elements
5428 pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
5429
5430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5431 }
5432
5433 impl PageAnchor {
5434 /// Creates a new default instance.
5435 pub fn new() -> Self {
5436 std::default::Default::default()
5437 }
5438
5439 /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
5440 ///
5441 /// # Example
5442 /// ```ignore,no_run
5443 /// # use google_cloud_documentai_v1::model::document::PageAnchor;
5444 /// use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5445 /// let x = PageAnchor::new()
5446 /// .set_page_refs([
5447 /// PageRef::default()/* use setters */,
5448 /// PageRef::default()/* use (different) setters */,
5449 /// ]);
5450 /// ```
5451 pub fn set_page_refs<T, V>(mut self, v: T) -> Self
5452 where
5453 T: std::iter::IntoIterator<Item = V>,
5454 V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
5455 {
5456 use std::iter::Iterator;
5457 self.page_refs = v.into_iter().map(|i| i.into()).collect();
5458 self
5459 }
5460 }
5461
5462 impl wkt::message::Message for PageAnchor {
5463 fn typename() -> &'static str {
5464 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
5465 }
5466 }
5467
5468 /// Defines additional types related to [PageAnchor].
5469 pub mod page_anchor {
5470 #[allow(unused_imports)]
5471 use super::*;
5472
5473 /// Represents a weak reference to a page element within a document.
5474 #[derive(Clone, Default, PartialEq)]
5475 #[non_exhaustive]
5476 pub struct PageRef {
5477 /// Required. Index into the
5478 /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
5479 /// for example using
5480 /// `[Document.pages][page_refs.page]` to locate the related page element.
5481 /// This field is skipped when its value is the default `0`. See
5482 /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
5483 ///
5484 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5485 pub page: i64,
5486
5487 /// Optional. The type of the layout element that is being referenced if
5488 /// any.
5489 pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
5490
5491 /// Optional. Deprecated. Use
5492 /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
5493 /// instead.
5494 ///
5495 /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
5496 #[deprecated]
5497 pub layout_id: std::string::String,
5498
5499 /// Optional. Identifies the bounding polygon of a layout element on the
5500 /// page. If `layout_type` is set, the bounding polygon must be exactly the
5501 /// same to the layout element it's referring to.
5502 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
5503
5504 /// Optional. Confidence of detected page element, if applicable. Range
5505 /// `[0, 1]`.
5506 pub confidence: f32,
5507
5508 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5509 }
5510
5511 impl PageRef {
5512 /// Creates a new default instance.
5513 pub fn new() -> Self {
5514 std::default::Default::default()
5515 }
5516
5517 /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
5518 ///
5519 /// # Example
5520 /// ```ignore,no_run
5521 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5522 /// let x = PageRef::new().set_page(42);
5523 /// ```
5524 pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5525 self.page = v.into();
5526 self
5527 }
5528
5529 /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
5530 ///
5531 /// # Example
5532 /// ```ignore,no_run
5533 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5534 /// use google_cloud_documentai_v1::model::document::page_anchor::page_ref::LayoutType;
5535 /// let x0 = PageRef::new().set_layout_type(LayoutType::Block);
5536 /// let x1 = PageRef::new().set_layout_type(LayoutType::Paragraph);
5537 /// let x2 = PageRef::new().set_layout_type(LayoutType::Line);
5538 /// ```
5539 pub fn set_layout_type<
5540 T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
5541 >(
5542 mut self,
5543 v: T,
5544 ) -> Self {
5545 self.layout_type = v.into();
5546 self
5547 }
5548
5549 /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
5550 ///
5551 /// # Example
5552 /// ```ignore,no_run
5553 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5554 /// let x = PageRef::new().set_layout_id("example");
5555 /// ```
5556 #[deprecated]
5557 pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
5558 mut self,
5559 v: T,
5560 ) -> Self {
5561 self.layout_id = v.into();
5562 self
5563 }
5564
5565 /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5566 ///
5567 /// # Example
5568 /// ```ignore,no_run
5569 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5570 /// use google_cloud_documentai_v1::model::BoundingPoly;
5571 /// let x = PageRef::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
5572 /// ```
5573 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
5574 where
5575 T: std::convert::Into<crate::model::BoundingPoly>,
5576 {
5577 self.bounding_poly = std::option::Option::Some(v.into());
5578 self
5579 }
5580
5581 /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5582 ///
5583 /// # Example
5584 /// ```ignore,no_run
5585 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5586 /// use google_cloud_documentai_v1::model::BoundingPoly;
5587 /// let x = PageRef::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
5588 /// let x = PageRef::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
5589 /// ```
5590 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
5591 where
5592 T: std::convert::Into<crate::model::BoundingPoly>,
5593 {
5594 self.bounding_poly = v.map(|x| x.into());
5595 self
5596 }
5597
5598 /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
5599 ///
5600 /// # Example
5601 /// ```ignore,no_run
5602 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5603 /// let x = PageRef::new().set_confidence(42.0);
5604 /// ```
5605 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5606 self.confidence = v.into();
5607 self
5608 }
5609 }
5610
5611 impl wkt::message::Message for PageRef {
5612 fn typename() -> &'static str {
5613 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
5614 }
5615 }
5616
5617 /// Defines additional types related to [PageRef].
5618 pub mod page_ref {
5619 #[allow(unused_imports)]
5620 use super::*;
5621
5622 /// The type of layout that is being referenced.
5623 ///
5624 /// # Working with unknown values
5625 ///
5626 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5627 /// additional enum variants at any time. Adding new variants is not considered
5628 /// a breaking change. Applications should write their code in anticipation of:
5629 ///
5630 /// - New values appearing in future releases of the client library, **and**
5631 /// - New values received dynamically, without application changes.
5632 ///
5633 /// Please consult the [Working with enums] section in the user guide for some
5634 /// guidelines.
5635 ///
5636 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5637 #[derive(Clone, Debug, PartialEq)]
5638 #[non_exhaustive]
5639 pub enum LayoutType {
5640 /// Layout Unspecified.
5641 Unspecified,
5642 /// References a
5643 /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
5644 /// element.
5645 ///
5646 /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
5647 Block,
5648 /// References a
5649 /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
5650 /// element.
5651 ///
5652 /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
5653 Paragraph,
5654 /// References a
5655 /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
5656 ///
5657 /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
5658 Line,
5659 /// References a
5660 /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
5661 /// element.
5662 ///
5663 /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
5664 Token,
5665 /// References a
5666 /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
5667 /// element.
5668 ///
5669 /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
5670 VisualElement,
5671 /// Refrrences a
5672 /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
5673 /// element.
5674 ///
5675 /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
5676 Table,
5677 /// References a
5678 /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
5679 /// element.
5680 ///
5681 /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
5682 FormField,
5683 /// If set, the enum was initialized with an unknown value.
5684 ///
5685 /// Applications can examine the value using [LayoutType::value] or
5686 /// [LayoutType::name].
5687 UnknownValue(layout_type::UnknownValue),
5688 }
5689
5690 #[doc(hidden)]
5691 pub mod layout_type {
5692 #[allow(unused_imports)]
5693 use super::*;
5694 #[derive(Clone, Debug, PartialEq)]
5695 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5696 }
5697
5698 impl LayoutType {
5699 /// Gets the enum value.
5700 ///
5701 /// Returns `None` if the enum contains an unknown value deserialized from
5702 /// the string representation of enums.
5703 pub fn value(&self) -> std::option::Option<i32> {
5704 match self {
5705 Self::Unspecified => std::option::Option::Some(0),
5706 Self::Block => std::option::Option::Some(1),
5707 Self::Paragraph => std::option::Option::Some(2),
5708 Self::Line => std::option::Option::Some(3),
5709 Self::Token => std::option::Option::Some(4),
5710 Self::VisualElement => std::option::Option::Some(5),
5711 Self::Table => std::option::Option::Some(6),
5712 Self::FormField => std::option::Option::Some(7),
5713 Self::UnknownValue(u) => u.0.value(),
5714 }
5715 }
5716
5717 /// Gets the enum value as a string.
5718 ///
5719 /// Returns `None` if the enum contains an unknown value deserialized from
5720 /// the integer representation of enums.
5721 pub fn name(&self) -> std::option::Option<&str> {
5722 match self {
5723 Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
5724 Self::Block => std::option::Option::Some("BLOCK"),
5725 Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
5726 Self::Line => std::option::Option::Some("LINE"),
5727 Self::Token => std::option::Option::Some("TOKEN"),
5728 Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
5729 Self::Table => std::option::Option::Some("TABLE"),
5730 Self::FormField => std::option::Option::Some("FORM_FIELD"),
5731 Self::UnknownValue(u) => u.0.name(),
5732 }
5733 }
5734 }
5735
5736 impl std::default::Default for LayoutType {
5737 fn default() -> Self {
5738 use std::convert::From;
5739 Self::from(0)
5740 }
5741 }
5742
5743 impl std::fmt::Display for LayoutType {
5744 fn fmt(
5745 &self,
5746 f: &mut std::fmt::Formatter<'_>,
5747 ) -> std::result::Result<(), std::fmt::Error> {
5748 wkt::internal::display_enum(f, self.name(), self.value())
5749 }
5750 }
5751
5752 impl std::convert::From<i32> for LayoutType {
5753 fn from(value: i32) -> Self {
5754 match value {
5755 0 => Self::Unspecified,
5756 1 => Self::Block,
5757 2 => Self::Paragraph,
5758 3 => Self::Line,
5759 4 => Self::Token,
5760 5 => Self::VisualElement,
5761 6 => Self::Table,
5762 7 => Self::FormField,
5763 _ => Self::UnknownValue(layout_type::UnknownValue(
5764 wkt::internal::UnknownEnumValue::Integer(value),
5765 )),
5766 }
5767 }
5768 }
5769
5770 impl std::convert::From<&str> for LayoutType {
5771 fn from(value: &str) -> Self {
5772 use std::string::ToString;
5773 match value {
5774 "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
5775 "BLOCK" => Self::Block,
5776 "PARAGRAPH" => Self::Paragraph,
5777 "LINE" => Self::Line,
5778 "TOKEN" => Self::Token,
5779 "VISUAL_ELEMENT" => Self::VisualElement,
5780 "TABLE" => Self::Table,
5781 "FORM_FIELD" => Self::FormField,
5782 _ => Self::UnknownValue(layout_type::UnknownValue(
5783 wkt::internal::UnknownEnumValue::String(value.to_string()),
5784 )),
5785 }
5786 }
5787 }
5788
5789 impl serde::ser::Serialize for LayoutType {
5790 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5791 where
5792 S: serde::Serializer,
5793 {
5794 match self {
5795 Self::Unspecified => serializer.serialize_i32(0),
5796 Self::Block => serializer.serialize_i32(1),
5797 Self::Paragraph => serializer.serialize_i32(2),
5798 Self::Line => serializer.serialize_i32(3),
5799 Self::Token => serializer.serialize_i32(4),
5800 Self::VisualElement => serializer.serialize_i32(5),
5801 Self::Table => serializer.serialize_i32(6),
5802 Self::FormField => serializer.serialize_i32(7),
5803 Self::UnknownValue(u) => u.0.serialize(serializer),
5804 }
5805 }
5806 }
5807
5808 impl<'de> serde::de::Deserialize<'de> for LayoutType {
5809 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5810 where
5811 D: serde::Deserializer<'de>,
5812 {
5813 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
5814 ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
5815 ))
5816 }
5817 }
5818 }
5819 }
5820
5821 /// Structure to identify provenance relationships between annotations in
5822 /// different revisions.
5823 #[derive(Clone, Default, PartialEq)]
5824 #[non_exhaustive]
5825 pub struct Provenance {
5826 /// The index of the revision that produced this element.
5827 #[deprecated]
5828 pub revision: i32,
5829
5830 /// The Id of this operation. Needs to be unique within the scope of the
5831 /// revision.
5832 #[deprecated]
5833 pub id: i32,
5834
5835 /// References to the original elements that are replaced.
5836 pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
5837
5838 /// The type of provenance operation.
5839 pub r#type: crate::model::document::provenance::OperationType,
5840
5841 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5842 }
5843
5844 impl Provenance {
5845 /// Creates a new default instance.
5846 pub fn new() -> Self {
5847 std::default::Default::default()
5848 }
5849
5850 /// Sets the value of [revision][crate::model::document::Provenance::revision].
5851 ///
5852 /// # Example
5853 /// ```ignore,no_run
5854 /// # use google_cloud_documentai_v1::model::document::Provenance;
5855 /// let x = Provenance::new().set_revision(42);
5856 /// ```
5857 #[deprecated]
5858 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5859 self.revision = v.into();
5860 self
5861 }
5862
5863 /// Sets the value of [id][crate::model::document::Provenance::id].
5864 ///
5865 /// # Example
5866 /// ```ignore,no_run
5867 /// # use google_cloud_documentai_v1::model::document::Provenance;
5868 /// let x = Provenance::new().set_id(42);
5869 /// ```
5870 #[deprecated]
5871 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5872 self.id = v.into();
5873 self
5874 }
5875
5876 /// Sets the value of [parents][crate::model::document::Provenance::parents].
5877 ///
5878 /// # Example
5879 /// ```ignore,no_run
5880 /// # use google_cloud_documentai_v1::model::document::Provenance;
5881 /// use google_cloud_documentai_v1::model::document::provenance::Parent;
5882 /// let x = Provenance::new()
5883 /// .set_parents([
5884 /// Parent::default()/* use setters */,
5885 /// Parent::default()/* use (different) setters */,
5886 /// ]);
5887 /// ```
5888 pub fn set_parents<T, V>(mut self, v: T) -> Self
5889 where
5890 T: std::iter::IntoIterator<Item = V>,
5891 V: std::convert::Into<crate::model::document::provenance::Parent>,
5892 {
5893 use std::iter::Iterator;
5894 self.parents = v.into_iter().map(|i| i.into()).collect();
5895 self
5896 }
5897
5898 /// Sets the value of [r#type][crate::model::document::Provenance::type].
5899 ///
5900 /// # Example
5901 /// ```ignore,no_run
5902 /// # use google_cloud_documentai_v1::model::document::Provenance;
5903 /// use google_cloud_documentai_v1::model::document::provenance::OperationType;
5904 /// let x0 = Provenance::new().set_type(OperationType::Add);
5905 /// let x1 = Provenance::new().set_type(OperationType::Remove);
5906 /// let x2 = Provenance::new().set_type(OperationType::Update);
5907 /// ```
5908 pub fn set_type<
5909 T: std::convert::Into<crate::model::document::provenance::OperationType>,
5910 >(
5911 mut self,
5912 v: T,
5913 ) -> Self {
5914 self.r#type = v.into();
5915 self
5916 }
5917 }
5918
5919 impl wkt::message::Message for Provenance {
5920 fn typename() -> &'static str {
5921 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
5922 }
5923 }
5924
5925 /// Defines additional types related to [Provenance].
5926 pub mod provenance {
5927 #[allow(unused_imports)]
5928 use super::*;
5929
5930 /// The parent element the current element is based on. Used for
5931 /// referencing/aligning, removal and replacement operations.
5932 #[derive(Clone, Default, PartialEq)]
5933 #[non_exhaustive]
5934 pub struct Parent {
5935 /// The index of the index into current revision's parent_ids list.
5936 pub revision: i32,
5937
5938 /// The index of the parent item in the corresponding item list (eg. list
5939 /// of entities, properties within entities, etc.) in the parent revision.
5940 pub index: i32,
5941
5942 /// The id of the parent provenance.
5943 #[deprecated]
5944 pub id: i32,
5945
5946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5947 }
5948
5949 impl Parent {
5950 /// Creates a new default instance.
5951 pub fn new() -> Self {
5952 std::default::Default::default()
5953 }
5954
5955 /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
5956 ///
5957 /// # Example
5958 /// ```ignore,no_run
5959 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5960 /// let x = Parent::new().set_revision(42);
5961 /// ```
5962 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5963 self.revision = v.into();
5964 self
5965 }
5966
5967 /// Sets the value of [index][crate::model::document::provenance::Parent::index].
5968 ///
5969 /// # Example
5970 /// ```ignore,no_run
5971 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5972 /// let x = Parent::new().set_index(42);
5973 /// ```
5974 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5975 self.index = v.into();
5976 self
5977 }
5978
5979 /// Sets the value of [id][crate::model::document::provenance::Parent::id].
5980 ///
5981 /// # Example
5982 /// ```ignore,no_run
5983 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5984 /// let x = Parent::new().set_id(42);
5985 /// ```
5986 #[deprecated]
5987 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5988 self.id = v.into();
5989 self
5990 }
5991 }
5992
5993 impl wkt::message::Message for Parent {
5994 fn typename() -> &'static str {
5995 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
5996 }
5997 }
5998
5999 /// If a processor or agent does an explicit operation on existing elements.
6000 ///
6001 /// # Working with unknown values
6002 ///
6003 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6004 /// additional enum variants at any time. Adding new variants is not considered
6005 /// a breaking change. Applications should write their code in anticipation of:
6006 ///
6007 /// - New values appearing in future releases of the client library, **and**
6008 /// - New values received dynamically, without application changes.
6009 ///
6010 /// Please consult the [Working with enums] section in the user guide for some
6011 /// guidelines.
6012 ///
6013 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6014 #[derive(Clone, Debug, PartialEq)]
6015 #[non_exhaustive]
6016 pub enum OperationType {
6017 /// Operation type unspecified. If no operation is specified a provenance
6018 /// entry is simply used to match against a `parent`.
6019 Unspecified,
6020 /// Add an element.
6021 Add,
6022 /// Remove an element identified by `parent`.
6023 Remove,
6024 /// Updates any fields within the given provenance scope of the message. It
6025 /// overwrites the fields rather than replacing them. Use this when you
6026 /// want to update a field value of an entity without also updating all the
6027 /// child properties.
6028 Update,
6029 /// Currently unused. Replace an element identified by `parent`.
6030 Replace,
6031 /// Deprecated. Request human review for the element identified by
6032 /// `parent`.
6033 #[deprecated]
6034 EvalRequested,
6035 /// Deprecated. Element is reviewed and approved at human review,
6036 /// confidence will be set to 1.0.
6037 #[deprecated]
6038 EvalApproved,
6039 /// Deprecated. Element is skipped in the validation process.
6040 #[deprecated]
6041 EvalSkipped,
6042 /// If set, the enum was initialized with an unknown value.
6043 ///
6044 /// Applications can examine the value using [OperationType::value] or
6045 /// [OperationType::name].
6046 UnknownValue(operation_type::UnknownValue),
6047 }
6048
6049 #[doc(hidden)]
6050 pub mod operation_type {
6051 #[allow(unused_imports)]
6052 use super::*;
6053 #[derive(Clone, Debug, PartialEq)]
6054 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6055 }
6056
6057 impl OperationType {
6058 /// Gets the enum value.
6059 ///
6060 /// Returns `None` if the enum contains an unknown value deserialized from
6061 /// the string representation of enums.
6062 pub fn value(&self) -> std::option::Option<i32> {
6063 match self {
6064 Self::Unspecified => std::option::Option::Some(0),
6065 Self::Add => std::option::Option::Some(1),
6066 Self::Remove => std::option::Option::Some(2),
6067 Self::Update => std::option::Option::Some(7),
6068 Self::Replace => std::option::Option::Some(3),
6069 Self::EvalRequested => std::option::Option::Some(4),
6070 Self::EvalApproved => std::option::Option::Some(5),
6071 Self::EvalSkipped => std::option::Option::Some(6),
6072 Self::UnknownValue(u) => u.0.value(),
6073 }
6074 }
6075
6076 /// Gets the enum value as a string.
6077 ///
6078 /// Returns `None` if the enum contains an unknown value deserialized from
6079 /// the integer representation of enums.
6080 pub fn name(&self) -> std::option::Option<&str> {
6081 match self {
6082 Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
6083 Self::Add => std::option::Option::Some("ADD"),
6084 Self::Remove => std::option::Option::Some("REMOVE"),
6085 Self::Update => std::option::Option::Some("UPDATE"),
6086 Self::Replace => std::option::Option::Some("REPLACE"),
6087 Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
6088 Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
6089 Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
6090 Self::UnknownValue(u) => u.0.name(),
6091 }
6092 }
6093 }
6094
6095 impl std::default::Default for OperationType {
6096 fn default() -> Self {
6097 use std::convert::From;
6098 Self::from(0)
6099 }
6100 }
6101
6102 impl std::fmt::Display for OperationType {
6103 fn fmt(
6104 &self,
6105 f: &mut std::fmt::Formatter<'_>,
6106 ) -> std::result::Result<(), std::fmt::Error> {
6107 wkt::internal::display_enum(f, self.name(), self.value())
6108 }
6109 }
6110
6111 impl std::convert::From<i32> for OperationType {
6112 fn from(value: i32) -> Self {
6113 match value {
6114 0 => Self::Unspecified,
6115 1 => Self::Add,
6116 2 => Self::Remove,
6117 3 => Self::Replace,
6118 4 => Self::EvalRequested,
6119 5 => Self::EvalApproved,
6120 6 => Self::EvalSkipped,
6121 7 => Self::Update,
6122 _ => Self::UnknownValue(operation_type::UnknownValue(
6123 wkt::internal::UnknownEnumValue::Integer(value),
6124 )),
6125 }
6126 }
6127 }
6128
6129 impl std::convert::From<&str> for OperationType {
6130 fn from(value: &str) -> Self {
6131 use std::string::ToString;
6132 match value {
6133 "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
6134 "ADD" => Self::Add,
6135 "REMOVE" => Self::Remove,
6136 "UPDATE" => Self::Update,
6137 "REPLACE" => Self::Replace,
6138 "EVAL_REQUESTED" => Self::EvalRequested,
6139 "EVAL_APPROVED" => Self::EvalApproved,
6140 "EVAL_SKIPPED" => Self::EvalSkipped,
6141 _ => Self::UnknownValue(operation_type::UnknownValue(
6142 wkt::internal::UnknownEnumValue::String(value.to_string()),
6143 )),
6144 }
6145 }
6146 }
6147
6148 impl serde::ser::Serialize for OperationType {
6149 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6150 where
6151 S: serde::Serializer,
6152 {
6153 match self {
6154 Self::Unspecified => serializer.serialize_i32(0),
6155 Self::Add => serializer.serialize_i32(1),
6156 Self::Remove => serializer.serialize_i32(2),
6157 Self::Update => serializer.serialize_i32(7),
6158 Self::Replace => serializer.serialize_i32(3),
6159 Self::EvalRequested => serializer.serialize_i32(4),
6160 Self::EvalApproved => serializer.serialize_i32(5),
6161 Self::EvalSkipped => serializer.serialize_i32(6),
6162 Self::UnknownValue(u) => u.0.serialize(serializer),
6163 }
6164 }
6165 }
6166
6167 impl<'de> serde::de::Deserialize<'de> for OperationType {
6168 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6169 where
6170 D: serde::Deserializer<'de>,
6171 {
6172 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
6173 ".google.cloud.documentai.v1.Document.Provenance.OperationType",
6174 ))
6175 }
6176 }
6177 }
6178
6179 /// Contains past or forward revisions of this document.
6180 #[derive(Clone, Default, PartialEq)]
6181 #[non_exhaustive]
6182 pub struct Revision {
6183 /// Id of the revision, internally generated by doc proto storage.
6184 /// Unique within the context of the document.
6185 pub id: std::string::String,
6186
6187 /// The revisions that this revision is based on. This can include one or
6188 /// more parent (when documents are merged.) This field represents the
6189 /// index into the `revisions` field.
6190 #[deprecated]
6191 pub parent: std::vec::Vec<i32>,
6192
6193 /// The revisions that this revision is based on. Must include all the ids
6194 /// that have anything to do with this revision - eg. there are
6195 /// `provenance.parent.revision` fields that index into this field.
6196 pub parent_ids: std::vec::Vec<std::string::String>,
6197
6198 /// The time that the revision was created, internally generated by
6199 /// doc proto storage at the time of create.
6200 pub create_time: std::option::Option<wkt::Timestamp>,
6201
6202 /// Human Review information of this revision.
6203 pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
6204
6205 /// Who/what made the change
6206 pub source: std::option::Option<crate::model::document::revision::Source>,
6207
6208 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6209 }
6210
6211 impl Revision {
6212 /// Creates a new default instance.
6213 pub fn new() -> Self {
6214 std::default::Default::default()
6215 }
6216
6217 /// Sets the value of [id][crate::model::document::Revision::id].
6218 ///
6219 /// # Example
6220 /// ```ignore,no_run
6221 /// # use google_cloud_documentai_v1::model::document::Revision;
6222 /// let x = Revision::new().set_id("example");
6223 /// ```
6224 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6225 self.id = v.into();
6226 self
6227 }
6228
6229 /// Sets the value of [parent][crate::model::document::Revision::parent].
6230 ///
6231 /// # Example
6232 /// ```ignore,no_run
6233 /// # use google_cloud_documentai_v1::model::document::Revision;
6234 /// let x = Revision::new().set_parent([1, 2, 3]);
6235 /// ```
6236 #[deprecated]
6237 pub fn set_parent<T, V>(mut self, v: T) -> Self
6238 where
6239 T: std::iter::IntoIterator<Item = V>,
6240 V: std::convert::Into<i32>,
6241 {
6242 use std::iter::Iterator;
6243 self.parent = v.into_iter().map(|i| i.into()).collect();
6244 self
6245 }
6246
6247 /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
6248 ///
6249 /// # Example
6250 /// ```ignore,no_run
6251 /// # use google_cloud_documentai_v1::model::document::Revision;
6252 /// let x = Revision::new().set_parent_ids(["a", "b", "c"]);
6253 /// ```
6254 pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
6255 where
6256 T: std::iter::IntoIterator<Item = V>,
6257 V: std::convert::Into<std::string::String>,
6258 {
6259 use std::iter::Iterator;
6260 self.parent_ids = v.into_iter().map(|i| i.into()).collect();
6261 self
6262 }
6263
6264 /// Sets the value of [create_time][crate::model::document::Revision::create_time].
6265 ///
6266 /// # Example
6267 /// ```ignore,no_run
6268 /// # use google_cloud_documentai_v1::model::document::Revision;
6269 /// use wkt::Timestamp;
6270 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
6271 /// ```
6272 pub fn set_create_time<T>(mut self, v: T) -> Self
6273 where
6274 T: std::convert::Into<wkt::Timestamp>,
6275 {
6276 self.create_time = std::option::Option::Some(v.into());
6277 self
6278 }
6279
6280 /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
6281 ///
6282 /// # Example
6283 /// ```ignore,no_run
6284 /// # use google_cloud_documentai_v1::model::document::Revision;
6285 /// use wkt::Timestamp;
6286 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6287 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
6288 /// ```
6289 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6290 where
6291 T: std::convert::Into<wkt::Timestamp>,
6292 {
6293 self.create_time = v.map(|x| x.into());
6294 self
6295 }
6296
6297 /// Sets the value of [human_review][crate::model::document::Revision::human_review].
6298 ///
6299 /// # Example
6300 /// ```ignore,no_run
6301 /// # use google_cloud_documentai_v1::model::document::Revision;
6302 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6303 /// let x = Revision::new().set_human_review(HumanReview::default()/* use setters */);
6304 /// ```
6305 pub fn set_human_review<T>(mut self, v: T) -> Self
6306 where
6307 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6308 {
6309 self.human_review = std::option::Option::Some(v.into());
6310 self
6311 }
6312
6313 /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
6314 ///
6315 /// # Example
6316 /// ```ignore,no_run
6317 /// # use google_cloud_documentai_v1::model::document::Revision;
6318 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6319 /// let x = Revision::new().set_or_clear_human_review(Some(HumanReview::default()/* use setters */));
6320 /// let x = Revision::new().set_or_clear_human_review(None::<HumanReview>);
6321 /// ```
6322 pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
6323 where
6324 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6325 {
6326 self.human_review = v.map(|x| x.into());
6327 self
6328 }
6329
6330 /// Sets the value of [source][crate::model::document::Revision::source].
6331 ///
6332 /// Note that all the setters affecting `source` are mutually
6333 /// exclusive.
6334 ///
6335 /// # Example
6336 /// ```ignore,no_run
6337 /// # use google_cloud_documentai_v1::model::document::Revision;
6338 /// use google_cloud_documentai_v1::model::document::revision::Source;
6339 /// let x = Revision::new().set_source(Some(Source::Agent("example".to_string())));
6340 /// ```
6341 pub fn set_source<
6342 T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
6343 >(
6344 mut self,
6345 v: T,
6346 ) -> Self {
6347 self.source = v.into();
6348 self
6349 }
6350
6351 /// The value of [source][crate::model::document::Revision::source]
6352 /// if it holds a `Agent`, `None` if the field is not set or
6353 /// holds a different branch.
6354 pub fn agent(&self) -> std::option::Option<&std::string::String> {
6355 #[allow(unreachable_patterns)]
6356 self.source.as_ref().and_then(|v| match v {
6357 crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
6358 _ => std::option::Option::None,
6359 })
6360 }
6361
6362 /// Sets the value of [source][crate::model::document::Revision::source]
6363 /// to hold a `Agent`.
6364 ///
6365 /// Note that all the setters affecting `source` are
6366 /// mutually exclusive.
6367 ///
6368 /// # Example
6369 /// ```ignore,no_run
6370 /// # use google_cloud_documentai_v1::model::document::Revision;
6371 /// let x = Revision::new().set_agent("example");
6372 /// assert!(x.agent().is_some());
6373 /// assert!(x.processor().is_none());
6374 /// ```
6375 pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6376 self.source = std::option::Option::Some(
6377 crate::model::document::revision::Source::Agent(v.into()),
6378 );
6379 self
6380 }
6381
6382 /// The value of [source][crate::model::document::Revision::source]
6383 /// if it holds a `Processor`, `None` if the field is not set or
6384 /// holds a different branch.
6385 pub fn processor(&self) -> std::option::Option<&std::string::String> {
6386 #[allow(unreachable_patterns)]
6387 self.source.as_ref().and_then(|v| match v {
6388 crate::model::document::revision::Source::Processor(v) => {
6389 std::option::Option::Some(v)
6390 }
6391 _ => std::option::Option::None,
6392 })
6393 }
6394
6395 /// Sets the value of [source][crate::model::document::Revision::source]
6396 /// to hold a `Processor`.
6397 ///
6398 /// Note that all the setters affecting `source` are
6399 /// mutually exclusive.
6400 ///
6401 /// # Example
6402 /// ```ignore,no_run
6403 /// # use google_cloud_documentai_v1::model::document::Revision;
6404 /// let x = Revision::new().set_processor("example");
6405 /// assert!(x.processor().is_some());
6406 /// assert!(x.agent().is_none());
6407 /// ```
6408 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6409 self.source = std::option::Option::Some(
6410 crate::model::document::revision::Source::Processor(v.into()),
6411 );
6412 self
6413 }
6414 }
6415
6416 impl wkt::message::Message for Revision {
6417 fn typename() -> &'static str {
6418 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
6419 }
6420 }
6421
6422 /// Defines additional types related to [Revision].
6423 pub mod revision {
6424 #[allow(unused_imports)]
6425 use super::*;
6426
6427 /// Human Review information of the document.
6428 #[derive(Clone, Default, PartialEq)]
6429 #[non_exhaustive]
6430 pub struct HumanReview {
6431 /// Human review state. For example, `requested`, `succeeded`, `rejected`.
6432 pub state: std::string::String,
6433
6434 /// A message providing more details about the current state of processing.
6435 /// For example, the rejection reason when the state is `rejected`.
6436 pub state_message: std::string::String,
6437
6438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6439 }
6440
6441 impl HumanReview {
6442 /// Creates a new default instance.
6443 pub fn new() -> Self {
6444 std::default::Default::default()
6445 }
6446
6447 /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
6448 ///
6449 /// # Example
6450 /// ```ignore,no_run
6451 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6452 /// let x = HumanReview::new().set_state("example");
6453 /// ```
6454 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6455 self.state = v.into();
6456 self
6457 }
6458
6459 /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
6460 ///
6461 /// # Example
6462 /// ```ignore,no_run
6463 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6464 /// let x = HumanReview::new().set_state_message("example");
6465 /// ```
6466 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
6467 mut self,
6468 v: T,
6469 ) -> Self {
6470 self.state_message = v.into();
6471 self
6472 }
6473 }
6474
6475 impl wkt::message::Message for HumanReview {
6476 fn typename() -> &'static str {
6477 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
6478 }
6479 }
6480
6481 /// Who/what made the change
6482 #[derive(Clone, Debug, PartialEq)]
6483 #[non_exhaustive]
6484 pub enum Source {
6485 /// If the change was made by a person specify the name or id of that
6486 /// person.
6487 Agent(std::string::String),
6488 /// If the annotation was made by processor identify the processor by its
6489 /// resource name.
6490 Processor(std::string::String),
6491 }
6492 }
6493
6494 /// This message is used for text changes aka. OCR corrections.
6495 #[derive(Clone, Default, PartialEq)]
6496 #[non_exhaustive]
6497 pub struct TextChange {
6498 /// Provenance of the correction.
6499 /// Text anchor indexing into the
6500 /// [Document.text][google.cloud.documentai.v1.Document.text]. There can
6501 /// only be a single `TextAnchor.text_segments` element. If the start and
6502 /// end index of the text segment are the same, the text change is inserted
6503 /// before that index.
6504 ///
6505 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
6506 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
6507
6508 /// The text that replaces the text identified in the `text_anchor`.
6509 pub changed_text: std::string::String,
6510
6511 /// The history of this annotation.
6512 #[deprecated]
6513 pub provenance: std::vec::Vec<crate::model::document::Provenance>,
6514
6515 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6516 }
6517
6518 impl TextChange {
6519 /// Creates a new default instance.
6520 pub fn new() -> Self {
6521 std::default::Default::default()
6522 }
6523
6524 /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6525 ///
6526 /// # Example
6527 /// ```ignore,no_run
6528 /// # use google_cloud_documentai_v1::model::document::TextChange;
6529 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6530 /// let x = TextChange::new().set_text_anchor(TextAnchor::default()/* use setters */);
6531 /// ```
6532 pub fn set_text_anchor<T>(mut self, v: T) -> Self
6533 where
6534 T: std::convert::Into<crate::model::document::TextAnchor>,
6535 {
6536 self.text_anchor = std::option::Option::Some(v.into());
6537 self
6538 }
6539
6540 /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6541 ///
6542 /// # Example
6543 /// ```ignore,no_run
6544 /// # use google_cloud_documentai_v1::model::document::TextChange;
6545 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6546 /// let x = TextChange::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
6547 /// let x = TextChange::new().set_or_clear_text_anchor(None::<TextAnchor>);
6548 /// ```
6549 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
6550 where
6551 T: std::convert::Into<crate::model::document::TextAnchor>,
6552 {
6553 self.text_anchor = v.map(|x| x.into());
6554 self
6555 }
6556
6557 /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
6558 ///
6559 /// # Example
6560 /// ```ignore,no_run
6561 /// # use google_cloud_documentai_v1::model::document::TextChange;
6562 /// let x = TextChange::new().set_changed_text("example");
6563 /// ```
6564 pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
6565 mut self,
6566 v: T,
6567 ) -> Self {
6568 self.changed_text = v.into();
6569 self
6570 }
6571
6572 /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
6573 ///
6574 /// # Example
6575 /// ```ignore,no_run
6576 /// # use google_cloud_documentai_v1::model::document::TextChange;
6577 /// use google_cloud_documentai_v1::model::document::Provenance;
6578 /// let x = TextChange::new()
6579 /// .set_provenance([
6580 /// Provenance::default()/* use setters */,
6581 /// Provenance::default()/* use (different) setters */,
6582 /// ]);
6583 /// ```
6584 #[deprecated]
6585 pub fn set_provenance<T, V>(mut self, v: T) -> Self
6586 where
6587 T: std::iter::IntoIterator<Item = V>,
6588 V: std::convert::Into<crate::model::document::Provenance>,
6589 {
6590 use std::iter::Iterator;
6591 self.provenance = v.into_iter().map(|i| i.into()).collect();
6592 self
6593 }
6594 }
6595
6596 impl wkt::message::Message for TextChange {
6597 fn typename() -> &'static str {
6598 "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
6599 }
6600 }
6601
6602 /// Represents the annotation of a block or a chunk.
6603 #[derive(Clone, Default, PartialEq)]
6604 #[non_exhaustive]
6605 pub struct Annotations {
6606 /// The description of the content with this annotation.
6607 pub description: std::string::String,
6608
6609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6610 }
6611
6612 impl Annotations {
6613 /// Creates a new default instance.
6614 pub fn new() -> Self {
6615 std::default::Default::default()
6616 }
6617
6618 /// Sets the value of [description][crate::model::document::Annotations::description].
6619 ///
6620 /// # Example
6621 /// ```ignore,no_run
6622 /// # use google_cloud_documentai_v1::model::document::Annotations;
6623 /// let x = Annotations::new().set_description("example");
6624 /// ```
6625 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6626 self.description = v.into();
6627 self
6628 }
6629 }
6630
6631 impl wkt::message::Message for Annotations {
6632 fn typename() -> &'static str {
6633 "type.googleapis.com/google.cloud.documentai.v1.Document.Annotations"
6634 }
6635 }
6636
6637 /// Represents the parsed layout of a document as a collection of blocks that
6638 /// the document is divided into.
6639 #[derive(Clone, Default, PartialEq)]
6640 #[non_exhaustive]
6641 pub struct DocumentLayout {
6642 /// List of blocks in the document.
6643 pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6644
6645 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6646 }
6647
6648 impl DocumentLayout {
6649 /// Creates a new default instance.
6650 pub fn new() -> Self {
6651 std::default::Default::default()
6652 }
6653
6654 /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
6655 ///
6656 /// # Example
6657 /// ```ignore,no_run
6658 /// # use google_cloud_documentai_v1::model::document::DocumentLayout;
6659 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6660 /// let x = DocumentLayout::new()
6661 /// .set_blocks([
6662 /// DocumentLayoutBlock::default()/* use setters */,
6663 /// DocumentLayoutBlock::default()/* use (different) setters */,
6664 /// ]);
6665 /// ```
6666 pub fn set_blocks<T, V>(mut self, v: T) -> Self
6667 where
6668 T: std::iter::IntoIterator<Item = V>,
6669 V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
6670 {
6671 use std::iter::Iterator;
6672 self.blocks = v.into_iter().map(|i| i.into()).collect();
6673 self
6674 }
6675 }
6676
6677 impl wkt::message::Message for DocumentLayout {
6678 fn typename() -> &'static str {
6679 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
6680 }
6681 }
6682
6683 /// Defines additional types related to [DocumentLayout].
6684 pub mod document_layout {
6685 #[allow(unused_imports)]
6686 use super::*;
6687
6688 /// Represents a block. A block could be one of the various types (text,
6689 /// table, list) supported.
6690 #[derive(Clone, Default, PartialEq)]
6691 #[non_exhaustive]
6692 pub struct DocumentLayoutBlock {
6693 /// ID of the block.
6694 pub block_id: std::string::String,
6695
6696 /// Page span of the block.
6697 pub page_span: std::option::Option<
6698 crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
6699 >,
6700
6701 /// Identifies the bounding box for the block.
6702 pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6703
6704 #[allow(missing_docs)]
6705 pub block: std::option::Option<
6706 crate::model::document::document_layout::document_layout_block::Block,
6707 >,
6708
6709 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6710 }
6711
6712 impl DocumentLayoutBlock {
6713 /// Creates a new default instance.
6714 pub fn new() -> Self {
6715 std::default::Default::default()
6716 }
6717
6718 /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
6719 ///
6720 /// # Example
6721 /// ```ignore,no_run
6722 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6723 /// let x = DocumentLayoutBlock::new().set_block_id("example");
6724 /// ```
6725 pub fn set_block_id<T: std::convert::Into<std::string::String>>(
6726 mut self,
6727 v: T,
6728 ) -> Self {
6729 self.block_id = v.into();
6730 self
6731 }
6732
6733 /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6734 ///
6735 /// # Example
6736 /// ```ignore,no_run
6737 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6738 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6739 /// let x = DocumentLayoutBlock::new().set_page_span(LayoutPageSpan::default()/* use setters */);
6740 /// ```
6741 pub fn set_page_span<T>(mut self, v: T) -> Self
6742 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6743 {
6744 self.page_span = std::option::Option::Some(v.into());
6745 self
6746 }
6747
6748 /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6749 ///
6750 /// # Example
6751 /// ```ignore,no_run
6752 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6753 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6754 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(Some(LayoutPageSpan::default()/* use setters */));
6755 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(None::<LayoutPageSpan>);
6756 /// ```
6757 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
6758 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6759 {
6760 self.page_span = v.map(|x| x.into());
6761 self
6762 }
6763
6764 /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6765 ///
6766 /// # Example
6767 /// ```ignore,no_run
6768 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6769 /// use google_cloud_documentai_v1::model::BoundingPoly;
6770 /// let x = DocumentLayoutBlock::new().set_bounding_box(BoundingPoly::default()/* use setters */);
6771 /// ```
6772 pub fn set_bounding_box<T>(mut self, v: T) -> Self
6773 where
6774 T: std::convert::Into<crate::model::BoundingPoly>,
6775 {
6776 self.bounding_box = std::option::Option::Some(v.into());
6777 self
6778 }
6779
6780 /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6781 ///
6782 /// # Example
6783 /// ```ignore,no_run
6784 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6785 /// use google_cloud_documentai_v1::model::BoundingPoly;
6786 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(Some(BoundingPoly::default()/* use setters */));
6787 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(None::<BoundingPoly>);
6788 /// ```
6789 pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6790 where
6791 T: std::convert::Into<crate::model::BoundingPoly>,
6792 {
6793 self.bounding_box = v.map(|x| x.into());
6794 self
6795 }
6796
6797 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
6798 ///
6799 /// Note that all the setters affecting `block` are mutually
6800 /// exclusive.
6801 ///
6802 /// # Example
6803 /// ```ignore,no_run
6804 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6805 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6806 /// let x = DocumentLayoutBlock::new().set_block(Some(
6807 /// google_cloud_documentai_v1::model::document::document_layout::document_layout_block::Block::TextBlock(LayoutTextBlock::default().into())));
6808 /// ```
6809 pub fn set_block<
6810 T: std::convert::Into<
6811 std::option::Option<
6812 crate::model::document::document_layout::document_layout_block::Block,
6813 >,
6814 >,
6815 >(
6816 mut self,
6817 v: T,
6818 ) -> Self {
6819 self.block = v.into();
6820 self
6821 }
6822
6823 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6824 /// if it holds a `TextBlock`, `None` if the field is not set or
6825 /// holds a different branch.
6826 pub fn text_block(
6827 &self,
6828 ) -> std::option::Option<
6829 &std::boxed::Box<
6830 crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
6831 >,
6832 > {
6833 #[allow(unreachable_patterns)]
6834 self.block.as_ref().and_then(|v| match v {
6835 crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
6836 _ => std::option::Option::None,
6837 })
6838 }
6839
6840 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6841 /// to hold a `TextBlock`.
6842 ///
6843 /// Note that all the setters affecting `block` are
6844 /// mutually exclusive.
6845 ///
6846 /// # Example
6847 /// ```ignore,no_run
6848 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6849 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6850 /// let x = DocumentLayoutBlock::new().set_text_block(LayoutTextBlock::default()/* use setters */);
6851 /// assert!(x.text_block().is_some());
6852 /// assert!(x.table_block().is_none());
6853 /// assert!(x.list_block().is_none());
6854 /// assert!(x.image_block().is_none());
6855 /// ```
6856 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{
6857 self.block = std::option::Option::Some(
6858 crate::model::document::document_layout::document_layout_block::Block::TextBlock(
6859 v.into()
6860 )
6861 );
6862 self
6863 }
6864
6865 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6866 /// if it holds a `TableBlock`, `None` if the field is not set or
6867 /// holds a different branch.
6868 pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
6869 #[allow(unreachable_patterns)]
6870 self.block.as_ref().and_then(|v| match v {
6871 crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
6872 _ => std::option::Option::None,
6873 })
6874 }
6875
6876 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6877 /// to hold a `TableBlock`.
6878 ///
6879 /// Note that all the setters affecting `block` are
6880 /// mutually exclusive.
6881 ///
6882 /// # Example
6883 /// ```ignore,no_run
6884 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6885 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
6886 /// let x = DocumentLayoutBlock::new().set_table_block(LayoutTableBlock::default()/* use setters */);
6887 /// assert!(x.table_block().is_some());
6888 /// assert!(x.text_block().is_none());
6889 /// assert!(x.list_block().is_none());
6890 /// assert!(x.image_block().is_none());
6891 /// ```
6892 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{
6893 self.block = std::option::Option::Some(
6894 crate::model::document::document_layout::document_layout_block::Block::TableBlock(
6895 v.into()
6896 )
6897 );
6898 self
6899 }
6900
6901 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6902 /// if it holds a `ListBlock`, `None` if the field is not set or
6903 /// holds a different branch.
6904 pub fn list_block(
6905 &self,
6906 ) -> std::option::Option<
6907 &std::boxed::Box<
6908 crate::model::document::document_layout::document_layout_block::LayoutListBlock,
6909 >,
6910 > {
6911 #[allow(unreachable_patterns)]
6912 self.block.as_ref().and_then(|v| match v {
6913 crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
6914 _ => std::option::Option::None,
6915 })
6916 }
6917
6918 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6919 /// to hold a `ListBlock`.
6920 ///
6921 /// Note that all the setters affecting `block` are
6922 /// mutually exclusive.
6923 ///
6924 /// # Example
6925 /// ```ignore,no_run
6926 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6927 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
6928 /// let x = DocumentLayoutBlock::new().set_list_block(LayoutListBlock::default()/* use setters */);
6929 /// assert!(x.list_block().is_some());
6930 /// assert!(x.text_block().is_none());
6931 /// assert!(x.table_block().is_none());
6932 /// assert!(x.image_block().is_none());
6933 /// ```
6934 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{
6935 self.block = std::option::Option::Some(
6936 crate::model::document::document_layout::document_layout_block::Block::ListBlock(
6937 v.into()
6938 )
6939 );
6940 self
6941 }
6942
6943 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6944 /// if it holds a `ImageBlock`, `None` if the field is not set or
6945 /// holds a different branch.
6946 pub fn image_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>>{
6947 #[allow(unreachable_patterns)]
6948 self.block.as_ref().and_then(|v| match v {
6949 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(v) => std::option::Option::Some(v),
6950 _ => std::option::Option::None,
6951 })
6952 }
6953
6954 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6955 /// to hold a `ImageBlock`.
6956 ///
6957 /// Note that all the setters affecting `block` are
6958 /// mutually exclusive.
6959 ///
6960 /// # Example
6961 /// ```ignore,no_run
6962 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6963 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
6964 /// let x = DocumentLayoutBlock::new().set_image_block(LayoutImageBlock::default()/* use setters */);
6965 /// assert!(x.image_block().is_some());
6966 /// assert!(x.text_block().is_none());
6967 /// assert!(x.table_block().is_none());
6968 /// assert!(x.list_block().is_none());
6969 /// ```
6970 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{
6971 self.block = std::option::Option::Some(
6972 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(
6973 v.into()
6974 )
6975 );
6976 self
6977 }
6978 }
6979
6980 impl wkt::message::Message for DocumentLayoutBlock {
6981 fn typename() -> &'static str {
6982 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
6983 }
6984 }
6985
6986 /// Defines additional types related to [DocumentLayoutBlock].
6987 pub mod document_layout_block {
6988 #[allow(unused_imports)]
6989 use super::*;
6990
6991 /// Represents where the block starts and ends in the document.
6992 #[derive(Clone, Default, PartialEq)]
6993 #[non_exhaustive]
6994 pub struct LayoutPageSpan {
6995 /// Page where block starts in the document.
6996 pub page_start: i32,
6997
6998 /// Page where block ends in the document.
6999 pub page_end: i32,
7000
7001 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7002 }
7003
7004 impl LayoutPageSpan {
7005 /// Creates a new default instance.
7006 pub fn new() -> Self {
7007 std::default::Default::default()
7008 }
7009
7010 /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
7011 ///
7012 /// # Example
7013 /// ```ignore,no_run
7014 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
7015 /// let x = LayoutPageSpan::new().set_page_start(42);
7016 /// ```
7017 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7018 self.page_start = v.into();
7019 self
7020 }
7021
7022 /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
7023 ///
7024 /// # Example
7025 /// ```ignore,no_run
7026 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
7027 /// let x = LayoutPageSpan::new().set_page_end(42);
7028 /// ```
7029 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7030 self.page_end = v.into();
7031 self
7032 }
7033 }
7034
7035 impl wkt::message::Message for LayoutPageSpan {
7036 fn typename() -> &'static str {
7037 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
7038 }
7039 }
7040
7041 /// Represents a text type block.
7042 #[derive(Clone, Default, PartialEq)]
7043 #[non_exhaustive]
7044 pub struct LayoutTextBlock {
7045 /// Text content stored in the block.
7046 pub text: std::string::String,
7047
7048 /// Type of the text in the block. Available options are: `paragraph`,
7049 /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
7050 /// `heading-5`, `header`, `footer`.
7051 pub r#type: std::string::String,
7052
7053 /// A text block could further have child blocks.
7054 /// Repeated blocks support further hierarchies and nested blocks.
7055 pub blocks:
7056 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7057
7058 /// Annotation of the text block.
7059 pub annotations: std::option::Option<crate::model::document::Annotations>,
7060
7061 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7062 }
7063
7064 impl LayoutTextBlock {
7065 /// Creates a new default instance.
7066 pub fn new() -> Self {
7067 std::default::Default::default()
7068 }
7069
7070 /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
7071 ///
7072 /// # Example
7073 /// ```ignore,no_run
7074 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7075 /// let x = LayoutTextBlock::new().set_text("example");
7076 /// ```
7077 pub fn set_text<T: std::convert::Into<std::string::String>>(
7078 mut self,
7079 v: T,
7080 ) -> Self {
7081 self.text = v.into();
7082 self
7083 }
7084
7085 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
7086 ///
7087 /// # Example
7088 /// ```ignore,no_run
7089 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7090 /// let x = LayoutTextBlock::new().set_type("example");
7091 /// ```
7092 pub fn set_type<T: std::convert::Into<std::string::String>>(
7093 mut self,
7094 v: T,
7095 ) -> Self {
7096 self.r#type = v.into();
7097 self
7098 }
7099
7100 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
7101 ///
7102 /// # Example
7103 /// ```ignore,no_run
7104 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7105 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7106 /// let x = LayoutTextBlock::new()
7107 /// .set_blocks([
7108 /// DocumentLayoutBlock::default()/* use setters */,
7109 /// DocumentLayoutBlock::default()/* use (different) setters */,
7110 /// ]);
7111 /// ```
7112 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7113 where
7114 T: std::iter::IntoIterator<Item = V>,
7115 V: std::convert::Into<
7116 crate::model::document::document_layout::DocumentLayoutBlock,
7117 >,
7118 {
7119 use std::iter::Iterator;
7120 self.blocks = v.into_iter().map(|i| i.into()).collect();
7121 self
7122 }
7123
7124 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7125 ///
7126 /// # Example
7127 /// ```ignore,no_run
7128 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7129 /// use google_cloud_documentai_v1::model::document::Annotations;
7130 /// let x = LayoutTextBlock::new().set_annotations(Annotations::default()/* use setters */);
7131 /// ```
7132 pub fn set_annotations<T>(mut self, v: T) -> Self
7133 where
7134 T: std::convert::Into<crate::model::document::Annotations>,
7135 {
7136 self.annotations = std::option::Option::Some(v.into());
7137 self
7138 }
7139
7140 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7141 ///
7142 /// # Example
7143 /// ```ignore,no_run
7144 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7145 /// use google_cloud_documentai_v1::model::document::Annotations;
7146 /// let x = LayoutTextBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7147 /// let x = LayoutTextBlock::new().set_or_clear_annotations(None::<Annotations>);
7148 /// ```
7149 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7150 where
7151 T: std::convert::Into<crate::model::document::Annotations>,
7152 {
7153 self.annotations = v.map(|x| x.into());
7154 self
7155 }
7156 }
7157
7158 impl wkt::message::Message for LayoutTextBlock {
7159 fn typename() -> &'static str {
7160 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
7161 }
7162 }
7163
7164 /// Represents a table type block.
7165 #[derive(Clone, Default, PartialEq)]
7166 #[non_exhaustive]
7167 pub struct LayoutTableBlock {
7168 /// Header rows at the top of the table.
7169 pub header_rows: std::vec::Vec<
7170 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7171 >,
7172
7173 /// Body rows containing main table content.
7174 pub body_rows: std::vec::Vec<
7175 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7176 >,
7177
7178 /// Table caption/title.
7179 pub caption: std::string::String,
7180
7181 /// Annotation of the table block.
7182 pub annotations: std::option::Option<crate::model::document::Annotations>,
7183
7184 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7185 }
7186
7187 impl LayoutTableBlock {
7188 /// Creates a new default instance.
7189 pub fn new() -> Self {
7190 std::default::Default::default()
7191 }
7192
7193 /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
7194 ///
7195 /// # Example
7196 /// ```ignore,no_run
7197 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7198 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7199 /// let x = LayoutTableBlock::new()
7200 /// .set_header_rows([
7201 /// LayoutTableRow::default()/* use setters */,
7202 /// LayoutTableRow::default()/* use (different) setters */,
7203 /// ]);
7204 /// ```
7205 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
7206 where
7207 T: std::iter::IntoIterator<Item = V>,
7208 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7209 {
7210 use std::iter::Iterator;
7211 self.header_rows = v.into_iter().map(|i| i.into()).collect();
7212 self
7213 }
7214
7215 /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
7216 ///
7217 /// # Example
7218 /// ```ignore,no_run
7219 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7220 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7221 /// let x = LayoutTableBlock::new()
7222 /// .set_body_rows([
7223 /// LayoutTableRow::default()/* use setters */,
7224 /// LayoutTableRow::default()/* use (different) setters */,
7225 /// ]);
7226 /// ```
7227 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
7228 where
7229 T: std::iter::IntoIterator<Item = V>,
7230 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7231 {
7232 use std::iter::Iterator;
7233 self.body_rows = v.into_iter().map(|i| i.into()).collect();
7234 self
7235 }
7236
7237 /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
7238 ///
7239 /// # Example
7240 /// ```ignore,no_run
7241 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7242 /// let x = LayoutTableBlock::new().set_caption("example");
7243 /// ```
7244 pub fn set_caption<T: std::convert::Into<std::string::String>>(
7245 mut self,
7246 v: T,
7247 ) -> Self {
7248 self.caption = v.into();
7249 self
7250 }
7251
7252 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7253 ///
7254 /// # Example
7255 /// ```ignore,no_run
7256 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7257 /// use google_cloud_documentai_v1::model::document::Annotations;
7258 /// let x = LayoutTableBlock::new().set_annotations(Annotations::default()/* use setters */);
7259 /// ```
7260 pub fn set_annotations<T>(mut self, v: T) -> Self
7261 where
7262 T: std::convert::Into<crate::model::document::Annotations>,
7263 {
7264 self.annotations = std::option::Option::Some(v.into());
7265 self
7266 }
7267
7268 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7269 ///
7270 /// # Example
7271 /// ```ignore,no_run
7272 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7273 /// use google_cloud_documentai_v1::model::document::Annotations;
7274 /// let x = LayoutTableBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7275 /// let x = LayoutTableBlock::new().set_or_clear_annotations(None::<Annotations>);
7276 /// ```
7277 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7278 where
7279 T: std::convert::Into<crate::model::document::Annotations>,
7280 {
7281 self.annotations = v.map(|x| x.into());
7282 self
7283 }
7284 }
7285
7286 impl wkt::message::Message for LayoutTableBlock {
7287 fn typename() -> &'static str {
7288 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
7289 }
7290 }
7291
7292 /// Represents a row in a table.
7293 #[derive(Clone, Default, PartialEq)]
7294 #[non_exhaustive]
7295 pub struct LayoutTableRow {
7296 /// A table row is a list of table cells.
7297 pub cells: std::vec::Vec<
7298 crate::model::document::document_layout::document_layout_block::LayoutTableCell,
7299 >,
7300
7301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7302 }
7303
7304 impl LayoutTableRow {
7305 /// Creates a new default instance.
7306 pub fn new() -> Self {
7307 std::default::Default::default()
7308 }
7309
7310 /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
7311 ///
7312 /// # Example
7313 /// ```ignore,no_run
7314 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7315 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7316 /// let x = LayoutTableRow::new()
7317 /// .set_cells([
7318 /// LayoutTableCell::default()/* use setters */,
7319 /// LayoutTableCell::default()/* use (different) setters */,
7320 /// ]);
7321 /// ```
7322 pub fn set_cells<T, V>(mut self, v: T) -> Self
7323 where
7324 T: std::iter::IntoIterator<Item = V>,
7325 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
7326 {
7327 use std::iter::Iterator;
7328 self.cells = v.into_iter().map(|i| i.into()).collect();
7329 self
7330 }
7331 }
7332
7333 impl wkt::message::Message for LayoutTableRow {
7334 fn typename() -> &'static str {
7335 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
7336 }
7337 }
7338
7339 /// Represents a cell in a table row.
7340 #[derive(Clone, Default, PartialEq)]
7341 #[non_exhaustive]
7342 pub struct LayoutTableCell {
7343 /// A table cell is a list of blocks.
7344 /// Repeated blocks support further hierarchies and nested blocks.
7345 pub blocks:
7346 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7347
7348 /// How many rows this cell spans.
7349 pub row_span: i32,
7350
7351 /// How many columns this cell spans.
7352 pub col_span: i32,
7353
7354 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7355 }
7356
7357 impl LayoutTableCell {
7358 /// Creates a new default instance.
7359 pub fn new() -> Self {
7360 std::default::Default::default()
7361 }
7362
7363 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
7364 ///
7365 /// # Example
7366 /// ```ignore,no_run
7367 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7368 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7369 /// let x = LayoutTableCell::new()
7370 /// .set_blocks([
7371 /// DocumentLayoutBlock::default()/* use setters */,
7372 /// DocumentLayoutBlock::default()/* use (different) setters */,
7373 /// ]);
7374 /// ```
7375 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7376 where
7377 T: std::iter::IntoIterator<Item = V>,
7378 V: std::convert::Into<
7379 crate::model::document::document_layout::DocumentLayoutBlock,
7380 >,
7381 {
7382 use std::iter::Iterator;
7383 self.blocks = v.into_iter().map(|i| i.into()).collect();
7384 self
7385 }
7386
7387 /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
7388 ///
7389 /// # Example
7390 /// ```ignore,no_run
7391 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7392 /// let x = LayoutTableCell::new().set_row_span(42);
7393 /// ```
7394 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7395 self.row_span = v.into();
7396 self
7397 }
7398
7399 /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
7400 ///
7401 /// # Example
7402 /// ```ignore,no_run
7403 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7404 /// let x = LayoutTableCell::new().set_col_span(42);
7405 /// ```
7406 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7407 self.col_span = v.into();
7408 self
7409 }
7410 }
7411
7412 impl wkt::message::Message for LayoutTableCell {
7413 fn typename() -> &'static str {
7414 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
7415 }
7416 }
7417
7418 /// Represents a list type block.
7419 #[derive(Clone, Default, PartialEq)]
7420 #[non_exhaustive]
7421 pub struct LayoutListBlock {
7422 /// List entries that constitute a list block.
7423 pub list_entries: std::vec::Vec<
7424 crate::model::document::document_layout::document_layout_block::LayoutListEntry,
7425 >,
7426
7427 /// Type of the list_entries (if exist). Available options are `ordered`
7428 /// and `unordered`.
7429 pub r#type: std::string::String,
7430
7431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7432 }
7433
7434 impl LayoutListBlock {
7435 /// Creates a new default instance.
7436 pub fn new() -> Self {
7437 std::default::Default::default()
7438 }
7439
7440 /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
7441 ///
7442 /// # Example
7443 /// ```ignore,no_run
7444 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7445 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7446 /// let x = LayoutListBlock::new()
7447 /// .set_list_entries([
7448 /// LayoutListEntry::default()/* use setters */,
7449 /// LayoutListEntry::default()/* use (different) setters */,
7450 /// ]);
7451 /// ```
7452 pub fn set_list_entries<T, V>(mut self, v: T) -> Self
7453 where
7454 T: std::iter::IntoIterator<Item = V>,
7455 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
7456 {
7457 use std::iter::Iterator;
7458 self.list_entries = v.into_iter().map(|i| i.into()).collect();
7459 self
7460 }
7461
7462 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
7463 ///
7464 /// # Example
7465 /// ```ignore,no_run
7466 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7467 /// let x = LayoutListBlock::new().set_type("example");
7468 /// ```
7469 pub fn set_type<T: std::convert::Into<std::string::String>>(
7470 mut self,
7471 v: T,
7472 ) -> Self {
7473 self.r#type = v.into();
7474 self
7475 }
7476 }
7477
7478 impl wkt::message::Message for LayoutListBlock {
7479 fn typename() -> &'static str {
7480 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
7481 }
7482 }
7483
7484 /// Represents an entry in the list.
7485 #[derive(Clone, Default, PartialEq)]
7486 #[non_exhaustive]
7487 pub struct LayoutListEntry {
7488 /// A list entry is a list of blocks.
7489 /// Repeated blocks support further hierarchies and nested blocks.
7490 pub blocks:
7491 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7492
7493 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7494 }
7495
7496 impl LayoutListEntry {
7497 /// Creates a new default instance.
7498 pub fn new() -> Self {
7499 std::default::Default::default()
7500 }
7501
7502 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
7503 ///
7504 /// # Example
7505 /// ```ignore,no_run
7506 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7507 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7508 /// let x = LayoutListEntry::new()
7509 /// .set_blocks([
7510 /// DocumentLayoutBlock::default()/* use setters */,
7511 /// DocumentLayoutBlock::default()/* use (different) setters */,
7512 /// ]);
7513 /// ```
7514 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7515 where
7516 T: std::iter::IntoIterator<Item = V>,
7517 V: std::convert::Into<
7518 crate::model::document::document_layout::DocumentLayoutBlock,
7519 >,
7520 {
7521 use std::iter::Iterator;
7522 self.blocks = v.into_iter().map(|i| i.into()).collect();
7523 self
7524 }
7525 }
7526
7527 impl wkt::message::Message for LayoutListEntry {
7528 fn typename() -> &'static str {
7529 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
7530 }
7531 }
7532
7533 /// Represents an image type block.
7534 #[derive(Clone, Default, PartialEq)]
7535 #[non_exhaustive]
7536 pub struct LayoutImageBlock {
7537
7538 /// Mime type of the image. An IANA published [media type (MIME type)]
7539 /// (<https://www.iana.org/assignments/media-types/media-types.xhtml>).
7540 pub mime_type: std::string::String,
7541
7542 /// Text extracted from the image using OCR or alt text describing the
7543 /// image.
7544 pub image_text: std::string::String,
7545
7546 /// Annotation of the image block.
7547 pub annotations: std::option::Option<crate::model::document::Annotations>,
7548
7549 /// Source of the image.
7550 pub image_source: std::option::Option<crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource>,
7551
7552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7553 }
7554
7555 impl LayoutImageBlock {
7556 /// Creates a new default instance.
7557 pub fn new() -> Self {
7558 std::default::Default::default()
7559 }
7560
7561 /// Sets the value of [mime_type][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::mime_type].
7562 ///
7563 /// # Example
7564 /// ```ignore,no_run
7565 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7566 /// let x = LayoutImageBlock::new().set_mime_type("example");
7567 /// ```
7568 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
7569 mut self,
7570 v: T,
7571 ) -> Self {
7572 self.mime_type = v.into();
7573 self
7574 }
7575
7576 /// Sets the value of [image_text][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_text].
7577 ///
7578 /// # Example
7579 /// ```ignore,no_run
7580 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7581 /// let x = LayoutImageBlock::new().set_image_text("example");
7582 /// ```
7583 pub fn set_image_text<T: std::convert::Into<std::string::String>>(
7584 mut self,
7585 v: T,
7586 ) -> Self {
7587 self.image_text = v.into();
7588 self
7589 }
7590
7591 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7592 ///
7593 /// # Example
7594 /// ```ignore,no_run
7595 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7596 /// use google_cloud_documentai_v1::model::document::Annotations;
7597 /// let x = LayoutImageBlock::new().set_annotations(Annotations::default()/* use setters */);
7598 /// ```
7599 pub fn set_annotations<T>(mut self, v: T) -> Self
7600 where
7601 T: std::convert::Into<crate::model::document::Annotations>,
7602 {
7603 self.annotations = std::option::Option::Some(v.into());
7604 self
7605 }
7606
7607 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7608 ///
7609 /// # Example
7610 /// ```ignore,no_run
7611 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7612 /// use google_cloud_documentai_v1::model::document::Annotations;
7613 /// let x = LayoutImageBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7614 /// let x = LayoutImageBlock::new().set_or_clear_annotations(None::<Annotations>);
7615 /// ```
7616 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7617 where
7618 T: std::convert::Into<crate::model::document::Annotations>,
7619 {
7620 self.annotations = v.map(|x| x.into());
7621 self
7622 }
7623
7624 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source].
7625 ///
7626 /// Note that all the setters affecting `image_source` are mutually
7627 /// exclusive.
7628 ///
7629 /// # Example
7630 /// ```ignore,no_run
7631 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7632 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::layout_image_block::ImageSource;
7633 /// let x = LayoutImageBlock::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
7634 /// ```
7635 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
7636 {
7637 self.image_source = v.into();
7638 self
7639 }
7640
7641 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7642 /// if it holds a `BlobAssetId`, `None` if the field is not set or
7643 /// holds a different branch.
7644 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
7645 #[allow(unreachable_patterns)]
7646 self.image_source.as_ref().and_then(|v| match v {
7647 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
7648 _ => std::option::Option::None,
7649 })
7650 }
7651
7652 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7653 /// to hold a `BlobAssetId`.
7654 ///
7655 /// Note that all the setters affecting `image_source` are
7656 /// mutually exclusive.
7657 ///
7658 /// # Example
7659 /// ```ignore,no_run
7660 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7661 /// let x = LayoutImageBlock::new().set_blob_asset_id("example");
7662 /// assert!(x.blob_asset_id().is_some());
7663 /// assert!(x.gcs_uri().is_none());
7664 /// assert!(x.data_uri().is_none());
7665 /// ```
7666 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
7667 mut self,
7668 v: T,
7669 ) -> Self {
7670 self.image_source = std::option::Option::Some(
7671 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(
7672 v.into()
7673 )
7674 );
7675 self
7676 }
7677
7678 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7679 /// if it holds a `GcsUri`, `None` if the field is not set or
7680 /// holds a different branch.
7681 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
7682 #[allow(unreachable_patterns)]
7683 self.image_source.as_ref().and_then(|v| match v {
7684 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(v) => std::option::Option::Some(v),
7685 _ => std::option::Option::None,
7686 })
7687 }
7688
7689 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7690 /// to hold a `GcsUri`.
7691 ///
7692 /// Note that all the setters affecting `image_source` are
7693 /// mutually exclusive.
7694 ///
7695 /// # Example
7696 /// ```ignore,no_run
7697 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7698 /// let x = LayoutImageBlock::new().set_gcs_uri("example");
7699 /// assert!(x.gcs_uri().is_some());
7700 /// assert!(x.blob_asset_id().is_none());
7701 /// assert!(x.data_uri().is_none());
7702 /// ```
7703 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
7704 mut self,
7705 v: T,
7706 ) -> Self {
7707 self.image_source = std::option::Option::Some(
7708 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(
7709 v.into()
7710 )
7711 );
7712 self
7713 }
7714
7715 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7716 /// if it holds a `DataUri`, `None` if the field is not set or
7717 /// holds a different branch.
7718 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
7719 #[allow(unreachable_patterns)]
7720 self.image_source.as_ref().and_then(|v| match v {
7721 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(v) => std::option::Option::Some(v),
7722 _ => std::option::Option::None,
7723 })
7724 }
7725
7726 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7727 /// to hold a `DataUri`.
7728 ///
7729 /// Note that all the setters affecting `image_source` are
7730 /// mutually exclusive.
7731 ///
7732 /// # Example
7733 /// ```ignore,no_run
7734 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7735 /// let x = LayoutImageBlock::new().set_data_uri("example");
7736 /// assert!(x.data_uri().is_some());
7737 /// assert!(x.blob_asset_id().is_none());
7738 /// assert!(x.gcs_uri().is_none());
7739 /// ```
7740 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
7741 mut self,
7742 v: T,
7743 ) -> Self {
7744 self.image_source = std::option::Option::Some(
7745 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(
7746 v.into()
7747 )
7748 );
7749 self
7750 }
7751 }
7752
7753 impl wkt::message::Message for LayoutImageBlock {
7754 fn typename() -> &'static str {
7755 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutImageBlock"
7756 }
7757 }
7758
7759 /// Defines additional types related to [LayoutImageBlock].
7760 pub mod layout_image_block {
7761 #[allow(unused_imports)]
7762 use super::*;
7763
7764 /// Source of the image.
7765 #[derive(Clone, Debug, PartialEq)]
7766 #[non_exhaustive]
7767 pub enum ImageSource {
7768 /// Optional. Asset id of the inline image. If set, find the image
7769 /// content in the blob_assets field.
7770 BlobAssetId(std::string::String),
7771 /// Optional. Google Cloud Storage uri of the image.
7772 GcsUri(std::string::String),
7773 /// Optional. Data uri of the image.
7774 /// It is composed of four parts: a prefix (data:), a MIME type
7775 /// indicating the type of data, an optional base64 token if
7776 /// non-textual, and the data itself:
7777 /// data:[\<mediatype\>][;base64],\<data\>
7778 DataUri(std::string::String),
7779 }
7780 }
7781
7782 #[allow(missing_docs)]
7783 #[derive(Clone, Debug, PartialEq)]
7784 #[non_exhaustive]
7785 pub enum Block {
7786 /// Block consisting of text content.
7787 TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
7788 /// Block consisting of table content/structure.
7789 TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
7790 /// Block consisting of list content/structure.
7791 ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
7792 /// Block consisting of image content.
7793 ImageBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>),
7794 }
7795 }
7796 }
7797
7798 /// Represents the chunks that the document is divided into.
7799 #[derive(Clone, Default, PartialEq)]
7800 #[non_exhaustive]
7801 pub struct ChunkedDocument {
7802 /// List of chunks.
7803 pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
7804
7805 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7806 }
7807
7808 impl ChunkedDocument {
7809 /// Creates a new default instance.
7810 pub fn new() -> Self {
7811 std::default::Default::default()
7812 }
7813
7814 /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
7815 ///
7816 /// # Example
7817 /// ```ignore,no_run
7818 /// # use google_cloud_documentai_v1::model::document::ChunkedDocument;
7819 /// use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7820 /// let x = ChunkedDocument::new()
7821 /// .set_chunks([
7822 /// Chunk::default()/* use setters */,
7823 /// Chunk::default()/* use (different) setters */,
7824 /// ]);
7825 /// ```
7826 pub fn set_chunks<T, V>(mut self, v: T) -> Self
7827 where
7828 T: std::iter::IntoIterator<Item = V>,
7829 V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
7830 {
7831 use std::iter::Iterator;
7832 self.chunks = v.into_iter().map(|i| i.into()).collect();
7833 self
7834 }
7835 }
7836
7837 impl wkt::message::Message for ChunkedDocument {
7838 fn typename() -> &'static str {
7839 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
7840 }
7841 }
7842
7843 /// Defines additional types related to [ChunkedDocument].
7844 pub mod chunked_document {
7845 #[allow(unused_imports)]
7846 use super::*;
7847
7848 /// Represents a chunk.
7849 #[derive(Clone, Default, PartialEq)]
7850 #[non_exhaustive]
7851 pub struct Chunk {
7852 /// ID of the chunk.
7853 pub chunk_id: std::string::String,
7854
7855 /// Unused.
7856 pub source_block_ids: std::vec::Vec<std::string::String>,
7857
7858 /// Text content of the chunk.
7859 pub content: std::string::String,
7860
7861 /// Page span of the chunk.
7862 pub page_span:
7863 std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
7864
7865 /// Page headers associated with the chunk.
7866 pub page_headers:
7867 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
7868
7869 /// Page footers associated with the chunk.
7870 pub page_footers:
7871 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
7872
7873 /// Chunk fields inside this chunk.
7874 pub chunk_fields:
7875 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkField>,
7876
7877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7878 }
7879
7880 impl Chunk {
7881 /// Creates a new default instance.
7882 pub fn new() -> Self {
7883 std::default::Default::default()
7884 }
7885
7886 /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
7887 ///
7888 /// # Example
7889 /// ```ignore,no_run
7890 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7891 /// let x = Chunk::new().set_chunk_id("example");
7892 /// ```
7893 pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
7894 mut self,
7895 v: T,
7896 ) -> Self {
7897 self.chunk_id = v.into();
7898 self
7899 }
7900
7901 /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
7902 ///
7903 /// # Example
7904 /// ```ignore,no_run
7905 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7906 /// let x = Chunk::new().set_source_block_ids(["a", "b", "c"]);
7907 /// ```
7908 pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
7909 where
7910 T: std::iter::IntoIterator<Item = V>,
7911 V: std::convert::Into<std::string::String>,
7912 {
7913 use std::iter::Iterator;
7914 self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
7915 self
7916 }
7917
7918 /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
7919 ///
7920 /// # Example
7921 /// ```ignore,no_run
7922 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7923 /// let x = Chunk::new().set_content("example");
7924 /// ```
7925 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7926 self.content = v.into();
7927 self
7928 }
7929
7930 /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7931 ///
7932 /// # Example
7933 /// ```ignore,no_run
7934 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7935 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7936 /// let x = Chunk::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7937 /// ```
7938 pub fn set_page_span<T>(mut self, v: T) -> Self
7939 where
7940 T: std::convert::Into<
7941 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7942 >,
7943 {
7944 self.page_span = std::option::Option::Some(v.into());
7945 self
7946 }
7947
7948 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7949 ///
7950 /// # Example
7951 /// ```ignore,no_run
7952 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7953 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7954 /// let x = Chunk::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7955 /// let x = Chunk::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7956 /// ```
7957 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7958 where
7959 T: std::convert::Into<
7960 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7961 >,
7962 {
7963 self.page_span = v.map(|x| x.into());
7964 self
7965 }
7966
7967 /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
7968 ///
7969 /// # Example
7970 /// ```ignore,no_run
7971 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7972 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7973 /// let x = Chunk::new()
7974 /// .set_page_headers([
7975 /// ChunkPageHeader::default()/* use setters */,
7976 /// ChunkPageHeader::default()/* use (different) setters */,
7977 /// ]);
7978 /// ```
7979 pub fn set_page_headers<T, V>(mut self, v: T) -> Self
7980 where
7981 T: std::iter::IntoIterator<Item = V>,
7982 V: std::convert::Into<
7983 crate::model::document::chunked_document::chunk::ChunkPageHeader,
7984 >,
7985 {
7986 use std::iter::Iterator;
7987 self.page_headers = v.into_iter().map(|i| i.into()).collect();
7988 self
7989 }
7990
7991 /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
7992 ///
7993 /// # Example
7994 /// ```ignore,no_run
7995 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7996 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7997 /// let x = Chunk::new()
7998 /// .set_page_footers([
7999 /// ChunkPageFooter::default()/* use setters */,
8000 /// ChunkPageFooter::default()/* use (different) setters */,
8001 /// ]);
8002 /// ```
8003 pub fn set_page_footers<T, V>(mut self, v: T) -> Self
8004 where
8005 T: std::iter::IntoIterator<Item = V>,
8006 V: std::convert::Into<
8007 crate::model::document::chunked_document::chunk::ChunkPageFooter,
8008 >,
8009 {
8010 use std::iter::Iterator;
8011 self.page_footers = v.into_iter().map(|i| i.into()).collect();
8012 self
8013 }
8014
8015 /// Sets the value of [chunk_fields][crate::model::document::chunked_document::Chunk::chunk_fields].
8016 ///
8017 /// # Example
8018 /// ```ignore,no_run
8019 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
8020 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8021 /// let x = Chunk::new()
8022 /// .set_chunk_fields([
8023 /// ChunkField::default()/* use setters */,
8024 /// ChunkField::default()/* use (different) setters */,
8025 /// ]);
8026 /// ```
8027 pub fn set_chunk_fields<T, V>(mut self, v: T) -> Self
8028 where
8029 T: std::iter::IntoIterator<Item = V>,
8030 V: std::convert::Into<crate::model::document::chunked_document::chunk::ChunkField>,
8031 {
8032 use std::iter::Iterator;
8033 self.chunk_fields = v.into_iter().map(|i| i.into()).collect();
8034 self
8035 }
8036 }
8037
8038 impl wkt::message::Message for Chunk {
8039 fn typename() -> &'static str {
8040 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
8041 }
8042 }
8043
8044 /// Defines additional types related to [Chunk].
8045 pub mod chunk {
8046 #[allow(unused_imports)]
8047 use super::*;
8048
8049 /// Represents where the chunk starts and ends in the document.
8050 #[derive(Clone, Default, PartialEq)]
8051 #[non_exhaustive]
8052 pub struct ChunkPageSpan {
8053 /// Page where chunk starts in the document.
8054 pub page_start: i32,
8055
8056 /// Page where chunk ends in the document.
8057 pub page_end: i32,
8058
8059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8060 }
8061
8062 impl ChunkPageSpan {
8063 /// Creates a new default instance.
8064 pub fn new() -> Self {
8065 std::default::Default::default()
8066 }
8067
8068 /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
8069 ///
8070 /// # Example
8071 /// ```ignore,no_run
8072 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8073 /// let x = ChunkPageSpan::new().set_page_start(42);
8074 /// ```
8075 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8076 self.page_start = v.into();
8077 self
8078 }
8079
8080 /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
8081 ///
8082 /// # Example
8083 /// ```ignore,no_run
8084 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8085 /// let x = ChunkPageSpan::new().set_page_end(42);
8086 /// ```
8087 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8088 self.page_end = v.into();
8089 self
8090 }
8091 }
8092
8093 impl wkt::message::Message for ChunkPageSpan {
8094 fn typename() -> &'static str {
8095 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
8096 }
8097 }
8098
8099 /// Represents the page header associated with the chunk.
8100 #[derive(Clone, Default, PartialEq)]
8101 #[non_exhaustive]
8102 pub struct ChunkPageHeader {
8103 /// Header in text format.
8104 pub text: std::string::String,
8105
8106 /// Page span of the header.
8107 pub page_span: std::option::Option<
8108 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8109 >,
8110
8111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8112 }
8113
8114 impl ChunkPageHeader {
8115 /// Creates a new default instance.
8116 pub fn new() -> Self {
8117 std::default::Default::default()
8118 }
8119
8120 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
8121 ///
8122 /// # Example
8123 /// ```ignore,no_run
8124 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8125 /// let x = ChunkPageHeader::new().set_text("example");
8126 /// ```
8127 pub fn set_text<T: std::convert::Into<std::string::String>>(
8128 mut self,
8129 v: T,
8130 ) -> Self {
8131 self.text = v.into();
8132 self
8133 }
8134
8135 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8136 ///
8137 /// # Example
8138 /// ```ignore,no_run
8139 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8140 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8141 /// let x = ChunkPageHeader::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8142 /// ```
8143 pub fn set_page_span<T>(mut self, v: T) -> Self
8144 where
8145 T: std::convert::Into<
8146 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8147 >,
8148 {
8149 self.page_span = std::option::Option::Some(v.into());
8150 self
8151 }
8152
8153 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8154 ///
8155 /// # Example
8156 /// ```ignore,no_run
8157 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8158 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8159 /// let x = ChunkPageHeader::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8160 /// let x = ChunkPageHeader::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8161 /// ```
8162 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8163 where
8164 T: std::convert::Into<
8165 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8166 >,
8167 {
8168 self.page_span = v.map(|x| x.into());
8169 self
8170 }
8171 }
8172
8173 impl wkt::message::Message for ChunkPageHeader {
8174 fn typename() -> &'static str {
8175 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
8176 }
8177 }
8178
8179 /// Represents the page footer associated with the chunk.
8180 #[derive(Clone, Default, PartialEq)]
8181 #[non_exhaustive]
8182 pub struct ChunkPageFooter {
8183 /// Footer in text format.
8184 pub text: std::string::String,
8185
8186 /// Page span of the footer.
8187 pub page_span: std::option::Option<
8188 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8189 >,
8190
8191 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8192 }
8193
8194 impl ChunkPageFooter {
8195 /// Creates a new default instance.
8196 pub fn new() -> Self {
8197 std::default::Default::default()
8198 }
8199
8200 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
8201 ///
8202 /// # Example
8203 /// ```ignore,no_run
8204 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8205 /// let x = ChunkPageFooter::new().set_text("example");
8206 /// ```
8207 pub fn set_text<T: std::convert::Into<std::string::String>>(
8208 mut self,
8209 v: T,
8210 ) -> Self {
8211 self.text = v.into();
8212 self
8213 }
8214
8215 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8216 ///
8217 /// # Example
8218 /// ```ignore,no_run
8219 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8220 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8221 /// let x = ChunkPageFooter::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8222 /// ```
8223 pub fn set_page_span<T>(mut self, v: T) -> Self
8224 where
8225 T: std::convert::Into<
8226 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8227 >,
8228 {
8229 self.page_span = std::option::Option::Some(v.into());
8230 self
8231 }
8232
8233 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8234 ///
8235 /// # Example
8236 /// ```ignore,no_run
8237 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8238 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8239 /// let x = ChunkPageFooter::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8240 /// let x = ChunkPageFooter::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8241 /// ```
8242 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8243 where
8244 T: std::convert::Into<
8245 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8246 >,
8247 {
8248 self.page_span = v.map(|x| x.into());
8249 self
8250 }
8251 }
8252
8253 impl wkt::message::Message for ChunkPageFooter {
8254 fn typename() -> &'static str {
8255 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
8256 }
8257 }
8258
8259 /// The image chunk field in the chunk.
8260 #[derive(Clone, Default, PartialEq)]
8261 #[non_exhaustive]
8262 pub struct ImageChunkField {
8263 /// Annotation of the image chunk field.
8264 pub annotations: std::option::Option<crate::model::document::Annotations>,
8265
8266 /// Source of the image.
8267 pub image_source: std::option::Option<
8268 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource,
8269 >,
8270
8271 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8272 }
8273
8274 impl ImageChunkField {
8275 /// Creates a new default instance.
8276 pub fn new() -> Self {
8277 std::default::Default::default()
8278 }
8279
8280 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8281 ///
8282 /// # Example
8283 /// ```ignore,no_run
8284 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8285 /// use google_cloud_documentai_v1::model::document::Annotations;
8286 /// let x = ImageChunkField::new().set_annotations(Annotations::default()/* use setters */);
8287 /// ```
8288 pub fn set_annotations<T>(mut self, v: T) -> Self
8289 where
8290 T: std::convert::Into<crate::model::document::Annotations>,
8291 {
8292 self.annotations = std::option::Option::Some(v.into());
8293 self
8294 }
8295
8296 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8297 ///
8298 /// # Example
8299 /// ```ignore,no_run
8300 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8301 /// use google_cloud_documentai_v1::model::document::Annotations;
8302 /// let x = ImageChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8303 /// let x = ImageChunkField::new().set_or_clear_annotations(None::<Annotations>);
8304 /// ```
8305 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8306 where
8307 T: std::convert::Into<crate::model::document::Annotations>,
8308 {
8309 self.annotations = v.map(|x| x.into());
8310 self
8311 }
8312
8313 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source].
8314 ///
8315 /// Note that all the setters affecting `image_source` are mutually
8316 /// exclusive.
8317 ///
8318 /// # Example
8319 /// ```ignore,no_run
8320 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8321 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::image_chunk_field::ImageSource;
8322 /// let x = ImageChunkField::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
8323 /// ```
8324 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
8325 {
8326 self.image_source = v.into();
8327 self
8328 }
8329
8330 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8331 /// if it holds a `BlobAssetId`, `None` if the field is not set or
8332 /// holds a different branch.
8333 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
8334 #[allow(unreachable_patterns)]
8335 self.image_source.as_ref().and_then(|v| match v {
8336 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
8337 _ => std::option::Option::None,
8338 })
8339 }
8340
8341 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8342 /// to hold a `BlobAssetId`.
8343 ///
8344 /// Note that all the setters affecting `image_source` are
8345 /// mutually exclusive.
8346 ///
8347 /// # Example
8348 /// ```ignore,no_run
8349 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8350 /// let x = ImageChunkField::new().set_blob_asset_id("example");
8351 /// assert!(x.blob_asset_id().is_some());
8352 /// assert!(x.gcs_uri().is_none());
8353 /// assert!(x.data_uri().is_none());
8354 /// ```
8355 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
8356 mut self,
8357 v: T,
8358 ) -> Self {
8359 self.image_source = std::option::Option::Some(
8360 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(
8361 v.into()
8362 )
8363 );
8364 self
8365 }
8366
8367 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8368 /// if it holds a `GcsUri`, `None` if the field is not set or
8369 /// holds a different branch.
8370 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
8371 #[allow(unreachable_patterns)]
8372 self.image_source.as_ref().and_then(|v| match v {
8373 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(v) => std::option::Option::Some(v),
8374 _ => std::option::Option::None,
8375 })
8376 }
8377
8378 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8379 /// to hold a `GcsUri`.
8380 ///
8381 /// Note that all the setters affecting `image_source` are
8382 /// mutually exclusive.
8383 ///
8384 /// # Example
8385 /// ```ignore,no_run
8386 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8387 /// let x = ImageChunkField::new().set_gcs_uri("example");
8388 /// assert!(x.gcs_uri().is_some());
8389 /// assert!(x.blob_asset_id().is_none());
8390 /// assert!(x.data_uri().is_none());
8391 /// ```
8392 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
8393 mut self,
8394 v: T,
8395 ) -> Self {
8396 self.image_source = std::option::Option::Some(
8397 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(
8398 v.into()
8399 )
8400 );
8401 self
8402 }
8403
8404 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8405 /// if it holds a `DataUri`, `None` if the field is not set or
8406 /// holds a different branch.
8407 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
8408 #[allow(unreachable_patterns)]
8409 self.image_source.as_ref().and_then(|v| match v {
8410 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(v) => std::option::Option::Some(v),
8411 _ => std::option::Option::None,
8412 })
8413 }
8414
8415 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8416 /// to hold a `DataUri`.
8417 ///
8418 /// Note that all the setters affecting `image_source` are
8419 /// mutually exclusive.
8420 ///
8421 /// # Example
8422 /// ```ignore,no_run
8423 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8424 /// let x = ImageChunkField::new().set_data_uri("example");
8425 /// assert!(x.data_uri().is_some());
8426 /// assert!(x.blob_asset_id().is_none());
8427 /// assert!(x.gcs_uri().is_none());
8428 /// ```
8429 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
8430 mut self,
8431 v: T,
8432 ) -> Self {
8433 self.image_source = std::option::Option::Some(
8434 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(
8435 v.into()
8436 )
8437 );
8438 self
8439 }
8440 }
8441
8442 impl wkt::message::Message for ImageChunkField {
8443 fn typename() -> &'static str {
8444 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ImageChunkField"
8445 }
8446 }
8447
8448 /// Defines additional types related to [ImageChunkField].
8449 pub mod image_chunk_field {
8450 #[allow(unused_imports)]
8451 use super::*;
8452
8453 /// Source of the image.
8454 #[derive(Clone, Debug, PartialEq)]
8455 #[non_exhaustive]
8456 pub enum ImageSource {
8457 /// Optional. Asset id of the inline image. If set, find the image
8458 /// content in the blob_assets field.
8459 BlobAssetId(std::string::String),
8460 /// Optional. Google Cloud Storage uri of the image.
8461 GcsUri(std::string::String),
8462 /// Optional. Data uri of the image.
8463 /// It is composed of four parts: a prefix (data:), a MIME type
8464 /// indicating the type of data, an optional base64 token if
8465 /// non-textual, and the data itself:
8466 /// data:[\<mediatype\>][;base64],\<data\>
8467 DataUri(std::string::String),
8468 }
8469 }
8470
8471 /// The table chunk field in the chunk.
8472 #[derive(Clone, Default, PartialEq)]
8473 #[non_exhaustive]
8474 pub struct TableChunkField {
8475 /// Annotation of the table chunk field.
8476 pub annotations: std::option::Option<crate::model::document::Annotations>,
8477
8478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8479 }
8480
8481 impl TableChunkField {
8482 /// Creates a new default instance.
8483 pub fn new() -> Self {
8484 std::default::Default::default()
8485 }
8486
8487 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8488 ///
8489 /// # Example
8490 /// ```ignore,no_run
8491 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8492 /// use google_cloud_documentai_v1::model::document::Annotations;
8493 /// let x = TableChunkField::new().set_annotations(Annotations::default()/* use setters */);
8494 /// ```
8495 pub fn set_annotations<T>(mut self, v: T) -> Self
8496 where
8497 T: std::convert::Into<crate::model::document::Annotations>,
8498 {
8499 self.annotations = std::option::Option::Some(v.into());
8500 self
8501 }
8502
8503 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8504 ///
8505 /// # Example
8506 /// ```ignore,no_run
8507 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8508 /// use google_cloud_documentai_v1::model::document::Annotations;
8509 /// let x = TableChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8510 /// let x = TableChunkField::new().set_or_clear_annotations(None::<Annotations>);
8511 /// ```
8512 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8513 where
8514 T: std::convert::Into<crate::model::document::Annotations>,
8515 {
8516 self.annotations = v.map(|x| x.into());
8517 self
8518 }
8519 }
8520
8521 impl wkt::message::Message for TableChunkField {
8522 fn typename() -> &'static str {
8523 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.TableChunkField"
8524 }
8525 }
8526
8527 /// The chunk field in the chunk. A chunk field could be one of the various
8528 /// types (for example, image, table) supported.
8529 #[derive(Clone, Default, PartialEq)]
8530 #[non_exhaustive]
8531 pub struct ChunkField {
8532 /// The type of the chunk field.
8533 pub field_type: std::option::Option<
8534 crate::model::document::chunked_document::chunk::chunk_field::FieldType,
8535 >,
8536
8537 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8538 }
8539
8540 impl ChunkField {
8541 /// Creates a new default instance.
8542 pub fn new() -> Self {
8543 std::default::Default::default()
8544 }
8545
8546 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type].
8547 ///
8548 /// Note that all the setters affecting `field_type` are mutually
8549 /// exclusive.
8550 ///
8551 /// # Example
8552 /// ```ignore,no_run
8553 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8554 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8555 /// let x = ChunkField::new().set_field_type(Some(
8556 /// google_cloud_documentai_v1::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(ImageChunkField::default().into())));
8557 /// ```
8558 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
8559 {
8560 self.field_type = v.into();
8561 self
8562 }
8563
8564 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8565 /// if it holds a `ImageChunkField`, `None` if the field is not set or
8566 /// holds a different branch.
8567 pub fn image_chunk_field(
8568 &self,
8569 ) -> std::option::Option<
8570 &std::boxed::Box<
8571 crate::model::document::chunked_document::chunk::ImageChunkField,
8572 >,
8573 > {
8574 #[allow(unreachable_patterns)]
8575 self.field_type.as_ref().and_then(|v| match v {
8576 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(v) => std::option::Option::Some(v),
8577 _ => std::option::Option::None,
8578 })
8579 }
8580
8581 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8582 /// to hold a `ImageChunkField`.
8583 ///
8584 /// Note that all the setters affecting `field_type` are
8585 /// mutually exclusive.
8586 ///
8587 /// # Example
8588 /// ```ignore,no_run
8589 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8590 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8591 /// let x = ChunkField::new().set_image_chunk_field(ImageChunkField::default()/* use setters */);
8592 /// assert!(x.image_chunk_field().is_some());
8593 /// assert!(x.table_chunk_field().is_none());
8594 /// ```
8595 pub fn set_image_chunk_field<
8596 T: std::convert::Into<
8597 std::boxed::Box<
8598 crate::model::document::chunked_document::chunk::ImageChunkField,
8599 >,
8600 >,
8601 >(
8602 mut self,
8603 v: T,
8604 ) -> Self {
8605 self.field_type = std::option::Option::Some(
8606 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(
8607 v.into()
8608 )
8609 );
8610 self
8611 }
8612
8613 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8614 /// if it holds a `TableChunkField`, `None` if the field is not set or
8615 /// holds a different branch.
8616 pub fn table_chunk_field(
8617 &self,
8618 ) -> std::option::Option<
8619 &std::boxed::Box<
8620 crate::model::document::chunked_document::chunk::TableChunkField,
8621 >,
8622 > {
8623 #[allow(unreachable_patterns)]
8624 self.field_type.as_ref().and_then(|v| match v {
8625 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(v) => std::option::Option::Some(v),
8626 _ => std::option::Option::None,
8627 })
8628 }
8629
8630 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8631 /// to hold a `TableChunkField`.
8632 ///
8633 /// Note that all the setters affecting `field_type` are
8634 /// mutually exclusive.
8635 ///
8636 /// # Example
8637 /// ```ignore,no_run
8638 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8639 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8640 /// let x = ChunkField::new().set_table_chunk_field(TableChunkField::default()/* use setters */);
8641 /// assert!(x.table_chunk_field().is_some());
8642 /// assert!(x.image_chunk_field().is_none());
8643 /// ```
8644 pub fn set_table_chunk_field<
8645 T: std::convert::Into<
8646 std::boxed::Box<
8647 crate::model::document::chunked_document::chunk::TableChunkField,
8648 >,
8649 >,
8650 >(
8651 mut self,
8652 v: T,
8653 ) -> Self {
8654 self.field_type = std::option::Option::Some(
8655 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(
8656 v.into()
8657 )
8658 );
8659 self
8660 }
8661 }
8662
8663 impl wkt::message::Message for ChunkField {
8664 fn typename() -> &'static str {
8665 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkField"
8666 }
8667 }
8668
8669 /// Defines additional types related to [ChunkField].
8670 pub mod chunk_field {
8671 #[allow(unused_imports)]
8672 use super::*;
8673
8674 /// The type of the chunk field.
8675 #[derive(Clone, Debug, PartialEq)]
8676 #[non_exhaustive]
8677 pub enum FieldType {
8678 /// The image chunk field in the chunk.
8679 ImageChunkField(
8680 std::boxed::Box<
8681 crate::model::document::chunked_document::chunk::ImageChunkField,
8682 >,
8683 ),
8684 /// The table chunk field in the chunk.
8685 TableChunkField(
8686 std::boxed::Box<
8687 crate::model::document::chunked_document::chunk::TableChunkField,
8688 >,
8689 ),
8690 }
8691 }
8692 }
8693 }
8694
8695 /// Represents a blob asset. It's used to store the content of the inline blob
8696 /// in this document, for example, image bytes, such that it can be referenced
8697 /// by other fields in the document via asset ID.
8698 #[derive(Clone, Default, PartialEq)]
8699 #[non_exhaustive]
8700 pub struct BlobAsset {
8701 /// Optional. The id of the blob asset.
8702 pub asset_id: std::string::String,
8703
8704 /// Optional. The content of the blob asset, for example, image bytes.
8705 pub content: ::bytes::Bytes,
8706
8707 /// The mime type of the blob asset.
8708 /// An IANA published [media type (MIME
8709 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
8710 pub mime_type: std::string::String,
8711
8712 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8713 }
8714
8715 impl BlobAsset {
8716 /// Creates a new default instance.
8717 pub fn new() -> Self {
8718 std::default::Default::default()
8719 }
8720
8721 /// Sets the value of [asset_id][crate::model::document::BlobAsset::asset_id].
8722 ///
8723 /// # Example
8724 /// ```ignore,no_run
8725 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8726 /// let x = BlobAsset::new().set_asset_id("example");
8727 /// ```
8728 pub fn set_asset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8729 self.asset_id = v.into();
8730 self
8731 }
8732
8733 /// Sets the value of [content][crate::model::document::BlobAsset::content].
8734 ///
8735 /// # Example
8736 /// ```ignore,no_run
8737 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8738 /// let x = BlobAsset::new().set_content(bytes::Bytes::from_static(b"example"));
8739 /// ```
8740 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8741 self.content = v.into();
8742 self
8743 }
8744
8745 /// Sets the value of [mime_type][crate::model::document::BlobAsset::mime_type].
8746 ///
8747 /// # Example
8748 /// ```ignore,no_run
8749 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8750 /// let x = BlobAsset::new().set_mime_type("example");
8751 /// ```
8752 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8753 self.mime_type = v.into();
8754 self
8755 }
8756 }
8757
8758 impl wkt::message::Message for BlobAsset {
8759 fn typename() -> &'static str {
8760 "type.googleapis.com/google.cloud.documentai.v1.Document.BlobAsset"
8761 }
8762 }
8763
8764 /// The output of the validation given the document and the validation rules.
8765 #[derive(Clone, Default, PartialEq)]
8766 #[non_exhaustive]
8767 pub struct EntityValidationOutput {
8768 /// The result of each validation rule.
8769 pub validation_results:
8770 std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
8771
8772 /// The overall result of the validation, true if all applicable rules are
8773 /// valid.
8774 pub pass_all_rules: bool,
8775
8776 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8777 }
8778
8779 impl EntityValidationOutput {
8780 /// Creates a new default instance.
8781 pub fn new() -> Self {
8782 std::default::Default::default()
8783 }
8784
8785 /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
8786 ///
8787 /// # Example
8788 /// ```ignore,no_run
8789 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8790 /// use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8791 /// let x = EntityValidationOutput::new()
8792 /// .set_validation_results([
8793 /// ValidationResult::default()/* use setters */,
8794 /// ValidationResult::default()/* use (different) setters */,
8795 /// ]);
8796 /// ```
8797 pub fn set_validation_results<T, V>(mut self, v: T) -> Self
8798 where
8799 T: std::iter::IntoIterator<Item = V>,
8800 V: std::convert::Into<
8801 crate::model::document::entity_validation_output::ValidationResult,
8802 >,
8803 {
8804 use std::iter::Iterator;
8805 self.validation_results = v.into_iter().map(|i| i.into()).collect();
8806 self
8807 }
8808
8809 /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
8810 ///
8811 /// # Example
8812 /// ```ignore,no_run
8813 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8814 /// let x = EntityValidationOutput::new().set_pass_all_rules(true);
8815 /// ```
8816 pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8817 self.pass_all_rules = v.into();
8818 self
8819 }
8820 }
8821
8822 impl wkt::message::Message for EntityValidationOutput {
8823 fn typename() -> &'static str {
8824 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
8825 }
8826 }
8827
8828 /// Defines additional types related to [EntityValidationOutput].
8829 pub mod entity_validation_output {
8830 #[allow(unused_imports)]
8831 use super::*;
8832
8833 /// Validation result for a single validation rule.
8834 #[derive(Clone, Default, PartialEq)]
8835 #[non_exhaustive]
8836 pub struct ValidationResult {
8837
8838 /// The name of the validation rule.
8839 pub rule_name: std::string::String,
8840
8841 /// The description of the validation rule.
8842 pub rule_description: std::string::String,
8843
8844 /// The result of the validation rule.
8845 pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
8846
8847 /// The detailed information of the running the validation process using
8848 /// the entity from the document based on the validation rule.
8849 pub validation_details: std::string::String,
8850
8851 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8852 }
8853
8854 impl ValidationResult {
8855 /// Creates a new default instance.
8856 pub fn new() -> Self {
8857 std::default::Default::default()
8858 }
8859
8860 /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
8861 ///
8862 /// # Example
8863 /// ```ignore,no_run
8864 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8865 /// let x = ValidationResult::new().set_rule_name("example");
8866 /// ```
8867 pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
8868 mut self,
8869 v: T,
8870 ) -> Self {
8871 self.rule_name = v.into();
8872 self
8873 }
8874
8875 /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
8876 ///
8877 /// # Example
8878 /// ```ignore,no_run
8879 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8880 /// let x = ValidationResult::new().set_rule_description("example");
8881 /// ```
8882 pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
8883 mut self,
8884 v: T,
8885 ) -> Self {
8886 self.rule_description = v.into();
8887 self
8888 }
8889
8890 /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
8891 ///
8892 /// # Example
8893 /// ```ignore,no_run
8894 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8895 /// use google_cloud_documentai_v1::model::document::entity_validation_output::validation_result::ValidationResultType;
8896 /// let x0 = ValidationResult::new().set_validation_result_type(ValidationResultType::Valid);
8897 /// let x1 = ValidationResult::new().set_validation_result_type(ValidationResultType::Invalid);
8898 /// let x2 = ValidationResult::new().set_validation_result_type(ValidationResultType::Skipped);
8899 /// ```
8900 pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
8901 self.validation_result_type = v.into();
8902 self
8903 }
8904
8905 /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
8906 ///
8907 /// # Example
8908 /// ```ignore,no_run
8909 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8910 /// let x = ValidationResult::new().set_validation_details("example");
8911 /// ```
8912 pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
8913 mut self,
8914 v: T,
8915 ) -> Self {
8916 self.validation_details = v.into();
8917 self
8918 }
8919 }
8920
8921 impl wkt::message::Message for ValidationResult {
8922 fn typename() -> &'static str {
8923 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
8924 }
8925 }
8926
8927 /// Defines additional types related to [ValidationResult].
8928 pub mod validation_result {
8929 #[allow(unused_imports)]
8930 use super::*;
8931
8932 /// The result of the validation rule.
8933 ///
8934 /// # Working with unknown values
8935 ///
8936 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8937 /// additional enum variants at any time. Adding new variants is not considered
8938 /// a breaking change. Applications should write their code in anticipation of:
8939 ///
8940 /// - New values appearing in future releases of the client library, **and**
8941 /// - New values received dynamically, without application changes.
8942 ///
8943 /// Please consult the [Working with enums] section in the user guide for some
8944 /// guidelines.
8945 ///
8946 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8947 #[derive(Clone, Debug, PartialEq)]
8948 #[non_exhaustive]
8949 pub enum ValidationResultType {
8950 /// The validation result type is unspecified.
8951 Unspecified,
8952 /// The validation is valid.
8953 Valid,
8954 /// The validation is invalid.
8955 Invalid,
8956 /// The validation is skipped.
8957 Skipped,
8958 /// The validation is not applicable.
8959 NotApplicable,
8960 /// If set, the enum was initialized with an unknown value.
8961 ///
8962 /// Applications can examine the value using [ValidationResultType::value] or
8963 /// [ValidationResultType::name].
8964 UnknownValue(validation_result_type::UnknownValue),
8965 }
8966
8967 #[doc(hidden)]
8968 pub mod validation_result_type {
8969 #[allow(unused_imports)]
8970 use super::*;
8971 #[derive(Clone, Debug, PartialEq)]
8972 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8973 }
8974
8975 impl ValidationResultType {
8976 /// Gets the enum value.
8977 ///
8978 /// Returns `None` if the enum contains an unknown value deserialized from
8979 /// the string representation of enums.
8980 pub fn value(&self) -> std::option::Option<i32> {
8981 match self {
8982 Self::Unspecified => std::option::Option::Some(0),
8983 Self::Valid => std::option::Option::Some(1),
8984 Self::Invalid => std::option::Option::Some(2),
8985 Self::Skipped => std::option::Option::Some(3),
8986 Self::NotApplicable => std::option::Option::Some(4),
8987 Self::UnknownValue(u) => u.0.value(),
8988 }
8989 }
8990
8991 /// Gets the enum value as a string.
8992 ///
8993 /// Returns `None` if the enum contains an unknown value deserialized from
8994 /// the integer representation of enums.
8995 pub fn name(&self) -> std::option::Option<&str> {
8996 match self {
8997 Self::Unspecified => {
8998 std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
8999 }
9000 Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
9001 Self::Invalid => {
9002 std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
9003 }
9004 Self::Skipped => {
9005 std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
9006 }
9007 Self::NotApplicable => {
9008 std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
9009 }
9010 Self::UnknownValue(u) => u.0.name(),
9011 }
9012 }
9013 }
9014
9015 impl std::default::Default for ValidationResultType {
9016 fn default() -> Self {
9017 use std::convert::From;
9018 Self::from(0)
9019 }
9020 }
9021
9022 impl std::fmt::Display for ValidationResultType {
9023 fn fmt(
9024 &self,
9025 f: &mut std::fmt::Formatter<'_>,
9026 ) -> std::result::Result<(), std::fmt::Error> {
9027 wkt::internal::display_enum(f, self.name(), self.value())
9028 }
9029 }
9030
9031 impl std::convert::From<i32> for ValidationResultType {
9032 fn from(value: i32) -> Self {
9033 match value {
9034 0 => Self::Unspecified,
9035 1 => Self::Valid,
9036 2 => Self::Invalid,
9037 3 => Self::Skipped,
9038 4 => Self::NotApplicable,
9039 _ => Self::UnknownValue(validation_result_type::UnknownValue(
9040 wkt::internal::UnknownEnumValue::Integer(value),
9041 )),
9042 }
9043 }
9044 }
9045
9046 impl std::convert::From<&str> for ValidationResultType {
9047 fn from(value: &str) -> Self {
9048 use std::string::ToString;
9049 match value {
9050 "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
9051 "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
9052 "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
9053 "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
9054 "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
9055 _ => Self::UnknownValue(validation_result_type::UnknownValue(
9056 wkt::internal::UnknownEnumValue::String(value.to_string()),
9057 )),
9058 }
9059 }
9060 }
9061
9062 impl serde::ser::Serialize for ValidationResultType {
9063 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9064 where
9065 S: serde::Serializer,
9066 {
9067 match self {
9068 Self::Unspecified => serializer.serialize_i32(0),
9069 Self::Valid => serializer.serialize_i32(1),
9070 Self::Invalid => serializer.serialize_i32(2),
9071 Self::Skipped => serializer.serialize_i32(3),
9072 Self::NotApplicable => serializer.serialize_i32(4),
9073 Self::UnknownValue(u) => u.0.serialize(serializer),
9074 }
9075 }
9076 }
9077
9078 impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
9079 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9080 where
9081 D: serde::Deserializer<'de>,
9082 {
9083 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
9084 ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
9085 }
9086 }
9087 }
9088 }
9089
9090 /// Entity revision.
9091 #[derive(Clone, Default, PartialEq)]
9092 #[non_exhaustive]
9093 pub struct EntitiesRevision {
9094 /// The revision id.
9095 pub revision_id: std::string::String,
9096
9097 /// The entities in this revision.
9098 pub entities: std::vec::Vec<crate::model::document::Entity>,
9099
9100 /// The entity validation output for this revision.
9101 pub entity_validation_output:
9102 std::option::Option<crate::model::document::EntityValidationOutput>,
9103
9104 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9105 }
9106
9107 impl EntitiesRevision {
9108 /// Creates a new default instance.
9109 pub fn new() -> Self {
9110 std::default::Default::default()
9111 }
9112
9113 /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
9114 ///
9115 /// # Example
9116 /// ```ignore,no_run
9117 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9118 /// let x = EntitiesRevision::new().set_revision_id("example");
9119 /// ```
9120 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9121 self.revision_id = v.into();
9122 self
9123 }
9124
9125 /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
9126 ///
9127 /// # Example
9128 /// ```ignore,no_run
9129 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9130 /// use google_cloud_documentai_v1::model::document::Entity;
9131 /// let x = EntitiesRevision::new()
9132 /// .set_entities([
9133 /// Entity::default()/* use setters */,
9134 /// Entity::default()/* use (different) setters */,
9135 /// ]);
9136 /// ```
9137 pub fn set_entities<T, V>(mut self, v: T) -> Self
9138 where
9139 T: std::iter::IntoIterator<Item = V>,
9140 V: std::convert::Into<crate::model::document::Entity>,
9141 {
9142 use std::iter::Iterator;
9143 self.entities = v.into_iter().map(|i| i.into()).collect();
9144 self
9145 }
9146
9147 /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9148 ///
9149 /// # Example
9150 /// ```ignore,no_run
9151 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9152 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9153 /// let x = EntitiesRevision::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
9154 /// ```
9155 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
9156 where
9157 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9158 {
9159 self.entity_validation_output = std::option::Option::Some(v.into());
9160 self
9161 }
9162
9163 /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9164 ///
9165 /// # Example
9166 /// ```ignore,no_run
9167 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9168 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9169 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
9170 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
9171 /// ```
9172 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
9173 where
9174 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9175 {
9176 self.entity_validation_output = v.map(|x| x.into());
9177 self
9178 }
9179 }
9180
9181 impl wkt::message::Message for EntitiesRevision {
9182 fn typename() -> &'static str {
9183 "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
9184 }
9185 }
9186
9187 /// Original source document from the user.
9188 #[derive(Clone, Debug, PartialEq)]
9189 #[non_exhaustive]
9190 pub enum Source {
9191 /// Optional. Currently supports Google Cloud Storage URI of the form
9192 /// `gs://bucket_name/object_name`. Object versioning is not supported.
9193 /// For more information, refer to [Google Cloud Storage Request
9194 /// URIs](https://cloud.google.com/storage/docs/reference-uris).
9195 Uri(std::string::String),
9196 /// Optional. Inline document content, represented as a stream of bytes.
9197 /// Note: As with all `bytes` fields, protobuffers use a pure binary
9198 /// representation, whereas JSON representations use base64.
9199 Content(::bytes::Bytes),
9200 }
9201}
9202
9203/// Payload message of raw document content (bytes).
9204#[derive(Clone, Default, PartialEq)]
9205#[non_exhaustive]
9206pub struct RawDocument {
9207 /// Inline document content.
9208 pub content: ::bytes::Bytes,
9209
9210 /// An IANA MIME type (RFC6838) indicating the nature and format of the
9211 /// [content][google.cloud.documentai.v1.RawDocument.content].
9212 ///
9213 /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
9214 pub mime_type: std::string::String,
9215
9216 /// The display name of the document, it supports all Unicode characters except
9217 /// the following:
9218 /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
9219 /// `~`, `=` and `:` are reserved.
9220 /// If not specified, a default ID is generated.
9221 pub display_name: std::string::String,
9222
9223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9224}
9225
9226impl RawDocument {
9227 /// Creates a new default instance.
9228 pub fn new() -> Self {
9229 std::default::Default::default()
9230 }
9231
9232 /// Sets the value of [content][crate::model::RawDocument::content].
9233 ///
9234 /// # Example
9235 /// ```ignore,no_run
9236 /// # use google_cloud_documentai_v1::model::RawDocument;
9237 /// let x = RawDocument::new().set_content(bytes::Bytes::from_static(b"example"));
9238 /// ```
9239 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9240 self.content = v.into();
9241 self
9242 }
9243
9244 /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
9245 ///
9246 /// # Example
9247 /// ```ignore,no_run
9248 /// # use google_cloud_documentai_v1::model::RawDocument;
9249 /// let x = RawDocument::new().set_mime_type("example");
9250 /// ```
9251 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9252 self.mime_type = v.into();
9253 self
9254 }
9255
9256 /// Sets the value of [display_name][crate::model::RawDocument::display_name].
9257 ///
9258 /// # Example
9259 /// ```ignore,no_run
9260 /// # use google_cloud_documentai_v1::model::RawDocument;
9261 /// let x = RawDocument::new().set_display_name("example");
9262 /// ```
9263 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9264 self.display_name = v.into();
9265 self
9266 }
9267}
9268
9269impl wkt::message::Message for RawDocument {
9270 fn typename() -> &'static str {
9271 "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
9272 }
9273}
9274
9275/// Specifies a document stored on Cloud Storage.
9276#[derive(Clone, Default, PartialEq)]
9277#[non_exhaustive]
9278pub struct GcsDocument {
9279 /// The Cloud Storage object uri.
9280 pub gcs_uri: std::string::String,
9281
9282 /// An IANA MIME type (RFC6838) of the content.
9283 pub mime_type: std::string::String,
9284
9285 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9286}
9287
9288impl GcsDocument {
9289 /// Creates a new default instance.
9290 pub fn new() -> Self {
9291 std::default::Default::default()
9292 }
9293
9294 /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
9295 ///
9296 /// # Example
9297 /// ```ignore,no_run
9298 /// # use google_cloud_documentai_v1::model::GcsDocument;
9299 /// let x = GcsDocument::new().set_gcs_uri("example");
9300 /// ```
9301 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9302 self.gcs_uri = v.into();
9303 self
9304 }
9305
9306 /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
9307 ///
9308 /// # Example
9309 /// ```ignore,no_run
9310 /// # use google_cloud_documentai_v1::model::GcsDocument;
9311 /// let x = GcsDocument::new().set_mime_type("example");
9312 /// ```
9313 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9314 self.mime_type = v.into();
9315 self
9316 }
9317}
9318
9319impl wkt::message::Message for GcsDocument {
9320 fn typename() -> &'static str {
9321 "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
9322 }
9323}
9324
9325/// Specifies a set of documents on Cloud Storage.
9326#[derive(Clone, Default, PartialEq)]
9327#[non_exhaustive]
9328pub struct GcsDocuments {
9329 /// The list of documents.
9330 pub documents: std::vec::Vec<crate::model::GcsDocument>,
9331
9332 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9333}
9334
9335impl GcsDocuments {
9336 /// Creates a new default instance.
9337 pub fn new() -> Self {
9338 std::default::Default::default()
9339 }
9340
9341 /// Sets the value of [documents][crate::model::GcsDocuments::documents].
9342 ///
9343 /// # Example
9344 /// ```ignore,no_run
9345 /// # use google_cloud_documentai_v1::model::GcsDocuments;
9346 /// use google_cloud_documentai_v1::model::GcsDocument;
9347 /// let x = GcsDocuments::new()
9348 /// .set_documents([
9349 /// GcsDocument::default()/* use setters */,
9350 /// GcsDocument::default()/* use (different) setters */,
9351 /// ]);
9352 /// ```
9353 pub fn set_documents<T, V>(mut self, v: T) -> Self
9354 where
9355 T: std::iter::IntoIterator<Item = V>,
9356 V: std::convert::Into<crate::model::GcsDocument>,
9357 {
9358 use std::iter::Iterator;
9359 self.documents = v.into_iter().map(|i| i.into()).collect();
9360 self
9361 }
9362}
9363
9364impl wkt::message::Message for GcsDocuments {
9365 fn typename() -> &'static str {
9366 "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
9367 }
9368}
9369
9370/// Specifies all documents on Cloud Storage with a common prefix.
9371#[derive(Clone, Default, PartialEq)]
9372#[non_exhaustive]
9373pub struct GcsPrefix {
9374 /// The URI prefix.
9375 pub gcs_uri_prefix: std::string::String,
9376
9377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9378}
9379
9380impl GcsPrefix {
9381 /// Creates a new default instance.
9382 pub fn new() -> Self {
9383 std::default::Default::default()
9384 }
9385
9386 /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
9387 ///
9388 /// # Example
9389 /// ```ignore,no_run
9390 /// # use google_cloud_documentai_v1::model::GcsPrefix;
9391 /// let x = GcsPrefix::new().set_gcs_uri_prefix("example");
9392 /// ```
9393 pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9394 self.gcs_uri_prefix = v.into();
9395 self
9396 }
9397}
9398
9399impl wkt::message::Message for GcsPrefix {
9400 fn typename() -> &'static str {
9401 "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
9402 }
9403}
9404
9405/// The common config to specify a set of documents used as input.
9406#[derive(Clone, Default, PartialEq)]
9407#[non_exhaustive]
9408pub struct BatchDocumentsInputConfig {
9409 /// The source. Make sure that the caller of the API has storage.objects.get
9410 /// access to the buckets.
9411 pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
9412
9413 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9414}
9415
9416impl BatchDocumentsInputConfig {
9417 /// Creates a new default instance.
9418 pub fn new() -> Self {
9419 std::default::Default::default()
9420 }
9421
9422 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
9423 ///
9424 /// Note that all the setters affecting `source` are mutually
9425 /// exclusive.
9426 ///
9427 /// # Example
9428 /// ```ignore,no_run
9429 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9430 /// use google_cloud_documentai_v1::model::GcsPrefix;
9431 /// let x = BatchDocumentsInputConfig::new().set_source(Some(
9432 /// google_cloud_documentai_v1::model::batch_documents_input_config::Source::GcsPrefix(GcsPrefix::default().into())));
9433 /// ```
9434 pub fn set_source<
9435 T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
9436 >(
9437 mut self,
9438 v: T,
9439 ) -> Self {
9440 self.source = v.into();
9441 self
9442 }
9443
9444 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9445 /// if it holds a `GcsPrefix`, `None` if the field is not set or
9446 /// holds a different branch.
9447 pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
9448 #[allow(unreachable_patterns)]
9449 self.source.as_ref().and_then(|v| match v {
9450 crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
9451 std::option::Option::Some(v)
9452 }
9453 _ => std::option::Option::None,
9454 })
9455 }
9456
9457 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9458 /// to hold a `GcsPrefix`.
9459 ///
9460 /// Note that all the setters affecting `source` are
9461 /// mutually exclusive.
9462 ///
9463 /// # Example
9464 /// ```ignore,no_run
9465 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9466 /// use google_cloud_documentai_v1::model::GcsPrefix;
9467 /// let x = BatchDocumentsInputConfig::new().set_gcs_prefix(GcsPrefix::default()/* use setters */);
9468 /// assert!(x.gcs_prefix().is_some());
9469 /// assert!(x.gcs_documents().is_none());
9470 /// ```
9471 pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
9472 mut self,
9473 v: T,
9474 ) -> Self {
9475 self.source = std::option::Option::Some(
9476 crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
9477 );
9478 self
9479 }
9480
9481 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9482 /// if it holds a `GcsDocuments`, `None` if the field is not set or
9483 /// holds a different branch.
9484 pub fn gcs_documents(
9485 &self,
9486 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
9487 #[allow(unreachable_patterns)]
9488 self.source.as_ref().and_then(|v| match v {
9489 crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
9490 std::option::Option::Some(v)
9491 }
9492 _ => std::option::Option::None,
9493 })
9494 }
9495
9496 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9497 /// to hold a `GcsDocuments`.
9498 ///
9499 /// Note that all the setters affecting `source` are
9500 /// mutually exclusive.
9501 ///
9502 /// # Example
9503 /// ```ignore,no_run
9504 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9505 /// use google_cloud_documentai_v1::model::GcsDocuments;
9506 /// let x = BatchDocumentsInputConfig::new().set_gcs_documents(GcsDocuments::default()/* use setters */);
9507 /// assert!(x.gcs_documents().is_some());
9508 /// assert!(x.gcs_prefix().is_none());
9509 /// ```
9510 pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
9511 mut self,
9512 v: T,
9513 ) -> Self {
9514 self.source = std::option::Option::Some(
9515 crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
9516 );
9517 self
9518 }
9519}
9520
9521impl wkt::message::Message for BatchDocumentsInputConfig {
9522 fn typename() -> &'static str {
9523 "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
9524 }
9525}
9526
9527/// Defines additional types related to [BatchDocumentsInputConfig].
9528pub mod batch_documents_input_config {
9529 #[allow(unused_imports)]
9530 use super::*;
9531
9532 /// The source. Make sure that the caller of the API has storage.objects.get
9533 /// access to the buckets.
9534 #[derive(Clone, Debug, PartialEq)]
9535 #[non_exhaustive]
9536 pub enum Source {
9537 /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
9538 GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
9539 /// The set of documents individually specified on Cloud Storage.
9540 GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
9541 }
9542}
9543
9544/// Config that controls the output of documents. All documents will be written
9545/// as a JSON file.
9546#[derive(Clone, Default, PartialEq)]
9547#[non_exhaustive]
9548pub struct DocumentOutputConfig {
9549 /// The destination of the results.
9550 pub destination: std::option::Option<crate::model::document_output_config::Destination>,
9551
9552 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9553}
9554
9555impl DocumentOutputConfig {
9556 /// Creates a new default instance.
9557 pub fn new() -> Self {
9558 std::default::Default::default()
9559 }
9560
9561 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
9562 ///
9563 /// Note that all the setters affecting `destination` are mutually
9564 /// exclusive.
9565 ///
9566 /// # Example
9567 /// ```ignore,no_run
9568 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9569 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9570 /// let x = DocumentOutputConfig::new().set_destination(Some(
9571 /// google_cloud_documentai_v1::model::document_output_config::Destination::GcsOutputConfig(GcsOutputConfig::default().into())));
9572 /// ```
9573 pub fn set_destination<
9574 T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
9575 >(
9576 mut self,
9577 v: T,
9578 ) -> Self {
9579 self.destination = v.into();
9580 self
9581 }
9582
9583 /// The value of [destination][crate::model::DocumentOutputConfig::destination]
9584 /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
9585 /// holds a different branch.
9586 pub fn gcs_output_config(
9587 &self,
9588 ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
9589 {
9590 #[allow(unreachable_patterns)]
9591 self.destination.as_ref().and_then(|v| match v {
9592 crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
9593 std::option::Option::Some(v)
9594 }
9595 _ => std::option::Option::None,
9596 })
9597 }
9598
9599 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
9600 /// to hold a `GcsOutputConfig`.
9601 ///
9602 /// Note that all the setters affecting `destination` are
9603 /// mutually exclusive.
9604 ///
9605 /// # Example
9606 /// ```ignore,no_run
9607 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9608 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9609 /// let x = DocumentOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
9610 /// assert!(x.gcs_output_config().is_some());
9611 /// ```
9612 pub fn set_gcs_output_config<
9613 T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
9614 >(
9615 mut self,
9616 v: T,
9617 ) -> Self {
9618 self.destination = std::option::Option::Some(
9619 crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
9620 );
9621 self
9622 }
9623}
9624
9625impl wkt::message::Message for DocumentOutputConfig {
9626 fn typename() -> &'static str {
9627 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
9628 }
9629}
9630
9631/// Defines additional types related to [DocumentOutputConfig].
9632pub mod document_output_config {
9633 #[allow(unused_imports)]
9634 use super::*;
9635
9636 /// The configuration used when outputting documents.
9637 #[derive(Clone, Default, PartialEq)]
9638 #[non_exhaustive]
9639 pub struct GcsOutputConfig {
9640 /// The Cloud Storage uri (a directory) of the output.
9641 pub gcs_uri: std::string::String,
9642
9643 /// Specifies which fields to include in the output documents.
9644 /// Only supports top level document and pages field so it must be in the
9645 /// form of `{document_field_name}` or `pages.{page_field_name}`.
9646 pub field_mask: std::option::Option<wkt::FieldMask>,
9647
9648 /// Specifies the sharding config for the output document.
9649 pub sharding_config: std::option::Option<
9650 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9651 >,
9652
9653 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9654 }
9655
9656 impl GcsOutputConfig {
9657 /// Creates a new default instance.
9658 pub fn new() -> Self {
9659 std::default::Default::default()
9660 }
9661
9662 /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
9663 ///
9664 /// # Example
9665 /// ```ignore,no_run
9666 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9667 /// let x = GcsOutputConfig::new().set_gcs_uri("example");
9668 /// ```
9669 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9670 self.gcs_uri = v.into();
9671 self
9672 }
9673
9674 /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9675 ///
9676 /// # Example
9677 /// ```ignore,no_run
9678 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9679 /// use wkt::FieldMask;
9680 /// let x = GcsOutputConfig::new().set_field_mask(FieldMask::default()/* use setters */);
9681 /// ```
9682 pub fn set_field_mask<T>(mut self, v: T) -> Self
9683 where
9684 T: std::convert::Into<wkt::FieldMask>,
9685 {
9686 self.field_mask = std::option::Option::Some(v.into());
9687 self
9688 }
9689
9690 /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9691 ///
9692 /// # Example
9693 /// ```ignore,no_run
9694 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9695 /// use wkt::FieldMask;
9696 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
9697 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(None::<FieldMask>);
9698 /// ```
9699 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
9700 where
9701 T: std::convert::Into<wkt::FieldMask>,
9702 {
9703 self.field_mask = v.map(|x| x.into());
9704 self
9705 }
9706
9707 /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9708 ///
9709 /// # Example
9710 /// ```ignore,no_run
9711 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9712 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9713 /// let x = GcsOutputConfig::new().set_sharding_config(ShardingConfig::default()/* use setters */);
9714 /// ```
9715 pub fn set_sharding_config<T>(mut self, v: T) -> Self
9716 where
9717 T: std::convert::Into<
9718 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9719 >,
9720 {
9721 self.sharding_config = std::option::Option::Some(v.into());
9722 self
9723 }
9724
9725 /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9726 ///
9727 /// # Example
9728 /// ```ignore,no_run
9729 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9730 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9731 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(Some(ShardingConfig::default()/* use setters */));
9732 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(None::<ShardingConfig>);
9733 /// ```
9734 pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
9735 where
9736 T: std::convert::Into<
9737 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9738 >,
9739 {
9740 self.sharding_config = v.map(|x| x.into());
9741 self
9742 }
9743 }
9744
9745 impl wkt::message::Message for GcsOutputConfig {
9746 fn typename() -> &'static str {
9747 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
9748 }
9749 }
9750
9751 /// Defines additional types related to [GcsOutputConfig].
9752 pub mod gcs_output_config {
9753 #[allow(unused_imports)]
9754 use super::*;
9755
9756 /// The sharding config for the output document.
9757 #[derive(Clone, Default, PartialEq)]
9758 #[non_exhaustive]
9759 pub struct ShardingConfig {
9760 /// The number of pages per shard.
9761 pub pages_per_shard: i32,
9762
9763 /// The number of overlapping pages between consecutive shards.
9764 pub pages_overlap: i32,
9765
9766 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9767 }
9768
9769 impl ShardingConfig {
9770 /// Creates a new default instance.
9771 pub fn new() -> Self {
9772 std::default::Default::default()
9773 }
9774
9775 /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
9776 ///
9777 /// # Example
9778 /// ```ignore,no_run
9779 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9780 /// let x = ShardingConfig::new().set_pages_per_shard(42);
9781 /// ```
9782 pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9783 self.pages_per_shard = v.into();
9784 self
9785 }
9786
9787 /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
9788 ///
9789 /// # Example
9790 /// ```ignore,no_run
9791 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9792 /// let x = ShardingConfig::new().set_pages_overlap(42);
9793 /// ```
9794 pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9795 self.pages_overlap = v.into();
9796 self
9797 }
9798 }
9799
9800 impl wkt::message::Message for ShardingConfig {
9801 fn typename() -> &'static str {
9802 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
9803 }
9804 }
9805 }
9806
9807 /// The destination of the results.
9808 #[derive(Clone, Debug, PartialEq)]
9809 #[non_exhaustive]
9810 pub enum Destination {
9811 /// Output config to write the results to Cloud Storage.
9812 GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
9813 }
9814}
9815
9816/// Config for Document OCR.
9817#[derive(Clone, Default, PartialEq)]
9818#[non_exhaustive]
9819pub struct OcrConfig {
9820 /// Hints for the OCR model.
9821 pub hints: std::option::Option<crate::model::ocr_config::Hints>,
9822
9823 /// Enables special handling for PDFs with existing text information. Results
9824 /// in better text extraction quality in such PDF inputs.
9825 pub enable_native_pdf_parsing: bool,
9826
9827 /// Enables intelligent document quality scores after OCR. Can help with
9828 /// diagnosing why OCR responses are of poor quality for a given input.
9829 /// Adds additional latency comparable to regular OCR to the process call.
9830 pub enable_image_quality_scores: bool,
9831
9832 /// A list of advanced OCR options to further fine-tune OCR behavior. Current
9833 /// valid values are:
9834 ///
9835 /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
9836 /// an alternative to the current ML-based layout detection algorithm.
9837 /// Customers can choose the best suitable layout algorithm based on their
9838 /// situation.
9839 pub advanced_ocr_options: std::vec::Vec<std::string::String>,
9840
9841 /// Includes symbol level OCR information if set to true.
9842 pub enable_symbol: bool,
9843
9844 /// Turn on font identification model and return font style information.
9845 /// Deprecated, use
9846 /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
9847 /// instead.
9848 ///
9849 /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
9850 #[deprecated]
9851 pub compute_style_info: bool,
9852
9853 /// Turn off character box detector in OCR engine. Character box detection is
9854 /// enabled by default in OCR 2.0 (and later) processors.
9855 pub disable_character_boxes_detection: bool,
9856
9857 /// Configurations for premium OCR features.
9858 pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
9859
9860 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9861}
9862
9863impl OcrConfig {
9864 /// Creates a new default instance.
9865 pub fn new() -> Self {
9866 std::default::Default::default()
9867 }
9868
9869 /// Sets the value of [hints][crate::model::OcrConfig::hints].
9870 ///
9871 /// # Example
9872 /// ```ignore,no_run
9873 /// # use google_cloud_documentai_v1::model::OcrConfig;
9874 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9875 /// let x = OcrConfig::new().set_hints(Hints::default()/* use setters */);
9876 /// ```
9877 pub fn set_hints<T>(mut self, v: T) -> Self
9878 where
9879 T: std::convert::Into<crate::model::ocr_config::Hints>,
9880 {
9881 self.hints = std::option::Option::Some(v.into());
9882 self
9883 }
9884
9885 /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
9886 ///
9887 /// # Example
9888 /// ```ignore,no_run
9889 /// # use google_cloud_documentai_v1::model::OcrConfig;
9890 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9891 /// let x = OcrConfig::new().set_or_clear_hints(Some(Hints::default()/* use setters */));
9892 /// let x = OcrConfig::new().set_or_clear_hints(None::<Hints>);
9893 /// ```
9894 pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
9895 where
9896 T: std::convert::Into<crate::model::ocr_config::Hints>,
9897 {
9898 self.hints = v.map(|x| x.into());
9899 self
9900 }
9901
9902 /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
9903 ///
9904 /// # Example
9905 /// ```ignore,no_run
9906 /// # use google_cloud_documentai_v1::model::OcrConfig;
9907 /// let x = OcrConfig::new().set_enable_native_pdf_parsing(true);
9908 /// ```
9909 pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9910 self.enable_native_pdf_parsing = v.into();
9911 self
9912 }
9913
9914 /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
9915 ///
9916 /// # Example
9917 /// ```ignore,no_run
9918 /// # use google_cloud_documentai_v1::model::OcrConfig;
9919 /// let x = OcrConfig::new().set_enable_image_quality_scores(true);
9920 /// ```
9921 pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9922 self.enable_image_quality_scores = v.into();
9923 self
9924 }
9925
9926 /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
9927 ///
9928 /// # Example
9929 /// ```ignore,no_run
9930 /// # use google_cloud_documentai_v1::model::OcrConfig;
9931 /// let x = OcrConfig::new().set_advanced_ocr_options(["a", "b", "c"]);
9932 /// ```
9933 pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
9934 where
9935 T: std::iter::IntoIterator<Item = V>,
9936 V: std::convert::Into<std::string::String>,
9937 {
9938 use std::iter::Iterator;
9939 self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
9940 self
9941 }
9942
9943 /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
9944 ///
9945 /// # Example
9946 /// ```ignore,no_run
9947 /// # use google_cloud_documentai_v1::model::OcrConfig;
9948 /// let x = OcrConfig::new().set_enable_symbol(true);
9949 /// ```
9950 pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9951 self.enable_symbol = v.into();
9952 self
9953 }
9954
9955 /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
9956 ///
9957 /// # Example
9958 /// ```ignore,no_run
9959 /// # use google_cloud_documentai_v1::model::OcrConfig;
9960 /// let x = OcrConfig::new().set_compute_style_info(true);
9961 /// ```
9962 #[deprecated]
9963 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9964 self.compute_style_info = v.into();
9965 self
9966 }
9967
9968 /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
9969 ///
9970 /// # Example
9971 /// ```ignore,no_run
9972 /// # use google_cloud_documentai_v1::model::OcrConfig;
9973 /// let x = OcrConfig::new().set_disable_character_boxes_detection(true);
9974 /// ```
9975 pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
9976 mut self,
9977 v: T,
9978 ) -> Self {
9979 self.disable_character_boxes_detection = v.into();
9980 self
9981 }
9982
9983 /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
9984 ///
9985 /// # Example
9986 /// ```ignore,no_run
9987 /// # use google_cloud_documentai_v1::model::OcrConfig;
9988 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9989 /// let x = OcrConfig::new().set_premium_features(PremiumFeatures::default()/* use setters */);
9990 /// ```
9991 pub fn set_premium_features<T>(mut self, v: T) -> Self
9992 where
9993 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
9994 {
9995 self.premium_features = std::option::Option::Some(v.into());
9996 self
9997 }
9998
9999 /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
10000 ///
10001 /// # Example
10002 /// ```ignore,no_run
10003 /// # use google_cloud_documentai_v1::model::OcrConfig;
10004 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10005 /// let x = OcrConfig::new().set_or_clear_premium_features(Some(PremiumFeatures::default()/* use setters */));
10006 /// let x = OcrConfig::new().set_or_clear_premium_features(None::<PremiumFeatures>);
10007 /// ```
10008 pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
10009 where
10010 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
10011 {
10012 self.premium_features = v.map(|x| x.into());
10013 self
10014 }
10015}
10016
10017impl wkt::message::Message for OcrConfig {
10018 fn typename() -> &'static str {
10019 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
10020 }
10021}
10022
10023/// Defines additional types related to [OcrConfig].
10024pub mod ocr_config {
10025 #[allow(unused_imports)]
10026 use super::*;
10027
10028 /// Hints for OCR Engine
10029 #[derive(Clone, Default, PartialEq)]
10030 #[non_exhaustive]
10031 pub struct Hints {
10032 /// List of BCP-47 language codes to use for OCR. In most cases, not
10033 /// specifying it yields the best results since it enables automatic language
10034 /// detection. For languages based on the Latin alphabet, setting hints is
10035 /// not needed. In rare cases, when the language of the text in the
10036 /// image is known, setting a hint will help get better results (although it
10037 /// will be a significant hindrance if the hint is wrong).
10038 pub language_hints: std::vec::Vec<std::string::String>,
10039
10040 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10041 }
10042
10043 impl Hints {
10044 /// Creates a new default instance.
10045 pub fn new() -> Self {
10046 std::default::Default::default()
10047 }
10048
10049 /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
10050 ///
10051 /// # Example
10052 /// ```ignore,no_run
10053 /// # use google_cloud_documentai_v1::model::ocr_config::Hints;
10054 /// let x = Hints::new().set_language_hints(["a", "b", "c"]);
10055 /// ```
10056 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
10057 where
10058 T: std::iter::IntoIterator<Item = V>,
10059 V: std::convert::Into<std::string::String>,
10060 {
10061 use std::iter::Iterator;
10062 self.language_hints = v.into_iter().map(|i| i.into()).collect();
10063 self
10064 }
10065 }
10066
10067 impl wkt::message::Message for Hints {
10068 fn typename() -> &'static str {
10069 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
10070 }
10071 }
10072
10073 /// Configurations for premium OCR features.
10074 #[derive(Clone, Default, PartialEq)]
10075 #[non_exhaustive]
10076 pub struct PremiumFeatures {
10077 /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
10078 /// (and later) processors.
10079 pub enable_selection_mark_detection: bool,
10080
10081 /// Turn on font identification model and return font style information.
10082 pub compute_style_info: bool,
10083
10084 /// Turn on the model that can extract LaTeX math formulas.
10085 pub enable_math_ocr: bool,
10086
10087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10088 }
10089
10090 impl PremiumFeatures {
10091 /// Creates a new default instance.
10092 pub fn new() -> Self {
10093 std::default::Default::default()
10094 }
10095
10096 /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
10097 ///
10098 /// # Example
10099 /// ```ignore,no_run
10100 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10101 /// let x = PremiumFeatures::new().set_enable_selection_mark_detection(true);
10102 /// ```
10103 pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
10104 mut self,
10105 v: T,
10106 ) -> Self {
10107 self.enable_selection_mark_detection = v.into();
10108 self
10109 }
10110
10111 /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
10112 ///
10113 /// # Example
10114 /// ```ignore,no_run
10115 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10116 /// let x = PremiumFeatures::new().set_compute_style_info(true);
10117 /// ```
10118 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10119 self.compute_style_info = v.into();
10120 self
10121 }
10122
10123 /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
10124 ///
10125 /// # Example
10126 /// ```ignore,no_run
10127 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10128 /// let x = PremiumFeatures::new().set_enable_math_ocr(true);
10129 /// ```
10130 pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10131 self.enable_math_ocr = v.into();
10132 self
10133 }
10134 }
10135
10136 impl wkt::message::Message for PremiumFeatures {
10137 fn typename() -> &'static str {
10138 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
10139 }
10140 }
10141}
10142
10143/// Options for Process API
10144#[derive(Clone, Default, PartialEq)]
10145#[non_exhaustive]
10146pub struct ProcessOptions {
10147 /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
10148 /// Returns error if set on other processor types.
10149 pub ocr_config: std::option::Option<crate::model::OcrConfig>,
10150
10151 /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
10152 /// Returns error if set on other processor types.
10153 pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
10154
10155 /// Optional. Override the schema of the
10156 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
10157 /// return an Invalid Argument error if this field is set when the underlying
10158 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
10159 /// support schema override.
10160 ///
10161 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10162 pub schema_override: std::option::Option<crate::model::DocumentSchema>,
10163
10164 /// A subset of pages to process. If not specified, all pages are processed.
10165 /// If a page range is set, only the given pages are extracted and processed
10166 /// from the document. In the output document,
10167 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10168 /// refers to the page number in the original document.
10169 /// This configuration only applies to online processing with
10170 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10171 ///
10172 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10173 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10174 pub page_range: std::option::Option<crate::model::process_options::PageRange>,
10175
10176 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10177}
10178
10179impl ProcessOptions {
10180 /// Creates a new default instance.
10181 pub fn new() -> Self {
10182 std::default::Default::default()
10183 }
10184
10185 /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10186 ///
10187 /// # Example
10188 /// ```ignore,no_run
10189 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10190 /// use google_cloud_documentai_v1::model::OcrConfig;
10191 /// let x = ProcessOptions::new().set_ocr_config(OcrConfig::default()/* use setters */);
10192 /// ```
10193 pub fn set_ocr_config<T>(mut self, v: T) -> Self
10194 where
10195 T: std::convert::Into<crate::model::OcrConfig>,
10196 {
10197 self.ocr_config = std::option::Option::Some(v.into());
10198 self
10199 }
10200
10201 /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10202 ///
10203 /// # Example
10204 /// ```ignore,no_run
10205 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10206 /// use google_cloud_documentai_v1::model::OcrConfig;
10207 /// let x = ProcessOptions::new().set_or_clear_ocr_config(Some(OcrConfig::default()/* use setters */));
10208 /// let x = ProcessOptions::new().set_or_clear_ocr_config(None::<OcrConfig>);
10209 /// ```
10210 pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
10211 where
10212 T: std::convert::Into<crate::model::OcrConfig>,
10213 {
10214 self.ocr_config = v.map(|x| x.into());
10215 self
10216 }
10217
10218 /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
10219 ///
10220 /// # Example
10221 /// ```ignore,no_run
10222 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10223 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10224 /// let x = ProcessOptions::new().set_layout_config(LayoutConfig::default()/* use setters */);
10225 /// ```
10226 pub fn set_layout_config<T>(mut self, v: T) -> Self
10227 where
10228 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10229 {
10230 self.layout_config = std::option::Option::Some(v.into());
10231 self
10232 }
10233
10234 /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
10235 ///
10236 /// # Example
10237 /// ```ignore,no_run
10238 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10239 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10240 /// let x = ProcessOptions::new().set_or_clear_layout_config(Some(LayoutConfig::default()/* use setters */));
10241 /// let x = ProcessOptions::new().set_or_clear_layout_config(None::<LayoutConfig>);
10242 /// ```
10243 pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
10244 where
10245 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10246 {
10247 self.layout_config = v.map(|x| x.into());
10248 self
10249 }
10250
10251 /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
10252 ///
10253 /// # Example
10254 /// ```ignore,no_run
10255 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10256 /// use google_cloud_documentai_v1::model::DocumentSchema;
10257 /// let x = ProcessOptions::new().set_schema_override(DocumentSchema::default()/* use setters */);
10258 /// ```
10259 pub fn set_schema_override<T>(mut self, v: T) -> Self
10260 where
10261 T: std::convert::Into<crate::model::DocumentSchema>,
10262 {
10263 self.schema_override = std::option::Option::Some(v.into());
10264 self
10265 }
10266
10267 /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
10268 ///
10269 /// # Example
10270 /// ```ignore,no_run
10271 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10272 /// use google_cloud_documentai_v1::model::DocumentSchema;
10273 /// let x = ProcessOptions::new().set_or_clear_schema_override(Some(DocumentSchema::default()/* use setters */));
10274 /// let x = ProcessOptions::new().set_or_clear_schema_override(None::<DocumentSchema>);
10275 /// ```
10276 pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
10277 where
10278 T: std::convert::Into<crate::model::DocumentSchema>,
10279 {
10280 self.schema_override = v.map(|x| x.into());
10281 self
10282 }
10283
10284 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
10285 ///
10286 /// Note that all the setters affecting `page_range` are mutually
10287 /// exclusive.
10288 ///
10289 /// # Example
10290 /// ```ignore,no_run
10291 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10292 /// use google_cloud_documentai_v1::model::process_options::PageRange;
10293 /// let x = ProcessOptions::new().set_page_range(Some(PageRange::FromStart(42)));
10294 /// ```
10295 pub fn set_page_range<
10296 T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
10297 >(
10298 mut self,
10299 v: T,
10300 ) -> Self {
10301 self.page_range = v.into();
10302 self
10303 }
10304
10305 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10306 /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
10307 /// holds a different branch.
10308 pub fn individual_page_selector(
10309 &self,
10310 ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
10311 {
10312 #[allow(unreachable_patterns)]
10313 self.page_range.as_ref().and_then(|v| match v {
10314 crate::model::process_options::PageRange::IndividualPageSelector(v) => {
10315 std::option::Option::Some(v)
10316 }
10317 _ => std::option::Option::None,
10318 })
10319 }
10320
10321 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10322 /// to hold a `IndividualPageSelector`.
10323 ///
10324 /// Note that all the setters affecting `page_range` are
10325 /// mutually exclusive.
10326 ///
10327 /// # Example
10328 /// ```ignore,no_run
10329 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10330 /// use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10331 /// let x = ProcessOptions::new().set_individual_page_selector(IndividualPageSelector::default()/* use setters */);
10332 /// assert!(x.individual_page_selector().is_some());
10333 /// assert!(x.from_start().is_none());
10334 /// assert!(x.from_end().is_none());
10335 /// ```
10336 pub fn set_individual_page_selector<
10337 T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
10338 >(
10339 mut self,
10340 v: T,
10341 ) -> Self {
10342 self.page_range = std::option::Option::Some(
10343 crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
10344 );
10345 self
10346 }
10347
10348 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10349 /// if it holds a `FromStart`, `None` if the field is not set or
10350 /// holds a different branch.
10351 pub fn from_start(&self) -> std::option::Option<&i32> {
10352 #[allow(unreachable_patterns)]
10353 self.page_range.as_ref().and_then(|v| match v {
10354 crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
10355 _ => std::option::Option::None,
10356 })
10357 }
10358
10359 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10360 /// to hold a `FromStart`.
10361 ///
10362 /// Note that all the setters affecting `page_range` are
10363 /// mutually exclusive.
10364 ///
10365 /// # Example
10366 /// ```ignore,no_run
10367 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10368 /// let x = ProcessOptions::new().set_from_start(42);
10369 /// assert!(x.from_start().is_some());
10370 /// assert!(x.individual_page_selector().is_none());
10371 /// assert!(x.from_end().is_none());
10372 /// ```
10373 pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10374 self.page_range = std::option::Option::Some(
10375 crate::model::process_options::PageRange::FromStart(v.into()),
10376 );
10377 self
10378 }
10379
10380 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10381 /// if it holds a `FromEnd`, `None` if the field is not set or
10382 /// holds a different branch.
10383 pub fn from_end(&self) -> std::option::Option<&i32> {
10384 #[allow(unreachable_patterns)]
10385 self.page_range.as_ref().and_then(|v| match v {
10386 crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
10387 _ => std::option::Option::None,
10388 })
10389 }
10390
10391 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10392 /// to hold a `FromEnd`.
10393 ///
10394 /// Note that all the setters affecting `page_range` are
10395 /// mutually exclusive.
10396 ///
10397 /// # Example
10398 /// ```ignore,no_run
10399 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10400 /// let x = ProcessOptions::new().set_from_end(42);
10401 /// assert!(x.from_end().is_some());
10402 /// assert!(x.individual_page_selector().is_none());
10403 /// assert!(x.from_start().is_none());
10404 /// ```
10405 pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10406 self.page_range =
10407 std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
10408 self
10409 }
10410}
10411
10412impl wkt::message::Message for ProcessOptions {
10413 fn typename() -> &'static str {
10414 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
10415 }
10416}
10417
10418/// Defines additional types related to [ProcessOptions].
10419pub mod process_options {
10420 #[allow(unused_imports)]
10421 use super::*;
10422
10423 /// Serving config for layout parser processor.
10424 #[derive(Clone, Default, PartialEq)]
10425 #[non_exhaustive]
10426 pub struct LayoutConfig {
10427 /// Optional. Config for chunking in layout parser processor.
10428 pub chunking_config:
10429 std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
10430
10431 /// Optional. Whether to include images in layout parser processor response.
10432 pub return_images: bool,
10433
10434 /// Optional. Whether to include bounding boxes in layout parser processor
10435 /// response.
10436 pub return_bounding_boxes: bool,
10437
10438 /// Optional. Whether to include image annotations in layout parser response.
10439 pub enable_image_annotation: bool,
10440
10441 /// Optional. Whether to include table annotations in layout parser response.
10442 pub enable_table_annotation: bool,
10443
10444 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10445 }
10446
10447 impl LayoutConfig {
10448 /// Creates a new default instance.
10449 pub fn new() -> Self {
10450 std::default::Default::default()
10451 }
10452
10453 /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10454 ///
10455 /// # Example
10456 /// ```ignore,no_run
10457 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10458 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10459 /// let x = LayoutConfig::new().set_chunking_config(ChunkingConfig::default()/* use setters */);
10460 /// ```
10461 pub fn set_chunking_config<T>(mut self, v: T) -> Self
10462 where
10463 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10464 {
10465 self.chunking_config = std::option::Option::Some(v.into());
10466 self
10467 }
10468
10469 /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10470 ///
10471 /// # Example
10472 /// ```ignore,no_run
10473 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10474 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10475 /// let x = LayoutConfig::new().set_or_clear_chunking_config(Some(ChunkingConfig::default()/* use setters */));
10476 /// let x = LayoutConfig::new().set_or_clear_chunking_config(None::<ChunkingConfig>);
10477 /// ```
10478 pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
10479 where
10480 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10481 {
10482 self.chunking_config = v.map(|x| x.into());
10483 self
10484 }
10485
10486 /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
10487 ///
10488 /// # Example
10489 /// ```ignore,no_run
10490 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10491 /// let x = LayoutConfig::new().set_return_images(true);
10492 /// ```
10493 pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10494 self.return_images = v.into();
10495 self
10496 }
10497
10498 /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
10499 ///
10500 /// # Example
10501 /// ```ignore,no_run
10502 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10503 /// let x = LayoutConfig::new().set_return_bounding_boxes(true);
10504 /// ```
10505 pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10506 self.return_bounding_boxes = v.into();
10507 self
10508 }
10509
10510 /// Sets the value of [enable_image_annotation][crate::model::process_options::LayoutConfig::enable_image_annotation].
10511 ///
10512 /// # Example
10513 /// ```ignore,no_run
10514 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10515 /// let x = LayoutConfig::new().set_enable_image_annotation(true);
10516 /// ```
10517 pub fn set_enable_image_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10518 self.enable_image_annotation = v.into();
10519 self
10520 }
10521
10522 /// Sets the value of [enable_table_annotation][crate::model::process_options::LayoutConfig::enable_table_annotation].
10523 ///
10524 /// # Example
10525 /// ```ignore,no_run
10526 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10527 /// let x = LayoutConfig::new().set_enable_table_annotation(true);
10528 /// ```
10529 pub fn set_enable_table_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10530 self.enable_table_annotation = v.into();
10531 self
10532 }
10533 }
10534
10535 impl wkt::message::Message for LayoutConfig {
10536 fn typename() -> &'static str {
10537 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
10538 }
10539 }
10540
10541 /// Defines additional types related to [LayoutConfig].
10542 pub mod layout_config {
10543 #[allow(unused_imports)]
10544 use super::*;
10545
10546 /// Serving config for chunking.
10547 #[derive(Clone, Default, PartialEq)]
10548 #[non_exhaustive]
10549 pub struct ChunkingConfig {
10550 /// Optional. The chunk sizes to use when splitting documents, in order of
10551 /// level.
10552 pub chunk_size: i32,
10553
10554 /// Optional. Whether or not to include ancestor headings when splitting.
10555 pub include_ancestor_headings: bool,
10556
10557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10558 }
10559
10560 impl ChunkingConfig {
10561 /// Creates a new default instance.
10562 pub fn new() -> Self {
10563 std::default::Default::default()
10564 }
10565
10566 /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
10567 ///
10568 /// # Example
10569 /// ```ignore,no_run
10570 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10571 /// let x = ChunkingConfig::new().set_chunk_size(42);
10572 /// ```
10573 pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10574 self.chunk_size = v.into();
10575 self
10576 }
10577
10578 /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
10579 ///
10580 /// # Example
10581 /// ```ignore,no_run
10582 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10583 /// let x = ChunkingConfig::new().set_include_ancestor_headings(true);
10584 /// ```
10585 pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
10586 mut self,
10587 v: T,
10588 ) -> Self {
10589 self.include_ancestor_headings = v.into();
10590 self
10591 }
10592 }
10593
10594 impl wkt::message::Message for ChunkingConfig {
10595 fn typename() -> &'static str {
10596 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
10597 }
10598 }
10599 }
10600
10601 /// A list of individual page numbers.
10602 #[derive(Clone, Default, PartialEq)]
10603 #[non_exhaustive]
10604 pub struct IndividualPageSelector {
10605 /// Optional. Indices of the pages (starting from 1).
10606 pub pages: std::vec::Vec<i32>,
10607
10608 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10609 }
10610
10611 impl IndividualPageSelector {
10612 /// Creates a new default instance.
10613 pub fn new() -> Self {
10614 std::default::Default::default()
10615 }
10616
10617 /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
10618 ///
10619 /// # Example
10620 /// ```ignore,no_run
10621 /// # use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10622 /// let x = IndividualPageSelector::new().set_pages([1, 2, 3]);
10623 /// ```
10624 pub fn set_pages<T, V>(mut self, v: T) -> Self
10625 where
10626 T: std::iter::IntoIterator<Item = V>,
10627 V: std::convert::Into<i32>,
10628 {
10629 use std::iter::Iterator;
10630 self.pages = v.into_iter().map(|i| i.into()).collect();
10631 self
10632 }
10633 }
10634
10635 impl wkt::message::Message for IndividualPageSelector {
10636 fn typename() -> &'static str {
10637 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
10638 }
10639 }
10640
10641 /// A subset of pages to process. If not specified, all pages are processed.
10642 /// If a page range is set, only the given pages are extracted and processed
10643 /// from the document. In the output document,
10644 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10645 /// refers to the page number in the original document.
10646 /// This configuration only applies to online processing with
10647 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10648 ///
10649 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10650 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10651 #[derive(Clone, Debug, PartialEq)]
10652 #[non_exhaustive]
10653 pub enum PageRange {
10654 /// Which pages to process (1-indexed).
10655 IndividualPageSelector(
10656 std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
10657 ),
10658 /// Only process certain pages from the start. Process all if the document
10659 /// has fewer pages.
10660 FromStart(i32),
10661 /// Only process certain pages from the end, same as above.
10662 FromEnd(i32),
10663 }
10664}
10665
10666/// Request message for the
10667/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
10668/// method.
10669///
10670/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10671#[derive(Clone, Default, PartialEq)]
10672#[non_exhaustive]
10673pub struct ProcessRequest {
10674 /// Required. The resource name of the
10675 /// [Processor][google.cloud.documentai.v1.Processor] or
10676 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
10677 /// to use for processing. If a
10678 /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
10679 /// will use its [default
10680 /// version][google.cloud.documentai.v1.Processor.default_processor_version].
10681 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
10682 /// or
10683 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
10684 ///
10685 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
10686 /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
10687 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10688 pub name: std::string::String,
10689
10690 /// Whether human review should be skipped for this request. Default to
10691 /// `false`.
10692 pub skip_human_review: bool,
10693
10694 /// Specifies which fields to include in the
10695 /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
10696 /// output. Only supports top-level document and pages field, so it must be in
10697 /// the form of `{document_field_name}` or `pages.{page_field_name}`.
10698 ///
10699 /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
10700 pub field_mask: std::option::Option<wkt::FieldMask>,
10701
10702 /// Inference-time options for the process API
10703 pub process_options: std::option::Option<crate::model::ProcessOptions>,
10704
10705 /// Optional. The labels with user-defined metadata for the request.
10706 ///
10707 /// Label keys and values can be no longer than 63 characters
10708 /// (Unicode codepoints) and can only contain lowercase letters, numeric
10709 /// characters, underscores, and dashes. International characters are allowed.
10710 /// Label values are optional. Label keys must start with a letter.
10711 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10712
10713 /// Optional. Option to remove images from the document.
10714 pub imageless_mode: bool,
10715
10716 /// The document payload.
10717 pub source: std::option::Option<crate::model::process_request::Source>,
10718
10719 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10720}
10721
10722impl ProcessRequest {
10723 /// Creates a new default instance.
10724 pub fn new() -> Self {
10725 std::default::Default::default()
10726 }
10727
10728 /// Sets the value of [name][crate::model::ProcessRequest::name].
10729 ///
10730 /// # Example
10731 /// ```ignore,no_run
10732 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10733 /// let x = ProcessRequest::new().set_name("example");
10734 /// ```
10735 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10736 self.name = v.into();
10737 self
10738 }
10739
10740 /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
10741 ///
10742 /// # Example
10743 /// ```ignore,no_run
10744 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10745 /// let x = ProcessRequest::new().set_skip_human_review(true);
10746 /// ```
10747 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10748 self.skip_human_review = v.into();
10749 self
10750 }
10751
10752 /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
10753 ///
10754 /// # Example
10755 /// ```ignore,no_run
10756 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10757 /// use wkt::FieldMask;
10758 /// let x = ProcessRequest::new().set_field_mask(FieldMask::default()/* use setters */);
10759 /// ```
10760 pub fn set_field_mask<T>(mut self, v: T) -> Self
10761 where
10762 T: std::convert::Into<wkt::FieldMask>,
10763 {
10764 self.field_mask = std::option::Option::Some(v.into());
10765 self
10766 }
10767
10768 /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
10769 ///
10770 /// # Example
10771 /// ```ignore,no_run
10772 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10773 /// use wkt::FieldMask;
10774 /// let x = ProcessRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
10775 /// let x = ProcessRequest::new().set_or_clear_field_mask(None::<FieldMask>);
10776 /// ```
10777 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
10778 where
10779 T: std::convert::Into<wkt::FieldMask>,
10780 {
10781 self.field_mask = v.map(|x| x.into());
10782 self
10783 }
10784
10785 /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
10786 ///
10787 /// # Example
10788 /// ```ignore,no_run
10789 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10790 /// use google_cloud_documentai_v1::model::ProcessOptions;
10791 /// let x = ProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
10792 /// ```
10793 pub fn set_process_options<T>(mut self, v: T) -> Self
10794 where
10795 T: std::convert::Into<crate::model::ProcessOptions>,
10796 {
10797 self.process_options = std::option::Option::Some(v.into());
10798 self
10799 }
10800
10801 /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
10802 ///
10803 /// # Example
10804 /// ```ignore,no_run
10805 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10806 /// use google_cloud_documentai_v1::model::ProcessOptions;
10807 /// let x = ProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
10808 /// let x = ProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
10809 /// ```
10810 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
10811 where
10812 T: std::convert::Into<crate::model::ProcessOptions>,
10813 {
10814 self.process_options = v.map(|x| x.into());
10815 self
10816 }
10817
10818 /// Sets the value of [labels][crate::model::ProcessRequest::labels].
10819 ///
10820 /// # Example
10821 /// ```ignore,no_run
10822 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10823 /// let x = ProcessRequest::new().set_labels([
10824 /// ("key0", "abc"),
10825 /// ("key1", "xyz"),
10826 /// ]);
10827 /// ```
10828 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10829 where
10830 T: std::iter::IntoIterator<Item = (K, V)>,
10831 K: std::convert::Into<std::string::String>,
10832 V: std::convert::Into<std::string::String>,
10833 {
10834 use std::iter::Iterator;
10835 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10836 self
10837 }
10838
10839 /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
10840 ///
10841 /// # Example
10842 /// ```ignore,no_run
10843 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10844 /// let x = ProcessRequest::new().set_imageless_mode(true);
10845 /// ```
10846 pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10847 self.imageless_mode = v.into();
10848 self
10849 }
10850
10851 /// Sets the value of [source][crate::model::ProcessRequest::source].
10852 ///
10853 /// Note that all the setters affecting `source` are mutually
10854 /// exclusive.
10855 ///
10856 /// # Example
10857 /// ```ignore,no_run
10858 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10859 /// use google_cloud_documentai_v1::model::Document;
10860 /// let x = ProcessRequest::new().set_source(Some(
10861 /// google_cloud_documentai_v1::model::process_request::Source::InlineDocument(Document::default().into())));
10862 /// ```
10863 pub fn set_source<
10864 T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
10865 >(
10866 mut self,
10867 v: T,
10868 ) -> Self {
10869 self.source = v.into();
10870 self
10871 }
10872
10873 /// The value of [source][crate::model::ProcessRequest::source]
10874 /// if it holds a `InlineDocument`, `None` if the field is not set or
10875 /// holds a different branch.
10876 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
10877 #[allow(unreachable_patterns)]
10878 self.source.as_ref().and_then(|v| match v {
10879 crate::model::process_request::Source::InlineDocument(v) => {
10880 std::option::Option::Some(v)
10881 }
10882 _ => std::option::Option::None,
10883 })
10884 }
10885
10886 /// Sets the value of [source][crate::model::ProcessRequest::source]
10887 /// to hold a `InlineDocument`.
10888 ///
10889 /// Note that all the setters affecting `source` are
10890 /// mutually exclusive.
10891 ///
10892 /// # Example
10893 /// ```ignore,no_run
10894 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10895 /// use google_cloud_documentai_v1::model::Document;
10896 /// let x = ProcessRequest::new().set_inline_document(Document::default()/* use setters */);
10897 /// assert!(x.inline_document().is_some());
10898 /// assert!(x.raw_document().is_none());
10899 /// assert!(x.gcs_document().is_none());
10900 /// ```
10901 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
10902 mut self,
10903 v: T,
10904 ) -> Self {
10905 self.source = std::option::Option::Some(
10906 crate::model::process_request::Source::InlineDocument(v.into()),
10907 );
10908 self
10909 }
10910
10911 /// The value of [source][crate::model::ProcessRequest::source]
10912 /// if it holds a `RawDocument`, `None` if the field is not set or
10913 /// holds a different branch.
10914 pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
10915 #[allow(unreachable_patterns)]
10916 self.source.as_ref().and_then(|v| match v {
10917 crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
10918 _ => std::option::Option::None,
10919 })
10920 }
10921
10922 /// Sets the value of [source][crate::model::ProcessRequest::source]
10923 /// to hold a `RawDocument`.
10924 ///
10925 /// Note that all the setters affecting `source` are
10926 /// mutually exclusive.
10927 ///
10928 /// # Example
10929 /// ```ignore,no_run
10930 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10931 /// use google_cloud_documentai_v1::model::RawDocument;
10932 /// let x = ProcessRequest::new().set_raw_document(RawDocument::default()/* use setters */);
10933 /// assert!(x.raw_document().is_some());
10934 /// assert!(x.inline_document().is_none());
10935 /// assert!(x.gcs_document().is_none());
10936 /// ```
10937 pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
10938 mut self,
10939 v: T,
10940 ) -> Self {
10941 self.source =
10942 std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
10943 self
10944 }
10945
10946 /// The value of [source][crate::model::ProcessRequest::source]
10947 /// if it holds a `GcsDocument`, `None` if the field is not set or
10948 /// holds a different branch.
10949 pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
10950 #[allow(unreachable_patterns)]
10951 self.source.as_ref().and_then(|v| match v {
10952 crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
10953 _ => std::option::Option::None,
10954 })
10955 }
10956
10957 /// Sets the value of [source][crate::model::ProcessRequest::source]
10958 /// to hold a `GcsDocument`.
10959 ///
10960 /// Note that all the setters affecting `source` are
10961 /// mutually exclusive.
10962 ///
10963 /// # Example
10964 /// ```ignore,no_run
10965 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10966 /// use google_cloud_documentai_v1::model::GcsDocument;
10967 /// let x = ProcessRequest::new().set_gcs_document(GcsDocument::default()/* use setters */);
10968 /// assert!(x.gcs_document().is_some());
10969 /// assert!(x.inline_document().is_none());
10970 /// assert!(x.raw_document().is_none());
10971 /// ```
10972 pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
10973 mut self,
10974 v: T,
10975 ) -> Self {
10976 self.source =
10977 std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
10978 self
10979 }
10980}
10981
10982impl wkt::message::Message for ProcessRequest {
10983 fn typename() -> &'static str {
10984 "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
10985 }
10986}
10987
10988/// Defines additional types related to [ProcessRequest].
10989pub mod process_request {
10990 #[allow(unused_imports)]
10991 use super::*;
10992
10993 /// The document payload.
10994 #[derive(Clone, Debug, PartialEq)]
10995 #[non_exhaustive]
10996 pub enum Source {
10997 /// An inline document proto.
10998 InlineDocument(std::boxed::Box<crate::model::Document>),
10999 /// A raw document content (bytes).
11000 RawDocument(std::boxed::Box<crate::model::RawDocument>),
11001 /// A raw document on Google Cloud Storage.
11002 GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
11003 }
11004}
11005
11006/// The status of human review on a processed document.
11007#[derive(Clone, Default, PartialEq)]
11008#[non_exhaustive]
11009pub struct HumanReviewStatus {
11010 /// The state of human review on the processing request.
11011 pub state: crate::model::human_review_status::State,
11012
11013 /// A message providing more details about the human review state.
11014 pub state_message: std::string::String,
11015
11016 /// The name of the operation triggered by the processed document. This field
11017 /// is populated only when the
11018 /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
11019 /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
11020 /// the long-running operation returned by
11021 /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
11022 ///
11023 /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
11024 /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
11025 pub human_review_operation: std::string::String,
11026
11027 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11028}
11029
11030impl HumanReviewStatus {
11031 /// Creates a new default instance.
11032 pub fn new() -> Self {
11033 std::default::Default::default()
11034 }
11035
11036 /// Sets the value of [state][crate::model::HumanReviewStatus::state].
11037 ///
11038 /// # Example
11039 /// ```ignore,no_run
11040 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11041 /// use google_cloud_documentai_v1::model::human_review_status::State;
11042 /// let x0 = HumanReviewStatus::new().set_state(State::Skipped);
11043 /// let x1 = HumanReviewStatus::new().set_state(State::ValidationPassed);
11044 /// let x2 = HumanReviewStatus::new().set_state(State::InProgress);
11045 /// ```
11046 pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
11047 mut self,
11048 v: T,
11049 ) -> Self {
11050 self.state = v.into();
11051 self
11052 }
11053
11054 /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
11055 ///
11056 /// # Example
11057 /// ```ignore,no_run
11058 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11059 /// let x = HumanReviewStatus::new().set_state_message("example");
11060 /// ```
11061 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11062 self.state_message = v.into();
11063 self
11064 }
11065
11066 /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
11067 ///
11068 /// # Example
11069 /// ```ignore,no_run
11070 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11071 /// let x = HumanReviewStatus::new().set_human_review_operation("example");
11072 /// ```
11073 pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
11074 mut self,
11075 v: T,
11076 ) -> Self {
11077 self.human_review_operation = v.into();
11078 self
11079 }
11080}
11081
11082impl wkt::message::Message for HumanReviewStatus {
11083 fn typename() -> &'static str {
11084 "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
11085 }
11086}
11087
11088/// Defines additional types related to [HumanReviewStatus].
11089pub mod human_review_status {
11090 #[allow(unused_imports)]
11091 use super::*;
11092
11093 /// The final state of human review on a processed document.
11094 ///
11095 /// # Working with unknown values
11096 ///
11097 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11098 /// additional enum variants at any time. Adding new variants is not considered
11099 /// a breaking change. Applications should write their code in anticipation of:
11100 ///
11101 /// - New values appearing in future releases of the client library, **and**
11102 /// - New values received dynamically, without application changes.
11103 ///
11104 /// Please consult the [Working with enums] section in the user guide for some
11105 /// guidelines.
11106 ///
11107 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11108 #[derive(Clone, Debug, PartialEq)]
11109 #[non_exhaustive]
11110 pub enum State {
11111 /// Human review state is unspecified. Most likely due to an internal error.
11112 Unspecified,
11113 /// Human review is skipped for the document. This can happen because human
11114 /// review isn't enabled on the processor or the processing request has
11115 /// been set to skip this document.
11116 Skipped,
11117 /// Human review validation is triggered and passed, so no review is needed.
11118 ValidationPassed,
11119 /// Human review validation is triggered and the document is under review.
11120 InProgress,
11121 /// Some error happened during triggering human review, see the
11122 /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
11123 /// for details.
11124 ///
11125 /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
11126 Error,
11127 /// If set, the enum was initialized with an unknown value.
11128 ///
11129 /// Applications can examine the value using [State::value] or
11130 /// [State::name].
11131 UnknownValue(state::UnknownValue),
11132 }
11133
11134 #[doc(hidden)]
11135 pub mod state {
11136 #[allow(unused_imports)]
11137 use super::*;
11138 #[derive(Clone, Debug, PartialEq)]
11139 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11140 }
11141
11142 impl State {
11143 /// Gets the enum value.
11144 ///
11145 /// Returns `None` if the enum contains an unknown value deserialized from
11146 /// the string representation of enums.
11147 pub fn value(&self) -> std::option::Option<i32> {
11148 match self {
11149 Self::Unspecified => std::option::Option::Some(0),
11150 Self::Skipped => std::option::Option::Some(1),
11151 Self::ValidationPassed => std::option::Option::Some(2),
11152 Self::InProgress => std::option::Option::Some(3),
11153 Self::Error => std::option::Option::Some(4),
11154 Self::UnknownValue(u) => u.0.value(),
11155 }
11156 }
11157
11158 /// Gets the enum value as a string.
11159 ///
11160 /// Returns `None` if the enum contains an unknown value deserialized from
11161 /// the integer representation of enums.
11162 pub fn name(&self) -> std::option::Option<&str> {
11163 match self {
11164 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11165 Self::Skipped => std::option::Option::Some("SKIPPED"),
11166 Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
11167 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
11168 Self::Error => std::option::Option::Some("ERROR"),
11169 Self::UnknownValue(u) => u.0.name(),
11170 }
11171 }
11172 }
11173
11174 impl std::default::Default for State {
11175 fn default() -> Self {
11176 use std::convert::From;
11177 Self::from(0)
11178 }
11179 }
11180
11181 impl std::fmt::Display for State {
11182 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11183 wkt::internal::display_enum(f, self.name(), self.value())
11184 }
11185 }
11186
11187 impl std::convert::From<i32> for State {
11188 fn from(value: i32) -> Self {
11189 match value {
11190 0 => Self::Unspecified,
11191 1 => Self::Skipped,
11192 2 => Self::ValidationPassed,
11193 3 => Self::InProgress,
11194 4 => Self::Error,
11195 _ => Self::UnknownValue(state::UnknownValue(
11196 wkt::internal::UnknownEnumValue::Integer(value),
11197 )),
11198 }
11199 }
11200 }
11201
11202 impl std::convert::From<&str> for State {
11203 fn from(value: &str) -> Self {
11204 use std::string::ToString;
11205 match value {
11206 "STATE_UNSPECIFIED" => Self::Unspecified,
11207 "SKIPPED" => Self::Skipped,
11208 "VALIDATION_PASSED" => Self::ValidationPassed,
11209 "IN_PROGRESS" => Self::InProgress,
11210 "ERROR" => Self::Error,
11211 _ => Self::UnknownValue(state::UnknownValue(
11212 wkt::internal::UnknownEnumValue::String(value.to_string()),
11213 )),
11214 }
11215 }
11216 }
11217
11218 impl serde::ser::Serialize for State {
11219 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11220 where
11221 S: serde::Serializer,
11222 {
11223 match self {
11224 Self::Unspecified => serializer.serialize_i32(0),
11225 Self::Skipped => serializer.serialize_i32(1),
11226 Self::ValidationPassed => serializer.serialize_i32(2),
11227 Self::InProgress => serializer.serialize_i32(3),
11228 Self::Error => serializer.serialize_i32(4),
11229 Self::UnknownValue(u) => u.0.serialize(serializer),
11230 }
11231 }
11232 }
11233
11234 impl<'de> serde::de::Deserialize<'de> for State {
11235 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11236 where
11237 D: serde::Deserializer<'de>,
11238 {
11239 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11240 ".google.cloud.documentai.v1.HumanReviewStatus.State",
11241 ))
11242 }
11243 }
11244}
11245
11246/// Response message for the
11247/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
11248/// method.
11249///
11250/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
11251#[derive(Clone, Default, PartialEq)]
11252#[non_exhaustive]
11253pub struct ProcessResponse {
11254 /// The document payload, will populate fields based on the processor's
11255 /// behavior.
11256 pub document: std::option::Option<crate::model::Document>,
11257
11258 /// The status of human review on the processed document.
11259 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11260
11261 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11262}
11263
11264impl ProcessResponse {
11265 /// Creates a new default instance.
11266 pub fn new() -> Self {
11267 std::default::Default::default()
11268 }
11269
11270 /// Sets the value of [document][crate::model::ProcessResponse::document].
11271 ///
11272 /// # Example
11273 /// ```ignore,no_run
11274 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11275 /// use google_cloud_documentai_v1::model::Document;
11276 /// let x = ProcessResponse::new().set_document(Document::default()/* use setters */);
11277 /// ```
11278 pub fn set_document<T>(mut self, v: T) -> Self
11279 where
11280 T: std::convert::Into<crate::model::Document>,
11281 {
11282 self.document = std::option::Option::Some(v.into());
11283 self
11284 }
11285
11286 /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
11287 ///
11288 /// # Example
11289 /// ```ignore,no_run
11290 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11291 /// use google_cloud_documentai_v1::model::Document;
11292 /// let x = ProcessResponse::new().set_or_clear_document(Some(Document::default()/* use setters */));
11293 /// let x = ProcessResponse::new().set_or_clear_document(None::<Document>);
11294 /// ```
11295 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
11296 where
11297 T: std::convert::Into<crate::model::Document>,
11298 {
11299 self.document = v.map(|x| x.into());
11300 self
11301 }
11302
11303 /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11304 ///
11305 /// # Example
11306 /// ```ignore,no_run
11307 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11308 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11309 /// let x = ProcessResponse::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11310 /// ```
11311 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11312 where
11313 T: std::convert::Into<crate::model::HumanReviewStatus>,
11314 {
11315 self.human_review_status = std::option::Option::Some(v.into());
11316 self
11317 }
11318
11319 /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11320 ///
11321 /// # Example
11322 /// ```ignore,no_run
11323 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11324 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11325 /// let x = ProcessResponse::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11326 /// let x = ProcessResponse::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11327 /// ```
11328 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11329 where
11330 T: std::convert::Into<crate::model::HumanReviewStatus>,
11331 {
11332 self.human_review_status = v.map(|x| x.into());
11333 self
11334 }
11335}
11336
11337impl wkt::message::Message for ProcessResponse {
11338 fn typename() -> &'static str {
11339 "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
11340 }
11341}
11342
11343/// Request message for
11344/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11345///
11346/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11347#[derive(Clone, Default, PartialEq)]
11348#[non_exhaustive]
11349pub struct BatchProcessRequest {
11350 /// Required. The resource name of
11351 /// [Processor][google.cloud.documentai.v1.Processor] or
11352 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
11353 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
11354 /// or
11355 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
11356 ///
11357 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
11358 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
11359 pub name: std::string::String,
11360
11361 /// The input documents for the
11362 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11363 /// method.
11364 ///
11365 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11366 pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
11367
11368 /// The output configuration for the
11369 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11370 /// method.
11371 ///
11372 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11373 pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
11374
11375 /// Whether human review should be skipped for this request. Default to
11376 /// `false`.
11377 pub skip_human_review: bool,
11378
11379 /// Inference-time options for the process API
11380 pub process_options: std::option::Option<crate::model::ProcessOptions>,
11381
11382 /// Optional. The labels with user-defined metadata for the request.
11383 ///
11384 /// Label keys and values can be no longer than 63 characters
11385 /// (Unicode codepoints) and can only contain lowercase letters, numeric
11386 /// characters, underscores, and dashes. International characters are allowed.
11387 /// Label values are optional. Label keys must start with a letter.
11388 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11389
11390 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11391}
11392
11393impl BatchProcessRequest {
11394 /// Creates a new default instance.
11395 pub fn new() -> Self {
11396 std::default::Default::default()
11397 }
11398
11399 /// Sets the value of [name][crate::model::BatchProcessRequest::name].
11400 ///
11401 /// # Example
11402 /// ```ignore,no_run
11403 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11404 /// let x = BatchProcessRequest::new().set_name("example");
11405 /// ```
11406 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11407 self.name = v.into();
11408 self
11409 }
11410
11411 /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11412 ///
11413 /// # Example
11414 /// ```ignore,no_run
11415 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11416 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11417 /// let x = BatchProcessRequest::new().set_input_documents(BatchDocumentsInputConfig::default()/* use setters */);
11418 /// ```
11419 pub fn set_input_documents<T>(mut self, v: T) -> Self
11420 where
11421 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11422 {
11423 self.input_documents = std::option::Option::Some(v.into());
11424 self
11425 }
11426
11427 /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11428 ///
11429 /// # Example
11430 /// ```ignore,no_run
11431 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11432 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11433 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
11434 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(None::<BatchDocumentsInputConfig>);
11435 /// ```
11436 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
11437 where
11438 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11439 {
11440 self.input_documents = v.map(|x| x.into());
11441 self
11442 }
11443
11444 /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11445 ///
11446 /// # Example
11447 /// ```ignore,no_run
11448 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11449 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11450 /// let x = BatchProcessRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
11451 /// ```
11452 pub fn set_document_output_config<T>(mut self, v: T) -> Self
11453 where
11454 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11455 {
11456 self.document_output_config = std::option::Option::Some(v.into());
11457 self
11458 }
11459
11460 /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11461 ///
11462 /// # Example
11463 /// ```ignore,no_run
11464 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11465 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11466 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
11467 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
11468 /// ```
11469 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
11470 where
11471 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11472 {
11473 self.document_output_config = v.map(|x| x.into());
11474 self
11475 }
11476
11477 /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
11478 ///
11479 /// # Example
11480 /// ```ignore,no_run
11481 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11482 /// let x = BatchProcessRequest::new().set_skip_human_review(true);
11483 /// ```
11484 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11485 self.skip_human_review = v.into();
11486 self
11487 }
11488
11489 /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
11490 ///
11491 /// # Example
11492 /// ```ignore,no_run
11493 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11494 /// use google_cloud_documentai_v1::model::ProcessOptions;
11495 /// let x = BatchProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
11496 /// ```
11497 pub fn set_process_options<T>(mut self, v: T) -> Self
11498 where
11499 T: std::convert::Into<crate::model::ProcessOptions>,
11500 {
11501 self.process_options = std::option::Option::Some(v.into());
11502 self
11503 }
11504
11505 /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
11506 ///
11507 /// # Example
11508 /// ```ignore,no_run
11509 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11510 /// use google_cloud_documentai_v1::model::ProcessOptions;
11511 /// let x = BatchProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
11512 /// let x = BatchProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
11513 /// ```
11514 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
11515 where
11516 T: std::convert::Into<crate::model::ProcessOptions>,
11517 {
11518 self.process_options = v.map(|x| x.into());
11519 self
11520 }
11521
11522 /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
11523 ///
11524 /// # Example
11525 /// ```ignore,no_run
11526 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11527 /// let x = BatchProcessRequest::new().set_labels([
11528 /// ("key0", "abc"),
11529 /// ("key1", "xyz"),
11530 /// ]);
11531 /// ```
11532 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11533 where
11534 T: std::iter::IntoIterator<Item = (K, V)>,
11535 K: std::convert::Into<std::string::String>,
11536 V: std::convert::Into<std::string::String>,
11537 {
11538 use std::iter::Iterator;
11539 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11540 self
11541 }
11542}
11543
11544impl wkt::message::Message for BatchProcessRequest {
11545 fn typename() -> &'static str {
11546 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
11547 }
11548}
11549
11550/// Response message for
11551/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11552///
11553/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11554#[derive(Clone, Default, PartialEq)]
11555#[non_exhaustive]
11556pub struct BatchProcessResponse {
11557 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11558}
11559
11560impl BatchProcessResponse {
11561 /// Creates a new default instance.
11562 pub fn new() -> Self {
11563 std::default::Default::default()
11564 }
11565}
11566
11567impl wkt::message::Message for BatchProcessResponse {
11568 fn typename() -> &'static str {
11569 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
11570 }
11571}
11572
11573/// The long-running operation metadata for
11574/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11575///
11576/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11577#[derive(Clone, Default, PartialEq)]
11578#[non_exhaustive]
11579pub struct BatchProcessMetadata {
11580 /// The state of the current batch processing.
11581 pub state: crate::model::batch_process_metadata::State,
11582
11583 /// A message providing more details about the current state of processing.
11584 /// For example, the error message if the operation is failed.
11585 pub state_message: std::string::String,
11586
11587 /// The creation time of the operation.
11588 pub create_time: std::option::Option<wkt::Timestamp>,
11589
11590 /// The last update time of the operation.
11591 pub update_time: std::option::Option<wkt::Timestamp>,
11592
11593 /// The list of response details of each document.
11594 pub individual_process_statuses:
11595 std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
11596
11597 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11598}
11599
11600impl BatchProcessMetadata {
11601 /// Creates a new default instance.
11602 pub fn new() -> Self {
11603 std::default::Default::default()
11604 }
11605
11606 /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
11607 ///
11608 /// # Example
11609 /// ```ignore,no_run
11610 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11611 /// use google_cloud_documentai_v1::model::batch_process_metadata::State;
11612 /// let x0 = BatchProcessMetadata::new().set_state(State::Waiting);
11613 /// let x1 = BatchProcessMetadata::new().set_state(State::Running);
11614 /// let x2 = BatchProcessMetadata::new().set_state(State::Succeeded);
11615 /// ```
11616 pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
11617 mut self,
11618 v: T,
11619 ) -> Self {
11620 self.state = v.into();
11621 self
11622 }
11623
11624 /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
11625 ///
11626 /// # Example
11627 /// ```ignore,no_run
11628 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11629 /// let x = BatchProcessMetadata::new().set_state_message("example");
11630 /// ```
11631 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11632 self.state_message = v.into();
11633 self
11634 }
11635
11636 /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11637 ///
11638 /// # Example
11639 /// ```ignore,no_run
11640 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11641 /// use wkt::Timestamp;
11642 /// let x = BatchProcessMetadata::new().set_create_time(Timestamp::default()/* use setters */);
11643 /// ```
11644 pub fn set_create_time<T>(mut self, v: T) -> Self
11645 where
11646 T: std::convert::Into<wkt::Timestamp>,
11647 {
11648 self.create_time = std::option::Option::Some(v.into());
11649 self
11650 }
11651
11652 /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11653 ///
11654 /// # Example
11655 /// ```ignore,no_run
11656 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11657 /// use wkt::Timestamp;
11658 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11659 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(None::<Timestamp>);
11660 /// ```
11661 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11662 where
11663 T: std::convert::Into<wkt::Timestamp>,
11664 {
11665 self.create_time = v.map(|x| x.into());
11666 self
11667 }
11668
11669 /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11670 ///
11671 /// # Example
11672 /// ```ignore,no_run
11673 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11674 /// use wkt::Timestamp;
11675 /// let x = BatchProcessMetadata::new().set_update_time(Timestamp::default()/* use setters */);
11676 /// ```
11677 pub fn set_update_time<T>(mut self, v: T) -> Self
11678 where
11679 T: std::convert::Into<wkt::Timestamp>,
11680 {
11681 self.update_time = std::option::Option::Some(v.into());
11682 self
11683 }
11684
11685 /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11686 ///
11687 /// # Example
11688 /// ```ignore,no_run
11689 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11690 /// use wkt::Timestamp;
11691 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11692 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(None::<Timestamp>);
11693 /// ```
11694 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11695 where
11696 T: std::convert::Into<wkt::Timestamp>,
11697 {
11698 self.update_time = v.map(|x| x.into());
11699 self
11700 }
11701
11702 /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
11703 ///
11704 /// # Example
11705 /// ```ignore,no_run
11706 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11707 /// use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11708 /// let x = BatchProcessMetadata::new()
11709 /// .set_individual_process_statuses([
11710 /// IndividualProcessStatus::default()/* use setters */,
11711 /// IndividualProcessStatus::default()/* use (different) setters */,
11712 /// ]);
11713 /// ```
11714 pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
11715 where
11716 T: std::iter::IntoIterator<Item = V>,
11717 V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
11718 {
11719 use std::iter::Iterator;
11720 self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
11721 self
11722 }
11723}
11724
11725impl wkt::message::Message for BatchProcessMetadata {
11726 fn typename() -> &'static str {
11727 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
11728 }
11729}
11730
11731/// Defines additional types related to [BatchProcessMetadata].
11732pub mod batch_process_metadata {
11733 #[allow(unused_imports)]
11734 use super::*;
11735
11736 /// The status of a each individual document in the batch process.
11737 #[derive(Clone, Default, PartialEq)]
11738 #[non_exhaustive]
11739 pub struct IndividualProcessStatus {
11740 /// The source of the document, same as the
11741 /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
11742 /// field in the request when the batch process started.
11743 ///
11744 /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
11745 pub input_gcs_source: std::string::String,
11746
11747 /// The status processing the document.
11748 pub status: std::option::Option<google_cloud_rpc::model::Status>,
11749
11750 /// The Cloud Storage output destination (in the request as
11751 /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
11752 /// of the processed document if it was successful, otherwise empty.
11753 ///
11754 /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
11755 pub output_gcs_destination: std::string::String,
11756
11757 /// The status of human review on the processed document.
11758 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11759
11760 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11761 }
11762
11763 impl IndividualProcessStatus {
11764 /// Creates a new default instance.
11765 pub fn new() -> Self {
11766 std::default::Default::default()
11767 }
11768
11769 /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
11770 ///
11771 /// # Example
11772 /// ```ignore,no_run
11773 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11774 /// let x = IndividualProcessStatus::new().set_input_gcs_source("example");
11775 /// ```
11776 pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
11777 mut self,
11778 v: T,
11779 ) -> Self {
11780 self.input_gcs_source = v.into();
11781 self
11782 }
11783
11784 /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11785 ///
11786 /// # Example
11787 /// ```ignore,no_run
11788 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11789 /// use google_cloud_rpc::model::Status;
11790 /// let x = IndividualProcessStatus::new().set_status(Status::default()/* use setters */);
11791 /// ```
11792 pub fn set_status<T>(mut self, v: T) -> Self
11793 where
11794 T: std::convert::Into<google_cloud_rpc::model::Status>,
11795 {
11796 self.status = std::option::Option::Some(v.into());
11797 self
11798 }
11799
11800 /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11801 ///
11802 /// # Example
11803 /// ```ignore,no_run
11804 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11805 /// use google_cloud_rpc::model::Status;
11806 /// let x = IndividualProcessStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
11807 /// let x = IndividualProcessStatus::new().set_or_clear_status(None::<Status>);
11808 /// ```
11809 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
11810 where
11811 T: std::convert::Into<google_cloud_rpc::model::Status>,
11812 {
11813 self.status = v.map(|x| x.into());
11814 self
11815 }
11816
11817 /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
11818 ///
11819 /// # Example
11820 /// ```ignore,no_run
11821 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11822 /// let x = IndividualProcessStatus::new().set_output_gcs_destination("example");
11823 /// ```
11824 pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
11825 mut self,
11826 v: T,
11827 ) -> Self {
11828 self.output_gcs_destination = v.into();
11829 self
11830 }
11831
11832 /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11833 ///
11834 /// # Example
11835 /// ```ignore,no_run
11836 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11837 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11838 /// let x = IndividualProcessStatus::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11839 /// ```
11840 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11841 where
11842 T: std::convert::Into<crate::model::HumanReviewStatus>,
11843 {
11844 self.human_review_status = std::option::Option::Some(v.into());
11845 self
11846 }
11847
11848 /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11849 ///
11850 /// # Example
11851 /// ```ignore,no_run
11852 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11853 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11854 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11855 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11856 /// ```
11857 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11858 where
11859 T: std::convert::Into<crate::model::HumanReviewStatus>,
11860 {
11861 self.human_review_status = v.map(|x| x.into());
11862 self
11863 }
11864 }
11865
11866 impl wkt::message::Message for IndividualProcessStatus {
11867 fn typename() -> &'static str {
11868 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
11869 }
11870 }
11871
11872 /// Possible states of the batch processing operation.
11873 ///
11874 /// # Working with unknown values
11875 ///
11876 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11877 /// additional enum variants at any time. Adding new variants is not considered
11878 /// a breaking change. Applications should write their code in anticipation of:
11879 ///
11880 /// - New values appearing in future releases of the client library, **and**
11881 /// - New values received dynamically, without application changes.
11882 ///
11883 /// Please consult the [Working with enums] section in the user guide for some
11884 /// guidelines.
11885 ///
11886 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11887 #[derive(Clone, Debug, PartialEq)]
11888 #[non_exhaustive]
11889 pub enum State {
11890 /// The default value. This value is used if the state is omitted.
11891 Unspecified,
11892 /// Request operation is waiting for scheduling.
11893 Waiting,
11894 /// Request is being processed.
11895 Running,
11896 /// The batch processing completed successfully.
11897 Succeeded,
11898 /// The batch processing was being cancelled.
11899 Cancelling,
11900 /// The batch processing was cancelled.
11901 Cancelled,
11902 /// The batch processing has failed.
11903 Failed,
11904 /// If set, the enum was initialized with an unknown value.
11905 ///
11906 /// Applications can examine the value using [State::value] or
11907 /// [State::name].
11908 UnknownValue(state::UnknownValue),
11909 }
11910
11911 #[doc(hidden)]
11912 pub mod state {
11913 #[allow(unused_imports)]
11914 use super::*;
11915 #[derive(Clone, Debug, PartialEq)]
11916 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11917 }
11918
11919 impl State {
11920 /// Gets the enum value.
11921 ///
11922 /// Returns `None` if the enum contains an unknown value deserialized from
11923 /// the string representation of enums.
11924 pub fn value(&self) -> std::option::Option<i32> {
11925 match self {
11926 Self::Unspecified => std::option::Option::Some(0),
11927 Self::Waiting => std::option::Option::Some(1),
11928 Self::Running => std::option::Option::Some(2),
11929 Self::Succeeded => std::option::Option::Some(3),
11930 Self::Cancelling => std::option::Option::Some(4),
11931 Self::Cancelled => std::option::Option::Some(5),
11932 Self::Failed => std::option::Option::Some(6),
11933 Self::UnknownValue(u) => u.0.value(),
11934 }
11935 }
11936
11937 /// Gets the enum value as a string.
11938 ///
11939 /// Returns `None` if the enum contains an unknown value deserialized from
11940 /// the integer representation of enums.
11941 pub fn name(&self) -> std::option::Option<&str> {
11942 match self {
11943 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11944 Self::Waiting => std::option::Option::Some("WAITING"),
11945 Self::Running => std::option::Option::Some("RUNNING"),
11946 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
11947 Self::Cancelling => std::option::Option::Some("CANCELLING"),
11948 Self::Cancelled => std::option::Option::Some("CANCELLED"),
11949 Self::Failed => std::option::Option::Some("FAILED"),
11950 Self::UnknownValue(u) => u.0.name(),
11951 }
11952 }
11953 }
11954
11955 impl std::default::Default for State {
11956 fn default() -> Self {
11957 use std::convert::From;
11958 Self::from(0)
11959 }
11960 }
11961
11962 impl std::fmt::Display for State {
11963 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11964 wkt::internal::display_enum(f, self.name(), self.value())
11965 }
11966 }
11967
11968 impl std::convert::From<i32> for State {
11969 fn from(value: i32) -> Self {
11970 match value {
11971 0 => Self::Unspecified,
11972 1 => Self::Waiting,
11973 2 => Self::Running,
11974 3 => Self::Succeeded,
11975 4 => Self::Cancelling,
11976 5 => Self::Cancelled,
11977 6 => Self::Failed,
11978 _ => Self::UnknownValue(state::UnknownValue(
11979 wkt::internal::UnknownEnumValue::Integer(value),
11980 )),
11981 }
11982 }
11983 }
11984
11985 impl std::convert::From<&str> for State {
11986 fn from(value: &str) -> Self {
11987 use std::string::ToString;
11988 match value {
11989 "STATE_UNSPECIFIED" => Self::Unspecified,
11990 "WAITING" => Self::Waiting,
11991 "RUNNING" => Self::Running,
11992 "SUCCEEDED" => Self::Succeeded,
11993 "CANCELLING" => Self::Cancelling,
11994 "CANCELLED" => Self::Cancelled,
11995 "FAILED" => Self::Failed,
11996 _ => Self::UnknownValue(state::UnknownValue(
11997 wkt::internal::UnknownEnumValue::String(value.to_string()),
11998 )),
11999 }
12000 }
12001 }
12002
12003 impl serde::ser::Serialize for State {
12004 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12005 where
12006 S: serde::Serializer,
12007 {
12008 match self {
12009 Self::Unspecified => serializer.serialize_i32(0),
12010 Self::Waiting => serializer.serialize_i32(1),
12011 Self::Running => serializer.serialize_i32(2),
12012 Self::Succeeded => serializer.serialize_i32(3),
12013 Self::Cancelling => serializer.serialize_i32(4),
12014 Self::Cancelled => serializer.serialize_i32(5),
12015 Self::Failed => serializer.serialize_i32(6),
12016 Self::UnknownValue(u) => u.0.serialize(serializer),
12017 }
12018 }
12019 }
12020
12021 impl<'de> serde::de::Deserialize<'de> for State {
12022 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12023 where
12024 D: serde::Deserializer<'de>,
12025 {
12026 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12027 ".google.cloud.documentai.v1.BatchProcessMetadata.State",
12028 ))
12029 }
12030 }
12031}
12032
12033/// Request message for the
12034/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
12035/// method. Some processor types may require the project be added to an
12036/// allowlist.
12037///
12038/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
12039#[derive(Clone, Default, PartialEq)]
12040#[non_exhaustive]
12041pub struct FetchProcessorTypesRequest {
12042 /// Required. The location of processor types to list.
12043 /// Format: `projects/{project}/locations/{location}`.
12044 pub parent: std::string::String,
12045
12046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12047}
12048
12049impl FetchProcessorTypesRequest {
12050 /// Creates a new default instance.
12051 pub fn new() -> Self {
12052 std::default::Default::default()
12053 }
12054
12055 /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
12056 ///
12057 /// # Example
12058 /// ```ignore,no_run
12059 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesRequest;
12060 /// # let project_id = "project_id";
12061 /// # let location_id = "location_id";
12062 /// let x = FetchProcessorTypesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
12063 /// ```
12064 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12065 self.parent = v.into();
12066 self
12067 }
12068}
12069
12070impl wkt::message::Message for FetchProcessorTypesRequest {
12071 fn typename() -> &'static str {
12072 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
12073 }
12074}
12075
12076/// Response message for the
12077/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
12078/// method.
12079///
12080/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
12081#[derive(Clone, Default, PartialEq)]
12082#[non_exhaustive]
12083pub struct FetchProcessorTypesResponse {
12084 /// The list of processor types.
12085 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12086
12087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12088}
12089
12090impl FetchProcessorTypesResponse {
12091 /// Creates a new default instance.
12092 pub fn new() -> Self {
12093 std::default::Default::default()
12094 }
12095
12096 /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
12097 ///
12098 /// # Example
12099 /// ```ignore,no_run
12100 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesResponse;
12101 /// use google_cloud_documentai_v1::model::ProcessorType;
12102 /// let x = FetchProcessorTypesResponse::new()
12103 /// .set_processor_types([
12104 /// ProcessorType::default()/* use setters */,
12105 /// ProcessorType::default()/* use (different) setters */,
12106 /// ]);
12107 /// ```
12108 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12109 where
12110 T: std::iter::IntoIterator<Item = V>,
12111 V: std::convert::Into<crate::model::ProcessorType>,
12112 {
12113 use std::iter::Iterator;
12114 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12115 self
12116 }
12117}
12118
12119impl wkt::message::Message for FetchProcessorTypesResponse {
12120 fn typename() -> &'static str {
12121 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
12122 }
12123}
12124
12125/// Request message for the
12126/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12127/// method. Some processor types may require the project be added to an
12128/// allowlist.
12129///
12130/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12131#[derive(Clone, Default, PartialEq)]
12132#[non_exhaustive]
12133pub struct ListProcessorTypesRequest {
12134 /// Required. The location of processor types to list.
12135 /// Format: `projects/{project}/locations/{location}`.
12136 pub parent: std::string::String,
12137
12138 /// The maximum number of processor types to return.
12139 /// If unspecified, at most `100` processor types will be returned.
12140 /// The maximum value is `500`. Values above `500` will be coerced to `500`.
12141 pub page_size: i32,
12142
12143 /// Used to retrieve the next page of results, empty if at the end of the list.
12144 pub page_token: std::string::String,
12145
12146 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12147}
12148
12149impl ListProcessorTypesRequest {
12150 /// Creates a new default instance.
12151 pub fn new() -> Self {
12152 std::default::Default::default()
12153 }
12154
12155 /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
12156 ///
12157 /// # Example
12158 /// ```ignore,no_run
12159 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12160 /// # let project_id = "project_id";
12161 /// # let location_id = "location_id";
12162 /// let x = ListProcessorTypesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
12163 /// ```
12164 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12165 self.parent = v.into();
12166 self
12167 }
12168
12169 /// Sets the value of [page_size][crate::model::ListProcessorTypesRequest::page_size].
12170 ///
12171 /// # Example
12172 /// ```ignore,no_run
12173 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12174 /// let x = ListProcessorTypesRequest::new().set_page_size(42);
12175 /// ```
12176 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12177 self.page_size = v.into();
12178 self
12179 }
12180
12181 /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
12182 ///
12183 /// # Example
12184 /// ```ignore,no_run
12185 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12186 /// let x = ListProcessorTypesRequest::new().set_page_token("example");
12187 /// ```
12188 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12189 self.page_token = v.into();
12190 self
12191 }
12192}
12193
12194impl wkt::message::Message for ListProcessorTypesRequest {
12195 fn typename() -> &'static str {
12196 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
12197 }
12198}
12199
12200/// Response message for the
12201/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12202/// method.
12203///
12204/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12205#[derive(Clone, Default, PartialEq)]
12206#[non_exhaustive]
12207pub struct ListProcessorTypesResponse {
12208 /// The processor types.
12209 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12210
12211 /// Points to the next page, otherwise empty.
12212 pub next_page_token: std::string::String,
12213
12214 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12215}
12216
12217impl ListProcessorTypesResponse {
12218 /// Creates a new default instance.
12219 pub fn new() -> Self {
12220 std::default::Default::default()
12221 }
12222
12223 /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
12224 ///
12225 /// # Example
12226 /// ```ignore,no_run
12227 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12228 /// use google_cloud_documentai_v1::model::ProcessorType;
12229 /// let x = ListProcessorTypesResponse::new()
12230 /// .set_processor_types([
12231 /// ProcessorType::default()/* use setters */,
12232 /// ProcessorType::default()/* use (different) setters */,
12233 /// ]);
12234 /// ```
12235 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12236 where
12237 T: std::iter::IntoIterator<Item = V>,
12238 V: std::convert::Into<crate::model::ProcessorType>,
12239 {
12240 use std::iter::Iterator;
12241 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12242 self
12243 }
12244
12245 /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
12246 ///
12247 /// # Example
12248 /// ```ignore,no_run
12249 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12250 /// let x = ListProcessorTypesResponse::new().set_next_page_token("example");
12251 /// ```
12252 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12253 self.next_page_token = v.into();
12254 self
12255 }
12256}
12257
12258impl wkt::message::Message for ListProcessorTypesResponse {
12259 fn typename() -> &'static str {
12260 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
12261 }
12262}
12263
12264#[doc(hidden)]
12265impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
12266 type PageItem = crate::model::ProcessorType;
12267
12268 fn items(self) -> std::vec::Vec<Self::PageItem> {
12269 self.processor_types
12270 }
12271
12272 fn next_page_token(&self) -> std::string::String {
12273 use std::clone::Clone;
12274 self.next_page_token.clone()
12275 }
12276}
12277
12278/// Request message for list all processors belongs to a project.
12279#[derive(Clone, Default, PartialEq)]
12280#[non_exhaustive]
12281pub struct ListProcessorsRequest {
12282 /// Required. The parent (project and location) which owns this collection of
12283 /// Processors. Format: `projects/{project}/locations/{location}`
12284 pub parent: std::string::String,
12285
12286 /// The maximum number of processors to return.
12287 /// If unspecified, at most `50` processors will be returned.
12288 /// The maximum value is `100`. Values above `100` will be coerced to `100`.
12289 pub page_size: i32,
12290
12291 /// We will return the processors sorted by creation time. The page token
12292 /// will point to the next processor.
12293 pub page_token: std::string::String,
12294
12295 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12296}
12297
12298impl ListProcessorsRequest {
12299 /// Creates a new default instance.
12300 pub fn new() -> Self {
12301 std::default::Default::default()
12302 }
12303
12304 /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
12305 ///
12306 /// # Example
12307 /// ```ignore,no_run
12308 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12309 /// # let project_id = "project_id";
12310 /// # let location_id = "location_id";
12311 /// let x = ListProcessorsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
12312 /// ```
12313 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12314 self.parent = v.into();
12315 self
12316 }
12317
12318 /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
12319 ///
12320 /// # Example
12321 /// ```ignore,no_run
12322 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12323 /// let x = ListProcessorsRequest::new().set_page_size(42);
12324 /// ```
12325 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12326 self.page_size = v.into();
12327 self
12328 }
12329
12330 /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
12331 ///
12332 /// # Example
12333 /// ```ignore,no_run
12334 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12335 /// let x = ListProcessorsRequest::new().set_page_token("example");
12336 /// ```
12337 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12338 self.page_token = v.into();
12339 self
12340 }
12341}
12342
12343impl wkt::message::Message for ListProcessorsRequest {
12344 fn typename() -> &'static str {
12345 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
12346 }
12347}
12348
12349/// Response message for the
12350/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
12351/// method.
12352///
12353/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
12354#[derive(Clone, Default, PartialEq)]
12355#[non_exhaustive]
12356pub struct ListProcessorsResponse {
12357 /// The list of processors.
12358 pub processors: std::vec::Vec<crate::model::Processor>,
12359
12360 /// Points to the next processor, otherwise empty.
12361 pub next_page_token: std::string::String,
12362
12363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12364}
12365
12366impl ListProcessorsResponse {
12367 /// Creates a new default instance.
12368 pub fn new() -> Self {
12369 std::default::Default::default()
12370 }
12371
12372 /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
12373 ///
12374 /// # Example
12375 /// ```ignore,no_run
12376 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12377 /// use google_cloud_documentai_v1::model::Processor;
12378 /// let x = ListProcessorsResponse::new()
12379 /// .set_processors([
12380 /// Processor::default()/* use setters */,
12381 /// Processor::default()/* use (different) setters */,
12382 /// ]);
12383 /// ```
12384 pub fn set_processors<T, V>(mut self, v: T) -> Self
12385 where
12386 T: std::iter::IntoIterator<Item = V>,
12387 V: std::convert::Into<crate::model::Processor>,
12388 {
12389 use std::iter::Iterator;
12390 self.processors = v.into_iter().map(|i| i.into()).collect();
12391 self
12392 }
12393
12394 /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
12395 ///
12396 /// # Example
12397 /// ```ignore,no_run
12398 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12399 /// let x = ListProcessorsResponse::new().set_next_page_token("example");
12400 /// ```
12401 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12402 self.next_page_token = v.into();
12403 self
12404 }
12405}
12406
12407impl wkt::message::Message for ListProcessorsResponse {
12408 fn typename() -> &'static str {
12409 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
12410 }
12411}
12412
12413#[doc(hidden)]
12414impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorsResponse {
12415 type PageItem = crate::model::Processor;
12416
12417 fn items(self) -> std::vec::Vec<Self::PageItem> {
12418 self.processors
12419 }
12420
12421 fn next_page_token(&self) -> std::string::String {
12422 use std::clone::Clone;
12423 self.next_page_token.clone()
12424 }
12425}
12426
12427/// Request message for the
12428/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
12429/// method.
12430///
12431/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
12432#[derive(Clone, Default, PartialEq)]
12433#[non_exhaustive]
12434pub struct GetProcessorTypeRequest {
12435 /// Required. The processor type resource name.
12436 pub name: std::string::String,
12437
12438 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12439}
12440
12441impl GetProcessorTypeRequest {
12442 /// Creates a new default instance.
12443 pub fn new() -> Self {
12444 std::default::Default::default()
12445 }
12446
12447 /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
12448 ///
12449 /// # Example
12450 /// ```ignore,no_run
12451 /// # use google_cloud_documentai_v1::model::GetProcessorTypeRequest;
12452 /// # let project_id = "project_id";
12453 /// # let location_id = "location_id";
12454 /// # let processor_type_id = "processor_type_id";
12455 /// let x = GetProcessorTypeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processorTypes/{processor_type_id}"));
12456 /// ```
12457 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12458 self.name = v.into();
12459 self
12460 }
12461}
12462
12463impl wkt::message::Message for GetProcessorTypeRequest {
12464 fn typename() -> &'static str {
12465 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
12466 }
12467}
12468
12469/// Request message for the
12470/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
12471/// method.
12472///
12473/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
12474#[derive(Clone, Default, PartialEq)]
12475#[non_exhaustive]
12476pub struct GetProcessorRequest {
12477 /// Required. The processor resource name.
12478 pub name: std::string::String,
12479
12480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12481}
12482
12483impl GetProcessorRequest {
12484 /// Creates a new default instance.
12485 pub fn new() -> Self {
12486 std::default::Default::default()
12487 }
12488
12489 /// Sets the value of [name][crate::model::GetProcessorRequest::name].
12490 ///
12491 /// # Example
12492 /// ```ignore,no_run
12493 /// # use google_cloud_documentai_v1::model::GetProcessorRequest;
12494 /// # let project_id = "project_id";
12495 /// # let location_id = "location_id";
12496 /// # let processor_id = "processor_id";
12497 /// let x = GetProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
12498 /// ```
12499 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12500 self.name = v.into();
12501 self
12502 }
12503}
12504
12505impl wkt::message::Message for GetProcessorRequest {
12506 fn typename() -> &'static str {
12507 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
12508 }
12509}
12510
12511/// Request message for the
12512/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
12513/// method.
12514///
12515/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
12516#[derive(Clone, Default, PartialEq)]
12517#[non_exhaustive]
12518pub struct GetProcessorVersionRequest {
12519 /// Required. The processor resource name.
12520 pub name: std::string::String,
12521
12522 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12523}
12524
12525impl GetProcessorVersionRequest {
12526 /// Creates a new default instance.
12527 pub fn new() -> Self {
12528 std::default::Default::default()
12529 }
12530
12531 /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
12532 ///
12533 /// # Example
12534 /// ```ignore,no_run
12535 /// # use google_cloud_documentai_v1::model::GetProcessorVersionRequest;
12536 /// # let project_id = "project_id";
12537 /// # let location_id = "location_id";
12538 /// # let processor_id = "processor_id";
12539 /// # let processor_version_id = "processor_version_id";
12540 /// let x = GetProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12541 /// ```
12542 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12543 self.name = v.into();
12544 self
12545 }
12546}
12547
12548impl wkt::message::Message for GetProcessorVersionRequest {
12549 fn typename() -> &'static str {
12550 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
12551 }
12552}
12553
12554/// Request message for list all processor versions belongs to a processor.
12555#[derive(Clone, Default, PartialEq)]
12556#[non_exhaustive]
12557pub struct ListProcessorVersionsRequest {
12558 /// Required. The parent (project, location and processor) to list all
12559 /// versions. Format:
12560 /// `projects/{project}/locations/{location}/processors/{processor}`
12561 pub parent: std::string::String,
12562
12563 /// The maximum number of processor versions to return.
12564 /// If unspecified, at most `10` processor versions will be returned.
12565 /// The maximum value is `20`. Values above `20` will be coerced to `20`.
12566 pub page_size: i32,
12567
12568 /// We will return the processor versions sorted by creation time. The page
12569 /// token will point to the next processor version.
12570 pub page_token: std::string::String,
12571
12572 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12573}
12574
12575impl ListProcessorVersionsRequest {
12576 /// Creates a new default instance.
12577 pub fn new() -> Self {
12578 std::default::Default::default()
12579 }
12580
12581 /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
12582 ///
12583 /// # Example
12584 /// ```ignore,no_run
12585 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12586 /// # let project_id = "project_id";
12587 /// # let location_id = "location_id";
12588 /// # let processor_id = "processor_id";
12589 /// let x = ListProcessorVersionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
12590 /// ```
12591 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12592 self.parent = v.into();
12593 self
12594 }
12595
12596 /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
12597 ///
12598 /// # Example
12599 /// ```ignore,no_run
12600 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12601 /// let x = ListProcessorVersionsRequest::new().set_page_size(42);
12602 /// ```
12603 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12604 self.page_size = v.into();
12605 self
12606 }
12607
12608 /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
12609 ///
12610 /// # Example
12611 /// ```ignore,no_run
12612 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12613 /// let x = ListProcessorVersionsRequest::new().set_page_token("example");
12614 /// ```
12615 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12616 self.page_token = v.into();
12617 self
12618 }
12619}
12620
12621impl wkt::message::Message for ListProcessorVersionsRequest {
12622 fn typename() -> &'static str {
12623 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
12624 }
12625}
12626
12627/// Response message for the
12628/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
12629/// method.
12630///
12631/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
12632#[derive(Clone, Default, PartialEq)]
12633#[non_exhaustive]
12634pub struct ListProcessorVersionsResponse {
12635 /// The list of processors.
12636 pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
12637
12638 /// Points to the next processor, otherwise empty.
12639 pub next_page_token: std::string::String,
12640
12641 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12642}
12643
12644impl ListProcessorVersionsResponse {
12645 /// Creates a new default instance.
12646 pub fn new() -> Self {
12647 std::default::Default::default()
12648 }
12649
12650 /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
12651 ///
12652 /// # Example
12653 /// ```ignore,no_run
12654 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12655 /// use google_cloud_documentai_v1::model::ProcessorVersion;
12656 /// let x = ListProcessorVersionsResponse::new()
12657 /// .set_processor_versions([
12658 /// ProcessorVersion::default()/* use setters */,
12659 /// ProcessorVersion::default()/* use (different) setters */,
12660 /// ]);
12661 /// ```
12662 pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
12663 where
12664 T: std::iter::IntoIterator<Item = V>,
12665 V: std::convert::Into<crate::model::ProcessorVersion>,
12666 {
12667 use std::iter::Iterator;
12668 self.processor_versions = v.into_iter().map(|i| i.into()).collect();
12669 self
12670 }
12671
12672 /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
12673 ///
12674 /// # Example
12675 /// ```ignore,no_run
12676 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12677 /// let x = ListProcessorVersionsResponse::new().set_next_page_token("example");
12678 /// ```
12679 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12680 self.next_page_token = v.into();
12681 self
12682 }
12683}
12684
12685impl wkt::message::Message for ListProcessorVersionsResponse {
12686 fn typename() -> &'static str {
12687 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
12688 }
12689}
12690
12691#[doc(hidden)]
12692impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
12693 type PageItem = crate::model::ProcessorVersion;
12694
12695 fn items(self) -> std::vec::Vec<Self::PageItem> {
12696 self.processor_versions
12697 }
12698
12699 fn next_page_token(&self) -> std::string::String {
12700 use std::clone::Clone;
12701 self.next_page_token.clone()
12702 }
12703}
12704
12705/// Request message for the
12706/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12707/// method.
12708///
12709/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12710#[derive(Clone, Default, PartialEq)]
12711#[non_exhaustive]
12712pub struct DeleteProcessorVersionRequest {
12713 /// Required. The processor version resource name to be deleted.
12714 pub name: std::string::String,
12715
12716 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12717}
12718
12719impl DeleteProcessorVersionRequest {
12720 /// Creates a new default instance.
12721 pub fn new() -> Self {
12722 std::default::Default::default()
12723 }
12724
12725 /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
12726 ///
12727 /// # Example
12728 /// ```ignore,no_run
12729 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionRequest;
12730 /// # let project_id = "project_id";
12731 /// # let location_id = "location_id";
12732 /// # let processor_id = "processor_id";
12733 /// # let processor_version_id = "processor_version_id";
12734 /// let x = DeleteProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12735 /// ```
12736 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12737 self.name = v.into();
12738 self
12739 }
12740}
12741
12742impl wkt::message::Message for DeleteProcessorVersionRequest {
12743 fn typename() -> &'static str {
12744 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
12745 }
12746}
12747
12748/// The long-running operation metadata for the
12749/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12750/// method.
12751///
12752/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12753#[derive(Clone, Default, PartialEq)]
12754#[non_exhaustive]
12755pub struct DeleteProcessorVersionMetadata {
12756 /// The basic metadata of the long-running operation.
12757 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12758
12759 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12760}
12761
12762impl DeleteProcessorVersionMetadata {
12763 /// Creates a new default instance.
12764 pub fn new() -> Self {
12765 std::default::Default::default()
12766 }
12767
12768 /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12769 ///
12770 /// # Example
12771 /// ```ignore,no_run
12772 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12773 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12774 /// let x = DeleteProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12775 /// ```
12776 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12777 where
12778 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12779 {
12780 self.common_metadata = std::option::Option::Some(v.into());
12781 self
12782 }
12783
12784 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12785 ///
12786 /// # Example
12787 /// ```ignore,no_run
12788 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12789 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12790 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12791 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12792 /// ```
12793 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12794 where
12795 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12796 {
12797 self.common_metadata = v.map(|x| x.into());
12798 self
12799 }
12800}
12801
12802impl wkt::message::Message for DeleteProcessorVersionMetadata {
12803 fn typename() -> &'static str {
12804 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
12805 }
12806}
12807
12808/// Request message for the
12809/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12810/// method.
12811///
12812/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12813#[derive(Clone, Default, PartialEq)]
12814#[non_exhaustive]
12815pub struct DeployProcessorVersionRequest {
12816 /// Required. The processor version resource name to be deployed.
12817 pub name: std::string::String,
12818
12819 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12820}
12821
12822impl DeployProcessorVersionRequest {
12823 /// Creates a new default instance.
12824 pub fn new() -> Self {
12825 std::default::Default::default()
12826 }
12827
12828 /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
12829 ///
12830 /// # Example
12831 /// ```ignore,no_run
12832 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionRequest;
12833 /// # let project_id = "project_id";
12834 /// # let location_id = "location_id";
12835 /// # let processor_id = "processor_id";
12836 /// # let processor_version_id = "processor_version_id";
12837 /// let x = DeployProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12838 /// ```
12839 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12840 self.name = v.into();
12841 self
12842 }
12843}
12844
12845impl wkt::message::Message for DeployProcessorVersionRequest {
12846 fn typename() -> &'static str {
12847 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
12848 }
12849}
12850
12851/// Response message for the
12852/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12853/// method.
12854///
12855/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12856#[derive(Clone, Default, PartialEq)]
12857#[non_exhaustive]
12858pub struct DeployProcessorVersionResponse {
12859 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12860}
12861
12862impl DeployProcessorVersionResponse {
12863 /// Creates a new default instance.
12864 pub fn new() -> Self {
12865 std::default::Default::default()
12866 }
12867}
12868
12869impl wkt::message::Message for DeployProcessorVersionResponse {
12870 fn typename() -> &'static str {
12871 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
12872 }
12873}
12874
12875/// The long-running operation metadata for the
12876/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12877/// method.
12878///
12879/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12880#[derive(Clone, Default, PartialEq)]
12881#[non_exhaustive]
12882pub struct DeployProcessorVersionMetadata {
12883 /// The basic metadata of the long-running operation.
12884 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12885
12886 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12887}
12888
12889impl DeployProcessorVersionMetadata {
12890 /// Creates a new default instance.
12891 pub fn new() -> Self {
12892 std::default::Default::default()
12893 }
12894
12895 /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12896 ///
12897 /// # Example
12898 /// ```ignore,no_run
12899 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12900 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12901 /// let x = DeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12902 /// ```
12903 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12904 where
12905 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12906 {
12907 self.common_metadata = std::option::Option::Some(v.into());
12908 self
12909 }
12910
12911 /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12912 ///
12913 /// # Example
12914 /// ```ignore,no_run
12915 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12916 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12917 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12918 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12919 /// ```
12920 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12921 where
12922 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12923 {
12924 self.common_metadata = v.map(|x| x.into());
12925 self
12926 }
12927}
12928
12929impl wkt::message::Message for DeployProcessorVersionMetadata {
12930 fn typename() -> &'static str {
12931 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
12932 }
12933}
12934
12935/// Request message for the
12936/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12937/// method.
12938///
12939/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12940#[derive(Clone, Default, PartialEq)]
12941#[non_exhaustive]
12942pub struct UndeployProcessorVersionRequest {
12943 /// Required. The processor version resource name to be undeployed.
12944 pub name: std::string::String,
12945
12946 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12947}
12948
12949impl UndeployProcessorVersionRequest {
12950 /// Creates a new default instance.
12951 pub fn new() -> Self {
12952 std::default::Default::default()
12953 }
12954
12955 /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
12956 ///
12957 /// # Example
12958 /// ```ignore,no_run
12959 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionRequest;
12960 /// # let project_id = "project_id";
12961 /// # let location_id = "location_id";
12962 /// # let processor_id = "processor_id";
12963 /// # let processor_version_id = "processor_version_id";
12964 /// let x = UndeployProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12965 /// ```
12966 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12967 self.name = v.into();
12968 self
12969 }
12970}
12971
12972impl wkt::message::Message for UndeployProcessorVersionRequest {
12973 fn typename() -> &'static str {
12974 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
12975 }
12976}
12977
12978/// Response message for the
12979/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12980/// method.
12981///
12982/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12983#[derive(Clone, Default, PartialEq)]
12984#[non_exhaustive]
12985pub struct UndeployProcessorVersionResponse {
12986 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12987}
12988
12989impl UndeployProcessorVersionResponse {
12990 /// Creates a new default instance.
12991 pub fn new() -> Self {
12992 std::default::Default::default()
12993 }
12994}
12995
12996impl wkt::message::Message for UndeployProcessorVersionResponse {
12997 fn typename() -> &'static str {
12998 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
12999 }
13000}
13001
13002/// The long-running operation metadata for the
13003/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
13004/// method.
13005///
13006/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
13007#[derive(Clone, Default, PartialEq)]
13008#[non_exhaustive]
13009pub struct UndeployProcessorVersionMetadata {
13010 /// The basic metadata of the long-running operation.
13011 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13012
13013 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13014}
13015
13016impl UndeployProcessorVersionMetadata {
13017 /// Creates a new default instance.
13018 pub fn new() -> Self {
13019 std::default::Default::default()
13020 }
13021
13022 /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
13023 ///
13024 /// # Example
13025 /// ```ignore,no_run
13026 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
13027 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13028 /// let x = UndeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13029 /// ```
13030 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13031 where
13032 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13033 {
13034 self.common_metadata = std::option::Option::Some(v.into());
13035 self
13036 }
13037
13038 /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
13039 ///
13040 /// # Example
13041 /// ```ignore,no_run
13042 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
13043 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13044 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13045 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13046 /// ```
13047 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13048 where
13049 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13050 {
13051 self.common_metadata = v.map(|x| x.into());
13052 self
13053 }
13054}
13055
13056impl wkt::message::Message for UndeployProcessorVersionMetadata {
13057 fn typename() -> &'static str {
13058 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
13059 }
13060}
13061
13062/// Request message for the
13063/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
13064/// method. Notice this request is sent to a regionalized backend service. If the
13065/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
13066/// that region, the creation fails.
13067///
13068/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
13069/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
13070#[derive(Clone, Default, PartialEq)]
13071#[non_exhaustive]
13072pub struct CreateProcessorRequest {
13073 /// Required. The parent (project and location) under which to create the
13074 /// processor. Format: `projects/{project}/locations/{location}`
13075 pub parent: std::string::String,
13076
13077 /// Required. The processor to be created, requires
13078 /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
13079 /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
13080 /// to be set. Also, the
13081 /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
13082 /// field must be set if the processor is under CMEK.
13083 ///
13084 /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
13085 /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
13086 /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
13087 pub processor: std::option::Option<crate::model::Processor>,
13088
13089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13090}
13091
13092impl CreateProcessorRequest {
13093 /// Creates a new default instance.
13094 pub fn new() -> Self {
13095 std::default::Default::default()
13096 }
13097
13098 /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
13099 ///
13100 /// # Example
13101 /// ```ignore,no_run
13102 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13103 /// # let project_id = "project_id";
13104 /// # let location_id = "location_id";
13105 /// let x = CreateProcessorRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
13106 /// ```
13107 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13108 self.parent = v.into();
13109 self
13110 }
13111
13112 /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
13113 ///
13114 /// # Example
13115 /// ```ignore,no_run
13116 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13117 /// use google_cloud_documentai_v1::model::Processor;
13118 /// let x = CreateProcessorRequest::new().set_processor(Processor::default()/* use setters */);
13119 /// ```
13120 pub fn set_processor<T>(mut self, v: T) -> Self
13121 where
13122 T: std::convert::Into<crate::model::Processor>,
13123 {
13124 self.processor = std::option::Option::Some(v.into());
13125 self
13126 }
13127
13128 /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
13129 ///
13130 /// # Example
13131 /// ```ignore,no_run
13132 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13133 /// use google_cloud_documentai_v1::model::Processor;
13134 /// let x = CreateProcessorRequest::new().set_or_clear_processor(Some(Processor::default()/* use setters */));
13135 /// let x = CreateProcessorRequest::new().set_or_clear_processor(None::<Processor>);
13136 /// ```
13137 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
13138 where
13139 T: std::convert::Into<crate::model::Processor>,
13140 {
13141 self.processor = v.map(|x| x.into());
13142 self
13143 }
13144}
13145
13146impl wkt::message::Message for CreateProcessorRequest {
13147 fn typename() -> &'static str {
13148 "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
13149 }
13150}
13151
13152/// Request message for the
13153/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13154/// method.
13155///
13156/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13157#[derive(Clone, Default, PartialEq)]
13158#[non_exhaustive]
13159pub struct DeleteProcessorRequest {
13160 /// Required. The processor resource name to be deleted.
13161 pub name: std::string::String,
13162
13163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13164}
13165
13166impl DeleteProcessorRequest {
13167 /// Creates a new default instance.
13168 pub fn new() -> Self {
13169 std::default::Default::default()
13170 }
13171
13172 /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
13173 ///
13174 /// # Example
13175 /// ```ignore,no_run
13176 /// # use google_cloud_documentai_v1::model::DeleteProcessorRequest;
13177 /// # let project_id = "project_id";
13178 /// # let location_id = "location_id";
13179 /// # let processor_id = "processor_id";
13180 /// let x = DeleteProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13181 /// ```
13182 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13183 self.name = v.into();
13184 self
13185 }
13186}
13187
13188impl wkt::message::Message for DeleteProcessorRequest {
13189 fn typename() -> &'static str {
13190 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
13191 }
13192}
13193
13194/// The long-running operation metadata for the
13195/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13196/// method.
13197///
13198/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13199#[derive(Clone, Default, PartialEq)]
13200#[non_exhaustive]
13201pub struct DeleteProcessorMetadata {
13202 /// The basic metadata of the long-running operation.
13203 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13204
13205 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13206}
13207
13208impl DeleteProcessorMetadata {
13209 /// Creates a new default instance.
13210 pub fn new() -> Self {
13211 std::default::Default::default()
13212 }
13213
13214 /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13215 ///
13216 /// # Example
13217 /// ```ignore,no_run
13218 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13219 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13220 /// let x = DeleteProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13221 /// ```
13222 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13223 where
13224 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13225 {
13226 self.common_metadata = std::option::Option::Some(v.into());
13227 self
13228 }
13229
13230 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13231 ///
13232 /// # Example
13233 /// ```ignore,no_run
13234 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13235 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13236 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13237 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13238 /// ```
13239 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13240 where
13241 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13242 {
13243 self.common_metadata = v.map(|x| x.into());
13244 self
13245 }
13246}
13247
13248impl wkt::message::Message for DeleteProcessorMetadata {
13249 fn typename() -> &'static str {
13250 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
13251 }
13252}
13253
13254/// Request message for the
13255/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13256/// method.
13257///
13258/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13259#[derive(Clone, Default, PartialEq)]
13260#[non_exhaustive]
13261pub struct EnableProcessorRequest {
13262 /// Required. The processor resource name to be enabled.
13263 pub name: std::string::String,
13264
13265 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13266}
13267
13268impl EnableProcessorRequest {
13269 /// Creates a new default instance.
13270 pub fn new() -> Self {
13271 std::default::Default::default()
13272 }
13273
13274 /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
13275 ///
13276 /// # Example
13277 /// ```ignore,no_run
13278 /// # use google_cloud_documentai_v1::model::EnableProcessorRequest;
13279 /// # let project_id = "project_id";
13280 /// # let location_id = "location_id";
13281 /// # let processor_id = "processor_id";
13282 /// let x = EnableProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13283 /// ```
13284 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13285 self.name = v.into();
13286 self
13287 }
13288}
13289
13290impl wkt::message::Message for EnableProcessorRequest {
13291 fn typename() -> &'static str {
13292 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
13293 }
13294}
13295
13296/// Response message for the
13297/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13298/// method. Intentionally empty proto for adding fields in future.
13299///
13300/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13301#[derive(Clone, Default, PartialEq)]
13302#[non_exhaustive]
13303pub struct EnableProcessorResponse {
13304 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13305}
13306
13307impl EnableProcessorResponse {
13308 /// Creates a new default instance.
13309 pub fn new() -> Self {
13310 std::default::Default::default()
13311 }
13312}
13313
13314impl wkt::message::Message for EnableProcessorResponse {
13315 fn typename() -> &'static str {
13316 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
13317 }
13318}
13319
13320/// The long-running operation metadata for the
13321/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13322/// method.
13323///
13324/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13325#[derive(Clone, Default, PartialEq)]
13326#[non_exhaustive]
13327pub struct EnableProcessorMetadata {
13328 /// The basic metadata of the long-running operation.
13329 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13330
13331 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13332}
13333
13334impl EnableProcessorMetadata {
13335 /// Creates a new default instance.
13336 pub fn new() -> Self {
13337 std::default::Default::default()
13338 }
13339
13340 /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13341 ///
13342 /// # Example
13343 /// ```ignore,no_run
13344 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13345 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13346 /// let x = EnableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13347 /// ```
13348 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13349 where
13350 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13351 {
13352 self.common_metadata = std::option::Option::Some(v.into());
13353 self
13354 }
13355
13356 /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13357 ///
13358 /// # Example
13359 /// ```ignore,no_run
13360 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13361 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13362 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13363 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13364 /// ```
13365 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13366 where
13367 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13368 {
13369 self.common_metadata = v.map(|x| x.into());
13370 self
13371 }
13372}
13373
13374impl wkt::message::Message for EnableProcessorMetadata {
13375 fn typename() -> &'static str {
13376 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
13377 }
13378}
13379
13380/// Request message for the
13381/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13382/// method.
13383///
13384/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13385#[derive(Clone, Default, PartialEq)]
13386#[non_exhaustive]
13387pub struct DisableProcessorRequest {
13388 /// Required. The processor resource name to be disabled.
13389 pub name: std::string::String,
13390
13391 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13392}
13393
13394impl DisableProcessorRequest {
13395 /// Creates a new default instance.
13396 pub fn new() -> Self {
13397 std::default::Default::default()
13398 }
13399
13400 /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
13401 ///
13402 /// # Example
13403 /// ```ignore,no_run
13404 /// # use google_cloud_documentai_v1::model::DisableProcessorRequest;
13405 /// # let project_id = "project_id";
13406 /// # let location_id = "location_id";
13407 /// # let processor_id = "processor_id";
13408 /// let x = DisableProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13409 /// ```
13410 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13411 self.name = v.into();
13412 self
13413 }
13414}
13415
13416impl wkt::message::Message for DisableProcessorRequest {
13417 fn typename() -> &'static str {
13418 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
13419 }
13420}
13421
13422/// Response message for the
13423/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13424/// method. Intentionally empty proto for adding fields in future.
13425///
13426/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13427#[derive(Clone, Default, PartialEq)]
13428#[non_exhaustive]
13429pub struct DisableProcessorResponse {
13430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13431}
13432
13433impl DisableProcessorResponse {
13434 /// Creates a new default instance.
13435 pub fn new() -> Self {
13436 std::default::Default::default()
13437 }
13438}
13439
13440impl wkt::message::Message for DisableProcessorResponse {
13441 fn typename() -> &'static str {
13442 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
13443 }
13444}
13445
13446/// The long-running operation metadata for the
13447/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13448/// method.
13449///
13450/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13451#[derive(Clone, Default, PartialEq)]
13452#[non_exhaustive]
13453pub struct DisableProcessorMetadata {
13454 /// The basic metadata of the long-running operation.
13455 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13456
13457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13458}
13459
13460impl DisableProcessorMetadata {
13461 /// Creates a new default instance.
13462 pub fn new() -> Self {
13463 std::default::Default::default()
13464 }
13465
13466 /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13467 ///
13468 /// # Example
13469 /// ```ignore,no_run
13470 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13471 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13472 /// let x = DisableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13473 /// ```
13474 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13475 where
13476 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13477 {
13478 self.common_metadata = std::option::Option::Some(v.into());
13479 self
13480 }
13481
13482 /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13483 ///
13484 /// # Example
13485 /// ```ignore,no_run
13486 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13487 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13488 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13489 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13490 /// ```
13491 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13492 where
13493 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13494 {
13495 self.common_metadata = v.map(|x| x.into());
13496 self
13497 }
13498}
13499
13500impl wkt::message::Message for DisableProcessorMetadata {
13501 fn typename() -> &'static str {
13502 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
13503 }
13504}
13505
13506/// Request message for the
13507/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13508/// method.
13509///
13510/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13511#[derive(Clone, Default, PartialEq)]
13512#[non_exhaustive]
13513pub struct SetDefaultProcessorVersionRequest {
13514 /// Required. The resource name of the
13515 /// [Processor][google.cloud.documentai.v1.Processor] to change default
13516 /// version.
13517 ///
13518 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
13519 pub processor: std::string::String,
13520
13521 /// Required. The resource name of child
13522 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
13523 /// default. Format:
13524 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
13525 ///
13526 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13527 pub default_processor_version: std::string::String,
13528
13529 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13530}
13531
13532impl SetDefaultProcessorVersionRequest {
13533 /// Creates a new default instance.
13534 pub fn new() -> Self {
13535 std::default::Default::default()
13536 }
13537
13538 /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
13539 ///
13540 /// # Example
13541 /// ```ignore,no_run
13542 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13543 /// # let project_id = "project_id";
13544 /// # let location_id = "location_id";
13545 /// # let processor_id = "processor_id";
13546 /// let x = SetDefaultProcessorVersionRequest::new().set_processor(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13547 /// ```
13548 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13549 self.processor = v.into();
13550 self
13551 }
13552
13553 /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
13554 ///
13555 /// # Example
13556 /// ```ignore,no_run
13557 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13558 /// # let project_id = "project_id";
13559 /// # let location_id = "location_id";
13560 /// # let processor_id = "processor_id";
13561 /// # let processor_version_id = "processor_version_id";
13562 /// let x = SetDefaultProcessorVersionRequest::new().set_default_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
13563 /// ```
13564 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
13565 mut self,
13566 v: T,
13567 ) -> Self {
13568 self.default_processor_version = v.into();
13569 self
13570 }
13571}
13572
13573impl wkt::message::Message for SetDefaultProcessorVersionRequest {
13574 fn typename() -> &'static str {
13575 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
13576 }
13577}
13578
13579/// Response message for the
13580/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13581/// method.
13582///
13583/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13584#[derive(Clone, Default, PartialEq)]
13585#[non_exhaustive]
13586pub struct SetDefaultProcessorVersionResponse {
13587 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13588}
13589
13590impl SetDefaultProcessorVersionResponse {
13591 /// Creates a new default instance.
13592 pub fn new() -> Self {
13593 std::default::Default::default()
13594 }
13595}
13596
13597impl wkt::message::Message for SetDefaultProcessorVersionResponse {
13598 fn typename() -> &'static str {
13599 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
13600 }
13601}
13602
13603/// The long-running operation metadata for the
13604/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13605/// method.
13606///
13607/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13608#[derive(Clone, Default, PartialEq)]
13609#[non_exhaustive]
13610pub struct SetDefaultProcessorVersionMetadata {
13611 /// The basic metadata of the long-running operation.
13612 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13613
13614 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13615}
13616
13617impl SetDefaultProcessorVersionMetadata {
13618 /// Creates a new default instance.
13619 pub fn new() -> Self {
13620 std::default::Default::default()
13621 }
13622
13623 /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13624 ///
13625 /// # Example
13626 /// ```ignore,no_run
13627 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13628 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13629 /// let x = SetDefaultProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13630 /// ```
13631 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13632 where
13633 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13634 {
13635 self.common_metadata = std::option::Option::Some(v.into());
13636 self
13637 }
13638
13639 /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13640 ///
13641 /// # Example
13642 /// ```ignore,no_run
13643 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13644 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13645 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13646 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13647 /// ```
13648 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13649 where
13650 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13651 {
13652 self.common_metadata = v.map(|x| x.into());
13653 self
13654 }
13655}
13656
13657impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
13658 fn typename() -> &'static str {
13659 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
13660 }
13661}
13662
13663/// Request message for the
13664/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
13665/// method.
13666///
13667/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
13668#[derive(Clone, Default, PartialEq)]
13669#[non_exhaustive]
13670pub struct TrainProcessorVersionRequest {
13671 /// Required. The parent (project, location and processor) to create the new
13672 /// version for. Format:
13673 /// `projects/{project}/locations/{location}/processors/{processor}`.
13674 pub parent: std::string::String,
13675
13676 /// Required. The processor version to be created.
13677 pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
13678
13679 /// Optional. The schema the processor version will be trained with.
13680 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
13681
13682 /// Optional. The input data used to train the
13683 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13684 ///
13685 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13686 pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
13687
13688 /// Optional. The processor version to use as a base for training. This
13689 /// processor version must be a child of `parent`. Format:
13690 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
13691 pub base_processor_version: std::string::String,
13692
13693 #[allow(missing_docs)]
13694 pub processor_flags:
13695 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13696
13697 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13698}
13699
13700impl TrainProcessorVersionRequest {
13701 /// Creates a new default instance.
13702 pub fn new() -> Self {
13703 std::default::Default::default()
13704 }
13705
13706 /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
13707 ///
13708 /// # Example
13709 /// ```ignore,no_run
13710 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13711 /// # let project_id = "project_id";
13712 /// # let location_id = "location_id";
13713 /// # let processor_id = "processor_id";
13714 /// let x = TrainProcessorVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13715 /// ```
13716 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13717 self.parent = v.into();
13718 self
13719 }
13720
13721 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13722 ///
13723 /// # Example
13724 /// ```ignore,no_run
13725 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13726 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13727 /// let x = TrainProcessorVersionRequest::new().set_processor_version(ProcessorVersion::default()/* use setters */);
13728 /// ```
13729 pub fn set_processor_version<T>(mut self, v: T) -> Self
13730 where
13731 T: std::convert::Into<crate::model::ProcessorVersion>,
13732 {
13733 self.processor_version = std::option::Option::Some(v.into());
13734 self
13735 }
13736
13737 /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13738 ///
13739 /// # Example
13740 /// ```ignore,no_run
13741 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13742 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13743 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(Some(ProcessorVersion::default()/* use setters */));
13744 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(None::<ProcessorVersion>);
13745 /// ```
13746 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
13747 where
13748 T: std::convert::Into<crate::model::ProcessorVersion>,
13749 {
13750 self.processor_version = v.map(|x| x.into());
13751 self
13752 }
13753
13754 /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13755 ///
13756 /// # Example
13757 /// ```ignore,no_run
13758 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13759 /// use google_cloud_documentai_v1::model::DocumentSchema;
13760 /// let x = TrainProcessorVersionRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
13761 /// ```
13762 pub fn set_document_schema<T>(mut self, v: T) -> Self
13763 where
13764 T: std::convert::Into<crate::model::DocumentSchema>,
13765 {
13766 self.document_schema = std::option::Option::Some(v.into());
13767 self
13768 }
13769
13770 /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13771 ///
13772 /// # Example
13773 /// ```ignore,no_run
13774 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13775 /// use google_cloud_documentai_v1::model::DocumentSchema;
13776 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
13777 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
13778 /// ```
13779 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
13780 where
13781 T: std::convert::Into<crate::model::DocumentSchema>,
13782 {
13783 self.document_schema = v.map(|x| x.into());
13784 self
13785 }
13786
13787 /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13788 ///
13789 /// # Example
13790 /// ```ignore,no_run
13791 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13792 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13793 /// let x = TrainProcessorVersionRequest::new().set_input_data(InputData::default()/* use setters */);
13794 /// ```
13795 pub fn set_input_data<T>(mut self, v: T) -> Self
13796 where
13797 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13798 {
13799 self.input_data = std::option::Option::Some(v.into());
13800 self
13801 }
13802
13803 /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13804 ///
13805 /// # Example
13806 /// ```ignore,no_run
13807 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13808 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13809 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(Some(InputData::default()/* use setters */));
13810 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(None::<InputData>);
13811 /// ```
13812 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
13813 where
13814 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13815 {
13816 self.input_data = v.map(|x| x.into());
13817 self
13818 }
13819
13820 /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
13821 ///
13822 /// # Example
13823 /// ```ignore,no_run
13824 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13825 /// let x = TrainProcessorVersionRequest::new().set_base_processor_version("example");
13826 /// ```
13827 pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
13828 mut self,
13829 v: T,
13830 ) -> Self {
13831 self.base_processor_version = v.into();
13832 self
13833 }
13834
13835 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
13836 ///
13837 /// Note that all the setters affecting `processor_flags` are mutually
13838 /// exclusive.
13839 ///
13840 /// # Example
13841 /// ```ignore,no_run
13842 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13843 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13844 /// let x = TrainProcessorVersionRequest::new().set_processor_flags(Some(
13845 /// google_cloud_documentai_v1::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(CustomDocumentExtractionOptions::default().into())));
13846 /// ```
13847 pub fn set_processor_flags<
13848 T: std::convert::Into<
13849 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13850 >,
13851 >(
13852 mut self,
13853 v: T,
13854 ) -> Self {
13855 self.processor_flags = v.into();
13856 self
13857 }
13858
13859 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13860 /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
13861 /// holds a different branch.
13862 pub fn custom_document_extraction_options(
13863 &self,
13864 ) -> std::option::Option<
13865 &std::boxed::Box<
13866 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13867 >,
13868 > {
13869 #[allow(unreachable_patterns)]
13870 self.processor_flags.as_ref().and_then(|v| match v {
13871 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
13872 _ => std::option::Option::None,
13873 })
13874 }
13875
13876 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13877 /// to hold a `CustomDocumentExtractionOptions`.
13878 ///
13879 /// Note that all the setters affecting `processor_flags` are
13880 /// mutually exclusive.
13881 ///
13882 /// # Example
13883 /// ```ignore,no_run
13884 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13885 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13886 /// let x = TrainProcessorVersionRequest::new().set_custom_document_extraction_options(CustomDocumentExtractionOptions::default()/* use setters */);
13887 /// assert!(x.custom_document_extraction_options().is_some());
13888 /// assert!(x.foundation_model_tuning_options().is_none());
13889 /// ```
13890 pub fn set_custom_document_extraction_options<
13891 T: std::convert::Into<
13892 std::boxed::Box<
13893 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13894 >,
13895 >,
13896 >(
13897 mut self,
13898 v: T,
13899 ) -> Self {
13900 self.processor_flags = std::option::Option::Some(
13901 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
13902 v.into()
13903 )
13904 );
13905 self
13906 }
13907
13908 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13909 /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
13910 /// holds a different branch.
13911 pub fn foundation_model_tuning_options(
13912 &self,
13913 ) -> std::option::Option<
13914 &std::boxed::Box<
13915 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13916 >,
13917 > {
13918 #[allow(unreachable_patterns)]
13919 self.processor_flags.as_ref().and_then(|v| match v {
13920 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
13921 _ => std::option::Option::None,
13922 })
13923 }
13924
13925 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13926 /// to hold a `FoundationModelTuningOptions`.
13927 ///
13928 /// Note that all the setters affecting `processor_flags` are
13929 /// mutually exclusive.
13930 ///
13931 /// # Example
13932 /// ```ignore,no_run
13933 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13934 /// use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13935 /// let x = TrainProcessorVersionRequest::new().set_foundation_model_tuning_options(FoundationModelTuningOptions::default()/* use setters */);
13936 /// assert!(x.foundation_model_tuning_options().is_some());
13937 /// assert!(x.custom_document_extraction_options().is_none());
13938 /// ```
13939 pub fn set_foundation_model_tuning_options<
13940 T: std::convert::Into<
13941 std::boxed::Box<
13942 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13943 >,
13944 >,
13945 >(
13946 mut self,
13947 v: T,
13948 ) -> Self {
13949 self.processor_flags = std::option::Option::Some(
13950 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
13951 v.into()
13952 )
13953 );
13954 self
13955 }
13956}
13957
13958impl wkt::message::Message for TrainProcessorVersionRequest {
13959 fn typename() -> &'static str {
13960 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
13961 }
13962}
13963
13964/// Defines additional types related to [TrainProcessorVersionRequest].
13965pub mod train_processor_version_request {
13966 #[allow(unused_imports)]
13967 use super::*;
13968
13969 /// The input data used to train a new
13970 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13971 ///
13972 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13973 #[derive(Clone, Default, PartialEq)]
13974 #[non_exhaustive]
13975 pub struct InputData {
13976 /// The documents used for training the new version.
13977 pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13978
13979 /// The documents used for testing the trained version.
13980 pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13981
13982 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13983 }
13984
13985 impl InputData {
13986 /// Creates a new default instance.
13987 pub fn new() -> Self {
13988 std::default::Default::default()
13989 }
13990
13991 /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
13992 ///
13993 /// # Example
13994 /// ```ignore,no_run
13995 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13996 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13997 /// let x = InputData::new().set_training_documents(BatchDocumentsInputConfig::default()/* use setters */);
13998 /// ```
13999 pub fn set_training_documents<T>(mut self, v: T) -> Self
14000 where
14001 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14002 {
14003 self.training_documents = std::option::Option::Some(v.into());
14004 self
14005 }
14006
14007 /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
14008 ///
14009 /// # Example
14010 /// ```ignore,no_run
14011 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
14012 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14013 /// let x = InputData::new().set_or_clear_training_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
14014 /// let x = InputData::new().set_or_clear_training_documents(None::<BatchDocumentsInputConfig>);
14015 /// ```
14016 pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
14017 where
14018 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14019 {
14020 self.training_documents = v.map(|x| x.into());
14021 self
14022 }
14023
14024 /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
14025 ///
14026 /// # Example
14027 /// ```ignore,no_run
14028 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
14029 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14030 /// let x = InputData::new().set_test_documents(BatchDocumentsInputConfig::default()/* use setters */);
14031 /// ```
14032 pub fn set_test_documents<T>(mut self, v: T) -> Self
14033 where
14034 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14035 {
14036 self.test_documents = std::option::Option::Some(v.into());
14037 self
14038 }
14039
14040 /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
14041 ///
14042 /// # Example
14043 /// ```ignore,no_run
14044 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
14045 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14046 /// let x = InputData::new().set_or_clear_test_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
14047 /// let x = InputData::new().set_or_clear_test_documents(None::<BatchDocumentsInputConfig>);
14048 /// ```
14049 pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
14050 where
14051 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14052 {
14053 self.test_documents = v.map(|x| x.into());
14054 self
14055 }
14056 }
14057
14058 impl wkt::message::Message for InputData {
14059 fn typename() -> &'static str {
14060 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
14061 }
14062 }
14063
14064 /// Options to control the training of the Custom Document Extraction (CDE)
14065 /// Processor.
14066 #[derive(Clone, Default, PartialEq)]
14067 #[non_exhaustive]
14068 pub struct CustomDocumentExtractionOptions {
14069
14070 /// Optional. Training method to use for CDE training.
14071 pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
14072
14073 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14074 }
14075
14076 impl CustomDocumentExtractionOptions {
14077 /// Creates a new default instance.
14078 pub fn new() -> Self {
14079 std::default::Default::default()
14080 }
14081
14082 /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
14083 ///
14084 /// # Example
14085 /// ```ignore,no_run
14086 /// # use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
14087 /// use google_cloud_documentai_v1::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod;
14088 /// let x0 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::ModelBased);
14089 /// let x1 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::TemplateBased);
14090 /// ```
14091 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{
14092 self.training_method = v.into();
14093 self
14094 }
14095 }
14096
14097 impl wkt::message::Message for CustomDocumentExtractionOptions {
14098 fn typename() -> &'static str {
14099 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
14100 }
14101 }
14102
14103 /// Defines additional types related to [CustomDocumentExtractionOptions].
14104 pub mod custom_document_extraction_options {
14105 #[allow(unused_imports)]
14106 use super::*;
14107
14108 /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
14109 /// `MODEL_BASED`.
14110 ///
14111 /// # Working with unknown values
14112 ///
14113 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14114 /// additional enum variants at any time. Adding new variants is not considered
14115 /// a breaking change. Applications should write their code in anticipation of:
14116 ///
14117 /// - New values appearing in future releases of the client library, **and**
14118 /// - New values received dynamically, without application changes.
14119 ///
14120 /// Please consult the [Working with enums] section in the user guide for some
14121 /// guidelines.
14122 ///
14123 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14124 #[derive(Clone, Debug, PartialEq)]
14125 #[non_exhaustive]
14126 pub enum TrainingMethod {
14127 #[allow(missing_docs)]
14128 Unspecified,
14129 #[allow(missing_docs)]
14130 ModelBased,
14131 #[allow(missing_docs)]
14132 TemplateBased,
14133 /// If set, the enum was initialized with an unknown value.
14134 ///
14135 /// Applications can examine the value using [TrainingMethod::value] or
14136 /// [TrainingMethod::name].
14137 UnknownValue(training_method::UnknownValue),
14138 }
14139
14140 #[doc(hidden)]
14141 pub mod training_method {
14142 #[allow(unused_imports)]
14143 use super::*;
14144 #[derive(Clone, Debug, PartialEq)]
14145 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14146 }
14147
14148 impl TrainingMethod {
14149 /// Gets the enum value.
14150 ///
14151 /// Returns `None` if the enum contains an unknown value deserialized from
14152 /// the string representation of enums.
14153 pub fn value(&self) -> std::option::Option<i32> {
14154 match self {
14155 Self::Unspecified => std::option::Option::Some(0),
14156 Self::ModelBased => std::option::Option::Some(1),
14157 Self::TemplateBased => std::option::Option::Some(2),
14158 Self::UnknownValue(u) => u.0.value(),
14159 }
14160 }
14161
14162 /// Gets the enum value as a string.
14163 ///
14164 /// Returns `None` if the enum contains an unknown value deserialized from
14165 /// the integer representation of enums.
14166 pub fn name(&self) -> std::option::Option<&str> {
14167 match self {
14168 Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
14169 Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
14170 Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
14171 Self::UnknownValue(u) => u.0.name(),
14172 }
14173 }
14174 }
14175
14176 impl std::default::Default for TrainingMethod {
14177 fn default() -> Self {
14178 use std::convert::From;
14179 Self::from(0)
14180 }
14181 }
14182
14183 impl std::fmt::Display for TrainingMethod {
14184 fn fmt(
14185 &self,
14186 f: &mut std::fmt::Formatter<'_>,
14187 ) -> std::result::Result<(), std::fmt::Error> {
14188 wkt::internal::display_enum(f, self.name(), self.value())
14189 }
14190 }
14191
14192 impl std::convert::From<i32> for TrainingMethod {
14193 fn from(value: i32) -> Self {
14194 match value {
14195 0 => Self::Unspecified,
14196 1 => Self::ModelBased,
14197 2 => Self::TemplateBased,
14198 _ => Self::UnknownValue(training_method::UnknownValue(
14199 wkt::internal::UnknownEnumValue::Integer(value),
14200 )),
14201 }
14202 }
14203 }
14204
14205 impl std::convert::From<&str> for TrainingMethod {
14206 fn from(value: &str) -> Self {
14207 use std::string::ToString;
14208 match value {
14209 "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
14210 "MODEL_BASED" => Self::ModelBased,
14211 "TEMPLATE_BASED" => Self::TemplateBased,
14212 _ => Self::UnknownValue(training_method::UnknownValue(
14213 wkt::internal::UnknownEnumValue::String(value.to_string()),
14214 )),
14215 }
14216 }
14217 }
14218
14219 impl serde::ser::Serialize for TrainingMethod {
14220 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14221 where
14222 S: serde::Serializer,
14223 {
14224 match self {
14225 Self::Unspecified => serializer.serialize_i32(0),
14226 Self::ModelBased => serializer.serialize_i32(1),
14227 Self::TemplateBased => serializer.serialize_i32(2),
14228 Self::UnknownValue(u) => u.0.serialize(serializer),
14229 }
14230 }
14231 }
14232
14233 impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
14234 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14235 where
14236 D: serde::Deserializer<'de>,
14237 {
14238 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
14239 ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
14240 }
14241 }
14242 }
14243
14244 /// Options to control foundation model tuning of the processor.
14245 #[derive(Clone, Default, PartialEq)]
14246 #[non_exhaustive]
14247 pub struct FoundationModelTuningOptions {
14248 /// Optional. The number of steps to run for model tuning. Valid values are
14249 /// between 1 and 400. If not provided, recommended steps will be used.
14250 pub train_steps: i32,
14251
14252 /// Optional. The multiplier to apply to the recommended learning rate. Valid
14253 /// values are between 0.1 and 10. If not provided, recommended learning rate
14254 /// will be used.
14255 pub learning_rate_multiplier: f32,
14256
14257 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14258 }
14259
14260 impl FoundationModelTuningOptions {
14261 /// Creates a new default instance.
14262 pub fn new() -> Self {
14263 std::default::Default::default()
14264 }
14265
14266 /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
14267 ///
14268 /// # Example
14269 /// ```ignore,no_run
14270 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14271 /// let x = FoundationModelTuningOptions::new().set_train_steps(42);
14272 /// ```
14273 pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14274 self.train_steps = v.into();
14275 self
14276 }
14277
14278 /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
14279 ///
14280 /// # Example
14281 /// ```ignore,no_run
14282 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14283 /// let x = FoundationModelTuningOptions::new().set_learning_rate_multiplier(42.0);
14284 /// ```
14285 pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14286 self.learning_rate_multiplier = v.into();
14287 self
14288 }
14289 }
14290
14291 impl wkt::message::Message for FoundationModelTuningOptions {
14292 fn typename() -> &'static str {
14293 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
14294 }
14295 }
14296
14297 #[allow(missing_docs)]
14298 #[derive(Clone, Debug, PartialEq)]
14299 #[non_exhaustive]
14300 pub enum ProcessorFlags {
14301 /// Options to control Custom Document Extraction (CDE) Processor.
14302 CustomDocumentExtractionOptions(
14303 std::boxed::Box<
14304 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
14305 >,
14306 ),
14307 /// Options to control foundation model tuning of a processor.
14308 FoundationModelTuningOptions(
14309 std::boxed::Box<
14310 crate::model::train_processor_version_request::FoundationModelTuningOptions,
14311 >,
14312 ),
14313 }
14314}
14315
14316/// The response for
14317/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
14318///
14319/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
14320#[derive(Clone, Default, PartialEq)]
14321#[non_exhaustive]
14322pub struct TrainProcessorVersionResponse {
14323 /// The resource name of the processor version produced by training.
14324 pub processor_version: std::string::String,
14325
14326 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14327}
14328
14329impl TrainProcessorVersionResponse {
14330 /// Creates a new default instance.
14331 pub fn new() -> Self {
14332 std::default::Default::default()
14333 }
14334
14335 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
14336 ///
14337 /// # Example
14338 /// ```ignore,no_run
14339 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionResponse;
14340 /// let x = TrainProcessorVersionResponse::new().set_processor_version("example");
14341 /// ```
14342 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
14343 mut self,
14344 v: T,
14345 ) -> Self {
14346 self.processor_version = v.into();
14347 self
14348 }
14349}
14350
14351impl wkt::message::Message for TrainProcessorVersionResponse {
14352 fn typename() -> &'static str {
14353 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
14354 }
14355}
14356
14357/// The metadata that represents a processor version being created.
14358#[derive(Clone, Default, PartialEq)]
14359#[non_exhaustive]
14360pub struct TrainProcessorVersionMetadata {
14361 /// The basic metadata of the long-running operation.
14362 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14363
14364 /// The training dataset validation information.
14365 pub training_dataset_validation:
14366 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14367
14368 /// The test dataset validation information.
14369 pub test_dataset_validation:
14370 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14371
14372 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14373}
14374
14375impl TrainProcessorVersionMetadata {
14376 /// Creates a new default instance.
14377 pub fn new() -> Self {
14378 std::default::Default::default()
14379 }
14380
14381 /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14382 ///
14383 /// # Example
14384 /// ```ignore,no_run
14385 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14386 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14387 /// let x = TrainProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14388 /// ```
14389 pub fn set_common_metadata<T>(mut self, v: T) -> Self
14390 where
14391 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14392 {
14393 self.common_metadata = std::option::Option::Some(v.into());
14394 self
14395 }
14396
14397 /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14398 ///
14399 /// # Example
14400 /// ```ignore,no_run
14401 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14402 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14403 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14404 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14405 /// ```
14406 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14407 where
14408 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14409 {
14410 self.common_metadata = v.map(|x| x.into());
14411 self
14412 }
14413
14414 /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14415 ///
14416 /// # Example
14417 /// ```ignore,no_run
14418 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14419 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14420 /// let x = TrainProcessorVersionMetadata::new().set_training_dataset_validation(DatasetValidation::default()/* use setters */);
14421 /// ```
14422 pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
14423 where
14424 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14425 {
14426 self.training_dataset_validation = std::option::Option::Some(v.into());
14427 self
14428 }
14429
14430 /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14431 ///
14432 /// # Example
14433 /// ```ignore,no_run
14434 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14435 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14436 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14437 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(None::<DatasetValidation>);
14438 /// ```
14439 pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14440 where
14441 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14442 {
14443 self.training_dataset_validation = v.map(|x| x.into());
14444 self
14445 }
14446
14447 /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14448 ///
14449 /// # Example
14450 /// ```ignore,no_run
14451 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14452 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14453 /// let x = TrainProcessorVersionMetadata::new().set_test_dataset_validation(DatasetValidation::default()/* use setters */);
14454 /// ```
14455 pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
14456 where
14457 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14458 {
14459 self.test_dataset_validation = std::option::Option::Some(v.into());
14460 self
14461 }
14462
14463 /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14464 ///
14465 /// # Example
14466 /// ```ignore,no_run
14467 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14468 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14469 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14470 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(None::<DatasetValidation>);
14471 /// ```
14472 pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14473 where
14474 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14475 {
14476 self.test_dataset_validation = v.map(|x| x.into());
14477 self
14478 }
14479}
14480
14481impl wkt::message::Message for TrainProcessorVersionMetadata {
14482 fn typename() -> &'static str {
14483 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
14484 }
14485}
14486
14487/// Defines additional types related to [TrainProcessorVersionMetadata].
14488pub mod train_processor_version_metadata {
14489 #[allow(unused_imports)]
14490 use super::*;
14491
14492 /// The dataset validation information.
14493 /// This includes any and all errors with documents and the dataset.
14494 #[derive(Clone, Default, PartialEq)]
14495 #[non_exhaustive]
14496 pub struct DatasetValidation {
14497 /// The total number of document errors.
14498 pub document_error_count: i32,
14499
14500 /// The total number of dataset errors.
14501 pub dataset_error_count: i32,
14502
14503 /// Error information pertaining to specific documents. A maximum of 10
14504 /// document errors will be returned.
14505 /// Any document with errors will not be used throughout training.
14506 pub document_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14507
14508 /// Error information for the dataset as a whole. A maximum of 10 dataset
14509 /// errors will be returned.
14510 /// A single dataset error is terminal for training.
14511 pub dataset_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14512
14513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14514 }
14515
14516 impl DatasetValidation {
14517 /// Creates a new default instance.
14518 pub fn new() -> Self {
14519 std::default::Default::default()
14520 }
14521
14522 /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
14523 ///
14524 /// # Example
14525 /// ```ignore,no_run
14526 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14527 /// let x = DatasetValidation::new().set_document_error_count(42);
14528 /// ```
14529 pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14530 self.document_error_count = v.into();
14531 self
14532 }
14533
14534 /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
14535 ///
14536 /// # Example
14537 /// ```ignore,no_run
14538 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14539 /// let x = DatasetValidation::new().set_dataset_error_count(42);
14540 /// ```
14541 pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14542 self.dataset_error_count = v.into();
14543 self
14544 }
14545
14546 /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
14547 ///
14548 /// # Example
14549 /// ```ignore,no_run
14550 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14551 /// use google_cloud_rpc::model::Status;
14552 /// let x = DatasetValidation::new()
14553 /// .set_document_errors([
14554 /// Status::default()/* use setters */,
14555 /// Status::default()/* use (different) setters */,
14556 /// ]);
14557 /// ```
14558 pub fn set_document_errors<T, V>(mut self, v: T) -> Self
14559 where
14560 T: std::iter::IntoIterator<Item = V>,
14561 V: std::convert::Into<google_cloud_rpc::model::Status>,
14562 {
14563 use std::iter::Iterator;
14564 self.document_errors = v.into_iter().map(|i| i.into()).collect();
14565 self
14566 }
14567
14568 /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
14569 ///
14570 /// # Example
14571 /// ```ignore,no_run
14572 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14573 /// use google_cloud_rpc::model::Status;
14574 /// let x = DatasetValidation::new()
14575 /// .set_dataset_errors([
14576 /// Status::default()/* use setters */,
14577 /// Status::default()/* use (different) setters */,
14578 /// ]);
14579 /// ```
14580 pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
14581 where
14582 T: std::iter::IntoIterator<Item = V>,
14583 V: std::convert::Into<google_cloud_rpc::model::Status>,
14584 {
14585 use std::iter::Iterator;
14586 self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
14587 self
14588 }
14589 }
14590
14591 impl wkt::message::Message for DatasetValidation {
14592 fn typename() -> &'static str {
14593 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
14594 }
14595 }
14596}
14597
14598/// Request message for the
14599/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14600/// method.
14601///
14602/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14603#[derive(Clone, Default, PartialEq)]
14604#[non_exhaustive]
14605pub struct ReviewDocumentRequest {
14606 /// Required. The resource name of the
14607 /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
14608 /// document will be reviewed with.
14609 pub human_review_config: std::string::String,
14610
14611 /// Whether the validation should be performed on the ad-hoc review request.
14612 pub enable_schema_validation: bool,
14613
14614 /// The priority of the human review task.
14615 pub priority: crate::model::review_document_request::Priority,
14616
14617 /// The document schema of the human review task.
14618 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
14619
14620 /// The document payload.
14621 pub source: std::option::Option<crate::model::review_document_request::Source>,
14622
14623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14624}
14625
14626impl ReviewDocumentRequest {
14627 /// Creates a new default instance.
14628 pub fn new() -> Self {
14629 std::default::Default::default()
14630 }
14631
14632 /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
14633 ///
14634 /// # Example
14635 /// ```ignore,no_run
14636 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14637 /// let x = ReviewDocumentRequest::new().set_human_review_config("example");
14638 /// ```
14639 pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
14640 mut self,
14641 v: T,
14642 ) -> Self {
14643 self.human_review_config = v.into();
14644 self
14645 }
14646
14647 /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
14648 ///
14649 /// # Example
14650 /// ```ignore,no_run
14651 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14652 /// let x = ReviewDocumentRequest::new().set_enable_schema_validation(true);
14653 /// ```
14654 pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14655 self.enable_schema_validation = v.into();
14656 self
14657 }
14658
14659 /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
14660 ///
14661 /// # Example
14662 /// ```ignore,no_run
14663 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14664 /// use google_cloud_documentai_v1::model::review_document_request::Priority;
14665 /// let x0 = ReviewDocumentRequest::new().set_priority(Priority::Urgent);
14666 /// ```
14667 pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
14668 mut self,
14669 v: T,
14670 ) -> Self {
14671 self.priority = v.into();
14672 self
14673 }
14674
14675 /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14676 ///
14677 /// # Example
14678 /// ```ignore,no_run
14679 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14680 /// use google_cloud_documentai_v1::model::DocumentSchema;
14681 /// let x = ReviewDocumentRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
14682 /// ```
14683 pub fn set_document_schema<T>(mut self, v: T) -> Self
14684 where
14685 T: std::convert::Into<crate::model::DocumentSchema>,
14686 {
14687 self.document_schema = std::option::Option::Some(v.into());
14688 self
14689 }
14690
14691 /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14692 ///
14693 /// # Example
14694 /// ```ignore,no_run
14695 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14696 /// use google_cloud_documentai_v1::model::DocumentSchema;
14697 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
14698 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
14699 /// ```
14700 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
14701 where
14702 T: std::convert::Into<crate::model::DocumentSchema>,
14703 {
14704 self.document_schema = v.map(|x| x.into());
14705 self
14706 }
14707
14708 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
14709 ///
14710 /// Note that all the setters affecting `source` are mutually
14711 /// exclusive.
14712 ///
14713 /// # Example
14714 /// ```ignore,no_run
14715 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14716 /// use google_cloud_documentai_v1::model::Document;
14717 /// let x = ReviewDocumentRequest::new().set_source(Some(
14718 /// google_cloud_documentai_v1::model::review_document_request::Source::InlineDocument(Document::default().into())));
14719 /// ```
14720 pub fn set_source<
14721 T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
14722 >(
14723 mut self,
14724 v: T,
14725 ) -> Self {
14726 self.source = v.into();
14727 self
14728 }
14729
14730 /// The value of [source][crate::model::ReviewDocumentRequest::source]
14731 /// if it holds a `InlineDocument`, `None` if the field is not set or
14732 /// holds a different branch.
14733 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
14734 #[allow(unreachable_patterns)]
14735 self.source.as_ref().and_then(|v| match v {
14736 crate::model::review_document_request::Source::InlineDocument(v) => {
14737 std::option::Option::Some(v)
14738 }
14739 _ => std::option::Option::None,
14740 })
14741 }
14742
14743 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
14744 /// to hold a `InlineDocument`.
14745 ///
14746 /// Note that all the setters affecting `source` are
14747 /// mutually exclusive.
14748 ///
14749 /// # Example
14750 /// ```ignore,no_run
14751 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14752 /// use google_cloud_documentai_v1::model::Document;
14753 /// let x = ReviewDocumentRequest::new().set_inline_document(Document::default()/* use setters */);
14754 /// assert!(x.inline_document().is_some());
14755 /// ```
14756 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
14757 mut self,
14758 v: T,
14759 ) -> Self {
14760 self.source = std::option::Option::Some(
14761 crate::model::review_document_request::Source::InlineDocument(v.into()),
14762 );
14763 self
14764 }
14765}
14766
14767impl wkt::message::Message for ReviewDocumentRequest {
14768 fn typename() -> &'static str {
14769 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
14770 }
14771}
14772
14773/// Defines additional types related to [ReviewDocumentRequest].
14774pub mod review_document_request {
14775 #[allow(unused_imports)]
14776 use super::*;
14777
14778 /// The priority level of the human review task.
14779 ///
14780 /// # Working with unknown values
14781 ///
14782 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14783 /// additional enum variants at any time. Adding new variants is not considered
14784 /// a breaking change. Applications should write their code in anticipation of:
14785 ///
14786 /// - New values appearing in future releases of the client library, **and**
14787 /// - New values received dynamically, without application changes.
14788 ///
14789 /// Please consult the [Working with enums] section in the user guide for some
14790 /// guidelines.
14791 ///
14792 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14793 #[derive(Clone, Debug, PartialEq)]
14794 #[non_exhaustive]
14795 pub enum Priority {
14796 /// The default priority level.
14797 Default,
14798 /// The urgent priority level. The labeling manager should allocate labeler
14799 /// resource to the urgent task queue to respect this priority level.
14800 Urgent,
14801 /// If set, the enum was initialized with an unknown value.
14802 ///
14803 /// Applications can examine the value using [Priority::value] or
14804 /// [Priority::name].
14805 UnknownValue(priority::UnknownValue),
14806 }
14807
14808 #[doc(hidden)]
14809 pub mod priority {
14810 #[allow(unused_imports)]
14811 use super::*;
14812 #[derive(Clone, Debug, PartialEq)]
14813 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14814 }
14815
14816 impl Priority {
14817 /// Gets the enum value.
14818 ///
14819 /// Returns `None` if the enum contains an unknown value deserialized from
14820 /// the string representation of enums.
14821 pub fn value(&self) -> std::option::Option<i32> {
14822 match self {
14823 Self::Default => std::option::Option::Some(0),
14824 Self::Urgent => std::option::Option::Some(1),
14825 Self::UnknownValue(u) => u.0.value(),
14826 }
14827 }
14828
14829 /// Gets the enum value as a string.
14830 ///
14831 /// Returns `None` if the enum contains an unknown value deserialized from
14832 /// the integer representation of enums.
14833 pub fn name(&self) -> std::option::Option<&str> {
14834 match self {
14835 Self::Default => std::option::Option::Some("DEFAULT"),
14836 Self::Urgent => std::option::Option::Some("URGENT"),
14837 Self::UnknownValue(u) => u.0.name(),
14838 }
14839 }
14840 }
14841
14842 impl std::default::Default for Priority {
14843 fn default() -> Self {
14844 use std::convert::From;
14845 Self::from(0)
14846 }
14847 }
14848
14849 impl std::fmt::Display for Priority {
14850 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14851 wkt::internal::display_enum(f, self.name(), self.value())
14852 }
14853 }
14854
14855 impl std::convert::From<i32> for Priority {
14856 fn from(value: i32) -> Self {
14857 match value {
14858 0 => Self::Default,
14859 1 => Self::Urgent,
14860 _ => Self::UnknownValue(priority::UnknownValue(
14861 wkt::internal::UnknownEnumValue::Integer(value),
14862 )),
14863 }
14864 }
14865 }
14866
14867 impl std::convert::From<&str> for Priority {
14868 fn from(value: &str) -> Self {
14869 use std::string::ToString;
14870 match value {
14871 "DEFAULT" => Self::Default,
14872 "URGENT" => Self::Urgent,
14873 _ => Self::UnknownValue(priority::UnknownValue(
14874 wkt::internal::UnknownEnumValue::String(value.to_string()),
14875 )),
14876 }
14877 }
14878 }
14879
14880 impl serde::ser::Serialize for Priority {
14881 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14882 where
14883 S: serde::Serializer,
14884 {
14885 match self {
14886 Self::Default => serializer.serialize_i32(0),
14887 Self::Urgent => serializer.serialize_i32(1),
14888 Self::UnknownValue(u) => u.0.serialize(serializer),
14889 }
14890 }
14891 }
14892
14893 impl<'de> serde::de::Deserialize<'de> for Priority {
14894 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14895 where
14896 D: serde::Deserializer<'de>,
14897 {
14898 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
14899 ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
14900 ))
14901 }
14902 }
14903
14904 /// The document payload.
14905 #[derive(Clone, Debug, PartialEq)]
14906 #[non_exhaustive]
14907 pub enum Source {
14908 /// An inline document proto.
14909 InlineDocument(std::boxed::Box<crate::model::Document>),
14910 }
14911}
14912
14913/// Response message for the
14914/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14915/// method.
14916///
14917/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14918#[derive(Clone, Default, PartialEq)]
14919#[non_exhaustive]
14920pub struct ReviewDocumentResponse {
14921 /// The Cloud Storage uri for the human reviewed document if the review is
14922 /// succeeded.
14923 pub gcs_destination: std::string::String,
14924
14925 /// The state of the review operation.
14926 pub state: crate::model::review_document_response::State,
14927
14928 /// The reason why the review is rejected by reviewer.
14929 pub rejection_reason: std::string::String,
14930
14931 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14932}
14933
14934impl ReviewDocumentResponse {
14935 /// Creates a new default instance.
14936 pub fn new() -> Self {
14937 std::default::Default::default()
14938 }
14939
14940 /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
14941 ///
14942 /// # Example
14943 /// ```ignore,no_run
14944 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14945 /// let x = ReviewDocumentResponse::new().set_gcs_destination("example");
14946 /// ```
14947 pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14948 self.gcs_destination = v.into();
14949 self
14950 }
14951
14952 /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
14953 ///
14954 /// # Example
14955 /// ```ignore,no_run
14956 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14957 /// use google_cloud_documentai_v1::model::review_document_response::State;
14958 /// let x0 = ReviewDocumentResponse::new().set_state(State::Rejected);
14959 /// let x1 = ReviewDocumentResponse::new().set_state(State::Succeeded);
14960 /// ```
14961 pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
14962 mut self,
14963 v: T,
14964 ) -> Self {
14965 self.state = v.into();
14966 self
14967 }
14968
14969 /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
14970 ///
14971 /// # Example
14972 /// ```ignore,no_run
14973 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14974 /// let x = ReviewDocumentResponse::new().set_rejection_reason("example");
14975 /// ```
14976 pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
14977 mut self,
14978 v: T,
14979 ) -> Self {
14980 self.rejection_reason = v.into();
14981 self
14982 }
14983}
14984
14985impl wkt::message::Message for ReviewDocumentResponse {
14986 fn typename() -> &'static str {
14987 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
14988 }
14989}
14990
14991/// Defines additional types related to [ReviewDocumentResponse].
14992pub mod review_document_response {
14993 #[allow(unused_imports)]
14994 use super::*;
14995
14996 /// Possible states of the review operation.
14997 ///
14998 /// # Working with unknown values
14999 ///
15000 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
15001 /// additional enum variants at any time. Adding new variants is not considered
15002 /// a breaking change. Applications should write their code in anticipation of:
15003 ///
15004 /// - New values appearing in future releases of the client library, **and**
15005 /// - New values received dynamically, without application changes.
15006 ///
15007 /// Please consult the [Working with enums] section in the user guide for some
15008 /// guidelines.
15009 ///
15010 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15011 #[derive(Clone, Debug, PartialEq)]
15012 #[non_exhaustive]
15013 pub enum State {
15014 /// The default value. This value is used if the state is omitted.
15015 Unspecified,
15016 /// The review operation is rejected by the reviewer.
15017 Rejected,
15018 /// The review operation is succeeded.
15019 Succeeded,
15020 /// If set, the enum was initialized with an unknown value.
15021 ///
15022 /// Applications can examine the value using [State::value] or
15023 /// [State::name].
15024 UnknownValue(state::UnknownValue),
15025 }
15026
15027 #[doc(hidden)]
15028 pub mod state {
15029 #[allow(unused_imports)]
15030 use super::*;
15031 #[derive(Clone, Debug, PartialEq)]
15032 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15033 }
15034
15035 impl State {
15036 /// Gets the enum value.
15037 ///
15038 /// Returns `None` if the enum contains an unknown value deserialized from
15039 /// the string representation of enums.
15040 pub fn value(&self) -> std::option::Option<i32> {
15041 match self {
15042 Self::Unspecified => std::option::Option::Some(0),
15043 Self::Rejected => std::option::Option::Some(1),
15044 Self::Succeeded => std::option::Option::Some(2),
15045 Self::UnknownValue(u) => u.0.value(),
15046 }
15047 }
15048
15049 /// Gets the enum value as a string.
15050 ///
15051 /// Returns `None` if the enum contains an unknown value deserialized from
15052 /// the integer representation of enums.
15053 pub fn name(&self) -> std::option::Option<&str> {
15054 match self {
15055 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
15056 Self::Rejected => std::option::Option::Some("REJECTED"),
15057 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
15058 Self::UnknownValue(u) => u.0.name(),
15059 }
15060 }
15061 }
15062
15063 impl std::default::Default for State {
15064 fn default() -> Self {
15065 use std::convert::From;
15066 Self::from(0)
15067 }
15068 }
15069
15070 impl std::fmt::Display for State {
15071 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15072 wkt::internal::display_enum(f, self.name(), self.value())
15073 }
15074 }
15075
15076 impl std::convert::From<i32> for State {
15077 fn from(value: i32) -> Self {
15078 match value {
15079 0 => Self::Unspecified,
15080 1 => Self::Rejected,
15081 2 => Self::Succeeded,
15082 _ => Self::UnknownValue(state::UnknownValue(
15083 wkt::internal::UnknownEnumValue::Integer(value),
15084 )),
15085 }
15086 }
15087 }
15088
15089 impl std::convert::From<&str> for State {
15090 fn from(value: &str) -> Self {
15091 use std::string::ToString;
15092 match value {
15093 "STATE_UNSPECIFIED" => Self::Unspecified,
15094 "REJECTED" => Self::Rejected,
15095 "SUCCEEDED" => Self::Succeeded,
15096 _ => Self::UnknownValue(state::UnknownValue(
15097 wkt::internal::UnknownEnumValue::String(value.to_string()),
15098 )),
15099 }
15100 }
15101 }
15102
15103 impl serde::ser::Serialize for State {
15104 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15105 where
15106 S: serde::Serializer,
15107 {
15108 match self {
15109 Self::Unspecified => serializer.serialize_i32(0),
15110 Self::Rejected => serializer.serialize_i32(1),
15111 Self::Succeeded => serializer.serialize_i32(2),
15112 Self::UnknownValue(u) => u.0.serialize(serializer),
15113 }
15114 }
15115 }
15116
15117 impl<'de> serde::de::Deserialize<'de> for State {
15118 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15119 where
15120 D: serde::Deserializer<'de>,
15121 {
15122 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
15123 ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
15124 ))
15125 }
15126 }
15127}
15128
15129/// The long-running operation metadata for the
15130/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
15131/// method.
15132///
15133/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
15134#[derive(Clone, Default, PartialEq)]
15135#[non_exhaustive]
15136pub struct ReviewDocumentOperationMetadata {
15137 /// The basic metadata of the long-running operation.
15138 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15139
15140 /// The Crowd Compute question ID.
15141 pub question_id: std::string::String,
15142
15143 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15144}
15145
15146impl ReviewDocumentOperationMetadata {
15147 /// Creates a new default instance.
15148 pub fn new() -> Self {
15149 std::default::Default::default()
15150 }
15151
15152 /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
15153 ///
15154 /// # Example
15155 /// ```ignore,no_run
15156 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15157 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15158 /// let x = ReviewDocumentOperationMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15159 /// ```
15160 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15161 where
15162 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15163 {
15164 self.common_metadata = std::option::Option::Some(v.into());
15165 self
15166 }
15167
15168 /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
15169 ///
15170 /// # Example
15171 /// ```ignore,no_run
15172 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15173 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15174 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15175 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15176 /// ```
15177 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15178 where
15179 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15180 {
15181 self.common_metadata = v.map(|x| x.into());
15182 self
15183 }
15184
15185 /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
15186 ///
15187 /// # Example
15188 /// ```ignore,no_run
15189 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15190 /// let x = ReviewDocumentOperationMetadata::new().set_question_id("example");
15191 /// ```
15192 pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15193 self.question_id = v.into();
15194 self
15195 }
15196}
15197
15198impl wkt::message::Message for ReviewDocumentOperationMetadata {
15199 fn typename() -> &'static str {
15200 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
15201 }
15202}
15203
15204/// Evaluates the given
15205/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
15206/// supplied documents.
15207///
15208/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15209#[derive(Clone, Default, PartialEq)]
15210#[non_exhaustive]
15211pub struct EvaluateProcessorVersionRequest {
15212 /// Required. The resource name of the
15213 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
15214 /// evaluate.
15215 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15216 ///
15217 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15218 pub processor_version: std::string::String,
15219
15220 /// Optional. The documents used in the evaluation. If unspecified, use the
15221 /// processor's dataset as evaluation input.
15222 pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
15223
15224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15225}
15226
15227impl EvaluateProcessorVersionRequest {
15228 /// Creates a new default instance.
15229 pub fn new() -> Self {
15230 std::default::Default::default()
15231 }
15232
15233 /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
15234 ///
15235 /// # Example
15236 /// ```ignore,no_run
15237 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15238 /// # let project_id = "project_id";
15239 /// # let location_id = "location_id";
15240 /// # let processor_id = "processor_id";
15241 /// # let processor_version_id = "processor_version_id";
15242 /// let x = EvaluateProcessorVersionRequest::new().set_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
15243 /// ```
15244 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
15245 mut self,
15246 v: T,
15247 ) -> Self {
15248 self.processor_version = v.into();
15249 self
15250 }
15251
15252 /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15253 ///
15254 /// # Example
15255 /// ```ignore,no_run
15256 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15257 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15258 /// let x = EvaluateProcessorVersionRequest::new().set_evaluation_documents(BatchDocumentsInputConfig::default()/* use setters */);
15259 /// ```
15260 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
15261 where
15262 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15263 {
15264 self.evaluation_documents = std::option::Option::Some(v.into());
15265 self
15266 }
15267
15268 /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15269 ///
15270 /// # Example
15271 /// ```ignore,no_run
15272 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15273 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15274 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
15275 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(None::<BatchDocumentsInputConfig>);
15276 /// ```
15277 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
15278 where
15279 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15280 {
15281 self.evaluation_documents = v.map(|x| x.into());
15282 self
15283 }
15284}
15285
15286impl wkt::message::Message for EvaluateProcessorVersionRequest {
15287 fn typename() -> &'static str {
15288 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
15289 }
15290}
15291
15292/// Metadata of the
15293/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15294/// method.
15295///
15296/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15297#[derive(Clone, Default, PartialEq)]
15298#[non_exhaustive]
15299pub struct EvaluateProcessorVersionMetadata {
15300 /// The basic metadata of the long-running operation.
15301 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15302
15303 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15304}
15305
15306impl EvaluateProcessorVersionMetadata {
15307 /// Creates a new default instance.
15308 pub fn new() -> Self {
15309 std::default::Default::default()
15310 }
15311
15312 /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15313 ///
15314 /// # Example
15315 /// ```ignore,no_run
15316 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15317 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15318 /// let x = EvaluateProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15319 /// ```
15320 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15321 where
15322 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15323 {
15324 self.common_metadata = std::option::Option::Some(v.into());
15325 self
15326 }
15327
15328 /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15329 ///
15330 /// # Example
15331 /// ```ignore,no_run
15332 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15333 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15334 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15335 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15336 /// ```
15337 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15338 where
15339 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15340 {
15341 self.common_metadata = v.map(|x| x.into());
15342 self
15343 }
15344}
15345
15346impl wkt::message::Message for EvaluateProcessorVersionMetadata {
15347 fn typename() -> &'static str {
15348 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
15349 }
15350}
15351
15352/// Response of the
15353/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15354/// method.
15355///
15356/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15357#[derive(Clone, Default, PartialEq)]
15358#[non_exhaustive]
15359pub struct EvaluateProcessorVersionResponse {
15360 /// The resource name of the created evaluation.
15361 pub evaluation: std::string::String,
15362
15363 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15364}
15365
15366impl EvaluateProcessorVersionResponse {
15367 /// Creates a new default instance.
15368 pub fn new() -> Self {
15369 std::default::Default::default()
15370 }
15371
15372 /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
15373 ///
15374 /// # Example
15375 /// ```ignore,no_run
15376 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionResponse;
15377 /// let x = EvaluateProcessorVersionResponse::new().set_evaluation("example");
15378 /// ```
15379 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15380 self.evaluation = v.into();
15381 self
15382 }
15383}
15384
15385impl wkt::message::Message for EvaluateProcessorVersionResponse {
15386 fn typename() -> &'static str {
15387 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
15388 }
15389}
15390
15391/// Retrieves a specific Evaluation.
15392#[derive(Clone, Default, PartialEq)]
15393#[non_exhaustive]
15394pub struct GetEvaluationRequest {
15395 /// Required. The resource name of the
15396 /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
15397 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
15398 ///
15399 /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
15400 pub name: std::string::String,
15401
15402 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15403}
15404
15405impl GetEvaluationRequest {
15406 /// Creates a new default instance.
15407 pub fn new() -> Self {
15408 std::default::Default::default()
15409 }
15410
15411 /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
15412 ///
15413 /// # Example
15414 /// ```ignore,no_run
15415 /// # use google_cloud_documentai_v1::model::GetEvaluationRequest;
15416 /// # let project_id = "project_id";
15417 /// # let location_id = "location_id";
15418 /// # let processor_id = "processor_id";
15419 /// # let processor_version_id = "processor_version_id";
15420 /// # let evaluation_id = "evaluation_id";
15421 /// let x = GetEvaluationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}/evaluations/{evaluation_id}"));
15422 /// ```
15423 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15424 self.name = v.into();
15425 self
15426 }
15427}
15428
15429impl wkt::message::Message for GetEvaluationRequest {
15430 fn typename() -> &'static str {
15431 "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
15432 }
15433}
15434
15435/// Retrieves a list of evaluations for a given
15436/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
15437///
15438/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15439#[derive(Clone, Default, PartialEq)]
15440#[non_exhaustive]
15441pub struct ListEvaluationsRequest {
15442 /// Required. The resource name of the
15443 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
15444 /// evaluations for.
15445 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15446 ///
15447 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15448 pub parent: std::string::String,
15449
15450 /// The standard list page size.
15451 /// If unspecified, at most `5` evaluations are returned.
15452 /// The maximum value is `100`. Values above `100` are coerced to `100`.
15453 pub page_size: i32,
15454
15455 /// A page token, received from a previous `ListEvaluations` call.
15456 /// Provide this to retrieve the subsequent page.
15457 pub page_token: std::string::String,
15458
15459 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15460}
15461
15462impl ListEvaluationsRequest {
15463 /// Creates a new default instance.
15464 pub fn new() -> Self {
15465 std::default::Default::default()
15466 }
15467
15468 /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
15469 ///
15470 /// # Example
15471 /// ```ignore,no_run
15472 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15473 /// # let project_id = "project_id";
15474 /// # let location_id = "location_id";
15475 /// # let processor_id = "processor_id";
15476 /// # let processor_version_id = "processor_version_id";
15477 /// let x = ListEvaluationsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
15478 /// ```
15479 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15480 self.parent = v.into();
15481 self
15482 }
15483
15484 /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
15485 ///
15486 /// # Example
15487 /// ```ignore,no_run
15488 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15489 /// let x = ListEvaluationsRequest::new().set_page_size(42);
15490 /// ```
15491 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15492 self.page_size = v.into();
15493 self
15494 }
15495
15496 /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
15497 ///
15498 /// # Example
15499 /// ```ignore,no_run
15500 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15501 /// let x = ListEvaluationsRequest::new().set_page_token("example");
15502 /// ```
15503 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15504 self.page_token = v.into();
15505 self
15506 }
15507}
15508
15509impl wkt::message::Message for ListEvaluationsRequest {
15510 fn typename() -> &'static str {
15511 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
15512 }
15513}
15514
15515/// The response from `ListEvaluations`.
15516#[derive(Clone, Default, PartialEq)]
15517#[non_exhaustive]
15518pub struct ListEvaluationsResponse {
15519 /// The evaluations requested.
15520 pub evaluations: std::vec::Vec<crate::model::Evaluation>,
15521
15522 /// A token, which can be sent as `page_token` to retrieve the next page.
15523 /// If this field is omitted, there are no subsequent pages.
15524 pub next_page_token: std::string::String,
15525
15526 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15527}
15528
15529impl ListEvaluationsResponse {
15530 /// Creates a new default instance.
15531 pub fn new() -> Self {
15532 std::default::Default::default()
15533 }
15534
15535 /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
15536 ///
15537 /// # Example
15538 /// ```ignore,no_run
15539 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15540 /// use google_cloud_documentai_v1::model::Evaluation;
15541 /// let x = ListEvaluationsResponse::new()
15542 /// .set_evaluations([
15543 /// Evaluation::default()/* use setters */,
15544 /// Evaluation::default()/* use (different) setters */,
15545 /// ]);
15546 /// ```
15547 pub fn set_evaluations<T, V>(mut self, v: T) -> Self
15548 where
15549 T: std::iter::IntoIterator<Item = V>,
15550 V: std::convert::Into<crate::model::Evaluation>,
15551 {
15552 use std::iter::Iterator;
15553 self.evaluations = v.into_iter().map(|i| i.into()).collect();
15554 self
15555 }
15556
15557 /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
15558 ///
15559 /// # Example
15560 /// ```ignore,no_run
15561 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15562 /// let x = ListEvaluationsResponse::new().set_next_page_token("example");
15563 /// ```
15564 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15565 self.next_page_token = v.into();
15566 self
15567 }
15568}
15569
15570impl wkt::message::Message for ListEvaluationsResponse {
15571 fn typename() -> &'static str {
15572 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
15573 }
15574}
15575
15576#[doc(hidden)]
15577impl google_cloud_gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
15578 type PageItem = crate::model::Evaluation;
15579
15580 fn items(self) -> std::vec::Vec<Self::PageItem> {
15581 self.evaluations
15582 }
15583
15584 fn next_page_token(&self) -> std::string::String {
15585 use std::clone::Clone;
15586 self.next_page_token.clone()
15587 }
15588}
15589
15590/// The schema defines the output of the processed document by a processor.
15591#[derive(Clone, Default, PartialEq)]
15592#[non_exhaustive]
15593pub struct DocumentSchema {
15594 /// Display name to show to users.
15595 pub display_name: std::string::String,
15596
15597 /// Description of the schema.
15598 pub description: std::string::String,
15599
15600 /// Entity types of the schema.
15601 pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
15602
15603 /// Metadata of the schema.
15604 pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
15605
15606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15607}
15608
15609impl DocumentSchema {
15610 /// Creates a new default instance.
15611 pub fn new() -> Self {
15612 std::default::Default::default()
15613 }
15614
15615 /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
15616 ///
15617 /// # Example
15618 /// ```ignore,no_run
15619 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15620 /// let x = DocumentSchema::new().set_display_name("example");
15621 /// ```
15622 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15623 self.display_name = v.into();
15624 self
15625 }
15626
15627 /// Sets the value of [description][crate::model::DocumentSchema::description].
15628 ///
15629 /// # Example
15630 /// ```ignore,no_run
15631 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15632 /// let x = DocumentSchema::new().set_description("example");
15633 /// ```
15634 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15635 self.description = v.into();
15636 self
15637 }
15638
15639 /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
15640 ///
15641 /// # Example
15642 /// ```ignore,no_run
15643 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15644 /// use google_cloud_documentai_v1::model::document_schema::EntityType;
15645 /// let x = DocumentSchema::new()
15646 /// .set_entity_types([
15647 /// EntityType::default()/* use setters */,
15648 /// EntityType::default()/* use (different) setters */,
15649 /// ]);
15650 /// ```
15651 pub fn set_entity_types<T, V>(mut self, v: T) -> Self
15652 where
15653 T: std::iter::IntoIterator<Item = V>,
15654 V: std::convert::Into<crate::model::document_schema::EntityType>,
15655 {
15656 use std::iter::Iterator;
15657 self.entity_types = v.into_iter().map(|i| i.into()).collect();
15658 self
15659 }
15660
15661 /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
15662 ///
15663 /// # Example
15664 /// ```ignore,no_run
15665 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15666 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15667 /// let x = DocumentSchema::new().set_metadata(Metadata::default()/* use setters */);
15668 /// ```
15669 pub fn set_metadata<T>(mut self, v: T) -> Self
15670 where
15671 T: std::convert::Into<crate::model::document_schema::Metadata>,
15672 {
15673 self.metadata = std::option::Option::Some(v.into());
15674 self
15675 }
15676
15677 /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
15678 ///
15679 /// # Example
15680 /// ```ignore,no_run
15681 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15682 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15683 /// let x = DocumentSchema::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
15684 /// let x = DocumentSchema::new().set_or_clear_metadata(None::<Metadata>);
15685 /// ```
15686 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15687 where
15688 T: std::convert::Into<crate::model::document_schema::Metadata>,
15689 {
15690 self.metadata = v.map(|x| x.into());
15691 self
15692 }
15693}
15694
15695impl wkt::message::Message for DocumentSchema {
15696 fn typename() -> &'static str {
15697 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
15698 }
15699}
15700
15701/// Defines additional types related to [DocumentSchema].
15702pub mod document_schema {
15703 #[allow(unused_imports)]
15704 use super::*;
15705
15706 /// EntityType is the wrapper of a label of the corresponding model with
15707 /// detailed attributes and limitations for entity-based processors. Multiple
15708 /// types can also compose a dependency tree to represent nested types.
15709 #[derive(Clone, Default, PartialEq)]
15710 #[non_exhaustive]
15711 pub struct EntityType {
15712 /// User defined name for the type.
15713 pub display_name: std::string::String,
15714
15715 /// Name of the type. It must be unique within the schema file and
15716 /// cannot be a "Common Type". The following naming conventions are used:
15717 ///
15718 /// - Use `snake_casing`.
15719 /// - Name matching is case-sensitive.
15720 /// - Maximum 64 characters.
15721 /// - Must start with a letter.
15722 /// - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward
15723 /// compatibility internal infrastructure and tooling can handle any ascii
15724 /// character.)
15725 /// - The `/` is sometimes used to denote a property of a type. For example
15726 /// `line_item/amount`. This convention is deprecated, but will still be
15727 /// honored for backward compatibility.
15728 pub name: std::string::String,
15729
15730 /// The entity type that this type is derived from. For now, one and only
15731 /// one should be set.
15732 pub base_types: std::vec::Vec<std::string::String>,
15733
15734 /// Description the nested structure, or composition of an entity.
15735 pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
15736
15737 #[allow(missing_docs)]
15738 pub value_source:
15739 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15740
15741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15742 }
15743
15744 impl EntityType {
15745 /// Creates a new default instance.
15746 pub fn new() -> Self {
15747 std::default::Default::default()
15748 }
15749
15750 /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
15751 ///
15752 /// # Example
15753 /// ```ignore,no_run
15754 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15755 /// let x = EntityType::new().set_display_name("example");
15756 /// ```
15757 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15758 mut self,
15759 v: T,
15760 ) -> Self {
15761 self.display_name = v.into();
15762 self
15763 }
15764
15765 /// Sets the value of [name][crate::model::document_schema::EntityType::name].
15766 ///
15767 /// # Example
15768 /// ```ignore,no_run
15769 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15770 /// let x = EntityType::new().set_name("example");
15771 /// ```
15772 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15773 self.name = v.into();
15774 self
15775 }
15776
15777 /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
15778 ///
15779 /// # Example
15780 /// ```ignore,no_run
15781 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15782 /// let x = EntityType::new().set_base_types(["a", "b", "c"]);
15783 /// ```
15784 pub fn set_base_types<T, V>(mut self, v: T) -> Self
15785 where
15786 T: std::iter::IntoIterator<Item = V>,
15787 V: std::convert::Into<std::string::String>,
15788 {
15789 use std::iter::Iterator;
15790 self.base_types = v.into_iter().map(|i| i.into()).collect();
15791 self
15792 }
15793
15794 /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
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::Property;
15800 /// let x = EntityType::new()
15801 /// .set_properties([
15802 /// Property::default()/* use setters */,
15803 /// Property::default()/* use (different) setters */,
15804 /// ]);
15805 /// ```
15806 pub fn set_properties<T, V>(mut self, v: T) -> Self
15807 where
15808 T: std::iter::IntoIterator<Item = V>,
15809 V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
15810 {
15811 use std::iter::Iterator;
15812 self.properties = v.into_iter().map(|i| i.into()).collect();
15813 self
15814 }
15815
15816 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
15817 ///
15818 /// Note that all the setters affecting `value_source` are mutually
15819 /// exclusive.
15820 ///
15821 /// # Example
15822 /// ```ignore,no_run
15823 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15824 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15825 /// let x = EntityType::new().set_value_source(Some(
15826 /// google_cloud_documentai_v1::model::document_schema::entity_type::ValueSource::EnumValues(EnumValues::default().into())));
15827 /// ```
15828 pub fn set_value_source<
15829 T: std::convert::Into<
15830 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15831 >,
15832 >(
15833 mut self,
15834 v: T,
15835 ) -> Self {
15836 self.value_source = v.into();
15837 self
15838 }
15839
15840 /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
15841 /// if it holds a `EnumValues`, `None` if the field is not set or
15842 /// holds a different branch.
15843 pub fn enum_values(
15844 &self,
15845 ) -> std::option::Option<
15846 &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15847 > {
15848 #[allow(unreachable_patterns)]
15849 self.value_source.as_ref().and_then(|v| match v {
15850 crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
15851 std::option::Option::Some(v)
15852 }
15853 _ => std::option::Option::None,
15854 })
15855 }
15856
15857 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
15858 /// to hold a `EnumValues`.
15859 ///
15860 /// Note that all the setters affecting `value_source` are
15861 /// mutually exclusive.
15862 ///
15863 /// # Example
15864 /// ```ignore,no_run
15865 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15866 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15867 /// let x = EntityType::new().set_enum_values(EnumValues::default()/* use setters */);
15868 /// assert!(x.enum_values().is_some());
15869 /// ```
15870 pub fn set_enum_values<
15871 T: std::convert::Into<
15872 std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15873 >,
15874 >(
15875 mut self,
15876 v: T,
15877 ) -> Self {
15878 self.value_source = std::option::Option::Some(
15879 crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
15880 );
15881 self
15882 }
15883 }
15884
15885 impl wkt::message::Message for EntityType {
15886 fn typename() -> &'static str {
15887 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
15888 }
15889 }
15890
15891 /// Defines additional types related to [EntityType].
15892 pub mod entity_type {
15893 #[allow(unused_imports)]
15894 use super::*;
15895
15896 /// Defines the a list of enum values.
15897 #[derive(Clone, Default, PartialEq)]
15898 #[non_exhaustive]
15899 pub struct EnumValues {
15900 /// The individual values that this enum values type can include.
15901 pub values: std::vec::Vec<std::string::String>,
15902
15903 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15904 }
15905
15906 impl EnumValues {
15907 /// Creates a new default instance.
15908 pub fn new() -> Self {
15909 std::default::Default::default()
15910 }
15911
15912 /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
15913 ///
15914 /// # Example
15915 /// ```ignore,no_run
15916 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15917 /// let x = EnumValues::new().set_values(["a", "b", "c"]);
15918 /// ```
15919 pub fn set_values<T, V>(mut self, v: T) -> Self
15920 where
15921 T: std::iter::IntoIterator<Item = V>,
15922 V: std::convert::Into<std::string::String>,
15923 {
15924 use std::iter::Iterator;
15925 self.values = v.into_iter().map(|i| i.into()).collect();
15926 self
15927 }
15928 }
15929
15930 impl wkt::message::Message for EnumValues {
15931 fn typename() -> &'static str {
15932 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
15933 }
15934 }
15935
15936 /// Defines properties that can be part of the entity type.
15937 #[derive(Clone, Default, PartialEq)]
15938 #[non_exhaustive]
15939 pub struct Property {
15940 /// The name of the property. Follows the same guidelines as the
15941 /// EntityType name.
15942 pub name: std::string::String,
15943
15944 /// User defined name for the property.
15945 pub display_name: std::string::String,
15946
15947 /// A reference to the value type of the property. This type is subject
15948 /// to the same conventions as the `Entity.base_types` field.
15949 pub value_type: std::string::String,
15950
15951 /// Occurrence type limits the number of instances an entity type appears
15952 /// in the document.
15953 pub occurrence_type:
15954 crate::model::document_schema::entity_type::property::OccurrenceType,
15955
15956 /// Specifies how the entity's value is obtained.
15957 pub method: crate::model::document_schema::entity_type::property::Method,
15958
15959 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15960 }
15961
15962 impl Property {
15963 /// Creates a new default instance.
15964 pub fn new() -> Self {
15965 std::default::Default::default()
15966 }
15967
15968 /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
15969 ///
15970 /// # Example
15971 /// ```ignore,no_run
15972 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15973 /// let x = Property::new().set_name("example");
15974 /// ```
15975 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15976 self.name = v.into();
15977 self
15978 }
15979
15980 /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
15981 ///
15982 /// # Example
15983 /// ```ignore,no_run
15984 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15985 /// let x = Property::new().set_display_name("example");
15986 /// ```
15987 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15988 mut self,
15989 v: T,
15990 ) -> Self {
15991 self.display_name = v.into();
15992 self
15993 }
15994
15995 /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
15996 ///
15997 /// # Example
15998 /// ```ignore,no_run
15999 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
16000 /// let x = Property::new().set_value_type("example");
16001 /// ```
16002 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
16003 mut self,
16004 v: T,
16005 ) -> Self {
16006 self.value_type = v.into();
16007 self
16008 }
16009
16010 /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
16011 ///
16012 /// # Example
16013 /// ```ignore,no_run
16014 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
16015 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::OccurrenceType;
16016 /// let x0 = Property::new().set_occurrence_type(OccurrenceType::OptionalOnce);
16017 /// let x1 = Property::new().set_occurrence_type(OccurrenceType::OptionalMultiple);
16018 /// let x2 = Property::new().set_occurrence_type(OccurrenceType::RequiredOnce);
16019 /// ```
16020 pub fn set_occurrence_type<
16021 T: std::convert::Into<
16022 crate::model::document_schema::entity_type::property::OccurrenceType,
16023 >,
16024 >(
16025 mut self,
16026 v: T,
16027 ) -> Self {
16028 self.occurrence_type = v.into();
16029 self
16030 }
16031
16032 /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
16033 ///
16034 /// # Example
16035 /// ```ignore,no_run
16036 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
16037 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::Method;
16038 /// let x0 = Property::new().set_method(Method::Extract);
16039 /// let x1 = Property::new().set_method(Method::Derive);
16040 /// ```
16041 pub fn set_method<
16042 T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
16043 >(
16044 mut self,
16045 v: T,
16046 ) -> Self {
16047 self.method = v.into();
16048 self
16049 }
16050 }
16051
16052 impl wkt::message::Message for Property {
16053 fn typename() -> &'static str {
16054 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
16055 }
16056 }
16057
16058 /// Defines additional types related to [Property].
16059 pub mod property {
16060 #[allow(unused_imports)]
16061 use super::*;
16062
16063 /// Types of occurrences of the entity type in the document. This
16064 /// represents the number of instances, not mentions, of an entity.
16065 /// For example, a bank statement might only have one
16066 /// `account_number`, but this account number can be mentioned in several
16067 /// places on the document. In this case, the `account_number` is
16068 /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
16069 /// expect a bank statement to contain the status of multiple different
16070 /// accounts for the customers, the occurrence type is set to
16071 /// `REQUIRED_MULTIPLE`.
16072 ///
16073 /// # Working with unknown values
16074 ///
16075 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16076 /// additional enum variants at any time. Adding new variants is not considered
16077 /// a breaking change. Applications should write their code in anticipation of:
16078 ///
16079 /// - New values appearing in future releases of the client library, **and**
16080 /// - New values received dynamically, without application changes.
16081 ///
16082 /// Please consult the [Working with enums] section in the user guide for some
16083 /// guidelines.
16084 ///
16085 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16086 #[derive(Clone, Debug, PartialEq)]
16087 #[non_exhaustive]
16088 pub enum OccurrenceType {
16089 /// Unspecified occurrence type.
16090 Unspecified,
16091 /// There will be zero or one instance of this entity type. The same
16092 /// entity instance may be mentioned multiple times.
16093 OptionalOnce,
16094 /// The entity type will appear zero or multiple times.
16095 OptionalMultiple,
16096 /// The entity type will only appear exactly once. The same
16097 /// entity instance may be mentioned multiple times.
16098 RequiredOnce,
16099 /// The entity type will appear once or more times.
16100 RequiredMultiple,
16101 /// If set, the enum was initialized with an unknown value.
16102 ///
16103 /// Applications can examine the value using [OccurrenceType::value] or
16104 /// [OccurrenceType::name].
16105 UnknownValue(occurrence_type::UnknownValue),
16106 }
16107
16108 #[doc(hidden)]
16109 pub mod occurrence_type {
16110 #[allow(unused_imports)]
16111 use super::*;
16112 #[derive(Clone, Debug, PartialEq)]
16113 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16114 }
16115
16116 impl OccurrenceType {
16117 /// Gets the enum value.
16118 ///
16119 /// Returns `None` if the enum contains an unknown value deserialized from
16120 /// the string representation of enums.
16121 pub fn value(&self) -> std::option::Option<i32> {
16122 match self {
16123 Self::Unspecified => std::option::Option::Some(0),
16124 Self::OptionalOnce => std::option::Option::Some(1),
16125 Self::OptionalMultiple => std::option::Option::Some(2),
16126 Self::RequiredOnce => std::option::Option::Some(3),
16127 Self::RequiredMultiple => std::option::Option::Some(4),
16128 Self::UnknownValue(u) => u.0.value(),
16129 }
16130 }
16131
16132 /// Gets the enum value as a string.
16133 ///
16134 /// Returns `None` if the enum contains an unknown value deserialized from
16135 /// the integer representation of enums.
16136 pub fn name(&self) -> std::option::Option<&str> {
16137 match self {
16138 Self::Unspecified => {
16139 std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
16140 }
16141 Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
16142 Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
16143 Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
16144 Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
16145 Self::UnknownValue(u) => u.0.name(),
16146 }
16147 }
16148 }
16149
16150 impl std::default::Default for OccurrenceType {
16151 fn default() -> Self {
16152 use std::convert::From;
16153 Self::from(0)
16154 }
16155 }
16156
16157 impl std::fmt::Display for OccurrenceType {
16158 fn fmt(
16159 &self,
16160 f: &mut std::fmt::Formatter<'_>,
16161 ) -> std::result::Result<(), std::fmt::Error> {
16162 wkt::internal::display_enum(f, self.name(), self.value())
16163 }
16164 }
16165
16166 impl std::convert::From<i32> for OccurrenceType {
16167 fn from(value: i32) -> Self {
16168 match value {
16169 0 => Self::Unspecified,
16170 1 => Self::OptionalOnce,
16171 2 => Self::OptionalMultiple,
16172 3 => Self::RequiredOnce,
16173 4 => Self::RequiredMultiple,
16174 _ => Self::UnknownValue(occurrence_type::UnknownValue(
16175 wkt::internal::UnknownEnumValue::Integer(value),
16176 )),
16177 }
16178 }
16179 }
16180
16181 impl std::convert::From<&str> for OccurrenceType {
16182 fn from(value: &str) -> Self {
16183 use std::string::ToString;
16184 match value {
16185 "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
16186 "OPTIONAL_ONCE" => Self::OptionalOnce,
16187 "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
16188 "REQUIRED_ONCE" => Self::RequiredOnce,
16189 "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
16190 _ => Self::UnknownValue(occurrence_type::UnknownValue(
16191 wkt::internal::UnknownEnumValue::String(value.to_string()),
16192 )),
16193 }
16194 }
16195 }
16196
16197 impl serde::ser::Serialize for OccurrenceType {
16198 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16199 where
16200 S: serde::Serializer,
16201 {
16202 match self {
16203 Self::Unspecified => serializer.serialize_i32(0),
16204 Self::OptionalOnce => serializer.serialize_i32(1),
16205 Self::OptionalMultiple => serializer.serialize_i32(2),
16206 Self::RequiredOnce => serializer.serialize_i32(3),
16207 Self::RequiredMultiple => serializer.serialize_i32(4),
16208 Self::UnknownValue(u) => u.0.serialize(serializer),
16209 }
16210 }
16211 }
16212
16213 impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
16214 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16215 where
16216 D: serde::Deserializer<'de>,
16217 {
16218 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
16219 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
16220 }
16221 }
16222
16223 /// Specifies how the entity's value is obtained from the document.
16224 ///
16225 /// # Working with unknown values
16226 ///
16227 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16228 /// additional enum variants at any time. Adding new variants is not considered
16229 /// a breaking change. Applications should write their code in anticipation of:
16230 ///
16231 /// - New values appearing in future releases of the client library, **and**
16232 /// - New values received dynamically, without application changes.
16233 ///
16234 /// Please consult the [Working with enums] section in the user guide for some
16235 /// guidelines.
16236 ///
16237 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16238 #[derive(Clone, Debug, PartialEq)]
16239 #[non_exhaustive]
16240 pub enum Method {
16241 /// Unspecified method. It defaults to `EXTRACT`.
16242 Unspecified,
16243 /// The entity's value is directly extracted as-is from the document
16244 /// text.
16245 Extract,
16246 /// The entity's value is derived through inference and is not
16247 /// necessarily an exact text extraction from the document.
16248 Derive,
16249 /// If set, the enum was initialized with an unknown value.
16250 ///
16251 /// Applications can examine the value using [Method::value] or
16252 /// [Method::name].
16253 UnknownValue(method::UnknownValue),
16254 }
16255
16256 #[doc(hidden)]
16257 pub mod method {
16258 #[allow(unused_imports)]
16259 use super::*;
16260 #[derive(Clone, Debug, PartialEq)]
16261 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16262 }
16263
16264 impl Method {
16265 /// Gets the enum value.
16266 ///
16267 /// Returns `None` if the enum contains an unknown value deserialized from
16268 /// the string representation of enums.
16269 pub fn value(&self) -> std::option::Option<i32> {
16270 match self {
16271 Self::Unspecified => std::option::Option::Some(0),
16272 Self::Extract => std::option::Option::Some(1),
16273 Self::Derive => std::option::Option::Some(2),
16274 Self::UnknownValue(u) => u.0.value(),
16275 }
16276 }
16277
16278 /// Gets the enum value as a string.
16279 ///
16280 /// Returns `None` if the enum contains an unknown value deserialized from
16281 /// the integer representation of enums.
16282 pub fn name(&self) -> std::option::Option<&str> {
16283 match self {
16284 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
16285 Self::Extract => std::option::Option::Some("EXTRACT"),
16286 Self::Derive => std::option::Option::Some("DERIVE"),
16287 Self::UnknownValue(u) => u.0.name(),
16288 }
16289 }
16290 }
16291
16292 impl std::default::Default for Method {
16293 fn default() -> Self {
16294 use std::convert::From;
16295 Self::from(0)
16296 }
16297 }
16298
16299 impl std::fmt::Display for Method {
16300 fn fmt(
16301 &self,
16302 f: &mut std::fmt::Formatter<'_>,
16303 ) -> std::result::Result<(), std::fmt::Error> {
16304 wkt::internal::display_enum(f, self.name(), self.value())
16305 }
16306 }
16307
16308 impl std::convert::From<i32> for Method {
16309 fn from(value: i32) -> Self {
16310 match value {
16311 0 => Self::Unspecified,
16312 1 => Self::Extract,
16313 2 => Self::Derive,
16314 _ => Self::UnknownValue(method::UnknownValue(
16315 wkt::internal::UnknownEnumValue::Integer(value),
16316 )),
16317 }
16318 }
16319 }
16320
16321 impl std::convert::From<&str> for Method {
16322 fn from(value: &str) -> Self {
16323 use std::string::ToString;
16324 match value {
16325 "METHOD_UNSPECIFIED" => Self::Unspecified,
16326 "EXTRACT" => Self::Extract,
16327 "DERIVE" => Self::Derive,
16328 _ => Self::UnknownValue(method::UnknownValue(
16329 wkt::internal::UnknownEnumValue::String(value.to_string()),
16330 )),
16331 }
16332 }
16333 }
16334
16335 impl serde::ser::Serialize for Method {
16336 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16337 where
16338 S: serde::Serializer,
16339 {
16340 match self {
16341 Self::Unspecified => serializer.serialize_i32(0),
16342 Self::Extract => serializer.serialize_i32(1),
16343 Self::Derive => serializer.serialize_i32(2),
16344 Self::UnknownValue(u) => u.0.serialize(serializer),
16345 }
16346 }
16347 }
16348
16349 impl<'de> serde::de::Deserialize<'de> for Method {
16350 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16351 where
16352 D: serde::Deserializer<'de>,
16353 {
16354 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
16355 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
16356 ))
16357 }
16358 }
16359 }
16360
16361 #[allow(missing_docs)]
16362 #[derive(Clone, Debug, PartialEq)]
16363 #[non_exhaustive]
16364 pub enum ValueSource {
16365 /// If specified, lists all the possible values for this entity. This
16366 /// should not be more than a handful of values. If the number of values
16367 /// is >10 or could change frequently use the `EntityType.value_ontology`
16368 /// field and specify a list of all possible values in a value ontology
16369 /// file.
16370 EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
16371 }
16372 }
16373
16374 /// Metadata for global schema behavior.
16375 #[derive(Clone, Default, PartialEq)]
16376 #[non_exhaustive]
16377 pub struct Metadata {
16378 /// If true, a `document` entity type can be applied to subdocument
16379 /// (splitting). Otherwise, it can only be applied to the entire document
16380 /// (classification).
16381 pub document_splitter: bool,
16382
16383 /// If true, on a given page, there can be multiple `document` annotations
16384 /// covering it.
16385 pub document_allow_multiple_labels: bool,
16386
16387 /// If set, all the nested entities must be prefixed with the parents.
16388 pub prefixed_naming_on_properties: bool,
16389
16390 /// If set, we will skip the naming format validation in the schema. So the
16391 /// string values in `DocumentSchema.EntityType.name` and
16392 /// `DocumentSchema.EntityType.Property.name` will not be checked.
16393 pub skip_naming_validation: bool,
16394
16395 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16396 }
16397
16398 impl Metadata {
16399 /// Creates a new default instance.
16400 pub fn new() -> Self {
16401 std::default::Default::default()
16402 }
16403
16404 /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
16405 ///
16406 /// # Example
16407 /// ```ignore,no_run
16408 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16409 /// let x = Metadata::new().set_document_splitter(true);
16410 /// ```
16411 pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16412 self.document_splitter = v.into();
16413 self
16414 }
16415
16416 /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
16417 ///
16418 /// # Example
16419 /// ```ignore,no_run
16420 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16421 /// let x = Metadata::new().set_document_allow_multiple_labels(true);
16422 /// ```
16423 pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
16424 mut self,
16425 v: T,
16426 ) -> Self {
16427 self.document_allow_multiple_labels = v.into();
16428 self
16429 }
16430
16431 /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
16432 ///
16433 /// # Example
16434 /// ```ignore,no_run
16435 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16436 /// let x = Metadata::new().set_prefixed_naming_on_properties(true);
16437 /// ```
16438 pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
16439 mut self,
16440 v: T,
16441 ) -> Self {
16442 self.prefixed_naming_on_properties = v.into();
16443 self
16444 }
16445
16446 /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
16447 ///
16448 /// # Example
16449 /// ```ignore,no_run
16450 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16451 /// let x = Metadata::new().set_skip_naming_validation(true);
16452 /// ```
16453 pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16454 self.skip_naming_validation = v.into();
16455 self
16456 }
16457 }
16458
16459 impl wkt::message::Message for Metadata {
16460 fn typename() -> &'static str {
16461 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
16462 }
16463 }
16464}
16465
16466/// Gives a short summary of an evaluation, and links to the evaluation itself.
16467#[derive(Clone, Default, PartialEq)]
16468#[non_exhaustive]
16469pub struct EvaluationReference {
16470 /// The resource name of the Long Running Operation for the evaluation.
16471 pub operation: std::string::String,
16472
16473 /// The resource name of the evaluation.
16474 pub evaluation: std::string::String,
16475
16476 /// An aggregate of the statistics for the evaluation with fuzzy matching on.
16477 pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
16478
16479 /// An aggregate of the statistics for the evaluation with fuzzy matching off.
16480 pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
16481
16482 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16483}
16484
16485impl EvaluationReference {
16486 /// Creates a new default instance.
16487 pub fn new() -> Self {
16488 std::default::Default::default()
16489 }
16490
16491 /// Sets the value of [operation][crate::model::EvaluationReference::operation].
16492 ///
16493 /// # Example
16494 /// ```ignore,no_run
16495 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16496 /// let x = EvaluationReference::new().set_operation("example");
16497 /// ```
16498 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16499 self.operation = v.into();
16500 self
16501 }
16502
16503 /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
16504 ///
16505 /// # Example
16506 /// ```ignore,no_run
16507 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16508 /// # let project_id = "project_id";
16509 /// # let location_id = "location_id";
16510 /// # let processor_id = "processor_id";
16511 /// # let processor_version_id = "processor_version_id";
16512 /// # let evaluation_id = "evaluation_id";
16513 /// let x = EvaluationReference::new().set_evaluation(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}/evaluations/{evaluation_id}"));
16514 /// ```
16515 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16516 self.evaluation = v.into();
16517 self
16518 }
16519
16520 /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16521 ///
16522 /// # Example
16523 /// ```ignore,no_run
16524 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16525 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16526 /// let x = EvaluationReference::new().set_aggregate_metrics(Metrics::default()/* use setters */);
16527 /// ```
16528 pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
16529 where
16530 T: std::convert::Into<crate::model::evaluation::Metrics>,
16531 {
16532 self.aggregate_metrics = std::option::Option::Some(v.into());
16533 self
16534 }
16535
16536 /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16537 ///
16538 /// # Example
16539 /// ```ignore,no_run
16540 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16541 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16542 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(Some(Metrics::default()/* use setters */));
16543 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(None::<Metrics>);
16544 /// ```
16545 pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16546 where
16547 T: std::convert::Into<crate::model::evaluation::Metrics>,
16548 {
16549 self.aggregate_metrics = v.map(|x| x.into());
16550 self
16551 }
16552
16553 /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16554 ///
16555 /// # Example
16556 /// ```ignore,no_run
16557 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16558 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16559 /// let x = EvaluationReference::new().set_aggregate_metrics_exact(Metrics::default()/* use setters */);
16560 /// ```
16561 pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
16562 where
16563 T: std::convert::Into<crate::model::evaluation::Metrics>,
16564 {
16565 self.aggregate_metrics_exact = std::option::Option::Some(v.into());
16566 self
16567 }
16568
16569 /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16570 ///
16571 /// # Example
16572 /// ```ignore,no_run
16573 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16574 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16575 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(Some(Metrics::default()/* use setters */));
16576 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(None::<Metrics>);
16577 /// ```
16578 pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
16579 where
16580 T: std::convert::Into<crate::model::evaluation::Metrics>,
16581 {
16582 self.aggregate_metrics_exact = v.map(|x| x.into());
16583 self
16584 }
16585}
16586
16587impl wkt::message::Message for EvaluationReference {
16588 fn typename() -> &'static str {
16589 "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
16590 }
16591}
16592
16593/// An evaluation of a ProcessorVersion's performance.
16594#[derive(Clone, Default, PartialEq)]
16595#[non_exhaustive]
16596pub struct Evaluation {
16597 /// The resource name of the evaluation.
16598 /// Format:
16599 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
16600 pub name: std::string::String,
16601
16602 /// The time that the evaluation was created.
16603 pub create_time: std::option::Option<wkt::Timestamp>,
16604
16605 /// Counters for the documents used in the evaluation.
16606 pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
16607
16608 /// Metrics for all the entities in aggregate.
16609 pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
16610
16611 /// Metrics across confidence levels, for different entities.
16612 pub entity_metrics: std::collections::HashMap<
16613 std::string::String,
16614 crate::model::evaluation::MultiConfidenceMetrics,
16615 >,
16616
16617 /// The KMS key name used for encryption.
16618 pub kms_key_name: std::string::String,
16619
16620 /// The KMS key version with which data is encrypted.
16621 pub kms_key_version_name: std::string::String,
16622
16623 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16624}
16625
16626impl Evaluation {
16627 /// Creates a new default instance.
16628 pub fn new() -> Self {
16629 std::default::Default::default()
16630 }
16631
16632 /// Sets the value of [name][crate::model::Evaluation::name].
16633 ///
16634 /// # Example
16635 /// ```ignore,no_run
16636 /// # use google_cloud_documentai_v1::model::Evaluation;
16637 /// # let project_id = "project_id";
16638 /// # let location_id = "location_id";
16639 /// # let processor_id = "processor_id";
16640 /// # let processor_version_id = "processor_version_id";
16641 /// # let evaluation_id = "evaluation_id";
16642 /// let x = Evaluation::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}/evaluations/{evaluation_id}"));
16643 /// ```
16644 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16645 self.name = v.into();
16646 self
16647 }
16648
16649 /// Sets the value of [create_time][crate::model::Evaluation::create_time].
16650 ///
16651 /// # Example
16652 /// ```ignore,no_run
16653 /// # use google_cloud_documentai_v1::model::Evaluation;
16654 /// use wkt::Timestamp;
16655 /// let x = Evaluation::new().set_create_time(Timestamp::default()/* use setters */);
16656 /// ```
16657 pub fn set_create_time<T>(mut self, v: T) -> Self
16658 where
16659 T: std::convert::Into<wkt::Timestamp>,
16660 {
16661 self.create_time = std::option::Option::Some(v.into());
16662 self
16663 }
16664
16665 /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
16666 ///
16667 /// # Example
16668 /// ```ignore,no_run
16669 /// # use google_cloud_documentai_v1::model::Evaluation;
16670 /// use wkt::Timestamp;
16671 /// let x = Evaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16672 /// let x = Evaluation::new().set_or_clear_create_time(None::<Timestamp>);
16673 /// ```
16674 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16675 where
16676 T: std::convert::Into<wkt::Timestamp>,
16677 {
16678 self.create_time = v.map(|x| x.into());
16679 self
16680 }
16681
16682 /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
16683 ///
16684 /// # Example
16685 /// ```ignore,no_run
16686 /// # use google_cloud_documentai_v1::model::Evaluation;
16687 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16688 /// let x = Evaluation::new().set_document_counters(Counters::default()/* use setters */);
16689 /// ```
16690 pub fn set_document_counters<T>(mut self, v: T) -> Self
16691 where
16692 T: std::convert::Into<crate::model::evaluation::Counters>,
16693 {
16694 self.document_counters = std::option::Option::Some(v.into());
16695 self
16696 }
16697
16698 /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
16699 ///
16700 /// # Example
16701 /// ```ignore,no_run
16702 /// # use google_cloud_documentai_v1::model::Evaluation;
16703 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16704 /// let x = Evaluation::new().set_or_clear_document_counters(Some(Counters::default()/* use setters */));
16705 /// let x = Evaluation::new().set_or_clear_document_counters(None::<Counters>);
16706 /// ```
16707 pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
16708 where
16709 T: std::convert::Into<crate::model::evaluation::Counters>,
16710 {
16711 self.document_counters = v.map(|x| x.into());
16712 self
16713 }
16714
16715 /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16716 ///
16717 /// # Example
16718 /// ```ignore,no_run
16719 /// # use google_cloud_documentai_v1::model::Evaluation;
16720 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16721 /// let x = Evaluation::new().set_all_entities_metrics(MultiConfidenceMetrics::default()/* use setters */);
16722 /// ```
16723 pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
16724 where
16725 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16726 {
16727 self.all_entities_metrics = std::option::Option::Some(v.into());
16728 self
16729 }
16730
16731 /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16732 ///
16733 /// # Example
16734 /// ```ignore,no_run
16735 /// # use google_cloud_documentai_v1::model::Evaluation;
16736 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16737 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(Some(MultiConfidenceMetrics::default()/* use setters */));
16738 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(None::<MultiConfidenceMetrics>);
16739 /// ```
16740 pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16741 where
16742 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16743 {
16744 self.all_entities_metrics = v.map(|x| x.into());
16745 self
16746 }
16747
16748 /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
16749 ///
16750 /// # Example
16751 /// ```ignore,no_run
16752 /// # use google_cloud_documentai_v1::model::Evaluation;
16753 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16754 /// let x = Evaluation::new().set_entity_metrics([
16755 /// ("key0", MultiConfidenceMetrics::default()/* use setters */),
16756 /// ("key1", MultiConfidenceMetrics::default()/* use (different) setters */),
16757 /// ]);
16758 /// ```
16759 pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
16760 where
16761 T: std::iter::IntoIterator<Item = (K, V)>,
16762 K: std::convert::Into<std::string::String>,
16763 V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16764 {
16765 use std::iter::Iterator;
16766 self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16767 self
16768 }
16769
16770 /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
16771 ///
16772 /// # Example
16773 /// ```ignore,no_run
16774 /// # use google_cloud_documentai_v1::model::Evaluation;
16775 /// let x = Evaluation::new().set_kms_key_name("example");
16776 /// ```
16777 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16778 self.kms_key_name = v.into();
16779 self
16780 }
16781
16782 /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
16783 ///
16784 /// # Example
16785 /// ```ignore,no_run
16786 /// # use google_cloud_documentai_v1::model::Evaluation;
16787 /// let x = Evaluation::new().set_kms_key_version_name("example");
16788 /// ```
16789 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
16790 mut self,
16791 v: T,
16792 ) -> Self {
16793 self.kms_key_version_name = v.into();
16794 self
16795 }
16796}
16797
16798impl wkt::message::Message for Evaluation {
16799 fn typename() -> &'static str {
16800 "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
16801 }
16802}
16803
16804/// Defines additional types related to [Evaluation].
16805pub mod evaluation {
16806 #[allow(unused_imports)]
16807 use super::*;
16808
16809 /// Evaluation counters for the documents that were used.
16810 #[derive(Clone, Default, PartialEq)]
16811 #[non_exhaustive]
16812 pub struct Counters {
16813 /// How many documents were sent for evaluation.
16814 pub input_documents_count: i32,
16815
16816 /// How many documents were not included in the evaluation as they didn't
16817 /// pass validation.
16818 pub invalid_documents_count: i32,
16819
16820 /// How many documents were not included in the evaluation as Document AI
16821 /// failed to process them.
16822 pub failed_documents_count: i32,
16823
16824 /// How many documents were used in the evaluation.
16825 pub evaluated_documents_count: i32,
16826
16827 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16828 }
16829
16830 impl Counters {
16831 /// Creates a new default instance.
16832 pub fn new() -> Self {
16833 std::default::Default::default()
16834 }
16835
16836 /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
16837 ///
16838 /// # Example
16839 /// ```ignore,no_run
16840 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16841 /// let x = Counters::new().set_input_documents_count(42);
16842 /// ```
16843 pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16844 self.input_documents_count = v.into();
16845 self
16846 }
16847
16848 /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
16849 ///
16850 /// # Example
16851 /// ```ignore,no_run
16852 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16853 /// let x = Counters::new().set_invalid_documents_count(42);
16854 /// ```
16855 pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16856 self.invalid_documents_count = v.into();
16857 self
16858 }
16859
16860 /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
16861 ///
16862 /// # Example
16863 /// ```ignore,no_run
16864 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16865 /// let x = Counters::new().set_failed_documents_count(42);
16866 /// ```
16867 pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16868 self.failed_documents_count = v.into();
16869 self
16870 }
16871
16872 /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
16873 ///
16874 /// # Example
16875 /// ```ignore,no_run
16876 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16877 /// let x = Counters::new().set_evaluated_documents_count(42);
16878 /// ```
16879 pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16880 self.evaluated_documents_count = v.into();
16881 self
16882 }
16883 }
16884
16885 impl wkt::message::Message for Counters {
16886 fn typename() -> &'static str {
16887 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
16888 }
16889 }
16890
16891 /// Evaluation metrics, either in aggregate or about a specific entity.
16892 #[derive(Clone, Default, PartialEq)]
16893 #[non_exhaustive]
16894 pub struct Metrics {
16895 /// The calculated precision.
16896 pub precision: f32,
16897
16898 /// The calculated recall.
16899 pub recall: f32,
16900
16901 /// The calculated f1 score.
16902 pub f1_score: f32,
16903
16904 /// The amount of occurrences in predicted documents.
16905 pub predicted_occurrences_count: i32,
16906
16907 /// The amount of occurrences in ground truth documents.
16908 pub ground_truth_occurrences_count: i32,
16909
16910 /// The amount of documents with a predicted occurrence.
16911 pub predicted_document_count: i32,
16912
16913 /// The amount of documents with a ground truth occurrence.
16914 pub ground_truth_document_count: i32,
16915
16916 /// The amount of true positives.
16917 pub true_positives_count: i32,
16918
16919 /// The amount of false positives.
16920 pub false_positives_count: i32,
16921
16922 /// The amount of false negatives.
16923 pub false_negatives_count: i32,
16924
16925 /// The amount of documents that had an occurrence of this label.
16926 pub total_documents_count: i32,
16927
16928 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16929 }
16930
16931 impl Metrics {
16932 /// Creates a new default instance.
16933 pub fn new() -> Self {
16934 std::default::Default::default()
16935 }
16936
16937 /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
16938 ///
16939 /// # Example
16940 /// ```ignore,no_run
16941 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16942 /// let x = Metrics::new().set_precision(42.0);
16943 /// ```
16944 pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16945 self.precision = v.into();
16946 self
16947 }
16948
16949 /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
16950 ///
16951 /// # Example
16952 /// ```ignore,no_run
16953 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16954 /// let x = Metrics::new().set_recall(42.0);
16955 /// ```
16956 pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16957 self.recall = v.into();
16958 self
16959 }
16960
16961 /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
16962 ///
16963 /// # Example
16964 /// ```ignore,no_run
16965 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16966 /// let x = Metrics::new().set_f1_score(42.0);
16967 /// ```
16968 pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16969 self.f1_score = v.into();
16970 self
16971 }
16972
16973 /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
16974 ///
16975 /// # Example
16976 /// ```ignore,no_run
16977 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16978 /// let x = Metrics::new().set_predicted_occurrences_count(42);
16979 /// ```
16980 pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16981 self.predicted_occurrences_count = v.into();
16982 self
16983 }
16984
16985 /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
16986 ///
16987 /// # Example
16988 /// ```ignore,no_run
16989 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16990 /// let x = Metrics::new().set_ground_truth_occurrences_count(42);
16991 /// ```
16992 pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
16993 mut self,
16994 v: T,
16995 ) -> Self {
16996 self.ground_truth_occurrences_count = v.into();
16997 self
16998 }
16999
17000 /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
17001 ///
17002 /// # Example
17003 /// ```ignore,no_run
17004 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17005 /// let x = Metrics::new().set_predicted_document_count(42);
17006 /// ```
17007 pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17008 self.predicted_document_count = v.into();
17009 self
17010 }
17011
17012 /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
17013 ///
17014 /// # Example
17015 /// ```ignore,no_run
17016 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17017 /// let x = Metrics::new().set_ground_truth_document_count(42);
17018 /// ```
17019 pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17020 self.ground_truth_document_count = v.into();
17021 self
17022 }
17023
17024 /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
17025 ///
17026 /// # Example
17027 /// ```ignore,no_run
17028 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17029 /// let x = Metrics::new().set_true_positives_count(42);
17030 /// ```
17031 pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17032 self.true_positives_count = v.into();
17033 self
17034 }
17035
17036 /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
17037 ///
17038 /// # Example
17039 /// ```ignore,no_run
17040 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17041 /// let x = Metrics::new().set_false_positives_count(42);
17042 /// ```
17043 pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17044 self.false_positives_count = v.into();
17045 self
17046 }
17047
17048 /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
17049 ///
17050 /// # Example
17051 /// ```ignore,no_run
17052 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17053 /// let x = Metrics::new().set_false_negatives_count(42);
17054 /// ```
17055 pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17056 self.false_negatives_count = v.into();
17057 self
17058 }
17059
17060 /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
17061 ///
17062 /// # Example
17063 /// ```ignore,no_run
17064 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17065 /// let x = Metrics::new().set_total_documents_count(42);
17066 /// ```
17067 pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17068 self.total_documents_count = v.into();
17069 self
17070 }
17071 }
17072
17073 impl wkt::message::Message for Metrics {
17074 fn typename() -> &'static str {
17075 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
17076 }
17077 }
17078
17079 /// Evaluations metrics, at a specific confidence level.
17080 #[derive(Clone, Default, PartialEq)]
17081 #[non_exhaustive]
17082 pub struct ConfidenceLevelMetrics {
17083 /// The confidence level.
17084 pub confidence_level: f32,
17085
17086 /// The metrics at the specific confidence level.
17087 pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
17088
17089 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17090 }
17091
17092 impl ConfidenceLevelMetrics {
17093 /// Creates a new default instance.
17094 pub fn new() -> Self {
17095 std::default::Default::default()
17096 }
17097
17098 /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
17099 ///
17100 /// # Example
17101 /// ```ignore,no_run
17102 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17103 /// let x = ConfidenceLevelMetrics::new().set_confidence_level(42.0);
17104 /// ```
17105 pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17106 self.confidence_level = v.into();
17107 self
17108 }
17109
17110 /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
17111 ///
17112 /// # Example
17113 /// ```ignore,no_run
17114 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17115 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
17116 /// let x = ConfidenceLevelMetrics::new().set_metrics(Metrics::default()/* use setters */);
17117 /// ```
17118 pub fn set_metrics<T>(mut self, v: T) -> Self
17119 where
17120 T: std::convert::Into<crate::model::evaluation::Metrics>,
17121 {
17122 self.metrics = std::option::Option::Some(v.into());
17123 self
17124 }
17125
17126 /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
17127 ///
17128 /// # Example
17129 /// ```ignore,no_run
17130 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17131 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
17132 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(Some(Metrics::default()/* use setters */));
17133 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(None::<Metrics>);
17134 /// ```
17135 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
17136 where
17137 T: std::convert::Into<crate::model::evaluation::Metrics>,
17138 {
17139 self.metrics = v.map(|x| x.into());
17140 self
17141 }
17142 }
17143
17144 impl wkt::message::Message for ConfidenceLevelMetrics {
17145 fn typename() -> &'static str {
17146 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
17147 }
17148 }
17149
17150 /// Metrics across multiple confidence levels.
17151 #[derive(Clone, Default, PartialEq)]
17152 #[non_exhaustive]
17153 pub struct MultiConfidenceMetrics {
17154 /// Metrics across confidence levels with fuzzy matching enabled.
17155 pub confidence_level_metrics:
17156 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
17157
17158 /// Metrics across confidence levels with only exact matching.
17159 pub confidence_level_metrics_exact:
17160 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
17161
17162 /// The calculated area under the precision recall curve (AUPRC), computed by
17163 /// integrating over all confidence thresholds.
17164 pub auprc: f32,
17165
17166 /// The Estimated Calibration Error (ECE) of the confidence of the predicted
17167 /// entities.
17168 pub estimated_calibration_error: f32,
17169
17170 /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
17171 /// only.
17172 pub auprc_exact: f32,
17173
17174 /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
17175 /// exact matching only.
17176 pub estimated_calibration_error_exact: f32,
17177
17178 /// The metrics type for the label.
17179 pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
17180
17181 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17182 }
17183
17184 impl MultiConfidenceMetrics {
17185 /// Creates a new default instance.
17186 pub fn new() -> Self {
17187 std::default::Default::default()
17188 }
17189
17190 /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
17191 ///
17192 /// # Example
17193 /// ```ignore,no_run
17194 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17195 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17196 /// let x = MultiConfidenceMetrics::new()
17197 /// .set_confidence_level_metrics([
17198 /// ConfidenceLevelMetrics::default()/* use setters */,
17199 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
17200 /// ]);
17201 /// ```
17202 pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
17203 where
17204 T: std::iter::IntoIterator<Item = V>,
17205 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17206 {
17207 use std::iter::Iterator;
17208 self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
17209 self
17210 }
17211
17212 /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
17213 ///
17214 /// # Example
17215 /// ```ignore,no_run
17216 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17217 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17218 /// let x = MultiConfidenceMetrics::new()
17219 /// .set_confidence_level_metrics_exact([
17220 /// ConfidenceLevelMetrics::default()/* use setters */,
17221 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
17222 /// ]);
17223 /// ```
17224 pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
17225 where
17226 T: std::iter::IntoIterator<Item = V>,
17227 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17228 {
17229 use std::iter::Iterator;
17230 self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
17231 self
17232 }
17233
17234 /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
17235 ///
17236 /// # Example
17237 /// ```ignore,no_run
17238 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17239 /// let x = MultiConfidenceMetrics::new().set_auprc(42.0);
17240 /// ```
17241 pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17242 self.auprc = v.into();
17243 self
17244 }
17245
17246 /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
17247 ///
17248 /// # Example
17249 /// ```ignore,no_run
17250 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17251 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error(42.0);
17252 /// ```
17253 pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17254 self.estimated_calibration_error = v.into();
17255 self
17256 }
17257
17258 /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
17259 ///
17260 /// # Example
17261 /// ```ignore,no_run
17262 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17263 /// let x = MultiConfidenceMetrics::new().set_auprc_exact(42.0);
17264 /// ```
17265 pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17266 self.auprc_exact = v.into();
17267 self
17268 }
17269
17270 /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
17271 ///
17272 /// # Example
17273 /// ```ignore,no_run
17274 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17275 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error_exact(42.0);
17276 /// ```
17277 pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
17278 mut self,
17279 v: T,
17280 ) -> Self {
17281 self.estimated_calibration_error_exact = v.into();
17282 self
17283 }
17284
17285 /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
17286 ///
17287 /// # Example
17288 /// ```ignore,no_run
17289 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17290 /// use google_cloud_documentai_v1::model::evaluation::multi_confidence_metrics::MetricsType;
17291 /// let x0 = MultiConfidenceMetrics::new().set_metrics_type(MetricsType::Aggregate);
17292 /// ```
17293 pub fn set_metrics_type<
17294 T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
17295 >(
17296 mut self,
17297 v: T,
17298 ) -> Self {
17299 self.metrics_type = v.into();
17300 self
17301 }
17302 }
17303
17304 impl wkt::message::Message for MultiConfidenceMetrics {
17305 fn typename() -> &'static str {
17306 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
17307 }
17308 }
17309
17310 /// Defines additional types related to [MultiConfidenceMetrics].
17311 pub mod multi_confidence_metrics {
17312 #[allow(unused_imports)]
17313 use super::*;
17314
17315 /// A type that determines how metrics should be interpreted.
17316 ///
17317 /// # Working with unknown values
17318 ///
17319 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17320 /// additional enum variants at any time. Adding new variants is not considered
17321 /// a breaking change. Applications should write their code in anticipation of:
17322 ///
17323 /// - New values appearing in future releases of the client library, **and**
17324 /// - New values received dynamically, without application changes.
17325 ///
17326 /// Please consult the [Working with enums] section in the user guide for some
17327 /// guidelines.
17328 ///
17329 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17330 #[derive(Clone, Debug, PartialEq)]
17331 #[non_exhaustive]
17332 pub enum MetricsType {
17333 /// The metrics type is unspecified. By default, metrics without a
17334 /// particular specification are for leaf entity types (i.e., top-level
17335 /// entity types without child types, or child types which are not
17336 /// parent types themselves).
17337 Unspecified,
17338 /// Indicates whether metrics for this particular label type represent an
17339 /// aggregate of metrics for other types instead of being based on actual
17340 /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
17341 /// entity types are an aggregate of metrics for their children.
17342 Aggregate,
17343 /// If set, the enum was initialized with an unknown value.
17344 ///
17345 /// Applications can examine the value using [MetricsType::value] or
17346 /// [MetricsType::name].
17347 UnknownValue(metrics_type::UnknownValue),
17348 }
17349
17350 #[doc(hidden)]
17351 pub mod metrics_type {
17352 #[allow(unused_imports)]
17353 use super::*;
17354 #[derive(Clone, Debug, PartialEq)]
17355 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17356 }
17357
17358 impl MetricsType {
17359 /// Gets the enum value.
17360 ///
17361 /// Returns `None` if the enum contains an unknown value deserialized from
17362 /// the string representation of enums.
17363 pub fn value(&self) -> std::option::Option<i32> {
17364 match self {
17365 Self::Unspecified => std::option::Option::Some(0),
17366 Self::Aggregate => std::option::Option::Some(1),
17367 Self::UnknownValue(u) => u.0.value(),
17368 }
17369 }
17370
17371 /// Gets the enum value as a string.
17372 ///
17373 /// Returns `None` if the enum contains an unknown value deserialized from
17374 /// the integer representation of enums.
17375 pub fn name(&self) -> std::option::Option<&str> {
17376 match self {
17377 Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
17378 Self::Aggregate => std::option::Option::Some("AGGREGATE"),
17379 Self::UnknownValue(u) => u.0.name(),
17380 }
17381 }
17382 }
17383
17384 impl std::default::Default for MetricsType {
17385 fn default() -> Self {
17386 use std::convert::From;
17387 Self::from(0)
17388 }
17389 }
17390
17391 impl std::fmt::Display for MetricsType {
17392 fn fmt(
17393 &self,
17394 f: &mut std::fmt::Formatter<'_>,
17395 ) -> std::result::Result<(), std::fmt::Error> {
17396 wkt::internal::display_enum(f, self.name(), self.value())
17397 }
17398 }
17399
17400 impl std::convert::From<i32> for MetricsType {
17401 fn from(value: i32) -> Self {
17402 match value {
17403 0 => Self::Unspecified,
17404 1 => Self::Aggregate,
17405 _ => Self::UnknownValue(metrics_type::UnknownValue(
17406 wkt::internal::UnknownEnumValue::Integer(value),
17407 )),
17408 }
17409 }
17410 }
17411
17412 impl std::convert::From<&str> for MetricsType {
17413 fn from(value: &str) -> Self {
17414 use std::string::ToString;
17415 match value {
17416 "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
17417 "AGGREGATE" => Self::Aggregate,
17418 _ => Self::UnknownValue(metrics_type::UnknownValue(
17419 wkt::internal::UnknownEnumValue::String(value.to_string()),
17420 )),
17421 }
17422 }
17423 }
17424
17425 impl serde::ser::Serialize for MetricsType {
17426 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17427 where
17428 S: serde::Serializer,
17429 {
17430 match self {
17431 Self::Unspecified => serializer.serialize_i32(0),
17432 Self::Aggregate => serializer.serialize_i32(1),
17433 Self::UnknownValue(u) => u.0.serialize(serializer),
17434 }
17435 }
17436 }
17437
17438 impl<'de> serde::de::Deserialize<'de> for MetricsType {
17439 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17440 where
17441 D: serde::Deserializer<'de>,
17442 {
17443 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
17444 ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
17445 ))
17446 }
17447 }
17448 }
17449}
17450
17451/// A vertex represents a 2D point in the image.
17452/// NOTE: the vertex coordinates are in the same scale as the original image.
17453#[derive(Clone, Default, PartialEq)]
17454#[non_exhaustive]
17455pub struct Vertex {
17456 /// X coordinate.
17457 pub x: i32,
17458
17459 /// Y coordinate (starts from the top of the image).
17460 pub y: i32,
17461
17462 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17463}
17464
17465impl Vertex {
17466 /// Creates a new default instance.
17467 pub fn new() -> Self {
17468 std::default::Default::default()
17469 }
17470
17471 /// Sets the value of [x][crate::model::Vertex::x].
17472 ///
17473 /// # Example
17474 /// ```ignore,no_run
17475 /// # use google_cloud_documentai_v1::model::Vertex;
17476 /// let x = Vertex::new().set_x(42);
17477 /// ```
17478 pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17479 self.x = v.into();
17480 self
17481 }
17482
17483 /// Sets the value of [y][crate::model::Vertex::y].
17484 ///
17485 /// # Example
17486 /// ```ignore,no_run
17487 /// # use google_cloud_documentai_v1::model::Vertex;
17488 /// let x = Vertex::new().set_y(42);
17489 /// ```
17490 pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17491 self.y = v.into();
17492 self
17493 }
17494}
17495
17496impl wkt::message::Message for Vertex {
17497 fn typename() -> &'static str {
17498 "type.googleapis.com/google.cloud.documentai.v1.Vertex"
17499 }
17500}
17501
17502/// A vertex represents a 2D point in the image.
17503/// NOTE: the normalized vertex coordinates are relative to the original image
17504/// and range from 0 to 1.
17505#[derive(Clone, Default, PartialEq)]
17506#[non_exhaustive]
17507pub struct NormalizedVertex {
17508 /// X coordinate.
17509 pub x: f32,
17510
17511 /// Y coordinate (starts from the top of the image).
17512 pub y: f32,
17513
17514 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17515}
17516
17517impl NormalizedVertex {
17518 /// Creates a new default instance.
17519 pub fn new() -> Self {
17520 std::default::Default::default()
17521 }
17522
17523 /// Sets the value of [x][crate::model::NormalizedVertex::x].
17524 ///
17525 /// # Example
17526 /// ```ignore,no_run
17527 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17528 /// let x = NormalizedVertex::new().set_x(42.0);
17529 /// ```
17530 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17531 self.x = v.into();
17532 self
17533 }
17534
17535 /// Sets the value of [y][crate::model::NormalizedVertex::y].
17536 ///
17537 /// # Example
17538 /// ```ignore,no_run
17539 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17540 /// let x = NormalizedVertex::new().set_y(42.0);
17541 /// ```
17542 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17543 self.y = v.into();
17544 self
17545 }
17546}
17547
17548impl wkt::message::Message for NormalizedVertex {
17549 fn typename() -> &'static str {
17550 "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
17551 }
17552}
17553
17554/// A bounding polygon for the detected image annotation.
17555#[derive(Clone, Default, PartialEq)]
17556#[non_exhaustive]
17557pub struct BoundingPoly {
17558 /// The bounding polygon vertices.
17559 pub vertices: std::vec::Vec<crate::model::Vertex>,
17560
17561 /// The bounding polygon normalized vertices.
17562 pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
17563
17564 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17565}
17566
17567impl BoundingPoly {
17568 /// Creates a new default instance.
17569 pub fn new() -> Self {
17570 std::default::Default::default()
17571 }
17572
17573 /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
17574 ///
17575 /// # Example
17576 /// ```ignore,no_run
17577 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17578 /// use google_cloud_documentai_v1::model::Vertex;
17579 /// let x = BoundingPoly::new()
17580 /// .set_vertices([
17581 /// Vertex::default()/* use setters */,
17582 /// Vertex::default()/* use (different) setters */,
17583 /// ]);
17584 /// ```
17585 pub fn set_vertices<T, V>(mut self, v: T) -> Self
17586 where
17587 T: std::iter::IntoIterator<Item = V>,
17588 V: std::convert::Into<crate::model::Vertex>,
17589 {
17590 use std::iter::Iterator;
17591 self.vertices = v.into_iter().map(|i| i.into()).collect();
17592 self
17593 }
17594
17595 /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
17596 ///
17597 /// # Example
17598 /// ```ignore,no_run
17599 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17600 /// use google_cloud_documentai_v1::model::NormalizedVertex;
17601 /// let x = BoundingPoly::new()
17602 /// .set_normalized_vertices([
17603 /// NormalizedVertex::default()/* use setters */,
17604 /// NormalizedVertex::default()/* use (different) setters */,
17605 /// ]);
17606 /// ```
17607 pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
17608 where
17609 T: std::iter::IntoIterator<Item = V>,
17610 V: std::convert::Into<crate::model::NormalizedVertex>,
17611 {
17612 use std::iter::Iterator;
17613 self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
17614 self
17615 }
17616}
17617
17618impl wkt::message::Message for BoundingPoly {
17619 fn typename() -> &'static str {
17620 "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
17621 }
17622}
17623
17624/// The common metadata for long running operations.
17625#[derive(Clone, Default, PartialEq)]
17626#[non_exhaustive]
17627pub struct CommonOperationMetadata {
17628 /// The state of the operation.
17629 pub state: crate::model::common_operation_metadata::State,
17630
17631 /// A message providing more details about the current state of processing.
17632 pub state_message: std::string::String,
17633
17634 /// A related resource to this operation.
17635 pub resource: std::string::String,
17636
17637 /// The creation time of the operation.
17638 pub create_time: std::option::Option<wkt::Timestamp>,
17639
17640 /// The last update time of the operation.
17641 pub update_time: std::option::Option<wkt::Timestamp>,
17642
17643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17644}
17645
17646impl CommonOperationMetadata {
17647 /// Creates a new default instance.
17648 pub fn new() -> Self {
17649 std::default::Default::default()
17650 }
17651
17652 /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
17653 ///
17654 /// # Example
17655 /// ```ignore,no_run
17656 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17657 /// use google_cloud_documentai_v1::model::common_operation_metadata::State;
17658 /// let x0 = CommonOperationMetadata::new().set_state(State::Running);
17659 /// let x1 = CommonOperationMetadata::new().set_state(State::Cancelling);
17660 /// let x2 = CommonOperationMetadata::new().set_state(State::Succeeded);
17661 /// ```
17662 pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
17663 mut self,
17664 v: T,
17665 ) -> Self {
17666 self.state = v.into();
17667 self
17668 }
17669
17670 /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
17671 ///
17672 /// # Example
17673 /// ```ignore,no_run
17674 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17675 /// let x = CommonOperationMetadata::new().set_state_message("example");
17676 /// ```
17677 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17678 self.state_message = v.into();
17679 self
17680 }
17681
17682 /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
17683 ///
17684 /// # Example
17685 /// ```ignore,no_run
17686 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17687 /// let x = CommonOperationMetadata::new().set_resource("example");
17688 /// ```
17689 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17690 self.resource = v.into();
17691 self
17692 }
17693
17694 /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17695 ///
17696 /// # Example
17697 /// ```ignore,no_run
17698 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17699 /// use wkt::Timestamp;
17700 /// let x = CommonOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17701 /// ```
17702 pub fn set_create_time<T>(mut self, v: T) -> Self
17703 where
17704 T: std::convert::Into<wkt::Timestamp>,
17705 {
17706 self.create_time = std::option::Option::Some(v.into());
17707 self
17708 }
17709
17710 /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17711 ///
17712 /// # Example
17713 /// ```ignore,no_run
17714 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17715 /// use wkt::Timestamp;
17716 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17717 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17718 /// ```
17719 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17720 where
17721 T: std::convert::Into<wkt::Timestamp>,
17722 {
17723 self.create_time = v.map(|x| x.into());
17724 self
17725 }
17726
17727 /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17728 ///
17729 /// # Example
17730 /// ```ignore,no_run
17731 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17732 /// use wkt::Timestamp;
17733 /// let x = CommonOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
17734 /// ```
17735 pub fn set_update_time<T>(mut self, v: T) -> Self
17736 where
17737 T: std::convert::Into<wkt::Timestamp>,
17738 {
17739 self.update_time = std::option::Option::Some(v.into());
17740 self
17741 }
17742
17743 /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17744 ///
17745 /// # Example
17746 /// ```ignore,no_run
17747 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17748 /// use wkt::Timestamp;
17749 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17750 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
17751 /// ```
17752 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17753 where
17754 T: std::convert::Into<wkt::Timestamp>,
17755 {
17756 self.update_time = v.map(|x| x.into());
17757 self
17758 }
17759}
17760
17761impl wkt::message::Message for CommonOperationMetadata {
17762 fn typename() -> &'static str {
17763 "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
17764 }
17765}
17766
17767/// Defines additional types related to [CommonOperationMetadata].
17768pub mod common_operation_metadata {
17769 #[allow(unused_imports)]
17770 use super::*;
17771
17772 /// State of the longrunning operation.
17773 ///
17774 /// # Working with unknown values
17775 ///
17776 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17777 /// additional enum variants at any time. Adding new variants is not considered
17778 /// a breaking change. Applications should write their code in anticipation of:
17779 ///
17780 /// - New values appearing in future releases of the client library, **and**
17781 /// - New values received dynamically, without application changes.
17782 ///
17783 /// Please consult the [Working with enums] section in the user guide for some
17784 /// guidelines.
17785 ///
17786 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17787 #[derive(Clone, Debug, PartialEq)]
17788 #[non_exhaustive]
17789 pub enum State {
17790 /// Unspecified state.
17791 Unspecified,
17792 /// Operation is still running.
17793 Running,
17794 /// Operation is being cancelled.
17795 Cancelling,
17796 /// Operation succeeded.
17797 Succeeded,
17798 /// Operation failed.
17799 Failed,
17800 /// Operation is cancelled.
17801 Cancelled,
17802 /// If set, the enum was initialized with an unknown value.
17803 ///
17804 /// Applications can examine the value using [State::value] or
17805 /// [State::name].
17806 UnknownValue(state::UnknownValue),
17807 }
17808
17809 #[doc(hidden)]
17810 pub mod state {
17811 #[allow(unused_imports)]
17812 use super::*;
17813 #[derive(Clone, Debug, PartialEq)]
17814 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17815 }
17816
17817 impl State {
17818 /// Gets the enum value.
17819 ///
17820 /// Returns `None` if the enum contains an unknown value deserialized from
17821 /// the string representation of enums.
17822 pub fn value(&self) -> std::option::Option<i32> {
17823 match self {
17824 Self::Unspecified => std::option::Option::Some(0),
17825 Self::Running => std::option::Option::Some(1),
17826 Self::Cancelling => std::option::Option::Some(2),
17827 Self::Succeeded => std::option::Option::Some(3),
17828 Self::Failed => std::option::Option::Some(4),
17829 Self::Cancelled => std::option::Option::Some(5),
17830 Self::UnknownValue(u) => u.0.value(),
17831 }
17832 }
17833
17834 /// Gets the enum value as a string.
17835 ///
17836 /// Returns `None` if the enum contains an unknown value deserialized from
17837 /// the integer representation of enums.
17838 pub fn name(&self) -> std::option::Option<&str> {
17839 match self {
17840 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17841 Self::Running => std::option::Option::Some("RUNNING"),
17842 Self::Cancelling => std::option::Option::Some("CANCELLING"),
17843 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
17844 Self::Failed => std::option::Option::Some("FAILED"),
17845 Self::Cancelled => std::option::Option::Some("CANCELLED"),
17846 Self::UnknownValue(u) => u.0.name(),
17847 }
17848 }
17849 }
17850
17851 impl std::default::Default for State {
17852 fn default() -> Self {
17853 use std::convert::From;
17854 Self::from(0)
17855 }
17856 }
17857
17858 impl std::fmt::Display for State {
17859 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17860 wkt::internal::display_enum(f, self.name(), self.value())
17861 }
17862 }
17863
17864 impl std::convert::From<i32> for State {
17865 fn from(value: i32) -> Self {
17866 match value {
17867 0 => Self::Unspecified,
17868 1 => Self::Running,
17869 2 => Self::Cancelling,
17870 3 => Self::Succeeded,
17871 4 => Self::Failed,
17872 5 => Self::Cancelled,
17873 _ => Self::UnknownValue(state::UnknownValue(
17874 wkt::internal::UnknownEnumValue::Integer(value),
17875 )),
17876 }
17877 }
17878 }
17879
17880 impl std::convert::From<&str> for State {
17881 fn from(value: &str) -> Self {
17882 use std::string::ToString;
17883 match value {
17884 "STATE_UNSPECIFIED" => Self::Unspecified,
17885 "RUNNING" => Self::Running,
17886 "CANCELLING" => Self::Cancelling,
17887 "SUCCEEDED" => Self::Succeeded,
17888 "FAILED" => Self::Failed,
17889 "CANCELLED" => Self::Cancelled,
17890 _ => Self::UnknownValue(state::UnknownValue(
17891 wkt::internal::UnknownEnumValue::String(value.to_string()),
17892 )),
17893 }
17894 }
17895 }
17896
17897 impl serde::ser::Serialize for State {
17898 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17899 where
17900 S: serde::Serializer,
17901 {
17902 match self {
17903 Self::Unspecified => serializer.serialize_i32(0),
17904 Self::Running => serializer.serialize_i32(1),
17905 Self::Cancelling => serializer.serialize_i32(2),
17906 Self::Succeeded => serializer.serialize_i32(3),
17907 Self::Failed => serializer.serialize_i32(4),
17908 Self::Cancelled => serializer.serialize_i32(5),
17909 Self::UnknownValue(u) => u.0.serialize(serializer),
17910 }
17911 }
17912 }
17913
17914 impl<'de> serde::de::Deserialize<'de> for State {
17915 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17916 where
17917 D: serde::Deserializer<'de>,
17918 {
17919 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17920 ".google.cloud.documentai.v1.CommonOperationMetadata.State",
17921 ))
17922 }
17923 }
17924}
17925
17926/// A processor version is an implementation of a processor. Each processor
17927/// can have multiple versions, pretrained by Google internally or uptrained
17928/// by the customer. A processor can only have one default version at a time.
17929/// Its document-processing behavior is defined by that version.
17930#[derive(Clone, Default, PartialEq)]
17931#[non_exhaustive]
17932pub struct ProcessorVersion {
17933 /// Identifier. The resource name of the processor version.
17934 /// Format:
17935 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
17936 pub name: std::string::String,
17937
17938 /// The display name of the processor version.
17939 pub display_name: std::string::String,
17940
17941 /// Output only. The schema of the processor version. Describes the output.
17942 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
17943
17944 /// Output only. The state of the processor version.
17945 pub state: crate::model::processor_version::State,
17946
17947 /// Output only. The time the processor version was created.
17948 pub create_time: std::option::Option<wkt::Timestamp>,
17949
17950 /// Output only. The most recently invoked evaluation for the processor
17951 /// version.
17952 pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
17953
17954 /// Output only. The KMS key name used for encryption.
17955 pub kms_key_name: std::string::String,
17956
17957 /// Output only. The KMS key version with which data is encrypted.
17958 pub kms_key_version_name: std::string::String,
17959
17960 /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
17961 pub google_managed: bool,
17962
17963 /// Output only. If set, information about the eventual deprecation of this
17964 /// version.
17965 pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
17966
17967 /// Output only. The model type of this processor version.
17968 pub model_type: crate::model::processor_version::ModelType,
17969
17970 /// Output only. Reserved for future use.
17971 pub satisfies_pzs: bool,
17972
17973 /// Output only. Reserved for future use.
17974 pub satisfies_pzi: bool,
17975
17976 /// Output only. Information about Generative AI model-based processor
17977 /// versions.
17978 pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
17979
17980 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17981}
17982
17983impl ProcessorVersion {
17984 /// Creates a new default instance.
17985 pub fn new() -> Self {
17986 std::default::Default::default()
17987 }
17988
17989 /// Sets the value of [name][crate::model::ProcessorVersion::name].
17990 ///
17991 /// # Example
17992 /// ```ignore,no_run
17993 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17994 /// # let project_id = "project_id";
17995 /// # let location_id = "location_id";
17996 /// # let processor_id = "processor_id";
17997 /// # let processor_version_id = "processor_version_id";
17998 /// let x = ProcessorVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
17999 /// ```
18000 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18001 self.name = v.into();
18002 self
18003 }
18004
18005 /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
18006 ///
18007 /// # Example
18008 /// ```ignore,no_run
18009 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18010 /// let x = ProcessorVersion::new().set_display_name("example");
18011 /// ```
18012 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18013 self.display_name = v.into();
18014 self
18015 }
18016
18017 /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
18018 ///
18019 /// # Example
18020 /// ```ignore,no_run
18021 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18022 /// use google_cloud_documentai_v1::model::DocumentSchema;
18023 /// let x = ProcessorVersion::new().set_document_schema(DocumentSchema::default()/* use setters */);
18024 /// ```
18025 pub fn set_document_schema<T>(mut self, v: T) -> Self
18026 where
18027 T: std::convert::Into<crate::model::DocumentSchema>,
18028 {
18029 self.document_schema = std::option::Option::Some(v.into());
18030 self
18031 }
18032
18033 /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
18034 ///
18035 /// # Example
18036 /// ```ignore,no_run
18037 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18038 /// use google_cloud_documentai_v1::model::DocumentSchema;
18039 /// let x = ProcessorVersion::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
18040 /// let x = ProcessorVersion::new().set_or_clear_document_schema(None::<DocumentSchema>);
18041 /// ```
18042 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
18043 where
18044 T: std::convert::Into<crate::model::DocumentSchema>,
18045 {
18046 self.document_schema = v.map(|x| x.into());
18047 self
18048 }
18049
18050 /// Sets the value of [state][crate::model::ProcessorVersion::state].
18051 ///
18052 /// # Example
18053 /// ```ignore,no_run
18054 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18055 /// use google_cloud_documentai_v1::model::processor_version::State;
18056 /// let x0 = ProcessorVersion::new().set_state(State::Deployed);
18057 /// let x1 = ProcessorVersion::new().set_state(State::Deploying);
18058 /// let x2 = ProcessorVersion::new().set_state(State::Undeployed);
18059 /// ```
18060 pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
18061 mut self,
18062 v: T,
18063 ) -> Self {
18064 self.state = v.into();
18065 self
18066 }
18067
18068 /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
18069 ///
18070 /// # Example
18071 /// ```ignore,no_run
18072 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18073 /// use wkt::Timestamp;
18074 /// let x = ProcessorVersion::new().set_create_time(Timestamp::default()/* use setters */);
18075 /// ```
18076 pub fn set_create_time<T>(mut self, v: T) -> Self
18077 where
18078 T: std::convert::Into<wkt::Timestamp>,
18079 {
18080 self.create_time = std::option::Option::Some(v.into());
18081 self
18082 }
18083
18084 /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
18085 ///
18086 /// # Example
18087 /// ```ignore,no_run
18088 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18089 /// use wkt::Timestamp;
18090 /// let x = ProcessorVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18091 /// let x = ProcessorVersion::new().set_or_clear_create_time(None::<Timestamp>);
18092 /// ```
18093 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18094 where
18095 T: std::convert::Into<wkt::Timestamp>,
18096 {
18097 self.create_time = v.map(|x| x.into());
18098 self
18099 }
18100
18101 /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
18102 ///
18103 /// # Example
18104 /// ```ignore,no_run
18105 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18106 /// use google_cloud_documentai_v1::model::EvaluationReference;
18107 /// let x = ProcessorVersion::new().set_latest_evaluation(EvaluationReference::default()/* use setters */);
18108 /// ```
18109 pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
18110 where
18111 T: std::convert::Into<crate::model::EvaluationReference>,
18112 {
18113 self.latest_evaluation = std::option::Option::Some(v.into());
18114 self
18115 }
18116
18117 /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
18118 ///
18119 /// # Example
18120 /// ```ignore,no_run
18121 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18122 /// use google_cloud_documentai_v1::model::EvaluationReference;
18123 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(Some(EvaluationReference::default()/* use setters */));
18124 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(None::<EvaluationReference>);
18125 /// ```
18126 pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
18127 where
18128 T: std::convert::Into<crate::model::EvaluationReference>,
18129 {
18130 self.latest_evaluation = v.map(|x| x.into());
18131 self
18132 }
18133
18134 /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
18135 ///
18136 /// # Example
18137 /// ```ignore,no_run
18138 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18139 /// let x = ProcessorVersion::new().set_kms_key_name("example");
18140 /// ```
18141 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18142 self.kms_key_name = v.into();
18143 self
18144 }
18145
18146 /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
18147 ///
18148 /// # Example
18149 /// ```ignore,no_run
18150 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18151 /// let x = ProcessorVersion::new().set_kms_key_version_name("example");
18152 /// ```
18153 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
18154 mut self,
18155 v: T,
18156 ) -> Self {
18157 self.kms_key_version_name = v.into();
18158 self
18159 }
18160
18161 /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
18162 ///
18163 /// # Example
18164 /// ```ignore,no_run
18165 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18166 /// let x = ProcessorVersion::new().set_google_managed(true);
18167 /// ```
18168 pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18169 self.google_managed = v.into();
18170 self
18171 }
18172
18173 /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
18174 ///
18175 /// # Example
18176 /// ```ignore,no_run
18177 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18178 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18179 /// let x = ProcessorVersion::new().set_deprecation_info(DeprecationInfo::default()/* use setters */);
18180 /// ```
18181 pub fn set_deprecation_info<T>(mut self, v: T) -> Self
18182 where
18183 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
18184 {
18185 self.deprecation_info = std::option::Option::Some(v.into());
18186 self
18187 }
18188
18189 /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
18190 ///
18191 /// # Example
18192 /// ```ignore,no_run
18193 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18194 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18195 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(Some(DeprecationInfo::default()/* use setters */));
18196 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(None::<DeprecationInfo>);
18197 /// ```
18198 pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
18199 where
18200 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
18201 {
18202 self.deprecation_info = v.map(|x| x.into());
18203 self
18204 }
18205
18206 /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
18207 ///
18208 /// # Example
18209 /// ```ignore,no_run
18210 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18211 /// use google_cloud_documentai_v1::model::processor_version::ModelType;
18212 /// let x0 = ProcessorVersion::new().set_model_type(ModelType::Generative);
18213 /// let x1 = ProcessorVersion::new().set_model_type(ModelType::Custom);
18214 /// ```
18215 pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
18216 mut self,
18217 v: T,
18218 ) -> Self {
18219 self.model_type = v.into();
18220 self
18221 }
18222
18223 /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
18224 ///
18225 /// # Example
18226 /// ```ignore,no_run
18227 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18228 /// let x = ProcessorVersion::new().set_satisfies_pzs(true);
18229 /// ```
18230 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18231 self.satisfies_pzs = v.into();
18232 self
18233 }
18234
18235 /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
18236 ///
18237 /// # Example
18238 /// ```ignore,no_run
18239 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18240 /// let x = ProcessorVersion::new().set_satisfies_pzi(true);
18241 /// ```
18242 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18243 self.satisfies_pzi = v.into();
18244 self
18245 }
18246
18247 /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18248 ///
18249 /// # Example
18250 /// ```ignore,no_run
18251 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18252 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18253 /// let x = ProcessorVersion::new().set_gen_ai_model_info(GenAiModelInfo::default()/* use setters */);
18254 /// ```
18255 pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
18256 where
18257 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18258 {
18259 self.gen_ai_model_info = std::option::Option::Some(v.into());
18260 self
18261 }
18262
18263 /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18264 ///
18265 /// # Example
18266 /// ```ignore,no_run
18267 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18268 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18269 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(Some(GenAiModelInfo::default()/* use setters */));
18270 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(None::<GenAiModelInfo>);
18271 /// ```
18272 pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
18273 where
18274 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18275 {
18276 self.gen_ai_model_info = v.map(|x| x.into());
18277 self
18278 }
18279}
18280
18281impl wkt::message::Message for ProcessorVersion {
18282 fn typename() -> &'static str {
18283 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
18284 }
18285}
18286
18287/// Defines additional types related to [ProcessorVersion].
18288pub mod processor_version {
18289 #[allow(unused_imports)]
18290 use super::*;
18291
18292 /// Information about the upcoming deprecation of this processor version.
18293 #[derive(Clone, Default, PartialEq)]
18294 #[non_exhaustive]
18295 pub struct DeprecationInfo {
18296 /// The time at which this processor version will be deprecated.
18297 pub deprecation_time: std::option::Option<wkt::Timestamp>,
18298
18299 /// If set, the processor version that will be used as a replacement.
18300 pub replacement_processor_version: std::string::String,
18301
18302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18303 }
18304
18305 impl DeprecationInfo {
18306 /// Creates a new default instance.
18307 pub fn new() -> Self {
18308 std::default::Default::default()
18309 }
18310
18311 /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18312 ///
18313 /// # Example
18314 /// ```ignore,no_run
18315 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18316 /// use wkt::Timestamp;
18317 /// let x = DeprecationInfo::new().set_deprecation_time(Timestamp::default()/* use setters */);
18318 /// ```
18319 pub fn set_deprecation_time<T>(mut self, v: T) -> Self
18320 where
18321 T: std::convert::Into<wkt::Timestamp>,
18322 {
18323 self.deprecation_time = std::option::Option::Some(v.into());
18324 self
18325 }
18326
18327 /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18328 ///
18329 /// # Example
18330 /// ```ignore,no_run
18331 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18332 /// use wkt::Timestamp;
18333 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(Some(Timestamp::default()/* use setters */));
18334 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(None::<Timestamp>);
18335 /// ```
18336 pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
18337 where
18338 T: std::convert::Into<wkt::Timestamp>,
18339 {
18340 self.deprecation_time = v.map(|x| x.into());
18341 self
18342 }
18343
18344 /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
18345 ///
18346 /// # Example
18347 /// ```ignore,no_run
18348 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18349 /// # let project_id = "project_id";
18350 /// # let location_id = "location_id";
18351 /// # let processor_id = "processor_id";
18352 /// # let processor_version_id = "processor_version_id";
18353 /// let x = DeprecationInfo::new().set_replacement_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
18354 /// ```
18355 pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
18356 mut self,
18357 v: T,
18358 ) -> Self {
18359 self.replacement_processor_version = v.into();
18360 self
18361 }
18362 }
18363
18364 impl wkt::message::Message for DeprecationInfo {
18365 fn typename() -> &'static str {
18366 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
18367 }
18368 }
18369
18370 /// Information about Generative AI model-based processor versions.
18371 #[derive(Clone, Default, PartialEq)]
18372 #[non_exhaustive]
18373 pub struct GenAiModelInfo {
18374 /// The processor version is either a pretrained Google-managed foundation
18375 /// model or a custom Generative AI model created by the user.
18376 pub model_info:
18377 std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
18378
18379 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18380 }
18381
18382 impl GenAiModelInfo {
18383 /// Creates a new default instance.
18384 pub fn new() -> Self {
18385 std::default::Default::default()
18386 }
18387
18388 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
18389 ///
18390 /// Note that all the setters affecting `model_info` are mutually
18391 /// exclusive.
18392 ///
18393 /// # Example
18394 /// ```ignore,no_run
18395 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18396 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18397 /// let x = GenAiModelInfo::new().set_model_info(Some(
18398 /// google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(FoundationGenAiModelInfo::default().into())));
18399 /// ```
18400 pub fn set_model_info<
18401 T: std::convert::Into<
18402 std::option::Option<
18403 crate::model::processor_version::gen_ai_model_info::ModelInfo,
18404 >,
18405 >,
18406 >(
18407 mut self,
18408 v: T,
18409 ) -> Self {
18410 self.model_info = v.into();
18411 self
18412 }
18413
18414 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18415 /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
18416 /// holds a different branch.
18417 pub fn foundation_gen_ai_model_info(
18418 &self,
18419 ) -> std::option::Option<
18420 &std::boxed::Box<
18421 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18422 >,
18423 > {
18424 #[allow(unreachable_patterns)]
18425 self.model_info.as_ref().and_then(|v| match v {
18426 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
18427 _ => std::option::Option::None,
18428 })
18429 }
18430
18431 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18432 /// to hold a `FoundationGenAiModelInfo`.
18433 ///
18434 /// Note that all the setters affecting `model_info` are
18435 /// mutually exclusive.
18436 ///
18437 /// # Example
18438 /// ```ignore,no_run
18439 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18440 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18441 /// let x = GenAiModelInfo::new().set_foundation_gen_ai_model_info(FoundationGenAiModelInfo::default()/* use setters */);
18442 /// assert!(x.foundation_gen_ai_model_info().is_some());
18443 /// assert!(x.custom_gen_ai_model_info().is_none());
18444 /// ```
18445 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{
18446 self.model_info = std::option::Option::Some(
18447 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
18448 v.into()
18449 )
18450 );
18451 self
18452 }
18453
18454 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18455 /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
18456 /// holds a different branch.
18457 pub fn custom_gen_ai_model_info(
18458 &self,
18459 ) -> std::option::Option<
18460 &std::boxed::Box<
18461 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18462 >,
18463 > {
18464 #[allow(unreachable_patterns)]
18465 self.model_info.as_ref().and_then(|v| match v {
18466 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
18467 _ => std::option::Option::None,
18468 })
18469 }
18470
18471 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18472 /// to hold a `CustomGenAiModelInfo`.
18473 ///
18474 /// Note that all the setters affecting `model_info` are
18475 /// mutually exclusive.
18476 ///
18477 /// # Example
18478 /// ```ignore,no_run
18479 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18480 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18481 /// let x = GenAiModelInfo::new().set_custom_gen_ai_model_info(CustomGenAiModelInfo::default()/* use setters */);
18482 /// assert!(x.custom_gen_ai_model_info().is_some());
18483 /// assert!(x.foundation_gen_ai_model_info().is_none());
18484 /// ```
18485 pub fn set_custom_gen_ai_model_info<
18486 T: std::convert::Into<
18487 std::boxed::Box<
18488 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18489 >,
18490 >,
18491 >(
18492 mut self,
18493 v: T,
18494 ) -> Self {
18495 self.model_info = std::option::Option::Some(
18496 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
18497 v.into(),
18498 ),
18499 );
18500 self
18501 }
18502 }
18503
18504 impl wkt::message::Message for GenAiModelInfo {
18505 fn typename() -> &'static str {
18506 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
18507 }
18508 }
18509
18510 /// Defines additional types related to [GenAiModelInfo].
18511 pub mod gen_ai_model_info {
18512 #[allow(unused_imports)]
18513 use super::*;
18514
18515 /// Information for a pretrained Google-managed foundation model.
18516 #[derive(Clone, Default, PartialEq)]
18517 #[non_exhaustive]
18518 pub struct FoundationGenAiModelInfo {
18519 /// Whether finetuning is allowed for this base processor version.
18520 pub finetuning_allowed: bool,
18521
18522 /// The minimum number of labeled documents in the training dataset
18523 /// required for finetuning.
18524 pub min_train_labeled_documents: i32,
18525
18526 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18527 }
18528
18529 impl FoundationGenAiModelInfo {
18530 /// Creates a new default instance.
18531 pub fn new() -> Self {
18532 std::default::Default::default()
18533 }
18534
18535 /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
18536 ///
18537 /// # Example
18538 /// ```ignore,no_run
18539 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18540 /// let x = FoundationGenAiModelInfo::new().set_finetuning_allowed(true);
18541 /// ```
18542 pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18543 self.finetuning_allowed = v.into();
18544 self
18545 }
18546
18547 /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
18548 ///
18549 /// # Example
18550 /// ```ignore,no_run
18551 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18552 /// let x = FoundationGenAiModelInfo::new().set_min_train_labeled_documents(42);
18553 /// ```
18554 pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
18555 mut self,
18556 v: T,
18557 ) -> Self {
18558 self.min_train_labeled_documents = v.into();
18559 self
18560 }
18561 }
18562
18563 impl wkt::message::Message for FoundationGenAiModelInfo {
18564 fn typename() -> &'static str {
18565 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
18566 }
18567 }
18568
18569 /// Information for a custom Generative AI model created by the user. These
18570 /// are created with `Create New Version` in either the `Call foundation
18571 /// model` or `Fine tuning` tabs.
18572 #[derive(Clone, Default, PartialEq)]
18573 #[non_exhaustive]
18574 pub struct CustomGenAiModelInfo {
18575
18576 /// The type of custom model created by the user.
18577 pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
18578
18579 /// The base processor version ID for the custom model.
18580 pub base_processor_version_id: std::string::String,
18581
18582 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18583 }
18584
18585 impl CustomGenAiModelInfo {
18586 /// Creates a new default instance.
18587 pub fn new() -> Self {
18588 std::default::Default::default()
18589 }
18590
18591 /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
18592 ///
18593 /// # Example
18594 /// ```ignore,no_run
18595 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18596 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType;
18597 /// let x0 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::VersionedFoundation);
18598 /// let x1 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::FineTuned);
18599 /// ```
18600 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{
18601 self.custom_model_type = v.into();
18602 self
18603 }
18604
18605 /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
18606 ///
18607 /// # Example
18608 /// ```ignore,no_run
18609 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18610 /// let x = CustomGenAiModelInfo::new().set_base_processor_version_id("example");
18611 /// ```
18612 pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
18613 mut self,
18614 v: T,
18615 ) -> Self {
18616 self.base_processor_version_id = v.into();
18617 self
18618 }
18619 }
18620
18621 impl wkt::message::Message for CustomGenAiModelInfo {
18622 fn typename() -> &'static str {
18623 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
18624 }
18625 }
18626
18627 /// Defines additional types related to [CustomGenAiModelInfo].
18628 pub mod custom_gen_ai_model_info {
18629 #[allow(unused_imports)]
18630 use super::*;
18631
18632 /// The type of custom model created by the user.
18633 ///
18634 /// # Working with unknown values
18635 ///
18636 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18637 /// additional enum variants at any time. Adding new variants is not considered
18638 /// a breaking change. Applications should write their code in anticipation of:
18639 ///
18640 /// - New values appearing in future releases of the client library, **and**
18641 /// - New values received dynamically, without application changes.
18642 ///
18643 /// Please consult the [Working with enums] section in the user guide for some
18644 /// guidelines.
18645 ///
18646 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18647 #[derive(Clone, Debug, PartialEq)]
18648 #[non_exhaustive]
18649 pub enum CustomModelType {
18650 /// The model type is unspecified.
18651 Unspecified,
18652 /// The model is a versioned foundation model.
18653 VersionedFoundation,
18654 /// The model is a finetuned foundation model.
18655 FineTuned,
18656 /// If set, the enum was initialized with an unknown value.
18657 ///
18658 /// Applications can examine the value using [CustomModelType::value] or
18659 /// [CustomModelType::name].
18660 UnknownValue(custom_model_type::UnknownValue),
18661 }
18662
18663 #[doc(hidden)]
18664 pub mod custom_model_type {
18665 #[allow(unused_imports)]
18666 use super::*;
18667 #[derive(Clone, Debug, PartialEq)]
18668 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18669 }
18670
18671 impl CustomModelType {
18672 /// Gets the enum value.
18673 ///
18674 /// Returns `None` if the enum contains an unknown value deserialized from
18675 /// the string representation of enums.
18676 pub fn value(&self) -> std::option::Option<i32> {
18677 match self {
18678 Self::Unspecified => std::option::Option::Some(0),
18679 Self::VersionedFoundation => std::option::Option::Some(1),
18680 Self::FineTuned => std::option::Option::Some(2),
18681 Self::UnknownValue(u) => u.0.value(),
18682 }
18683 }
18684
18685 /// Gets the enum value as a string.
18686 ///
18687 /// Returns `None` if the enum contains an unknown value deserialized from
18688 /// the integer representation of enums.
18689 pub fn name(&self) -> std::option::Option<&str> {
18690 match self {
18691 Self::Unspecified => {
18692 std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
18693 }
18694 Self::VersionedFoundation => {
18695 std::option::Option::Some("VERSIONED_FOUNDATION")
18696 }
18697 Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
18698 Self::UnknownValue(u) => u.0.name(),
18699 }
18700 }
18701 }
18702
18703 impl std::default::Default for CustomModelType {
18704 fn default() -> Self {
18705 use std::convert::From;
18706 Self::from(0)
18707 }
18708 }
18709
18710 impl std::fmt::Display for CustomModelType {
18711 fn fmt(
18712 &self,
18713 f: &mut std::fmt::Formatter<'_>,
18714 ) -> std::result::Result<(), std::fmt::Error> {
18715 wkt::internal::display_enum(f, self.name(), self.value())
18716 }
18717 }
18718
18719 impl std::convert::From<i32> for CustomModelType {
18720 fn from(value: i32) -> Self {
18721 match value {
18722 0 => Self::Unspecified,
18723 1 => Self::VersionedFoundation,
18724 2 => Self::FineTuned,
18725 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18726 wkt::internal::UnknownEnumValue::Integer(value),
18727 )),
18728 }
18729 }
18730 }
18731
18732 impl std::convert::From<&str> for CustomModelType {
18733 fn from(value: &str) -> Self {
18734 use std::string::ToString;
18735 match value {
18736 "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
18737 "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
18738 "FINE_TUNED" => Self::FineTuned,
18739 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18740 wkt::internal::UnknownEnumValue::String(value.to_string()),
18741 )),
18742 }
18743 }
18744 }
18745
18746 impl serde::ser::Serialize for CustomModelType {
18747 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18748 where
18749 S: serde::Serializer,
18750 {
18751 match self {
18752 Self::Unspecified => serializer.serialize_i32(0),
18753 Self::VersionedFoundation => serializer.serialize_i32(1),
18754 Self::FineTuned => serializer.serialize_i32(2),
18755 Self::UnknownValue(u) => u.0.serialize(serializer),
18756 }
18757 }
18758 }
18759
18760 impl<'de> serde::de::Deserialize<'de> for CustomModelType {
18761 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18762 where
18763 D: serde::Deserializer<'de>,
18764 {
18765 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
18766 ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
18767 }
18768 }
18769 }
18770
18771 /// The processor version is either a pretrained Google-managed foundation
18772 /// model or a custom Generative AI model created by the user.
18773 #[derive(Clone, Debug, PartialEq)]
18774 #[non_exhaustive]
18775 pub enum ModelInfo {
18776 /// Information for a pretrained Google-managed foundation model.
18777 FoundationGenAiModelInfo(
18778 std::boxed::Box<
18779 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18780 >,
18781 ),
18782 /// Information for a custom Generative AI model created by the user.
18783 CustomGenAiModelInfo(
18784 std::boxed::Box<
18785 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18786 >,
18787 ),
18788 }
18789 }
18790
18791 /// The possible states of the processor version.
18792 ///
18793 /// # Working with unknown values
18794 ///
18795 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18796 /// additional enum variants at any time. Adding new variants is not considered
18797 /// a breaking change. Applications should write their code in anticipation of:
18798 ///
18799 /// - New values appearing in future releases of the client library, **and**
18800 /// - New values received dynamically, without application changes.
18801 ///
18802 /// Please consult the [Working with enums] section in the user guide for some
18803 /// guidelines.
18804 ///
18805 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18806 #[derive(Clone, Debug, PartialEq)]
18807 #[non_exhaustive]
18808 pub enum State {
18809 /// The processor version is in an unspecified state.
18810 Unspecified,
18811 /// The processor version is deployed and can be used for processing.
18812 Deployed,
18813 /// The processor version is being deployed.
18814 Deploying,
18815 /// The processor version is not deployed and cannot be used for processing.
18816 Undeployed,
18817 /// The processor version is being undeployed.
18818 Undeploying,
18819 /// The processor version is being created.
18820 Creating,
18821 /// The processor version is being deleted.
18822 Deleting,
18823 /// The processor version failed and is in an indeterminate state.
18824 Failed,
18825 /// The processor version is being imported.
18826 Importing,
18827 /// If set, the enum was initialized with an unknown value.
18828 ///
18829 /// Applications can examine the value using [State::value] or
18830 /// [State::name].
18831 UnknownValue(state::UnknownValue),
18832 }
18833
18834 #[doc(hidden)]
18835 pub mod state {
18836 #[allow(unused_imports)]
18837 use super::*;
18838 #[derive(Clone, Debug, PartialEq)]
18839 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18840 }
18841
18842 impl State {
18843 /// Gets the enum value.
18844 ///
18845 /// Returns `None` if the enum contains an unknown value deserialized from
18846 /// the string representation of enums.
18847 pub fn value(&self) -> std::option::Option<i32> {
18848 match self {
18849 Self::Unspecified => std::option::Option::Some(0),
18850 Self::Deployed => std::option::Option::Some(1),
18851 Self::Deploying => std::option::Option::Some(2),
18852 Self::Undeployed => std::option::Option::Some(3),
18853 Self::Undeploying => std::option::Option::Some(4),
18854 Self::Creating => std::option::Option::Some(5),
18855 Self::Deleting => std::option::Option::Some(6),
18856 Self::Failed => std::option::Option::Some(7),
18857 Self::Importing => std::option::Option::Some(8),
18858 Self::UnknownValue(u) => u.0.value(),
18859 }
18860 }
18861
18862 /// Gets the enum value as a string.
18863 ///
18864 /// Returns `None` if the enum contains an unknown value deserialized from
18865 /// the integer representation of enums.
18866 pub fn name(&self) -> std::option::Option<&str> {
18867 match self {
18868 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
18869 Self::Deployed => std::option::Option::Some("DEPLOYED"),
18870 Self::Deploying => std::option::Option::Some("DEPLOYING"),
18871 Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
18872 Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
18873 Self::Creating => std::option::Option::Some("CREATING"),
18874 Self::Deleting => std::option::Option::Some("DELETING"),
18875 Self::Failed => std::option::Option::Some("FAILED"),
18876 Self::Importing => std::option::Option::Some("IMPORTING"),
18877 Self::UnknownValue(u) => u.0.name(),
18878 }
18879 }
18880 }
18881
18882 impl std::default::Default for State {
18883 fn default() -> Self {
18884 use std::convert::From;
18885 Self::from(0)
18886 }
18887 }
18888
18889 impl std::fmt::Display for State {
18890 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18891 wkt::internal::display_enum(f, self.name(), self.value())
18892 }
18893 }
18894
18895 impl std::convert::From<i32> for State {
18896 fn from(value: i32) -> Self {
18897 match value {
18898 0 => Self::Unspecified,
18899 1 => Self::Deployed,
18900 2 => Self::Deploying,
18901 3 => Self::Undeployed,
18902 4 => Self::Undeploying,
18903 5 => Self::Creating,
18904 6 => Self::Deleting,
18905 7 => Self::Failed,
18906 8 => Self::Importing,
18907 _ => Self::UnknownValue(state::UnknownValue(
18908 wkt::internal::UnknownEnumValue::Integer(value),
18909 )),
18910 }
18911 }
18912 }
18913
18914 impl std::convert::From<&str> for State {
18915 fn from(value: &str) -> Self {
18916 use std::string::ToString;
18917 match value {
18918 "STATE_UNSPECIFIED" => Self::Unspecified,
18919 "DEPLOYED" => Self::Deployed,
18920 "DEPLOYING" => Self::Deploying,
18921 "UNDEPLOYED" => Self::Undeployed,
18922 "UNDEPLOYING" => Self::Undeploying,
18923 "CREATING" => Self::Creating,
18924 "DELETING" => Self::Deleting,
18925 "FAILED" => Self::Failed,
18926 "IMPORTING" => Self::Importing,
18927 _ => Self::UnknownValue(state::UnknownValue(
18928 wkt::internal::UnknownEnumValue::String(value.to_string()),
18929 )),
18930 }
18931 }
18932 }
18933
18934 impl serde::ser::Serialize for State {
18935 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18936 where
18937 S: serde::Serializer,
18938 {
18939 match self {
18940 Self::Unspecified => serializer.serialize_i32(0),
18941 Self::Deployed => serializer.serialize_i32(1),
18942 Self::Deploying => serializer.serialize_i32(2),
18943 Self::Undeployed => serializer.serialize_i32(3),
18944 Self::Undeploying => serializer.serialize_i32(4),
18945 Self::Creating => serializer.serialize_i32(5),
18946 Self::Deleting => serializer.serialize_i32(6),
18947 Self::Failed => serializer.serialize_i32(7),
18948 Self::Importing => serializer.serialize_i32(8),
18949 Self::UnknownValue(u) => u.0.serialize(serializer),
18950 }
18951 }
18952 }
18953
18954 impl<'de> serde::de::Deserialize<'de> for State {
18955 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18956 where
18957 D: serde::Deserializer<'de>,
18958 {
18959 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18960 ".google.cloud.documentai.v1.ProcessorVersion.State",
18961 ))
18962 }
18963 }
18964
18965 /// The possible model types of the processor version.
18966 ///
18967 /// # Working with unknown values
18968 ///
18969 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18970 /// additional enum variants at any time. Adding new variants is not considered
18971 /// a breaking change. Applications should write their code in anticipation of:
18972 ///
18973 /// - New values appearing in future releases of the client library, **and**
18974 /// - New values received dynamically, without application changes.
18975 ///
18976 /// Please consult the [Working with enums] section in the user guide for some
18977 /// guidelines.
18978 ///
18979 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18980 #[derive(Clone, Debug, PartialEq)]
18981 #[non_exhaustive]
18982 pub enum ModelType {
18983 /// The processor version has unspecified model type.
18984 Unspecified,
18985 /// The processor version has generative model type.
18986 Generative,
18987 /// The processor version has custom model type.
18988 Custom,
18989 /// If set, the enum was initialized with an unknown value.
18990 ///
18991 /// Applications can examine the value using [ModelType::value] or
18992 /// [ModelType::name].
18993 UnknownValue(model_type::UnknownValue),
18994 }
18995
18996 #[doc(hidden)]
18997 pub mod model_type {
18998 #[allow(unused_imports)]
18999 use super::*;
19000 #[derive(Clone, Debug, PartialEq)]
19001 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19002 }
19003
19004 impl ModelType {
19005 /// Gets the enum value.
19006 ///
19007 /// Returns `None` if the enum contains an unknown value deserialized from
19008 /// the string representation of enums.
19009 pub fn value(&self) -> std::option::Option<i32> {
19010 match self {
19011 Self::Unspecified => std::option::Option::Some(0),
19012 Self::Generative => std::option::Option::Some(1),
19013 Self::Custom => std::option::Option::Some(2),
19014 Self::UnknownValue(u) => u.0.value(),
19015 }
19016 }
19017
19018 /// Gets the enum value as a string.
19019 ///
19020 /// Returns `None` if the enum contains an unknown value deserialized from
19021 /// the integer representation of enums.
19022 pub fn name(&self) -> std::option::Option<&str> {
19023 match self {
19024 Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
19025 Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
19026 Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
19027 Self::UnknownValue(u) => u.0.name(),
19028 }
19029 }
19030 }
19031
19032 impl std::default::Default for ModelType {
19033 fn default() -> Self {
19034 use std::convert::From;
19035 Self::from(0)
19036 }
19037 }
19038
19039 impl std::fmt::Display for ModelType {
19040 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19041 wkt::internal::display_enum(f, self.name(), self.value())
19042 }
19043 }
19044
19045 impl std::convert::From<i32> for ModelType {
19046 fn from(value: i32) -> Self {
19047 match value {
19048 0 => Self::Unspecified,
19049 1 => Self::Generative,
19050 2 => Self::Custom,
19051 _ => Self::UnknownValue(model_type::UnknownValue(
19052 wkt::internal::UnknownEnumValue::Integer(value),
19053 )),
19054 }
19055 }
19056 }
19057
19058 impl std::convert::From<&str> for ModelType {
19059 fn from(value: &str) -> Self {
19060 use std::string::ToString;
19061 match value {
19062 "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
19063 "MODEL_TYPE_GENERATIVE" => Self::Generative,
19064 "MODEL_TYPE_CUSTOM" => Self::Custom,
19065 _ => Self::UnknownValue(model_type::UnknownValue(
19066 wkt::internal::UnknownEnumValue::String(value.to_string()),
19067 )),
19068 }
19069 }
19070 }
19071
19072 impl serde::ser::Serialize for ModelType {
19073 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19074 where
19075 S: serde::Serializer,
19076 {
19077 match self {
19078 Self::Unspecified => serializer.serialize_i32(0),
19079 Self::Generative => serializer.serialize_i32(1),
19080 Self::Custom => serializer.serialize_i32(2),
19081 Self::UnknownValue(u) => u.0.serialize(serializer),
19082 }
19083 }
19084 }
19085
19086 impl<'de> serde::de::Deserialize<'de> for ModelType {
19087 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19088 where
19089 D: serde::Deserializer<'de>,
19090 {
19091 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
19092 ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
19093 ))
19094 }
19095 }
19096}
19097
19098/// Contains the alias and the aliased resource name of processor version.
19099#[derive(Clone, Default, PartialEq)]
19100#[non_exhaustive]
19101pub struct ProcessorVersionAlias {
19102 /// The alias in the form of `processor_version` resource name.
19103 pub alias: std::string::String,
19104
19105 /// The resource name of aliased processor version.
19106 pub processor_version: std::string::String,
19107
19108 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19109}
19110
19111impl ProcessorVersionAlias {
19112 /// Creates a new default instance.
19113 pub fn new() -> Self {
19114 std::default::Default::default()
19115 }
19116
19117 /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
19118 ///
19119 /// # Example
19120 /// ```ignore,no_run
19121 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19122 /// let x = ProcessorVersionAlias::new().set_alias("example");
19123 /// ```
19124 pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19125 self.alias = v.into();
19126 self
19127 }
19128
19129 /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
19130 ///
19131 /// # Example
19132 /// ```ignore,no_run
19133 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19134 /// # let project_id = "project_id";
19135 /// # let location_id = "location_id";
19136 /// # let processor_id = "processor_id";
19137 /// # let processor_version_id = "processor_version_id";
19138 /// let x = ProcessorVersionAlias::new().set_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
19139 /// ```
19140 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
19141 mut self,
19142 v: T,
19143 ) -> Self {
19144 self.processor_version = v.into();
19145 self
19146 }
19147}
19148
19149impl wkt::message::Message for ProcessorVersionAlias {
19150 fn typename() -> &'static str {
19151 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
19152 }
19153}
19154
19155/// The first-class citizen for Document AI. Each processor defines how to
19156/// extract structural information from a document.
19157#[derive(Clone, Default, PartialEq)]
19158#[non_exhaustive]
19159pub struct Processor {
19160 /// Output only. Immutable. The resource name of the processor.
19161 /// Format: `projects/{project}/locations/{location}/processors/{processor}`
19162 pub name: std::string::String,
19163
19164 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19165 /// To get a list of processor types, see
19166 /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
19167 ///
19168 /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
19169 pub r#type: std::string::String,
19170
19171 /// The display name of the processor.
19172 pub display_name: std::string::String,
19173
19174 /// Output only. The state of the processor.
19175 pub state: crate::model::processor::State,
19176
19177 /// The default processor version.
19178 pub default_processor_version: std::string::String,
19179
19180 /// Output only. The processor version aliases.
19181 pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
19182
19183 /// Output only. Immutable. The http endpoint that can be called to invoke
19184 /// processing.
19185 pub process_endpoint: std::string::String,
19186
19187 /// Output only. The time the processor was created.
19188 pub create_time: std::option::Option<wkt::Timestamp>,
19189
19190 /// The [KMS key](https://cloud.google.com/security-key-management) used for
19191 /// encryption and decryption in CMEK scenarios.
19192 pub kms_key_name: std::string::String,
19193
19194 /// Output only. Reserved for future use.
19195 pub satisfies_pzs: bool,
19196
19197 /// Output only. Reserved for future use.
19198 pub satisfies_pzi: bool,
19199
19200 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19201}
19202
19203impl Processor {
19204 /// Creates a new default instance.
19205 pub fn new() -> Self {
19206 std::default::Default::default()
19207 }
19208
19209 /// Sets the value of [name][crate::model::Processor::name].
19210 ///
19211 /// # Example
19212 /// ```ignore,no_run
19213 /// # use google_cloud_documentai_v1::model::Processor;
19214 /// # let project_id = "project_id";
19215 /// # let location_id = "location_id";
19216 /// # let processor_id = "processor_id";
19217 /// let x = Processor::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
19218 /// ```
19219 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19220 self.name = v.into();
19221 self
19222 }
19223
19224 /// Sets the value of [r#type][crate::model::Processor::type].
19225 ///
19226 /// # Example
19227 /// ```ignore,no_run
19228 /// # use google_cloud_documentai_v1::model::Processor;
19229 /// let x = Processor::new().set_type("example");
19230 /// ```
19231 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19232 self.r#type = v.into();
19233 self
19234 }
19235
19236 /// Sets the value of [display_name][crate::model::Processor::display_name].
19237 ///
19238 /// # Example
19239 /// ```ignore,no_run
19240 /// # use google_cloud_documentai_v1::model::Processor;
19241 /// let x = Processor::new().set_display_name("example");
19242 /// ```
19243 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19244 self.display_name = v.into();
19245 self
19246 }
19247
19248 /// Sets the value of [state][crate::model::Processor::state].
19249 ///
19250 /// # Example
19251 /// ```ignore,no_run
19252 /// # use google_cloud_documentai_v1::model::Processor;
19253 /// use google_cloud_documentai_v1::model::processor::State;
19254 /// let x0 = Processor::new().set_state(State::Enabled);
19255 /// let x1 = Processor::new().set_state(State::Disabled);
19256 /// let x2 = Processor::new().set_state(State::Enabling);
19257 /// ```
19258 pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
19259 mut self,
19260 v: T,
19261 ) -> Self {
19262 self.state = v.into();
19263 self
19264 }
19265
19266 /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
19267 ///
19268 /// # Example
19269 /// ```ignore,no_run
19270 /// # use google_cloud_documentai_v1::model::Processor;
19271 /// # let project_id = "project_id";
19272 /// # let location_id = "location_id";
19273 /// # let processor_id = "processor_id";
19274 /// # let processor_version_id = "processor_version_id";
19275 /// let x = Processor::new().set_default_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
19276 /// ```
19277 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
19278 mut self,
19279 v: T,
19280 ) -> Self {
19281 self.default_processor_version = v.into();
19282 self
19283 }
19284
19285 /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
19286 ///
19287 /// # Example
19288 /// ```ignore,no_run
19289 /// # use google_cloud_documentai_v1::model::Processor;
19290 /// use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19291 /// let x = Processor::new()
19292 /// .set_processor_version_aliases([
19293 /// ProcessorVersionAlias::default()/* use setters */,
19294 /// ProcessorVersionAlias::default()/* use (different) setters */,
19295 /// ]);
19296 /// ```
19297 pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
19298 where
19299 T: std::iter::IntoIterator<Item = V>,
19300 V: std::convert::Into<crate::model::ProcessorVersionAlias>,
19301 {
19302 use std::iter::Iterator;
19303 self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
19304 self
19305 }
19306
19307 /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
19308 ///
19309 /// # Example
19310 /// ```ignore,no_run
19311 /// # use google_cloud_documentai_v1::model::Processor;
19312 /// let x = Processor::new().set_process_endpoint("example");
19313 /// ```
19314 pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
19315 mut self,
19316 v: T,
19317 ) -> Self {
19318 self.process_endpoint = v.into();
19319 self
19320 }
19321
19322 /// Sets the value of [create_time][crate::model::Processor::create_time].
19323 ///
19324 /// # Example
19325 /// ```ignore,no_run
19326 /// # use google_cloud_documentai_v1::model::Processor;
19327 /// use wkt::Timestamp;
19328 /// let x = Processor::new().set_create_time(Timestamp::default()/* use setters */);
19329 /// ```
19330 pub fn set_create_time<T>(mut self, v: T) -> Self
19331 where
19332 T: std::convert::Into<wkt::Timestamp>,
19333 {
19334 self.create_time = std::option::Option::Some(v.into());
19335 self
19336 }
19337
19338 /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
19339 ///
19340 /// # Example
19341 /// ```ignore,no_run
19342 /// # use google_cloud_documentai_v1::model::Processor;
19343 /// use wkt::Timestamp;
19344 /// let x = Processor::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19345 /// let x = Processor::new().set_or_clear_create_time(None::<Timestamp>);
19346 /// ```
19347 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19348 where
19349 T: std::convert::Into<wkt::Timestamp>,
19350 {
19351 self.create_time = v.map(|x| x.into());
19352 self
19353 }
19354
19355 /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
19356 ///
19357 /// # Example
19358 /// ```ignore,no_run
19359 /// # use google_cloud_documentai_v1::model::Processor;
19360 /// let x = Processor::new().set_kms_key_name("example");
19361 /// ```
19362 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19363 self.kms_key_name = v.into();
19364 self
19365 }
19366
19367 /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
19368 ///
19369 /// # Example
19370 /// ```ignore,no_run
19371 /// # use google_cloud_documentai_v1::model::Processor;
19372 /// let x = Processor::new().set_satisfies_pzs(true);
19373 /// ```
19374 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19375 self.satisfies_pzs = v.into();
19376 self
19377 }
19378
19379 /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
19380 ///
19381 /// # Example
19382 /// ```ignore,no_run
19383 /// # use google_cloud_documentai_v1::model::Processor;
19384 /// let x = Processor::new().set_satisfies_pzi(true);
19385 /// ```
19386 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19387 self.satisfies_pzi = v.into();
19388 self
19389 }
19390}
19391
19392impl wkt::message::Message for Processor {
19393 fn typename() -> &'static str {
19394 "type.googleapis.com/google.cloud.documentai.v1.Processor"
19395 }
19396}
19397
19398/// Defines additional types related to [Processor].
19399pub mod processor {
19400 #[allow(unused_imports)]
19401 use super::*;
19402
19403 /// The possible states of the processor.
19404 ///
19405 /// # Working with unknown values
19406 ///
19407 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19408 /// additional enum variants at any time. Adding new variants is not considered
19409 /// a breaking change. Applications should write their code in anticipation of:
19410 ///
19411 /// - New values appearing in future releases of the client library, **and**
19412 /// - New values received dynamically, without application changes.
19413 ///
19414 /// Please consult the [Working with enums] section in the user guide for some
19415 /// guidelines.
19416 ///
19417 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19418 #[derive(Clone, Debug, PartialEq)]
19419 #[non_exhaustive]
19420 pub enum State {
19421 /// The processor is in an unspecified state.
19422 Unspecified,
19423 /// The processor is enabled, i.e., has an enabled version which can
19424 /// currently serve processing requests and all the feature dependencies have
19425 /// been successfully initialized.
19426 Enabled,
19427 /// The processor is disabled.
19428 Disabled,
19429 /// The processor is being enabled, will become `ENABLED` if successful.
19430 Enabling,
19431 /// The processor is being disabled, will become `DISABLED` if successful.
19432 Disabling,
19433 /// The processor is being created, will become either `ENABLED` (for
19434 /// successful creation) or `FAILED` (for failed ones).
19435 /// Once a processor is in this state, it can then be used for document
19436 /// processing, but the feature dependencies of the processor might not be
19437 /// fully created yet.
19438 Creating,
19439 /// The processor failed during creation or initialization of feature
19440 /// dependencies. The user should delete the processor and recreate one as
19441 /// all the functionalities of the processor are disabled.
19442 Failed,
19443 /// The processor is being deleted, will be removed if successful.
19444 Deleting,
19445 /// If set, the enum was initialized with an unknown value.
19446 ///
19447 /// Applications can examine the value using [State::value] or
19448 /// [State::name].
19449 UnknownValue(state::UnknownValue),
19450 }
19451
19452 #[doc(hidden)]
19453 pub mod state {
19454 #[allow(unused_imports)]
19455 use super::*;
19456 #[derive(Clone, Debug, PartialEq)]
19457 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19458 }
19459
19460 impl State {
19461 /// Gets the enum value.
19462 ///
19463 /// Returns `None` if the enum contains an unknown value deserialized from
19464 /// the string representation of enums.
19465 pub fn value(&self) -> std::option::Option<i32> {
19466 match self {
19467 Self::Unspecified => std::option::Option::Some(0),
19468 Self::Enabled => std::option::Option::Some(1),
19469 Self::Disabled => std::option::Option::Some(2),
19470 Self::Enabling => std::option::Option::Some(3),
19471 Self::Disabling => std::option::Option::Some(4),
19472 Self::Creating => std::option::Option::Some(5),
19473 Self::Failed => std::option::Option::Some(6),
19474 Self::Deleting => std::option::Option::Some(7),
19475 Self::UnknownValue(u) => u.0.value(),
19476 }
19477 }
19478
19479 /// Gets the enum value as a string.
19480 ///
19481 /// Returns `None` if the enum contains an unknown value deserialized from
19482 /// the integer representation of enums.
19483 pub fn name(&self) -> std::option::Option<&str> {
19484 match self {
19485 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19486 Self::Enabled => std::option::Option::Some("ENABLED"),
19487 Self::Disabled => std::option::Option::Some("DISABLED"),
19488 Self::Enabling => std::option::Option::Some("ENABLING"),
19489 Self::Disabling => std::option::Option::Some("DISABLING"),
19490 Self::Creating => std::option::Option::Some("CREATING"),
19491 Self::Failed => std::option::Option::Some("FAILED"),
19492 Self::Deleting => std::option::Option::Some("DELETING"),
19493 Self::UnknownValue(u) => u.0.name(),
19494 }
19495 }
19496 }
19497
19498 impl std::default::Default for State {
19499 fn default() -> Self {
19500 use std::convert::From;
19501 Self::from(0)
19502 }
19503 }
19504
19505 impl std::fmt::Display for State {
19506 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19507 wkt::internal::display_enum(f, self.name(), self.value())
19508 }
19509 }
19510
19511 impl std::convert::From<i32> for State {
19512 fn from(value: i32) -> Self {
19513 match value {
19514 0 => Self::Unspecified,
19515 1 => Self::Enabled,
19516 2 => Self::Disabled,
19517 3 => Self::Enabling,
19518 4 => Self::Disabling,
19519 5 => Self::Creating,
19520 6 => Self::Failed,
19521 7 => Self::Deleting,
19522 _ => Self::UnknownValue(state::UnknownValue(
19523 wkt::internal::UnknownEnumValue::Integer(value),
19524 )),
19525 }
19526 }
19527 }
19528
19529 impl std::convert::From<&str> for State {
19530 fn from(value: &str) -> Self {
19531 use std::string::ToString;
19532 match value {
19533 "STATE_UNSPECIFIED" => Self::Unspecified,
19534 "ENABLED" => Self::Enabled,
19535 "DISABLED" => Self::Disabled,
19536 "ENABLING" => Self::Enabling,
19537 "DISABLING" => Self::Disabling,
19538 "CREATING" => Self::Creating,
19539 "FAILED" => Self::Failed,
19540 "DELETING" => Self::Deleting,
19541 _ => Self::UnknownValue(state::UnknownValue(
19542 wkt::internal::UnknownEnumValue::String(value.to_string()),
19543 )),
19544 }
19545 }
19546 }
19547
19548 impl serde::ser::Serialize for State {
19549 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19550 where
19551 S: serde::Serializer,
19552 {
19553 match self {
19554 Self::Unspecified => serializer.serialize_i32(0),
19555 Self::Enabled => serializer.serialize_i32(1),
19556 Self::Disabled => serializer.serialize_i32(2),
19557 Self::Enabling => serializer.serialize_i32(3),
19558 Self::Disabling => serializer.serialize_i32(4),
19559 Self::Creating => serializer.serialize_i32(5),
19560 Self::Failed => serializer.serialize_i32(6),
19561 Self::Deleting => serializer.serialize_i32(7),
19562 Self::UnknownValue(u) => u.0.serialize(serializer),
19563 }
19564 }
19565 }
19566
19567 impl<'de> serde::de::Deserialize<'de> for State {
19568 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19569 where
19570 D: serde::Deserializer<'de>,
19571 {
19572 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19573 ".google.cloud.documentai.v1.Processor.State",
19574 ))
19575 }
19576 }
19577}
19578
19579/// A processor type is responsible for performing a certain document
19580/// understanding task on a certain type of document.
19581#[derive(Clone, Default, PartialEq)]
19582#[non_exhaustive]
19583pub struct ProcessorType {
19584 /// The resource name of the processor type.
19585 /// Format: `projects/{project}/processorTypes/{processor_type}`
19586 pub name: std::string::String,
19587
19588 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19589 pub r#type: std::string::String,
19590
19591 /// The processor category, used by UI to group processor types.
19592 pub category: std::string::String,
19593
19594 /// The locations in which this processor is available.
19595 pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
19596
19597 /// Whether the processor type allows creation. If true, users can create a
19598 /// processor of this processor type. Otherwise, users need to request access.
19599 pub allow_creation: bool,
19600
19601 /// Launch stage of the processor type
19602 pub launch_stage: google_cloud_api::model::LaunchStage,
19603
19604 /// A set of Cloud Storage URIs of sample documents for this processor.
19605 pub sample_document_uris: std::vec::Vec<std::string::String>,
19606
19607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19608}
19609
19610impl ProcessorType {
19611 /// Creates a new default instance.
19612 pub fn new() -> Self {
19613 std::default::Default::default()
19614 }
19615
19616 /// Sets the value of [name][crate::model::ProcessorType::name].
19617 ///
19618 /// # Example
19619 /// ```ignore,no_run
19620 /// # use google_cloud_documentai_v1::model::ProcessorType;
19621 /// # let project_id = "project_id";
19622 /// # let location_id = "location_id";
19623 /// # let processor_type_id = "processor_type_id";
19624 /// let x = ProcessorType::new().set_name(format!("projects/{project_id}/locations/{location_id}/processorTypes/{processor_type_id}"));
19625 /// ```
19626 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19627 self.name = v.into();
19628 self
19629 }
19630
19631 /// Sets the value of [r#type][crate::model::ProcessorType::type].
19632 ///
19633 /// # Example
19634 /// ```ignore,no_run
19635 /// # use google_cloud_documentai_v1::model::ProcessorType;
19636 /// let x = ProcessorType::new().set_type("example");
19637 /// ```
19638 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19639 self.r#type = v.into();
19640 self
19641 }
19642
19643 /// Sets the value of [category][crate::model::ProcessorType::category].
19644 ///
19645 /// # Example
19646 /// ```ignore,no_run
19647 /// # use google_cloud_documentai_v1::model::ProcessorType;
19648 /// let x = ProcessorType::new().set_category("example");
19649 /// ```
19650 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19651 self.category = v.into();
19652 self
19653 }
19654
19655 /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
19656 ///
19657 /// # Example
19658 /// ```ignore,no_run
19659 /// # use google_cloud_documentai_v1::model::ProcessorType;
19660 /// use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19661 /// let x = ProcessorType::new()
19662 /// .set_available_locations([
19663 /// LocationInfo::default()/* use setters */,
19664 /// LocationInfo::default()/* use (different) setters */,
19665 /// ]);
19666 /// ```
19667 pub fn set_available_locations<T, V>(mut self, v: T) -> Self
19668 where
19669 T: std::iter::IntoIterator<Item = V>,
19670 V: std::convert::Into<crate::model::processor_type::LocationInfo>,
19671 {
19672 use std::iter::Iterator;
19673 self.available_locations = v.into_iter().map(|i| i.into()).collect();
19674 self
19675 }
19676
19677 /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
19678 ///
19679 /// # Example
19680 /// ```ignore,no_run
19681 /// # use google_cloud_documentai_v1::model::ProcessorType;
19682 /// let x = ProcessorType::new().set_allow_creation(true);
19683 /// ```
19684 pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19685 self.allow_creation = v.into();
19686 self
19687 }
19688
19689 /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
19690 ///
19691 /// # Example
19692 /// ```ignore,no_run
19693 /// # use google_cloud_documentai_v1::model::ProcessorType;
19694 /// use google_cloud_api::model::LaunchStage;
19695 /// let x0 = ProcessorType::new().set_launch_stage(LaunchStage::Unimplemented);
19696 /// let x1 = ProcessorType::new().set_launch_stage(LaunchStage::Prelaunch);
19697 /// let x2 = ProcessorType::new().set_launch_stage(LaunchStage::EarlyAccess);
19698 /// ```
19699 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
19700 mut self,
19701 v: T,
19702 ) -> Self {
19703 self.launch_stage = v.into();
19704 self
19705 }
19706
19707 /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
19708 ///
19709 /// # Example
19710 /// ```ignore,no_run
19711 /// # use google_cloud_documentai_v1::model::ProcessorType;
19712 /// let x = ProcessorType::new().set_sample_document_uris(["a", "b", "c"]);
19713 /// ```
19714 pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
19715 where
19716 T: std::iter::IntoIterator<Item = V>,
19717 V: std::convert::Into<std::string::String>,
19718 {
19719 use std::iter::Iterator;
19720 self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
19721 self
19722 }
19723}
19724
19725impl wkt::message::Message for ProcessorType {
19726 fn typename() -> &'static str {
19727 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
19728 }
19729}
19730
19731/// Defines additional types related to [ProcessorType].
19732pub mod processor_type {
19733 #[allow(unused_imports)]
19734 use super::*;
19735
19736 /// The location information about where the processor is available.
19737 #[derive(Clone, Default, PartialEq)]
19738 #[non_exhaustive]
19739 pub struct LocationInfo {
19740 /// The location ID. For supported locations, refer to [regional and
19741 /// multi-regional support](/document-ai/docs/regions).
19742 pub location_id: std::string::String,
19743
19744 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19745 }
19746
19747 impl LocationInfo {
19748 /// Creates a new default instance.
19749 pub fn new() -> Self {
19750 std::default::Default::default()
19751 }
19752
19753 /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
19754 ///
19755 /// # Example
19756 /// ```ignore,no_run
19757 /// # use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19758 /// let x = LocationInfo::new().set_location_id("example");
19759 /// ```
19760 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19761 self.location_id = v.into();
19762 self
19763 }
19764 }
19765
19766 impl wkt::message::Message for LocationInfo {
19767 fn typename() -> &'static str {
19768 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
19769 }
19770 }
19771}