google_cloud_vision_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 gax;
23extern crate gaxi;
24extern crate gtype;
25extern crate lazy_static;
26extern crate longrunning;
27extern crate lro;
28extern crate reqwest;
29extern crate rpc;
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/// A vertex represents a 2D point in the image.
42/// NOTE: the vertex coordinates are in the same scale as the original image.
43#[derive(Clone, Default, PartialEq)]
44#[non_exhaustive]
45pub struct Vertex {
46    /// X coordinate.
47    pub x: i32,
48
49    /// Y coordinate.
50    pub y: i32,
51
52    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
53}
54
55impl Vertex {
56    pub fn new() -> Self {
57        std::default::Default::default()
58    }
59
60    /// Sets the value of [x][crate::model::Vertex::x].
61    pub fn set_x<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
62        self.x = v.into();
63        self
64    }
65
66    /// Sets the value of [y][crate::model::Vertex::y].
67    pub fn set_y<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
68        self.y = v.into();
69        self
70    }
71}
72
73impl wkt::message::Message for Vertex {
74    fn typename() -> &'static str {
75        "type.googleapis.com/google.cloud.vision.v1.Vertex"
76    }
77}
78
79/// A vertex represents a 2D point in the image.
80/// NOTE: the normalized vertex coordinates are relative to the original image
81/// and range from 0 to 1.
82#[derive(Clone, Default, PartialEq)]
83#[non_exhaustive]
84pub struct NormalizedVertex {
85    /// X coordinate.
86    pub x: f32,
87
88    /// Y coordinate.
89    pub y: f32,
90
91    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
92}
93
94impl NormalizedVertex {
95    pub fn new() -> Self {
96        std::default::Default::default()
97    }
98
99    /// Sets the value of [x][crate::model::NormalizedVertex::x].
100    pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
101        self.x = v.into();
102        self
103    }
104
105    /// Sets the value of [y][crate::model::NormalizedVertex::y].
106    pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
107        self.y = v.into();
108        self
109    }
110}
111
112impl wkt::message::Message for NormalizedVertex {
113    fn typename() -> &'static str {
114        "type.googleapis.com/google.cloud.vision.v1.NormalizedVertex"
115    }
116}
117
118/// A bounding polygon for the detected image annotation.
119#[derive(Clone, Default, PartialEq)]
120#[non_exhaustive]
121pub struct BoundingPoly {
122    /// The bounding polygon vertices.
123    pub vertices: std::vec::Vec<crate::model::Vertex>,
124
125    /// The bounding polygon normalized vertices.
126    pub normalized_vertices: std::vec::Vec<crate::model::NormalizedVertex>,
127
128    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
129}
130
131impl BoundingPoly {
132    pub fn new() -> Self {
133        std::default::Default::default()
134    }
135
136    /// Sets the value of [vertices][crate::model::BoundingPoly::vertices].
137    pub fn set_vertices<T, V>(mut self, v: T) -> Self
138    where
139        T: std::iter::IntoIterator<Item = V>,
140        V: std::convert::Into<crate::model::Vertex>,
141    {
142        use std::iter::Iterator;
143        self.vertices = v.into_iter().map(|i| i.into()).collect();
144        self
145    }
146
147    /// Sets the value of [normalized_vertices][crate::model::BoundingPoly::normalized_vertices].
148    pub fn set_normalized_vertices<T, V>(mut self, v: T) -> Self
149    where
150        T: std::iter::IntoIterator<Item = V>,
151        V: std::convert::Into<crate::model::NormalizedVertex>,
152    {
153        use std::iter::Iterator;
154        self.normalized_vertices = v.into_iter().map(|i| i.into()).collect();
155        self
156    }
157}
158
159impl wkt::message::Message for BoundingPoly {
160    fn typename() -> &'static str {
161        "type.googleapis.com/google.cloud.vision.v1.BoundingPoly"
162    }
163}
164
165/// A 3D position in the image, used primarily for Face detection landmarks.
166/// A valid Position must have both x and y coordinates.
167/// The position coordinates are in the same scale as the original image.
168#[derive(Clone, Default, PartialEq)]
169#[non_exhaustive]
170pub struct Position {
171    /// X coordinate.
172    pub x: f32,
173
174    /// Y coordinate.
175    pub y: f32,
176
177    /// Z coordinate (or depth).
178    pub z: f32,
179
180    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
181}
182
183impl Position {
184    pub fn new() -> Self {
185        std::default::Default::default()
186    }
187
188    /// Sets the value of [x][crate::model::Position::x].
189    pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
190        self.x = v.into();
191        self
192    }
193
194    /// Sets the value of [y][crate::model::Position::y].
195    pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
196        self.y = v.into();
197        self
198    }
199
200    /// Sets the value of [z][crate::model::Position::z].
201    pub fn set_z<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
202        self.z = v.into();
203        self
204    }
205}
206
207impl wkt::message::Message for Position {
208    fn typename() -> &'static str {
209        "type.googleapis.com/google.cloud.vision.v1.Position"
210    }
211}
212
213/// The type of Google Cloud Vision API detection to perform, and the maximum
214/// number of results to return for that type. Multiple `Feature` objects can
215/// be specified in the `features` list.
216#[derive(Clone, Default, PartialEq)]
217#[non_exhaustive]
218pub struct Feature {
219    /// The feature type.
220    pub r#type: crate::model::feature::Type,
221
222    /// Maximum number of results of this type. Does not apply to
223    /// `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
224    pub max_results: i32,
225
226    /// Model to use for the feature.
227    /// Supported values: "builtin/stable" (the default if unset) and
228    /// "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
229    /// support "builtin/weekly" for the bleeding edge release updated weekly.
230    pub model: std::string::String,
231
232    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
233}
234
235impl Feature {
236    pub fn new() -> Self {
237        std::default::Default::default()
238    }
239
240    /// Sets the value of [r#type][crate::model::Feature::type].
241    pub fn set_type<T: std::convert::Into<crate::model::feature::Type>>(mut self, v: T) -> Self {
242        self.r#type = v.into();
243        self
244    }
245
246    /// Sets the value of [max_results][crate::model::Feature::max_results].
247    pub fn set_max_results<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
248        self.max_results = v.into();
249        self
250    }
251
252    /// Sets the value of [model][crate::model::Feature::model].
253    pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
254        self.model = v.into();
255        self
256    }
257}
258
259impl wkt::message::Message for Feature {
260    fn typename() -> &'static str {
261        "type.googleapis.com/google.cloud.vision.v1.Feature"
262    }
263}
264
265/// Defines additional types related to [Feature].
266pub mod feature {
267    #[allow(unused_imports)]
268    use super::*;
269
270    /// Type of Google Cloud Vision API feature to be extracted.
271    ///
272    /// # Working with unknown values
273    ///
274    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
275    /// additional enum variants at any time. Adding new variants is not considered
276    /// a breaking change. Applications should write their code in anticipation of:
277    ///
278    /// - New values appearing in future releases of the client library, **and**
279    /// - New values received dynamically, without application changes.
280    ///
281    /// Please consult the [Working with enums] section in the user guide for some
282    /// guidelines.
283    ///
284    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
285    #[derive(Clone, Debug, PartialEq)]
286    #[non_exhaustive]
287    pub enum Type {
288        /// Unspecified feature type.
289        Unspecified,
290        /// Run face detection.
291        FaceDetection,
292        /// Run landmark detection.
293        LandmarkDetection,
294        /// Run logo detection.
295        LogoDetection,
296        /// Run label detection.
297        LabelDetection,
298        /// Run text detection / optical character recognition (OCR). Text detection
299        /// is optimized for areas of text within a larger image; if the image is
300        /// a document, use `DOCUMENT_TEXT_DETECTION` instead.
301        TextDetection,
302        /// Run dense text document OCR. Takes precedence when both
303        /// `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` are present.
304        DocumentTextDetection,
305        /// Run Safe Search to detect potentially unsafe
306        /// or undesirable content.
307        SafeSearchDetection,
308        /// Compute a set of image properties, such as the
309        /// image's dominant colors.
310        ImageProperties,
311        /// Run crop hints.
312        CropHints,
313        /// Run web detection.
314        WebDetection,
315        /// Run Product Search.
316        ProductSearch,
317        /// Run localizer for object detection.
318        ObjectLocalization,
319        /// If set, the enum was initialized with an unknown value.
320        ///
321        /// Applications can examine the value using [Type::value] or
322        /// [Type::name].
323        UnknownValue(r#type::UnknownValue),
324    }
325
326    #[doc(hidden)]
327    pub mod r#type {
328        #[allow(unused_imports)]
329        use super::*;
330        #[derive(Clone, Debug, PartialEq)]
331        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
332    }
333
334    impl Type {
335        /// Gets the enum value.
336        ///
337        /// Returns `None` if the enum contains an unknown value deserialized from
338        /// the string representation of enums.
339        pub fn value(&self) -> std::option::Option<i32> {
340            match self {
341                Self::Unspecified => std::option::Option::Some(0),
342                Self::FaceDetection => std::option::Option::Some(1),
343                Self::LandmarkDetection => std::option::Option::Some(2),
344                Self::LogoDetection => std::option::Option::Some(3),
345                Self::LabelDetection => std::option::Option::Some(4),
346                Self::TextDetection => std::option::Option::Some(5),
347                Self::DocumentTextDetection => std::option::Option::Some(11),
348                Self::SafeSearchDetection => std::option::Option::Some(6),
349                Self::ImageProperties => std::option::Option::Some(7),
350                Self::CropHints => std::option::Option::Some(9),
351                Self::WebDetection => std::option::Option::Some(10),
352                Self::ProductSearch => std::option::Option::Some(12),
353                Self::ObjectLocalization => std::option::Option::Some(19),
354                Self::UnknownValue(u) => u.0.value(),
355            }
356        }
357
358        /// Gets the enum value as a string.
359        ///
360        /// Returns `None` if the enum contains an unknown value deserialized from
361        /// the integer representation of enums.
362        pub fn name(&self) -> std::option::Option<&str> {
363            match self {
364                Self::Unspecified => std::option::Option::Some("TYPE_UNSPECIFIED"),
365                Self::FaceDetection => std::option::Option::Some("FACE_DETECTION"),
366                Self::LandmarkDetection => std::option::Option::Some("LANDMARK_DETECTION"),
367                Self::LogoDetection => std::option::Option::Some("LOGO_DETECTION"),
368                Self::LabelDetection => std::option::Option::Some("LABEL_DETECTION"),
369                Self::TextDetection => std::option::Option::Some("TEXT_DETECTION"),
370                Self::DocumentTextDetection => std::option::Option::Some("DOCUMENT_TEXT_DETECTION"),
371                Self::SafeSearchDetection => std::option::Option::Some("SAFE_SEARCH_DETECTION"),
372                Self::ImageProperties => std::option::Option::Some("IMAGE_PROPERTIES"),
373                Self::CropHints => std::option::Option::Some("CROP_HINTS"),
374                Self::WebDetection => std::option::Option::Some("WEB_DETECTION"),
375                Self::ProductSearch => std::option::Option::Some("PRODUCT_SEARCH"),
376                Self::ObjectLocalization => std::option::Option::Some("OBJECT_LOCALIZATION"),
377                Self::UnknownValue(u) => u.0.name(),
378            }
379        }
380    }
381
382    impl std::default::Default for Type {
383        fn default() -> Self {
384            use std::convert::From;
385            Self::from(0)
386        }
387    }
388
389    impl std::fmt::Display for Type {
390        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
391            wkt::internal::display_enum(f, self.name(), self.value())
392        }
393    }
394
395    impl std::convert::From<i32> for Type {
396        fn from(value: i32) -> Self {
397            match value {
398                0 => Self::Unspecified,
399                1 => Self::FaceDetection,
400                2 => Self::LandmarkDetection,
401                3 => Self::LogoDetection,
402                4 => Self::LabelDetection,
403                5 => Self::TextDetection,
404                6 => Self::SafeSearchDetection,
405                7 => Self::ImageProperties,
406                9 => Self::CropHints,
407                10 => Self::WebDetection,
408                11 => Self::DocumentTextDetection,
409                12 => Self::ProductSearch,
410                19 => Self::ObjectLocalization,
411                _ => Self::UnknownValue(r#type::UnknownValue(
412                    wkt::internal::UnknownEnumValue::Integer(value),
413                )),
414            }
415        }
416    }
417
418    impl std::convert::From<&str> for Type {
419        fn from(value: &str) -> Self {
420            use std::string::ToString;
421            match value {
422                "TYPE_UNSPECIFIED" => Self::Unspecified,
423                "FACE_DETECTION" => Self::FaceDetection,
424                "LANDMARK_DETECTION" => Self::LandmarkDetection,
425                "LOGO_DETECTION" => Self::LogoDetection,
426                "LABEL_DETECTION" => Self::LabelDetection,
427                "TEXT_DETECTION" => Self::TextDetection,
428                "DOCUMENT_TEXT_DETECTION" => Self::DocumentTextDetection,
429                "SAFE_SEARCH_DETECTION" => Self::SafeSearchDetection,
430                "IMAGE_PROPERTIES" => Self::ImageProperties,
431                "CROP_HINTS" => Self::CropHints,
432                "WEB_DETECTION" => Self::WebDetection,
433                "PRODUCT_SEARCH" => Self::ProductSearch,
434                "OBJECT_LOCALIZATION" => Self::ObjectLocalization,
435                _ => Self::UnknownValue(r#type::UnknownValue(
436                    wkt::internal::UnknownEnumValue::String(value.to_string()),
437                )),
438            }
439        }
440    }
441
442    impl serde::ser::Serialize for Type {
443        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
444        where
445            S: serde::Serializer,
446        {
447            match self {
448                Self::Unspecified => serializer.serialize_i32(0),
449                Self::FaceDetection => serializer.serialize_i32(1),
450                Self::LandmarkDetection => serializer.serialize_i32(2),
451                Self::LogoDetection => serializer.serialize_i32(3),
452                Self::LabelDetection => serializer.serialize_i32(4),
453                Self::TextDetection => serializer.serialize_i32(5),
454                Self::DocumentTextDetection => serializer.serialize_i32(11),
455                Self::SafeSearchDetection => serializer.serialize_i32(6),
456                Self::ImageProperties => serializer.serialize_i32(7),
457                Self::CropHints => serializer.serialize_i32(9),
458                Self::WebDetection => serializer.serialize_i32(10),
459                Self::ProductSearch => serializer.serialize_i32(12),
460                Self::ObjectLocalization => serializer.serialize_i32(19),
461                Self::UnknownValue(u) => u.0.serialize(serializer),
462            }
463        }
464    }
465
466    impl<'de> serde::de::Deserialize<'de> for Type {
467        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
468        where
469            D: serde::Deserializer<'de>,
470        {
471            deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
472                ".google.cloud.vision.v1.Feature.Type",
473            ))
474        }
475    }
476}
477
478/// External image source (Google Cloud Storage or web URL image location).
479#[derive(Clone, Default, PartialEq)]
480#[non_exhaustive]
481pub struct ImageSource {
482    /// **Use `image_uri` instead.**
483    ///
484    /// The Google Cloud Storage  URI of the form
485    /// `gs://bucket_name/object_name`. Object versioning is not supported. See
486    /// [Google Cloud Storage Request
487    /// URIs](https://cloud.google.com/storage/docs/reference-uris) for more info.
488    pub gcs_image_uri: std::string::String,
489
490    /// The URI of the source image. Can be either:
491    ///
492    /// 1. A Google Cloud Storage URI of the form
493    ///    `gs://bucket_name/object_name`. Object versioning is not supported. See
494    ///    [Google Cloud Storage Request
495    ///    URIs](https://cloud.google.com/storage/docs/reference-uris) for more
496    ///    info.
497    ///
498    /// 1. A publicly-accessible image HTTP/HTTPS URL. When fetching images from
499    ///    HTTP/HTTPS URLs, Google cannot guarantee that the request will be
500    ///    completed. Your request may fail if the specified host denies the
501    ///    request (e.g. due to request throttling or DOS prevention), or if Google
502    ///    throttles requests to the site for abuse prevention. You should not
503    ///    depend on externally-hosted images for production applications.
504    ///
505    ///
506    /// When both `gcs_image_uri` and `image_uri` are specified, `image_uri` takes
507    /// precedence.
508    pub image_uri: std::string::String,
509
510    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
511}
512
513impl ImageSource {
514    pub fn new() -> Self {
515        std::default::Default::default()
516    }
517
518    /// Sets the value of [gcs_image_uri][crate::model::ImageSource::gcs_image_uri].
519    pub fn set_gcs_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
520        self.gcs_image_uri = v.into();
521        self
522    }
523
524    /// Sets the value of [image_uri][crate::model::ImageSource::image_uri].
525    pub fn set_image_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
526        self.image_uri = v.into();
527        self
528    }
529}
530
531impl wkt::message::Message for ImageSource {
532    fn typename() -> &'static str {
533        "type.googleapis.com/google.cloud.vision.v1.ImageSource"
534    }
535}
536
537/// Client image to perform Google Cloud Vision API tasks over.
538#[derive(Clone, Default, PartialEq)]
539#[non_exhaustive]
540pub struct Image {
541    /// Image content, represented as a stream of bytes.
542    /// Note: As with all `bytes` fields, protobuffers use a pure binary
543    /// representation, whereas JSON representations use base64.
544    ///
545    /// Currently, this field only works for BatchAnnotateImages requests. It does
546    /// not work for AsyncBatchAnnotateImages requests.
547    pub content: ::bytes::Bytes,
548
549    /// Google Cloud Storage image location, or publicly-accessible image
550    /// URL. If both `content` and `source` are provided for an image, `content`
551    /// takes precedence and is used to perform the image annotation request.
552    pub source: std::option::Option<crate::model::ImageSource>,
553
554    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
555}
556
557impl Image {
558    pub fn new() -> Self {
559        std::default::Default::default()
560    }
561
562    /// Sets the value of [content][crate::model::Image::content].
563    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
564        self.content = v.into();
565        self
566    }
567
568    /// Sets the value of [source][crate::model::Image::source].
569    pub fn set_source<T>(mut self, v: T) -> Self
570    where
571        T: std::convert::Into<crate::model::ImageSource>,
572    {
573        self.source = std::option::Option::Some(v.into());
574        self
575    }
576
577    /// Sets or clears the value of [source][crate::model::Image::source].
578    pub fn set_or_clear_source<T>(mut self, v: std::option::Option<T>) -> Self
579    where
580        T: std::convert::Into<crate::model::ImageSource>,
581    {
582        self.source = v.map(|x| x.into());
583        self
584    }
585}
586
587impl wkt::message::Message for Image {
588    fn typename() -> &'static str {
589        "type.googleapis.com/google.cloud.vision.v1.Image"
590    }
591}
592
593/// A face annotation object contains the results of face detection.
594#[derive(Clone, Default, PartialEq)]
595#[non_exhaustive]
596pub struct FaceAnnotation {
597    /// The bounding polygon around the face. The coordinates of the bounding box
598    /// are in the original image's scale.
599    /// The bounding box is computed to "frame" the face in accordance with human
600    /// expectations. It is based on the landmarker results.
601    /// Note that one or more x and/or y coordinates may not be generated in the
602    /// `BoundingPoly` (the polygon will be unbounded) if only a partial face
603    /// appears in the image to be annotated.
604    pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
605
606    /// The `fd_bounding_poly` bounding polygon is tighter than the
607    /// `boundingPoly`, and encloses only the skin part of the face. Typically, it
608    /// is used to eliminate the face from any image analysis that detects the
609    /// "amount of skin" visible in an image. It is not based on the
610    /// landmarker results, only on the initial face detection, hence
611    /// the \<code\>fd\</code\> (face detection) prefix.
612    pub fd_bounding_poly: std::option::Option<crate::model::BoundingPoly>,
613
614    /// Detected face landmarks.
615    pub landmarks: std::vec::Vec<crate::model::face_annotation::Landmark>,
616
617    /// Roll angle, which indicates the amount of clockwise/anti-clockwise rotation
618    /// of the face relative to the image vertical about the axis perpendicular to
619    /// the face. Range [-180,180].
620    pub roll_angle: f32,
621
622    /// Yaw angle, which indicates the leftward/rightward angle that the face is
623    /// pointing relative to the vertical plane perpendicular to the image. Range
624    /// [-180,180].
625    pub pan_angle: f32,
626
627    /// Pitch angle, which indicates the upwards/downwards angle that the face is
628    /// pointing relative to the image's horizontal plane. Range [-180,180].
629    pub tilt_angle: f32,
630
631    /// Detection confidence. Range [0, 1].
632    pub detection_confidence: f32,
633
634    /// Face landmarking confidence. Range [0, 1].
635    pub landmarking_confidence: f32,
636
637    /// Joy likelihood.
638    pub joy_likelihood: crate::model::Likelihood,
639
640    /// Sorrow likelihood.
641    pub sorrow_likelihood: crate::model::Likelihood,
642
643    /// Anger likelihood.
644    pub anger_likelihood: crate::model::Likelihood,
645
646    /// Surprise likelihood.
647    pub surprise_likelihood: crate::model::Likelihood,
648
649    /// Under-exposed likelihood.
650    pub under_exposed_likelihood: crate::model::Likelihood,
651
652    /// Blurred likelihood.
653    pub blurred_likelihood: crate::model::Likelihood,
654
655    /// Headwear likelihood.
656    pub headwear_likelihood: crate::model::Likelihood,
657
658    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
659}
660
661impl FaceAnnotation {
662    pub fn new() -> Self {
663        std::default::Default::default()
664    }
665
666    /// Sets the value of [bounding_poly][crate::model::FaceAnnotation::bounding_poly].
667    pub fn set_bounding_poly<T>(mut self, v: T) -> Self
668    where
669        T: std::convert::Into<crate::model::BoundingPoly>,
670    {
671        self.bounding_poly = std::option::Option::Some(v.into());
672        self
673    }
674
675    /// Sets or clears the value of [bounding_poly][crate::model::FaceAnnotation::bounding_poly].
676    pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
677    where
678        T: std::convert::Into<crate::model::BoundingPoly>,
679    {
680        self.bounding_poly = v.map(|x| x.into());
681        self
682    }
683
684    /// Sets the value of [fd_bounding_poly][crate::model::FaceAnnotation::fd_bounding_poly].
685    pub fn set_fd_bounding_poly<T>(mut self, v: T) -> Self
686    where
687        T: std::convert::Into<crate::model::BoundingPoly>,
688    {
689        self.fd_bounding_poly = std::option::Option::Some(v.into());
690        self
691    }
692
693    /// Sets or clears the value of [fd_bounding_poly][crate::model::FaceAnnotation::fd_bounding_poly].
694    pub fn set_or_clear_fd_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
695    where
696        T: std::convert::Into<crate::model::BoundingPoly>,
697    {
698        self.fd_bounding_poly = v.map(|x| x.into());
699        self
700    }
701
702    /// Sets the value of [landmarks][crate::model::FaceAnnotation::landmarks].
703    pub fn set_landmarks<T, V>(mut self, v: T) -> Self
704    where
705        T: std::iter::IntoIterator<Item = V>,
706        V: std::convert::Into<crate::model::face_annotation::Landmark>,
707    {
708        use std::iter::Iterator;
709        self.landmarks = v.into_iter().map(|i| i.into()).collect();
710        self
711    }
712
713    /// Sets the value of [roll_angle][crate::model::FaceAnnotation::roll_angle].
714    pub fn set_roll_angle<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
715        self.roll_angle = v.into();
716        self
717    }
718
719    /// Sets the value of [pan_angle][crate::model::FaceAnnotation::pan_angle].
720    pub fn set_pan_angle<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
721        self.pan_angle = v.into();
722        self
723    }
724
725    /// Sets the value of [tilt_angle][crate::model::FaceAnnotation::tilt_angle].
726    pub fn set_tilt_angle<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
727        self.tilt_angle = v.into();
728        self
729    }
730
731    /// Sets the value of [detection_confidence][crate::model::FaceAnnotation::detection_confidence].
732    pub fn set_detection_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
733        self.detection_confidence = v.into();
734        self
735    }
736
737    /// Sets the value of [landmarking_confidence][crate::model::FaceAnnotation::landmarking_confidence].
738    pub fn set_landmarking_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
739        self.landmarking_confidence = v.into();
740        self
741    }
742
743    /// Sets the value of [joy_likelihood][crate::model::FaceAnnotation::joy_likelihood].
744    pub fn set_joy_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
745        mut self,
746        v: T,
747    ) -> Self {
748        self.joy_likelihood = v.into();
749        self
750    }
751
752    /// Sets the value of [sorrow_likelihood][crate::model::FaceAnnotation::sorrow_likelihood].
753    pub fn set_sorrow_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
754        mut self,
755        v: T,
756    ) -> Self {
757        self.sorrow_likelihood = v.into();
758        self
759    }
760
761    /// Sets the value of [anger_likelihood][crate::model::FaceAnnotation::anger_likelihood].
762    pub fn set_anger_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
763        mut self,
764        v: T,
765    ) -> Self {
766        self.anger_likelihood = v.into();
767        self
768    }
769
770    /// Sets the value of [surprise_likelihood][crate::model::FaceAnnotation::surprise_likelihood].
771    pub fn set_surprise_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
772        mut self,
773        v: T,
774    ) -> Self {
775        self.surprise_likelihood = v.into();
776        self
777    }
778
779    /// Sets the value of [under_exposed_likelihood][crate::model::FaceAnnotation::under_exposed_likelihood].
780    pub fn set_under_exposed_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
781        mut self,
782        v: T,
783    ) -> Self {
784        self.under_exposed_likelihood = v.into();
785        self
786    }
787
788    /// Sets the value of [blurred_likelihood][crate::model::FaceAnnotation::blurred_likelihood].
789    pub fn set_blurred_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
790        mut self,
791        v: T,
792    ) -> Self {
793        self.blurred_likelihood = v.into();
794        self
795    }
796
797    /// Sets the value of [headwear_likelihood][crate::model::FaceAnnotation::headwear_likelihood].
798    pub fn set_headwear_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
799        mut self,
800        v: T,
801    ) -> Self {
802        self.headwear_likelihood = v.into();
803        self
804    }
805}
806
807impl wkt::message::Message for FaceAnnotation {
808    fn typename() -> &'static str {
809        "type.googleapis.com/google.cloud.vision.v1.FaceAnnotation"
810    }
811}
812
813/// Defines additional types related to [FaceAnnotation].
814pub mod face_annotation {
815    #[allow(unused_imports)]
816    use super::*;
817
818    /// A face-specific landmark (for example, a face feature).
819    #[derive(Clone, Default, PartialEq)]
820    #[non_exhaustive]
821    pub struct Landmark {
822        /// Face landmark type.
823        pub r#type: crate::model::face_annotation::landmark::Type,
824
825        /// Face landmark position.
826        pub position: std::option::Option<crate::model::Position>,
827
828        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
829    }
830
831    impl Landmark {
832        pub fn new() -> Self {
833            std::default::Default::default()
834        }
835
836        /// Sets the value of [r#type][crate::model::face_annotation::Landmark::type].
837        pub fn set_type<T: std::convert::Into<crate::model::face_annotation::landmark::Type>>(
838            mut self,
839            v: T,
840        ) -> Self {
841            self.r#type = v.into();
842            self
843        }
844
845        /// Sets the value of [position][crate::model::face_annotation::Landmark::position].
846        pub fn set_position<T>(mut self, v: T) -> Self
847        where
848            T: std::convert::Into<crate::model::Position>,
849        {
850            self.position = std::option::Option::Some(v.into());
851            self
852        }
853
854        /// Sets or clears the value of [position][crate::model::face_annotation::Landmark::position].
855        pub fn set_or_clear_position<T>(mut self, v: std::option::Option<T>) -> Self
856        where
857            T: std::convert::Into<crate::model::Position>,
858        {
859            self.position = v.map(|x| x.into());
860            self
861        }
862    }
863
864    impl wkt::message::Message for Landmark {
865        fn typename() -> &'static str {
866            "type.googleapis.com/google.cloud.vision.v1.FaceAnnotation.Landmark"
867        }
868    }
869
870    /// Defines additional types related to [Landmark].
871    pub mod landmark {
872        #[allow(unused_imports)]
873        use super::*;
874
875        /// Face landmark (feature) type.
876        /// Left and right are defined from the vantage of the viewer of the image
877        /// without considering mirror projections typical of photos. So, `LEFT_EYE`,
878        /// typically, is the person's right eye.
879        ///
880        /// # Working with unknown values
881        ///
882        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
883        /// additional enum variants at any time. Adding new variants is not considered
884        /// a breaking change. Applications should write their code in anticipation of:
885        ///
886        /// - New values appearing in future releases of the client library, **and**
887        /// - New values received dynamically, without application changes.
888        ///
889        /// Please consult the [Working with enums] section in the user guide for some
890        /// guidelines.
891        ///
892        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
893        #[derive(Clone, Debug, PartialEq)]
894        #[non_exhaustive]
895        pub enum Type {
896            /// Unknown face landmark detected. Should not be filled.
897            UnknownLandmark,
898            /// Left eye.
899            LeftEye,
900            /// Right eye.
901            RightEye,
902            /// Left of left eyebrow.
903            LeftOfLeftEyebrow,
904            /// Right of left eyebrow.
905            RightOfLeftEyebrow,
906            /// Left of right eyebrow.
907            LeftOfRightEyebrow,
908            /// Right of right eyebrow.
909            RightOfRightEyebrow,
910            /// Midpoint between eyes.
911            MidpointBetweenEyes,
912            /// Nose tip.
913            NoseTip,
914            /// Upper lip.
915            UpperLip,
916            /// Lower lip.
917            LowerLip,
918            /// Mouth left.
919            MouthLeft,
920            /// Mouth right.
921            MouthRight,
922            /// Mouth center.
923            MouthCenter,
924            /// Nose, bottom right.
925            NoseBottomRight,
926            /// Nose, bottom left.
927            NoseBottomLeft,
928            /// Nose, bottom center.
929            NoseBottomCenter,
930            /// Left eye, top boundary.
931            LeftEyeTopBoundary,
932            /// Left eye, right corner.
933            LeftEyeRightCorner,
934            /// Left eye, bottom boundary.
935            LeftEyeBottomBoundary,
936            /// Left eye, left corner.
937            LeftEyeLeftCorner,
938            /// Right eye, top boundary.
939            RightEyeTopBoundary,
940            /// Right eye, right corner.
941            RightEyeRightCorner,
942            /// Right eye, bottom boundary.
943            RightEyeBottomBoundary,
944            /// Right eye, left corner.
945            RightEyeLeftCorner,
946            /// Left eyebrow, upper midpoint.
947            LeftEyebrowUpperMidpoint,
948            /// Right eyebrow, upper midpoint.
949            RightEyebrowUpperMidpoint,
950            /// Left ear tragion.
951            LeftEarTragion,
952            /// Right ear tragion.
953            RightEarTragion,
954            /// Left eye pupil.
955            LeftEyePupil,
956            /// Right eye pupil.
957            RightEyePupil,
958            /// Forehead glabella.
959            ForeheadGlabella,
960            /// Chin gnathion.
961            ChinGnathion,
962            /// Chin left gonion.
963            ChinLeftGonion,
964            /// Chin right gonion.
965            ChinRightGonion,
966            /// Left cheek center.
967            LeftCheekCenter,
968            /// Right cheek center.
969            RightCheekCenter,
970            /// If set, the enum was initialized with an unknown value.
971            ///
972            /// Applications can examine the value using [Type::value] or
973            /// [Type::name].
974            UnknownValue(r#type::UnknownValue),
975        }
976
977        #[doc(hidden)]
978        pub mod r#type {
979            #[allow(unused_imports)]
980            use super::*;
981            #[derive(Clone, Debug, PartialEq)]
982            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
983        }
984
985        impl Type {
986            /// Gets the enum value.
987            ///
988            /// Returns `None` if the enum contains an unknown value deserialized from
989            /// the string representation of enums.
990            pub fn value(&self) -> std::option::Option<i32> {
991                match self {
992                    Self::UnknownLandmark => std::option::Option::Some(0),
993                    Self::LeftEye => std::option::Option::Some(1),
994                    Self::RightEye => std::option::Option::Some(2),
995                    Self::LeftOfLeftEyebrow => std::option::Option::Some(3),
996                    Self::RightOfLeftEyebrow => std::option::Option::Some(4),
997                    Self::LeftOfRightEyebrow => std::option::Option::Some(5),
998                    Self::RightOfRightEyebrow => std::option::Option::Some(6),
999                    Self::MidpointBetweenEyes => std::option::Option::Some(7),
1000                    Self::NoseTip => std::option::Option::Some(8),
1001                    Self::UpperLip => std::option::Option::Some(9),
1002                    Self::LowerLip => std::option::Option::Some(10),
1003                    Self::MouthLeft => std::option::Option::Some(11),
1004                    Self::MouthRight => std::option::Option::Some(12),
1005                    Self::MouthCenter => std::option::Option::Some(13),
1006                    Self::NoseBottomRight => std::option::Option::Some(14),
1007                    Self::NoseBottomLeft => std::option::Option::Some(15),
1008                    Self::NoseBottomCenter => std::option::Option::Some(16),
1009                    Self::LeftEyeTopBoundary => std::option::Option::Some(17),
1010                    Self::LeftEyeRightCorner => std::option::Option::Some(18),
1011                    Self::LeftEyeBottomBoundary => std::option::Option::Some(19),
1012                    Self::LeftEyeLeftCorner => std::option::Option::Some(20),
1013                    Self::RightEyeTopBoundary => std::option::Option::Some(21),
1014                    Self::RightEyeRightCorner => std::option::Option::Some(22),
1015                    Self::RightEyeBottomBoundary => std::option::Option::Some(23),
1016                    Self::RightEyeLeftCorner => std::option::Option::Some(24),
1017                    Self::LeftEyebrowUpperMidpoint => std::option::Option::Some(25),
1018                    Self::RightEyebrowUpperMidpoint => std::option::Option::Some(26),
1019                    Self::LeftEarTragion => std::option::Option::Some(27),
1020                    Self::RightEarTragion => std::option::Option::Some(28),
1021                    Self::LeftEyePupil => std::option::Option::Some(29),
1022                    Self::RightEyePupil => std::option::Option::Some(30),
1023                    Self::ForeheadGlabella => std::option::Option::Some(31),
1024                    Self::ChinGnathion => std::option::Option::Some(32),
1025                    Self::ChinLeftGonion => std::option::Option::Some(33),
1026                    Self::ChinRightGonion => std::option::Option::Some(34),
1027                    Self::LeftCheekCenter => std::option::Option::Some(35),
1028                    Self::RightCheekCenter => std::option::Option::Some(36),
1029                    Self::UnknownValue(u) => u.0.value(),
1030                }
1031            }
1032
1033            /// Gets the enum value as a string.
1034            ///
1035            /// Returns `None` if the enum contains an unknown value deserialized from
1036            /// the integer representation of enums.
1037            pub fn name(&self) -> std::option::Option<&str> {
1038                match self {
1039                    Self::UnknownLandmark => std::option::Option::Some("UNKNOWN_LANDMARK"),
1040                    Self::LeftEye => std::option::Option::Some("LEFT_EYE"),
1041                    Self::RightEye => std::option::Option::Some("RIGHT_EYE"),
1042                    Self::LeftOfLeftEyebrow => std::option::Option::Some("LEFT_OF_LEFT_EYEBROW"),
1043                    Self::RightOfLeftEyebrow => std::option::Option::Some("RIGHT_OF_LEFT_EYEBROW"),
1044                    Self::LeftOfRightEyebrow => std::option::Option::Some("LEFT_OF_RIGHT_EYEBROW"),
1045                    Self::RightOfRightEyebrow => {
1046                        std::option::Option::Some("RIGHT_OF_RIGHT_EYEBROW")
1047                    }
1048                    Self::MidpointBetweenEyes => std::option::Option::Some("MIDPOINT_BETWEEN_EYES"),
1049                    Self::NoseTip => std::option::Option::Some("NOSE_TIP"),
1050                    Self::UpperLip => std::option::Option::Some("UPPER_LIP"),
1051                    Self::LowerLip => std::option::Option::Some("LOWER_LIP"),
1052                    Self::MouthLeft => std::option::Option::Some("MOUTH_LEFT"),
1053                    Self::MouthRight => std::option::Option::Some("MOUTH_RIGHT"),
1054                    Self::MouthCenter => std::option::Option::Some("MOUTH_CENTER"),
1055                    Self::NoseBottomRight => std::option::Option::Some("NOSE_BOTTOM_RIGHT"),
1056                    Self::NoseBottomLeft => std::option::Option::Some("NOSE_BOTTOM_LEFT"),
1057                    Self::NoseBottomCenter => std::option::Option::Some("NOSE_BOTTOM_CENTER"),
1058                    Self::LeftEyeTopBoundary => std::option::Option::Some("LEFT_EYE_TOP_BOUNDARY"),
1059                    Self::LeftEyeRightCorner => std::option::Option::Some("LEFT_EYE_RIGHT_CORNER"),
1060                    Self::LeftEyeBottomBoundary => {
1061                        std::option::Option::Some("LEFT_EYE_BOTTOM_BOUNDARY")
1062                    }
1063                    Self::LeftEyeLeftCorner => std::option::Option::Some("LEFT_EYE_LEFT_CORNER"),
1064                    Self::RightEyeTopBoundary => {
1065                        std::option::Option::Some("RIGHT_EYE_TOP_BOUNDARY")
1066                    }
1067                    Self::RightEyeRightCorner => {
1068                        std::option::Option::Some("RIGHT_EYE_RIGHT_CORNER")
1069                    }
1070                    Self::RightEyeBottomBoundary => {
1071                        std::option::Option::Some("RIGHT_EYE_BOTTOM_BOUNDARY")
1072                    }
1073                    Self::RightEyeLeftCorner => std::option::Option::Some("RIGHT_EYE_LEFT_CORNER"),
1074                    Self::LeftEyebrowUpperMidpoint => {
1075                        std::option::Option::Some("LEFT_EYEBROW_UPPER_MIDPOINT")
1076                    }
1077                    Self::RightEyebrowUpperMidpoint => {
1078                        std::option::Option::Some("RIGHT_EYEBROW_UPPER_MIDPOINT")
1079                    }
1080                    Self::LeftEarTragion => std::option::Option::Some("LEFT_EAR_TRAGION"),
1081                    Self::RightEarTragion => std::option::Option::Some("RIGHT_EAR_TRAGION"),
1082                    Self::LeftEyePupil => std::option::Option::Some("LEFT_EYE_PUPIL"),
1083                    Self::RightEyePupil => std::option::Option::Some("RIGHT_EYE_PUPIL"),
1084                    Self::ForeheadGlabella => std::option::Option::Some("FOREHEAD_GLABELLA"),
1085                    Self::ChinGnathion => std::option::Option::Some("CHIN_GNATHION"),
1086                    Self::ChinLeftGonion => std::option::Option::Some("CHIN_LEFT_GONION"),
1087                    Self::ChinRightGonion => std::option::Option::Some("CHIN_RIGHT_GONION"),
1088                    Self::LeftCheekCenter => std::option::Option::Some("LEFT_CHEEK_CENTER"),
1089                    Self::RightCheekCenter => std::option::Option::Some("RIGHT_CHEEK_CENTER"),
1090                    Self::UnknownValue(u) => u.0.name(),
1091                }
1092            }
1093        }
1094
1095        impl std::default::Default for Type {
1096            fn default() -> Self {
1097                use std::convert::From;
1098                Self::from(0)
1099            }
1100        }
1101
1102        impl std::fmt::Display for Type {
1103            fn fmt(
1104                &self,
1105                f: &mut std::fmt::Formatter<'_>,
1106            ) -> std::result::Result<(), std::fmt::Error> {
1107                wkt::internal::display_enum(f, self.name(), self.value())
1108            }
1109        }
1110
1111        impl std::convert::From<i32> for Type {
1112            fn from(value: i32) -> Self {
1113                match value {
1114                    0 => Self::UnknownLandmark,
1115                    1 => Self::LeftEye,
1116                    2 => Self::RightEye,
1117                    3 => Self::LeftOfLeftEyebrow,
1118                    4 => Self::RightOfLeftEyebrow,
1119                    5 => Self::LeftOfRightEyebrow,
1120                    6 => Self::RightOfRightEyebrow,
1121                    7 => Self::MidpointBetweenEyes,
1122                    8 => Self::NoseTip,
1123                    9 => Self::UpperLip,
1124                    10 => Self::LowerLip,
1125                    11 => Self::MouthLeft,
1126                    12 => Self::MouthRight,
1127                    13 => Self::MouthCenter,
1128                    14 => Self::NoseBottomRight,
1129                    15 => Self::NoseBottomLeft,
1130                    16 => Self::NoseBottomCenter,
1131                    17 => Self::LeftEyeTopBoundary,
1132                    18 => Self::LeftEyeRightCorner,
1133                    19 => Self::LeftEyeBottomBoundary,
1134                    20 => Self::LeftEyeLeftCorner,
1135                    21 => Self::RightEyeTopBoundary,
1136                    22 => Self::RightEyeRightCorner,
1137                    23 => Self::RightEyeBottomBoundary,
1138                    24 => Self::RightEyeLeftCorner,
1139                    25 => Self::LeftEyebrowUpperMidpoint,
1140                    26 => Self::RightEyebrowUpperMidpoint,
1141                    27 => Self::LeftEarTragion,
1142                    28 => Self::RightEarTragion,
1143                    29 => Self::LeftEyePupil,
1144                    30 => Self::RightEyePupil,
1145                    31 => Self::ForeheadGlabella,
1146                    32 => Self::ChinGnathion,
1147                    33 => Self::ChinLeftGonion,
1148                    34 => Self::ChinRightGonion,
1149                    35 => Self::LeftCheekCenter,
1150                    36 => Self::RightCheekCenter,
1151                    _ => Self::UnknownValue(r#type::UnknownValue(
1152                        wkt::internal::UnknownEnumValue::Integer(value),
1153                    )),
1154                }
1155            }
1156        }
1157
1158        impl std::convert::From<&str> for Type {
1159            fn from(value: &str) -> Self {
1160                use std::string::ToString;
1161                match value {
1162                    "UNKNOWN_LANDMARK" => Self::UnknownLandmark,
1163                    "LEFT_EYE" => Self::LeftEye,
1164                    "RIGHT_EYE" => Self::RightEye,
1165                    "LEFT_OF_LEFT_EYEBROW" => Self::LeftOfLeftEyebrow,
1166                    "RIGHT_OF_LEFT_EYEBROW" => Self::RightOfLeftEyebrow,
1167                    "LEFT_OF_RIGHT_EYEBROW" => Self::LeftOfRightEyebrow,
1168                    "RIGHT_OF_RIGHT_EYEBROW" => Self::RightOfRightEyebrow,
1169                    "MIDPOINT_BETWEEN_EYES" => Self::MidpointBetweenEyes,
1170                    "NOSE_TIP" => Self::NoseTip,
1171                    "UPPER_LIP" => Self::UpperLip,
1172                    "LOWER_LIP" => Self::LowerLip,
1173                    "MOUTH_LEFT" => Self::MouthLeft,
1174                    "MOUTH_RIGHT" => Self::MouthRight,
1175                    "MOUTH_CENTER" => Self::MouthCenter,
1176                    "NOSE_BOTTOM_RIGHT" => Self::NoseBottomRight,
1177                    "NOSE_BOTTOM_LEFT" => Self::NoseBottomLeft,
1178                    "NOSE_BOTTOM_CENTER" => Self::NoseBottomCenter,
1179                    "LEFT_EYE_TOP_BOUNDARY" => Self::LeftEyeTopBoundary,
1180                    "LEFT_EYE_RIGHT_CORNER" => Self::LeftEyeRightCorner,
1181                    "LEFT_EYE_BOTTOM_BOUNDARY" => Self::LeftEyeBottomBoundary,
1182                    "LEFT_EYE_LEFT_CORNER" => Self::LeftEyeLeftCorner,
1183                    "RIGHT_EYE_TOP_BOUNDARY" => Self::RightEyeTopBoundary,
1184                    "RIGHT_EYE_RIGHT_CORNER" => Self::RightEyeRightCorner,
1185                    "RIGHT_EYE_BOTTOM_BOUNDARY" => Self::RightEyeBottomBoundary,
1186                    "RIGHT_EYE_LEFT_CORNER" => Self::RightEyeLeftCorner,
1187                    "LEFT_EYEBROW_UPPER_MIDPOINT" => Self::LeftEyebrowUpperMidpoint,
1188                    "RIGHT_EYEBROW_UPPER_MIDPOINT" => Self::RightEyebrowUpperMidpoint,
1189                    "LEFT_EAR_TRAGION" => Self::LeftEarTragion,
1190                    "RIGHT_EAR_TRAGION" => Self::RightEarTragion,
1191                    "LEFT_EYE_PUPIL" => Self::LeftEyePupil,
1192                    "RIGHT_EYE_PUPIL" => Self::RightEyePupil,
1193                    "FOREHEAD_GLABELLA" => Self::ForeheadGlabella,
1194                    "CHIN_GNATHION" => Self::ChinGnathion,
1195                    "CHIN_LEFT_GONION" => Self::ChinLeftGonion,
1196                    "CHIN_RIGHT_GONION" => Self::ChinRightGonion,
1197                    "LEFT_CHEEK_CENTER" => Self::LeftCheekCenter,
1198                    "RIGHT_CHEEK_CENTER" => Self::RightCheekCenter,
1199                    _ => Self::UnknownValue(r#type::UnknownValue(
1200                        wkt::internal::UnknownEnumValue::String(value.to_string()),
1201                    )),
1202                }
1203            }
1204        }
1205
1206        impl serde::ser::Serialize for Type {
1207            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
1208            where
1209                S: serde::Serializer,
1210            {
1211                match self {
1212                    Self::UnknownLandmark => serializer.serialize_i32(0),
1213                    Self::LeftEye => serializer.serialize_i32(1),
1214                    Self::RightEye => serializer.serialize_i32(2),
1215                    Self::LeftOfLeftEyebrow => serializer.serialize_i32(3),
1216                    Self::RightOfLeftEyebrow => serializer.serialize_i32(4),
1217                    Self::LeftOfRightEyebrow => serializer.serialize_i32(5),
1218                    Self::RightOfRightEyebrow => serializer.serialize_i32(6),
1219                    Self::MidpointBetweenEyes => serializer.serialize_i32(7),
1220                    Self::NoseTip => serializer.serialize_i32(8),
1221                    Self::UpperLip => serializer.serialize_i32(9),
1222                    Self::LowerLip => serializer.serialize_i32(10),
1223                    Self::MouthLeft => serializer.serialize_i32(11),
1224                    Self::MouthRight => serializer.serialize_i32(12),
1225                    Self::MouthCenter => serializer.serialize_i32(13),
1226                    Self::NoseBottomRight => serializer.serialize_i32(14),
1227                    Self::NoseBottomLeft => serializer.serialize_i32(15),
1228                    Self::NoseBottomCenter => serializer.serialize_i32(16),
1229                    Self::LeftEyeTopBoundary => serializer.serialize_i32(17),
1230                    Self::LeftEyeRightCorner => serializer.serialize_i32(18),
1231                    Self::LeftEyeBottomBoundary => serializer.serialize_i32(19),
1232                    Self::LeftEyeLeftCorner => serializer.serialize_i32(20),
1233                    Self::RightEyeTopBoundary => serializer.serialize_i32(21),
1234                    Self::RightEyeRightCorner => serializer.serialize_i32(22),
1235                    Self::RightEyeBottomBoundary => serializer.serialize_i32(23),
1236                    Self::RightEyeLeftCorner => serializer.serialize_i32(24),
1237                    Self::LeftEyebrowUpperMidpoint => serializer.serialize_i32(25),
1238                    Self::RightEyebrowUpperMidpoint => serializer.serialize_i32(26),
1239                    Self::LeftEarTragion => serializer.serialize_i32(27),
1240                    Self::RightEarTragion => serializer.serialize_i32(28),
1241                    Self::LeftEyePupil => serializer.serialize_i32(29),
1242                    Self::RightEyePupil => serializer.serialize_i32(30),
1243                    Self::ForeheadGlabella => serializer.serialize_i32(31),
1244                    Self::ChinGnathion => serializer.serialize_i32(32),
1245                    Self::ChinLeftGonion => serializer.serialize_i32(33),
1246                    Self::ChinRightGonion => serializer.serialize_i32(34),
1247                    Self::LeftCheekCenter => serializer.serialize_i32(35),
1248                    Self::RightCheekCenter => serializer.serialize_i32(36),
1249                    Self::UnknownValue(u) => u.0.serialize(serializer),
1250                }
1251            }
1252        }
1253
1254        impl<'de> serde::de::Deserialize<'de> for Type {
1255            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
1256            where
1257                D: serde::Deserializer<'de>,
1258            {
1259                deserializer.deserialize_any(wkt::internal::EnumVisitor::<Type>::new(
1260                    ".google.cloud.vision.v1.FaceAnnotation.Landmark.Type",
1261                ))
1262            }
1263        }
1264    }
1265}
1266
1267/// Detected entity location information.
1268#[derive(Clone, Default, PartialEq)]
1269#[non_exhaustive]
1270pub struct LocationInfo {
1271    /// lat/long location coordinates.
1272    pub lat_lng: std::option::Option<gtype::model::LatLng>,
1273
1274    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1275}
1276
1277impl LocationInfo {
1278    pub fn new() -> Self {
1279        std::default::Default::default()
1280    }
1281
1282    /// Sets the value of [lat_lng][crate::model::LocationInfo::lat_lng].
1283    pub fn set_lat_lng<T>(mut self, v: T) -> Self
1284    where
1285        T: std::convert::Into<gtype::model::LatLng>,
1286    {
1287        self.lat_lng = std::option::Option::Some(v.into());
1288        self
1289    }
1290
1291    /// Sets or clears the value of [lat_lng][crate::model::LocationInfo::lat_lng].
1292    pub fn set_or_clear_lat_lng<T>(mut self, v: std::option::Option<T>) -> Self
1293    where
1294        T: std::convert::Into<gtype::model::LatLng>,
1295    {
1296        self.lat_lng = v.map(|x| x.into());
1297        self
1298    }
1299}
1300
1301impl wkt::message::Message for LocationInfo {
1302    fn typename() -> &'static str {
1303        "type.googleapis.com/google.cloud.vision.v1.LocationInfo"
1304    }
1305}
1306
1307/// A `Property` consists of a user-supplied name/value pair.
1308#[derive(Clone, Default, PartialEq)]
1309#[non_exhaustive]
1310pub struct Property {
1311    /// Name of the property.
1312    pub name: std::string::String,
1313
1314    /// Value of the property.
1315    pub value: std::string::String,
1316
1317    /// Value of numeric properties.
1318    pub uint64_value: u64,
1319
1320    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1321}
1322
1323impl Property {
1324    pub fn new() -> Self {
1325        std::default::Default::default()
1326    }
1327
1328    /// Sets the value of [name][crate::model::Property::name].
1329    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1330        self.name = v.into();
1331        self
1332    }
1333
1334    /// Sets the value of [value][crate::model::Property::value].
1335    pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1336        self.value = v.into();
1337        self
1338    }
1339
1340    /// Sets the value of [uint64_value][crate::model::Property::uint64_value].
1341    pub fn set_uint64_value<T: std::convert::Into<u64>>(mut self, v: T) -> Self {
1342        self.uint64_value = v.into();
1343        self
1344    }
1345}
1346
1347impl wkt::message::Message for Property {
1348    fn typename() -> &'static str {
1349        "type.googleapis.com/google.cloud.vision.v1.Property"
1350    }
1351}
1352
1353/// Set of detected entity features.
1354#[derive(Clone, Default, PartialEq)]
1355#[non_exhaustive]
1356pub struct EntityAnnotation {
1357    /// Opaque entity ID. Some IDs may be available in
1358    /// [Google Knowledge Graph Search
1359    /// API](https://developers.google.com/knowledge-graph/).
1360    pub mid: std::string::String,
1361
1362    /// The language code for the locale in which the entity textual
1363    /// `description` is expressed.
1364    pub locale: std::string::String,
1365
1366    /// Entity textual description, expressed in its `locale` language.
1367    pub description: std::string::String,
1368
1369    /// Overall score of the result. Range [0, 1].
1370    pub score: f32,
1371
1372    /// **Deprecated. Use `score` instead.**
1373    /// The accuracy of the entity detection in an image.
1374    /// For example, for an image in which the "Eiffel Tower" entity is detected,
1375    /// this field represents the confidence that there is a tower in the query
1376    /// image. Range [0, 1].
1377    #[deprecated]
1378    pub confidence: f32,
1379
1380    /// The relevancy of the ICA (Image Content Annotation) label to the
1381    /// image. For example, the relevancy of "tower" is likely higher to an image
1382    /// containing the detected "Eiffel Tower" than to an image containing a
1383    /// detected distant towering building, even though the confidence that
1384    /// there is a tower in each image may be the same. Range [0, 1].
1385    pub topicality: f32,
1386
1387    /// Image region to which this entity belongs. Not produced
1388    /// for `LABEL_DETECTION` features.
1389    pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1390
1391    /// The location information for the detected entity. Multiple
1392    /// `LocationInfo` elements can be present because one location may
1393    /// indicate the location of the scene in the image, and another location
1394    /// may indicate the location of the place where the image was taken.
1395    /// Location information is usually present for landmarks.
1396    pub locations: std::vec::Vec<crate::model::LocationInfo>,
1397
1398    /// Some entities may have optional user-supplied `Property` (name/value)
1399    /// fields, such a score or string that qualifies the entity.
1400    pub properties: std::vec::Vec<crate::model::Property>,
1401
1402    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1403}
1404
1405impl EntityAnnotation {
1406    pub fn new() -> Self {
1407        std::default::Default::default()
1408    }
1409
1410    /// Sets the value of [mid][crate::model::EntityAnnotation::mid].
1411    pub fn set_mid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1412        self.mid = v.into();
1413        self
1414    }
1415
1416    /// Sets the value of [locale][crate::model::EntityAnnotation::locale].
1417    pub fn set_locale<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1418        self.locale = v.into();
1419        self
1420    }
1421
1422    /// Sets the value of [description][crate::model::EntityAnnotation::description].
1423    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1424        self.description = v.into();
1425        self
1426    }
1427
1428    /// Sets the value of [score][crate::model::EntityAnnotation::score].
1429    pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1430        self.score = v.into();
1431        self
1432    }
1433
1434    /// Sets the value of [confidence][crate::model::EntityAnnotation::confidence].
1435    #[deprecated]
1436    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1437        self.confidence = v.into();
1438        self
1439    }
1440
1441    /// Sets the value of [topicality][crate::model::EntityAnnotation::topicality].
1442    pub fn set_topicality<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1443        self.topicality = v.into();
1444        self
1445    }
1446
1447    /// Sets the value of [bounding_poly][crate::model::EntityAnnotation::bounding_poly].
1448    pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1449    where
1450        T: std::convert::Into<crate::model::BoundingPoly>,
1451    {
1452        self.bounding_poly = std::option::Option::Some(v.into());
1453        self
1454    }
1455
1456    /// Sets or clears the value of [bounding_poly][crate::model::EntityAnnotation::bounding_poly].
1457    pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1458    where
1459        T: std::convert::Into<crate::model::BoundingPoly>,
1460    {
1461        self.bounding_poly = v.map(|x| x.into());
1462        self
1463    }
1464
1465    /// Sets the value of [locations][crate::model::EntityAnnotation::locations].
1466    pub fn set_locations<T, V>(mut self, v: T) -> Self
1467    where
1468        T: std::iter::IntoIterator<Item = V>,
1469        V: std::convert::Into<crate::model::LocationInfo>,
1470    {
1471        use std::iter::Iterator;
1472        self.locations = v.into_iter().map(|i| i.into()).collect();
1473        self
1474    }
1475
1476    /// Sets the value of [properties][crate::model::EntityAnnotation::properties].
1477    pub fn set_properties<T, V>(mut self, v: T) -> Self
1478    where
1479        T: std::iter::IntoIterator<Item = V>,
1480        V: std::convert::Into<crate::model::Property>,
1481    {
1482        use std::iter::Iterator;
1483        self.properties = v.into_iter().map(|i| i.into()).collect();
1484        self
1485    }
1486}
1487
1488impl wkt::message::Message for EntityAnnotation {
1489    fn typename() -> &'static str {
1490        "type.googleapis.com/google.cloud.vision.v1.EntityAnnotation"
1491    }
1492}
1493
1494/// Set of detected objects with bounding boxes.
1495#[derive(Clone, Default, PartialEq)]
1496#[non_exhaustive]
1497pub struct LocalizedObjectAnnotation {
1498    /// Object ID that should align with EntityAnnotation mid.
1499    pub mid: std::string::String,
1500
1501    /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more
1502    /// information, see
1503    /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier>.
1504    pub language_code: std::string::String,
1505
1506    /// Object name, expressed in its `language_code` language.
1507    pub name: std::string::String,
1508
1509    /// Score of the result. Range [0, 1].
1510    pub score: f32,
1511
1512    /// Image region to which this object belongs. This must be populated.
1513    pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1514
1515    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1516}
1517
1518impl LocalizedObjectAnnotation {
1519    pub fn new() -> Self {
1520        std::default::Default::default()
1521    }
1522
1523    /// Sets the value of [mid][crate::model::LocalizedObjectAnnotation::mid].
1524    pub fn set_mid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1525        self.mid = v.into();
1526        self
1527    }
1528
1529    /// Sets the value of [language_code][crate::model::LocalizedObjectAnnotation::language_code].
1530    pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1531        self.language_code = v.into();
1532        self
1533    }
1534
1535    /// Sets the value of [name][crate::model::LocalizedObjectAnnotation::name].
1536    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1537        self.name = v.into();
1538        self
1539    }
1540
1541    /// Sets the value of [score][crate::model::LocalizedObjectAnnotation::score].
1542    pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1543        self.score = v.into();
1544        self
1545    }
1546
1547    /// Sets the value of [bounding_poly][crate::model::LocalizedObjectAnnotation::bounding_poly].
1548    pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1549    where
1550        T: std::convert::Into<crate::model::BoundingPoly>,
1551    {
1552        self.bounding_poly = std::option::Option::Some(v.into());
1553        self
1554    }
1555
1556    /// Sets or clears the value of [bounding_poly][crate::model::LocalizedObjectAnnotation::bounding_poly].
1557    pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1558    where
1559        T: std::convert::Into<crate::model::BoundingPoly>,
1560    {
1561        self.bounding_poly = v.map(|x| x.into());
1562        self
1563    }
1564}
1565
1566impl wkt::message::Message for LocalizedObjectAnnotation {
1567    fn typename() -> &'static str {
1568        "type.googleapis.com/google.cloud.vision.v1.LocalizedObjectAnnotation"
1569    }
1570}
1571
1572/// Set of features pertaining to the image, computed by computer vision
1573/// methods over safe-search verticals (for example, adult, spoof, medical,
1574/// violence).
1575#[derive(Clone, Default, PartialEq)]
1576#[non_exhaustive]
1577pub struct SafeSearchAnnotation {
1578    /// Represents the adult content likelihood for the image. Adult content may
1579    /// contain elements such as nudity, pornographic images or cartoons, or
1580    /// sexual activities.
1581    pub adult: crate::model::Likelihood,
1582
1583    /// Spoof likelihood. The likelihood that an modification
1584    /// was made to the image's canonical version to make it appear
1585    /// funny or offensive.
1586    pub spoof: crate::model::Likelihood,
1587
1588    /// Likelihood that this is a medical image.
1589    pub medical: crate::model::Likelihood,
1590
1591    /// Likelihood that this image contains violent content. Violent content may
1592    /// include death, serious harm, or injury to individuals or groups of
1593    /// individuals.
1594    pub violence: crate::model::Likelihood,
1595
1596    /// Likelihood that the request image contains racy content. Racy content may
1597    /// include (but is not limited to) skimpy or sheer clothing, strategically
1598    /// covered nudity, lewd or provocative poses, or close-ups of sensitive
1599    /// body areas.
1600    pub racy: crate::model::Likelihood,
1601
1602    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1603}
1604
1605impl SafeSearchAnnotation {
1606    pub fn new() -> Self {
1607        std::default::Default::default()
1608    }
1609
1610    /// Sets the value of [adult][crate::model::SafeSearchAnnotation::adult].
1611    pub fn set_adult<T: std::convert::Into<crate::model::Likelihood>>(mut self, v: T) -> Self {
1612        self.adult = v.into();
1613        self
1614    }
1615
1616    /// Sets the value of [spoof][crate::model::SafeSearchAnnotation::spoof].
1617    pub fn set_spoof<T: std::convert::Into<crate::model::Likelihood>>(mut self, v: T) -> Self {
1618        self.spoof = v.into();
1619        self
1620    }
1621
1622    /// Sets the value of [medical][crate::model::SafeSearchAnnotation::medical].
1623    pub fn set_medical<T: std::convert::Into<crate::model::Likelihood>>(mut self, v: T) -> Self {
1624        self.medical = v.into();
1625        self
1626    }
1627
1628    /// Sets the value of [violence][crate::model::SafeSearchAnnotation::violence].
1629    pub fn set_violence<T: std::convert::Into<crate::model::Likelihood>>(mut self, v: T) -> Self {
1630        self.violence = v.into();
1631        self
1632    }
1633
1634    /// Sets the value of [racy][crate::model::SafeSearchAnnotation::racy].
1635    pub fn set_racy<T: std::convert::Into<crate::model::Likelihood>>(mut self, v: T) -> Self {
1636        self.racy = v.into();
1637        self
1638    }
1639}
1640
1641impl wkt::message::Message for SafeSearchAnnotation {
1642    fn typename() -> &'static str {
1643        "type.googleapis.com/google.cloud.vision.v1.SafeSearchAnnotation"
1644    }
1645}
1646
1647/// Rectangle determined by min and max `LatLng` pairs.
1648#[derive(Clone, Default, PartialEq)]
1649#[non_exhaustive]
1650pub struct LatLongRect {
1651    /// Min lat/long pair.
1652    pub min_lat_lng: std::option::Option<gtype::model::LatLng>,
1653
1654    /// Max lat/long pair.
1655    pub max_lat_lng: std::option::Option<gtype::model::LatLng>,
1656
1657    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1658}
1659
1660impl LatLongRect {
1661    pub fn new() -> Self {
1662        std::default::Default::default()
1663    }
1664
1665    /// Sets the value of [min_lat_lng][crate::model::LatLongRect::min_lat_lng].
1666    pub fn set_min_lat_lng<T>(mut self, v: T) -> Self
1667    where
1668        T: std::convert::Into<gtype::model::LatLng>,
1669    {
1670        self.min_lat_lng = std::option::Option::Some(v.into());
1671        self
1672    }
1673
1674    /// Sets or clears the value of [min_lat_lng][crate::model::LatLongRect::min_lat_lng].
1675    pub fn set_or_clear_min_lat_lng<T>(mut self, v: std::option::Option<T>) -> Self
1676    where
1677        T: std::convert::Into<gtype::model::LatLng>,
1678    {
1679        self.min_lat_lng = v.map(|x| x.into());
1680        self
1681    }
1682
1683    /// Sets the value of [max_lat_lng][crate::model::LatLongRect::max_lat_lng].
1684    pub fn set_max_lat_lng<T>(mut self, v: T) -> Self
1685    where
1686        T: std::convert::Into<gtype::model::LatLng>,
1687    {
1688        self.max_lat_lng = std::option::Option::Some(v.into());
1689        self
1690    }
1691
1692    /// Sets or clears the value of [max_lat_lng][crate::model::LatLongRect::max_lat_lng].
1693    pub fn set_or_clear_max_lat_lng<T>(mut self, v: std::option::Option<T>) -> Self
1694    where
1695        T: std::convert::Into<gtype::model::LatLng>,
1696    {
1697        self.max_lat_lng = v.map(|x| x.into());
1698        self
1699    }
1700}
1701
1702impl wkt::message::Message for LatLongRect {
1703    fn typename() -> &'static str {
1704        "type.googleapis.com/google.cloud.vision.v1.LatLongRect"
1705    }
1706}
1707
1708/// Color information consists of RGB channels, score, and the fraction of
1709/// the image that the color occupies in the image.
1710#[derive(Clone, Default, PartialEq)]
1711#[non_exhaustive]
1712pub struct ColorInfo {
1713    /// RGB components of the color.
1714    pub color: std::option::Option<gtype::model::Color>,
1715
1716    /// Image-specific score for this color. Value in range [0, 1].
1717    pub score: f32,
1718
1719    /// The fraction of pixels the color occupies in the image.
1720    /// Value in range [0, 1].
1721    pub pixel_fraction: f32,
1722
1723    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1724}
1725
1726impl ColorInfo {
1727    pub fn new() -> Self {
1728        std::default::Default::default()
1729    }
1730
1731    /// Sets the value of [color][crate::model::ColorInfo::color].
1732    pub fn set_color<T>(mut self, v: T) -> Self
1733    where
1734        T: std::convert::Into<gtype::model::Color>,
1735    {
1736        self.color = std::option::Option::Some(v.into());
1737        self
1738    }
1739
1740    /// Sets or clears the value of [color][crate::model::ColorInfo::color].
1741    pub fn set_or_clear_color<T>(mut self, v: std::option::Option<T>) -> Self
1742    where
1743        T: std::convert::Into<gtype::model::Color>,
1744    {
1745        self.color = v.map(|x| x.into());
1746        self
1747    }
1748
1749    /// Sets the value of [score][crate::model::ColorInfo::score].
1750    pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1751        self.score = v.into();
1752        self
1753    }
1754
1755    /// Sets the value of [pixel_fraction][crate::model::ColorInfo::pixel_fraction].
1756    pub fn set_pixel_fraction<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1757        self.pixel_fraction = v.into();
1758        self
1759    }
1760}
1761
1762impl wkt::message::Message for ColorInfo {
1763    fn typename() -> &'static str {
1764        "type.googleapis.com/google.cloud.vision.v1.ColorInfo"
1765    }
1766}
1767
1768/// Set of dominant colors and their corresponding scores.
1769#[derive(Clone, Default, PartialEq)]
1770#[non_exhaustive]
1771pub struct DominantColorsAnnotation {
1772    /// RGB color values with their score and pixel fraction.
1773    pub colors: std::vec::Vec<crate::model::ColorInfo>,
1774
1775    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1776}
1777
1778impl DominantColorsAnnotation {
1779    pub fn new() -> Self {
1780        std::default::Default::default()
1781    }
1782
1783    /// Sets the value of [colors][crate::model::DominantColorsAnnotation::colors].
1784    pub fn set_colors<T, V>(mut self, v: T) -> Self
1785    where
1786        T: std::iter::IntoIterator<Item = V>,
1787        V: std::convert::Into<crate::model::ColorInfo>,
1788    {
1789        use std::iter::Iterator;
1790        self.colors = v.into_iter().map(|i| i.into()).collect();
1791        self
1792    }
1793}
1794
1795impl wkt::message::Message for DominantColorsAnnotation {
1796    fn typename() -> &'static str {
1797        "type.googleapis.com/google.cloud.vision.v1.DominantColorsAnnotation"
1798    }
1799}
1800
1801/// Stores image properties, such as dominant colors.
1802#[derive(Clone, Default, PartialEq)]
1803#[non_exhaustive]
1804pub struct ImageProperties {
1805    /// If present, dominant colors completed successfully.
1806    pub dominant_colors: std::option::Option<crate::model::DominantColorsAnnotation>,
1807
1808    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1809}
1810
1811impl ImageProperties {
1812    pub fn new() -> Self {
1813        std::default::Default::default()
1814    }
1815
1816    /// Sets the value of [dominant_colors][crate::model::ImageProperties::dominant_colors].
1817    pub fn set_dominant_colors<T>(mut self, v: T) -> Self
1818    where
1819        T: std::convert::Into<crate::model::DominantColorsAnnotation>,
1820    {
1821        self.dominant_colors = std::option::Option::Some(v.into());
1822        self
1823    }
1824
1825    /// Sets or clears the value of [dominant_colors][crate::model::ImageProperties::dominant_colors].
1826    pub fn set_or_clear_dominant_colors<T>(mut self, v: std::option::Option<T>) -> Self
1827    where
1828        T: std::convert::Into<crate::model::DominantColorsAnnotation>,
1829    {
1830        self.dominant_colors = v.map(|x| x.into());
1831        self
1832    }
1833}
1834
1835impl wkt::message::Message for ImageProperties {
1836    fn typename() -> &'static str {
1837        "type.googleapis.com/google.cloud.vision.v1.ImageProperties"
1838    }
1839}
1840
1841/// Single crop hint that is used to generate a new crop when serving an image.
1842#[derive(Clone, Default, PartialEq)]
1843#[non_exhaustive]
1844pub struct CropHint {
1845    /// The bounding polygon for the crop region. The coordinates of the bounding
1846    /// box are in the original image's scale.
1847    pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
1848
1849    /// Confidence of this being a salient region.  Range [0, 1].
1850    pub confidence: f32,
1851
1852    /// Fraction of importance of this salient region with respect to the original
1853    /// image.
1854    pub importance_fraction: f32,
1855
1856    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1857}
1858
1859impl CropHint {
1860    pub fn new() -> Self {
1861        std::default::Default::default()
1862    }
1863
1864    /// Sets the value of [bounding_poly][crate::model::CropHint::bounding_poly].
1865    pub fn set_bounding_poly<T>(mut self, v: T) -> Self
1866    where
1867        T: std::convert::Into<crate::model::BoundingPoly>,
1868    {
1869        self.bounding_poly = std::option::Option::Some(v.into());
1870        self
1871    }
1872
1873    /// Sets or clears the value of [bounding_poly][crate::model::CropHint::bounding_poly].
1874    pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
1875    where
1876        T: std::convert::Into<crate::model::BoundingPoly>,
1877    {
1878        self.bounding_poly = v.map(|x| x.into());
1879        self
1880    }
1881
1882    /// Sets the value of [confidence][crate::model::CropHint::confidence].
1883    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1884        self.confidence = v.into();
1885        self
1886    }
1887
1888    /// Sets the value of [importance_fraction][crate::model::CropHint::importance_fraction].
1889    pub fn set_importance_fraction<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1890        self.importance_fraction = v.into();
1891        self
1892    }
1893}
1894
1895impl wkt::message::Message for CropHint {
1896    fn typename() -> &'static str {
1897        "type.googleapis.com/google.cloud.vision.v1.CropHint"
1898    }
1899}
1900
1901/// Set of crop hints that are used to generate new crops when serving images.
1902#[derive(Clone, Default, PartialEq)]
1903#[non_exhaustive]
1904pub struct CropHintsAnnotation {
1905    /// Crop hint results.
1906    pub crop_hints: std::vec::Vec<crate::model::CropHint>,
1907
1908    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1909}
1910
1911impl CropHintsAnnotation {
1912    pub fn new() -> Self {
1913        std::default::Default::default()
1914    }
1915
1916    /// Sets the value of [crop_hints][crate::model::CropHintsAnnotation::crop_hints].
1917    pub fn set_crop_hints<T, V>(mut self, v: T) -> Self
1918    where
1919        T: std::iter::IntoIterator<Item = V>,
1920        V: std::convert::Into<crate::model::CropHint>,
1921    {
1922        use std::iter::Iterator;
1923        self.crop_hints = v.into_iter().map(|i| i.into()).collect();
1924        self
1925    }
1926}
1927
1928impl wkt::message::Message for CropHintsAnnotation {
1929    fn typename() -> &'static str {
1930        "type.googleapis.com/google.cloud.vision.v1.CropHintsAnnotation"
1931    }
1932}
1933
1934/// Parameters for crop hints annotation request.
1935#[derive(Clone, Default, PartialEq)]
1936#[non_exhaustive]
1937pub struct CropHintsParams {
1938    /// Aspect ratios in floats, representing the ratio of the width to the height
1939    /// of the image. For example, if the desired aspect ratio is 4/3, the
1940    /// corresponding float value should be 1.33333.  If not specified, the
1941    /// best possible crop is returned. The number of provided aspect ratios is
1942    /// limited to a maximum of 16; any aspect ratios provided after the 16th are
1943    /// ignored.
1944    pub aspect_ratios: std::vec::Vec<f32>,
1945
1946    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1947}
1948
1949impl CropHintsParams {
1950    pub fn new() -> Self {
1951        std::default::Default::default()
1952    }
1953
1954    /// Sets the value of [aspect_ratios][crate::model::CropHintsParams::aspect_ratios].
1955    pub fn set_aspect_ratios<T, V>(mut self, v: T) -> Self
1956    where
1957        T: std::iter::IntoIterator<Item = V>,
1958        V: std::convert::Into<f32>,
1959    {
1960        use std::iter::Iterator;
1961        self.aspect_ratios = v.into_iter().map(|i| i.into()).collect();
1962        self
1963    }
1964}
1965
1966impl wkt::message::Message for CropHintsParams {
1967    fn typename() -> &'static str {
1968        "type.googleapis.com/google.cloud.vision.v1.CropHintsParams"
1969    }
1970}
1971
1972/// Parameters for web detection request.
1973#[derive(Clone, Default, PartialEq)]
1974#[non_exhaustive]
1975pub struct WebDetectionParams {
1976    /// This field has no effect on results.
1977    #[deprecated]
1978    pub include_geo_results: bool,
1979
1980    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1981}
1982
1983impl WebDetectionParams {
1984    pub fn new() -> Self {
1985        std::default::Default::default()
1986    }
1987
1988    /// Sets the value of [include_geo_results][crate::model::WebDetectionParams::include_geo_results].
1989    #[deprecated]
1990    pub fn set_include_geo_results<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
1991        self.include_geo_results = v.into();
1992        self
1993    }
1994}
1995
1996impl wkt::message::Message for WebDetectionParams {
1997    fn typename() -> &'static str {
1998        "type.googleapis.com/google.cloud.vision.v1.WebDetectionParams"
1999    }
2000}
2001
2002/// Parameters for text detections. This is used to control TEXT_DETECTION and
2003/// DOCUMENT_TEXT_DETECTION features.
2004#[derive(Clone, Default, PartialEq)]
2005#[non_exhaustive]
2006pub struct TextDetectionParams {
2007    /// By default, Cloud Vision API only includes confidence score for
2008    /// DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence
2009    /// score for TEXT_DETECTION as well.
2010    pub enable_text_detection_confidence_score: bool,
2011
2012    /// A list of advanced OCR options to further fine-tune OCR behavior.
2013    /// Current valid values are:
2014    ///
2015    /// - `legacy_layout`: a heuristics layout detection algorithm, which serves as
2016    ///   an alternative to the current ML-based layout detection algorithm.
2017    ///   Customers can choose the best suitable layout algorithm based on their
2018    ///   situation.
2019    pub advanced_ocr_options: std::vec::Vec<std::string::String>,
2020
2021    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2022}
2023
2024impl TextDetectionParams {
2025    pub fn new() -> Self {
2026        std::default::Default::default()
2027    }
2028
2029    /// Sets the value of [enable_text_detection_confidence_score][crate::model::TextDetectionParams::enable_text_detection_confidence_score].
2030    pub fn set_enable_text_detection_confidence_score<T: std::convert::Into<bool>>(
2031        mut self,
2032        v: T,
2033    ) -> Self {
2034        self.enable_text_detection_confidence_score = v.into();
2035        self
2036    }
2037
2038    /// Sets the value of [advanced_ocr_options][crate::model::TextDetectionParams::advanced_ocr_options].
2039    pub fn set_advanced_ocr_options<T, V>(mut self, v: T) -> Self
2040    where
2041        T: std::iter::IntoIterator<Item = V>,
2042        V: std::convert::Into<std::string::String>,
2043    {
2044        use std::iter::Iterator;
2045        self.advanced_ocr_options = v.into_iter().map(|i| i.into()).collect();
2046        self
2047    }
2048}
2049
2050impl wkt::message::Message for TextDetectionParams {
2051    fn typename() -> &'static str {
2052        "type.googleapis.com/google.cloud.vision.v1.TextDetectionParams"
2053    }
2054}
2055
2056/// Image context and/or feature-specific parameters.
2057#[derive(Clone, Default, PartialEq)]
2058#[non_exhaustive]
2059pub struct ImageContext {
2060    /// Not used.
2061    pub lat_long_rect: std::option::Option<crate::model::LatLongRect>,
2062
2063    /// List of languages to use for TEXT_DETECTION. In most cases, an empty value
2064    /// yields the best results since it enables automatic language detection. For
2065    /// languages based on the Latin alphabet, setting `language_hints` is not
2066    /// needed. In rare cases, when the language of the text in the image is known,
2067    /// setting a hint will help get better results (although it will be a
2068    /// significant hindrance if the hint is wrong). Text detection returns an
2069    /// error if one or more of the specified languages is not one of the
2070    /// [supported languages](https://cloud.google.com/vision/docs/languages).
2071    pub language_hints: std::vec::Vec<std::string::String>,
2072
2073    /// Parameters for crop hints annotation request.
2074    pub crop_hints_params: std::option::Option<crate::model::CropHintsParams>,
2075
2076    /// Parameters for product search.
2077    pub product_search_params: std::option::Option<crate::model::ProductSearchParams>,
2078
2079    /// Parameters for web detection.
2080    pub web_detection_params: std::option::Option<crate::model::WebDetectionParams>,
2081
2082    /// Parameters for text detection and document text detection.
2083    pub text_detection_params: std::option::Option<crate::model::TextDetectionParams>,
2084
2085    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2086}
2087
2088impl ImageContext {
2089    pub fn new() -> Self {
2090        std::default::Default::default()
2091    }
2092
2093    /// Sets the value of [lat_long_rect][crate::model::ImageContext::lat_long_rect].
2094    pub fn set_lat_long_rect<T>(mut self, v: T) -> Self
2095    where
2096        T: std::convert::Into<crate::model::LatLongRect>,
2097    {
2098        self.lat_long_rect = std::option::Option::Some(v.into());
2099        self
2100    }
2101
2102    /// Sets or clears the value of [lat_long_rect][crate::model::ImageContext::lat_long_rect].
2103    pub fn set_or_clear_lat_long_rect<T>(mut self, v: std::option::Option<T>) -> Self
2104    where
2105        T: std::convert::Into<crate::model::LatLongRect>,
2106    {
2107        self.lat_long_rect = v.map(|x| x.into());
2108        self
2109    }
2110
2111    /// Sets the value of [language_hints][crate::model::ImageContext::language_hints].
2112    pub fn set_language_hints<T, V>(mut self, v: T) -> Self
2113    where
2114        T: std::iter::IntoIterator<Item = V>,
2115        V: std::convert::Into<std::string::String>,
2116    {
2117        use std::iter::Iterator;
2118        self.language_hints = v.into_iter().map(|i| i.into()).collect();
2119        self
2120    }
2121
2122    /// Sets the value of [crop_hints_params][crate::model::ImageContext::crop_hints_params].
2123    pub fn set_crop_hints_params<T>(mut self, v: T) -> Self
2124    where
2125        T: std::convert::Into<crate::model::CropHintsParams>,
2126    {
2127        self.crop_hints_params = std::option::Option::Some(v.into());
2128        self
2129    }
2130
2131    /// Sets or clears the value of [crop_hints_params][crate::model::ImageContext::crop_hints_params].
2132    pub fn set_or_clear_crop_hints_params<T>(mut self, v: std::option::Option<T>) -> Self
2133    where
2134        T: std::convert::Into<crate::model::CropHintsParams>,
2135    {
2136        self.crop_hints_params = v.map(|x| x.into());
2137        self
2138    }
2139
2140    /// Sets the value of [product_search_params][crate::model::ImageContext::product_search_params].
2141    pub fn set_product_search_params<T>(mut self, v: T) -> Self
2142    where
2143        T: std::convert::Into<crate::model::ProductSearchParams>,
2144    {
2145        self.product_search_params = std::option::Option::Some(v.into());
2146        self
2147    }
2148
2149    /// Sets or clears the value of [product_search_params][crate::model::ImageContext::product_search_params].
2150    pub fn set_or_clear_product_search_params<T>(mut self, v: std::option::Option<T>) -> Self
2151    where
2152        T: std::convert::Into<crate::model::ProductSearchParams>,
2153    {
2154        self.product_search_params = v.map(|x| x.into());
2155        self
2156    }
2157
2158    /// Sets the value of [web_detection_params][crate::model::ImageContext::web_detection_params].
2159    pub fn set_web_detection_params<T>(mut self, v: T) -> Self
2160    where
2161        T: std::convert::Into<crate::model::WebDetectionParams>,
2162    {
2163        self.web_detection_params = std::option::Option::Some(v.into());
2164        self
2165    }
2166
2167    /// Sets or clears the value of [web_detection_params][crate::model::ImageContext::web_detection_params].
2168    pub fn set_or_clear_web_detection_params<T>(mut self, v: std::option::Option<T>) -> Self
2169    where
2170        T: std::convert::Into<crate::model::WebDetectionParams>,
2171    {
2172        self.web_detection_params = v.map(|x| x.into());
2173        self
2174    }
2175
2176    /// Sets the value of [text_detection_params][crate::model::ImageContext::text_detection_params].
2177    pub fn set_text_detection_params<T>(mut self, v: T) -> Self
2178    where
2179        T: std::convert::Into<crate::model::TextDetectionParams>,
2180    {
2181        self.text_detection_params = std::option::Option::Some(v.into());
2182        self
2183    }
2184
2185    /// Sets or clears the value of [text_detection_params][crate::model::ImageContext::text_detection_params].
2186    pub fn set_or_clear_text_detection_params<T>(mut self, v: std::option::Option<T>) -> Self
2187    where
2188        T: std::convert::Into<crate::model::TextDetectionParams>,
2189    {
2190        self.text_detection_params = v.map(|x| x.into());
2191        self
2192    }
2193}
2194
2195impl wkt::message::Message for ImageContext {
2196    fn typename() -> &'static str {
2197        "type.googleapis.com/google.cloud.vision.v1.ImageContext"
2198    }
2199}
2200
2201/// Request for performing Google Cloud Vision API tasks over a user-provided
2202/// image, with user-requested features, and with context information.
2203#[derive(Clone, Default, PartialEq)]
2204#[non_exhaustive]
2205pub struct AnnotateImageRequest {
2206    /// The image to be processed.
2207    pub image: std::option::Option<crate::model::Image>,
2208
2209    /// Requested features.
2210    pub features: std::vec::Vec<crate::model::Feature>,
2211
2212    /// Additional context that may accompany the image.
2213    pub image_context: std::option::Option<crate::model::ImageContext>,
2214
2215    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2216}
2217
2218impl AnnotateImageRequest {
2219    pub fn new() -> Self {
2220        std::default::Default::default()
2221    }
2222
2223    /// Sets the value of [image][crate::model::AnnotateImageRequest::image].
2224    pub fn set_image<T>(mut self, v: T) -> Self
2225    where
2226        T: std::convert::Into<crate::model::Image>,
2227    {
2228        self.image = std::option::Option::Some(v.into());
2229        self
2230    }
2231
2232    /// Sets or clears the value of [image][crate::model::AnnotateImageRequest::image].
2233    pub fn set_or_clear_image<T>(mut self, v: std::option::Option<T>) -> Self
2234    where
2235        T: std::convert::Into<crate::model::Image>,
2236    {
2237        self.image = v.map(|x| x.into());
2238        self
2239    }
2240
2241    /// Sets the value of [features][crate::model::AnnotateImageRequest::features].
2242    pub fn set_features<T, V>(mut self, v: T) -> Self
2243    where
2244        T: std::iter::IntoIterator<Item = V>,
2245        V: std::convert::Into<crate::model::Feature>,
2246    {
2247        use std::iter::Iterator;
2248        self.features = v.into_iter().map(|i| i.into()).collect();
2249        self
2250    }
2251
2252    /// Sets the value of [image_context][crate::model::AnnotateImageRequest::image_context].
2253    pub fn set_image_context<T>(mut self, v: T) -> Self
2254    where
2255        T: std::convert::Into<crate::model::ImageContext>,
2256    {
2257        self.image_context = std::option::Option::Some(v.into());
2258        self
2259    }
2260
2261    /// Sets or clears the value of [image_context][crate::model::AnnotateImageRequest::image_context].
2262    pub fn set_or_clear_image_context<T>(mut self, v: std::option::Option<T>) -> Self
2263    where
2264        T: std::convert::Into<crate::model::ImageContext>,
2265    {
2266        self.image_context = v.map(|x| x.into());
2267        self
2268    }
2269}
2270
2271impl wkt::message::Message for AnnotateImageRequest {
2272    fn typename() -> &'static str {
2273        "type.googleapis.com/google.cloud.vision.v1.AnnotateImageRequest"
2274    }
2275}
2276
2277/// If an image was produced from a file (e.g. a PDF), this message gives
2278/// information about the source of that image.
2279#[derive(Clone, Default, PartialEq)]
2280#[non_exhaustive]
2281pub struct ImageAnnotationContext {
2282    /// The URI of the file used to produce the image.
2283    pub uri: std::string::String,
2284
2285    /// If the file was a PDF or TIFF, this field gives the page number within
2286    /// the file used to produce the image.
2287    pub page_number: i32,
2288
2289    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2290}
2291
2292impl ImageAnnotationContext {
2293    pub fn new() -> Self {
2294        std::default::Default::default()
2295    }
2296
2297    /// Sets the value of [uri][crate::model::ImageAnnotationContext::uri].
2298    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2299        self.uri = v.into();
2300        self
2301    }
2302
2303    /// Sets the value of [page_number][crate::model::ImageAnnotationContext::page_number].
2304    pub fn set_page_number<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2305        self.page_number = v.into();
2306        self
2307    }
2308}
2309
2310impl wkt::message::Message for ImageAnnotationContext {
2311    fn typename() -> &'static str {
2312        "type.googleapis.com/google.cloud.vision.v1.ImageAnnotationContext"
2313    }
2314}
2315
2316/// Response to an image annotation request.
2317#[derive(Clone, Default, PartialEq)]
2318#[non_exhaustive]
2319pub struct AnnotateImageResponse {
2320    /// If present, face detection has completed successfully.
2321    pub face_annotations: std::vec::Vec<crate::model::FaceAnnotation>,
2322
2323    /// If present, landmark detection has completed successfully.
2324    pub landmark_annotations: std::vec::Vec<crate::model::EntityAnnotation>,
2325
2326    /// If present, logo detection has completed successfully.
2327    pub logo_annotations: std::vec::Vec<crate::model::EntityAnnotation>,
2328
2329    /// If present, label detection has completed successfully.
2330    pub label_annotations: std::vec::Vec<crate::model::EntityAnnotation>,
2331
2332    /// If present, localized object detection has completed successfully.
2333    /// This will be sorted descending by confidence score.
2334    pub localized_object_annotations: std::vec::Vec<crate::model::LocalizedObjectAnnotation>,
2335
2336    /// If present, text (OCR) detection has completed successfully.
2337    pub text_annotations: std::vec::Vec<crate::model::EntityAnnotation>,
2338
2339    /// If present, text (OCR) detection or document (OCR) text detection has
2340    /// completed successfully.
2341    /// This annotation provides the structural hierarchy for the OCR detected
2342    /// text.
2343    pub full_text_annotation: std::option::Option<crate::model::TextAnnotation>,
2344
2345    /// If present, safe-search annotation has completed successfully.
2346    pub safe_search_annotation: std::option::Option<crate::model::SafeSearchAnnotation>,
2347
2348    /// If present, image properties were extracted successfully.
2349    pub image_properties_annotation: std::option::Option<crate::model::ImageProperties>,
2350
2351    /// If present, crop hints have completed successfully.
2352    pub crop_hints_annotation: std::option::Option<crate::model::CropHintsAnnotation>,
2353
2354    /// If present, web detection has completed successfully.
2355    pub web_detection: std::option::Option<crate::model::WebDetection>,
2356
2357    /// If present, product search has completed successfully.
2358    pub product_search_results: std::option::Option<crate::model::ProductSearchResults>,
2359
2360    /// If set, represents the error message for the operation.
2361    /// Note that filled-in image annotations are guaranteed to be
2362    /// correct, even when `error` is set.
2363    pub error: std::option::Option<rpc::model::Status>,
2364
2365    /// If present, contextual information is needed to understand where this image
2366    /// comes from.
2367    pub context: std::option::Option<crate::model::ImageAnnotationContext>,
2368
2369    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2370}
2371
2372impl AnnotateImageResponse {
2373    pub fn new() -> Self {
2374        std::default::Default::default()
2375    }
2376
2377    /// Sets the value of [face_annotations][crate::model::AnnotateImageResponse::face_annotations].
2378    pub fn set_face_annotations<T, V>(mut self, v: T) -> Self
2379    where
2380        T: std::iter::IntoIterator<Item = V>,
2381        V: std::convert::Into<crate::model::FaceAnnotation>,
2382    {
2383        use std::iter::Iterator;
2384        self.face_annotations = v.into_iter().map(|i| i.into()).collect();
2385        self
2386    }
2387
2388    /// Sets the value of [landmark_annotations][crate::model::AnnotateImageResponse::landmark_annotations].
2389    pub fn set_landmark_annotations<T, V>(mut self, v: T) -> Self
2390    where
2391        T: std::iter::IntoIterator<Item = V>,
2392        V: std::convert::Into<crate::model::EntityAnnotation>,
2393    {
2394        use std::iter::Iterator;
2395        self.landmark_annotations = v.into_iter().map(|i| i.into()).collect();
2396        self
2397    }
2398
2399    /// Sets the value of [logo_annotations][crate::model::AnnotateImageResponse::logo_annotations].
2400    pub fn set_logo_annotations<T, V>(mut self, v: T) -> Self
2401    where
2402        T: std::iter::IntoIterator<Item = V>,
2403        V: std::convert::Into<crate::model::EntityAnnotation>,
2404    {
2405        use std::iter::Iterator;
2406        self.logo_annotations = v.into_iter().map(|i| i.into()).collect();
2407        self
2408    }
2409
2410    /// Sets the value of [label_annotations][crate::model::AnnotateImageResponse::label_annotations].
2411    pub fn set_label_annotations<T, V>(mut self, v: T) -> Self
2412    where
2413        T: std::iter::IntoIterator<Item = V>,
2414        V: std::convert::Into<crate::model::EntityAnnotation>,
2415    {
2416        use std::iter::Iterator;
2417        self.label_annotations = v.into_iter().map(|i| i.into()).collect();
2418        self
2419    }
2420
2421    /// Sets the value of [localized_object_annotations][crate::model::AnnotateImageResponse::localized_object_annotations].
2422    pub fn set_localized_object_annotations<T, V>(mut self, v: T) -> Self
2423    where
2424        T: std::iter::IntoIterator<Item = V>,
2425        V: std::convert::Into<crate::model::LocalizedObjectAnnotation>,
2426    {
2427        use std::iter::Iterator;
2428        self.localized_object_annotations = v.into_iter().map(|i| i.into()).collect();
2429        self
2430    }
2431
2432    /// Sets the value of [text_annotations][crate::model::AnnotateImageResponse::text_annotations].
2433    pub fn set_text_annotations<T, V>(mut self, v: T) -> Self
2434    where
2435        T: std::iter::IntoIterator<Item = V>,
2436        V: std::convert::Into<crate::model::EntityAnnotation>,
2437    {
2438        use std::iter::Iterator;
2439        self.text_annotations = v.into_iter().map(|i| i.into()).collect();
2440        self
2441    }
2442
2443    /// Sets the value of [full_text_annotation][crate::model::AnnotateImageResponse::full_text_annotation].
2444    pub fn set_full_text_annotation<T>(mut self, v: T) -> Self
2445    where
2446        T: std::convert::Into<crate::model::TextAnnotation>,
2447    {
2448        self.full_text_annotation = std::option::Option::Some(v.into());
2449        self
2450    }
2451
2452    /// Sets or clears the value of [full_text_annotation][crate::model::AnnotateImageResponse::full_text_annotation].
2453    pub fn set_or_clear_full_text_annotation<T>(mut self, v: std::option::Option<T>) -> Self
2454    where
2455        T: std::convert::Into<crate::model::TextAnnotation>,
2456    {
2457        self.full_text_annotation = v.map(|x| x.into());
2458        self
2459    }
2460
2461    /// Sets the value of [safe_search_annotation][crate::model::AnnotateImageResponse::safe_search_annotation].
2462    pub fn set_safe_search_annotation<T>(mut self, v: T) -> Self
2463    where
2464        T: std::convert::Into<crate::model::SafeSearchAnnotation>,
2465    {
2466        self.safe_search_annotation = std::option::Option::Some(v.into());
2467        self
2468    }
2469
2470    /// Sets or clears the value of [safe_search_annotation][crate::model::AnnotateImageResponse::safe_search_annotation].
2471    pub fn set_or_clear_safe_search_annotation<T>(mut self, v: std::option::Option<T>) -> Self
2472    where
2473        T: std::convert::Into<crate::model::SafeSearchAnnotation>,
2474    {
2475        self.safe_search_annotation = v.map(|x| x.into());
2476        self
2477    }
2478
2479    /// Sets the value of [image_properties_annotation][crate::model::AnnotateImageResponse::image_properties_annotation].
2480    pub fn set_image_properties_annotation<T>(mut self, v: T) -> Self
2481    where
2482        T: std::convert::Into<crate::model::ImageProperties>,
2483    {
2484        self.image_properties_annotation = std::option::Option::Some(v.into());
2485        self
2486    }
2487
2488    /// Sets or clears the value of [image_properties_annotation][crate::model::AnnotateImageResponse::image_properties_annotation].
2489    pub fn set_or_clear_image_properties_annotation<T>(mut self, v: std::option::Option<T>) -> Self
2490    where
2491        T: std::convert::Into<crate::model::ImageProperties>,
2492    {
2493        self.image_properties_annotation = v.map(|x| x.into());
2494        self
2495    }
2496
2497    /// Sets the value of [crop_hints_annotation][crate::model::AnnotateImageResponse::crop_hints_annotation].
2498    pub fn set_crop_hints_annotation<T>(mut self, v: T) -> Self
2499    where
2500        T: std::convert::Into<crate::model::CropHintsAnnotation>,
2501    {
2502        self.crop_hints_annotation = std::option::Option::Some(v.into());
2503        self
2504    }
2505
2506    /// Sets or clears the value of [crop_hints_annotation][crate::model::AnnotateImageResponse::crop_hints_annotation].
2507    pub fn set_or_clear_crop_hints_annotation<T>(mut self, v: std::option::Option<T>) -> Self
2508    where
2509        T: std::convert::Into<crate::model::CropHintsAnnotation>,
2510    {
2511        self.crop_hints_annotation = v.map(|x| x.into());
2512        self
2513    }
2514
2515    /// Sets the value of [web_detection][crate::model::AnnotateImageResponse::web_detection].
2516    pub fn set_web_detection<T>(mut self, v: T) -> Self
2517    where
2518        T: std::convert::Into<crate::model::WebDetection>,
2519    {
2520        self.web_detection = std::option::Option::Some(v.into());
2521        self
2522    }
2523
2524    /// Sets or clears the value of [web_detection][crate::model::AnnotateImageResponse::web_detection].
2525    pub fn set_or_clear_web_detection<T>(mut self, v: std::option::Option<T>) -> Self
2526    where
2527        T: std::convert::Into<crate::model::WebDetection>,
2528    {
2529        self.web_detection = v.map(|x| x.into());
2530        self
2531    }
2532
2533    /// Sets the value of [product_search_results][crate::model::AnnotateImageResponse::product_search_results].
2534    pub fn set_product_search_results<T>(mut self, v: T) -> Self
2535    where
2536        T: std::convert::Into<crate::model::ProductSearchResults>,
2537    {
2538        self.product_search_results = std::option::Option::Some(v.into());
2539        self
2540    }
2541
2542    /// Sets or clears the value of [product_search_results][crate::model::AnnotateImageResponse::product_search_results].
2543    pub fn set_or_clear_product_search_results<T>(mut self, v: std::option::Option<T>) -> Self
2544    where
2545        T: std::convert::Into<crate::model::ProductSearchResults>,
2546    {
2547        self.product_search_results = v.map(|x| x.into());
2548        self
2549    }
2550
2551    /// Sets the value of [error][crate::model::AnnotateImageResponse::error].
2552    pub fn set_error<T>(mut self, v: T) -> Self
2553    where
2554        T: std::convert::Into<rpc::model::Status>,
2555    {
2556        self.error = std::option::Option::Some(v.into());
2557        self
2558    }
2559
2560    /// Sets or clears the value of [error][crate::model::AnnotateImageResponse::error].
2561    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
2562    where
2563        T: std::convert::Into<rpc::model::Status>,
2564    {
2565        self.error = v.map(|x| x.into());
2566        self
2567    }
2568
2569    /// Sets the value of [context][crate::model::AnnotateImageResponse::context].
2570    pub fn set_context<T>(mut self, v: T) -> Self
2571    where
2572        T: std::convert::Into<crate::model::ImageAnnotationContext>,
2573    {
2574        self.context = std::option::Option::Some(v.into());
2575        self
2576    }
2577
2578    /// Sets or clears the value of [context][crate::model::AnnotateImageResponse::context].
2579    pub fn set_or_clear_context<T>(mut self, v: std::option::Option<T>) -> Self
2580    where
2581        T: std::convert::Into<crate::model::ImageAnnotationContext>,
2582    {
2583        self.context = v.map(|x| x.into());
2584        self
2585    }
2586}
2587
2588impl wkt::message::Message for AnnotateImageResponse {
2589    fn typename() -> &'static str {
2590        "type.googleapis.com/google.cloud.vision.v1.AnnotateImageResponse"
2591    }
2592}
2593
2594/// Multiple image annotation requests are batched into a single service call.
2595#[derive(Clone, Default, PartialEq)]
2596#[non_exhaustive]
2597pub struct BatchAnnotateImagesRequest {
2598    /// Required. Individual image annotation requests for this batch.
2599    pub requests: std::vec::Vec<crate::model::AnnotateImageRequest>,
2600
2601    /// Optional. Target project and location to make a call.
2602    ///
2603    /// Format: `projects/{project-id}/locations/{location-id}`.
2604    ///
2605    /// If no parent is specified, a region will be chosen automatically.
2606    ///
2607    /// Supported location-ids:
2608    /// `us`: USA country only,
2609    /// `asia`: East asia areas, like Japan, Taiwan,
2610    /// `eu`: The European Union.
2611    ///
2612    /// Example: `projects/project-A/locations/eu`.
2613    pub parent: std::string::String,
2614
2615    /// Optional. The labels with user-defined metadata for the request.
2616    ///
2617    /// Label keys and values can be no longer than 63 characters
2618    /// (Unicode codepoints), can only contain lowercase letters, numeric
2619    /// characters, underscores and dashes. International characters are allowed.
2620    /// Label values are optional. Label keys must start with a letter.
2621    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2622
2623    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2624}
2625
2626impl BatchAnnotateImagesRequest {
2627    pub fn new() -> Self {
2628        std::default::Default::default()
2629    }
2630
2631    /// Sets the value of [requests][crate::model::BatchAnnotateImagesRequest::requests].
2632    pub fn set_requests<T, V>(mut self, v: T) -> Self
2633    where
2634        T: std::iter::IntoIterator<Item = V>,
2635        V: std::convert::Into<crate::model::AnnotateImageRequest>,
2636    {
2637        use std::iter::Iterator;
2638        self.requests = v.into_iter().map(|i| i.into()).collect();
2639        self
2640    }
2641
2642    /// Sets the value of [parent][crate::model::BatchAnnotateImagesRequest::parent].
2643    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2644        self.parent = v.into();
2645        self
2646    }
2647
2648    /// Sets the value of [labels][crate::model::BatchAnnotateImagesRequest::labels].
2649    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2650    where
2651        T: std::iter::IntoIterator<Item = (K, V)>,
2652        K: std::convert::Into<std::string::String>,
2653        V: std::convert::Into<std::string::String>,
2654    {
2655        use std::iter::Iterator;
2656        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2657        self
2658    }
2659}
2660
2661impl wkt::message::Message for BatchAnnotateImagesRequest {
2662    fn typename() -> &'static str {
2663        "type.googleapis.com/google.cloud.vision.v1.BatchAnnotateImagesRequest"
2664    }
2665}
2666
2667/// Response to a batch image annotation request.
2668#[derive(Clone, Default, PartialEq)]
2669#[non_exhaustive]
2670pub struct BatchAnnotateImagesResponse {
2671    /// Individual responses to image annotation requests within the batch.
2672    pub responses: std::vec::Vec<crate::model::AnnotateImageResponse>,
2673
2674    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2675}
2676
2677impl BatchAnnotateImagesResponse {
2678    pub fn new() -> Self {
2679        std::default::Default::default()
2680    }
2681
2682    /// Sets the value of [responses][crate::model::BatchAnnotateImagesResponse::responses].
2683    pub fn set_responses<T, V>(mut self, v: T) -> Self
2684    where
2685        T: std::iter::IntoIterator<Item = V>,
2686        V: std::convert::Into<crate::model::AnnotateImageResponse>,
2687    {
2688        use std::iter::Iterator;
2689        self.responses = v.into_iter().map(|i| i.into()).collect();
2690        self
2691    }
2692}
2693
2694impl wkt::message::Message for BatchAnnotateImagesResponse {
2695    fn typename() -> &'static str {
2696        "type.googleapis.com/google.cloud.vision.v1.BatchAnnotateImagesResponse"
2697    }
2698}
2699
2700/// A request to annotate one single file, e.g. a PDF, TIFF or GIF file.
2701#[derive(Clone, Default, PartialEq)]
2702#[non_exhaustive]
2703pub struct AnnotateFileRequest {
2704    /// Required. Information about the input file.
2705    pub input_config: std::option::Option<crate::model::InputConfig>,
2706
2707    /// Required. Requested features.
2708    pub features: std::vec::Vec<crate::model::Feature>,
2709
2710    /// Additional context that may accompany the image(s) in the file.
2711    pub image_context: std::option::Option<crate::model::ImageContext>,
2712
2713    /// Pages of the file to perform image annotation.
2714    ///
2715    /// Pages starts from 1, we assume the first page of the file is page 1.
2716    /// At most 5 pages are supported per request. Pages can be negative.
2717    ///
2718    /// Page 1 means the first page.
2719    /// Page 2 means the second page.
2720    /// Page -1 means the last page.
2721    /// Page -2 means the second to the last page.
2722    ///
2723    /// If the file is GIF instead of PDF or TIFF, page refers to GIF frames.
2724    ///
2725    /// If this field is empty, by default the service performs image annotation
2726    /// for the first 5 pages of the file.
2727    pub pages: std::vec::Vec<i32>,
2728
2729    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2730}
2731
2732impl AnnotateFileRequest {
2733    pub fn new() -> Self {
2734        std::default::Default::default()
2735    }
2736
2737    /// Sets the value of [input_config][crate::model::AnnotateFileRequest::input_config].
2738    pub fn set_input_config<T>(mut self, v: T) -> Self
2739    where
2740        T: std::convert::Into<crate::model::InputConfig>,
2741    {
2742        self.input_config = std::option::Option::Some(v.into());
2743        self
2744    }
2745
2746    /// Sets or clears the value of [input_config][crate::model::AnnotateFileRequest::input_config].
2747    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2748    where
2749        T: std::convert::Into<crate::model::InputConfig>,
2750    {
2751        self.input_config = v.map(|x| x.into());
2752        self
2753    }
2754
2755    /// Sets the value of [features][crate::model::AnnotateFileRequest::features].
2756    pub fn set_features<T, V>(mut self, v: T) -> Self
2757    where
2758        T: std::iter::IntoIterator<Item = V>,
2759        V: std::convert::Into<crate::model::Feature>,
2760    {
2761        use std::iter::Iterator;
2762        self.features = v.into_iter().map(|i| i.into()).collect();
2763        self
2764    }
2765
2766    /// Sets the value of [image_context][crate::model::AnnotateFileRequest::image_context].
2767    pub fn set_image_context<T>(mut self, v: T) -> Self
2768    where
2769        T: std::convert::Into<crate::model::ImageContext>,
2770    {
2771        self.image_context = std::option::Option::Some(v.into());
2772        self
2773    }
2774
2775    /// Sets or clears the value of [image_context][crate::model::AnnotateFileRequest::image_context].
2776    pub fn set_or_clear_image_context<T>(mut self, v: std::option::Option<T>) -> Self
2777    where
2778        T: std::convert::Into<crate::model::ImageContext>,
2779    {
2780        self.image_context = v.map(|x| x.into());
2781        self
2782    }
2783
2784    /// Sets the value of [pages][crate::model::AnnotateFileRequest::pages].
2785    pub fn set_pages<T, V>(mut self, v: T) -> Self
2786    where
2787        T: std::iter::IntoIterator<Item = V>,
2788        V: std::convert::Into<i32>,
2789    {
2790        use std::iter::Iterator;
2791        self.pages = v.into_iter().map(|i| i.into()).collect();
2792        self
2793    }
2794}
2795
2796impl wkt::message::Message for AnnotateFileRequest {
2797    fn typename() -> &'static str {
2798        "type.googleapis.com/google.cloud.vision.v1.AnnotateFileRequest"
2799    }
2800}
2801
2802/// Response to a single file annotation request. A file may contain one or more
2803/// images, which individually have their own responses.
2804#[derive(Clone, Default, PartialEq)]
2805#[non_exhaustive]
2806pub struct AnnotateFileResponse {
2807    /// Information about the file for which this response is generated.
2808    pub input_config: std::option::Option<crate::model::InputConfig>,
2809
2810    /// Individual responses to images found within the file. This field will be
2811    /// empty if the `error` field is set.
2812    pub responses: std::vec::Vec<crate::model::AnnotateImageResponse>,
2813
2814    /// This field gives the total number of pages in the file.
2815    pub total_pages: i32,
2816
2817    /// If set, represents the error message for the failed request. The
2818    /// `responses` field will not be set in this case.
2819    pub error: std::option::Option<rpc::model::Status>,
2820
2821    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2822}
2823
2824impl AnnotateFileResponse {
2825    pub fn new() -> Self {
2826        std::default::Default::default()
2827    }
2828
2829    /// Sets the value of [input_config][crate::model::AnnotateFileResponse::input_config].
2830    pub fn set_input_config<T>(mut self, v: T) -> Self
2831    where
2832        T: std::convert::Into<crate::model::InputConfig>,
2833    {
2834        self.input_config = std::option::Option::Some(v.into());
2835        self
2836    }
2837
2838    /// Sets or clears the value of [input_config][crate::model::AnnotateFileResponse::input_config].
2839    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
2840    where
2841        T: std::convert::Into<crate::model::InputConfig>,
2842    {
2843        self.input_config = v.map(|x| x.into());
2844        self
2845    }
2846
2847    /// Sets the value of [responses][crate::model::AnnotateFileResponse::responses].
2848    pub fn set_responses<T, V>(mut self, v: T) -> Self
2849    where
2850        T: std::iter::IntoIterator<Item = V>,
2851        V: std::convert::Into<crate::model::AnnotateImageResponse>,
2852    {
2853        use std::iter::Iterator;
2854        self.responses = v.into_iter().map(|i| i.into()).collect();
2855        self
2856    }
2857
2858    /// Sets the value of [total_pages][crate::model::AnnotateFileResponse::total_pages].
2859    pub fn set_total_pages<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
2860        self.total_pages = v.into();
2861        self
2862    }
2863
2864    /// Sets the value of [error][crate::model::AnnotateFileResponse::error].
2865    pub fn set_error<T>(mut self, v: T) -> Self
2866    where
2867        T: std::convert::Into<rpc::model::Status>,
2868    {
2869        self.error = std::option::Option::Some(v.into());
2870        self
2871    }
2872
2873    /// Sets or clears the value of [error][crate::model::AnnotateFileResponse::error].
2874    pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
2875    where
2876        T: std::convert::Into<rpc::model::Status>,
2877    {
2878        self.error = v.map(|x| x.into());
2879        self
2880    }
2881}
2882
2883impl wkt::message::Message for AnnotateFileResponse {
2884    fn typename() -> &'static str {
2885        "type.googleapis.com/google.cloud.vision.v1.AnnotateFileResponse"
2886    }
2887}
2888
2889/// A list of requests to annotate files using the BatchAnnotateFiles API.
2890#[derive(Clone, Default, PartialEq)]
2891#[non_exhaustive]
2892pub struct BatchAnnotateFilesRequest {
2893    /// Required. The list of file annotation requests. Right now we support only
2894    /// one AnnotateFileRequest in BatchAnnotateFilesRequest.
2895    pub requests: std::vec::Vec<crate::model::AnnotateFileRequest>,
2896
2897    /// Optional. Target project and location to make a call.
2898    ///
2899    /// Format: `projects/{project-id}/locations/{location-id}`.
2900    ///
2901    /// If no parent is specified, a region will be chosen automatically.
2902    ///
2903    /// Supported location-ids:
2904    /// `us`: USA country only,
2905    /// `asia`: East asia areas, like Japan, Taiwan,
2906    /// `eu`: The European Union.
2907    ///
2908    /// Example: `projects/project-A/locations/eu`.
2909    pub parent: std::string::String,
2910
2911    /// Optional. The labels with user-defined metadata for the request.
2912    ///
2913    /// Label keys and values can be no longer than 63 characters
2914    /// (Unicode codepoints), can only contain lowercase letters, numeric
2915    /// characters, underscores and dashes. International characters are allowed.
2916    /// Label values are optional. Label keys must start with a letter.
2917    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
2918
2919    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2920}
2921
2922impl BatchAnnotateFilesRequest {
2923    pub fn new() -> Self {
2924        std::default::Default::default()
2925    }
2926
2927    /// Sets the value of [requests][crate::model::BatchAnnotateFilesRequest::requests].
2928    pub fn set_requests<T, V>(mut self, v: T) -> Self
2929    where
2930        T: std::iter::IntoIterator<Item = V>,
2931        V: std::convert::Into<crate::model::AnnotateFileRequest>,
2932    {
2933        use std::iter::Iterator;
2934        self.requests = v.into_iter().map(|i| i.into()).collect();
2935        self
2936    }
2937
2938    /// Sets the value of [parent][crate::model::BatchAnnotateFilesRequest::parent].
2939    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2940        self.parent = v.into();
2941        self
2942    }
2943
2944    /// Sets the value of [labels][crate::model::BatchAnnotateFilesRequest::labels].
2945    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
2946    where
2947        T: std::iter::IntoIterator<Item = (K, V)>,
2948        K: std::convert::Into<std::string::String>,
2949        V: std::convert::Into<std::string::String>,
2950    {
2951        use std::iter::Iterator;
2952        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
2953        self
2954    }
2955}
2956
2957impl wkt::message::Message for BatchAnnotateFilesRequest {
2958    fn typename() -> &'static str {
2959        "type.googleapis.com/google.cloud.vision.v1.BatchAnnotateFilesRequest"
2960    }
2961}
2962
2963/// A list of file annotation responses.
2964#[derive(Clone, Default, PartialEq)]
2965#[non_exhaustive]
2966pub struct BatchAnnotateFilesResponse {
2967    /// The list of file annotation responses, each response corresponding to each
2968    /// AnnotateFileRequest in BatchAnnotateFilesRequest.
2969    pub responses: std::vec::Vec<crate::model::AnnotateFileResponse>,
2970
2971    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2972}
2973
2974impl BatchAnnotateFilesResponse {
2975    pub fn new() -> Self {
2976        std::default::Default::default()
2977    }
2978
2979    /// Sets the value of [responses][crate::model::BatchAnnotateFilesResponse::responses].
2980    pub fn set_responses<T, V>(mut self, v: T) -> Self
2981    where
2982        T: std::iter::IntoIterator<Item = V>,
2983        V: std::convert::Into<crate::model::AnnotateFileResponse>,
2984    {
2985        use std::iter::Iterator;
2986        self.responses = v.into_iter().map(|i| i.into()).collect();
2987        self
2988    }
2989}
2990
2991impl wkt::message::Message for BatchAnnotateFilesResponse {
2992    fn typename() -> &'static str {
2993        "type.googleapis.com/google.cloud.vision.v1.BatchAnnotateFilesResponse"
2994    }
2995}
2996
2997/// An offline file annotation request.
2998#[derive(Clone, Default, PartialEq)]
2999#[non_exhaustive]
3000pub struct AsyncAnnotateFileRequest {
3001    /// Required. Information about the input file.
3002    pub input_config: std::option::Option<crate::model::InputConfig>,
3003
3004    /// Required. Requested features.
3005    pub features: std::vec::Vec<crate::model::Feature>,
3006
3007    /// Additional context that may accompany the image(s) in the file.
3008    pub image_context: std::option::Option<crate::model::ImageContext>,
3009
3010    /// Required. The desired output location and metadata (e.g. format).
3011    pub output_config: std::option::Option<crate::model::OutputConfig>,
3012
3013    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3014}
3015
3016impl AsyncAnnotateFileRequest {
3017    pub fn new() -> Self {
3018        std::default::Default::default()
3019    }
3020
3021    /// Sets the value of [input_config][crate::model::AsyncAnnotateFileRequest::input_config].
3022    pub fn set_input_config<T>(mut self, v: T) -> Self
3023    where
3024        T: std::convert::Into<crate::model::InputConfig>,
3025    {
3026        self.input_config = std::option::Option::Some(v.into());
3027        self
3028    }
3029
3030    /// Sets or clears the value of [input_config][crate::model::AsyncAnnotateFileRequest::input_config].
3031    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
3032    where
3033        T: std::convert::Into<crate::model::InputConfig>,
3034    {
3035        self.input_config = v.map(|x| x.into());
3036        self
3037    }
3038
3039    /// Sets the value of [features][crate::model::AsyncAnnotateFileRequest::features].
3040    pub fn set_features<T, V>(mut self, v: T) -> Self
3041    where
3042        T: std::iter::IntoIterator<Item = V>,
3043        V: std::convert::Into<crate::model::Feature>,
3044    {
3045        use std::iter::Iterator;
3046        self.features = v.into_iter().map(|i| i.into()).collect();
3047        self
3048    }
3049
3050    /// Sets the value of [image_context][crate::model::AsyncAnnotateFileRequest::image_context].
3051    pub fn set_image_context<T>(mut self, v: T) -> Self
3052    where
3053        T: std::convert::Into<crate::model::ImageContext>,
3054    {
3055        self.image_context = std::option::Option::Some(v.into());
3056        self
3057    }
3058
3059    /// Sets or clears the value of [image_context][crate::model::AsyncAnnotateFileRequest::image_context].
3060    pub fn set_or_clear_image_context<T>(mut self, v: std::option::Option<T>) -> Self
3061    where
3062        T: std::convert::Into<crate::model::ImageContext>,
3063    {
3064        self.image_context = v.map(|x| x.into());
3065        self
3066    }
3067
3068    /// Sets the value of [output_config][crate::model::AsyncAnnotateFileRequest::output_config].
3069    pub fn set_output_config<T>(mut self, v: T) -> Self
3070    where
3071        T: std::convert::Into<crate::model::OutputConfig>,
3072    {
3073        self.output_config = std::option::Option::Some(v.into());
3074        self
3075    }
3076
3077    /// Sets or clears the value of [output_config][crate::model::AsyncAnnotateFileRequest::output_config].
3078    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3079    where
3080        T: std::convert::Into<crate::model::OutputConfig>,
3081    {
3082        self.output_config = v.map(|x| x.into());
3083        self
3084    }
3085}
3086
3087impl wkt::message::Message for AsyncAnnotateFileRequest {
3088    fn typename() -> &'static str {
3089        "type.googleapis.com/google.cloud.vision.v1.AsyncAnnotateFileRequest"
3090    }
3091}
3092
3093/// The response for a single offline file annotation request.
3094#[derive(Clone, Default, PartialEq)]
3095#[non_exhaustive]
3096pub struct AsyncAnnotateFileResponse {
3097    /// The output location and metadata from AsyncAnnotateFileRequest.
3098    pub output_config: std::option::Option<crate::model::OutputConfig>,
3099
3100    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3101}
3102
3103impl AsyncAnnotateFileResponse {
3104    pub fn new() -> Self {
3105        std::default::Default::default()
3106    }
3107
3108    /// Sets the value of [output_config][crate::model::AsyncAnnotateFileResponse::output_config].
3109    pub fn set_output_config<T>(mut self, v: T) -> Self
3110    where
3111        T: std::convert::Into<crate::model::OutputConfig>,
3112    {
3113        self.output_config = std::option::Option::Some(v.into());
3114        self
3115    }
3116
3117    /// Sets or clears the value of [output_config][crate::model::AsyncAnnotateFileResponse::output_config].
3118    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3119    where
3120        T: std::convert::Into<crate::model::OutputConfig>,
3121    {
3122        self.output_config = v.map(|x| x.into());
3123        self
3124    }
3125}
3126
3127impl wkt::message::Message for AsyncAnnotateFileResponse {
3128    fn typename() -> &'static str {
3129        "type.googleapis.com/google.cloud.vision.v1.AsyncAnnotateFileResponse"
3130    }
3131}
3132
3133/// Request for async image annotation for a list of images.
3134#[derive(Clone, Default, PartialEq)]
3135#[non_exhaustive]
3136pub struct AsyncBatchAnnotateImagesRequest {
3137    /// Required. Individual image annotation requests for this batch.
3138    pub requests: std::vec::Vec<crate::model::AnnotateImageRequest>,
3139
3140    /// Required. The desired output location and metadata (e.g. format).
3141    pub output_config: std::option::Option<crate::model::OutputConfig>,
3142
3143    /// Optional. Target project and location to make a call.
3144    ///
3145    /// Format: `projects/{project-id}/locations/{location-id}`.
3146    ///
3147    /// If no parent is specified, a region will be chosen automatically.
3148    ///
3149    /// Supported location-ids:
3150    /// `us`: USA country only,
3151    /// `asia`: East asia areas, like Japan, Taiwan,
3152    /// `eu`: The European Union.
3153    ///
3154    /// Example: `projects/project-A/locations/eu`.
3155    pub parent: std::string::String,
3156
3157    /// Optional. The labels with user-defined metadata for the request.
3158    ///
3159    /// Label keys and values can be no longer than 63 characters
3160    /// (Unicode codepoints), can only contain lowercase letters, numeric
3161    /// characters, underscores and dashes. International characters are allowed.
3162    /// Label values are optional. Label keys must start with a letter.
3163    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3164
3165    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3166}
3167
3168impl AsyncBatchAnnotateImagesRequest {
3169    pub fn new() -> Self {
3170        std::default::Default::default()
3171    }
3172
3173    /// Sets the value of [requests][crate::model::AsyncBatchAnnotateImagesRequest::requests].
3174    pub fn set_requests<T, V>(mut self, v: T) -> Self
3175    where
3176        T: std::iter::IntoIterator<Item = V>,
3177        V: std::convert::Into<crate::model::AnnotateImageRequest>,
3178    {
3179        use std::iter::Iterator;
3180        self.requests = v.into_iter().map(|i| i.into()).collect();
3181        self
3182    }
3183
3184    /// Sets the value of [output_config][crate::model::AsyncBatchAnnotateImagesRequest::output_config].
3185    pub fn set_output_config<T>(mut self, v: T) -> Self
3186    where
3187        T: std::convert::Into<crate::model::OutputConfig>,
3188    {
3189        self.output_config = std::option::Option::Some(v.into());
3190        self
3191    }
3192
3193    /// Sets or clears the value of [output_config][crate::model::AsyncBatchAnnotateImagesRequest::output_config].
3194    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3195    where
3196        T: std::convert::Into<crate::model::OutputConfig>,
3197    {
3198        self.output_config = v.map(|x| x.into());
3199        self
3200    }
3201
3202    /// Sets the value of [parent][crate::model::AsyncBatchAnnotateImagesRequest::parent].
3203    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3204        self.parent = v.into();
3205        self
3206    }
3207
3208    /// Sets the value of [labels][crate::model::AsyncBatchAnnotateImagesRequest::labels].
3209    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3210    where
3211        T: std::iter::IntoIterator<Item = (K, V)>,
3212        K: std::convert::Into<std::string::String>,
3213        V: std::convert::Into<std::string::String>,
3214    {
3215        use std::iter::Iterator;
3216        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3217        self
3218    }
3219}
3220
3221impl wkt::message::Message for AsyncBatchAnnotateImagesRequest {
3222    fn typename() -> &'static str {
3223        "type.googleapis.com/google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest"
3224    }
3225}
3226
3227/// Response to an async batch image annotation request.
3228#[derive(Clone, Default, PartialEq)]
3229#[non_exhaustive]
3230pub struct AsyncBatchAnnotateImagesResponse {
3231    /// The output location and metadata from AsyncBatchAnnotateImagesRequest.
3232    pub output_config: std::option::Option<crate::model::OutputConfig>,
3233
3234    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3235}
3236
3237impl AsyncBatchAnnotateImagesResponse {
3238    pub fn new() -> Self {
3239        std::default::Default::default()
3240    }
3241
3242    /// Sets the value of [output_config][crate::model::AsyncBatchAnnotateImagesResponse::output_config].
3243    pub fn set_output_config<T>(mut self, v: T) -> Self
3244    where
3245        T: std::convert::Into<crate::model::OutputConfig>,
3246    {
3247        self.output_config = std::option::Option::Some(v.into());
3248        self
3249    }
3250
3251    /// Sets or clears the value of [output_config][crate::model::AsyncBatchAnnotateImagesResponse::output_config].
3252    pub fn set_or_clear_output_config<T>(mut self, v: std::option::Option<T>) -> Self
3253    where
3254        T: std::convert::Into<crate::model::OutputConfig>,
3255    {
3256        self.output_config = v.map(|x| x.into());
3257        self
3258    }
3259}
3260
3261impl wkt::message::Message for AsyncBatchAnnotateImagesResponse {
3262    fn typename() -> &'static str {
3263        "type.googleapis.com/google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse"
3264    }
3265}
3266
3267/// Multiple async file annotation requests are batched into a single service
3268/// call.
3269#[derive(Clone, Default, PartialEq)]
3270#[non_exhaustive]
3271pub struct AsyncBatchAnnotateFilesRequest {
3272    /// Required. Individual async file annotation requests for this batch.
3273    pub requests: std::vec::Vec<crate::model::AsyncAnnotateFileRequest>,
3274
3275    /// Optional. Target project and location to make a call.
3276    ///
3277    /// Format: `projects/{project-id}/locations/{location-id}`.
3278    ///
3279    /// If no parent is specified, a region will be chosen automatically.
3280    ///
3281    /// Supported location-ids:
3282    /// `us`: USA country only,
3283    /// `asia`: East asia areas, like Japan, Taiwan,
3284    /// `eu`: The European Union.
3285    ///
3286    /// Example: `projects/project-A/locations/eu`.
3287    pub parent: std::string::String,
3288
3289    /// Optional. The labels with user-defined metadata for the request.
3290    ///
3291    /// Label keys and values can be no longer than 63 characters
3292    /// (Unicode codepoints), can only contain lowercase letters, numeric
3293    /// characters, underscores and dashes. International characters are allowed.
3294    /// Label values are optional. Label keys must start with a letter.
3295    pub labels: std::collections::HashMap<std::string::String, std::string::String>,
3296
3297    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3298}
3299
3300impl AsyncBatchAnnotateFilesRequest {
3301    pub fn new() -> Self {
3302        std::default::Default::default()
3303    }
3304
3305    /// Sets the value of [requests][crate::model::AsyncBatchAnnotateFilesRequest::requests].
3306    pub fn set_requests<T, V>(mut self, v: T) -> Self
3307    where
3308        T: std::iter::IntoIterator<Item = V>,
3309        V: std::convert::Into<crate::model::AsyncAnnotateFileRequest>,
3310    {
3311        use std::iter::Iterator;
3312        self.requests = v.into_iter().map(|i| i.into()).collect();
3313        self
3314    }
3315
3316    /// Sets the value of [parent][crate::model::AsyncBatchAnnotateFilesRequest::parent].
3317    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3318        self.parent = v.into();
3319        self
3320    }
3321
3322    /// Sets the value of [labels][crate::model::AsyncBatchAnnotateFilesRequest::labels].
3323    pub fn set_labels<T, K, V>(mut self, v: T) -> Self
3324    where
3325        T: std::iter::IntoIterator<Item = (K, V)>,
3326        K: std::convert::Into<std::string::String>,
3327        V: std::convert::Into<std::string::String>,
3328    {
3329        use std::iter::Iterator;
3330        self.labels = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
3331        self
3332    }
3333}
3334
3335impl wkt::message::Message for AsyncBatchAnnotateFilesRequest {
3336    fn typename() -> &'static str {
3337        "type.googleapis.com/google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest"
3338    }
3339}
3340
3341/// Response to an async batch file annotation request.
3342#[derive(Clone, Default, PartialEq)]
3343#[non_exhaustive]
3344pub struct AsyncBatchAnnotateFilesResponse {
3345    /// The list of file annotation responses, one for each request in
3346    /// AsyncBatchAnnotateFilesRequest.
3347    pub responses: std::vec::Vec<crate::model::AsyncAnnotateFileResponse>,
3348
3349    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3350}
3351
3352impl AsyncBatchAnnotateFilesResponse {
3353    pub fn new() -> Self {
3354        std::default::Default::default()
3355    }
3356
3357    /// Sets the value of [responses][crate::model::AsyncBatchAnnotateFilesResponse::responses].
3358    pub fn set_responses<T, V>(mut self, v: T) -> Self
3359    where
3360        T: std::iter::IntoIterator<Item = V>,
3361        V: std::convert::Into<crate::model::AsyncAnnotateFileResponse>,
3362    {
3363        use std::iter::Iterator;
3364        self.responses = v.into_iter().map(|i| i.into()).collect();
3365        self
3366    }
3367}
3368
3369impl wkt::message::Message for AsyncBatchAnnotateFilesResponse {
3370    fn typename() -> &'static str {
3371        "type.googleapis.com/google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse"
3372    }
3373}
3374
3375/// The desired input location and metadata.
3376#[derive(Clone, Default, PartialEq)]
3377#[non_exhaustive]
3378pub struct InputConfig {
3379    /// The Google Cloud Storage location to read the input from.
3380    pub gcs_source: std::option::Option<crate::model::GcsSource>,
3381
3382    /// File content, represented as a stream of bytes.
3383    /// Note: As with all `bytes` fields, protobuffers use a pure binary
3384    /// representation, whereas JSON representations use base64.
3385    ///
3386    /// Currently, this field only works for BatchAnnotateFiles requests. It does
3387    /// not work for AsyncBatchAnnotateFiles requests.
3388    pub content: ::bytes::Bytes,
3389
3390    /// The type of the file. Currently only "application/pdf", "image/tiff" and
3391    /// "image/gif" are supported. Wildcards are not supported.
3392    pub mime_type: std::string::String,
3393
3394    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3395}
3396
3397impl InputConfig {
3398    pub fn new() -> Self {
3399        std::default::Default::default()
3400    }
3401
3402    /// Sets the value of [gcs_source][crate::model::InputConfig::gcs_source].
3403    pub fn set_gcs_source<T>(mut self, v: T) -> Self
3404    where
3405        T: std::convert::Into<crate::model::GcsSource>,
3406    {
3407        self.gcs_source = std::option::Option::Some(v.into());
3408        self
3409    }
3410
3411    /// Sets or clears the value of [gcs_source][crate::model::InputConfig::gcs_source].
3412    pub fn set_or_clear_gcs_source<T>(mut self, v: std::option::Option<T>) -> Self
3413    where
3414        T: std::convert::Into<crate::model::GcsSource>,
3415    {
3416        self.gcs_source = v.map(|x| x.into());
3417        self
3418    }
3419
3420    /// Sets the value of [content][crate::model::InputConfig::content].
3421    pub fn set_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
3422        self.content = v.into();
3423        self
3424    }
3425
3426    /// Sets the value of [mime_type][crate::model::InputConfig::mime_type].
3427    pub fn set_mime_type<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3428        self.mime_type = v.into();
3429        self
3430    }
3431}
3432
3433impl wkt::message::Message for InputConfig {
3434    fn typename() -> &'static str {
3435        "type.googleapis.com/google.cloud.vision.v1.InputConfig"
3436    }
3437}
3438
3439/// The desired output location and metadata.
3440#[derive(Clone, Default, PartialEq)]
3441#[non_exhaustive]
3442pub struct OutputConfig {
3443    /// The Google Cloud Storage location to write the output(s) to.
3444    pub gcs_destination: std::option::Option<crate::model::GcsDestination>,
3445
3446    /// The max number of response protos to put into each output JSON file on
3447    /// Google Cloud Storage.
3448    /// The valid range is [1, 100]. If not specified, the default value is 20.
3449    ///
3450    /// For example, for one pdf file with 100 pages, 100 response protos will
3451    /// be generated. If `batch_size` = 20, then 5 json files each
3452    /// containing 20 response protos will be written under the prefix
3453    /// `gcs_destination`.`uri`.
3454    ///
3455    /// Currently, batch_size only applies to GcsDestination, with potential future
3456    /// support for other output configurations.
3457    pub batch_size: i32,
3458
3459    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3460}
3461
3462impl OutputConfig {
3463    pub fn new() -> Self {
3464        std::default::Default::default()
3465    }
3466
3467    /// Sets the value of [gcs_destination][crate::model::OutputConfig::gcs_destination].
3468    pub fn set_gcs_destination<T>(mut self, v: T) -> Self
3469    where
3470        T: std::convert::Into<crate::model::GcsDestination>,
3471    {
3472        self.gcs_destination = std::option::Option::Some(v.into());
3473        self
3474    }
3475
3476    /// Sets or clears the value of [gcs_destination][crate::model::OutputConfig::gcs_destination].
3477    pub fn set_or_clear_gcs_destination<T>(mut self, v: std::option::Option<T>) -> Self
3478    where
3479        T: std::convert::Into<crate::model::GcsDestination>,
3480    {
3481        self.gcs_destination = v.map(|x| x.into());
3482        self
3483    }
3484
3485    /// Sets the value of [batch_size][crate::model::OutputConfig::batch_size].
3486    pub fn set_batch_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3487        self.batch_size = v.into();
3488        self
3489    }
3490}
3491
3492impl wkt::message::Message for OutputConfig {
3493    fn typename() -> &'static str {
3494        "type.googleapis.com/google.cloud.vision.v1.OutputConfig"
3495    }
3496}
3497
3498/// The Google Cloud Storage location where the input will be read from.
3499#[derive(Clone, Default, PartialEq)]
3500#[non_exhaustive]
3501pub struct GcsSource {
3502    /// Google Cloud Storage URI for the input file. This must only be a
3503    /// Google Cloud Storage object. Wildcards are not currently supported.
3504    pub uri: std::string::String,
3505
3506    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3507}
3508
3509impl GcsSource {
3510    pub fn new() -> Self {
3511        std::default::Default::default()
3512    }
3513
3514    /// Sets the value of [uri][crate::model::GcsSource::uri].
3515    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3516        self.uri = v.into();
3517        self
3518    }
3519}
3520
3521impl wkt::message::Message for GcsSource {
3522    fn typename() -> &'static str {
3523        "type.googleapis.com/google.cloud.vision.v1.GcsSource"
3524    }
3525}
3526
3527/// The Google Cloud Storage location where the output will be written to.
3528#[derive(Clone, Default, PartialEq)]
3529#[non_exhaustive]
3530pub struct GcsDestination {
3531    /// Google Cloud Storage URI prefix where the results will be stored. Results
3532    /// will be in JSON format and preceded by its corresponding input URI prefix.
3533    /// This field can either represent a gcs file prefix or gcs directory. In
3534    /// either case, the uri should be unique because in order to get all of the
3535    /// output files, you will need to do a wildcard gcs search on the uri prefix
3536    /// you provide.
3537    ///
3538    /// Examples:
3539    ///
3540    /// * File Prefix: gs://bucket-name/here/filenameprefix   The output files
3541    ///   will be created in gs://bucket-name/here/ and the names of the
3542    ///   output files will begin with "filenameprefix".
3543    ///
3544    /// * Directory Prefix: gs://bucket-name/some/location/   The output files
3545    ///   will be created in gs://bucket-name/some/location/ and the names of the
3546    ///   output files could be anything because there was no filename prefix
3547    ///   specified.
3548    ///
3549    ///
3550    /// If multiple outputs, each response is still AnnotateFileResponse, each of
3551    /// which contains some subset of the full list of AnnotateImageResponse.
3552    /// Multiple outputs can happen if, for example, the output JSON is too large
3553    /// and overflows into multiple sharded files.
3554    pub uri: std::string::String,
3555
3556    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3557}
3558
3559impl GcsDestination {
3560    pub fn new() -> Self {
3561        std::default::Default::default()
3562    }
3563
3564    /// Sets the value of [uri][crate::model::GcsDestination::uri].
3565    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3566        self.uri = v.into();
3567        self
3568    }
3569}
3570
3571impl wkt::message::Message for GcsDestination {
3572    fn typename() -> &'static str {
3573        "type.googleapis.com/google.cloud.vision.v1.GcsDestination"
3574    }
3575}
3576
3577/// Contains metadata for the BatchAnnotateImages operation.
3578#[derive(Clone, Default, PartialEq)]
3579#[non_exhaustive]
3580pub struct OperationMetadata {
3581    /// Current state of the batch operation.
3582    pub state: crate::model::operation_metadata::State,
3583
3584    /// The time when the batch request was received.
3585    pub create_time: std::option::Option<wkt::Timestamp>,
3586
3587    /// The time when the operation result was last updated.
3588    pub update_time: std::option::Option<wkt::Timestamp>,
3589
3590    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3591}
3592
3593impl OperationMetadata {
3594    pub fn new() -> Self {
3595        std::default::Default::default()
3596    }
3597
3598    /// Sets the value of [state][crate::model::OperationMetadata::state].
3599    pub fn set_state<T: std::convert::Into<crate::model::operation_metadata::State>>(
3600        mut self,
3601        v: T,
3602    ) -> Self {
3603        self.state = v.into();
3604        self
3605    }
3606
3607    /// Sets the value of [create_time][crate::model::OperationMetadata::create_time].
3608    pub fn set_create_time<T>(mut self, v: T) -> Self
3609    where
3610        T: std::convert::Into<wkt::Timestamp>,
3611    {
3612        self.create_time = std::option::Option::Some(v.into());
3613        self
3614    }
3615
3616    /// Sets or clears the value of [create_time][crate::model::OperationMetadata::create_time].
3617    pub fn set_or_clear_create_time<T>(mut self, v: std::option::Option<T>) -> Self
3618    where
3619        T: std::convert::Into<wkt::Timestamp>,
3620    {
3621        self.create_time = v.map(|x| x.into());
3622        self
3623    }
3624
3625    /// Sets the value of [update_time][crate::model::OperationMetadata::update_time].
3626    pub fn set_update_time<T>(mut self, v: T) -> Self
3627    where
3628        T: std::convert::Into<wkt::Timestamp>,
3629    {
3630        self.update_time = std::option::Option::Some(v.into());
3631        self
3632    }
3633
3634    /// Sets or clears the value of [update_time][crate::model::OperationMetadata::update_time].
3635    pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3636    where
3637        T: std::convert::Into<wkt::Timestamp>,
3638    {
3639        self.update_time = v.map(|x| x.into());
3640        self
3641    }
3642}
3643
3644impl wkt::message::Message for OperationMetadata {
3645    fn typename() -> &'static str {
3646        "type.googleapis.com/google.cloud.vision.v1.OperationMetadata"
3647    }
3648}
3649
3650/// Defines additional types related to [OperationMetadata].
3651pub mod operation_metadata {
3652    #[allow(unused_imports)]
3653    use super::*;
3654
3655    /// Batch operation states.
3656    ///
3657    /// # Working with unknown values
3658    ///
3659    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
3660    /// additional enum variants at any time. Adding new variants is not considered
3661    /// a breaking change. Applications should write their code in anticipation of:
3662    ///
3663    /// - New values appearing in future releases of the client library, **and**
3664    /// - New values received dynamically, without application changes.
3665    ///
3666    /// Please consult the [Working with enums] section in the user guide for some
3667    /// guidelines.
3668    ///
3669    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
3670    #[derive(Clone, Debug, PartialEq)]
3671    #[non_exhaustive]
3672    pub enum State {
3673        /// Invalid.
3674        Unspecified,
3675        /// Request is received.
3676        Created,
3677        /// Request is actively being processed.
3678        Running,
3679        /// The batch processing is done.
3680        Done,
3681        /// The batch processing was cancelled.
3682        Cancelled,
3683        /// If set, the enum was initialized with an unknown value.
3684        ///
3685        /// Applications can examine the value using [State::value] or
3686        /// [State::name].
3687        UnknownValue(state::UnknownValue),
3688    }
3689
3690    #[doc(hidden)]
3691    pub mod state {
3692        #[allow(unused_imports)]
3693        use super::*;
3694        #[derive(Clone, Debug, PartialEq)]
3695        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
3696    }
3697
3698    impl State {
3699        /// Gets the enum value.
3700        ///
3701        /// Returns `None` if the enum contains an unknown value deserialized from
3702        /// the string representation of enums.
3703        pub fn value(&self) -> std::option::Option<i32> {
3704            match self {
3705                Self::Unspecified => std::option::Option::Some(0),
3706                Self::Created => std::option::Option::Some(1),
3707                Self::Running => std::option::Option::Some(2),
3708                Self::Done => std::option::Option::Some(3),
3709                Self::Cancelled => std::option::Option::Some(4),
3710                Self::UnknownValue(u) => u.0.value(),
3711            }
3712        }
3713
3714        /// Gets the enum value as a string.
3715        ///
3716        /// Returns `None` if the enum contains an unknown value deserialized from
3717        /// the integer representation of enums.
3718        pub fn name(&self) -> std::option::Option<&str> {
3719            match self {
3720                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
3721                Self::Created => std::option::Option::Some("CREATED"),
3722                Self::Running => std::option::Option::Some("RUNNING"),
3723                Self::Done => std::option::Option::Some("DONE"),
3724                Self::Cancelled => std::option::Option::Some("CANCELLED"),
3725                Self::UnknownValue(u) => u.0.name(),
3726            }
3727        }
3728    }
3729
3730    impl std::default::Default for State {
3731        fn default() -> Self {
3732            use std::convert::From;
3733            Self::from(0)
3734        }
3735    }
3736
3737    impl std::fmt::Display for State {
3738        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
3739            wkt::internal::display_enum(f, self.name(), self.value())
3740        }
3741    }
3742
3743    impl std::convert::From<i32> for State {
3744        fn from(value: i32) -> Self {
3745            match value {
3746                0 => Self::Unspecified,
3747                1 => Self::Created,
3748                2 => Self::Running,
3749                3 => Self::Done,
3750                4 => Self::Cancelled,
3751                _ => Self::UnknownValue(state::UnknownValue(
3752                    wkt::internal::UnknownEnumValue::Integer(value),
3753                )),
3754            }
3755        }
3756    }
3757
3758    impl std::convert::From<&str> for State {
3759        fn from(value: &str) -> Self {
3760            use std::string::ToString;
3761            match value {
3762                "STATE_UNSPECIFIED" => Self::Unspecified,
3763                "CREATED" => Self::Created,
3764                "RUNNING" => Self::Running,
3765                "DONE" => Self::Done,
3766                "CANCELLED" => Self::Cancelled,
3767                _ => Self::UnknownValue(state::UnknownValue(
3768                    wkt::internal::UnknownEnumValue::String(value.to_string()),
3769                )),
3770            }
3771        }
3772    }
3773
3774    impl serde::ser::Serialize for State {
3775        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
3776        where
3777            S: serde::Serializer,
3778        {
3779            match self {
3780                Self::Unspecified => serializer.serialize_i32(0),
3781                Self::Created => serializer.serialize_i32(1),
3782                Self::Running => serializer.serialize_i32(2),
3783                Self::Done => serializer.serialize_i32(3),
3784                Self::Cancelled => serializer.serialize_i32(4),
3785                Self::UnknownValue(u) => u.0.serialize(serializer),
3786            }
3787        }
3788    }
3789
3790    impl<'de> serde::de::Deserialize<'de> for State {
3791        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
3792        where
3793            D: serde::Deserializer<'de>,
3794        {
3795            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
3796                ".google.cloud.vision.v1.OperationMetadata.State",
3797            ))
3798        }
3799    }
3800}
3801
3802/// Parameters for a product search request.
3803#[derive(Clone, Default, PartialEq)]
3804#[non_exhaustive]
3805pub struct ProductSearchParams {
3806    /// The bounding polygon around the area of interest in the image.
3807    /// If it is not specified, system discretion will be applied.
3808    pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
3809
3810    /// The resource name of a [ProductSet][google.cloud.vision.v1.ProductSet] to
3811    /// be searched for similar images.
3812    ///
3813    /// Format is:
3814    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
3815    ///
3816    /// [google.cloud.vision.v1.ProductSet]: crate::model::ProductSet
3817    pub product_set: std::string::String,
3818
3819    /// The list of product categories to search in. Currently, we only consider
3820    /// the first category, and either "homegoods-v2", "apparel-v2", "toys-v2",
3821    /// "packagedgoods-v1", or "general-v1" should be specified. The legacy
3822    /// categories "homegoods", "apparel", and "toys" are still supported but will
3823    /// be deprecated. For new products, please use "homegoods-v2", "apparel-v2",
3824    /// or "toys-v2" for better product search accuracy. It is recommended to
3825    /// migrate existing products to these categories as well.
3826    pub product_categories: std::vec::Vec<std::string::String>,
3827
3828    /// The filtering expression. This can be used to restrict search results based
3829    /// on Product labels. We currently support an AND of OR of key-value
3830    /// expressions, where each expression within an OR must have the same key. An
3831    /// '=' should be used to connect the key and value.
3832    ///
3833    /// For example, "(color = red OR color = blue) AND brand = Google" is
3834    /// acceptable, but "(color = red OR brand = Google)" is not acceptable.
3835    /// "color: red" is not acceptable because it uses a ':' instead of an '='.
3836    pub filter: std::string::String,
3837
3838    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3839}
3840
3841impl ProductSearchParams {
3842    pub fn new() -> Self {
3843        std::default::Default::default()
3844    }
3845
3846    /// Sets the value of [bounding_poly][crate::model::ProductSearchParams::bounding_poly].
3847    pub fn set_bounding_poly<T>(mut self, v: T) -> Self
3848    where
3849        T: std::convert::Into<crate::model::BoundingPoly>,
3850    {
3851        self.bounding_poly = std::option::Option::Some(v.into());
3852        self
3853    }
3854
3855    /// Sets or clears the value of [bounding_poly][crate::model::ProductSearchParams::bounding_poly].
3856    pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
3857    where
3858        T: std::convert::Into<crate::model::BoundingPoly>,
3859    {
3860        self.bounding_poly = v.map(|x| x.into());
3861        self
3862    }
3863
3864    /// Sets the value of [product_set][crate::model::ProductSearchParams::product_set].
3865    pub fn set_product_set<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3866        self.product_set = v.into();
3867        self
3868    }
3869
3870    /// Sets the value of [product_categories][crate::model::ProductSearchParams::product_categories].
3871    pub fn set_product_categories<T, V>(mut self, v: T) -> Self
3872    where
3873        T: std::iter::IntoIterator<Item = V>,
3874        V: std::convert::Into<std::string::String>,
3875    {
3876        use std::iter::Iterator;
3877        self.product_categories = v.into_iter().map(|i| i.into()).collect();
3878        self
3879    }
3880
3881    /// Sets the value of [filter][crate::model::ProductSearchParams::filter].
3882    pub fn set_filter<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3883        self.filter = v.into();
3884        self
3885    }
3886}
3887
3888impl wkt::message::Message for ProductSearchParams {
3889    fn typename() -> &'static str {
3890        "type.googleapis.com/google.cloud.vision.v1.ProductSearchParams"
3891    }
3892}
3893
3894/// Results for a product search request.
3895#[derive(Clone, Default, PartialEq)]
3896#[non_exhaustive]
3897pub struct ProductSearchResults {
3898    /// Timestamp of the index which provided these results. Products added to the
3899    /// product set and products removed from the product set after this time are
3900    /// not reflected in the current results.
3901    pub index_time: std::option::Option<wkt::Timestamp>,
3902
3903    /// List of results, one for each product match.
3904    pub results: std::vec::Vec<crate::model::product_search_results::Result>,
3905
3906    /// List of results grouped by products detected in the query image. Each entry
3907    /// corresponds to one bounding polygon in the query image, and contains the
3908    /// matching products specific to that region. There may be duplicate product
3909    /// matches in the union of all the per-product results.
3910    pub product_grouped_results: std::vec::Vec<crate::model::product_search_results::GroupedResult>,
3911
3912    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3913}
3914
3915impl ProductSearchResults {
3916    pub fn new() -> Self {
3917        std::default::Default::default()
3918    }
3919
3920    /// Sets the value of [index_time][crate::model::ProductSearchResults::index_time].
3921    pub fn set_index_time<T>(mut self, v: T) -> Self
3922    where
3923        T: std::convert::Into<wkt::Timestamp>,
3924    {
3925        self.index_time = std::option::Option::Some(v.into());
3926        self
3927    }
3928
3929    /// Sets or clears the value of [index_time][crate::model::ProductSearchResults::index_time].
3930    pub fn set_or_clear_index_time<T>(mut self, v: std::option::Option<T>) -> Self
3931    where
3932        T: std::convert::Into<wkt::Timestamp>,
3933    {
3934        self.index_time = v.map(|x| x.into());
3935        self
3936    }
3937
3938    /// Sets the value of [results][crate::model::ProductSearchResults::results].
3939    pub fn set_results<T, V>(mut self, v: T) -> Self
3940    where
3941        T: std::iter::IntoIterator<Item = V>,
3942        V: std::convert::Into<crate::model::product_search_results::Result>,
3943    {
3944        use std::iter::Iterator;
3945        self.results = v.into_iter().map(|i| i.into()).collect();
3946        self
3947    }
3948
3949    /// Sets the value of [product_grouped_results][crate::model::ProductSearchResults::product_grouped_results].
3950    pub fn set_product_grouped_results<T, V>(mut self, v: T) -> Self
3951    where
3952        T: std::iter::IntoIterator<Item = V>,
3953        V: std::convert::Into<crate::model::product_search_results::GroupedResult>,
3954    {
3955        use std::iter::Iterator;
3956        self.product_grouped_results = v.into_iter().map(|i| i.into()).collect();
3957        self
3958    }
3959}
3960
3961impl wkt::message::Message for ProductSearchResults {
3962    fn typename() -> &'static str {
3963        "type.googleapis.com/google.cloud.vision.v1.ProductSearchResults"
3964    }
3965}
3966
3967/// Defines additional types related to [ProductSearchResults].
3968pub mod product_search_results {
3969    #[allow(unused_imports)]
3970    use super::*;
3971
3972    /// Information about a product.
3973    #[derive(Clone, Default, PartialEq)]
3974    #[non_exhaustive]
3975    pub struct Result {
3976        /// The Product.
3977        pub product: std::option::Option<crate::model::Product>,
3978
3979        /// A confidence level on the match, ranging from 0 (no confidence) to
3980        /// 1 (full confidence).
3981        pub score: f32,
3982
3983        /// The resource name of the image from the product that is the closest match
3984        /// to the query.
3985        pub image: std::string::String,
3986
3987        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3988    }
3989
3990    impl Result {
3991        pub fn new() -> Self {
3992            std::default::Default::default()
3993        }
3994
3995        /// Sets the value of [product][crate::model::product_search_results::Result::product].
3996        pub fn set_product<T>(mut self, v: T) -> Self
3997        where
3998            T: std::convert::Into<crate::model::Product>,
3999        {
4000            self.product = std::option::Option::Some(v.into());
4001            self
4002        }
4003
4004        /// Sets or clears the value of [product][crate::model::product_search_results::Result::product].
4005        pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
4006        where
4007            T: std::convert::Into<crate::model::Product>,
4008        {
4009            self.product = v.map(|x| x.into());
4010            self
4011        }
4012
4013        /// Sets the value of [score][crate::model::product_search_results::Result::score].
4014        pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4015            self.score = v.into();
4016            self
4017        }
4018
4019        /// Sets the value of [image][crate::model::product_search_results::Result::image].
4020        pub fn set_image<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4021            self.image = v.into();
4022            self
4023        }
4024    }
4025
4026    impl wkt::message::Message for Result {
4027        fn typename() -> &'static str {
4028            "type.googleapis.com/google.cloud.vision.v1.ProductSearchResults.Result"
4029        }
4030    }
4031
4032    /// Prediction for what the object in the bounding box is.
4033    #[derive(Clone, Default, PartialEq)]
4034    #[non_exhaustive]
4035    pub struct ObjectAnnotation {
4036        /// Object ID that should align with EntityAnnotation mid.
4037        pub mid: std::string::String,
4038
4039        /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more
4040        /// information, see
4041        /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier>.
4042        pub language_code: std::string::String,
4043
4044        /// Object name, expressed in its `language_code` language.
4045        pub name: std::string::String,
4046
4047        /// Score of the result. Range [0, 1].
4048        pub score: f32,
4049
4050        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4051    }
4052
4053    impl ObjectAnnotation {
4054        pub fn new() -> Self {
4055            std::default::Default::default()
4056        }
4057
4058        /// Sets the value of [mid][crate::model::product_search_results::ObjectAnnotation::mid].
4059        pub fn set_mid<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4060            self.mid = v.into();
4061            self
4062        }
4063
4064        /// Sets the value of [language_code][crate::model::product_search_results::ObjectAnnotation::language_code].
4065        pub fn set_language_code<T: std::convert::Into<std::string::String>>(
4066            mut self,
4067            v: T,
4068        ) -> Self {
4069            self.language_code = v.into();
4070            self
4071        }
4072
4073        /// Sets the value of [name][crate::model::product_search_results::ObjectAnnotation::name].
4074        pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4075            self.name = v.into();
4076            self
4077        }
4078
4079        /// Sets the value of [score][crate::model::product_search_results::ObjectAnnotation::score].
4080        pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4081            self.score = v.into();
4082            self
4083        }
4084    }
4085
4086    impl wkt::message::Message for ObjectAnnotation {
4087        fn typename() -> &'static str {
4088            "type.googleapis.com/google.cloud.vision.v1.ProductSearchResults.ObjectAnnotation"
4089        }
4090    }
4091
4092    /// Information about the products similar to a single product in a query
4093    /// image.
4094    #[derive(Clone, Default, PartialEq)]
4095    #[non_exhaustive]
4096    pub struct GroupedResult {
4097        /// The bounding polygon around the product detected in the query image.
4098        pub bounding_poly: std::option::Option<crate::model::BoundingPoly>,
4099
4100        /// List of results, one for each product match.
4101        pub results: std::vec::Vec<crate::model::product_search_results::Result>,
4102
4103        /// List of generic predictions for the object in the bounding box.
4104        pub object_annotations:
4105            std::vec::Vec<crate::model::product_search_results::ObjectAnnotation>,
4106
4107        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4108    }
4109
4110    impl GroupedResult {
4111        pub fn new() -> Self {
4112            std::default::Default::default()
4113        }
4114
4115        /// Sets the value of [bounding_poly][crate::model::product_search_results::GroupedResult::bounding_poly].
4116        pub fn set_bounding_poly<T>(mut self, v: T) -> Self
4117        where
4118            T: std::convert::Into<crate::model::BoundingPoly>,
4119        {
4120            self.bounding_poly = std::option::Option::Some(v.into());
4121            self
4122        }
4123
4124        /// Sets or clears the value of [bounding_poly][crate::model::product_search_results::GroupedResult::bounding_poly].
4125        pub fn set_or_clear_bounding_poly<T>(mut self, v: std::option::Option<T>) -> Self
4126        where
4127            T: std::convert::Into<crate::model::BoundingPoly>,
4128        {
4129            self.bounding_poly = v.map(|x| x.into());
4130            self
4131        }
4132
4133        /// Sets the value of [results][crate::model::product_search_results::GroupedResult::results].
4134        pub fn set_results<T, V>(mut self, v: T) -> Self
4135        where
4136            T: std::iter::IntoIterator<Item = V>,
4137            V: std::convert::Into<crate::model::product_search_results::Result>,
4138        {
4139            use std::iter::Iterator;
4140            self.results = v.into_iter().map(|i| i.into()).collect();
4141            self
4142        }
4143
4144        /// Sets the value of [object_annotations][crate::model::product_search_results::GroupedResult::object_annotations].
4145        pub fn set_object_annotations<T, V>(mut self, v: T) -> Self
4146        where
4147            T: std::iter::IntoIterator<Item = V>,
4148            V: std::convert::Into<crate::model::product_search_results::ObjectAnnotation>,
4149        {
4150            use std::iter::Iterator;
4151            self.object_annotations = v.into_iter().map(|i| i.into()).collect();
4152            self
4153        }
4154    }
4155
4156    impl wkt::message::Message for GroupedResult {
4157        fn typename() -> &'static str {
4158            "type.googleapis.com/google.cloud.vision.v1.ProductSearchResults.GroupedResult"
4159        }
4160    }
4161}
4162
4163/// A Product contains ReferenceImages.
4164#[derive(Clone, Default, PartialEq)]
4165#[non_exhaustive]
4166pub struct Product {
4167    /// The resource name of the product.
4168    ///
4169    /// Format is:
4170    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
4171    ///
4172    /// This field is ignored when creating a product.
4173    pub name: std::string::String,
4174
4175    /// The user-provided name for this Product. Must not be empty. Must be at most
4176    /// 4096 characters long.
4177    pub display_name: std::string::String,
4178
4179    /// User-provided metadata to be stored with this product. Must be at most 4096
4180    /// characters long.
4181    pub description: std::string::String,
4182
4183    /// Immutable. The category for the product identified by the reference image.
4184    /// This should be one of "homegoods-v2", "apparel-v2", "toys-v2",
4185    /// "packagedgoods-v1" or "general-v1". The legacy categories "homegoods",
4186    /// "apparel", and "toys" are still supported, but these should not be used for
4187    /// new products.
4188    pub product_category: std::string::String,
4189
4190    /// Key-value pairs that can be attached to a product. At query time,
4191    /// constraints can be specified based on the product_labels.
4192    ///
4193    /// Note that integer values can be provided as strings, e.g. "1199". Only
4194    /// strings with integer values can match a range-based restriction which is
4195    /// to be supported soon.
4196    ///
4197    /// Multiple values can be assigned to the same key. One product may have up to
4198    /// 500 product_labels.
4199    ///
4200    /// Notice that the total number of distinct product_labels over all products
4201    /// in one ProductSet cannot exceed 1M, otherwise the product search pipeline
4202    /// will refuse to work for that ProductSet.
4203    pub product_labels: std::vec::Vec<crate::model::product::KeyValue>,
4204
4205    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4206}
4207
4208impl Product {
4209    pub fn new() -> Self {
4210        std::default::Default::default()
4211    }
4212
4213    /// Sets the value of [name][crate::model::Product::name].
4214    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4215        self.name = v.into();
4216        self
4217    }
4218
4219    /// Sets the value of [display_name][crate::model::Product::display_name].
4220    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4221        self.display_name = v.into();
4222        self
4223    }
4224
4225    /// Sets the value of [description][crate::model::Product::description].
4226    pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4227        self.description = v.into();
4228        self
4229    }
4230
4231    /// Sets the value of [product_category][crate::model::Product::product_category].
4232    pub fn set_product_category<T: std::convert::Into<std::string::String>>(
4233        mut self,
4234        v: T,
4235    ) -> Self {
4236        self.product_category = v.into();
4237        self
4238    }
4239
4240    /// Sets the value of [product_labels][crate::model::Product::product_labels].
4241    pub fn set_product_labels<T, V>(mut self, v: T) -> Self
4242    where
4243        T: std::iter::IntoIterator<Item = V>,
4244        V: std::convert::Into<crate::model::product::KeyValue>,
4245    {
4246        use std::iter::Iterator;
4247        self.product_labels = v.into_iter().map(|i| i.into()).collect();
4248        self
4249    }
4250}
4251
4252impl wkt::message::Message for Product {
4253    fn typename() -> &'static str {
4254        "type.googleapis.com/google.cloud.vision.v1.Product"
4255    }
4256}
4257
4258/// Defines additional types related to [Product].
4259pub mod product {
4260    #[allow(unused_imports)]
4261    use super::*;
4262
4263    /// A product label represented as a key-value pair.
4264    #[derive(Clone, Default, PartialEq)]
4265    #[non_exhaustive]
4266    pub struct KeyValue {
4267        /// The key of the label attached to the product. Cannot be empty and cannot
4268        /// exceed 128 bytes.
4269        pub key: std::string::String,
4270
4271        /// The value of the label attached to the product. Cannot be empty and
4272        /// cannot exceed 128 bytes.
4273        pub value: std::string::String,
4274
4275        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4276    }
4277
4278    impl KeyValue {
4279        pub fn new() -> Self {
4280            std::default::Default::default()
4281        }
4282
4283        /// Sets the value of [key][crate::model::product::KeyValue::key].
4284        pub fn set_key<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4285            self.key = v.into();
4286            self
4287        }
4288
4289        /// Sets the value of [value][crate::model::product::KeyValue::value].
4290        pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4291            self.value = v.into();
4292            self
4293        }
4294    }
4295
4296    impl wkt::message::Message for KeyValue {
4297        fn typename() -> &'static str {
4298            "type.googleapis.com/google.cloud.vision.v1.Product.KeyValue"
4299        }
4300    }
4301}
4302
4303/// A ProductSet contains Products. A ProductSet can contain a maximum of 1
4304/// million reference images. If the limit is exceeded, periodic indexing will
4305/// fail.
4306#[derive(Clone, Default, PartialEq)]
4307#[non_exhaustive]
4308pub struct ProductSet {
4309    /// The resource name of the ProductSet.
4310    ///
4311    /// Format is:
4312    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
4313    ///
4314    /// This field is ignored when creating a ProductSet.
4315    pub name: std::string::String,
4316
4317    /// The user-provided name for this ProductSet. Must not be empty. Must be at
4318    /// most 4096 characters long.
4319    pub display_name: std::string::String,
4320
4321    /// Output only. The time at which this ProductSet was last indexed. Query
4322    /// results will reflect all updates before this time. If this ProductSet has
4323    /// never been indexed, this timestamp is the default value
4324    /// "1970-01-01T00:00:00Z".
4325    ///
4326    /// This field is ignored when creating a ProductSet.
4327    pub index_time: std::option::Option<wkt::Timestamp>,
4328
4329    /// Output only. If there was an error with indexing the product set, the field
4330    /// is populated.
4331    ///
4332    /// This field is ignored when creating a ProductSet.
4333    pub index_error: std::option::Option<rpc::model::Status>,
4334
4335    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4336}
4337
4338impl ProductSet {
4339    pub fn new() -> Self {
4340        std::default::Default::default()
4341    }
4342
4343    /// Sets the value of [name][crate::model::ProductSet::name].
4344    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4345        self.name = v.into();
4346        self
4347    }
4348
4349    /// Sets the value of [display_name][crate::model::ProductSet::display_name].
4350    pub fn set_display_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4351        self.display_name = v.into();
4352        self
4353    }
4354
4355    /// Sets the value of [index_time][crate::model::ProductSet::index_time].
4356    pub fn set_index_time<T>(mut self, v: T) -> Self
4357    where
4358        T: std::convert::Into<wkt::Timestamp>,
4359    {
4360        self.index_time = std::option::Option::Some(v.into());
4361        self
4362    }
4363
4364    /// Sets or clears the value of [index_time][crate::model::ProductSet::index_time].
4365    pub fn set_or_clear_index_time<T>(mut self, v: std::option::Option<T>) -> Self
4366    where
4367        T: std::convert::Into<wkt::Timestamp>,
4368    {
4369        self.index_time = v.map(|x| x.into());
4370        self
4371    }
4372
4373    /// Sets the value of [index_error][crate::model::ProductSet::index_error].
4374    pub fn set_index_error<T>(mut self, v: T) -> Self
4375    where
4376        T: std::convert::Into<rpc::model::Status>,
4377    {
4378        self.index_error = std::option::Option::Some(v.into());
4379        self
4380    }
4381
4382    /// Sets or clears the value of [index_error][crate::model::ProductSet::index_error].
4383    pub fn set_or_clear_index_error<T>(mut self, v: std::option::Option<T>) -> Self
4384    where
4385        T: std::convert::Into<rpc::model::Status>,
4386    {
4387        self.index_error = v.map(|x| x.into());
4388        self
4389    }
4390}
4391
4392impl wkt::message::Message for ProductSet {
4393    fn typename() -> &'static str {
4394        "type.googleapis.com/google.cloud.vision.v1.ProductSet"
4395    }
4396}
4397
4398/// A `ReferenceImage` represents a product image and its associated metadata,
4399/// such as bounding boxes.
4400#[derive(Clone, Default, PartialEq)]
4401#[non_exhaustive]
4402pub struct ReferenceImage {
4403    /// The resource name of the reference image.
4404    ///
4405    /// Format is:
4406    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
4407    ///
4408    /// This field is ignored when creating a reference image.
4409    pub name: std::string::String,
4410
4411    /// Required. The Google Cloud Storage URI of the reference image.
4412    ///
4413    /// The URI must start with `gs://`.
4414    pub uri: std::string::String,
4415
4416    /// Optional. Bounding polygons around the areas of interest in the reference
4417    /// image. If this field is empty, the system will try to detect regions of
4418    /// interest. At most 10 bounding polygons will be used.
4419    ///
4420    /// The provided shape is converted into a non-rotated rectangle. Once
4421    /// converted, the small edge of the rectangle must be greater than or equal
4422    /// to 300 pixels. The aspect ratio must be 1:4 or less (i.e. 1:3 is ok; 1:5
4423    /// is not).
4424    pub bounding_polys: std::vec::Vec<crate::model::BoundingPoly>,
4425
4426    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4427}
4428
4429impl ReferenceImage {
4430    pub fn new() -> Self {
4431        std::default::Default::default()
4432    }
4433
4434    /// Sets the value of [name][crate::model::ReferenceImage::name].
4435    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4436        self.name = v.into();
4437        self
4438    }
4439
4440    /// Sets the value of [uri][crate::model::ReferenceImage::uri].
4441    pub fn set_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4442        self.uri = v.into();
4443        self
4444    }
4445
4446    /// Sets the value of [bounding_polys][crate::model::ReferenceImage::bounding_polys].
4447    pub fn set_bounding_polys<T, V>(mut self, v: T) -> Self
4448    where
4449        T: std::iter::IntoIterator<Item = V>,
4450        V: std::convert::Into<crate::model::BoundingPoly>,
4451    {
4452        use std::iter::Iterator;
4453        self.bounding_polys = v.into_iter().map(|i| i.into()).collect();
4454        self
4455    }
4456}
4457
4458impl wkt::message::Message for ReferenceImage {
4459    fn typename() -> &'static str {
4460        "type.googleapis.com/google.cloud.vision.v1.ReferenceImage"
4461    }
4462}
4463
4464/// Request message for the `CreateProduct` method.
4465#[derive(Clone, Default, PartialEq)]
4466#[non_exhaustive]
4467pub struct CreateProductRequest {
4468    /// Required. The project in which the Product should be created.
4469    ///
4470    /// Format is
4471    /// `projects/PROJECT_ID/locations/LOC_ID`.
4472    pub parent: std::string::String,
4473
4474    /// Required. The product to create.
4475    pub product: std::option::Option<crate::model::Product>,
4476
4477    /// A user-supplied resource id for this Product. If set, the server will
4478    /// attempt to use this value as the resource id. If it is already in use, an
4479    /// error is returned with code ALREADY_EXISTS. Must be at most 128 characters
4480    /// long. It cannot contain the character `/`.
4481    pub product_id: std::string::String,
4482
4483    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4484}
4485
4486impl CreateProductRequest {
4487    pub fn new() -> Self {
4488        std::default::Default::default()
4489    }
4490
4491    /// Sets the value of [parent][crate::model::CreateProductRequest::parent].
4492    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4493        self.parent = v.into();
4494        self
4495    }
4496
4497    /// Sets the value of [product][crate::model::CreateProductRequest::product].
4498    pub fn set_product<T>(mut self, v: T) -> Self
4499    where
4500        T: std::convert::Into<crate::model::Product>,
4501    {
4502        self.product = std::option::Option::Some(v.into());
4503        self
4504    }
4505
4506    /// Sets or clears the value of [product][crate::model::CreateProductRequest::product].
4507    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
4508    where
4509        T: std::convert::Into<crate::model::Product>,
4510    {
4511        self.product = v.map(|x| x.into());
4512        self
4513    }
4514
4515    /// Sets the value of [product_id][crate::model::CreateProductRequest::product_id].
4516    pub fn set_product_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4517        self.product_id = v.into();
4518        self
4519    }
4520}
4521
4522impl wkt::message::Message for CreateProductRequest {
4523    fn typename() -> &'static str {
4524        "type.googleapis.com/google.cloud.vision.v1.CreateProductRequest"
4525    }
4526}
4527
4528/// Request message for the `ListProducts` method.
4529#[derive(Clone, Default, PartialEq)]
4530#[non_exhaustive]
4531pub struct ListProductsRequest {
4532    /// Required. The project OR ProductSet from which Products should be listed.
4533    ///
4534    /// Format:
4535    /// `projects/PROJECT_ID/locations/LOC_ID`
4536    pub parent: std::string::String,
4537
4538    /// The maximum number of items to return. Default 10, maximum 100.
4539    pub page_size: i32,
4540
4541    /// The next_page_token returned from a previous List request, if any.
4542    pub page_token: std::string::String,
4543
4544    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4545}
4546
4547impl ListProductsRequest {
4548    pub fn new() -> Self {
4549        std::default::Default::default()
4550    }
4551
4552    /// Sets the value of [parent][crate::model::ListProductsRequest::parent].
4553    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4554        self.parent = v.into();
4555        self
4556    }
4557
4558    /// Sets the value of [page_size][crate::model::ListProductsRequest::page_size].
4559    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4560        self.page_size = v.into();
4561        self
4562    }
4563
4564    /// Sets the value of [page_token][crate::model::ListProductsRequest::page_token].
4565    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4566        self.page_token = v.into();
4567        self
4568    }
4569}
4570
4571impl wkt::message::Message for ListProductsRequest {
4572    fn typename() -> &'static str {
4573        "type.googleapis.com/google.cloud.vision.v1.ListProductsRequest"
4574    }
4575}
4576
4577/// Response message for the `ListProducts` method.
4578#[derive(Clone, Default, PartialEq)]
4579#[non_exhaustive]
4580pub struct ListProductsResponse {
4581    /// List of products.
4582    pub products: std::vec::Vec<crate::model::Product>,
4583
4584    /// Token to retrieve the next page of results, or empty if there are no more
4585    /// results in the list.
4586    pub next_page_token: std::string::String,
4587
4588    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4589}
4590
4591impl ListProductsResponse {
4592    pub fn new() -> Self {
4593        std::default::Default::default()
4594    }
4595
4596    /// Sets the value of [products][crate::model::ListProductsResponse::products].
4597    pub fn set_products<T, V>(mut self, v: T) -> Self
4598    where
4599        T: std::iter::IntoIterator<Item = V>,
4600        V: std::convert::Into<crate::model::Product>,
4601    {
4602        use std::iter::Iterator;
4603        self.products = v.into_iter().map(|i| i.into()).collect();
4604        self
4605    }
4606
4607    /// Sets the value of [next_page_token][crate::model::ListProductsResponse::next_page_token].
4608    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4609        self.next_page_token = v.into();
4610        self
4611    }
4612}
4613
4614impl wkt::message::Message for ListProductsResponse {
4615    fn typename() -> &'static str {
4616        "type.googleapis.com/google.cloud.vision.v1.ListProductsResponse"
4617    }
4618}
4619
4620#[doc(hidden)]
4621impl gax::paginator::internal::PageableResponse for ListProductsResponse {
4622    type PageItem = crate::model::Product;
4623
4624    fn items(self) -> std::vec::Vec<Self::PageItem> {
4625        self.products
4626    }
4627
4628    fn next_page_token(&self) -> std::string::String {
4629        use std::clone::Clone;
4630        self.next_page_token.clone()
4631    }
4632}
4633
4634/// Request message for the `GetProduct` method.
4635#[derive(Clone, Default, PartialEq)]
4636#[non_exhaustive]
4637pub struct GetProductRequest {
4638    /// Required. Resource name of the Product to get.
4639    ///
4640    /// Format is:
4641    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
4642    pub name: std::string::String,
4643
4644    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4645}
4646
4647impl GetProductRequest {
4648    pub fn new() -> Self {
4649        std::default::Default::default()
4650    }
4651
4652    /// Sets the value of [name][crate::model::GetProductRequest::name].
4653    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4654        self.name = v.into();
4655        self
4656    }
4657}
4658
4659impl wkt::message::Message for GetProductRequest {
4660    fn typename() -> &'static str {
4661        "type.googleapis.com/google.cloud.vision.v1.GetProductRequest"
4662    }
4663}
4664
4665/// Request message for the `UpdateProduct` method.
4666#[derive(Clone, Default, PartialEq)]
4667#[non_exhaustive]
4668pub struct UpdateProductRequest {
4669    /// Required. The Product resource which replaces the one on the server.
4670    /// product.name is immutable.
4671    pub product: std::option::Option<crate::model::Product>,
4672
4673    /// The [FieldMask][google.protobuf.FieldMask] that specifies which fields
4674    /// to update.
4675    /// If update_mask isn't specified, all mutable fields are to be updated.
4676    /// Valid mask paths include `product_labels`, `display_name`, and
4677    /// `description`.
4678    ///
4679    /// [google.protobuf.FieldMask]: wkt::FieldMask
4680    pub update_mask: std::option::Option<wkt::FieldMask>,
4681
4682    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4683}
4684
4685impl UpdateProductRequest {
4686    pub fn new() -> Self {
4687        std::default::Default::default()
4688    }
4689
4690    /// Sets the value of [product][crate::model::UpdateProductRequest::product].
4691    pub fn set_product<T>(mut self, v: T) -> Self
4692    where
4693        T: std::convert::Into<crate::model::Product>,
4694    {
4695        self.product = std::option::Option::Some(v.into());
4696        self
4697    }
4698
4699    /// Sets or clears the value of [product][crate::model::UpdateProductRequest::product].
4700    pub fn set_or_clear_product<T>(mut self, v: std::option::Option<T>) -> Self
4701    where
4702        T: std::convert::Into<crate::model::Product>,
4703    {
4704        self.product = v.map(|x| x.into());
4705        self
4706    }
4707
4708    /// Sets the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
4709    pub fn set_update_mask<T>(mut self, v: T) -> Self
4710    where
4711        T: std::convert::Into<wkt::FieldMask>,
4712    {
4713        self.update_mask = std::option::Option::Some(v.into());
4714        self
4715    }
4716
4717    /// Sets or clears the value of [update_mask][crate::model::UpdateProductRequest::update_mask].
4718    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
4719    where
4720        T: std::convert::Into<wkt::FieldMask>,
4721    {
4722        self.update_mask = v.map(|x| x.into());
4723        self
4724    }
4725}
4726
4727impl wkt::message::Message for UpdateProductRequest {
4728    fn typename() -> &'static str {
4729        "type.googleapis.com/google.cloud.vision.v1.UpdateProductRequest"
4730    }
4731}
4732
4733/// Request message for the `DeleteProduct` method.
4734#[derive(Clone, Default, PartialEq)]
4735#[non_exhaustive]
4736pub struct DeleteProductRequest {
4737    /// Required. Resource name of product to delete.
4738    ///
4739    /// Format is:
4740    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
4741    pub name: std::string::String,
4742
4743    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4744}
4745
4746impl DeleteProductRequest {
4747    pub fn new() -> Self {
4748        std::default::Default::default()
4749    }
4750
4751    /// Sets the value of [name][crate::model::DeleteProductRequest::name].
4752    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4753        self.name = v.into();
4754        self
4755    }
4756}
4757
4758impl wkt::message::Message for DeleteProductRequest {
4759    fn typename() -> &'static str {
4760        "type.googleapis.com/google.cloud.vision.v1.DeleteProductRequest"
4761    }
4762}
4763
4764/// Request message for the `CreateProductSet` method.
4765#[derive(Clone, Default, PartialEq)]
4766#[non_exhaustive]
4767pub struct CreateProductSetRequest {
4768    /// Required. The project in which the ProductSet should be created.
4769    ///
4770    /// Format is `projects/PROJECT_ID/locations/LOC_ID`.
4771    pub parent: std::string::String,
4772
4773    /// Required. The ProductSet to create.
4774    pub product_set: std::option::Option<crate::model::ProductSet>,
4775
4776    /// A user-supplied resource id for this ProductSet. If set, the server will
4777    /// attempt to use this value as the resource id. If it is already in use, an
4778    /// error is returned with code ALREADY_EXISTS. Must be at most 128 characters
4779    /// long. It cannot contain the character `/`.
4780    pub product_set_id: std::string::String,
4781
4782    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4783}
4784
4785impl CreateProductSetRequest {
4786    pub fn new() -> Self {
4787        std::default::Default::default()
4788    }
4789
4790    /// Sets the value of [parent][crate::model::CreateProductSetRequest::parent].
4791    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4792        self.parent = v.into();
4793        self
4794    }
4795
4796    /// Sets the value of [product_set][crate::model::CreateProductSetRequest::product_set].
4797    pub fn set_product_set<T>(mut self, v: T) -> Self
4798    where
4799        T: std::convert::Into<crate::model::ProductSet>,
4800    {
4801        self.product_set = std::option::Option::Some(v.into());
4802        self
4803    }
4804
4805    /// Sets or clears the value of [product_set][crate::model::CreateProductSetRequest::product_set].
4806    pub fn set_or_clear_product_set<T>(mut self, v: std::option::Option<T>) -> Self
4807    where
4808        T: std::convert::Into<crate::model::ProductSet>,
4809    {
4810        self.product_set = v.map(|x| x.into());
4811        self
4812    }
4813
4814    /// Sets the value of [product_set_id][crate::model::CreateProductSetRequest::product_set_id].
4815    pub fn set_product_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4816        self.product_set_id = v.into();
4817        self
4818    }
4819}
4820
4821impl wkt::message::Message for CreateProductSetRequest {
4822    fn typename() -> &'static str {
4823        "type.googleapis.com/google.cloud.vision.v1.CreateProductSetRequest"
4824    }
4825}
4826
4827/// Request message for the `ListProductSets` method.
4828#[derive(Clone, Default, PartialEq)]
4829#[non_exhaustive]
4830pub struct ListProductSetsRequest {
4831    /// Required. The project from which ProductSets should be listed.
4832    ///
4833    /// Format is `projects/PROJECT_ID/locations/LOC_ID`.
4834    pub parent: std::string::String,
4835
4836    /// The maximum number of items to return. Default 10, maximum 100.
4837    pub page_size: i32,
4838
4839    /// The next_page_token returned from a previous List request, if any.
4840    pub page_token: std::string::String,
4841
4842    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4843}
4844
4845impl ListProductSetsRequest {
4846    pub fn new() -> Self {
4847        std::default::Default::default()
4848    }
4849
4850    /// Sets the value of [parent][crate::model::ListProductSetsRequest::parent].
4851    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4852        self.parent = v.into();
4853        self
4854    }
4855
4856    /// Sets the value of [page_size][crate::model::ListProductSetsRequest::page_size].
4857    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
4858        self.page_size = v.into();
4859        self
4860    }
4861
4862    /// Sets the value of [page_token][crate::model::ListProductSetsRequest::page_token].
4863    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4864        self.page_token = v.into();
4865        self
4866    }
4867}
4868
4869impl wkt::message::Message for ListProductSetsRequest {
4870    fn typename() -> &'static str {
4871        "type.googleapis.com/google.cloud.vision.v1.ListProductSetsRequest"
4872    }
4873}
4874
4875/// Response message for the `ListProductSets` method.
4876#[derive(Clone, Default, PartialEq)]
4877#[non_exhaustive]
4878pub struct ListProductSetsResponse {
4879    /// List of ProductSets.
4880    pub product_sets: std::vec::Vec<crate::model::ProductSet>,
4881
4882    /// Token to retrieve the next page of results, or empty if there are no more
4883    /// results in the list.
4884    pub next_page_token: std::string::String,
4885
4886    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4887}
4888
4889impl ListProductSetsResponse {
4890    pub fn new() -> Self {
4891        std::default::Default::default()
4892    }
4893
4894    /// Sets the value of [product_sets][crate::model::ListProductSetsResponse::product_sets].
4895    pub fn set_product_sets<T, V>(mut self, v: T) -> Self
4896    where
4897        T: std::iter::IntoIterator<Item = V>,
4898        V: std::convert::Into<crate::model::ProductSet>,
4899    {
4900        use std::iter::Iterator;
4901        self.product_sets = v.into_iter().map(|i| i.into()).collect();
4902        self
4903    }
4904
4905    /// Sets the value of [next_page_token][crate::model::ListProductSetsResponse::next_page_token].
4906    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4907        self.next_page_token = v.into();
4908        self
4909    }
4910}
4911
4912impl wkt::message::Message for ListProductSetsResponse {
4913    fn typename() -> &'static str {
4914        "type.googleapis.com/google.cloud.vision.v1.ListProductSetsResponse"
4915    }
4916}
4917
4918#[doc(hidden)]
4919impl gax::paginator::internal::PageableResponse for ListProductSetsResponse {
4920    type PageItem = crate::model::ProductSet;
4921
4922    fn items(self) -> std::vec::Vec<Self::PageItem> {
4923        self.product_sets
4924    }
4925
4926    fn next_page_token(&self) -> std::string::String {
4927        use std::clone::Clone;
4928        self.next_page_token.clone()
4929    }
4930}
4931
4932/// Request message for the `GetProductSet` method.
4933#[derive(Clone, Default, PartialEq)]
4934#[non_exhaustive]
4935pub struct GetProductSetRequest {
4936    /// Required. Resource name of the ProductSet to get.
4937    ///
4938    /// Format is:
4939    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
4940    pub name: std::string::String,
4941
4942    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4943}
4944
4945impl GetProductSetRequest {
4946    pub fn new() -> Self {
4947        std::default::Default::default()
4948    }
4949
4950    /// Sets the value of [name][crate::model::GetProductSetRequest::name].
4951    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4952        self.name = v.into();
4953        self
4954    }
4955}
4956
4957impl wkt::message::Message for GetProductSetRequest {
4958    fn typename() -> &'static str {
4959        "type.googleapis.com/google.cloud.vision.v1.GetProductSetRequest"
4960    }
4961}
4962
4963/// Request message for the `UpdateProductSet` method.
4964#[derive(Clone, Default, PartialEq)]
4965#[non_exhaustive]
4966pub struct UpdateProductSetRequest {
4967    /// Required. The ProductSet resource which replaces the one on the server.
4968    pub product_set: std::option::Option<crate::model::ProductSet>,
4969
4970    /// The [FieldMask][google.protobuf.FieldMask] that specifies which fields to
4971    /// update.
4972    /// If update_mask isn't specified, all mutable fields are to be updated.
4973    /// Valid mask path is `display_name`.
4974    ///
4975    /// [google.protobuf.FieldMask]: wkt::FieldMask
4976    pub update_mask: std::option::Option<wkt::FieldMask>,
4977
4978    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4979}
4980
4981impl UpdateProductSetRequest {
4982    pub fn new() -> Self {
4983        std::default::Default::default()
4984    }
4985
4986    /// Sets the value of [product_set][crate::model::UpdateProductSetRequest::product_set].
4987    pub fn set_product_set<T>(mut self, v: T) -> Self
4988    where
4989        T: std::convert::Into<crate::model::ProductSet>,
4990    {
4991        self.product_set = std::option::Option::Some(v.into());
4992        self
4993    }
4994
4995    /// Sets or clears the value of [product_set][crate::model::UpdateProductSetRequest::product_set].
4996    pub fn set_or_clear_product_set<T>(mut self, v: std::option::Option<T>) -> Self
4997    where
4998        T: std::convert::Into<crate::model::ProductSet>,
4999    {
5000        self.product_set = v.map(|x| x.into());
5001        self
5002    }
5003
5004    /// Sets the value of [update_mask][crate::model::UpdateProductSetRequest::update_mask].
5005    pub fn set_update_mask<T>(mut self, v: T) -> Self
5006    where
5007        T: std::convert::Into<wkt::FieldMask>,
5008    {
5009        self.update_mask = std::option::Option::Some(v.into());
5010        self
5011    }
5012
5013    /// Sets or clears the value of [update_mask][crate::model::UpdateProductSetRequest::update_mask].
5014    pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
5015    where
5016        T: std::convert::Into<wkt::FieldMask>,
5017    {
5018        self.update_mask = v.map(|x| x.into());
5019        self
5020    }
5021}
5022
5023impl wkt::message::Message for UpdateProductSetRequest {
5024    fn typename() -> &'static str {
5025        "type.googleapis.com/google.cloud.vision.v1.UpdateProductSetRequest"
5026    }
5027}
5028
5029/// Request message for the `DeleteProductSet` method.
5030#[derive(Clone, Default, PartialEq)]
5031#[non_exhaustive]
5032pub struct DeleteProductSetRequest {
5033    /// Required. Resource name of the ProductSet to delete.
5034    ///
5035    /// Format is:
5036    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
5037    pub name: std::string::String,
5038
5039    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5040}
5041
5042impl DeleteProductSetRequest {
5043    pub fn new() -> Self {
5044        std::default::Default::default()
5045    }
5046
5047    /// Sets the value of [name][crate::model::DeleteProductSetRequest::name].
5048    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5049        self.name = v.into();
5050        self
5051    }
5052}
5053
5054impl wkt::message::Message for DeleteProductSetRequest {
5055    fn typename() -> &'static str {
5056        "type.googleapis.com/google.cloud.vision.v1.DeleteProductSetRequest"
5057    }
5058}
5059
5060/// Request message for the `CreateReferenceImage` method.
5061#[derive(Clone, Default, PartialEq)]
5062#[non_exhaustive]
5063pub struct CreateReferenceImageRequest {
5064    /// Required. Resource name of the product in which to create the reference
5065    /// image.
5066    ///
5067    /// Format is
5068    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
5069    pub parent: std::string::String,
5070
5071    /// Required. The reference image to create.
5072    /// If an image ID is specified, it is ignored.
5073    pub reference_image: std::option::Option<crate::model::ReferenceImage>,
5074
5075    /// A user-supplied resource id for the ReferenceImage to be added. If set,
5076    /// the server will attempt to use this value as the resource id. If it is
5077    /// already in use, an error is returned with code ALREADY_EXISTS. Must be at
5078    /// most 128 characters long. It cannot contain the character `/`.
5079    pub reference_image_id: std::string::String,
5080
5081    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5082}
5083
5084impl CreateReferenceImageRequest {
5085    pub fn new() -> Self {
5086        std::default::Default::default()
5087    }
5088
5089    /// Sets the value of [parent][crate::model::CreateReferenceImageRequest::parent].
5090    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5091        self.parent = v.into();
5092        self
5093    }
5094
5095    /// Sets the value of [reference_image][crate::model::CreateReferenceImageRequest::reference_image].
5096    pub fn set_reference_image<T>(mut self, v: T) -> Self
5097    where
5098        T: std::convert::Into<crate::model::ReferenceImage>,
5099    {
5100        self.reference_image = std::option::Option::Some(v.into());
5101        self
5102    }
5103
5104    /// Sets or clears the value of [reference_image][crate::model::CreateReferenceImageRequest::reference_image].
5105    pub fn set_or_clear_reference_image<T>(mut self, v: std::option::Option<T>) -> Self
5106    where
5107        T: std::convert::Into<crate::model::ReferenceImage>,
5108    {
5109        self.reference_image = v.map(|x| x.into());
5110        self
5111    }
5112
5113    /// Sets the value of [reference_image_id][crate::model::CreateReferenceImageRequest::reference_image_id].
5114    pub fn set_reference_image_id<T: std::convert::Into<std::string::String>>(
5115        mut self,
5116        v: T,
5117    ) -> Self {
5118        self.reference_image_id = v.into();
5119        self
5120    }
5121}
5122
5123impl wkt::message::Message for CreateReferenceImageRequest {
5124    fn typename() -> &'static str {
5125        "type.googleapis.com/google.cloud.vision.v1.CreateReferenceImageRequest"
5126    }
5127}
5128
5129/// Request message for the `ListReferenceImages` method.
5130#[derive(Clone, Default, PartialEq)]
5131#[non_exhaustive]
5132pub struct ListReferenceImagesRequest {
5133    /// Required. Resource name of the product containing the reference images.
5134    ///
5135    /// Format is
5136    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`.
5137    pub parent: std::string::String,
5138
5139    /// The maximum number of items to return. Default 10, maximum 100.
5140    pub page_size: i32,
5141
5142    /// A token identifying a page of results to be returned. This is the value
5143    /// of `nextPageToken` returned in a previous reference image list request.
5144    ///
5145    /// Defaults to the first page if not specified.
5146    pub page_token: std::string::String,
5147
5148    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5149}
5150
5151impl ListReferenceImagesRequest {
5152    pub fn new() -> Self {
5153        std::default::Default::default()
5154    }
5155
5156    /// Sets the value of [parent][crate::model::ListReferenceImagesRequest::parent].
5157    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5158        self.parent = v.into();
5159        self
5160    }
5161
5162    /// Sets the value of [page_size][crate::model::ListReferenceImagesRequest::page_size].
5163    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5164        self.page_size = v.into();
5165        self
5166    }
5167
5168    /// Sets the value of [page_token][crate::model::ListReferenceImagesRequest::page_token].
5169    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5170        self.page_token = v.into();
5171        self
5172    }
5173}
5174
5175impl wkt::message::Message for ListReferenceImagesRequest {
5176    fn typename() -> &'static str {
5177        "type.googleapis.com/google.cloud.vision.v1.ListReferenceImagesRequest"
5178    }
5179}
5180
5181/// Response message for the `ListReferenceImages` method.
5182#[derive(Clone, Default, PartialEq)]
5183#[non_exhaustive]
5184pub struct ListReferenceImagesResponse {
5185    /// The list of reference images.
5186    pub reference_images: std::vec::Vec<crate::model::ReferenceImage>,
5187
5188    /// The maximum number of items to return. Default 10, maximum 100.
5189    pub page_size: i32,
5190
5191    /// The next_page_token returned from a previous List request, if any.
5192    pub next_page_token: std::string::String,
5193
5194    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5195}
5196
5197impl ListReferenceImagesResponse {
5198    pub fn new() -> Self {
5199        std::default::Default::default()
5200    }
5201
5202    /// Sets the value of [reference_images][crate::model::ListReferenceImagesResponse::reference_images].
5203    pub fn set_reference_images<T, V>(mut self, v: T) -> Self
5204    where
5205        T: std::iter::IntoIterator<Item = V>,
5206        V: std::convert::Into<crate::model::ReferenceImage>,
5207    {
5208        use std::iter::Iterator;
5209        self.reference_images = v.into_iter().map(|i| i.into()).collect();
5210        self
5211    }
5212
5213    /// Sets the value of [page_size][crate::model::ListReferenceImagesResponse::page_size].
5214    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5215        self.page_size = v.into();
5216        self
5217    }
5218
5219    /// Sets the value of [next_page_token][crate::model::ListReferenceImagesResponse::next_page_token].
5220    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5221        self.next_page_token = v.into();
5222        self
5223    }
5224}
5225
5226impl wkt::message::Message for ListReferenceImagesResponse {
5227    fn typename() -> &'static str {
5228        "type.googleapis.com/google.cloud.vision.v1.ListReferenceImagesResponse"
5229    }
5230}
5231
5232#[doc(hidden)]
5233impl gax::paginator::internal::PageableResponse for ListReferenceImagesResponse {
5234    type PageItem = crate::model::ReferenceImage;
5235
5236    fn items(self) -> std::vec::Vec<Self::PageItem> {
5237        self.reference_images
5238    }
5239
5240    fn next_page_token(&self) -> std::string::String {
5241        use std::clone::Clone;
5242        self.next_page_token.clone()
5243    }
5244}
5245
5246/// Request message for the `GetReferenceImage` method.
5247#[derive(Clone, Default, PartialEq)]
5248#[non_exhaustive]
5249pub struct GetReferenceImageRequest {
5250    /// Required. The resource name of the ReferenceImage to get.
5251    ///
5252    /// Format is:
5253    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`.
5254    pub name: std::string::String,
5255
5256    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5257}
5258
5259impl GetReferenceImageRequest {
5260    pub fn new() -> Self {
5261        std::default::Default::default()
5262    }
5263
5264    /// Sets the value of [name][crate::model::GetReferenceImageRequest::name].
5265    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5266        self.name = v.into();
5267        self
5268    }
5269}
5270
5271impl wkt::message::Message for GetReferenceImageRequest {
5272    fn typename() -> &'static str {
5273        "type.googleapis.com/google.cloud.vision.v1.GetReferenceImageRequest"
5274    }
5275}
5276
5277/// Request message for the `DeleteReferenceImage` method.
5278#[derive(Clone, Default, PartialEq)]
5279#[non_exhaustive]
5280pub struct DeleteReferenceImageRequest {
5281    /// Required. The resource name of the reference image to delete.
5282    ///
5283    /// Format is:
5284    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`
5285    pub name: std::string::String,
5286
5287    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5288}
5289
5290impl DeleteReferenceImageRequest {
5291    pub fn new() -> Self {
5292        std::default::Default::default()
5293    }
5294
5295    /// Sets the value of [name][crate::model::DeleteReferenceImageRequest::name].
5296    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5297        self.name = v.into();
5298        self
5299    }
5300}
5301
5302impl wkt::message::Message for DeleteReferenceImageRequest {
5303    fn typename() -> &'static str {
5304        "type.googleapis.com/google.cloud.vision.v1.DeleteReferenceImageRequest"
5305    }
5306}
5307
5308/// Request message for the `AddProductToProductSet` method.
5309#[derive(Clone, Default, PartialEq)]
5310#[non_exhaustive]
5311pub struct AddProductToProductSetRequest {
5312    /// Required. The resource name for the ProductSet to modify.
5313    ///
5314    /// Format is:
5315    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
5316    pub name: std::string::String,
5317
5318    /// Required. The resource name for the Product to be added to this ProductSet.
5319    ///
5320    /// Format is:
5321    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
5322    pub product: std::string::String,
5323
5324    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5325}
5326
5327impl AddProductToProductSetRequest {
5328    pub fn new() -> Self {
5329        std::default::Default::default()
5330    }
5331
5332    /// Sets the value of [name][crate::model::AddProductToProductSetRequest::name].
5333    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5334        self.name = v.into();
5335        self
5336    }
5337
5338    /// Sets the value of [product][crate::model::AddProductToProductSetRequest::product].
5339    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5340        self.product = v.into();
5341        self
5342    }
5343}
5344
5345impl wkt::message::Message for AddProductToProductSetRequest {
5346    fn typename() -> &'static str {
5347        "type.googleapis.com/google.cloud.vision.v1.AddProductToProductSetRequest"
5348    }
5349}
5350
5351/// Request message for the `RemoveProductFromProductSet` method.
5352#[derive(Clone, Default, PartialEq)]
5353#[non_exhaustive]
5354pub struct RemoveProductFromProductSetRequest {
5355    /// Required. The resource name for the ProductSet to modify.
5356    ///
5357    /// Format is:
5358    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
5359    pub name: std::string::String,
5360
5361    /// Required. The resource name for the Product to be removed from this
5362    /// ProductSet.
5363    ///
5364    /// Format is:
5365    /// `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`
5366    pub product: std::string::String,
5367
5368    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5369}
5370
5371impl RemoveProductFromProductSetRequest {
5372    pub fn new() -> Self {
5373        std::default::Default::default()
5374    }
5375
5376    /// Sets the value of [name][crate::model::RemoveProductFromProductSetRequest::name].
5377    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5378        self.name = v.into();
5379        self
5380    }
5381
5382    /// Sets the value of [product][crate::model::RemoveProductFromProductSetRequest::product].
5383    pub fn set_product<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5384        self.product = v.into();
5385        self
5386    }
5387}
5388
5389impl wkt::message::Message for RemoveProductFromProductSetRequest {
5390    fn typename() -> &'static str {
5391        "type.googleapis.com/google.cloud.vision.v1.RemoveProductFromProductSetRequest"
5392    }
5393}
5394
5395/// Request message for the `ListProductsInProductSet` method.
5396#[derive(Clone, Default, PartialEq)]
5397#[non_exhaustive]
5398pub struct ListProductsInProductSetRequest {
5399    /// Required. The ProductSet resource for which to retrieve Products.
5400    ///
5401    /// Format is:
5402    /// `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`
5403    pub name: std::string::String,
5404
5405    /// The maximum number of items to return. Default 10, maximum 100.
5406    pub page_size: i32,
5407
5408    /// The next_page_token returned from a previous List request, if any.
5409    pub page_token: std::string::String,
5410
5411    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5412}
5413
5414impl ListProductsInProductSetRequest {
5415    pub fn new() -> Self {
5416        std::default::Default::default()
5417    }
5418
5419    /// Sets the value of [name][crate::model::ListProductsInProductSetRequest::name].
5420    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5421        self.name = v.into();
5422        self
5423    }
5424
5425    /// Sets the value of [page_size][crate::model::ListProductsInProductSetRequest::page_size].
5426    pub fn set_page_size<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
5427        self.page_size = v.into();
5428        self
5429    }
5430
5431    /// Sets the value of [page_token][crate::model::ListProductsInProductSetRequest::page_token].
5432    pub fn set_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5433        self.page_token = v.into();
5434        self
5435    }
5436}
5437
5438impl wkt::message::Message for ListProductsInProductSetRequest {
5439    fn typename() -> &'static str {
5440        "type.googleapis.com/google.cloud.vision.v1.ListProductsInProductSetRequest"
5441    }
5442}
5443
5444/// Response message for the `ListProductsInProductSet` method.
5445#[derive(Clone, Default, PartialEq)]
5446#[non_exhaustive]
5447pub struct ListProductsInProductSetResponse {
5448    /// The list of Products.
5449    pub products: std::vec::Vec<crate::model::Product>,
5450
5451    /// Token to retrieve the next page of results, or empty if there are no more
5452    /// results in the list.
5453    pub next_page_token: std::string::String,
5454
5455    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5456}
5457
5458impl ListProductsInProductSetResponse {
5459    pub fn new() -> Self {
5460        std::default::Default::default()
5461    }
5462
5463    /// Sets the value of [products][crate::model::ListProductsInProductSetResponse::products].
5464    pub fn set_products<T, V>(mut self, v: T) -> Self
5465    where
5466        T: std::iter::IntoIterator<Item = V>,
5467        V: std::convert::Into<crate::model::Product>,
5468    {
5469        use std::iter::Iterator;
5470        self.products = v.into_iter().map(|i| i.into()).collect();
5471        self
5472    }
5473
5474    /// Sets the value of [next_page_token][crate::model::ListProductsInProductSetResponse::next_page_token].
5475    pub fn set_next_page_token<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5476        self.next_page_token = v.into();
5477        self
5478    }
5479}
5480
5481impl wkt::message::Message for ListProductsInProductSetResponse {
5482    fn typename() -> &'static str {
5483        "type.googleapis.com/google.cloud.vision.v1.ListProductsInProductSetResponse"
5484    }
5485}
5486
5487#[doc(hidden)]
5488impl gax::paginator::internal::PageableResponse for ListProductsInProductSetResponse {
5489    type PageItem = crate::model::Product;
5490
5491    fn items(self) -> std::vec::Vec<Self::PageItem> {
5492        self.products
5493    }
5494
5495    fn next_page_token(&self) -> std::string::String {
5496        use std::clone::Clone;
5497        self.next_page_token.clone()
5498    }
5499}
5500
5501/// The Google Cloud Storage location for a csv file which preserves a list of
5502/// ImportProductSetRequests in each line.
5503#[derive(Clone, Default, PartialEq)]
5504#[non_exhaustive]
5505pub struct ImportProductSetsGcsSource {
5506    /// The Google Cloud Storage URI of the input csv file.
5507    ///
5508    /// The URI must start with `gs://`.
5509    ///
5510    /// The format of the input csv file should be one image per line.
5511    /// In each line, there are 8 columns.
5512    ///
5513    /// 1. image-uri
5514    /// 1. image-id
5515    /// 1. product-set-id
5516    /// 1. product-id
5517    /// 1. product-category
5518    /// 1. product-display-name
5519    /// 1. labels
5520    /// 1. bounding-poly
5521    ///
5522    /// The `image-uri`, `product-set-id`, `product-id`, and `product-category`
5523    /// columns are required. All other columns are optional.
5524    ///
5525    /// If the `ProductSet` or `Product` specified by the `product-set-id` and
5526    /// `product-id` values does not exist, then the system will create a new
5527    /// `ProductSet` or `Product` for the image. In this case, the
5528    /// `product-display-name` column refers to
5529    /// [display_name][google.cloud.vision.v1.Product.display_name], the
5530    /// `product-category` column refers to
5531    /// [product_category][google.cloud.vision.v1.Product.product_category], and
5532    /// the `labels` column refers to
5533    /// [product_labels][google.cloud.vision.v1.Product.product_labels].
5534    ///
5535    /// The `image-id` column is optional but must be unique if provided. If it is
5536    /// empty, the system will automatically assign a unique id to the image.
5537    ///
5538    /// The `product-display-name` column is optional. If it is empty, the system
5539    /// sets the [display_name][google.cloud.vision.v1.Product.display_name] field
5540    /// for the product to a space (" "). You can update the `display_name` later
5541    /// by using the API.
5542    ///
5543    /// If a `Product` with the specified `product-id` already exists, then the
5544    /// system ignores the `product-display-name`, `product-category`, and `labels`
5545    /// columns.
5546    ///
5547    /// The `labels` column (optional) is a line containing a list of
5548    /// comma-separated key-value pairs, in the following format:
5549    ///
5550    /// ```norust
5551    /// "key_1=value_1,key_2=value_2,...,key_n=value_n"
5552    /// ```
5553    ///
5554    /// The `bounding-poly` column (optional) identifies one region of
5555    /// interest from the image in the same manner as `CreateReferenceImage`. If
5556    /// you do not specify the `bounding-poly` column, then the system will try to
5557    /// detect regions of interest automatically.
5558    ///
5559    /// At most one `bounding-poly` column is allowed per line. If the image
5560    /// contains multiple regions of interest, add a line to the CSV file that
5561    /// includes the same product information, and the `bounding-poly` values for
5562    /// each region of interest.
5563    ///
5564    /// The `bounding-poly` column must contain an even number of comma-separated
5565    /// numbers, in the format "p1_x,p1_y,p2_x,p2_y,...,pn_x,pn_y". Use
5566    /// non-negative integers for absolute bounding polygons, and float values
5567    /// in [0, 1] for normalized bounding polygons.
5568    ///
5569    /// The system will resize the image if the image resolution is too
5570    /// large to process (larger than 20MP).
5571    ///
5572    /// [google.cloud.vision.v1.Product.display_name]: crate::model::Product::display_name
5573    /// [google.cloud.vision.v1.Product.product_category]: crate::model::Product::product_category
5574    /// [google.cloud.vision.v1.Product.product_labels]: crate::model::Product::product_labels
5575    pub csv_file_uri: std::string::String,
5576
5577    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5578}
5579
5580impl ImportProductSetsGcsSource {
5581    pub fn new() -> Self {
5582        std::default::Default::default()
5583    }
5584
5585    /// Sets the value of [csv_file_uri][crate::model::ImportProductSetsGcsSource::csv_file_uri].
5586    pub fn set_csv_file_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5587        self.csv_file_uri = v.into();
5588        self
5589    }
5590}
5591
5592impl wkt::message::Message for ImportProductSetsGcsSource {
5593    fn typename() -> &'static str {
5594        "type.googleapis.com/google.cloud.vision.v1.ImportProductSetsGcsSource"
5595    }
5596}
5597
5598/// The input content for the `ImportProductSets` method.
5599#[derive(Clone, Default, PartialEq)]
5600#[non_exhaustive]
5601pub struct ImportProductSetsInputConfig {
5602    /// The source of the input.
5603    pub source: std::option::Option<crate::model::import_product_sets_input_config::Source>,
5604
5605    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5606}
5607
5608impl ImportProductSetsInputConfig {
5609    pub fn new() -> Self {
5610        std::default::Default::default()
5611    }
5612
5613    /// Sets the value of [source][crate::model::ImportProductSetsInputConfig::source].
5614    ///
5615    /// Note that all the setters affecting `source` are mutually
5616    /// exclusive.
5617    pub fn set_source<
5618        T: std::convert::Into<
5619                std::option::Option<crate::model::import_product_sets_input_config::Source>,
5620            >,
5621    >(
5622        mut self,
5623        v: T,
5624    ) -> Self {
5625        self.source = v.into();
5626        self
5627    }
5628
5629    /// The value of [source][crate::model::ImportProductSetsInputConfig::source]
5630    /// if it holds a `GcsSource`, `None` if the field is not set or
5631    /// holds a different branch.
5632    pub fn gcs_source(
5633        &self,
5634    ) -> std::option::Option<&std::boxed::Box<crate::model::ImportProductSetsGcsSource>> {
5635        #[allow(unreachable_patterns)]
5636        self.source.as_ref().and_then(|v| match v {
5637            crate::model::import_product_sets_input_config::Source::GcsSource(v) => {
5638                std::option::Option::Some(v)
5639            }
5640            _ => std::option::Option::None,
5641        })
5642    }
5643
5644    /// Sets the value of [source][crate::model::ImportProductSetsInputConfig::source]
5645    /// to hold a `GcsSource`.
5646    ///
5647    /// Note that all the setters affecting `source` are
5648    /// mutually exclusive.
5649    pub fn set_gcs_source<
5650        T: std::convert::Into<std::boxed::Box<crate::model::ImportProductSetsGcsSource>>,
5651    >(
5652        mut self,
5653        v: T,
5654    ) -> Self {
5655        self.source = std::option::Option::Some(
5656            crate::model::import_product_sets_input_config::Source::GcsSource(v.into()),
5657        );
5658        self
5659    }
5660}
5661
5662impl wkt::message::Message for ImportProductSetsInputConfig {
5663    fn typename() -> &'static str {
5664        "type.googleapis.com/google.cloud.vision.v1.ImportProductSetsInputConfig"
5665    }
5666}
5667
5668/// Defines additional types related to [ImportProductSetsInputConfig].
5669pub mod import_product_sets_input_config {
5670    #[allow(unused_imports)]
5671    use super::*;
5672
5673    /// The source of the input.
5674    #[derive(Clone, Debug, PartialEq)]
5675    #[non_exhaustive]
5676    pub enum Source {
5677        /// The Google Cloud Storage location for a csv file which preserves a list
5678        /// of ImportProductSetRequests in each line.
5679        GcsSource(std::boxed::Box<crate::model::ImportProductSetsGcsSource>),
5680    }
5681}
5682
5683/// Request message for the `ImportProductSets` method.
5684#[derive(Clone, Default, PartialEq)]
5685#[non_exhaustive]
5686pub struct ImportProductSetsRequest {
5687    /// Required. The project in which the ProductSets should be imported.
5688    ///
5689    /// Format is `projects/PROJECT_ID/locations/LOC_ID`.
5690    pub parent: std::string::String,
5691
5692    /// Required. The input content for the list of requests.
5693    pub input_config: std::option::Option<crate::model::ImportProductSetsInputConfig>,
5694
5695    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5696}
5697
5698impl ImportProductSetsRequest {
5699    pub fn new() -> Self {
5700        std::default::Default::default()
5701    }
5702
5703    /// Sets the value of [parent][crate::model::ImportProductSetsRequest::parent].
5704    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
5705        self.parent = v.into();
5706        self
5707    }
5708
5709    /// Sets the value of [input_config][crate::model::ImportProductSetsRequest::input_config].
5710    pub fn set_input_config<T>(mut self, v: T) -> Self
5711    where
5712        T: std::convert::Into<crate::model::ImportProductSetsInputConfig>,
5713    {
5714        self.input_config = std::option::Option::Some(v.into());
5715        self
5716    }
5717
5718    /// Sets or clears the value of [input_config][crate::model::ImportProductSetsRequest::input_config].
5719    pub fn set_or_clear_input_config<T>(mut self, v: std::option::Option<T>) -> Self
5720    where
5721        T: std::convert::Into<crate::model::ImportProductSetsInputConfig>,
5722    {
5723        self.input_config = v.map(|x| x.into());
5724        self
5725    }
5726}
5727
5728impl wkt::message::Message for ImportProductSetsRequest {
5729    fn typename() -> &'static str {
5730        "type.googleapis.com/google.cloud.vision.v1.ImportProductSetsRequest"
5731    }
5732}
5733
5734/// Response message for the `ImportProductSets` method.
5735///
5736/// This message is returned by the
5737/// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation]
5738/// method in the returned
5739/// [google.longrunning.Operation.response][google.longrunning.Operation.response]
5740/// field.
5741///
5742/// [google.longrunning.Operation.response]: longrunning::model::Operation::result
5743#[derive(Clone, Default, PartialEq)]
5744#[non_exhaustive]
5745pub struct ImportProductSetsResponse {
5746    /// The list of reference_images that are imported successfully.
5747    pub reference_images: std::vec::Vec<crate::model::ReferenceImage>,
5748
5749    /// The rpc status for each ImportProductSet request, including both successes
5750    /// and errors.
5751    ///
5752    /// The number of statuses here matches the number of lines in the csv file,
5753    /// and statuses[i] stores the success or failure status of processing the i-th
5754    /// line of the csv, starting from line 0.
5755    pub statuses: std::vec::Vec<rpc::model::Status>,
5756
5757    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5758}
5759
5760impl ImportProductSetsResponse {
5761    pub fn new() -> Self {
5762        std::default::Default::default()
5763    }
5764
5765    /// Sets the value of [reference_images][crate::model::ImportProductSetsResponse::reference_images].
5766    pub fn set_reference_images<T, V>(mut self, v: T) -> Self
5767    where
5768        T: std::iter::IntoIterator<Item = V>,
5769        V: std::convert::Into<crate::model::ReferenceImage>,
5770    {
5771        use std::iter::Iterator;
5772        self.reference_images = v.into_iter().map(|i| i.into()).collect();
5773        self
5774    }
5775
5776    /// Sets the value of [statuses][crate::model::ImportProductSetsResponse::statuses].
5777    pub fn set_statuses<T, V>(mut self, v: T) -> Self
5778    where
5779        T: std::iter::IntoIterator<Item = V>,
5780        V: std::convert::Into<rpc::model::Status>,
5781    {
5782        use std::iter::Iterator;
5783        self.statuses = v.into_iter().map(|i| i.into()).collect();
5784        self
5785    }
5786}
5787
5788impl wkt::message::Message for ImportProductSetsResponse {
5789    fn typename() -> &'static str {
5790        "type.googleapis.com/google.cloud.vision.v1.ImportProductSetsResponse"
5791    }
5792}
5793
5794/// Metadata for the batch operations such as the current state.
5795///
5796/// This is included in the `metadata` field of the `Operation` returned by the
5797/// `GetOperation` call of the `google::longrunning::Operations` service.
5798#[derive(Clone, Default, PartialEq)]
5799#[non_exhaustive]
5800pub struct BatchOperationMetadata {
5801    /// The current state of the batch operation.
5802    pub state: crate::model::batch_operation_metadata::State,
5803
5804    /// The time when the batch request was submitted to the server.
5805    pub submit_time: std::option::Option<wkt::Timestamp>,
5806
5807    /// The time when the batch request is finished and
5808    /// [google.longrunning.Operation.done][google.longrunning.Operation.done] is
5809    /// set to true.
5810    ///
5811    /// [google.longrunning.Operation.done]: longrunning::model::Operation::done
5812    pub end_time: std::option::Option<wkt::Timestamp>,
5813
5814    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
5815}
5816
5817impl BatchOperationMetadata {
5818    pub fn new() -> Self {
5819        std::default::Default::default()
5820    }
5821
5822    /// Sets the value of [state][crate::model::BatchOperationMetadata::state].
5823    pub fn set_state<T: std::convert::Into<crate::model::batch_operation_metadata::State>>(
5824        mut self,
5825        v: T,
5826    ) -> Self {
5827        self.state = v.into();
5828        self
5829    }
5830
5831    /// Sets the value of [submit_time][crate::model::BatchOperationMetadata::submit_time].
5832    pub fn set_submit_time<T>(mut self, v: T) -> Self
5833    where
5834        T: std::convert::Into<wkt::Timestamp>,
5835    {
5836        self.submit_time = std::option::Option::Some(v.into());
5837        self
5838    }
5839
5840    /// Sets or clears the value of [submit_time][crate::model::BatchOperationMetadata::submit_time].
5841    pub fn set_or_clear_submit_time<T>(mut self, v: std::option::Option<T>) -> Self
5842    where
5843        T: std::convert::Into<wkt::Timestamp>,
5844    {
5845        self.submit_time = v.map(|x| x.into());
5846        self
5847    }
5848
5849    /// Sets the value of [end_time][crate::model::BatchOperationMetadata::end_time].
5850    pub fn set_end_time<T>(mut self, v: T) -> Self
5851    where
5852        T: std::convert::Into<wkt::Timestamp>,
5853    {
5854        self.end_time = std::option::Option::Some(v.into());
5855        self
5856    }
5857
5858    /// Sets or clears the value of [end_time][crate::model::BatchOperationMetadata::end_time].
5859    pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
5860    where
5861        T: std::convert::Into<wkt::Timestamp>,
5862    {
5863        self.end_time = v.map(|x| x.into());
5864        self
5865    }
5866}
5867
5868impl wkt::message::Message for BatchOperationMetadata {
5869    fn typename() -> &'static str {
5870        "type.googleapis.com/google.cloud.vision.v1.BatchOperationMetadata"
5871    }
5872}
5873
5874/// Defines additional types related to [BatchOperationMetadata].
5875pub mod batch_operation_metadata {
5876    #[allow(unused_imports)]
5877    use super::*;
5878
5879    /// Enumerates the possible states that the batch request can be in.
5880    ///
5881    /// # Working with unknown values
5882    ///
5883    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
5884    /// additional enum variants at any time. Adding new variants is not considered
5885    /// a breaking change. Applications should write their code in anticipation of:
5886    ///
5887    /// - New values appearing in future releases of the client library, **and**
5888    /// - New values received dynamically, without application changes.
5889    ///
5890    /// Please consult the [Working with enums] section in the user guide for some
5891    /// guidelines.
5892    ///
5893    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
5894    #[derive(Clone, Debug, PartialEq)]
5895    #[non_exhaustive]
5896    pub enum State {
5897        /// Invalid.
5898        Unspecified,
5899        /// Request is actively being processed.
5900        Processing,
5901        /// The request is done and at least one item has been successfully
5902        /// processed.
5903        Successful,
5904        /// The request is done and no item has been successfully processed.
5905        Failed,
5906        /// The request is done after the longrunning.Operations.CancelOperation has
5907        /// been called by the user.  Any records that were processed before the
5908        /// cancel command are output as specified in the request.
5909        Cancelled,
5910        /// If set, the enum was initialized with an unknown value.
5911        ///
5912        /// Applications can examine the value using [State::value] or
5913        /// [State::name].
5914        UnknownValue(state::UnknownValue),
5915    }
5916
5917    #[doc(hidden)]
5918    pub mod state {
5919        #[allow(unused_imports)]
5920        use super::*;
5921        #[derive(Clone, Debug, PartialEq)]
5922        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
5923    }
5924
5925    impl State {
5926        /// Gets the enum value.
5927        ///
5928        /// Returns `None` if the enum contains an unknown value deserialized from
5929        /// the string representation of enums.
5930        pub fn value(&self) -> std::option::Option<i32> {
5931            match self {
5932                Self::Unspecified => std::option::Option::Some(0),
5933                Self::Processing => std::option::Option::Some(1),
5934                Self::Successful => std::option::Option::Some(2),
5935                Self::Failed => std::option::Option::Some(3),
5936                Self::Cancelled => std::option::Option::Some(4),
5937                Self::UnknownValue(u) => u.0.value(),
5938            }
5939        }
5940
5941        /// Gets the enum value as a string.
5942        ///
5943        /// Returns `None` if the enum contains an unknown value deserialized from
5944        /// the integer representation of enums.
5945        pub fn name(&self) -> std::option::Option<&str> {
5946            match self {
5947                Self::Unspecified => std::option::Option::Some("STATE_UNSPECIFIED"),
5948                Self::Processing => std::option::Option::Some("PROCESSING"),
5949                Self::Successful => std::option::Option::Some("SUCCESSFUL"),
5950                Self::Failed => std::option::Option::Some("FAILED"),
5951                Self::Cancelled => std::option::Option::Some("CANCELLED"),
5952                Self::UnknownValue(u) => u.0.name(),
5953            }
5954        }
5955    }
5956
5957    impl std::default::Default for State {
5958        fn default() -> Self {
5959            use std::convert::From;
5960            Self::from(0)
5961        }
5962    }
5963
5964    impl std::fmt::Display for State {
5965        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
5966            wkt::internal::display_enum(f, self.name(), self.value())
5967        }
5968    }
5969
5970    impl std::convert::From<i32> for State {
5971        fn from(value: i32) -> Self {
5972            match value {
5973                0 => Self::Unspecified,
5974                1 => Self::Processing,
5975                2 => Self::Successful,
5976                3 => Self::Failed,
5977                4 => Self::Cancelled,
5978                _ => Self::UnknownValue(state::UnknownValue(
5979                    wkt::internal::UnknownEnumValue::Integer(value),
5980                )),
5981            }
5982        }
5983    }
5984
5985    impl std::convert::From<&str> for State {
5986        fn from(value: &str) -> Self {
5987            use std::string::ToString;
5988            match value {
5989                "STATE_UNSPECIFIED" => Self::Unspecified,
5990                "PROCESSING" => Self::Processing,
5991                "SUCCESSFUL" => Self::Successful,
5992                "FAILED" => Self::Failed,
5993                "CANCELLED" => Self::Cancelled,
5994                _ => Self::UnknownValue(state::UnknownValue(
5995                    wkt::internal::UnknownEnumValue::String(value.to_string()),
5996                )),
5997            }
5998        }
5999    }
6000
6001    impl serde::ser::Serialize for State {
6002        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6003        where
6004            S: serde::Serializer,
6005        {
6006            match self {
6007                Self::Unspecified => serializer.serialize_i32(0),
6008                Self::Processing => serializer.serialize_i32(1),
6009                Self::Successful => serializer.serialize_i32(2),
6010                Self::Failed => serializer.serialize_i32(3),
6011                Self::Cancelled => serializer.serialize_i32(4),
6012                Self::UnknownValue(u) => u.0.serialize(serializer),
6013            }
6014        }
6015    }
6016
6017    impl<'de> serde::de::Deserialize<'de> for State {
6018        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6019        where
6020            D: serde::Deserializer<'de>,
6021        {
6022            deserializer.deserialize_any(wkt::internal::EnumVisitor::<State>::new(
6023                ".google.cloud.vision.v1.BatchOperationMetadata.State",
6024            ))
6025        }
6026    }
6027}
6028
6029/// Config to control which ProductSet contains the Products to be deleted.
6030#[derive(Clone, Default, PartialEq)]
6031#[non_exhaustive]
6032pub struct ProductSetPurgeConfig {
6033    /// The ProductSet that contains the Products to delete. If a Product is a
6034    /// member of product_set_id in addition to other ProductSets, the Product will
6035    /// still be deleted.
6036    pub product_set_id: std::string::String,
6037
6038    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6039}
6040
6041impl ProductSetPurgeConfig {
6042    pub fn new() -> Self {
6043        std::default::Default::default()
6044    }
6045
6046    /// Sets the value of [product_set_id][crate::model::ProductSetPurgeConfig::product_set_id].
6047    pub fn set_product_set_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6048        self.product_set_id = v.into();
6049        self
6050    }
6051}
6052
6053impl wkt::message::Message for ProductSetPurgeConfig {
6054    fn typename() -> &'static str {
6055        "type.googleapis.com/google.cloud.vision.v1.ProductSetPurgeConfig"
6056    }
6057}
6058
6059/// Request message for the `PurgeProducts` method.
6060#[derive(Clone, Default, PartialEq)]
6061#[non_exhaustive]
6062pub struct PurgeProductsRequest {
6063    /// Required. The project and location in which the Products should be deleted.
6064    ///
6065    /// Format is `projects/PROJECT_ID/locations/LOC_ID`.
6066    pub parent: std::string::String,
6067
6068    /// The default value is false. Override this value to true to actually perform
6069    /// the purge.
6070    pub force: bool,
6071
6072    /// The Products to delete.
6073    pub target: std::option::Option<crate::model::purge_products_request::Target>,
6074
6075    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6076}
6077
6078impl PurgeProductsRequest {
6079    pub fn new() -> Self {
6080        std::default::Default::default()
6081    }
6082
6083    /// Sets the value of [parent][crate::model::PurgeProductsRequest::parent].
6084    pub fn set_parent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6085        self.parent = v.into();
6086        self
6087    }
6088
6089    /// Sets the value of [force][crate::model::PurgeProductsRequest::force].
6090    pub fn set_force<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6091        self.force = v.into();
6092        self
6093    }
6094
6095    /// Sets the value of [target][crate::model::PurgeProductsRequest::target].
6096    ///
6097    /// Note that all the setters affecting `target` are mutually
6098    /// exclusive.
6099    pub fn set_target<
6100        T: std::convert::Into<std::option::Option<crate::model::purge_products_request::Target>>,
6101    >(
6102        mut self,
6103        v: T,
6104    ) -> Self {
6105        self.target = v.into();
6106        self
6107    }
6108
6109    /// The value of [target][crate::model::PurgeProductsRequest::target]
6110    /// if it holds a `ProductSetPurgeConfig`, `None` if the field is not set or
6111    /// holds a different branch.
6112    pub fn product_set_purge_config(
6113        &self,
6114    ) -> std::option::Option<&std::boxed::Box<crate::model::ProductSetPurgeConfig>> {
6115        #[allow(unreachable_patterns)]
6116        self.target.as_ref().and_then(|v| match v {
6117            crate::model::purge_products_request::Target::ProductSetPurgeConfig(v) => {
6118                std::option::Option::Some(v)
6119            }
6120            _ => std::option::Option::None,
6121        })
6122    }
6123
6124    /// Sets the value of [target][crate::model::PurgeProductsRequest::target]
6125    /// to hold a `ProductSetPurgeConfig`.
6126    ///
6127    /// Note that all the setters affecting `target` are
6128    /// mutually exclusive.
6129    pub fn set_product_set_purge_config<
6130        T: std::convert::Into<std::boxed::Box<crate::model::ProductSetPurgeConfig>>,
6131    >(
6132        mut self,
6133        v: T,
6134    ) -> Self {
6135        self.target = std::option::Option::Some(
6136            crate::model::purge_products_request::Target::ProductSetPurgeConfig(v.into()),
6137        );
6138        self
6139    }
6140
6141    /// The value of [target][crate::model::PurgeProductsRequest::target]
6142    /// if it holds a `DeleteOrphanProducts`, `None` if the field is not set or
6143    /// holds a different branch.
6144    pub fn delete_orphan_products(&self) -> std::option::Option<&bool> {
6145        #[allow(unreachable_patterns)]
6146        self.target.as_ref().and_then(|v| match v {
6147            crate::model::purge_products_request::Target::DeleteOrphanProducts(v) => {
6148                std::option::Option::Some(v)
6149            }
6150            _ => std::option::Option::None,
6151        })
6152    }
6153
6154    /// Sets the value of [target][crate::model::PurgeProductsRequest::target]
6155    /// to hold a `DeleteOrphanProducts`.
6156    ///
6157    /// Note that all the setters affecting `target` are
6158    /// mutually exclusive.
6159    pub fn set_delete_orphan_products<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6160        self.target = std::option::Option::Some(
6161            crate::model::purge_products_request::Target::DeleteOrphanProducts(v.into()),
6162        );
6163        self
6164    }
6165}
6166
6167impl wkt::message::Message for PurgeProductsRequest {
6168    fn typename() -> &'static str {
6169        "type.googleapis.com/google.cloud.vision.v1.PurgeProductsRequest"
6170    }
6171}
6172
6173/// Defines additional types related to [PurgeProductsRequest].
6174pub mod purge_products_request {
6175    #[allow(unused_imports)]
6176    use super::*;
6177
6178    /// The Products to delete.
6179    #[derive(Clone, Debug, PartialEq)]
6180    #[non_exhaustive]
6181    pub enum Target {
6182        /// Specify which ProductSet contains the Products to be deleted.
6183        ProductSetPurgeConfig(std::boxed::Box<crate::model::ProductSetPurgeConfig>),
6184        /// If delete_orphan_products is true, all Products that are not in any
6185        /// ProductSet will be deleted.
6186        DeleteOrphanProducts(bool),
6187    }
6188}
6189
6190/// TextAnnotation contains a structured representation of OCR extracted text.
6191/// The hierarchy of an OCR extracted text structure is like this:
6192/// TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol
6193/// Each structural component, starting from Page, may further have their own
6194/// properties. Properties describe detected languages, breaks etc.. Please refer
6195/// to the
6196/// [TextAnnotation.TextProperty][google.cloud.vision.v1.TextAnnotation.TextProperty]
6197/// message definition below for more detail.
6198///
6199/// [google.cloud.vision.v1.TextAnnotation.TextProperty]: crate::model::text_annotation::TextProperty
6200#[derive(Clone, Default, PartialEq)]
6201#[non_exhaustive]
6202pub struct TextAnnotation {
6203    /// List of pages detected by OCR.
6204    pub pages: std::vec::Vec<crate::model::Page>,
6205
6206    /// UTF-8 text detected on the pages.
6207    pub text: std::string::String,
6208
6209    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6210}
6211
6212impl TextAnnotation {
6213    pub fn new() -> Self {
6214        std::default::Default::default()
6215    }
6216
6217    /// Sets the value of [pages][crate::model::TextAnnotation::pages].
6218    pub fn set_pages<T, V>(mut self, v: T) -> Self
6219    where
6220        T: std::iter::IntoIterator<Item = V>,
6221        V: std::convert::Into<crate::model::Page>,
6222    {
6223        use std::iter::Iterator;
6224        self.pages = v.into_iter().map(|i| i.into()).collect();
6225        self
6226    }
6227
6228    /// Sets the value of [text][crate::model::TextAnnotation::text].
6229    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
6230        self.text = v.into();
6231        self
6232    }
6233}
6234
6235impl wkt::message::Message for TextAnnotation {
6236    fn typename() -> &'static str {
6237        "type.googleapis.com/google.cloud.vision.v1.TextAnnotation"
6238    }
6239}
6240
6241/// Defines additional types related to [TextAnnotation].
6242pub mod text_annotation {
6243    #[allow(unused_imports)]
6244    use super::*;
6245
6246    /// Detected language for a structural component.
6247    #[derive(Clone, Default, PartialEq)]
6248    #[non_exhaustive]
6249    pub struct DetectedLanguage {
6250        /// The BCP-47 language code, such as "en-US" or "sr-Latn". For more
6251        /// information, see
6252        /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier>.
6253        pub language_code: std::string::String,
6254
6255        /// Confidence of detected language. Range [0, 1].
6256        pub confidence: f32,
6257
6258        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6259    }
6260
6261    impl DetectedLanguage {
6262        pub fn new() -> Self {
6263            std::default::Default::default()
6264        }
6265
6266        /// Sets the value of [language_code][crate::model::text_annotation::DetectedLanguage::language_code].
6267        pub fn set_language_code<T: std::convert::Into<std::string::String>>(
6268            mut self,
6269            v: T,
6270        ) -> Self {
6271            self.language_code = v.into();
6272            self
6273        }
6274
6275        /// Sets the value of [confidence][crate::model::text_annotation::DetectedLanguage::confidence].
6276        pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6277            self.confidence = v.into();
6278            self
6279        }
6280    }
6281
6282    impl wkt::message::Message for DetectedLanguage {
6283        fn typename() -> &'static str {
6284            "type.googleapis.com/google.cloud.vision.v1.TextAnnotation.DetectedLanguage"
6285        }
6286    }
6287
6288    /// Detected start or end of a structural component.
6289    #[derive(Clone, Default, PartialEq)]
6290    #[non_exhaustive]
6291    pub struct DetectedBreak {
6292        /// Detected break type.
6293        pub r#type: crate::model::text_annotation::detected_break::BreakType,
6294
6295        /// True if break prepends the element.
6296        pub is_prefix: bool,
6297
6298        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6299    }
6300
6301    impl DetectedBreak {
6302        pub fn new() -> Self {
6303            std::default::Default::default()
6304        }
6305
6306        /// Sets the value of [r#type][crate::model::text_annotation::DetectedBreak::type].
6307        pub fn set_type<
6308            T: std::convert::Into<crate::model::text_annotation::detected_break::BreakType>,
6309        >(
6310            mut self,
6311            v: T,
6312        ) -> Self {
6313            self.r#type = v.into();
6314            self
6315        }
6316
6317        /// Sets the value of [is_prefix][crate::model::text_annotation::DetectedBreak::is_prefix].
6318        pub fn set_is_prefix<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
6319            self.is_prefix = v.into();
6320            self
6321        }
6322    }
6323
6324    impl wkt::message::Message for DetectedBreak {
6325        fn typename() -> &'static str {
6326            "type.googleapis.com/google.cloud.vision.v1.TextAnnotation.DetectedBreak"
6327        }
6328    }
6329
6330    /// Defines additional types related to [DetectedBreak].
6331    pub mod detected_break {
6332        #[allow(unused_imports)]
6333        use super::*;
6334
6335        /// Enum to denote the type of break found. New line, space etc.
6336        ///
6337        /// # Working with unknown values
6338        ///
6339        /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6340        /// additional enum variants at any time. Adding new variants is not considered
6341        /// a breaking change. Applications should write their code in anticipation of:
6342        ///
6343        /// - New values appearing in future releases of the client library, **and**
6344        /// - New values received dynamically, without application changes.
6345        ///
6346        /// Please consult the [Working with enums] section in the user guide for some
6347        /// guidelines.
6348        ///
6349        /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6350        #[derive(Clone, Debug, PartialEq)]
6351        #[non_exhaustive]
6352        pub enum BreakType {
6353            /// Unknown break label type.
6354            Unknown,
6355            /// Regular space.
6356            Space,
6357            /// Sure space (very wide).
6358            SureSpace,
6359            /// Line-wrapping break.
6360            EolSureSpace,
6361            /// End-line hyphen that is not present in text; does not co-occur with
6362            /// `SPACE`, `LEADER_SPACE`, or `LINE_BREAK`.
6363            Hyphen,
6364            /// Line break that ends a paragraph.
6365            LineBreak,
6366            /// If set, the enum was initialized with an unknown value.
6367            ///
6368            /// Applications can examine the value using [BreakType::value] or
6369            /// [BreakType::name].
6370            UnknownValue(break_type::UnknownValue),
6371        }
6372
6373        #[doc(hidden)]
6374        pub mod break_type {
6375            #[allow(unused_imports)]
6376            use super::*;
6377            #[derive(Clone, Debug, PartialEq)]
6378            pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6379        }
6380
6381        impl BreakType {
6382            /// Gets the enum value.
6383            ///
6384            /// Returns `None` if the enum contains an unknown value deserialized from
6385            /// the string representation of enums.
6386            pub fn value(&self) -> std::option::Option<i32> {
6387                match self {
6388                    Self::Unknown => std::option::Option::Some(0),
6389                    Self::Space => std::option::Option::Some(1),
6390                    Self::SureSpace => std::option::Option::Some(2),
6391                    Self::EolSureSpace => std::option::Option::Some(3),
6392                    Self::Hyphen => std::option::Option::Some(4),
6393                    Self::LineBreak => std::option::Option::Some(5),
6394                    Self::UnknownValue(u) => u.0.value(),
6395                }
6396            }
6397
6398            /// Gets the enum value as a string.
6399            ///
6400            /// Returns `None` if the enum contains an unknown value deserialized from
6401            /// the integer representation of enums.
6402            pub fn name(&self) -> std::option::Option<&str> {
6403                match self {
6404                    Self::Unknown => std::option::Option::Some("UNKNOWN"),
6405                    Self::Space => std::option::Option::Some("SPACE"),
6406                    Self::SureSpace => std::option::Option::Some("SURE_SPACE"),
6407                    Self::EolSureSpace => std::option::Option::Some("EOL_SURE_SPACE"),
6408                    Self::Hyphen => std::option::Option::Some("HYPHEN"),
6409                    Self::LineBreak => std::option::Option::Some("LINE_BREAK"),
6410                    Self::UnknownValue(u) => u.0.name(),
6411                }
6412            }
6413        }
6414
6415        impl std::default::Default for BreakType {
6416            fn default() -> Self {
6417                use std::convert::From;
6418                Self::from(0)
6419            }
6420        }
6421
6422        impl std::fmt::Display for BreakType {
6423            fn fmt(
6424                &self,
6425                f: &mut std::fmt::Formatter<'_>,
6426            ) -> std::result::Result<(), std::fmt::Error> {
6427                wkt::internal::display_enum(f, self.name(), self.value())
6428            }
6429        }
6430
6431        impl std::convert::From<i32> for BreakType {
6432            fn from(value: i32) -> Self {
6433                match value {
6434                    0 => Self::Unknown,
6435                    1 => Self::Space,
6436                    2 => Self::SureSpace,
6437                    3 => Self::EolSureSpace,
6438                    4 => Self::Hyphen,
6439                    5 => Self::LineBreak,
6440                    _ => Self::UnknownValue(break_type::UnknownValue(
6441                        wkt::internal::UnknownEnumValue::Integer(value),
6442                    )),
6443                }
6444            }
6445        }
6446
6447        impl std::convert::From<&str> for BreakType {
6448            fn from(value: &str) -> Self {
6449                use std::string::ToString;
6450                match value {
6451                    "UNKNOWN" => Self::Unknown,
6452                    "SPACE" => Self::Space,
6453                    "SURE_SPACE" => Self::SureSpace,
6454                    "EOL_SURE_SPACE" => Self::EolSureSpace,
6455                    "HYPHEN" => Self::Hyphen,
6456                    "LINE_BREAK" => Self::LineBreak,
6457                    _ => Self::UnknownValue(break_type::UnknownValue(
6458                        wkt::internal::UnknownEnumValue::String(value.to_string()),
6459                    )),
6460                }
6461            }
6462        }
6463
6464        impl serde::ser::Serialize for BreakType {
6465            fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6466            where
6467                S: serde::Serializer,
6468            {
6469                match self {
6470                    Self::Unknown => serializer.serialize_i32(0),
6471                    Self::Space => serializer.serialize_i32(1),
6472                    Self::SureSpace => serializer.serialize_i32(2),
6473                    Self::EolSureSpace => serializer.serialize_i32(3),
6474                    Self::Hyphen => serializer.serialize_i32(4),
6475                    Self::LineBreak => serializer.serialize_i32(5),
6476                    Self::UnknownValue(u) => u.0.serialize(serializer),
6477                }
6478            }
6479        }
6480
6481        impl<'de> serde::de::Deserialize<'de> for BreakType {
6482            fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6483            where
6484                D: serde::Deserializer<'de>,
6485            {
6486                deserializer.deserialize_any(wkt::internal::EnumVisitor::<BreakType>::new(
6487                    ".google.cloud.vision.v1.TextAnnotation.DetectedBreak.BreakType",
6488                ))
6489            }
6490        }
6491    }
6492
6493    /// Additional information detected on the structural component.
6494    #[derive(Clone, Default, PartialEq)]
6495    #[non_exhaustive]
6496    pub struct TextProperty {
6497        /// A list of detected languages together with confidence.
6498        pub detected_languages: std::vec::Vec<crate::model::text_annotation::DetectedLanguage>,
6499
6500        /// Detected start or end of a text segment.
6501        pub detected_break: std::option::Option<crate::model::text_annotation::DetectedBreak>,
6502
6503        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6504    }
6505
6506    impl TextProperty {
6507        pub fn new() -> Self {
6508            std::default::Default::default()
6509        }
6510
6511        /// Sets the value of [detected_languages][crate::model::text_annotation::TextProperty::detected_languages].
6512        pub fn set_detected_languages<T, V>(mut self, v: T) -> Self
6513        where
6514            T: std::iter::IntoIterator<Item = V>,
6515            V: std::convert::Into<crate::model::text_annotation::DetectedLanguage>,
6516        {
6517            use std::iter::Iterator;
6518            self.detected_languages = v.into_iter().map(|i| i.into()).collect();
6519            self
6520        }
6521
6522        /// Sets the value of [detected_break][crate::model::text_annotation::TextProperty::detected_break].
6523        pub fn set_detected_break<T>(mut self, v: T) -> Self
6524        where
6525            T: std::convert::Into<crate::model::text_annotation::DetectedBreak>,
6526        {
6527            self.detected_break = std::option::Option::Some(v.into());
6528            self
6529        }
6530
6531        /// Sets or clears the value of [detected_break][crate::model::text_annotation::TextProperty::detected_break].
6532        pub fn set_or_clear_detected_break<T>(mut self, v: std::option::Option<T>) -> Self
6533        where
6534            T: std::convert::Into<crate::model::text_annotation::DetectedBreak>,
6535        {
6536            self.detected_break = v.map(|x| x.into());
6537            self
6538        }
6539    }
6540
6541    impl wkt::message::Message for TextProperty {
6542        fn typename() -> &'static str {
6543            "type.googleapis.com/google.cloud.vision.v1.TextAnnotation.TextProperty"
6544        }
6545    }
6546}
6547
6548/// Detected page from OCR.
6549#[derive(Clone, Default, PartialEq)]
6550#[non_exhaustive]
6551pub struct Page {
6552    /// Additional information detected on the page.
6553    pub property: std::option::Option<crate::model::text_annotation::TextProperty>,
6554
6555    /// Page width. For PDFs the unit is points. For images (including
6556    /// TIFFs) the unit is pixels.
6557    pub width: i32,
6558
6559    /// Page height. For PDFs the unit is points. For images (including
6560    /// TIFFs) the unit is pixels.
6561    pub height: i32,
6562
6563    /// List of blocks of text, images etc on this page.
6564    pub blocks: std::vec::Vec<crate::model::Block>,
6565
6566    /// Confidence of the OCR results on the page. Range [0, 1].
6567    pub confidence: f32,
6568
6569    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6570}
6571
6572impl Page {
6573    pub fn new() -> Self {
6574        std::default::Default::default()
6575    }
6576
6577    /// Sets the value of [property][crate::model::Page::property].
6578    pub fn set_property<T>(mut self, v: T) -> Self
6579    where
6580        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
6581    {
6582        self.property = std::option::Option::Some(v.into());
6583        self
6584    }
6585
6586    /// Sets or clears the value of [property][crate::model::Page::property].
6587    pub fn set_or_clear_property<T>(mut self, v: std::option::Option<T>) -> Self
6588    where
6589        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
6590    {
6591        self.property = v.map(|x| x.into());
6592        self
6593    }
6594
6595    /// Sets the value of [width][crate::model::Page::width].
6596    pub fn set_width<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6597        self.width = v.into();
6598        self
6599    }
6600
6601    /// Sets the value of [height][crate::model::Page::height].
6602    pub fn set_height<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
6603        self.height = v.into();
6604        self
6605    }
6606
6607    /// Sets the value of [blocks][crate::model::Page::blocks].
6608    pub fn set_blocks<T, V>(mut self, v: T) -> Self
6609    where
6610        T: std::iter::IntoIterator<Item = V>,
6611        V: std::convert::Into<crate::model::Block>,
6612    {
6613        use std::iter::Iterator;
6614        self.blocks = v.into_iter().map(|i| i.into()).collect();
6615        self
6616    }
6617
6618    /// Sets the value of [confidence][crate::model::Page::confidence].
6619    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6620        self.confidence = v.into();
6621        self
6622    }
6623}
6624
6625impl wkt::message::Message for Page {
6626    fn typename() -> &'static str {
6627        "type.googleapis.com/google.cloud.vision.v1.Page"
6628    }
6629}
6630
6631/// Logical element on the page.
6632#[derive(Clone, Default, PartialEq)]
6633#[non_exhaustive]
6634pub struct Block {
6635    /// Additional information detected for the block.
6636    pub property: std::option::Option<crate::model::text_annotation::TextProperty>,
6637
6638    /// The bounding box for the block.
6639    /// The vertices are in the order of top-left, top-right, bottom-right,
6640    /// bottom-left. When a rotation of the bounding box is detected the rotation
6641    /// is represented as around the top-left corner as defined when the text is
6642    /// read in the 'natural' orientation.
6643    /// For example:
6644    ///
6645    /// * when the text is horizontal it might look like:
6646    ///
6647    /// * when it's rotated 180 degrees around the top-left corner it becomes:
6648    ///
6649    ///   and the vertex order will still be (0, 1, 2, 3).
6650    ///
6651    ///
6652    /// ```norust
6653    ///   0----1
6654    ///   |    |
6655    ///   3----2
6656    /// ```
6657    ///
6658    /// ```norust
6659    ///   2----3
6660    ///   |    |
6661    ///   1----0
6662    /// ```
6663    pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6664
6665    /// List of paragraphs in this block (if this blocks is of type text).
6666    pub paragraphs: std::vec::Vec<crate::model::Paragraph>,
6667
6668    /// Detected block type (text, image etc) for this block.
6669    pub block_type: crate::model::block::BlockType,
6670
6671    /// Confidence of the OCR results on the block. Range [0, 1].
6672    pub confidence: f32,
6673
6674    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6675}
6676
6677impl Block {
6678    pub fn new() -> Self {
6679        std::default::Default::default()
6680    }
6681
6682    /// Sets the value of [property][crate::model::Block::property].
6683    pub fn set_property<T>(mut self, v: T) -> Self
6684    where
6685        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
6686    {
6687        self.property = std::option::Option::Some(v.into());
6688        self
6689    }
6690
6691    /// Sets or clears the value of [property][crate::model::Block::property].
6692    pub fn set_or_clear_property<T>(mut self, v: std::option::Option<T>) -> Self
6693    where
6694        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
6695    {
6696        self.property = v.map(|x| x.into());
6697        self
6698    }
6699
6700    /// Sets the value of [bounding_box][crate::model::Block::bounding_box].
6701    pub fn set_bounding_box<T>(mut self, v: T) -> Self
6702    where
6703        T: std::convert::Into<crate::model::BoundingPoly>,
6704    {
6705        self.bounding_box = std::option::Option::Some(v.into());
6706        self
6707    }
6708
6709    /// Sets or clears the value of [bounding_box][crate::model::Block::bounding_box].
6710    pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6711    where
6712        T: std::convert::Into<crate::model::BoundingPoly>,
6713    {
6714        self.bounding_box = v.map(|x| x.into());
6715        self
6716    }
6717
6718    /// Sets the value of [paragraphs][crate::model::Block::paragraphs].
6719    pub fn set_paragraphs<T, V>(mut self, v: T) -> Self
6720    where
6721        T: std::iter::IntoIterator<Item = V>,
6722        V: std::convert::Into<crate::model::Paragraph>,
6723    {
6724        use std::iter::Iterator;
6725        self.paragraphs = v.into_iter().map(|i| i.into()).collect();
6726        self
6727    }
6728
6729    /// Sets the value of [block_type][crate::model::Block::block_type].
6730    pub fn set_block_type<T: std::convert::Into<crate::model::block::BlockType>>(
6731        mut self,
6732        v: T,
6733    ) -> Self {
6734        self.block_type = v.into();
6735        self
6736    }
6737
6738    /// Sets the value of [confidence][crate::model::Block::confidence].
6739    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6740        self.confidence = v.into();
6741        self
6742    }
6743}
6744
6745impl wkt::message::Message for Block {
6746    fn typename() -> &'static str {
6747        "type.googleapis.com/google.cloud.vision.v1.Block"
6748    }
6749}
6750
6751/// Defines additional types related to [Block].
6752pub mod block {
6753    #[allow(unused_imports)]
6754    use super::*;
6755
6756    /// Type of a block (text, image etc) as identified by OCR.
6757    ///
6758    /// # Working with unknown values
6759    ///
6760    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
6761    /// additional enum variants at any time. Adding new variants is not considered
6762    /// a breaking change. Applications should write their code in anticipation of:
6763    ///
6764    /// - New values appearing in future releases of the client library, **and**
6765    /// - New values received dynamically, without application changes.
6766    ///
6767    /// Please consult the [Working with enums] section in the user guide for some
6768    /// guidelines.
6769    ///
6770    /// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
6771    #[derive(Clone, Debug, PartialEq)]
6772    #[non_exhaustive]
6773    pub enum BlockType {
6774        /// Unknown block type.
6775        Unknown,
6776        /// Regular text block.
6777        Text,
6778        /// Table block.
6779        Table,
6780        /// Image block.
6781        Picture,
6782        /// Horizontal/vertical line box.
6783        Ruler,
6784        /// Barcode block.
6785        Barcode,
6786        /// If set, the enum was initialized with an unknown value.
6787        ///
6788        /// Applications can examine the value using [BlockType::value] or
6789        /// [BlockType::name].
6790        UnknownValue(block_type::UnknownValue),
6791    }
6792
6793    #[doc(hidden)]
6794    pub mod block_type {
6795        #[allow(unused_imports)]
6796        use super::*;
6797        #[derive(Clone, Debug, PartialEq)]
6798        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
6799    }
6800
6801    impl BlockType {
6802        /// Gets the enum value.
6803        ///
6804        /// Returns `None` if the enum contains an unknown value deserialized from
6805        /// the string representation of enums.
6806        pub fn value(&self) -> std::option::Option<i32> {
6807            match self {
6808                Self::Unknown => std::option::Option::Some(0),
6809                Self::Text => std::option::Option::Some(1),
6810                Self::Table => std::option::Option::Some(2),
6811                Self::Picture => std::option::Option::Some(3),
6812                Self::Ruler => std::option::Option::Some(4),
6813                Self::Barcode => std::option::Option::Some(5),
6814                Self::UnknownValue(u) => u.0.value(),
6815            }
6816        }
6817
6818        /// Gets the enum value as a string.
6819        ///
6820        /// Returns `None` if the enum contains an unknown value deserialized from
6821        /// the integer representation of enums.
6822        pub fn name(&self) -> std::option::Option<&str> {
6823            match self {
6824                Self::Unknown => std::option::Option::Some("UNKNOWN"),
6825                Self::Text => std::option::Option::Some("TEXT"),
6826                Self::Table => std::option::Option::Some("TABLE"),
6827                Self::Picture => std::option::Option::Some("PICTURE"),
6828                Self::Ruler => std::option::Option::Some("RULER"),
6829                Self::Barcode => std::option::Option::Some("BARCODE"),
6830                Self::UnknownValue(u) => u.0.name(),
6831            }
6832        }
6833    }
6834
6835    impl std::default::Default for BlockType {
6836        fn default() -> Self {
6837            use std::convert::From;
6838            Self::from(0)
6839        }
6840    }
6841
6842    impl std::fmt::Display for BlockType {
6843        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
6844            wkt::internal::display_enum(f, self.name(), self.value())
6845        }
6846    }
6847
6848    impl std::convert::From<i32> for BlockType {
6849        fn from(value: i32) -> Self {
6850            match value {
6851                0 => Self::Unknown,
6852                1 => Self::Text,
6853                2 => Self::Table,
6854                3 => Self::Picture,
6855                4 => Self::Ruler,
6856                5 => Self::Barcode,
6857                _ => Self::UnknownValue(block_type::UnknownValue(
6858                    wkt::internal::UnknownEnumValue::Integer(value),
6859                )),
6860            }
6861        }
6862    }
6863
6864    impl std::convert::From<&str> for BlockType {
6865        fn from(value: &str) -> Self {
6866            use std::string::ToString;
6867            match value {
6868                "UNKNOWN" => Self::Unknown,
6869                "TEXT" => Self::Text,
6870                "TABLE" => Self::Table,
6871                "PICTURE" => Self::Picture,
6872                "RULER" => Self::Ruler,
6873                "BARCODE" => Self::Barcode,
6874                _ => Self::UnknownValue(block_type::UnknownValue(
6875                    wkt::internal::UnknownEnumValue::String(value.to_string()),
6876                )),
6877            }
6878        }
6879    }
6880
6881    impl serde::ser::Serialize for BlockType {
6882        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
6883        where
6884            S: serde::Serializer,
6885        {
6886            match self {
6887                Self::Unknown => serializer.serialize_i32(0),
6888                Self::Text => serializer.serialize_i32(1),
6889                Self::Table => serializer.serialize_i32(2),
6890                Self::Picture => serializer.serialize_i32(3),
6891                Self::Ruler => serializer.serialize_i32(4),
6892                Self::Barcode => serializer.serialize_i32(5),
6893                Self::UnknownValue(u) => u.0.serialize(serializer),
6894            }
6895        }
6896    }
6897
6898    impl<'de> serde::de::Deserialize<'de> for BlockType {
6899        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
6900        where
6901            D: serde::Deserializer<'de>,
6902        {
6903            deserializer.deserialize_any(wkt::internal::EnumVisitor::<BlockType>::new(
6904                ".google.cloud.vision.v1.Block.BlockType",
6905            ))
6906        }
6907    }
6908}
6909
6910/// Structural unit of text representing a number of words in certain order.
6911#[derive(Clone, Default, PartialEq)]
6912#[non_exhaustive]
6913pub struct Paragraph {
6914    /// Additional information detected for the paragraph.
6915    pub property: std::option::Option<crate::model::text_annotation::TextProperty>,
6916
6917    /// The bounding box for the paragraph.
6918    /// The vertices are in the order of top-left, top-right, bottom-right,
6919    /// bottom-left. When a rotation of the bounding box is detected the rotation
6920    /// is represented as around the top-left corner as defined when the text is
6921    /// read in the 'natural' orientation.
6922    /// For example:
6923    ///
6924    /// * when the text is horizontal it might look like:
6925    ///   0----1
6926    ///   |    |
6927    ///   3----2
6928    /// * when it's rotated 180 degrees around the top-left corner it becomes:
6929    ///   2----3
6930    ///   |    |
6931    ///   1----0
6932    ///   and the vertex order will still be (0, 1, 2, 3).
6933    pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
6934
6935    /// List of all words in this paragraph.
6936    pub words: std::vec::Vec<crate::model::Word>,
6937
6938    /// Confidence of the OCR results for the paragraph. Range [0, 1].
6939    pub confidence: f32,
6940
6941    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
6942}
6943
6944impl Paragraph {
6945    pub fn new() -> Self {
6946        std::default::Default::default()
6947    }
6948
6949    /// Sets the value of [property][crate::model::Paragraph::property].
6950    pub fn set_property<T>(mut self, v: T) -> Self
6951    where
6952        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
6953    {
6954        self.property = std::option::Option::Some(v.into());
6955        self
6956    }
6957
6958    /// Sets or clears the value of [property][crate::model::Paragraph::property].
6959    pub fn set_or_clear_property<T>(mut self, v: std::option::Option<T>) -> Self
6960    where
6961        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
6962    {
6963        self.property = v.map(|x| x.into());
6964        self
6965    }
6966
6967    /// Sets the value of [bounding_box][crate::model::Paragraph::bounding_box].
6968    pub fn set_bounding_box<T>(mut self, v: T) -> Self
6969    where
6970        T: std::convert::Into<crate::model::BoundingPoly>,
6971    {
6972        self.bounding_box = std::option::Option::Some(v.into());
6973        self
6974    }
6975
6976    /// Sets or clears the value of [bounding_box][crate::model::Paragraph::bounding_box].
6977    pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
6978    where
6979        T: std::convert::Into<crate::model::BoundingPoly>,
6980    {
6981        self.bounding_box = v.map(|x| x.into());
6982        self
6983    }
6984
6985    /// Sets the value of [words][crate::model::Paragraph::words].
6986    pub fn set_words<T, V>(mut self, v: T) -> Self
6987    where
6988        T: std::iter::IntoIterator<Item = V>,
6989        V: std::convert::Into<crate::model::Word>,
6990    {
6991        use std::iter::Iterator;
6992        self.words = v.into_iter().map(|i| i.into()).collect();
6993        self
6994    }
6995
6996    /// Sets the value of [confidence][crate::model::Paragraph::confidence].
6997    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
6998        self.confidence = v.into();
6999        self
7000    }
7001}
7002
7003impl wkt::message::Message for Paragraph {
7004    fn typename() -> &'static str {
7005        "type.googleapis.com/google.cloud.vision.v1.Paragraph"
7006    }
7007}
7008
7009/// A word representation.
7010#[derive(Clone, Default, PartialEq)]
7011#[non_exhaustive]
7012pub struct Word {
7013    /// Additional information detected for the word.
7014    pub property: std::option::Option<crate::model::text_annotation::TextProperty>,
7015
7016    /// The bounding box for the word.
7017    /// The vertices are in the order of top-left, top-right, bottom-right,
7018    /// bottom-left. When a rotation of the bounding box is detected the rotation
7019    /// is represented as around the top-left corner as defined when the text is
7020    /// read in the 'natural' orientation.
7021    /// For example:
7022    ///
7023    /// * when the text is horizontal it might look like:
7024    ///   0----1
7025    ///   |    |
7026    ///   3----2
7027    /// * when it's rotated 180 degrees around the top-left corner it becomes:
7028    ///   2----3
7029    ///   |    |
7030    ///   1----0
7031    ///   and the vertex order will still be (0, 1, 2, 3).
7032    pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
7033
7034    /// List of symbols in the word.
7035    /// The order of the symbols follows the natural reading order.
7036    pub symbols: std::vec::Vec<crate::model::Symbol>,
7037
7038    /// Confidence of the OCR results for the word. Range [0, 1].
7039    pub confidence: f32,
7040
7041    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7042}
7043
7044impl Word {
7045    pub fn new() -> Self {
7046        std::default::Default::default()
7047    }
7048
7049    /// Sets the value of [property][crate::model::Word::property].
7050    pub fn set_property<T>(mut self, v: T) -> Self
7051    where
7052        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
7053    {
7054        self.property = std::option::Option::Some(v.into());
7055        self
7056    }
7057
7058    /// Sets or clears the value of [property][crate::model::Word::property].
7059    pub fn set_or_clear_property<T>(mut self, v: std::option::Option<T>) -> Self
7060    where
7061        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
7062    {
7063        self.property = v.map(|x| x.into());
7064        self
7065    }
7066
7067    /// Sets the value of [bounding_box][crate::model::Word::bounding_box].
7068    pub fn set_bounding_box<T>(mut self, v: T) -> Self
7069    where
7070        T: std::convert::Into<crate::model::BoundingPoly>,
7071    {
7072        self.bounding_box = std::option::Option::Some(v.into());
7073        self
7074    }
7075
7076    /// Sets or clears the value of [bounding_box][crate::model::Word::bounding_box].
7077    pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
7078    where
7079        T: std::convert::Into<crate::model::BoundingPoly>,
7080    {
7081        self.bounding_box = v.map(|x| x.into());
7082        self
7083    }
7084
7085    /// Sets the value of [symbols][crate::model::Word::symbols].
7086    pub fn set_symbols<T, V>(mut self, v: T) -> Self
7087    where
7088        T: std::iter::IntoIterator<Item = V>,
7089        V: std::convert::Into<crate::model::Symbol>,
7090    {
7091        use std::iter::Iterator;
7092        self.symbols = v.into_iter().map(|i| i.into()).collect();
7093        self
7094    }
7095
7096    /// Sets the value of [confidence][crate::model::Word::confidence].
7097    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
7098        self.confidence = v.into();
7099        self
7100    }
7101}
7102
7103impl wkt::message::Message for Word {
7104    fn typename() -> &'static str {
7105        "type.googleapis.com/google.cloud.vision.v1.Word"
7106    }
7107}
7108
7109/// A single symbol representation.
7110#[derive(Clone, Default, PartialEq)]
7111#[non_exhaustive]
7112pub struct Symbol {
7113    /// Additional information detected for the symbol.
7114    pub property: std::option::Option<crate::model::text_annotation::TextProperty>,
7115
7116    /// The bounding box for the symbol.
7117    /// The vertices are in the order of top-left, top-right, bottom-right,
7118    /// bottom-left. When a rotation of the bounding box is detected the rotation
7119    /// is represented as around the top-left corner as defined when the text is
7120    /// read in the 'natural' orientation.
7121    /// For example:
7122    ///
7123    /// * when the text is horizontal it might look like:
7124    ///   0----1
7125    ///   |    |
7126    ///   3----2
7127    /// * when it's rotated 180 degrees around the top-left corner it becomes:
7128    ///   2----3
7129    ///   |    |
7130    ///   1----0
7131    ///   and the vertex order will still be (0, 1, 2, 3).
7132    pub bounding_box: std::option::Option<crate::model::BoundingPoly>,
7133
7134    /// The actual UTF-8 representation of the symbol.
7135    pub text: std::string::String,
7136
7137    /// Confidence of the OCR results for the symbol. Range [0, 1].
7138    pub confidence: f32,
7139
7140    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7141}
7142
7143impl Symbol {
7144    pub fn new() -> Self {
7145        std::default::Default::default()
7146    }
7147
7148    /// Sets the value of [property][crate::model::Symbol::property].
7149    pub fn set_property<T>(mut self, v: T) -> Self
7150    where
7151        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
7152    {
7153        self.property = std::option::Option::Some(v.into());
7154        self
7155    }
7156
7157    /// Sets or clears the value of [property][crate::model::Symbol::property].
7158    pub fn set_or_clear_property<T>(mut self, v: std::option::Option<T>) -> Self
7159    where
7160        T: std::convert::Into<crate::model::text_annotation::TextProperty>,
7161    {
7162        self.property = v.map(|x| x.into());
7163        self
7164    }
7165
7166    /// Sets the value of [bounding_box][crate::model::Symbol::bounding_box].
7167    pub fn set_bounding_box<T>(mut self, v: T) -> Self
7168    where
7169        T: std::convert::Into<crate::model::BoundingPoly>,
7170    {
7171        self.bounding_box = std::option::Option::Some(v.into());
7172        self
7173    }
7174
7175    /// Sets or clears the value of [bounding_box][crate::model::Symbol::bounding_box].
7176    pub fn set_or_clear_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
7177    where
7178        T: std::convert::Into<crate::model::BoundingPoly>,
7179    {
7180        self.bounding_box = v.map(|x| x.into());
7181        self
7182    }
7183
7184    /// Sets the value of [text][crate::model::Symbol::text].
7185    pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7186        self.text = v.into();
7187        self
7188    }
7189
7190    /// Sets the value of [confidence][crate::model::Symbol::confidence].
7191    pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
7192        self.confidence = v.into();
7193        self
7194    }
7195}
7196
7197impl wkt::message::Message for Symbol {
7198    fn typename() -> &'static str {
7199        "type.googleapis.com/google.cloud.vision.v1.Symbol"
7200    }
7201}
7202
7203/// Relevant information for the image from the Internet.
7204#[derive(Clone, Default, PartialEq)]
7205#[non_exhaustive]
7206pub struct WebDetection {
7207    /// Deduced entities from similar images on the Internet.
7208    pub web_entities: std::vec::Vec<crate::model::web_detection::WebEntity>,
7209
7210    /// Fully matching images from the Internet.
7211    /// Can include resized copies of the query image.
7212    pub full_matching_images: std::vec::Vec<crate::model::web_detection::WebImage>,
7213
7214    /// Partial matching images from the Internet.
7215    /// Those images are similar enough to share some key-point features. For
7216    /// example an original image will likely have partial matching for its crops.
7217    pub partial_matching_images: std::vec::Vec<crate::model::web_detection::WebImage>,
7218
7219    /// Web pages containing the matching images from the Internet.
7220    pub pages_with_matching_images: std::vec::Vec<crate::model::web_detection::WebPage>,
7221
7222    /// The visually similar image results.
7223    pub visually_similar_images: std::vec::Vec<crate::model::web_detection::WebImage>,
7224
7225    /// The service's best guess as to the topic of the request image.
7226    /// Inferred from similar images on the open web.
7227    pub best_guess_labels: std::vec::Vec<crate::model::web_detection::WebLabel>,
7228
7229    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7230}
7231
7232impl WebDetection {
7233    pub fn new() -> Self {
7234        std::default::Default::default()
7235    }
7236
7237    /// Sets the value of [web_entities][crate::model::WebDetection::web_entities].
7238    pub fn set_web_entities<T, V>(mut self, v: T) -> Self
7239    where
7240        T: std::iter::IntoIterator<Item = V>,
7241        V: std::convert::Into<crate::model::web_detection::WebEntity>,
7242    {
7243        use std::iter::Iterator;
7244        self.web_entities = v.into_iter().map(|i| i.into()).collect();
7245        self
7246    }
7247
7248    /// Sets the value of [full_matching_images][crate::model::WebDetection::full_matching_images].
7249    pub fn set_full_matching_images<T, V>(mut self, v: T) -> Self
7250    where
7251        T: std::iter::IntoIterator<Item = V>,
7252        V: std::convert::Into<crate::model::web_detection::WebImage>,
7253    {
7254        use std::iter::Iterator;
7255        self.full_matching_images = v.into_iter().map(|i| i.into()).collect();
7256        self
7257    }
7258
7259    /// Sets the value of [partial_matching_images][crate::model::WebDetection::partial_matching_images].
7260    pub fn set_partial_matching_images<T, V>(mut self, v: T) -> Self
7261    where
7262        T: std::iter::IntoIterator<Item = V>,
7263        V: std::convert::Into<crate::model::web_detection::WebImage>,
7264    {
7265        use std::iter::Iterator;
7266        self.partial_matching_images = v.into_iter().map(|i| i.into()).collect();
7267        self
7268    }
7269
7270    /// Sets the value of [pages_with_matching_images][crate::model::WebDetection::pages_with_matching_images].
7271    pub fn set_pages_with_matching_images<T, V>(mut self, v: T) -> Self
7272    where
7273        T: std::iter::IntoIterator<Item = V>,
7274        V: std::convert::Into<crate::model::web_detection::WebPage>,
7275    {
7276        use std::iter::Iterator;
7277        self.pages_with_matching_images = v.into_iter().map(|i| i.into()).collect();
7278        self
7279    }
7280
7281    /// Sets the value of [visually_similar_images][crate::model::WebDetection::visually_similar_images].
7282    pub fn set_visually_similar_images<T, V>(mut self, v: T) -> Self
7283    where
7284        T: std::iter::IntoIterator<Item = V>,
7285        V: std::convert::Into<crate::model::web_detection::WebImage>,
7286    {
7287        use std::iter::Iterator;
7288        self.visually_similar_images = v.into_iter().map(|i| i.into()).collect();
7289        self
7290    }
7291
7292    /// Sets the value of [best_guess_labels][crate::model::WebDetection::best_guess_labels].
7293    pub fn set_best_guess_labels<T, V>(mut self, v: T) -> Self
7294    where
7295        T: std::iter::IntoIterator<Item = V>,
7296        V: std::convert::Into<crate::model::web_detection::WebLabel>,
7297    {
7298        use std::iter::Iterator;
7299        self.best_guess_labels = v.into_iter().map(|i| i.into()).collect();
7300        self
7301    }
7302}
7303
7304impl wkt::message::Message for WebDetection {
7305    fn typename() -> &'static str {
7306        "type.googleapis.com/google.cloud.vision.v1.WebDetection"
7307    }
7308}
7309
7310/// Defines additional types related to [WebDetection].
7311pub mod web_detection {
7312    #[allow(unused_imports)]
7313    use super::*;
7314
7315    /// Entity deduced from similar images on the Internet.
7316    #[derive(Clone, Default, PartialEq)]
7317    #[non_exhaustive]
7318    pub struct WebEntity {
7319        /// Opaque entity ID.
7320        pub entity_id: std::string::String,
7321
7322        /// Overall relevancy score for the entity.
7323        /// Not normalized and not comparable across different image queries.
7324        pub score: f32,
7325
7326        /// Canonical description of the entity, in English.
7327        pub description: std::string::String,
7328
7329        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7330    }
7331
7332    impl WebEntity {
7333        pub fn new() -> Self {
7334            std::default::Default::default()
7335        }
7336
7337        /// Sets the value of [entity_id][crate::model::web_detection::WebEntity::entity_id].
7338        pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7339            self.entity_id = v.into();
7340            self
7341        }
7342
7343        /// Sets the value of [score][crate::model::web_detection::WebEntity::score].
7344        pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
7345            self.score = v.into();
7346            self
7347        }
7348
7349        /// Sets the value of [description][crate::model::web_detection::WebEntity::description].
7350        pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7351            self.description = v.into();
7352            self
7353        }
7354    }
7355
7356    impl wkt::message::Message for WebEntity {
7357        fn typename() -> &'static str {
7358            "type.googleapis.com/google.cloud.vision.v1.WebDetection.WebEntity"
7359        }
7360    }
7361
7362    /// Metadata for online images.
7363    #[derive(Clone, Default, PartialEq)]
7364    #[non_exhaustive]
7365    pub struct WebImage {
7366        /// The result image URL.
7367        pub url: std::string::String,
7368
7369        /// (Deprecated) Overall relevancy score for the image.
7370        pub score: f32,
7371
7372        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7373    }
7374
7375    impl WebImage {
7376        pub fn new() -> Self {
7377            std::default::Default::default()
7378        }
7379
7380        /// Sets the value of [url][crate::model::web_detection::WebImage::url].
7381        pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7382            self.url = v.into();
7383            self
7384        }
7385
7386        /// Sets the value of [score][crate::model::web_detection::WebImage::score].
7387        pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
7388            self.score = v.into();
7389            self
7390        }
7391    }
7392
7393    impl wkt::message::Message for WebImage {
7394        fn typename() -> &'static str {
7395            "type.googleapis.com/google.cloud.vision.v1.WebDetection.WebImage"
7396        }
7397    }
7398
7399    /// Metadata for web pages.
7400    #[derive(Clone, Default, PartialEq)]
7401    #[non_exhaustive]
7402    pub struct WebPage {
7403        /// The result web page URL.
7404        pub url: std::string::String,
7405
7406        /// (Deprecated) Overall relevancy score for the web page.
7407        pub score: f32,
7408
7409        /// Title for the web page, may contain HTML markups.
7410        pub page_title: std::string::String,
7411
7412        /// Fully matching images on the page.
7413        /// Can include resized copies of the query image.
7414        pub full_matching_images: std::vec::Vec<crate::model::web_detection::WebImage>,
7415
7416        /// Partial matching images on the page.
7417        /// Those images are similar enough to share some key-point features. For
7418        /// example an original image will likely have partial matching for its
7419        /// crops.
7420        pub partial_matching_images: std::vec::Vec<crate::model::web_detection::WebImage>,
7421
7422        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7423    }
7424
7425    impl WebPage {
7426        pub fn new() -> Self {
7427            std::default::Default::default()
7428        }
7429
7430        /// Sets the value of [url][crate::model::web_detection::WebPage::url].
7431        pub fn set_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7432            self.url = v.into();
7433            self
7434        }
7435
7436        /// Sets the value of [score][crate::model::web_detection::WebPage::score].
7437        pub fn set_score<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
7438            self.score = v.into();
7439            self
7440        }
7441
7442        /// Sets the value of [page_title][crate::model::web_detection::WebPage::page_title].
7443        pub fn set_page_title<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7444            self.page_title = v.into();
7445            self
7446        }
7447
7448        /// Sets the value of [full_matching_images][crate::model::web_detection::WebPage::full_matching_images].
7449        pub fn set_full_matching_images<T, V>(mut self, v: T) -> Self
7450        where
7451            T: std::iter::IntoIterator<Item = V>,
7452            V: std::convert::Into<crate::model::web_detection::WebImage>,
7453        {
7454            use std::iter::Iterator;
7455            self.full_matching_images = v.into_iter().map(|i| i.into()).collect();
7456            self
7457        }
7458
7459        /// Sets the value of [partial_matching_images][crate::model::web_detection::WebPage::partial_matching_images].
7460        pub fn set_partial_matching_images<T, V>(mut self, v: T) -> Self
7461        where
7462            T: std::iter::IntoIterator<Item = V>,
7463            V: std::convert::Into<crate::model::web_detection::WebImage>,
7464        {
7465            use std::iter::Iterator;
7466            self.partial_matching_images = v.into_iter().map(|i| i.into()).collect();
7467            self
7468        }
7469    }
7470
7471    impl wkt::message::Message for WebPage {
7472        fn typename() -> &'static str {
7473            "type.googleapis.com/google.cloud.vision.v1.WebDetection.WebPage"
7474        }
7475    }
7476
7477    /// Label to provide extra metadata for the web detection.
7478    #[derive(Clone, Default, PartialEq)]
7479    #[non_exhaustive]
7480    pub struct WebLabel {
7481        /// Label for extra metadata.
7482        pub label: std::string::String,
7483
7484        /// The BCP-47 language code for `label`, such as "en-US" or "sr-Latn".
7485        /// For more information, see
7486        /// <http://www.unicode.org/reports/tr35/#Unicode_locale_identifier>.
7487        pub language_code: std::string::String,
7488
7489        pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
7490    }
7491
7492    impl WebLabel {
7493        pub fn new() -> Self {
7494            std::default::Default::default()
7495        }
7496
7497        /// Sets the value of [label][crate::model::web_detection::WebLabel::label].
7498        pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
7499            self.label = v.into();
7500            self
7501        }
7502
7503        /// Sets the value of [language_code][crate::model::web_detection::WebLabel::language_code].
7504        pub fn set_language_code<T: std::convert::Into<std::string::String>>(
7505            mut self,
7506            v: T,
7507        ) -> Self {
7508            self.language_code = v.into();
7509            self
7510        }
7511    }
7512
7513    impl wkt::message::Message for WebLabel {
7514        fn typename() -> &'static str {
7515            "type.googleapis.com/google.cloud.vision.v1.WebDetection.WebLabel"
7516        }
7517    }
7518}
7519
7520/// A bucketized representation of likelihood, which is intended to give clients
7521/// highly stable results across model upgrades.
7522///
7523/// # Working with unknown values
7524///
7525/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
7526/// additional enum variants at any time. Adding new variants is not considered
7527/// a breaking change. Applications should write their code in anticipation of:
7528///
7529/// - New values appearing in future releases of the client library, **and**
7530/// - New values received dynamically, without application changes.
7531///
7532/// Please consult the [Working with enums] section in the user guide for some
7533/// guidelines.
7534///
7535/// [Working with enums]: https://google-cloud-rust.github.io/working_with_enums.html
7536#[derive(Clone, Debug, PartialEq)]
7537#[non_exhaustive]
7538pub enum Likelihood {
7539    /// Unknown likelihood.
7540    Unknown,
7541    /// It is very unlikely.
7542    VeryUnlikely,
7543    /// It is unlikely.
7544    Unlikely,
7545    /// It is possible.
7546    Possible,
7547    /// It is likely.
7548    Likely,
7549    /// It is very likely.
7550    VeryLikely,
7551    /// If set, the enum was initialized with an unknown value.
7552    ///
7553    /// Applications can examine the value using [Likelihood::value] or
7554    /// [Likelihood::name].
7555    UnknownValue(likelihood::UnknownValue),
7556}
7557
7558#[doc(hidden)]
7559pub mod likelihood {
7560    #[allow(unused_imports)]
7561    use super::*;
7562    #[derive(Clone, Debug, PartialEq)]
7563    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
7564}
7565
7566impl Likelihood {
7567    /// Gets the enum value.
7568    ///
7569    /// Returns `None` if the enum contains an unknown value deserialized from
7570    /// the string representation of enums.
7571    pub fn value(&self) -> std::option::Option<i32> {
7572        match self {
7573            Self::Unknown => std::option::Option::Some(0),
7574            Self::VeryUnlikely => std::option::Option::Some(1),
7575            Self::Unlikely => std::option::Option::Some(2),
7576            Self::Possible => std::option::Option::Some(3),
7577            Self::Likely => std::option::Option::Some(4),
7578            Self::VeryLikely => std::option::Option::Some(5),
7579            Self::UnknownValue(u) => u.0.value(),
7580        }
7581    }
7582
7583    /// Gets the enum value as a string.
7584    ///
7585    /// Returns `None` if the enum contains an unknown value deserialized from
7586    /// the integer representation of enums.
7587    pub fn name(&self) -> std::option::Option<&str> {
7588        match self {
7589            Self::Unknown => std::option::Option::Some("UNKNOWN"),
7590            Self::VeryUnlikely => std::option::Option::Some("VERY_UNLIKELY"),
7591            Self::Unlikely => std::option::Option::Some("UNLIKELY"),
7592            Self::Possible => std::option::Option::Some("POSSIBLE"),
7593            Self::Likely => std::option::Option::Some("LIKELY"),
7594            Self::VeryLikely => std::option::Option::Some("VERY_LIKELY"),
7595            Self::UnknownValue(u) => u.0.name(),
7596        }
7597    }
7598}
7599
7600impl std::default::Default for Likelihood {
7601    fn default() -> Self {
7602        use std::convert::From;
7603        Self::from(0)
7604    }
7605}
7606
7607impl std::fmt::Display for Likelihood {
7608    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
7609        wkt::internal::display_enum(f, self.name(), self.value())
7610    }
7611}
7612
7613impl std::convert::From<i32> for Likelihood {
7614    fn from(value: i32) -> Self {
7615        match value {
7616            0 => Self::Unknown,
7617            1 => Self::VeryUnlikely,
7618            2 => Self::Unlikely,
7619            3 => Self::Possible,
7620            4 => Self::Likely,
7621            5 => Self::VeryLikely,
7622            _ => Self::UnknownValue(likelihood::UnknownValue(
7623                wkt::internal::UnknownEnumValue::Integer(value),
7624            )),
7625        }
7626    }
7627}
7628
7629impl std::convert::From<&str> for Likelihood {
7630    fn from(value: &str) -> Self {
7631        use std::string::ToString;
7632        match value {
7633            "UNKNOWN" => Self::Unknown,
7634            "VERY_UNLIKELY" => Self::VeryUnlikely,
7635            "UNLIKELY" => Self::Unlikely,
7636            "POSSIBLE" => Self::Possible,
7637            "LIKELY" => Self::Likely,
7638            "VERY_LIKELY" => Self::VeryLikely,
7639            _ => Self::UnknownValue(likelihood::UnknownValue(
7640                wkt::internal::UnknownEnumValue::String(value.to_string()),
7641            )),
7642        }
7643    }
7644}
7645
7646impl serde::ser::Serialize for Likelihood {
7647    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
7648    where
7649        S: serde::Serializer,
7650    {
7651        match self {
7652            Self::Unknown => serializer.serialize_i32(0),
7653            Self::VeryUnlikely => serializer.serialize_i32(1),
7654            Self::Unlikely => serializer.serialize_i32(2),
7655            Self::Possible => serializer.serialize_i32(3),
7656            Self::Likely => serializer.serialize_i32(4),
7657            Self::VeryLikely => serializer.serialize_i32(5),
7658            Self::UnknownValue(u) => u.0.serialize(serializer),
7659        }
7660    }
7661}
7662
7663impl<'de> serde::de::Deserialize<'de> for Likelihood {
7664    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
7665    where
7666        D: serde::Deserializer<'de>,
7667    {
7668        deserializer.deserialize_any(wkt::internal::EnumVisitor::<Likelihood>::new(
7669            ".google.cloud.vision.v1.Likelihood",
7670        ))
7671    }
7672}