google_cloud_documentai_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_api;
24extern crate google_cloud_gax;
25extern crate google_cloud_location;
26extern crate google_cloud_longrunning;
27extern crate google_cloud_lro;
28extern crate google_cloud_rpc;
29extern crate google_cloud_type;
30extern crate serde;
31extern crate serde_json;
32extern crate serde_with;
33extern crate std;
34extern crate tracing;
35extern crate wkt;
36
37mod debug;
38mod deserialize;
39mod serialize;
40
41/// Encodes the detailed information of a barcode.
42#[derive(Clone, Default, PartialEq)]
43#[non_exhaustive]
44pub struct Barcode {
45 /// Format of a barcode.
46 /// The supported formats are:
47 ///
48 /// - `CODE_128`: Code 128 type.
49 /// - `CODE_39`: Code 39 type.
50 /// - `CODE_93`: Code 93 type.
51 /// - `CODABAR`: Codabar type.
52 /// - `DATA_MATRIX`: 2D Data Matrix type.
53 /// - `ITF`: ITF type.
54 /// - `EAN_13`: EAN-13 type.
55 /// - `EAN_8`: EAN-8 type.
56 /// - `QR_CODE`: 2D QR code type.
57 /// - `UPC_A`: UPC-A type.
58 /// - `UPC_E`: UPC-E type.
59 /// - `PDF417`: PDF417 type.
60 /// - `AZTEC`: 2D Aztec code type.
61 /// - `DATABAR`: GS1 DataBar code type.
62 pub format: std::string::String,
63
64 /// Value format describes the format of the value that a barcode
65 /// encodes.
66 /// The supported formats are:
67 ///
68 /// - `CONTACT_INFO`: Contact information.
69 /// - `EMAIL`: Email address.
70 /// - `ISBN`: ISBN identifier.
71 /// - `PHONE`: Phone number.
72 /// - `PRODUCT`: Product.
73 /// - `SMS`: SMS message.
74 /// - `TEXT`: Text string.
75 /// - `URL`: URL address.
76 /// - `WIFI`: Wifi information.
77 /// - `GEO`: Geo-localization.
78 /// - `CALENDAR_EVENT`: Calendar event.
79 /// - `DRIVER_LICENSE`: Driver's license.
80 pub value_format: std::string::String,
81
82 /// Raw value encoded in the barcode.
83 /// For example: `'MEBKM:TITLE:Google;URL:<https://www.google.com>;;'`.
84 pub raw_value: std::string::String,
85
86 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
87}
88
89impl Barcode {
90 /// Creates a new default instance.
91 pub fn new() -> Self {
92 std::default::Default::default()
93 }
94
95 /// Sets the value of [format][crate::model::Barcode::format].
96 ///
97 /// # Example
98 /// ```ignore,no_run
99 /// # use google_cloud_documentai_v1::model::Barcode;
100 /// let x = Barcode::new().set_format("example");
101 /// ```
102 pub fn set_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
103 self.format = v.into();
104 self
105 }
106
107 /// Sets the value of [value_format][crate::model::Barcode::value_format].
108 ///
109 /// # Example
110 /// ```ignore,no_run
111 /// # use google_cloud_documentai_v1::model::Barcode;
112 /// let x = Barcode::new().set_value_format("example");
113 /// ```
114 pub fn set_value_format<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
115 self.value_format = v.into();
116 self
117 }
118
119 /// Sets the value of [raw_value][crate::model::Barcode::raw_value].
120 ///
121 /// # Example
122 /// ```ignore,no_run
123 /// # use google_cloud_documentai_v1::model::Barcode;
124 /// let x = Barcode::new().set_raw_value("example");
125 /// ```
126 pub fn set_raw_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
127 self.raw_value = v.into();
128 self
129 }
130}
131
132impl wkt::message::Message for Barcode {
133 fn typename() -> &'static str {
134 "type.googleapis.com/google.cloud.documentai.v1.Barcode"
135 }
136}
137
138/// Document represents the canonical document resource in Document AI. It is an
139/// interchange format that provides insights into documents and allows for
140/// collaboration between users and Document AI to iterate and optimize for
141/// quality.
142#[derive(Clone, Default, PartialEq)]
143#[non_exhaustive]
144pub struct Document {
145 /// Optional. An internal identifier for document. Should be loggable (no PII).
146 pub docid: std::string::String,
147
148 /// An IANA published [media type (MIME
149 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
150 pub mime_type: std::string::String,
151
152 /// Optional. UTF-8 encoded text in reading order from the document.
153 pub text: std::string::String,
154
155 /// Styles for the [Document.text][google.cloud.documentai.v1.Document.text].
156 ///
157 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
158 #[deprecated]
159 pub text_styles: std::vec::Vec<crate::model::document::Style>,
160
161 /// Visual page layout for the [Document][google.cloud.documentai.v1.Document].
162 ///
163 /// [google.cloud.documentai.v1.Document]: crate::model::Document
164 pub pages: std::vec::Vec<crate::model::document::Page>,
165
166 /// A list of entities detected on
167 /// [Document.text][google.cloud.documentai.v1.Document.text]. For document
168 /// shards, entities in this list may cross shard boundaries.
169 ///
170 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
171 pub entities: std::vec::Vec<crate::model::document::Entity>,
172
173 /// Placeholder. Relationship among
174 /// [Document.entities][google.cloud.documentai.v1.Document.entities].
175 ///
176 /// [google.cloud.documentai.v1.Document.entities]: crate::model::Document::entities
177 pub entity_relations: std::vec::Vec<crate::model::document::EntityRelation>,
178
179 /// Placeholder. A list of text corrections made to
180 /// [Document.text][google.cloud.documentai.v1.Document.text]. This is usually
181 /// used for annotating corrections to OCR mistakes. Text changes for a given
182 /// revision may not overlap with each other.
183 ///
184 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
185 pub text_changes: std::vec::Vec<crate::model::document::TextChange>,
186
187 /// Information about the sharding if this document is sharded part of a larger
188 /// document. If the document is not sharded, this message is not specified.
189 pub shard_info: std::option::Option<crate::model::document::ShardInfo>,
190
191 /// Any error that occurred while processing this document.
192 pub error: std::option::Option<google_cloud_rpc::model::Status>,
193
194 /// Placeholder. Revision history of this document.
195 pub revisions: std::vec::Vec<crate::model::document::Revision>,
196
197 /// Parsed layout of the document.
198 pub document_layout: std::option::Option<crate::model::document::DocumentLayout>,
199
200 /// Document chunked based on chunking config.
201 pub chunked_document: std::option::Option<crate::model::document::ChunkedDocument>,
202
203 /// Optional. The blob assets in this document. This is used to store the
204 /// content of the inline blobs in this document, for example, image bytes,
205 /// such that it can be referenced by other fields in the document via asset
206 /// id.
207 pub blob_assets: std::vec::Vec<crate::model::document::BlobAsset>,
208
209 /// The entity validation output for the document. This is the validation
210 /// output for `document.entities` field.
211 pub entity_validation_output:
212 std::option::Option<crate::model::document::EntityValidationOutput>,
213
214 /// A list of entity revisions. The entity revisions are appended to the
215 /// document in the processing order. This field can be used for comparing the
216 /// entity extraction results at different stages of the processing.
217 pub entities_revisions: std::vec::Vec<crate::model::document::EntitiesRevision>,
218
219 /// The entity revision ID that `document.entities` field is based on.
220 /// If this field is set and `entities_revisions` is not empty, the entities in
221 /// `document.entities` field are the entities in the entity revision with this
222 /// id and `document.entity_validation_output` field is the
223 /// `entity_validation_output` field in this entity revision.
224 pub entities_revision_id: std::string::String,
225
226 /// Original source document from the user.
227 pub source: std::option::Option<crate::model::document::Source>,
228
229 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
230}
231
232impl Document {
233 /// Creates a new default instance.
234 pub fn new() -> Self {
235 std::default::Default::default()
236 }
237
238 /// Sets the value of [docid][crate::model::Document::docid].
239 ///
240 /// # Example
241 /// ```ignore,no_run
242 /// # use google_cloud_documentai_v1::model::Document;
243 /// let x = Document::new().set_docid("example");
244 /// ```
245 pub fn set_docid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
246 self.docid = v.into();
247 self
248 }
249
250 /// Sets the value of [mime_type][crate::model::Document::mime_type].
251 ///
252 /// # Example
253 /// ```ignore,no_run
254 /// # use google_cloud_documentai_v1::model::Document;
255 /// let x = Document::new().set_mime_type("example");
256 /// ```
257 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
258 self.mime_type = v.into();
259 self
260 }
261
262 /// Sets the value of [text][crate::model::Document::text].
263 ///
264 /// # Example
265 /// ```ignore,no_run
266 /// # use google_cloud_documentai_v1::model::Document;
267 /// let x = Document::new().set_text("example");
268 /// ```
269 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
270 self.text = v.into();
271 self
272 }
273
274 /// Sets the value of [text_styles][crate::model::Document::text_styles].
275 ///
276 /// # Example
277 /// ```ignore,no_run
278 /// # use google_cloud_documentai_v1::model::Document;
279 /// use google_cloud_documentai_v1::model::document::Style;
280 /// let x = Document::new()
281 /// .set_text_styles([
282 /// Style::default()/* use setters */,
283 /// Style::default()/* use (different) setters */,
284 /// ]);
285 /// ```
286 #[deprecated]
287 pub fn set_text_styles<T, V>(mut self, v: T) -> Self
288 where
289 T: std::iter::IntoIterator<Item = V>,
290 V: std::convert::Into<crate::model::document::Style>,
291 {
292 use std::iter::Iterator;
293 self.text_styles = v.into_iter().map(|i| i.into()).collect();
294 self
295 }
296
297 /// Sets the value of [pages][crate::model::Document::pages].
298 ///
299 /// # Example
300 /// ```ignore,no_run
301 /// # use google_cloud_documentai_v1::model::Document;
302 /// use google_cloud_documentai_v1::model::document::Page;
303 /// let x = Document::new()
304 /// .set_pages([
305 /// Page::default()/* use setters */,
306 /// Page::default()/* use (different) setters */,
307 /// ]);
308 /// ```
309 pub fn set_pages<T, V>(mut self, v: T) -> Self
310 where
311 T: std::iter::IntoIterator<Item = V>,
312 V: std::convert::Into<crate::model::document::Page>,
313 {
314 use std::iter::Iterator;
315 self.pages = v.into_iter().map(|i| i.into()).collect();
316 self
317 }
318
319 /// Sets the value of [entities][crate::model::Document::entities].
320 ///
321 /// # Example
322 /// ```ignore,no_run
323 /// # use google_cloud_documentai_v1::model::Document;
324 /// use google_cloud_documentai_v1::model::document::Entity;
325 /// let x = Document::new()
326 /// .set_entities([
327 /// Entity::default()/* use setters */,
328 /// Entity::default()/* use (different) setters */,
329 /// ]);
330 /// ```
331 pub fn set_entities<T, V>(mut self, v: T) -> Self
332 where
333 T: std::iter::IntoIterator<Item = V>,
334 V: std::convert::Into<crate::model::document::Entity>,
335 {
336 use std::iter::Iterator;
337 self.entities = v.into_iter().map(|i| i.into()).collect();
338 self
339 }
340
341 /// Sets the value of [entity_relations][crate::model::Document::entity_relations].
342 ///
343 /// # Example
344 /// ```ignore,no_run
345 /// # use google_cloud_documentai_v1::model::Document;
346 /// use google_cloud_documentai_v1::model::document::EntityRelation;
347 /// let x = Document::new()
348 /// .set_entity_relations([
349 /// EntityRelation::default()/* use setters */,
350 /// EntityRelation::default()/* use (different) setters */,
351 /// ]);
352 /// ```
353 pub fn set_entity_relations<T, V>(mut self, v: T) -> Self
354 where
355 T: std::iter::IntoIterator<Item = V>,
356 V: std::convert::Into<crate::model::document::EntityRelation>,
357 {
358 use std::iter::Iterator;
359 self.entity_relations = v.into_iter().map(|i| i.into()).collect();
360 self
361 }
362
363 /// Sets the value of [text_changes][crate::model::Document::text_changes].
364 ///
365 /// # Example
366 /// ```ignore,no_run
367 /// # use google_cloud_documentai_v1::model::Document;
368 /// use google_cloud_documentai_v1::model::document::TextChange;
369 /// let x = Document::new()
370 /// .set_text_changes([
371 /// TextChange::default()/* use setters */,
372 /// TextChange::default()/* use (different) setters */,
373 /// ]);
374 /// ```
375 pub fn set_text_changes<T, V>(mut self, v: T) -> Self
376 where
377 T: std::iter::IntoIterator<Item = V>,
378 V: std::convert::Into<crate::model::document::TextChange>,
379 {
380 use std::iter::Iterator;
381 self.text_changes = v.into_iter().map(|i| i.into()).collect();
382 self
383 }
384
385 /// Sets the value of [shard_info][crate::model::Document::shard_info].
386 ///
387 /// # Example
388 /// ```ignore,no_run
389 /// # use google_cloud_documentai_v1::model::Document;
390 /// use google_cloud_documentai_v1::model::document::ShardInfo;
391 /// let x = Document::new().set_shard_info(ShardInfo::default()/* use setters */);
392 /// ```
393 pub fn set_shard_info<T>(mut self, v: T) -> Self
394 where
395 T: std::convert::Into<crate::model::document::ShardInfo>,
396 {
397 self.shard_info = std::option::Option::Some(v.into());
398 self
399 }
400
401 /// Sets or clears the value of [shard_info][crate::model::Document::shard_info].
402 ///
403 /// # Example
404 /// ```ignore,no_run
405 /// # use google_cloud_documentai_v1::model::Document;
406 /// use google_cloud_documentai_v1::model::document::ShardInfo;
407 /// let x = Document::new().set_or_clear_shard_info(Some(ShardInfo::default()/* use setters */));
408 /// let x = Document::new().set_or_clear_shard_info(None::<ShardInfo>);
409 /// ```
410 pub fn set_or_clear_shard_info<T>(mut self, v: std::option::Option<T>) -> Self
411 where
412 T: std::convert::Into<crate::model::document::ShardInfo>,
413 {
414 self.shard_info = v.map(|x| x.into());
415 self
416 }
417
418 /// Sets the value of [error][crate::model::Document::error].
419 ///
420 /// # Example
421 /// ```ignore,no_run
422 /// # use google_cloud_documentai_v1::model::Document;
423 /// use google_cloud_rpc::model::Status;
424 /// let x = Document::new().set_error(Status::default()/* use setters */);
425 /// ```
426 pub fn set_error<T>(mut self, v: T) -> Self
427 where
428 T: std::convert::Into<google_cloud_rpc::model::Status>,
429 {
430 self.error = std::option::Option::Some(v.into());
431 self
432 }
433
434 /// Sets or clears the value of [error][crate::model::Document::error].
435 ///
436 /// # Example
437 /// ```ignore,no_run
438 /// # use google_cloud_documentai_v1::model::Document;
439 /// use google_cloud_rpc::model::Status;
440 /// let x = Document::new().set_or_clear_error(Some(Status::default()/* use setters */));
441 /// let x = Document::new().set_or_clear_error(None::<Status>);
442 /// ```
443 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
444 where
445 T: std::convert::Into<google_cloud_rpc::model::Status>,
446 {
447 self.error = v.map(|x| x.into());
448 self
449 }
450
451 /// Sets the value of [revisions][crate::model::Document::revisions].
452 ///
453 /// # Example
454 /// ```ignore,no_run
455 /// # use google_cloud_documentai_v1::model::Document;
456 /// use google_cloud_documentai_v1::model::document::Revision;
457 /// let x = Document::new()
458 /// .set_revisions([
459 /// Revision::default()/* use setters */,
460 /// Revision::default()/* use (different) setters */,
461 /// ]);
462 /// ```
463 pub fn set_revisions<T, V>(mut self, v: T) -> Self
464 where
465 T: std::iter::IntoIterator<Item = V>,
466 V: std::convert::Into<crate::model::document::Revision>,
467 {
468 use std::iter::Iterator;
469 self.revisions = v.into_iter().map(|i| i.into()).collect();
470 self
471 }
472
473 /// Sets the value of [document_layout][crate::model::Document::document_layout].
474 ///
475 /// # Example
476 /// ```ignore,no_run
477 /// # use google_cloud_documentai_v1::model::Document;
478 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
479 /// let x = Document::new().set_document_layout(DocumentLayout::default()/* use setters */);
480 /// ```
481 pub fn set_document_layout<T>(mut self, v: T) -> Self
482 where
483 T: std::convert::Into<crate::model::document::DocumentLayout>,
484 {
485 self.document_layout = std::option::Option::Some(v.into());
486 self
487 }
488
489 /// Sets or clears the value of [document_layout][crate::model::Document::document_layout].
490 ///
491 /// # Example
492 /// ```ignore,no_run
493 /// # use google_cloud_documentai_v1::model::Document;
494 /// use google_cloud_documentai_v1::model::document::DocumentLayout;
495 /// let x = Document::new().set_or_clear_document_layout(Some(DocumentLayout::default()/* use setters */));
496 /// let x = Document::new().set_or_clear_document_layout(None::<DocumentLayout>);
497 /// ```
498 pub fn set_or_clear_document_layout<T>(mut self, v: std::option::Option<T>) -> Self
499 where
500 T: std::convert::Into<crate::model::document::DocumentLayout>,
501 {
502 self.document_layout = v.map(|x| x.into());
503 self
504 }
505
506 /// Sets the value of [chunked_document][crate::model::Document::chunked_document].
507 ///
508 /// # Example
509 /// ```ignore,no_run
510 /// # use google_cloud_documentai_v1::model::Document;
511 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
512 /// let x = Document::new().set_chunked_document(ChunkedDocument::default()/* use setters */);
513 /// ```
514 pub fn set_chunked_document<T>(mut self, v: T) -> Self
515 where
516 T: std::convert::Into<crate::model::document::ChunkedDocument>,
517 {
518 self.chunked_document = std::option::Option::Some(v.into());
519 self
520 }
521
522 /// Sets or clears the value of [chunked_document][crate::model::Document::chunked_document].
523 ///
524 /// # Example
525 /// ```ignore,no_run
526 /// # use google_cloud_documentai_v1::model::Document;
527 /// use google_cloud_documentai_v1::model::document::ChunkedDocument;
528 /// let x = Document::new().set_or_clear_chunked_document(Some(ChunkedDocument::default()/* use setters */));
529 /// let x = Document::new().set_or_clear_chunked_document(None::<ChunkedDocument>);
530 /// ```
531 pub fn set_or_clear_chunked_document<T>(mut self, v: std::option::Option<T>) -> Self
532 where
533 T: std::convert::Into<crate::model::document::ChunkedDocument>,
534 {
535 self.chunked_document = v.map(|x| x.into());
536 self
537 }
538
539 /// Sets the value of [blob_assets][crate::model::Document::blob_assets].
540 ///
541 /// # Example
542 /// ```ignore,no_run
543 /// # use google_cloud_documentai_v1::model::Document;
544 /// use google_cloud_documentai_v1::model::document::BlobAsset;
545 /// let x = Document::new()
546 /// .set_blob_assets([
547 /// BlobAsset::default()/* use setters */,
548 /// BlobAsset::default()/* use (different) setters */,
549 /// ]);
550 /// ```
551 pub fn set_blob_assets<T, V>(mut self, v: T) -> Self
552 where
553 T: std::iter::IntoIterator<Item = V>,
554 V: std::convert::Into<crate::model::document::BlobAsset>,
555 {
556 use std::iter::Iterator;
557 self.blob_assets = v.into_iter().map(|i| i.into()).collect();
558 self
559 }
560
561 /// Sets the value of [entity_validation_output][crate::model::Document::entity_validation_output].
562 ///
563 /// # Example
564 /// ```ignore,no_run
565 /// # use google_cloud_documentai_v1::model::Document;
566 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
567 /// let x = Document::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
568 /// ```
569 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
570 where
571 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
572 {
573 self.entity_validation_output = std::option::Option::Some(v.into());
574 self
575 }
576
577 /// Sets or clears the value of [entity_validation_output][crate::model::Document::entity_validation_output].
578 ///
579 /// # Example
580 /// ```ignore,no_run
581 /// # use google_cloud_documentai_v1::model::Document;
582 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
583 /// let x = Document::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
584 /// let x = Document::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
585 /// ```
586 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
587 where
588 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
589 {
590 self.entity_validation_output = v.map(|x| x.into());
591 self
592 }
593
594 /// Sets the value of [entities_revisions][crate::model::Document::entities_revisions].
595 ///
596 /// # Example
597 /// ```ignore,no_run
598 /// # use google_cloud_documentai_v1::model::Document;
599 /// use google_cloud_documentai_v1::model::document::EntitiesRevision;
600 /// let x = Document::new()
601 /// .set_entities_revisions([
602 /// EntitiesRevision::default()/* use setters */,
603 /// EntitiesRevision::default()/* use (different) setters */,
604 /// ]);
605 /// ```
606 pub fn set_entities_revisions<T, V>(mut self, v: T) -> Self
607 where
608 T: std::iter::IntoIterator<Item = V>,
609 V: std::convert::Into<crate::model::document::EntitiesRevision>,
610 {
611 use std::iter::Iterator;
612 self.entities_revisions = v.into_iter().map(|i| i.into()).collect();
613 self
614 }
615
616 /// Sets the value of [entities_revision_id][crate::model::Document::entities_revision_id].
617 ///
618 /// # Example
619 /// ```ignore,no_run
620 /// # use google_cloud_documentai_v1::model::Document;
621 /// let x = Document::new().set_entities_revision_id("example");
622 /// ```
623 pub fn set_entities_revision_id<T: std::convert::Into<std::string::String>>(
624 mut self,
625 v: T,
626 ) -> Self {
627 self.entities_revision_id = v.into();
628 self
629 }
630
631 /// Sets the value of [source][crate::model::Document::source].
632 ///
633 /// Note that all the setters affecting `source` are mutually
634 /// exclusive.
635 ///
636 /// # Example
637 /// ```ignore,no_run
638 /// # use google_cloud_documentai_v1::model::Document;
639 /// use google_cloud_documentai_v1::model::document::Source;
640 /// let x = Document::new().set_source(Some(Source::Uri("example".to_string())));
641 /// ```
642 pub fn set_source<
643 T: std::convert::Into<std::option::Option<crate::model::document::Source>>,
644 >(
645 mut self,
646 v: T,
647 ) -> Self {
648 self.source = v.into();
649 self
650 }
651
652 /// The value of [source][crate::model::Document::source]
653 /// if it holds a `Uri`, `None` if the field is not set or
654 /// holds a different branch.
655 pub fn uri(&self) -> std::option::Option<&std::string::String> {
656 #[allow(unreachable_patterns)]
657 self.source.as_ref().and_then(|v| match v {
658 crate::model::document::Source::Uri(v) => std::option::Option::Some(v),
659 _ => std::option::Option::None,
660 })
661 }
662
663 /// Sets the value of [source][crate::model::Document::source]
664 /// to hold a `Uri`.
665 ///
666 /// Note that all the setters affecting `source` are
667 /// mutually exclusive.
668 ///
669 /// # Example
670 /// ```ignore,no_run
671 /// # use google_cloud_documentai_v1::model::Document;
672 /// let x = Document::new().set_uri("example");
673 /// assert!(x.uri().is_some());
674 /// assert!(x.content().is_none());
675 /// ```
676 pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
677 self.source = std::option::Option::Some(crate::model::document::Source::Uri(v.into()));
678 self
679 }
680
681 /// The value of [source][crate::model::Document::source]
682 /// if it holds a `Content`, `None` if the field is not set or
683 /// holds a different branch.
684 pub fn content(&self) -> std::option::Option<&::bytes::Bytes> {
685 #[allow(unreachable_patterns)]
686 self.source.as_ref().and_then(|v| match v {
687 crate::model::document::Source::Content(v) => std::option::Option::Some(v),
688 _ => std::option::Option::None,
689 })
690 }
691
692 /// Sets the value of [source][crate::model::Document::source]
693 /// to hold a `Content`.
694 ///
695 /// Note that all the setters affecting `source` are
696 /// mutually exclusive.
697 ///
698 /// # Example
699 /// ```ignore,no_run
700 /// # use google_cloud_documentai_v1::model::Document;
701 /// let x = Document::new().set_content(bytes::Bytes::from_static(b"example"));
702 /// assert!(x.content().is_some());
703 /// assert!(x.uri().is_none());
704 /// ```
705 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
706 self.source = std::option::Option::Some(crate::model::document::Source::Content(v.into()));
707 self
708 }
709}
710
711impl wkt::message::Message for Document {
712 fn typename() -> &'static str {
713 "type.googleapis.com/google.cloud.documentai.v1.Document"
714 }
715}
716
717/// Defines additional types related to [Document].
718pub mod document {
719 #[allow(unused_imports)]
720 use super::*;
721
722 /// For a large document, sharding may be performed to produce several
723 /// document shards. Each document shard contains this field to detail which
724 /// shard it is.
725 #[derive(Clone, Default, PartialEq)]
726 #[non_exhaustive]
727 pub struct ShardInfo {
728 /// The 0-based index of this shard.
729 pub shard_index: i64,
730
731 /// Total number of shards.
732 pub shard_count: i64,
733
734 /// The index of the first character in
735 /// [Document.text][google.cloud.documentai.v1.Document.text] in the overall
736 /// document global text.
737 ///
738 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
739 pub text_offset: i64,
740
741 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
742 }
743
744 impl ShardInfo {
745 /// Creates a new default instance.
746 pub fn new() -> Self {
747 std::default::Default::default()
748 }
749
750 /// Sets the value of [shard_index][crate::model::document::ShardInfo::shard_index].
751 ///
752 /// # Example
753 /// ```ignore,no_run
754 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
755 /// let x = ShardInfo::new().set_shard_index(42);
756 /// ```
757 pub fn set_shard_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
758 self.shard_index = v.into();
759 self
760 }
761
762 /// Sets the value of [shard_count][crate::model::document::ShardInfo::shard_count].
763 ///
764 /// # Example
765 /// ```ignore,no_run
766 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
767 /// let x = ShardInfo::new().set_shard_count(42);
768 /// ```
769 pub fn set_shard_count<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
770 self.shard_count = v.into();
771 self
772 }
773
774 /// Sets the value of [text_offset][crate::model::document::ShardInfo::text_offset].
775 ///
776 /// # Example
777 /// ```ignore,no_run
778 /// # use google_cloud_documentai_v1::model::document::ShardInfo;
779 /// let x = ShardInfo::new().set_text_offset(42);
780 /// ```
781 pub fn set_text_offset<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
782 self.text_offset = v.into();
783 self
784 }
785 }
786
787 impl wkt::message::Message for ShardInfo {
788 fn typename() -> &'static str {
789 "type.googleapis.com/google.cloud.documentai.v1.Document.ShardInfo"
790 }
791 }
792
793 /// Annotation for common text style attributes. This adheres to CSS
794 /// conventions as much as possible.
795 #[derive(Clone, Default, PartialEq)]
796 #[non_exhaustive]
797 pub struct Style {
798 /// Text anchor indexing into the
799 /// [Document.text][google.cloud.documentai.v1.Document.text].
800 ///
801 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
802 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
803
804 /// Text color.
805 pub color: std::option::Option<google_cloud_type::model::Color>,
806
807 /// Text background color.
808 pub background_color: std::option::Option<google_cloud_type::model::Color>,
809
810 /// [Font weight](https://www.w3schools.com/cssref/pr_font_weight.asp).
811 /// Possible values are `normal`, `bold`, `bolder`, and `lighter`.
812 pub font_weight: std::string::String,
813
814 /// [Text style](https://www.w3schools.com/cssref/pr_font_font-style.asp).
815 /// Possible values are `normal`, `italic`, and `oblique`.
816 pub text_style: std::string::String,
817
818 /// [Text
819 /// decoration](https://www.w3schools.com/cssref/pr_text_text-decoration.asp).
820 /// Follows CSS standard. \<text-decoration-line\> \<text-decoration-color\>
821 /// \<text-decoration-style\>
822 pub text_decoration: std::string::String,
823
824 /// Font size.
825 pub font_size: std::option::Option<crate::model::document::style::FontSize>,
826
827 /// Font family such as `Arial`, `Times New Roman`.
828 /// <https://www.w3schools.com/cssref/pr_font_font-family.asp>
829 pub font_family: std::string::String,
830
831 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
832 }
833
834 impl Style {
835 /// Creates a new default instance.
836 pub fn new() -> Self {
837 std::default::Default::default()
838 }
839
840 /// Sets the value of [text_anchor][crate::model::document::Style::text_anchor].
841 ///
842 /// # Example
843 /// ```ignore,no_run
844 /// # use google_cloud_documentai_v1::model::document::Style;
845 /// use google_cloud_documentai_v1::model::document::TextAnchor;
846 /// let x = Style::new().set_text_anchor(TextAnchor::default()/* use setters */);
847 /// ```
848 pub fn set_text_anchor<T>(mut self, v: T) -> Self
849 where
850 T: std::convert::Into<crate::model::document::TextAnchor>,
851 {
852 self.text_anchor = std::option::Option::Some(v.into());
853 self
854 }
855
856 /// Sets or clears the value of [text_anchor][crate::model::document::Style::text_anchor].
857 ///
858 /// # Example
859 /// ```ignore,no_run
860 /// # use google_cloud_documentai_v1::model::document::Style;
861 /// use google_cloud_documentai_v1::model::document::TextAnchor;
862 /// let x = Style::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
863 /// let x = Style::new().set_or_clear_text_anchor(None::<TextAnchor>);
864 /// ```
865 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
866 where
867 T: std::convert::Into<crate::model::document::TextAnchor>,
868 {
869 self.text_anchor = v.map(|x| x.into());
870 self
871 }
872
873 /// Sets the value of [color][crate::model::document::Style::color].
874 ///
875 /// # Example
876 /// ```ignore,no_run
877 /// # use google_cloud_documentai_v1::model::document::Style;
878 /// use google_cloud_type::model::Color;
879 /// let x = Style::new().set_color(Color::default()/* use setters */);
880 /// ```
881 pub fn set_color<T>(mut self, v: T) -> Self
882 where
883 T: std::convert::Into<google_cloud_type::model::Color>,
884 {
885 self.color = std::option::Option::Some(v.into());
886 self
887 }
888
889 /// Sets or clears the value of [color][crate::model::document::Style::color].
890 ///
891 /// # Example
892 /// ```ignore,no_run
893 /// # use google_cloud_documentai_v1::model::document::Style;
894 /// use google_cloud_type::model::Color;
895 /// let x = Style::new().set_or_clear_color(Some(Color::default()/* use setters */));
896 /// let x = Style::new().set_or_clear_color(None::<Color>);
897 /// ```
898 pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
899 where
900 T: std::convert::Into<google_cloud_type::model::Color>,
901 {
902 self.color = v.map(|x| x.into());
903 self
904 }
905
906 /// Sets the value of [background_color][crate::model::document::Style::background_color].
907 ///
908 /// # Example
909 /// ```ignore,no_run
910 /// # use google_cloud_documentai_v1::model::document::Style;
911 /// use google_cloud_type::model::Color;
912 /// let x = Style::new().set_background_color(Color::default()/* use setters */);
913 /// ```
914 pub fn set_background_color<T>(mut self, v: T) -> Self
915 where
916 T: std::convert::Into<google_cloud_type::model::Color>,
917 {
918 self.background_color = std::option::Option::Some(v.into());
919 self
920 }
921
922 /// Sets or clears the value of [background_color][crate::model::document::Style::background_color].
923 ///
924 /// # Example
925 /// ```ignore,no_run
926 /// # use google_cloud_documentai_v1::model::document::Style;
927 /// use google_cloud_type::model::Color;
928 /// let x = Style::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
929 /// let x = Style::new().set_or_clear_background_color(None::<Color>);
930 /// ```
931 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
932 where
933 T: std::convert::Into<google_cloud_type::model::Color>,
934 {
935 self.background_color = v.map(|x| x.into());
936 self
937 }
938
939 /// Sets the value of [font_weight][crate::model::document::Style::font_weight].
940 ///
941 /// # Example
942 /// ```ignore,no_run
943 /// # use google_cloud_documentai_v1::model::document::Style;
944 /// let x = Style::new().set_font_weight("example");
945 /// ```
946 pub fn set_font_weight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
947 self.font_weight = v.into();
948 self
949 }
950
951 /// Sets the value of [text_style][crate::model::document::Style::text_style].
952 ///
953 /// # Example
954 /// ```ignore,no_run
955 /// # use google_cloud_documentai_v1::model::document::Style;
956 /// let x = Style::new().set_text_style("example");
957 /// ```
958 pub fn set_text_style<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
959 self.text_style = v.into();
960 self
961 }
962
963 /// Sets the value of [text_decoration][crate::model::document::Style::text_decoration].
964 ///
965 /// # Example
966 /// ```ignore,no_run
967 /// # use google_cloud_documentai_v1::model::document::Style;
968 /// let x = Style::new().set_text_decoration("example");
969 /// ```
970 pub fn set_text_decoration<T: std::convert::Into<std::string::String>>(
971 mut self,
972 v: T,
973 ) -> Self {
974 self.text_decoration = v.into();
975 self
976 }
977
978 /// Sets the value of [font_size][crate::model::document::Style::font_size].
979 ///
980 /// # Example
981 /// ```ignore,no_run
982 /// # use google_cloud_documentai_v1::model::document::Style;
983 /// use google_cloud_documentai_v1::model::document::style::FontSize;
984 /// let x = Style::new().set_font_size(FontSize::default()/* use setters */);
985 /// ```
986 pub fn set_font_size<T>(mut self, v: T) -> Self
987 where
988 T: std::convert::Into<crate::model::document::style::FontSize>,
989 {
990 self.font_size = std::option::Option::Some(v.into());
991 self
992 }
993
994 /// Sets or clears the value of [font_size][crate::model::document::Style::font_size].
995 ///
996 /// # Example
997 /// ```ignore,no_run
998 /// # use google_cloud_documentai_v1::model::document::Style;
999 /// use google_cloud_documentai_v1::model::document::style::FontSize;
1000 /// let x = Style::new().set_or_clear_font_size(Some(FontSize::default()/* use setters */));
1001 /// let x = Style::new().set_or_clear_font_size(None::<FontSize>);
1002 /// ```
1003 pub fn set_or_clear_font_size<T>(mut self, v: std::option::Option<T>) -> Self
1004 where
1005 T: std::convert::Into<crate::model::document::style::FontSize>,
1006 {
1007 self.font_size = v.map(|x| x.into());
1008 self
1009 }
1010
1011 /// Sets the value of [font_family][crate::model::document::Style::font_family].
1012 ///
1013 /// # Example
1014 /// ```ignore,no_run
1015 /// # use google_cloud_documentai_v1::model::document::Style;
1016 /// let x = Style::new().set_font_family("example");
1017 /// ```
1018 pub fn set_font_family<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1019 self.font_family = v.into();
1020 self
1021 }
1022 }
1023
1024 impl wkt::message::Message for Style {
1025 fn typename() -> &'static str {
1026 "type.googleapis.com/google.cloud.documentai.v1.Document.Style"
1027 }
1028 }
1029
1030 /// Defines additional types related to [Style].
1031 pub mod style {
1032 #[allow(unused_imports)]
1033 use super::*;
1034
1035 /// Font size with unit.
1036 #[derive(Clone, Default, PartialEq)]
1037 #[non_exhaustive]
1038 pub struct FontSize {
1039 /// Font size for the text.
1040 pub size: f32,
1041
1042 /// Unit for the font size. Follows CSS naming (such as `in`, `px`, and
1043 /// `pt`).
1044 pub unit: std::string::String,
1045
1046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1047 }
1048
1049 impl FontSize {
1050 /// Creates a new default instance.
1051 pub fn new() -> Self {
1052 std::default::Default::default()
1053 }
1054
1055 /// Sets the value of [size][crate::model::document::style::FontSize::size].
1056 ///
1057 /// # Example
1058 /// ```ignore,no_run
1059 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1060 /// let x = FontSize::new().set_size(42.0);
1061 /// ```
1062 pub fn set_size<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1063 self.size = v.into();
1064 self
1065 }
1066
1067 /// Sets the value of [unit][crate::model::document::style::FontSize::unit].
1068 ///
1069 /// # Example
1070 /// ```ignore,no_run
1071 /// # use google_cloud_documentai_v1::model::document::style::FontSize;
1072 /// let x = FontSize::new().set_unit("example");
1073 /// ```
1074 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1075 self.unit = v.into();
1076 self
1077 }
1078 }
1079
1080 impl wkt::message::Message for FontSize {
1081 fn typename() -> &'static str {
1082 "type.googleapis.com/google.cloud.documentai.v1.Document.Style.FontSize"
1083 }
1084 }
1085 }
1086
1087 /// A page in a [Document][google.cloud.documentai.v1.Document].
1088 ///
1089 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1090 #[derive(Clone, Default, PartialEq)]
1091 #[non_exhaustive]
1092 pub struct Page {
1093 /// 1-based index for current
1094 /// [Page][google.cloud.documentai.v1.Document.Page] in a parent
1095 /// [Document][google.cloud.documentai.v1.Document]. Useful when a page is
1096 /// taken out of a [Document][google.cloud.documentai.v1.Document] for
1097 /// individual processing.
1098 ///
1099 /// [google.cloud.documentai.v1.Document]: crate::model::Document
1100 /// [google.cloud.documentai.v1.Document.Page]: crate::model::document::Page
1101 pub page_number: i32,
1102
1103 /// Rendered image for this page. This image is preprocessed to remove any
1104 /// skew, rotation, and distortions such that the annotation bounding boxes
1105 /// can be upright and axis-aligned.
1106 pub image: std::option::Option<crate::model::document::page::Image>,
1107
1108 /// Transformation matrices that were applied to the original document image
1109 /// to produce [Page.image][google.cloud.documentai.v1.Document.Page.image].
1110 ///
1111 /// [google.cloud.documentai.v1.Document.Page.image]: crate::model::document::Page::image
1112 pub transforms: std::vec::Vec<crate::model::document::page::Matrix>,
1113
1114 /// Physical dimension of the page.
1115 pub dimension: std::option::Option<crate::model::document::page::Dimension>,
1116
1117 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page.
1118 ///
1119 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1120 pub layout: std::option::Option<crate::model::document::page::Layout>,
1121
1122 /// A list of detected languages together with confidence.
1123 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
1124
1125 /// A list of visually detected text blocks on the page.
1126 /// A block has a set of lines (collected into paragraphs) that have a common
1127 /// line-spacing and orientation.
1128 pub blocks: std::vec::Vec<crate::model::document::page::Block>,
1129
1130 /// A list of visually detected text paragraphs on the page.
1131 /// A collection of lines that a human would perceive as a paragraph.
1132 pub paragraphs: std::vec::Vec<crate::model::document::page::Paragraph>,
1133
1134 /// A list of visually detected text lines on the page.
1135 /// A collection of tokens that a human would perceive as a line.
1136 pub lines: std::vec::Vec<crate::model::document::page::Line>,
1137
1138 /// A list of visually detected tokens on the page.
1139 pub tokens: std::vec::Vec<crate::model::document::page::Token>,
1140
1141 /// A list of detected non-text visual elements, for example, checkbox,
1142 /// signature etc. on the page.
1143 pub visual_elements: std::vec::Vec<crate::model::document::page::VisualElement>,
1144
1145 /// A list of visually detected tables on the page.
1146 pub tables: std::vec::Vec<crate::model::document::page::Table>,
1147
1148 /// A list of visually detected form fields on the page.
1149 pub form_fields: std::vec::Vec<crate::model::document::page::FormField>,
1150
1151 /// A list of visually detected symbols on the page.
1152 pub symbols: std::vec::Vec<crate::model::document::page::Symbol>,
1153
1154 /// A list of detected barcodes.
1155 pub detected_barcodes: std::vec::Vec<crate::model::document::page::DetectedBarcode>,
1156
1157 /// Image quality scores.
1158 pub image_quality_scores:
1159 std::option::Option<crate::model::document::page::ImageQualityScores>,
1160
1161 /// The history of this page.
1162 #[deprecated]
1163 pub provenance: std::option::Option<crate::model::document::Provenance>,
1164
1165 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1166 }
1167
1168 impl Page {
1169 /// Creates a new default instance.
1170 pub fn new() -> Self {
1171 std::default::Default::default()
1172 }
1173
1174 /// Sets the value of [page_number][crate::model::document::Page::page_number].
1175 ///
1176 /// # Example
1177 /// ```ignore,no_run
1178 /// # use google_cloud_documentai_v1::model::document::Page;
1179 /// let x = Page::new().set_page_number(42);
1180 /// ```
1181 pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1182 self.page_number = v.into();
1183 self
1184 }
1185
1186 /// Sets the value of [image][crate::model::document::Page::image].
1187 ///
1188 /// # Example
1189 /// ```ignore,no_run
1190 /// # use google_cloud_documentai_v1::model::document::Page;
1191 /// use google_cloud_documentai_v1::model::document::page::Image;
1192 /// let x = Page::new().set_image(Image::default()/* use setters */);
1193 /// ```
1194 pub fn set_image<T>(mut self, v: T) -> Self
1195 where
1196 T: std::convert::Into<crate::model::document::page::Image>,
1197 {
1198 self.image = std::option::Option::Some(v.into());
1199 self
1200 }
1201
1202 /// Sets or clears the value of [image][crate::model::document::Page::image].
1203 ///
1204 /// # Example
1205 /// ```ignore,no_run
1206 /// # use google_cloud_documentai_v1::model::document::Page;
1207 /// use google_cloud_documentai_v1::model::document::page::Image;
1208 /// let x = Page::new().set_or_clear_image(Some(Image::default()/* use setters */));
1209 /// let x = Page::new().set_or_clear_image(None::<Image>);
1210 /// ```
1211 pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
1212 where
1213 T: std::convert::Into<crate::model::document::page::Image>,
1214 {
1215 self.image = v.map(|x| x.into());
1216 self
1217 }
1218
1219 /// Sets the value of [transforms][crate::model::document::Page::transforms].
1220 ///
1221 /// # Example
1222 /// ```ignore,no_run
1223 /// # use google_cloud_documentai_v1::model::document::Page;
1224 /// use google_cloud_documentai_v1::model::document::page::Matrix;
1225 /// let x = Page::new()
1226 /// .set_transforms([
1227 /// Matrix::default()/* use setters */,
1228 /// Matrix::default()/* use (different) setters */,
1229 /// ]);
1230 /// ```
1231 pub fn set_transforms<T, V>(mut self, v: T) -> Self
1232 where
1233 T: std::iter::IntoIterator<Item = V>,
1234 V: std::convert::Into<crate::model::document::page::Matrix>,
1235 {
1236 use std::iter::Iterator;
1237 self.transforms = v.into_iter().map(|i| i.into()).collect();
1238 self
1239 }
1240
1241 /// Sets the value of [dimension][crate::model::document::Page::dimension].
1242 ///
1243 /// # Example
1244 /// ```ignore,no_run
1245 /// # use google_cloud_documentai_v1::model::document::Page;
1246 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1247 /// let x = Page::new().set_dimension(Dimension::default()/* use setters */);
1248 /// ```
1249 pub fn set_dimension<T>(mut self, v: T) -> Self
1250 where
1251 T: std::convert::Into<crate::model::document::page::Dimension>,
1252 {
1253 self.dimension = std::option::Option::Some(v.into());
1254 self
1255 }
1256
1257 /// Sets or clears the value of [dimension][crate::model::document::Page::dimension].
1258 ///
1259 /// # Example
1260 /// ```ignore,no_run
1261 /// # use google_cloud_documentai_v1::model::document::Page;
1262 /// use google_cloud_documentai_v1::model::document::page::Dimension;
1263 /// let x = Page::new().set_or_clear_dimension(Some(Dimension::default()/* use setters */));
1264 /// let x = Page::new().set_or_clear_dimension(None::<Dimension>);
1265 /// ```
1266 pub fn set_or_clear_dimension<T>(mut self, v: std::option::Option<T>) -> Self
1267 where
1268 T: std::convert::Into<crate::model::document::page::Dimension>,
1269 {
1270 self.dimension = v.map(|x| x.into());
1271 self
1272 }
1273
1274 /// Sets the value of [layout][crate::model::document::Page::layout].
1275 ///
1276 /// # Example
1277 /// ```ignore,no_run
1278 /// # use google_cloud_documentai_v1::model::document::Page;
1279 /// use google_cloud_documentai_v1::model::document::page::Layout;
1280 /// let x = Page::new().set_layout(Layout::default()/* use setters */);
1281 /// ```
1282 pub fn set_layout<T>(mut self, v: T) -> Self
1283 where
1284 T: std::convert::Into<crate::model::document::page::Layout>,
1285 {
1286 self.layout = std::option::Option::Some(v.into());
1287 self
1288 }
1289
1290 /// Sets or clears the value of [layout][crate::model::document::Page::layout].
1291 ///
1292 /// # Example
1293 /// ```ignore,no_run
1294 /// # use google_cloud_documentai_v1::model::document::Page;
1295 /// use google_cloud_documentai_v1::model::document::page::Layout;
1296 /// let x = Page::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
1297 /// let x = Page::new().set_or_clear_layout(None::<Layout>);
1298 /// ```
1299 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
1300 where
1301 T: std::convert::Into<crate::model::document::page::Layout>,
1302 {
1303 self.layout = v.map(|x| x.into());
1304 self
1305 }
1306
1307 /// Sets the value of [detected_languages][crate::model::document::Page::detected_languages].
1308 ///
1309 /// # Example
1310 /// ```ignore,no_run
1311 /// # use google_cloud_documentai_v1::model::document::Page;
1312 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
1313 /// let x = Page::new()
1314 /// .set_detected_languages([
1315 /// DetectedLanguage::default()/* use setters */,
1316 /// DetectedLanguage::default()/* use (different) setters */,
1317 /// ]);
1318 /// ```
1319 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
1320 where
1321 T: std::iter::IntoIterator<Item = V>,
1322 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
1323 {
1324 use std::iter::Iterator;
1325 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
1326 self
1327 }
1328
1329 /// Sets the value of [blocks][crate::model::document::Page::blocks].
1330 ///
1331 /// # Example
1332 /// ```ignore,no_run
1333 /// # use google_cloud_documentai_v1::model::document::Page;
1334 /// use google_cloud_documentai_v1::model::document::page::Block;
1335 /// let x = Page::new()
1336 /// .set_blocks([
1337 /// Block::default()/* use setters */,
1338 /// Block::default()/* use (different) setters */,
1339 /// ]);
1340 /// ```
1341 pub fn set_blocks<T, V>(mut self, v: T) -> Self
1342 where
1343 T: std::iter::IntoIterator<Item = V>,
1344 V: std::convert::Into<crate::model::document::page::Block>,
1345 {
1346 use std::iter::Iterator;
1347 self.blocks = v.into_iter().map(|i| i.into()).collect();
1348 self
1349 }
1350
1351 /// Sets the value of [paragraphs][crate::model::document::Page::paragraphs].
1352 ///
1353 /// # Example
1354 /// ```ignore,no_run
1355 /// # use google_cloud_documentai_v1::model::document::Page;
1356 /// use google_cloud_documentai_v1::model::document::page::Paragraph;
1357 /// let x = Page::new()
1358 /// .set_paragraphs([
1359 /// Paragraph::default()/* use setters */,
1360 /// Paragraph::default()/* use (different) setters */,
1361 /// ]);
1362 /// ```
1363 pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
1364 where
1365 T: std::iter::IntoIterator<Item = V>,
1366 V: std::convert::Into<crate::model::document::page::Paragraph>,
1367 {
1368 use std::iter::Iterator;
1369 self.paragraphs = v.into_iter().map(|i| i.into()).collect();
1370 self
1371 }
1372
1373 /// Sets the value of [lines][crate::model::document::Page::lines].
1374 ///
1375 /// # Example
1376 /// ```ignore,no_run
1377 /// # use google_cloud_documentai_v1::model::document::Page;
1378 /// use google_cloud_documentai_v1::model::document::page::Line;
1379 /// let x = Page::new()
1380 /// .set_lines([
1381 /// Line::default()/* use setters */,
1382 /// Line::default()/* use (different) setters */,
1383 /// ]);
1384 /// ```
1385 pub fn set_lines<T, V>(mut self, v: T) -> Self
1386 where
1387 T: std::iter::IntoIterator<Item = V>,
1388 V: std::convert::Into<crate::model::document::page::Line>,
1389 {
1390 use std::iter::Iterator;
1391 self.lines = v.into_iter().map(|i| i.into()).collect();
1392 self
1393 }
1394
1395 /// Sets the value of [tokens][crate::model::document::Page::tokens].
1396 ///
1397 /// # Example
1398 /// ```ignore,no_run
1399 /// # use google_cloud_documentai_v1::model::document::Page;
1400 /// use google_cloud_documentai_v1::model::document::page::Token;
1401 /// let x = Page::new()
1402 /// .set_tokens([
1403 /// Token::default()/* use setters */,
1404 /// Token::default()/* use (different) setters */,
1405 /// ]);
1406 /// ```
1407 pub fn set_tokens<T, V>(mut self, v: T) -> Self
1408 where
1409 T: std::iter::IntoIterator<Item = V>,
1410 V: std::convert::Into<crate::model::document::page::Token>,
1411 {
1412 use std::iter::Iterator;
1413 self.tokens = v.into_iter().map(|i| i.into()).collect();
1414 self
1415 }
1416
1417 /// Sets the value of [visual_elements][crate::model::document::Page::visual_elements].
1418 ///
1419 /// # Example
1420 /// ```ignore,no_run
1421 /// # use google_cloud_documentai_v1::model::document::Page;
1422 /// use google_cloud_documentai_v1::model::document::page::VisualElement;
1423 /// let x = Page::new()
1424 /// .set_visual_elements([
1425 /// VisualElement::default()/* use setters */,
1426 /// VisualElement::default()/* use (different) setters */,
1427 /// ]);
1428 /// ```
1429 pub fn set_visual_elements<T, V>(mut self, v: T) -> Self
1430 where
1431 T: std::iter::IntoIterator<Item = V>,
1432 V: std::convert::Into<crate::model::document::page::VisualElement>,
1433 {
1434 use std::iter::Iterator;
1435 self.visual_elements = v.into_iter().map(|i| i.into()).collect();
1436 self
1437 }
1438
1439 /// Sets the value of [tables][crate::model::document::Page::tables].
1440 ///
1441 /// # Example
1442 /// ```ignore,no_run
1443 /// # use google_cloud_documentai_v1::model::document::Page;
1444 /// use google_cloud_documentai_v1::model::document::page::Table;
1445 /// let x = Page::new()
1446 /// .set_tables([
1447 /// Table::default()/* use setters */,
1448 /// Table::default()/* use (different) setters */,
1449 /// ]);
1450 /// ```
1451 pub fn set_tables<T, V>(mut self, v: T) -> Self
1452 where
1453 T: std::iter::IntoIterator<Item = V>,
1454 V: std::convert::Into<crate::model::document::page::Table>,
1455 {
1456 use std::iter::Iterator;
1457 self.tables = v.into_iter().map(|i| i.into()).collect();
1458 self
1459 }
1460
1461 /// Sets the value of [form_fields][crate::model::document::Page::form_fields].
1462 ///
1463 /// # Example
1464 /// ```ignore,no_run
1465 /// # use google_cloud_documentai_v1::model::document::Page;
1466 /// use google_cloud_documentai_v1::model::document::page::FormField;
1467 /// let x = Page::new()
1468 /// .set_form_fields([
1469 /// FormField::default()/* use setters */,
1470 /// FormField::default()/* use (different) setters */,
1471 /// ]);
1472 /// ```
1473 pub fn set_form_fields<T, V>(mut self, v: T) -> Self
1474 where
1475 T: std::iter::IntoIterator<Item = V>,
1476 V: std::convert::Into<crate::model::document::page::FormField>,
1477 {
1478 use std::iter::Iterator;
1479 self.form_fields = v.into_iter().map(|i| i.into()).collect();
1480 self
1481 }
1482
1483 /// Sets the value of [symbols][crate::model::document::Page::symbols].
1484 ///
1485 /// # Example
1486 /// ```ignore,no_run
1487 /// # use google_cloud_documentai_v1::model::document::Page;
1488 /// use google_cloud_documentai_v1::model::document::page::Symbol;
1489 /// let x = Page::new()
1490 /// .set_symbols([
1491 /// Symbol::default()/* use setters */,
1492 /// Symbol::default()/* use (different) setters */,
1493 /// ]);
1494 /// ```
1495 pub fn set_symbols<T, V>(mut self, v: T) -> Self
1496 where
1497 T: std::iter::IntoIterator<Item = V>,
1498 V: std::convert::Into<crate::model::document::page::Symbol>,
1499 {
1500 use std::iter::Iterator;
1501 self.symbols = v.into_iter().map(|i| i.into()).collect();
1502 self
1503 }
1504
1505 /// Sets the value of [detected_barcodes][crate::model::document::Page::detected_barcodes].
1506 ///
1507 /// # Example
1508 /// ```ignore,no_run
1509 /// # use google_cloud_documentai_v1::model::document::Page;
1510 /// use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
1511 /// let x = Page::new()
1512 /// .set_detected_barcodes([
1513 /// DetectedBarcode::default()/* use setters */,
1514 /// DetectedBarcode::default()/* use (different) setters */,
1515 /// ]);
1516 /// ```
1517 pub fn set_detected_barcodes<T, V>(mut self, v: T) -> Self
1518 where
1519 T: std::iter::IntoIterator<Item = V>,
1520 V: std::convert::Into<crate::model::document::page::DetectedBarcode>,
1521 {
1522 use std::iter::Iterator;
1523 self.detected_barcodes = v.into_iter().map(|i| i.into()).collect();
1524 self
1525 }
1526
1527 /// Sets the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1528 ///
1529 /// # Example
1530 /// ```ignore,no_run
1531 /// # use google_cloud_documentai_v1::model::document::Page;
1532 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1533 /// let x = Page::new().set_image_quality_scores(ImageQualityScores::default()/* use setters */);
1534 /// ```
1535 pub fn set_image_quality_scores<T>(mut self, v: T) -> Self
1536 where
1537 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1538 {
1539 self.image_quality_scores = std::option::Option::Some(v.into());
1540 self
1541 }
1542
1543 /// Sets or clears the value of [image_quality_scores][crate::model::document::Page::image_quality_scores].
1544 ///
1545 /// # Example
1546 /// ```ignore,no_run
1547 /// # use google_cloud_documentai_v1::model::document::Page;
1548 /// use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
1549 /// let x = Page::new().set_or_clear_image_quality_scores(Some(ImageQualityScores::default()/* use setters */));
1550 /// let x = Page::new().set_or_clear_image_quality_scores(None::<ImageQualityScores>);
1551 /// ```
1552 pub fn set_or_clear_image_quality_scores<T>(mut self, v: std::option::Option<T>) -> Self
1553 where
1554 T: std::convert::Into<crate::model::document::page::ImageQualityScores>,
1555 {
1556 self.image_quality_scores = v.map(|x| x.into());
1557 self
1558 }
1559
1560 /// Sets the value of [provenance][crate::model::document::Page::provenance].
1561 ///
1562 /// # Example
1563 /// ```ignore,no_run
1564 /// # use google_cloud_documentai_v1::model::document::Page;
1565 /// use google_cloud_documentai_v1::model::document::Provenance;
1566 /// let x = Page::new().set_provenance(Provenance::default()/* use setters */);
1567 /// ```
1568 #[deprecated]
1569 pub fn set_provenance<T>(mut self, v: T) -> Self
1570 where
1571 T: std::convert::Into<crate::model::document::Provenance>,
1572 {
1573 self.provenance = std::option::Option::Some(v.into());
1574 self
1575 }
1576
1577 /// Sets or clears the value of [provenance][crate::model::document::Page::provenance].
1578 ///
1579 /// # Example
1580 /// ```ignore,no_run
1581 /// # use google_cloud_documentai_v1::model::document::Page;
1582 /// use google_cloud_documentai_v1::model::document::Provenance;
1583 /// let x = Page::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
1584 /// let x = Page::new().set_or_clear_provenance(None::<Provenance>);
1585 /// ```
1586 #[deprecated]
1587 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
1588 where
1589 T: std::convert::Into<crate::model::document::Provenance>,
1590 {
1591 self.provenance = v.map(|x| x.into());
1592 self
1593 }
1594 }
1595
1596 impl wkt::message::Message for Page {
1597 fn typename() -> &'static str {
1598 "type.googleapis.com/google.cloud.documentai.v1.Document.Page"
1599 }
1600 }
1601
1602 /// Defines additional types related to [Page].
1603 pub mod page {
1604 #[allow(unused_imports)]
1605 use super::*;
1606
1607 /// Dimension for the page.
1608 #[derive(Clone, Default, PartialEq)]
1609 #[non_exhaustive]
1610 pub struct Dimension {
1611 /// Page width.
1612 pub width: f32,
1613
1614 /// Page height.
1615 pub height: f32,
1616
1617 /// Dimension unit.
1618 pub unit: std::string::String,
1619
1620 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1621 }
1622
1623 impl Dimension {
1624 /// Creates a new default instance.
1625 pub fn new() -> Self {
1626 std::default::Default::default()
1627 }
1628
1629 /// Sets the value of [width][crate::model::document::page::Dimension::width].
1630 ///
1631 /// # Example
1632 /// ```ignore,no_run
1633 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1634 /// let x = Dimension::new().set_width(42.0);
1635 /// ```
1636 pub fn set_width<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1637 self.width = v.into();
1638 self
1639 }
1640
1641 /// Sets the value of [height][crate::model::document::page::Dimension::height].
1642 ///
1643 /// # Example
1644 /// ```ignore,no_run
1645 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1646 /// let x = Dimension::new().set_height(42.0);
1647 /// ```
1648 pub fn set_height<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1649 self.height = v.into();
1650 self
1651 }
1652
1653 /// Sets the value of [unit][crate::model::document::page::Dimension::unit].
1654 ///
1655 /// # Example
1656 /// ```ignore,no_run
1657 /// # use google_cloud_documentai_v1::model::document::page::Dimension;
1658 /// let x = Dimension::new().set_unit("example");
1659 /// ```
1660 pub fn set_unit<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1661 self.unit = v.into();
1662 self
1663 }
1664 }
1665
1666 impl wkt::message::Message for Dimension {
1667 fn typename() -> &'static str {
1668 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Dimension"
1669 }
1670 }
1671
1672 /// Rendered image contents for this page.
1673 #[derive(Clone, Default, PartialEq)]
1674 #[non_exhaustive]
1675 pub struct Image {
1676 /// Raw byte content of the image.
1677 pub content: ::bytes::Bytes,
1678
1679 /// Encoding [media type (MIME
1680 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml)
1681 /// for the image.
1682 pub mime_type: std::string::String,
1683
1684 /// Width of the image in pixels.
1685 pub width: i32,
1686
1687 /// Height of the image in pixels.
1688 pub height: i32,
1689
1690 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1691 }
1692
1693 impl Image {
1694 /// Creates a new default instance.
1695 pub fn new() -> Self {
1696 std::default::Default::default()
1697 }
1698
1699 /// Sets the value of [content][crate::model::document::page::Image::content].
1700 ///
1701 /// # Example
1702 /// ```ignore,no_run
1703 /// # use google_cloud_documentai_v1::model::document::page::Image;
1704 /// let x = Image::new().set_content(bytes::Bytes::from_static(b"example"));
1705 /// ```
1706 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1707 self.content = v.into();
1708 self
1709 }
1710
1711 /// Sets the value of [mime_type][crate::model::document::page::Image::mime_type].
1712 ///
1713 /// # Example
1714 /// ```ignore,no_run
1715 /// # use google_cloud_documentai_v1::model::document::page::Image;
1716 /// let x = Image::new().set_mime_type("example");
1717 /// ```
1718 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
1719 mut self,
1720 v: T,
1721 ) -> Self {
1722 self.mime_type = v.into();
1723 self
1724 }
1725
1726 /// Sets the value of [width][crate::model::document::page::Image::width].
1727 ///
1728 /// # Example
1729 /// ```ignore,no_run
1730 /// # use google_cloud_documentai_v1::model::document::page::Image;
1731 /// let x = Image::new().set_width(42);
1732 /// ```
1733 pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1734 self.width = v.into();
1735 self
1736 }
1737
1738 /// Sets the value of [height][crate::model::document::page::Image::height].
1739 ///
1740 /// # Example
1741 /// ```ignore,no_run
1742 /// # use google_cloud_documentai_v1::model::document::page::Image;
1743 /// let x = Image::new().set_height(42);
1744 /// ```
1745 pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1746 self.height = v.into();
1747 self
1748 }
1749 }
1750
1751 impl wkt::message::Message for Image {
1752 fn typename() -> &'static str {
1753 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Image"
1754 }
1755 }
1756
1757 /// Representation for transformation matrix, intended to be compatible and
1758 /// used with OpenCV format for image manipulation.
1759 #[derive(Clone, Default, PartialEq)]
1760 #[non_exhaustive]
1761 pub struct Matrix {
1762 /// Number of rows in the matrix.
1763 pub rows: i32,
1764
1765 /// Number of columns in the matrix.
1766 pub cols: i32,
1767
1768 /// This encodes information about what data type the matrix uses.
1769 /// For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list
1770 /// of OpenCV primitive data types, please refer to
1771 /// <https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html>
1772 pub r#type: i32,
1773
1774 /// The matrix data.
1775 pub data: ::bytes::Bytes,
1776
1777 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1778 }
1779
1780 impl Matrix {
1781 /// Creates a new default instance.
1782 pub fn new() -> Self {
1783 std::default::Default::default()
1784 }
1785
1786 /// Sets the value of [rows][crate::model::document::page::Matrix::rows].
1787 ///
1788 /// # Example
1789 /// ```ignore,no_run
1790 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1791 /// let x = Matrix::new().set_rows(42);
1792 /// ```
1793 pub fn set_rows<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1794 self.rows = v.into();
1795 self
1796 }
1797
1798 /// Sets the value of [cols][crate::model::document::page::Matrix::cols].
1799 ///
1800 /// # Example
1801 /// ```ignore,no_run
1802 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1803 /// let x = Matrix::new().set_cols(42);
1804 /// ```
1805 pub fn set_cols<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1806 self.cols = v.into();
1807 self
1808 }
1809
1810 /// Sets the value of [r#type][crate::model::document::page::Matrix::type].
1811 ///
1812 /// # Example
1813 /// ```ignore,no_run
1814 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1815 /// let x = Matrix::new().set_type(42);
1816 /// ```
1817 pub fn set_type<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
1818 self.r#type = v.into();
1819 self
1820 }
1821
1822 /// Sets the value of [data][crate::model::document::page::Matrix::data].
1823 ///
1824 /// # Example
1825 /// ```ignore,no_run
1826 /// # use google_cloud_documentai_v1::model::document::page::Matrix;
1827 /// let x = Matrix::new().set_data(bytes::Bytes::from_static(b"example"));
1828 /// ```
1829 pub fn set_data<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1830 self.data = v.into();
1831 self
1832 }
1833 }
1834
1835 impl wkt::message::Message for Matrix {
1836 fn typename() -> &'static str {
1837 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Matrix"
1838 }
1839 }
1840
1841 /// Visual element describing a layout unit on a page.
1842 #[derive(Clone, Default, PartialEq)]
1843 #[non_exhaustive]
1844 pub struct Layout {
1845 /// Text anchor indexing into the
1846 /// [Document.text][google.cloud.documentai.v1.Document.text].
1847 ///
1848 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
1849 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
1850
1851 /// Confidence of the current
1852 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] within
1853 /// context of the object this layout is for. For example, confidence can
1854 /// be for a single token, a table, a visual element, etc. depending on
1855 /// context. Range `[0, 1]`.
1856 ///
1857 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1858 pub confidence: f32,
1859
1860 /// The bounding polygon for the
1861 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1862 ///
1863 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1864 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1865
1866 /// Detected orientation for the
1867 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout].
1868 ///
1869 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
1870 pub orientation: crate::model::document::page::layout::Orientation,
1871
1872 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1873 }
1874
1875 impl Layout {
1876 /// Creates a new default instance.
1877 pub fn new() -> Self {
1878 std::default::Default::default()
1879 }
1880
1881 /// Sets the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1882 ///
1883 /// # Example
1884 /// ```ignore,no_run
1885 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1886 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1887 /// let x = Layout::new().set_text_anchor(TextAnchor::default()/* use setters */);
1888 /// ```
1889 pub fn set_text_anchor<T>(mut self, v: T) -> Self
1890 where
1891 T: std::convert::Into<crate::model::document::TextAnchor>,
1892 {
1893 self.text_anchor = std::option::Option::Some(v.into());
1894 self
1895 }
1896
1897 /// Sets or clears the value of [text_anchor][crate::model::document::page::Layout::text_anchor].
1898 ///
1899 /// # Example
1900 /// ```ignore,no_run
1901 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1902 /// use google_cloud_documentai_v1::model::document::TextAnchor;
1903 /// let x = Layout::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
1904 /// let x = Layout::new().set_or_clear_text_anchor(None::<TextAnchor>);
1905 /// ```
1906 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
1907 where
1908 T: std::convert::Into<crate::model::document::TextAnchor>,
1909 {
1910 self.text_anchor = v.map(|x| x.into());
1911 self
1912 }
1913
1914 /// Sets the value of [confidence][crate::model::document::page::Layout::confidence].
1915 ///
1916 /// # Example
1917 /// ```ignore,no_run
1918 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1919 /// let x = Layout::new().set_confidence(42.0);
1920 /// ```
1921 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1922 self.confidence = v.into();
1923 self
1924 }
1925
1926 /// Sets the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1927 ///
1928 /// # Example
1929 /// ```ignore,no_run
1930 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1931 /// use google_cloud_documentai_v1::model::BoundingPoly;
1932 /// let x = Layout::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
1933 /// ```
1934 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1935 where
1936 T: std::convert::Into<crate::model::BoundingPoly>,
1937 {
1938 self.bounding_poly = std::option::Option::Some(v.into());
1939 self
1940 }
1941
1942 /// Sets or clears the value of [bounding_poly][crate::model::document::page::Layout::bounding_poly].
1943 ///
1944 /// # Example
1945 /// ```ignore,no_run
1946 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1947 /// use google_cloud_documentai_v1::model::BoundingPoly;
1948 /// let x = Layout::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
1949 /// let x = Layout::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
1950 /// ```
1951 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1952 where
1953 T: std::convert::Into<crate::model::BoundingPoly>,
1954 {
1955 self.bounding_poly = v.map(|x| x.into());
1956 self
1957 }
1958
1959 /// Sets the value of [orientation][crate::model::document::page::Layout::orientation].
1960 ///
1961 /// # Example
1962 /// ```ignore,no_run
1963 /// # use google_cloud_documentai_v1::model::document::page::Layout;
1964 /// use google_cloud_documentai_v1::model::document::page::layout::Orientation;
1965 /// let x0 = Layout::new().set_orientation(Orientation::PageUp);
1966 /// let x1 = Layout::new().set_orientation(Orientation::PageRight);
1967 /// let x2 = Layout::new().set_orientation(Orientation::PageDown);
1968 /// ```
1969 pub fn set_orientation<
1970 T: std::convert::Into<crate::model::document::page::layout::Orientation>,
1971 >(
1972 mut self,
1973 v: T,
1974 ) -> Self {
1975 self.orientation = v.into();
1976 self
1977 }
1978 }
1979
1980 impl wkt::message::Message for Layout {
1981 fn typename() -> &'static str {
1982 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Layout"
1983 }
1984 }
1985
1986 /// Defines additional types related to [Layout].
1987 pub mod layout {
1988 #[allow(unused_imports)]
1989 use super::*;
1990
1991 /// Detected human reading orientation.
1992 ///
1993 /// # Working with unknown values
1994 ///
1995 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
1996 /// additional enum variants at any time. Adding new variants is not considered
1997 /// a breaking change. Applications should write their code in anticipation of:
1998 ///
1999 /// - New values appearing in future releases of the client library, **and**
2000 /// - New values received dynamically, without application changes.
2001 ///
2002 /// Please consult the [Working with enums] section in the user guide for some
2003 /// guidelines.
2004 ///
2005 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2006 #[derive(Clone, Debug, PartialEq)]
2007 #[non_exhaustive]
2008 pub enum Orientation {
2009 /// Unspecified orientation.
2010 Unspecified,
2011 /// Orientation is aligned with page up.
2012 PageUp,
2013 /// Orientation is aligned with page right.
2014 /// Turn the head 90 degrees clockwise from upright to read.
2015 PageRight,
2016 /// Orientation is aligned with page down.
2017 /// Turn the head 180 degrees from upright to read.
2018 PageDown,
2019 /// Orientation is aligned with page left.
2020 /// Turn the head 90 degrees counterclockwise from upright to read.
2021 PageLeft,
2022 /// If set, the enum was initialized with an unknown value.
2023 ///
2024 /// Applications can examine the value using [Orientation::value] or
2025 /// [Orientation::name].
2026 UnknownValue(orientation::UnknownValue),
2027 }
2028
2029 #[doc(hidden)]
2030 pub mod orientation {
2031 #[allow(unused_imports)]
2032 use super::*;
2033 #[derive(Clone, Debug, PartialEq)]
2034 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2035 }
2036
2037 impl Orientation {
2038 /// Gets the enum value.
2039 ///
2040 /// Returns `None` if the enum contains an unknown value deserialized from
2041 /// the string representation of enums.
2042 pub fn value(&self) -> std::option::Option<i32> {
2043 match self {
2044 Self::Unspecified => std::option::Option::Some(0),
2045 Self::PageUp => std::option::Option::Some(1),
2046 Self::PageRight => std::option::Option::Some(2),
2047 Self::PageDown => std::option::Option::Some(3),
2048 Self::PageLeft => std::option::Option::Some(4),
2049 Self::UnknownValue(u) => u.0.value(),
2050 }
2051 }
2052
2053 /// Gets the enum value as a string.
2054 ///
2055 /// Returns `None` if the enum contains an unknown value deserialized from
2056 /// the integer representation of enums.
2057 pub fn name(&self) -> std::option::Option<&str> {
2058 match self {
2059 Self::Unspecified => std::option::Option::Some("ORIENTATION_UNSPECIFIED"),
2060 Self::PageUp => std::option::Option::Some("PAGE_UP"),
2061 Self::PageRight => std::option::Option::Some("PAGE_RIGHT"),
2062 Self::PageDown => std::option::Option::Some("PAGE_DOWN"),
2063 Self::PageLeft => std::option::Option::Some("PAGE_LEFT"),
2064 Self::UnknownValue(u) => u.0.name(),
2065 }
2066 }
2067 }
2068
2069 impl std::default::Default for Orientation {
2070 fn default() -> Self {
2071 use std::convert::From;
2072 Self::from(0)
2073 }
2074 }
2075
2076 impl std::fmt::Display for Orientation {
2077 fn fmt(
2078 &self,
2079 f: &mut std::fmt::Formatter<'_>,
2080 ) -> std::result::Result<(), std::fmt::Error> {
2081 wkt::internal::display_enum(f, self.name(), self.value())
2082 }
2083 }
2084
2085 impl std::convert::From<i32> for Orientation {
2086 fn from(value: i32) -> Self {
2087 match value {
2088 0 => Self::Unspecified,
2089 1 => Self::PageUp,
2090 2 => Self::PageRight,
2091 3 => Self::PageDown,
2092 4 => Self::PageLeft,
2093 _ => Self::UnknownValue(orientation::UnknownValue(
2094 wkt::internal::UnknownEnumValue::Integer(value),
2095 )),
2096 }
2097 }
2098 }
2099
2100 impl std::convert::From<&str> for Orientation {
2101 fn from(value: &str) -> Self {
2102 use std::string::ToString;
2103 match value {
2104 "ORIENTATION_UNSPECIFIED" => Self::Unspecified,
2105 "PAGE_UP" => Self::PageUp,
2106 "PAGE_RIGHT" => Self::PageRight,
2107 "PAGE_DOWN" => Self::PageDown,
2108 "PAGE_LEFT" => Self::PageLeft,
2109 _ => Self::UnknownValue(orientation::UnknownValue(
2110 wkt::internal::UnknownEnumValue::String(value.to_string()),
2111 )),
2112 }
2113 }
2114 }
2115
2116 impl serde::ser::Serialize for Orientation {
2117 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2118 where
2119 S: serde::Serializer,
2120 {
2121 match self {
2122 Self::Unspecified => serializer.serialize_i32(0),
2123 Self::PageUp => serializer.serialize_i32(1),
2124 Self::PageRight => serializer.serialize_i32(2),
2125 Self::PageDown => serializer.serialize_i32(3),
2126 Self::PageLeft => serializer.serialize_i32(4),
2127 Self::UnknownValue(u) => u.0.serialize(serializer),
2128 }
2129 }
2130 }
2131
2132 impl<'de> serde::de::Deserialize<'de> for Orientation {
2133 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2134 where
2135 D: serde::Deserializer<'de>,
2136 {
2137 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Orientation>::new(
2138 ".google.cloud.documentai.v1.Document.Page.Layout.Orientation",
2139 ))
2140 }
2141 }
2142 }
2143
2144 /// A block has a set of lines (collected into paragraphs) that have a
2145 /// common line-spacing and orientation.
2146 #[derive(Clone, Default, PartialEq)]
2147 #[non_exhaustive]
2148 pub struct Block {
2149 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2150 /// [Block][google.cloud.documentai.v1.Document.Page.Block].
2151 ///
2152 /// [google.cloud.documentai.v1.Document.Page.Block]: crate::model::document::page::Block
2153 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2154 pub layout: std::option::Option<crate::model::document::page::Layout>,
2155
2156 /// A list of detected languages together with confidence.
2157 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2158
2159 /// The history of this annotation.
2160 #[deprecated]
2161 pub provenance: std::option::Option<crate::model::document::Provenance>,
2162
2163 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2164 }
2165
2166 impl Block {
2167 /// Creates a new default instance.
2168 pub fn new() -> Self {
2169 std::default::Default::default()
2170 }
2171
2172 /// Sets the value of [layout][crate::model::document::page::Block::layout].
2173 ///
2174 /// # Example
2175 /// ```ignore,no_run
2176 /// # use google_cloud_documentai_v1::model::document::page::Block;
2177 /// use google_cloud_documentai_v1::model::document::page::Layout;
2178 /// let x = Block::new().set_layout(Layout::default()/* use setters */);
2179 /// ```
2180 pub fn set_layout<T>(mut self, v: T) -> Self
2181 where
2182 T: std::convert::Into<crate::model::document::page::Layout>,
2183 {
2184 self.layout = std::option::Option::Some(v.into());
2185 self
2186 }
2187
2188 /// Sets or clears the value of [layout][crate::model::document::page::Block::layout].
2189 ///
2190 /// # Example
2191 /// ```ignore,no_run
2192 /// # use google_cloud_documentai_v1::model::document::page::Block;
2193 /// use google_cloud_documentai_v1::model::document::page::Layout;
2194 /// let x = Block::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2195 /// let x = Block::new().set_or_clear_layout(None::<Layout>);
2196 /// ```
2197 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2198 where
2199 T: std::convert::Into<crate::model::document::page::Layout>,
2200 {
2201 self.layout = v.map(|x| x.into());
2202 self
2203 }
2204
2205 /// Sets the value of [detected_languages][crate::model::document::page::Block::detected_languages].
2206 ///
2207 /// # Example
2208 /// ```ignore,no_run
2209 /// # use google_cloud_documentai_v1::model::document::page::Block;
2210 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2211 /// let x = Block::new()
2212 /// .set_detected_languages([
2213 /// DetectedLanguage::default()/* use setters */,
2214 /// DetectedLanguage::default()/* use (different) setters */,
2215 /// ]);
2216 /// ```
2217 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2218 where
2219 T: std::iter::IntoIterator<Item = V>,
2220 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2221 {
2222 use std::iter::Iterator;
2223 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2224 self
2225 }
2226
2227 /// Sets the value of [provenance][crate::model::document::page::Block::provenance].
2228 ///
2229 /// # Example
2230 /// ```ignore,no_run
2231 /// # use google_cloud_documentai_v1::model::document::page::Block;
2232 /// use google_cloud_documentai_v1::model::document::Provenance;
2233 /// let x = Block::new().set_provenance(Provenance::default()/* use setters */);
2234 /// ```
2235 #[deprecated]
2236 pub fn set_provenance<T>(mut self, v: T) -> Self
2237 where
2238 T: std::convert::Into<crate::model::document::Provenance>,
2239 {
2240 self.provenance = std::option::Option::Some(v.into());
2241 self
2242 }
2243
2244 /// Sets or clears the value of [provenance][crate::model::document::page::Block::provenance].
2245 ///
2246 /// # Example
2247 /// ```ignore,no_run
2248 /// # use google_cloud_documentai_v1::model::document::page::Block;
2249 /// use google_cloud_documentai_v1::model::document::Provenance;
2250 /// let x = Block::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2251 /// let x = Block::new().set_or_clear_provenance(None::<Provenance>);
2252 /// ```
2253 #[deprecated]
2254 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2255 where
2256 T: std::convert::Into<crate::model::document::Provenance>,
2257 {
2258 self.provenance = v.map(|x| x.into());
2259 self
2260 }
2261 }
2262
2263 impl wkt::message::Message for Block {
2264 fn typename() -> &'static str {
2265 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Block"
2266 }
2267 }
2268
2269 /// A collection of lines that a human would perceive as a paragraph.
2270 #[derive(Clone, Default, PartialEq)]
2271 #[non_exhaustive]
2272 pub struct Paragraph {
2273 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2274 /// [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph].
2275 ///
2276 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2277 /// [google.cloud.documentai.v1.Document.Page.Paragraph]: crate::model::document::page::Paragraph
2278 pub layout: std::option::Option<crate::model::document::page::Layout>,
2279
2280 /// A list of detected languages together with confidence.
2281 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2282
2283 /// The history of this annotation.
2284 #[deprecated]
2285 pub provenance: std::option::Option<crate::model::document::Provenance>,
2286
2287 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2288 }
2289
2290 impl Paragraph {
2291 /// Creates a new default instance.
2292 pub fn new() -> Self {
2293 std::default::Default::default()
2294 }
2295
2296 /// Sets the value of [layout][crate::model::document::page::Paragraph::layout].
2297 ///
2298 /// # Example
2299 /// ```ignore,no_run
2300 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2301 /// use google_cloud_documentai_v1::model::document::page::Layout;
2302 /// let x = Paragraph::new().set_layout(Layout::default()/* use setters */);
2303 /// ```
2304 pub fn set_layout<T>(mut self, v: T) -> Self
2305 where
2306 T: std::convert::Into<crate::model::document::page::Layout>,
2307 {
2308 self.layout = std::option::Option::Some(v.into());
2309 self
2310 }
2311
2312 /// Sets or clears the value of [layout][crate::model::document::page::Paragraph::layout].
2313 ///
2314 /// # Example
2315 /// ```ignore,no_run
2316 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2317 /// use google_cloud_documentai_v1::model::document::page::Layout;
2318 /// let x = Paragraph::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2319 /// let x = Paragraph::new().set_or_clear_layout(None::<Layout>);
2320 /// ```
2321 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2322 where
2323 T: std::convert::Into<crate::model::document::page::Layout>,
2324 {
2325 self.layout = v.map(|x| x.into());
2326 self
2327 }
2328
2329 /// Sets the value of [detected_languages][crate::model::document::page::Paragraph::detected_languages].
2330 ///
2331 /// # Example
2332 /// ```ignore,no_run
2333 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2334 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2335 /// let x = Paragraph::new()
2336 /// .set_detected_languages([
2337 /// DetectedLanguage::default()/* use setters */,
2338 /// DetectedLanguage::default()/* use (different) setters */,
2339 /// ]);
2340 /// ```
2341 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2342 where
2343 T: std::iter::IntoIterator<Item = V>,
2344 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2345 {
2346 use std::iter::Iterator;
2347 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2348 self
2349 }
2350
2351 /// Sets the value of [provenance][crate::model::document::page::Paragraph::provenance].
2352 ///
2353 /// # Example
2354 /// ```ignore,no_run
2355 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2356 /// use google_cloud_documentai_v1::model::document::Provenance;
2357 /// let x = Paragraph::new().set_provenance(Provenance::default()/* use setters */);
2358 /// ```
2359 #[deprecated]
2360 pub fn set_provenance<T>(mut self, v: T) -> Self
2361 where
2362 T: std::convert::Into<crate::model::document::Provenance>,
2363 {
2364 self.provenance = std::option::Option::Some(v.into());
2365 self
2366 }
2367
2368 /// Sets or clears the value of [provenance][crate::model::document::page::Paragraph::provenance].
2369 ///
2370 /// # Example
2371 /// ```ignore,no_run
2372 /// # use google_cloud_documentai_v1::model::document::page::Paragraph;
2373 /// use google_cloud_documentai_v1::model::document::Provenance;
2374 /// let x = Paragraph::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2375 /// let x = Paragraph::new().set_or_clear_provenance(None::<Provenance>);
2376 /// ```
2377 #[deprecated]
2378 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2379 where
2380 T: std::convert::Into<crate::model::document::Provenance>,
2381 {
2382 self.provenance = v.map(|x| x.into());
2383 self
2384 }
2385 }
2386
2387 impl wkt::message::Message for Paragraph {
2388 fn typename() -> &'static str {
2389 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Paragraph"
2390 }
2391 }
2392
2393 /// A collection of tokens that a human would perceive as a line.
2394 /// Does not cross column boundaries, can be horizontal, vertical, etc.
2395 #[derive(Clone, Default, PartialEq)]
2396 #[non_exhaustive]
2397 pub struct Line {
2398 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2399 /// [Line][google.cloud.documentai.v1.Document.Page.Line].
2400 ///
2401 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2402 /// [google.cloud.documentai.v1.Document.Page.Line]: crate::model::document::page::Line
2403 pub layout: std::option::Option<crate::model::document::page::Layout>,
2404
2405 /// A list of detected languages together with confidence.
2406 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2407
2408 /// The history of this annotation.
2409 #[deprecated]
2410 pub provenance: std::option::Option<crate::model::document::Provenance>,
2411
2412 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2413 }
2414
2415 impl Line {
2416 /// Creates a new default instance.
2417 pub fn new() -> Self {
2418 std::default::Default::default()
2419 }
2420
2421 /// Sets the value of [layout][crate::model::document::page::Line::layout].
2422 ///
2423 /// # Example
2424 /// ```ignore,no_run
2425 /// # use google_cloud_documentai_v1::model::document::page::Line;
2426 /// use google_cloud_documentai_v1::model::document::page::Layout;
2427 /// let x = Line::new().set_layout(Layout::default()/* use setters */);
2428 /// ```
2429 pub fn set_layout<T>(mut self, v: T) -> Self
2430 where
2431 T: std::convert::Into<crate::model::document::page::Layout>,
2432 {
2433 self.layout = std::option::Option::Some(v.into());
2434 self
2435 }
2436
2437 /// Sets or clears the value of [layout][crate::model::document::page::Line::layout].
2438 ///
2439 /// # Example
2440 /// ```ignore,no_run
2441 /// # use google_cloud_documentai_v1::model::document::page::Line;
2442 /// use google_cloud_documentai_v1::model::document::page::Layout;
2443 /// let x = Line::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2444 /// let x = Line::new().set_or_clear_layout(None::<Layout>);
2445 /// ```
2446 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2447 where
2448 T: std::convert::Into<crate::model::document::page::Layout>,
2449 {
2450 self.layout = v.map(|x| x.into());
2451 self
2452 }
2453
2454 /// Sets the value of [detected_languages][crate::model::document::page::Line::detected_languages].
2455 ///
2456 /// # Example
2457 /// ```ignore,no_run
2458 /// # use google_cloud_documentai_v1::model::document::page::Line;
2459 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2460 /// let x = Line::new()
2461 /// .set_detected_languages([
2462 /// DetectedLanguage::default()/* use setters */,
2463 /// DetectedLanguage::default()/* use (different) setters */,
2464 /// ]);
2465 /// ```
2466 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2467 where
2468 T: std::iter::IntoIterator<Item = V>,
2469 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2470 {
2471 use std::iter::Iterator;
2472 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2473 self
2474 }
2475
2476 /// Sets the value of [provenance][crate::model::document::page::Line::provenance].
2477 ///
2478 /// # Example
2479 /// ```ignore,no_run
2480 /// # use google_cloud_documentai_v1::model::document::page::Line;
2481 /// use google_cloud_documentai_v1::model::document::Provenance;
2482 /// let x = Line::new().set_provenance(Provenance::default()/* use setters */);
2483 /// ```
2484 #[deprecated]
2485 pub fn set_provenance<T>(mut self, v: T) -> Self
2486 where
2487 T: std::convert::Into<crate::model::document::Provenance>,
2488 {
2489 self.provenance = std::option::Option::Some(v.into());
2490 self
2491 }
2492
2493 /// Sets or clears the value of [provenance][crate::model::document::page::Line::provenance].
2494 ///
2495 /// # Example
2496 /// ```ignore,no_run
2497 /// # use google_cloud_documentai_v1::model::document::page::Line;
2498 /// use google_cloud_documentai_v1::model::document::Provenance;
2499 /// let x = Line::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2500 /// let x = Line::new().set_or_clear_provenance(None::<Provenance>);
2501 /// ```
2502 #[deprecated]
2503 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2504 where
2505 T: std::convert::Into<crate::model::document::Provenance>,
2506 {
2507 self.provenance = v.map(|x| x.into());
2508 self
2509 }
2510 }
2511
2512 impl wkt::message::Message for Line {
2513 fn typename() -> &'static str {
2514 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Line"
2515 }
2516 }
2517
2518 /// A detected token.
2519 #[derive(Clone, Default, PartialEq)]
2520 #[non_exhaustive]
2521 pub struct Token {
2522 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
2523 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2524 ///
2525 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
2526 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2527 pub layout: std::option::Option<crate::model::document::page::Layout>,
2528
2529 /// Detected break at the end of a
2530 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2531 ///
2532 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2533 pub detected_break:
2534 std::option::Option<crate::model::document::page::token::DetectedBreak>,
2535
2536 /// A list of detected languages together with confidence.
2537 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
2538
2539 /// The history of this annotation.
2540 #[deprecated]
2541 pub provenance: std::option::Option<crate::model::document::Provenance>,
2542
2543 /// Text style attributes.
2544 pub style_info: std::option::Option<crate::model::document::page::token::StyleInfo>,
2545
2546 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2547 }
2548
2549 impl Token {
2550 /// Creates a new default instance.
2551 pub fn new() -> Self {
2552 std::default::Default::default()
2553 }
2554
2555 /// Sets the value of [layout][crate::model::document::page::Token::layout].
2556 ///
2557 /// # Example
2558 /// ```ignore,no_run
2559 /// # use google_cloud_documentai_v1::model::document::page::Token;
2560 /// use google_cloud_documentai_v1::model::document::page::Layout;
2561 /// let x = Token::new().set_layout(Layout::default()/* use setters */);
2562 /// ```
2563 pub fn set_layout<T>(mut self, v: T) -> Self
2564 where
2565 T: std::convert::Into<crate::model::document::page::Layout>,
2566 {
2567 self.layout = std::option::Option::Some(v.into());
2568 self
2569 }
2570
2571 /// Sets or clears the value of [layout][crate::model::document::page::Token::layout].
2572 ///
2573 /// # Example
2574 /// ```ignore,no_run
2575 /// # use google_cloud_documentai_v1::model::document::page::Token;
2576 /// use google_cloud_documentai_v1::model::document::page::Layout;
2577 /// let x = Token::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
2578 /// let x = Token::new().set_or_clear_layout(None::<Layout>);
2579 /// ```
2580 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
2581 where
2582 T: std::convert::Into<crate::model::document::page::Layout>,
2583 {
2584 self.layout = v.map(|x| x.into());
2585 self
2586 }
2587
2588 /// Sets the value of [detected_break][crate::model::document::page::Token::detected_break].
2589 ///
2590 /// # Example
2591 /// ```ignore,no_run
2592 /// # use google_cloud_documentai_v1::model::document::page::Token;
2593 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2594 /// let x = Token::new().set_detected_break(DetectedBreak::default()/* use setters */);
2595 /// ```
2596 pub fn set_detected_break<T>(mut self, v: T) -> Self
2597 where
2598 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2599 {
2600 self.detected_break = std::option::Option::Some(v.into());
2601 self
2602 }
2603
2604 /// Sets or clears the value of [detected_break][crate::model::document::page::Token::detected_break].
2605 ///
2606 /// # Example
2607 /// ```ignore,no_run
2608 /// # use google_cloud_documentai_v1::model::document::page::Token;
2609 /// use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2610 /// let x = Token::new().set_or_clear_detected_break(Some(DetectedBreak::default()/* use setters */));
2611 /// let x = Token::new().set_or_clear_detected_break(None::<DetectedBreak>);
2612 /// ```
2613 pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
2614 where
2615 T: std::convert::Into<crate::model::document::page::token::DetectedBreak>,
2616 {
2617 self.detected_break = v.map(|x| x.into());
2618 self
2619 }
2620
2621 /// Sets the value of [detected_languages][crate::model::document::page::Token::detected_languages].
2622 ///
2623 /// # Example
2624 /// ```ignore,no_run
2625 /// # use google_cloud_documentai_v1::model::document::page::Token;
2626 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
2627 /// let x = Token::new()
2628 /// .set_detected_languages([
2629 /// DetectedLanguage::default()/* use setters */,
2630 /// DetectedLanguage::default()/* use (different) setters */,
2631 /// ]);
2632 /// ```
2633 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
2634 where
2635 T: std::iter::IntoIterator<Item = V>,
2636 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
2637 {
2638 use std::iter::Iterator;
2639 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
2640 self
2641 }
2642
2643 /// Sets the value of [provenance][crate::model::document::page::Token::provenance].
2644 ///
2645 /// # Example
2646 /// ```ignore,no_run
2647 /// # use google_cloud_documentai_v1::model::document::page::Token;
2648 /// use google_cloud_documentai_v1::model::document::Provenance;
2649 /// let x = Token::new().set_provenance(Provenance::default()/* use setters */);
2650 /// ```
2651 #[deprecated]
2652 pub fn set_provenance<T>(mut self, v: T) -> Self
2653 where
2654 T: std::convert::Into<crate::model::document::Provenance>,
2655 {
2656 self.provenance = std::option::Option::Some(v.into());
2657 self
2658 }
2659
2660 /// Sets or clears the value of [provenance][crate::model::document::page::Token::provenance].
2661 ///
2662 /// # Example
2663 /// ```ignore,no_run
2664 /// # use google_cloud_documentai_v1::model::document::page::Token;
2665 /// use google_cloud_documentai_v1::model::document::Provenance;
2666 /// let x = Token::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
2667 /// let x = Token::new().set_or_clear_provenance(None::<Provenance>);
2668 /// ```
2669 #[deprecated]
2670 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
2671 where
2672 T: std::convert::Into<crate::model::document::Provenance>,
2673 {
2674 self.provenance = v.map(|x| x.into());
2675 self
2676 }
2677
2678 /// Sets the value of [style_info][crate::model::document::page::Token::style_info].
2679 ///
2680 /// # Example
2681 /// ```ignore,no_run
2682 /// # use google_cloud_documentai_v1::model::document::page::Token;
2683 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2684 /// let x = Token::new().set_style_info(StyleInfo::default()/* use setters */);
2685 /// ```
2686 pub fn set_style_info<T>(mut self, v: T) -> Self
2687 where
2688 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2689 {
2690 self.style_info = std::option::Option::Some(v.into());
2691 self
2692 }
2693
2694 /// Sets or clears the value of [style_info][crate::model::document::page::Token::style_info].
2695 ///
2696 /// # Example
2697 /// ```ignore,no_run
2698 /// # use google_cloud_documentai_v1::model::document::page::Token;
2699 /// use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2700 /// let x = Token::new().set_or_clear_style_info(Some(StyleInfo::default()/* use setters */));
2701 /// let x = Token::new().set_or_clear_style_info(None::<StyleInfo>);
2702 /// ```
2703 pub fn set_or_clear_style_info<T>(mut self, v: std::option::Option<T>) -> Self
2704 where
2705 T: std::convert::Into<crate::model::document::page::token::StyleInfo>,
2706 {
2707 self.style_info = v.map(|x| x.into());
2708 self
2709 }
2710 }
2711
2712 impl wkt::message::Message for Token {
2713 fn typename() -> &'static str {
2714 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token"
2715 }
2716 }
2717
2718 /// Defines additional types related to [Token].
2719 pub mod token {
2720 #[allow(unused_imports)]
2721 use super::*;
2722
2723 /// Detected break at the end of a
2724 /// [Token][google.cloud.documentai.v1.Document.Page.Token].
2725 ///
2726 /// [google.cloud.documentai.v1.Document.Page.Token]: crate::model::document::page::Token
2727 #[derive(Clone, Default, PartialEq)]
2728 #[non_exhaustive]
2729 pub struct DetectedBreak {
2730 /// Detected break type.
2731 pub r#type: crate::model::document::page::token::detected_break::Type,
2732
2733 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2734 }
2735
2736 impl DetectedBreak {
2737 /// Creates a new default instance.
2738 pub fn new() -> Self {
2739 std::default::Default::default()
2740 }
2741
2742 /// Sets the value of [r#type][crate::model::document::page::token::DetectedBreak::type].
2743 ///
2744 /// # Example
2745 /// ```ignore,no_run
2746 /// # use google_cloud_documentai_v1::model::document::page::token::DetectedBreak;
2747 /// use google_cloud_documentai_v1::model::document::page::token::detected_break::Type;
2748 /// let x0 = DetectedBreak::new().set_type(Type::Space);
2749 /// let x1 = DetectedBreak::new().set_type(Type::WideSpace);
2750 /// let x2 = DetectedBreak::new().set_type(Type::Hyphen);
2751 /// ```
2752 pub fn set_type<
2753 T: std::convert::Into<crate::model::document::page::token::detected_break::Type>,
2754 >(
2755 mut self,
2756 v: T,
2757 ) -> Self {
2758 self.r#type = v.into();
2759 self
2760 }
2761 }
2762
2763 impl wkt::message::Message for DetectedBreak {
2764 fn typename() -> &'static str {
2765 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.DetectedBreak"
2766 }
2767 }
2768
2769 /// Defines additional types related to [DetectedBreak].
2770 pub mod detected_break {
2771 #[allow(unused_imports)]
2772 use super::*;
2773
2774 /// Enum to denote the type of break found.
2775 ///
2776 /// # Working with unknown values
2777 ///
2778 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
2779 /// additional enum variants at any time. Adding new variants is not considered
2780 /// a breaking change. Applications should write their code in anticipation of:
2781 ///
2782 /// - New values appearing in future releases of the client library, **and**
2783 /// - New values received dynamically, without application changes.
2784 ///
2785 /// Please consult the [Working with enums] section in the user guide for some
2786 /// guidelines.
2787 ///
2788 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
2789 #[derive(Clone, Debug, PartialEq)]
2790 #[non_exhaustive]
2791 pub enum Type {
2792 /// Unspecified break type.
2793 Unspecified,
2794 /// A single whitespace.
2795 Space,
2796 /// A wider whitespace.
2797 WideSpace,
2798 /// A hyphen that indicates that a token has been split across lines.
2799 Hyphen,
2800 /// If set, the enum was initialized with an unknown value.
2801 ///
2802 /// Applications can examine the value using [Type::value] or
2803 /// [Type::name].
2804 UnknownValue(r#type::UnknownValue),
2805 }
2806
2807 #[doc(hidden)]
2808 pub mod r#type {
2809 #[allow(unused_imports)]
2810 use super::*;
2811 #[derive(Clone, Debug, PartialEq)]
2812 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
2813 }
2814
2815 impl Type {
2816 /// Gets the enum value.
2817 ///
2818 /// Returns `None` if the enum contains an unknown value deserialized from
2819 /// the string representation of enums.
2820 pub fn value(&self) -> std::option::Option<i32> {
2821 match self {
2822 Self::Unspecified => std::option::Option::Some(0),
2823 Self::Space => std::option::Option::Some(1),
2824 Self::WideSpace => std::option::Option::Some(2),
2825 Self::Hyphen => std::option::Option::Some(3),
2826 Self::UnknownValue(u) => u.0.value(),
2827 }
2828 }
2829
2830 /// Gets the enum value as a string.
2831 ///
2832 /// Returns `None` if the enum contains an unknown value deserialized from
2833 /// the integer representation of enums.
2834 pub fn name(&self) -> std::option::Option<&str> {
2835 match self {
2836 Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
2837 Self::Space => std::option::Option::Some("SPACE"),
2838 Self::WideSpace => std::option::Option::Some("WIDE_SPACE"),
2839 Self::Hyphen => std::option::Option::Some("HYPHEN"),
2840 Self::UnknownValue(u) => u.0.name(),
2841 }
2842 }
2843 }
2844
2845 impl std::default::Default for Type {
2846 fn default() -> Self {
2847 use std::convert::From;
2848 Self::from(0)
2849 }
2850 }
2851
2852 impl std::fmt::Display for Type {
2853 fn fmt(
2854 &self,
2855 f: &mut std::fmt::Formatter<'_>,
2856 ) -> std::result::Result<(), std::fmt::Error> {
2857 wkt::internal::display_enum(f, self.name(), self.value())
2858 }
2859 }
2860
2861 impl std::convert::From<i32> for Type {
2862 fn from(value: i32) -> Self {
2863 match value {
2864 0 => Self::Unspecified,
2865 1 => Self::Space,
2866 2 => Self::WideSpace,
2867 3 => Self::Hyphen,
2868 _ => Self::UnknownValue(r#type::UnknownValue(
2869 wkt::internal::UnknownEnumValue::Integer(value),
2870 )),
2871 }
2872 }
2873 }
2874
2875 impl std::convert::From<&str> for Type {
2876 fn from(value: &str) -> Self {
2877 use std::string::ToString;
2878 match value {
2879 "TYPE_UNSPECIFIED" => Self::Unspecified,
2880 "SPACE" => Self::Space,
2881 "WIDE_SPACE" => Self::WideSpace,
2882 "HYPHEN" => Self::Hyphen,
2883 _ => Self::UnknownValue(r#type::UnknownValue(
2884 wkt::internal::UnknownEnumValue::String(value.to_string()),
2885 )),
2886 }
2887 }
2888 }
2889
2890 impl serde::ser::Serialize for Type {
2891 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
2892 where
2893 S: serde::Serializer,
2894 {
2895 match self {
2896 Self::Unspecified => serializer.serialize_i32(0),
2897 Self::Space => serializer.serialize_i32(1),
2898 Self::WideSpace => serializer.serialize_i32(2),
2899 Self::Hyphen => serializer.serialize_i32(3),
2900 Self::UnknownValue(u) => u.0.serialize(serializer),
2901 }
2902 }
2903 }
2904
2905 impl<'de> serde::de::Deserialize<'de> for Type {
2906 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
2907 where
2908 D: serde::Deserializer<'de>,
2909 {
2910 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
2911 ".google.cloud.documentai.v1.Document.Page.Token.DetectedBreak.Type",
2912 ))
2913 }
2914 }
2915 }
2916
2917 /// Font and other text style attributes.
2918 #[derive(Clone, Default, PartialEq)]
2919 #[non_exhaustive]
2920 pub struct StyleInfo {
2921 /// Font size in points (`1` point is `¹⁄₇₂` inches).
2922 pub font_size: i32,
2923
2924 /// Font size in pixels, equal to _unrounded
2925 /// [font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]_
2926 ///
2927 /// * _resolution_ ÷ `72.0`.
2928 ///
2929 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]: crate::model::document::page::token::StyleInfo::font_size
2930 pub pixel_font_size: f64,
2931
2932 /// Letter spacing in points.
2933 pub letter_spacing: f64,
2934
2935 /// Name or style of the font.
2936 pub font_type: std::string::String,
2937
2938 /// Whether the text is bold (equivalent to
2939 /// [font_weight][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]
2940 /// is at least `700`).
2941 ///
2942 /// [google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_weight]: crate::model::document::page::token::StyleInfo::font_weight
2943 pub bold: bool,
2944
2945 /// Whether the text is italic.
2946 pub italic: bool,
2947
2948 /// Whether the text is underlined.
2949 pub underlined: bool,
2950
2951 /// Whether the text is strikethrough. This feature is not supported yet.
2952 pub strikeout: bool,
2953
2954 /// Whether the text is a subscript. This feature is not supported yet.
2955 pub subscript: bool,
2956
2957 /// Whether the text is a superscript. This feature is not supported yet.
2958 pub superscript: bool,
2959
2960 /// Whether the text is in small caps. This feature is not supported yet.
2961 pub smallcaps: bool,
2962
2963 /// TrueType weight on a scale `100` (thin) to `1000` (ultra-heavy).
2964 /// Normal is `400`, bold is `700`.
2965 pub font_weight: i32,
2966
2967 /// Whether the text is handwritten.
2968 pub handwritten: bool,
2969
2970 /// Color of the text.
2971 pub text_color: std::option::Option<google_cloud_type::model::Color>,
2972
2973 /// Color of the background.
2974 pub background_color: std::option::Option<google_cloud_type::model::Color>,
2975
2976 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2977 }
2978
2979 impl StyleInfo {
2980 /// Creates a new default instance.
2981 pub fn new() -> Self {
2982 std::default::Default::default()
2983 }
2984
2985 /// Sets the value of [font_size][crate::model::document::page::token::StyleInfo::font_size].
2986 ///
2987 /// # Example
2988 /// ```ignore,no_run
2989 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
2990 /// let x = StyleInfo::new().set_font_size(42);
2991 /// ```
2992 pub fn set_font_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2993 self.font_size = v.into();
2994 self
2995 }
2996
2997 /// Sets the value of [pixel_font_size][crate::model::document::page::token::StyleInfo::pixel_font_size].
2998 ///
2999 /// # Example
3000 /// ```ignore,no_run
3001 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3002 /// let x = StyleInfo::new().set_pixel_font_size(42.0);
3003 /// ```
3004 pub fn set_pixel_font_size<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3005 self.pixel_font_size = v.into();
3006 self
3007 }
3008
3009 /// Sets the value of [letter_spacing][crate::model::document::page::token::StyleInfo::letter_spacing].
3010 ///
3011 /// # Example
3012 /// ```ignore,no_run
3013 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3014 /// let x = StyleInfo::new().set_letter_spacing(42.0);
3015 /// ```
3016 pub fn set_letter_spacing<T: std::convert::Into<f64>>(mut self, v: T) -> Self {
3017 self.letter_spacing = v.into();
3018 self
3019 }
3020
3021 /// Sets the value of [font_type][crate::model::document::page::token::StyleInfo::font_type].
3022 ///
3023 /// # Example
3024 /// ```ignore,no_run
3025 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3026 /// let x = StyleInfo::new().set_font_type("example");
3027 /// ```
3028 pub fn set_font_type<T: std::convert::Into<std::string::String>>(
3029 mut self,
3030 v: T,
3031 ) -> Self {
3032 self.font_type = v.into();
3033 self
3034 }
3035
3036 /// Sets the value of [bold][crate::model::document::page::token::StyleInfo::bold].
3037 ///
3038 /// # Example
3039 /// ```ignore,no_run
3040 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3041 /// let x = StyleInfo::new().set_bold(true);
3042 /// ```
3043 pub fn set_bold<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3044 self.bold = v.into();
3045 self
3046 }
3047
3048 /// Sets the value of [italic][crate::model::document::page::token::StyleInfo::italic].
3049 ///
3050 /// # Example
3051 /// ```ignore,no_run
3052 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3053 /// let x = StyleInfo::new().set_italic(true);
3054 /// ```
3055 pub fn set_italic<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3056 self.italic = v.into();
3057 self
3058 }
3059
3060 /// Sets the value of [underlined][crate::model::document::page::token::StyleInfo::underlined].
3061 ///
3062 /// # Example
3063 /// ```ignore,no_run
3064 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3065 /// let x = StyleInfo::new().set_underlined(true);
3066 /// ```
3067 pub fn set_underlined<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3068 self.underlined = v.into();
3069 self
3070 }
3071
3072 /// Sets the value of [strikeout][crate::model::document::page::token::StyleInfo::strikeout].
3073 ///
3074 /// # Example
3075 /// ```ignore,no_run
3076 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3077 /// let x = StyleInfo::new().set_strikeout(true);
3078 /// ```
3079 pub fn set_strikeout<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3080 self.strikeout = v.into();
3081 self
3082 }
3083
3084 /// Sets the value of [subscript][crate::model::document::page::token::StyleInfo::subscript].
3085 ///
3086 /// # Example
3087 /// ```ignore,no_run
3088 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3089 /// let x = StyleInfo::new().set_subscript(true);
3090 /// ```
3091 pub fn set_subscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3092 self.subscript = v.into();
3093 self
3094 }
3095
3096 /// Sets the value of [superscript][crate::model::document::page::token::StyleInfo::superscript].
3097 ///
3098 /// # Example
3099 /// ```ignore,no_run
3100 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3101 /// let x = StyleInfo::new().set_superscript(true);
3102 /// ```
3103 pub fn set_superscript<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3104 self.superscript = v.into();
3105 self
3106 }
3107
3108 /// Sets the value of [smallcaps][crate::model::document::page::token::StyleInfo::smallcaps].
3109 ///
3110 /// # Example
3111 /// ```ignore,no_run
3112 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3113 /// let x = StyleInfo::new().set_smallcaps(true);
3114 /// ```
3115 pub fn set_smallcaps<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3116 self.smallcaps = v.into();
3117 self
3118 }
3119
3120 /// Sets the value of [font_weight][crate::model::document::page::token::StyleInfo::font_weight].
3121 ///
3122 /// # Example
3123 /// ```ignore,no_run
3124 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3125 /// let x = StyleInfo::new().set_font_weight(42);
3126 /// ```
3127 pub fn set_font_weight<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3128 self.font_weight = v.into();
3129 self
3130 }
3131
3132 /// Sets the value of [handwritten][crate::model::document::page::token::StyleInfo::handwritten].
3133 ///
3134 /// # Example
3135 /// ```ignore,no_run
3136 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3137 /// let x = StyleInfo::new().set_handwritten(true);
3138 /// ```
3139 pub fn set_handwritten<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3140 self.handwritten = v.into();
3141 self
3142 }
3143
3144 /// Sets the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3145 ///
3146 /// # Example
3147 /// ```ignore,no_run
3148 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3149 /// use google_cloud_type::model::Color;
3150 /// let x = StyleInfo::new().set_text_color(Color::default()/* use setters */);
3151 /// ```
3152 pub fn set_text_color<T>(mut self, v: T) -> Self
3153 where
3154 T: std::convert::Into<google_cloud_type::model::Color>,
3155 {
3156 self.text_color = std::option::Option::Some(v.into());
3157 self
3158 }
3159
3160 /// Sets or clears the value of [text_color][crate::model::document::page::token::StyleInfo::text_color].
3161 ///
3162 /// # Example
3163 /// ```ignore,no_run
3164 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3165 /// use google_cloud_type::model::Color;
3166 /// let x = StyleInfo::new().set_or_clear_text_color(Some(Color::default()/* use setters */));
3167 /// let x = StyleInfo::new().set_or_clear_text_color(None::<Color>);
3168 /// ```
3169 pub fn set_or_clear_text_color<T>(mut self, v: std::option::Option<T>) -> Self
3170 where
3171 T: std::convert::Into<google_cloud_type::model::Color>,
3172 {
3173 self.text_color = v.map(|x| x.into());
3174 self
3175 }
3176
3177 /// Sets the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3178 ///
3179 /// # Example
3180 /// ```ignore,no_run
3181 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3182 /// use google_cloud_type::model::Color;
3183 /// let x = StyleInfo::new().set_background_color(Color::default()/* use setters */);
3184 /// ```
3185 pub fn set_background_color<T>(mut self, v: T) -> Self
3186 where
3187 T: std::convert::Into<google_cloud_type::model::Color>,
3188 {
3189 self.background_color = std::option::Option::Some(v.into());
3190 self
3191 }
3192
3193 /// Sets or clears the value of [background_color][crate::model::document::page::token::StyleInfo::background_color].
3194 ///
3195 /// # Example
3196 /// ```ignore,no_run
3197 /// # use google_cloud_documentai_v1::model::document::page::token::StyleInfo;
3198 /// use google_cloud_type::model::Color;
3199 /// let x = StyleInfo::new().set_or_clear_background_color(Some(Color::default()/* use setters */));
3200 /// let x = StyleInfo::new().set_or_clear_background_color(None::<Color>);
3201 /// ```
3202 pub fn set_or_clear_background_color<T>(mut self, v: std::option::Option<T>) -> Self
3203 where
3204 T: std::convert::Into<google_cloud_type::model::Color>,
3205 {
3206 self.background_color = v.map(|x| x.into());
3207 self
3208 }
3209 }
3210
3211 impl wkt::message::Message for StyleInfo {
3212 fn typename() -> &'static str {
3213 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Token.StyleInfo"
3214 }
3215 }
3216 }
3217
3218 /// A detected symbol.
3219 #[derive(Clone, Default, PartialEq)]
3220 #[non_exhaustive]
3221 pub struct Symbol {
3222 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3223 /// [Symbol][google.cloud.documentai.v1.Document.Page.Symbol].
3224 ///
3225 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3226 /// [google.cloud.documentai.v1.Document.Page.Symbol]: crate::model::document::page::Symbol
3227 pub layout: std::option::Option<crate::model::document::page::Layout>,
3228
3229 /// A list of detected languages together with confidence.
3230 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3231
3232 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3233 }
3234
3235 impl Symbol {
3236 /// Creates a new default instance.
3237 pub fn new() -> Self {
3238 std::default::Default::default()
3239 }
3240
3241 /// Sets the value of [layout][crate::model::document::page::Symbol::layout].
3242 ///
3243 /// # Example
3244 /// ```ignore,no_run
3245 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3246 /// use google_cloud_documentai_v1::model::document::page::Layout;
3247 /// let x = Symbol::new().set_layout(Layout::default()/* use setters */);
3248 /// ```
3249 pub fn set_layout<T>(mut self, v: T) -> Self
3250 where
3251 T: std::convert::Into<crate::model::document::page::Layout>,
3252 {
3253 self.layout = std::option::Option::Some(v.into());
3254 self
3255 }
3256
3257 /// Sets or clears the value of [layout][crate::model::document::page::Symbol::layout].
3258 ///
3259 /// # Example
3260 /// ```ignore,no_run
3261 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3262 /// use google_cloud_documentai_v1::model::document::page::Layout;
3263 /// let x = Symbol::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3264 /// let x = Symbol::new().set_or_clear_layout(None::<Layout>);
3265 /// ```
3266 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3267 where
3268 T: std::convert::Into<crate::model::document::page::Layout>,
3269 {
3270 self.layout = v.map(|x| x.into());
3271 self
3272 }
3273
3274 /// Sets the value of [detected_languages][crate::model::document::page::Symbol::detected_languages].
3275 ///
3276 /// # Example
3277 /// ```ignore,no_run
3278 /// # use google_cloud_documentai_v1::model::document::page::Symbol;
3279 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3280 /// let x = Symbol::new()
3281 /// .set_detected_languages([
3282 /// DetectedLanguage::default()/* use setters */,
3283 /// DetectedLanguage::default()/* use (different) setters */,
3284 /// ]);
3285 /// ```
3286 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3287 where
3288 T: std::iter::IntoIterator<Item = V>,
3289 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3290 {
3291 use std::iter::Iterator;
3292 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3293 self
3294 }
3295 }
3296
3297 impl wkt::message::Message for Symbol {
3298 fn typename() -> &'static str {
3299 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Symbol"
3300 }
3301 }
3302
3303 /// Detected non-text visual elements, for example, checkbox, signature etc.
3304 /// on the page.
3305 #[derive(Clone, Default, PartialEq)]
3306 #[non_exhaustive]
3307 pub struct VisualElement {
3308 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3309 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3310 ///
3311 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3312 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3313 pub layout: std::option::Option<crate::model::document::page::Layout>,
3314
3315 /// Type of the
3316 /// [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement].
3317 ///
3318 /// [google.cloud.documentai.v1.Document.Page.VisualElement]: crate::model::document::page::VisualElement
3319 pub r#type: std::string::String,
3320
3321 /// A list of detected languages together with confidence.
3322 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3323
3324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3325 }
3326
3327 impl VisualElement {
3328 /// Creates a new default instance.
3329 pub fn new() -> Self {
3330 std::default::Default::default()
3331 }
3332
3333 /// Sets the value of [layout][crate::model::document::page::VisualElement::layout].
3334 ///
3335 /// # Example
3336 /// ```ignore,no_run
3337 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3338 /// use google_cloud_documentai_v1::model::document::page::Layout;
3339 /// let x = VisualElement::new().set_layout(Layout::default()/* use setters */);
3340 /// ```
3341 pub fn set_layout<T>(mut self, v: T) -> Self
3342 where
3343 T: std::convert::Into<crate::model::document::page::Layout>,
3344 {
3345 self.layout = std::option::Option::Some(v.into());
3346 self
3347 }
3348
3349 /// Sets or clears the value of [layout][crate::model::document::page::VisualElement::layout].
3350 ///
3351 /// # Example
3352 /// ```ignore,no_run
3353 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3354 /// use google_cloud_documentai_v1::model::document::page::Layout;
3355 /// let x = VisualElement::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3356 /// let x = VisualElement::new().set_or_clear_layout(None::<Layout>);
3357 /// ```
3358 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3359 where
3360 T: std::convert::Into<crate::model::document::page::Layout>,
3361 {
3362 self.layout = v.map(|x| x.into());
3363 self
3364 }
3365
3366 /// Sets the value of [r#type][crate::model::document::page::VisualElement::type].
3367 ///
3368 /// # Example
3369 /// ```ignore,no_run
3370 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3371 /// let x = VisualElement::new().set_type("example");
3372 /// ```
3373 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3374 self.r#type = v.into();
3375 self
3376 }
3377
3378 /// Sets the value of [detected_languages][crate::model::document::page::VisualElement::detected_languages].
3379 ///
3380 /// # Example
3381 /// ```ignore,no_run
3382 /// # use google_cloud_documentai_v1::model::document::page::VisualElement;
3383 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3384 /// let x = VisualElement::new()
3385 /// .set_detected_languages([
3386 /// DetectedLanguage::default()/* use setters */,
3387 /// DetectedLanguage::default()/* use (different) setters */,
3388 /// ]);
3389 /// ```
3390 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3391 where
3392 T: std::iter::IntoIterator<Item = V>,
3393 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3394 {
3395 use std::iter::Iterator;
3396 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3397 self
3398 }
3399 }
3400
3401 impl wkt::message::Message for VisualElement {
3402 fn typename() -> &'static str {
3403 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.VisualElement"
3404 }
3405 }
3406
3407 /// A table representation similar to HTML table structure.
3408 #[derive(Clone, Default, PartialEq)]
3409 #[non_exhaustive]
3410 pub struct Table {
3411 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3412 /// [Table][google.cloud.documentai.v1.Document.Page.Table].
3413 ///
3414 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3415 /// [google.cloud.documentai.v1.Document.Page.Table]: crate::model::document::page::Table
3416 pub layout: std::option::Option<crate::model::document::page::Layout>,
3417
3418 /// Header rows of the table.
3419 pub header_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3420
3421 /// Body rows of the table.
3422 pub body_rows: std::vec::Vec<crate::model::document::page::table::TableRow>,
3423
3424 /// A list of detected languages together with confidence.
3425 pub detected_languages: std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3426
3427 /// The history of this table.
3428 #[deprecated]
3429 pub provenance: std::option::Option<crate::model::document::Provenance>,
3430
3431 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3432 }
3433
3434 impl Table {
3435 /// Creates a new default instance.
3436 pub fn new() -> Self {
3437 std::default::Default::default()
3438 }
3439
3440 /// Sets the value of [layout][crate::model::document::page::Table::layout].
3441 ///
3442 /// # Example
3443 /// ```ignore,no_run
3444 /// # use google_cloud_documentai_v1::model::document::page::Table;
3445 /// use google_cloud_documentai_v1::model::document::page::Layout;
3446 /// let x = Table::new().set_layout(Layout::default()/* use setters */);
3447 /// ```
3448 pub fn set_layout<T>(mut self, v: T) -> Self
3449 where
3450 T: std::convert::Into<crate::model::document::page::Layout>,
3451 {
3452 self.layout = std::option::Option::Some(v.into());
3453 self
3454 }
3455
3456 /// Sets or clears the value of [layout][crate::model::document::page::Table::layout].
3457 ///
3458 /// # Example
3459 /// ```ignore,no_run
3460 /// # use google_cloud_documentai_v1::model::document::page::Table;
3461 /// use google_cloud_documentai_v1::model::document::page::Layout;
3462 /// let x = Table::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3463 /// let x = Table::new().set_or_clear_layout(None::<Layout>);
3464 /// ```
3465 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3466 where
3467 T: std::convert::Into<crate::model::document::page::Layout>,
3468 {
3469 self.layout = v.map(|x| x.into());
3470 self
3471 }
3472
3473 /// Sets the value of [header_rows][crate::model::document::page::Table::header_rows].
3474 ///
3475 /// # Example
3476 /// ```ignore,no_run
3477 /// # use google_cloud_documentai_v1::model::document::page::Table;
3478 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3479 /// let x = Table::new()
3480 /// .set_header_rows([
3481 /// TableRow::default()/* use setters */,
3482 /// TableRow::default()/* use (different) setters */,
3483 /// ]);
3484 /// ```
3485 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
3486 where
3487 T: std::iter::IntoIterator<Item = V>,
3488 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3489 {
3490 use std::iter::Iterator;
3491 self.header_rows = v.into_iter().map(|i| i.into()).collect();
3492 self
3493 }
3494
3495 /// Sets the value of [body_rows][crate::model::document::page::Table::body_rows].
3496 ///
3497 /// # Example
3498 /// ```ignore,no_run
3499 /// # use google_cloud_documentai_v1::model::document::page::Table;
3500 /// use google_cloud_documentai_v1::model::document::page::table::TableRow;
3501 /// let x = Table::new()
3502 /// .set_body_rows([
3503 /// TableRow::default()/* use setters */,
3504 /// TableRow::default()/* use (different) setters */,
3505 /// ]);
3506 /// ```
3507 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
3508 where
3509 T: std::iter::IntoIterator<Item = V>,
3510 V: std::convert::Into<crate::model::document::page::table::TableRow>,
3511 {
3512 use std::iter::Iterator;
3513 self.body_rows = v.into_iter().map(|i| i.into()).collect();
3514 self
3515 }
3516
3517 /// Sets the value of [detected_languages][crate::model::document::page::Table::detected_languages].
3518 ///
3519 /// # Example
3520 /// ```ignore,no_run
3521 /// # use google_cloud_documentai_v1::model::document::page::Table;
3522 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3523 /// let x = Table::new()
3524 /// .set_detected_languages([
3525 /// DetectedLanguage::default()/* use setters */,
3526 /// DetectedLanguage::default()/* use (different) setters */,
3527 /// ]);
3528 /// ```
3529 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3530 where
3531 T: std::iter::IntoIterator<Item = V>,
3532 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3533 {
3534 use std::iter::Iterator;
3535 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3536 self
3537 }
3538
3539 /// Sets the value of [provenance][crate::model::document::page::Table::provenance].
3540 ///
3541 /// # Example
3542 /// ```ignore,no_run
3543 /// # use google_cloud_documentai_v1::model::document::page::Table;
3544 /// use google_cloud_documentai_v1::model::document::Provenance;
3545 /// let x = Table::new().set_provenance(Provenance::default()/* use setters */);
3546 /// ```
3547 #[deprecated]
3548 pub fn set_provenance<T>(mut self, v: T) -> Self
3549 where
3550 T: std::convert::Into<crate::model::document::Provenance>,
3551 {
3552 self.provenance = std::option::Option::Some(v.into());
3553 self
3554 }
3555
3556 /// Sets or clears the value of [provenance][crate::model::document::page::Table::provenance].
3557 ///
3558 /// # Example
3559 /// ```ignore,no_run
3560 /// # use google_cloud_documentai_v1::model::document::page::Table;
3561 /// use google_cloud_documentai_v1::model::document::Provenance;
3562 /// let x = Table::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3563 /// let x = Table::new().set_or_clear_provenance(None::<Provenance>);
3564 /// ```
3565 #[deprecated]
3566 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3567 where
3568 T: std::convert::Into<crate::model::document::Provenance>,
3569 {
3570 self.provenance = v.map(|x| x.into());
3571 self
3572 }
3573 }
3574
3575 impl wkt::message::Message for Table {
3576 fn typename() -> &'static str {
3577 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table"
3578 }
3579 }
3580
3581 /// Defines additional types related to [Table].
3582 pub mod table {
3583 #[allow(unused_imports)]
3584 use super::*;
3585
3586 /// A row of table cells.
3587 #[derive(Clone, Default, PartialEq)]
3588 #[non_exhaustive]
3589 pub struct TableRow {
3590 /// Cells that make up this row.
3591 pub cells: std::vec::Vec<crate::model::document::page::table::TableCell>,
3592
3593 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3594 }
3595
3596 impl TableRow {
3597 /// Creates a new default instance.
3598 pub fn new() -> Self {
3599 std::default::Default::default()
3600 }
3601
3602 /// Sets the value of [cells][crate::model::document::page::table::TableRow::cells].
3603 ///
3604 /// # Example
3605 /// ```ignore,no_run
3606 /// # use google_cloud_documentai_v1::model::document::page::table::TableRow;
3607 /// use google_cloud_documentai_v1::model::document::page::table::TableCell;
3608 /// let x = TableRow::new()
3609 /// .set_cells([
3610 /// TableCell::default()/* use setters */,
3611 /// TableCell::default()/* use (different) setters */,
3612 /// ]);
3613 /// ```
3614 pub fn set_cells<T, V>(mut self, v: T) -> Self
3615 where
3616 T: std::iter::IntoIterator<Item = V>,
3617 V: std::convert::Into<crate::model::document::page::table::TableCell>,
3618 {
3619 use std::iter::Iterator;
3620 self.cells = v.into_iter().map(|i| i.into()).collect();
3621 self
3622 }
3623 }
3624
3625 impl wkt::message::Message for TableRow {
3626 fn typename() -> &'static str {
3627 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableRow"
3628 }
3629 }
3630
3631 /// A cell representation inside the table.
3632 #[derive(Clone, Default, PartialEq)]
3633 #[non_exhaustive]
3634 pub struct TableCell {
3635 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
3636 /// [TableCell][google.cloud.documentai.v1.Document.Page.Table.TableCell].
3637 ///
3638 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3639 /// [google.cloud.documentai.v1.Document.Page.Table.TableCell]: crate::model::document::page::table::TableCell
3640 pub layout: std::option::Option<crate::model::document::page::Layout>,
3641
3642 /// How many rows this cell spans.
3643 pub row_span: i32,
3644
3645 /// How many columns this cell spans.
3646 pub col_span: i32,
3647
3648 /// A list of detected languages together with confidence.
3649 pub detected_languages:
3650 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3651
3652 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3653 }
3654
3655 impl TableCell {
3656 /// Creates a new default instance.
3657 pub fn new() -> Self {
3658 std::default::Default::default()
3659 }
3660
3661 /// Sets the value of [layout][crate::model::document::page::table::TableCell::layout].
3662 ///
3663 /// # Example
3664 /// ```ignore,no_run
3665 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3666 /// use google_cloud_documentai_v1::model::document::page::Layout;
3667 /// let x = TableCell::new().set_layout(Layout::default()/* use setters */);
3668 /// ```
3669 pub fn set_layout<T>(mut self, v: T) -> Self
3670 where
3671 T: std::convert::Into<crate::model::document::page::Layout>,
3672 {
3673 self.layout = std::option::Option::Some(v.into());
3674 self
3675 }
3676
3677 /// Sets or clears the value of [layout][crate::model::document::page::table::TableCell::layout].
3678 ///
3679 /// # Example
3680 /// ```ignore,no_run
3681 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3682 /// use google_cloud_documentai_v1::model::document::page::Layout;
3683 /// let x = TableCell::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
3684 /// let x = TableCell::new().set_or_clear_layout(None::<Layout>);
3685 /// ```
3686 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
3687 where
3688 T: std::convert::Into<crate::model::document::page::Layout>,
3689 {
3690 self.layout = v.map(|x| x.into());
3691 self
3692 }
3693
3694 /// Sets the value of [row_span][crate::model::document::page::table::TableCell::row_span].
3695 ///
3696 /// # Example
3697 /// ```ignore,no_run
3698 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3699 /// let x = TableCell::new().set_row_span(42);
3700 /// ```
3701 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3702 self.row_span = v.into();
3703 self
3704 }
3705
3706 /// Sets the value of [col_span][crate::model::document::page::table::TableCell::col_span].
3707 ///
3708 /// # Example
3709 /// ```ignore,no_run
3710 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3711 /// let x = TableCell::new().set_col_span(42);
3712 /// ```
3713 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3714 self.col_span = v.into();
3715 self
3716 }
3717
3718 /// Sets the value of [detected_languages][crate::model::document::page::table::TableCell::detected_languages].
3719 ///
3720 /// # Example
3721 /// ```ignore,no_run
3722 /// # use google_cloud_documentai_v1::model::document::page::table::TableCell;
3723 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3724 /// let x = TableCell::new()
3725 /// .set_detected_languages([
3726 /// DetectedLanguage::default()/* use setters */,
3727 /// DetectedLanguage::default()/* use (different) setters */,
3728 /// ]);
3729 /// ```
3730 pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
3731 where
3732 T: std::iter::IntoIterator<Item = V>,
3733 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3734 {
3735 use std::iter::Iterator;
3736 self.detected_languages = v.into_iter().map(|i| i.into()).collect();
3737 self
3738 }
3739 }
3740
3741 impl wkt::message::Message for TableCell {
3742 fn typename() -> &'static str {
3743 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.Table.TableCell"
3744 }
3745 }
3746 }
3747
3748 /// A form field detected on the page.
3749 #[derive(Clone, Default, PartialEq)]
3750 #[non_exhaustive]
3751 pub struct FormField {
3752 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3753 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] name.
3754 /// For example, `Address`, `Email`, `Grand total`, `Phone number`, etc.
3755 ///
3756 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3757 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3758 pub field_name: std::option::Option<crate::model::document::page::Layout>,
3759
3760 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the
3761 /// [FormField][google.cloud.documentai.v1.Document.Page.FormField] value.
3762 ///
3763 /// [google.cloud.documentai.v1.Document.Page.FormField]: crate::model::document::page::FormField
3764 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
3765 pub field_value: std::option::Option<crate::model::document::page::Layout>,
3766
3767 /// A list of detected languages for name together with confidence.
3768 pub name_detected_languages:
3769 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3770
3771 /// A list of detected languages for value together with confidence.
3772 pub value_detected_languages:
3773 std::vec::Vec<crate::model::document::page::DetectedLanguage>,
3774
3775 /// If the value is non-textual, this field represents the type. Current
3776 /// valid values are:
3777 ///
3778 /// - blank (this indicates the `field_value` is normal text)
3779 /// - `unfilled_checkbox`
3780 /// - `filled_checkbox`
3781 pub value_type: std::string::String,
3782
3783 /// Created for Labeling UI to export key text.
3784 /// If corrections were made to the text identified by the
3785 /// `field_name.text_anchor`, this field will contain the correction.
3786 pub corrected_key_text: std::string::String,
3787
3788 /// Created for Labeling UI to export value text.
3789 /// If corrections were made to the text identified by the
3790 /// `field_value.text_anchor`, this field will contain the correction.
3791 pub corrected_value_text: std::string::String,
3792
3793 /// The history of this annotation.
3794 pub provenance: std::option::Option<crate::model::document::Provenance>,
3795
3796 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3797 }
3798
3799 impl FormField {
3800 /// Creates a new default instance.
3801 pub fn new() -> Self {
3802 std::default::Default::default()
3803 }
3804
3805 /// Sets the value of [field_name][crate::model::document::page::FormField::field_name].
3806 ///
3807 /// # Example
3808 /// ```ignore,no_run
3809 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3810 /// use google_cloud_documentai_v1::model::document::page::Layout;
3811 /// let x = FormField::new().set_field_name(Layout::default()/* use setters */);
3812 /// ```
3813 pub fn set_field_name<T>(mut self, v: T) -> Self
3814 where
3815 T: std::convert::Into<crate::model::document::page::Layout>,
3816 {
3817 self.field_name = std::option::Option::Some(v.into());
3818 self
3819 }
3820
3821 /// Sets or clears the value of [field_name][crate::model::document::page::FormField::field_name].
3822 ///
3823 /// # Example
3824 /// ```ignore,no_run
3825 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3826 /// use google_cloud_documentai_v1::model::document::page::Layout;
3827 /// let x = FormField::new().set_or_clear_field_name(Some(Layout::default()/* use setters */));
3828 /// let x = FormField::new().set_or_clear_field_name(None::<Layout>);
3829 /// ```
3830 pub fn set_or_clear_field_name<T>(mut self, v: std::option::Option<T>) -> Self
3831 where
3832 T: std::convert::Into<crate::model::document::page::Layout>,
3833 {
3834 self.field_name = v.map(|x| x.into());
3835 self
3836 }
3837
3838 /// Sets the value of [field_value][crate::model::document::page::FormField::field_value].
3839 ///
3840 /// # Example
3841 /// ```ignore,no_run
3842 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3843 /// use google_cloud_documentai_v1::model::document::page::Layout;
3844 /// let x = FormField::new().set_field_value(Layout::default()/* use setters */);
3845 /// ```
3846 pub fn set_field_value<T>(mut self, v: T) -> Self
3847 where
3848 T: std::convert::Into<crate::model::document::page::Layout>,
3849 {
3850 self.field_value = std::option::Option::Some(v.into());
3851 self
3852 }
3853
3854 /// Sets or clears the value of [field_value][crate::model::document::page::FormField::field_value].
3855 ///
3856 /// # Example
3857 /// ```ignore,no_run
3858 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3859 /// use google_cloud_documentai_v1::model::document::page::Layout;
3860 /// let x = FormField::new().set_or_clear_field_value(Some(Layout::default()/* use setters */));
3861 /// let x = FormField::new().set_or_clear_field_value(None::<Layout>);
3862 /// ```
3863 pub fn set_or_clear_field_value<T>(mut self, v: std::option::Option<T>) -> Self
3864 where
3865 T: std::convert::Into<crate::model::document::page::Layout>,
3866 {
3867 self.field_value = v.map(|x| x.into());
3868 self
3869 }
3870
3871 /// Sets the value of [name_detected_languages][crate::model::document::page::FormField::name_detected_languages].
3872 ///
3873 /// # Example
3874 /// ```ignore,no_run
3875 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3876 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3877 /// let x = FormField::new()
3878 /// .set_name_detected_languages([
3879 /// DetectedLanguage::default()/* use setters */,
3880 /// DetectedLanguage::default()/* use (different) setters */,
3881 /// ]);
3882 /// ```
3883 pub fn set_name_detected_languages<T, V>(mut self, v: T) -> Self
3884 where
3885 T: std::iter::IntoIterator<Item = V>,
3886 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3887 {
3888 use std::iter::Iterator;
3889 self.name_detected_languages = v.into_iter().map(|i| i.into()).collect();
3890 self
3891 }
3892
3893 /// Sets the value of [value_detected_languages][crate::model::document::page::FormField::value_detected_languages].
3894 ///
3895 /// # Example
3896 /// ```ignore,no_run
3897 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3898 /// use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
3899 /// let x = FormField::new()
3900 /// .set_value_detected_languages([
3901 /// DetectedLanguage::default()/* use setters */,
3902 /// DetectedLanguage::default()/* use (different) setters */,
3903 /// ]);
3904 /// ```
3905 pub fn set_value_detected_languages<T, V>(mut self, v: T) -> Self
3906 where
3907 T: std::iter::IntoIterator<Item = V>,
3908 V: std::convert::Into<crate::model::document::page::DetectedLanguage>,
3909 {
3910 use std::iter::Iterator;
3911 self.value_detected_languages = v.into_iter().map(|i| i.into()).collect();
3912 self
3913 }
3914
3915 /// Sets the value of [value_type][crate::model::document::page::FormField::value_type].
3916 ///
3917 /// # Example
3918 /// ```ignore,no_run
3919 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3920 /// let x = FormField::new().set_value_type("example");
3921 /// ```
3922 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
3923 mut self,
3924 v: T,
3925 ) -> Self {
3926 self.value_type = v.into();
3927 self
3928 }
3929
3930 /// Sets the value of [corrected_key_text][crate::model::document::page::FormField::corrected_key_text].
3931 ///
3932 /// # Example
3933 /// ```ignore,no_run
3934 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3935 /// let x = FormField::new().set_corrected_key_text("example");
3936 /// ```
3937 pub fn set_corrected_key_text<T: std::convert::Into<std::string::String>>(
3938 mut self,
3939 v: T,
3940 ) -> Self {
3941 self.corrected_key_text = v.into();
3942 self
3943 }
3944
3945 /// Sets the value of [corrected_value_text][crate::model::document::page::FormField::corrected_value_text].
3946 ///
3947 /// # Example
3948 /// ```ignore,no_run
3949 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3950 /// let x = FormField::new().set_corrected_value_text("example");
3951 /// ```
3952 pub fn set_corrected_value_text<T: std::convert::Into<std::string::String>>(
3953 mut self,
3954 v: T,
3955 ) -> Self {
3956 self.corrected_value_text = v.into();
3957 self
3958 }
3959
3960 /// Sets the value of [provenance][crate::model::document::page::FormField::provenance].
3961 ///
3962 /// # Example
3963 /// ```ignore,no_run
3964 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3965 /// use google_cloud_documentai_v1::model::document::Provenance;
3966 /// let x = FormField::new().set_provenance(Provenance::default()/* use setters */);
3967 /// ```
3968 pub fn set_provenance<T>(mut self, v: T) -> Self
3969 where
3970 T: std::convert::Into<crate::model::document::Provenance>,
3971 {
3972 self.provenance = std::option::Option::Some(v.into());
3973 self
3974 }
3975
3976 /// Sets or clears the value of [provenance][crate::model::document::page::FormField::provenance].
3977 ///
3978 /// # Example
3979 /// ```ignore,no_run
3980 /// # use google_cloud_documentai_v1::model::document::page::FormField;
3981 /// use google_cloud_documentai_v1::model::document::Provenance;
3982 /// let x = FormField::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
3983 /// let x = FormField::new().set_or_clear_provenance(None::<Provenance>);
3984 /// ```
3985 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
3986 where
3987 T: std::convert::Into<crate::model::document::Provenance>,
3988 {
3989 self.provenance = v.map(|x| x.into());
3990 self
3991 }
3992 }
3993
3994 impl wkt::message::Message for FormField {
3995 fn typename() -> &'static str {
3996 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.FormField"
3997 }
3998 }
3999
4000 /// A detected barcode.
4001 #[derive(Clone, Default, PartialEq)]
4002 #[non_exhaustive]
4003 pub struct DetectedBarcode {
4004 /// [Layout][google.cloud.documentai.v1.Document.Page.Layout] for
4005 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
4006 ///
4007 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
4008 /// [google.cloud.documentai.v1.Document.Page.Layout]: crate::model::document::page::Layout
4009 pub layout: std::option::Option<crate::model::document::page::Layout>,
4010
4011 /// Detailed barcode information of the
4012 /// [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode].
4013 ///
4014 /// [google.cloud.documentai.v1.Document.Page.DetectedBarcode]: crate::model::document::page::DetectedBarcode
4015 pub barcode: std::option::Option<crate::model::Barcode>,
4016
4017 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4018 }
4019
4020 impl DetectedBarcode {
4021 /// Creates a new default instance.
4022 pub fn new() -> Self {
4023 std::default::Default::default()
4024 }
4025
4026 /// Sets the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4027 ///
4028 /// # Example
4029 /// ```ignore,no_run
4030 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4031 /// use google_cloud_documentai_v1::model::document::page::Layout;
4032 /// let x = DetectedBarcode::new().set_layout(Layout::default()/* use setters */);
4033 /// ```
4034 pub fn set_layout<T>(mut self, v: T) -> Self
4035 where
4036 T: std::convert::Into<crate::model::document::page::Layout>,
4037 {
4038 self.layout = std::option::Option::Some(v.into());
4039 self
4040 }
4041
4042 /// Sets or clears the value of [layout][crate::model::document::page::DetectedBarcode::layout].
4043 ///
4044 /// # Example
4045 /// ```ignore,no_run
4046 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4047 /// use google_cloud_documentai_v1::model::document::page::Layout;
4048 /// let x = DetectedBarcode::new().set_or_clear_layout(Some(Layout::default()/* use setters */));
4049 /// let x = DetectedBarcode::new().set_or_clear_layout(None::<Layout>);
4050 /// ```
4051 pub fn set_or_clear_layout<T>(mut self, v: std::option::Option<T>) -> Self
4052 where
4053 T: std::convert::Into<crate::model::document::page::Layout>,
4054 {
4055 self.layout = v.map(|x| x.into());
4056 self
4057 }
4058
4059 /// Sets the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4060 ///
4061 /// # Example
4062 /// ```ignore,no_run
4063 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4064 /// use google_cloud_documentai_v1::model::Barcode;
4065 /// let x = DetectedBarcode::new().set_barcode(Barcode::default()/* use setters */);
4066 /// ```
4067 pub fn set_barcode<T>(mut self, v: T) -> Self
4068 where
4069 T: std::convert::Into<crate::model::Barcode>,
4070 {
4071 self.barcode = std::option::Option::Some(v.into());
4072 self
4073 }
4074
4075 /// Sets or clears the value of [barcode][crate::model::document::page::DetectedBarcode::barcode].
4076 ///
4077 /// # Example
4078 /// ```ignore,no_run
4079 /// # use google_cloud_documentai_v1::model::document::page::DetectedBarcode;
4080 /// use google_cloud_documentai_v1::model::Barcode;
4081 /// let x = DetectedBarcode::new().set_or_clear_barcode(Some(Barcode::default()/* use setters */));
4082 /// let x = DetectedBarcode::new().set_or_clear_barcode(None::<Barcode>);
4083 /// ```
4084 pub fn set_or_clear_barcode<T>(mut self, v: std::option::Option<T>) -> Self
4085 where
4086 T: std::convert::Into<crate::model::Barcode>,
4087 {
4088 self.barcode = v.map(|x| x.into());
4089 self
4090 }
4091 }
4092
4093 impl wkt::message::Message for DetectedBarcode {
4094 fn typename() -> &'static str {
4095 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedBarcode"
4096 }
4097 }
4098
4099 /// Detected language for a structural component.
4100 #[derive(Clone, Default, PartialEq)]
4101 #[non_exhaustive]
4102 pub struct DetectedLanguage {
4103 /// The [BCP-47 language
4104 /// code](https://www.unicode.org/reports/tr35/#Unicode_locale_identifier),
4105 /// such as `en-US` or `sr-Latn`.
4106 pub language_code: std::string::String,
4107
4108 /// Confidence of detected language. Range `[0, 1]`.
4109 pub confidence: f32,
4110
4111 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4112 }
4113
4114 impl DetectedLanguage {
4115 /// Creates a new default instance.
4116 pub fn new() -> Self {
4117 std::default::Default::default()
4118 }
4119
4120 /// Sets the value of [language_code][crate::model::document::page::DetectedLanguage::language_code].
4121 ///
4122 /// # Example
4123 /// ```ignore,no_run
4124 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4125 /// let x = DetectedLanguage::new().set_language_code("example");
4126 /// ```
4127 pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4128 mut self,
4129 v: T,
4130 ) -> Self {
4131 self.language_code = v.into();
4132 self
4133 }
4134
4135 /// Sets the value of [confidence][crate::model::document::page::DetectedLanguage::confidence].
4136 ///
4137 /// # Example
4138 /// ```ignore,no_run
4139 /// # use google_cloud_documentai_v1::model::document::page::DetectedLanguage;
4140 /// let x = DetectedLanguage::new().set_confidence(42.0);
4141 /// ```
4142 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4143 self.confidence = v.into();
4144 self
4145 }
4146 }
4147
4148 impl wkt::message::Message for DetectedLanguage {
4149 fn typename() -> &'static str {
4150 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.DetectedLanguage"
4151 }
4152 }
4153
4154 /// Image quality scores for the page image.
4155 #[derive(Clone, Default, PartialEq)]
4156 #[non_exhaustive]
4157 pub struct ImageQualityScores {
4158 /// The overall quality score. Range `[0, 1]` where `1` is perfect quality.
4159 pub quality_score: f32,
4160
4161 /// A list of detected defects.
4162 pub detected_defects:
4163 std::vec::Vec<crate::model::document::page::image_quality_scores::DetectedDefect>,
4164
4165 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4166 }
4167
4168 impl ImageQualityScores {
4169 /// Creates a new default instance.
4170 pub fn new() -> Self {
4171 std::default::Default::default()
4172 }
4173
4174 /// Sets the value of [quality_score][crate::model::document::page::ImageQualityScores::quality_score].
4175 ///
4176 /// # Example
4177 /// ```ignore,no_run
4178 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4179 /// let x = ImageQualityScores::new().set_quality_score(42.0);
4180 /// ```
4181 pub fn set_quality_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4182 self.quality_score = v.into();
4183 self
4184 }
4185
4186 /// Sets the value of [detected_defects][crate::model::document::page::ImageQualityScores::detected_defects].
4187 ///
4188 /// # Example
4189 /// ```ignore,no_run
4190 /// # use google_cloud_documentai_v1::model::document::page::ImageQualityScores;
4191 /// use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4192 /// let x = ImageQualityScores::new()
4193 /// .set_detected_defects([
4194 /// DetectedDefect::default()/* use setters */,
4195 /// DetectedDefect::default()/* use (different) setters */,
4196 /// ]);
4197 /// ```
4198 pub fn set_detected_defects<T, V>(mut self, v: T) -> Self
4199 where
4200 T: std::iter::IntoIterator<Item = V>,
4201 V: std::convert::Into<
4202 crate::model::document::page::image_quality_scores::DetectedDefect,
4203 >,
4204 {
4205 use std::iter::Iterator;
4206 self.detected_defects = v.into_iter().map(|i| i.into()).collect();
4207 self
4208 }
4209 }
4210
4211 impl wkt::message::Message for ImageQualityScores {
4212 fn typename() -> &'static str {
4213 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores"
4214 }
4215 }
4216
4217 /// Defines additional types related to [ImageQualityScores].
4218 pub mod image_quality_scores {
4219 #[allow(unused_imports)]
4220 use super::*;
4221
4222 /// Image Quality Defects
4223 #[derive(Clone, Default, PartialEq)]
4224 #[non_exhaustive]
4225 pub struct DetectedDefect {
4226 /// Name of the defect type. Supported values are:
4227 ///
4228 /// - `quality/defect_blurry`
4229 /// - `quality/defect_noisy`
4230 /// - `quality/defect_dark`
4231 /// - `quality/defect_faint`
4232 /// - `quality/defect_text_too_small`
4233 /// - `quality/defect_document_cutoff`
4234 /// - `quality/defect_text_cutoff`
4235 /// - `quality/defect_glare`
4236 pub r#type: std::string::String,
4237
4238 /// Confidence of detected defect. Range `[0, 1]` where `1` indicates
4239 /// strong confidence that the defect exists.
4240 pub confidence: f32,
4241
4242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4243 }
4244
4245 impl DetectedDefect {
4246 /// Creates a new default instance.
4247 pub fn new() -> Self {
4248 std::default::Default::default()
4249 }
4250
4251 /// Sets the value of [r#type][crate::model::document::page::image_quality_scores::DetectedDefect::type].
4252 ///
4253 /// # Example
4254 /// ```ignore,no_run
4255 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4256 /// let x = DetectedDefect::new().set_type("example");
4257 /// ```
4258 pub fn set_type<T: std::convert::Into<std::string::String>>(
4259 mut self,
4260 v: T,
4261 ) -> Self {
4262 self.r#type = v.into();
4263 self
4264 }
4265
4266 /// Sets the value of [confidence][crate::model::document::page::image_quality_scores::DetectedDefect::confidence].
4267 ///
4268 /// # Example
4269 /// ```ignore,no_run
4270 /// # use google_cloud_documentai_v1::model::document::page::image_quality_scores::DetectedDefect;
4271 /// let x = DetectedDefect::new().set_confidence(42.0);
4272 /// ```
4273 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4274 self.confidence = v.into();
4275 self
4276 }
4277 }
4278
4279 impl wkt::message::Message for DetectedDefect {
4280 fn typename() -> &'static str {
4281 "type.googleapis.com/google.cloud.documentai.v1.Document.Page.ImageQualityScores.DetectedDefect"
4282 }
4283 }
4284 }
4285 }
4286
4287 /// An entity that could be a phrase in the text or a property that belongs to
4288 /// the document. It is a known entity type, such as a person, an organization,
4289 /// or location.
4290 #[derive(Clone, Default, PartialEq)]
4291 #[non_exhaustive]
4292 pub struct Entity {
4293 /// Optional. Provenance of the entity.
4294 /// Text anchor indexing into the
4295 /// [Document.text][google.cloud.documentai.v1.Document.text].
4296 ///
4297 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
4298 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
4299
4300 /// Required. Entity type from a schema, for example, `Address`.
4301 pub r#type: std::string::String,
4302
4303 /// Optional. Text value of the entity, for example, `1600 Amphitheatre
4304 /// Pkwy`.
4305 pub mention_text: std::string::String,
4306
4307 /// Optional. Deprecated. Use `id` field instead.
4308 pub mention_id: std::string::String,
4309
4310 /// Optional. Confidence of detected Schema entity. Range `[0, 1]`.
4311 pub confidence: f32,
4312
4313 /// Optional. Represents the provenance of this entity wrt. the location on
4314 /// the page where it was found.
4315 pub page_anchor: std::option::Option<crate::model::document::PageAnchor>,
4316
4317 /// Optional. Canonical id. This will be a unique value in the entity list
4318 /// for this document.
4319 pub id: std::string::String,
4320
4321 /// Optional. Normalized entity value. Absent if the extracted value could
4322 /// not be converted or the type (for example, address) is not supported for
4323 /// certain parsers. This field is also only populated for certain supported
4324 /// document types.
4325 pub normalized_value: std::option::Option<crate::model::document::entity::NormalizedValue>,
4326
4327 /// Optional. Entities can be nested to form a hierarchical data structure
4328 /// representing the content in the document.
4329 pub properties: std::vec::Vec<crate::model::document::Entity>,
4330
4331 /// Optional. The history of this annotation.
4332 pub provenance: std::option::Option<crate::model::document::Provenance>,
4333
4334 /// Optional. Whether the entity will be redacted for de-identification
4335 /// purposes.
4336 pub redacted: bool,
4337
4338 /// Optional. Specifies how the entity's value is obtained.
4339 pub method: crate::model::document::entity::Method,
4340
4341 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4342 }
4343
4344 impl Entity {
4345 /// Creates a new default instance.
4346 pub fn new() -> Self {
4347 std::default::Default::default()
4348 }
4349
4350 /// Sets the value of [text_anchor][crate::model::document::Entity::text_anchor].
4351 ///
4352 /// # Example
4353 /// ```ignore,no_run
4354 /// # use google_cloud_documentai_v1::model::document::Entity;
4355 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4356 /// let x = Entity::new().set_text_anchor(TextAnchor::default()/* use setters */);
4357 /// ```
4358 pub fn set_text_anchor<T>(mut self, v: T) -> Self
4359 where
4360 T: std::convert::Into<crate::model::document::TextAnchor>,
4361 {
4362 self.text_anchor = std::option::Option::Some(v.into());
4363 self
4364 }
4365
4366 /// Sets or clears the value of [text_anchor][crate::model::document::Entity::text_anchor].
4367 ///
4368 /// # Example
4369 /// ```ignore,no_run
4370 /// # use google_cloud_documentai_v1::model::document::Entity;
4371 /// use google_cloud_documentai_v1::model::document::TextAnchor;
4372 /// let x = Entity::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
4373 /// let x = Entity::new().set_or_clear_text_anchor(None::<TextAnchor>);
4374 /// ```
4375 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4376 where
4377 T: std::convert::Into<crate::model::document::TextAnchor>,
4378 {
4379 self.text_anchor = v.map(|x| x.into());
4380 self
4381 }
4382
4383 /// Sets the value of [r#type][crate::model::document::Entity::type].
4384 ///
4385 /// # Example
4386 /// ```ignore,no_run
4387 /// # use google_cloud_documentai_v1::model::document::Entity;
4388 /// let x = Entity::new().set_type("example");
4389 /// ```
4390 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4391 self.r#type = v.into();
4392 self
4393 }
4394
4395 /// Sets the value of [mention_text][crate::model::document::Entity::mention_text].
4396 ///
4397 /// # Example
4398 /// ```ignore,no_run
4399 /// # use google_cloud_documentai_v1::model::document::Entity;
4400 /// let x = Entity::new().set_mention_text("example");
4401 /// ```
4402 pub fn set_mention_text<T: std::convert::Into<std::string::String>>(
4403 mut self,
4404 v: T,
4405 ) -> Self {
4406 self.mention_text = v.into();
4407 self
4408 }
4409
4410 /// Sets the value of [mention_id][crate::model::document::Entity::mention_id].
4411 ///
4412 /// # Example
4413 /// ```ignore,no_run
4414 /// # use google_cloud_documentai_v1::model::document::Entity;
4415 /// let x = Entity::new().set_mention_id("example");
4416 /// ```
4417 pub fn set_mention_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4418 self.mention_id = v.into();
4419 self
4420 }
4421
4422 /// Sets the value of [confidence][crate::model::document::Entity::confidence].
4423 ///
4424 /// # Example
4425 /// ```ignore,no_run
4426 /// # use google_cloud_documentai_v1::model::document::Entity;
4427 /// let x = Entity::new().set_confidence(42.0);
4428 /// ```
4429 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4430 self.confidence = v.into();
4431 self
4432 }
4433
4434 /// Sets the value of [page_anchor][crate::model::document::Entity::page_anchor].
4435 ///
4436 /// # Example
4437 /// ```ignore,no_run
4438 /// # use google_cloud_documentai_v1::model::document::Entity;
4439 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4440 /// let x = Entity::new().set_page_anchor(PageAnchor::default()/* use setters */);
4441 /// ```
4442 pub fn set_page_anchor<T>(mut self, v: T) -> Self
4443 where
4444 T: std::convert::Into<crate::model::document::PageAnchor>,
4445 {
4446 self.page_anchor = std::option::Option::Some(v.into());
4447 self
4448 }
4449
4450 /// Sets or clears the value of [page_anchor][crate::model::document::Entity::page_anchor].
4451 ///
4452 /// # Example
4453 /// ```ignore,no_run
4454 /// # use google_cloud_documentai_v1::model::document::Entity;
4455 /// use google_cloud_documentai_v1::model::document::PageAnchor;
4456 /// let x = Entity::new().set_or_clear_page_anchor(Some(PageAnchor::default()/* use setters */));
4457 /// let x = Entity::new().set_or_clear_page_anchor(None::<PageAnchor>);
4458 /// ```
4459 pub fn set_or_clear_page_anchor<T>(mut self, v: std::option::Option<T>) -> Self
4460 where
4461 T: std::convert::Into<crate::model::document::PageAnchor>,
4462 {
4463 self.page_anchor = v.map(|x| x.into());
4464 self
4465 }
4466
4467 /// Sets the value of [id][crate::model::document::Entity::id].
4468 ///
4469 /// # Example
4470 /// ```ignore,no_run
4471 /// # use google_cloud_documentai_v1::model::document::Entity;
4472 /// let x = Entity::new().set_id("example");
4473 /// ```
4474 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4475 self.id = v.into();
4476 self
4477 }
4478
4479 /// Sets the value of [normalized_value][crate::model::document::Entity::normalized_value].
4480 ///
4481 /// # Example
4482 /// ```ignore,no_run
4483 /// # use google_cloud_documentai_v1::model::document::Entity;
4484 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4485 /// let x = Entity::new().set_normalized_value(NormalizedValue::default()/* use setters */);
4486 /// ```
4487 pub fn set_normalized_value<T>(mut self, v: T) -> Self
4488 where
4489 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4490 {
4491 self.normalized_value = std::option::Option::Some(v.into());
4492 self
4493 }
4494
4495 /// Sets or clears the value of [normalized_value][crate::model::document::Entity::normalized_value].
4496 ///
4497 /// # Example
4498 /// ```ignore,no_run
4499 /// # use google_cloud_documentai_v1::model::document::Entity;
4500 /// use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4501 /// let x = Entity::new().set_or_clear_normalized_value(Some(NormalizedValue::default()/* use setters */));
4502 /// let x = Entity::new().set_or_clear_normalized_value(None::<NormalizedValue>);
4503 /// ```
4504 pub fn set_or_clear_normalized_value<T>(mut self, v: std::option::Option<T>) -> Self
4505 where
4506 T: std::convert::Into<crate::model::document::entity::NormalizedValue>,
4507 {
4508 self.normalized_value = v.map(|x| x.into());
4509 self
4510 }
4511
4512 /// Sets the value of [properties][crate::model::document::Entity::properties].
4513 ///
4514 /// # Example
4515 /// ```ignore,no_run
4516 /// # use google_cloud_documentai_v1::model::document::Entity;
4517 /// let x = Entity::new()
4518 /// .set_properties([
4519 /// Entity::default()/* use setters */,
4520 /// Entity::default()/* use (different) setters */,
4521 /// ]);
4522 /// ```
4523 pub fn set_properties<T, V>(mut self, v: T) -> Self
4524 where
4525 T: std::iter::IntoIterator<Item = V>,
4526 V: std::convert::Into<crate::model::document::Entity>,
4527 {
4528 use std::iter::Iterator;
4529 self.properties = v.into_iter().map(|i| i.into()).collect();
4530 self
4531 }
4532
4533 /// Sets the value of [provenance][crate::model::document::Entity::provenance].
4534 ///
4535 /// # Example
4536 /// ```ignore,no_run
4537 /// # use google_cloud_documentai_v1::model::document::Entity;
4538 /// use google_cloud_documentai_v1::model::document::Provenance;
4539 /// let x = Entity::new().set_provenance(Provenance::default()/* use setters */);
4540 /// ```
4541 pub fn set_provenance<T>(mut self, v: T) -> Self
4542 where
4543 T: std::convert::Into<crate::model::document::Provenance>,
4544 {
4545 self.provenance = std::option::Option::Some(v.into());
4546 self
4547 }
4548
4549 /// Sets or clears the value of [provenance][crate::model::document::Entity::provenance].
4550 ///
4551 /// # Example
4552 /// ```ignore,no_run
4553 /// # use google_cloud_documentai_v1::model::document::Entity;
4554 /// use google_cloud_documentai_v1::model::document::Provenance;
4555 /// let x = Entity::new().set_or_clear_provenance(Some(Provenance::default()/* use setters */));
4556 /// let x = Entity::new().set_or_clear_provenance(None::<Provenance>);
4557 /// ```
4558 pub fn set_or_clear_provenance<T>(mut self, v: std::option::Option<T>) -> Self
4559 where
4560 T: std::convert::Into<crate::model::document::Provenance>,
4561 {
4562 self.provenance = v.map(|x| x.into());
4563 self
4564 }
4565
4566 /// Sets the value of [redacted][crate::model::document::Entity::redacted].
4567 ///
4568 /// # Example
4569 /// ```ignore,no_run
4570 /// # use google_cloud_documentai_v1::model::document::Entity;
4571 /// let x = Entity::new().set_redacted(true);
4572 /// ```
4573 pub fn set_redacted<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4574 self.redacted = v.into();
4575 self
4576 }
4577
4578 /// Sets the value of [method][crate::model::document::Entity::method].
4579 ///
4580 /// # Example
4581 /// ```ignore,no_run
4582 /// # use google_cloud_documentai_v1::model::document::Entity;
4583 /// use google_cloud_documentai_v1::model::document::entity::Method;
4584 /// let x0 = Entity::new().set_method(Method::Extract);
4585 /// let x1 = Entity::new().set_method(Method::Derive);
4586 /// ```
4587 pub fn set_method<T: std::convert::Into<crate::model::document::entity::Method>>(
4588 mut self,
4589 v: T,
4590 ) -> Self {
4591 self.method = v.into();
4592 self
4593 }
4594 }
4595
4596 impl wkt::message::Message for Entity {
4597 fn typename() -> &'static str {
4598 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity"
4599 }
4600 }
4601
4602 /// Defines additional types related to [Entity].
4603 pub mod entity {
4604 #[allow(unused_imports)]
4605 use super::*;
4606
4607 /// Parsed and normalized entity value.
4608 #[derive(Clone, Default, PartialEq)]
4609 #[non_exhaustive]
4610 pub struct NormalizedValue {
4611 /// Optional. An optional field to store a normalized string.
4612 /// For some entity types, one of respective `structured_value` fields may
4613 /// also be populated. Also not all the types of `structured_value` will be
4614 /// normalized. For example, some processors may not generate `float`
4615 /// or `integer` normalized text by default.
4616 ///
4617 /// Below are sample formats mapped to structured values.
4618 ///
4619 /// - Money/Currency type (`money_value`) is in the ISO 4217 text format.
4620 /// - Date type (`date_value`) is in the ISO 8601 text format.
4621 /// - Datetime type (`datetime_value`) is in the ISO 8601 text format.
4622 pub text: std::string::String,
4623
4624 /// An optional structured entity value.
4625 /// Must match entity type defined in schema if
4626 /// known. If this field is present, the `text` field could also be
4627 /// populated.
4628 pub structured_value: std::option::Option<
4629 crate::model::document::entity::normalized_value::StructuredValue,
4630 >,
4631
4632 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4633 }
4634
4635 impl NormalizedValue {
4636 /// Creates a new default instance.
4637 pub fn new() -> Self {
4638 std::default::Default::default()
4639 }
4640
4641 /// Sets the value of [text][crate::model::document::entity::NormalizedValue::text].
4642 ///
4643 /// # Example
4644 /// ```ignore,no_run
4645 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4646 /// let x = NormalizedValue::new().set_text("example");
4647 /// ```
4648 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4649 self.text = v.into();
4650 self
4651 }
4652
4653 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value].
4654 ///
4655 /// Note that all the setters affecting `structured_value` are mutually
4656 /// exclusive.
4657 ///
4658 /// # Example
4659 /// ```ignore,no_run
4660 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4661 /// use google_cloud_documentai_v1::model::document::entity::normalized_value::StructuredValue;
4662 /// let x = NormalizedValue::new().set_structured_value(Some(StructuredValue::BooleanValue(true)));
4663 /// ```
4664 pub fn set_structured_value<
4665 T: std::convert::Into<
4666 std::option::Option<
4667 crate::model::document::entity::normalized_value::StructuredValue,
4668 >,
4669 >,
4670 >(
4671 mut self,
4672 v: T,
4673 ) -> Self {
4674 self.structured_value = v.into();
4675 self
4676 }
4677
4678 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4679 /// if it holds a `MoneyValue`, `None` if the field is not set or
4680 /// holds a different branch.
4681 pub fn money_value(
4682 &self,
4683 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Money>>
4684 {
4685 #[allow(unreachable_patterns)]
4686 self.structured_value.as_ref().and_then(|v| match v {
4687 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(v) => std::option::Option::Some(v),
4688 _ => std::option::Option::None,
4689 })
4690 }
4691
4692 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4693 /// to hold a `MoneyValue`.
4694 ///
4695 /// Note that all the setters affecting `structured_value` are
4696 /// mutually exclusive.
4697 ///
4698 /// # Example
4699 /// ```ignore,no_run
4700 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4701 /// use google_cloud_type::model::Money;
4702 /// let x = NormalizedValue::new().set_money_value(Money::default()/* use setters */);
4703 /// assert!(x.money_value().is_some());
4704 /// assert!(x.date_value().is_none());
4705 /// assert!(x.datetime_value().is_none());
4706 /// assert!(x.address_value().is_none());
4707 /// assert!(x.boolean_value().is_none());
4708 /// assert!(x.integer_value().is_none());
4709 /// assert!(x.float_value().is_none());
4710 /// assert!(x.signature_value().is_none());
4711 /// ```
4712 pub fn set_money_value<
4713 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Money>>,
4714 >(
4715 mut self,
4716 v: T,
4717 ) -> Self {
4718 self.structured_value = std::option::Option::Some(
4719 crate::model::document::entity::normalized_value::StructuredValue::MoneyValue(
4720 v.into(),
4721 ),
4722 );
4723 self
4724 }
4725
4726 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4727 /// if it holds a `DateValue`, `None` if the field is not set or
4728 /// holds a different branch.
4729 pub fn date_value(
4730 &self,
4731 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::Date>> {
4732 #[allow(unreachable_patterns)]
4733 self.structured_value.as_ref().and_then(|v| match v {
4734 crate::model::document::entity::normalized_value::StructuredValue::DateValue(v) => std::option::Option::Some(v),
4735 _ => std::option::Option::None,
4736 })
4737 }
4738
4739 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4740 /// to hold a `DateValue`.
4741 ///
4742 /// Note that all the setters affecting `structured_value` are
4743 /// mutually exclusive.
4744 ///
4745 /// # Example
4746 /// ```ignore,no_run
4747 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4748 /// use google_cloud_type::model::Date;
4749 /// let x = NormalizedValue::new().set_date_value(Date::default()/* use setters */);
4750 /// assert!(x.date_value().is_some());
4751 /// assert!(x.money_value().is_none());
4752 /// assert!(x.datetime_value().is_none());
4753 /// assert!(x.address_value().is_none());
4754 /// assert!(x.boolean_value().is_none());
4755 /// assert!(x.integer_value().is_none());
4756 /// assert!(x.float_value().is_none());
4757 /// assert!(x.signature_value().is_none());
4758 /// ```
4759 pub fn set_date_value<
4760 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::Date>>,
4761 >(
4762 mut self,
4763 v: T,
4764 ) -> Self {
4765 self.structured_value = std::option::Option::Some(
4766 crate::model::document::entity::normalized_value::StructuredValue::DateValue(
4767 v.into(),
4768 ),
4769 );
4770 self
4771 }
4772
4773 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4774 /// if it holds a `DatetimeValue`, `None` if the field is not set or
4775 /// holds a different branch.
4776 pub fn datetime_value(
4777 &self,
4778 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::DateTime>>
4779 {
4780 #[allow(unreachable_patterns)]
4781 self.structured_value.as_ref().and_then(|v| match v {
4782 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(v) => std::option::Option::Some(v),
4783 _ => std::option::Option::None,
4784 })
4785 }
4786
4787 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4788 /// to hold a `DatetimeValue`.
4789 ///
4790 /// Note that all the setters affecting `structured_value` are
4791 /// mutually exclusive.
4792 ///
4793 /// # Example
4794 /// ```ignore,no_run
4795 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4796 /// use google_cloud_type::model::DateTime;
4797 /// let x = NormalizedValue::new().set_datetime_value(DateTime::default()/* use setters */);
4798 /// assert!(x.datetime_value().is_some());
4799 /// assert!(x.money_value().is_none());
4800 /// assert!(x.date_value().is_none());
4801 /// assert!(x.address_value().is_none());
4802 /// assert!(x.boolean_value().is_none());
4803 /// assert!(x.integer_value().is_none());
4804 /// assert!(x.float_value().is_none());
4805 /// assert!(x.signature_value().is_none());
4806 /// ```
4807 pub fn set_datetime_value<
4808 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::DateTime>>,
4809 >(
4810 mut self,
4811 v: T,
4812 ) -> Self {
4813 self.structured_value = std::option::Option::Some(
4814 crate::model::document::entity::normalized_value::StructuredValue::DatetimeValue(
4815 v.into()
4816 )
4817 );
4818 self
4819 }
4820
4821 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4822 /// if it holds a `AddressValue`, `None` if the field is not set or
4823 /// holds a different branch.
4824 pub fn address_value(
4825 &self,
4826 ) -> std::option::Option<&std::boxed::Box<google_cloud_type::model::PostalAddress>>
4827 {
4828 #[allow(unreachable_patterns)]
4829 self.structured_value.as_ref().and_then(|v| match v {
4830 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(v) => std::option::Option::Some(v),
4831 _ => std::option::Option::None,
4832 })
4833 }
4834
4835 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4836 /// to hold a `AddressValue`.
4837 ///
4838 /// Note that all the setters affecting `structured_value` are
4839 /// mutually exclusive.
4840 ///
4841 /// # Example
4842 /// ```ignore,no_run
4843 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4844 /// use google_cloud_type::model::PostalAddress;
4845 /// let x = NormalizedValue::new().set_address_value(PostalAddress::default()/* use setters */);
4846 /// assert!(x.address_value().is_some());
4847 /// assert!(x.money_value().is_none());
4848 /// assert!(x.date_value().is_none());
4849 /// assert!(x.datetime_value().is_none());
4850 /// assert!(x.boolean_value().is_none());
4851 /// assert!(x.integer_value().is_none());
4852 /// assert!(x.float_value().is_none());
4853 /// assert!(x.signature_value().is_none());
4854 /// ```
4855 pub fn set_address_value<
4856 T: std::convert::Into<std::boxed::Box<google_cloud_type::model::PostalAddress>>,
4857 >(
4858 mut self,
4859 v: T,
4860 ) -> Self {
4861 self.structured_value = std::option::Option::Some(
4862 crate::model::document::entity::normalized_value::StructuredValue::AddressValue(
4863 v.into(),
4864 ),
4865 );
4866 self
4867 }
4868
4869 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4870 /// if it holds a `BooleanValue`, `None` if the field is not set or
4871 /// holds a different branch.
4872 pub fn boolean_value(&self) -> std::option::Option<&bool> {
4873 #[allow(unreachable_patterns)]
4874 self.structured_value.as_ref().and_then(|v| match v {
4875 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(v) => std::option::Option::Some(v),
4876 _ => std::option::Option::None,
4877 })
4878 }
4879
4880 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4881 /// to hold a `BooleanValue`.
4882 ///
4883 /// Note that all the setters affecting `structured_value` are
4884 /// mutually exclusive.
4885 ///
4886 /// # Example
4887 /// ```ignore,no_run
4888 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4889 /// let x = NormalizedValue::new().set_boolean_value(true);
4890 /// assert!(x.boolean_value().is_some());
4891 /// assert!(x.money_value().is_none());
4892 /// assert!(x.date_value().is_none());
4893 /// assert!(x.datetime_value().is_none());
4894 /// assert!(x.address_value().is_none());
4895 /// assert!(x.integer_value().is_none());
4896 /// assert!(x.float_value().is_none());
4897 /// assert!(x.signature_value().is_none());
4898 /// ```
4899 pub fn set_boolean_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
4900 self.structured_value = std::option::Option::Some(
4901 crate::model::document::entity::normalized_value::StructuredValue::BooleanValue(
4902 v.into(),
4903 ),
4904 );
4905 self
4906 }
4907
4908 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4909 /// if it holds a `IntegerValue`, `None` if the field is not set or
4910 /// holds a different branch.
4911 pub fn integer_value(&self) -> std::option::Option<&i32> {
4912 #[allow(unreachable_patterns)]
4913 self.structured_value.as_ref().and_then(|v| match v {
4914 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(v) => std::option::Option::Some(v),
4915 _ => std::option::Option::None,
4916 })
4917 }
4918
4919 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4920 /// to hold a `IntegerValue`.
4921 ///
4922 /// Note that all the setters affecting `structured_value` are
4923 /// mutually exclusive.
4924 ///
4925 /// # Example
4926 /// ```ignore,no_run
4927 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4928 /// let x = NormalizedValue::new().set_integer_value(42);
4929 /// assert!(x.integer_value().is_some());
4930 /// assert!(x.money_value().is_none());
4931 /// assert!(x.date_value().is_none());
4932 /// assert!(x.datetime_value().is_none());
4933 /// assert!(x.address_value().is_none());
4934 /// assert!(x.boolean_value().is_none());
4935 /// assert!(x.float_value().is_none());
4936 /// assert!(x.signature_value().is_none());
4937 /// ```
4938 pub fn set_integer_value<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4939 self.structured_value = std::option::Option::Some(
4940 crate::model::document::entity::normalized_value::StructuredValue::IntegerValue(
4941 v.into(),
4942 ),
4943 );
4944 self
4945 }
4946
4947 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4948 /// if it holds a `FloatValue`, `None` if the field is not set or
4949 /// holds a different branch.
4950 pub fn float_value(&self) -> std::option::Option<&f32> {
4951 #[allow(unreachable_patterns)]
4952 self.structured_value.as_ref().and_then(|v| match v {
4953 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(v) => std::option::Option::Some(v),
4954 _ => std::option::Option::None,
4955 })
4956 }
4957
4958 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4959 /// to hold a `FloatValue`.
4960 ///
4961 /// Note that all the setters affecting `structured_value` are
4962 /// mutually exclusive.
4963 ///
4964 /// # Example
4965 /// ```ignore,no_run
4966 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
4967 /// let x = NormalizedValue::new().set_float_value(42.0);
4968 /// assert!(x.float_value().is_some());
4969 /// assert!(x.money_value().is_none());
4970 /// assert!(x.date_value().is_none());
4971 /// assert!(x.datetime_value().is_none());
4972 /// assert!(x.address_value().is_none());
4973 /// assert!(x.boolean_value().is_none());
4974 /// assert!(x.integer_value().is_none());
4975 /// assert!(x.signature_value().is_none());
4976 /// ```
4977 pub fn set_float_value<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4978 self.structured_value = std::option::Option::Some(
4979 crate::model::document::entity::normalized_value::StructuredValue::FloatValue(
4980 v.into(),
4981 ),
4982 );
4983 self
4984 }
4985
4986 /// The value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4987 /// if it holds a `SignatureValue`, `None` if the field is not set or
4988 /// holds a different branch.
4989 pub fn signature_value(&self) -> std::option::Option<&bool> {
4990 #[allow(unreachable_patterns)]
4991 self.structured_value.as_ref().and_then(|v| match v {
4992 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(v) => std::option::Option::Some(v),
4993 _ => std::option::Option::None,
4994 })
4995 }
4996
4997 /// Sets the value of [structured_value][crate::model::document::entity::NormalizedValue::structured_value]
4998 /// to hold a `SignatureValue`.
4999 ///
5000 /// Note that all the setters affecting `structured_value` are
5001 /// mutually exclusive.
5002 ///
5003 /// # Example
5004 /// ```ignore,no_run
5005 /// # use google_cloud_documentai_v1::model::document::entity::NormalizedValue;
5006 /// let x = NormalizedValue::new().set_signature_value(true);
5007 /// assert!(x.signature_value().is_some());
5008 /// assert!(x.money_value().is_none());
5009 /// assert!(x.date_value().is_none());
5010 /// assert!(x.datetime_value().is_none());
5011 /// assert!(x.address_value().is_none());
5012 /// assert!(x.boolean_value().is_none());
5013 /// assert!(x.integer_value().is_none());
5014 /// assert!(x.float_value().is_none());
5015 /// ```
5016 pub fn set_signature_value<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
5017 self.structured_value = std::option::Option::Some(
5018 crate::model::document::entity::normalized_value::StructuredValue::SignatureValue(
5019 v.into()
5020 )
5021 );
5022 self
5023 }
5024 }
5025
5026 impl wkt::message::Message for NormalizedValue {
5027 fn typename() -> &'static str {
5028 "type.googleapis.com/google.cloud.documentai.v1.Document.Entity.NormalizedValue"
5029 }
5030 }
5031
5032 /// Defines additional types related to [NormalizedValue].
5033 pub mod normalized_value {
5034 #[allow(unused_imports)]
5035 use super::*;
5036
5037 /// An optional structured entity value.
5038 /// Must match entity type defined in schema if
5039 /// known. If this field is present, the `text` field could also be
5040 /// populated.
5041 #[derive(Clone, Debug, PartialEq)]
5042 #[non_exhaustive]
5043 pub enum StructuredValue {
5044 /// Money value. See also:
5045 /// <https://github.com/googleapis/googleapis/blob/master/google/type/money.proto>
5046 MoneyValue(std::boxed::Box<google_cloud_type::model::Money>),
5047 /// Date value. Includes year, month, day. See also:
5048 /// <https://github.com/googleapis/googleapis/blob/master/google/type/date.proto>
5049 DateValue(std::boxed::Box<google_cloud_type::model::Date>),
5050 /// DateTime value. Includes date, time, and timezone. See also:
5051 /// <https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto>
5052 DatetimeValue(std::boxed::Box<google_cloud_type::model::DateTime>),
5053 /// Postal address. See also:
5054 /// <https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto>
5055 AddressValue(std::boxed::Box<google_cloud_type::model::PostalAddress>),
5056 /// Boolean value. Can be used for entities with binary values, or for
5057 /// checkboxes.
5058 BooleanValue(bool),
5059 /// Integer value.
5060 IntegerValue(i32),
5061 /// Float value.
5062 FloatValue(f32),
5063 /// A signature - a graphical representation of a person's name,
5064 /// often used to sign a document.
5065 SignatureValue(bool),
5066 }
5067 }
5068
5069 /// Specifies how the entity's value is obtained.
5070 ///
5071 /// # Working with unknown values
5072 ///
5073 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5074 /// additional enum variants at any time. Adding new variants is not considered
5075 /// a breaking change. Applications should write their code in anticipation of:
5076 ///
5077 /// - New values appearing in future releases of the client library, **and**
5078 /// - New values received dynamically, without application changes.
5079 ///
5080 /// Please consult the [Working with enums] section in the user guide for some
5081 /// guidelines.
5082 ///
5083 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5084 #[derive(Clone, Debug, PartialEq)]
5085 #[non_exhaustive]
5086 pub enum Method {
5087 /// When the method is not specified, it should be treated as `EXTRACT`.
5088 Unspecified,
5089 /// The entity's value is directly extracted as-is from the document
5090 /// text.
5091 Extract,
5092 /// The entity's value is derived through inference and is not
5093 /// necessarily an exact text extraction from the document.
5094 Derive,
5095 /// If set, the enum was initialized with an unknown value.
5096 ///
5097 /// Applications can examine the value using [Method::value] or
5098 /// [Method::name].
5099 UnknownValue(method::UnknownValue),
5100 }
5101
5102 #[doc(hidden)]
5103 pub mod method {
5104 #[allow(unused_imports)]
5105 use super::*;
5106 #[derive(Clone, Debug, PartialEq)]
5107 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5108 }
5109
5110 impl Method {
5111 /// Gets the enum value.
5112 ///
5113 /// Returns `None` if the enum contains an unknown value deserialized from
5114 /// the string representation of enums.
5115 pub fn value(&self) -> std::option::Option<i32> {
5116 match self {
5117 Self::Unspecified => std::option::Option::Some(0),
5118 Self::Extract => std::option::Option::Some(1),
5119 Self::Derive => std::option::Option::Some(2),
5120 Self::UnknownValue(u) => u.0.value(),
5121 }
5122 }
5123
5124 /// Gets the enum value as a string.
5125 ///
5126 /// Returns `None` if the enum contains an unknown value deserialized from
5127 /// the integer representation of enums.
5128 pub fn name(&self) -> std::option::Option<&str> {
5129 match self {
5130 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
5131 Self::Extract => std::option::Option::Some("EXTRACT"),
5132 Self::Derive => std::option::Option::Some("DERIVE"),
5133 Self::UnknownValue(u) => u.0.name(),
5134 }
5135 }
5136 }
5137
5138 impl std::default::Default for Method {
5139 fn default() -> Self {
5140 use std::convert::From;
5141 Self::from(0)
5142 }
5143 }
5144
5145 impl std::fmt::Display for Method {
5146 fn fmt(
5147 &self,
5148 f: &mut std::fmt::Formatter<'_>,
5149 ) -> std::result::Result<(), std::fmt::Error> {
5150 wkt::internal::display_enum(f, self.name(), self.value())
5151 }
5152 }
5153
5154 impl std::convert::From<i32> for Method {
5155 fn from(value: i32) -> Self {
5156 match value {
5157 0 => Self::Unspecified,
5158 1 => Self::Extract,
5159 2 => Self::Derive,
5160 _ => Self::UnknownValue(method::UnknownValue(
5161 wkt::internal::UnknownEnumValue::Integer(value),
5162 )),
5163 }
5164 }
5165 }
5166
5167 impl std::convert::From<&str> for Method {
5168 fn from(value: &str) -> Self {
5169 use std::string::ToString;
5170 match value {
5171 "METHOD_UNSPECIFIED" => Self::Unspecified,
5172 "EXTRACT" => Self::Extract,
5173 "DERIVE" => Self::Derive,
5174 _ => Self::UnknownValue(method::UnknownValue(
5175 wkt::internal::UnknownEnumValue::String(value.to_string()),
5176 )),
5177 }
5178 }
5179 }
5180
5181 impl serde::ser::Serialize for Method {
5182 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5183 where
5184 S: serde::Serializer,
5185 {
5186 match self {
5187 Self::Unspecified => serializer.serialize_i32(0),
5188 Self::Extract => serializer.serialize_i32(1),
5189 Self::Derive => serializer.serialize_i32(2),
5190 Self::UnknownValue(u) => u.0.serialize(serializer),
5191 }
5192 }
5193 }
5194
5195 impl<'de> serde::de::Deserialize<'de> for Method {
5196 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5197 where
5198 D: serde::Deserializer<'de>,
5199 {
5200 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
5201 ".google.cloud.documentai.v1.Document.Entity.Method",
5202 ))
5203 }
5204 }
5205 }
5206
5207 /// Relationship between
5208 /// [Entities][google.cloud.documentai.v1.Document.Entity].
5209 ///
5210 /// [google.cloud.documentai.v1.Document.Entity]: crate::model::document::Entity
5211 #[derive(Clone, Default, PartialEq)]
5212 #[non_exhaustive]
5213 pub struct EntityRelation {
5214 /// Subject entity id.
5215 pub subject_id: std::string::String,
5216
5217 /// Object entity id.
5218 pub object_id: std::string::String,
5219
5220 /// Relationship description.
5221 pub relation: std::string::String,
5222
5223 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5224 }
5225
5226 impl EntityRelation {
5227 /// Creates a new default instance.
5228 pub fn new() -> Self {
5229 std::default::Default::default()
5230 }
5231
5232 /// Sets the value of [subject_id][crate::model::document::EntityRelation::subject_id].
5233 ///
5234 /// # Example
5235 /// ```ignore,no_run
5236 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5237 /// let x = EntityRelation::new().set_subject_id("example");
5238 /// ```
5239 pub fn set_subject_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5240 self.subject_id = v.into();
5241 self
5242 }
5243
5244 /// Sets the value of [object_id][crate::model::document::EntityRelation::object_id].
5245 ///
5246 /// # Example
5247 /// ```ignore,no_run
5248 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5249 /// let x = EntityRelation::new().set_object_id("example");
5250 /// ```
5251 pub fn set_object_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5252 self.object_id = v.into();
5253 self
5254 }
5255
5256 /// Sets the value of [relation][crate::model::document::EntityRelation::relation].
5257 ///
5258 /// # Example
5259 /// ```ignore,no_run
5260 /// # use google_cloud_documentai_v1::model::document::EntityRelation;
5261 /// let x = EntityRelation::new().set_relation("example");
5262 /// ```
5263 pub fn set_relation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5264 self.relation = v.into();
5265 self
5266 }
5267 }
5268
5269 impl wkt::message::Message for EntityRelation {
5270 fn typename() -> &'static str {
5271 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityRelation"
5272 }
5273 }
5274
5275 /// Text reference indexing into the
5276 /// [Document.text][google.cloud.documentai.v1.Document.text].
5277 ///
5278 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5279 #[derive(Clone, Default, PartialEq)]
5280 #[non_exhaustive]
5281 pub struct TextAnchor {
5282 /// The text segments from the
5283 /// [Document.text][google.cloud.documentai.v1.Document.text].
5284 ///
5285 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5286 pub text_segments: std::vec::Vec<crate::model::document::text_anchor::TextSegment>,
5287
5288 /// Contains the content of the text span so that users do
5289 /// not have to look it up in the text_segments. It is always
5290 /// populated for formFields.
5291 pub content: std::string::String,
5292
5293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5294 }
5295
5296 impl TextAnchor {
5297 /// Creates a new default instance.
5298 pub fn new() -> Self {
5299 std::default::Default::default()
5300 }
5301
5302 /// Sets the value of [text_segments][crate::model::document::TextAnchor::text_segments].
5303 ///
5304 /// # Example
5305 /// ```ignore,no_run
5306 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5307 /// use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5308 /// let x = TextAnchor::new()
5309 /// .set_text_segments([
5310 /// TextSegment::default()/* use setters */,
5311 /// TextSegment::default()/* use (different) setters */,
5312 /// ]);
5313 /// ```
5314 pub fn set_text_segments<T, V>(mut self, v: T) -> Self
5315 where
5316 T: std::iter::IntoIterator<Item = V>,
5317 V: std::convert::Into<crate::model::document::text_anchor::TextSegment>,
5318 {
5319 use std::iter::Iterator;
5320 self.text_segments = v.into_iter().map(|i| i.into()).collect();
5321 self
5322 }
5323
5324 /// Sets the value of [content][crate::model::document::TextAnchor::content].
5325 ///
5326 /// # Example
5327 /// ```ignore,no_run
5328 /// # use google_cloud_documentai_v1::model::document::TextAnchor;
5329 /// let x = TextAnchor::new().set_content("example");
5330 /// ```
5331 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5332 self.content = v.into();
5333 self
5334 }
5335 }
5336
5337 impl wkt::message::Message for TextAnchor {
5338 fn typename() -> &'static str {
5339 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor"
5340 }
5341 }
5342
5343 /// Defines additional types related to [TextAnchor].
5344 pub mod text_anchor {
5345 #[allow(unused_imports)]
5346 use super::*;
5347
5348 /// A text segment in the
5349 /// [Document.text][google.cloud.documentai.v1.Document.text]. The indices
5350 /// may be out of bounds which indicate that the text extends into another
5351 /// document shard for large sharded documents. See
5352 /// [ShardInfo.text_offset][google.cloud.documentai.v1.Document.ShardInfo.text_offset]
5353 ///
5354 /// [google.cloud.documentai.v1.Document.ShardInfo.text_offset]: crate::model::document::ShardInfo::text_offset
5355 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5356 #[derive(Clone, Default, PartialEq)]
5357 #[non_exhaustive]
5358 pub struct TextSegment {
5359 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5360 /// start UTF-8 char index in the
5361 /// [Document.text][google.cloud.documentai.v1.Document.text].
5362 ///
5363 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5364 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5365 pub start_index: i64,
5366
5367 /// [TextSegment][google.cloud.documentai.v1.Document.TextAnchor.TextSegment]
5368 /// half open end UTF-8 char index in the
5369 /// [Document.text][google.cloud.documentai.v1.Document.text].
5370 ///
5371 /// [google.cloud.documentai.v1.Document.TextAnchor.TextSegment]: crate::model::document::text_anchor::TextSegment
5372 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
5373 pub end_index: i64,
5374
5375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5376 }
5377
5378 impl TextSegment {
5379 /// Creates a new default instance.
5380 pub fn new() -> Self {
5381 std::default::Default::default()
5382 }
5383
5384 /// Sets the value of [start_index][crate::model::document::text_anchor::TextSegment::start_index].
5385 ///
5386 /// # Example
5387 /// ```ignore,no_run
5388 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5389 /// let x = TextSegment::new().set_start_index(42);
5390 /// ```
5391 pub fn set_start_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5392 self.start_index = v.into();
5393 self
5394 }
5395
5396 /// Sets the value of [end_index][crate::model::document::text_anchor::TextSegment::end_index].
5397 ///
5398 /// # Example
5399 /// ```ignore,no_run
5400 /// # use google_cloud_documentai_v1::model::document::text_anchor::TextSegment;
5401 /// let x = TextSegment::new().set_end_index(42);
5402 /// ```
5403 pub fn set_end_index<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5404 self.end_index = v.into();
5405 self
5406 }
5407 }
5408
5409 impl wkt::message::Message for TextSegment {
5410 fn typename() -> &'static str {
5411 "type.googleapis.com/google.cloud.documentai.v1.Document.TextAnchor.TextSegment"
5412 }
5413 }
5414 }
5415
5416 /// Referencing the visual context of the entity in the
5417 /// [Document.pages][google.cloud.documentai.v1.Document.pages]. Page anchors
5418 /// can be cross-page, consist of multiple bounding polygons and optionally
5419 /// reference specific layout element types.
5420 ///
5421 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5422 #[derive(Clone, Default, PartialEq)]
5423 #[non_exhaustive]
5424 pub struct PageAnchor {
5425 /// One or more references to visual page elements
5426 pub page_refs: std::vec::Vec<crate::model::document::page_anchor::PageRef>,
5427
5428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5429 }
5430
5431 impl PageAnchor {
5432 /// Creates a new default instance.
5433 pub fn new() -> Self {
5434 std::default::Default::default()
5435 }
5436
5437 /// Sets the value of [page_refs][crate::model::document::PageAnchor::page_refs].
5438 ///
5439 /// # Example
5440 /// ```ignore,no_run
5441 /// # use google_cloud_documentai_v1::model::document::PageAnchor;
5442 /// use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5443 /// let x = PageAnchor::new()
5444 /// .set_page_refs([
5445 /// PageRef::default()/* use setters */,
5446 /// PageRef::default()/* use (different) setters */,
5447 /// ]);
5448 /// ```
5449 pub fn set_page_refs<T, V>(mut self, v: T) -> Self
5450 where
5451 T: std::iter::IntoIterator<Item = V>,
5452 V: std::convert::Into<crate::model::document::page_anchor::PageRef>,
5453 {
5454 use std::iter::Iterator;
5455 self.page_refs = v.into_iter().map(|i| i.into()).collect();
5456 self
5457 }
5458 }
5459
5460 impl wkt::message::Message for PageAnchor {
5461 fn typename() -> &'static str {
5462 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor"
5463 }
5464 }
5465
5466 /// Defines additional types related to [PageAnchor].
5467 pub mod page_anchor {
5468 #[allow(unused_imports)]
5469 use super::*;
5470
5471 /// Represents a weak reference to a page element within a document.
5472 #[derive(Clone, Default, PartialEq)]
5473 #[non_exhaustive]
5474 pub struct PageRef {
5475 /// Required. Index into the
5476 /// [Document.pages][google.cloud.documentai.v1.Document.pages] element,
5477 /// for example using
5478 /// `[Document.pages][page_refs.page]` to locate the related page element.
5479 /// This field is skipped when its value is the default `0`. See
5480 /// <https://developers.google.com/protocol-buffers/docs/proto3#json>.
5481 ///
5482 /// [google.cloud.documentai.v1.Document.pages]: crate::model::Document::pages
5483 pub page: i64,
5484
5485 /// Optional. The type of the layout element that is being referenced if
5486 /// any.
5487 pub layout_type: crate::model::document::page_anchor::page_ref::LayoutType,
5488
5489 /// Optional. Deprecated. Use
5490 /// [PageRef.bounding_poly][google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]
5491 /// instead.
5492 ///
5493 /// [google.cloud.documentai.v1.Document.PageAnchor.PageRef.bounding_poly]: crate::model::document::page_anchor::PageRef::bounding_poly
5494 #[deprecated]
5495 pub layout_id: std::string::String,
5496
5497 /// Optional. Identifies the bounding polygon of a layout element on the
5498 /// page. If `layout_type` is set, the bounding polygon must be exactly the
5499 /// same to the layout element it's referring to.
5500 pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
5501
5502 /// Optional. Confidence of detected page element, if applicable. Range
5503 /// `[0, 1]`.
5504 pub confidence: f32,
5505
5506 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5507 }
5508
5509 impl PageRef {
5510 /// Creates a new default instance.
5511 pub fn new() -> Self {
5512 std::default::Default::default()
5513 }
5514
5515 /// Sets the value of [page][crate::model::document::page_anchor::PageRef::page].
5516 ///
5517 /// # Example
5518 /// ```ignore,no_run
5519 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5520 /// let x = PageRef::new().set_page(42);
5521 /// ```
5522 pub fn set_page<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
5523 self.page = v.into();
5524 self
5525 }
5526
5527 /// Sets the value of [layout_type][crate::model::document::page_anchor::PageRef::layout_type].
5528 ///
5529 /// # Example
5530 /// ```ignore,no_run
5531 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5532 /// use google_cloud_documentai_v1::model::document::page_anchor::page_ref::LayoutType;
5533 /// let x0 = PageRef::new().set_layout_type(LayoutType::Block);
5534 /// let x1 = PageRef::new().set_layout_type(LayoutType::Paragraph);
5535 /// let x2 = PageRef::new().set_layout_type(LayoutType::Line);
5536 /// ```
5537 pub fn set_layout_type<
5538 T: std::convert::Into<crate::model::document::page_anchor::page_ref::LayoutType>,
5539 >(
5540 mut self,
5541 v: T,
5542 ) -> Self {
5543 self.layout_type = v.into();
5544 self
5545 }
5546
5547 /// Sets the value of [layout_id][crate::model::document::page_anchor::PageRef::layout_id].
5548 ///
5549 /// # Example
5550 /// ```ignore,no_run
5551 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5552 /// let x = PageRef::new().set_layout_id("example");
5553 /// ```
5554 #[deprecated]
5555 pub fn set_layout_id<T: std::convert::Into<std::string::String>>(
5556 mut self,
5557 v: T,
5558 ) -> Self {
5559 self.layout_id = v.into();
5560 self
5561 }
5562
5563 /// Sets the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5564 ///
5565 /// # Example
5566 /// ```ignore,no_run
5567 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5568 /// use google_cloud_documentai_v1::model::BoundingPoly;
5569 /// let x = PageRef::new().set_bounding_poly(BoundingPoly::default()/* use setters */);
5570 /// ```
5571 pub fn set_bounding_poly<T>(mut self, v: T) -> Self
5572 where
5573 T: std::convert::Into<crate::model::BoundingPoly>,
5574 {
5575 self.bounding_poly = std::option::Option::Some(v.into());
5576 self
5577 }
5578
5579 /// Sets or clears the value of [bounding_poly][crate::model::document::page_anchor::PageRef::bounding_poly].
5580 ///
5581 /// # Example
5582 /// ```ignore,no_run
5583 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5584 /// use google_cloud_documentai_v1::model::BoundingPoly;
5585 /// let x = PageRef::new().set_or_clear_bounding_poly(Some(BoundingPoly::default()/* use setters */));
5586 /// let x = PageRef::new().set_or_clear_bounding_poly(None::<BoundingPoly>);
5587 /// ```
5588 pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
5589 where
5590 T: std::convert::Into<crate::model::BoundingPoly>,
5591 {
5592 self.bounding_poly = v.map(|x| x.into());
5593 self
5594 }
5595
5596 /// Sets the value of [confidence][crate::model::document::page_anchor::PageRef::confidence].
5597 ///
5598 /// # Example
5599 /// ```ignore,no_run
5600 /// # use google_cloud_documentai_v1::model::document::page_anchor::PageRef;
5601 /// let x = PageRef::new().set_confidence(42.0);
5602 /// ```
5603 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
5604 self.confidence = v.into();
5605 self
5606 }
5607 }
5608
5609 impl wkt::message::Message for PageRef {
5610 fn typename() -> &'static str {
5611 "type.googleapis.com/google.cloud.documentai.v1.Document.PageAnchor.PageRef"
5612 }
5613 }
5614
5615 /// Defines additional types related to [PageRef].
5616 pub mod page_ref {
5617 #[allow(unused_imports)]
5618 use super::*;
5619
5620 /// The type of layout that is being referenced.
5621 ///
5622 /// # Working with unknown values
5623 ///
5624 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5625 /// additional enum variants at any time. Adding new variants is not considered
5626 /// a breaking change. Applications should write their code in anticipation of:
5627 ///
5628 /// - New values appearing in future releases of the client library, **and**
5629 /// - New values received dynamically, without application changes.
5630 ///
5631 /// Please consult the [Working with enums] section in the user guide for some
5632 /// guidelines.
5633 ///
5634 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
5635 #[derive(Clone, Debug, PartialEq)]
5636 #[non_exhaustive]
5637 pub enum LayoutType {
5638 /// Layout Unspecified.
5639 Unspecified,
5640 /// References a
5641 /// [Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
5642 /// element.
5643 ///
5644 /// [google.cloud.documentai.v1.Document.Page.blocks]: crate::model::document::Page::blocks
5645 Block,
5646 /// References a
5647 /// [Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
5648 /// element.
5649 ///
5650 /// [google.cloud.documentai.v1.Document.Page.paragraphs]: crate::model::document::Page::paragraphs
5651 Paragraph,
5652 /// References a
5653 /// [Page.lines][google.cloud.documentai.v1.Document.Page.lines] element.
5654 ///
5655 /// [google.cloud.documentai.v1.Document.Page.lines]: crate::model::document::Page::lines
5656 Line,
5657 /// References a
5658 /// [Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
5659 /// element.
5660 ///
5661 /// [google.cloud.documentai.v1.Document.Page.tokens]: crate::model::document::Page::tokens
5662 Token,
5663 /// References a
5664 /// [Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
5665 /// element.
5666 ///
5667 /// [google.cloud.documentai.v1.Document.Page.visual_elements]: crate::model::document::Page::visual_elements
5668 VisualElement,
5669 /// Refrrences a
5670 /// [Page.tables][google.cloud.documentai.v1.Document.Page.tables]
5671 /// element.
5672 ///
5673 /// [google.cloud.documentai.v1.Document.Page.tables]: crate::model::document::Page::tables
5674 Table,
5675 /// References a
5676 /// [Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
5677 /// element.
5678 ///
5679 /// [google.cloud.documentai.v1.Document.Page.form_fields]: crate::model::document::Page::form_fields
5680 FormField,
5681 /// If set, the enum was initialized with an unknown value.
5682 ///
5683 /// Applications can examine the value using [LayoutType::value] or
5684 /// [LayoutType::name].
5685 UnknownValue(layout_type::UnknownValue),
5686 }
5687
5688 #[doc(hidden)]
5689 pub mod layout_type {
5690 #[allow(unused_imports)]
5691 use super::*;
5692 #[derive(Clone, Debug, PartialEq)]
5693 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5694 }
5695
5696 impl LayoutType {
5697 /// Gets the enum value.
5698 ///
5699 /// Returns `None` if the enum contains an unknown value deserialized from
5700 /// the string representation of enums.
5701 pub fn value(&self) -> std::option::Option<i32> {
5702 match self {
5703 Self::Unspecified => std::option::Option::Some(0),
5704 Self::Block => std::option::Option::Some(1),
5705 Self::Paragraph => std::option::Option::Some(2),
5706 Self::Line => std::option::Option::Some(3),
5707 Self::Token => std::option::Option::Some(4),
5708 Self::VisualElement => std::option::Option::Some(5),
5709 Self::Table => std::option::Option::Some(6),
5710 Self::FormField => std::option::Option::Some(7),
5711 Self::UnknownValue(u) => u.0.value(),
5712 }
5713 }
5714
5715 /// Gets the enum value as a string.
5716 ///
5717 /// Returns `None` if the enum contains an unknown value deserialized from
5718 /// the integer representation of enums.
5719 pub fn name(&self) -> std::option::Option<&str> {
5720 match self {
5721 Self::Unspecified => std::option::Option::Some("LAYOUT_TYPE_UNSPECIFIED"),
5722 Self::Block => std::option::Option::Some("BLOCK"),
5723 Self::Paragraph => std::option::Option::Some("PARAGRAPH"),
5724 Self::Line => std::option::Option::Some("LINE"),
5725 Self::Token => std::option::Option::Some("TOKEN"),
5726 Self::VisualElement => std::option::Option::Some("VISUAL_ELEMENT"),
5727 Self::Table => std::option::Option::Some("TABLE"),
5728 Self::FormField => std::option::Option::Some("FORM_FIELD"),
5729 Self::UnknownValue(u) => u.0.name(),
5730 }
5731 }
5732 }
5733
5734 impl std::default::Default for LayoutType {
5735 fn default() -> Self {
5736 use std::convert::From;
5737 Self::from(0)
5738 }
5739 }
5740
5741 impl std::fmt::Display for LayoutType {
5742 fn fmt(
5743 &self,
5744 f: &mut std::fmt::Formatter<'_>,
5745 ) -> std::result::Result<(), std::fmt::Error> {
5746 wkt::internal::display_enum(f, self.name(), self.value())
5747 }
5748 }
5749
5750 impl std::convert::From<i32> for LayoutType {
5751 fn from(value: i32) -> Self {
5752 match value {
5753 0 => Self::Unspecified,
5754 1 => Self::Block,
5755 2 => Self::Paragraph,
5756 3 => Self::Line,
5757 4 => Self::Token,
5758 5 => Self::VisualElement,
5759 6 => Self::Table,
5760 7 => Self::FormField,
5761 _ => Self::UnknownValue(layout_type::UnknownValue(
5762 wkt::internal::UnknownEnumValue::Integer(value),
5763 )),
5764 }
5765 }
5766 }
5767
5768 impl std::convert::From<&str> for LayoutType {
5769 fn from(value: &str) -> Self {
5770 use std::string::ToString;
5771 match value {
5772 "LAYOUT_TYPE_UNSPECIFIED" => Self::Unspecified,
5773 "BLOCK" => Self::Block,
5774 "PARAGRAPH" => Self::Paragraph,
5775 "LINE" => Self::Line,
5776 "TOKEN" => Self::Token,
5777 "VISUAL_ELEMENT" => Self::VisualElement,
5778 "TABLE" => Self::Table,
5779 "FORM_FIELD" => Self::FormField,
5780 _ => Self::UnknownValue(layout_type::UnknownValue(
5781 wkt::internal::UnknownEnumValue::String(value.to_string()),
5782 )),
5783 }
5784 }
5785 }
5786
5787 impl serde::ser::Serialize for LayoutType {
5788 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
5789 where
5790 S: serde::Serializer,
5791 {
5792 match self {
5793 Self::Unspecified => serializer.serialize_i32(0),
5794 Self::Block => serializer.serialize_i32(1),
5795 Self::Paragraph => serializer.serialize_i32(2),
5796 Self::Line => serializer.serialize_i32(3),
5797 Self::Token => serializer.serialize_i32(4),
5798 Self::VisualElement => serializer.serialize_i32(5),
5799 Self::Table => serializer.serialize_i32(6),
5800 Self::FormField => serializer.serialize_i32(7),
5801 Self::UnknownValue(u) => u.0.serialize(serializer),
5802 }
5803 }
5804 }
5805
5806 impl<'de> serde::de::Deserialize<'de> for LayoutType {
5807 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5808 where
5809 D: serde::Deserializer<'de>,
5810 {
5811 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LayoutType>::new(
5812 ".google.cloud.documentai.v1.Document.PageAnchor.PageRef.LayoutType",
5813 ))
5814 }
5815 }
5816 }
5817 }
5818
5819 /// Structure to identify provenance relationships between annotations in
5820 /// different revisions.
5821 #[derive(Clone, Default, PartialEq)]
5822 #[non_exhaustive]
5823 pub struct Provenance {
5824 /// The index of the revision that produced this element.
5825 #[deprecated]
5826 pub revision: i32,
5827
5828 /// The Id of this operation. Needs to be unique within the scope of the
5829 /// revision.
5830 #[deprecated]
5831 pub id: i32,
5832
5833 /// References to the original elements that are replaced.
5834 pub parents: std::vec::Vec<crate::model::document::provenance::Parent>,
5835
5836 /// The type of provenance operation.
5837 pub r#type: crate::model::document::provenance::OperationType,
5838
5839 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5840 }
5841
5842 impl Provenance {
5843 /// Creates a new default instance.
5844 pub fn new() -> Self {
5845 std::default::Default::default()
5846 }
5847
5848 /// Sets the value of [revision][crate::model::document::Provenance::revision].
5849 ///
5850 /// # Example
5851 /// ```ignore,no_run
5852 /// # use google_cloud_documentai_v1::model::document::Provenance;
5853 /// let x = Provenance::new().set_revision(42);
5854 /// ```
5855 #[deprecated]
5856 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5857 self.revision = v.into();
5858 self
5859 }
5860
5861 /// Sets the value of [id][crate::model::document::Provenance::id].
5862 ///
5863 /// # Example
5864 /// ```ignore,no_run
5865 /// # use google_cloud_documentai_v1::model::document::Provenance;
5866 /// let x = Provenance::new().set_id(42);
5867 /// ```
5868 #[deprecated]
5869 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5870 self.id = v.into();
5871 self
5872 }
5873
5874 /// Sets the value of [parents][crate::model::document::Provenance::parents].
5875 ///
5876 /// # Example
5877 /// ```ignore,no_run
5878 /// # use google_cloud_documentai_v1::model::document::Provenance;
5879 /// use google_cloud_documentai_v1::model::document::provenance::Parent;
5880 /// let x = Provenance::new()
5881 /// .set_parents([
5882 /// Parent::default()/* use setters */,
5883 /// Parent::default()/* use (different) setters */,
5884 /// ]);
5885 /// ```
5886 pub fn set_parents<T, V>(mut self, v: T) -> Self
5887 where
5888 T: std::iter::IntoIterator<Item = V>,
5889 V: std::convert::Into<crate::model::document::provenance::Parent>,
5890 {
5891 use std::iter::Iterator;
5892 self.parents = v.into_iter().map(|i| i.into()).collect();
5893 self
5894 }
5895
5896 /// Sets the value of [r#type][crate::model::document::Provenance::type].
5897 ///
5898 /// # Example
5899 /// ```ignore,no_run
5900 /// # use google_cloud_documentai_v1::model::document::Provenance;
5901 /// use google_cloud_documentai_v1::model::document::provenance::OperationType;
5902 /// let x0 = Provenance::new().set_type(OperationType::Add);
5903 /// let x1 = Provenance::new().set_type(OperationType::Remove);
5904 /// let x2 = Provenance::new().set_type(OperationType::Update);
5905 /// ```
5906 pub fn set_type<
5907 T: std::convert::Into<crate::model::document::provenance::OperationType>,
5908 >(
5909 mut self,
5910 v: T,
5911 ) -> Self {
5912 self.r#type = v.into();
5913 self
5914 }
5915 }
5916
5917 impl wkt::message::Message for Provenance {
5918 fn typename() -> &'static str {
5919 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance"
5920 }
5921 }
5922
5923 /// Defines additional types related to [Provenance].
5924 pub mod provenance {
5925 #[allow(unused_imports)]
5926 use super::*;
5927
5928 /// The parent element the current element is based on. Used for
5929 /// referencing/aligning, removal and replacement operations.
5930 #[derive(Clone, Default, PartialEq)]
5931 #[non_exhaustive]
5932 pub struct Parent {
5933 /// The index of the index into current revision's parent_ids list.
5934 pub revision: i32,
5935
5936 /// The index of the parent item in the corresponding item list (eg. list
5937 /// of entities, properties within entities, etc.) in the parent revision.
5938 pub index: i32,
5939
5940 /// The id of the parent provenance.
5941 #[deprecated]
5942 pub id: i32,
5943
5944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5945 }
5946
5947 impl Parent {
5948 /// Creates a new default instance.
5949 pub fn new() -> Self {
5950 std::default::Default::default()
5951 }
5952
5953 /// Sets the value of [revision][crate::model::document::provenance::Parent::revision].
5954 ///
5955 /// # Example
5956 /// ```ignore,no_run
5957 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5958 /// let x = Parent::new().set_revision(42);
5959 /// ```
5960 pub fn set_revision<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5961 self.revision = v.into();
5962 self
5963 }
5964
5965 /// Sets the value of [index][crate::model::document::provenance::Parent::index].
5966 ///
5967 /// # Example
5968 /// ```ignore,no_run
5969 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5970 /// let x = Parent::new().set_index(42);
5971 /// ```
5972 pub fn set_index<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5973 self.index = v.into();
5974 self
5975 }
5976
5977 /// Sets the value of [id][crate::model::document::provenance::Parent::id].
5978 ///
5979 /// # Example
5980 /// ```ignore,no_run
5981 /// # use google_cloud_documentai_v1::model::document::provenance::Parent;
5982 /// let x = Parent::new().set_id(42);
5983 /// ```
5984 #[deprecated]
5985 pub fn set_id<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5986 self.id = v.into();
5987 self
5988 }
5989 }
5990
5991 impl wkt::message::Message for Parent {
5992 fn typename() -> &'static str {
5993 "type.googleapis.com/google.cloud.documentai.v1.Document.Provenance.Parent"
5994 }
5995 }
5996
5997 /// If a processor or agent does an explicit operation on existing elements.
5998 ///
5999 /// # Working with unknown values
6000 ///
6001 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6002 /// additional enum variants at any time. Adding new variants is not considered
6003 /// a breaking change. Applications should write their code in anticipation of:
6004 ///
6005 /// - New values appearing in future releases of the client library, **and**
6006 /// - New values received dynamically, without application changes.
6007 ///
6008 /// Please consult the [Working with enums] section in the user guide for some
6009 /// guidelines.
6010 ///
6011 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
6012 #[derive(Clone, Debug, PartialEq)]
6013 #[non_exhaustive]
6014 pub enum OperationType {
6015 /// Operation type unspecified. If no operation is specified a provenance
6016 /// entry is simply used to match against a `parent`.
6017 Unspecified,
6018 /// Add an element.
6019 Add,
6020 /// Remove an element identified by `parent`.
6021 Remove,
6022 /// Updates any fields within the given provenance scope of the message. It
6023 /// overwrites the fields rather than replacing them. Use this when you
6024 /// want to update a field value of an entity without also updating all the
6025 /// child properties.
6026 Update,
6027 /// Currently unused. Replace an element identified by `parent`.
6028 Replace,
6029 /// Deprecated. Request human review for the element identified by
6030 /// `parent`.
6031 #[deprecated]
6032 EvalRequested,
6033 /// Deprecated. Element is reviewed and approved at human review,
6034 /// confidence will be set to 1.0.
6035 #[deprecated]
6036 EvalApproved,
6037 /// Deprecated. Element is skipped in the validation process.
6038 #[deprecated]
6039 EvalSkipped,
6040 /// If set, the enum was initialized with an unknown value.
6041 ///
6042 /// Applications can examine the value using [OperationType::value] or
6043 /// [OperationType::name].
6044 UnknownValue(operation_type::UnknownValue),
6045 }
6046
6047 #[doc(hidden)]
6048 pub mod operation_type {
6049 #[allow(unused_imports)]
6050 use super::*;
6051 #[derive(Clone, Debug, PartialEq)]
6052 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6053 }
6054
6055 impl OperationType {
6056 /// Gets the enum value.
6057 ///
6058 /// Returns `None` if the enum contains an unknown value deserialized from
6059 /// the string representation of enums.
6060 pub fn value(&self) -> std::option::Option<i32> {
6061 match self {
6062 Self::Unspecified => std::option::Option::Some(0),
6063 Self::Add => std::option::Option::Some(1),
6064 Self::Remove => std::option::Option::Some(2),
6065 Self::Update => std::option::Option::Some(7),
6066 Self::Replace => std::option::Option::Some(3),
6067 Self::EvalRequested => std::option::Option::Some(4),
6068 Self::EvalApproved => std::option::Option::Some(5),
6069 Self::EvalSkipped => std::option::Option::Some(6),
6070 Self::UnknownValue(u) => u.0.value(),
6071 }
6072 }
6073
6074 /// Gets the enum value as a string.
6075 ///
6076 /// Returns `None` if the enum contains an unknown value deserialized from
6077 /// the integer representation of enums.
6078 pub fn name(&self) -> std::option::Option<&str> {
6079 match self {
6080 Self::Unspecified => std::option::Option::Some("OPERATION_TYPE_UNSPECIFIED"),
6081 Self::Add => std::option::Option::Some("ADD"),
6082 Self::Remove => std::option::Option::Some("REMOVE"),
6083 Self::Update => std::option::Option::Some("UPDATE"),
6084 Self::Replace => std::option::Option::Some("REPLACE"),
6085 Self::EvalRequested => std::option::Option::Some("EVAL_REQUESTED"),
6086 Self::EvalApproved => std::option::Option::Some("EVAL_APPROVED"),
6087 Self::EvalSkipped => std::option::Option::Some("EVAL_SKIPPED"),
6088 Self::UnknownValue(u) => u.0.name(),
6089 }
6090 }
6091 }
6092
6093 impl std::default::Default for OperationType {
6094 fn default() -> Self {
6095 use std::convert::From;
6096 Self::from(0)
6097 }
6098 }
6099
6100 impl std::fmt::Display for OperationType {
6101 fn fmt(
6102 &self,
6103 f: &mut std::fmt::Formatter<'_>,
6104 ) -> std::result::Result<(), std::fmt::Error> {
6105 wkt::internal::display_enum(f, self.name(), self.value())
6106 }
6107 }
6108
6109 impl std::convert::From<i32> for OperationType {
6110 fn from(value: i32) -> Self {
6111 match value {
6112 0 => Self::Unspecified,
6113 1 => Self::Add,
6114 2 => Self::Remove,
6115 3 => Self::Replace,
6116 4 => Self::EvalRequested,
6117 5 => Self::EvalApproved,
6118 6 => Self::EvalSkipped,
6119 7 => Self::Update,
6120 _ => Self::UnknownValue(operation_type::UnknownValue(
6121 wkt::internal::UnknownEnumValue::Integer(value),
6122 )),
6123 }
6124 }
6125 }
6126
6127 impl std::convert::From<&str> for OperationType {
6128 fn from(value: &str) -> Self {
6129 use std::string::ToString;
6130 match value {
6131 "OPERATION_TYPE_UNSPECIFIED" => Self::Unspecified,
6132 "ADD" => Self::Add,
6133 "REMOVE" => Self::Remove,
6134 "UPDATE" => Self::Update,
6135 "REPLACE" => Self::Replace,
6136 "EVAL_REQUESTED" => Self::EvalRequested,
6137 "EVAL_APPROVED" => Self::EvalApproved,
6138 "EVAL_SKIPPED" => Self::EvalSkipped,
6139 _ => Self::UnknownValue(operation_type::UnknownValue(
6140 wkt::internal::UnknownEnumValue::String(value.to_string()),
6141 )),
6142 }
6143 }
6144 }
6145
6146 impl serde::ser::Serialize for OperationType {
6147 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6148 where
6149 S: serde::Serializer,
6150 {
6151 match self {
6152 Self::Unspecified => serializer.serialize_i32(0),
6153 Self::Add => serializer.serialize_i32(1),
6154 Self::Remove => serializer.serialize_i32(2),
6155 Self::Update => serializer.serialize_i32(7),
6156 Self::Replace => serializer.serialize_i32(3),
6157 Self::EvalRequested => serializer.serialize_i32(4),
6158 Self::EvalApproved => serializer.serialize_i32(5),
6159 Self::EvalSkipped => serializer.serialize_i32(6),
6160 Self::UnknownValue(u) => u.0.serialize(serializer),
6161 }
6162 }
6163 }
6164
6165 impl<'de> serde::de::Deserialize<'de> for OperationType {
6166 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6167 where
6168 D: serde::Deserializer<'de>,
6169 {
6170 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OperationType>::new(
6171 ".google.cloud.documentai.v1.Document.Provenance.OperationType",
6172 ))
6173 }
6174 }
6175 }
6176
6177 /// Contains past or forward revisions of this document.
6178 #[derive(Clone, Default, PartialEq)]
6179 #[non_exhaustive]
6180 pub struct Revision {
6181 /// Id of the revision, internally generated by doc proto storage.
6182 /// Unique within the context of the document.
6183 pub id: std::string::String,
6184
6185 /// The revisions that this revision is based on. This can include one or
6186 /// more parent (when documents are merged.) This field represents the
6187 /// index into the `revisions` field.
6188 #[deprecated]
6189 pub parent: std::vec::Vec<i32>,
6190
6191 /// The revisions that this revision is based on. Must include all the ids
6192 /// that have anything to do with this revision - eg. there are
6193 /// `provenance.parent.revision` fields that index into this field.
6194 pub parent_ids: std::vec::Vec<std::string::String>,
6195
6196 /// The time that the revision was created, internally generated by
6197 /// doc proto storage at the time of create.
6198 pub create_time: std::option::Option<wkt::Timestamp>,
6199
6200 /// Human Review information of this revision.
6201 pub human_review: std::option::Option<crate::model::document::revision::HumanReview>,
6202
6203 /// Who/what made the change
6204 pub source: std::option::Option<crate::model::document::revision::Source>,
6205
6206 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6207 }
6208
6209 impl Revision {
6210 /// Creates a new default instance.
6211 pub fn new() -> Self {
6212 std::default::Default::default()
6213 }
6214
6215 /// Sets the value of [id][crate::model::document::Revision::id].
6216 ///
6217 /// # Example
6218 /// ```ignore,no_run
6219 /// # use google_cloud_documentai_v1::model::document::Revision;
6220 /// let x = Revision::new().set_id("example");
6221 /// ```
6222 pub fn set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6223 self.id = v.into();
6224 self
6225 }
6226
6227 /// Sets the value of [parent][crate::model::document::Revision::parent].
6228 ///
6229 /// # Example
6230 /// ```ignore,no_run
6231 /// # use google_cloud_documentai_v1::model::document::Revision;
6232 /// let x = Revision::new().set_parent([1, 2, 3]);
6233 /// ```
6234 #[deprecated]
6235 pub fn set_parent<T, V>(mut self, v: T) -> Self
6236 where
6237 T: std::iter::IntoIterator<Item = V>,
6238 V: std::convert::Into<i32>,
6239 {
6240 use std::iter::Iterator;
6241 self.parent = v.into_iter().map(|i| i.into()).collect();
6242 self
6243 }
6244
6245 /// Sets the value of [parent_ids][crate::model::document::Revision::parent_ids].
6246 ///
6247 /// # Example
6248 /// ```ignore,no_run
6249 /// # use google_cloud_documentai_v1::model::document::Revision;
6250 /// let x = Revision::new().set_parent_ids(["a", "b", "c"]);
6251 /// ```
6252 pub fn set_parent_ids<T, V>(mut self, v: T) -> Self
6253 where
6254 T: std::iter::IntoIterator<Item = V>,
6255 V: std::convert::Into<std::string::String>,
6256 {
6257 use std::iter::Iterator;
6258 self.parent_ids = v.into_iter().map(|i| i.into()).collect();
6259 self
6260 }
6261
6262 /// Sets the value of [create_time][crate::model::document::Revision::create_time].
6263 ///
6264 /// # Example
6265 /// ```ignore,no_run
6266 /// # use google_cloud_documentai_v1::model::document::Revision;
6267 /// use wkt::Timestamp;
6268 /// let x = Revision::new().set_create_time(Timestamp::default()/* use setters */);
6269 /// ```
6270 pub fn set_create_time<T>(mut self, v: T) -> Self
6271 where
6272 T: std::convert::Into<wkt::Timestamp>,
6273 {
6274 self.create_time = std::option::Option::Some(v.into());
6275 self
6276 }
6277
6278 /// Sets or clears the value of [create_time][crate::model::document::Revision::create_time].
6279 ///
6280 /// # Example
6281 /// ```ignore,no_run
6282 /// # use google_cloud_documentai_v1::model::document::Revision;
6283 /// use wkt::Timestamp;
6284 /// let x = Revision::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
6285 /// let x = Revision::new().set_or_clear_create_time(None::<Timestamp>);
6286 /// ```
6287 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
6288 where
6289 T: std::convert::Into<wkt::Timestamp>,
6290 {
6291 self.create_time = v.map(|x| x.into());
6292 self
6293 }
6294
6295 /// Sets the value of [human_review][crate::model::document::Revision::human_review].
6296 ///
6297 /// # Example
6298 /// ```ignore,no_run
6299 /// # use google_cloud_documentai_v1::model::document::Revision;
6300 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6301 /// let x = Revision::new().set_human_review(HumanReview::default()/* use setters */);
6302 /// ```
6303 pub fn set_human_review<T>(mut self, v: T) -> Self
6304 where
6305 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6306 {
6307 self.human_review = std::option::Option::Some(v.into());
6308 self
6309 }
6310
6311 /// Sets or clears the value of [human_review][crate::model::document::Revision::human_review].
6312 ///
6313 /// # Example
6314 /// ```ignore,no_run
6315 /// # use google_cloud_documentai_v1::model::document::Revision;
6316 /// use google_cloud_documentai_v1::model::document::revision::HumanReview;
6317 /// let x = Revision::new().set_or_clear_human_review(Some(HumanReview::default()/* use setters */));
6318 /// let x = Revision::new().set_or_clear_human_review(None::<HumanReview>);
6319 /// ```
6320 pub fn set_or_clear_human_review<T>(mut self, v: std::option::Option<T>) -> Self
6321 where
6322 T: std::convert::Into<crate::model::document::revision::HumanReview>,
6323 {
6324 self.human_review = v.map(|x| x.into());
6325 self
6326 }
6327
6328 /// Sets the value of [source][crate::model::document::Revision::source].
6329 ///
6330 /// Note that all the setters affecting `source` are mutually
6331 /// exclusive.
6332 ///
6333 /// # Example
6334 /// ```ignore,no_run
6335 /// # use google_cloud_documentai_v1::model::document::Revision;
6336 /// use google_cloud_documentai_v1::model::document::revision::Source;
6337 /// let x = Revision::new().set_source(Some(Source::Agent("example".to_string())));
6338 /// ```
6339 pub fn set_source<
6340 T: std::convert::Into<std::option::Option<crate::model::document::revision::Source>>,
6341 >(
6342 mut self,
6343 v: T,
6344 ) -> Self {
6345 self.source = v.into();
6346 self
6347 }
6348
6349 /// The value of [source][crate::model::document::Revision::source]
6350 /// if it holds a `Agent`, `None` if the field is not set or
6351 /// holds a different branch.
6352 pub fn agent(&self) -> std::option::Option<&std::string::String> {
6353 #[allow(unreachable_patterns)]
6354 self.source.as_ref().and_then(|v| match v {
6355 crate::model::document::revision::Source::Agent(v) => std::option::Option::Some(v),
6356 _ => std::option::Option::None,
6357 })
6358 }
6359
6360 /// Sets the value of [source][crate::model::document::Revision::source]
6361 /// to hold a `Agent`.
6362 ///
6363 /// Note that all the setters affecting `source` are
6364 /// mutually exclusive.
6365 ///
6366 /// # Example
6367 /// ```ignore,no_run
6368 /// # use google_cloud_documentai_v1::model::document::Revision;
6369 /// let x = Revision::new().set_agent("example");
6370 /// assert!(x.agent().is_some());
6371 /// assert!(x.processor().is_none());
6372 /// ```
6373 pub fn set_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6374 self.source = std::option::Option::Some(
6375 crate::model::document::revision::Source::Agent(v.into()),
6376 );
6377 self
6378 }
6379
6380 /// The value of [source][crate::model::document::Revision::source]
6381 /// if it holds a `Processor`, `None` if the field is not set or
6382 /// holds a different branch.
6383 pub fn processor(&self) -> std::option::Option<&std::string::String> {
6384 #[allow(unreachable_patterns)]
6385 self.source.as_ref().and_then(|v| match v {
6386 crate::model::document::revision::Source::Processor(v) => {
6387 std::option::Option::Some(v)
6388 }
6389 _ => std::option::Option::None,
6390 })
6391 }
6392
6393 /// Sets the value of [source][crate::model::document::Revision::source]
6394 /// to hold a `Processor`.
6395 ///
6396 /// Note that all the setters affecting `source` are
6397 /// mutually exclusive.
6398 ///
6399 /// # Example
6400 /// ```ignore,no_run
6401 /// # use google_cloud_documentai_v1::model::document::Revision;
6402 /// let x = Revision::new().set_processor("example");
6403 /// assert!(x.processor().is_some());
6404 /// assert!(x.agent().is_none());
6405 /// ```
6406 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6407 self.source = std::option::Option::Some(
6408 crate::model::document::revision::Source::Processor(v.into()),
6409 );
6410 self
6411 }
6412 }
6413
6414 impl wkt::message::Message for Revision {
6415 fn typename() -> &'static str {
6416 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision"
6417 }
6418 }
6419
6420 /// Defines additional types related to [Revision].
6421 pub mod revision {
6422 #[allow(unused_imports)]
6423 use super::*;
6424
6425 /// Human Review information of the document.
6426 #[derive(Clone, Default, PartialEq)]
6427 #[non_exhaustive]
6428 pub struct HumanReview {
6429 /// Human review state. For example, `requested`, `succeeded`, `rejected`.
6430 pub state: std::string::String,
6431
6432 /// A message providing more details about the current state of processing.
6433 /// For example, the rejection reason when the state is `rejected`.
6434 pub state_message: std::string::String,
6435
6436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6437 }
6438
6439 impl HumanReview {
6440 /// Creates a new default instance.
6441 pub fn new() -> Self {
6442 std::default::Default::default()
6443 }
6444
6445 /// Sets the value of [state][crate::model::document::revision::HumanReview::state].
6446 ///
6447 /// # Example
6448 /// ```ignore,no_run
6449 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6450 /// let x = HumanReview::new().set_state("example");
6451 /// ```
6452 pub fn set_state<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6453 self.state = v.into();
6454 self
6455 }
6456
6457 /// Sets the value of [state_message][crate::model::document::revision::HumanReview::state_message].
6458 ///
6459 /// # Example
6460 /// ```ignore,no_run
6461 /// # use google_cloud_documentai_v1::model::document::revision::HumanReview;
6462 /// let x = HumanReview::new().set_state_message("example");
6463 /// ```
6464 pub fn set_state_message<T: std::convert::Into<std::string::String>>(
6465 mut self,
6466 v: T,
6467 ) -> Self {
6468 self.state_message = v.into();
6469 self
6470 }
6471 }
6472
6473 impl wkt::message::Message for HumanReview {
6474 fn typename() -> &'static str {
6475 "type.googleapis.com/google.cloud.documentai.v1.Document.Revision.HumanReview"
6476 }
6477 }
6478
6479 /// Who/what made the change
6480 #[derive(Clone, Debug, PartialEq)]
6481 #[non_exhaustive]
6482 pub enum Source {
6483 /// If the change was made by a person specify the name or id of that
6484 /// person.
6485 Agent(std::string::String),
6486 /// If the annotation was made by processor identify the processor by its
6487 /// resource name.
6488 Processor(std::string::String),
6489 }
6490 }
6491
6492 /// This message is used for text changes aka. OCR corrections.
6493 #[derive(Clone, Default, PartialEq)]
6494 #[non_exhaustive]
6495 pub struct TextChange {
6496 /// Provenance of the correction.
6497 /// Text anchor indexing into the
6498 /// [Document.text][google.cloud.documentai.v1.Document.text]. There can
6499 /// only be a single `TextAnchor.text_segments` element. If the start and
6500 /// end index of the text segment are the same, the text change is inserted
6501 /// before that index.
6502 ///
6503 /// [google.cloud.documentai.v1.Document.text]: crate::model::Document::text
6504 pub text_anchor: std::option::Option<crate::model::document::TextAnchor>,
6505
6506 /// The text that replaces the text identified in the `text_anchor`.
6507 pub changed_text: std::string::String,
6508
6509 /// The history of this annotation.
6510 #[deprecated]
6511 pub provenance: std::vec::Vec<crate::model::document::Provenance>,
6512
6513 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6514 }
6515
6516 impl TextChange {
6517 /// Creates a new default instance.
6518 pub fn new() -> Self {
6519 std::default::Default::default()
6520 }
6521
6522 /// Sets the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6523 ///
6524 /// # Example
6525 /// ```ignore,no_run
6526 /// # use google_cloud_documentai_v1::model::document::TextChange;
6527 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6528 /// let x = TextChange::new().set_text_anchor(TextAnchor::default()/* use setters */);
6529 /// ```
6530 pub fn set_text_anchor<T>(mut self, v: T) -> Self
6531 where
6532 T: std::convert::Into<crate::model::document::TextAnchor>,
6533 {
6534 self.text_anchor = std::option::Option::Some(v.into());
6535 self
6536 }
6537
6538 /// Sets or clears the value of [text_anchor][crate::model::document::TextChange::text_anchor].
6539 ///
6540 /// # Example
6541 /// ```ignore,no_run
6542 /// # use google_cloud_documentai_v1::model::document::TextChange;
6543 /// use google_cloud_documentai_v1::model::document::TextAnchor;
6544 /// let x = TextChange::new().set_or_clear_text_anchor(Some(TextAnchor::default()/* use setters */));
6545 /// let x = TextChange::new().set_or_clear_text_anchor(None::<TextAnchor>);
6546 /// ```
6547 pub fn set_or_clear_text_anchor<T>(mut self, v: std::option::Option<T>) -> Self
6548 where
6549 T: std::convert::Into<crate::model::document::TextAnchor>,
6550 {
6551 self.text_anchor = v.map(|x| x.into());
6552 self
6553 }
6554
6555 /// Sets the value of [changed_text][crate::model::document::TextChange::changed_text].
6556 ///
6557 /// # Example
6558 /// ```ignore,no_run
6559 /// # use google_cloud_documentai_v1::model::document::TextChange;
6560 /// let x = TextChange::new().set_changed_text("example");
6561 /// ```
6562 pub fn set_changed_text<T: std::convert::Into<std::string::String>>(
6563 mut self,
6564 v: T,
6565 ) -> Self {
6566 self.changed_text = v.into();
6567 self
6568 }
6569
6570 /// Sets the value of [provenance][crate::model::document::TextChange::provenance].
6571 ///
6572 /// # Example
6573 /// ```ignore,no_run
6574 /// # use google_cloud_documentai_v1::model::document::TextChange;
6575 /// use google_cloud_documentai_v1::model::document::Provenance;
6576 /// let x = TextChange::new()
6577 /// .set_provenance([
6578 /// Provenance::default()/* use setters */,
6579 /// Provenance::default()/* use (different) setters */,
6580 /// ]);
6581 /// ```
6582 #[deprecated]
6583 pub fn set_provenance<T, V>(mut self, v: T) -> Self
6584 where
6585 T: std::iter::IntoIterator<Item = V>,
6586 V: std::convert::Into<crate::model::document::Provenance>,
6587 {
6588 use std::iter::Iterator;
6589 self.provenance = v.into_iter().map(|i| i.into()).collect();
6590 self
6591 }
6592 }
6593
6594 impl wkt::message::Message for TextChange {
6595 fn typename() -> &'static str {
6596 "type.googleapis.com/google.cloud.documentai.v1.Document.TextChange"
6597 }
6598 }
6599
6600 /// Represents the annotation of a block or a chunk.
6601 #[derive(Clone, Default, PartialEq)]
6602 #[non_exhaustive]
6603 pub struct Annotations {
6604 /// The description of the content with this annotation.
6605 pub description: std::string::String,
6606
6607 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6608 }
6609
6610 impl Annotations {
6611 /// Creates a new default instance.
6612 pub fn new() -> Self {
6613 std::default::Default::default()
6614 }
6615
6616 /// Sets the value of [description][crate::model::document::Annotations::description].
6617 ///
6618 /// # Example
6619 /// ```ignore,no_run
6620 /// # use google_cloud_documentai_v1::model::document::Annotations;
6621 /// let x = Annotations::new().set_description("example");
6622 /// ```
6623 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6624 self.description = v.into();
6625 self
6626 }
6627 }
6628
6629 impl wkt::message::Message for Annotations {
6630 fn typename() -> &'static str {
6631 "type.googleapis.com/google.cloud.documentai.v1.Document.Annotations"
6632 }
6633 }
6634
6635 /// Represents the parsed layout of a document as a collection of blocks that
6636 /// the document is divided into.
6637 #[derive(Clone, Default, PartialEq)]
6638 #[non_exhaustive]
6639 pub struct DocumentLayout {
6640 /// List of blocks in the document.
6641 pub blocks: std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
6642
6643 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6644 }
6645
6646 impl DocumentLayout {
6647 /// Creates a new default instance.
6648 pub fn new() -> Self {
6649 std::default::Default::default()
6650 }
6651
6652 /// Sets the value of [blocks][crate::model::document::DocumentLayout::blocks].
6653 ///
6654 /// # Example
6655 /// ```ignore,no_run
6656 /// # use google_cloud_documentai_v1::model::document::DocumentLayout;
6657 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6658 /// let x = DocumentLayout::new()
6659 /// .set_blocks([
6660 /// DocumentLayoutBlock::default()/* use setters */,
6661 /// DocumentLayoutBlock::default()/* use (different) setters */,
6662 /// ]);
6663 /// ```
6664 pub fn set_blocks<T, V>(mut self, v: T) -> Self
6665 where
6666 T: std::iter::IntoIterator<Item = V>,
6667 V: std::convert::Into<crate::model::document::document_layout::DocumentLayoutBlock>,
6668 {
6669 use std::iter::Iterator;
6670 self.blocks = v.into_iter().map(|i| i.into()).collect();
6671 self
6672 }
6673 }
6674
6675 impl wkt::message::Message for DocumentLayout {
6676 fn typename() -> &'static str {
6677 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout"
6678 }
6679 }
6680
6681 /// Defines additional types related to [DocumentLayout].
6682 pub mod document_layout {
6683 #[allow(unused_imports)]
6684 use super::*;
6685
6686 /// Represents a block. A block could be one of the various types (text,
6687 /// table, list) supported.
6688 #[derive(Clone, Default, PartialEq)]
6689 #[non_exhaustive]
6690 pub struct DocumentLayoutBlock {
6691 /// ID of the block.
6692 pub block_id: std::string::String,
6693
6694 /// Page span of the block.
6695 pub page_span: std::option::Option<
6696 crate::model::document::document_layout::document_layout_block::LayoutPageSpan,
6697 >,
6698
6699 /// Identifies the bounding box for the block.
6700 pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6701
6702 #[allow(missing_docs)]
6703 pub block: std::option::Option<
6704 crate::model::document::document_layout::document_layout_block::Block,
6705 >,
6706
6707 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6708 }
6709
6710 impl DocumentLayoutBlock {
6711 /// Creates a new default instance.
6712 pub fn new() -> Self {
6713 std::default::Default::default()
6714 }
6715
6716 /// Sets the value of [block_id][crate::model::document::document_layout::DocumentLayoutBlock::block_id].
6717 ///
6718 /// # Example
6719 /// ```ignore,no_run
6720 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6721 /// let x = DocumentLayoutBlock::new().set_block_id("example");
6722 /// ```
6723 pub fn set_block_id<T: std::convert::Into<std::string::String>>(
6724 mut self,
6725 v: T,
6726 ) -> Self {
6727 self.block_id = v.into();
6728 self
6729 }
6730
6731 /// Sets the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6732 ///
6733 /// # Example
6734 /// ```ignore,no_run
6735 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6736 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6737 /// let x = DocumentLayoutBlock::new().set_page_span(LayoutPageSpan::default()/* use setters */);
6738 /// ```
6739 pub fn set_page_span<T>(mut self, v: T) -> Self
6740 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6741 {
6742 self.page_span = std::option::Option::Some(v.into());
6743 self
6744 }
6745
6746 /// Sets or clears the value of [page_span][crate::model::document::document_layout::DocumentLayoutBlock::page_span].
6747 ///
6748 /// # Example
6749 /// ```ignore,no_run
6750 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6751 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
6752 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(Some(LayoutPageSpan::default()/* use setters */));
6753 /// let x = DocumentLayoutBlock::new().set_or_clear_page_span(None::<LayoutPageSpan>);
6754 /// ```
6755 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
6756 where T: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutPageSpan>
6757 {
6758 self.page_span = v.map(|x| x.into());
6759 self
6760 }
6761
6762 /// Sets the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6763 ///
6764 /// # Example
6765 /// ```ignore,no_run
6766 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6767 /// use google_cloud_documentai_v1::model::BoundingPoly;
6768 /// let x = DocumentLayoutBlock::new().set_bounding_box(BoundingPoly::default()/* use setters */);
6769 /// ```
6770 pub fn set_bounding_box<T>(mut self, v: T) -> Self
6771 where
6772 T: std::convert::Into<crate::model::BoundingPoly>,
6773 {
6774 self.bounding_box = std::option::Option::Some(v.into());
6775 self
6776 }
6777
6778 /// Sets or clears the value of [bounding_box][crate::model::document::document_layout::DocumentLayoutBlock::bounding_box].
6779 ///
6780 /// # Example
6781 /// ```ignore,no_run
6782 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6783 /// use google_cloud_documentai_v1::model::BoundingPoly;
6784 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(Some(BoundingPoly::default()/* use setters */));
6785 /// let x = DocumentLayoutBlock::new().set_or_clear_bounding_box(None::<BoundingPoly>);
6786 /// ```
6787 pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6788 where
6789 T: std::convert::Into<crate::model::BoundingPoly>,
6790 {
6791 self.bounding_box = v.map(|x| x.into());
6792 self
6793 }
6794
6795 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block].
6796 ///
6797 /// Note that all the setters affecting `block` are mutually
6798 /// exclusive.
6799 ///
6800 /// # Example
6801 /// ```ignore,no_run
6802 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6803 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6804 /// let x = DocumentLayoutBlock::new().set_block(Some(
6805 /// google_cloud_documentai_v1::model::document::document_layout::document_layout_block::Block::TextBlock(LayoutTextBlock::default().into())));
6806 /// ```
6807 pub fn set_block<
6808 T: std::convert::Into<
6809 std::option::Option<
6810 crate::model::document::document_layout::document_layout_block::Block,
6811 >,
6812 >,
6813 >(
6814 mut self,
6815 v: T,
6816 ) -> Self {
6817 self.block = v.into();
6818 self
6819 }
6820
6821 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6822 /// if it holds a `TextBlock`, `None` if the field is not set or
6823 /// holds a different branch.
6824 pub fn text_block(
6825 &self,
6826 ) -> std::option::Option<
6827 &std::boxed::Box<
6828 crate::model::document::document_layout::document_layout_block::LayoutTextBlock,
6829 >,
6830 > {
6831 #[allow(unreachable_patterns)]
6832 self.block.as_ref().and_then(|v| match v {
6833 crate::model::document::document_layout::document_layout_block::Block::TextBlock(v) => std::option::Option::Some(v),
6834 _ => std::option::Option::None,
6835 })
6836 }
6837
6838 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6839 /// to hold a `TextBlock`.
6840 ///
6841 /// Note that all the setters affecting `block` are
6842 /// mutually exclusive.
6843 ///
6844 /// # Example
6845 /// ```ignore,no_run
6846 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6847 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
6848 /// let x = DocumentLayoutBlock::new().set_text_block(LayoutTextBlock::default()/* use setters */);
6849 /// assert!(x.text_block().is_some());
6850 /// assert!(x.table_block().is_none());
6851 /// assert!(x.list_block().is_none());
6852 /// assert!(x.image_block().is_none());
6853 /// ```
6854 pub fn set_text_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>>>(mut self, v: T) -> Self{
6855 self.block = std::option::Option::Some(
6856 crate::model::document::document_layout::document_layout_block::Block::TextBlock(
6857 v.into()
6858 )
6859 );
6860 self
6861 }
6862
6863 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6864 /// if it holds a `TableBlock`, `None` if the field is not set or
6865 /// holds a different branch.
6866 pub fn table_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>{
6867 #[allow(unreachable_patterns)]
6868 self.block.as_ref().and_then(|v| match v {
6869 crate::model::document::document_layout::document_layout_block::Block::TableBlock(v) => std::option::Option::Some(v),
6870 _ => std::option::Option::None,
6871 })
6872 }
6873
6874 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6875 /// to hold a `TableBlock`.
6876 ///
6877 /// Note that all the setters affecting `block` are
6878 /// mutually exclusive.
6879 ///
6880 /// # Example
6881 /// ```ignore,no_run
6882 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6883 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
6884 /// let x = DocumentLayoutBlock::new().set_table_block(LayoutTableBlock::default()/* use setters */);
6885 /// assert!(x.table_block().is_some());
6886 /// assert!(x.text_block().is_none());
6887 /// assert!(x.list_block().is_none());
6888 /// assert!(x.image_block().is_none());
6889 /// ```
6890 pub fn set_table_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>>>(mut self, v: T) -> Self{
6891 self.block = std::option::Option::Some(
6892 crate::model::document::document_layout::document_layout_block::Block::TableBlock(
6893 v.into()
6894 )
6895 );
6896 self
6897 }
6898
6899 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6900 /// if it holds a `ListBlock`, `None` if the field is not set or
6901 /// holds a different branch.
6902 pub fn list_block(
6903 &self,
6904 ) -> std::option::Option<
6905 &std::boxed::Box<
6906 crate::model::document::document_layout::document_layout_block::LayoutListBlock,
6907 >,
6908 > {
6909 #[allow(unreachable_patterns)]
6910 self.block.as_ref().and_then(|v| match v {
6911 crate::model::document::document_layout::document_layout_block::Block::ListBlock(v) => std::option::Option::Some(v),
6912 _ => std::option::Option::None,
6913 })
6914 }
6915
6916 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6917 /// to hold a `ListBlock`.
6918 ///
6919 /// Note that all the setters affecting `block` are
6920 /// mutually exclusive.
6921 ///
6922 /// # Example
6923 /// ```ignore,no_run
6924 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6925 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
6926 /// let x = DocumentLayoutBlock::new().set_list_block(LayoutListBlock::default()/* use setters */);
6927 /// assert!(x.list_block().is_some());
6928 /// assert!(x.text_block().is_none());
6929 /// assert!(x.table_block().is_none());
6930 /// assert!(x.image_block().is_none());
6931 /// ```
6932 pub fn set_list_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>>>(mut self, v: T) -> Self{
6933 self.block = std::option::Option::Some(
6934 crate::model::document::document_layout::document_layout_block::Block::ListBlock(
6935 v.into()
6936 )
6937 );
6938 self
6939 }
6940
6941 /// The value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6942 /// if it holds a `ImageBlock`, `None` if the field is not set or
6943 /// holds a different branch.
6944 pub fn image_block(&self) -> std::option::Option<&std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>>{
6945 #[allow(unreachable_patterns)]
6946 self.block.as_ref().and_then(|v| match v {
6947 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(v) => std::option::Option::Some(v),
6948 _ => std::option::Option::None,
6949 })
6950 }
6951
6952 /// Sets the value of [block][crate::model::document::document_layout::DocumentLayoutBlock::block]
6953 /// to hold a `ImageBlock`.
6954 ///
6955 /// Note that all the setters affecting `block` are
6956 /// mutually exclusive.
6957 ///
6958 /// # Example
6959 /// ```ignore,no_run
6960 /// # use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
6961 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
6962 /// let x = DocumentLayoutBlock::new().set_image_block(LayoutImageBlock::default()/* use setters */);
6963 /// assert!(x.image_block().is_some());
6964 /// assert!(x.text_block().is_none());
6965 /// assert!(x.table_block().is_none());
6966 /// assert!(x.list_block().is_none());
6967 /// ```
6968 pub fn set_image_block<T: std::convert::Into<std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>>>(mut self, v: T) -> Self{
6969 self.block = std::option::Option::Some(
6970 crate::model::document::document_layout::document_layout_block::Block::ImageBlock(
6971 v.into()
6972 )
6973 );
6974 self
6975 }
6976 }
6977
6978 impl wkt::message::Message for DocumentLayoutBlock {
6979 fn typename() -> &'static str {
6980 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock"
6981 }
6982 }
6983
6984 /// Defines additional types related to [DocumentLayoutBlock].
6985 pub mod document_layout_block {
6986 #[allow(unused_imports)]
6987 use super::*;
6988
6989 /// Represents where the block starts and ends in the document.
6990 #[derive(Clone, Default, PartialEq)]
6991 #[non_exhaustive]
6992 pub struct LayoutPageSpan {
6993 /// Page where block starts in the document.
6994 pub page_start: i32,
6995
6996 /// Page where block ends in the document.
6997 pub page_end: i32,
6998
6999 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7000 }
7001
7002 impl LayoutPageSpan {
7003 /// Creates a new default instance.
7004 pub fn new() -> Self {
7005 std::default::Default::default()
7006 }
7007
7008 /// Sets the value of [page_start][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_start].
7009 ///
7010 /// # Example
7011 /// ```ignore,no_run
7012 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
7013 /// let x = LayoutPageSpan::new().set_page_start(42);
7014 /// ```
7015 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7016 self.page_start = v.into();
7017 self
7018 }
7019
7020 /// Sets the value of [page_end][crate::model::document::document_layout::document_layout_block::LayoutPageSpan::page_end].
7021 ///
7022 /// # Example
7023 /// ```ignore,no_run
7024 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutPageSpan;
7025 /// let x = LayoutPageSpan::new().set_page_end(42);
7026 /// ```
7027 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7028 self.page_end = v.into();
7029 self
7030 }
7031 }
7032
7033 impl wkt::message::Message for LayoutPageSpan {
7034 fn typename() -> &'static str {
7035 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutPageSpan"
7036 }
7037 }
7038
7039 /// Represents a text type block.
7040 #[derive(Clone, Default, PartialEq)]
7041 #[non_exhaustive]
7042 pub struct LayoutTextBlock {
7043 /// Text content stored in the block.
7044 pub text: std::string::String,
7045
7046 /// Type of the text in the block. Available options are: `paragraph`,
7047 /// `subtitle`, `heading-1`, `heading-2`, `heading-3`, `heading-4`,
7048 /// `heading-5`, `header`, `footer`.
7049 pub r#type: std::string::String,
7050
7051 /// A text block could further have child blocks.
7052 /// Repeated blocks support further hierarchies and nested blocks.
7053 pub blocks:
7054 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7055
7056 /// Annotation of the text block.
7057 pub annotations: std::option::Option<crate::model::document::Annotations>,
7058
7059 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7060 }
7061
7062 impl LayoutTextBlock {
7063 /// Creates a new default instance.
7064 pub fn new() -> Self {
7065 std::default::Default::default()
7066 }
7067
7068 /// Sets the value of [text][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::text].
7069 ///
7070 /// # Example
7071 /// ```ignore,no_run
7072 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7073 /// let x = LayoutTextBlock::new().set_text("example");
7074 /// ```
7075 pub fn set_text<T: std::convert::Into<std::string::String>>(
7076 mut self,
7077 v: T,
7078 ) -> Self {
7079 self.text = v.into();
7080 self
7081 }
7082
7083 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::type].
7084 ///
7085 /// # Example
7086 /// ```ignore,no_run
7087 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7088 /// let x = LayoutTextBlock::new().set_type("example");
7089 /// ```
7090 pub fn set_type<T: std::convert::Into<std::string::String>>(
7091 mut self,
7092 v: T,
7093 ) -> Self {
7094 self.r#type = v.into();
7095 self
7096 }
7097
7098 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::blocks].
7099 ///
7100 /// # Example
7101 /// ```ignore,no_run
7102 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7103 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7104 /// let x = LayoutTextBlock::new()
7105 /// .set_blocks([
7106 /// DocumentLayoutBlock::default()/* use setters */,
7107 /// DocumentLayoutBlock::default()/* use (different) setters */,
7108 /// ]);
7109 /// ```
7110 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7111 where
7112 T: std::iter::IntoIterator<Item = V>,
7113 V: std::convert::Into<
7114 crate::model::document::document_layout::DocumentLayoutBlock,
7115 >,
7116 {
7117 use std::iter::Iterator;
7118 self.blocks = v.into_iter().map(|i| i.into()).collect();
7119 self
7120 }
7121
7122 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7123 ///
7124 /// # Example
7125 /// ```ignore,no_run
7126 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7127 /// use google_cloud_documentai_v1::model::document::Annotations;
7128 /// let x = LayoutTextBlock::new().set_annotations(Annotations::default()/* use setters */);
7129 /// ```
7130 pub fn set_annotations<T>(mut self, v: T) -> Self
7131 where
7132 T: std::convert::Into<crate::model::document::Annotations>,
7133 {
7134 self.annotations = std::option::Option::Some(v.into());
7135 self
7136 }
7137
7138 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTextBlock::annotations].
7139 ///
7140 /// # Example
7141 /// ```ignore,no_run
7142 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTextBlock;
7143 /// use google_cloud_documentai_v1::model::document::Annotations;
7144 /// let x = LayoutTextBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7145 /// let x = LayoutTextBlock::new().set_or_clear_annotations(None::<Annotations>);
7146 /// ```
7147 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7148 where
7149 T: std::convert::Into<crate::model::document::Annotations>,
7150 {
7151 self.annotations = v.map(|x| x.into());
7152 self
7153 }
7154 }
7155
7156 impl wkt::message::Message for LayoutTextBlock {
7157 fn typename() -> &'static str {
7158 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTextBlock"
7159 }
7160 }
7161
7162 /// Represents a table type block.
7163 #[derive(Clone, Default, PartialEq)]
7164 #[non_exhaustive]
7165 pub struct LayoutTableBlock {
7166 /// Header rows at the top of the table.
7167 pub header_rows: std::vec::Vec<
7168 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7169 >,
7170
7171 /// Body rows containing main table content.
7172 pub body_rows: std::vec::Vec<
7173 crate::model::document::document_layout::document_layout_block::LayoutTableRow,
7174 >,
7175
7176 /// Table caption/title.
7177 pub caption: std::string::String,
7178
7179 /// Annotation of the table block.
7180 pub annotations: std::option::Option<crate::model::document::Annotations>,
7181
7182 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7183 }
7184
7185 impl LayoutTableBlock {
7186 /// Creates a new default instance.
7187 pub fn new() -> Self {
7188 std::default::Default::default()
7189 }
7190
7191 /// Sets the value of [header_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::header_rows].
7192 ///
7193 /// # Example
7194 /// ```ignore,no_run
7195 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7196 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7197 /// let x = LayoutTableBlock::new()
7198 /// .set_header_rows([
7199 /// LayoutTableRow::default()/* use setters */,
7200 /// LayoutTableRow::default()/* use (different) setters */,
7201 /// ]);
7202 /// ```
7203 pub fn set_header_rows<T, V>(mut self, v: T) -> Self
7204 where
7205 T: std::iter::IntoIterator<Item = V>,
7206 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7207 {
7208 use std::iter::Iterator;
7209 self.header_rows = v.into_iter().map(|i| i.into()).collect();
7210 self
7211 }
7212
7213 /// Sets the value of [body_rows][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::body_rows].
7214 ///
7215 /// # Example
7216 /// ```ignore,no_run
7217 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7218 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7219 /// let x = LayoutTableBlock::new()
7220 /// .set_body_rows([
7221 /// LayoutTableRow::default()/* use setters */,
7222 /// LayoutTableRow::default()/* use (different) setters */,
7223 /// ]);
7224 /// ```
7225 pub fn set_body_rows<T, V>(mut self, v: T) -> Self
7226 where
7227 T: std::iter::IntoIterator<Item = V>,
7228 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableRow>
7229 {
7230 use std::iter::Iterator;
7231 self.body_rows = v.into_iter().map(|i| i.into()).collect();
7232 self
7233 }
7234
7235 /// Sets the value of [caption][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::caption].
7236 ///
7237 /// # Example
7238 /// ```ignore,no_run
7239 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7240 /// let x = LayoutTableBlock::new().set_caption("example");
7241 /// ```
7242 pub fn set_caption<T: std::convert::Into<std::string::String>>(
7243 mut self,
7244 v: T,
7245 ) -> Self {
7246 self.caption = v.into();
7247 self
7248 }
7249
7250 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7251 ///
7252 /// # Example
7253 /// ```ignore,no_run
7254 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7255 /// use google_cloud_documentai_v1::model::document::Annotations;
7256 /// let x = LayoutTableBlock::new().set_annotations(Annotations::default()/* use setters */);
7257 /// ```
7258 pub fn set_annotations<T>(mut self, v: T) -> Self
7259 where
7260 T: std::convert::Into<crate::model::document::Annotations>,
7261 {
7262 self.annotations = std::option::Option::Some(v.into());
7263 self
7264 }
7265
7266 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutTableBlock::annotations].
7267 ///
7268 /// # Example
7269 /// ```ignore,no_run
7270 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableBlock;
7271 /// use google_cloud_documentai_v1::model::document::Annotations;
7272 /// let x = LayoutTableBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7273 /// let x = LayoutTableBlock::new().set_or_clear_annotations(None::<Annotations>);
7274 /// ```
7275 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7276 where
7277 T: std::convert::Into<crate::model::document::Annotations>,
7278 {
7279 self.annotations = v.map(|x| x.into());
7280 self
7281 }
7282 }
7283
7284 impl wkt::message::Message for LayoutTableBlock {
7285 fn typename() -> &'static str {
7286 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableBlock"
7287 }
7288 }
7289
7290 /// Represents a row in a table.
7291 #[derive(Clone, Default, PartialEq)]
7292 #[non_exhaustive]
7293 pub struct LayoutTableRow {
7294 /// A table row is a list of table cells.
7295 pub cells: std::vec::Vec<
7296 crate::model::document::document_layout::document_layout_block::LayoutTableCell,
7297 >,
7298
7299 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7300 }
7301
7302 impl LayoutTableRow {
7303 /// Creates a new default instance.
7304 pub fn new() -> Self {
7305 std::default::Default::default()
7306 }
7307
7308 /// Sets the value of [cells][crate::model::document::document_layout::document_layout_block::LayoutTableRow::cells].
7309 ///
7310 /// # Example
7311 /// ```ignore,no_run
7312 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableRow;
7313 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7314 /// let x = LayoutTableRow::new()
7315 /// .set_cells([
7316 /// LayoutTableCell::default()/* use setters */,
7317 /// LayoutTableCell::default()/* use (different) setters */,
7318 /// ]);
7319 /// ```
7320 pub fn set_cells<T, V>(mut self, v: T) -> Self
7321 where
7322 T: std::iter::IntoIterator<Item = V>,
7323 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutTableCell>
7324 {
7325 use std::iter::Iterator;
7326 self.cells = v.into_iter().map(|i| i.into()).collect();
7327 self
7328 }
7329 }
7330
7331 impl wkt::message::Message for LayoutTableRow {
7332 fn typename() -> &'static str {
7333 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableRow"
7334 }
7335 }
7336
7337 /// Represents a cell in a table row.
7338 #[derive(Clone, Default, PartialEq)]
7339 #[non_exhaustive]
7340 pub struct LayoutTableCell {
7341 /// A table cell is a list of blocks.
7342 /// Repeated blocks support further hierarchies and nested blocks.
7343 pub blocks:
7344 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7345
7346 /// How many rows this cell spans.
7347 pub row_span: i32,
7348
7349 /// How many columns this cell spans.
7350 pub col_span: i32,
7351
7352 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7353 }
7354
7355 impl LayoutTableCell {
7356 /// Creates a new default instance.
7357 pub fn new() -> Self {
7358 std::default::Default::default()
7359 }
7360
7361 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutTableCell::blocks].
7362 ///
7363 /// # Example
7364 /// ```ignore,no_run
7365 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7366 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7367 /// let x = LayoutTableCell::new()
7368 /// .set_blocks([
7369 /// DocumentLayoutBlock::default()/* use setters */,
7370 /// DocumentLayoutBlock::default()/* use (different) setters */,
7371 /// ]);
7372 /// ```
7373 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7374 where
7375 T: std::iter::IntoIterator<Item = V>,
7376 V: std::convert::Into<
7377 crate::model::document::document_layout::DocumentLayoutBlock,
7378 >,
7379 {
7380 use std::iter::Iterator;
7381 self.blocks = v.into_iter().map(|i| i.into()).collect();
7382 self
7383 }
7384
7385 /// Sets the value of [row_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::row_span].
7386 ///
7387 /// # Example
7388 /// ```ignore,no_run
7389 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7390 /// let x = LayoutTableCell::new().set_row_span(42);
7391 /// ```
7392 pub fn set_row_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7393 self.row_span = v.into();
7394 self
7395 }
7396
7397 /// Sets the value of [col_span][crate::model::document::document_layout::document_layout_block::LayoutTableCell::col_span].
7398 ///
7399 /// # Example
7400 /// ```ignore,no_run
7401 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutTableCell;
7402 /// let x = LayoutTableCell::new().set_col_span(42);
7403 /// ```
7404 pub fn set_col_span<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
7405 self.col_span = v.into();
7406 self
7407 }
7408 }
7409
7410 impl wkt::message::Message for LayoutTableCell {
7411 fn typename() -> &'static str {
7412 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutTableCell"
7413 }
7414 }
7415
7416 /// Represents a list type block.
7417 #[derive(Clone, Default, PartialEq)]
7418 #[non_exhaustive]
7419 pub struct LayoutListBlock {
7420 /// List entries that constitute a list block.
7421 pub list_entries: std::vec::Vec<
7422 crate::model::document::document_layout::document_layout_block::LayoutListEntry,
7423 >,
7424
7425 /// Type of the list_entries (if exist). Available options are `ordered`
7426 /// and `unordered`.
7427 pub r#type: std::string::String,
7428
7429 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7430 }
7431
7432 impl LayoutListBlock {
7433 /// Creates a new default instance.
7434 pub fn new() -> Self {
7435 std::default::Default::default()
7436 }
7437
7438 /// Sets the value of [list_entries][crate::model::document::document_layout::document_layout_block::LayoutListBlock::list_entries].
7439 ///
7440 /// # Example
7441 /// ```ignore,no_run
7442 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7443 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7444 /// let x = LayoutListBlock::new()
7445 /// .set_list_entries([
7446 /// LayoutListEntry::default()/* use setters */,
7447 /// LayoutListEntry::default()/* use (different) setters */,
7448 /// ]);
7449 /// ```
7450 pub fn set_list_entries<T, V>(mut self, v: T) -> Self
7451 where
7452 T: std::iter::IntoIterator<Item = V>,
7453 V: std::convert::Into<crate::model::document::document_layout::document_layout_block::LayoutListEntry>
7454 {
7455 use std::iter::Iterator;
7456 self.list_entries = v.into_iter().map(|i| i.into()).collect();
7457 self
7458 }
7459
7460 /// Sets the value of [r#type][crate::model::document::document_layout::document_layout_block::LayoutListBlock::type].
7461 ///
7462 /// # Example
7463 /// ```ignore,no_run
7464 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListBlock;
7465 /// let x = LayoutListBlock::new().set_type("example");
7466 /// ```
7467 pub fn set_type<T: std::convert::Into<std::string::String>>(
7468 mut self,
7469 v: T,
7470 ) -> Self {
7471 self.r#type = v.into();
7472 self
7473 }
7474 }
7475
7476 impl wkt::message::Message for LayoutListBlock {
7477 fn typename() -> &'static str {
7478 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListBlock"
7479 }
7480 }
7481
7482 /// Represents an entry in the list.
7483 #[derive(Clone, Default, PartialEq)]
7484 #[non_exhaustive]
7485 pub struct LayoutListEntry {
7486 /// A list entry is a list of blocks.
7487 /// Repeated blocks support further hierarchies and nested blocks.
7488 pub blocks:
7489 std::vec::Vec<crate::model::document::document_layout::DocumentLayoutBlock>,
7490
7491 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7492 }
7493
7494 impl LayoutListEntry {
7495 /// Creates a new default instance.
7496 pub fn new() -> Self {
7497 std::default::Default::default()
7498 }
7499
7500 /// Sets the value of [blocks][crate::model::document::document_layout::document_layout_block::LayoutListEntry::blocks].
7501 ///
7502 /// # Example
7503 /// ```ignore,no_run
7504 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutListEntry;
7505 /// use google_cloud_documentai_v1::model::document::document_layout::DocumentLayoutBlock;
7506 /// let x = LayoutListEntry::new()
7507 /// .set_blocks([
7508 /// DocumentLayoutBlock::default()/* use setters */,
7509 /// DocumentLayoutBlock::default()/* use (different) setters */,
7510 /// ]);
7511 /// ```
7512 pub fn set_blocks<T, V>(mut self, v: T) -> Self
7513 where
7514 T: std::iter::IntoIterator<Item = V>,
7515 V: std::convert::Into<
7516 crate::model::document::document_layout::DocumentLayoutBlock,
7517 >,
7518 {
7519 use std::iter::Iterator;
7520 self.blocks = v.into_iter().map(|i| i.into()).collect();
7521 self
7522 }
7523 }
7524
7525 impl wkt::message::Message for LayoutListEntry {
7526 fn typename() -> &'static str {
7527 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutListEntry"
7528 }
7529 }
7530
7531 /// Represents an image type block.
7532 #[derive(Clone, Default, PartialEq)]
7533 #[non_exhaustive]
7534 pub struct LayoutImageBlock {
7535
7536 /// Mime type of the image. An IANA published [media type (MIME type)]
7537 /// (<https://www.iana.org/assignments/media-types/media-types.xhtml>).
7538 pub mime_type: std::string::String,
7539
7540 /// Text extracted from the image using OCR or alt text describing the
7541 /// image.
7542 pub image_text: std::string::String,
7543
7544 /// Annotation of the image block.
7545 pub annotations: std::option::Option<crate::model::document::Annotations>,
7546
7547 /// Source of the image.
7548 pub image_source: std::option::Option<crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource>,
7549
7550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7551 }
7552
7553 impl LayoutImageBlock {
7554 /// Creates a new default instance.
7555 pub fn new() -> Self {
7556 std::default::Default::default()
7557 }
7558
7559 /// Sets the value of [mime_type][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::mime_type].
7560 ///
7561 /// # Example
7562 /// ```ignore,no_run
7563 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7564 /// let x = LayoutImageBlock::new().set_mime_type("example");
7565 /// ```
7566 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(
7567 mut self,
7568 v: T,
7569 ) -> Self {
7570 self.mime_type = v.into();
7571 self
7572 }
7573
7574 /// Sets the value of [image_text][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_text].
7575 ///
7576 /// # Example
7577 /// ```ignore,no_run
7578 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7579 /// let x = LayoutImageBlock::new().set_image_text("example");
7580 /// ```
7581 pub fn set_image_text<T: std::convert::Into<std::string::String>>(
7582 mut self,
7583 v: T,
7584 ) -> Self {
7585 self.image_text = v.into();
7586 self
7587 }
7588
7589 /// Sets the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7590 ///
7591 /// # Example
7592 /// ```ignore,no_run
7593 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7594 /// use google_cloud_documentai_v1::model::document::Annotations;
7595 /// let x = LayoutImageBlock::new().set_annotations(Annotations::default()/* use setters */);
7596 /// ```
7597 pub fn set_annotations<T>(mut self, v: T) -> Self
7598 where
7599 T: std::convert::Into<crate::model::document::Annotations>,
7600 {
7601 self.annotations = std::option::Option::Some(v.into());
7602 self
7603 }
7604
7605 /// Sets or clears the value of [annotations][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::annotations].
7606 ///
7607 /// # Example
7608 /// ```ignore,no_run
7609 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7610 /// use google_cloud_documentai_v1::model::document::Annotations;
7611 /// let x = LayoutImageBlock::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
7612 /// let x = LayoutImageBlock::new().set_or_clear_annotations(None::<Annotations>);
7613 /// ```
7614 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
7615 where
7616 T: std::convert::Into<crate::model::document::Annotations>,
7617 {
7618 self.annotations = v.map(|x| x.into());
7619 self
7620 }
7621
7622 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source].
7623 ///
7624 /// Note that all the setters affecting `image_source` are mutually
7625 /// exclusive.
7626 ///
7627 /// # Example
7628 /// ```ignore,no_run
7629 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7630 /// use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::layout_image_block::ImageSource;
7631 /// let x = LayoutImageBlock::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
7632 /// ```
7633 pub fn set_image_source<T: std::convert::Into<std::option::Option<crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource>>>(mut self, v: T) -> Self
7634 {
7635 self.image_source = v.into();
7636 self
7637 }
7638
7639 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7640 /// if it holds a `BlobAssetId`, `None` if the field is not set or
7641 /// holds a different branch.
7642 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
7643 #[allow(unreachable_patterns)]
7644 self.image_source.as_ref().and_then(|v| match v {
7645 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
7646 _ => std::option::Option::None,
7647 })
7648 }
7649
7650 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7651 /// to hold a `BlobAssetId`.
7652 ///
7653 /// Note that all the setters affecting `image_source` are
7654 /// mutually exclusive.
7655 ///
7656 /// # Example
7657 /// ```ignore,no_run
7658 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7659 /// let x = LayoutImageBlock::new().set_blob_asset_id("example");
7660 /// assert!(x.blob_asset_id().is_some());
7661 /// assert!(x.gcs_uri().is_none());
7662 /// assert!(x.data_uri().is_none());
7663 /// ```
7664 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
7665 mut self,
7666 v: T,
7667 ) -> Self {
7668 self.image_source = std::option::Option::Some(
7669 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::BlobAssetId(
7670 v.into()
7671 )
7672 );
7673 self
7674 }
7675
7676 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7677 /// if it holds a `GcsUri`, `None` if the field is not set or
7678 /// holds a different branch.
7679 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
7680 #[allow(unreachable_patterns)]
7681 self.image_source.as_ref().and_then(|v| match v {
7682 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(v) => std::option::Option::Some(v),
7683 _ => std::option::Option::None,
7684 })
7685 }
7686
7687 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7688 /// to hold a `GcsUri`.
7689 ///
7690 /// Note that all the setters affecting `image_source` are
7691 /// mutually exclusive.
7692 ///
7693 /// # Example
7694 /// ```ignore,no_run
7695 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7696 /// let x = LayoutImageBlock::new().set_gcs_uri("example");
7697 /// assert!(x.gcs_uri().is_some());
7698 /// assert!(x.blob_asset_id().is_none());
7699 /// assert!(x.data_uri().is_none());
7700 /// ```
7701 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
7702 mut self,
7703 v: T,
7704 ) -> Self {
7705 self.image_source = std::option::Option::Some(
7706 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::GcsUri(
7707 v.into()
7708 )
7709 );
7710 self
7711 }
7712
7713 /// The value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7714 /// if it holds a `DataUri`, `None` if the field is not set or
7715 /// holds a different branch.
7716 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
7717 #[allow(unreachable_patterns)]
7718 self.image_source.as_ref().and_then(|v| match v {
7719 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(v) => std::option::Option::Some(v),
7720 _ => std::option::Option::None,
7721 })
7722 }
7723
7724 /// Sets the value of [image_source][crate::model::document::document_layout::document_layout_block::LayoutImageBlock::image_source]
7725 /// to hold a `DataUri`.
7726 ///
7727 /// Note that all the setters affecting `image_source` are
7728 /// mutually exclusive.
7729 ///
7730 /// # Example
7731 /// ```ignore,no_run
7732 /// # use google_cloud_documentai_v1::model::document::document_layout::document_layout_block::LayoutImageBlock;
7733 /// let x = LayoutImageBlock::new().set_data_uri("example");
7734 /// assert!(x.data_uri().is_some());
7735 /// assert!(x.blob_asset_id().is_none());
7736 /// assert!(x.gcs_uri().is_none());
7737 /// ```
7738 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
7739 mut self,
7740 v: T,
7741 ) -> Self {
7742 self.image_source = std::option::Option::Some(
7743 crate::model::document::document_layout::document_layout_block::layout_image_block::ImageSource::DataUri(
7744 v.into()
7745 )
7746 );
7747 self
7748 }
7749 }
7750
7751 impl wkt::message::Message for LayoutImageBlock {
7752 fn typename() -> &'static str {
7753 "type.googleapis.com/google.cloud.documentai.v1.Document.DocumentLayout.DocumentLayoutBlock.LayoutImageBlock"
7754 }
7755 }
7756
7757 /// Defines additional types related to [LayoutImageBlock].
7758 pub mod layout_image_block {
7759 #[allow(unused_imports)]
7760 use super::*;
7761
7762 /// Source of the image.
7763 #[derive(Clone, Debug, PartialEq)]
7764 #[non_exhaustive]
7765 pub enum ImageSource {
7766 /// Optional. Asset id of the inline image. If set, find the image
7767 /// content in the blob_assets field.
7768 BlobAssetId(std::string::String),
7769 /// Optional. Google Cloud Storage uri of the image.
7770 GcsUri(std::string::String),
7771 /// Optional. Data uri of the image.
7772 /// It is composed of four parts: a prefix (data:), a MIME type
7773 /// indicating the type of data, an optional base64 token if
7774 /// non-textual, and the data itself:
7775 /// data:[\<mediatype\>][;base64],\<data\>
7776 DataUri(std::string::String),
7777 }
7778 }
7779
7780 #[allow(missing_docs)]
7781 #[derive(Clone, Debug, PartialEq)]
7782 #[non_exhaustive]
7783 pub enum Block {
7784 /// Block consisting of text content.
7785 TextBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTextBlock>),
7786 /// Block consisting of table content/structure.
7787 TableBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutTableBlock>),
7788 /// Block consisting of list content/structure.
7789 ListBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutListBlock>),
7790 /// Block consisting of image content.
7791 ImageBlock(std::boxed::Box<crate::model::document::document_layout::document_layout_block::LayoutImageBlock>),
7792 }
7793 }
7794 }
7795
7796 /// Represents the chunks that the document is divided into.
7797 #[derive(Clone, Default, PartialEq)]
7798 #[non_exhaustive]
7799 pub struct ChunkedDocument {
7800 /// List of chunks.
7801 pub chunks: std::vec::Vec<crate::model::document::chunked_document::Chunk>,
7802
7803 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7804 }
7805
7806 impl ChunkedDocument {
7807 /// Creates a new default instance.
7808 pub fn new() -> Self {
7809 std::default::Default::default()
7810 }
7811
7812 /// Sets the value of [chunks][crate::model::document::ChunkedDocument::chunks].
7813 ///
7814 /// # Example
7815 /// ```ignore,no_run
7816 /// # use google_cloud_documentai_v1::model::document::ChunkedDocument;
7817 /// use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7818 /// let x = ChunkedDocument::new()
7819 /// .set_chunks([
7820 /// Chunk::default()/* use setters */,
7821 /// Chunk::default()/* use (different) setters */,
7822 /// ]);
7823 /// ```
7824 pub fn set_chunks<T, V>(mut self, v: T) -> Self
7825 where
7826 T: std::iter::IntoIterator<Item = V>,
7827 V: std::convert::Into<crate::model::document::chunked_document::Chunk>,
7828 {
7829 use std::iter::Iterator;
7830 self.chunks = v.into_iter().map(|i| i.into()).collect();
7831 self
7832 }
7833 }
7834
7835 impl wkt::message::Message for ChunkedDocument {
7836 fn typename() -> &'static str {
7837 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument"
7838 }
7839 }
7840
7841 /// Defines additional types related to [ChunkedDocument].
7842 pub mod chunked_document {
7843 #[allow(unused_imports)]
7844 use super::*;
7845
7846 /// Represents a chunk.
7847 #[derive(Clone, Default, PartialEq)]
7848 #[non_exhaustive]
7849 pub struct Chunk {
7850 /// ID of the chunk.
7851 pub chunk_id: std::string::String,
7852
7853 /// Unused.
7854 pub source_block_ids: std::vec::Vec<std::string::String>,
7855
7856 /// Text content of the chunk.
7857 pub content: std::string::String,
7858
7859 /// Page span of the chunk.
7860 pub page_span:
7861 std::option::Option<crate::model::document::chunked_document::chunk::ChunkPageSpan>,
7862
7863 /// Page headers associated with the chunk.
7864 pub page_headers:
7865 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageHeader>,
7866
7867 /// Page footers associated with the chunk.
7868 pub page_footers:
7869 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkPageFooter>,
7870
7871 /// Chunk fields inside this chunk.
7872 pub chunk_fields:
7873 std::vec::Vec<crate::model::document::chunked_document::chunk::ChunkField>,
7874
7875 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7876 }
7877
7878 impl Chunk {
7879 /// Creates a new default instance.
7880 pub fn new() -> Self {
7881 std::default::Default::default()
7882 }
7883
7884 /// Sets the value of [chunk_id][crate::model::document::chunked_document::Chunk::chunk_id].
7885 ///
7886 /// # Example
7887 /// ```ignore,no_run
7888 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7889 /// let x = Chunk::new().set_chunk_id("example");
7890 /// ```
7891 pub fn set_chunk_id<T: std::convert::Into<std::string::String>>(
7892 mut self,
7893 v: T,
7894 ) -> Self {
7895 self.chunk_id = v.into();
7896 self
7897 }
7898
7899 /// Sets the value of [source_block_ids][crate::model::document::chunked_document::Chunk::source_block_ids].
7900 ///
7901 /// # Example
7902 /// ```ignore,no_run
7903 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7904 /// let x = Chunk::new().set_source_block_ids(["a", "b", "c"]);
7905 /// ```
7906 pub fn set_source_block_ids<T, V>(mut self, v: T) -> Self
7907 where
7908 T: std::iter::IntoIterator<Item = V>,
7909 V: std::convert::Into<std::string::String>,
7910 {
7911 use std::iter::Iterator;
7912 self.source_block_ids = v.into_iter().map(|i| i.into()).collect();
7913 self
7914 }
7915
7916 /// Sets the value of [content][crate::model::document::chunked_document::Chunk::content].
7917 ///
7918 /// # Example
7919 /// ```ignore,no_run
7920 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7921 /// let x = Chunk::new().set_content("example");
7922 /// ```
7923 pub fn set_content<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7924 self.content = v.into();
7925 self
7926 }
7927
7928 /// Sets the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7929 ///
7930 /// # Example
7931 /// ```ignore,no_run
7932 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7933 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7934 /// let x = Chunk::new().set_page_span(ChunkPageSpan::default()/* use setters */);
7935 /// ```
7936 pub fn set_page_span<T>(mut self, v: T) -> Self
7937 where
7938 T: std::convert::Into<
7939 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7940 >,
7941 {
7942 self.page_span = std::option::Option::Some(v.into());
7943 self
7944 }
7945
7946 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::Chunk::page_span].
7947 ///
7948 /// # Example
7949 /// ```ignore,no_run
7950 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7951 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
7952 /// let x = Chunk::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
7953 /// let x = Chunk::new().set_or_clear_page_span(None::<ChunkPageSpan>);
7954 /// ```
7955 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
7956 where
7957 T: std::convert::Into<
7958 crate::model::document::chunked_document::chunk::ChunkPageSpan,
7959 >,
7960 {
7961 self.page_span = v.map(|x| x.into());
7962 self
7963 }
7964
7965 /// Sets the value of [page_headers][crate::model::document::chunked_document::Chunk::page_headers].
7966 ///
7967 /// # Example
7968 /// ```ignore,no_run
7969 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7970 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
7971 /// let x = Chunk::new()
7972 /// .set_page_headers([
7973 /// ChunkPageHeader::default()/* use setters */,
7974 /// ChunkPageHeader::default()/* use (different) setters */,
7975 /// ]);
7976 /// ```
7977 pub fn set_page_headers<T, V>(mut self, v: T) -> Self
7978 where
7979 T: std::iter::IntoIterator<Item = V>,
7980 V: std::convert::Into<
7981 crate::model::document::chunked_document::chunk::ChunkPageHeader,
7982 >,
7983 {
7984 use std::iter::Iterator;
7985 self.page_headers = v.into_iter().map(|i| i.into()).collect();
7986 self
7987 }
7988
7989 /// Sets the value of [page_footers][crate::model::document::chunked_document::Chunk::page_footers].
7990 ///
7991 /// # Example
7992 /// ```ignore,no_run
7993 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
7994 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
7995 /// let x = Chunk::new()
7996 /// .set_page_footers([
7997 /// ChunkPageFooter::default()/* use setters */,
7998 /// ChunkPageFooter::default()/* use (different) setters */,
7999 /// ]);
8000 /// ```
8001 pub fn set_page_footers<T, V>(mut self, v: T) -> Self
8002 where
8003 T: std::iter::IntoIterator<Item = V>,
8004 V: std::convert::Into<
8005 crate::model::document::chunked_document::chunk::ChunkPageFooter,
8006 >,
8007 {
8008 use std::iter::Iterator;
8009 self.page_footers = v.into_iter().map(|i| i.into()).collect();
8010 self
8011 }
8012
8013 /// Sets the value of [chunk_fields][crate::model::document::chunked_document::Chunk::chunk_fields].
8014 ///
8015 /// # Example
8016 /// ```ignore,no_run
8017 /// # use google_cloud_documentai_v1::model::document::chunked_document::Chunk;
8018 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8019 /// let x = Chunk::new()
8020 /// .set_chunk_fields([
8021 /// ChunkField::default()/* use setters */,
8022 /// ChunkField::default()/* use (different) setters */,
8023 /// ]);
8024 /// ```
8025 pub fn set_chunk_fields<T, V>(mut self, v: T) -> Self
8026 where
8027 T: std::iter::IntoIterator<Item = V>,
8028 V: std::convert::Into<crate::model::document::chunked_document::chunk::ChunkField>,
8029 {
8030 use std::iter::Iterator;
8031 self.chunk_fields = v.into_iter().map(|i| i.into()).collect();
8032 self
8033 }
8034 }
8035
8036 impl wkt::message::Message for Chunk {
8037 fn typename() -> &'static str {
8038 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk"
8039 }
8040 }
8041
8042 /// Defines additional types related to [Chunk].
8043 pub mod chunk {
8044 #[allow(unused_imports)]
8045 use super::*;
8046
8047 /// Represents where the chunk starts and ends in the document.
8048 #[derive(Clone, Default, PartialEq)]
8049 #[non_exhaustive]
8050 pub struct ChunkPageSpan {
8051 /// Page where chunk starts in the document.
8052 pub page_start: i32,
8053
8054 /// Page where chunk ends in the document.
8055 pub page_end: i32,
8056
8057 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8058 }
8059
8060 impl ChunkPageSpan {
8061 /// Creates a new default instance.
8062 pub fn new() -> Self {
8063 std::default::Default::default()
8064 }
8065
8066 /// Sets the value of [page_start][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_start].
8067 ///
8068 /// # Example
8069 /// ```ignore,no_run
8070 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8071 /// let x = ChunkPageSpan::new().set_page_start(42);
8072 /// ```
8073 pub fn set_page_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8074 self.page_start = v.into();
8075 self
8076 }
8077
8078 /// Sets the value of [page_end][crate::model::document::chunked_document::chunk::ChunkPageSpan::page_end].
8079 ///
8080 /// # Example
8081 /// ```ignore,no_run
8082 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8083 /// let x = ChunkPageSpan::new().set_page_end(42);
8084 /// ```
8085 pub fn set_page_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
8086 self.page_end = v.into();
8087 self
8088 }
8089 }
8090
8091 impl wkt::message::Message for ChunkPageSpan {
8092 fn typename() -> &'static str {
8093 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageSpan"
8094 }
8095 }
8096
8097 /// Represents the page header associated with the chunk.
8098 #[derive(Clone, Default, PartialEq)]
8099 #[non_exhaustive]
8100 pub struct ChunkPageHeader {
8101 /// Header in text format.
8102 pub text: std::string::String,
8103
8104 /// Page span of the header.
8105 pub page_span: std::option::Option<
8106 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8107 >,
8108
8109 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8110 }
8111
8112 impl ChunkPageHeader {
8113 /// Creates a new default instance.
8114 pub fn new() -> Self {
8115 std::default::Default::default()
8116 }
8117
8118 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageHeader::text].
8119 ///
8120 /// # Example
8121 /// ```ignore,no_run
8122 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8123 /// let x = ChunkPageHeader::new().set_text("example");
8124 /// ```
8125 pub fn set_text<T: std::convert::Into<std::string::String>>(
8126 mut self,
8127 v: T,
8128 ) -> Self {
8129 self.text = v.into();
8130 self
8131 }
8132
8133 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8134 ///
8135 /// # Example
8136 /// ```ignore,no_run
8137 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8138 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8139 /// let x = ChunkPageHeader::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8140 /// ```
8141 pub fn set_page_span<T>(mut self, v: T) -> Self
8142 where
8143 T: std::convert::Into<
8144 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8145 >,
8146 {
8147 self.page_span = std::option::Option::Some(v.into());
8148 self
8149 }
8150
8151 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageHeader::page_span].
8152 ///
8153 /// # Example
8154 /// ```ignore,no_run
8155 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageHeader;
8156 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8157 /// let x = ChunkPageHeader::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8158 /// let x = ChunkPageHeader::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8159 /// ```
8160 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8161 where
8162 T: std::convert::Into<
8163 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8164 >,
8165 {
8166 self.page_span = v.map(|x| x.into());
8167 self
8168 }
8169 }
8170
8171 impl wkt::message::Message for ChunkPageHeader {
8172 fn typename() -> &'static str {
8173 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageHeader"
8174 }
8175 }
8176
8177 /// Represents the page footer associated with the chunk.
8178 #[derive(Clone, Default, PartialEq)]
8179 #[non_exhaustive]
8180 pub struct ChunkPageFooter {
8181 /// Footer in text format.
8182 pub text: std::string::String,
8183
8184 /// Page span of the footer.
8185 pub page_span: std::option::Option<
8186 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8187 >,
8188
8189 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8190 }
8191
8192 impl ChunkPageFooter {
8193 /// Creates a new default instance.
8194 pub fn new() -> Self {
8195 std::default::Default::default()
8196 }
8197
8198 /// Sets the value of [text][crate::model::document::chunked_document::chunk::ChunkPageFooter::text].
8199 ///
8200 /// # Example
8201 /// ```ignore,no_run
8202 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8203 /// let x = ChunkPageFooter::new().set_text("example");
8204 /// ```
8205 pub fn set_text<T: std::convert::Into<std::string::String>>(
8206 mut self,
8207 v: T,
8208 ) -> Self {
8209 self.text = v.into();
8210 self
8211 }
8212
8213 /// Sets the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8214 ///
8215 /// # Example
8216 /// ```ignore,no_run
8217 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8218 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8219 /// let x = ChunkPageFooter::new().set_page_span(ChunkPageSpan::default()/* use setters */);
8220 /// ```
8221 pub fn set_page_span<T>(mut self, v: T) -> Self
8222 where
8223 T: std::convert::Into<
8224 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8225 >,
8226 {
8227 self.page_span = std::option::Option::Some(v.into());
8228 self
8229 }
8230
8231 /// Sets or clears the value of [page_span][crate::model::document::chunked_document::chunk::ChunkPageFooter::page_span].
8232 ///
8233 /// # Example
8234 /// ```ignore,no_run
8235 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageFooter;
8236 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkPageSpan;
8237 /// let x = ChunkPageFooter::new().set_or_clear_page_span(Some(ChunkPageSpan::default()/* use setters */));
8238 /// let x = ChunkPageFooter::new().set_or_clear_page_span(None::<ChunkPageSpan>);
8239 /// ```
8240 pub fn set_or_clear_page_span<T>(mut self, v: std::option::Option<T>) -> Self
8241 where
8242 T: std::convert::Into<
8243 crate::model::document::chunked_document::chunk::ChunkPageSpan,
8244 >,
8245 {
8246 self.page_span = v.map(|x| x.into());
8247 self
8248 }
8249 }
8250
8251 impl wkt::message::Message for ChunkPageFooter {
8252 fn typename() -> &'static str {
8253 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkPageFooter"
8254 }
8255 }
8256
8257 /// The image chunk field in the chunk.
8258 #[derive(Clone, Default, PartialEq)]
8259 #[non_exhaustive]
8260 pub struct ImageChunkField {
8261 /// Annotation of the image chunk field.
8262 pub annotations: std::option::Option<crate::model::document::Annotations>,
8263
8264 /// Source of the image.
8265 pub image_source: std::option::Option<
8266 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource,
8267 >,
8268
8269 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8270 }
8271
8272 impl ImageChunkField {
8273 /// Creates a new default instance.
8274 pub fn new() -> Self {
8275 std::default::Default::default()
8276 }
8277
8278 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8279 ///
8280 /// # Example
8281 /// ```ignore,no_run
8282 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8283 /// use google_cloud_documentai_v1::model::document::Annotations;
8284 /// let x = ImageChunkField::new().set_annotations(Annotations::default()/* use setters */);
8285 /// ```
8286 pub fn set_annotations<T>(mut self, v: T) -> Self
8287 where
8288 T: std::convert::Into<crate::model::document::Annotations>,
8289 {
8290 self.annotations = std::option::Option::Some(v.into());
8291 self
8292 }
8293
8294 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::ImageChunkField::annotations].
8295 ///
8296 /// # Example
8297 /// ```ignore,no_run
8298 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8299 /// use google_cloud_documentai_v1::model::document::Annotations;
8300 /// let x = ImageChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8301 /// let x = ImageChunkField::new().set_or_clear_annotations(None::<Annotations>);
8302 /// ```
8303 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8304 where
8305 T: std::convert::Into<crate::model::document::Annotations>,
8306 {
8307 self.annotations = v.map(|x| x.into());
8308 self
8309 }
8310
8311 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source].
8312 ///
8313 /// Note that all the setters affecting `image_source` are mutually
8314 /// exclusive.
8315 ///
8316 /// # Example
8317 /// ```ignore,no_run
8318 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8319 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::image_chunk_field::ImageSource;
8320 /// let x = ImageChunkField::new().set_image_source(Some(ImageSource::BlobAssetId("example".to_string())));
8321 /// ```
8322 pub fn set_image_source<T: std::convert::Into<std::option::Option<crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource>>>(mut self, v: T) -> Self
8323 {
8324 self.image_source = v.into();
8325 self
8326 }
8327
8328 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8329 /// if it holds a `BlobAssetId`, `None` if the field is not set or
8330 /// holds a different branch.
8331 pub fn blob_asset_id(&self) -> std::option::Option<&std::string::String> {
8332 #[allow(unreachable_patterns)]
8333 self.image_source.as_ref().and_then(|v| match v {
8334 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(v) => std::option::Option::Some(v),
8335 _ => std::option::Option::None,
8336 })
8337 }
8338
8339 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8340 /// to hold a `BlobAssetId`.
8341 ///
8342 /// Note that all the setters affecting `image_source` are
8343 /// mutually exclusive.
8344 ///
8345 /// # Example
8346 /// ```ignore,no_run
8347 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8348 /// let x = ImageChunkField::new().set_blob_asset_id("example");
8349 /// assert!(x.blob_asset_id().is_some());
8350 /// assert!(x.gcs_uri().is_none());
8351 /// assert!(x.data_uri().is_none());
8352 /// ```
8353 pub fn set_blob_asset_id<T: std::convert::Into<std::string::String>>(
8354 mut self,
8355 v: T,
8356 ) -> Self {
8357 self.image_source = std::option::Option::Some(
8358 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::BlobAssetId(
8359 v.into()
8360 )
8361 );
8362 self
8363 }
8364
8365 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8366 /// if it holds a `GcsUri`, `None` if the field is not set or
8367 /// holds a different branch.
8368 pub fn gcs_uri(&self) -> std::option::Option<&std::string::String> {
8369 #[allow(unreachable_patterns)]
8370 self.image_source.as_ref().and_then(|v| match v {
8371 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(v) => std::option::Option::Some(v),
8372 _ => std::option::Option::None,
8373 })
8374 }
8375
8376 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8377 /// to hold a `GcsUri`.
8378 ///
8379 /// Note that all the setters affecting `image_source` are
8380 /// mutually exclusive.
8381 ///
8382 /// # Example
8383 /// ```ignore,no_run
8384 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8385 /// let x = ImageChunkField::new().set_gcs_uri("example");
8386 /// assert!(x.gcs_uri().is_some());
8387 /// assert!(x.blob_asset_id().is_none());
8388 /// assert!(x.data_uri().is_none());
8389 /// ```
8390 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(
8391 mut self,
8392 v: T,
8393 ) -> Self {
8394 self.image_source = std::option::Option::Some(
8395 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::GcsUri(
8396 v.into()
8397 )
8398 );
8399 self
8400 }
8401
8402 /// The value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8403 /// if it holds a `DataUri`, `None` if the field is not set or
8404 /// holds a different branch.
8405 pub fn data_uri(&self) -> std::option::Option<&std::string::String> {
8406 #[allow(unreachable_patterns)]
8407 self.image_source.as_ref().and_then(|v| match v {
8408 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(v) => std::option::Option::Some(v),
8409 _ => std::option::Option::None,
8410 })
8411 }
8412
8413 /// Sets the value of [image_source][crate::model::document::chunked_document::chunk::ImageChunkField::image_source]
8414 /// to hold a `DataUri`.
8415 ///
8416 /// Note that all the setters affecting `image_source` are
8417 /// mutually exclusive.
8418 ///
8419 /// # Example
8420 /// ```ignore,no_run
8421 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8422 /// let x = ImageChunkField::new().set_data_uri("example");
8423 /// assert!(x.data_uri().is_some());
8424 /// assert!(x.blob_asset_id().is_none());
8425 /// assert!(x.gcs_uri().is_none());
8426 /// ```
8427 pub fn set_data_uri<T: std::convert::Into<std::string::String>>(
8428 mut self,
8429 v: T,
8430 ) -> Self {
8431 self.image_source = std::option::Option::Some(
8432 crate::model::document::chunked_document::chunk::image_chunk_field::ImageSource::DataUri(
8433 v.into()
8434 )
8435 );
8436 self
8437 }
8438 }
8439
8440 impl wkt::message::Message for ImageChunkField {
8441 fn typename() -> &'static str {
8442 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ImageChunkField"
8443 }
8444 }
8445
8446 /// Defines additional types related to [ImageChunkField].
8447 pub mod image_chunk_field {
8448 #[allow(unused_imports)]
8449 use super::*;
8450
8451 /// Source of the image.
8452 #[derive(Clone, Debug, PartialEq)]
8453 #[non_exhaustive]
8454 pub enum ImageSource {
8455 /// Optional. Asset id of the inline image. If set, find the image
8456 /// content in the blob_assets field.
8457 BlobAssetId(std::string::String),
8458 /// Optional. Google Cloud Storage uri of the image.
8459 GcsUri(std::string::String),
8460 /// Optional. Data uri of the image.
8461 /// It is composed of four parts: a prefix (data:), a MIME type
8462 /// indicating the type of data, an optional base64 token if
8463 /// non-textual, and the data itself:
8464 /// data:[\<mediatype\>][;base64],\<data\>
8465 DataUri(std::string::String),
8466 }
8467 }
8468
8469 /// The table chunk field in the chunk.
8470 #[derive(Clone, Default, PartialEq)]
8471 #[non_exhaustive]
8472 pub struct TableChunkField {
8473 /// Annotation of the table chunk field.
8474 pub annotations: std::option::Option<crate::model::document::Annotations>,
8475
8476 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8477 }
8478
8479 impl TableChunkField {
8480 /// Creates a new default instance.
8481 pub fn new() -> Self {
8482 std::default::Default::default()
8483 }
8484
8485 /// Sets the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8486 ///
8487 /// # Example
8488 /// ```ignore,no_run
8489 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8490 /// use google_cloud_documentai_v1::model::document::Annotations;
8491 /// let x = TableChunkField::new().set_annotations(Annotations::default()/* use setters */);
8492 /// ```
8493 pub fn set_annotations<T>(mut self, v: T) -> Self
8494 where
8495 T: std::convert::Into<crate::model::document::Annotations>,
8496 {
8497 self.annotations = std::option::Option::Some(v.into());
8498 self
8499 }
8500
8501 /// Sets or clears the value of [annotations][crate::model::document::chunked_document::chunk::TableChunkField::annotations].
8502 ///
8503 /// # Example
8504 /// ```ignore,no_run
8505 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8506 /// use google_cloud_documentai_v1::model::document::Annotations;
8507 /// let x = TableChunkField::new().set_or_clear_annotations(Some(Annotations::default()/* use setters */));
8508 /// let x = TableChunkField::new().set_or_clear_annotations(None::<Annotations>);
8509 /// ```
8510 pub fn set_or_clear_annotations<T>(mut self, v: std::option::Option<T>) -> Self
8511 where
8512 T: std::convert::Into<crate::model::document::Annotations>,
8513 {
8514 self.annotations = v.map(|x| x.into());
8515 self
8516 }
8517 }
8518
8519 impl wkt::message::Message for TableChunkField {
8520 fn typename() -> &'static str {
8521 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.TableChunkField"
8522 }
8523 }
8524
8525 /// The chunk field in the chunk. A chunk field could be one of the various
8526 /// types (for example, image, table) supported.
8527 #[derive(Clone, Default, PartialEq)]
8528 #[non_exhaustive]
8529 pub struct ChunkField {
8530 /// The type of the chunk field.
8531 pub field_type: std::option::Option<
8532 crate::model::document::chunked_document::chunk::chunk_field::FieldType,
8533 >,
8534
8535 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8536 }
8537
8538 impl ChunkField {
8539 /// Creates a new default instance.
8540 pub fn new() -> Self {
8541 std::default::Default::default()
8542 }
8543
8544 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type].
8545 ///
8546 /// Note that all the setters affecting `field_type` are mutually
8547 /// exclusive.
8548 ///
8549 /// # Example
8550 /// ```ignore,no_run
8551 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8552 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8553 /// let x = ChunkField::new().set_field_type(Some(
8554 /// google_cloud_documentai_v1::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(ImageChunkField::default().into())));
8555 /// ```
8556 pub fn set_field_type<T: std::convert::Into<std::option::Option<crate::model::document::chunked_document::chunk::chunk_field::FieldType>>>(mut self, v: T) -> Self
8557 {
8558 self.field_type = v.into();
8559 self
8560 }
8561
8562 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8563 /// if it holds a `ImageChunkField`, `None` if the field is not set or
8564 /// holds a different branch.
8565 pub fn image_chunk_field(
8566 &self,
8567 ) -> std::option::Option<
8568 &std::boxed::Box<
8569 crate::model::document::chunked_document::chunk::ImageChunkField,
8570 >,
8571 > {
8572 #[allow(unreachable_patterns)]
8573 self.field_type.as_ref().and_then(|v| match v {
8574 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(v) => std::option::Option::Some(v),
8575 _ => std::option::Option::None,
8576 })
8577 }
8578
8579 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8580 /// to hold a `ImageChunkField`.
8581 ///
8582 /// Note that all the setters affecting `field_type` are
8583 /// mutually exclusive.
8584 ///
8585 /// # Example
8586 /// ```ignore,no_run
8587 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8588 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::ImageChunkField;
8589 /// let x = ChunkField::new().set_image_chunk_field(ImageChunkField::default()/* use setters */);
8590 /// assert!(x.image_chunk_field().is_some());
8591 /// assert!(x.table_chunk_field().is_none());
8592 /// ```
8593 pub fn set_image_chunk_field<
8594 T: std::convert::Into<
8595 std::boxed::Box<
8596 crate::model::document::chunked_document::chunk::ImageChunkField,
8597 >,
8598 >,
8599 >(
8600 mut self,
8601 v: T,
8602 ) -> Self {
8603 self.field_type = std::option::Option::Some(
8604 crate::model::document::chunked_document::chunk::chunk_field::FieldType::ImageChunkField(
8605 v.into()
8606 )
8607 );
8608 self
8609 }
8610
8611 /// The value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8612 /// if it holds a `TableChunkField`, `None` if the field is not set or
8613 /// holds a different branch.
8614 pub fn table_chunk_field(
8615 &self,
8616 ) -> std::option::Option<
8617 &std::boxed::Box<
8618 crate::model::document::chunked_document::chunk::TableChunkField,
8619 >,
8620 > {
8621 #[allow(unreachable_patterns)]
8622 self.field_type.as_ref().and_then(|v| match v {
8623 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(v) => std::option::Option::Some(v),
8624 _ => std::option::Option::None,
8625 })
8626 }
8627
8628 /// Sets the value of [field_type][crate::model::document::chunked_document::chunk::ChunkField::field_type]
8629 /// to hold a `TableChunkField`.
8630 ///
8631 /// Note that all the setters affecting `field_type` are
8632 /// mutually exclusive.
8633 ///
8634 /// # Example
8635 /// ```ignore,no_run
8636 /// # use google_cloud_documentai_v1::model::document::chunked_document::chunk::ChunkField;
8637 /// use google_cloud_documentai_v1::model::document::chunked_document::chunk::TableChunkField;
8638 /// let x = ChunkField::new().set_table_chunk_field(TableChunkField::default()/* use setters */);
8639 /// assert!(x.table_chunk_field().is_some());
8640 /// assert!(x.image_chunk_field().is_none());
8641 /// ```
8642 pub fn set_table_chunk_field<
8643 T: std::convert::Into<
8644 std::boxed::Box<
8645 crate::model::document::chunked_document::chunk::TableChunkField,
8646 >,
8647 >,
8648 >(
8649 mut self,
8650 v: T,
8651 ) -> Self {
8652 self.field_type = std::option::Option::Some(
8653 crate::model::document::chunked_document::chunk::chunk_field::FieldType::TableChunkField(
8654 v.into()
8655 )
8656 );
8657 self
8658 }
8659 }
8660
8661 impl wkt::message::Message for ChunkField {
8662 fn typename() -> &'static str {
8663 "type.googleapis.com/google.cloud.documentai.v1.Document.ChunkedDocument.Chunk.ChunkField"
8664 }
8665 }
8666
8667 /// Defines additional types related to [ChunkField].
8668 pub mod chunk_field {
8669 #[allow(unused_imports)]
8670 use super::*;
8671
8672 /// The type of the chunk field.
8673 #[derive(Clone, Debug, PartialEq)]
8674 #[non_exhaustive]
8675 pub enum FieldType {
8676 /// The image chunk field in the chunk.
8677 ImageChunkField(
8678 std::boxed::Box<
8679 crate::model::document::chunked_document::chunk::ImageChunkField,
8680 >,
8681 ),
8682 /// The table chunk field in the chunk.
8683 TableChunkField(
8684 std::boxed::Box<
8685 crate::model::document::chunked_document::chunk::TableChunkField,
8686 >,
8687 ),
8688 }
8689 }
8690 }
8691 }
8692
8693 /// Represents a blob asset. It's used to store the content of the inline blob
8694 /// in this document, for example, image bytes, such that it can be referenced
8695 /// by other fields in the document via asset ID.
8696 #[derive(Clone, Default, PartialEq)]
8697 #[non_exhaustive]
8698 pub struct BlobAsset {
8699 /// Optional. The id of the blob asset.
8700 pub asset_id: std::string::String,
8701
8702 /// Optional. The content of the blob asset, for example, image bytes.
8703 pub content: ::bytes::Bytes,
8704
8705 /// The mime type of the blob asset.
8706 /// An IANA published [media type (MIME
8707 /// type)](https://www.iana.org/assignments/media-types/media-types.xhtml).
8708 pub mime_type: std::string::String,
8709
8710 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8711 }
8712
8713 impl BlobAsset {
8714 /// Creates a new default instance.
8715 pub fn new() -> Self {
8716 std::default::Default::default()
8717 }
8718
8719 /// Sets the value of [asset_id][crate::model::document::BlobAsset::asset_id].
8720 ///
8721 /// # Example
8722 /// ```ignore,no_run
8723 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8724 /// let x = BlobAsset::new().set_asset_id("example");
8725 /// ```
8726 pub fn set_asset_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8727 self.asset_id = v.into();
8728 self
8729 }
8730
8731 /// Sets the value of [content][crate::model::document::BlobAsset::content].
8732 ///
8733 /// # Example
8734 /// ```ignore,no_run
8735 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8736 /// let x = BlobAsset::new().set_content(bytes::Bytes::from_static(b"example"));
8737 /// ```
8738 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
8739 self.content = v.into();
8740 self
8741 }
8742
8743 /// Sets the value of [mime_type][crate::model::document::BlobAsset::mime_type].
8744 ///
8745 /// # Example
8746 /// ```ignore,no_run
8747 /// # use google_cloud_documentai_v1::model::document::BlobAsset;
8748 /// let x = BlobAsset::new().set_mime_type("example");
8749 /// ```
8750 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
8751 self.mime_type = v.into();
8752 self
8753 }
8754 }
8755
8756 impl wkt::message::Message for BlobAsset {
8757 fn typename() -> &'static str {
8758 "type.googleapis.com/google.cloud.documentai.v1.Document.BlobAsset"
8759 }
8760 }
8761
8762 /// The output of the validation given the document and the validation rules.
8763 #[derive(Clone, Default, PartialEq)]
8764 #[non_exhaustive]
8765 pub struct EntityValidationOutput {
8766 /// The result of each validation rule.
8767 pub validation_results:
8768 std::vec::Vec<crate::model::document::entity_validation_output::ValidationResult>,
8769
8770 /// The overall result of the validation, true if all applicable rules are
8771 /// valid.
8772 pub pass_all_rules: bool,
8773
8774 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8775 }
8776
8777 impl EntityValidationOutput {
8778 /// Creates a new default instance.
8779 pub fn new() -> Self {
8780 std::default::Default::default()
8781 }
8782
8783 /// Sets the value of [validation_results][crate::model::document::EntityValidationOutput::validation_results].
8784 ///
8785 /// # Example
8786 /// ```ignore,no_run
8787 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8788 /// use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8789 /// let x = EntityValidationOutput::new()
8790 /// .set_validation_results([
8791 /// ValidationResult::default()/* use setters */,
8792 /// ValidationResult::default()/* use (different) setters */,
8793 /// ]);
8794 /// ```
8795 pub fn set_validation_results<T, V>(mut self, v: T) -> Self
8796 where
8797 T: std::iter::IntoIterator<Item = V>,
8798 V: std::convert::Into<
8799 crate::model::document::entity_validation_output::ValidationResult,
8800 >,
8801 {
8802 use std::iter::Iterator;
8803 self.validation_results = v.into_iter().map(|i| i.into()).collect();
8804 self
8805 }
8806
8807 /// Sets the value of [pass_all_rules][crate::model::document::EntityValidationOutput::pass_all_rules].
8808 ///
8809 /// # Example
8810 /// ```ignore,no_run
8811 /// # use google_cloud_documentai_v1::model::document::EntityValidationOutput;
8812 /// let x = EntityValidationOutput::new().set_pass_all_rules(true);
8813 /// ```
8814 pub fn set_pass_all_rules<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
8815 self.pass_all_rules = v.into();
8816 self
8817 }
8818 }
8819
8820 impl wkt::message::Message for EntityValidationOutput {
8821 fn typename() -> &'static str {
8822 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput"
8823 }
8824 }
8825
8826 /// Defines additional types related to [EntityValidationOutput].
8827 pub mod entity_validation_output {
8828 #[allow(unused_imports)]
8829 use super::*;
8830
8831 /// Validation result for a single validation rule.
8832 #[derive(Clone, Default, PartialEq)]
8833 #[non_exhaustive]
8834 pub struct ValidationResult {
8835
8836 /// The name of the validation rule.
8837 pub rule_name: std::string::String,
8838
8839 /// The description of the validation rule.
8840 pub rule_description: std::string::String,
8841
8842 /// The result of the validation rule.
8843 pub validation_result_type: crate::model::document::entity_validation_output::validation_result::ValidationResultType,
8844
8845 /// The detailed information of the running the validation process using
8846 /// the entity from the document based on the validation rule.
8847 pub validation_details: std::string::String,
8848
8849 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
8850 }
8851
8852 impl ValidationResult {
8853 /// Creates a new default instance.
8854 pub fn new() -> Self {
8855 std::default::Default::default()
8856 }
8857
8858 /// Sets the value of [rule_name][crate::model::document::entity_validation_output::ValidationResult::rule_name].
8859 ///
8860 /// # Example
8861 /// ```ignore,no_run
8862 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8863 /// let x = ValidationResult::new().set_rule_name("example");
8864 /// ```
8865 pub fn set_rule_name<T: std::convert::Into<std::string::String>>(
8866 mut self,
8867 v: T,
8868 ) -> Self {
8869 self.rule_name = v.into();
8870 self
8871 }
8872
8873 /// Sets the value of [rule_description][crate::model::document::entity_validation_output::ValidationResult::rule_description].
8874 ///
8875 /// # Example
8876 /// ```ignore,no_run
8877 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8878 /// let x = ValidationResult::new().set_rule_description("example");
8879 /// ```
8880 pub fn set_rule_description<T: std::convert::Into<std::string::String>>(
8881 mut self,
8882 v: T,
8883 ) -> Self {
8884 self.rule_description = v.into();
8885 self
8886 }
8887
8888 /// Sets the value of [validation_result_type][crate::model::document::entity_validation_output::ValidationResult::validation_result_type].
8889 ///
8890 /// # Example
8891 /// ```ignore,no_run
8892 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8893 /// use google_cloud_documentai_v1::model::document::entity_validation_output::validation_result::ValidationResultType;
8894 /// let x0 = ValidationResult::new().set_validation_result_type(ValidationResultType::Valid);
8895 /// let x1 = ValidationResult::new().set_validation_result_type(ValidationResultType::Invalid);
8896 /// let x2 = ValidationResult::new().set_validation_result_type(ValidationResultType::Skipped);
8897 /// ```
8898 pub fn set_validation_result_type<T: std::convert::Into<crate::model::document::entity_validation_output::validation_result::ValidationResultType>>(mut self, v: T) -> Self{
8899 self.validation_result_type = v.into();
8900 self
8901 }
8902
8903 /// Sets the value of [validation_details][crate::model::document::entity_validation_output::ValidationResult::validation_details].
8904 ///
8905 /// # Example
8906 /// ```ignore,no_run
8907 /// # use google_cloud_documentai_v1::model::document::entity_validation_output::ValidationResult;
8908 /// let x = ValidationResult::new().set_validation_details("example");
8909 /// ```
8910 pub fn set_validation_details<T: std::convert::Into<std::string::String>>(
8911 mut self,
8912 v: T,
8913 ) -> Self {
8914 self.validation_details = v.into();
8915 self
8916 }
8917 }
8918
8919 impl wkt::message::Message for ValidationResult {
8920 fn typename() -> &'static str {
8921 "type.googleapis.com/google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult"
8922 }
8923 }
8924
8925 /// Defines additional types related to [ValidationResult].
8926 pub mod validation_result {
8927 #[allow(unused_imports)]
8928 use super::*;
8929
8930 /// The result of the validation rule.
8931 ///
8932 /// # Working with unknown values
8933 ///
8934 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
8935 /// additional enum variants at any time. Adding new variants is not considered
8936 /// a breaking change. Applications should write their code in anticipation of:
8937 ///
8938 /// - New values appearing in future releases of the client library, **and**
8939 /// - New values received dynamically, without application changes.
8940 ///
8941 /// Please consult the [Working with enums] section in the user guide for some
8942 /// guidelines.
8943 ///
8944 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
8945 #[derive(Clone, Debug, PartialEq)]
8946 #[non_exhaustive]
8947 pub enum ValidationResultType {
8948 /// The validation result type is unspecified.
8949 Unspecified,
8950 /// The validation is valid.
8951 Valid,
8952 /// The validation is invalid.
8953 Invalid,
8954 /// The validation is skipped.
8955 Skipped,
8956 /// The validation is not applicable.
8957 NotApplicable,
8958 /// If set, the enum was initialized with an unknown value.
8959 ///
8960 /// Applications can examine the value using [ValidationResultType::value] or
8961 /// [ValidationResultType::name].
8962 UnknownValue(validation_result_type::UnknownValue),
8963 }
8964
8965 #[doc(hidden)]
8966 pub mod validation_result_type {
8967 #[allow(unused_imports)]
8968 use super::*;
8969 #[derive(Clone, Debug, PartialEq)]
8970 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
8971 }
8972
8973 impl ValidationResultType {
8974 /// Gets the enum value.
8975 ///
8976 /// Returns `None` if the enum contains an unknown value deserialized from
8977 /// the string representation of enums.
8978 pub fn value(&self) -> std::option::Option<i32> {
8979 match self {
8980 Self::Unspecified => std::option::Option::Some(0),
8981 Self::Valid => std::option::Option::Some(1),
8982 Self::Invalid => std::option::Option::Some(2),
8983 Self::Skipped => std::option::Option::Some(3),
8984 Self::NotApplicable => std::option::Option::Some(4),
8985 Self::UnknownValue(u) => u.0.value(),
8986 }
8987 }
8988
8989 /// Gets the enum value as a string.
8990 ///
8991 /// Returns `None` if the enum contains an unknown value deserialized from
8992 /// the integer representation of enums.
8993 pub fn name(&self) -> std::option::Option<&str> {
8994 match self {
8995 Self::Unspecified => {
8996 std::option::Option::Some("VALIDATION_RESULT_TYPE_UNSPECIFIED")
8997 }
8998 Self::Valid => std::option::Option::Some("VALIDATION_RESULT_TYPE_VALID"),
8999 Self::Invalid => {
9000 std::option::Option::Some("VALIDATION_RESULT_TYPE_INVALID")
9001 }
9002 Self::Skipped => {
9003 std::option::Option::Some("VALIDATION_RESULT_TYPE_SKIPPED")
9004 }
9005 Self::NotApplicable => {
9006 std::option::Option::Some("VALIDATION_RESULT_TYPE_NOT_APPLICABLE")
9007 }
9008 Self::UnknownValue(u) => u.0.name(),
9009 }
9010 }
9011 }
9012
9013 impl std::default::Default for ValidationResultType {
9014 fn default() -> Self {
9015 use std::convert::From;
9016 Self::from(0)
9017 }
9018 }
9019
9020 impl std::fmt::Display for ValidationResultType {
9021 fn fmt(
9022 &self,
9023 f: &mut std::fmt::Formatter<'_>,
9024 ) -> std::result::Result<(), std::fmt::Error> {
9025 wkt::internal::display_enum(f, self.name(), self.value())
9026 }
9027 }
9028
9029 impl std::convert::From<i32> for ValidationResultType {
9030 fn from(value: i32) -> Self {
9031 match value {
9032 0 => Self::Unspecified,
9033 1 => Self::Valid,
9034 2 => Self::Invalid,
9035 3 => Self::Skipped,
9036 4 => Self::NotApplicable,
9037 _ => Self::UnknownValue(validation_result_type::UnknownValue(
9038 wkt::internal::UnknownEnumValue::Integer(value),
9039 )),
9040 }
9041 }
9042 }
9043
9044 impl std::convert::From<&str> for ValidationResultType {
9045 fn from(value: &str) -> Self {
9046 use std::string::ToString;
9047 match value {
9048 "VALIDATION_RESULT_TYPE_UNSPECIFIED" => Self::Unspecified,
9049 "VALIDATION_RESULT_TYPE_VALID" => Self::Valid,
9050 "VALIDATION_RESULT_TYPE_INVALID" => Self::Invalid,
9051 "VALIDATION_RESULT_TYPE_SKIPPED" => Self::Skipped,
9052 "VALIDATION_RESULT_TYPE_NOT_APPLICABLE" => Self::NotApplicable,
9053 _ => Self::UnknownValue(validation_result_type::UnknownValue(
9054 wkt::internal::UnknownEnumValue::String(value.to_string()),
9055 )),
9056 }
9057 }
9058 }
9059
9060 impl serde::ser::Serialize for ValidationResultType {
9061 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
9062 where
9063 S: serde::Serializer,
9064 {
9065 match self {
9066 Self::Unspecified => serializer.serialize_i32(0),
9067 Self::Valid => serializer.serialize_i32(1),
9068 Self::Invalid => serializer.serialize_i32(2),
9069 Self::Skipped => serializer.serialize_i32(3),
9070 Self::NotApplicable => serializer.serialize_i32(4),
9071 Self::UnknownValue(u) => u.0.serialize(serializer),
9072 }
9073 }
9074 }
9075
9076 impl<'de> serde::de::Deserialize<'de> for ValidationResultType {
9077 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
9078 where
9079 D: serde::Deserializer<'de>,
9080 {
9081 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ValidationResultType>::new(
9082 ".google.cloud.documentai.v1.Document.EntityValidationOutput.ValidationResult.ValidationResultType"))
9083 }
9084 }
9085 }
9086 }
9087
9088 /// Entity revision.
9089 #[derive(Clone, Default, PartialEq)]
9090 #[non_exhaustive]
9091 pub struct EntitiesRevision {
9092 /// The revision id.
9093 pub revision_id: std::string::String,
9094
9095 /// The entities in this revision.
9096 pub entities: std::vec::Vec<crate::model::document::Entity>,
9097
9098 /// The entity validation output for this revision.
9099 pub entity_validation_output:
9100 std::option::Option<crate::model::document::EntityValidationOutput>,
9101
9102 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9103 }
9104
9105 impl EntitiesRevision {
9106 /// Creates a new default instance.
9107 pub fn new() -> Self {
9108 std::default::Default::default()
9109 }
9110
9111 /// Sets the value of [revision_id][crate::model::document::EntitiesRevision::revision_id].
9112 ///
9113 /// # Example
9114 /// ```ignore,no_run
9115 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9116 /// let x = EntitiesRevision::new().set_revision_id("example");
9117 /// ```
9118 pub fn set_revision_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9119 self.revision_id = v.into();
9120 self
9121 }
9122
9123 /// Sets the value of [entities][crate::model::document::EntitiesRevision::entities].
9124 ///
9125 /// # Example
9126 /// ```ignore,no_run
9127 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9128 /// use google_cloud_documentai_v1::model::document::Entity;
9129 /// let x = EntitiesRevision::new()
9130 /// .set_entities([
9131 /// Entity::default()/* use setters */,
9132 /// Entity::default()/* use (different) setters */,
9133 /// ]);
9134 /// ```
9135 pub fn set_entities<T, V>(mut self, v: T) -> Self
9136 where
9137 T: std::iter::IntoIterator<Item = V>,
9138 V: std::convert::Into<crate::model::document::Entity>,
9139 {
9140 use std::iter::Iterator;
9141 self.entities = v.into_iter().map(|i| i.into()).collect();
9142 self
9143 }
9144
9145 /// Sets the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9146 ///
9147 /// # Example
9148 /// ```ignore,no_run
9149 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9150 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9151 /// let x = EntitiesRevision::new().set_entity_validation_output(EntityValidationOutput::default()/* use setters */);
9152 /// ```
9153 pub fn set_entity_validation_output<T>(mut self, v: T) -> Self
9154 where
9155 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9156 {
9157 self.entity_validation_output = std::option::Option::Some(v.into());
9158 self
9159 }
9160
9161 /// Sets or clears the value of [entity_validation_output][crate::model::document::EntitiesRevision::entity_validation_output].
9162 ///
9163 /// # Example
9164 /// ```ignore,no_run
9165 /// # use google_cloud_documentai_v1::model::document::EntitiesRevision;
9166 /// use google_cloud_documentai_v1::model::document::EntityValidationOutput;
9167 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(Some(EntityValidationOutput::default()/* use setters */));
9168 /// let x = EntitiesRevision::new().set_or_clear_entity_validation_output(None::<EntityValidationOutput>);
9169 /// ```
9170 pub fn set_or_clear_entity_validation_output<T>(mut self, v: std::option::Option<T>) -> Self
9171 where
9172 T: std::convert::Into<crate::model::document::EntityValidationOutput>,
9173 {
9174 self.entity_validation_output = v.map(|x| x.into());
9175 self
9176 }
9177 }
9178
9179 impl wkt::message::Message for EntitiesRevision {
9180 fn typename() -> &'static str {
9181 "type.googleapis.com/google.cloud.documentai.v1.Document.EntitiesRevision"
9182 }
9183 }
9184
9185 /// Original source document from the user.
9186 #[derive(Clone, Debug, PartialEq)]
9187 #[non_exhaustive]
9188 pub enum Source {
9189 /// Optional. Currently supports Google Cloud Storage URI of the form
9190 /// `gs://bucket_name/object_name`. Object versioning is not supported.
9191 /// For more information, refer to [Google Cloud Storage Request
9192 /// URIs](https://cloud.google.com/storage/docs/reference-uris).
9193 Uri(std::string::String),
9194 /// Optional. Inline document content, represented as a stream of bytes.
9195 /// Note: As with all `bytes` fields, protobuffers use a pure binary
9196 /// representation, whereas JSON representations use base64.
9197 Content(::bytes::Bytes),
9198 }
9199}
9200
9201/// Payload message of raw document content (bytes).
9202#[derive(Clone, Default, PartialEq)]
9203#[non_exhaustive]
9204pub struct RawDocument {
9205 /// Inline document content.
9206 pub content: ::bytes::Bytes,
9207
9208 /// An IANA MIME type (RFC6838) indicating the nature and format of the
9209 /// [content][google.cloud.documentai.v1.RawDocument.content].
9210 ///
9211 /// [google.cloud.documentai.v1.RawDocument.content]: crate::model::RawDocument::content
9212 pub mime_type: std::string::String,
9213
9214 /// The display name of the document, it supports all Unicode characters except
9215 /// the following:
9216 /// `*`, `?`, `[`, `]`, `%`, `{`, `}`,`'`, `\"`, `,`
9217 /// `~`, `=` and `:` are reserved.
9218 /// If not specified, a default ID is generated.
9219 pub display_name: std::string::String,
9220
9221 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9222}
9223
9224impl RawDocument {
9225 /// Creates a new default instance.
9226 pub fn new() -> Self {
9227 std::default::Default::default()
9228 }
9229
9230 /// Sets the value of [content][crate::model::RawDocument::content].
9231 ///
9232 /// # Example
9233 /// ```ignore,no_run
9234 /// # use google_cloud_documentai_v1::model::RawDocument;
9235 /// let x = RawDocument::new().set_content(bytes::Bytes::from_static(b"example"));
9236 /// ```
9237 pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
9238 self.content = v.into();
9239 self
9240 }
9241
9242 /// Sets the value of [mime_type][crate::model::RawDocument::mime_type].
9243 ///
9244 /// # Example
9245 /// ```ignore,no_run
9246 /// # use google_cloud_documentai_v1::model::RawDocument;
9247 /// let x = RawDocument::new().set_mime_type("example");
9248 /// ```
9249 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9250 self.mime_type = v.into();
9251 self
9252 }
9253
9254 /// Sets the value of [display_name][crate::model::RawDocument::display_name].
9255 ///
9256 /// # Example
9257 /// ```ignore,no_run
9258 /// # use google_cloud_documentai_v1::model::RawDocument;
9259 /// let x = RawDocument::new().set_display_name("example");
9260 /// ```
9261 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9262 self.display_name = v.into();
9263 self
9264 }
9265}
9266
9267impl wkt::message::Message for RawDocument {
9268 fn typename() -> &'static str {
9269 "type.googleapis.com/google.cloud.documentai.v1.RawDocument"
9270 }
9271}
9272
9273/// Specifies a document stored on Cloud Storage.
9274#[derive(Clone, Default, PartialEq)]
9275#[non_exhaustive]
9276pub struct GcsDocument {
9277 /// The Cloud Storage object uri.
9278 pub gcs_uri: std::string::String,
9279
9280 /// An IANA MIME type (RFC6838) of the content.
9281 pub mime_type: std::string::String,
9282
9283 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9284}
9285
9286impl GcsDocument {
9287 /// Creates a new default instance.
9288 pub fn new() -> Self {
9289 std::default::Default::default()
9290 }
9291
9292 /// Sets the value of [gcs_uri][crate::model::GcsDocument::gcs_uri].
9293 ///
9294 /// # Example
9295 /// ```ignore,no_run
9296 /// # use google_cloud_documentai_v1::model::GcsDocument;
9297 /// let x = GcsDocument::new().set_gcs_uri("example");
9298 /// ```
9299 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9300 self.gcs_uri = v.into();
9301 self
9302 }
9303
9304 /// Sets the value of [mime_type][crate::model::GcsDocument::mime_type].
9305 ///
9306 /// # Example
9307 /// ```ignore,no_run
9308 /// # use google_cloud_documentai_v1::model::GcsDocument;
9309 /// let x = GcsDocument::new().set_mime_type("example");
9310 /// ```
9311 pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9312 self.mime_type = v.into();
9313 self
9314 }
9315}
9316
9317impl wkt::message::Message for GcsDocument {
9318 fn typename() -> &'static str {
9319 "type.googleapis.com/google.cloud.documentai.v1.GcsDocument"
9320 }
9321}
9322
9323/// Specifies a set of documents on Cloud Storage.
9324#[derive(Clone, Default, PartialEq)]
9325#[non_exhaustive]
9326pub struct GcsDocuments {
9327 /// The list of documents.
9328 pub documents: std::vec::Vec<crate::model::GcsDocument>,
9329
9330 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9331}
9332
9333impl GcsDocuments {
9334 /// Creates a new default instance.
9335 pub fn new() -> Self {
9336 std::default::Default::default()
9337 }
9338
9339 /// Sets the value of [documents][crate::model::GcsDocuments::documents].
9340 ///
9341 /// # Example
9342 /// ```ignore,no_run
9343 /// # use google_cloud_documentai_v1::model::GcsDocuments;
9344 /// use google_cloud_documentai_v1::model::GcsDocument;
9345 /// let x = GcsDocuments::new()
9346 /// .set_documents([
9347 /// GcsDocument::default()/* use setters */,
9348 /// GcsDocument::default()/* use (different) setters */,
9349 /// ]);
9350 /// ```
9351 pub fn set_documents<T, V>(mut self, v: T) -> Self
9352 where
9353 T: std::iter::IntoIterator<Item = V>,
9354 V: std::convert::Into<crate::model::GcsDocument>,
9355 {
9356 use std::iter::Iterator;
9357 self.documents = v.into_iter().map(|i| i.into()).collect();
9358 self
9359 }
9360}
9361
9362impl wkt::message::Message for GcsDocuments {
9363 fn typename() -> &'static str {
9364 "type.googleapis.com/google.cloud.documentai.v1.GcsDocuments"
9365 }
9366}
9367
9368/// Specifies all documents on Cloud Storage with a common prefix.
9369#[derive(Clone, Default, PartialEq)]
9370#[non_exhaustive]
9371pub struct GcsPrefix {
9372 /// The URI prefix.
9373 pub gcs_uri_prefix: std::string::String,
9374
9375 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9376}
9377
9378impl GcsPrefix {
9379 /// Creates a new default instance.
9380 pub fn new() -> Self {
9381 std::default::Default::default()
9382 }
9383
9384 /// Sets the value of [gcs_uri_prefix][crate::model::GcsPrefix::gcs_uri_prefix].
9385 ///
9386 /// # Example
9387 /// ```ignore,no_run
9388 /// # use google_cloud_documentai_v1::model::GcsPrefix;
9389 /// let x = GcsPrefix::new().set_gcs_uri_prefix("example");
9390 /// ```
9391 pub fn set_gcs_uri_prefix<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9392 self.gcs_uri_prefix = v.into();
9393 self
9394 }
9395}
9396
9397impl wkt::message::Message for GcsPrefix {
9398 fn typename() -> &'static str {
9399 "type.googleapis.com/google.cloud.documentai.v1.GcsPrefix"
9400 }
9401}
9402
9403/// The common config to specify a set of documents used as input.
9404#[derive(Clone, Default, PartialEq)]
9405#[non_exhaustive]
9406pub struct BatchDocumentsInputConfig {
9407 /// The source. Make sure that the caller of the API has storage.objects.get
9408 /// access to the buckets.
9409 pub source: std::option::Option<crate::model::batch_documents_input_config::Source>,
9410
9411 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9412}
9413
9414impl BatchDocumentsInputConfig {
9415 /// Creates a new default instance.
9416 pub fn new() -> Self {
9417 std::default::Default::default()
9418 }
9419
9420 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source].
9421 ///
9422 /// Note that all the setters affecting `source` are mutually
9423 /// exclusive.
9424 ///
9425 /// # Example
9426 /// ```ignore,no_run
9427 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9428 /// use google_cloud_documentai_v1::model::GcsPrefix;
9429 /// let x = BatchDocumentsInputConfig::new().set_source(Some(
9430 /// google_cloud_documentai_v1::model::batch_documents_input_config::Source::GcsPrefix(GcsPrefix::default().into())));
9431 /// ```
9432 pub fn set_source<
9433 T: std::convert::Into<std::option::Option<crate::model::batch_documents_input_config::Source>>,
9434 >(
9435 mut self,
9436 v: T,
9437 ) -> Self {
9438 self.source = v.into();
9439 self
9440 }
9441
9442 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9443 /// if it holds a `GcsPrefix`, `None` if the field is not set or
9444 /// holds a different branch.
9445 pub fn gcs_prefix(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsPrefix>> {
9446 #[allow(unreachable_patterns)]
9447 self.source.as_ref().and_then(|v| match v {
9448 crate::model::batch_documents_input_config::Source::GcsPrefix(v) => {
9449 std::option::Option::Some(v)
9450 }
9451 _ => std::option::Option::None,
9452 })
9453 }
9454
9455 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9456 /// to hold a `GcsPrefix`.
9457 ///
9458 /// Note that all the setters affecting `source` are
9459 /// mutually exclusive.
9460 ///
9461 /// # Example
9462 /// ```ignore,no_run
9463 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9464 /// use google_cloud_documentai_v1::model::GcsPrefix;
9465 /// let x = BatchDocumentsInputConfig::new().set_gcs_prefix(GcsPrefix::default()/* use setters */);
9466 /// assert!(x.gcs_prefix().is_some());
9467 /// assert!(x.gcs_documents().is_none());
9468 /// ```
9469 pub fn set_gcs_prefix<T: std::convert::Into<std::boxed::Box<crate::model::GcsPrefix>>>(
9470 mut self,
9471 v: T,
9472 ) -> Self {
9473 self.source = std::option::Option::Some(
9474 crate::model::batch_documents_input_config::Source::GcsPrefix(v.into()),
9475 );
9476 self
9477 }
9478
9479 /// The value of [source][crate::model::BatchDocumentsInputConfig::source]
9480 /// if it holds a `GcsDocuments`, `None` if the field is not set or
9481 /// holds a different branch.
9482 pub fn gcs_documents(
9483 &self,
9484 ) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocuments>> {
9485 #[allow(unreachable_patterns)]
9486 self.source.as_ref().and_then(|v| match v {
9487 crate::model::batch_documents_input_config::Source::GcsDocuments(v) => {
9488 std::option::Option::Some(v)
9489 }
9490 _ => std::option::Option::None,
9491 })
9492 }
9493
9494 /// Sets the value of [source][crate::model::BatchDocumentsInputConfig::source]
9495 /// to hold a `GcsDocuments`.
9496 ///
9497 /// Note that all the setters affecting `source` are
9498 /// mutually exclusive.
9499 ///
9500 /// # Example
9501 /// ```ignore,no_run
9502 /// # use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
9503 /// use google_cloud_documentai_v1::model::GcsDocuments;
9504 /// let x = BatchDocumentsInputConfig::new().set_gcs_documents(GcsDocuments::default()/* use setters */);
9505 /// assert!(x.gcs_documents().is_some());
9506 /// assert!(x.gcs_prefix().is_none());
9507 /// ```
9508 pub fn set_gcs_documents<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocuments>>>(
9509 mut self,
9510 v: T,
9511 ) -> Self {
9512 self.source = std::option::Option::Some(
9513 crate::model::batch_documents_input_config::Source::GcsDocuments(v.into()),
9514 );
9515 self
9516 }
9517}
9518
9519impl wkt::message::Message for BatchDocumentsInputConfig {
9520 fn typename() -> &'static str {
9521 "type.googleapis.com/google.cloud.documentai.v1.BatchDocumentsInputConfig"
9522 }
9523}
9524
9525/// Defines additional types related to [BatchDocumentsInputConfig].
9526pub mod batch_documents_input_config {
9527 #[allow(unused_imports)]
9528 use super::*;
9529
9530 /// The source. Make sure that the caller of the API has storage.objects.get
9531 /// access to the buckets.
9532 #[derive(Clone, Debug, PartialEq)]
9533 #[non_exhaustive]
9534 pub enum Source {
9535 /// The set of documents that match the specified Cloud Storage `gcs_prefix`.
9536 GcsPrefix(std::boxed::Box<crate::model::GcsPrefix>),
9537 /// The set of documents individually specified on Cloud Storage.
9538 GcsDocuments(std::boxed::Box<crate::model::GcsDocuments>),
9539 }
9540}
9541
9542/// Config that controls the output of documents. All documents will be written
9543/// as a JSON file.
9544#[derive(Clone, Default, PartialEq)]
9545#[non_exhaustive]
9546pub struct DocumentOutputConfig {
9547 /// The destination of the results.
9548 pub destination: std::option::Option<crate::model::document_output_config::Destination>,
9549
9550 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9551}
9552
9553impl DocumentOutputConfig {
9554 /// Creates a new default instance.
9555 pub fn new() -> Self {
9556 std::default::Default::default()
9557 }
9558
9559 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination].
9560 ///
9561 /// Note that all the setters affecting `destination` are mutually
9562 /// exclusive.
9563 ///
9564 /// # Example
9565 /// ```ignore,no_run
9566 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9567 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9568 /// let x = DocumentOutputConfig::new().set_destination(Some(
9569 /// google_cloud_documentai_v1::model::document_output_config::Destination::GcsOutputConfig(GcsOutputConfig::default().into())));
9570 /// ```
9571 pub fn set_destination<
9572 T: std::convert::Into<std::option::Option<crate::model::document_output_config::Destination>>,
9573 >(
9574 mut self,
9575 v: T,
9576 ) -> Self {
9577 self.destination = v.into();
9578 self
9579 }
9580
9581 /// The value of [destination][crate::model::DocumentOutputConfig::destination]
9582 /// if it holds a `GcsOutputConfig`, `None` if the field is not set or
9583 /// holds a different branch.
9584 pub fn gcs_output_config(
9585 &self,
9586 ) -> std::option::Option<&std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>
9587 {
9588 #[allow(unreachable_patterns)]
9589 self.destination.as_ref().and_then(|v| match v {
9590 crate::model::document_output_config::Destination::GcsOutputConfig(v) => {
9591 std::option::Option::Some(v)
9592 }
9593 _ => std::option::Option::None,
9594 })
9595 }
9596
9597 /// Sets the value of [destination][crate::model::DocumentOutputConfig::destination]
9598 /// to hold a `GcsOutputConfig`.
9599 ///
9600 /// Note that all the setters affecting `destination` are
9601 /// mutually exclusive.
9602 ///
9603 /// # Example
9604 /// ```ignore,no_run
9605 /// # use google_cloud_documentai_v1::model::DocumentOutputConfig;
9606 /// use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9607 /// let x = DocumentOutputConfig::new().set_gcs_output_config(GcsOutputConfig::default()/* use setters */);
9608 /// assert!(x.gcs_output_config().is_some());
9609 /// ```
9610 pub fn set_gcs_output_config<
9611 T: std::convert::Into<std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>>,
9612 >(
9613 mut self,
9614 v: T,
9615 ) -> Self {
9616 self.destination = std::option::Option::Some(
9617 crate::model::document_output_config::Destination::GcsOutputConfig(v.into()),
9618 );
9619 self
9620 }
9621}
9622
9623impl wkt::message::Message for DocumentOutputConfig {
9624 fn typename() -> &'static str {
9625 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig"
9626 }
9627}
9628
9629/// Defines additional types related to [DocumentOutputConfig].
9630pub mod document_output_config {
9631 #[allow(unused_imports)]
9632 use super::*;
9633
9634 /// The configuration used when outputting documents.
9635 #[derive(Clone, Default, PartialEq)]
9636 #[non_exhaustive]
9637 pub struct GcsOutputConfig {
9638 /// The Cloud Storage uri (a directory) of the output.
9639 pub gcs_uri: std::string::String,
9640
9641 /// Specifies which fields to include in the output documents.
9642 /// Only supports top level document and pages field so it must be in the
9643 /// form of `{document_field_name}` or `pages.{page_field_name}`.
9644 pub field_mask: std::option::Option<wkt::FieldMask>,
9645
9646 /// Specifies the sharding config for the output document.
9647 pub sharding_config: std::option::Option<
9648 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9649 >,
9650
9651 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9652 }
9653
9654 impl GcsOutputConfig {
9655 /// Creates a new default instance.
9656 pub fn new() -> Self {
9657 std::default::Default::default()
9658 }
9659
9660 /// Sets the value of [gcs_uri][crate::model::document_output_config::GcsOutputConfig::gcs_uri].
9661 ///
9662 /// # Example
9663 /// ```ignore,no_run
9664 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9665 /// let x = GcsOutputConfig::new().set_gcs_uri("example");
9666 /// ```
9667 pub fn set_gcs_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
9668 self.gcs_uri = v.into();
9669 self
9670 }
9671
9672 /// Sets the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9673 ///
9674 /// # Example
9675 /// ```ignore,no_run
9676 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9677 /// use wkt::FieldMask;
9678 /// let x = GcsOutputConfig::new().set_field_mask(FieldMask::default()/* use setters */);
9679 /// ```
9680 pub fn set_field_mask<T>(mut self, v: T) -> Self
9681 where
9682 T: std::convert::Into<wkt::FieldMask>,
9683 {
9684 self.field_mask = std::option::Option::Some(v.into());
9685 self
9686 }
9687
9688 /// Sets or clears the value of [field_mask][crate::model::document_output_config::GcsOutputConfig::field_mask].
9689 ///
9690 /// # Example
9691 /// ```ignore,no_run
9692 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9693 /// use wkt::FieldMask;
9694 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
9695 /// let x = GcsOutputConfig::new().set_or_clear_field_mask(None::<FieldMask>);
9696 /// ```
9697 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
9698 where
9699 T: std::convert::Into<wkt::FieldMask>,
9700 {
9701 self.field_mask = v.map(|x| x.into());
9702 self
9703 }
9704
9705 /// Sets the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9706 ///
9707 /// # Example
9708 /// ```ignore,no_run
9709 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9710 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9711 /// let x = GcsOutputConfig::new().set_sharding_config(ShardingConfig::default()/* use setters */);
9712 /// ```
9713 pub fn set_sharding_config<T>(mut self, v: T) -> Self
9714 where
9715 T: std::convert::Into<
9716 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9717 >,
9718 {
9719 self.sharding_config = std::option::Option::Some(v.into());
9720 self
9721 }
9722
9723 /// Sets or clears the value of [sharding_config][crate::model::document_output_config::GcsOutputConfig::sharding_config].
9724 ///
9725 /// # Example
9726 /// ```ignore,no_run
9727 /// # use google_cloud_documentai_v1::model::document_output_config::GcsOutputConfig;
9728 /// use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9729 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(Some(ShardingConfig::default()/* use setters */));
9730 /// let x = GcsOutputConfig::new().set_or_clear_sharding_config(None::<ShardingConfig>);
9731 /// ```
9732 pub fn set_or_clear_sharding_config<T>(mut self, v: std::option::Option<T>) -> Self
9733 where
9734 T: std::convert::Into<
9735 crate::model::document_output_config::gcs_output_config::ShardingConfig,
9736 >,
9737 {
9738 self.sharding_config = v.map(|x| x.into());
9739 self
9740 }
9741 }
9742
9743 impl wkt::message::Message for GcsOutputConfig {
9744 fn typename() -> &'static str {
9745 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig"
9746 }
9747 }
9748
9749 /// Defines additional types related to [GcsOutputConfig].
9750 pub mod gcs_output_config {
9751 #[allow(unused_imports)]
9752 use super::*;
9753
9754 /// The sharding config for the output document.
9755 #[derive(Clone, Default, PartialEq)]
9756 #[non_exhaustive]
9757 pub struct ShardingConfig {
9758 /// The number of pages per shard.
9759 pub pages_per_shard: i32,
9760
9761 /// The number of overlapping pages between consecutive shards.
9762 pub pages_overlap: i32,
9763
9764 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9765 }
9766
9767 impl ShardingConfig {
9768 /// Creates a new default instance.
9769 pub fn new() -> Self {
9770 std::default::Default::default()
9771 }
9772
9773 /// Sets the value of [pages_per_shard][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_per_shard].
9774 ///
9775 /// # Example
9776 /// ```ignore,no_run
9777 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9778 /// let x = ShardingConfig::new().set_pages_per_shard(42);
9779 /// ```
9780 pub fn set_pages_per_shard<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9781 self.pages_per_shard = v.into();
9782 self
9783 }
9784
9785 /// Sets the value of [pages_overlap][crate::model::document_output_config::gcs_output_config::ShardingConfig::pages_overlap].
9786 ///
9787 /// # Example
9788 /// ```ignore,no_run
9789 /// # use google_cloud_documentai_v1::model::document_output_config::gcs_output_config::ShardingConfig;
9790 /// let x = ShardingConfig::new().set_pages_overlap(42);
9791 /// ```
9792 pub fn set_pages_overlap<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
9793 self.pages_overlap = v.into();
9794 self
9795 }
9796 }
9797
9798 impl wkt::message::Message for ShardingConfig {
9799 fn typename() -> &'static str {
9800 "type.googleapis.com/google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.ShardingConfig"
9801 }
9802 }
9803 }
9804
9805 /// The destination of the results.
9806 #[derive(Clone, Debug, PartialEq)]
9807 #[non_exhaustive]
9808 pub enum Destination {
9809 /// Output config to write the results to Cloud Storage.
9810 GcsOutputConfig(std::boxed::Box<crate::model::document_output_config::GcsOutputConfig>),
9811 }
9812}
9813
9814/// Config for Document OCR.
9815#[derive(Clone, Default, PartialEq)]
9816#[non_exhaustive]
9817pub struct OcrConfig {
9818 /// Hints for the OCR model.
9819 pub hints: std::option::Option<crate::model::ocr_config::Hints>,
9820
9821 /// Enables special handling for PDFs with existing text information. Results
9822 /// in better text extraction quality in such PDF inputs.
9823 pub enable_native_pdf_parsing: bool,
9824
9825 /// Enables intelligent document quality scores after OCR. Can help with
9826 /// diagnosing why OCR responses are of poor quality for a given input.
9827 /// Adds additional latency comparable to regular OCR to the process call.
9828 pub enable_image_quality_scores: bool,
9829
9830 /// A list of advanced OCR options to further fine-tune OCR behavior. Current
9831 /// valid values are:
9832 ///
9833 /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
9834 /// an alternative to the current ML-based layout detection algorithm.
9835 /// Customers can choose the best suitable layout algorithm based on their
9836 /// situation.
9837 pub advanced_ocr_options: std::vec::Vec<std::string::String>,
9838
9839 /// Includes symbol level OCR information if set to true.
9840 pub enable_symbol: bool,
9841
9842 /// Turn on font identification model and return font style information.
9843 /// Deprecated, use
9844 /// [PremiumFeatures.compute_style_info][google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]
9845 /// instead.
9846 ///
9847 /// [google.cloud.documentai.v1.OcrConfig.PremiumFeatures.compute_style_info]: crate::model::ocr_config::PremiumFeatures::compute_style_info
9848 #[deprecated]
9849 pub compute_style_info: bool,
9850
9851 /// Turn off character box detector in OCR engine. Character box detection is
9852 /// enabled by default in OCR 2.0 (and later) processors.
9853 pub disable_character_boxes_detection: bool,
9854
9855 /// Configurations for premium OCR features.
9856 pub premium_features: std::option::Option<crate::model::ocr_config::PremiumFeatures>,
9857
9858 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
9859}
9860
9861impl OcrConfig {
9862 /// Creates a new default instance.
9863 pub fn new() -> Self {
9864 std::default::Default::default()
9865 }
9866
9867 /// Sets the value of [hints][crate::model::OcrConfig::hints].
9868 ///
9869 /// # Example
9870 /// ```ignore,no_run
9871 /// # use google_cloud_documentai_v1::model::OcrConfig;
9872 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9873 /// let x = OcrConfig::new().set_hints(Hints::default()/* use setters */);
9874 /// ```
9875 pub fn set_hints<T>(mut self, v: T) -> Self
9876 where
9877 T: std::convert::Into<crate::model::ocr_config::Hints>,
9878 {
9879 self.hints = std::option::Option::Some(v.into());
9880 self
9881 }
9882
9883 /// Sets or clears the value of [hints][crate::model::OcrConfig::hints].
9884 ///
9885 /// # Example
9886 /// ```ignore,no_run
9887 /// # use google_cloud_documentai_v1::model::OcrConfig;
9888 /// use google_cloud_documentai_v1::model::ocr_config::Hints;
9889 /// let x = OcrConfig::new().set_or_clear_hints(Some(Hints::default()/* use setters */));
9890 /// let x = OcrConfig::new().set_or_clear_hints(None::<Hints>);
9891 /// ```
9892 pub fn set_or_clear_hints<T>(mut self, v: std::option::Option<T>) -> Self
9893 where
9894 T: std::convert::Into<crate::model::ocr_config::Hints>,
9895 {
9896 self.hints = v.map(|x| x.into());
9897 self
9898 }
9899
9900 /// Sets the value of [enable_native_pdf_parsing][crate::model::OcrConfig::enable_native_pdf_parsing].
9901 ///
9902 /// # Example
9903 /// ```ignore,no_run
9904 /// # use google_cloud_documentai_v1::model::OcrConfig;
9905 /// let x = OcrConfig::new().set_enable_native_pdf_parsing(true);
9906 /// ```
9907 pub fn set_enable_native_pdf_parsing<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9908 self.enable_native_pdf_parsing = v.into();
9909 self
9910 }
9911
9912 /// Sets the value of [enable_image_quality_scores][crate::model::OcrConfig::enable_image_quality_scores].
9913 ///
9914 /// # Example
9915 /// ```ignore,no_run
9916 /// # use google_cloud_documentai_v1::model::OcrConfig;
9917 /// let x = OcrConfig::new().set_enable_image_quality_scores(true);
9918 /// ```
9919 pub fn set_enable_image_quality_scores<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9920 self.enable_image_quality_scores = v.into();
9921 self
9922 }
9923
9924 /// Sets the value of [advanced_ocr_options][crate::model::OcrConfig::advanced_ocr_options].
9925 ///
9926 /// # Example
9927 /// ```ignore,no_run
9928 /// # use google_cloud_documentai_v1::model::OcrConfig;
9929 /// let x = OcrConfig::new().set_advanced_ocr_options(["a", "b", "c"]);
9930 /// ```
9931 pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
9932 where
9933 T: std::iter::IntoIterator<Item = V>,
9934 V: std::convert::Into<std::string::String>,
9935 {
9936 use std::iter::Iterator;
9937 self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
9938 self
9939 }
9940
9941 /// Sets the value of [enable_symbol][crate::model::OcrConfig::enable_symbol].
9942 ///
9943 /// # Example
9944 /// ```ignore,no_run
9945 /// # use google_cloud_documentai_v1::model::OcrConfig;
9946 /// let x = OcrConfig::new().set_enable_symbol(true);
9947 /// ```
9948 pub fn set_enable_symbol<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9949 self.enable_symbol = v.into();
9950 self
9951 }
9952
9953 /// Sets the value of [compute_style_info][crate::model::OcrConfig::compute_style_info].
9954 ///
9955 /// # Example
9956 /// ```ignore,no_run
9957 /// # use google_cloud_documentai_v1::model::OcrConfig;
9958 /// let x = OcrConfig::new().set_compute_style_info(true);
9959 /// ```
9960 #[deprecated]
9961 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
9962 self.compute_style_info = v.into();
9963 self
9964 }
9965
9966 /// Sets the value of [disable_character_boxes_detection][crate::model::OcrConfig::disable_character_boxes_detection].
9967 ///
9968 /// # Example
9969 /// ```ignore,no_run
9970 /// # use google_cloud_documentai_v1::model::OcrConfig;
9971 /// let x = OcrConfig::new().set_disable_character_boxes_detection(true);
9972 /// ```
9973 pub fn set_disable_character_boxes_detection<T: std::convert::Into<bool>>(
9974 mut self,
9975 v: T,
9976 ) -> Self {
9977 self.disable_character_boxes_detection = v.into();
9978 self
9979 }
9980
9981 /// Sets the value of [premium_features][crate::model::OcrConfig::premium_features].
9982 ///
9983 /// # Example
9984 /// ```ignore,no_run
9985 /// # use google_cloud_documentai_v1::model::OcrConfig;
9986 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
9987 /// let x = OcrConfig::new().set_premium_features(PremiumFeatures::default()/* use setters */);
9988 /// ```
9989 pub fn set_premium_features<T>(mut self, v: T) -> Self
9990 where
9991 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
9992 {
9993 self.premium_features = std::option::Option::Some(v.into());
9994 self
9995 }
9996
9997 /// Sets or clears the value of [premium_features][crate::model::OcrConfig::premium_features].
9998 ///
9999 /// # Example
10000 /// ```ignore,no_run
10001 /// # use google_cloud_documentai_v1::model::OcrConfig;
10002 /// use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10003 /// let x = OcrConfig::new().set_or_clear_premium_features(Some(PremiumFeatures::default()/* use setters */));
10004 /// let x = OcrConfig::new().set_or_clear_premium_features(None::<PremiumFeatures>);
10005 /// ```
10006 pub fn set_or_clear_premium_features<T>(mut self, v: std::option::Option<T>) -> Self
10007 where
10008 T: std::convert::Into<crate::model::ocr_config::PremiumFeatures>,
10009 {
10010 self.premium_features = v.map(|x| x.into());
10011 self
10012 }
10013}
10014
10015impl wkt::message::Message for OcrConfig {
10016 fn typename() -> &'static str {
10017 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig"
10018 }
10019}
10020
10021/// Defines additional types related to [OcrConfig].
10022pub mod ocr_config {
10023 #[allow(unused_imports)]
10024 use super::*;
10025
10026 /// Hints for OCR Engine
10027 #[derive(Clone, Default, PartialEq)]
10028 #[non_exhaustive]
10029 pub struct Hints {
10030 /// List of BCP-47 language codes to use for OCR. In most cases, not
10031 /// specifying it yields the best results since it enables automatic language
10032 /// detection. For languages based on the Latin alphabet, setting hints is
10033 /// not needed. In rare cases, when the language of the text in the
10034 /// image is known, setting a hint will help get better results (although it
10035 /// will be a significant hindrance if the hint is wrong).
10036 pub language_hints: std::vec::Vec<std::string::String>,
10037
10038 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10039 }
10040
10041 impl Hints {
10042 /// Creates a new default instance.
10043 pub fn new() -> Self {
10044 std::default::Default::default()
10045 }
10046
10047 /// Sets the value of [language_hints][crate::model::ocr_config::Hints::language_hints].
10048 ///
10049 /// # Example
10050 /// ```ignore,no_run
10051 /// # use google_cloud_documentai_v1::model::ocr_config::Hints;
10052 /// let x = Hints::new().set_language_hints(["a", "b", "c"]);
10053 /// ```
10054 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
10055 where
10056 T: std::iter::IntoIterator<Item = V>,
10057 V: std::convert::Into<std::string::String>,
10058 {
10059 use std::iter::Iterator;
10060 self.language_hints = v.into_iter().map(|i| i.into()).collect();
10061 self
10062 }
10063 }
10064
10065 impl wkt::message::Message for Hints {
10066 fn typename() -> &'static str {
10067 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.Hints"
10068 }
10069 }
10070
10071 /// Configurations for premium OCR features.
10072 #[derive(Clone, Default, PartialEq)]
10073 #[non_exhaustive]
10074 pub struct PremiumFeatures {
10075 /// Turn on selection mark detector in OCR engine. Only available in OCR 2.0
10076 /// (and later) processors.
10077 pub enable_selection_mark_detection: bool,
10078
10079 /// Turn on font identification model and return font style information.
10080 pub compute_style_info: bool,
10081
10082 /// Turn on the model that can extract LaTeX math formulas.
10083 pub enable_math_ocr: bool,
10084
10085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10086 }
10087
10088 impl PremiumFeatures {
10089 /// Creates a new default instance.
10090 pub fn new() -> Self {
10091 std::default::Default::default()
10092 }
10093
10094 /// Sets the value of [enable_selection_mark_detection][crate::model::ocr_config::PremiumFeatures::enable_selection_mark_detection].
10095 ///
10096 /// # Example
10097 /// ```ignore,no_run
10098 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10099 /// let x = PremiumFeatures::new().set_enable_selection_mark_detection(true);
10100 /// ```
10101 pub fn set_enable_selection_mark_detection<T: std::convert::Into<bool>>(
10102 mut self,
10103 v: T,
10104 ) -> Self {
10105 self.enable_selection_mark_detection = v.into();
10106 self
10107 }
10108
10109 /// Sets the value of [compute_style_info][crate::model::ocr_config::PremiumFeatures::compute_style_info].
10110 ///
10111 /// # Example
10112 /// ```ignore,no_run
10113 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10114 /// let x = PremiumFeatures::new().set_compute_style_info(true);
10115 /// ```
10116 pub fn set_compute_style_info<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10117 self.compute_style_info = v.into();
10118 self
10119 }
10120
10121 /// Sets the value of [enable_math_ocr][crate::model::ocr_config::PremiumFeatures::enable_math_ocr].
10122 ///
10123 /// # Example
10124 /// ```ignore,no_run
10125 /// # use google_cloud_documentai_v1::model::ocr_config::PremiumFeatures;
10126 /// let x = PremiumFeatures::new().set_enable_math_ocr(true);
10127 /// ```
10128 pub fn set_enable_math_ocr<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10129 self.enable_math_ocr = v.into();
10130 self
10131 }
10132 }
10133
10134 impl wkt::message::Message for PremiumFeatures {
10135 fn typename() -> &'static str {
10136 "type.googleapis.com/google.cloud.documentai.v1.OcrConfig.PremiumFeatures"
10137 }
10138 }
10139}
10140
10141/// Options for Process API
10142#[derive(Clone, Default, PartialEq)]
10143#[non_exhaustive]
10144pub struct ProcessOptions {
10145 /// Only applicable to `OCR_PROCESSOR` and `FORM_PARSER_PROCESSOR`.
10146 /// Returns error if set on other processor types.
10147 pub ocr_config: std::option::Option<crate::model::OcrConfig>,
10148
10149 /// Optional. Only applicable to `LAYOUT_PARSER_PROCESSOR`.
10150 /// Returns error if set on other processor types.
10151 pub layout_config: std::option::Option<crate::model::process_options::LayoutConfig>,
10152
10153 /// Optional. Override the schema of the
10154 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]. Will
10155 /// return an Invalid Argument error if this field is set when the underlying
10156 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] doesn't
10157 /// support schema override.
10158 ///
10159 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10160 pub schema_override: std::option::Option<crate::model::DocumentSchema>,
10161
10162 /// A subset of pages to process. If not specified, all pages are processed.
10163 /// If a page range is set, only the given pages are extracted and processed
10164 /// from the document. In the output document,
10165 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10166 /// refers to the page number in the original document.
10167 /// This configuration only applies to online processing with
10168 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10169 ///
10170 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10171 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10172 pub page_range: std::option::Option<crate::model::process_options::PageRange>,
10173
10174 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10175}
10176
10177impl ProcessOptions {
10178 /// Creates a new default instance.
10179 pub fn new() -> Self {
10180 std::default::Default::default()
10181 }
10182
10183 /// Sets the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10184 ///
10185 /// # Example
10186 /// ```ignore,no_run
10187 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10188 /// use google_cloud_documentai_v1::model::OcrConfig;
10189 /// let x = ProcessOptions::new().set_ocr_config(OcrConfig::default()/* use setters */);
10190 /// ```
10191 pub fn set_ocr_config<T>(mut self, v: T) -> Self
10192 where
10193 T: std::convert::Into<crate::model::OcrConfig>,
10194 {
10195 self.ocr_config = std::option::Option::Some(v.into());
10196 self
10197 }
10198
10199 /// Sets or clears the value of [ocr_config][crate::model::ProcessOptions::ocr_config].
10200 ///
10201 /// # Example
10202 /// ```ignore,no_run
10203 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10204 /// use google_cloud_documentai_v1::model::OcrConfig;
10205 /// let x = ProcessOptions::new().set_or_clear_ocr_config(Some(OcrConfig::default()/* use setters */));
10206 /// let x = ProcessOptions::new().set_or_clear_ocr_config(None::<OcrConfig>);
10207 /// ```
10208 pub fn set_or_clear_ocr_config<T>(mut self, v: std::option::Option<T>) -> Self
10209 where
10210 T: std::convert::Into<crate::model::OcrConfig>,
10211 {
10212 self.ocr_config = v.map(|x| x.into());
10213 self
10214 }
10215
10216 /// Sets the value of [layout_config][crate::model::ProcessOptions::layout_config].
10217 ///
10218 /// # Example
10219 /// ```ignore,no_run
10220 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10221 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10222 /// let x = ProcessOptions::new().set_layout_config(LayoutConfig::default()/* use setters */);
10223 /// ```
10224 pub fn set_layout_config<T>(mut self, v: T) -> Self
10225 where
10226 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10227 {
10228 self.layout_config = std::option::Option::Some(v.into());
10229 self
10230 }
10231
10232 /// Sets or clears the value of [layout_config][crate::model::ProcessOptions::layout_config].
10233 ///
10234 /// # Example
10235 /// ```ignore,no_run
10236 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10237 /// use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10238 /// let x = ProcessOptions::new().set_or_clear_layout_config(Some(LayoutConfig::default()/* use setters */));
10239 /// let x = ProcessOptions::new().set_or_clear_layout_config(None::<LayoutConfig>);
10240 /// ```
10241 pub fn set_or_clear_layout_config<T>(mut self, v: std::option::Option<T>) -> Self
10242 where
10243 T: std::convert::Into<crate::model::process_options::LayoutConfig>,
10244 {
10245 self.layout_config = v.map(|x| x.into());
10246 self
10247 }
10248
10249 /// Sets the value of [schema_override][crate::model::ProcessOptions::schema_override].
10250 ///
10251 /// # Example
10252 /// ```ignore,no_run
10253 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10254 /// use google_cloud_documentai_v1::model::DocumentSchema;
10255 /// let x = ProcessOptions::new().set_schema_override(DocumentSchema::default()/* use setters */);
10256 /// ```
10257 pub fn set_schema_override<T>(mut self, v: T) -> Self
10258 where
10259 T: std::convert::Into<crate::model::DocumentSchema>,
10260 {
10261 self.schema_override = std::option::Option::Some(v.into());
10262 self
10263 }
10264
10265 /// Sets or clears the value of [schema_override][crate::model::ProcessOptions::schema_override].
10266 ///
10267 /// # Example
10268 /// ```ignore,no_run
10269 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10270 /// use google_cloud_documentai_v1::model::DocumentSchema;
10271 /// let x = ProcessOptions::new().set_or_clear_schema_override(Some(DocumentSchema::default()/* use setters */));
10272 /// let x = ProcessOptions::new().set_or_clear_schema_override(None::<DocumentSchema>);
10273 /// ```
10274 pub fn set_or_clear_schema_override<T>(mut self, v: std::option::Option<T>) -> Self
10275 where
10276 T: std::convert::Into<crate::model::DocumentSchema>,
10277 {
10278 self.schema_override = v.map(|x| x.into());
10279 self
10280 }
10281
10282 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range].
10283 ///
10284 /// Note that all the setters affecting `page_range` are mutually
10285 /// exclusive.
10286 ///
10287 /// # Example
10288 /// ```ignore,no_run
10289 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10290 /// use google_cloud_documentai_v1::model::process_options::PageRange;
10291 /// let x = ProcessOptions::new().set_page_range(Some(PageRange::FromStart(42)));
10292 /// ```
10293 pub fn set_page_range<
10294 T: std::convert::Into<std::option::Option<crate::model::process_options::PageRange>>,
10295 >(
10296 mut self,
10297 v: T,
10298 ) -> Self {
10299 self.page_range = v.into();
10300 self
10301 }
10302
10303 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10304 /// if it holds a `IndividualPageSelector`, `None` if the field is not set or
10305 /// holds a different branch.
10306 pub fn individual_page_selector(
10307 &self,
10308 ) -> std::option::Option<&std::boxed::Box<crate::model::process_options::IndividualPageSelector>>
10309 {
10310 #[allow(unreachable_patterns)]
10311 self.page_range.as_ref().and_then(|v| match v {
10312 crate::model::process_options::PageRange::IndividualPageSelector(v) => {
10313 std::option::Option::Some(v)
10314 }
10315 _ => std::option::Option::None,
10316 })
10317 }
10318
10319 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10320 /// to hold a `IndividualPageSelector`.
10321 ///
10322 /// Note that all the setters affecting `page_range` are
10323 /// mutually exclusive.
10324 ///
10325 /// # Example
10326 /// ```ignore,no_run
10327 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10328 /// use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10329 /// let x = ProcessOptions::new().set_individual_page_selector(IndividualPageSelector::default()/* use setters */);
10330 /// assert!(x.individual_page_selector().is_some());
10331 /// assert!(x.from_start().is_none());
10332 /// assert!(x.from_end().is_none());
10333 /// ```
10334 pub fn set_individual_page_selector<
10335 T: std::convert::Into<std::boxed::Box<crate::model::process_options::IndividualPageSelector>>,
10336 >(
10337 mut self,
10338 v: T,
10339 ) -> Self {
10340 self.page_range = std::option::Option::Some(
10341 crate::model::process_options::PageRange::IndividualPageSelector(v.into()),
10342 );
10343 self
10344 }
10345
10346 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10347 /// if it holds a `FromStart`, `None` if the field is not set or
10348 /// holds a different branch.
10349 pub fn from_start(&self) -> std::option::Option<&i32> {
10350 #[allow(unreachable_patterns)]
10351 self.page_range.as_ref().and_then(|v| match v {
10352 crate::model::process_options::PageRange::FromStart(v) => std::option::Option::Some(v),
10353 _ => std::option::Option::None,
10354 })
10355 }
10356
10357 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10358 /// to hold a `FromStart`.
10359 ///
10360 /// Note that all the setters affecting `page_range` are
10361 /// mutually exclusive.
10362 ///
10363 /// # Example
10364 /// ```ignore,no_run
10365 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10366 /// let x = ProcessOptions::new().set_from_start(42);
10367 /// assert!(x.from_start().is_some());
10368 /// assert!(x.individual_page_selector().is_none());
10369 /// assert!(x.from_end().is_none());
10370 /// ```
10371 pub fn set_from_start<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10372 self.page_range = std::option::Option::Some(
10373 crate::model::process_options::PageRange::FromStart(v.into()),
10374 );
10375 self
10376 }
10377
10378 /// The value of [page_range][crate::model::ProcessOptions::page_range]
10379 /// if it holds a `FromEnd`, `None` if the field is not set or
10380 /// holds a different branch.
10381 pub fn from_end(&self) -> std::option::Option<&i32> {
10382 #[allow(unreachable_patterns)]
10383 self.page_range.as_ref().and_then(|v| match v {
10384 crate::model::process_options::PageRange::FromEnd(v) => std::option::Option::Some(v),
10385 _ => std::option::Option::None,
10386 })
10387 }
10388
10389 /// Sets the value of [page_range][crate::model::ProcessOptions::page_range]
10390 /// to hold a `FromEnd`.
10391 ///
10392 /// Note that all the setters affecting `page_range` are
10393 /// mutually exclusive.
10394 ///
10395 /// # Example
10396 /// ```ignore,no_run
10397 /// # use google_cloud_documentai_v1::model::ProcessOptions;
10398 /// let x = ProcessOptions::new().set_from_end(42);
10399 /// assert!(x.from_end().is_some());
10400 /// assert!(x.individual_page_selector().is_none());
10401 /// assert!(x.from_start().is_none());
10402 /// ```
10403 pub fn set_from_end<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10404 self.page_range =
10405 std::option::Option::Some(crate::model::process_options::PageRange::FromEnd(v.into()));
10406 self
10407 }
10408}
10409
10410impl wkt::message::Message for ProcessOptions {
10411 fn typename() -> &'static str {
10412 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions"
10413 }
10414}
10415
10416/// Defines additional types related to [ProcessOptions].
10417pub mod process_options {
10418 #[allow(unused_imports)]
10419 use super::*;
10420
10421 /// Serving config for layout parser processor.
10422 #[derive(Clone, Default, PartialEq)]
10423 #[non_exhaustive]
10424 pub struct LayoutConfig {
10425 /// Optional. Config for chunking in layout parser processor.
10426 pub chunking_config:
10427 std::option::Option<crate::model::process_options::layout_config::ChunkingConfig>,
10428
10429 /// Optional. Whether to include images in layout parser processor response.
10430 pub return_images: bool,
10431
10432 /// Optional. Whether to include bounding boxes in layout parser processor
10433 /// response.
10434 pub return_bounding_boxes: bool,
10435
10436 /// Optional. Whether to include image annotations in layout parser response.
10437 pub enable_image_annotation: bool,
10438
10439 /// Optional. Whether to include table annotations in layout parser response.
10440 pub enable_table_annotation: bool,
10441
10442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10443 }
10444
10445 impl LayoutConfig {
10446 /// Creates a new default instance.
10447 pub fn new() -> Self {
10448 std::default::Default::default()
10449 }
10450
10451 /// Sets the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10452 ///
10453 /// # Example
10454 /// ```ignore,no_run
10455 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10456 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10457 /// let x = LayoutConfig::new().set_chunking_config(ChunkingConfig::default()/* use setters */);
10458 /// ```
10459 pub fn set_chunking_config<T>(mut self, v: T) -> Self
10460 where
10461 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10462 {
10463 self.chunking_config = std::option::Option::Some(v.into());
10464 self
10465 }
10466
10467 /// Sets or clears the value of [chunking_config][crate::model::process_options::LayoutConfig::chunking_config].
10468 ///
10469 /// # Example
10470 /// ```ignore,no_run
10471 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10472 /// use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10473 /// let x = LayoutConfig::new().set_or_clear_chunking_config(Some(ChunkingConfig::default()/* use setters */));
10474 /// let x = LayoutConfig::new().set_or_clear_chunking_config(None::<ChunkingConfig>);
10475 /// ```
10476 pub fn set_or_clear_chunking_config<T>(mut self, v: std::option::Option<T>) -> Self
10477 where
10478 T: std::convert::Into<crate::model::process_options::layout_config::ChunkingConfig>,
10479 {
10480 self.chunking_config = v.map(|x| x.into());
10481 self
10482 }
10483
10484 /// Sets the value of [return_images][crate::model::process_options::LayoutConfig::return_images].
10485 ///
10486 /// # Example
10487 /// ```ignore,no_run
10488 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10489 /// let x = LayoutConfig::new().set_return_images(true);
10490 /// ```
10491 pub fn set_return_images<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10492 self.return_images = v.into();
10493 self
10494 }
10495
10496 /// Sets the value of [return_bounding_boxes][crate::model::process_options::LayoutConfig::return_bounding_boxes].
10497 ///
10498 /// # Example
10499 /// ```ignore,no_run
10500 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10501 /// let x = LayoutConfig::new().set_return_bounding_boxes(true);
10502 /// ```
10503 pub fn set_return_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10504 self.return_bounding_boxes = v.into();
10505 self
10506 }
10507
10508 /// Sets the value of [enable_image_annotation][crate::model::process_options::LayoutConfig::enable_image_annotation].
10509 ///
10510 /// # Example
10511 /// ```ignore,no_run
10512 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10513 /// let x = LayoutConfig::new().set_enable_image_annotation(true);
10514 /// ```
10515 pub fn set_enable_image_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10516 self.enable_image_annotation = v.into();
10517 self
10518 }
10519
10520 /// Sets the value of [enable_table_annotation][crate::model::process_options::LayoutConfig::enable_table_annotation].
10521 ///
10522 /// # Example
10523 /// ```ignore,no_run
10524 /// # use google_cloud_documentai_v1::model::process_options::LayoutConfig;
10525 /// let x = LayoutConfig::new().set_enable_table_annotation(true);
10526 /// ```
10527 pub fn set_enable_table_annotation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10528 self.enable_table_annotation = v.into();
10529 self
10530 }
10531 }
10532
10533 impl wkt::message::Message for LayoutConfig {
10534 fn typename() -> &'static str {
10535 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig"
10536 }
10537 }
10538
10539 /// Defines additional types related to [LayoutConfig].
10540 pub mod layout_config {
10541 #[allow(unused_imports)]
10542 use super::*;
10543
10544 /// Serving config for chunking.
10545 #[derive(Clone, Default, PartialEq)]
10546 #[non_exhaustive]
10547 pub struct ChunkingConfig {
10548 /// Optional. The chunk sizes to use when splitting documents, in order of
10549 /// level.
10550 pub chunk_size: i32,
10551
10552 /// Optional. Whether or not to include ancestor headings when splitting.
10553 pub include_ancestor_headings: bool,
10554
10555 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10556 }
10557
10558 impl ChunkingConfig {
10559 /// Creates a new default instance.
10560 pub fn new() -> Self {
10561 std::default::Default::default()
10562 }
10563
10564 /// Sets the value of [chunk_size][crate::model::process_options::layout_config::ChunkingConfig::chunk_size].
10565 ///
10566 /// # Example
10567 /// ```ignore,no_run
10568 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10569 /// let x = ChunkingConfig::new().set_chunk_size(42);
10570 /// ```
10571 pub fn set_chunk_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
10572 self.chunk_size = v.into();
10573 self
10574 }
10575
10576 /// Sets the value of [include_ancestor_headings][crate::model::process_options::layout_config::ChunkingConfig::include_ancestor_headings].
10577 ///
10578 /// # Example
10579 /// ```ignore,no_run
10580 /// # use google_cloud_documentai_v1::model::process_options::layout_config::ChunkingConfig;
10581 /// let x = ChunkingConfig::new().set_include_ancestor_headings(true);
10582 /// ```
10583 pub fn set_include_ancestor_headings<T: std::convert::Into<bool>>(
10584 mut self,
10585 v: T,
10586 ) -> Self {
10587 self.include_ancestor_headings = v.into();
10588 self
10589 }
10590 }
10591
10592 impl wkt::message::Message for ChunkingConfig {
10593 fn typename() -> &'static str {
10594 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.LayoutConfig.ChunkingConfig"
10595 }
10596 }
10597 }
10598
10599 /// A list of individual page numbers.
10600 #[derive(Clone, Default, PartialEq)]
10601 #[non_exhaustive]
10602 pub struct IndividualPageSelector {
10603 /// Optional. Indices of the pages (starting from 1).
10604 pub pages: std::vec::Vec<i32>,
10605
10606 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10607 }
10608
10609 impl IndividualPageSelector {
10610 /// Creates a new default instance.
10611 pub fn new() -> Self {
10612 std::default::Default::default()
10613 }
10614
10615 /// Sets the value of [pages][crate::model::process_options::IndividualPageSelector::pages].
10616 ///
10617 /// # Example
10618 /// ```ignore,no_run
10619 /// # use google_cloud_documentai_v1::model::process_options::IndividualPageSelector;
10620 /// let x = IndividualPageSelector::new().set_pages([1, 2, 3]);
10621 /// ```
10622 pub fn set_pages<T, V>(mut self, v: T) -> Self
10623 where
10624 T: std::iter::IntoIterator<Item = V>,
10625 V: std::convert::Into<i32>,
10626 {
10627 use std::iter::Iterator;
10628 self.pages = v.into_iter().map(|i| i.into()).collect();
10629 self
10630 }
10631 }
10632
10633 impl wkt::message::Message for IndividualPageSelector {
10634 fn typename() -> &'static str {
10635 "type.googleapis.com/google.cloud.documentai.v1.ProcessOptions.IndividualPageSelector"
10636 }
10637 }
10638
10639 /// A subset of pages to process. If not specified, all pages are processed.
10640 /// If a page range is set, only the given pages are extracted and processed
10641 /// from the document. In the output document,
10642 /// [Document.Page.page_number][google.cloud.documentai.v1.Document.Page.page_number]
10643 /// refers to the page number in the original document.
10644 /// This configuration only applies to online processing with
10645 /// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument].
10646 ///
10647 /// [google.cloud.documentai.v1.Document.Page.page_number]: crate::model::document::Page::page_number
10648 /// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10649 #[derive(Clone, Debug, PartialEq)]
10650 #[non_exhaustive]
10651 pub enum PageRange {
10652 /// Which pages to process (1-indexed).
10653 IndividualPageSelector(
10654 std::boxed::Box<crate::model::process_options::IndividualPageSelector>,
10655 ),
10656 /// Only process certain pages from the start. Process all if the document
10657 /// has fewer pages.
10658 FromStart(i32),
10659 /// Only process certain pages from the end, same as above.
10660 FromEnd(i32),
10661 }
10662}
10663
10664/// Request message for the
10665/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
10666/// method.
10667///
10668/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
10669#[derive(Clone, Default, PartialEq)]
10670#[non_exhaustive]
10671pub struct ProcessRequest {
10672 /// Required. The resource name of the
10673 /// [Processor][google.cloud.documentai.v1.Processor] or
10674 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion]
10675 /// to use for processing. If a
10676 /// [Processor][google.cloud.documentai.v1.Processor] is specified, the server
10677 /// will use its [default
10678 /// version][google.cloud.documentai.v1.Processor.default_processor_version].
10679 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
10680 /// or
10681 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
10682 ///
10683 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
10684 /// [google.cloud.documentai.v1.Processor.default_processor_version]: crate::model::Processor::default_processor_version
10685 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
10686 pub name: std::string::String,
10687
10688 /// Whether human review should be skipped for this request. Default to
10689 /// `false`.
10690 pub skip_human_review: bool,
10691
10692 /// Specifies which fields to include in the
10693 /// [ProcessResponse.document][google.cloud.documentai.v1.ProcessResponse.document]
10694 /// output. Only supports top-level document and pages field, so it must be in
10695 /// the form of `{document_field_name}` or `pages.{page_field_name}`.
10696 ///
10697 /// [google.cloud.documentai.v1.ProcessResponse.document]: crate::model::ProcessResponse::document
10698 pub field_mask: std::option::Option<wkt::FieldMask>,
10699
10700 /// Inference-time options for the process API
10701 pub process_options: std::option::Option<crate::model::ProcessOptions>,
10702
10703 /// Optional. The labels with user-defined metadata for the request.
10704 ///
10705 /// Label keys and values can be no longer than 63 characters
10706 /// (Unicode codepoints) and can only contain lowercase letters, numeric
10707 /// characters, underscores, and dashes. International characters are allowed.
10708 /// Label values are optional. Label keys must start with a letter.
10709 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
10710
10711 /// Optional. Option to remove images from the document.
10712 pub imageless_mode: bool,
10713
10714 /// The document payload.
10715 pub source: std::option::Option<crate::model::process_request::Source>,
10716
10717 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
10718}
10719
10720impl ProcessRequest {
10721 /// Creates a new default instance.
10722 pub fn new() -> Self {
10723 std::default::Default::default()
10724 }
10725
10726 /// Sets the value of [name][crate::model::ProcessRequest::name].
10727 ///
10728 /// # Example
10729 /// ```ignore,no_run
10730 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10731 /// let x = ProcessRequest::new().set_name("example");
10732 /// ```
10733 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
10734 self.name = v.into();
10735 self
10736 }
10737
10738 /// Sets the value of [skip_human_review][crate::model::ProcessRequest::skip_human_review].
10739 ///
10740 /// # Example
10741 /// ```ignore,no_run
10742 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10743 /// let x = ProcessRequest::new().set_skip_human_review(true);
10744 /// ```
10745 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10746 self.skip_human_review = v.into();
10747 self
10748 }
10749
10750 /// Sets the value of [field_mask][crate::model::ProcessRequest::field_mask].
10751 ///
10752 /// # Example
10753 /// ```ignore,no_run
10754 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10755 /// use wkt::FieldMask;
10756 /// let x = ProcessRequest::new().set_field_mask(FieldMask::default()/* use setters */);
10757 /// ```
10758 pub fn set_field_mask<T>(mut self, v: T) -> Self
10759 where
10760 T: std::convert::Into<wkt::FieldMask>,
10761 {
10762 self.field_mask = std::option::Option::Some(v.into());
10763 self
10764 }
10765
10766 /// Sets or clears the value of [field_mask][crate::model::ProcessRequest::field_mask].
10767 ///
10768 /// # Example
10769 /// ```ignore,no_run
10770 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10771 /// use wkt::FieldMask;
10772 /// let x = ProcessRequest::new().set_or_clear_field_mask(Some(FieldMask::default()/* use setters */));
10773 /// let x = ProcessRequest::new().set_or_clear_field_mask(None::<FieldMask>);
10774 /// ```
10775 pub fn set_or_clear_field_mask<T>(mut self, v: std::option::Option<T>) -> Self
10776 where
10777 T: std::convert::Into<wkt::FieldMask>,
10778 {
10779 self.field_mask = v.map(|x| x.into());
10780 self
10781 }
10782
10783 /// Sets the value of [process_options][crate::model::ProcessRequest::process_options].
10784 ///
10785 /// # Example
10786 /// ```ignore,no_run
10787 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10788 /// use google_cloud_documentai_v1::model::ProcessOptions;
10789 /// let x = ProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
10790 /// ```
10791 pub fn set_process_options<T>(mut self, v: T) -> Self
10792 where
10793 T: std::convert::Into<crate::model::ProcessOptions>,
10794 {
10795 self.process_options = std::option::Option::Some(v.into());
10796 self
10797 }
10798
10799 /// Sets or clears the value of [process_options][crate::model::ProcessRequest::process_options].
10800 ///
10801 /// # Example
10802 /// ```ignore,no_run
10803 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10804 /// use google_cloud_documentai_v1::model::ProcessOptions;
10805 /// let x = ProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
10806 /// let x = ProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
10807 /// ```
10808 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
10809 where
10810 T: std::convert::Into<crate::model::ProcessOptions>,
10811 {
10812 self.process_options = v.map(|x| x.into());
10813 self
10814 }
10815
10816 /// Sets the value of [labels][crate::model::ProcessRequest::labels].
10817 ///
10818 /// # Example
10819 /// ```ignore,no_run
10820 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10821 /// let x = ProcessRequest::new().set_labels([
10822 /// ("key0", "abc"),
10823 /// ("key1", "xyz"),
10824 /// ]);
10825 /// ```
10826 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
10827 where
10828 T: std::iter::IntoIterator<Item = (K, V)>,
10829 K: std::convert::Into<std::string::String>,
10830 V: std::convert::Into<std::string::String>,
10831 {
10832 use std::iter::Iterator;
10833 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
10834 self
10835 }
10836
10837 /// Sets the value of [imageless_mode][crate::model::ProcessRequest::imageless_mode].
10838 ///
10839 /// # Example
10840 /// ```ignore,no_run
10841 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10842 /// let x = ProcessRequest::new().set_imageless_mode(true);
10843 /// ```
10844 pub fn set_imageless_mode<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
10845 self.imageless_mode = v.into();
10846 self
10847 }
10848
10849 /// Sets the value of [source][crate::model::ProcessRequest::source].
10850 ///
10851 /// Note that all the setters affecting `source` are mutually
10852 /// exclusive.
10853 ///
10854 /// # Example
10855 /// ```ignore,no_run
10856 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10857 /// use google_cloud_documentai_v1::model::Document;
10858 /// let x = ProcessRequest::new().set_source(Some(
10859 /// google_cloud_documentai_v1::model::process_request::Source::InlineDocument(Document::default().into())));
10860 /// ```
10861 pub fn set_source<
10862 T: std::convert::Into<std::option::Option<crate::model::process_request::Source>>,
10863 >(
10864 mut self,
10865 v: T,
10866 ) -> Self {
10867 self.source = v.into();
10868 self
10869 }
10870
10871 /// The value of [source][crate::model::ProcessRequest::source]
10872 /// if it holds a `InlineDocument`, `None` if the field is not set or
10873 /// holds a different branch.
10874 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
10875 #[allow(unreachable_patterns)]
10876 self.source.as_ref().and_then(|v| match v {
10877 crate::model::process_request::Source::InlineDocument(v) => {
10878 std::option::Option::Some(v)
10879 }
10880 _ => std::option::Option::None,
10881 })
10882 }
10883
10884 /// Sets the value of [source][crate::model::ProcessRequest::source]
10885 /// to hold a `InlineDocument`.
10886 ///
10887 /// Note that all the setters affecting `source` are
10888 /// mutually exclusive.
10889 ///
10890 /// # Example
10891 /// ```ignore,no_run
10892 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10893 /// use google_cloud_documentai_v1::model::Document;
10894 /// let x = ProcessRequest::new().set_inline_document(Document::default()/* use setters */);
10895 /// assert!(x.inline_document().is_some());
10896 /// assert!(x.raw_document().is_none());
10897 /// assert!(x.gcs_document().is_none());
10898 /// ```
10899 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
10900 mut self,
10901 v: T,
10902 ) -> Self {
10903 self.source = std::option::Option::Some(
10904 crate::model::process_request::Source::InlineDocument(v.into()),
10905 );
10906 self
10907 }
10908
10909 /// The value of [source][crate::model::ProcessRequest::source]
10910 /// if it holds a `RawDocument`, `None` if the field is not set or
10911 /// holds a different branch.
10912 pub fn raw_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::RawDocument>> {
10913 #[allow(unreachable_patterns)]
10914 self.source.as_ref().and_then(|v| match v {
10915 crate::model::process_request::Source::RawDocument(v) => std::option::Option::Some(v),
10916 _ => std::option::Option::None,
10917 })
10918 }
10919
10920 /// Sets the value of [source][crate::model::ProcessRequest::source]
10921 /// to hold a `RawDocument`.
10922 ///
10923 /// Note that all the setters affecting `source` are
10924 /// mutually exclusive.
10925 ///
10926 /// # Example
10927 /// ```ignore,no_run
10928 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10929 /// use google_cloud_documentai_v1::model::RawDocument;
10930 /// let x = ProcessRequest::new().set_raw_document(RawDocument::default()/* use setters */);
10931 /// assert!(x.raw_document().is_some());
10932 /// assert!(x.inline_document().is_none());
10933 /// assert!(x.gcs_document().is_none());
10934 /// ```
10935 pub fn set_raw_document<T: std::convert::Into<std::boxed::Box<crate::model::RawDocument>>>(
10936 mut self,
10937 v: T,
10938 ) -> Self {
10939 self.source =
10940 std::option::Option::Some(crate::model::process_request::Source::RawDocument(v.into()));
10941 self
10942 }
10943
10944 /// The value of [source][crate::model::ProcessRequest::source]
10945 /// if it holds a `GcsDocument`, `None` if the field is not set or
10946 /// holds a different branch.
10947 pub fn gcs_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::GcsDocument>> {
10948 #[allow(unreachable_patterns)]
10949 self.source.as_ref().and_then(|v| match v {
10950 crate::model::process_request::Source::GcsDocument(v) => std::option::Option::Some(v),
10951 _ => std::option::Option::None,
10952 })
10953 }
10954
10955 /// Sets the value of [source][crate::model::ProcessRequest::source]
10956 /// to hold a `GcsDocument`.
10957 ///
10958 /// Note that all the setters affecting `source` are
10959 /// mutually exclusive.
10960 ///
10961 /// # Example
10962 /// ```ignore,no_run
10963 /// # use google_cloud_documentai_v1::model::ProcessRequest;
10964 /// use google_cloud_documentai_v1::model::GcsDocument;
10965 /// let x = ProcessRequest::new().set_gcs_document(GcsDocument::default()/* use setters */);
10966 /// assert!(x.gcs_document().is_some());
10967 /// assert!(x.inline_document().is_none());
10968 /// assert!(x.raw_document().is_none());
10969 /// ```
10970 pub fn set_gcs_document<T: std::convert::Into<std::boxed::Box<crate::model::GcsDocument>>>(
10971 mut self,
10972 v: T,
10973 ) -> Self {
10974 self.source =
10975 std::option::Option::Some(crate::model::process_request::Source::GcsDocument(v.into()));
10976 self
10977 }
10978}
10979
10980impl wkt::message::Message for ProcessRequest {
10981 fn typename() -> &'static str {
10982 "type.googleapis.com/google.cloud.documentai.v1.ProcessRequest"
10983 }
10984}
10985
10986/// Defines additional types related to [ProcessRequest].
10987pub mod process_request {
10988 #[allow(unused_imports)]
10989 use super::*;
10990
10991 /// The document payload.
10992 #[derive(Clone, Debug, PartialEq)]
10993 #[non_exhaustive]
10994 pub enum Source {
10995 /// An inline document proto.
10996 InlineDocument(std::boxed::Box<crate::model::Document>),
10997 /// A raw document content (bytes).
10998 RawDocument(std::boxed::Box<crate::model::RawDocument>),
10999 /// A raw document on Google Cloud Storage.
11000 GcsDocument(std::boxed::Box<crate::model::GcsDocument>),
11001 }
11002}
11003
11004/// The status of human review on a processed document.
11005#[derive(Clone, Default, PartialEq)]
11006#[non_exhaustive]
11007pub struct HumanReviewStatus {
11008 /// The state of human review on the processing request.
11009 pub state: crate::model::human_review_status::State,
11010
11011 /// A message providing more details about the human review state.
11012 pub state_message: std::string::String,
11013
11014 /// The name of the operation triggered by the processed document. This field
11015 /// is populated only when the
11016 /// [state][google.cloud.documentai.v1.HumanReviewStatus.state] is
11017 /// `HUMAN_REVIEW_IN_PROGRESS`. It has the same response type and metadata as
11018 /// the long-running operation returned by
11019 /// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument].
11020 ///
11021 /// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
11022 /// [google.cloud.documentai.v1.HumanReviewStatus.state]: crate::model::HumanReviewStatus::state
11023 pub human_review_operation: std::string::String,
11024
11025 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11026}
11027
11028impl HumanReviewStatus {
11029 /// Creates a new default instance.
11030 pub fn new() -> Self {
11031 std::default::Default::default()
11032 }
11033
11034 /// Sets the value of [state][crate::model::HumanReviewStatus::state].
11035 ///
11036 /// # Example
11037 /// ```ignore,no_run
11038 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11039 /// use google_cloud_documentai_v1::model::human_review_status::State;
11040 /// let x0 = HumanReviewStatus::new().set_state(State::Skipped);
11041 /// let x1 = HumanReviewStatus::new().set_state(State::ValidationPassed);
11042 /// let x2 = HumanReviewStatus::new().set_state(State::InProgress);
11043 /// ```
11044 pub fn set_state<T: std::convert::Into<crate::model::human_review_status::State>>(
11045 mut self,
11046 v: T,
11047 ) -> Self {
11048 self.state = v.into();
11049 self
11050 }
11051
11052 /// Sets the value of [state_message][crate::model::HumanReviewStatus::state_message].
11053 ///
11054 /// # Example
11055 /// ```ignore,no_run
11056 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11057 /// let x = HumanReviewStatus::new().set_state_message("example");
11058 /// ```
11059 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11060 self.state_message = v.into();
11061 self
11062 }
11063
11064 /// Sets the value of [human_review_operation][crate::model::HumanReviewStatus::human_review_operation].
11065 ///
11066 /// # Example
11067 /// ```ignore,no_run
11068 /// # use google_cloud_documentai_v1::model::HumanReviewStatus;
11069 /// let x = HumanReviewStatus::new().set_human_review_operation("example");
11070 /// ```
11071 pub fn set_human_review_operation<T: std::convert::Into<std::string::String>>(
11072 mut self,
11073 v: T,
11074 ) -> Self {
11075 self.human_review_operation = v.into();
11076 self
11077 }
11078}
11079
11080impl wkt::message::Message for HumanReviewStatus {
11081 fn typename() -> &'static str {
11082 "type.googleapis.com/google.cloud.documentai.v1.HumanReviewStatus"
11083 }
11084}
11085
11086/// Defines additional types related to [HumanReviewStatus].
11087pub mod human_review_status {
11088 #[allow(unused_imports)]
11089 use super::*;
11090
11091 /// The final state of human review on a processed document.
11092 ///
11093 /// # Working with unknown values
11094 ///
11095 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11096 /// additional enum variants at any time. Adding new variants is not considered
11097 /// a breaking change. Applications should write their code in anticipation of:
11098 ///
11099 /// - New values appearing in future releases of the client library, **and**
11100 /// - New values received dynamically, without application changes.
11101 ///
11102 /// Please consult the [Working with enums] section in the user guide for some
11103 /// guidelines.
11104 ///
11105 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11106 #[derive(Clone, Debug, PartialEq)]
11107 #[non_exhaustive]
11108 pub enum State {
11109 /// Human review state is unspecified. Most likely due to an internal error.
11110 Unspecified,
11111 /// Human review is skipped for the document. This can happen because human
11112 /// review isn't enabled on the processor or the processing request has
11113 /// been set to skip this document.
11114 Skipped,
11115 /// Human review validation is triggered and passed, so no review is needed.
11116 ValidationPassed,
11117 /// Human review validation is triggered and the document is under review.
11118 InProgress,
11119 /// Some error happened during triggering human review, see the
11120 /// [state_message][google.cloud.documentai.v1.HumanReviewStatus.state_message]
11121 /// for details.
11122 ///
11123 /// [google.cloud.documentai.v1.HumanReviewStatus.state_message]: crate::model::HumanReviewStatus::state_message
11124 Error,
11125 /// If set, the enum was initialized with an unknown value.
11126 ///
11127 /// Applications can examine the value using [State::value] or
11128 /// [State::name].
11129 UnknownValue(state::UnknownValue),
11130 }
11131
11132 #[doc(hidden)]
11133 pub mod state {
11134 #[allow(unused_imports)]
11135 use super::*;
11136 #[derive(Clone, Debug, PartialEq)]
11137 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11138 }
11139
11140 impl State {
11141 /// Gets the enum value.
11142 ///
11143 /// Returns `None` if the enum contains an unknown value deserialized from
11144 /// the string representation of enums.
11145 pub fn value(&self) -> std::option::Option<i32> {
11146 match self {
11147 Self::Unspecified => std::option::Option::Some(0),
11148 Self::Skipped => std::option::Option::Some(1),
11149 Self::ValidationPassed => std::option::Option::Some(2),
11150 Self::InProgress => std::option::Option::Some(3),
11151 Self::Error => std::option::Option::Some(4),
11152 Self::UnknownValue(u) => u.0.value(),
11153 }
11154 }
11155
11156 /// Gets the enum value as a string.
11157 ///
11158 /// Returns `None` if the enum contains an unknown value deserialized from
11159 /// the integer representation of enums.
11160 pub fn name(&self) -> std::option::Option<&str> {
11161 match self {
11162 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11163 Self::Skipped => std::option::Option::Some("SKIPPED"),
11164 Self::ValidationPassed => std::option::Option::Some("VALIDATION_PASSED"),
11165 Self::InProgress => std::option::Option::Some("IN_PROGRESS"),
11166 Self::Error => std::option::Option::Some("ERROR"),
11167 Self::UnknownValue(u) => u.0.name(),
11168 }
11169 }
11170 }
11171
11172 impl std::default::Default for State {
11173 fn default() -> Self {
11174 use std::convert::From;
11175 Self::from(0)
11176 }
11177 }
11178
11179 impl std::fmt::Display for State {
11180 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11181 wkt::internal::display_enum(f, self.name(), self.value())
11182 }
11183 }
11184
11185 impl std::convert::From<i32> for State {
11186 fn from(value: i32) -> Self {
11187 match value {
11188 0 => Self::Unspecified,
11189 1 => Self::Skipped,
11190 2 => Self::ValidationPassed,
11191 3 => Self::InProgress,
11192 4 => Self::Error,
11193 _ => Self::UnknownValue(state::UnknownValue(
11194 wkt::internal::UnknownEnumValue::Integer(value),
11195 )),
11196 }
11197 }
11198 }
11199
11200 impl std::convert::From<&str> for State {
11201 fn from(value: &str) -> Self {
11202 use std::string::ToString;
11203 match value {
11204 "STATE_UNSPECIFIED" => Self::Unspecified,
11205 "SKIPPED" => Self::Skipped,
11206 "VALIDATION_PASSED" => Self::ValidationPassed,
11207 "IN_PROGRESS" => Self::InProgress,
11208 "ERROR" => Self::Error,
11209 _ => Self::UnknownValue(state::UnknownValue(
11210 wkt::internal::UnknownEnumValue::String(value.to_string()),
11211 )),
11212 }
11213 }
11214 }
11215
11216 impl serde::ser::Serialize for State {
11217 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
11218 where
11219 S: serde::Serializer,
11220 {
11221 match self {
11222 Self::Unspecified => serializer.serialize_i32(0),
11223 Self::Skipped => serializer.serialize_i32(1),
11224 Self::ValidationPassed => serializer.serialize_i32(2),
11225 Self::InProgress => serializer.serialize_i32(3),
11226 Self::Error => serializer.serialize_i32(4),
11227 Self::UnknownValue(u) => u.0.serialize(serializer),
11228 }
11229 }
11230 }
11231
11232 impl<'de> serde::de::Deserialize<'de> for State {
11233 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
11234 where
11235 D: serde::Deserializer<'de>,
11236 {
11237 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
11238 ".google.cloud.documentai.v1.HumanReviewStatus.State",
11239 ))
11240 }
11241 }
11242}
11243
11244/// Response message for the
11245/// [ProcessDocument][google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]
11246/// method.
11247///
11248/// [google.cloud.documentai.v1.DocumentProcessorService.ProcessDocument]: crate::client::DocumentProcessorService::process_document
11249#[derive(Clone, Default, PartialEq)]
11250#[non_exhaustive]
11251pub struct ProcessResponse {
11252 /// The document payload, will populate fields based on the processor's
11253 /// behavior.
11254 pub document: std::option::Option<crate::model::Document>,
11255
11256 /// The status of human review on the processed document.
11257 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11258
11259 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11260}
11261
11262impl ProcessResponse {
11263 /// Creates a new default instance.
11264 pub fn new() -> Self {
11265 std::default::Default::default()
11266 }
11267
11268 /// Sets the value of [document][crate::model::ProcessResponse::document].
11269 ///
11270 /// # Example
11271 /// ```ignore,no_run
11272 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11273 /// use google_cloud_documentai_v1::model::Document;
11274 /// let x = ProcessResponse::new().set_document(Document::default()/* use setters */);
11275 /// ```
11276 pub fn set_document<T>(mut self, v: T) -> Self
11277 where
11278 T: std::convert::Into<crate::model::Document>,
11279 {
11280 self.document = std::option::Option::Some(v.into());
11281 self
11282 }
11283
11284 /// Sets or clears the value of [document][crate::model::ProcessResponse::document].
11285 ///
11286 /// # Example
11287 /// ```ignore,no_run
11288 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11289 /// use google_cloud_documentai_v1::model::Document;
11290 /// let x = ProcessResponse::new().set_or_clear_document(Some(Document::default()/* use setters */));
11291 /// let x = ProcessResponse::new().set_or_clear_document(None::<Document>);
11292 /// ```
11293 pub fn set_or_clear_document<T>(mut self, v: std::option::Option<T>) -> Self
11294 where
11295 T: std::convert::Into<crate::model::Document>,
11296 {
11297 self.document = v.map(|x| x.into());
11298 self
11299 }
11300
11301 /// Sets the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11302 ///
11303 /// # Example
11304 /// ```ignore,no_run
11305 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11306 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11307 /// let x = ProcessResponse::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11308 /// ```
11309 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11310 where
11311 T: std::convert::Into<crate::model::HumanReviewStatus>,
11312 {
11313 self.human_review_status = std::option::Option::Some(v.into());
11314 self
11315 }
11316
11317 /// Sets or clears the value of [human_review_status][crate::model::ProcessResponse::human_review_status].
11318 ///
11319 /// # Example
11320 /// ```ignore,no_run
11321 /// # use google_cloud_documentai_v1::model::ProcessResponse;
11322 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11323 /// let x = ProcessResponse::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11324 /// let x = ProcessResponse::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11325 /// ```
11326 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11327 where
11328 T: std::convert::Into<crate::model::HumanReviewStatus>,
11329 {
11330 self.human_review_status = v.map(|x| x.into());
11331 self
11332 }
11333}
11334
11335impl wkt::message::Message for ProcessResponse {
11336 fn typename() -> &'static str {
11337 "type.googleapis.com/google.cloud.documentai.v1.ProcessResponse"
11338 }
11339}
11340
11341/// Request message for
11342/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11343///
11344/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11345#[derive(Clone, Default, PartialEq)]
11346#[non_exhaustive]
11347pub struct BatchProcessRequest {
11348 /// Required. The resource name of
11349 /// [Processor][google.cloud.documentai.v1.Processor] or
11350 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
11351 /// Format: `projects/{project}/locations/{location}/processors/{processor}`,
11352 /// or
11353 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
11354 ///
11355 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
11356 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
11357 pub name: std::string::String,
11358
11359 /// The input documents for the
11360 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11361 /// method.
11362 ///
11363 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11364 pub input_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
11365
11366 /// The output configuration for the
11367 /// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]
11368 /// method.
11369 ///
11370 /// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11371 pub document_output_config: std::option::Option<crate::model::DocumentOutputConfig>,
11372
11373 /// Whether human review should be skipped for this request. Default to
11374 /// `false`.
11375 pub skip_human_review: bool,
11376
11377 /// Inference-time options for the process API
11378 pub process_options: std::option::Option<crate::model::ProcessOptions>,
11379
11380 /// Optional. The labels with user-defined metadata for the request.
11381 ///
11382 /// Label keys and values can be no longer than 63 characters
11383 /// (Unicode codepoints) and can only contain lowercase letters, numeric
11384 /// characters, underscores, and dashes. International characters are allowed.
11385 /// Label values are optional. Label keys must start with a letter.
11386 pub labels: std::collections::HashMap<std::string::String, std::string::String>,
11387
11388 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11389}
11390
11391impl BatchProcessRequest {
11392 /// Creates a new default instance.
11393 pub fn new() -> Self {
11394 std::default::Default::default()
11395 }
11396
11397 /// Sets the value of [name][crate::model::BatchProcessRequest::name].
11398 ///
11399 /// # Example
11400 /// ```ignore,no_run
11401 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11402 /// let x = BatchProcessRequest::new().set_name("example");
11403 /// ```
11404 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11405 self.name = v.into();
11406 self
11407 }
11408
11409 /// Sets the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11410 ///
11411 /// # Example
11412 /// ```ignore,no_run
11413 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11414 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11415 /// let x = BatchProcessRequest::new().set_input_documents(BatchDocumentsInputConfig::default()/* use setters */);
11416 /// ```
11417 pub fn set_input_documents<T>(mut self, v: T) -> Self
11418 where
11419 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11420 {
11421 self.input_documents = std::option::Option::Some(v.into());
11422 self
11423 }
11424
11425 /// Sets or clears the value of [input_documents][crate::model::BatchProcessRequest::input_documents].
11426 ///
11427 /// # Example
11428 /// ```ignore,no_run
11429 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11430 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
11431 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
11432 /// let x = BatchProcessRequest::new().set_or_clear_input_documents(None::<BatchDocumentsInputConfig>);
11433 /// ```
11434 pub fn set_or_clear_input_documents<T>(mut self, v: std::option::Option<T>) -> Self
11435 where
11436 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
11437 {
11438 self.input_documents = v.map(|x| x.into());
11439 self
11440 }
11441
11442 /// Sets the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11443 ///
11444 /// # Example
11445 /// ```ignore,no_run
11446 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11447 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11448 /// let x = BatchProcessRequest::new().set_document_output_config(DocumentOutputConfig::default()/* use setters */);
11449 /// ```
11450 pub fn set_document_output_config<T>(mut self, v: T) -> Self
11451 where
11452 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11453 {
11454 self.document_output_config = std::option::Option::Some(v.into());
11455 self
11456 }
11457
11458 /// Sets or clears the value of [document_output_config][crate::model::BatchProcessRequest::document_output_config].
11459 ///
11460 /// # Example
11461 /// ```ignore,no_run
11462 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11463 /// use google_cloud_documentai_v1::model::DocumentOutputConfig;
11464 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(Some(DocumentOutputConfig::default()/* use setters */));
11465 /// let x = BatchProcessRequest::new().set_or_clear_document_output_config(None::<DocumentOutputConfig>);
11466 /// ```
11467 pub fn set_or_clear_document_output_config<T>(mut self, v: std::option::Option<T>) -> Self
11468 where
11469 T: std::convert::Into<crate::model::DocumentOutputConfig>,
11470 {
11471 self.document_output_config = v.map(|x| x.into());
11472 self
11473 }
11474
11475 /// Sets the value of [skip_human_review][crate::model::BatchProcessRequest::skip_human_review].
11476 ///
11477 /// # Example
11478 /// ```ignore,no_run
11479 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11480 /// let x = BatchProcessRequest::new().set_skip_human_review(true);
11481 /// ```
11482 pub fn set_skip_human_review<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
11483 self.skip_human_review = v.into();
11484 self
11485 }
11486
11487 /// Sets the value of [process_options][crate::model::BatchProcessRequest::process_options].
11488 ///
11489 /// # Example
11490 /// ```ignore,no_run
11491 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11492 /// use google_cloud_documentai_v1::model::ProcessOptions;
11493 /// let x = BatchProcessRequest::new().set_process_options(ProcessOptions::default()/* use setters */);
11494 /// ```
11495 pub fn set_process_options<T>(mut self, v: T) -> Self
11496 where
11497 T: std::convert::Into<crate::model::ProcessOptions>,
11498 {
11499 self.process_options = std::option::Option::Some(v.into());
11500 self
11501 }
11502
11503 /// Sets or clears the value of [process_options][crate::model::BatchProcessRequest::process_options].
11504 ///
11505 /// # Example
11506 /// ```ignore,no_run
11507 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11508 /// use google_cloud_documentai_v1::model::ProcessOptions;
11509 /// let x = BatchProcessRequest::new().set_or_clear_process_options(Some(ProcessOptions::default()/* use setters */));
11510 /// let x = BatchProcessRequest::new().set_or_clear_process_options(None::<ProcessOptions>);
11511 /// ```
11512 pub fn set_or_clear_process_options<T>(mut self, v: std::option::Option<T>) -> Self
11513 where
11514 T: std::convert::Into<crate::model::ProcessOptions>,
11515 {
11516 self.process_options = v.map(|x| x.into());
11517 self
11518 }
11519
11520 /// Sets the value of [labels][crate::model::BatchProcessRequest::labels].
11521 ///
11522 /// # Example
11523 /// ```ignore,no_run
11524 /// # use google_cloud_documentai_v1::model::BatchProcessRequest;
11525 /// let x = BatchProcessRequest::new().set_labels([
11526 /// ("key0", "abc"),
11527 /// ("key1", "xyz"),
11528 /// ]);
11529 /// ```
11530 pub fn set_labels<T, K, V>(mut self, v: T) -> Self
11531 where
11532 T: std::iter::IntoIterator<Item = (K, V)>,
11533 K: std::convert::Into<std::string::String>,
11534 V: std::convert::Into<std::string::String>,
11535 {
11536 use std::iter::Iterator;
11537 self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
11538 self
11539 }
11540}
11541
11542impl wkt::message::Message for BatchProcessRequest {
11543 fn typename() -> &'static str {
11544 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessRequest"
11545 }
11546}
11547
11548/// Response message for
11549/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11550///
11551/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11552#[derive(Clone, Default, PartialEq)]
11553#[non_exhaustive]
11554pub struct BatchProcessResponse {
11555 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11556}
11557
11558impl BatchProcessResponse {
11559 /// Creates a new default instance.
11560 pub fn new() -> Self {
11561 std::default::Default::default()
11562 }
11563}
11564
11565impl wkt::message::Message for BatchProcessResponse {
11566 fn typename() -> &'static str {
11567 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessResponse"
11568 }
11569}
11570
11571/// The long-running operation metadata for
11572/// [BatchProcessDocuments][google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments].
11573///
11574/// [google.cloud.documentai.v1.DocumentProcessorService.BatchProcessDocuments]: crate::client::DocumentProcessorService::batch_process_documents
11575#[derive(Clone, Default, PartialEq)]
11576#[non_exhaustive]
11577pub struct BatchProcessMetadata {
11578 /// The state of the current batch processing.
11579 pub state: crate::model::batch_process_metadata::State,
11580
11581 /// A message providing more details about the current state of processing.
11582 /// For example, the error message if the operation is failed.
11583 pub state_message: std::string::String,
11584
11585 /// The creation time of the operation.
11586 pub create_time: std::option::Option<wkt::Timestamp>,
11587
11588 /// The last update time of the operation.
11589 pub update_time: std::option::Option<wkt::Timestamp>,
11590
11591 /// The list of response details of each document.
11592 pub individual_process_statuses:
11593 std::vec::Vec<crate::model::batch_process_metadata::IndividualProcessStatus>,
11594
11595 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11596}
11597
11598impl BatchProcessMetadata {
11599 /// Creates a new default instance.
11600 pub fn new() -> Self {
11601 std::default::Default::default()
11602 }
11603
11604 /// Sets the value of [state][crate::model::BatchProcessMetadata::state].
11605 ///
11606 /// # Example
11607 /// ```ignore,no_run
11608 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11609 /// use google_cloud_documentai_v1::model::batch_process_metadata::State;
11610 /// let x0 = BatchProcessMetadata::new().set_state(State::Waiting);
11611 /// let x1 = BatchProcessMetadata::new().set_state(State::Running);
11612 /// let x2 = BatchProcessMetadata::new().set_state(State::Succeeded);
11613 /// ```
11614 pub fn set_state<T: std::convert::Into<crate::model::batch_process_metadata::State>>(
11615 mut self,
11616 v: T,
11617 ) -> Self {
11618 self.state = v.into();
11619 self
11620 }
11621
11622 /// Sets the value of [state_message][crate::model::BatchProcessMetadata::state_message].
11623 ///
11624 /// # Example
11625 /// ```ignore,no_run
11626 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11627 /// let x = BatchProcessMetadata::new().set_state_message("example");
11628 /// ```
11629 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
11630 self.state_message = v.into();
11631 self
11632 }
11633
11634 /// Sets the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11635 ///
11636 /// # Example
11637 /// ```ignore,no_run
11638 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11639 /// use wkt::Timestamp;
11640 /// let x = BatchProcessMetadata::new().set_create_time(Timestamp::default()/* use setters */);
11641 /// ```
11642 pub fn set_create_time<T>(mut self, v: T) -> Self
11643 where
11644 T: std::convert::Into<wkt::Timestamp>,
11645 {
11646 self.create_time = std::option::Option::Some(v.into());
11647 self
11648 }
11649
11650 /// Sets or clears the value of [create_time][crate::model::BatchProcessMetadata::create_time].
11651 ///
11652 /// # Example
11653 /// ```ignore,no_run
11654 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11655 /// use wkt::Timestamp;
11656 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
11657 /// let x = BatchProcessMetadata::new().set_or_clear_create_time(None::<Timestamp>);
11658 /// ```
11659 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
11660 where
11661 T: std::convert::Into<wkt::Timestamp>,
11662 {
11663 self.create_time = v.map(|x| x.into());
11664 self
11665 }
11666
11667 /// Sets the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11668 ///
11669 /// # Example
11670 /// ```ignore,no_run
11671 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11672 /// use wkt::Timestamp;
11673 /// let x = BatchProcessMetadata::new().set_update_time(Timestamp::default()/* use setters */);
11674 /// ```
11675 pub fn set_update_time<T>(mut self, v: T) -> Self
11676 where
11677 T: std::convert::Into<wkt::Timestamp>,
11678 {
11679 self.update_time = std::option::Option::Some(v.into());
11680 self
11681 }
11682
11683 /// Sets or clears the value of [update_time][crate::model::BatchProcessMetadata::update_time].
11684 ///
11685 /// # Example
11686 /// ```ignore,no_run
11687 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11688 /// use wkt::Timestamp;
11689 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
11690 /// let x = BatchProcessMetadata::new().set_or_clear_update_time(None::<Timestamp>);
11691 /// ```
11692 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
11693 where
11694 T: std::convert::Into<wkt::Timestamp>,
11695 {
11696 self.update_time = v.map(|x| x.into());
11697 self
11698 }
11699
11700 /// Sets the value of [individual_process_statuses][crate::model::BatchProcessMetadata::individual_process_statuses].
11701 ///
11702 /// # Example
11703 /// ```ignore,no_run
11704 /// # use google_cloud_documentai_v1::model::BatchProcessMetadata;
11705 /// use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11706 /// let x = BatchProcessMetadata::new()
11707 /// .set_individual_process_statuses([
11708 /// IndividualProcessStatus::default()/* use setters */,
11709 /// IndividualProcessStatus::default()/* use (different) setters */,
11710 /// ]);
11711 /// ```
11712 pub fn set_individual_process_statuses<T, V>(mut self, v: T) -> Self
11713 where
11714 T: std::iter::IntoIterator<Item = V>,
11715 V: std::convert::Into<crate::model::batch_process_metadata::IndividualProcessStatus>,
11716 {
11717 use std::iter::Iterator;
11718 self.individual_process_statuses = v.into_iter().map(|i| i.into()).collect();
11719 self
11720 }
11721}
11722
11723impl wkt::message::Message for BatchProcessMetadata {
11724 fn typename() -> &'static str {
11725 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata"
11726 }
11727}
11728
11729/// Defines additional types related to [BatchProcessMetadata].
11730pub mod batch_process_metadata {
11731 #[allow(unused_imports)]
11732 use super::*;
11733
11734 /// The status of a each individual document in the batch process.
11735 #[derive(Clone, Default, PartialEq)]
11736 #[non_exhaustive]
11737 pub struct IndividualProcessStatus {
11738 /// The source of the document, same as the
11739 /// [input_gcs_source][google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]
11740 /// field in the request when the batch process started.
11741 ///
11742 /// [google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus.input_gcs_source]: crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source
11743 pub input_gcs_source: std::string::String,
11744
11745 /// The status processing the document.
11746 pub status: std::option::Option<google_cloud_rpc::model::Status>,
11747
11748 /// The Cloud Storage output destination (in the request as
11749 /// [DocumentOutputConfig.GcsOutputConfig.gcs_uri][google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri])
11750 /// of the processed document if it was successful, otherwise empty.
11751 ///
11752 /// [google.cloud.documentai.v1.DocumentOutputConfig.GcsOutputConfig.gcs_uri]: crate::model::document_output_config::GcsOutputConfig::gcs_uri
11753 pub output_gcs_destination: std::string::String,
11754
11755 /// The status of human review on the processed document.
11756 pub human_review_status: std::option::Option<crate::model::HumanReviewStatus>,
11757
11758 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
11759 }
11760
11761 impl IndividualProcessStatus {
11762 /// Creates a new default instance.
11763 pub fn new() -> Self {
11764 std::default::Default::default()
11765 }
11766
11767 /// Sets the value of [input_gcs_source][crate::model::batch_process_metadata::IndividualProcessStatus::input_gcs_source].
11768 ///
11769 /// # Example
11770 /// ```ignore,no_run
11771 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11772 /// let x = IndividualProcessStatus::new().set_input_gcs_source("example");
11773 /// ```
11774 pub fn set_input_gcs_source<T: std::convert::Into<std::string::String>>(
11775 mut self,
11776 v: T,
11777 ) -> Self {
11778 self.input_gcs_source = v.into();
11779 self
11780 }
11781
11782 /// Sets the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11783 ///
11784 /// # Example
11785 /// ```ignore,no_run
11786 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11787 /// use google_cloud_rpc::model::Status;
11788 /// let x = IndividualProcessStatus::new().set_status(Status::default()/* use setters */);
11789 /// ```
11790 pub fn set_status<T>(mut self, v: T) -> Self
11791 where
11792 T: std::convert::Into<google_cloud_rpc::model::Status>,
11793 {
11794 self.status = std::option::Option::Some(v.into());
11795 self
11796 }
11797
11798 /// Sets or clears the value of [status][crate::model::batch_process_metadata::IndividualProcessStatus::status].
11799 ///
11800 /// # Example
11801 /// ```ignore,no_run
11802 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11803 /// use google_cloud_rpc::model::Status;
11804 /// let x = IndividualProcessStatus::new().set_or_clear_status(Some(Status::default()/* use setters */));
11805 /// let x = IndividualProcessStatus::new().set_or_clear_status(None::<Status>);
11806 /// ```
11807 pub fn set_or_clear_status<T>(mut self, v: std::option::Option<T>) -> Self
11808 where
11809 T: std::convert::Into<google_cloud_rpc::model::Status>,
11810 {
11811 self.status = v.map(|x| x.into());
11812 self
11813 }
11814
11815 /// Sets the value of [output_gcs_destination][crate::model::batch_process_metadata::IndividualProcessStatus::output_gcs_destination].
11816 ///
11817 /// # Example
11818 /// ```ignore,no_run
11819 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11820 /// let x = IndividualProcessStatus::new().set_output_gcs_destination("example");
11821 /// ```
11822 pub fn set_output_gcs_destination<T: std::convert::Into<std::string::String>>(
11823 mut self,
11824 v: T,
11825 ) -> Self {
11826 self.output_gcs_destination = v.into();
11827 self
11828 }
11829
11830 /// Sets the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11831 ///
11832 /// # Example
11833 /// ```ignore,no_run
11834 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11835 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11836 /// let x = IndividualProcessStatus::new().set_human_review_status(HumanReviewStatus::default()/* use setters */);
11837 /// ```
11838 pub fn set_human_review_status<T>(mut self, v: T) -> Self
11839 where
11840 T: std::convert::Into<crate::model::HumanReviewStatus>,
11841 {
11842 self.human_review_status = std::option::Option::Some(v.into());
11843 self
11844 }
11845
11846 /// Sets or clears the value of [human_review_status][crate::model::batch_process_metadata::IndividualProcessStatus::human_review_status].
11847 ///
11848 /// # Example
11849 /// ```ignore,no_run
11850 /// # use google_cloud_documentai_v1::model::batch_process_metadata::IndividualProcessStatus;
11851 /// use google_cloud_documentai_v1::model::HumanReviewStatus;
11852 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(Some(HumanReviewStatus::default()/* use setters */));
11853 /// let x = IndividualProcessStatus::new().set_or_clear_human_review_status(None::<HumanReviewStatus>);
11854 /// ```
11855 pub fn set_or_clear_human_review_status<T>(mut self, v: std::option::Option<T>) -> Self
11856 where
11857 T: std::convert::Into<crate::model::HumanReviewStatus>,
11858 {
11859 self.human_review_status = v.map(|x| x.into());
11860 self
11861 }
11862 }
11863
11864 impl wkt::message::Message for IndividualProcessStatus {
11865 fn typename() -> &'static str {
11866 "type.googleapis.com/google.cloud.documentai.v1.BatchProcessMetadata.IndividualProcessStatus"
11867 }
11868 }
11869
11870 /// Possible states of the batch processing operation.
11871 ///
11872 /// # Working with unknown values
11873 ///
11874 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
11875 /// additional enum variants at any time. Adding new variants is not considered
11876 /// a breaking change. Applications should write their code in anticipation of:
11877 ///
11878 /// - New values appearing in future releases of the client library, **and**
11879 /// - New values received dynamically, without application changes.
11880 ///
11881 /// Please consult the [Working with enums] section in the user guide for some
11882 /// guidelines.
11883 ///
11884 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
11885 #[derive(Clone, Debug, PartialEq)]
11886 #[non_exhaustive]
11887 pub enum State {
11888 /// The default value. This value is used if the state is omitted.
11889 Unspecified,
11890 /// Request operation is waiting for scheduling.
11891 Waiting,
11892 /// Request is being processed.
11893 Running,
11894 /// The batch processing completed successfully.
11895 Succeeded,
11896 /// The batch processing was being cancelled.
11897 Cancelling,
11898 /// The batch processing was cancelled.
11899 Cancelled,
11900 /// The batch processing has failed.
11901 Failed,
11902 /// If set, the enum was initialized with an unknown value.
11903 ///
11904 /// Applications can examine the value using [State::value] or
11905 /// [State::name].
11906 UnknownValue(state::UnknownValue),
11907 }
11908
11909 #[doc(hidden)]
11910 pub mod state {
11911 #[allow(unused_imports)]
11912 use super::*;
11913 #[derive(Clone, Debug, PartialEq)]
11914 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
11915 }
11916
11917 impl State {
11918 /// Gets the enum value.
11919 ///
11920 /// Returns `None` if the enum contains an unknown value deserialized from
11921 /// the string representation of enums.
11922 pub fn value(&self) -> std::option::Option<i32> {
11923 match self {
11924 Self::Unspecified => std::option::Option::Some(0),
11925 Self::Waiting => std::option::Option::Some(1),
11926 Self::Running => std::option::Option::Some(2),
11927 Self::Succeeded => std::option::Option::Some(3),
11928 Self::Cancelling => std::option::Option::Some(4),
11929 Self::Cancelled => std::option::Option::Some(5),
11930 Self::Failed => std::option::Option::Some(6),
11931 Self::UnknownValue(u) => u.0.value(),
11932 }
11933 }
11934
11935 /// Gets the enum value as a string.
11936 ///
11937 /// Returns `None` if the enum contains an unknown value deserialized from
11938 /// the integer representation of enums.
11939 pub fn name(&self) -> std::option::Option<&str> {
11940 match self {
11941 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
11942 Self::Waiting => std::option::Option::Some("WAITING"),
11943 Self::Running => std::option::Option::Some("RUNNING"),
11944 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
11945 Self::Cancelling => std::option::Option::Some("CANCELLING"),
11946 Self::Cancelled => std::option::Option::Some("CANCELLED"),
11947 Self::Failed => std::option::Option::Some("FAILED"),
11948 Self::UnknownValue(u) => u.0.name(),
11949 }
11950 }
11951 }
11952
11953 impl std::default::Default for State {
11954 fn default() -> Self {
11955 use std::convert::From;
11956 Self::from(0)
11957 }
11958 }
11959
11960 impl std::fmt::Display for State {
11961 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
11962 wkt::internal::display_enum(f, self.name(), self.value())
11963 }
11964 }
11965
11966 impl std::convert::From<i32> for State {
11967 fn from(value: i32) -> Self {
11968 match value {
11969 0 => Self::Unspecified,
11970 1 => Self::Waiting,
11971 2 => Self::Running,
11972 3 => Self::Succeeded,
11973 4 => Self::Cancelling,
11974 5 => Self::Cancelled,
11975 6 => Self::Failed,
11976 _ => Self::UnknownValue(state::UnknownValue(
11977 wkt::internal::UnknownEnumValue::Integer(value),
11978 )),
11979 }
11980 }
11981 }
11982
11983 impl std::convert::From<&str> for State {
11984 fn from(value: &str) -> Self {
11985 use std::string::ToString;
11986 match value {
11987 "STATE_UNSPECIFIED" => Self::Unspecified,
11988 "WAITING" => Self::Waiting,
11989 "RUNNING" => Self::Running,
11990 "SUCCEEDED" => Self::Succeeded,
11991 "CANCELLING" => Self::Cancelling,
11992 "CANCELLED" => Self::Cancelled,
11993 "FAILED" => Self::Failed,
11994 _ => Self::UnknownValue(state::UnknownValue(
11995 wkt::internal::UnknownEnumValue::String(value.to_string()),
11996 )),
11997 }
11998 }
11999 }
12000
12001 impl serde::ser::Serialize for State {
12002 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
12003 where
12004 S: serde::Serializer,
12005 {
12006 match self {
12007 Self::Unspecified => serializer.serialize_i32(0),
12008 Self::Waiting => serializer.serialize_i32(1),
12009 Self::Running => serializer.serialize_i32(2),
12010 Self::Succeeded => serializer.serialize_i32(3),
12011 Self::Cancelling => serializer.serialize_i32(4),
12012 Self::Cancelled => serializer.serialize_i32(5),
12013 Self::Failed => serializer.serialize_i32(6),
12014 Self::UnknownValue(u) => u.0.serialize(serializer),
12015 }
12016 }
12017 }
12018
12019 impl<'de> serde::de::Deserialize<'de> for State {
12020 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
12021 where
12022 D: serde::Deserializer<'de>,
12023 {
12024 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
12025 ".google.cloud.documentai.v1.BatchProcessMetadata.State",
12026 ))
12027 }
12028 }
12029}
12030
12031/// Request message for the
12032/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
12033/// method. Some processor types may require the project be added to an
12034/// allowlist.
12035///
12036/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
12037#[derive(Clone, Default, PartialEq)]
12038#[non_exhaustive]
12039pub struct FetchProcessorTypesRequest {
12040 /// Required. The location of processor types to list.
12041 /// Format: `projects/{project}/locations/{location}`.
12042 pub parent: std::string::String,
12043
12044 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12045}
12046
12047impl FetchProcessorTypesRequest {
12048 /// Creates a new default instance.
12049 pub fn new() -> Self {
12050 std::default::Default::default()
12051 }
12052
12053 /// Sets the value of [parent][crate::model::FetchProcessorTypesRequest::parent].
12054 ///
12055 /// # Example
12056 /// ```ignore,no_run
12057 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesRequest;
12058 /// # let project_id = "project_id";
12059 /// # let location_id = "location_id";
12060 /// let x = FetchProcessorTypesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
12061 /// ```
12062 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12063 self.parent = v.into();
12064 self
12065 }
12066}
12067
12068impl wkt::message::Message for FetchProcessorTypesRequest {
12069 fn typename() -> &'static str {
12070 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesRequest"
12071 }
12072}
12073
12074/// Response message for the
12075/// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]
12076/// method.
12077///
12078/// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
12079#[derive(Clone, Default, PartialEq)]
12080#[non_exhaustive]
12081pub struct FetchProcessorTypesResponse {
12082 /// The list of processor types.
12083 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12084
12085 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12086}
12087
12088impl FetchProcessorTypesResponse {
12089 /// Creates a new default instance.
12090 pub fn new() -> Self {
12091 std::default::Default::default()
12092 }
12093
12094 /// Sets the value of [processor_types][crate::model::FetchProcessorTypesResponse::processor_types].
12095 ///
12096 /// # Example
12097 /// ```ignore,no_run
12098 /// # use google_cloud_documentai_v1::model::FetchProcessorTypesResponse;
12099 /// use google_cloud_documentai_v1::model::ProcessorType;
12100 /// let x = FetchProcessorTypesResponse::new()
12101 /// .set_processor_types([
12102 /// ProcessorType::default()/* use setters */,
12103 /// ProcessorType::default()/* use (different) setters */,
12104 /// ]);
12105 /// ```
12106 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12107 where
12108 T: std::iter::IntoIterator<Item = V>,
12109 V: std::convert::Into<crate::model::ProcessorType>,
12110 {
12111 use std::iter::Iterator;
12112 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12113 self
12114 }
12115}
12116
12117impl wkt::message::Message for FetchProcessorTypesResponse {
12118 fn typename() -> &'static str {
12119 "type.googleapis.com/google.cloud.documentai.v1.FetchProcessorTypesResponse"
12120 }
12121}
12122
12123/// Request message for the
12124/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12125/// method. Some processor types may require the project be added to an
12126/// allowlist.
12127///
12128/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12129#[derive(Clone, Default, PartialEq)]
12130#[non_exhaustive]
12131pub struct ListProcessorTypesRequest {
12132 /// Required. The location of processor types to list.
12133 /// Format: `projects/{project}/locations/{location}`.
12134 pub parent: std::string::String,
12135
12136 /// The maximum number of processor types to return.
12137 /// If unspecified, at most `100` processor types will be returned.
12138 /// The maximum value is `500`. Values above `500` will be coerced to `500`.
12139 pub page_size: i32,
12140
12141 /// Used to retrieve the next page of results, empty if at the end of the list.
12142 pub page_token: std::string::String,
12143
12144 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12145}
12146
12147impl ListProcessorTypesRequest {
12148 /// Creates a new default instance.
12149 pub fn new() -> Self {
12150 std::default::Default::default()
12151 }
12152
12153 /// Sets the value of [parent][crate::model::ListProcessorTypesRequest::parent].
12154 ///
12155 /// # Example
12156 /// ```ignore,no_run
12157 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12158 /// # let project_id = "project_id";
12159 /// # let location_id = "location_id";
12160 /// let x = ListProcessorTypesRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
12161 /// ```
12162 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12163 self.parent = v.into();
12164 self
12165 }
12166
12167 /// Sets the value of [page_size][crate::model::ListProcessorTypesRequest::page_size].
12168 ///
12169 /// # Example
12170 /// ```ignore,no_run
12171 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12172 /// let x = ListProcessorTypesRequest::new().set_page_size(42);
12173 /// ```
12174 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12175 self.page_size = v.into();
12176 self
12177 }
12178
12179 /// Sets the value of [page_token][crate::model::ListProcessorTypesRequest::page_token].
12180 ///
12181 /// # Example
12182 /// ```ignore,no_run
12183 /// # use google_cloud_documentai_v1::model::ListProcessorTypesRequest;
12184 /// let x = ListProcessorTypesRequest::new().set_page_token("example");
12185 /// ```
12186 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12187 self.page_token = v.into();
12188 self
12189 }
12190}
12191
12192impl wkt::message::Message for ListProcessorTypesRequest {
12193 fn typename() -> &'static str {
12194 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesRequest"
12195 }
12196}
12197
12198/// Response message for the
12199/// [ListProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]
12200/// method.
12201///
12202/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorTypes]: crate::client::DocumentProcessorService::list_processor_types
12203#[derive(Clone, Default, PartialEq)]
12204#[non_exhaustive]
12205pub struct ListProcessorTypesResponse {
12206 /// The processor types.
12207 pub processor_types: std::vec::Vec<crate::model::ProcessorType>,
12208
12209 /// Points to the next page, otherwise empty.
12210 pub next_page_token: std::string::String,
12211
12212 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12213}
12214
12215impl ListProcessorTypesResponse {
12216 /// Creates a new default instance.
12217 pub fn new() -> Self {
12218 std::default::Default::default()
12219 }
12220
12221 /// Sets the value of [processor_types][crate::model::ListProcessorTypesResponse::processor_types].
12222 ///
12223 /// # Example
12224 /// ```ignore,no_run
12225 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12226 /// use google_cloud_documentai_v1::model::ProcessorType;
12227 /// let x = ListProcessorTypesResponse::new()
12228 /// .set_processor_types([
12229 /// ProcessorType::default()/* use setters */,
12230 /// ProcessorType::default()/* use (different) setters */,
12231 /// ]);
12232 /// ```
12233 pub fn set_processor_types<T, V>(mut self, v: T) -> Self
12234 where
12235 T: std::iter::IntoIterator<Item = V>,
12236 V: std::convert::Into<crate::model::ProcessorType>,
12237 {
12238 use std::iter::Iterator;
12239 self.processor_types = v.into_iter().map(|i| i.into()).collect();
12240 self
12241 }
12242
12243 /// Sets the value of [next_page_token][crate::model::ListProcessorTypesResponse::next_page_token].
12244 ///
12245 /// # Example
12246 /// ```ignore,no_run
12247 /// # use google_cloud_documentai_v1::model::ListProcessorTypesResponse;
12248 /// let x = ListProcessorTypesResponse::new().set_next_page_token("example");
12249 /// ```
12250 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12251 self.next_page_token = v.into();
12252 self
12253 }
12254}
12255
12256impl wkt::message::Message for ListProcessorTypesResponse {
12257 fn typename() -> &'static str {
12258 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorTypesResponse"
12259 }
12260}
12261
12262#[doc(hidden)]
12263impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorTypesResponse {
12264 type PageItem = crate::model::ProcessorType;
12265
12266 fn items(self) -> std::vec::Vec<Self::PageItem> {
12267 self.processor_types
12268 }
12269
12270 fn next_page_token(&self) -> std::string::String {
12271 use std::clone::Clone;
12272 self.next_page_token.clone()
12273 }
12274}
12275
12276/// Request message for list all processors belongs to a project.
12277#[derive(Clone, Default, PartialEq)]
12278#[non_exhaustive]
12279pub struct ListProcessorsRequest {
12280 /// Required. The parent (project and location) which owns this collection of
12281 /// Processors. Format: `projects/{project}/locations/{location}`
12282 pub parent: std::string::String,
12283
12284 /// The maximum number of processors to return.
12285 /// If unspecified, at most `50` processors will be returned.
12286 /// The maximum value is `100`. Values above `100` will be coerced to `100`.
12287 pub page_size: i32,
12288
12289 /// We will return the processors sorted by creation time. The page token
12290 /// will point to the next processor.
12291 pub page_token: std::string::String,
12292
12293 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12294}
12295
12296impl ListProcessorsRequest {
12297 /// Creates a new default instance.
12298 pub fn new() -> Self {
12299 std::default::Default::default()
12300 }
12301
12302 /// Sets the value of [parent][crate::model::ListProcessorsRequest::parent].
12303 ///
12304 /// # Example
12305 /// ```ignore,no_run
12306 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12307 /// # let project_id = "project_id";
12308 /// # let location_id = "location_id";
12309 /// let x = ListProcessorsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
12310 /// ```
12311 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12312 self.parent = v.into();
12313 self
12314 }
12315
12316 /// Sets the value of [page_size][crate::model::ListProcessorsRequest::page_size].
12317 ///
12318 /// # Example
12319 /// ```ignore,no_run
12320 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12321 /// let x = ListProcessorsRequest::new().set_page_size(42);
12322 /// ```
12323 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12324 self.page_size = v.into();
12325 self
12326 }
12327
12328 /// Sets the value of [page_token][crate::model::ListProcessorsRequest::page_token].
12329 ///
12330 /// # Example
12331 /// ```ignore,no_run
12332 /// # use google_cloud_documentai_v1::model::ListProcessorsRequest;
12333 /// let x = ListProcessorsRequest::new().set_page_token("example");
12334 /// ```
12335 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12336 self.page_token = v.into();
12337 self
12338 }
12339}
12340
12341impl wkt::message::Message for ListProcessorsRequest {
12342 fn typename() -> &'static str {
12343 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsRequest"
12344 }
12345}
12346
12347/// Response message for the
12348/// [ListProcessors][google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]
12349/// method.
12350///
12351/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessors]: crate::client::DocumentProcessorService::list_processors
12352#[derive(Clone, Default, PartialEq)]
12353#[non_exhaustive]
12354pub struct ListProcessorsResponse {
12355 /// The list of processors.
12356 pub processors: std::vec::Vec<crate::model::Processor>,
12357
12358 /// Points to the next processor, otherwise empty.
12359 pub next_page_token: std::string::String,
12360
12361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12362}
12363
12364impl ListProcessorsResponse {
12365 /// Creates a new default instance.
12366 pub fn new() -> Self {
12367 std::default::Default::default()
12368 }
12369
12370 /// Sets the value of [processors][crate::model::ListProcessorsResponse::processors].
12371 ///
12372 /// # Example
12373 /// ```ignore,no_run
12374 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12375 /// use google_cloud_documentai_v1::model::Processor;
12376 /// let x = ListProcessorsResponse::new()
12377 /// .set_processors([
12378 /// Processor::default()/* use setters */,
12379 /// Processor::default()/* use (different) setters */,
12380 /// ]);
12381 /// ```
12382 pub fn set_processors<T, V>(mut self, v: T) -> Self
12383 where
12384 T: std::iter::IntoIterator<Item = V>,
12385 V: std::convert::Into<crate::model::Processor>,
12386 {
12387 use std::iter::Iterator;
12388 self.processors = v.into_iter().map(|i| i.into()).collect();
12389 self
12390 }
12391
12392 /// Sets the value of [next_page_token][crate::model::ListProcessorsResponse::next_page_token].
12393 ///
12394 /// # Example
12395 /// ```ignore,no_run
12396 /// # use google_cloud_documentai_v1::model::ListProcessorsResponse;
12397 /// let x = ListProcessorsResponse::new().set_next_page_token("example");
12398 /// ```
12399 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12400 self.next_page_token = v.into();
12401 self
12402 }
12403}
12404
12405impl wkt::message::Message for ListProcessorsResponse {
12406 fn typename() -> &'static str {
12407 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorsResponse"
12408 }
12409}
12410
12411#[doc(hidden)]
12412impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorsResponse {
12413 type PageItem = crate::model::Processor;
12414
12415 fn items(self) -> std::vec::Vec<Self::PageItem> {
12416 self.processors
12417 }
12418
12419 fn next_page_token(&self) -> std::string::String {
12420 use std::clone::Clone;
12421 self.next_page_token.clone()
12422 }
12423}
12424
12425/// Request message for the
12426/// [GetProcessorType][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]
12427/// method.
12428///
12429/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorType]: crate::client::DocumentProcessorService::get_processor_type
12430#[derive(Clone, Default, PartialEq)]
12431#[non_exhaustive]
12432pub struct GetProcessorTypeRequest {
12433 /// Required. The processor type resource name.
12434 pub name: std::string::String,
12435
12436 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12437}
12438
12439impl GetProcessorTypeRequest {
12440 /// Creates a new default instance.
12441 pub fn new() -> Self {
12442 std::default::Default::default()
12443 }
12444
12445 /// Sets the value of [name][crate::model::GetProcessorTypeRequest::name].
12446 ///
12447 /// # Example
12448 /// ```ignore,no_run
12449 /// # use google_cloud_documentai_v1::model::GetProcessorTypeRequest;
12450 /// # let project_id = "project_id";
12451 /// # let location_id = "location_id";
12452 /// # let processor_type_id = "processor_type_id";
12453 /// let x = GetProcessorTypeRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processorTypes/{processor_type_id}"));
12454 /// ```
12455 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12456 self.name = v.into();
12457 self
12458 }
12459}
12460
12461impl wkt::message::Message for GetProcessorTypeRequest {
12462 fn typename() -> &'static str {
12463 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorTypeRequest"
12464 }
12465}
12466
12467/// Request message for the
12468/// [GetProcessor][google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]
12469/// method.
12470///
12471/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessor]: crate::client::DocumentProcessorService::get_processor
12472#[derive(Clone, Default, PartialEq)]
12473#[non_exhaustive]
12474pub struct GetProcessorRequest {
12475 /// Required. The processor resource name.
12476 pub name: std::string::String,
12477
12478 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12479}
12480
12481impl GetProcessorRequest {
12482 /// Creates a new default instance.
12483 pub fn new() -> Self {
12484 std::default::Default::default()
12485 }
12486
12487 /// Sets the value of [name][crate::model::GetProcessorRequest::name].
12488 ///
12489 /// # Example
12490 /// ```ignore,no_run
12491 /// # use google_cloud_documentai_v1::model::GetProcessorRequest;
12492 /// # let project_id = "project_id";
12493 /// # let location_id = "location_id";
12494 /// # let processor_id = "processor_id";
12495 /// let x = GetProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
12496 /// ```
12497 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12498 self.name = v.into();
12499 self
12500 }
12501}
12502
12503impl wkt::message::Message for GetProcessorRequest {
12504 fn typename() -> &'static str {
12505 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorRequest"
12506 }
12507}
12508
12509/// Request message for the
12510/// [GetProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]
12511/// method.
12512///
12513/// [google.cloud.documentai.v1.DocumentProcessorService.GetProcessorVersion]: crate::client::DocumentProcessorService::get_processor_version
12514#[derive(Clone, Default, PartialEq)]
12515#[non_exhaustive]
12516pub struct GetProcessorVersionRequest {
12517 /// Required. The processor resource name.
12518 pub name: std::string::String,
12519
12520 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12521}
12522
12523impl GetProcessorVersionRequest {
12524 /// Creates a new default instance.
12525 pub fn new() -> Self {
12526 std::default::Default::default()
12527 }
12528
12529 /// Sets the value of [name][crate::model::GetProcessorVersionRequest::name].
12530 ///
12531 /// # Example
12532 /// ```ignore,no_run
12533 /// # use google_cloud_documentai_v1::model::GetProcessorVersionRequest;
12534 /// # let project_id = "project_id";
12535 /// # let location_id = "location_id";
12536 /// # let processor_id = "processor_id";
12537 /// # let processor_version_id = "processor_version_id";
12538 /// let x = GetProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12539 /// ```
12540 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12541 self.name = v.into();
12542 self
12543 }
12544}
12545
12546impl wkt::message::Message for GetProcessorVersionRequest {
12547 fn typename() -> &'static str {
12548 "type.googleapis.com/google.cloud.documentai.v1.GetProcessorVersionRequest"
12549 }
12550}
12551
12552/// Request message for list all processor versions belongs to a processor.
12553#[derive(Clone, Default, PartialEq)]
12554#[non_exhaustive]
12555pub struct ListProcessorVersionsRequest {
12556 /// Required. The parent (project, location and processor) to list all
12557 /// versions. Format:
12558 /// `projects/{project}/locations/{location}/processors/{processor}`
12559 pub parent: std::string::String,
12560
12561 /// The maximum number of processor versions to return.
12562 /// If unspecified, at most `10` processor versions will be returned.
12563 /// The maximum value is `20`. Values above `20` will be coerced to `20`.
12564 pub page_size: i32,
12565
12566 /// We will return the processor versions sorted by creation time. The page
12567 /// token will point to the next processor version.
12568 pub page_token: std::string::String,
12569
12570 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12571}
12572
12573impl ListProcessorVersionsRequest {
12574 /// Creates a new default instance.
12575 pub fn new() -> Self {
12576 std::default::Default::default()
12577 }
12578
12579 /// Sets the value of [parent][crate::model::ListProcessorVersionsRequest::parent].
12580 ///
12581 /// # Example
12582 /// ```ignore,no_run
12583 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12584 /// # let project_id = "project_id";
12585 /// # let location_id = "location_id";
12586 /// # let processor_id = "processor_id";
12587 /// let x = ListProcessorVersionsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
12588 /// ```
12589 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12590 self.parent = v.into();
12591 self
12592 }
12593
12594 /// Sets the value of [page_size][crate::model::ListProcessorVersionsRequest::page_size].
12595 ///
12596 /// # Example
12597 /// ```ignore,no_run
12598 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12599 /// let x = ListProcessorVersionsRequest::new().set_page_size(42);
12600 /// ```
12601 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
12602 self.page_size = v.into();
12603 self
12604 }
12605
12606 /// Sets the value of [page_token][crate::model::ListProcessorVersionsRequest::page_token].
12607 ///
12608 /// # Example
12609 /// ```ignore,no_run
12610 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsRequest;
12611 /// let x = ListProcessorVersionsRequest::new().set_page_token("example");
12612 /// ```
12613 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12614 self.page_token = v.into();
12615 self
12616 }
12617}
12618
12619impl wkt::message::Message for ListProcessorVersionsRequest {
12620 fn typename() -> &'static str {
12621 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsRequest"
12622 }
12623}
12624
12625/// Response message for the
12626/// [ListProcessorVersions][google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]
12627/// method.
12628///
12629/// [google.cloud.documentai.v1.DocumentProcessorService.ListProcessorVersions]: crate::client::DocumentProcessorService::list_processor_versions
12630#[derive(Clone, Default, PartialEq)]
12631#[non_exhaustive]
12632pub struct ListProcessorVersionsResponse {
12633 /// The list of processors.
12634 pub processor_versions: std::vec::Vec<crate::model::ProcessorVersion>,
12635
12636 /// Points to the next processor, otherwise empty.
12637 pub next_page_token: std::string::String,
12638
12639 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12640}
12641
12642impl ListProcessorVersionsResponse {
12643 /// Creates a new default instance.
12644 pub fn new() -> Self {
12645 std::default::Default::default()
12646 }
12647
12648 /// Sets the value of [processor_versions][crate::model::ListProcessorVersionsResponse::processor_versions].
12649 ///
12650 /// # Example
12651 /// ```ignore,no_run
12652 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12653 /// use google_cloud_documentai_v1::model::ProcessorVersion;
12654 /// let x = ListProcessorVersionsResponse::new()
12655 /// .set_processor_versions([
12656 /// ProcessorVersion::default()/* use setters */,
12657 /// ProcessorVersion::default()/* use (different) setters */,
12658 /// ]);
12659 /// ```
12660 pub fn set_processor_versions<T, V>(mut self, v: T) -> Self
12661 where
12662 T: std::iter::IntoIterator<Item = V>,
12663 V: std::convert::Into<crate::model::ProcessorVersion>,
12664 {
12665 use std::iter::Iterator;
12666 self.processor_versions = v.into_iter().map(|i| i.into()).collect();
12667 self
12668 }
12669
12670 /// Sets the value of [next_page_token][crate::model::ListProcessorVersionsResponse::next_page_token].
12671 ///
12672 /// # Example
12673 /// ```ignore,no_run
12674 /// # use google_cloud_documentai_v1::model::ListProcessorVersionsResponse;
12675 /// let x = ListProcessorVersionsResponse::new().set_next_page_token("example");
12676 /// ```
12677 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12678 self.next_page_token = v.into();
12679 self
12680 }
12681}
12682
12683impl wkt::message::Message for ListProcessorVersionsResponse {
12684 fn typename() -> &'static str {
12685 "type.googleapis.com/google.cloud.documentai.v1.ListProcessorVersionsResponse"
12686 }
12687}
12688
12689#[doc(hidden)]
12690impl google_cloud_gax::paginator::internal::PageableResponse for ListProcessorVersionsResponse {
12691 type PageItem = crate::model::ProcessorVersion;
12692
12693 fn items(self) -> std::vec::Vec<Self::PageItem> {
12694 self.processor_versions
12695 }
12696
12697 fn next_page_token(&self) -> std::string::String {
12698 use std::clone::Clone;
12699 self.next_page_token.clone()
12700 }
12701}
12702
12703/// Request message for the
12704/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12705/// method.
12706///
12707/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12708#[derive(Clone, Default, PartialEq)]
12709#[non_exhaustive]
12710pub struct DeleteProcessorVersionRequest {
12711 /// Required. The processor version resource name to be deleted.
12712 pub name: std::string::String,
12713
12714 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12715}
12716
12717impl DeleteProcessorVersionRequest {
12718 /// Creates a new default instance.
12719 pub fn new() -> Self {
12720 std::default::Default::default()
12721 }
12722
12723 /// Sets the value of [name][crate::model::DeleteProcessorVersionRequest::name].
12724 ///
12725 /// # Example
12726 /// ```ignore,no_run
12727 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionRequest;
12728 /// # let project_id = "project_id";
12729 /// # let location_id = "location_id";
12730 /// # let processor_id = "processor_id";
12731 /// # let processor_version_id = "processor_version_id";
12732 /// let x = DeleteProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12733 /// ```
12734 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12735 self.name = v.into();
12736 self
12737 }
12738}
12739
12740impl wkt::message::Message for DeleteProcessorVersionRequest {
12741 fn typename() -> &'static str {
12742 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionRequest"
12743 }
12744}
12745
12746/// The long-running operation metadata for the
12747/// [DeleteProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]
12748/// method.
12749///
12750/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessorVersion]: crate::client::DocumentProcessorService::delete_processor_version
12751#[derive(Clone, Default, PartialEq)]
12752#[non_exhaustive]
12753pub struct DeleteProcessorVersionMetadata {
12754 /// The basic metadata of the long-running operation.
12755 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12756
12757 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12758}
12759
12760impl DeleteProcessorVersionMetadata {
12761 /// Creates a new default instance.
12762 pub fn new() -> Self {
12763 std::default::Default::default()
12764 }
12765
12766 /// Sets the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12767 ///
12768 /// # Example
12769 /// ```ignore,no_run
12770 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12771 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12772 /// let x = DeleteProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12773 /// ```
12774 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12775 where
12776 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12777 {
12778 self.common_metadata = std::option::Option::Some(v.into());
12779 self
12780 }
12781
12782 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorVersionMetadata::common_metadata].
12783 ///
12784 /// # Example
12785 /// ```ignore,no_run
12786 /// # use google_cloud_documentai_v1::model::DeleteProcessorVersionMetadata;
12787 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12788 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12789 /// let x = DeleteProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12790 /// ```
12791 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12792 where
12793 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12794 {
12795 self.common_metadata = v.map(|x| x.into());
12796 self
12797 }
12798}
12799
12800impl wkt::message::Message for DeleteProcessorVersionMetadata {
12801 fn typename() -> &'static str {
12802 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata"
12803 }
12804}
12805
12806/// Request message for the
12807/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12808/// method.
12809///
12810/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12811#[derive(Clone, Default, PartialEq)]
12812#[non_exhaustive]
12813pub struct DeployProcessorVersionRequest {
12814 /// Required. The processor version resource name to be deployed.
12815 pub name: std::string::String,
12816
12817 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12818}
12819
12820impl DeployProcessorVersionRequest {
12821 /// Creates a new default instance.
12822 pub fn new() -> Self {
12823 std::default::Default::default()
12824 }
12825
12826 /// Sets the value of [name][crate::model::DeployProcessorVersionRequest::name].
12827 ///
12828 /// # Example
12829 /// ```ignore,no_run
12830 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionRequest;
12831 /// # let project_id = "project_id";
12832 /// # let location_id = "location_id";
12833 /// # let processor_id = "processor_id";
12834 /// # let processor_version_id = "processor_version_id";
12835 /// let x = DeployProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12836 /// ```
12837 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12838 self.name = v.into();
12839 self
12840 }
12841}
12842
12843impl wkt::message::Message for DeployProcessorVersionRequest {
12844 fn typename() -> &'static str {
12845 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionRequest"
12846 }
12847}
12848
12849/// Response message for the
12850/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12851/// method.
12852///
12853/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12854#[derive(Clone, Default, PartialEq)]
12855#[non_exhaustive]
12856pub struct DeployProcessorVersionResponse {
12857 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12858}
12859
12860impl DeployProcessorVersionResponse {
12861 /// Creates a new default instance.
12862 pub fn new() -> Self {
12863 std::default::Default::default()
12864 }
12865}
12866
12867impl wkt::message::Message for DeployProcessorVersionResponse {
12868 fn typename() -> &'static str {
12869 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse"
12870 }
12871}
12872
12873/// The long-running operation metadata for the
12874/// [DeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]
12875/// method.
12876///
12877/// [google.cloud.documentai.v1.DocumentProcessorService.DeployProcessorVersion]: crate::client::DocumentProcessorService::deploy_processor_version
12878#[derive(Clone, Default, PartialEq)]
12879#[non_exhaustive]
12880pub struct DeployProcessorVersionMetadata {
12881 /// The basic metadata of the long-running operation.
12882 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
12883
12884 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12885}
12886
12887impl DeployProcessorVersionMetadata {
12888 /// Creates a new default instance.
12889 pub fn new() -> Self {
12890 std::default::Default::default()
12891 }
12892
12893 /// Sets the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12894 ///
12895 /// # Example
12896 /// ```ignore,no_run
12897 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12898 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12899 /// let x = DeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
12900 /// ```
12901 pub fn set_common_metadata<T>(mut self, v: T) -> Self
12902 where
12903 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12904 {
12905 self.common_metadata = std::option::Option::Some(v.into());
12906 self
12907 }
12908
12909 /// Sets or clears the value of [common_metadata][crate::model::DeployProcessorVersionMetadata::common_metadata].
12910 ///
12911 /// # Example
12912 /// ```ignore,no_run
12913 /// # use google_cloud_documentai_v1::model::DeployProcessorVersionMetadata;
12914 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
12915 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
12916 /// let x = DeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
12917 /// ```
12918 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
12919 where
12920 T: std::convert::Into<crate::model::CommonOperationMetadata>,
12921 {
12922 self.common_metadata = v.map(|x| x.into());
12923 self
12924 }
12925}
12926
12927impl wkt::message::Message for DeployProcessorVersionMetadata {
12928 fn typename() -> &'static str {
12929 "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata"
12930 }
12931}
12932
12933/// Request message for the
12934/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12935/// method.
12936///
12937/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12938#[derive(Clone, Default, PartialEq)]
12939#[non_exhaustive]
12940pub struct UndeployProcessorVersionRequest {
12941 /// Required. The processor version resource name to be undeployed.
12942 pub name: std::string::String,
12943
12944 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12945}
12946
12947impl UndeployProcessorVersionRequest {
12948 /// Creates a new default instance.
12949 pub fn new() -> Self {
12950 std::default::Default::default()
12951 }
12952
12953 /// Sets the value of [name][crate::model::UndeployProcessorVersionRequest::name].
12954 ///
12955 /// # Example
12956 /// ```ignore,no_run
12957 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionRequest;
12958 /// # let project_id = "project_id";
12959 /// # let location_id = "location_id";
12960 /// # let processor_id = "processor_id";
12961 /// # let processor_version_id = "processor_version_id";
12962 /// let x = UndeployProcessorVersionRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
12963 /// ```
12964 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
12965 self.name = v.into();
12966 self
12967 }
12968}
12969
12970impl wkt::message::Message for UndeployProcessorVersionRequest {
12971 fn typename() -> &'static str {
12972 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionRequest"
12973 }
12974}
12975
12976/// Response message for the
12977/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
12978/// method.
12979///
12980/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
12981#[derive(Clone, Default, PartialEq)]
12982#[non_exhaustive]
12983pub struct UndeployProcessorVersionResponse {
12984 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
12985}
12986
12987impl UndeployProcessorVersionResponse {
12988 /// Creates a new default instance.
12989 pub fn new() -> Self {
12990 std::default::Default::default()
12991 }
12992}
12993
12994impl wkt::message::Message for UndeployProcessorVersionResponse {
12995 fn typename() -> &'static str {
12996 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse"
12997 }
12998}
12999
13000/// The long-running operation metadata for the
13001/// [UndeployProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]
13002/// method.
13003///
13004/// [google.cloud.documentai.v1.DocumentProcessorService.UndeployProcessorVersion]: crate::client::DocumentProcessorService::undeploy_processor_version
13005#[derive(Clone, Default, PartialEq)]
13006#[non_exhaustive]
13007pub struct UndeployProcessorVersionMetadata {
13008 /// The basic metadata of the long-running operation.
13009 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13010
13011 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13012}
13013
13014impl UndeployProcessorVersionMetadata {
13015 /// Creates a new default instance.
13016 pub fn new() -> Self {
13017 std::default::Default::default()
13018 }
13019
13020 /// Sets the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
13021 ///
13022 /// # Example
13023 /// ```ignore,no_run
13024 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
13025 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13026 /// let x = UndeployProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13027 /// ```
13028 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13029 where
13030 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13031 {
13032 self.common_metadata = std::option::Option::Some(v.into());
13033 self
13034 }
13035
13036 /// Sets or clears the value of [common_metadata][crate::model::UndeployProcessorVersionMetadata::common_metadata].
13037 ///
13038 /// # Example
13039 /// ```ignore,no_run
13040 /// # use google_cloud_documentai_v1::model::UndeployProcessorVersionMetadata;
13041 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13042 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13043 /// let x = UndeployProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13044 /// ```
13045 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13046 where
13047 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13048 {
13049 self.common_metadata = v.map(|x| x.into());
13050 self
13051 }
13052}
13053
13054impl wkt::message::Message for UndeployProcessorVersionMetadata {
13055 fn typename() -> &'static str {
13056 "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata"
13057 }
13058}
13059
13060/// Request message for the
13061/// [CreateProcessor][google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]
13062/// method. Notice this request is sent to a regionalized backend service. If the
13063/// [ProcessorType][google.cloud.documentai.v1.ProcessorType] isn't available in
13064/// that region, the creation fails.
13065///
13066/// [google.cloud.documentai.v1.DocumentProcessorService.CreateProcessor]: crate::client::DocumentProcessorService::create_processor
13067/// [google.cloud.documentai.v1.ProcessorType]: crate::model::ProcessorType
13068#[derive(Clone, Default, PartialEq)]
13069#[non_exhaustive]
13070pub struct CreateProcessorRequest {
13071 /// Required. The parent (project and location) under which to create the
13072 /// processor. Format: `projects/{project}/locations/{location}`
13073 pub parent: std::string::String,
13074
13075 /// Required. The processor to be created, requires
13076 /// [Processor.type][google.cloud.documentai.v1.Processor.type] and
13077 /// [Processor.display_name][google.cloud.documentai.v1.Processor.display_name]
13078 /// to be set. Also, the
13079 /// [Processor.kms_key_name][google.cloud.documentai.v1.Processor.kms_key_name]
13080 /// field must be set if the processor is under CMEK.
13081 ///
13082 /// [google.cloud.documentai.v1.Processor.display_name]: crate::model::Processor::display_name
13083 /// [google.cloud.documentai.v1.Processor.kms_key_name]: crate::model::Processor::kms_key_name
13084 /// [google.cloud.documentai.v1.Processor.type]: crate::model::Processor::type
13085 pub processor: std::option::Option<crate::model::Processor>,
13086
13087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13088}
13089
13090impl CreateProcessorRequest {
13091 /// Creates a new default instance.
13092 pub fn new() -> Self {
13093 std::default::Default::default()
13094 }
13095
13096 /// Sets the value of [parent][crate::model::CreateProcessorRequest::parent].
13097 ///
13098 /// # Example
13099 /// ```ignore,no_run
13100 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13101 /// # let project_id = "project_id";
13102 /// # let location_id = "location_id";
13103 /// let x = CreateProcessorRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}"));
13104 /// ```
13105 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13106 self.parent = v.into();
13107 self
13108 }
13109
13110 /// Sets the value of [processor][crate::model::CreateProcessorRequest::processor].
13111 ///
13112 /// # Example
13113 /// ```ignore,no_run
13114 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13115 /// use google_cloud_documentai_v1::model::Processor;
13116 /// let x = CreateProcessorRequest::new().set_processor(Processor::default()/* use setters */);
13117 /// ```
13118 pub fn set_processor<T>(mut self, v: T) -> Self
13119 where
13120 T: std::convert::Into<crate::model::Processor>,
13121 {
13122 self.processor = std::option::Option::Some(v.into());
13123 self
13124 }
13125
13126 /// Sets or clears the value of [processor][crate::model::CreateProcessorRequest::processor].
13127 ///
13128 /// # Example
13129 /// ```ignore,no_run
13130 /// # use google_cloud_documentai_v1::model::CreateProcessorRequest;
13131 /// use google_cloud_documentai_v1::model::Processor;
13132 /// let x = CreateProcessorRequest::new().set_or_clear_processor(Some(Processor::default()/* use setters */));
13133 /// let x = CreateProcessorRequest::new().set_or_clear_processor(None::<Processor>);
13134 /// ```
13135 pub fn set_or_clear_processor<T>(mut self, v: std::option::Option<T>) -> Self
13136 where
13137 T: std::convert::Into<crate::model::Processor>,
13138 {
13139 self.processor = v.map(|x| x.into());
13140 self
13141 }
13142}
13143
13144impl wkt::message::Message for CreateProcessorRequest {
13145 fn typename() -> &'static str {
13146 "type.googleapis.com/google.cloud.documentai.v1.CreateProcessorRequest"
13147 }
13148}
13149
13150/// Request message for the
13151/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13152/// method.
13153///
13154/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13155#[derive(Clone, Default, PartialEq)]
13156#[non_exhaustive]
13157pub struct DeleteProcessorRequest {
13158 /// Required. The processor resource name to be deleted.
13159 pub name: std::string::String,
13160
13161 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13162}
13163
13164impl DeleteProcessorRequest {
13165 /// Creates a new default instance.
13166 pub fn new() -> Self {
13167 std::default::Default::default()
13168 }
13169
13170 /// Sets the value of [name][crate::model::DeleteProcessorRequest::name].
13171 ///
13172 /// # Example
13173 /// ```ignore,no_run
13174 /// # use google_cloud_documentai_v1::model::DeleteProcessorRequest;
13175 /// # let project_id = "project_id";
13176 /// # let location_id = "location_id";
13177 /// # let processor_id = "processor_id";
13178 /// let x = DeleteProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13179 /// ```
13180 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13181 self.name = v.into();
13182 self
13183 }
13184}
13185
13186impl wkt::message::Message for DeleteProcessorRequest {
13187 fn typename() -> &'static str {
13188 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorRequest"
13189 }
13190}
13191
13192/// The long-running operation metadata for the
13193/// [DeleteProcessor][google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]
13194/// method.
13195///
13196/// [google.cloud.documentai.v1.DocumentProcessorService.DeleteProcessor]: crate::client::DocumentProcessorService::delete_processor
13197#[derive(Clone, Default, PartialEq)]
13198#[non_exhaustive]
13199pub struct DeleteProcessorMetadata {
13200 /// The basic metadata of the long-running operation.
13201 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13202
13203 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13204}
13205
13206impl DeleteProcessorMetadata {
13207 /// Creates a new default instance.
13208 pub fn new() -> Self {
13209 std::default::Default::default()
13210 }
13211
13212 /// Sets the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13213 ///
13214 /// # Example
13215 /// ```ignore,no_run
13216 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13217 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13218 /// let x = DeleteProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13219 /// ```
13220 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13221 where
13222 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13223 {
13224 self.common_metadata = std::option::Option::Some(v.into());
13225 self
13226 }
13227
13228 /// Sets or clears the value of [common_metadata][crate::model::DeleteProcessorMetadata::common_metadata].
13229 ///
13230 /// # Example
13231 /// ```ignore,no_run
13232 /// # use google_cloud_documentai_v1::model::DeleteProcessorMetadata;
13233 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13234 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13235 /// let x = DeleteProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13236 /// ```
13237 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13238 where
13239 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13240 {
13241 self.common_metadata = v.map(|x| x.into());
13242 self
13243 }
13244}
13245
13246impl wkt::message::Message for DeleteProcessorMetadata {
13247 fn typename() -> &'static str {
13248 "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorMetadata"
13249 }
13250}
13251
13252/// Request message for the
13253/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13254/// method.
13255///
13256/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13257#[derive(Clone, Default, PartialEq)]
13258#[non_exhaustive]
13259pub struct EnableProcessorRequest {
13260 /// Required. The processor resource name to be enabled.
13261 pub name: std::string::String,
13262
13263 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13264}
13265
13266impl EnableProcessorRequest {
13267 /// Creates a new default instance.
13268 pub fn new() -> Self {
13269 std::default::Default::default()
13270 }
13271
13272 /// Sets the value of [name][crate::model::EnableProcessorRequest::name].
13273 ///
13274 /// # Example
13275 /// ```ignore,no_run
13276 /// # use google_cloud_documentai_v1::model::EnableProcessorRequest;
13277 /// # let project_id = "project_id";
13278 /// # let location_id = "location_id";
13279 /// # let processor_id = "processor_id";
13280 /// let x = EnableProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13281 /// ```
13282 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13283 self.name = v.into();
13284 self
13285 }
13286}
13287
13288impl wkt::message::Message for EnableProcessorRequest {
13289 fn typename() -> &'static str {
13290 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorRequest"
13291 }
13292}
13293
13294/// Response message for the
13295/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13296/// method. Intentionally empty proto for adding fields in future.
13297///
13298/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13299#[derive(Clone, Default, PartialEq)]
13300#[non_exhaustive]
13301pub struct EnableProcessorResponse {
13302 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13303}
13304
13305impl EnableProcessorResponse {
13306 /// Creates a new default instance.
13307 pub fn new() -> Self {
13308 std::default::Default::default()
13309 }
13310}
13311
13312impl wkt::message::Message for EnableProcessorResponse {
13313 fn typename() -> &'static str {
13314 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorResponse"
13315 }
13316}
13317
13318/// The long-running operation metadata for the
13319/// [EnableProcessor][google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]
13320/// method.
13321///
13322/// [google.cloud.documentai.v1.DocumentProcessorService.EnableProcessor]: crate::client::DocumentProcessorService::enable_processor
13323#[derive(Clone, Default, PartialEq)]
13324#[non_exhaustive]
13325pub struct EnableProcessorMetadata {
13326 /// The basic metadata of the long-running operation.
13327 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13328
13329 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13330}
13331
13332impl EnableProcessorMetadata {
13333 /// Creates a new default instance.
13334 pub fn new() -> Self {
13335 std::default::Default::default()
13336 }
13337
13338 /// Sets the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13339 ///
13340 /// # Example
13341 /// ```ignore,no_run
13342 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13343 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13344 /// let x = EnableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13345 /// ```
13346 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13347 where
13348 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13349 {
13350 self.common_metadata = std::option::Option::Some(v.into());
13351 self
13352 }
13353
13354 /// Sets or clears the value of [common_metadata][crate::model::EnableProcessorMetadata::common_metadata].
13355 ///
13356 /// # Example
13357 /// ```ignore,no_run
13358 /// # use google_cloud_documentai_v1::model::EnableProcessorMetadata;
13359 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13360 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13361 /// let x = EnableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13362 /// ```
13363 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13364 where
13365 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13366 {
13367 self.common_metadata = v.map(|x| x.into());
13368 self
13369 }
13370}
13371
13372impl wkt::message::Message for EnableProcessorMetadata {
13373 fn typename() -> &'static str {
13374 "type.googleapis.com/google.cloud.documentai.v1.EnableProcessorMetadata"
13375 }
13376}
13377
13378/// Request message for the
13379/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13380/// method.
13381///
13382/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13383#[derive(Clone, Default, PartialEq)]
13384#[non_exhaustive]
13385pub struct DisableProcessorRequest {
13386 /// Required. The processor resource name to be disabled.
13387 pub name: std::string::String,
13388
13389 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13390}
13391
13392impl DisableProcessorRequest {
13393 /// Creates a new default instance.
13394 pub fn new() -> Self {
13395 std::default::Default::default()
13396 }
13397
13398 /// Sets the value of [name][crate::model::DisableProcessorRequest::name].
13399 ///
13400 /// # Example
13401 /// ```ignore,no_run
13402 /// # use google_cloud_documentai_v1::model::DisableProcessorRequest;
13403 /// # let project_id = "project_id";
13404 /// # let location_id = "location_id";
13405 /// # let processor_id = "processor_id";
13406 /// let x = DisableProcessorRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13407 /// ```
13408 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13409 self.name = v.into();
13410 self
13411 }
13412}
13413
13414impl wkt::message::Message for DisableProcessorRequest {
13415 fn typename() -> &'static str {
13416 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorRequest"
13417 }
13418}
13419
13420/// Response message for the
13421/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13422/// method. Intentionally empty proto for adding fields in future.
13423///
13424/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13425#[derive(Clone, Default, PartialEq)]
13426#[non_exhaustive]
13427pub struct DisableProcessorResponse {
13428 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13429}
13430
13431impl DisableProcessorResponse {
13432 /// Creates a new default instance.
13433 pub fn new() -> Self {
13434 std::default::Default::default()
13435 }
13436}
13437
13438impl wkt::message::Message for DisableProcessorResponse {
13439 fn typename() -> &'static str {
13440 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorResponse"
13441 }
13442}
13443
13444/// The long-running operation metadata for the
13445/// [DisableProcessor][google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]
13446/// method.
13447///
13448/// [google.cloud.documentai.v1.DocumentProcessorService.DisableProcessor]: crate::client::DocumentProcessorService::disable_processor
13449#[derive(Clone, Default, PartialEq)]
13450#[non_exhaustive]
13451pub struct DisableProcessorMetadata {
13452 /// The basic metadata of the long-running operation.
13453 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13454
13455 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13456}
13457
13458impl DisableProcessorMetadata {
13459 /// Creates a new default instance.
13460 pub fn new() -> Self {
13461 std::default::Default::default()
13462 }
13463
13464 /// Sets the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13465 ///
13466 /// # Example
13467 /// ```ignore,no_run
13468 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13469 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13470 /// let x = DisableProcessorMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13471 /// ```
13472 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13473 where
13474 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13475 {
13476 self.common_metadata = std::option::Option::Some(v.into());
13477 self
13478 }
13479
13480 /// Sets or clears the value of [common_metadata][crate::model::DisableProcessorMetadata::common_metadata].
13481 ///
13482 /// # Example
13483 /// ```ignore,no_run
13484 /// # use google_cloud_documentai_v1::model::DisableProcessorMetadata;
13485 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13486 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13487 /// let x = DisableProcessorMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13488 /// ```
13489 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13490 where
13491 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13492 {
13493 self.common_metadata = v.map(|x| x.into());
13494 self
13495 }
13496}
13497
13498impl wkt::message::Message for DisableProcessorMetadata {
13499 fn typename() -> &'static str {
13500 "type.googleapis.com/google.cloud.documentai.v1.DisableProcessorMetadata"
13501 }
13502}
13503
13504/// Request message for the
13505/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13506/// method.
13507///
13508/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13509#[derive(Clone, Default, PartialEq)]
13510#[non_exhaustive]
13511pub struct SetDefaultProcessorVersionRequest {
13512 /// Required. The resource name of the
13513 /// [Processor][google.cloud.documentai.v1.Processor] to change default
13514 /// version.
13515 ///
13516 /// [google.cloud.documentai.v1.Processor]: crate::model::Processor
13517 pub processor: std::string::String,
13518
13519 /// Required. The resource name of child
13520 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to use as
13521 /// default. Format:
13522 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`
13523 ///
13524 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13525 pub default_processor_version: std::string::String,
13526
13527 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13528}
13529
13530impl SetDefaultProcessorVersionRequest {
13531 /// Creates a new default instance.
13532 pub fn new() -> Self {
13533 std::default::Default::default()
13534 }
13535
13536 /// Sets the value of [processor][crate::model::SetDefaultProcessorVersionRequest::processor].
13537 ///
13538 /// # Example
13539 /// ```ignore,no_run
13540 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13541 /// # let project_id = "project_id";
13542 /// # let location_id = "location_id";
13543 /// # let processor_id = "processor_id";
13544 /// let x = SetDefaultProcessorVersionRequest::new().set_processor(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13545 /// ```
13546 pub fn set_processor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13547 self.processor = v.into();
13548 self
13549 }
13550
13551 /// Sets the value of [default_processor_version][crate::model::SetDefaultProcessorVersionRequest::default_processor_version].
13552 ///
13553 /// # Example
13554 /// ```ignore,no_run
13555 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionRequest;
13556 /// # let project_id = "project_id";
13557 /// # let location_id = "location_id";
13558 /// # let processor_id = "processor_id";
13559 /// # let processor_version_id = "processor_version_id";
13560 /// let x = SetDefaultProcessorVersionRequest::new().set_default_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
13561 /// ```
13562 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
13563 mut self,
13564 v: T,
13565 ) -> Self {
13566 self.default_processor_version = v.into();
13567 self
13568 }
13569}
13570
13571impl wkt::message::Message for SetDefaultProcessorVersionRequest {
13572 fn typename() -> &'static str {
13573 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionRequest"
13574 }
13575}
13576
13577/// Response message for the
13578/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13579/// method.
13580///
13581/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13582#[derive(Clone, Default, PartialEq)]
13583#[non_exhaustive]
13584pub struct SetDefaultProcessorVersionResponse {
13585 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13586}
13587
13588impl SetDefaultProcessorVersionResponse {
13589 /// Creates a new default instance.
13590 pub fn new() -> Self {
13591 std::default::Default::default()
13592 }
13593}
13594
13595impl wkt::message::Message for SetDefaultProcessorVersionResponse {
13596 fn typename() -> &'static str {
13597 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse"
13598 }
13599}
13600
13601/// The long-running operation metadata for the
13602/// [SetDefaultProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]
13603/// method.
13604///
13605/// [google.cloud.documentai.v1.DocumentProcessorService.SetDefaultProcessorVersion]: crate::client::DocumentProcessorService::set_default_processor_version
13606#[derive(Clone, Default, PartialEq)]
13607#[non_exhaustive]
13608pub struct SetDefaultProcessorVersionMetadata {
13609 /// The basic metadata of the long-running operation.
13610 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
13611
13612 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13613}
13614
13615impl SetDefaultProcessorVersionMetadata {
13616 /// Creates a new default instance.
13617 pub fn new() -> Self {
13618 std::default::Default::default()
13619 }
13620
13621 /// Sets the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13622 ///
13623 /// # Example
13624 /// ```ignore,no_run
13625 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13626 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13627 /// let x = SetDefaultProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
13628 /// ```
13629 pub fn set_common_metadata<T>(mut self, v: T) -> Self
13630 where
13631 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13632 {
13633 self.common_metadata = std::option::Option::Some(v.into());
13634 self
13635 }
13636
13637 /// Sets or clears the value of [common_metadata][crate::model::SetDefaultProcessorVersionMetadata::common_metadata].
13638 ///
13639 /// # Example
13640 /// ```ignore,no_run
13641 /// # use google_cloud_documentai_v1::model::SetDefaultProcessorVersionMetadata;
13642 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
13643 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
13644 /// let x = SetDefaultProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
13645 /// ```
13646 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
13647 where
13648 T: std::convert::Into<crate::model::CommonOperationMetadata>,
13649 {
13650 self.common_metadata = v.map(|x| x.into());
13651 self
13652 }
13653}
13654
13655impl wkt::message::Message for SetDefaultProcessorVersionMetadata {
13656 fn typename() -> &'static str {
13657 "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata"
13658 }
13659}
13660
13661/// Request message for the
13662/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]
13663/// method.
13664///
13665/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
13666#[derive(Clone, Default, PartialEq)]
13667#[non_exhaustive]
13668pub struct TrainProcessorVersionRequest {
13669 /// Required. The parent (project, location and processor) to create the new
13670 /// version for. Format:
13671 /// `projects/{project}/locations/{location}/processors/{processor}`.
13672 pub parent: std::string::String,
13673
13674 /// Required. The processor version to be created.
13675 pub processor_version: std::option::Option<crate::model::ProcessorVersion>,
13676
13677 /// Optional. The schema the processor version will be trained with.
13678 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
13679
13680 /// Optional. The input data used to train the
13681 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13682 ///
13683 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13684 pub input_data: std::option::Option<crate::model::train_processor_version_request::InputData>,
13685
13686 /// Optional. The processor version to use as a base for training. This
13687 /// processor version must be a child of `parent`. Format:
13688 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
13689 pub base_processor_version: std::string::String,
13690
13691 #[allow(missing_docs)]
13692 pub processor_flags:
13693 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13694
13695 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13696}
13697
13698impl TrainProcessorVersionRequest {
13699 /// Creates a new default instance.
13700 pub fn new() -> Self {
13701 std::default::Default::default()
13702 }
13703
13704 /// Sets the value of [parent][crate::model::TrainProcessorVersionRequest::parent].
13705 ///
13706 /// # Example
13707 /// ```ignore,no_run
13708 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13709 /// # let project_id = "project_id";
13710 /// # let location_id = "location_id";
13711 /// # let processor_id = "processor_id";
13712 /// let x = TrainProcessorVersionRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
13713 /// ```
13714 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
13715 self.parent = v.into();
13716 self
13717 }
13718
13719 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13720 ///
13721 /// # Example
13722 /// ```ignore,no_run
13723 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13724 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13725 /// let x = TrainProcessorVersionRequest::new().set_processor_version(ProcessorVersion::default()/* use setters */);
13726 /// ```
13727 pub fn set_processor_version<T>(mut self, v: T) -> Self
13728 where
13729 T: std::convert::Into<crate::model::ProcessorVersion>,
13730 {
13731 self.processor_version = std::option::Option::Some(v.into());
13732 self
13733 }
13734
13735 /// Sets or clears the value of [processor_version][crate::model::TrainProcessorVersionRequest::processor_version].
13736 ///
13737 /// # Example
13738 /// ```ignore,no_run
13739 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13740 /// use google_cloud_documentai_v1::model::ProcessorVersion;
13741 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(Some(ProcessorVersion::default()/* use setters */));
13742 /// let x = TrainProcessorVersionRequest::new().set_or_clear_processor_version(None::<ProcessorVersion>);
13743 /// ```
13744 pub fn set_or_clear_processor_version<T>(mut self, v: std::option::Option<T>) -> Self
13745 where
13746 T: std::convert::Into<crate::model::ProcessorVersion>,
13747 {
13748 self.processor_version = v.map(|x| x.into());
13749 self
13750 }
13751
13752 /// Sets the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13753 ///
13754 /// # Example
13755 /// ```ignore,no_run
13756 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13757 /// use google_cloud_documentai_v1::model::DocumentSchema;
13758 /// let x = TrainProcessorVersionRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
13759 /// ```
13760 pub fn set_document_schema<T>(mut self, v: T) -> Self
13761 where
13762 T: std::convert::Into<crate::model::DocumentSchema>,
13763 {
13764 self.document_schema = std::option::Option::Some(v.into());
13765 self
13766 }
13767
13768 /// Sets or clears the value of [document_schema][crate::model::TrainProcessorVersionRequest::document_schema].
13769 ///
13770 /// # Example
13771 /// ```ignore,no_run
13772 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13773 /// use google_cloud_documentai_v1::model::DocumentSchema;
13774 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
13775 /// let x = TrainProcessorVersionRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
13776 /// ```
13777 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
13778 where
13779 T: std::convert::Into<crate::model::DocumentSchema>,
13780 {
13781 self.document_schema = v.map(|x| x.into());
13782 self
13783 }
13784
13785 /// Sets the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13786 ///
13787 /// # Example
13788 /// ```ignore,no_run
13789 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13790 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13791 /// let x = TrainProcessorVersionRequest::new().set_input_data(InputData::default()/* use setters */);
13792 /// ```
13793 pub fn set_input_data<T>(mut self, v: T) -> Self
13794 where
13795 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13796 {
13797 self.input_data = std::option::Option::Some(v.into());
13798 self
13799 }
13800
13801 /// Sets or clears the value of [input_data][crate::model::TrainProcessorVersionRequest::input_data].
13802 ///
13803 /// # Example
13804 /// ```ignore,no_run
13805 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13806 /// use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13807 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(Some(InputData::default()/* use setters */));
13808 /// let x = TrainProcessorVersionRequest::new().set_or_clear_input_data(None::<InputData>);
13809 /// ```
13810 pub fn set_or_clear_input_data<T>(mut self, v: std::option::Option<T>) -> Self
13811 where
13812 T: std::convert::Into<crate::model::train_processor_version_request::InputData>,
13813 {
13814 self.input_data = v.map(|x| x.into());
13815 self
13816 }
13817
13818 /// Sets the value of [base_processor_version][crate::model::TrainProcessorVersionRequest::base_processor_version].
13819 ///
13820 /// # Example
13821 /// ```ignore,no_run
13822 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13823 /// let x = TrainProcessorVersionRequest::new().set_base_processor_version("example");
13824 /// ```
13825 pub fn set_base_processor_version<T: std::convert::Into<std::string::String>>(
13826 mut self,
13827 v: T,
13828 ) -> Self {
13829 self.base_processor_version = v.into();
13830 self
13831 }
13832
13833 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags].
13834 ///
13835 /// Note that all the setters affecting `processor_flags` are mutually
13836 /// exclusive.
13837 ///
13838 /// # Example
13839 /// ```ignore,no_run
13840 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13841 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13842 /// let x = TrainProcessorVersionRequest::new().set_processor_flags(Some(
13843 /// google_cloud_documentai_v1::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(CustomDocumentExtractionOptions::default().into())));
13844 /// ```
13845 pub fn set_processor_flags<
13846 T: std::convert::Into<
13847 std::option::Option<crate::model::train_processor_version_request::ProcessorFlags>,
13848 >,
13849 >(
13850 mut self,
13851 v: T,
13852 ) -> Self {
13853 self.processor_flags = v.into();
13854 self
13855 }
13856
13857 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13858 /// if it holds a `CustomDocumentExtractionOptions`, `None` if the field is not set or
13859 /// holds a different branch.
13860 pub fn custom_document_extraction_options(
13861 &self,
13862 ) -> std::option::Option<
13863 &std::boxed::Box<
13864 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13865 >,
13866 > {
13867 #[allow(unreachable_patterns)]
13868 self.processor_flags.as_ref().and_then(|v| match v {
13869 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(v) => std::option::Option::Some(v),
13870 _ => std::option::Option::None,
13871 })
13872 }
13873
13874 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13875 /// to hold a `CustomDocumentExtractionOptions`.
13876 ///
13877 /// Note that all the setters affecting `processor_flags` are
13878 /// mutually exclusive.
13879 ///
13880 /// # Example
13881 /// ```ignore,no_run
13882 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13883 /// use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
13884 /// let x = TrainProcessorVersionRequest::new().set_custom_document_extraction_options(CustomDocumentExtractionOptions::default()/* use setters */);
13885 /// assert!(x.custom_document_extraction_options().is_some());
13886 /// assert!(x.foundation_model_tuning_options().is_none());
13887 /// ```
13888 pub fn set_custom_document_extraction_options<
13889 T: std::convert::Into<
13890 std::boxed::Box<
13891 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
13892 >,
13893 >,
13894 >(
13895 mut self,
13896 v: T,
13897 ) -> Self {
13898 self.processor_flags = std::option::Option::Some(
13899 crate::model::train_processor_version_request::ProcessorFlags::CustomDocumentExtractionOptions(
13900 v.into()
13901 )
13902 );
13903 self
13904 }
13905
13906 /// The value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13907 /// if it holds a `FoundationModelTuningOptions`, `None` if the field is not set or
13908 /// holds a different branch.
13909 pub fn foundation_model_tuning_options(
13910 &self,
13911 ) -> std::option::Option<
13912 &std::boxed::Box<
13913 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13914 >,
13915 > {
13916 #[allow(unreachable_patterns)]
13917 self.processor_flags.as_ref().and_then(|v| match v {
13918 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(v) => std::option::Option::Some(v),
13919 _ => std::option::Option::None,
13920 })
13921 }
13922
13923 /// Sets the value of [processor_flags][crate::model::TrainProcessorVersionRequest::processor_flags]
13924 /// to hold a `FoundationModelTuningOptions`.
13925 ///
13926 /// Note that all the setters affecting `processor_flags` are
13927 /// mutually exclusive.
13928 ///
13929 /// # Example
13930 /// ```ignore,no_run
13931 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionRequest;
13932 /// use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
13933 /// let x = TrainProcessorVersionRequest::new().set_foundation_model_tuning_options(FoundationModelTuningOptions::default()/* use setters */);
13934 /// assert!(x.foundation_model_tuning_options().is_some());
13935 /// assert!(x.custom_document_extraction_options().is_none());
13936 /// ```
13937 pub fn set_foundation_model_tuning_options<
13938 T: std::convert::Into<
13939 std::boxed::Box<
13940 crate::model::train_processor_version_request::FoundationModelTuningOptions,
13941 >,
13942 >,
13943 >(
13944 mut self,
13945 v: T,
13946 ) -> Self {
13947 self.processor_flags = std::option::Option::Some(
13948 crate::model::train_processor_version_request::ProcessorFlags::FoundationModelTuningOptions(
13949 v.into()
13950 )
13951 );
13952 self
13953 }
13954}
13955
13956impl wkt::message::Message for TrainProcessorVersionRequest {
13957 fn typename() -> &'static str {
13958 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest"
13959 }
13960}
13961
13962/// Defines additional types related to [TrainProcessorVersionRequest].
13963pub mod train_processor_version_request {
13964 #[allow(unused_imports)]
13965 use super::*;
13966
13967 /// The input data used to train a new
13968 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
13969 ///
13970 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
13971 #[derive(Clone, Default, PartialEq)]
13972 #[non_exhaustive]
13973 pub struct InputData {
13974 /// The documents used for training the new version.
13975 pub training_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13976
13977 /// The documents used for testing the trained version.
13978 pub test_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
13979
13980 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
13981 }
13982
13983 impl InputData {
13984 /// Creates a new default instance.
13985 pub fn new() -> Self {
13986 std::default::Default::default()
13987 }
13988
13989 /// Sets the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
13990 ///
13991 /// # Example
13992 /// ```ignore,no_run
13993 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
13994 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
13995 /// let x = InputData::new().set_training_documents(BatchDocumentsInputConfig::default()/* use setters */);
13996 /// ```
13997 pub fn set_training_documents<T>(mut self, v: T) -> Self
13998 where
13999 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14000 {
14001 self.training_documents = std::option::Option::Some(v.into());
14002 self
14003 }
14004
14005 /// Sets or clears the value of [training_documents][crate::model::train_processor_version_request::InputData::training_documents].
14006 ///
14007 /// # Example
14008 /// ```ignore,no_run
14009 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
14010 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14011 /// let x = InputData::new().set_or_clear_training_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
14012 /// let x = InputData::new().set_or_clear_training_documents(None::<BatchDocumentsInputConfig>);
14013 /// ```
14014 pub fn set_or_clear_training_documents<T>(mut self, v: std::option::Option<T>) -> Self
14015 where
14016 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14017 {
14018 self.training_documents = v.map(|x| x.into());
14019 self
14020 }
14021
14022 /// Sets the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
14023 ///
14024 /// # Example
14025 /// ```ignore,no_run
14026 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
14027 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14028 /// let x = InputData::new().set_test_documents(BatchDocumentsInputConfig::default()/* use setters */);
14029 /// ```
14030 pub fn set_test_documents<T>(mut self, v: T) -> Self
14031 where
14032 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14033 {
14034 self.test_documents = std::option::Option::Some(v.into());
14035 self
14036 }
14037
14038 /// Sets or clears the value of [test_documents][crate::model::train_processor_version_request::InputData::test_documents].
14039 ///
14040 /// # Example
14041 /// ```ignore,no_run
14042 /// # use google_cloud_documentai_v1::model::train_processor_version_request::InputData;
14043 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
14044 /// let x = InputData::new().set_or_clear_test_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
14045 /// let x = InputData::new().set_or_clear_test_documents(None::<BatchDocumentsInputConfig>);
14046 /// ```
14047 pub fn set_or_clear_test_documents<T>(mut self, v: std::option::Option<T>) -> Self
14048 where
14049 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
14050 {
14051 self.test_documents = v.map(|x| x.into());
14052 self
14053 }
14054 }
14055
14056 impl wkt::message::Message for InputData {
14057 fn typename() -> &'static str {
14058 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.InputData"
14059 }
14060 }
14061
14062 /// Options to control the training of the Custom Document Extraction (CDE)
14063 /// Processor.
14064 #[derive(Clone, Default, PartialEq)]
14065 #[non_exhaustive]
14066 pub struct CustomDocumentExtractionOptions {
14067
14068 /// Optional. Training method to use for CDE training.
14069 pub training_method: crate::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod,
14070
14071 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14072 }
14073
14074 impl CustomDocumentExtractionOptions {
14075 /// Creates a new default instance.
14076 pub fn new() -> Self {
14077 std::default::Default::default()
14078 }
14079
14080 /// Sets the value of [training_method][crate::model::train_processor_version_request::CustomDocumentExtractionOptions::training_method].
14081 ///
14082 /// # Example
14083 /// ```ignore,no_run
14084 /// # use google_cloud_documentai_v1::model::train_processor_version_request::CustomDocumentExtractionOptions;
14085 /// use google_cloud_documentai_v1::model::train_processor_version_request::custom_document_extraction_options::TrainingMethod;
14086 /// let x0 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::ModelBased);
14087 /// let x1 = CustomDocumentExtractionOptions::new().set_training_method(TrainingMethod::TemplateBased);
14088 /// ```
14089 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{
14090 self.training_method = v.into();
14091 self
14092 }
14093 }
14094
14095 impl wkt::message::Message for CustomDocumentExtractionOptions {
14096 fn typename() -> &'static str {
14097 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions"
14098 }
14099 }
14100
14101 /// Defines additional types related to [CustomDocumentExtractionOptions].
14102 pub mod custom_document_extraction_options {
14103 #[allow(unused_imports)]
14104 use super::*;
14105
14106 /// Training Method for CDE. `TRAINING_METHOD_UNSPECIFIED` will fall back to
14107 /// `MODEL_BASED`.
14108 ///
14109 /// # Working with unknown values
14110 ///
14111 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14112 /// additional enum variants at any time. Adding new variants is not considered
14113 /// a breaking change. Applications should write their code in anticipation of:
14114 ///
14115 /// - New values appearing in future releases of the client library, **and**
14116 /// - New values received dynamically, without application changes.
14117 ///
14118 /// Please consult the [Working with enums] section in the user guide for some
14119 /// guidelines.
14120 ///
14121 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14122 #[derive(Clone, Debug, PartialEq)]
14123 #[non_exhaustive]
14124 pub enum TrainingMethod {
14125 #[allow(missing_docs)]
14126 Unspecified,
14127 #[allow(missing_docs)]
14128 ModelBased,
14129 #[allow(missing_docs)]
14130 TemplateBased,
14131 /// If set, the enum was initialized with an unknown value.
14132 ///
14133 /// Applications can examine the value using [TrainingMethod::value] or
14134 /// [TrainingMethod::name].
14135 UnknownValue(training_method::UnknownValue),
14136 }
14137
14138 #[doc(hidden)]
14139 pub mod training_method {
14140 #[allow(unused_imports)]
14141 use super::*;
14142 #[derive(Clone, Debug, PartialEq)]
14143 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14144 }
14145
14146 impl TrainingMethod {
14147 /// Gets the enum value.
14148 ///
14149 /// Returns `None` if the enum contains an unknown value deserialized from
14150 /// the string representation of enums.
14151 pub fn value(&self) -> std::option::Option<i32> {
14152 match self {
14153 Self::Unspecified => std::option::Option::Some(0),
14154 Self::ModelBased => std::option::Option::Some(1),
14155 Self::TemplateBased => std::option::Option::Some(2),
14156 Self::UnknownValue(u) => u.0.value(),
14157 }
14158 }
14159
14160 /// Gets the enum value as a string.
14161 ///
14162 /// Returns `None` if the enum contains an unknown value deserialized from
14163 /// the integer representation of enums.
14164 pub fn name(&self) -> std::option::Option<&str> {
14165 match self {
14166 Self::Unspecified => std::option::Option::Some("TRAINING_METHOD_UNSPECIFIED"),
14167 Self::ModelBased => std::option::Option::Some("MODEL_BASED"),
14168 Self::TemplateBased => std::option::Option::Some("TEMPLATE_BASED"),
14169 Self::UnknownValue(u) => u.0.name(),
14170 }
14171 }
14172 }
14173
14174 impl std::default::Default for TrainingMethod {
14175 fn default() -> Self {
14176 use std::convert::From;
14177 Self::from(0)
14178 }
14179 }
14180
14181 impl std::fmt::Display for TrainingMethod {
14182 fn fmt(
14183 &self,
14184 f: &mut std::fmt::Formatter<'_>,
14185 ) -> std::result::Result<(), std::fmt::Error> {
14186 wkt::internal::display_enum(f, self.name(), self.value())
14187 }
14188 }
14189
14190 impl std::convert::From<i32> for TrainingMethod {
14191 fn from(value: i32) -> Self {
14192 match value {
14193 0 => Self::Unspecified,
14194 1 => Self::ModelBased,
14195 2 => Self::TemplateBased,
14196 _ => Self::UnknownValue(training_method::UnknownValue(
14197 wkt::internal::UnknownEnumValue::Integer(value),
14198 )),
14199 }
14200 }
14201 }
14202
14203 impl std::convert::From<&str> for TrainingMethod {
14204 fn from(value: &str) -> Self {
14205 use std::string::ToString;
14206 match value {
14207 "TRAINING_METHOD_UNSPECIFIED" => Self::Unspecified,
14208 "MODEL_BASED" => Self::ModelBased,
14209 "TEMPLATE_BASED" => Self::TemplateBased,
14210 _ => Self::UnknownValue(training_method::UnknownValue(
14211 wkt::internal::UnknownEnumValue::String(value.to_string()),
14212 )),
14213 }
14214 }
14215 }
14216
14217 impl serde::ser::Serialize for TrainingMethod {
14218 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14219 where
14220 S: serde::Serializer,
14221 {
14222 match self {
14223 Self::Unspecified => serializer.serialize_i32(0),
14224 Self::ModelBased => serializer.serialize_i32(1),
14225 Self::TemplateBased => serializer.serialize_i32(2),
14226 Self::UnknownValue(u) => u.0.serialize(serializer),
14227 }
14228 }
14229 }
14230
14231 impl<'de> serde::de::Deserialize<'de> for TrainingMethod {
14232 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14233 where
14234 D: serde::Deserializer<'de>,
14235 {
14236 deserializer.deserialize_any(wkt::internal::EnumVisitor::<TrainingMethod>::new(
14237 ".google.cloud.documentai.v1.TrainProcessorVersionRequest.CustomDocumentExtractionOptions.TrainingMethod"))
14238 }
14239 }
14240 }
14241
14242 /// Options to control foundation model tuning of the processor.
14243 #[derive(Clone, Default, PartialEq)]
14244 #[non_exhaustive]
14245 pub struct FoundationModelTuningOptions {
14246 /// Optional. The number of steps to run for model tuning. Valid values are
14247 /// between 1 and 400. If not provided, recommended steps will be used.
14248 pub train_steps: i32,
14249
14250 /// Optional. The multiplier to apply to the recommended learning rate. Valid
14251 /// values are between 0.1 and 10. If not provided, recommended learning rate
14252 /// will be used.
14253 pub learning_rate_multiplier: f32,
14254
14255 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14256 }
14257
14258 impl FoundationModelTuningOptions {
14259 /// Creates a new default instance.
14260 pub fn new() -> Self {
14261 std::default::Default::default()
14262 }
14263
14264 /// Sets the value of [train_steps][crate::model::train_processor_version_request::FoundationModelTuningOptions::train_steps].
14265 ///
14266 /// # Example
14267 /// ```ignore,no_run
14268 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14269 /// let x = FoundationModelTuningOptions::new().set_train_steps(42);
14270 /// ```
14271 pub fn set_train_steps<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14272 self.train_steps = v.into();
14273 self
14274 }
14275
14276 /// Sets the value of [learning_rate_multiplier][crate::model::train_processor_version_request::FoundationModelTuningOptions::learning_rate_multiplier].
14277 ///
14278 /// # Example
14279 /// ```ignore,no_run
14280 /// # use google_cloud_documentai_v1::model::train_processor_version_request::FoundationModelTuningOptions;
14281 /// let x = FoundationModelTuningOptions::new().set_learning_rate_multiplier(42.0);
14282 /// ```
14283 pub fn set_learning_rate_multiplier<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
14284 self.learning_rate_multiplier = v.into();
14285 self
14286 }
14287 }
14288
14289 impl wkt::message::Message for FoundationModelTuningOptions {
14290 fn typename() -> &'static str {
14291 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionRequest.FoundationModelTuningOptions"
14292 }
14293 }
14294
14295 #[allow(missing_docs)]
14296 #[derive(Clone, Debug, PartialEq)]
14297 #[non_exhaustive]
14298 pub enum ProcessorFlags {
14299 /// Options to control Custom Document Extraction (CDE) Processor.
14300 CustomDocumentExtractionOptions(
14301 std::boxed::Box<
14302 crate::model::train_processor_version_request::CustomDocumentExtractionOptions,
14303 >,
14304 ),
14305 /// Options to control foundation model tuning of a processor.
14306 FoundationModelTuningOptions(
14307 std::boxed::Box<
14308 crate::model::train_processor_version_request::FoundationModelTuningOptions,
14309 >,
14310 ),
14311 }
14312}
14313
14314/// The response for
14315/// [TrainProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion].
14316///
14317/// [google.cloud.documentai.v1.DocumentProcessorService.TrainProcessorVersion]: crate::client::DocumentProcessorService::train_processor_version
14318#[derive(Clone, Default, PartialEq)]
14319#[non_exhaustive]
14320pub struct TrainProcessorVersionResponse {
14321 /// The resource name of the processor version produced by training.
14322 pub processor_version: std::string::String,
14323
14324 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14325}
14326
14327impl TrainProcessorVersionResponse {
14328 /// Creates a new default instance.
14329 pub fn new() -> Self {
14330 std::default::Default::default()
14331 }
14332
14333 /// Sets the value of [processor_version][crate::model::TrainProcessorVersionResponse::processor_version].
14334 ///
14335 /// # Example
14336 /// ```ignore,no_run
14337 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionResponse;
14338 /// let x = TrainProcessorVersionResponse::new().set_processor_version("example");
14339 /// ```
14340 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
14341 mut self,
14342 v: T,
14343 ) -> Self {
14344 self.processor_version = v.into();
14345 self
14346 }
14347}
14348
14349impl wkt::message::Message for TrainProcessorVersionResponse {
14350 fn typename() -> &'static str {
14351 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionResponse"
14352 }
14353}
14354
14355/// The metadata that represents a processor version being created.
14356#[derive(Clone, Default, PartialEq)]
14357#[non_exhaustive]
14358pub struct TrainProcessorVersionMetadata {
14359 /// The basic metadata of the long-running operation.
14360 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
14361
14362 /// The training dataset validation information.
14363 pub training_dataset_validation:
14364 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14365
14366 /// The test dataset validation information.
14367 pub test_dataset_validation:
14368 std::option::Option<crate::model::train_processor_version_metadata::DatasetValidation>,
14369
14370 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14371}
14372
14373impl TrainProcessorVersionMetadata {
14374 /// Creates a new default instance.
14375 pub fn new() -> Self {
14376 std::default::Default::default()
14377 }
14378
14379 /// Sets the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14380 ///
14381 /// # Example
14382 /// ```ignore,no_run
14383 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14384 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14385 /// let x = TrainProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
14386 /// ```
14387 pub fn set_common_metadata<T>(mut self, v: T) -> Self
14388 where
14389 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14390 {
14391 self.common_metadata = std::option::Option::Some(v.into());
14392 self
14393 }
14394
14395 /// Sets or clears the value of [common_metadata][crate::model::TrainProcessorVersionMetadata::common_metadata].
14396 ///
14397 /// # Example
14398 /// ```ignore,no_run
14399 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14400 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
14401 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
14402 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
14403 /// ```
14404 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
14405 where
14406 T: std::convert::Into<crate::model::CommonOperationMetadata>,
14407 {
14408 self.common_metadata = v.map(|x| x.into());
14409 self
14410 }
14411
14412 /// Sets the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14413 ///
14414 /// # Example
14415 /// ```ignore,no_run
14416 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14417 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14418 /// let x = TrainProcessorVersionMetadata::new().set_training_dataset_validation(DatasetValidation::default()/* use setters */);
14419 /// ```
14420 pub fn set_training_dataset_validation<T>(mut self, v: T) -> Self
14421 where
14422 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14423 {
14424 self.training_dataset_validation = std::option::Option::Some(v.into());
14425 self
14426 }
14427
14428 /// Sets or clears the value of [training_dataset_validation][crate::model::TrainProcessorVersionMetadata::training_dataset_validation].
14429 ///
14430 /// # Example
14431 /// ```ignore,no_run
14432 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14433 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14434 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14435 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_training_dataset_validation(None::<DatasetValidation>);
14436 /// ```
14437 pub fn set_or_clear_training_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14438 where
14439 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14440 {
14441 self.training_dataset_validation = v.map(|x| x.into());
14442 self
14443 }
14444
14445 /// Sets the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14446 ///
14447 /// # Example
14448 /// ```ignore,no_run
14449 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14450 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14451 /// let x = TrainProcessorVersionMetadata::new().set_test_dataset_validation(DatasetValidation::default()/* use setters */);
14452 /// ```
14453 pub fn set_test_dataset_validation<T>(mut self, v: T) -> Self
14454 where
14455 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14456 {
14457 self.test_dataset_validation = std::option::Option::Some(v.into());
14458 self
14459 }
14460
14461 /// Sets or clears the value of [test_dataset_validation][crate::model::TrainProcessorVersionMetadata::test_dataset_validation].
14462 ///
14463 /// # Example
14464 /// ```ignore,no_run
14465 /// # use google_cloud_documentai_v1::model::TrainProcessorVersionMetadata;
14466 /// use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14467 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(Some(DatasetValidation::default()/* use setters */));
14468 /// let x = TrainProcessorVersionMetadata::new().set_or_clear_test_dataset_validation(None::<DatasetValidation>);
14469 /// ```
14470 pub fn set_or_clear_test_dataset_validation<T>(mut self, v: std::option::Option<T>) -> Self
14471 where
14472 T: std::convert::Into<crate::model::train_processor_version_metadata::DatasetValidation>,
14473 {
14474 self.test_dataset_validation = v.map(|x| x.into());
14475 self
14476 }
14477}
14478
14479impl wkt::message::Message for TrainProcessorVersionMetadata {
14480 fn typename() -> &'static str {
14481 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata"
14482 }
14483}
14484
14485/// Defines additional types related to [TrainProcessorVersionMetadata].
14486pub mod train_processor_version_metadata {
14487 #[allow(unused_imports)]
14488 use super::*;
14489
14490 /// The dataset validation information.
14491 /// This includes any and all errors with documents and the dataset.
14492 #[derive(Clone, Default, PartialEq)]
14493 #[non_exhaustive]
14494 pub struct DatasetValidation {
14495 /// The total number of document errors.
14496 pub document_error_count: i32,
14497
14498 /// The total number of dataset errors.
14499 pub dataset_error_count: i32,
14500
14501 /// Error information pertaining to specific documents. A maximum of 10
14502 /// document errors will be returned.
14503 /// Any document with errors will not be used throughout training.
14504 pub document_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14505
14506 /// Error information for the dataset as a whole. A maximum of 10 dataset
14507 /// errors will be returned.
14508 /// A single dataset error is terminal for training.
14509 pub dataset_errors: std::vec::Vec<google_cloud_rpc::model::Status>,
14510
14511 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14512 }
14513
14514 impl DatasetValidation {
14515 /// Creates a new default instance.
14516 pub fn new() -> Self {
14517 std::default::Default::default()
14518 }
14519
14520 /// Sets the value of [document_error_count][crate::model::train_processor_version_metadata::DatasetValidation::document_error_count].
14521 ///
14522 /// # Example
14523 /// ```ignore,no_run
14524 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14525 /// let x = DatasetValidation::new().set_document_error_count(42);
14526 /// ```
14527 pub fn set_document_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14528 self.document_error_count = v.into();
14529 self
14530 }
14531
14532 /// Sets the value of [dataset_error_count][crate::model::train_processor_version_metadata::DatasetValidation::dataset_error_count].
14533 ///
14534 /// # Example
14535 /// ```ignore,no_run
14536 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14537 /// let x = DatasetValidation::new().set_dataset_error_count(42);
14538 /// ```
14539 pub fn set_dataset_error_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
14540 self.dataset_error_count = v.into();
14541 self
14542 }
14543
14544 /// Sets the value of [document_errors][crate::model::train_processor_version_metadata::DatasetValidation::document_errors].
14545 ///
14546 /// # Example
14547 /// ```ignore,no_run
14548 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14549 /// use google_cloud_rpc::model::Status;
14550 /// let x = DatasetValidation::new()
14551 /// .set_document_errors([
14552 /// Status::default()/* use setters */,
14553 /// Status::default()/* use (different) setters */,
14554 /// ]);
14555 /// ```
14556 pub fn set_document_errors<T, V>(mut self, v: T) -> Self
14557 where
14558 T: std::iter::IntoIterator<Item = V>,
14559 V: std::convert::Into<google_cloud_rpc::model::Status>,
14560 {
14561 use std::iter::Iterator;
14562 self.document_errors = v.into_iter().map(|i| i.into()).collect();
14563 self
14564 }
14565
14566 /// Sets the value of [dataset_errors][crate::model::train_processor_version_metadata::DatasetValidation::dataset_errors].
14567 ///
14568 /// # Example
14569 /// ```ignore,no_run
14570 /// # use google_cloud_documentai_v1::model::train_processor_version_metadata::DatasetValidation;
14571 /// use google_cloud_rpc::model::Status;
14572 /// let x = DatasetValidation::new()
14573 /// .set_dataset_errors([
14574 /// Status::default()/* use setters */,
14575 /// Status::default()/* use (different) setters */,
14576 /// ]);
14577 /// ```
14578 pub fn set_dataset_errors<T, V>(mut self, v: T) -> Self
14579 where
14580 T: std::iter::IntoIterator<Item = V>,
14581 V: std::convert::Into<google_cloud_rpc::model::Status>,
14582 {
14583 use std::iter::Iterator;
14584 self.dataset_errors = v.into_iter().map(|i| i.into()).collect();
14585 self
14586 }
14587 }
14588
14589 impl wkt::message::Message for DatasetValidation {
14590 fn typename() -> &'static str {
14591 "type.googleapis.com/google.cloud.documentai.v1.TrainProcessorVersionMetadata.DatasetValidation"
14592 }
14593 }
14594}
14595
14596/// Request message for the
14597/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14598/// method.
14599///
14600/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14601#[derive(Clone, Default, PartialEq)]
14602#[non_exhaustive]
14603pub struct ReviewDocumentRequest {
14604 /// Required. The resource name of the
14605 /// [HumanReviewConfig][google.cloud.documentai.v1.HumanReviewConfig] that the
14606 /// document will be reviewed with.
14607 pub human_review_config: std::string::String,
14608
14609 /// Whether the validation should be performed on the ad-hoc review request.
14610 pub enable_schema_validation: bool,
14611
14612 /// The priority of the human review task.
14613 pub priority: crate::model::review_document_request::Priority,
14614
14615 /// The document schema of the human review task.
14616 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
14617
14618 /// The document payload.
14619 pub source: std::option::Option<crate::model::review_document_request::Source>,
14620
14621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14622}
14623
14624impl ReviewDocumentRequest {
14625 /// Creates a new default instance.
14626 pub fn new() -> Self {
14627 std::default::Default::default()
14628 }
14629
14630 /// Sets the value of [human_review_config][crate::model::ReviewDocumentRequest::human_review_config].
14631 ///
14632 /// # Example
14633 /// ```ignore,no_run
14634 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14635 /// let x = ReviewDocumentRequest::new().set_human_review_config("example");
14636 /// ```
14637 pub fn set_human_review_config<T: std::convert::Into<std::string::String>>(
14638 mut self,
14639 v: T,
14640 ) -> Self {
14641 self.human_review_config = v.into();
14642 self
14643 }
14644
14645 /// Sets the value of [enable_schema_validation][crate::model::ReviewDocumentRequest::enable_schema_validation].
14646 ///
14647 /// # Example
14648 /// ```ignore,no_run
14649 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14650 /// let x = ReviewDocumentRequest::new().set_enable_schema_validation(true);
14651 /// ```
14652 pub fn set_enable_schema_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
14653 self.enable_schema_validation = v.into();
14654 self
14655 }
14656
14657 /// Sets the value of [priority][crate::model::ReviewDocumentRequest::priority].
14658 ///
14659 /// # Example
14660 /// ```ignore,no_run
14661 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14662 /// use google_cloud_documentai_v1::model::review_document_request::Priority;
14663 /// let x0 = ReviewDocumentRequest::new().set_priority(Priority::Urgent);
14664 /// ```
14665 pub fn set_priority<T: std::convert::Into<crate::model::review_document_request::Priority>>(
14666 mut self,
14667 v: T,
14668 ) -> Self {
14669 self.priority = v.into();
14670 self
14671 }
14672
14673 /// Sets the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14674 ///
14675 /// # Example
14676 /// ```ignore,no_run
14677 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14678 /// use google_cloud_documentai_v1::model::DocumentSchema;
14679 /// let x = ReviewDocumentRequest::new().set_document_schema(DocumentSchema::default()/* use setters */);
14680 /// ```
14681 pub fn set_document_schema<T>(mut self, v: T) -> Self
14682 where
14683 T: std::convert::Into<crate::model::DocumentSchema>,
14684 {
14685 self.document_schema = std::option::Option::Some(v.into());
14686 self
14687 }
14688
14689 /// Sets or clears the value of [document_schema][crate::model::ReviewDocumentRequest::document_schema].
14690 ///
14691 /// # Example
14692 /// ```ignore,no_run
14693 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14694 /// use google_cloud_documentai_v1::model::DocumentSchema;
14695 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
14696 /// let x = ReviewDocumentRequest::new().set_or_clear_document_schema(None::<DocumentSchema>);
14697 /// ```
14698 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
14699 where
14700 T: std::convert::Into<crate::model::DocumentSchema>,
14701 {
14702 self.document_schema = v.map(|x| x.into());
14703 self
14704 }
14705
14706 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source].
14707 ///
14708 /// Note that all the setters affecting `source` are mutually
14709 /// exclusive.
14710 ///
14711 /// # Example
14712 /// ```ignore,no_run
14713 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14714 /// use google_cloud_documentai_v1::model::Document;
14715 /// let x = ReviewDocumentRequest::new().set_source(Some(
14716 /// google_cloud_documentai_v1::model::review_document_request::Source::InlineDocument(Document::default().into())));
14717 /// ```
14718 pub fn set_source<
14719 T: std::convert::Into<std::option::Option<crate::model::review_document_request::Source>>,
14720 >(
14721 mut self,
14722 v: T,
14723 ) -> Self {
14724 self.source = v.into();
14725 self
14726 }
14727
14728 /// The value of [source][crate::model::ReviewDocumentRequest::source]
14729 /// if it holds a `InlineDocument`, `None` if the field is not set or
14730 /// holds a different branch.
14731 pub fn inline_document(&self) -> std::option::Option<&std::boxed::Box<crate::model::Document>> {
14732 #[allow(unreachable_patterns)]
14733 self.source.as_ref().and_then(|v| match v {
14734 crate::model::review_document_request::Source::InlineDocument(v) => {
14735 std::option::Option::Some(v)
14736 }
14737 _ => std::option::Option::None,
14738 })
14739 }
14740
14741 /// Sets the value of [source][crate::model::ReviewDocumentRequest::source]
14742 /// to hold a `InlineDocument`.
14743 ///
14744 /// Note that all the setters affecting `source` are
14745 /// mutually exclusive.
14746 ///
14747 /// # Example
14748 /// ```ignore,no_run
14749 /// # use google_cloud_documentai_v1::model::ReviewDocumentRequest;
14750 /// use google_cloud_documentai_v1::model::Document;
14751 /// let x = ReviewDocumentRequest::new().set_inline_document(Document::default()/* use setters */);
14752 /// assert!(x.inline_document().is_some());
14753 /// ```
14754 pub fn set_inline_document<T: std::convert::Into<std::boxed::Box<crate::model::Document>>>(
14755 mut self,
14756 v: T,
14757 ) -> Self {
14758 self.source = std::option::Option::Some(
14759 crate::model::review_document_request::Source::InlineDocument(v.into()),
14760 );
14761 self
14762 }
14763}
14764
14765impl wkt::message::Message for ReviewDocumentRequest {
14766 fn typename() -> &'static str {
14767 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentRequest"
14768 }
14769}
14770
14771/// Defines additional types related to [ReviewDocumentRequest].
14772pub mod review_document_request {
14773 #[allow(unused_imports)]
14774 use super::*;
14775
14776 /// The priority level of the human review task.
14777 ///
14778 /// # Working with unknown values
14779 ///
14780 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14781 /// additional enum variants at any time. Adding new variants is not considered
14782 /// a breaking change. Applications should write their code in anticipation of:
14783 ///
14784 /// - New values appearing in future releases of the client library, **and**
14785 /// - New values received dynamically, without application changes.
14786 ///
14787 /// Please consult the [Working with enums] section in the user guide for some
14788 /// guidelines.
14789 ///
14790 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
14791 #[derive(Clone, Debug, PartialEq)]
14792 #[non_exhaustive]
14793 pub enum Priority {
14794 /// The default priority level.
14795 Default,
14796 /// The urgent priority level. The labeling manager should allocate labeler
14797 /// resource to the urgent task queue to respect this priority level.
14798 Urgent,
14799 /// If set, the enum was initialized with an unknown value.
14800 ///
14801 /// Applications can examine the value using [Priority::value] or
14802 /// [Priority::name].
14803 UnknownValue(priority::UnknownValue),
14804 }
14805
14806 #[doc(hidden)]
14807 pub mod priority {
14808 #[allow(unused_imports)]
14809 use super::*;
14810 #[derive(Clone, Debug, PartialEq)]
14811 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
14812 }
14813
14814 impl Priority {
14815 /// Gets the enum value.
14816 ///
14817 /// Returns `None` if the enum contains an unknown value deserialized from
14818 /// the string representation of enums.
14819 pub fn value(&self) -> std::option::Option<i32> {
14820 match self {
14821 Self::Default => std::option::Option::Some(0),
14822 Self::Urgent => std::option::Option::Some(1),
14823 Self::UnknownValue(u) => u.0.value(),
14824 }
14825 }
14826
14827 /// Gets the enum value as a string.
14828 ///
14829 /// Returns `None` if the enum contains an unknown value deserialized from
14830 /// the integer representation of enums.
14831 pub fn name(&self) -> std::option::Option<&str> {
14832 match self {
14833 Self::Default => std::option::Option::Some("DEFAULT"),
14834 Self::Urgent => std::option::Option::Some("URGENT"),
14835 Self::UnknownValue(u) => u.0.name(),
14836 }
14837 }
14838 }
14839
14840 impl std::default::Default for Priority {
14841 fn default() -> Self {
14842 use std::convert::From;
14843 Self::from(0)
14844 }
14845 }
14846
14847 impl std::fmt::Display for Priority {
14848 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
14849 wkt::internal::display_enum(f, self.name(), self.value())
14850 }
14851 }
14852
14853 impl std::convert::From<i32> for Priority {
14854 fn from(value: i32) -> Self {
14855 match value {
14856 0 => Self::Default,
14857 1 => Self::Urgent,
14858 _ => Self::UnknownValue(priority::UnknownValue(
14859 wkt::internal::UnknownEnumValue::Integer(value),
14860 )),
14861 }
14862 }
14863 }
14864
14865 impl std::convert::From<&str> for Priority {
14866 fn from(value: &str) -> Self {
14867 use std::string::ToString;
14868 match value {
14869 "DEFAULT" => Self::Default,
14870 "URGENT" => Self::Urgent,
14871 _ => Self::UnknownValue(priority::UnknownValue(
14872 wkt::internal::UnknownEnumValue::String(value.to_string()),
14873 )),
14874 }
14875 }
14876 }
14877
14878 impl serde::ser::Serialize for Priority {
14879 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
14880 where
14881 S: serde::Serializer,
14882 {
14883 match self {
14884 Self::Default => serializer.serialize_i32(0),
14885 Self::Urgent => serializer.serialize_i32(1),
14886 Self::UnknownValue(u) => u.0.serialize(serializer),
14887 }
14888 }
14889 }
14890
14891 impl<'de> serde::de::Deserialize<'de> for Priority {
14892 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
14893 where
14894 D: serde::Deserializer<'de>,
14895 {
14896 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Priority>::new(
14897 ".google.cloud.documentai.v1.ReviewDocumentRequest.Priority",
14898 ))
14899 }
14900 }
14901
14902 /// The document payload.
14903 #[derive(Clone, Debug, PartialEq)]
14904 #[non_exhaustive]
14905 pub enum Source {
14906 /// An inline document proto.
14907 InlineDocument(std::boxed::Box<crate::model::Document>),
14908 }
14909}
14910
14911/// Response message for the
14912/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
14913/// method.
14914///
14915/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
14916#[derive(Clone, Default, PartialEq)]
14917#[non_exhaustive]
14918pub struct ReviewDocumentResponse {
14919 /// The Cloud Storage uri for the human reviewed document if the review is
14920 /// succeeded.
14921 pub gcs_destination: std::string::String,
14922
14923 /// The state of the review operation.
14924 pub state: crate::model::review_document_response::State,
14925
14926 /// The reason why the review is rejected by reviewer.
14927 pub rejection_reason: std::string::String,
14928
14929 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
14930}
14931
14932impl ReviewDocumentResponse {
14933 /// Creates a new default instance.
14934 pub fn new() -> Self {
14935 std::default::Default::default()
14936 }
14937
14938 /// Sets the value of [gcs_destination][crate::model::ReviewDocumentResponse::gcs_destination].
14939 ///
14940 /// # Example
14941 /// ```ignore,no_run
14942 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14943 /// let x = ReviewDocumentResponse::new().set_gcs_destination("example");
14944 /// ```
14945 pub fn set_gcs_destination<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
14946 self.gcs_destination = v.into();
14947 self
14948 }
14949
14950 /// Sets the value of [state][crate::model::ReviewDocumentResponse::state].
14951 ///
14952 /// # Example
14953 /// ```ignore,no_run
14954 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14955 /// use google_cloud_documentai_v1::model::review_document_response::State;
14956 /// let x0 = ReviewDocumentResponse::new().set_state(State::Rejected);
14957 /// let x1 = ReviewDocumentResponse::new().set_state(State::Succeeded);
14958 /// ```
14959 pub fn set_state<T: std::convert::Into<crate::model::review_document_response::State>>(
14960 mut self,
14961 v: T,
14962 ) -> Self {
14963 self.state = v.into();
14964 self
14965 }
14966
14967 /// Sets the value of [rejection_reason][crate::model::ReviewDocumentResponse::rejection_reason].
14968 ///
14969 /// # Example
14970 /// ```ignore,no_run
14971 /// # use google_cloud_documentai_v1::model::ReviewDocumentResponse;
14972 /// let x = ReviewDocumentResponse::new().set_rejection_reason("example");
14973 /// ```
14974 pub fn set_rejection_reason<T: std::convert::Into<std::string::String>>(
14975 mut self,
14976 v: T,
14977 ) -> Self {
14978 self.rejection_reason = v.into();
14979 self
14980 }
14981}
14982
14983impl wkt::message::Message for ReviewDocumentResponse {
14984 fn typename() -> &'static str {
14985 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentResponse"
14986 }
14987}
14988
14989/// Defines additional types related to [ReviewDocumentResponse].
14990pub mod review_document_response {
14991 #[allow(unused_imports)]
14992 use super::*;
14993
14994 /// Possible states of the review operation.
14995 ///
14996 /// # Working with unknown values
14997 ///
14998 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
14999 /// additional enum variants at any time. Adding new variants is not considered
15000 /// a breaking change. Applications should write their code in anticipation of:
15001 ///
15002 /// - New values appearing in future releases of the client library, **and**
15003 /// - New values received dynamically, without application changes.
15004 ///
15005 /// Please consult the [Working with enums] section in the user guide for some
15006 /// guidelines.
15007 ///
15008 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
15009 #[derive(Clone, Debug, PartialEq)]
15010 #[non_exhaustive]
15011 pub enum State {
15012 /// The default value. This value is used if the state is omitted.
15013 Unspecified,
15014 /// The review operation is rejected by the reviewer.
15015 Rejected,
15016 /// The review operation is succeeded.
15017 Succeeded,
15018 /// If set, the enum was initialized with an unknown value.
15019 ///
15020 /// Applications can examine the value using [State::value] or
15021 /// [State::name].
15022 UnknownValue(state::UnknownValue),
15023 }
15024
15025 #[doc(hidden)]
15026 pub mod state {
15027 #[allow(unused_imports)]
15028 use super::*;
15029 #[derive(Clone, Debug, PartialEq)]
15030 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
15031 }
15032
15033 impl State {
15034 /// Gets the enum value.
15035 ///
15036 /// Returns `None` if the enum contains an unknown value deserialized from
15037 /// the string representation of enums.
15038 pub fn value(&self) -> std::option::Option<i32> {
15039 match self {
15040 Self::Unspecified => std::option::Option::Some(0),
15041 Self::Rejected => std::option::Option::Some(1),
15042 Self::Succeeded => std::option::Option::Some(2),
15043 Self::UnknownValue(u) => u.0.value(),
15044 }
15045 }
15046
15047 /// Gets the enum value as a string.
15048 ///
15049 /// Returns `None` if the enum contains an unknown value deserialized from
15050 /// the integer representation of enums.
15051 pub fn name(&self) -> std::option::Option<&str> {
15052 match self {
15053 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
15054 Self::Rejected => std::option::Option::Some("REJECTED"),
15055 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
15056 Self::UnknownValue(u) => u.0.name(),
15057 }
15058 }
15059 }
15060
15061 impl std::default::Default for State {
15062 fn default() -> Self {
15063 use std::convert::From;
15064 Self::from(0)
15065 }
15066 }
15067
15068 impl std::fmt::Display for State {
15069 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
15070 wkt::internal::display_enum(f, self.name(), self.value())
15071 }
15072 }
15073
15074 impl std::convert::From<i32> for State {
15075 fn from(value: i32) -> Self {
15076 match value {
15077 0 => Self::Unspecified,
15078 1 => Self::Rejected,
15079 2 => Self::Succeeded,
15080 _ => Self::UnknownValue(state::UnknownValue(
15081 wkt::internal::UnknownEnumValue::Integer(value),
15082 )),
15083 }
15084 }
15085 }
15086
15087 impl std::convert::From<&str> for State {
15088 fn from(value: &str) -> Self {
15089 use std::string::ToString;
15090 match value {
15091 "STATE_UNSPECIFIED" => Self::Unspecified,
15092 "REJECTED" => Self::Rejected,
15093 "SUCCEEDED" => Self::Succeeded,
15094 _ => Self::UnknownValue(state::UnknownValue(
15095 wkt::internal::UnknownEnumValue::String(value.to_string()),
15096 )),
15097 }
15098 }
15099 }
15100
15101 impl serde::ser::Serialize for State {
15102 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
15103 where
15104 S: serde::Serializer,
15105 {
15106 match self {
15107 Self::Unspecified => serializer.serialize_i32(0),
15108 Self::Rejected => serializer.serialize_i32(1),
15109 Self::Succeeded => serializer.serialize_i32(2),
15110 Self::UnknownValue(u) => u.0.serialize(serializer),
15111 }
15112 }
15113 }
15114
15115 impl<'de> serde::de::Deserialize<'de> for State {
15116 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
15117 where
15118 D: serde::Deserializer<'de>,
15119 {
15120 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
15121 ".google.cloud.documentai.v1.ReviewDocumentResponse.State",
15122 ))
15123 }
15124 }
15125}
15126
15127/// The long-running operation metadata for the
15128/// [ReviewDocument][google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]
15129/// method.
15130///
15131/// [google.cloud.documentai.v1.DocumentProcessorService.ReviewDocument]: crate::client::DocumentProcessorService::review_document
15132#[derive(Clone, Default, PartialEq)]
15133#[non_exhaustive]
15134pub struct ReviewDocumentOperationMetadata {
15135 /// The basic metadata of the long-running operation.
15136 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15137
15138 /// The Crowd Compute question ID.
15139 pub question_id: std::string::String,
15140
15141 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15142}
15143
15144impl ReviewDocumentOperationMetadata {
15145 /// Creates a new default instance.
15146 pub fn new() -> Self {
15147 std::default::Default::default()
15148 }
15149
15150 /// Sets the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
15151 ///
15152 /// # Example
15153 /// ```ignore,no_run
15154 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15155 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15156 /// let x = ReviewDocumentOperationMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15157 /// ```
15158 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15159 where
15160 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15161 {
15162 self.common_metadata = std::option::Option::Some(v.into());
15163 self
15164 }
15165
15166 /// Sets or clears the value of [common_metadata][crate::model::ReviewDocumentOperationMetadata::common_metadata].
15167 ///
15168 /// # Example
15169 /// ```ignore,no_run
15170 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15171 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15172 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15173 /// let x = ReviewDocumentOperationMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15174 /// ```
15175 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15176 where
15177 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15178 {
15179 self.common_metadata = v.map(|x| x.into());
15180 self
15181 }
15182
15183 /// Sets the value of [question_id][crate::model::ReviewDocumentOperationMetadata::question_id].
15184 ///
15185 /// # Example
15186 /// ```ignore,no_run
15187 /// # use google_cloud_documentai_v1::model::ReviewDocumentOperationMetadata;
15188 /// let x = ReviewDocumentOperationMetadata::new().set_question_id("example");
15189 /// ```
15190 pub fn set_question_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15191 self.question_id = v.into();
15192 self
15193 }
15194}
15195
15196impl wkt::message::Message for ReviewDocumentOperationMetadata {
15197 fn typename() -> &'static str {
15198 "type.googleapis.com/google.cloud.documentai.v1.ReviewDocumentOperationMetadata"
15199 }
15200}
15201
15202/// Evaluates the given
15203/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] against the
15204/// supplied documents.
15205///
15206/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15207#[derive(Clone, Default, PartialEq)]
15208#[non_exhaustive]
15209pub struct EvaluateProcessorVersionRequest {
15210 /// Required. The resource name of the
15211 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to
15212 /// evaluate.
15213 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15214 ///
15215 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15216 pub processor_version: std::string::String,
15217
15218 /// Optional. The documents used in the evaluation. If unspecified, use the
15219 /// processor's dataset as evaluation input.
15220 pub evaluation_documents: std::option::Option<crate::model::BatchDocumentsInputConfig>,
15221
15222 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15223}
15224
15225impl EvaluateProcessorVersionRequest {
15226 /// Creates a new default instance.
15227 pub fn new() -> Self {
15228 std::default::Default::default()
15229 }
15230
15231 /// Sets the value of [processor_version][crate::model::EvaluateProcessorVersionRequest::processor_version].
15232 ///
15233 /// # Example
15234 /// ```ignore,no_run
15235 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15236 /// # let project_id = "project_id";
15237 /// # let location_id = "location_id";
15238 /// # let processor_id = "processor_id";
15239 /// # let processor_version_id = "processor_version_id";
15240 /// let x = EvaluateProcessorVersionRequest::new().set_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
15241 /// ```
15242 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
15243 mut self,
15244 v: T,
15245 ) -> Self {
15246 self.processor_version = v.into();
15247 self
15248 }
15249
15250 /// Sets the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15251 ///
15252 /// # Example
15253 /// ```ignore,no_run
15254 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15255 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15256 /// let x = EvaluateProcessorVersionRequest::new().set_evaluation_documents(BatchDocumentsInputConfig::default()/* use setters */);
15257 /// ```
15258 pub fn set_evaluation_documents<T>(mut self, v: T) -> Self
15259 where
15260 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15261 {
15262 self.evaluation_documents = std::option::Option::Some(v.into());
15263 self
15264 }
15265
15266 /// Sets or clears the value of [evaluation_documents][crate::model::EvaluateProcessorVersionRequest::evaluation_documents].
15267 ///
15268 /// # Example
15269 /// ```ignore,no_run
15270 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionRequest;
15271 /// use google_cloud_documentai_v1::model::BatchDocumentsInputConfig;
15272 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(Some(BatchDocumentsInputConfig::default()/* use setters */));
15273 /// let x = EvaluateProcessorVersionRequest::new().set_or_clear_evaluation_documents(None::<BatchDocumentsInputConfig>);
15274 /// ```
15275 pub fn set_or_clear_evaluation_documents<T>(mut self, v: std::option::Option<T>) -> Self
15276 where
15277 T: std::convert::Into<crate::model::BatchDocumentsInputConfig>,
15278 {
15279 self.evaluation_documents = v.map(|x| x.into());
15280 self
15281 }
15282}
15283
15284impl wkt::message::Message for EvaluateProcessorVersionRequest {
15285 fn typename() -> &'static str {
15286 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionRequest"
15287 }
15288}
15289
15290/// Metadata of the
15291/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15292/// method.
15293///
15294/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15295#[derive(Clone, Default, PartialEq)]
15296#[non_exhaustive]
15297pub struct EvaluateProcessorVersionMetadata {
15298 /// The basic metadata of the long-running operation.
15299 pub common_metadata: std::option::Option<crate::model::CommonOperationMetadata>,
15300
15301 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15302}
15303
15304impl EvaluateProcessorVersionMetadata {
15305 /// Creates a new default instance.
15306 pub fn new() -> Self {
15307 std::default::Default::default()
15308 }
15309
15310 /// Sets the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15311 ///
15312 /// # Example
15313 /// ```ignore,no_run
15314 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15315 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15316 /// let x = EvaluateProcessorVersionMetadata::new().set_common_metadata(CommonOperationMetadata::default()/* use setters */);
15317 /// ```
15318 pub fn set_common_metadata<T>(mut self, v: T) -> Self
15319 where
15320 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15321 {
15322 self.common_metadata = std::option::Option::Some(v.into());
15323 self
15324 }
15325
15326 /// Sets or clears the value of [common_metadata][crate::model::EvaluateProcessorVersionMetadata::common_metadata].
15327 ///
15328 /// # Example
15329 /// ```ignore,no_run
15330 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionMetadata;
15331 /// use google_cloud_documentai_v1::model::CommonOperationMetadata;
15332 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(Some(CommonOperationMetadata::default()/* use setters */));
15333 /// let x = EvaluateProcessorVersionMetadata::new().set_or_clear_common_metadata(None::<CommonOperationMetadata>);
15334 /// ```
15335 pub fn set_or_clear_common_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15336 where
15337 T: std::convert::Into<crate::model::CommonOperationMetadata>,
15338 {
15339 self.common_metadata = v.map(|x| x.into());
15340 self
15341 }
15342}
15343
15344impl wkt::message::Message for EvaluateProcessorVersionMetadata {
15345 fn typename() -> &'static str {
15346 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionMetadata"
15347 }
15348}
15349
15350/// Response of the
15351/// [EvaluateProcessorVersion][google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]
15352/// method.
15353///
15354/// [google.cloud.documentai.v1.DocumentProcessorService.EvaluateProcessorVersion]: crate::client::DocumentProcessorService::evaluate_processor_version
15355#[derive(Clone, Default, PartialEq)]
15356#[non_exhaustive]
15357pub struct EvaluateProcessorVersionResponse {
15358 /// The resource name of the created evaluation.
15359 pub evaluation: std::string::String,
15360
15361 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15362}
15363
15364impl EvaluateProcessorVersionResponse {
15365 /// Creates a new default instance.
15366 pub fn new() -> Self {
15367 std::default::Default::default()
15368 }
15369
15370 /// Sets the value of [evaluation][crate::model::EvaluateProcessorVersionResponse::evaluation].
15371 ///
15372 /// # Example
15373 /// ```ignore,no_run
15374 /// # use google_cloud_documentai_v1::model::EvaluateProcessorVersionResponse;
15375 /// let x = EvaluateProcessorVersionResponse::new().set_evaluation("example");
15376 /// ```
15377 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15378 self.evaluation = v.into();
15379 self
15380 }
15381}
15382
15383impl wkt::message::Message for EvaluateProcessorVersionResponse {
15384 fn typename() -> &'static str {
15385 "type.googleapis.com/google.cloud.documentai.v1.EvaluateProcessorVersionResponse"
15386 }
15387}
15388
15389/// Retrieves a specific Evaluation.
15390#[derive(Clone, Default, PartialEq)]
15391#[non_exhaustive]
15392pub struct GetEvaluationRequest {
15393 /// Required. The resource name of the
15394 /// [Evaluation][google.cloud.documentai.v1.Evaluation] to get.
15395 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}`
15396 ///
15397 /// [google.cloud.documentai.v1.Evaluation]: crate::model::Evaluation
15398 pub name: std::string::String,
15399
15400 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15401}
15402
15403impl GetEvaluationRequest {
15404 /// Creates a new default instance.
15405 pub fn new() -> Self {
15406 std::default::Default::default()
15407 }
15408
15409 /// Sets the value of [name][crate::model::GetEvaluationRequest::name].
15410 ///
15411 /// # Example
15412 /// ```ignore,no_run
15413 /// # use google_cloud_documentai_v1::model::GetEvaluationRequest;
15414 /// # let project_id = "project_id";
15415 /// # let location_id = "location_id";
15416 /// # let processor_id = "processor_id";
15417 /// # let processor_version_id = "processor_version_id";
15418 /// # let evaluation_id = "evaluation_id";
15419 /// let x = GetEvaluationRequest::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}/evaluations/{evaluation_id}"));
15420 /// ```
15421 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15422 self.name = v.into();
15423 self
15424 }
15425}
15426
15427impl wkt::message::Message for GetEvaluationRequest {
15428 fn typename() -> &'static str {
15429 "type.googleapis.com/google.cloud.documentai.v1.GetEvaluationRequest"
15430 }
15431}
15432
15433/// Retrieves a list of evaluations for a given
15434/// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion].
15435///
15436/// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15437#[derive(Clone, Default, PartialEq)]
15438#[non_exhaustive]
15439pub struct ListEvaluationsRequest {
15440 /// Required. The resource name of the
15441 /// [ProcessorVersion][google.cloud.documentai.v1.ProcessorVersion] to list
15442 /// evaluations for.
15443 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`
15444 ///
15445 /// [google.cloud.documentai.v1.ProcessorVersion]: crate::model::ProcessorVersion
15446 pub parent: std::string::String,
15447
15448 /// The standard list page size.
15449 /// If unspecified, at most `5` evaluations are returned.
15450 /// The maximum value is `100`. Values above `100` are coerced to `100`.
15451 pub page_size: i32,
15452
15453 /// A page token, received from a previous `ListEvaluations` call.
15454 /// Provide this to retrieve the subsequent page.
15455 pub page_token: std::string::String,
15456
15457 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15458}
15459
15460impl ListEvaluationsRequest {
15461 /// Creates a new default instance.
15462 pub fn new() -> Self {
15463 std::default::Default::default()
15464 }
15465
15466 /// Sets the value of [parent][crate::model::ListEvaluationsRequest::parent].
15467 ///
15468 /// # Example
15469 /// ```ignore,no_run
15470 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15471 /// # let project_id = "project_id";
15472 /// # let location_id = "location_id";
15473 /// # let processor_id = "processor_id";
15474 /// # let processor_version_id = "processor_version_id";
15475 /// let x = ListEvaluationsRequest::new().set_parent(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
15476 /// ```
15477 pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15478 self.parent = v.into();
15479 self
15480 }
15481
15482 /// Sets the value of [page_size][crate::model::ListEvaluationsRequest::page_size].
15483 ///
15484 /// # Example
15485 /// ```ignore,no_run
15486 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15487 /// let x = ListEvaluationsRequest::new().set_page_size(42);
15488 /// ```
15489 pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
15490 self.page_size = v.into();
15491 self
15492 }
15493
15494 /// Sets the value of [page_token][crate::model::ListEvaluationsRequest::page_token].
15495 ///
15496 /// # Example
15497 /// ```ignore,no_run
15498 /// # use google_cloud_documentai_v1::model::ListEvaluationsRequest;
15499 /// let x = ListEvaluationsRequest::new().set_page_token("example");
15500 /// ```
15501 pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15502 self.page_token = v.into();
15503 self
15504 }
15505}
15506
15507impl wkt::message::Message for ListEvaluationsRequest {
15508 fn typename() -> &'static str {
15509 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsRequest"
15510 }
15511}
15512
15513/// The response from `ListEvaluations`.
15514#[derive(Clone, Default, PartialEq)]
15515#[non_exhaustive]
15516pub struct ListEvaluationsResponse {
15517 /// The evaluations requested.
15518 pub evaluations: std::vec::Vec<crate::model::Evaluation>,
15519
15520 /// A token, which can be sent as `page_token` to retrieve the next page.
15521 /// If this field is omitted, there are no subsequent pages.
15522 pub next_page_token: std::string::String,
15523
15524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15525}
15526
15527impl ListEvaluationsResponse {
15528 /// Creates a new default instance.
15529 pub fn new() -> Self {
15530 std::default::Default::default()
15531 }
15532
15533 /// Sets the value of [evaluations][crate::model::ListEvaluationsResponse::evaluations].
15534 ///
15535 /// # Example
15536 /// ```ignore,no_run
15537 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15538 /// use google_cloud_documentai_v1::model::Evaluation;
15539 /// let x = ListEvaluationsResponse::new()
15540 /// .set_evaluations([
15541 /// Evaluation::default()/* use setters */,
15542 /// Evaluation::default()/* use (different) setters */,
15543 /// ]);
15544 /// ```
15545 pub fn set_evaluations<T, V>(mut self, v: T) -> Self
15546 where
15547 T: std::iter::IntoIterator<Item = V>,
15548 V: std::convert::Into<crate::model::Evaluation>,
15549 {
15550 use std::iter::Iterator;
15551 self.evaluations = v.into_iter().map(|i| i.into()).collect();
15552 self
15553 }
15554
15555 /// Sets the value of [next_page_token][crate::model::ListEvaluationsResponse::next_page_token].
15556 ///
15557 /// # Example
15558 /// ```ignore,no_run
15559 /// # use google_cloud_documentai_v1::model::ListEvaluationsResponse;
15560 /// let x = ListEvaluationsResponse::new().set_next_page_token("example");
15561 /// ```
15562 pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15563 self.next_page_token = v.into();
15564 self
15565 }
15566}
15567
15568impl wkt::message::Message for ListEvaluationsResponse {
15569 fn typename() -> &'static str {
15570 "type.googleapis.com/google.cloud.documentai.v1.ListEvaluationsResponse"
15571 }
15572}
15573
15574#[doc(hidden)]
15575impl google_cloud_gax::paginator::internal::PageableResponse for ListEvaluationsResponse {
15576 type PageItem = crate::model::Evaluation;
15577
15578 fn items(self) -> std::vec::Vec<Self::PageItem> {
15579 self.evaluations
15580 }
15581
15582 fn next_page_token(&self) -> std::string::String {
15583 use std::clone::Clone;
15584 self.next_page_token.clone()
15585 }
15586}
15587
15588/// The schema defines the output of the processed document by a processor.
15589#[derive(Clone, Default, PartialEq)]
15590#[non_exhaustive]
15591pub struct DocumentSchema {
15592 /// Display name to show to users.
15593 pub display_name: std::string::String,
15594
15595 /// Description of the schema.
15596 pub description: std::string::String,
15597
15598 /// Entity types of the schema.
15599 pub entity_types: std::vec::Vec<crate::model::document_schema::EntityType>,
15600
15601 /// Metadata of the schema.
15602 pub metadata: std::option::Option<crate::model::document_schema::Metadata>,
15603
15604 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15605}
15606
15607impl DocumentSchema {
15608 /// Creates a new default instance.
15609 pub fn new() -> Self {
15610 std::default::Default::default()
15611 }
15612
15613 /// Sets the value of [display_name][crate::model::DocumentSchema::display_name].
15614 ///
15615 /// # Example
15616 /// ```ignore,no_run
15617 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15618 /// let x = DocumentSchema::new().set_display_name("example");
15619 /// ```
15620 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15621 self.display_name = v.into();
15622 self
15623 }
15624
15625 /// Sets the value of [description][crate::model::DocumentSchema::description].
15626 ///
15627 /// # Example
15628 /// ```ignore,no_run
15629 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15630 /// let x = DocumentSchema::new().set_description("example");
15631 /// ```
15632 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15633 self.description = v.into();
15634 self
15635 }
15636
15637 /// Sets the value of [entity_types][crate::model::DocumentSchema::entity_types].
15638 ///
15639 /// # Example
15640 /// ```ignore,no_run
15641 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15642 /// use google_cloud_documentai_v1::model::document_schema::EntityType;
15643 /// let x = DocumentSchema::new()
15644 /// .set_entity_types([
15645 /// EntityType::default()/* use setters */,
15646 /// EntityType::default()/* use (different) setters */,
15647 /// ]);
15648 /// ```
15649 pub fn set_entity_types<T, V>(mut self, v: T) -> Self
15650 where
15651 T: std::iter::IntoIterator<Item = V>,
15652 V: std::convert::Into<crate::model::document_schema::EntityType>,
15653 {
15654 use std::iter::Iterator;
15655 self.entity_types = v.into_iter().map(|i| i.into()).collect();
15656 self
15657 }
15658
15659 /// Sets the value of [metadata][crate::model::DocumentSchema::metadata].
15660 ///
15661 /// # Example
15662 /// ```ignore,no_run
15663 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15664 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15665 /// let x = DocumentSchema::new().set_metadata(Metadata::default()/* use setters */);
15666 /// ```
15667 pub fn set_metadata<T>(mut self, v: T) -> Self
15668 where
15669 T: std::convert::Into<crate::model::document_schema::Metadata>,
15670 {
15671 self.metadata = std::option::Option::Some(v.into());
15672 self
15673 }
15674
15675 /// Sets or clears the value of [metadata][crate::model::DocumentSchema::metadata].
15676 ///
15677 /// # Example
15678 /// ```ignore,no_run
15679 /// # use google_cloud_documentai_v1::model::DocumentSchema;
15680 /// use google_cloud_documentai_v1::model::document_schema::Metadata;
15681 /// let x = DocumentSchema::new().set_or_clear_metadata(Some(Metadata::default()/* use setters */));
15682 /// let x = DocumentSchema::new().set_or_clear_metadata(None::<Metadata>);
15683 /// ```
15684 pub fn set_or_clear_metadata<T>(mut self, v: std::option::Option<T>) -> Self
15685 where
15686 T: std::convert::Into<crate::model::document_schema::Metadata>,
15687 {
15688 self.metadata = v.map(|x| x.into());
15689 self
15690 }
15691}
15692
15693impl wkt::message::Message for DocumentSchema {
15694 fn typename() -> &'static str {
15695 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema"
15696 }
15697}
15698
15699/// Defines additional types related to [DocumentSchema].
15700pub mod document_schema {
15701 #[allow(unused_imports)]
15702 use super::*;
15703
15704 /// EntityType is the wrapper of a label of the corresponding model with
15705 /// detailed attributes and limitations for entity-based processors. Multiple
15706 /// types can also compose a dependency tree to represent nested types.
15707 #[derive(Clone, Default, PartialEq)]
15708 #[non_exhaustive]
15709 pub struct EntityType {
15710 /// User defined name for the type.
15711 pub display_name: std::string::String,
15712
15713 /// Name of the type. It must be unique within the schema file and
15714 /// cannot be a "Common Type". The following naming conventions are used:
15715 ///
15716 /// - Use `snake_casing`.
15717 /// - Name matching is case-sensitive.
15718 /// - Maximum 64 characters.
15719 /// - Must start with a letter.
15720 /// - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward
15721 /// compatibility internal infrastructure and tooling can handle any ascii
15722 /// character.)
15723 /// - The `/` is sometimes used to denote a property of a type. For example
15724 /// `line_item/amount`. This convention is deprecated, but will still be
15725 /// honored for backward compatibility.
15726 pub name: std::string::String,
15727
15728 /// The entity type that this type is derived from. For now, one and only
15729 /// one should be set.
15730 pub base_types: std::vec::Vec<std::string::String>,
15731
15732 /// Description the nested structure, or composition of an entity.
15733 pub properties: std::vec::Vec<crate::model::document_schema::entity_type::Property>,
15734
15735 #[allow(missing_docs)]
15736 pub value_source:
15737 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15738
15739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15740 }
15741
15742 impl EntityType {
15743 /// Creates a new default instance.
15744 pub fn new() -> Self {
15745 std::default::Default::default()
15746 }
15747
15748 /// Sets the value of [display_name][crate::model::document_schema::EntityType::display_name].
15749 ///
15750 /// # Example
15751 /// ```ignore,no_run
15752 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15753 /// let x = EntityType::new().set_display_name("example");
15754 /// ```
15755 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15756 mut self,
15757 v: T,
15758 ) -> Self {
15759 self.display_name = v.into();
15760 self
15761 }
15762
15763 /// Sets the value of [name][crate::model::document_schema::EntityType::name].
15764 ///
15765 /// # Example
15766 /// ```ignore,no_run
15767 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15768 /// let x = EntityType::new().set_name("example");
15769 /// ```
15770 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15771 self.name = v.into();
15772 self
15773 }
15774
15775 /// Sets the value of [base_types][crate::model::document_schema::EntityType::base_types].
15776 ///
15777 /// # Example
15778 /// ```ignore,no_run
15779 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15780 /// let x = EntityType::new().set_base_types(["a", "b", "c"]);
15781 /// ```
15782 pub fn set_base_types<T, V>(mut self, v: T) -> Self
15783 where
15784 T: std::iter::IntoIterator<Item = V>,
15785 V: std::convert::Into<std::string::String>,
15786 {
15787 use std::iter::Iterator;
15788 self.base_types = v.into_iter().map(|i| i.into()).collect();
15789 self
15790 }
15791
15792 /// Sets the value of [properties][crate::model::document_schema::EntityType::properties].
15793 ///
15794 /// # Example
15795 /// ```ignore,no_run
15796 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15797 /// use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15798 /// let x = EntityType::new()
15799 /// .set_properties([
15800 /// Property::default()/* use setters */,
15801 /// Property::default()/* use (different) setters */,
15802 /// ]);
15803 /// ```
15804 pub fn set_properties<T, V>(mut self, v: T) -> Self
15805 where
15806 T: std::iter::IntoIterator<Item = V>,
15807 V: std::convert::Into<crate::model::document_schema::entity_type::Property>,
15808 {
15809 use std::iter::Iterator;
15810 self.properties = v.into_iter().map(|i| i.into()).collect();
15811 self
15812 }
15813
15814 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source].
15815 ///
15816 /// Note that all the setters affecting `value_source` are mutually
15817 /// exclusive.
15818 ///
15819 /// # Example
15820 /// ```ignore,no_run
15821 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15822 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15823 /// let x = EntityType::new().set_value_source(Some(
15824 /// google_cloud_documentai_v1::model::document_schema::entity_type::ValueSource::EnumValues(EnumValues::default().into())));
15825 /// ```
15826 pub fn set_value_source<
15827 T: std::convert::Into<
15828 std::option::Option<crate::model::document_schema::entity_type::ValueSource>,
15829 >,
15830 >(
15831 mut self,
15832 v: T,
15833 ) -> Self {
15834 self.value_source = v.into();
15835 self
15836 }
15837
15838 /// The value of [value_source][crate::model::document_schema::EntityType::value_source]
15839 /// if it holds a `EnumValues`, `None` if the field is not set or
15840 /// holds a different branch.
15841 pub fn enum_values(
15842 &self,
15843 ) -> std::option::Option<
15844 &std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15845 > {
15846 #[allow(unreachable_patterns)]
15847 self.value_source.as_ref().and_then(|v| match v {
15848 crate::model::document_schema::entity_type::ValueSource::EnumValues(v) => {
15849 std::option::Option::Some(v)
15850 }
15851 _ => std::option::Option::None,
15852 })
15853 }
15854
15855 /// Sets the value of [value_source][crate::model::document_schema::EntityType::value_source]
15856 /// to hold a `EnumValues`.
15857 ///
15858 /// Note that all the setters affecting `value_source` are
15859 /// mutually exclusive.
15860 ///
15861 /// # Example
15862 /// ```ignore,no_run
15863 /// # use google_cloud_documentai_v1::model::document_schema::EntityType;
15864 /// use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15865 /// let x = EntityType::new().set_enum_values(EnumValues::default()/* use setters */);
15866 /// assert!(x.enum_values().is_some());
15867 /// ```
15868 pub fn set_enum_values<
15869 T: std::convert::Into<
15870 std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>,
15871 >,
15872 >(
15873 mut self,
15874 v: T,
15875 ) -> Self {
15876 self.value_source = std::option::Option::Some(
15877 crate::model::document_schema::entity_type::ValueSource::EnumValues(v.into()),
15878 );
15879 self
15880 }
15881 }
15882
15883 impl wkt::message::Message for EntityType {
15884 fn typename() -> &'static str {
15885 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType"
15886 }
15887 }
15888
15889 /// Defines additional types related to [EntityType].
15890 pub mod entity_type {
15891 #[allow(unused_imports)]
15892 use super::*;
15893
15894 /// Defines the a list of enum values.
15895 #[derive(Clone, Default, PartialEq)]
15896 #[non_exhaustive]
15897 pub struct EnumValues {
15898 /// The individual values that this enum values type can include.
15899 pub values: std::vec::Vec<std::string::String>,
15900
15901 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15902 }
15903
15904 impl EnumValues {
15905 /// Creates a new default instance.
15906 pub fn new() -> Self {
15907 std::default::Default::default()
15908 }
15909
15910 /// Sets the value of [values][crate::model::document_schema::entity_type::EnumValues::values].
15911 ///
15912 /// # Example
15913 /// ```ignore,no_run
15914 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::EnumValues;
15915 /// let x = EnumValues::new().set_values(["a", "b", "c"]);
15916 /// ```
15917 pub fn set_values<T, V>(mut self, v: T) -> Self
15918 where
15919 T: std::iter::IntoIterator<Item = V>,
15920 V: std::convert::Into<std::string::String>,
15921 {
15922 use std::iter::Iterator;
15923 self.values = v.into_iter().map(|i| i.into()).collect();
15924 self
15925 }
15926 }
15927
15928 impl wkt::message::Message for EnumValues {
15929 fn typename() -> &'static str {
15930 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.EnumValues"
15931 }
15932 }
15933
15934 /// Defines properties that can be part of the entity type.
15935 #[derive(Clone, Default, PartialEq)]
15936 #[non_exhaustive]
15937 pub struct Property {
15938 /// The name of the property. Follows the same guidelines as the
15939 /// EntityType name.
15940 pub name: std::string::String,
15941
15942 /// User defined name for the property.
15943 pub display_name: std::string::String,
15944
15945 /// A reference to the value type of the property. This type is subject
15946 /// to the same conventions as the `Entity.base_types` field.
15947 pub value_type: std::string::String,
15948
15949 /// Occurrence type limits the number of instances an entity type appears
15950 /// in the document.
15951 pub occurrence_type:
15952 crate::model::document_schema::entity_type::property::OccurrenceType,
15953
15954 /// Specifies how the entity's value is obtained.
15955 pub method: crate::model::document_schema::entity_type::property::Method,
15956
15957 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
15958 }
15959
15960 impl Property {
15961 /// Creates a new default instance.
15962 pub fn new() -> Self {
15963 std::default::Default::default()
15964 }
15965
15966 /// Sets the value of [name][crate::model::document_schema::entity_type::Property::name].
15967 ///
15968 /// # Example
15969 /// ```ignore,no_run
15970 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15971 /// let x = Property::new().set_name("example");
15972 /// ```
15973 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
15974 self.name = v.into();
15975 self
15976 }
15977
15978 /// Sets the value of [display_name][crate::model::document_schema::entity_type::Property::display_name].
15979 ///
15980 /// # Example
15981 /// ```ignore,no_run
15982 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15983 /// let x = Property::new().set_display_name("example");
15984 /// ```
15985 pub fn set_display_name<T: std::convert::Into<std::string::String>>(
15986 mut self,
15987 v: T,
15988 ) -> Self {
15989 self.display_name = v.into();
15990 self
15991 }
15992
15993 /// Sets the value of [value_type][crate::model::document_schema::entity_type::Property::value_type].
15994 ///
15995 /// # Example
15996 /// ```ignore,no_run
15997 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
15998 /// let x = Property::new().set_value_type("example");
15999 /// ```
16000 pub fn set_value_type<T: std::convert::Into<std::string::String>>(
16001 mut self,
16002 v: T,
16003 ) -> Self {
16004 self.value_type = v.into();
16005 self
16006 }
16007
16008 /// Sets the value of [occurrence_type][crate::model::document_schema::entity_type::Property::occurrence_type].
16009 ///
16010 /// # Example
16011 /// ```ignore,no_run
16012 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
16013 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::OccurrenceType;
16014 /// let x0 = Property::new().set_occurrence_type(OccurrenceType::OptionalOnce);
16015 /// let x1 = Property::new().set_occurrence_type(OccurrenceType::OptionalMultiple);
16016 /// let x2 = Property::new().set_occurrence_type(OccurrenceType::RequiredOnce);
16017 /// ```
16018 pub fn set_occurrence_type<
16019 T: std::convert::Into<
16020 crate::model::document_schema::entity_type::property::OccurrenceType,
16021 >,
16022 >(
16023 mut self,
16024 v: T,
16025 ) -> Self {
16026 self.occurrence_type = v.into();
16027 self
16028 }
16029
16030 /// Sets the value of [method][crate::model::document_schema::entity_type::Property::method].
16031 ///
16032 /// # Example
16033 /// ```ignore,no_run
16034 /// # use google_cloud_documentai_v1::model::document_schema::entity_type::Property;
16035 /// use google_cloud_documentai_v1::model::document_schema::entity_type::property::Method;
16036 /// let x0 = Property::new().set_method(Method::Extract);
16037 /// let x1 = Property::new().set_method(Method::Derive);
16038 /// ```
16039 pub fn set_method<
16040 T: std::convert::Into<crate::model::document_schema::entity_type::property::Method>,
16041 >(
16042 mut self,
16043 v: T,
16044 ) -> Self {
16045 self.method = v.into();
16046 self
16047 }
16048 }
16049
16050 impl wkt::message::Message for Property {
16051 fn typename() -> &'static str {
16052 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.EntityType.Property"
16053 }
16054 }
16055
16056 /// Defines additional types related to [Property].
16057 pub mod property {
16058 #[allow(unused_imports)]
16059 use super::*;
16060
16061 /// Types of occurrences of the entity type in the document. This
16062 /// represents the number of instances, not mentions, of an entity.
16063 /// For example, a bank statement might only have one
16064 /// `account_number`, but this account number can be mentioned in several
16065 /// places on the document. In this case, the `account_number` is
16066 /// considered a `REQUIRED_ONCE` entity type. If, on the other hand, we
16067 /// expect a bank statement to contain the status of multiple different
16068 /// accounts for the customers, the occurrence type is set to
16069 /// `REQUIRED_MULTIPLE`.
16070 ///
16071 /// # Working with unknown values
16072 ///
16073 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16074 /// additional enum variants at any time. Adding new variants is not considered
16075 /// a breaking change. Applications should write their code in anticipation of:
16076 ///
16077 /// - New values appearing in future releases of the client library, **and**
16078 /// - New values received dynamically, without application changes.
16079 ///
16080 /// Please consult the [Working with enums] section in the user guide for some
16081 /// guidelines.
16082 ///
16083 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16084 #[derive(Clone, Debug, PartialEq)]
16085 #[non_exhaustive]
16086 pub enum OccurrenceType {
16087 /// Unspecified occurrence type.
16088 Unspecified,
16089 /// There will be zero or one instance of this entity type. The same
16090 /// entity instance may be mentioned multiple times.
16091 OptionalOnce,
16092 /// The entity type will appear zero or multiple times.
16093 OptionalMultiple,
16094 /// The entity type will only appear exactly once. The same
16095 /// entity instance may be mentioned multiple times.
16096 RequiredOnce,
16097 /// The entity type will appear once or more times.
16098 RequiredMultiple,
16099 /// If set, the enum was initialized with an unknown value.
16100 ///
16101 /// Applications can examine the value using [OccurrenceType::value] or
16102 /// [OccurrenceType::name].
16103 UnknownValue(occurrence_type::UnknownValue),
16104 }
16105
16106 #[doc(hidden)]
16107 pub mod occurrence_type {
16108 #[allow(unused_imports)]
16109 use super::*;
16110 #[derive(Clone, Debug, PartialEq)]
16111 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16112 }
16113
16114 impl OccurrenceType {
16115 /// Gets the enum value.
16116 ///
16117 /// Returns `None` if the enum contains an unknown value deserialized from
16118 /// the string representation of enums.
16119 pub fn value(&self) -> std::option::Option<i32> {
16120 match self {
16121 Self::Unspecified => std::option::Option::Some(0),
16122 Self::OptionalOnce => std::option::Option::Some(1),
16123 Self::OptionalMultiple => std::option::Option::Some(2),
16124 Self::RequiredOnce => std::option::Option::Some(3),
16125 Self::RequiredMultiple => std::option::Option::Some(4),
16126 Self::UnknownValue(u) => u.0.value(),
16127 }
16128 }
16129
16130 /// Gets the enum value as a string.
16131 ///
16132 /// Returns `None` if the enum contains an unknown value deserialized from
16133 /// the integer representation of enums.
16134 pub fn name(&self) -> std::option::Option<&str> {
16135 match self {
16136 Self::Unspecified => {
16137 std::option::Option::Some("OCCURRENCE_TYPE_UNSPECIFIED")
16138 }
16139 Self::OptionalOnce => std::option::Option::Some("OPTIONAL_ONCE"),
16140 Self::OptionalMultiple => std::option::Option::Some("OPTIONAL_MULTIPLE"),
16141 Self::RequiredOnce => std::option::Option::Some("REQUIRED_ONCE"),
16142 Self::RequiredMultiple => std::option::Option::Some("REQUIRED_MULTIPLE"),
16143 Self::UnknownValue(u) => u.0.name(),
16144 }
16145 }
16146 }
16147
16148 impl std::default::Default for OccurrenceType {
16149 fn default() -> Self {
16150 use std::convert::From;
16151 Self::from(0)
16152 }
16153 }
16154
16155 impl std::fmt::Display for OccurrenceType {
16156 fn fmt(
16157 &self,
16158 f: &mut std::fmt::Formatter<'_>,
16159 ) -> std::result::Result<(), std::fmt::Error> {
16160 wkt::internal::display_enum(f, self.name(), self.value())
16161 }
16162 }
16163
16164 impl std::convert::From<i32> for OccurrenceType {
16165 fn from(value: i32) -> Self {
16166 match value {
16167 0 => Self::Unspecified,
16168 1 => Self::OptionalOnce,
16169 2 => Self::OptionalMultiple,
16170 3 => Self::RequiredOnce,
16171 4 => Self::RequiredMultiple,
16172 _ => Self::UnknownValue(occurrence_type::UnknownValue(
16173 wkt::internal::UnknownEnumValue::Integer(value),
16174 )),
16175 }
16176 }
16177 }
16178
16179 impl std::convert::From<&str> for OccurrenceType {
16180 fn from(value: &str) -> Self {
16181 use std::string::ToString;
16182 match value {
16183 "OCCURRENCE_TYPE_UNSPECIFIED" => Self::Unspecified,
16184 "OPTIONAL_ONCE" => Self::OptionalOnce,
16185 "OPTIONAL_MULTIPLE" => Self::OptionalMultiple,
16186 "REQUIRED_ONCE" => Self::RequiredOnce,
16187 "REQUIRED_MULTIPLE" => Self::RequiredMultiple,
16188 _ => Self::UnknownValue(occurrence_type::UnknownValue(
16189 wkt::internal::UnknownEnumValue::String(value.to_string()),
16190 )),
16191 }
16192 }
16193 }
16194
16195 impl serde::ser::Serialize for OccurrenceType {
16196 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16197 where
16198 S: serde::Serializer,
16199 {
16200 match self {
16201 Self::Unspecified => serializer.serialize_i32(0),
16202 Self::OptionalOnce => serializer.serialize_i32(1),
16203 Self::OptionalMultiple => serializer.serialize_i32(2),
16204 Self::RequiredOnce => serializer.serialize_i32(3),
16205 Self::RequiredMultiple => serializer.serialize_i32(4),
16206 Self::UnknownValue(u) => u.0.serialize(serializer),
16207 }
16208 }
16209 }
16210
16211 impl<'de> serde::de::Deserialize<'de> for OccurrenceType {
16212 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16213 where
16214 D: serde::Deserializer<'de>,
16215 {
16216 deserializer.deserialize_any(wkt::internal::EnumVisitor::<OccurrenceType>::new(
16217 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.OccurrenceType"))
16218 }
16219 }
16220
16221 /// Specifies how the entity's value is obtained from the document.
16222 ///
16223 /// # Working with unknown values
16224 ///
16225 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
16226 /// additional enum variants at any time. Adding new variants is not considered
16227 /// a breaking change. Applications should write their code in anticipation of:
16228 ///
16229 /// - New values appearing in future releases of the client library, **and**
16230 /// - New values received dynamically, without application changes.
16231 ///
16232 /// Please consult the [Working with enums] section in the user guide for some
16233 /// guidelines.
16234 ///
16235 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
16236 #[derive(Clone, Debug, PartialEq)]
16237 #[non_exhaustive]
16238 pub enum Method {
16239 /// Unspecified method. It defaults to `EXTRACT`.
16240 Unspecified,
16241 /// The entity's value is directly extracted as-is from the document
16242 /// text.
16243 Extract,
16244 /// The entity's value is derived through inference and is not
16245 /// necessarily an exact text extraction from the document.
16246 Derive,
16247 /// If set, the enum was initialized with an unknown value.
16248 ///
16249 /// Applications can examine the value using [Method::value] or
16250 /// [Method::name].
16251 UnknownValue(method::UnknownValue),
16252 }
16253
16254 #[doc(hidden)]
16255 pub mod method {
16256 #[allow(unused_imports)]
16257 use super::*;
16258 #[derive(Clone, Debug, PartialEq)]
16259 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
16260 }
16261
16262 impl Method {
16263 /// Gets the enum value.
16264 ///
16265 /// Returns `None` if the enum contains an unknown value deserialized from
16266 /// the string representation of enums.
16267 pub fn value(&self) -> std::option::Option<i32> {
16268 match self {
16269 Self::Unspecified => std::option::Option::Some(0),
16270 Self::Extract => std::option::Option::Some(1),
16271 Self::Derive => std::option::Option::Some(2),
16272 Self::UnknownValue(u) => u.0.value(),
16273 }
16274 }
16275
16276 /// Gets the enum value as a string.
16277 ///
16278 /// Returns `None` if the enum contains an unknown value deserialized from
16279 /// the integer representation of enums.
16280 pub fn name(&self) -> std::option::Option<&str> {
16281 match self {
16282 Self::Unspecified => std::option::Option::Some("METHOD_UNSPECIFIED"),
16283 Self::Extract => std::option::Option::Some("EXTRACT"),
16284 Self::Derive => std::option::Option::Some("DERIVE"),
16285 Self::UnknownValue(u) => u.0.name(),
16286 }
16287 }
16288 }
16289
16290 impl std::default::Default for Method {
16291 fn default() -> Self {
16292 use std::convert::From;
16293 Self::from(0)
16294 }
16295 }
16296
16297 impl std::fmt::Display for Method {
16298 fn fmt(
16299 &self,
16300 f: &mut std::fmt::Formatter<'_>,
16301 ) -> std::result::Result<(), std::fmt::Error> {
16302 wkt::internal::display_enum(f, self.name(), self.value())
16303 }
16304 }
16305
16306 impl std::convert::From<i32> for Method {
16307 fn from(value: i32) -> Self {
16308 match value {
16309 0 => Self::Unspecified,
16310 1 => Self::Extract,
16311 2 => Self::Derive,
16312 _ => Self::UnknownValue(method::UnknownValue(
16313 wkt::internal::UnknownEnumValue::Integer(value),
16314 )),
16315 }
16316 }
16317 }
16318
16319 impl std::convert::From<&str> for Method {
16320 fn from(value: &str) -> Self {
16321 use std::string::ToString;
16322 match value {
16323 "METHOD_UNSPECIFIED" => Self::Unspecified,
16324 "EXTRACT" => Self::Extract,
16325 "DERIVE" => Self::Derive,
16326 _ => Self::UnknownValue(method::UnknownValue(
16327 wkt::internal::UnknownEnumValue::String(value.to_string()),
16328 )),
16329 }
16330 }
16331 }
16332
16333 impl serde::ser::Serialize for Method {
16334 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
16335 where
16336 S: serde::Serializer,
16337 {
16338 match self {
16339 Self::Unspecified => serializer.serialize_i32(0),
16340 Self::Extract => serializer.serialize_i32(1),
16341 Self::Derive => serializer.serialize_i32(2),
16342 Self::UnknownValue(u) => u.0.serialize(serializer),
16343 }
16344 }
16345 }
16346
16347 impl<'de> serde::de::Deserialize<'de> for Method {
16348 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
16349 where
16350 D: serde::Deserializer<'de>,
16351 {
16352 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Method>::new(
16353 ".google.cloud.documentai.v1.DocumentSchema.EntityType.Property.Method",
16354 ))
16355 }
16356 }
16357 }
16358
16359 #[allow(missing_docs)]
16360 #[derive(Clone, Debug, PartialEq)]
16361 #[non_exhaustive]
16362 pub enum ValueSource {
16363 /// If specified, lists all the possible values for this entity. This
16364 /// should not be more than a handful of values. If the number of values
16365 /// is >10 or could change frequently use the `EntityType.value_ontology`
16366 /// field and specify a list of all possible values in a value ontology
16367 /// file.
16368 EnumValues(std::boxed::Box<crate::model::document_schema::entity_type::EnumValues>),
16369 }
16370 }
16371
16372 /// Metadata for global schema behavior.
16373 #[derive(Clone, Default, PartialEq)]
16374 #[non_exhaustive]
16375 pub struct Metadata {
16376 /// If true, a `document` entity type can be applied to subdocument
16377 /// (splitting). Otherwise, it can only be applied to the entire document
16378 /// (classification).
16379 pub document_splitter: bool,
16380
16381 /// If true, on a given page, there can be multiple `document` annotations
16382 /// covering it.
16383 pub document_allow_multiple_labels: bool,
16384
16385 /// If set, all the nested entities must be prefixed with the parents.
16386 pub prefixed_naming_on_properties: bool,
16387
16388 /// If set, we will skip the naming format validation in the schema. So the
16389 /// string values in `DocumentSchema.EntityType.name` and
16390 /// `DocumentSchema.EntityType.Property.name` will not be checked.
16391 pub skip_naming_validation: bool,
16392
16393 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16394 }
16395
16396 impl Metadata {
16397 /// Creates a new default instance.
16398 pub fn new() -> Self {
16399 std::default::Default::default()
16400 }
16401
16402 /// Sets the value of [document_splitter][crate::model::document_schema::Metadata::document_splitter].
16403 ///
16404 /// # Example
16405 /// ```ignore,no_run
16406 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16407 /// let x = Metadata::new().set_document_splitter(true);
16408 /// ```
16409 pub fn set_document_splitter<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16410 self.document_splitter = v.into();
16411 self
16412 }
16413
16414 /// Sets the value of [document_allow_multiple_labels][crate::model::document_schema::Metadata::document_allow_multiple_labels].
16415 ///
16416 /// # Example
16417 /// ```ignore,no_run
16418 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16419 /// let x = Metadata::new().set_document_allow_multiple_labels(true);
16420 /// ```
16421 pub fn set_document_allow_multiple_labels<T: std::convert::Into<bool>>(
16422 mut self,
16423 v: T,
16424 ) -> Self {
16425 self.document_allow_multiple_labels = v.into();
16426 self
16427 }
16428
16429 /// Sets the value of [prefixed_naming_on_properties][crate::model::document_schema::Metadata::prefixed_naming_on_properties].
16430 ///
16431 /// # Example
16432 /// ```ignore,no_run
16433 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16434 /// let x = Metadata::new().set_prefixed_naming_on_properties(true);
16435 /// ```
16436 pub fn set_prefixed_naming_on_properties<T: std::convert::Into<bool>>(
16437 mut self,
16438 v: T,
16439 ) -> Self {
16440 self.prefixed_naming_on_properties = v.into();
16441 self
16442 }
16443
16444 /// Sets the value of [skip_naming_validation][crate::model::document_schema::Metadata::skip_naming_validation].
16445 ///
16446 /// # Example
16447 /// ```ignore,no_run
16448 /// # use google_cloud_documentai_v1::model::document_schema::Metadata;
16449 /// let x = Metadata::new().set_skip_naming_validation(true);
16450 /// ```
16451 pub fn set_skip_naming_validation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
16452 self.skip_naming_validation = v.into();
16453 self
16454 }
16455 }
16456
16457 impl wkt::message::Message for Metadata {
16458 fn typename() -> &'static str {
16459 "type.googleapis.com/google.cloud.documentai.v1.DocumentSchema.Metadata"
16460 }
16461 }
16462}
16463
16464/// Gives a short summary of an evaluation, and links to the evaluation itself.
16465#[derive(Clone, Default, PartialEq)]
16466#[non_exhaustive]
16467pub struct EvaluationReference {
16468 /// The resource name of the Long Running Operation for the evaluation.
16469 pub operation: std::string::String,
16470
16471 /// The resource name of the evaluation.
16472 pub evaluation: std::string::String,
16473
16474 /// An aggregate of the statistics for the evaluation with fuzzy matching on.
16475 pub aggregate_metrics: std::option::Option<crate::model::evaluation::Metrics>,
16476
16477 /// An aggregate of the statistics for the evaluation with fuzzy matching off.
16478 pub aggregate_metrics_exact: std::option::Option<crate::model::evaluation::Metrics>,
16479
16480 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16481}
16482
16483impl EvaluationReference {
16484 /// Creates a new default instance.
16485 pub fn new() -> Self {
16486 std::default::Default::default()
16487 }
16488
16489 /// Sets the value of [operation][crate::model::EvaluationReference::operation].
16490 ///
16491 /// # Example
16492 /// ```ignore,no_run
16493 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16494 /// let x = EvaluationReference::new().set_operation("example");
16495 /// ```
16496 pub fn set_operation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16497 self.operation = v.into();
16498 self
16499 }
16500
16501 /// Sets the value of [evaluation][crate::model::EvaluationReference::evaluation].
16502 ///
16503 /// # Example
16504 /// ```ignore,no_run
16505 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16506 /// # let project_id = "project_id";
16507 /// # let location_id = "location_id";
16508 /// # let processor_id = "processor_id";
16509 /// # let processor_version_id = "processor_version_id";
16510 /// # let evaluation_id = "evaluation_id";
16511 /// let x = EvaluationReference::new().set_evaluation(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}/evaluations/{evaluation_id}"));
16512 /// ```
16513 pub fn set_evaluation<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16514 self.evaluation = v.into();
16515 self
16516 }
16517
16518 /// Sets the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16519 ///
16520 /// # Example
16521 /// ```ignore,no_run
16522 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16523 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16524 /// let x = EvaluationReference::new().set_aggregate_metrics(Metrics::default()/* use setters */);
16525 /// ```
16526 pub fn set_aggregate_metrics<T>(mut self, v: T) -> Self
16527 where
16528 T: std::convert::Into<crate::model::evaluation::Metrics>,
16529 {
16530 self.aggregate_metrics = std::option::Option::Some(v.into());
16531 self
16532 }
16533
16534 /// Sets or clears the value of [aggregate_metrics][crate::model::EvaluationReference::aggregate_metrics].
16535 ///
16536 /// # Example
16537 /// ```ignore,no_run
16538 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16539 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16540 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(Some(Metrics::default()/* use setters */));
16541 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics(None::<Metrics>);
16542 /// ```
16543 pub fn set_or_clear_aggregate_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16544 where
16545 T: std::convert::Into<crate::model::evaluation::Metrics>,
16546 {
16547 self.aggregate_metrics = v.map(|x| x.into());
16548 self
16549 }
16550
16551 /// Sets the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16552 ///
16553 /// # Example
16554 /// ```ignore,no_run
16555 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16556 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16557 /// let x = EvaluationReference::new().set_aggregate_metrics_exact(Metrics::default()/* use setters */);
16558 /// ```
16559 pub fn set_aggregate_metrics_exact<T>(mut self, v: T) -> Self
16560 where
16561 T: std::convert::Into<crate::model::evaluation::Metrics>,
16562 {
16563 self.aggregate_metrics_exact = std::option::Option::Some(v.into());
16564 self
16565 }
16566
16567 /// Sets or clears the value of [aggregate_metrics_exact][crate::model::EvaluationReference::aggregate_metrics_exact].
16568 ///
16569 /// # Example
16570 /// ```ignore,no_run
16571 /// # use google_cloud_documentai_v1::model::EvaluationReference;
16572 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
16573 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(Some(Metrics::default()/* use setters */));
16574 /// let x = EvaluationReference::new().set_or_clear_aggregate_metrics_exact(None::<Metrics>);
16575 /// ```
16576 pub fn set_or_clear_aggregate_metrics_exact<T>(mut self, v: std::option::Option<T>) -> Self
16577 where
16578 T: std::convert::Into<crate::model::evaluation::Metrics>,
16579 {
16580 self.aggregate_metrics_exact = v.map(|x| x.into());
16581 self
16582 }
16583}
16584
16585impl wkt::message::Message for EvaluationReference {
16586 fn typename() -> &'static str {
16587 "type.googleapis.com/google.cloud.documentai.v1.EvaluationReference"
16588 }
16589}
16590
16591/// An evaluation of a ProcessorVersion's performance.
16592#[derive(Clone, Default, PartialEq)]
16593#[non_exhaustive]
16594pub struct Evaluation {
16595 /// The resource name of the evaluation.
16596 /// Format:
16597 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}`
16598 pub name: std::string::String,
16599
16600 /// The time that the evaluation was created.
16601 pub create_time: std::option::Option<wkt::Timestamp>,
16602
16603 /// Counters for the documents used in the evaluation.
16604 pub document_counters: std::option::Option<crate::model::evaluation::Counters>,
16605
16606 /// Metrics for all the entities in aggregate.
16607 pub all_entities_metrics: std::option::Option<crate::model::evaluation::MultiConfidenceMetrics>,
16608
16609 /// Metrics across confidence levels, for different entities.
16610 pub entity_metrics: std::collections::HashMap<
16611 std::string::String,
16612 crate::model::evaluation::MultiConfidenceMetrics,
16613 >,
16614
16615 /// The KMS key name used for encryption.
16616 pub kms_key_name: std::string::String,
16617
16618 /// The KMS key version with which data is encrypted.
16619 pub kms_key_version_name: std::string::String,
16620
16621 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16622}
16623
16624impl Evaluation {
16625 /// Creates a new default instance.
16626 pub fn new() -> Self {
16627 std::default::Default::default()
16628 }
16629
16630 /// Sets the value of [name][crate::model::Evaluation::name].
16631 ///
16632 /// # Example
16633 /// ```ignore,no_run
16634 /// # use google_cloud_documentai_v1::model::Evaluation;
16635 /// # let project_id = "project_id";
16636 /// # let location_id = "location_id";
16637 /// # let processor_id = "processor_id";
16638 /// # let processor_version_id = "processor_version_id";
16639 /// # let evaluation_id = "evaluation_id";
16640 /// let x = Evaluation::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}/evaluations/{evaluation_id}"));
16641 /// ```
16642 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16643 self.name = v.into();
16644 self
16645 }
16646
16647 /// Sets the value of [create_time][crate::model::Evaluation::create_time].
16648 ///
16649 /// # Example
16650 /// ```ignore,no_run
16651 /// # use google_cloud_documentai_v1::model::Evaluation;
16652 /// use wkt::Timestamp;
16653 /// let x = Evaluation::new().set_create_time(Timestamp::default()/* use setters */);
16654 /// ```
16655 pub fn set_create_time<T>(mut self, v: T) -> Self
16656 where
16657 T: std::convert::Into<wkt::Timestamp>,
16658 {
16659 self.create_time = std::option::Option::Some(v.into());
16660 self
16661 }
16662
16663 /// Sets or clears the value of [create_time][crate::model::Evaluation::create_time].
16664 ///
16665 /// # Example
16666 /// ```ignore,no_run
16667 /// # use google_cloud_documentai_v1::model::Evaluation;
16668 /// use wkt::Timestamp;
16669 /// let x = Evaluation::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
16670 /// let x = Evaluation::new().set_or_clear_create_time(None::<Timestamp>);
16671 /// ```
16672 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
16673 where
16674 T: std::convert::Into<wkt::Timestamp>,
16675 {
16676 self.create_time = v.map(|x| x.into());
16677 self
16678 }
16679
16680 /// Sets the value of [document_counters][crate::model::Evaluation::document_counters].
16681 ///
16682 /// # Example
16683 /// ```ignore,no_run
16684 /// # use google_cloud_documentai_v1::model::Evaluation;
16685 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16686 /// let x = Evaluation::new().set_document_counters(Counters::default()/* use setters */);
16687 /// ```
16688 pub fn set_document_counters<T>(mut self, v: T) -> Self
16689 where
16690 T: std::convert::Into<crate::model::evaluation::Counters>,
16691 {
16692 self.document_counters = std::option::Option::Some(v.into());
16693 self
16694 }
16695
16696 /// Sets or clears the value of [document_counters][crate::model::Evaluation::document_counters].
16697 ///
16698 /// # Example
16699 /// ```ignore,no_run
16700 /// # use google_cloud_documentai_v1::model::Evaluation;
16701 /// use google_cloud_documentai_v1::model::evaluation::Counters;
16702 /// let x = Evaluation::new().set_or_clear_document_counters(Some(Counters::default()/* use setters */));
16703 /// let x = Evaluation::new().set_or_clear_document_counters(None::<Counters>);
16704 /// ```
16705 pub fn set_or_clear_document_counters<T>(mut self, v: std::option::Option<T>) -> Self
16706 where
16707 T: std::convert::Into<crate::model::evaluation::Counters>,
16708 {
16709 self.document_counters = v.map(|x| x.into());
16710 self
16711 }
16712
16713 /// Sets the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16714 ///
16715 /// # Example
16716 /// ```ignore,no_run
16717 /// # use google_cloud_documentai_v1::model::Evaluation;
16718 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16719 /// let x = Evaluation::new().set_all_entities_metrics(MultiConfidenceMetrics::default()/* use setters */);
16720 /// ```
16721 pub fn set_all_entities_metrics<T>(mut self, v: T) -> Self
16722 where
16723 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16724 {
16725 self.all_entities_metrics = std::option::Option::Some(v.into());
16726 self
16727 }
16728
16729 /// Sets or clears the value of [all_entities_metrics][crate::model::Evaluation::all_entities_metrics].
16730 ///
16731 /// # Example
16732 /// ```ignore,no_run
16733 /// # use google_cloud_documentai_v1::model::Evaluation;
16734 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16735 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(Some(MultiConfidenceMetrics::default()/* use setters */));
16736 /// let x = Evaluation::new().set_or_clear_all_entities_metrics(None::<MultiConfidenceMetrics>);
16737 /// ```
16738 pub fn set_or_clear_all_entities_metrics<T>(mut self, v: std::option::Option<T>) -> Self
16739 where
16740 T: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16741 {
16742 self.all_entities_metrics = v.map(|x| x.into());
16743 self
16744 }
16745
16746 /// Sets the value of [entity_metrics][crate::model::Evaluation::entity_metrics].
16747 ///
16748 /// # Example
16749 /// ```ignore,no_run
16750 /// # use google_cloud_documentai_v1::model::Evaluation;
16751 /// use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
16752 /// let x = Evaluation::new().set_entity_metrics([
16753 /// ("key0", MultiConfidenceMetrics::default()/* use setters */),
16754 /// ("key1", MultiConfidenceMetrics::default()/* use (different) setters */),
16755 /// ]);
16756 /// ```
16757 pub fn set_entity_metrics<T, K, V>(mut self, v: T) -> Self
16758 where
16759 T: std::iter::IntoIterator<Item = (K, V)>,
16760 K: std::convert::Into<std::string::String>,
16761 V: std::convert::Into<crate::model::evaluation::MultiConfidenceMetrics>,
16762 {
16763 use std::iter::Iterator;
16764 self.entity_metrics = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
16765 self
16766 }
16767
16768 /// Sets the value of [kms_key_name][crate::model::Evaluation::kms_key_name].
16769 ///
16770 /// # Example
16771 /// ```ignore,no_run
16772 /// # use google_cloud_documentai_v1::model::Evaluation;
16773 /// let x = Evaluation::new().set_kms_key_name("example");
16774 /// ```
16775 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
16776 self.kms_key_name = v.into();
16777 self
16778 }
16779
16780 /// Sets the value of [kms_key_version_name][crate::model::Evaluation::kms_key_version_name].
16781 ///
16782 /// # Example
16783 /// ```ignore,no_run
16784 /// # use google_cloud_documentai_v1::model::Evaluation;
16785 /// let x = Evaluation::new().set_kms_key_version_name("example");
16786 /// ```
16787 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
16788 mut self,
16789 v: T,
16790 ) -> Self {
16791 self.kms_key_version_name = v.into();
16792 self
16793 }
16794}
16795
16796impl wkt::message::Message for Evaluation {
16797 fn typename() -> &'static str {
16798 "type.googleapis.com/google.cloud.documentai.v1.Evaluation"
16799 }
16800}
16801
16802/// Defines additional types related to [Evaluation].
16803pub mod evaluation {
16804 #[allow(unused_imports)]
16805 use super::*;
16806
16807 /// Evaluation counters for the documents that were used.
16808 #[derive(Clone, Default, PartialEq)]
16809 #[non_exhaustive]
16810 pub struct Counters {
16811 /// How many documents were sent for evaluation.
16812 pub input_documents_count: i32,
16813
16814 /// How many documents were not included in the evaluation as they didn't
16815 /// pass validation.
16816 pub invalid_documents_count: i32,
16817
16818 /// How many documents were not included in the evaluation as Document AI
16819 /// failed to process them.
16820 pub failed_documents_count: i32,
16821
16822 /// How many documents were used in the evaluation.
16823 pub evaluated_documents_count: i32,
16824
16825 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16826 }
16827
16828 impl Counters {
16829 /// Creates a new default instance.
16830 pub fn new() -> Self {
16831 std::default::Default::default()
16832 }
16833
16834 /// Sets the value of [input_documents_count][crate::model::evaluation::Counters::input_documents_count].
16835 ///
16836 /// # Example
16837 /// ```ignore,no_run
16838 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16839 /// let x = Counters::new().set_input_documents_count(42);
16840 /// ```
16841 pub fn set_input_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16842 self.input_documents_count = v.into();
16843 self
16844 }
16845
16846 /// Sets the value of [invalid_documents_count][crate::model::evaluation::Counters::invalid_documents_count].
16847 ///
16848 /// # Example
16849 /// ```ignore,no_run
16850 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16851 /// let x = Counters::new().set_invalid_documents_count(42);
16852 /// ```
16853 pub fn set_invalid_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16854 self.invalid_documents_count = v.into();
16855 self
16856 }
16857
16858 /// Sets the value of [failed_documents_count][crate::model::evaluation::Counters::failed_documents_count].
16859 ///
16860 /// # Example
16861 /// ```ignore,no_run
16862 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16863 /// let x = Counters::new().set_failed_documents_count(42);
16864 /// ```
16865 pub fn set_failed_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16866 self.failed_documents_count = v.into();
16867 self
16868 }
16869
16870 /// Sets the value of [evaluated_documents_count][crate::model::evaluation::Counters::evaluated_documents_count].
16871 ///
16872 /// # Example
16873 /// ```ignore,no_run
16874 /// # use google_cloud_documentai_v1::model::evaluation::Counters;
16875 /// let x = Counters::new().set_evaluated_documents_count(42);
16876 /// ```
16877 pub fn set_evaluated_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16878 self.evaluated_documents_count = v.into();
16879 self
16880 }
16881 }
16882
16883 impl wkt::message::Message for Counters {
16884 fn typename() -> &'static str {
16885 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Counters"
16886 }
16887 }
16888
16889 /// Evaluation metrics, either in aggregate or about a specific entity.
16890 #[derive(Clone, Default, PartialEq)]
16891 #[non_exhaustive]
16892 pub struct Metrics {
16893 /// The calculated precision.
16894 pub precision: f32,
16895
16896 /// The calculated recall.
16897 pub recall: f32,
16898
16899 /// The calculated f1 score.
16900 pub f1_score: f32,
16901
16902 /// The amount of occurrences in predicted documents.
16903 pub predicted_occurrences_count: i32,
16904
16905 /// The amount of occurrences in ground truth documents.
16906 pub ground_truth_occurrences_count: i32,
16907
16908 /// The amount of documents with a predicted occurrence.
16909 pub predicted_document_count: i32,
16910
16911 /// The amount of documents with a ground truth occurrence.
16912 pub ground_truth_document_count: i32,
16913
16914 /// The amount of true positives.
16915 pub true_positives_count: i32,
16916
16917 /// The amount of false positives.
16918 pub false_positives_count: i32,
16919
16920 /// The amount of false negatives.
16921 pub false_negatives_count: i32,
16922
16923 /// The amount of documents that had an occurrence of this label.
16924 pub total_documents_count: i32,
16925
16926 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
16927 }
16928
16929 impl Metrics {
16930 /// Creates a new default instance.
16931 pub fn new() -> Self {
16932 std::default::Default::default()
16933 }
16934
16935 /// Sets the value of [precision][crate::model::evaluation::Metrics::precision].
16936 ///
16937 /// # Example
16938 /// ```ignore,no_run
16939 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16940 /// let x = Metrics::new().set_precision(42.0);
16941 /// ```
16942 pub fn set_precision<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16943 self.precision = v.into();
16944 self
16945 }
16946
16947 /// Sets the value of [recall][crate::model::evaluation::Metrics::recall].
16948 ///
16949 /// # Example
16950 /// ```ignore,no_run
16951 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16952 /// let x = Metrics::new().set_recall(42.0);
16953 /// ```
16954 pub fn set_recall<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16955 self.recall = v.into();
16956 self
16957 }
16958
16959 /// Sets the value of [f1_score][crate::model::evaluation::Metrics::f1_score].
16960 ///
16961 /// # Example
16962 /// ```ignore,no_run
16963 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16964 /// let x = Metrics::new().set_f1_score(42.0);
16965 /// ```
16966 pub fn set_f1_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
16967 self.f1_score = v.into();
16968 self
16969 }
16970
16971 /// Sets the value of [predicted_occurrences_count][crate::model::evaluation::Metrics::predicted_occurrences_count].
16972 ///
16973 /// # Example
16974 /// ```ignore,no_run
16975 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16976 /// let x = Metrics::new().set_predicted_occurrences_count(42);
16977 /// ```
16978 pub fn set_predicted_occurrences_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
16979 self.predicted_occurrences_count = v.into();
16980 self
16981 }
16982
16983 /// Sets the value of [ground_truth_occurrences_count][crate::model::evaluation::Metrics::ground_truth_occurrences_count].
16984 ///
16985 /// # Example
16986 /// ```ignore,no_run
16987 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
16988 /// let x = Metrics::new().set_ground_truth_occurrences_count(42);
16989 /// ```
16990 pub fn set_ground_truth_occurrences_count<T: std::convert::Into<i32>>(
16991 mut self,
16992 v: T,
16993 ) -> Self {
16994 self.ground_truth_occurrences_count = v.into();
16995 self
16996 }
16997
16998 /// Sets the value of [predicted_document_count][crate::model::evaluation::Metrics::predicted_document_count].
16999 ///
17000 /// # Example
17001 /// ```ignore,no_run
17002 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17003 /// let x = Metrics::new().set_predicted_document_count(42);
17004 /// ```
17005 pub fn set_predicted_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17006 self.predicted_document_count = v.into();
17007 self
17008 }
17009
17010 /// Sets the value of [ground_truth_document_count][crate::model::evaluation::Metrics::ground_truth_document_count].
17011 ///
17012 /// # Example
17013 /// ```ignore,no_run
17014 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17015 /// let x = Metrics::new().set_ground_truth_document_count(42);
17016 /// ```
17017 pub fn set_ground_truth_document_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17018 self.ground_truth_document_count = v.into();
17019 self
17020 }
17021
17022 /// Sets the value of [true_positives_count][crate::model::evaluation::Metrics::true_positives_count].
17023 ///
17024 /// # Example
17025 /// ```ignore,no_run
17026 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17027 /// let x = Metrics::new().set_true_positives_count(42);
17028 /// ```
17029 pub fn set_true_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17030 self.true_positives_count = v.into();
17031 self
17032 }
17033
17034 /// Sets the value of [false_positives_count][crate::model::evaluation::Metrics::false_positives_count].
17035 ///
17036 /// # Example
17037 /// ```ignore,no_run
17038 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17039 /// let x = Metrics::new().set_false_positives_count(42);
17040 /// ```
17041 pub fn set_false_positives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17042 self.false_positives_count = v.into();
17043 self
17044 }
17045
17046 /// Sets the value of [false_negatives_count][crate::model::evaluation::Metrics::false_negatives_count].
17047 ///
17048 /// # Example
17049 /// ```ignore,no_run
17050 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17051 /// let x = Metrics::new().set_false_negatives_count(42);
17052 /// ```
17053 pub fn set_false_negatives_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17054 self.false_negatives_count = v.into();
17055 self
17056 }
17057
17058 /// Sets the value of [total_documents_count][crate::model::evaluation::Metrics::total_documents_count].
17059 ///
17060 /// # Example
17061 /// ```ignore,no_run
17062 /// # use google_cloud_documentai_v1::model::evaluation::Metrics;
17063 /// let x = Metrics::new().set_total_documents_count(42);
17064 /// ```
17065 pub fn set_total_documents_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17066 self.total_documents_count = v.into();
17067 self
17068 }
17069 }
17070
17071 impl wkt::message::Message for Metrics {
17072 fn typename() -> &'static str {
17073 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.Metrics"
17074 }
17075 }
17076
17077 /// Evaluations metrics, at a specific confidence level.
17078 #[derive(Clone, Default, PartialEq)]
17079 #[non_exhaustive]
17080 pub struct ConfidenceLevelMetrics {
17081 /// The confidence level.
17082 pub confidence_level: f32,
17083
17084 /// The metrics at the specific confidence level.
17085 pub metrics: std::option::Option<crate::model::evaluation::Metrics>,
17086
17087 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17088 }
17089
17090 impl ConfidenceLevelMetrics {
17091 /// Creates a new default instance.
17092 pub fn new() -> Self {
17093 std::default::Default::default()
17094 }
17095
17096 /// Sets the value of [confidence_level][crate::model::evaluation::ConfidenceLevelMetrics::confidence_level].
17097 ///
17098 /// # Example
17099 /// ```ignore,no_run
17100 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17101 /// let x = ConfidenceLevelMetrics::new().set_confidence_level(42.0);
17102 /// ```
17103 pub fn set_confidence_level<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17104 self.confidence_level = v.into();
17105 self
17106 }
17107
17108 /// Sets the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
17109 ///
17110 /// # Example
17111 /// ```ignore,no_run
17112 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17113 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
17114 /// let x = ConfidenceLevelMetrics::new().set_metrics(Metrics::default()/* use setters */);
17115 /// ```
17116 pub fn set_metrics<T>(mut self, v: T) -> Self
17117 where
17118 T: std::convert::Into<crate::model::evaluation::Metrics>,
17119 {
17120 self.metrics = std::option::Option::Some(v.into());
17121 self
17122 }
17123
17124 /// Sets or clears the value of [metrics][crate::model::evaluation::ConfidenceLevelMetrics::metrics].
17125 ///
17126 /// # Example
17127 /// ```ignore,no_run
17128 /// # use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17129 /// use google_cloud_documentai_v1::model::evaluation::Metrics;
17130 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(Some(Metrics::default()/* use setters */));
17131 /// let x = ConfidenceLevelMetrics::new().set_or_clear_metrics(None::<Metrics>);
17132 /// ```
17133 pub fn set_or_clear_metrics<T>(mut self, v: std::option::Option<T>) -> Self
17134 where
17135 T: std::convert::Into<crate::model::evaluation::Metrics>,
17136 {
17137 self.metrics = v.map(|x| x.into());
17138 self
17139 }
17140 }
17141
17142 impl wkt::message::Message for ConfidenceLevelMetrics {
17143 fn typename() -> &'static str {
17144 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.ConfidenceLevelMetrics"
17145 }
17146 }
17147
17148 /// Metrics across multiple confidence levels.
17149 #[derive(Clone, Default, PartialEq)]
17150 #[non_exhaustive]
17151 pub struct MultiConfidenceMetrics {
17152 /// Metrics across confidence levels with fuzzy matching enabled.
17153 pub confidence_level_metrics:
17154 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
17155
17156 /// Metrics across confidence levels with only exact matching.
17157 pub confidence_level_metrics_exact:
17158 std::vec::Vec<crate::model::evaluation::ConfidenceLevelMetrics>,
17159
17160 /// The calculated area under the precision recall curve (AUPRC), computed by
17161 /// integrating over all confidence thresholds.
17162 pub auprc: f32,
17163
17164 /// The Estimated Calibration Error (ECE) of the confidence of the predicted
17165 /// entities.
17166 pub estimated_calibration_error: f32,
17167
17168 /// The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching
17169 /// only.
17170 pub auprc_exact: f32,
17171
17172 /// The ECE for the predicted entities with fuzzy matching disabled, i.e.,
17173 /// exact matching only.
17174 pub estimated_calibration_error_exact: f32,
17175
17176 /// The metrics type for the label.
17177 pub metrics_type: crate::model::evaluation::multi_confidence_metrics::MetricsType,
17178
17179 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17180 }
17181
17182 impl MultiConfidenceMetrics {
17183 /// Creates a new default instance.
17184 pub fn new() -> Self {
17185 std::default::Default::default()
17186 }
17187
17188 /// Sets the value of [confidence_level_metrics][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics].
17189 ///
17190 /// # Example
17191 /// ```ignore,no_run
17192 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17193 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17194 /// let x = MultiConfidenceMetrics::new()
17195 /// .set_confidence_level_metrics([
17196 /// ConfidenceLevelMetrics::default()/* use setters */,
17197 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
17198 /// ]);
17199 /// ```
17200 pub fn set_confidence_level_metrics<T, V>(mut self, v: T) -> Self
17201 where
17202 T: std::iter::IntoIterator<Item = V>,
17203 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17204 {
17205 use std::iter::Iterator;
17206 self.confidence_level_metrics = v.into_iter().map(|i| i.into()).collect();
17207 self
17208 }
17209
17210 /// Sets the value of [confidence_level_metrics_exact][crate::model::evaluation::MultiConfidenceMetrics::confidence_level_metrics_exact].
17211 ///
17212 /// # Example
17213 /// ```ignore,no_run
17214 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17215 /// use google_cloud_documentai_v1::model::evaluation::ConfidenceLevelMetrics;
17216 /// let x = MultiConfidenceMetrics::new()
17217 /// .set_confidence_level_metrics_exact([
17218 /// ConfidenceLevelMetrics::default()/* use setters */,
17219 /// ConfidenceLevelMetrics::default()/* use (different) setters */,
17220 /// ]);
17221 /// ```
17222 pub fn set_confidence_level_metrics_exact<T, V>(mut self, v: T) -> Self
17223 where
17224 T: std::iter::IntoIterator<Item = V>,
17225 V: std::convert::Into<crate::model::evaluation::ConfidenceLevelMetrics>,
17226 {
17227 use std::iter::Iterator;
17228 self.confidence_level_metrics_exact = v.into_iter().map(|i| i.into()).collect();
17229 self
17230 }
17231
17232 /// Sets the value of [auprc][crate::model::evaluation::MultiConfidenceMetrics::auprc].
17233 ///
17234 /// # Example
17235 /// ```ignore,no_run
17236 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17237 /// let x = MultiConfidenceMetrics::new().set_auprc(42.0);
17238 /// ```
17239 pub fn set_auprc<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17240 self.auprc = v.into();
17241 self
17242 }
17243
17244 /// Sets the value of [estimated_calibration_error][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error].
17245 ///
17246 /// # Example
17247 /// ```ignore,no_run
17248 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17249 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error(42.0);
17250 /// ```
17251 pub fn set_estimated_calibration_error<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17252 self.estimated_calibration_error = v.into();
17253 self
17254 }
17255
17256 /// Sets the value of [auprc_exact][crate::model::evaluation::MultiConfidenceMetrics::auprc_exact].
17257 ///
17258 /// # Example
17259 /// ```ignore,no_run
17260 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17261 /// let x = MultiConfidenceMetrics::new().set_auprc_exact(42.0);
17262 /// ```
17263 pub fn set_auprc_exact<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17264 self.auprc_exact = v.into();
17265 self
17266 }
17267
17268 /// Sets the value of [estimated_calibration_error_exact][crate::model::evaluation::MultiConfidenceMetrics::estimated_calibration_error_exact].
17269 ///
17270 /// # Example
17271 /// ```ignore,no_run
17272 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17273 /// let x = MultiConfidenceMetrics::new().set_estimated_calibration_error_exact(42.0);
17274 /// ```
17275 pub fn set_estimated_calibration_error_exact<T: std::convert::Into<f32>>(
17276 mut self,
17277 v: T,
17278 ) -> Self {
17279 self.estimated_calibration_error_exact = v.into();
17280 self
17281 }
17282
17283 /// Sets the value of [metrics_type][crate::model::evaluation::MultiConfidenceMetrics::metrics_type].
17284 ///
17285 /// # Example
17286 /// ```ignore,no_run
17287 /// # use google_cloud_documentai_v1::model::evaluation::MultiConfidenceMetrics;
17288 /// use google_cloud_documentai_v1::model::evaluation::multi_confidence_metrics::MetricsType;
17289 /// let x0 = MultiConfidenceMetrics::new().set_metrics_type(MetricsType::Aggregate);
17290 /// ```
17291 pub fn set_metrics_type<
17292 T: std::convert::Into<crate::model::evaluation::multi_confidence_metrics::MetricsType>,
17293 >(
17294 mut self,
17295 v: T,
17296 ) -> Self {
17297 self.metrics_type = v.into();
17298 self
17299 }
17300 }
17301
17302 impl wkt::message::Message for MultiConfidenceMetrics {
17303 fn typename() -> &'static str {
17304 "type.googleapis.com/google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics"
17305 }
17306 }
17307
17308 /// Defines additional types related to [MultiConfidenceMetrics].
17309 pub mod multi_confidence_metrics {
17310 #[allow(unused_imports)]
17311 use super::*;
17312
17313 /// A type that determines how metrics should be interpreted.
17314 ///
17315 /// # Working with unknown values
17316 ///
17317 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17318 /// additional enum variants at any time. Adding new variants is not considered
17319 /// a breaking change. Applications should write their code in anticipation of:
17320 ///
17321 /// - New values appearing in future releases of the client library, **and**
17322 /// - New values received dynamically, without application changes.
17323 ///
17324 /// Please consult the [Working with enums] section in the user guide for some
17325 /// guidelines.
17326 ///
17327 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17328 #[derive(Clone, Debug, PartialEq)]
17329 #[non_exhaustive]
17330 pub enum MetricsType {
17331 /// The metrics type is unspecified. By default, metrics without a
17332 /// particular specification are for leaf entity types (i.e., top-level
17333 /// entity types without child types, or child types which are not
17334 /// parent types themselves).
17335 Unspecified,
17336 /// Indicates whether metrics for this particular label type represent an
17337 /// aggregate of metrics for other types instead of being based on actual
17338 /// TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf)
17339 /// entity types are an aggregate of metrics for their children.
17340 Aggregate,
17341 /// If set, the enum was initialized with an unknown value.
17342 ///
17343 /// Applications can examine the value using [MetricsType::value] or
17344 /// [MetricsType::name].
17345 UnknownValue(metrics_type::UnknownValue),
17346 }
17347
17348 #[doc(hidden)]
17349 pub mod metrics_type {
17350 #[allow(unused_imports)]
17351 use super::*;
17352 #[derive(Clone, Debug, PartialEq)]
17353 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17354 }
17355
17356 impl MetricsType {
17357 /// Gets the enum value.
17358 ///
17359 /// Returns `None` if the enum contains an unknown value deserialized from
17360 /// the string representation of enums.
17361 pub fn value(&self) -> std::option::Option<i32> {
17362 match self {
17363 Self::Unspecified => std::option::Option::Some(0),
17364 Self::Aggregate => std::option::Option::Some(1),
17365 Self::UnknownValue(u) => u.0.value(),
17366 }
17367 }
17368
17369 /// Gets the enum value as a string.
17370 ///
17371 /// Returns `None` if the enum contains an unknown value deserialized from
17372 /// the integer representation of enums.
17373 pub fn name(&self) -> std::option::Option<&str> {
17374 match self {
17375 Self::Unspecified => std::option::Option::Some("METRICS_TYPE_UNSPECIFIED"),
17376 Self::Aggregate => std::option::Option::Some("AGGREGATE"),
17377 Self::UnknownValue(u) => u.0.name(),
17378 }
17379 }
17380 }
17381
17382 impl std::default::Default for MetricsType {
17383 fn default() -> Self {
17384 use std::convert::From;
17385 Self::from(0)
17386 }
17387 }
17388
17389 impl std::fmt::Display for MetricsType {
17390 fn fmt(
17391 &self,
17392 f: &mut std::fmt::Formatter<'_>,
17393 ) -> std::result::Result<(), std::fmt::Error> {
17394 wkt::internal::display_enum(f, self.name(), self.value())
17395 }
17396 }
17397
17398 impl std::convert::From<i32> for MetricsType {
17399 fn from(value: i32) -> Self {
17400 match value {
17401 0 => Self::Unspecified,
17402 1 => Self::Aggregate,
17403 _ => Self::UnknownValue(metrics_type::UnknownValue(
17404 wkt::internal::UnknownEnumValue::Integer(value),
17405 )),
17406 }
17407 }
17408 }
17409
17410 impl std::convert::From<&str> for MetricsType {
17411 fn from(value: &str) -> Self {
17412 use std::string::ToString;
17413 match value {
17414 "METRICS_TYPE_UNSPECIFIED" => Self::Unspecified,
17415 "AGGREGATE" => Self::Aggregate,
17416 _ => Self::UnknownValue(metrics_type::UnknownValue(
17417 wkt::internal::UnknownEnumValue::String(value.to_string()),
17418 )),
17419 }
17420 }
17421 }
17422
17423 impl serde::ser::Serialize for MetricsType {
17424 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17425 where
17426 S: serde::Serializer,
17427 {
17428 match self {
17429 Self::Unspecified => serializer.serialize_i32(0),
17430 Self::Aggregate => serializer.serialize_i32(1),
17431 Self::UnknownValue(u) => u.0.serialize(serializer),
17432 }
17433 }
17434 }
17435
17436 impl<'de> serde::de::Deserialize<'de> for MetricsType {
17437 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17438 where
17439 D: serde::Deserializer<'de>,
17440 {
17441 deserializer.deserialize_any(wkt::internal::EnumVisitor::<MetricsType>::new(
17442 ".google.cloud.documentai.v1.Evaluation.MultiConfidenceMetrics.MetricsType",
17443 ))
17444 }
17445 }
17446 }
17447}
17448
17449/// A vertex represents a 2D point in the image.
17450/// NOTE: the vertex coordinates are in the same scale as the original image.
17451#[derive(Clone, Default, PartialEq)]
17452#[non_exhaustive]
17453pub struct Vertex {
17454 /// X coordinate.
17455 pub x: i32,
17456
17457 /// Y coordinate (starts from the top of the image).
17458 pub y: i32,
17459
17460 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17461}
17462
17463impl Vertex {
17464 /// Creates a new default instance.
17465 pub fn new() -> Self {
17466 std::default::Default::default()
17467 }
17468
17469 /// Sets the value of [x][crate::model::Vertex::x].
17470 ///
17471 /// # Example
17472 /// ```ignore,no_run
17473 /// # use google_cloud_documentai_v1::model::Vertex;
17474 /// let x = Vertex::new().set_x(42);
17475 /// ```
17476 pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17477 self.x = v.into();
17478 self
17479 }
17480
17481 /// Sets the value of [y][crate::model::Vertex::y].
17482 ///
17483 /// # Example
17484 /// ```ignore,no_run
17485 /// # use google_cloud_documentai_v1::model::Vertex;
17486 /// let x = Vertex::new().set_y(42);
17487 /// ```
17488 pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
17489 self.y = v.into();
17490 self
17491 }
17492}
17493
17494impl wkt::message::Message for Vertex {
17495 fn typename() -> &'static str {
17496 "type.googleapis.com/google.cloud.documentai.v1.Vertex"
17497 }
17498}
17499
17500/// A vertex represents a 2D point in the image.
17501/// NOTE: the normalized vertex coordinates are relative to the original image
17502/// and range from 0 to 1.
17503#[derive(Clone, Default, PartialEq)]
17504#[non_exhaustive]
17505pub struct NormalizedVertex {
17506 /// X coordinate.
17507 pub x: f32,
17508
17509 /// Y coordinate (starts from the top of the image).
17510 pub y: f32,
17511
17512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17513}
17514
17515impl NormalizedVertex {
17516 /// Creates a new default instance.
17517 pub fn new() -> Self {
17518 std::default::Default::default()
17519 }
17520
17521 /// Sets the value of [x][crate::model::NormalizedVertex::x].
17522 ///
17523 /// # Example
17524 /// ```ignore,no_run
17525 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17526 /// let x = NormalizedVertex::new().set_x(42.0);
17527 /// ```
17528 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17529 self.x = v.into();
17530 self
17531 }
17532
17533 /// Sets the value of [y][crate::model::NormalizedVertex::y].
17534 ///
17535 /// # Example
17536 /// ```ignore,no_run
17537 /// # use google_cloud_documentai_v1::model::NormalizedVertex;
17538 /// let x = NormalizedVertex::new().set_y(42.0);
17539 /// ```
17540 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
17541 self.y = v.into();
17542 self
17543 }
17544}
17545
17546impl wkt::message::Message for NormalizedVertex {
17547 fn typename() -> &'static str {
17548 "type.googleapis.com/google.cloud.documentai.v1.NormalizedVertex"
17549 }
17550}
17551
17552/// A bounding polygon for the detected image annotation.
17553#[derive(Clone, Default, PartialEq)]
17554#[non_exhaustive]
17555pub struct BoundingPoly {
17556 /// The bounding polygon vertices.
17557 pub vertices: std::vec::Vec<crate::model::Vertex>,
17558
17559 /// The bounding polygon normalized vertices.
17560 pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
17561
17562 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17563}
17564
17565impl BoundingPoly {
17566 /// Creates a new default instance.
17567 pub fn new() -> Self {
17568 std::default::Default::default()
17569 }
17570
17571 /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
17572 ///
17573 /// # Example
17574 /// ```ignore,no_run
17575 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17576 /// use google_cloud_documentai_v1::model::Vertex;
17577 /// let x = BoundingPoly::new()
17578 /// .set_vertices([
17579 /// Vertex::default()/* use setters */,
17580 /// Vertex::default()/* use (different) setters */,
17581 /// ]);
17582 /// ```
17583 pub fn set_vertices<T, V>(mut self, v: T) -> Self
17584 where
17585 T: std::iter::IntoIterator<Item = V>,
17586 V: std::convert::Into<crate::model::Vertex>,
17587 {
17588 use std::iter::Iterator;
17589 self.vertices = v.into_iter().map(|i| i.into()).collect();
17590 self
17591 }
17592
17593 /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
17594 ///
17595 /// # Example
17596 /// ```ignore,no_run
17597 /// # use google_cloud_documentai_v1::model::BoundingPoly;
17598 /// use google_cloud_documentai_v1::model::NormalizedVertex;
17599 /// let x = BoundingPoly::new()
17600 /// .set_normalized_vertices([
17601 /// NormalizedVertex::default()/* use setters */,
17602 /// NormalizedVertex::default()/* use (different) setters */,
17603 /// ]);
17604 /// ```
17605 pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
17606 where
17607 T: std::iter::IntoIterator<Item = V>,
17608 V: std::convert::Into<crate::model::NormalizedVertex>,
17609 {
17610 use std::iter::Iterator;
17611 self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
17612 self
17613 }
17614}
17615
17616impl wkt::message::Message for BoundingPoly {
17617 fn typename() -> &'static str {
17618 "type.googleapis.com/google.cloud.documentai.v1.BoundingPoly"
17619 }
17620}
17621
17622/// The common metadata for long running operations.
17623#[derive(Clone, Default, PartialEq)]
17624#[non_exhaustive]
17625pub struct CommonOperationMetadata {
17626 /// The state of the operation.
17627 pub state: crate::model::common_operation_metadata::State,
17628
17629 /// A message providing more details about the current state of processing.
17630 pub state_message: std::string::String,
17631
17632 /// A related resource to this operation.
17633 pub resource: std::string::String,
17634
17635 /// The creation time of the operation.
17636 pub create_time: std::option::Option<wkt::Timestamp>,
17637
17638 /// The last update time of the operation.
17639 pub update_time: std::option::Option<wkt::Timestamp>,
17640
17641 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17642}
17643
17644impl CommonOperationMetadata {
17645 /// Creates a new default instance.
17646 pub fn new() -> Self {
17647 std::default::Default::default()
17648 }
17649
17650 /// Sets the value of [state][crate::model::CommonOperationMetadata::state].
17651 ///
17652 /// # Example
17653 /// ```ignore,no_run
17654 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17655 /// use google_cloud_documentai_v1::model::common_operation_metadata::State;
17656 /// let x0 = CommonOperationMetadata::new().set_state(State::Running);
17657 /// let x1 = CommonOperationMetadata::new().set_state(State::Cancelling);
17658 /// let x2 = CommonOperationMetadata::new().set_state(State::Succeeded);
17659 /// ```
17660 pub fn set_state<T: std::convert::Into<crate::model::common_operation_metadata::State>>(
17661 mut self,
17662 v: T,
17663 ) -> Self {
17664 self.state = v.into();
17665 self
17666 }
17667
17668 /// Sets the value of [state_message][crate::model::CommonOperationMetadata::state_message].
17669 ///
17670 /// # Example
17671 /// ```ignore,no_run
17672 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17673 /// let x = CommonOperationMetadata::new().set_state_message("example");
17674 /// ```
17675 pub fn set_state_message<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17676 self.state_message = v.into();
17677 self
17678 }
17679
17680 /// Sets the value of [resource][crate::model::CommonOperationMetadata::resource].
17681 ///
17682 /// # Example
17683 /// ```ignore,no_run
17684 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17685 /// let x = CommonOperationMetadata::new().set_resource("example");
17686 /// ```
17687 pub fn set_resource<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17688 self.resource = v.into();
17689 self
17690 }
17691
17692 /// Sets the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17693 ///
17694 /// # Example
17695 /// ```ignore,no_run
17696 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17697 /// use wkt::Timestamp;
17698 /// let x = CommonOperationMetadata::new().set_create_time(Timestamp::default()/* use setters */);
17699 /// ```
17700 pub fn set_create_time<T>(mut self, v: T) -> Self
17701 where
17702 T: std::convert::Into<wkt::Timestamp>,
17703 {
17704 self.create_time = std::option::Option::Some(v.into());
17705 self
17706 }
17707
17708 /// Sets or clears the value of [create_time][crate::model::CommonOperationMetadata::create_time].
17709 ///
17710 /// # Example
17711 /// ```ignore,no_run
17712 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17713 /// use wkt::Timestamp;
17714 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
17715 /// let x = CommonOperationMetadata::new().set_or_clear_create_time(None::<Timestamp>);
17716 /// ```
17717 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
17718 where
17719 T: std::convert::Into<wkt::Timestamp>,
17720 {
17721 self.create_time = v.map(|x| x.into());
17722 self
17723 }
17724
17725 /// Sets the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17726 ///
17727 /// # Example
17728 /// ```ignore,no_run
17729 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17730 /// use wkt::Timestamp;
17731 /// let x = CommonOperationMetadata::new().set_update_time(Timestamp::default()/* use setters */);
17732 /// ```
17733 pub fn set_update_time<T>(mut self, v: T) -> Self
17734 where
17735 T: std::convert::Into<wkt::Timestamp>,
17736 {
17737 self.update_time = std::option::Option::Some(v.into());
17738 self
17739 }
17740
17741 /// Sets or clears the value of [update_time][crate::model::CommonOperationMetadata::update_time].
17742 ///
17743 /// # Example
17744 /// ```ignore,no_run
17745 /// # use google_cloud_documentai_v1::model::CommonOperationMetadata;
17746 /// use wkt::Timestamp;
17747 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
17748 /// let x = CommonOperationMetadata::new().set_or_clear_update_time(None::<Timestamp>);
17749 /// ```
17750 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
17751 where
17752 T: std::convert::Into<wkt::Timestamp>,
17753 {
17754 self.update_time = v.map(|x| x.into());
17755 self
17756 }
17757}
17758
17759impl wkt::message::Message for CommonOperationMetadata {
17760 fn typename() -> &'static str {
17761 "type.googleapis.com/google.cloud.documentai.v1.CommonOperationMetadata"
17762 }
17763}
17764
17765/// Defines additional types related to [CommonOperationMetadata].
17766pub mod common_operation_metadata {
17767 #[allow(unused_imports)]
17768 use super::*;
17769
17770 /// State of the longrunning operation.
17771 ///
17772 /// # Working with unknown values
17773 ///
17774 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
17775 /// additional enum variants at any time. Adding new variants is not considered
17776 /// a breaking change. Applications should write their code in anticipation of:
17777 ///
17778 /// - New values appearing in future releases of the client library, **and**
17779 /// - New values received dynamically, without application changes.
17780 ///
17781 /// Please consult the [Working with enums] section in the user guide for some
17782 /// guidelines.
17783 ///
17784 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
17785 #[derive(Clone, Debug, PartialEq)]
17786 #[non_exhaustive]
17787 pub enum State {
17788 /// Unspecified state.
17789 Unspecified,
17790 /// Operation is still running.
17791 Running,
17792 /// Operation is being cancelled.
17793 Cancelling,
17794 /// Operation succeeded.
17795 Succeeded,
17796 /// Operation failed.
17797 Failed,
17798 /// Operation is cancelled.
17799 Cancelled,
17800 /// If set, the enum was initialized with an unknown value.
17801 ///
17802 /// Applications can examine the value using [State::value] or
17803 /// [State::name].
17804 UnknownValue(state::UnknownValue),
17805 }
17806
17807 #[doc(hidden)]
17808 pub mod state {
17809 #[allow(unused_imports)]
17810 use super::*;
17811 #[derive(Clone, Debug, PartialEq)]
17812 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
17813 }
17814
17815 impl State {
17816 /// Gets the enum value.
17817 ///
17818 /// Returns `None` if the enum contains an unknown value deserialized from
17819 /// the string representation of enums.
17820 pub fn value(&self) -> std::option::Option<i32> {
17821 match self {
17822 Self::Unspecified => std::option::Option::Some(0),
17823 Self::Running => std::option::Option::Some(1),
17824 Self::Cancelling => std::option::Option::Some(2),
17825 Self::Succeeded => std::option::Option::Some(3),
17826 Self::Failed => std::option::Option::Some(4),
17827 Self::Cancelled => std::option::Option::Some(5),
17828 Self::UnknownValue(u) => u.0.value(),
17829 }
17830 }
17831
17832 /// Gets the enum value as a string.
17833 ///
17834 /// Returns `None` if the enum contains an unknown value deserialized from
17835 /// the integer representation of enums.
17836 pub fn name(&self) -> std::option::Option<&str> {
17837 match self {
17838 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
17839 Self::Running => std::option::Option::Some("RUNNING"),
17840 Self::Cancelling => std::option::Option::Some("CANCELLING"),
17841 Self::Succeeded => std::option::Option::Some("SUCCEEDED"),
17842 Self::Failed => std::option::Option::Some("FAILED"),
17843 Self::Cancelled => std::option::Option::Some("CANCELLED"),
17844 Self::UnknownValue(u) => u.0.name(),
17845 }
17846 }
17847 }
17848
17849 impl std::default::Default for State {
17850 fn default() -> Self {
17851 use std::convert::From;
17852 Self::from(0)
17853 }
17854 }
17855
17856 impl std::fmt::Display for State {
17857 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
17858 wkt::internal::display_enum(f, self.name(), self.value())
17859 }
17860 }
17861
17862 impl std::convert::From<i32> for State {
17863 fn from(value: i32) -> Self {
17864 match value {
17865 0 => Self::Unspecified,
17866 1 => Self::Running,
17867 2 => Self::Cancelling,
17868 3 => Self::Succeeded,
17869 4 => Self::Failed,
17870 5 => Self::Cancelled,
17871 _ => Self::UnknownValue(state::UnknownValue(
17872 wkt::internal::UnknownEnumValue::Integer(value),
17873 )),
17874 }
17875 }
17876 }
17877
17878 impl std::convert::From<&str> for State {
17879 fn from(value: &str) -> Self {
17880 use std::string::ToString;
17881 match value {
17882 "STATE_UNSPECIFIED" => Self::Unspecified,
17883 "RUNNING" => Self::Running,
17884 "CANCELLING" => Self::Cancelling,
17885 "SUCCEEDED" => Self::Succeeded,
17886 "FAILED" => Self::Failed,
17887 "CANCELLED" => Self::Cancelled,
17888 _ => Self::UnknownValue(state::UnknownValue(
17889 wkt::internal::UnknownEnumValue::String(value.to_string()),
17890 )),
17891 }
17892 }
17893 }
17894
17895 impl serde::ser::Serialize for State {
17896 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
17897 where
17898 S: serde::Serializer,
17899 {
17900 match self {
17901 Self::Unspecified => serializer.serialize_i32(0),
17902 Self::Running => serializer.serialize_i32(1),
17903 Self::Cancelling => serializer.serialize_i32(2),
17904 Self::Succeeded => serializer.serialize_i32(3),
17905 Self::Failed => serializer.serialize_i32(4),
17906 Self::Cancelled => serializer.serialize_i32(5),
17907 Self::UnknownValue(u) => u.0.serialize(serializer),
17908 }
17909 }
17910 }
17911
17912 impl<'de> serde::de::Deserialize<'de> for State {
17913 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
17914 where
17915 D: serde::Deserializer<'de>,
17916 {
17917 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
17918 ".google.cloud.documentai.v1.CommonOperationMetadata.State",
17919 ))
17920 }
17921 }
17922}
17923
17924/// A processor version is an implementation of a processor. Each processor
17925/// can have multiple versions, pretrained by Google internally or uptrained
17926/// by the customer. A processor can only have one default version at a time.
17927/// Its document-processing behavior is defined by that version.
17928#[derive(Clone, Default, PartialEq)]
17929#[non_exhaustive]
17930pub struct ProcessorVersion {
17931 /// Identifier. The resource name of the processor version.
17932 /// Format:
17933 /// `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
17934 pub name: std::string::String,
17935
17936 /// The display name of the processor version.
17937 pub display_name: std::string::String,
17938
17939 /// Output only. The schema of the processor version. Describes the output.
17940 pub document_schema: std::option::Option<crate::model::DocumentSchema>,
17941
17942 /// Output only. The state of the processor version.
17943 pub state: crate::model::processor_version::State,
17944
17945 /// Output only. The time the processor version was created.
17946 pub create_time: std::option::Option<wkt::Timestamp>,
17947
17948 /// Output only. The most recently invoked evaluation for the processor
17949 /// version.
17950 pub latest_evaluation: std::option::Option<crate::model::EvaluationReference>,
17951
17952 /// Output only. The KMS key name used for encryption.
17953 pub kms_key_name: std::string::String,
17954
17955 /// Output only. The KMS key version with which data is encrypted.
17956 pub kms_key_version_name: std::string::String,
17957
17958 /// Output only. Denotes that this `ProcessorVersion` is managed by Google.
17959 pub google_managed: bool,
17960
17961 /// Output only. If set, information about the eventual deprecation of this
17962 /// version.
17963 pub deprecation_info: std::option::Option<crate::model::processor_version::DeprecationInfo>,
17964
17965 /// Output only. The model type of this processor version.
17966 pub model_type: crate::model::processor_version::ModelType,
17967
17968 /// Output only. Reserved for future use.
17969 pub satisfies_pzs: bool,
17970
17971 /// Output only. Reserved for future use.
17972 pub satisfies_pzi: bool,
17973
17974 /// Output only. Information about Generative AI model-based processor
17975 /// versions.
17976 pub gen_ai_model_info: std::option::Option<crate::model::processor_version::GenAiModelInfo>,
17977
17978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
17979}
17980
17981impl ProcessorVersion {
17982 /// Creates a new default instance.
17983 pub fn new() -> Self {
17984 std::default::Default::default()
17985 }
17986
17987 /// Sets the value of [name][crate::model::ProcessorVersion::name].
17988 ///
17989 /// # Example
17990 /// ```ignore,no_run
17991 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
17992 /// # let project_id = "project_id";
17993 /// # let location_id = "location_id";
17994 /// # let processor_id = "processor_id";
17995 /// # let processor_version_id = "processor_version_id";
17996 /// let x = ProcessorVersion::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
17997 /// ```
17998 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
17999 self.name = v.into();
18000 self
18001 }
18002
18003 /// Sets the value of [display_name][crate::model::ProcessorVersion::display_name].
18004 ///
18005 /// # Example
18006 /// ```ignore,no_run
18007 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18008 /// let x = ProcessorVersion::new().set_display_name("example");
18009 /// ```
18010 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18011 self.display_name = v.into();
18012 self
18013 }
18014
18015 /// Sets the value of [document_schema][crate::model::ProcessorVersion::document_schema].
18016 ///
18017 /// # Example
18018 /// ```ignore,no_run
18019 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18020 /// use google_cloud_documentai_v1::model::DocumentSchema;
18021 /// let x = ProcessorVersion::new().set_document_schema(DocumentSchema::default()/* use setters */);
18022 /// ```
18023 pub fn set_document_schema<T>(mut self, v: T) -> Self
18024 where
18025 T: std::convert::Into<crate::model::DocumentSchema>,
18026 {
18027 self.document_schema = std::option::Option::Some(v.into());
18028 self
18029 }
18030
18031 /// Sets or clears the value of [document_schema][crate::model::ProcessorVersion::document_schema].
18032 ///
18033 /// # Example
18034 /// ```ignore,no_run
18035 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18036 /// use google_cloud_documentai_v1::model::DocumentSchema;
18037 /// let x = ProcessorVersion::new().set_or_clear_document_schema(Some(DocumentSchema::default()/* use setters */));
18038 /// let x = ProcessorVersion::new().set_or_clear_document_schema(None::<DocumentSchema>);
18039 /// ```
18040 pub fn set_or_clear_document_schema<T>(mut self, v: std::option::Option<T>) -> Self
18041 where
18042 T: std::convert::Into<crate::model::DocumentSchema>,
18043 {
18044 self.document_schema = v.map(|x| x.into());
18045 self
18046 }
18047
18048 /// Sets the value of [state][crate::model::ProcessorVersion::state].
18049 ///
18050 /// # Example
18051 /// ```ignore,no_run
18052 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18053 /// use google_cloud_documentai_v1::model::processor_version::State;
18054 /// let x0 = ProcessorVersion::new().set_state(State::Deployed);
18055 /// let x1 = ProcessorVersion::new().set_state(State::Deploying);
18056 /// let x2 = ProcessorVersion::new().set_state(State::Undeployed);
18057 /// ```
18058 pub fn set_state<T: std::convert::Into<crate::model::processor_version::State>>(
18059 mut self,
18060 v: T,
18061 ) -> Self {
18062 self.state = v.into();
18063 self
18064 }
18065
18066 /// Sets the value of [create_time][crate::model::ProcessorVersion::create_time].
18067 ///
18068 /// # Example
18069 /// ```ignore,no_run
18070 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18071 /// use wkt::Timestamp;
18072 /// let x = ProcessorVersion::new().set_create_time(Timestamp::default()/* use setters */);
18073 /// ```
18074 pub fn set_create_time<T>(mut self, v: T) -> Self
18075 where
18076 T: std::convert::Into<wkt::Timestamp>,
18077 {
18078 self.create_time = std::option::Option::Some(v.into());
18079 self
18080 }
18081
18082 /// Sets or clears the value of [create_time][crate::model::ProcessorVersion::create_time].
18083 ///
18084 /// # Example
18085 /// ```ignore,no_run
18086 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18087 /// use wkt::Timestamp;
18088 /// let x = ProcessorVersion::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
18089 /// let x = ProcessorVersion::new().set_or_clear_create_time(None::<Timestamp>);
18090 /// ```
18091 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
18092 where
18093 T: std::convert::Into<wkt::Timestamp>,
18094 {
18095 self.create_time = v.map(|x| x.into());
18096 self
18097 }
18098
18099 /// Sets the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
18100 ///
18101 /// # Example
18102 /// ```ignore,no_run
18103 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18104 /// use google_cloud_documentai_v1::model::EvaluationReference;
18105 /// let x = ProcessorVersion::new().set_latest_evaluation(EvaluationReference::default()/* use setters */);
18106 /// ```
18107 pub fn set_latest_evaluation<T>(mut self, v: T) -> Self
18108 where
18109 T: std::convert::Into<crate::model::EvaluationReference>,
18110 {
18111 self.latest_evaluation = std::option::Option::Some(v.into());
18112 self
18113 }
18114
18115 /// Sets or clears the value of [latest_evaluation][crate::model::ProcessorVersion::latest_evaluation].
18116 ///
18117 /// # Example
18118 /// ```ignore,no_run
18119 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18120 /// use google_cloud_documentai_v1::model::EvaluationReference;
18121 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(Some(EvaluationReference::default()/* use setters */));
18122 /// let x = ProcessorVersion::new().set_or_clear_latest_evaluation(None::<EvaluationReference>);
18123 /// ```
18124 pub fn set_or_clear_latest_evaluation<T>(mut self, v: std::option::Option<T>) -> Self
18125 where
18126 T: std::convert::Into<crate::model::EvaluationReference>,
18127 {
18128 self.latest_evaluation = v.map(|x| x.into());
18129 self
18130 }
18131
18132 /// Sets the value of [kms_key_name][crate::model::ProcessorVersion::kms_key_name].
18133 ///
18134 /// # Example
18135 /// ```ignore,no_run
18136 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18137 /// let x = ProcessorVersion::new().set_kms_key_name("example");
18138 /// ```
18139 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
18140 self.kms_key_name = v.into();
18141 self
18142 }
18143
18144 /// Sets the value of [kms_key_version_name][crate::model::ProcessorVersion::kms_key_version_name].
18145 ///
18146 /// # Example
18147 /// ```ignore,no_run
18148 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18149 /// let x = ProcessorVersion::new().set_kms_key_version_name("example");
18150 /// ```
18151 pub fn set_kms_key_version_name<T: std::convert::Into<std::string::String>>(
18152 mut self,
18153 v: T,
18154 ) -> Self {
18155 self.kms_key_version_name = v.into();
18156 self
18157 }
18158
18159 /// Sets the value of [google_managed][crate::model::ProcessorVersion::google_managed].
18160 ///
18161 /// # Example
18162 /// ```ignore,no_run
18163 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18164 /// let x = ProcessorVersion::new().set_google_managed(true);
18165 /// ```
18166 pub fn set_google_managed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18167 self.google_managed = v.into();
18168 self
18169 }
18170
18171 /// Sets the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
18172 ///
18173 /// # Example
18174 /// ```ignore,no_run
18175 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18176 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18177 /// let x = ProcessorVersion::new().set_deprecation_info(DeprecationInfo::default()/* use setters */);
18178 /// ```
18179 pub fn set_deprecation_info<T>(mut self, v: T) -> Self
18180 where
18181 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
18182 {
18183 self.deprecation_info = std::option::Option::Some(v.into());
18184 self
18185 }
18186
18187 /// Sets or clears the value of [deprecation_info][crate::model::ProcessorVersion::deprecation_info].
18188 ///
18189 /// # Example
18190 /// ```ignore,no_run
18191 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18192 /// use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18193 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(Some(DeprecationInfo::default()/* use setters */));
18194 /// let x = ProcessorVersion::new().set_or_clear_deprecation_info(None::<DeprecationInfo>);
18195 /// ```
18196 pub fn set_or_clear_deprecation_info<T>(mut self, v: std::option::Option<T>) -> Self
18197 where
18198 T: std::convert::Into<crate::model::processor_version::DeprecationInfo>,
18199 {
18200 self.deprecation_info = v.map(|x| x.into());
18201 self
18202 }
18203
18204 /// Sets the value of [model_type][crate::model::ProcessorVersion::model_type].
18205 ///
18206 /// # Example
18207 /// ```ignore,no_run
18208 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18209 /// use google_cloud_documentai_v1::model::processor_version::ModelType;
18210 /// let x0 = ProcessorVersion::new().set_model_type(ModelType::Generative);
18211 /// let x1 = ProcessorVersion::new().set_model_type(ModelType::Custom);
18212 /// ```
18213 pub fn set_model_type<T: std::convert::Into<crate::model::processor_version::ModelType>>(
18214 mut self,
18215 v: T,
18216 ) -> Self {
18217 self.model_type = v.into();
18218 self
18219 }
18220
18221 /// Sets the value of [satisfies_pzs][crate::model::ProcessorVersion::satisfies_pzs].
18222 ///
18223 /// # Example
18224 /// ```ignore,no_run
18225 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18226 /// let x = ProcessorVersion::new().set_satisfies_pzs(true);
18227 /// ```
18228 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18229 self.satisfies_pzs = v.into();
18230 self
18231 }
18232
18233 /// Sets the value of [satisfies_pzi][crate::model::ProcessorVersion::satisfies_pzi].
18234 ///
18235 /// # Example
18236 /// ```ignore,no_run
18237 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18238 /// let x = ProcessorVersion::new().set_satisfies_pzi(true);
18239 /// ```
18240 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18241 self.satisfies_pzi = v.into();
18242 self
18243 }
18244
18245 /// Sets the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18246 ///
18247 /// # Example
18248 /// ```ignore,no_run
18249 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18250 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18251 /// let x = ProcessorVersion::new().set_gen_ai_model_info(GenAiModelInfo::default()/* use setters */);
18252 /// ```
18253 pub fn set_gen_ai_model_info<T>(mut self, v: T) -> Self
18254 where
18255 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18256 {
18257 self.gen_ai_model_info = std::option::Option::Some(v.into());
18258 self
18259 }
18260
18261 /// Sets or clears the value of [gen_ai_model_info][crate::model::ProcessorVersion::gen_ai_model_info].
18262 ///
18263 /// # Example
18264 /// ```ignore,no_run
18265 /// # use google_cloud_documentai_v1::model::ProcessorVersion;
18266 /// use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18267 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(Some(GenAiModelInfo::default()/* use setters */));
18268 /// let x = ProcessorVersion::new().set_or_clear_gen_ai_model_info(None::<GenAiModelInfo>);
18269 /// ```
18270 pub fn set_or_clear_gen_ai_model_info<T>(mut self, v: std::option::Option<T>) -> Self
18271 where
18272 T: std::convert::Into<crate::model::processor_version::GenAiModelInfo>,
18273 {
18274 self.gen_ai_model_info = v.map(|x| x.into());
18275 self
18276 }
18277}
18278
18279impl wkt::message::Message for ProcessorVersion {
18280 fn typename() -> &'static str {
18281 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion"
18282 }
18283}
18284
18285/// Defines additional types related to [ProcessorVersion].
18286pub mod processor_version {
18287 #[allow(unused_imports)]
18288 use super::*;
18289
18290 /// Information about the upcoming deprecation of this processor version.
18291 #[derive(Clone, Default, PartialEq)]
18292 #[non_exhaustive]
18293 pub struct DeprecationInfo {
18294 /// The time at which this processor version will be deprecated.
18295 pub deprecation_time: std::option::Option<wkt::Timestamp>,
18296
18297 /// If set, the processor version that will be used as a replacement.
18298 pub replacement_processor_version: std::string::String,
18299
18300 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18301 }
18302
18303 impl DeprecationInfo {
18304 /// Creates a new default instance.
18305 pub fn new() -> Self {
18306 std::default::Default::default()
18307 }
18308
18309 /// Sets the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18310 ///
18311 /// # Example
18312 /// ```ignore,no_run
18313 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18314 /// use wkt::Timestamp;
18315 /// let x = DeprecationInfo::new().set_deprecation_time(Timestamp::default()/* use setters */);
18316 /// ```
18317 pub fn set_deprecation_time<T>(mut self, v: T) -> Self
18318 where
18319 T: std::convert::Into<wkt::Timestamp>,
18320 {
18321 self.deprecation_time = std::option::Option::Some(v.into());
18322 self
18323 }
18324
18325 /// Sets or clears the value of [deprecation_time][crate::model::processor_version::DeprecationInfo::deprecation_time].
18326 ///
18327 /// # Example
18328 /// ```ignore,no_run
18329 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18330 /// use wkt::Timestamp;
18331 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(Some(Timestamp::default()/* use setters */));
18332 /// let x = DeprecationInfo::new().set_or_clear_deprecation_time(None::<Timestamp>);
18333 /// ```
18334 pub fn set_or_clear_deprecation_time<T>(mut self, v: std::option::Option<T>) -> Self
18335 where
18336 T: std::convert::Into<wkt::Timestamp>,
18337 {
18338 self.deprecation_time = v.map(|x| x.into());
18339 self
18340 }
18341
18342 /// Sets the value of [replacement_processor_version][crate::model::processor_version::DeprecationInfo::replacement_processor_version].
18343 ///
18344 /// # Example
18345 /// ```ignore,no_run
18346 /// # use google_cloud_documentai_v1::model::processor_version::DeprecationInfo;
18347 /// # let project_id = "project_id";
18348 /// # let location_id = "location_id";
18349 /// # let processor_id = "processor_id";
18350 /// # let processor_version_id = "processor_version_id";
18351 /// let x = DeprecationInfo::new().set_replacement_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
18352 /// ```
18353 pub fn set_replacement_processor_version<T: std::convert::Into<std::string::String>>(
18354 mut self,
18355 v: T,
18356 ) -> Self {
18357 self.replacement_processor_version = v.into();
18358 self
18359 }
18360 }
18361
18362 impl wkt::message::Message for DeprecationInfo {
18363 fn typename() -> &'static str {
18364 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.DeprecationInfo"
18365 }
18366 }
18367
18368 /// Information about Generative AI model-based processor versions.
18369 #[derive(Clone, Default, PartialEq)]
18370 #[non_exhaustive]
18371 pub struct GenAiModelInfo {
18372 /// The processor version is either a pretrained Google-managed foundation
18373 /// model or a custom Generative AI model created by the user.
18374 pub model_info:
18375 std::option::Option<crate::model::processor_version::gen_ai_model_info::ModelInfo>,
18376
18377 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18378 }
18379
18380 impl GenAiModelInfo {
18381 /// Creates a new default instance.
18382 pub fn new() -> Self {
18383 std::default::Default::default()
18384 }
18385
18386 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info].
18387 ///
18388 /// Note that all the setters affecting `model_info` are mutually
18389 /// exclusive.
18390 ///
18391 /// # Example
18392 /// ```ignore,no_run
18393 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18394 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18395 /// let x = GenAiModelInfo::new().set_model_info(Some(
18396 /// google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(FoundationGenAiModelInfo::default().into())));
18397 /// ```
18398 pub fn set_model_info<
18399 T: std::convert::Into<
18400 std::option::Option<
18401 crate::model::processor_version::gen_ai_model_info::ModelInfo,
18402 >,
18403 >,
18404 >(
18405 mut self,
18406 v: T,
18407 ) -> Self {
18408 self.model_info = v.into();
18409 self
18410 }
18411
18412 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18413 /// if it holds a `FoundationGenAiModelInfo`, `None` if the field is not set or
18414 /// holds a different branch.
18415 pub fn foundation_gen_ai_model_info(
18416 &self,
18417 ) -> std::option::Option<
18418 &std::boxed::Box<
18419 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18420 >,
18421 > {
18422 #[allow(unreachable_patterns)]
18423 self.model_info.as_ref().and_then(|v| match v {
18424 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(v) => std::option::Option::Some(v),
18425 _ => std::option::Option::None,
18426 })
18427 }
18428
18429 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18430 /// to hold a `FoundationGenAiModelInfo`.
18431 ///
18432 /// Note that all the setters affecting `model_info` are
18433 /// mutually exclusive.
18434 ///
18435 /// # Example
18436 /// ```ignore,no_run
18437 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18438 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18439 /// let x = GenAiModelInfo::new().set_foundation_gen_ai_model_info(FoundationGenAiModelInfo::default()/* use setters */);
18440 /// assert!(x.foundation_gen_ai_model_info().is_some());
18441 /// assert!(x.custom_gen_ai_model_info().is_none());
18442 /// ```
18443 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{
18444 self.model_info = std::option::Option::Some(
18445 crate::model::processor_version::gen_ai_model_info::ModelInfo::FoundationGenAiModelInfo(
18446 v.into()
18447 )
18448 );
18449 self
18450 }
18451
18452 /// The value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18453 /// if it holds a `CustomGenAiModelInfo`, `None` if the field is not set or
18454 /// holds a different branch.
18455 pub fn custom_gen_ai_model_info(
18456 &self,
18457 ) -> std::option::Option<
18458 &std::boxed::Box<
18459 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18460 >,
18461 > {
18462 #[allow(unreachable_patterns)]
18463 self.model_info.as_ref().and_then(|v| match v {
18464 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(v) => std::option::Option::Some(v),
18465 _ => std::option::Option::None,
18466 })
18467 }
18468
18469 /// Sets the value of [model_info][crate::model::processor_version::GenAiModelInfo::model_info]
18470 /// to hold a `CustomGenAiModelInfo`.
18471 ///
18472 /// Note that all the setters affecting `model_info` are
18473 /// mutually exclusive.
18474 ///
18475 /// # Example
18476 /// ```ignore,no_run
18477 /// # use google_cloud_documentai_v1::model::processor_version::GenAiModelInfo;
18478 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18479 /// let x = GenAiModelInfo::new().set_custom_gen_ai_model_info(CustomGenAiModelInfo::default()/* use setters */);
18480 /// assert!(x.custom_gen_ai_model_info().is_some());
18481 /// assert!(x.foundation_gen_ai_model_info().is_none());
18482 /// ```
18483 pub fn set_custom_gen_ai_model_info<
18484 T: std::convert::Into<
18485 std::boxed::Box<
18486 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18487 >,
18488 >,
18489 >(
18490 mut self,
18491 v: T,
18492 ) -> Self {
18493 self.model_info = std::option::Option::Some(
18494 crate::model::processor_version::gen_ai_model_info::ModelInfo::CustomGenAiModelInfo(
18495 v.into(),
18496 ),
18497 );
18498 self
18499 }
18500 }
18501
18502 impl wkt::message::Message for GenAiModelInfo {
18503 fn typename() -> &'static str {
18504 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo"
18505 }
18506 }
18507
18508 /// Defines additional types related to [GenAiModelInfo].
18509 pub mod gen_ai_model_info {
18510 #[allow(unused_imports)]
18511 use super::*;
18512
18513 /// Information for a pretrained Google-managed foundation model.
18514 #[derive(Clone, Default, PartialEq)]
18515 #[non_exhaustive]
18516 pub struct FoundationGenAiModelInfo {
18517 /// Whether finetuning is allowed for this base processor version.
18518 pub finetuning_allowed: bool,
18519
18520 /// The minimum number of labeled documents in the training dataset
18521 /// required for finetuning.
18522 pub min_train_labeled_documents: i32,
18523
18524 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18525 }
18526
18527 impl FoundationGenAiModelInfo {
18528 /// Creates a new default instance.
18529 pub fn new() -> Self {
18530 std::default::Default::default()
18531 }
18532
18533 /// Sets the value of [finetuning_allowed][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::finetuning_allowed].
18534 ///
18535 /// # Example
18536 /// ```ignore,no_run
18537 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18538 /// let x = FoundationGenAiModelInfo::new().set_finetuning_allowed(true);
18539 /// ```
18540 pub fn set_finetuning_allowed<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
18541 self.finetuning_allowed = v.into();
18542 self
18543 }
18544
18545 /// Sets the value of [min_train_labeled_documents][crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo::min_train_labeled_documents].
18546 ///
18547 /// # Example
18548 /// ```ignore,no_run
18549 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo;
18550 /// let x = FoundationGenAiModelInfo::new().set_min_train_labeled_documents(42);
18551 /// ```
18552 pub fn set_min_train_labeled_documents<T: std::convert::Into<i32>>(
18553 mut self,
18554 v: T,
18555 ) -> Self {
18556 self.min_train_labeled_documents = v.into();
18557 self
18558 }
18559 }
18560
18561 impl wkt::message::Message for FoundationGenAiModelInfo {
18562 fn typename() -> &'static str {
18563 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.FoundationGenAiModelInfo"
18564 }
18565 }
18566
18567 /// Information for a custom Generative AI model created by the user. These
18568 /// are created with `Create New Version` in either the `Call foundation
18569 /// model` or `Fine tuning` tabs.
18570 #[derive(Clone, Default, PartialEq)]
18571 #[non_exhaustive]
18572 pub struct CustomGenAiModelInfo {
18573
18574 /// The type of custom model created by the user.
18575 pub custom_model_type: crate::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType,
18576
18577 /// The base processor version ID for the custom model.
18578 pub base_processor_version_id: std::string::String,
18579
18580 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
18581 }
18582
18583 impl CustomGenAiModelInfo {
18584 /// Creates a new default instance.
18585 pub fn new() -> Self {
18586 std::default::Default::default()
18587 }
18588
18589 /// Sets the value of [custom_model_type][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::custom_model_type].
18590 ///
18591 /// # Example
18592 /// ```ignore,no_run
18593 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18594 /// use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::custom_gen_ai_model_info::CustomModelType;
18595 /// let x0 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::VersionedFoundation);
18596 /// let x1 = CustomGenAiModelInfo::new().set_custom_model_type(CustomModelType::FineTuned);
18597 /// ```
18598 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{
18599 self.custom_model_type = v.into();
18600 self
18601 }
18602
18603 /// Sets the value of [base_processor_version_id][crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo::base_processor_version_id].
18604 ///
18605 /// # Example
18606 /// ```ignore,no_run
18607 /// # use google_cloud_documentai_v1::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo;
18608 /// let x = CustomGenAiModelInfo::new().set_base_processor_version_id("example");
18609 /// ```
18610 pub fn set_base_processor_version_id<T: std::convert::Into<std::string::String>>(
18611 mut self,
18612 v: T,
18613 ) -> Self {
18614 self.base_processor_version_id = v.into();
18615 self
18616 }
18617 }
18618
18619 impl wkt::message::Message for CustomGenAiModelInfo {
18620 fn typename() -> &'static str {
18621 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo"
18622 }
18623 }
18624
18625 /// Defines additional types related to [CustomGenAiModelInfo].
18626 pub mod custom_gen_ai_model_info {
18627 #[allow(unused_imports)]
18628 use super::*;
18629
18630 /// The type of custom model created by the user.
18631 ///
18632 /// # Working with unknown values
18633 ///
18634 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18635 /// additional enum variants at any time. Adding new variants is not considered
18636 /// a breaking change. Applications should write their code in anticipation of:
18637 ///
18638 /// - New values appearing in future releases of the client library, **and**
18639 /// - New values received dynamically, without application changes.
18640 ///
18641 /// Please consult the [Working with enums] section in the user guide for some
18642 /// guidelines.
18643 ///
18644 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18645 #[derive(Clone, Debug, PartialEq)]
18646 #[non_exhaustive]
18647 pub enum CustomModelType {
18648 /// The model type is unspecified.
18649 Unspecified,
18650 /// The model is a versioned foundation model.
18651 VersionedFoundation,
18652 /// The model is a finetuned foundation model.
18653 FineTuned,
18654 /// If set, the enum was initialized with an unknown value.
18655 ///
18656 /// Applications can examine the value using [CustomModelType::value] or
18657 /// [CustomModelType::name].
18658 UnknownValue(custom_model_type::UnknownValue),
18659 }
18660
18661 #[doc(hidden)]
18662 pub mod custom_model_type {
18663 #[allow(unused_imports)]
18664 use super::*;
18665 #[derive(Clone, Debug, PartialEq)]
18666 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18667 }
18668
18669 impl CustomModelType {
18670 /// Gets the enum value.
18671 ///
18672 /// Returns `None` if the enum contains an unknown value deserialized from
18673 /// the string representation of enums.
18674 pub fn value(&self) -> std::option::Option<i32> {
18675 match self {
18676 Self::Unspecified => std::option::Option::Some(0),
18677 Self::VersionedFoundation => std::option::Option::Some(1),
18678 Self::FineTuned => std::option::Option::Some(2),
18679 Self::UnknownValue(u) => u.0.value(),
18680 }
18681 }
18682
18683 /// Gets the enum value as a string.
18684 ///
18685 /// Returns `None` if the enum contains an unknown value deserialized from
18686 /// the integer representation of enums.
18687 pub fn name(&self) -> std::option::Option<&str> {
18688 match self {
18689 Self::Unspecified => {
18690 std::option::Option::Some("CUSTOM_MODEL_TYPE_UNSPECIFIED")
18691 }
18692 Self::VersionedFoundation => {
18693 std::option::Option::Some("VERSIONED_FOUNDATION")
18694 }
18695 Self::FineTuned => std::option::Option::Some("FINE_TUNED"),
18696 Self::UnknownValue(u) => u.0.name(),
18697 }
18698 }
18699 }
18700
18701 impl std::default::Default for CustomModelType {
18702 fn default() -> Self {
18703 use std::convert::From;
18704 Self::from(0)
18705 }
18706 }
18707
18708 impl std::fmt::Display for CustomModelType {
18709 fn fmt(
18710 &self,
18711 f: &mut std::fmt::Formatter<'_>,
18712 ) -> std::result::Result<(), std::fmt::Error> {
18713 wkt::internal::display_enum(f, self.name(), self.value())
18714 }
18715 }
18716
18717 impl std::convert::From<i32> for CustomModelType {
18718 fn from(value: i32) -> Self {
18719 match value {
18720 0 => Self::Unspecified,
18721 1 => Self::VersionedFoundation,
18722 2 => Self::FineTuned,
18723 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18724 wkt::internal::UnknownEnumValue::Integer(value),
18725 )),
18726 }
18727 }
18728 }
18729
18730 impl std::convert::From<&str> for CustomModelType {
18731 fn from(value: &str) -> Self {
18732 use std::string::ToString;
18733 match value {
18734 "CUSTOM_MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
18735 "VERSIONED_FOUNDATION" => Self::VersionedFoundation,
18736 "FINE_TUNED" => Self::FineTuned,
18737 _ => Self::UnknownValue(custom_model_type::UnknownValue(
18738 wkt::internal::UnknownEnumValue::String(value.to_string()),
18739 )),
18740 }
18741 }
18742 }
18743
18744 impl serde::ser::Serialize for CustomModelType {
18745 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18746 where
18747 S: serde::Serializer,
18748 {
18749 match self {
18750 Self::Unspecified => serializer.serialize_i32(0),
18751 Self::VersionedFoundation => serializer.serialize_i32(1),
18752 Self::FineTuned => serializer.serialize_i32(2),
18753 Self::UnknownValue(u) => u.0.serialize(serializer),
18754 }
18755 }
18756 }
18757
18758 impl<'de> serde::de::Deserialize<'de> for CustomModelType {
18759 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18760 where
18761 D: serde::Deserializer<'de>,
18762 {
18763 deserializer.deserialize_any(wkt::internal::EnumVisitor::<CustomModelType>::new(
18764 ".google.cloud.documentai.v1.ProcessorVersion.GenAiModelInfo.CustomGenAiModelInfo.CustomModelType"))
18765 }
18766 }
18767 }
18768
18769 /// The processor version is either a pretrained Google-managed foundation
18770 /// model or a custom Generative AI model created by the user.
18771 #[derive(Clone, Debug, PartialEq)]
18772 #[non_exhaustive]
18773 pub enum ModelInfo {
18774 /// Information for a pretrained Google-managed foundation model.
18775 FoundationGenAiModelInfo(
18776 std::boxed::Box<
18777 crate::model::processor_version::gen_ai_model_info::FoundationGenAiModelInfo,
18778 >,
18779 ),
18780 /// Information for a custom Generative AI model created by the user.
18781 CustomGenAiModelInfo(
18782 std::boxed::Box<
18783 crate::model::processor_version::gen_ai_model_info::CustomGenAiModelInfo,
18784 >,
18785 ),
18786 }
18787 }
18788
18789 /// The possible states of the processor version.
18790 ///
18791 /// # Working with unknown values
18792 ///
18793 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18794 /// additional enum variants at any time. Adding new variants is not considered
18795 /// a breaking change. Applications should write their code in anticipation of:
18796 ///
18797 /// - New values appearing in future releases of the client library, **and**
18798 /// - New values received dynamically, without application changes.
18799 ///
18800 /// Please consult the [Working with enums] section in the user guide for some
18801 /// guidelines.
18802 ///
18803 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18804 #[derive(Clone, Debug, PartialEq)]
18805 #[non_exhaustive]
18806 pub enum State {
18807 /// The processor version is in an unspecified state.
18808 Unspecified,
18809 /// The processor version is deployed and can be used for processing.
18810 Deployed,
18811 /// The processor version is being deployed.
18812 Deploying,
18813 /// The processor version is not deployed and cannot be used for processing.
18814 Undeployed,
18815 /// The processor version is being undeployed.
18816 Undeploying,
18817 /// The processor version is being created.
18818 Creating,
18819 /// The processor version is being deleted.
18820 Deleting,
18821 /// The processor version failed and is in an indeterminate state.
18822 Failed,
18823 /// The processor version is being imported.
18824 Importing,
18825 /// If set, the enum was initialized with an unknown value.
18826 ///
18827 /// Applications can examine the value using [State::value] or
18828 /// [State::name].
18829 UnknownValue(state::UnknownValue),
18830 }
18831
18832 #[doc(hidden)]
18833 pub mod state {
18834 #[allow(unused_imports)]
18835 use super::*;
18836 #[derive(Clone, Debug, PartialEq)]
18837 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
18838 }
18839
18840 impl State {
18841 /// Gets the enum value.
18842 ///
18843 /// Returns `None` if the enum contains an unknown value deserialized from
18844 /// the string representation of enums.
18845 pub fn value(&self) -> std::option::Option<i32> {
18846 match self {
18847 Self::Unspecified => std::option::Option::Some(0),
18848 Self::Deployed => std::option::Option::Some(1),
18849 Self::Deploying => std::option::Option::Some(2),
18850 Self::Undeployed => std::option::Option::Some(3),
18851 Self::Undeploying => std::option::Option::Some(4),
18852 Self::Creating => std::option::Option::Some(5),
18853 Self::Deleting => std::option::Option::Some(6),
18854 Self::Failed => std::option::Option::Some(7),
18855 Self::Importing => std::option::Option::Some(8),
18856 Self::UnknownValue(u) => u.0.value(),
18857 }
18858 }
18859
18860 /// Gets the enum value as a string.
18861 ///
18862 /// Returns `None` if the enum contains an unknown value deserialized from
18863 /// the integer representation of enums.
18864 pub fn name(&self) -> std::option::Option<&str> {
18865 match self {
18866 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
18867 Self::Deployed => std::option::Option::Some("DEPLOYED"),
18868 Self::Deploying => std::option::Option::Some("DEPLOYING"),
18869 Self::Undeployed => std::option::Option::Some("UNDEPLOYED"),
18870 Self::Undeploying => std::option::Option::Some("UNDEPLOYING"),
18871 Self::Creating => std::option::Option::Some("CREATING"),
18872 Self::Deleting => std::option::Option::Some("DELETING"),
18873 Self::Failed => std::option::Option::Some("FAILED"),
18874 Self::Importing => std::option::Option::Some("IMPORTING"),
18875 Self::UnknownValue(u) => u.0.name(),
18876 }
18877 }
18878 }
18879
18880 impl std::default::Default for State {
18881 fn default() -> Self {
18882 use std::convert::From;
18883 Self::from(0)
18884 }
18885 }
18886
18887 impl std::fmt::Display for State {
18888 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
18889 wkt::internal::display_enum(f, self.name(), self.value())
18890 }
18891 }
18892
18893 impl std::convert::From<i32> for State {
18894 fn from(value: i32) -> Self {
18895 match value {
18896 0 => Self::Unspecified,
18897 1 => Self::Deployed,
18898 2 => Self::Deploying,
18899 3 => Self::Undeployed,
18900 4 => Self::Undeploying,
18901 5 => Self::Creating,
18902 6 => Self::Deleting,
18903 7 => Self::Failed,
18904 8 => Self::Importing,
18905 _ => Self::UnknownValue(state::UnknownValue(
18906 wkt::internal::UnknownEnumValue::Integer(value),
18907 )),
18908 }
18909 }
18910 }
18911
18912 impl std::convert::From<&str> for State {
18913 fn from(value: &str) -> Self {
18914 use std::string::ToString;
18915 match value {
18916 "STATE_UNSPECIFIED" => Self::Unspecified,
18917 "DEPLOYED" => Self::Deployed,
18918 "DEPLOYING" => Self::Deploying,
18919 "UNDEPLOYED" => Self::Undeployed,
18920 "UNDEPLOYING" => Self::Undeploying,
18921 "CREATING" => Self::Creating,
18922 "DELETING" => Self::Deleting,
18923 "FAILED" => Self::Failed,
18924 "IMPORTING" => Self::Importing,
18925 _ => Self::UnknownValue(state::UnknownValue(
18926 wkt::internal::UnknownEnumValue::String(value.to_string()),
18927 )),
18928 }
18929 }
18930 }
18931
18932 impl serde::ser::Serialize for State {
18933 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
18934 where
18935 S: serde::Serializer,
18936 {
18937 match self {
18938 Self::Unspecified => serializer.serialize_i32(0),
18939 Self::Deployed => serializer.serialize_i32(1),
18940 Self::Deploying => serializer.serialize_i32(2),
18941 Self::Undeployed => serializer.serialize_i32(3),
18942 Self::Undeploying => serializer.serialize_i32(4),
18943 Self::Creating => serializer.serialize_i32(5),
18944 Self::Deleting => serializer.serialize_i32(6),
18945 Self::Failed => serializer.serialize_i32(7),
18946 Self::Importing => serializer.serialize_i32(8),
18947 Self::UnknownValue(u) => u.0.serialize(serializer),
18948 }
18949 }
18950 }
18951
18952 impl<'de> serde::de::Deserialize<'de> for State {
18953 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
18954 where
18955 D: serde::Deserializer<'de>,
18956 {
18957 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
18958 ".google.cloud.documentai.v1.ProcessorVersion.State",
18959 ))
18960 }
18961 }
18962
18963 /// The possible model types of the processor version.
18964 ///
18965 /// # Working with unknown values
18966 ///
18967 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
18968 /// additional enum variants at any time. Adding new variants is not considered
18969 /// a breaking change. Applications should write their code in anticipation of:
18970 ///
18971 /// - New values appearing in future releases of the client library, **and**
18972 /// - New values received dynamically, without application changes.
18973 ///
18974 /// Please consult the [Working with enums] section in the user guide for some
18975 /// guidelines.
18976 ///
18977 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
18978 #[derive(Clone, Debug, PartialEq)]
18979 #[non_exhaustive]
18980 pub enum ModelType {
18981 /// The processor version has unspecified model type.
18982 Unspecified,
18983 /// The processor version has generative model type.
18984 Generative,
18985 /// The processor version has custom model type.
18986 Custom,
18987 /// If set, the enum was initialized with an unknown value.
18988 ///
18989 /// Applications can examine the value using [ModelType::value] or
18990 /// [ModelType::name].
18991 UnknownValue(model_type::UnknownValue),
18992 }
18993
18994 #[doc(hidden)]
18995 pub mod model_type {
18996 #[allow(unused_imports)]
18997 use super::*;
18998 #[derive(Clone, Debug, PartialEq)]
18999 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19000 }
19001
19002 impl ModelType {
19003 /// Gets the enum value.
19004 ///
19005 /// Returns `None` if the enum contains an unknown value deserialized from
19006 /// the string representation of enums.
19007 pub fn value(&self) -> std::option::Option<i32> {
19008 match self {
19009 Self::Unspecified => std::option::Option::Some(0),
19010 Self::Generative => std::option::Option::Some(1),
19011 Self::Custom => std::option::Option::Some(2),
19012 Self::UnknownValue(u) => u.0.value(),
19013 }
19014 }
19015
19016 /// Gets the enum value as a string.
19017 ///
19018 /// Returns `None` if the enum contains an unknown value deserialized from
19019 /// the integer representation of enums.
19020 pub fn name(&self) -> std::option::Option<&str> {
19021 match self {
19022 Self::Unspecified => std::option::Option::Some("MODEL_TYPE_UNSPECIFIED"),
19023 Self::Generative => std::option::Option::Some("MODEL_TYPE_GENERATIVE"),
19024 Self::Custom => std::option::Option::Some("MODEL_TYPE_CUSTOM"),
19025 Self::UnknownValue(u) => u.0.name(),
19026 }
19027 }
19028 }
19029
19030 impl std::default::Default for ModelType {
19031 fn default() -> Self {
19032 use std::convert::From;
19033 Self::from(0)
19034 }
19035 }
19036
19037 impl std::fmt::Display for ModelType {
19038 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19039 wkt::internal::display_enum(f, self.name(), self.value())
19040 }
19041 }
19042
19043 impl std::convert::From<i32> for ModelType {
19044 fn from(value: i32) -> Self {
19045 match value {
19046 0 => Self::Unspecified,
19047 1 => Self::Generative,
19048 2 => Self::Custom,
19049 _ => Self::UnknownValue(model_type::UnknownValue(
19050 wkt::internal::UnknownEnumValue::Integer(value),
19051 )),
19052 }
19053 }
19054 }
19055
19056 impl std::convert::From<&str> for ModelType {
19057 fn from(value: &str) -> Self {
19058 use std::string::ToString;
19059 match value {
19060 "MODEL_TYPE_UNSPECIFIED" => Self::Unspecified,
19061 "MODEL_TYPE_GENERATIVE" => Self::Generative,
19062 "MODEL_TYPE_CUSTOM" => Self::Custom,
19063 _ => Self::UnknownValue(model_type::UnknownValue(
19064 wkt::internal::UnknownEnumValue::String(value.to_string()),
19065 )),
19066 }
19067 }
19068 }
19069
19070 impl serde::ser::Serialize for ModelType {
19071 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19072 where
19073 S: serde::Serializer,
19074 {
19075 match self {
19076 Self::Unspecified => serializer.serialize_i32(0),
19077 Self::Generative => serializer.serialize_i32(1),
19078 Self::Custom => serializer.serialize_i32(2),
19079 Self::UnknownValue(u) => u.0.serialize(serializer),
19080 }
19081 }
19082 }
19083
19084 impl<'de> serde::de::Deserialize<'de> for ModelType {
19085 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19086 where
19087 D: serde::Deserializer<'de>,
19088 {
19089 deserializer.deserialize_any(wkt::internal::EnumVisitor::<ModelType>::new(
19090 ".google.cloud.documentai.v1.ProcessorVersion.ModelType",
19091 ))
19092 }
19093 }
19094}
19095
19096/// Contains the alias and the aliased resource name of processor version.
19097#[derive(Clone, Default, PartialEq)]
19098#[non_exhaustive]
19099pub struct ProcessorVersionAlias {
19100 /// The alias in the form of `processor_version` resource name.
19101 pub alias: std::string::String,
19102
19103 /// The resource name of aliased processor version.
19104 pub processor_version: std::string::String,
19105
19106 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19107}
19108
19109impl ProcessorVersionAlias {
19110 /// Creates a new default instance.
19111 pub fn new() -> Self {
19112 std::default::Default::default()
19113 }
19114
19115 /// Sets the value of [alias][crate::model::ProcessorVersionAlias::alias].
19116 ///
19117 /// # Example
19118 /// ```ignore,no_run
19119 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19120 /// let x = ProcessorVersionAlias::new().set_alias("example");
19121 /// ```
19122 pub fn set_alias<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19123 self.alias = v.into();
19124 self
19125 }
19126
19127 /// Sets the value of [processor_version][crate::model::ProcessorVersionAlias::processor_version].
19128 ///
19129 /// # Example
19130 /// ```ignore,no_run
19131 /// # use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19132 /// # let project_id = "project_id";
19133 /// # let location_id = "location_id";
19134 /// # let processor_id = "processor_id";
19135 /// # let processor_version_id = "processor_version_id";
19136 /// let x = ProcessorVersionAlias::new().set_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
19137 /// ```
19138 pub fn set_processor_version<T: std::convert::Into<std::string::String>>(
19139 mut self,
19140 v: T,
19141 ) -> Self {
19142 self.processor_version = v.into();
19143 self
19144 }
19145}
19146
19147impl wkt::message::Message for ProcessorVersionAlias {
19148 fn typename() -> &'static str {
19149 "type.googleapis.com/google.cloud.documentai.v1.ProcessorVersionAlias"
19150 }
19151}
19152
19153/// The first-class citizen for Document AI. Each processor defines how to
19154/// extract structural information from a document.
19155#[derive(Clone, Default, PartialEq)]
19156#[non_exhaustive]
19157pub struct Processor {
19158 /// Output only. Immutable. The resource name of the processor.
19159 /// Format: `projects/{project}/locations/{location}/processors/{processor}`
19160 pub name: std::string::String,
19161
19162 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19163 /// To get a list of processor types, see
19164 /// [FetchProcessorTypes][google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes].
19165 ///
19166 /// [google.cloud.documentai.v1.DocumentProcessorService.FetchProcessorTypes]: crate::client::DocumentProcessorService::fetch_processor_types
19167 pub r#type: std::string::String,
19168
19169 /// The display name of the processor.
19170 pub display_name: std::string::String,
19171
19172 /// Output only. The state of the processor.
19173 pub state: crate::model::processor::State,
19174
19175 /// The default processor version.
19176 pub default_processor_version: std::string::String,
19177
19178 /// Output only. The processor version aliases.
19179 pub processor_version_aliases: std::vec::Vec<crate::model::ProcessorVersionAlias>,
19180
19181 /// Output only. Immutable. The http endpoint that can be called to invoke
19182 /// processing.
19183 pub process_endpoint: std::string::String,
19184
19185 /// Output only. The time the processor was created.
19186 pub create_time: std::option::Option<wkt::Timestamp>,
19187
19188 /// The [KMS key](https://cloud.google.com/security-key-management) used for
19189 /// encryption and decryption in CMEK scenarios.
19190 pub kms_key_name: std::string::String,
19191
19192 /// Output only. Reserved for future use.
19193 pub satisfies_pzs: bool,
19194
19195 /// Output only. Reserved for future use.
19196 pub satisfies_pzi: bool,
19197
19198 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19199}
19200
19201impl Processor {
19202 /// Creates a new default instance.
19203 pub fn new() -> Self {
19204 std::default::Default::default()
19205 }
19206
19207 /// Sets the value of [name][crate::model::Processor::name].
19208 ///
19209 /// # Example
19210 /// ```ignore,no_run
19211 /// # use google_cloud_documentai_v1::model::Processor;
19212 /// # let project_id = "project_id";
19213 /// # let location_id = "location_id";
19214 /// # let processor_id = "processor_id";
19215 /// let x = Processor::new().set_name(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}"));
19216 /// ```
19217 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19218 self.name = v.into();
19219 self
19220 }
19221
19222 /// Sets the value of [r#type][crate::model::Processor::type].
19223 ///
19224 /// # Example
19225 /// ```ignore,no_run
19226 /// # use google_cloud_documentai_v1::model::Processor;
19227 /// let x = Processor::new().set_type("example");
19228 /// ```
19229 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19230 self.r#type = v.into();
19231 self
19232 }
19233
19234 /// Sets the value of [display_name][crate::model::Processor::display_name].
19235 ///
19236 /// # Example
19237 /// ```ignore,no_run
19238 /// # use google_cloud_documentai_v1::model::Processor;
19239 /// let x = Processor::new().set_display_name("example");
19240 /// ```
19241 pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19242 self.display_name = v.into();
19243 self
19244 }
19245
19246 /// Sets the value of [state][crate::model::Processor::state].
19247 ///
19248 /// # Example
19249 /// ```ignore,no_run
19250 /// # use google_cloud_documentai_v1::model::Processor;
19251 /// use google_cloud_documentai_v1::model::processor::State;
19252 /// let x0 = Processor::new().set_state(State::Enabled);
19253 /// let x1 = Processor::new().set_state(State::Disabled);
19254 /// let x2 = Processor::new().set_state(State::Enabling);
19255 /// ```
19256 pub fn set_state<T: std::convert::Into<crate::model::processor::State>>(
19257 mut self,
19258 v: T,
19259 ) -> Self {
19260 self.state = v.into();
19261 self
19262 }
19263
19264 /// Sets the value of [default_processor_version][crate::model::Processor::default_processor_version].
19265 ///
19266 /// # Example
19267 /// ```ignore,no_run
19268 /// # use google_cloud_documentai_v1::model::Processor;
19269 /// # let project_id = "project_id";
19270 /// # let location_id = "location_id";
19271 /// # let processor_id = "processor_id";
19272 /// # let processor_version_id = "processor_version_id";
19273 /// let x = Processor::new().set_default_processor_version(format!("projects/{project_id}/locations/{location_id}/processors/{processor_id}/processorVersions/{processor_version_id}"));
19274 /// ```
19275 pub fn set_default_processor_version<T: std::convert::Into<std::string::String>>(
19276 mut self,
19277 v: T,
19278 ) -> Self {
19279 self.default_processor_version = v.into();
19280 self
19281 }
19282
19283 /// Sets the value of [processor_version_aliases][crate::model::Processor::processor_version_aliases].
19284 ///
19285 /// # Example
19286 /// ```ignore,no_run
19287 /// # use google_cloud_documentai_v1::model::Processor;
19288 /// use google_cloud_documentai_v1::model::ProcessorVersionAlias;
19289 /// let x = Processor::new()
19290 /// .set_processor_version_aliases([
19291 /// ProcessorVersionAlias::default()/* use setters */,
19292 /// ProcessorVersionAlias::default()/* use (different) setters */,
19293 /// ]);
19294 /// ```
19295 pub fn set_processor_version_aliases<T, V>(mut self, v: T) -> Self
19296 where
19297 T: std::iter::IntoIterator<Item = V>,
19298 V: std::convert::Into<crate::model::ProcessorVersionAlias>,
19299 {
19300 use std::iter::Iterator;
19301 self.processor_version_aliases = v.into_iter().map(|i| i.into()).collect();
19302 self
19303 }
19304
19305 /// Sets the value of [process_endpoint][crate::model::Processor::process_endpoint].
19306 ///
19307 /// # Example
19308 /// ```ignore,no_run
19309 /// # use google_cloud_documentai_v1::model::Processor;
19310 /// let x = Processor::new().set_process_endpoint("example");
19311 /// ```
19312 pub fn set_process_endpoint<T: std::convert::Into<std::string::String>>(
19313 mut self,
19314 v: T,
19315 ) -> Self {
19316 self.process_endpoint = v.into();
19317 self
19318 }
19319
19320 /// Sets the value of [create_time][crate::model::Processor::create_time].
19321 ///
19322 /// # Example
19323 /// ```ignore,no_run
19324 /// # use google_cloud_documentai_v1::model::Processor;
19325 /// use wkt::Timestamp;
19326 /// let x = Processor::new().set_create_time(Timestamp::default()/* use setters */);
19327 /// ```
19328 pub fn set_create_time<T>(mut self, v: T) -> Self
19329 where
19330 T: std::convert::Into<wkt::Timestamp>,
19331 {
19332 self.create_time = std::option::Option::Some(v.into());
19333 self
19334 }
19335
19336 /// Sets or clears the value of [create_time][crate::model::Processor::create_time].
19337 ///
19338 /// # Example
19339 /// ```ignore,no_run
19340 /// # use google_cloud_documentai_v1::model::Processor;
19341 /// use wkt::Timestamp;
19342 /// let x = Processor::new().set_or_clear_create_time(Some(Timestamp::default()/* use setters */));
19343 /// let x = Processor::new().set_or_clear_create_time(None::<Timestamp>);
19344 /// ```
19345 pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
19346 where
19347 T: std::convert::Into<wkt::Timestamp>,
19348 {
19349 self.create_time = v.map(|x| x.into());
19350 self
19351 }
19352
19353 /// Sets the value of [kms_key_name][crate::model::Processor::kms_key_name].
19354 ///
19355 /// # Example
19356 /// ```ignore,no_run
19357 /// # use google_cloud_documentai_v1::model::Processor;
19358 /// let x = Processor::new().set_kms_key_name("example");
19359 /// ```
19360 pub fn set_kms_key_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19361 self.kms_key_name = v.into();
19362 self
19363 }
19364
19365 /// Sets the value of [satisfies_pzs][crate::model::Processor::satisfies_pzs].
19366 ///
19367 /// # Example
19368 /// ```ignore,no_run
19369 /// # use google_cloud_documentai_v1::model::Processor;
19370 /// let x = Processor::new().set_satisfies_pzs(true);
19371 /// ```
19372 pub fn set_satisfies_pzs<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19373 self.satisfies_pzs = v.into();
19374 self
19375 }
19376
19377 /// Sets the value of [satisfies_pzi][crate::model::Processor::satisfies_pzi].
19378 ///
19379 /// # Example
19380 /// ```ignore,no_run
19381 /// # use google_cloud_documentai_v1::model::Processor;
19382 /// let x = Processor::new().set_satisfies_pzi(true);
19383 /// ```
19384 pub fn set_satisfies_pzi<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19385 self.satisfies_pzi = v.into();
19386 self
19387 }
19388}
19389
19390impl wkt::message::Message for Processor {
19391 fn typename() -> &'static str {
19392 "type.googleapis.com/google.cloud.documentai.v1.Processor"
19393 }
19394}
19395
19396/// Defines additional types related to [Processor].
19397pub mod processor {
19398 #[allow(unused_imports)]
19399 use super::*;
19400
19401 /// The possible states of the processor.
19402 ///
19403 /// # Working with unknown values
19404 ///
19405 /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
19406 /// additional enum variants at any time. Adding new variants is not considered
19407 /// a breaking change. Applications should write their code in anticipation of:
19408 ///
19409 /// - New values appearing in future releases of the client library, **and**
19410 /// - New values received dynamically, without application changes.
19411 ///
19412 /// Please consult the [Working with enums] section in the user guide for some
19413 /// guidelines.
19414 ///
19415 /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
19416 #[derive(Clone, Debug, PartialEq)]
19417 #[non_exhaustive]
19418 pub enum State {
19419 /// The processor is in an unspecified state.
19420 Unspecified,
19421 /// The processor is enabled, i.e., has an enabled version which can
19422 /// currently serve processing requests and all the feature dependencies have
19423 /// been successfully initialized.
19424 Enabled,
19425 /// The processor is disabled.
19426 Disabled,
19427 /// The processor is being enabled, will become `ENABLED` if successful.
19428 Enabling,
19429 /// The processor is being disabled, will become `DISABLED` if successful.
19430 Disabling,
19431 /// The processor is being created, will become either `ENABLED` (for
19432 /// successful creation) or `FAILED` (for failed ones).
19433 /// Once a processor is in this state, it can then be used for document
19434 /// processing, but the feature dependencies of the processor might not be
19435 /// fully created yet.
19436 Creating,
19437 /// The processor failed during creation or initialization of feature
19438 /// dependencies. The user should delete the processor and recreate one as
19439 /// all the functionalities of the processor are disabled.
19440 Failed,
19441 /// The processor is being deleted, will be removed if successful.
19442 Deleting,
19443 /// If set, the enum was initialized with an unknown value.
19444 ///
19445 /// Applications can examine the value using [State::value] or
19446 /// [State::name].
19447 UnknownValue(state::UnknownValue),
19448 }
19449
19450 #[doc(hidden)]
19451 pub mod state {
19452 #[allow(unused_imports)]
19453 use super::*;
19454 #[derive(Clone, Debug, PartialEq)]
19455 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
19456 }
19457
19458 impl State {
19459 /// Gets the enum value.
19460 ///
19461 /// Returns `None` if the enum contains an unknown value deserialized from
19462 /// the string representation of enums.
19463 pub fn value(&self) -> std::option::Option<i32> {
19464 match self {
19465 Self::Unspecified => std::option::Option::Some(0),
19466 Self::Enabled => std::option::Option::Some(1),
19467 Self::Disabled => std::option::Option::Some(2),
19468 Self::Enabling => std::option::Option::Some(3),
19469 Self::Disabling => std::option::Option::Some(4),
19470 Self::Creating => std::option::Option::Some(5),
19471 Self::Failed => std::option::Option::Some(6),
19472 Self::Deleting => std::option::Option::Some(7),
19473 Self::UnknownValue(u) => u.0.value(),
19474 }
19475 }
19476
19477 /// Gets the enum value as a string.
19478 ///
19479 /// Returns `None` if the enum contains an unknown value deserialized from
19480 /// the integer representation of enums.
19481 pub fn name(&self) -> std::option::Option<&str> {
19482 match self {
19483 Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
19484 Self::Enabled => std::option::Option::Some("ENABLED"),
19485 Self::Disabled => std::option::Option::Some("DISABLED"),
19486 Self::Enabling => std::option::Option::Some("ENABLING"),
19487 Self::Disabling => std::option::Option::Some("DISABLING"),
19488 Self::Creating => std::option::Option::Some("CREATING"),
19489 Self::Failed => std::option::Option::Some("FAILED"),
19490 Self::Deleting => std::option::Option::Some("DELETING"),
19491 Self::UnknownValue(u) => u.0.name(),
19492 }
19493 }
19494 }
19495
19496 impl std::default::Default for State {
19497 fn default() -> Self {
19498 use std::convert::From;
19499 Self::from(0)
19500 }
19501 }
19502
19503 impl std::fmt::Display for State {
19504 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
19505 wkt::internal::display_enum(f, self.name(), self.value())
19506 }
19507 }
19508
19509 impl std::convert::From<i32> for State {
19510 fn from(value: i32) -> Self {
19511 match value {
19512 0 => Self::Unspecified,
19513 1 => Self::Enabled,
19514 2 => Self::Disabled,
19515 3 => Self::Enabling,
19516 4 => Self::Disabling,
19517 5 => Self::Creating,
19518 6 => Self::Failed,
19519 7 => Self::Deleting,
19520 _ => Self::UnknownValue(state::UnknownValue(
19521 wkt::internal::UnknownEnumValue::Integer(value),
19522 )),
19523 }
19524 }
19525 }
19526
19527 impl std::convert::From<&str> for State {
19528 fn from(value: &str) -> Self {
19529 use std::string::ToString;
19530 match value {
19531 "STATE_UNSPECIFIED" => Self::Unspecified,
19532 "ENABLED" => Self::Enabled,
19533 "DISABLED" => Self::Disabled,
19534 "ENABLING" => Self::Enabling,
19535 "DISABLING" => Self::Disabling,
19536 "CREATING" => Self::Creating,
19537 "FAILED" => Self::Failed,
19538 "DELETING" => Self::Deleting,
19539 _ => Self::UnknownValue(state::UnknownValue(
19540 wkt::internal::UnknownEnumValue::String(value.to_string()),
19541 )),
19542 }
19543 }
19544 }
19545
19546 impl serde::ser::Serialize for State {
19547 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
19548 where
19549 S: serde::Serializer,
19550 {
19551 match self {
19552 Self::Unspecified => serializer.serialize_i32(0),
19553 Self::Enabled => serializer.serialize_i32(1),
19554 Self::Disabled => serializer.serialize_i32(2),
19555 Self::Enabling => serializer.serialize_i32(3),
19556 Self::Disabling => serializer.serialize_i32(4),
19557 Self::Creating => serializer.serialize_i32(5),
19558 Self::Failed => serializer.serialize_i32(6),
19559 Self::Deleting => serializer.serialize_i32(7),
19560 Self::UnknownValue(u) => u.0.serialize(serializer),
19561 }
19562 }
19563 }
19564
19565 impl<'de> serde::de::Deserialize<'de> for State {
19566 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
19567 where
19568 D: serde::Deserializer<'de>,
19569 {
19570 deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
19571 ".google.cloud.documentai.v1.Processor.State",
19572 ))
19573 }
19574 }
19575}
19576
19577/// A processor type is responsible for performing a certain document
19578/// understanding task on a certain type of document.
19579#[derive(Clone, Default, PartialEq)]
19580#[non_exhaustive]
19581pub struct ProcessorType {
19582 /// The resource name of the processor type.
19583 /// Format: `projects/{project}/processorTypes/{processor_type}`
19584 pub name: std::string::String,
19585
19586 /// The processor type, such as: `OCR_PROCESSOR`, `INVOICE_PROCESSOR`.
19587 pub r#type: std::string::String,
19588
19589 /// The processor category, used by UI to group processor types.
19590 pub category: std::string::String,
19591
19592 /// The locations in which this processor is available.
19593 pub available_locations: std::vec::Vec<crate::model::processor_type::LocationInfo>,
19594
19595 /// Whether the processor type allows creation. If true, users can create a
19596 /// processor of this processor type. Otherwise, users need to request access.
19597 pub allow_creation: bool,
19598
19599 /// Launch stage of the processor type
19600 pub launch_stage: google_cloud_api::model::LaunchStage,
19601
19602 /// A set of Cloud Storage URIs of sample documents for this processor.
19603 pub sample_document_uris: std::vec::Vec<std::string::String>,
19604
19605 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19606}
19607
19608impl ProcessorType {
19609 /// Creates a new default instance.
19610 pub fn new() -> Self {
19611 std::default::Default::default()
19612 }
19613
19614 /// Sets the value of [name][crate::model::ProcessorType::name].
19615 ///
19616 /// # Example
19617 /// ```ignore,no_run
19618 /// # use google_cloud_documentai_v1::model::ProcessorType;
19619 /// # let project_id = "project_id";
19620 /// # let location_id = "location_id";
19621 /// # let processor_type_id = "processor_type_id";
19622 /// let x = ProcessorType::new().set_name(format!("projects/{project_id}/locations/{location_id}/processorTypes/{processor_type_id}"));
19623 /// ```
19624 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19625 self.name = v.into();
19626 self
19627 }
19628
19629 /// Sets the value of [r#type][crate::model::ProcessorType::type].
19630 ///
19631 /// # Example
19632 /// ```ignore,no_run
19633 /// # use google_cloud_documentai_v1::model::ProcessorType;
19634 /// let x = ProcessorType::new().set_type("example");
19635 /// ```
19636 pub fn set_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19637 self.r#type = v.into();
19638 self
19639 }
19640
19641 /// Sets the value of [category][crate::model::ProcessorType::category].
19642 ///
19643 /// # Example
19644 /// ```ignore,no_run
19645 /// # use google_cloud_documentai_v1::model::ProcessorType;
19646 /// let x = ProcessorType::new().set_category("example");
19647 /// ```
19648 pub fn set_category<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19649 self.category = v.into();
19650 self
19651 }
19652
19653 /// Sets the value of [available_locations][crate::model::ProcessorType::available_locations].
19654 ///
19655 /// # Example
19656 /// ```ignore,no_run
19657 /// # use google_cloud_documentai_v1::model::ProcessorType;
19658 /// use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19659 /// let x = ProcessorType::new()
19660 /// .set_available_locations([
19661 /// LocationInfo::default()/* use setters */,
19662 /// LocationInfo::default()/* use (different) setters */,
19663 /// ]);
19664 /// ```
19665 pub fn set_available_locations<T, V>(mut self, v: T) -> Self
19666 where
19667 T: std::iter::IntoIterator<Item = V>,
19668 V: std::convert::Into<crate::model::processor_type::LocationInfo>,
19669 {
19670 use std::iter::Iterator;
19671 self.available_locations = v.into_iter().map(|i| i.into()).collect();
19672 self
19673 }
19674
19675 /// Sets the value of [allow_creation][crate::model::ProcessorType::allow_creation].
19676 ///
19677 /// # Example
19678 /// ```ignore,no_run
19679 /// # use google_cloud_documentai_v1::model::ProcessorType;
19680 /// let x = ProcessorType::new().set_allow_creation(true);
19681 /// ```
19682 pub fn set_allow_creation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
19683 self.allow_creation = v.into();
19684 self
19685 }
19686
19687 /// Sets the value of [launch_stage][crate::model::ProcessorType::launch_stage].
19688 ///
19689 /// # Example
19690 /// ```ignore,no_run
19691 /// # use google_cloud_documentai_v1::model::ProcessorType;
19692 /// use google_cloud_api::model::LaunchStage;
19693 /// let x0 = ProcessorType::new().set_launch_stage(LaunchStage::Unimplemented);
19694 /// let x1 = ProcessorType::new().set_launch_stage(LaunchStage::Prelaunch);
19695 /// let x2 = ProcessorType::new().set_launch_stage(LaunchStage::EarlyAccess);
19696 /// ```
19697 pub fn set_launch_stage<T: std::convert::Into<google_cloud_api::model::LaunchStage>>(
19698 mut self,
19699 v: T,
19700 ) -> Self {
19701 self.launch_stage = v.into();
19702 self
19703 }
19704
19705 /// Sets the value of [sample_document_uris][crate::model::ProcessorType::sample_document_uris].
19706 ///
19707 /// # Example
19708 /// ```ignore,no_run
19709 /// # use google_cloud_documentai_v1::model::ProcessorType;
19710 /// let x = ProcessorType::new().set_sample_document_uris(["a", "b", "c"]);
19711 /// ```
19712 pub fn set_sample_document_uris<T, V>(mut self, v: T) -> Self
19713 where
19714 T: std::iter::IntoIterator<Item = V>,
19715 V: std::convert::Into<std::string::String>,
19716 {
19717 use std::iter::Iterator;
19718 self.sample_document_uris = v.into_iter().map(|i| i.into()).collect();
19719 self
19720 }
19721}
19722
19723impl wkt::message::Message for ProcessorType {
19724 fn typename() -> &'static str {
19725 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType"
19726 }
19727}
19728
19729/// Defines additional types related to [ProcessorType].
19730pub mod processor_type {
19731 #[allow(unused_imports)]
19732 use super::*;
19733
19734 /// The location information about where the processor is available.
19735 #[derive(Clone, Default, PartialEq)]
19736 #[non_exhaustive]
19737 pub struct LocationInfo {
19738 /// The location ID. For supported locations, refer to [regional and
19739 /// multi-regional support](/document-ai/docs/regions).
19740 pub location_id: std::string::String,
19741
19742 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
19743 }
19744
19745 impl LocationInfo {
19746 /// Creates a new default instance.
19747 pub fn new() -> Self {
19748 std::default::Default::default()
19749 }
19750
19751 /// Sets the value of [location_id][crate::model::processor_type::LocationInfo::location_id].
19752 ///
19753 /// # Example
19754 /// ```ignore,no_run
19755 /// # use google_cloud_documentai_v1::model::processor_type::LocationInfo;
19756 /// let x = LocationInfo::new().set_location_id("example");
19757 /// ```
19758 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
19759 self.location_id = v.into();
19760 self
19761 }
19762 }
19763
19764 impl wkt::message::Message for LocationInfo {
19765 fn typename() -> &'static str {
19766 "type.googleapis.com/google.cloud.documentai.v1.ProcessorType.LocationInfo"
19767 }
19768 }
19769}