google_cloud_videointelligence_v1/model.rs
1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16
17#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate async_trait;
21extern crate bytes;
22extern crate gaxi;
23extern crate google_cloud_gax;
24extern crate google_cloud_longrunning;
25extern crate google_cloud_lro;
26extern crate google_cloud_rpc;
27extern crate serde;
28extern crate serde_json;
29extern crate serde_with;
30extern crate std;
31extern crate tracing;
32extern crate wkt;
33
34mod debug;
35mod deserialize;
36mod serialize;
37
38/// Video annotation request.
39#[derive(Clone, Default, PartialEq)]
40#[non_exhaustive]
41pub struct AnnotateVideoRequest {
42 /// Input video location. Currently, only
43 /// [Cloud Storage](https://cloud.google.com/storage/) URIs are
44 /// supported. URIs must be specified in the following format:
45 /// `gs://bucket-id/object-id` (other URI formats return
46 /// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
47 /// more information, see [Request
48 /// URIs](https://cloud.google.com/storage/docs/request-endpoints). To identify
49 /// multiple videos, a video URI may include wildcards in the `object-id`.
50 /// Supported wildcards: '*' to match 0 or more characters;
51 /// '?' to match 1 character. If unset, the input video should be embedded
52 /// in the request as `input_content`. If set, `input_content` must be unset.
53 pub input_uri: std::string::String,
54
55 /// The video data bytes.
56 /// If unset, the input video(s) should be specified via the `input_uri`.
57 /// If set, `input_uri` must be unset.
58 pub input_content: ::bytes::Bytes,
59
60 /// Required. Requested video annotation features.
61 pub features: std::vec::Vec<crate::model::Feature>,
62
63 /// Additional video context and/or feature-specific parameters.
64 pub video_context: std::option::Option<crate::model::VideoContext>,
65
66 /// Optional. Location where the output (in JSON format) should be stored.
67 /// Currently, only [Cloud Storage](https://cloud.google.com/storage/)
68 /// URIs are supported. These must be specified in the following format:
69 /// `gs://bucket-id/object-id` (other URI formats return
70 /// [google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]). For
71 /// more information, see [Request
72 /// URIs](https://cloud.google.com/storage/docs/request-endpoints).
73 pub output_uri: std::string::String,
74
75 /// Optional. Cloud region where annotation should take place. Supported cloud
76 /// regions are: `us-east1`, `us-west1`, `europe-west1`, `asia-east1`. If no
77 /// region is specified, the region will be determined based on video file
78 /// location.
79 pub location_id: std::string::String,
80
81 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
82}
83
84impl AnnotateVideoRequest {
85 /// Creates a new default instance.
86 pub fn new() -> Self {
87 std::default::Default::default()
88 }
89
90 /// Sets the value of [input_uri][crate::model::AnnotateVideoRequest::input_uri].
91 ///
92 /// # Example
93 /// ```ignore,no_run
94 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
95 /// let x = AnnotateVideoRequest::new().set_input_uri("example");
96 /// ```
97 pub fn set_input_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
98 self.input_uri = v.into();
99 self
100 }
101
102 /// Sets the value of [input_content][crate::model::AnnotateVideoRequest::input_content].
103 ///
104 /// # Example
105 /// ```ignore,no_run
106 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
107 /// let x = AnnotateVideoRequest::new().set_input_content(bytes::Bytes::from_static(b"example"));
108 /// ```
109 pub fn set_input_content<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
110 self.input_content = v.into();
111 self
112 }
113
114 /// Sets the value of [features][crate::model::AnnotateVideoRequest::features].
115 ///
116 /// # Example
117 /// ```ignore,no_run
118 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
119 /// use google_cloud_videointelligence_v1::model::Feature;
120 /// let x = AnnotateVideoRequest::new().set_features([
121 /// Feature::LabelDetection,
122 /// Feature::ShotChangeDetection,
123 /// Feature::ExplicitContentDetection,
124 /// ]);
125 /// ```
126 pub fn set_features<T, V>(mut self, v: T) -> Self
127 where
128 T: std::iter::IntoIterator<Item = V>,
129 V: std::convert::Into<crate::model::Feature>,
130 {
131 use std::iter::Iterator;
132 self.features = v.into_iter().map(|i| i.into()).collect();
133 self
134 }
135
136 /// Sets the value of [video_context][crate::model::AnnotateVideoRequest::video_context].
137 ///
138 /// # Example
139 /// ```ignore,no_run
140 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
141 /// use google_cloud_videointelligence_v1::model::VideoContext;
142 /// let x = AnnotateVideoRequest::new().set_video_context(VideoContext::default()/* use setters */);
143 /// ```
144 pub fn set_video_context<T>(mut self, v: T) -> Self
145 where
146 T: std::convert::Into<crate::model::VideoContext>,
147 {
148 self.video_context = std::option::Option::Some(v.into());
149 self
150 }
151
152 /// Sets or clears the value of [video_context][crate::model::AnnotateVideoRequest::video_context].
153 ///
154 /// # Example
155 /// ```ignore,no_run
156 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
157 /// use google_cloud_videointelligence_v1::model::VideoContext;
158 /// let x = AnnotateVideoRequest::new().set_or_clear_video_context(Some(VideoContext::default()/* use setters */));
159 /// let x = AnnotateVideoRequest::new().set_or_clear_video_context(None::<VideoContext>);
160 /// ```
161 pub fn set_or_clear_video_context<T>(mut self, v: std::option::Option<T>) -> Self
162 where
163 T: std::convert::Into<crate::model::VideoContext>,
164 {
165 self.video_context = v.map(|x| x.into());
166 self
167 }
168
169 /// Sets the value of [output_uri][crate::model::AnnotateVideoRequest::output_uri].
170 ///
171 /// # Example
172 /// ```ignore,no_run
173 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
174 /// let x = AnnotateVideoRequest::new().set_output_uri("example");
175 /// ```
176 pub fn set_output_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
177 self.output_uri = v.into();
178 self
179 }
180
181 /// Sets the value of [location_id][crate::model::AnnotateVideoRequest::location_id].
182 ///
183 /// # Example
184 /// ```ignore,no_run
185 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoRequest;
186 /// let x = AnnotateVideoRequest::new().set_location_id("example");
187 /// ```
188 pub fn set_location_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
189 self.location_id = v.into();
190 self
191 }
192}
193
194impl wkt::message::Message for AnnotateVideoRequest {
195 fn typename() -> &'static str {
196 "type.googleapis.com/google.cloud.videointelligence.v1.AnnotateVideoRequest"
197 }
198}
199
200/// Video context and/or feature-specific parameters.
201#[derive(Clone, Default, PartialEq)]
202#[non_exhaustive]
203pub struct VideoContext {
204 /// Video segments to annotate. The segments may overlap and are not required
205 /// to be contiguous or span the whole video. If unspecified, each video is
206 /// treated as a single segment.
207 pub segments: std::vec::Vec<crate::model::VideoSegment>,
208
209 /// Config for LABEL_DETECTION.
210 pub label_detection_config: std::option::Option<crate::model::LabelDetectionConfig>,
211
212 /// Config for SHOT_CHANGE_DETECTION.
213 pub shot_change_detection_config: std::option::Option<crate::model::ShotChangeDetectionConfig>,
214
215 /// Config for EXPLICIT_CONTENT_DETECTION.
216 pub explicit_content_detection_config:
217 std::option::Option<crate::model::ExplicitContentDetectionConfig>,
218
219 /// Config for FACE_DETECTION.
220 pub face_detection_config: std::option::Option<crate::model::FaceDetectionConfig>,
221
222 /// Config for SPEECH_TRANSCRIPTION.
223 pub speech_transcription_config: std::option::Option<crate::model::SpeechTranscriptionConfig>,
224
225 /// Config for TEXT_DETECTION.
226 pub text_detection_config: std::option::Option<crate::model::TextDetectionConfig>,
227
228 /// Config for PERSON_DETECTION.
229 pub person_detection_config: std::option::Option<crate::model::PersonDetectionConfig>,
230
231 /// Config for OBJECT_TRACKING.
232 pub object_tracking_config: std::option::Option<crate::model::ObjectTrackingConfig>,
233
234 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
235}
236
237impl VideoContext {
238 /// Creates a new default instance.
239 pub fn new() -> Self {
240 std::default::Default::default()
241 }
242
243 /// Sets the value of [segments][crate::model::VideoContext::segments].
244 ///
245 /// # Example
246 /// ```ignore,no_run
247 /// # use google_cloud_videointelligence_v1::model::VideoContext;
248 /// use google_cloud_videointelligence_v1::model::VideoSegment;
249 /// let x = VideoContext::new()
250 /// .set_segments([
251 /// VideoSegment::default()/* use setters */,
252 /// VideoSegment::default()/* use (different) setters */,
253 /// ]);
254 /// ```
255 pub fn set_segments<T, V>(mut self, v: T) -> Self
256 where
257 T: std::iter::IntoIterator<Item = V>,
258 V: std::convert::Into<crate::model::VideoSegment>,
259 {
260 use std::iter::Iterator;
261 self.segments = v.into_iter().map(|i| i.into()).collect();
262 self
263 }
264
265 /// Sets the value of [label_detection_config][crate::model::VideoContext::label_detection_config].
266 ///
267 /// # Example
268 /// ```ignore,no_run
269 /// # use google_cloud_videointelligence_v1::model::VideoContext;
270 /// use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
271 /// let x = VideoContext::new().set_label_detection_config(LabelDetectionConfig::default()/* use setters */);
272 /// ```
273 pub fn set_label_detection_config<T>(mut self, v: T) -> Self
274 where
275 T: std::convert::Into<crate::model::LabelDetectionConfig>,
276 {
277 self.label_detection_config = std::option::Option::Some(v.into());
278 self
279 }
280
281 /// Sets or clears the value of [label_detection_config][crate::model::VideoContext::label_detection_config].
282 ///
283 /// # Example
284 /// ```ignore,no_run
285 /// # use google_cloud_videointelligence_v1::model::VideoContext;
286 /// use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
287 /// let x = VideoContext::new().set_or_clear_label_detection_config(Some(LabelDetectionConfig::default()/* use setters */));
288 /// let x = VideoContext::new().set_or_clear_label_detection_config(None::<LabelDetectionConfig>);
289 /// ```
290 pub fn set_or_clear_label_detection_config<T>(mut self, v: std::option::Option<T>) -> Self
291 where
292 T: std::convert::Into<crate::model::LabelDetectionConfig>,
293 {
294 self.label_detection_config = v.map(|x| x.into());
295 self
296 }
297
298 /// Sets the value of [shot_change_detection_config][crate::model::VideoContext::shot_change_detection_config].
299 ///
300 /// # Example
301 /// ```ignore,no_run
302 /// # use google_cloud_videointelligence_v1::model::VideoContext;
303 /// use google_cloud_videointelligence_v1::model::ShotChangeDetectionConfig;
304 /// let x = VideoContext::new().set_shot_change_detection_config(ShotChangeDetectionConfig::default()/* use setters */);
305 /// ```
306 pub fn set_shot_change_detection_config<T>(mut self, v: T) -> Self
307 where
308 T: std::convert::Into<crate::model::ShotChangeDetectionConfig>,
309 {
310 self.shot_change_detection_config = std::option::Option::Some(v.into());
311 self
312 }
313
314 /// Sets or clears the value of [shot_change_detection_config][crate::model::VideoContext::shot_change_detection_config].
315 ///
316 /// # Example
317 /// ```ignore,no_run
318 /// # use google_cloud_videointelligence_v1::model::VideoContext;
319 /// use google_cloud_videointelligence_v1::model::ShotChangeDetectionConfig;
320 /// let x = VideoContext::new().set_or_clear_shot_change_detection_config(Some(ShotChangeDetectionConfig::default()/* use setters */));
321 /// let x = VideoContext::new().set_or_clear_shot_change_detection_config(None::<ShotChangeDetectionConfig>);
322 /// ```
323 pub fn set_or_clear_shot_change_detection_config<T>(mut self, v: std::option::Option<T>) -> Self
324 where
325 T: std::convert::Into<crate::model::ShotChangeDetectionConfig>,
326 {
327 self.shot_change_detection_config = v.map(|x| x.into());
328 self
329 }
330
331 /// Sets the value of [explicit_content_detection_config][crate::model::VideoContext::explicit_content_detection_config].
332 ///
333 /// # Example
334 /// ```ignore,no_run
335 /// # use google_cloud_videointelligence_v1::model::VideoContext;
336 /// use google_cloud_videointelligence_v1::model::ExplicitContentDetectionConfig;
337 /// let x = VideoContext::new().set_explicit_content_detection_config(ExplicitContentDetectionConfig::default()/* use setters */);
338 /// ```
339 pub fn set_explicit_content_detection_config<T>(mut self, v: T) -> Self
340 where
341 T: std::convert::Into<crate::model::ExplicitContentDetectionConfig>,
342 {
343 self.explicit_content_detection_config = std::option::Option::Some(v.into());
344 self
345 }
346
347 /// Sets or clears the value of [explicit_content_detection_config][crate::model::VideoContext::explicit_content_detection_config].
348 ///
349 /// # Example
350 /// ```ignore,no_run
351 /// # use google_cloud_videointelligence_v1::model::VideoContext;
352 /// use google_cloud_videointelligence_v1::model::ExplicitContentDetectionConfig;
353 /// let x = VideoContext::new().set_or_clear_explicit_content_detection_config(Some(ExplicitContentDetectionConfig::default()/* use setters */));
354 /// let x = VideoContext::new().set_or_clear_explicit_content_detection_config(None::<ExplicitContentDetectionConfig>);
355 /// ```
356 pub fn set_or_clear_explicit_content_detection_config<T>(
357 mut self,
358 v: std::option::Option<T>,
359 ) -> Self
360 where
361 T: std::convert::Into<crate::model::ExplicitContentDetectionConfig>,
362 {
363 self.explicit_content_detection_config = v.map(|x| x.into());
364 self
365 }
366
367 /// Sets the value of [face_detection_config][crate::model::VideoContext::face_detection_config].
368 ///
369 /// # Example
370 /// ```ignore,no_run
371 /// # use google_cloud_videointelligence_v1::model::VideoContext;
372 /// use google_cloud_videointelligence_v1::model::FaceDetectionConfig;
373 /// let x = VideoContext::new().set_face_detection_config(FaceDetectionConfig::default()/* use setters */);
374 /// ```
375 pub fn set_face_detection_config<T>(mut self, v: T) -> Self
376 where
377 T: std::convert::Into<crate::model::FaceDetectionConfig>,
378 {
379 self.face_detection_config = std::option::Option::Some(v.into());
380 self
381 }
382
383 /// Sets or clears the value of [face_detection_config][crate::model::VideoContext::face_detection_config].
384 ///
385 /// # Example
386 /// ```ignore,no_run
387 /// # use google_cloud_videointelligence_v1::model::VideoContext;
388 /// use google_cloud_videointelligence_v1::model::FaceDetectionConfig;
389 /// let x = VideoContext::new().set_or_clear_face_detection_config(Some(FaceDetectionConfig::default()/* use setters */));
390 /// let x = VideoContext::new().set_or_clear_face_detection_config(None::<FaceDetectionConfig>);
391 /// ```
392 pub fn set_or_clear_face_detection_config<T>(mut self, v: std::option::Option<T>) -> Self
393 where
394 T: std::convert::Into<crate::model::FaceDetectionConfig>,
395 {
396 self.face_detection_config = v.map(|x| x.into());
397 self
398 }
399
400 /// Sets the value of [speech_transcription_config][crate::model::VideoContext::speech_transcription_config].
401 ///
402 /// # Example
403 /// ```ignore,no_run
404 /// # use google_cloud_videointelligence_v1::model::VideoContext;
405 /// use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
406 /// let x = VideoContext::new().set_speech_transcription_config(SpeechTranscriptionConfig::default()/* use setters */);
407 /// ```
408 pub fn set_speech_transcription_config<T>(mut self, v: T) -> Self
409 where
410 T: std::convert::Into<crate::model::SpeechTranscriptionConfig>,
411 {
412 self.speech_transcription_config = std::option::Option::Some(v.into());
413 self
414 }
415
416 /// Sets or clears the value of [speech_transcription_config][crate::model::VideoContext::speech_transcription_config].
417 ///
418 /// # Example
419 /// ```ignore,no_run
420 /// # use google_cloud_videointelligence_v1::model::VideoContext;
421 /// use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
422 /// let x = VideoContext::new().set_or_clear_speech_transcription_config(Some(SpeechTranscriptionConfig::default()/* use setters */));
423 /// let x = VideoContext::new().set_or_clear_speech_transcription_config(None::<SpeechTranscriptionConfig>);
424 /// ```
425 pub fn set_or_clear_speech_transcription_config<T>(mut self, v: std::option::Option<T>) -> Self
426 where
427 T: std::convert::Into<crate::model::SpeechTranscriptionConfig>,
428 {
429 self.speech_transcription_config = v.map(|x| x.into());
430 self
431 }
432
433 /// Sets the value of [text_detection_config][crate::model::VideoContext::text_detection_config].
434 ///
435 /// # Example
436 /// ```ignore,no_run
437 /// # use google_cloud_videointelligence_v1::model::VideoContext;
438 /// use google_cloud_videointelligence_v1::model::TextDetectionConfig;
439 /// let x = VideoContext::new().set_text_detection_config(TextDetectionConfig::default()/* use setters */);
440 /// ```
441 pub fn set_text_detection_config<T>(mut self, v: T) -> Self
442 where
443 T: std::convert::Into<crate::model::TextDetectionConfig>,
444 {
445 self.text_detection_config = std::option::Option::Some(v.into());
446 self
447 }
448
449 /// Sets or clears the value of [text_detection_config][crate::model::VideoContext::text_detection_config].
450 ///
451 /// # Example
452 /// ```ignore,no_run
453 /// # use google_cloud_videointelligence_v1::model::VideoContext;
454 /// use google_cloud_videointelligence_v1::model::TextDetectionConfig;
455 /// let x = VideoContext::new().set_or_clear_text_detection_config(Some(TextDetectionConfig::default()/* use setters */));
456 /// let x = VideoContext::new().set_or_clear_text_detection_config(None::<TextDetectionConfig>);
457 /// ```
458 pub fn set_or_clear_text_detection_config<T>(mut self, v: std::option::Option<T>) -> Self
459 where
460 T: std::convert::Into<crate::model::TextDetectionConfig>,
461 {
462 self.text_detection_config = v.map(|x| x.into());
463 self
464 }
465
466 /// Sets the value of [person_detection_config][crate::model::VideoContext::person_detection_config].
467 ///
468 /// # Example
469 /// ```ignore,no_run
470 /// # use google_cloud_videointelligence_v1::model::VideoContext;
471 /// use google_cloud_videointelligence_v1::model::PersonDetectionConfig;
472 /// let x = VideoContext::new().set_person_detection_config(PersonDetectionConfig::default()/* use setters */);
473 /// ```
474 pub fn set_person_detection_config<T>(mut self, v: T) -> Self
475 where
476 T: std::convert::Into<crate::model::PersonDetectionConfig>,
477 {
478 self.person_detection_config = std::option::Option::Some(v.into());
479 self
480 }
481
482 /// Sets or clears the value of [person_detection_config][crate::model::VideoContext::person_detection_config].
483 ///
484 /// # Example
485 /// ```ignore,no_run
486 /// # use google_cloud_videointelligence_v1::model::VideoContext;
487 /// use google_cloud_videointelligence_v1::model::PersonDetectionConfig;
488 /// let x = VideoContext::new().set_or_clear_person_detection_config(Some(PersonDetectionConfig::default()/* use setters */));
489 /// let x = VideoContext::new().set_or_clear_person_detection_config(None::<PersonDetectionConfig>);
490 /// ```
491 pub fn set_or_clear_person_detection_config<T>(mut self, v: std::option::Option<T>) -> Self
492 where
493 T: std::convert::Into<crate::model::PersonDetectionConfig>,
494 {
495 self.person_detection_config = v.map(|x| x.into());
496 self
497 }
498
499 /// Sets the value of [object_tracking_config][crate::model::VideoContext::object_tracking_config].
500 ///
501 /// # Example
502 /// ```ignore,no_run
503 /// # use google_cloud_videointelligence_v1::model::VideoContext;
504 /// use google_cloud_videointelligence_v1::model::ObjectTrackingConfig;
505 /// let x = VideoContext::new().set_object_tracking_config(ObjectTrackingConfig::default()/* use setters */);
506 /// ```
507 pub fn set_object_tracking_config<T>(mut self, v: T) -> Self
508 where
509 T: std::convert::Into<crate::model::ObjectTrackingConfig>,
510 {
511 self.object_tracking_config = std::option::Option::Some(v.into());
512 self
513 }
514
515 /// Sets or clears the value of [object_tracking_config][crate::model::VideoContext::object_tracking_config].
516 ///
517 /// # Example
518 /// ```ignore,no_run
519 /// # use google_cloud_videointelligence_v1::model::VideoContext;
520 /// use google_cloud_videointelligence_v1::model::ObjectTrackingConfig;
521 /// let x = VideoContext::new().set_or_clear_object_tracking_config(Some(ObjectTrackingConfig::default()/* use setters */));
522 /// let x = VideoContext::new().set_or_clear_object_tracking_config(None::<ObjectTrackingConfig>);
523 /// ```
524 pub fn set_or_clear_object_tracking_config<T>(mut self, v: std::option::Option<T>) -> Self
525 where
526 T: std::convert::Into<crate::model::ObjectTrackingConfig>,
527 {
528 self.object_tracking_config = v.map(|x| x.into());
529 self
530 }
531}
532
533impl wkt::message::Message for VideoContext {
534 fn typename() -> &'static str {
535 "type.googleapis.com/google.cloud.videointelligence.v1.VideoContext"
536 }
537}
538
539/// Config for LABEL_DETECTION.
540#[derive(Clone, Default, PartialEq)]
541#[non_exhaustive]
542pub struct LabelDetectionConfig {
543 /// What labels should be detected with LABEL_DETECTION, in addition to
544 /// video-level labels or segment-level labels.
545 /// If unspecified, defaults to `SHOT_MODE`.
546 pub label_detection_mode: crate::model::LabelDetectionMode,
547
548 /// Whether the video has been shot from a stationary (i.e., non-moving)
549 /// camera. When set to true, might improve detection accuracy for moving
550 /// objects. Should be used with `SHOT_AND_FRAME_MODE` enabled.
551 pub stationary_camera: bool,
552
553 /// Model to use for label detection.
554 /// Supported values: "builtin/stable" (the default if unset) and
555 /// "builtin/latest".
556 pub model: std::string::String,
557
558 /// The confidence threshold we perform filtering on the labels from
559 /// frame-level detection. If not set, it is set to 0.4 by default. The valid
560 /// range for this threshold is [0.1, 0.9]. Any value set outside of this
561 /// range will be clipped.
562 /// Note: For best results, follow the default threshold. We will update
563 /// the default threshold everytime when we release a new model.
564 pub frame_confidence_threshold: f32,
565
566 /// The confidence threshold we perform filtering on the labels from
567 /// video-level and shot-level detections. If not set, it's set to 0.3 by
568 /// default. The valid range for this threshold is [0.1, 0.9]. Any value set
569 /// outside of this range will be clipped.
570 /// Note: For best results, follow the default threshold. We will update
571 /// the default threshold everytime when we release a new model.
572 pub video_confidence_threshold: f32,
573
574 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
575}
576
577impl LabelDetectionConfig {
578 /// Creates a new default instance.
579 pub fn new() -> Self {
580 std::default::Default::default()
581 }
582
583 /// Sets the value of [label_detection_mode][crate::model::LabelDetectionConfig::label_detection_mode].
584 ///
585 /// # Example
586 /// ```ignore,no_run
587 /// # use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
588 /// use google_cloud_videointelligence_v1::model::LabelDetectionMode;
589 /// let x0 = LabelDetectionConfig::new().set_label_detection_mode(LabelDetectionMode::ShotMode);
590 /// let x1 = LabelDetectionConfig::new().set_label_detection_mode(LabelDetectionMode::FrameMode);
591 /// let x2 = LabelDetectionConfig::new().set_label_detection_mode(LabelDetectionMode::ShotAndFrameMode);
592 /// ```
593 pub fn set_label_detection_mode<T: std::convert::Into<crate::model::LabelDetectionMode>>(
594 mut self,
595 v: T,
596 ) -> Self {
597 self.label_detection_mode = v.into();
598 self
599 }
600
601 /// Sets the value of [stationary_camera][crate::model::LabelDetectionConfig::stationary_camera].
602 ///
603 /// # Example
604 /// ```ignore,no_run
605 /// # use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
606 /// let x = LabelDetectionConfig::new().set_stationary_camera(true);
607 /// ```
608 pub fn set_stationary_camera<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
609 self.stationary_camera = v.into();
610 self
611 }
612
613 /// Sets the value of [model][crate::model::LabelDetectionConfig::model].
614 ///
615 /// # Example
616 /// ```ignore,no_run
617 /// # use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
618 /// let x = LabelDetectionConfig::new().set_model("example");
619 /// ```
620 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
621 self.model = v.into();
622 self
623 }
624
625 /// Sets the value of [frame_confidence_threshold][crate::model::LabelDetectionConfig::frame_confidence_threshold].
626 ///
627 /// # Example
628 /// ```ignore,no_run
629 /// # use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
630 /// let x = LabelDetectionConfig::new().set_frame_confidence_threshold(42.0);
631 /// ```
632 pub fn set_frame_confidence_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
633 self.frame_confidence_threshold = v.into();
634 self
635 }
636
637 /// Sets the value of [video_confidence_threshold][crate::model::LabelDetectionConfig::video_confidence_threshold].
638 ///
639 /// # Example
640 /// ```ignore,no_run
641 /// # use google_cloud_videointelligence_v1::model::LabelDetectionConfig;
642 /// let x = LabelDetectionConfig::new().set_video_confidence_threshold(42.0);
643 /// ```
644 pub fn set_video_confidence_threshold<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
645 self.video_confidence_threshold = v.into();
646 self
647 }
648}
649
650impl wkt::message::Message for LabelDetectionConfig {
651 fn typename() -> &'static str {
652 "type.googleapis.com/google.cloud.videointelligence.v1.LabelDetectionConfig"
653 }
654}
655
656/// Config for SHOT_CHANGE_DETECTION.
657#[derive(Clone, Default, PartialEq)]
658#[non_exhaustive]
659pub struct ShotChangeDetectionConfig {
660 /// Model to use for shot change detection.
661 /// Supported values: "builtin/stable" (the default if unset) and
662 /// "builtin/latest".
663 pub model: std::string::String,
664
665 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
666}
667
668impl ShotChangeDetectionConfig {
669 /// Creates a new default instance.
670 pub fn new() -> Self {
671 std::default::Default::default()
672 }
673
674 /// Sets the value of [model][crate::model::ShotChangeDetectionConfig::model].
675 ///
676 /// # Example
677 /// ```ignore,no_run
678 /// # use google_cloud_videointelligence_v1::model::ShotChangeDetectionConfig;
679 /// let x = ShotChangeDetectionConfig::new().set_model("example");
680 /// ```
681 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
682 self.model = v.into();
683 self
684 }
685}
686
687impl wkt::message::Message for ShotChangeDetectionConfig {
688 fn typename() -> &'static str {
689 "type.googleapis.com/google.cloud.videointelligence.v1.ShotChangeDetectionConfig"
690 }
691}
692
693/// Config for OBJECT_TRACKING.
694#[derive(Clone, Default, PartialEq)]
695#[non_exhaustive]
696pub struct ObjectTrackingConfig {
697 /// Model to use for object tracking.
698 /// Supported values: "builtin/stable" (the default if unset) and
699 /// "builtin/latest".
700 pub model: std::string::String,
701
702 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
703}
704
705impl ObjectTrackingConfig {
706 /// Creates a new default instance.
707 pub fn new() -> Self {
708 std::default::Default::default()
709 }
710
711 /// Sets the value of [model][crate::model::ObjectTrackingConfig::model].
712 ///
713 /// # Example
714 /// ```ignore,no_run
715 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingConfig;
716 /// let x = ObjectTrackingConfig::new().set_model("example");
717 /// ```
718 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
719 self.model = v.into();
720 self
721 }
722}
723
724impl wkt::message::Message for ObjectTrackingConfig {
725 fn typename() -> &'static str {
726 "type.googleapis.com/google.cloud.videointelligence.v1.ObjectTrackingConfig"
727 }
728}
729
730/// Config for FACE_DETECTION.
731#[derive(Clone, Default, PartialEq)]
732#[non_exhaustive]
733pub struct FaceDetectionConfig {
734 /// Model to use for face detection.
735 /// Supported values: "builtin/stable" (the default if unset) and
736 /// "builtin/latest".
737 pub model: std::string::String,
738
739 /// Whether bounding boxes are included in the face annotation output.
740 pub include_bounding_boxes: bool,
741
742 /// Whether to enable face attributes detection, such as glasses, dark_glasses,
743 /// mouth_open etc. Ignored if 'include_bounding_boxes' is set to false.
744 pub include_attributes: bool,
745
746 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
747}
748
749impl FaceDetectionConfig {
750 /// Creates a new default instance.
751 pub fn new() -> Self {
752 std::default::Default::default()
753 }
754
755 /// Sets the value of [model][crate::model::FaceDetectionConfig::model].
756 ///
757 /// # Example
758 /// ```ignore,no_run
759 /// # use google_cloud_videointelligence_v1::model::FaceDetectionConfig;
760 /// let x = FaceDetectionConfig::new().set_model("example");
761 /// ```
762 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
763 self.model = v.into();
764 self
765 }
766
767 /// Sets the value of [include_bounding_boxes][crate::model::FaceDetectionConfig::include_bounding_boxes].
768 ///
769 /// # Example
770 /// ```ignore,no_run
771 /// # use google_cloud_videointelligence_v1::model::FaceDetectionConfig;
772 /// let x = FaceDetectionConfig::new().set_include_bounding_boxes(true);
773 /// ```
774 pub fn set_include_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
775 self.include_bounding_boxes = v.into();
776 self
777 }
778
779 /// Sets the value of [include_attributes][crate::model::FaceDetectionConfig::include_attributes].
780 ///
781 /// # Example
782 /// ```ignore,no_run
783 /// # use google_cloud_videointelligence_v1::model::FaceDetectionConfig;
784 /// let x = FaceDetectionConfig::new().set_include_attributes(true);
785 /// ```
786 pub fn set_include_attributes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
787 self.include_attributes = v.into();
788 self
789 }
790}
791
792impl wkt::message::Message for FaceDetectionConfig {
793 fn typename() -> &'static str {
794 "type.googleapis.com/google.cloud.videointelligence.v1.FaceDetectionConfig"
795 }
796}
797
798/// Config for PERSON_DETECTION.
799#[derive(Clone, Default, PartialEq)]
800#[non_exhaustive]
801pub struct PersonDetectionConfig {
802 /// Whether bounding boxes are included in the person detection annotation
803 /// output.
804 pub include_bounding_boxes: bool,
805
806 /// Whether to enable pose landmarks detection. Ignored if
807 /// 'include_bounding_boxes' is set to false.
808 pub include_pose_landmarks: bool,
809
810 /// Whether to enable person attributes detection, such as cloth color (black,
811 /// blue, etc), type (coat, dress, etc), pattern (plain, floral, etc), hair,
812 /// etc.
813 /// Ignored if 'include_bounding_boxes' is set to false.
814 pub include_attributes: bool,
815
816 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
817}
818
819impl PersonDetectionConfig {
820 /// Creates a new default instance.
821 pub fn new() -> Self {
822 std::default::Default::default()
823 }
824
825 /// Sets the value of [include_bounding_boxes][crate::model::PersonDetectionConfig::include_bounding_boxes].
826 ///
827 /// # Example
828 /// ```ignore,no_run
829 /// # use google_cloud_videointelligence_v1::model::PersonDetectionConfig;
830 /// let x = PersonDetectionConfig::new().set_include_bounding_boxes(true);
831 /// ```
832 pub fn set_include_bounding_boxes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
833 self.include_bounding_boxes = v.into();
834 self
835 }
836
837 /// Sets the value of [include_pose_landmarks][crate::model::PersonDetectionConfig::include_pose_landmarks].
838 ///
839 /// # Example
840 /// ```ignore,no_run
841 /// # use google_cloud_videointelligence_v1::model::PersonDetectionConfig;
842 /// let x = PersonDetectionConfig::new().set_include_pose_landmarks(true);
843 /// ```
844 pub fn set_include_pose_landmarks<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
845 self.include_pose_landmarks = v.into();
846 self
847 }
848
849 /// Sets the value of [include_attributes][crate::model::PersonDetectionConfig::include_attributes].
850 ///
851 /// # Example
852 /// ```ignore,no_run
853 /// # use google_cloud_videointelligence_v1::model::PersonDetectionConfig;
854 /// let x = PersonDetectionConfig::new().set_include_attributes(true);
855 /// ```
856 pub fn set_include_attributes<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
857 self.include_attributes = v.into();
858 self
859 }
860}
861
862impl wkt::message::Message for PersonDetectionConfig {
863 fn typename() -> &'static str {
864 "type.googleapis.com/google.cloud.videointelligence.v1.PersonDetectionConfig"
865 }
866}
867
868/// Config for EXPLICIT_CONTENT_DETECTION.
869#[derive(Clone, Default, PartialEq)]
870#[non_exhaustive]
871pub struct ExplicitContentDetectionConfig {
872 /// Model to use for explicit content detection.
873 /// Supported values: "builtin/stable" (the default if unset) and
874 /// "builtin/latest".
875 pub model: std::string::String,
876
877 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
878}
879
880impl ExplicitContentDetectionConfig {
881 /// Creates a new default instance.
882 pub fn new() -> Self {
883 std::default::Default::default()
884 }
885
886 /// Sets the value of [model][crate::model::ExplicitContentDetectionConfig::model].
887 ///
888 /// # Example
889 /// ```ignore,no_run
890 /// # use google_cloud_videointelligence_v1::model::ExplicitContentDetectionConfig;
891 /// let x = ExplicitContentDetectionConfig::new().set_model("example");
892 /// ```
893 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
894 self.model = v.into();
895 self
896 }
897}
898
899impl wkt::message::Message for ExplicitContentDetectionConfig {
900 fn typename() -> &'static str {
901 "type.googleapis.com/google.cloud.videointelligence.v1.ExplicitContentDetectionConfig"
902 }
903}
904
905/// Config for TEXT_DETECTION.
906#[derive(Clone, Default, PartialEq)]
907#[non_exhaustive]
908pub struct TextDetectionConfig {
909 /// Language hint can be specified if the language to be detected is known a
910 /// priori. It can increase the accuracy of the detection. Language hint must
911 /// be language code in BCP-47 format.
912 ///
913 /// Automatic language detection is performed if no hint is provided.
914 pub language_hints: std::vec::Vec<std::string::String>,
915
916 /// Model to use for text detection.
917 /// Supported values: "builtin/stable" (the default if unset) and
918 /// "builtin/latest".
919 pub model: std::string::String,
920
921 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
922}
923
924impl TextDetectionConfig {
925 /// Creates a new default instance.
926 pub fn new() -> Self {
927 std::default::Default::default()
928 }
929
930 /// Sets the value of [language_hints][crate::model::TextDetectionConfig::language_hints].
931 ///
932 /// # Example
933 /// ```ignore,no_run
934 /// # use google_cloud_videointelligence_v1::model::TextDetectionConfig;
935 /// let x = TextDetectionConfig::new().set_language_hints(["a", "b", "c"]);
936 /// ```
937 pub fn set_language_hints<T, V>(mut self, v: T) -> Self
938 where
939 T: std::iter::IntoIterator<Item = V>,
940 V: std::convert::Into<std::string::String>,
941 {
942 use std::iter::Iterator;
943 self.language_hints = v.into_iter().map(|i| i.into()).collect();
944 self
945 }
946
947 /// Sets the value of [model][crate::model::TextDetectionConfig::model].
948 ///
949 /// # Example
950 /// ```ignore,no_run
951 /// # use google_cloud_videointelligence_v1::model::TextDetectionConfig;
952 /// let x = TextDetectionConfig::new().set_model("example");
953 /// ```
954 pub fn set_model<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
955 self.model = v.into();
956 self
957 }
958}
959
960impl wkt::message::Message for TextDetectionConfig {
961 fn typename() -> &'static str {
962 "type.googleapis.com/google.cloud.videointelligence.v1.TextDetectionConfig"
963 }
964}
965
966/// Video segment.
967#[derive(Clone, Default, PartialEq)]
968#[non_exhaustive]
969pub struct VideoSegment {
970 /// Time-offset, relative to the beginning of the video,
971 /// corresponding to the start of the segment (inclusive).
972 pub start_time_offset: std::option::Option<wkt::Duration>,
973
974 /// Time-offset, relative to the beginning of the video,
975 /// corresponding to the end of the segment (inclusive).
976 pub end_time_offset: std::option::Option<wkt::Duration>,
977
978 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
979}
980
981impl VideoSegment {
982 /// Creates a new default instance.
983 pub fn new() -> Self {
984 std::default::Default::default()
985 }
986
987 /// Sets the value of [start_time_offset][crate::model::VideoSegment::start_time_offset].
988 ///
989 /// # Example
990 /// ```ignore,no_run
991 /// # use google_cloud_videointelligence_v1::model::VideoSegment;
992 /// use wkt::Duration;
993 /// let x = VideoSegment::new().set_start_time_offset(Duration::default()/* use setters */);
994 /// ```
995 pub fn set_start_time_offset<T>(mut self, v: T) -> Self
996 where
997 T: std::convert::Into<wkt::Duration>,
998 {
999 self.start_time_offset = std::option::Option::Some(v.into());
1000 self
1001 }
1002
1003 /// Sets or clears the value of [start_time_offset][crate::model::VideoSegment::start_time_offset].
1004 ///
1005 /// # Example
1006 /// ```ignore,no_run
1007 /// # use google_cloud_videointelligence_v1::model::VideoSegment;
1008 /// use wkt::Duration;
1009 /// let x = VideoSegment::new().set_or_clear_start_time_offset(Some(Duration::default()/* use setters */));
1010 /// let x = VideoSegment::new().set_or_clear_start_time_offset(None::<Duration>);
1011 /// ```
1012 pub fn set_or_clear_start_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
1013 where
1014 T: std::convert::Into<wkt::Duration>,
1015 {
1016 self.start_time_offset = v.map(|x| x.into());
1017 self
1018 }
1019
1020 /// Sets the value of [end_time_offset][crate::model::VideoSegment::end_time_offset].
1021 ///
1022 /// # Example
1023 /// ```ignore,no_run
1024 /// # use google_cloud_videointelligence_v1::model::VideoSegment;
1025 /// use wkt::Duration;
1026 /// let x = VideoSegment::new().set_end_time_offset(Duration::default()/* use setters */);
1027 /// ```
1028 pub fn set_end_time_offset<T>(mut self, v: T) -> Self
1029 where
1030 T: std::convert::Into<wkt::Duration>,
1031 {
1032 self.end_time_offset = std::option::Option::Some(v.into());
1033 self
1034 }
1035
1036 /// Sets or clears the value of [end_time_offset][crate::model::VideoSegment::end_time_offset].
1037 ///
1038 /// # Example
1039 /// ```ignore,no_run
1040 /// # use google_cloud_videointelligence_v1::model::VideoSegment;
1041 /// use wkt::Duration;
1042 /// let x = VideoSegment::new().set_or_clear_end_time_offset(Some(Duration::default()/* use setters */));
1043 /// let x = VideoSegment::new().set_or_clear_end_time_offset(None::<Duration>);
1044 /// ```
1045 pub fn set_or_clear_end_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
1046 where
1047 T: std::convert::Into<wkt::Duration>,
1048 {
1049 self.end_time_offset = v.map(|x| x.into());
1050 self
1051 }
1052}
1053
1054impl wkt::message::Message for VideoSegment {
1055 fn typename() -> &'static str {
1056 "type.googleapis.com/google.cloud.videointelligence.v1.VideoSegment"
1057 }
1058}
1059
1060/// Video segment level annotation results for label detection.
1061#[derive(Clone, Default, PartialEq)]
1062#[non_exhaustive]
1063pub struct LabelSegment {
1064 /// Video segment where a label was detected.
1065 pub segment: std::option::Option<crate::model::VideoSegment>,
1066
1067 /// Confidence that the label is accurate. Range: [0, 1].
1068 pub confidence: f32,
1069
1070 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1071}
1072
1073impl LabelSegment {
1074 /// Creates a new default instance.
1075 pub fn new() -> Self {
1076 std::default::Default::default()
1077 }
1078
1079 /// Sets the value of [segment][crate::model::LabelSegment::segment].
1080 ///
1081 /// # Example
1082 /// ```ignore,no_run
1083 /// # use google_cloud_videointelligence_v1::model::LabelSegment;
1084 /// use google_cloud_videointelligence_v1::model::VideoSegment;
1085 /// let x = LabelSegment::new().set_segment(VideoSegment::default()/* use setters */);
1086 /// ```
1087 pub fn set_segment<T>(mut self, v: T) -> Self
1088 where
1089 T: std::convert::Into<crate::model::VideoSegment>,
1090 {
1091 self.segment = std::option::Option::Some(v.into());
1092 self
1093 }
1094
1095 /// Sets or clears the value of [segment][crate::model::LabelSegment::segment].
1096 ///
1097 /// # Example
1098 /// ```ignore,no_run
1099 /// # use google_cloud_videointelligence_v1::model::LabelSegment;
1100 /// use google_cloud_videointelligence_v1::model::VideoSegment;
1101 /// let x = LabelSegment::new().set_or_clear_segment(Some(VideoSegment::default()/* use setters */));
1102 /// let x = LabelSegment::new().set_or_clear_segment(None::<VideoSegment>);
1103 /// ```
1104 pub fn set_or_clear_segment<T>(mut self, v: std::option::Option<T>) -> Self
1105 where
1106 T: std::convert::Into<crate::model::VideoSegment>,
1107 {
1108 self.segment = v.map(|x| x.into());
1109 self
1110 }
1111
1112 /// Sets the value of [confidence][crate::model::LabelSegment::confidence].
1113 ///
1114 /// # Example
1115 /// ```ignore,no_run
1116 /// # use google_cloud_videointelligence_v1::model::LabelSegment;
1117 /// let x = LabelSegment::new().set_confidence(42.0);
1118 /// ```
1119 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1120 self.confidence = v.into();
1121 self
1122 }
1123}
1124
1125impl wkt::message::Message for LabelSegment {
1126 fn typename() -> &'static str {
1127 "type.googleapis.com/google.cloud.videointelligence.v1.LabelSegment"
1128 }
1129}
1130
1131/// Video frame level annotation results for label detection.
1132#[derive(Clone, Default, PartialEq)]
1133#[non_exhaustive]
1134pub struct LabelFrame {
1135 /// Time-offset, relative to the beginning of the video, corresponding to the
1136 /// video frame for this location.
1137 pub time_offset: std::option::Option<wkt::Duration>,
1138
1139 /// Confidence that the label is accurate. Range: [0, 1].
1140 pub confidence: f32,
1141
1142 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1143}
1144
1145impl LabelFrame {
1146 /// Creates a new default instance.
1147 pub fn new() -> Self {
1148 std::default::Default::default()
1149 }
1150
1151 /// Sets the value of [time_offset][crate::model::LabelFrame::time_offset].
1152 ///
1153 /// # Example
1154 /// ```ignore,no_run
1155 /// # use google_cloud_videointelligence_v1::model::LabelFrame;
1156 /// use wkt::Duration;
1157 /// let x = LabelFrame::new().set_time_offset(Duration::default()/* use setters */);
1158 /// ```
1159 pub fn set_time_offset<T>(mut self, v: T) -> Self
1160 where
1161 T: std::convert::Into<wkt::Duration>,
1162 {
1163 self.time_offset = std::option::Option::Some(v.into());
1164 self
1165 }
1166
1167 /// Sets or clears the value of [time_offset][crate::model::LabelFrame::time_offset].
1168 ///
1169 /// # Example
1170 /// ```ignore,no_run
1171 /// # use google_cloud_videointelligence_v1::model::LabelFrame;
1172 /// use wkt::Duration;
1173 /// let x = LabelFrame::new().set_or_clear_time_offset(Some(Duration::default()/* use setters */));
1174 /// let x = LabelFrame::new().set_or_clear_time_offset(None::<Duration>);
1175 /// ```
1176 pub fn set_or_clear_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
1177 where
1178 T: std::convert::Into<wkt::Duration>,
1179 {
1180 self.time_offset = v.map(|x| x.into());
1181 self
1182 }
1183
1184 /// Sets the value of [confidence][crate::model::LabelFrame::confidence].
1185 ///
1186 /// # Example
1187 /// ```ignore,no_run
1188 /// # use google_cloud_videointelligence_v1::model::LabelFrame;
1189 /// let x = LabelFrame::new().set_confidence(42.0);
1190 /// ```
1191 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1192 self.confidence = v.into();
1193 self
1194 }
1195}
1196
1197impl wkt::message::Message for LabelFrame {
1198 fn typename() -> &'static str {
1199 "type.googleapis.com/google.cloud.videointelligence.v1.LabelFrame"
1200 }
1201}
1202
1203/// Detected entity from video analysis.
1204#[derive(Clone, Default, PartialEq)]
1205#[non_exhaustive]
1206pub struct Entity {
1207 /// Opaque entity ID. Some IDs may be available in
1208 /// [Google Knowledge Graph Search
1209 /// API](https://developers.google.com/knowledge-graph/).
1210 pub entity_id: std::string::String,
1211
1212 /// Textual description, e.g., `Fixed-gear bicycle`.
1213 pub description: std::string::String,
1214
1215 /// Language code for `description` in BCP-47 format.
1216 pub language_code: std::string::String,
1217
1218 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1219}
1220
1221impl Entity {
1222 /// Creates a new default instance.
1223 pub fn new() -> Self {
1224 std::default::Default::default()
1225 }
1226
1227 /// Sets the value of [entity_id][crate::model::Entity::entity_id].
1228 ///
1229 /// # Example
1230 /// ```ignore,no_run
1231 /// # use google_cloud_videointelligence_v1::model::Entity;
1232 /// let x = Entity::new().set_entity_id("example");
1233 /// ```
1234 pub fn set_entity_id<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1235 self.entity_id = v.into();
1236 self
1237 }
1238
1239 /// Sets the value of [description][crate::model::Entity::description].
1240 ///
1241 /// # Example
1242 /// ```ignore,no_run
1243 /// # use google_cloud_videointelligence_v1::model::Entity;
1244 /// let x = Entity::new().set_description("example");
1245 /// ```
1246 pub fn set_description<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1247 self.description = v.into();
1248 self
1249 }
1250
1251 /// Sets the value of [language_code][crate::model::Entity::language_code].
1252 ///
1253 /// # Example
1254 /// ```ignore,no_run
1255 /// # use google_cloud_videointelligence_v1::model::Entity;
1256 /// let x = Entity::new().set_language_code("example");
1257 /// ```
1258 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1259 self.language_code = v.into();
1260 self
1261 }
1262}
1263
1264impl wkt::message::Message for Entity {
1265 fn typename() -> &'static str {
1266 "type.googleapis.com/google.cloud.videointelligence.v1.Entity"
1267 }
1268}
1269
1270/// Label annotation.
1271#[derive(Clone, Default, PartialEq)]
1272#[non_exhaustive]
1273pub struct LabelAnnotation {
1274 /// Detected entity.
1275 pub entity: std::option::Option<crate::model::Entity>,
1276
1277 /// Common categories for the detected entity.
1278 /// For example, when the label is `Terrier`, the category is likely `dog`. And
1279 /// in some cases there might be more than one categories e.g., `Terrier` could
1280 /// also be a `pet`.
1281 pub category_entities: std::vec::Vec<crate::model::Entity>,
1282
1283 /// All video segments where a label was detected.
1284 pub segments: std::vec::Vec<crate::model::LabelSegment>,
1285
1286 /// All video frames where a label was detected.
1287 pub frames: std::vec::Vec<crate::model::LabelFrame>,
1288
1289 /// Feature version.
1290 pub version: std::string::String,
1291
1292 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1293}
1294
1295impl LabelAnnotation {
1296 /// Creates a new default instance.
1297 pub fn new() -> Self {
1298 std::default::Default::default()
1299 }
1300
1301 /// Sets the value of [entity][crate::model::LabelAnnotation::entity].
1302 ///
1303 /// # Example
1304 /// ```ignore,no_run
1305 /// # use google_cloud_videointelligence_v1::model::LabelAnnotation;
1306 /// use google_cloud_videointelligence_v1::model::Entity;
1307 /// let x = LabelAnnotation::new().set_entity(Entity::default()/* use setters */);
1308 /// ```
1309 pub fn set_entity<T>(mut self, v: T) -> Self
1310 where
1311 T: std::convert::Into<crate::model::Entity>,
1312 {
1313 self.entity = std::option::Option::Some(v.into());
1314 self
1315 }
1316
1317 /// Sets or clears the value of [entity][crate::model::LabelAnnotation::entity].
1318 ///
1319 /// # Example
1320 /// ```ignore,no_run
1321 /// # use google_cloud_videointelligence_v1::model::LabelAnnotation;
1322 /// use google_cloud_videointelligence_v1::model::Entity;
1323 /// let x = LabelAnnotation::new().set_or_clear_entity(Some(Entity::default()/* use setters */));
1324 /// let x = LabelAnnotation::new().set_or_clear_entity(None::<Entity>);
1325 /// ```
1326 pub fn set_or_clear_entity<T>(mut self, v: std::option::Option<T>) -> Self
1327 where
1328 T: std::convert::Into<crate::model::Entity>,
1329 {
1330 self.entity = v.map(|x| x.into());
1331 self
1332 }
1333
1334 /// Sets the value of [category_entities][crate::model::LabelAnnotation::category_entities].
1335 ///
1336 /// # Example
1337 /// ```ignore,no_run
1338 /// # use google_cloud_videointelligence_v1::model::LabelAnnotation;
1339 /// use google_cloud_videointelligence_v1::model::Entity;
1340 /// let x = LabelAnnotation::new()
1341 /// .set_category_entities([
1342 /// Entity::default()/* use setters */,
1343 /// Entity::default()/* use (different) setters */,
1344 /// ]);
1345 /// ```
1346 pub fn set_category_entities<T, V>(mut self, v: T) -> Self
1347 where
1348 T: std::iter::IntoIterator<Item = V>,
1349 V: std::convert::Into<crate::model::Entity>,
1350 {
1351 use std::iter::Iterator;
1352 self.category_entities = v.into_iter().map(|i| i.into()).collect();
1353 self
1354 }
1355
1356 /// Sets the value of [segments][crate::model::LabelAnnotation::segments].
1357 ///
1358 /// # Example
1359 /// ```ignore,no_run
1360 /// # use google_cloud_videointelligence_v1::model::LabelAnnotation;
1361 /// use google_cloud_videointelligence_v1::model::LabelSegment;
1362 /// let x = LabelAnnotation::new()
1363 /// .set_segments([
1364 /// LabelSegment::default()/* use setters */,
1365 /// LabelSegment::default()/* use (different) setters */,
1366 /// ]);
1367 /// ```
1368 pub fn set_segments<T, V>(mut self, v: T) -> Self
1369 where
1370 T: std::iter::IntoIterator<Item = V>,
1371 V: std::convert::Into<crate::model::LabelSegment>,
1372 {
1373 use std::iter::Iterator;
1374 self.segments = v.into_iter().map(|i| i.into()).collect();
1375 self
1376 }
1377
1378 /// Sets the value of [frames][crate::model::LabelAnnotation::frames].
1379 ///
1380 /// # Example
1381 /// ```ignore,no_run
1382 /// # use google_cloud_videointelligence_v1::model::LabelAnnotation;
1383 /// use google_cloud_videointelligence_v1::model::LabelFrame;
1384 /// let x = LabelAnnotation::new()
1385 /// .set_frames([
1386 /// LabelFrame::default()/* use setters */,
1387 /// LabelFrame::default()/* use (different) setters */,
1388 /// ]);
1389 /// ```
1390 pub fn set_frames<T, V>(mut self, v: T) -> Self
1391 where
1392 T: std::iter::IntoIterator<Item = V>,
1393 V: std::convert::Into<crate::model::LabelFrame>,
1394 {
1395 use std::iter::Iterator;
1396 self.frames = v.into_iter().map(|i| i.into()).collect();
1397 self
1398 }
1399
1400 /// Sets the value of [version][crate::model::LabelAnnotation::version].
1401 ///
1402 /// # Example
1403 /// ```ignore,no_run
1404 /// # use google_cloud_videointelligence_v1::model::LabelAnnotation;
1405 /// let x = LabelAnnotation::new().set_version("example");
1406 /// ```
1407 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1408 self.version = v.into();
1409 self
1410 }
1411}
1412
1413impl wkt::message::Message for LabelAnnotation {
1414 fn typename() -> &'static str {
1415 "type.googleapis.com/google.cloud.videointelligence.v1.LabelAnnotation"
1416 }
1417}
1418
1419/// Video frame level annotation results for explicit content.
1420#[derive(Clone, Default, PartialEq)]
1421#[non_exhaustive]
1422pub struct ExplicitContentFrame {
1423 /// Time-offset, relative to the beginning of the video, corresponding to the
1424 /// video frame for this location.
1425 pub time_offset: std::option::Option<wkt::Duration>,
1426
1427 /// Likelihood of the pornography content..
1428 pub pornography_likelihood: crate::model::Likelihood,
1429
1430 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1431}
1432
1433impl ExplicitContentFrame {
1434 /// Creates a new default instance.
1435 pub fn new() -> Self {
1436 std::default::Default::default()
1437 }
1438
1439 /// Sets the value of [time_offset][crate::model::ExplicitContentFrame::time_offset].
1440 ///
1441 /// # Example
1442 /// ```ignore,no_run
1443 /// # use google_cloud_videointelligence_v1::model::ExplicitContentFrame;
1444 /// use wkt::Duration;
1445 /// let x = ExplicitContentFrame::new().set_time_offset(Duration::default()/* use setters */);
1446 /// ```
1447 pub fn set_time_offset<T>(mut self, v: T) -> Self
1448 where
1449 T: std::convert::Into<wkt::Duration>,
1450 {
1451 self.time_offset = std::option::Option::Some(v.into());
1452 self
1453 }
1454
1455 /// Sets or clears the value of [time_offset][crate::model::ExplicitContentFrame::time_offset].
1456 ///
1457 /// # Example
1458 /// ```ignore,no_run
1459 /// # use google_cloud_videointelligence_v1::model::ExplicitContentFrame;
1460 /// use wkt::Duration;
1461 /// let x = ExplicitContentFrame::new().set_or_clear_time_offset(Some(Duration::default()/* use setters */));
1462 /// let x = ExplicitContentFrame::new().set_or_clear_time_offset(None::<Duration>);
1463 /// ```
1464 pub fn set_or_clear_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
1465 where
1466 T: std::convert::Into<wkt::Duration>,
1467 {
1468 self.time_offset = v.map(|x| x.into());
1469 self
1470 }
1471
1472 /// Sets the value of [pornography_likelihood][crate::model::ExplicitContentFrame::pornography_likelihood].
1473 ///
1474 /// # Example
1475 /// ```ignore,no_run
1476 /// # use google_cloud_videointelligence_v1::model::ExplicitContentFrame;
1477 /// use google_cloud_videointelligence_v1::model::Likelihood;
1478 /// let x0 = ExplicitContentFrame::new().set_pornography_likelihood(Likelihood::VeryUnlikely);
1479 /// let x1 = ExplicitContentFrame::new().set_pornography_likelihood(Likelihood::Unlikely);
1480 /// let x2 = ExplicitContentFrame::new().set_pornography_likelihood(Likelihood::Possible);
1481 /// ```
1482 pub fn set_pornography_likelihood<T: std::convert::Into<crate::model::Likelihood>>(
1483 mut self,
1484 v: T,
1485 ) -> Self {
1486 self.pornography_likelihood = v.into();
1487 self
1488 }
1489}
1490
1491impl wkt::message::Message for ExplicitContentFrame {
1492 fn typename() -> &'static str {
1493 "type.googleapis.com/google.cloud.videointelligence.v1.ExplicitContentFrame"
1494 }
1495}
1496
1497/// Explicit content annotation (based on per-frame visual signals only).
1498/// If no explicit content has been detected in a frame, no annotations are
1499/// present for that frame.
1500#[derive(Clone, Default, PartialEq)]
1501#[non_exhaustive]
1502pub struct ExplicitContentAnnotation {
1503 /// All video frames where explicit content was detected.
1504 pub frames: std::vec::Vec<crate::model::ExplicitContentFrame>,
1505
1506 /// Feature version.
1507 pub version: std::string::String,
1508
1509 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1510}
1511
1512impl ExplicitContentAnnotation {
1513 /// Creates a new default instance.
1514 pub fn new() -> Self {
1515 std::default::Default::default()
1516 }
1517
1518 /// Sets the value of [frames][crate::model::ExplicitContentAnnotation::frames].
1519 ///
1520 /// # Example
1521 /// ```ignore,no_run
1522 /// # use google_cloud_videointelligence_v1::model::ExplicitContentAnnotation;
1523 /// use google_cloud_videointelligence_v1::model::ExplicitContentFrame;
1524 /// let x = ExplicitContentAnnotation::new()
1525 /// .set_frames([
1526 /// ExplicitContentFrame::default()/* use setters */,
1527 /// ExplicitContentFrame::default()/* use (different) setters */,
1528 /// ]);
1529 /// ```
1530 pub fn set_frames<T, V>(mut self, v: T) -> Self
1531 where
1532 T: std::iter::IntoIterator<Item = V>,
1533 V: std::convert::Into<crate::model::ExplicitContentFrame>,
1534 {
1535 use std::iter::Iterator;
1536 self.frames = v.into_iter().map(|i| i.into()).collect();
1537 self
1538 }
1539
1540 /// Sets the value of [version][crate::model::ExplicitContentAnnotation::version].
1541 ///
1542 /// # Example
1543 /// ```ignore,no_run
1544 /// # use google_cloud_videointelligence_v1::model::ExplicitContentAnnotation;
1545 /// let x = ExplicitContentAnnotation::new().set_version("example");
1546 /// ```
1547 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1548 self.version = v.into();
1549 self
1550 }
1551}
1552
1553impl wkt::message::Message for ExplicitContentAnnotation {
1554 fn typename() -> &'static str {
1555 "type.googleapis.com/google.cloud.videointelligence.v1.ExplicitContentAnnotation"
1556 }
1557}
1558
1559/// Normalized bounding box.
1560/// The normalized vertex coordinates are relative to the original image.
1561/// Range: [0, 1].
1562#[derive(Clone, Default, PartialEq)]
1563#[non_exhaustive]
1564pub struct NormalizedBoundingBox {
1565 /// Left X coordinate.
1566 pub left: f32,
1567
1568 /// Top Y coordinate.
1569 pub top: f32,
1570
1571 /// Right X coordinate.
1572 pub right: f32,
1573
1574 /// Bottom Y coordinate.
1575 pub bottom: f32,
1576
1577 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1578}
1579
1580impl NormalizedBoundingBox {
1581 /// Creates a new default instance.
1582 pub fn new() -> Self {
1583 std::default::Default::default()
1584 }
1585
1586 /// Sets the value of [left][crate::model::NormalizedBoundingBox::left].
1587 ///
1588 /// # Example
1589 /// ```ignore,no_run
1590 /// # use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
1591 /// let x = NormalizedBoundingBox::new().set_left(42.0);
1592 /// ```
1593 pub fn set_left<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1594 self.left = v.into();
1595 self
1596 }
1597
1598 /// Sets the value of [top][crate::model::NormalizedBoundingBox::top].
1599 ///
1600 /// # Example
1601 /// ```ignore,no_run
1602 /// # use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
1603 /// let x = NormalizedBoundingBox::new().set_top(42.0);
1604 /// ```
1605 pub fn set_top<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1606 self.top = v.into();
1607 self
1608 }
1609
1610 /// Sets the value of [right][crate::model::NormalizedBoundingBox::right].
1611 ///
1612 /// # Example
1613 /// ```ignore,no_run
1614 /// # use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
1615 /// let x = NormalizedBoundingBox::new().set_right(42.0);
1616 /// ```
1617 pub fn set_right<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1618 self.right = v.into();
1619 self
1620 }
1621
1622 /// Sets the value of [bottom][crate::model::NormalizedBoundingBox::bottom].
1623 ///
1624 /// # Example
1625 /// ```ignore,no_run
1626 /// # use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
1627 /// let x = NormalizedBoundingBox::new().set_bottom(42.0);
1628 /// ```
1629 pub fn set_bottom<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
1630 self.bottom = v.into();
1631 self
1632 }
1633}
1634
1635impl wkt::message::Message for NormalizedBoundingBox {
1636 fn typename() -> &'static str {
1637 "type.googleapis.com/google.cloud.videointelligence.v1.NormalizedBoundingBox"
1638 }
1639}
1640
1641/// Face detection annotation.
1642#[derive(Clone, Default, PartialEq)]
1643#[non_exhaustive]
1644pub struct FaceDetectionAnnotation {
1645 /// The face tracks with attributes.
1646 pub tracks: std::vec::Vec<crate::model::Track>,
1647
1648 /// The thumbnail of a person's face.
1649 pub thumbnail: ::bytes::Bytes,
1650
1651 /// Feature version.
1652 pub version: std::string::String,
1653
1654 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1655}
1656
1657impl FaceDetectionAnnotation {
1658 /// Creates a new default instance.
1659 pub fn new() -> Self {
1660 std::default::Default::default()
1661 }
1662
1663 /// Sets the value of [tracks][crate::model::FaceDetectionAnnotation::tracks].
1664 ///
1665 /// # Example
1666 /// ```ignore,no_run
1667 /// # use google_cloud_videointelligence_v1::model::FaceDetectionAnnotation;
1668 /// use google_cloud_videointelligence_v1::model::Track;
1669 /// let x = FaceDetectionAnnotation::new()
1670 /// .set_tracks([
1671 /// Track::default()/* use setters */,
1672 /// Track::default()/* use (different) setters */,
1673 /// ]);
1674 /// ```
1675 pub fn set_tracks<T, V>(mut self, v: T) -> Self
1676 where
1677 T: std::iter::IntoIterator<Item = V>,
1678 V: std::convert::Into<crate::model::Track>,
1679 {
1680 use std::iter::Iterator;
1681 self.tracks = v.into_iter().map(|i| i.into()).collect();
1682 self
1683 }
1684
1685 /// Sets the value of [thumbnail][crate::model::FaceDetectionAnnotation::thumbnail].
1686 ///
1687 /// # Example
1688 /// ```ignore,no_run
1689 /// # use google_cloud_videointelligence_v1::model::FaceDetectionAnnotation;
1690 /// let x = FaceDetectionAnnotation::new().set_thumbnail(bytes::Bytes::from_static(b"example"));
1691 /// ```
1692 pub fn set_thumbnail<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1693 self.thumbnail = v.into();
1694 self
1695 }
1696
1697 /// Sets the value of [version][crate::model::FaceDetectionAnnotation::version].
1698 ///
1699 /// # Example
1700 /// ```ignore,no_run
1701 /// # use google_cloud_videointelligence_v1::model::FaceDetectionAnnotation;
1702 /// let x = FaceDetectionAnnotation::new().set_version("example");
1703 /// ```
1704 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1705 self.version = v.into();
1706 self
1707 }
1708}
1709
1710impl wkt::message::Message for FaceDetectionAnnotation {
1711 fn typename() -> &'static str {
1712 "type.googleapis.com/google.cloud.videointelligence.v1.FaceDetectionAnnotation"
1713 }
1714}
1715
1716/// Person detection annotation per video.
1717#[derive(Clone, Default, PartialEq)]
1718#[non_exhaustive]
1719pub struct PersonDetectionAnnotation {
1720 /// The detected tracks of a person.
1721 pub tracks: std::vec::Vec<crate::model::Track>,
1722
1723 /// Feature version.
1724 pub version: std::string::String,
1725
1726 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1727}
1728
1729impl PersonDetectionAnnotation {
1730 /// Creates a new default instance.
1731 pub fn new() -> Self {
1732 std::default::Default::default()
1733 }
1734
1735 /// Sets the value of [tracks][crate::model::PersonDetectionAnnotation::tracks].
1736 ///
1737 /// # Example
1738 /// ```ignore,no_run
1739 /// # use google_cloud_videointelligence_v1::model::PersonDetectionAnnotation;
1740 /// use google_cloud_videointelligence_v1::model::Track;
1741 /// let x = PersonDetectionAnnotation::new()
1742 /// .set_tracks([
1743 /// Track::default()/* use setters */,
1744 /// Track::default()/* use (different) setters */,
1745 /// ]);
1746 /// ```
1747 pub fn set_tracks<T, V>(mut self, v: T) -> Self
1748 where
1749 T: std::iter::IntoIterator<Item = V>,
1750 V: std::convert::Into<crate::model::Track>,
1751 {
1752 use std::iter::Iterator;
1753 self.tracks = v.into_iter().map(|i| i.into()).collect();
1754 self
1755 }
1756
1757 /// Sets the value of [version][crate::model::PersonDetectionAnnotation::version].
1758 ///
1759 /// # Example
1760 /// ```ignore,no_run
1761 /// # use google_cloud_videointelligence_v1::model::PersonDetectionAnnotation;
1762 /// let x = PersonDetectionAnnotation::new().set_version("example");
1763 /// ```
1764 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
1765 self.version = v.into();
1766 self
1767 }
1768}
1769
1770impl wkt::message::Message for PersonDetectionAnnotation {
1771 fn typename() -> &'static str {
1772 "type.googleapis.com/google.cloud.videointelligence.v1.PersonDetectionAnnotation"
1773 }
1774}
1775
1776/// Video segment level annotation results for face detection.
1777#[derive(Clone, Default, PartialEq)]
1778#[non_exhaustive]
1779pub struct FaceSegment {
1780 /// Video segment where a face was detected.
1781 pub segment: std::option::Option<crate::model::VideoSegment>,
1782
1783 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1784}
1785
1786impl FaceSegment {
1787 /// Creates a new default instance.
1788 pub fn new() -> Self {
1789 std::default::Default::default()
1790 }
1791
1792 /// Sets the value of [segment][crate::model::FaceSegment::segment].
1793 ///
1794 /// # Example
1795 /// ```ignore,no_run
1796 /// # use google_cloud_videointelligence_v1::model::FaceSegment;
1797 /// use google_cloud_videointelligence_v1::model::VideoSegment;
1798 /// let x = FaceSegment::new().set_segment(VideoSegment::default()/* use setters */);
1799 /// ```
1800 pub fn set_segment<T>(mut self, v: T) -> Self
1801 where
1802 T: std::convert::Into<crate::model::VideoSegment>,
1803 {
1804 self.segment = std::option::Option::Some(v.into());
1805 self
1806 }
1807
1808 /// Sets or clears the value of [segment][crate::model::FaceSegment::segment].
1809 ///
1810 /// # Example
1811 /// ```ignore,no_run
1812 /// # use google_cloud_videointelligence_v1::model::FaceSegment;
1813 /// use google_cloud_videointelligence_v1::model::VideoSegment;
1814 /// let x = FaceSegment::new().set_or_clear_segment(Some(VideoSegment::default()/* use setters */));
1815 /// let x = FaceSegment::new().set_or_clear_segment(None::<VideoSegment>);
1816 /// ```
1817 pub fn set_or_clear_segment<T>(mut self, v: std::option::Option<T>) -> Self
1818 where
1819 T: std::convert::Into<crate::model::VideoSegment>,
1820 {
1821 self.segment = v.map(|x| x.into());
1822 self
1823 }
1824}
1825
1826impl wkt::message::Message for FaceSegment {
1827 fn typename() -> &'static str {
1828 "type.googleapis.com/google.cloud.videointelligence.v1.FaceSegment"
1829 }
1830}
1831
1832/// Deprecated. No effect.
1833#[derive(Clone, Default, PartialEq)]
1834#[non_exhaustive]
1835#[deprecated]
1836pub struct FaceFrame {
1837 /// Normalized Bounding boxes in a frame.
1838 /// There can be more than one boxes if the same face is detected in multiple
1839 /// locations within the current frame.
1840 pub normalized_bounding_boxes: std::vec::Vec<crate::model::NormalizedBoundingBox>,
1841
1842 /// Time-offset, relative to the beginning of the video,
1843 /// corresponding to the video frame for this location.
1844 pub time_offset: std::option::Option<wkt::Duration>,
1845
1846 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1847}
1848
1849impl FaceFrame {
1850 /// Creates a new default instance.
1851 pub fn new() -> Self {
1852 std::default::Default::default()
1853 }
1854
1855 /// Sets the value of [normalized_bounding_boxes][crate::model::FaceFrame::normalized_bounding_boxes].
1856 ///
1857 /// # Example
1858 /// ```ignore,no_run
1859 /// # use google_cloud_videointelligence_v1::model::FaceFrame;
1860 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
1861 /// let x = FaceFrame::new()
1862 /// .set_normalized_bounding_boxes([
1863 /// NormalizedBoundingBox::default()/* use setters */,
1864 /// NormalizedBoundingBox::default()/* use (different) setters */,
1865 /// ]);
1866 /// ```
1867 pub fn set_normalized_bounding_boxes<T, V>(mut self, v: T) -> Self
1868 where
1869 T: std::iter::IntoIterator<Item = V>,
1870 V: std::convert::Into<crate::model::NormalizedBoundingBox>,
1871 {
1872 use std::iter::Iterator;
1873 self.normalized_bounding_boxes = v.into_iter().map(|i| i.into()).collect();
1874 self
1875 }
1876
1877 /// Sets the value of [time_offset][crate::model::FaceFrame::time_offset].
1878 ///
1879 /// # Example
1880 /// ```ignore,no_run
1881 /// # use google_cloud_videointelligence_v1::model::FaceFrame;
1882 /// use wkt::Duration;
1883 /// let x = FaceFrame::new().set_time_offset(Duration::default()/* use setters */);
1884 /// ```
1885 pub fn set_time_offset<T>(mut self, v: T) -> Self
1886 where
1887 T: std::convert::Into<wkt::Duration>,
1888 {
1889 self.time_offset = std::option::Option::Some(v.into());
1890 self
1891 }
1892
1893 /// Sets or clears the value of [time_offset][crate::model::FaceFrame::time_offset].
1894 ///
1895 /// # Example
1896 /// ```ignore,no_run
1897 /// # use google_cloud_videointelligence_v1::model::FaceFrame;
1898 /// use wkt::Duration;
1899 /// let x = FaceFrame::new().set_or_clear_time_offset(Some(Duration::default()/* use setters */));
1900 /// let x = FaceFrame::new().set_or_clear_time_offset(None::<Duration>);
1901 /// ```
1902 pub fn set_or_clear_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
1903 where
1904 T: std::convert::Into<wkt::Duration>,
1905 {
1906 self.time_offset = v.map(|x| x.into());
1907 self
1908 }
1909}
1910
1911impl wkt::message::Message for FaceFrame {
1912 fn typename() -> &'static str {
1913 "type.googleapis.com/google.cloud.videointelligence.v1.FaceFrame"
1914 }
1915}
1916
1917/// Deprecated. No effect.
1918#[derive(Clone, Default, PartialEq)]
1919#[non_exhaustive]
1920#[deprecated]
1921pub struct FaceAnnotation {
1922 /// Thumbnail of a representative face view (in JPEG format).
1923 pub thumbnail: ::bytes::Bytes,
1924
1925 /// All video segments where a face was detected.
1926 pub segments: std::vec::Vec<crate::model::FaceSegment>,
1927
1928 /// All video frames where a face was detected.
1929 pub frames: std::vec::Vec<crate::model::FaceFrame>,
1930
1931 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
1932}
1933
1934impl FaceAnnotation {
1935 /// Creates a new default instance.
1936 pub fn new() -> Self {
1937 std::default::Default::default()
1938 }
1939
1940 /// Sets the value of [thumbnail][crate::model::FaceAnnotation::thumbnail].
1941 ///
1942 /// # Example
1943 /// ```ignore,no_run
1944 /// # use google_cloud_videointelligence_v1::model::FaceAnnotation;
1945 /// let x = FaceAnnotation::new().set_thumbnail(bytes::Bytes::from_static(b"example"));
1946 /// ```
1947 pub fn set_thumbnail<T: std::convert::Into<::bytes::Bytes>>(mut self, v: T) -> Self {
1948 self.thumbnail = v.into();
1949 self
1950 }
1951
1952 /// Sets the value of [segments][crate::model::FaceAnnotation::segments].
1953 ///
1954 /// # Example
1955 /// ```ignore,no_run
1956 /// # use google_cloud_videointelligence_v1::model::FaceAnnotation;
1957 /// use google_cloud_videointelligence_v1::model::FaceSegment;
1958 /// let x = FaceAnnotation::new()
1959 /// .set_segments([
1960 /// FaceSegment::default()/* use setters */,
1961 /// FaceSegment::default()/* use (different) setters */,
1962 /// ]);
1963 /// ```
1964 pub fn set_segments<T, V>(mut self, v: T) -> Self
1965 where
1966 T: std::iter::IntoIterator<Item = V>,
1967 V: std::convert::Into<crate::model::FaceSegment>,
1968 {
1969 use std::iter::Iterator;
1970 self.segments = v.into_iter().map(|i| i.into()).collect();
1971 self
1972 }
1973
1974 /// Sets the value of [frames][crate::model::FaceAnnotation::frames].
1975 ///
1976 /// # Example
1977 /// ```ignore,no_run
1978 /// # use google_cloud_videointelligence_v1::model::FaceAnnotation;
1979 /// use google_cloud_videointelligence_v1::model::FaceFrame;
1980 /// let x = FaceAnnotation::new()
1981 /// .set_frames([
1982 /// FaceFrame::default()/* use setters */,
1983 /// FaceFrame::default()/* use (different) setters */,
1984 /// ]);
1985 /// ```
1986 pub fn set_frames<T, V>(mut self, v: T) -> Self
1987 where
1988 T: std::iter::IntoIterator<Item = V>,
1989 V: std::convert::Into<crate::model::FaceFrame>,
1990 {
1991 use std::iter::Iterator;
1992 self.frames = v.into_iter().map(|i| i.into()).collect();
1993 self
1994 }
1995}
1996
1997impl wkt::message::Message for FaceAnnotation {
1998 fn typename() -> &'static str {
1999 "type.googleapis.com/google.cloud.videointelligence.v1.FaceAnnotation"
2000 }
2001}
2002
2003/// For tracking related features.
2004/// An object at time_offset with attributes, and located with
2005/// normalized_bounding_box.
2006#[derive(Clone, Default, PartialEq)]
2007#[non_exhaustive]
2008pub struct TimestampedObject {
2009 /// Normalized Bounding box in a frame, where the object is located.
2010 pub normalized_bounding_box: std::option::Option<crate::model::NormalizedBoundingBox>,
2011
2012 /// Time-offset, relative to the beginning of the video,
2013 /// corresponding to the video frame for this object.
2014 pub time_offset: std::option::Option<wkt::Duration>,
2015
2016 /// Optional. The attributes of the object in the bounding box.
2017 pub attributes: std::vec::Vec<crate::model::DetectedAttribute>,
2018
2019 /// Optional. The detected landmarks.
2020 pub landmarks: std::vec::Vec<crate::model::DetectedLandmark>,
2021
2022 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2023}
2024
2025impl TimestampedObject {
2026 /// Creates a new default instance.
2027 pub fn new() -> Self {
2028 std::default::Default::default()
2029 }
2030
2031 /// Sets the value of [normalized_bounding_box][crate::model::TimestampedObject::normalized_bounding_box].
2032 ///
2033 /// # Example
2034 /// ```ignore,no_run
2035 /// # use google_cloud_videointelligence_v1::model::TimestampedObject;
2036 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
2037 /// let x = TimestampedObject::new().set_normalized_bounding_box(NormalizedBoundingBox::default()/* use setters */);
2038 /// ```
2039 pub fn set_normalized_bounding_box<T>(mut self, v: T) -> Self
2040 where
2041 T: std::convert::Into<crate::model::NormalizedBoundingBox>,
2042 {
2043 self.normalized_bounding_box = std::option::Option::Some(v.into());
2044 self
2045 }
2046
2047 /// Sets or clears the value of [normalized_bounding_box][crate::model::TimestampedObject::normalized_bounding_box].
2048 ///
2049 /// # Example
2050 /// ```ignore,no_run
2051 /// # use google_cloud_videointelligence_v1::model::TimestampedObject;
2052 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
2053 /// let x = TimestampedObject::new().set_or_clear_normalized_bounding_box(Some(NormalizedBoundingBox::default()/* use setters */));
2054 /// let x = TimestampedObject::new().set_or_clear_normalized_bounding_box(None::<NormalizedBoundingBox>);
2055 /// ```
2056 pub fn set_or_clear_normalized_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
2057 where
2058 T: std::convert::Into<crate::model::NormalizedBoundingBox>,
2059 {
2060 self.normalized_bounding_box = v.map(|x| x.into());
2061 self
2062 }
2063
2064 /// Sets the value of [time_offset][crate::model::TimestampedObject::time_offset].
2065 ///
2066 /// # Example
2067 /// ```ignore,no_run
2068 /// # use google_cloud_videointelligence_v1::model::TimestampedObject;
2069 /// use wkt::Duration;
2070 /// let x = TimestampedObject::new().set_time_offset(Duration::default()/* use setters */);
2071 /// ```
2072 pub fn set_time_offset<T>(mut self, v: T) -> Self
2073 where
2074 T: std::convert::Into<wkt::Duration>,
2075 {
2076 self.time_offset = std::option::Option::Some(v.into());
2077 self
2078 }
2079
2080 /// Sets or clears the value of [time_offset][crate::model::TimestampedObject::time_offset].
2081 ///
2082 /// # Example
2083 /// ```ignore,no_run
2084 /// # use google_cloud_videointelligence_v1::model::TimestampedObject;
2085 /// use wkt::Duration;
2086 /// let x = TimestampedObject::new().set_or_clear_time_offset(Some(Duration::default()/* use setters */));
2087 /// let x = TimestampedObject::new().set_or_clear_time_offset(None::<Duration>);
2088 /// ```
2089 pub fn set_or_clear_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
2090 where
2091 T: std::convert::Into<wkt::Duration>,
2092 {
2093 self.time_offset = v.map(|x| x.into());
2094 self
2095 }
2096
2097 /// Sets the value of [attributes][crate::model::TimestampedObject::attributes].
2098 ///
2099 /// # Example
2100 /// ```ignore,no_run
2101 /// # use google_cloud_videointelligence_v1::model::TimestampedObject;
2102 /// use google_cloud_videointelligence_v1::model::DetectedAttribute;
2103 /// let x = TimestampedObject::new()
2104 /// .set_attributes([
2105 /// DetectedAttribute::default()/* use setters */,
2106 /// DetectedAttribute::default()/* use (different) setters */,
2107 /// ]);
2108 /// ```
2109 pub fn set_attributes<T, V>(mut self, v: T) -> Self
2110 where
2111 T: std::iter::IntoIterator<Item = V>,
2112 V: std::convert::Into<crate::model::DetectedAttribute>,
2113 {
2114 use std::iter::Iterator;
2115 self.attributes = v.into_iter().map(|i| i.into()).collect();
2116 self
2117 }
2118
2119 /// Sets the value of [landmarks][crate::model::TimestampedObject::landmarks].
2120 ///
2121 /// # Example
2122 /// ```ignore,no_run
2123 /// # use google_cloud_videointelligence_v1::model::TimestampedObject;
2124 /// use google_cloud_videointelligence_v1::model::DetectedLandmark;
2125 /// let x = TimestampedObject::new()
2126 /// .set_landmarks([
2127 /// DetectedLandmark::default()/* use setters */,
2128 /// DetectedLandmark::default()/* use (different) setters */,
2129 /// ]);
2130 /// ```
2131 pub fn set_landmarks<T, V>(mut self, v: T) -> Self
2132 where
2133 T: std::iter::IntoIterator<Item = V>,
2134 V: std::convert::Into<crate::model::DetectedLandmark>,
2135 {
2136 use std::iter::Iterator;
2137 self.landmarks = v.into_iter().map(|i| i.into()).collect();
2138 self
2139 }
2140}
2141
2142impl wkt::message::Message for TimestampedObject {
2143 fn typename() -> &'static str {
2144 "type.googleapis.com/google.cloud.videointelligence.v1.TimestampedObject"
2145 }
2146}
2147
2148/// A track of an object instance.
2149#[derive(Clone, Default, PartialEq)]
2150#[non_exhaustive]
2151pub struct Track {
2152 /// Video segment of a track.
2153 pub segment: std::option::Option<crate::model::VideoSegment>,
2154
2155 /// The object with timestamp and attributes per frame in the track.
2156 pub timestamped_objects: std::vec::Vec<crate::model::TimestampedObject>,
2157
2158 /// Optional. Attributes in the track level.
2159 pub attributes: std::vec::Vec<crate::model::DetectedAttribute>,
2160
2161 /// Optional. The confidence score of the tracked object.
2162 pub confidence: f32,
2163
2164 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2165}
2166
2167impl Track {
2168 /// Creates a new default instance.
2169 pub fn new() -> Self {
2170 std::default::Default::default()
2171 }
2172
2173 /// Sets the value of [segment][crate::model::Track::segment].
2174 ///
2175 /// # Example
2176 /// ```ignore,no_run
2177 /// # use google_cloud_videointelligence_v1::model::Track;
2178 /// use google_cloud_videointelligence_v1::model::VideoSegment;
2179 /// let x = Track::new().set_segment(VideoSegment::default()/* use setters */);
2180 /// ```
2181 pub fn set_segment<T>(mut self, v: T) -> Self
2182 where
2183 T: std::convert::Into<crate::model::VideoSegment>,
2184 {
2185 self.segment = std::option::Option::Some(v.into());
2186 self
2187 }
2188
2189 /// Sets or clears the value of [segment][crate::model::Track::segment].
2190 ///
2191 /// # Example
2192 /// ```ignore,no_run
2193 /// # use google_cloud_videointelligence_v1::model::Track;
2194 /// use google_cloud_videointelligence_v1::model::VideoSegment;
2195 /// let x = Track::new().set_or_clear_segment(Some(VideoSegment::default()/* use setters */));
2196 /// let x = Track::new().set_or_clear_segment(None::<VideoSegment>);
2197 /// ```
2198 pub fn set_or_clear_segment<T>(mut self, v: std::option::Option<T>) -> Self
2199 where
2200 T: std::convert::Into<crate::model::VideoSegment>,
2201 {
2202 self.segment = v.map(|x| x.into());
2203 self
2204 }
2205
2206 /// Sets the value of [timestamped_objects][crate::model::Track::timestamped_objects].
2207 ///
2208 /// # Example
2209 /// ```ignore,no_run
2210 /// # use google_cloud_videointelligence_v1::model::Track;
2211 /// use google_cloud_videointelligence_v1::model::TimestampedObject;
2212 /// let x = Track::new()
2213 /// .set_timestamped_objects([
2214 /// TimestampedObject::default()/* use setters */,
2215 /// TimestampedObject::default()/* use (different) setters */,
2216 /// ]);
2217 /// ```
2218 pub fn set_timestamped_objects<T, V>(mut self, v: T) -> Self
2219 where
2220 T: std::iter::IntoIterator<Item = V>,
2221 V: std::convert::Into<crate::model::TimestampedObject>,
2222 {
2223 use std::iter::Iterator;
2224 self.timestamped_objects = v.into_iter().map(|i| i.into()).collect();
2225 self
2226 }
2227
2228 /// Sets the value of [attributes][crate::model::Track::attributes].
2229 ///
2230 /// # Example
2231 /// ```ignore,no_run
2232 /// # use google_cloud_videointelligence_v1::model::Track;
2233 /// use google_cloud_videointelligence_v1::model::DetectedAttribute;
2234 /// let x = Track::new()
2235 /// .set_attributes([
2236 /// DetectedAttribute::default()/* use setters */,
2237 /// DetectedAttribute::default()/* use (different) setters */,
2238 /// ]);
2239 /// ```
2240 pub fn set_attributes<T, V>(mut self, v: T) -> Self
2241 where
2242 T: std::iter::IntoIterator<Item = V>,
2243 V: std::convert::Into<crate::model::DetectedAttribute>,
2244 {
2245 use std::iter::Iterator;
2246 self.attributes = v.into_iter().map(|i| i.into()).collect();
2247 self
2248 }
2249
2250 /// Sets the value of [confidence][crate::model::Track::confidence].
2251 ///
2252 /// # Example
2253 /// ```ignore,no_run
2254 /// # use google_cloud_videointelligence_v1::model::Track;
2255 /// let x = Track::new().set_confidence(42.0);
2256 /// ```
2257 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2258 self.confidence = v.into();
2259 self
2260 }
2261}
2262
2263impl wkt::message::Message for Track {
2264 fn typename() -> &'static str {
2265 "type.googleapis.com/google.cloud.videointelligence.v1.Track"
2266 }
2267}
2268
2269/// A generic detected attribute represented by name in string format.
2270#[derive(Clone, Default, PartialEq)]
2271#[non_exhaustive]
2272pub struct DetectedAttribute {
2273 /// The name of the attribute, for example, glasses, dark_glasses, mouth_open.
2274 /// A full list of supported type names will be provided in the document.
2275 pub name: std::string::String,
2276
2277 /// Detected attribute confidence. Range [0, 1].
2278 pub confidence: f32,
2279
2280 /// Text value of the detection result. For example, the value for "HairColor"
2281 /// can be "black", "blonde", etc.
2282 pub value: std::string::String,
2283
2284 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2285}
2286
2287impl DetectedAttribute {
2288 /// Creates a new default instance.
2289 pub fn new() -> Self {
2290 std::default::Default::default()
2291 }
2292
2293 /// Sets the value of [name][crate::model::DetectedAttribute::name].
2294 ///
2295 /// # Example
2296 /// ```ignore,no_run
2297 /// # use google_cloud_videointelligence_v1::model::DetectedAttribute;
2298 /// let x = DetectedAttribute::new().set_name("example");
2299 /// ```
2300 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2301 self.name = v.into();
2302 self
2303 }
2304
2305 /// Sets the value of [confidence][crate::model::DetectedAttribute::confidence].
2306 ///
2307 /// # Example
2308 /// ```ignore,no_run
2309 /// # use google_cloud_videointelligence_v1::model::DetectedAttribute;
2310 /// let x = DetectedAttribute::new().set_confidence(42.0);
2311 /// ```
2312 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2313 self.confidence = v.into();
2314 self
2315 }
2316
2317 /// Sets the value of [value][crate::model::DetectedAttribute::value].
2318 ///
2319 /// # Example
2320 /// ```ignore,no_run
2321 /// # use google_cloud_videointelligence_v1::model::DetectedAttribute;
2322 /// let x = DetectedAttribute::new().set_value("example");
2323 /// ```
2324 pub fn set_value<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2325 self.value = v.into();
2326 self
2327 }
2328}
2329
2330impl wkt::message::Message for DetectedAttribute {
2331 fn typename() -> &'static str {
2332 "type.googleapis.com/google.cloud.videointelligence.v1.DetectedAttribute"
2333 }
2334}
2335
2336/// A generic detected landmark represented by name in string format and a 2D
2337/// location.
2338#[derive(Clone, Default, PartialEq)]
2339#[non_exhaustive]
2340pub struct DetectedLandmark {
2341 /// The name of this landmark, for example, left_hand, right_shoulder.
2342 pub name: std::string::String,
2343
2344 /// The 2D point of the detected landmark using the normalized image
2345 /// coordindate system. The normalized coordinates have the range from 0 to 1.
2346 pub point: std::option::Option<crate::model::NormalizedVertex>,
2347
2348 /// The confidence score of the detected landmark. Range [0, 1].
2349 pub confidence: f32,
2350
2351 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2352}
2353
2354impl DetectedLandmark {
2355 /// Creates a new default instance.
2356 pub fn new() -> Self {
2357 std::default::Default::default()
2358 }
2359
2360 /// Sets the value of [name][crate::model::DetectedLandmark::name].
2361 ///
2362 /// # Example
2363 /// ```ignore,no_run
2364 /// # use google_cloud_videointelligence_v1::model::DetectedLandmark;
2365 /// let x = DetectedLandmark::new().set_name("example");
2366 /// ```
2367 pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2368 self.name = v.into();
2369 self
2370 }
2371
2372 /// Sets the value of [point][crate::model::DetectedLandmark::point].
2373 ///
2374 /// # Example
2375 /// ```ignore,no_run
2376 /// # use google_cloud_videointelligence_v1::model::DetectedLandmark;
2377 /// use google_cloud_videointelligence_v1::model::NormalizedVertex;
2378 /// let x = DetectedLandmark::new().set_point(NormalizedVertex::default()/* use setters */);
2379 /// ```
2380 pub fn set_point<T>(mut self, v: T) -> Self
2381 where
2382 T: std::convert::Into<crate::model::NormalizedVertex>,
2383 {
2384 self.point = std::option::Option::Some(v.into());
2385 self
2386 }
2387
2388 /// Sets or clears the value of [point][crate::model::DetectedLandmark::point].
2389 ///
2390 /// # Example
2391 /// ```ignore,no_run
2392 /// # use google_cloud_videointelligence_v1::model::DetectedLandmark;
2393 /// use google_cloud_videointelligence_v1::model::NormalizedVertex;
2394 /// let x = DetectedLandmark::new().set_or_clear_point(Some(NormalizedVertex::default()/* use setters */));
2395 /// let x = DetectedLandmark::new().set_or_clear_point(None::<NormalizedVertex>);
2396 /// ```
2397 pub fn set_or_clear_point<T>(mut self, v: std::option::Option<T>) -> Self
2398 where
2399 T: std::convert::Into<crate::model::NormalizedVertex>,
2400 {
2401 self.point = v.map(|x| x.into());
2402 self
2403 }
2404
2405 /// Sets the value of [confidence][crate::model::DetectedLandmark::confidence].
2406 ///
2407 /// # Example
2408 /// ```ignore,no_run
2409 /// # use google_cloud_videointelligence_v1::model::DetectedLandmark;
2410 /// let x = DetectedLandmark::new().set_confidence(42.0);
2411 /// ```
2412 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
2413 self.confidence = v.into();
2414 self
2415 }
2416}
2417
2418impl wkt::message::Message for DetectedLandmark {
2419 fn typename() -> &'static str {
2420 "type.googleapis.com/google.cloud.videointelligence.v1.DetectedLandmark"
2421 }
2422}
2423
2424/// Annotation results for a single video.
2425#[derive(Clone, Default, PartialEq)]
2426#[non_exhaustive]
2427pub struct VideoAnnotationResults {
2428 /// Video file location in
2429 /// [Cloud Storage](https://cloud.google.com/storage/).
2430 pub input_uri: std::string::String,
2431
2432 /// Video segment on which the annotation is run.
2433 pub segment: std::option::Option<crate::model::VideoSegment>,
2434
2435 /// Topical label annotations on video level or user-specified segment level.
2436 /// There is exactly one element for each unique label.
2437 pub segment_label_annotations: std::vec::Vec<crate::model::LabelAnnotation>,
2438
2439 /// Presence label annotations on video level or user-specified segment level.
2440 /// There is exactly one element for each unique label. Compared to the
2441 /// existing topical `segment_label_annotations`, this field presents more
2442 /// fine-grained, segment-level labels detected in video content and is made
2443 /// available only when the client sets `LabelDetectionConfig.model` to
2444 /// "builtin/latest" in the request.
2445 pub segment_presence_label_annotations: std::vec::Vec<crate::model::LabelAnnotation>,
2446
2447 /// Topical label annotations on shot level.
2448 /// There is exactly one element for each unique label.
2449 pub shot_label_annotations: std::vec::Vec<crate::model::LabelAnnotation>,
2450
2451 /// Presence label annotations on shot level. There is exactly one element for
2452 /// each unique label. Compared to the existing topical
2453 /// `shot_label_annotations`, this field presents more fine-grained, shot-level
2454 /// labels detected in video content and is made available only when the client
2455 /// sets `LabelDetectionConfig.model` to "builtin/latest" in the request.
2456 pub shot_presence_label_annotations: std::vec::Vec<crate::model::LabelAnnotation>,
2457
2458 /// Label annotations on frame level.
2459 /// There is exactly one element for each unique label.
2460 pub frame_label_annotations: std::vec::Vec<crate::model::LabelAnnotation>,
2461
2462 /// Deprecated. Please use `face_detection_annotations` instead.
2463 #[deprecated]
2464 pub face_annotations: std::vec::Vec<crate::model::FaceAnnotation>,
2465
2466 /// Face detection annotations.
2467 pub face_detection_annotations: std::vec::Vec<crate::model::FaceDetectionAnnotation>,
2468
2469 /// Shot annotations. Each shot is represented as a video segment.
2470 pub shot_annotations: std::vec::Vec<crate::model::VideoSegment>,
2471
2472 /// Explicit content annotation.
2473 pub explicit_annotation: std::option::Option<crate::model::ExplicitContentAnnotation>,
2474
2475 /// Speech transcription.
2476 pub speech_transcriptions: std::vec::Vec<crate::model::SpeechTranscription>,
2477
2478 /// OCR text detection and tracking.
2479 /// Annotations for list of detected text snippets. Each will have list of
2480 /// frame information associated with it.
2481 pub text_annotations: std::vec::Vec<crate::model::TextAnnotation>,
2482
2483 /// Annotations for list of objects detected and tracked in video.
2484 pub object_annotations: std::vec::Vec<crate::model::ObjectTrackingAnnotation>,
2485
2486 /// Annotations for list of logos detected, tracked and recognized in video.
2487 pub logo_recognition_annotations: std::vec::Vec<crate::model::LogoRecognitionAnnotation>,
2488
2489 /// Person detection annotations.
2490 pub person_detection_annotations: std::vec::Vec<crate::model::PersonDetectionAnnotation>,
2491
2492 /// If set, indicates an error. Note that for a single `AnnotateVideoRequest`
2493 /// some videos may succeed and some may fail.
2494 pub error: std::option::Option<google_cloud_rpc::model::Status>,
2495
2496 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2497}
2498
2499impl VideoAnnotationResults {
2500 /// Creates a new default instance.
2501 pub fn new() -> Self {
2502 std::default::Default::default()
2503 }
2504
2505 /// Sets the value of [input_uri][crate::model::VideoAnnotationResults::input_uri].
2506 ///
2507 /// # Example
2508 /// ```ignore,no_run
2509 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2510 /// let x = VideoAnnotationResults::new().set_input_uri("example");
2511 /// ```
2512 pub fn set_input_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
2513 self.input_uri = v.into();
2514 self
2515 }
2516
2517 /// Sets the value of [segment][crate::model::VideoAnnotationResults::segment].
2518 ///
2519 /// # Example
2520 /// ```ignore,no_run
2521 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2522 /// use google_cloud_videointelligence_v1::model::VideoSegment;
2523 /// let x = VideoAnnotationResults::new().set_segment(VideoSegment::default()/* use setters */);
2524 /// ```
2525 pub fn set_segment<T>(mut self, v: T) -> Self
2526 where
2527 T: std::convert::Into<crate::model::VideoSegment>,
2528 {
2529 self.segment = std::option::Option::Some(v.into());
2530 self
2531 }
2532
2533 /// Sets or clears the value of [segment][crate::model::VideoAnnotationResults::segment].
2534 ///
2535 /// # Example
2536 /// ```ignore,no_run
2537 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2538 /// use google_cloud_videointelligence_v1::model::VideoSegment;
2539 /// let x = VideoAnnotationResults::new().set_or_clear_segment(Some(VideoSegment::default()/* use setters */));
2540 /// let x = VideoAnnotationResults::new().set_or_clear_segment(None::<VideoSegment>);
2541 /// ```
2542 pub fn set_or_clear_segment<T>(mut self, v: std::option::Option<T>) -> Self
2543 where
2544 T: std::convert::Into<crate::model::VideoSegment>,
2545 {
2546 self.segment = v.map(|x| x.into());
2547 self
2548 }
2549
2550 /// Sets the value of [segment_label_annotations][crate::model::VideoAnnotationResults::segment_label_annotations].
2551 ///
2552 /// # Example
2553 /// ```ignore,no_run
2554 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2555 /// use google_cloud_videointelligence_v1::model::LabelAnnotation;
2556 /// let x = VideoAnnotationResults::new()
2557 /// .set_segment_label_annotations([
2558 /// LabelAnnotation::default()/* use setters */,
2559 /// LabelAnnotation::default()/* use (different) setters */,
2560 /// ]);
2561 /// ```
2562 pub fn set_segment_label_annotations<T, V>(mut self, v: T) -> Self
2563 where
2564 T: std::iter::IntoIterator<Item = V>,
2565 V: std::convert::Into<crate::model::LabelAnnotation>,
2566 {
2567 use std::iter::Iterator;
2568 self.segment_label_annotations = v.into_iter().map(|i| i.into()).collect();
2569 self
2570 }
2571
2572 /// Sets the value of [segment_presence_label_annotations][crate::model::VideoAnnotationResults::segment_presence_label_annotations].
2573 ///
2574 /// # Example
2575 /// ```ignore,no_run
2576 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2577 /// use google_cloud_videointelligence_v1::model::LabelAnnotation;
2578 /// let x = VideoAnnotationResults::new()
2579 /// .set_segment_presence_label_annotations([
2580 /// LabelAnnotation::default()/* use setters */,
2581 /// LabelAnnotation::default()/* use (different) setters */,
2582 /// ]);
2583 /// ```
2584 pub fn set_segment_presence_label_annotations<T, V>(mut self, v: T) -> Self
2585 where
2586 T: std::iter::IntoIterator<Item = V>,
2587 V: std::convert::Into<crate::model::LabelAnnotation>,
2588 {
2589 use std::iter::Iterator;
2590 self.segment_presence_label_annotations = v.into_iter().map(|i| i.into()).collect();
2591 self
2592 }
2593
2594 /// Sets the value of [shot_label_annotations][crate::model::VideoAnnotationResults::shot_label_annotations].
2595 ///
2596 /// # Example
2597 /// ```ignore,no_run
2598 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2599 /// use google_cloud_videointelligence_v1::model::LabelAnnotation;
2600 /// let x = VideoAnnotationResults::new()
2601 /// .set_shot_label_annotations([
2602 /// LabelAnnotation::default()/* use setters */,
2603 /// LabelAnnotation::default()/* use (different) setters */,
2604 /// ]);
2605 /// ```
2606 pub fn set_shot_label_annotations<T, V>(mut self, v: T) -> Self
2607 where
2608 T: std::iter::IntoIterator<Item = V>,
2609 V: std::convert::Into<crate::model::LabelAnnotation>,
2610 {
2611 use std::iter::Iterator;
2612 self.shot_label_annotations = v.into_iter().map(|i| i.into()).collect();
2613 self
2614 }
2615
2616 /// Sets the value of [shot_presence_label_annotations][crate::model::VideoAnnotationResults::shot_presence_label_annotations].
2617 ///
2618 /// # Example
2619 /// ```ignore,no_run
2620 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2621 /// use google_cloud_videointelligence_v1::model::LabelAnnotation;
2622 /// let x = VideoAnnotationResults::new()
2623 /// .set_shot_presence_label_annotations([
2624 /// LabelAnnotation::default()/* use setters */,
2625 /// LabelAnnotation::default()/* use (different) setters */,
2626 /// ]);
2627 /// ```
2628 pub fn set_shot_presence_label_annotations<T, V>(mut self, v: T) -> Self
2629 where
2630 T: std::iter::IntoIterator<Item = V>,
2631 V: std::convert::Into<crate::model::LabelAnnotation>,
2632 {
2633 use std::iter::Iterator;
2634 self.shot_presence_label_annotations = v.into_iter().map(|i| i.into()).collect();
2635 self
2636 }
2637
2638 /// Sets the value of [frame_label_annotations][crate::model::VideoAnnotationResults::frame_label_annotations].
2639 ///
2640 /// # Example
2641 /// ```ignore,no_run
2642 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2643 /// use google_cloud_videointelligence_v1::model::LabelAnnotation;
2644 /// let x = VideoAnnotationResults::new()
2645 /// .set_frame_label_annotations([
2646 /// LabelAnnotation::default()/* use setters */,
2647 /// LabelAnnotation::default()/* use (different) setters */,
2648 /// ]);
2649 /// ```
2650 pub fn set_frame_label_annotations<T, V>(mut self, v: T) -> Self
2651 where
2652 T: std::iter::IntoIterator<Item = V>,
2653 V: std::convert::Into<crate::model::LabelAnnotation>,
2654 {
2655 use std::iter::Iterator;
2656 self.frame_label_annotations = v.into_iter().map(|i| i.into()).collect();
2657 self
2658 }
2659
2660 /// Sets the value of [face_annotations][crate::model::VideoAnnotationResults::face_annotations].
2661 ///
2662 /// # Example
2663 /// ```ignore,no_run
2664 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2665 /// use google_cloud_videointelligence_v1::model::FaceAnnotation;
2666 /// let x = VideoAnnotationResults::new()
2667 /// .set_face_annotations([
2668 /// FaceAnnotation::default()/* use setters */,
2669 /// FaceAnnotation::default()/* use (different) setters */,
2670 /// ]);
2671 /// ```
2672 #[deprecated]
2673 pub fn set_face_annotations<T, V>(mut self, v: T) -> Self
2674 where
2675 T: std::iter::IntoIterator<Item = V>,
2676 V: std::convert::Into<crate::model::FaceAnnotation>,
2677 {
2678 use std::iter::Iterator;
2679 self.face_annotations = v.into_iter().map(|i| i.into()).collect();
2680 self
2681 }
2682
2683 /// Sets the value of [face_detection_annotations][crate::model::VideoAnnotationResults::face_detection_annotations].
2684 ///
2685 /// # Example
2686 /// ```ignore,no_run
2687 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2688 /// use google_cloud_videointelligence_v1::model::FaceDetectionAnnotation;
2689 /// let x = VideoAnnotationResults::new()
2690 /// .set_face_detection_annotations([
2691 /// FaceDetectionAnnotation::default()/* use setters */,
2692 /// FaceDetectionAnnotation::default()/* use (different) setters */,
2693 /// ]);
2694 /// ```
2695 pub fn set_face_detection_annotations<T, V>(mut self, v: T) -> Self
2696 where
2697 T: std::iter::IntoIterator<Item = V>,
2698 V: std::convert::Into<crate::model::FaceDetectionAnnotation>,
2699 {
2700 use std::iter::Iterator;
2701 self.face_detection_annotations = v.into_iter().map(|i| i.into()).collect();
2702 self
2703 }
2704
2705 /// Sets the value of [shot_annotations][crate::model::VideoAnnotationResults::shot_annotations].
2706 ///
2707 /// # Example
2708 /// ```ignore,no_run
2709 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2710 /// use google_cloud_videointelligence_v1::model::VideoSegment;
2711 /// let x = VideoAnnotationResults::new()
2712 /// .set_shot_annotations([
2713 /// VideoSegment::default()/* use setters */,
2714 /// VideoSegment::default()/* use (different) setters */,
2715 /// ]);
2716 /// ```
2717 pub fn set_shot_annotations<T, V>(mut self, v: T) -> Self
2718 where
2719 T: std::iter::IntoIterator<Item = V>,
2720 V: std::convert::Into<crate::model::VideoSegment>,
2721 {
2722 use std::iter::Iterator;
2723 self.shot_annotations = v.into_iter().map(|i| i.into()).collect();
2724 self
2725 }
2726
2727 /// Sets the value of [explicit_annotation][crate::model::VideoAnnotationResults::explicit_annotation].
2728 ///
2729 /// # Example
2730 /// ```ignore,no_run
2731 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2732 /// use google_cloud_videointelligence_v1::model::ExplicitContentAnnotation;
2733 /// let x = VideoAnnotationResults::new().set_explicit_annotation(ExplicitContentAnnotation::default()/* use setters */);
2734 /// ```
2735 pub fn set_explicit_annotation<T>(mut self, v: T) -> Self
2736 where
2737 T: std::convert::Into<crate::model::ExplicitContentAnnotation>,
2738 {
2739 self.explicit_annotation = std::option::Option::Some(v.into());
2740 self
2741 }
2742
2743 /// Sets or clears the value of [explicit_annotation][crate::model::VideoAnnotationResults::explicit_annotation].
2744 ///
2745 /// # Example
2746 /// ```ignore,no_run
2747 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2748 /// use google_cloud_videointelligence_v1::model::ExplicitContentAnnotation;
2749 /// let x = VideoAnnotationResults::new().set_or_clear_explicit_annotation(Some(ExplicitContentAnnotation::default()/* use setters */));
2750 /// let x = VideoAnnotationResults::new().set_or_clear_explicit_annotation(None::<ExplicitContentAnnotation>);
2751 /// ```
2752 pub fn set_or_clear_explicit_annotation<T>(mut self, v: std::option::Option<T>) -> Self
2753 where
2754 T: std::convert::Into<crate::model::ExplicitContentAnnotation>,
2755 {
2756 self.explicit_annotation = v.map(|x| x.into());
2757 self
2758 }
2759
2760 /// Sets the value of [speech_transcriptions][crate::model::VideoAnnotationResults::speech_transcriptions].
2761 ///
2762 /// # Example
2763 /// ```ignore,no_run
2764 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2765 /// use google_cloud_videointelligence_v1::model::SpeechTranscription;
2766 /// let x = VideoAnnotationResults::new()
2767 /// .set_speech_transcriptions([
2768 /// SpeechTranscription::default()/* use setters */,
2769 /// SpeechTranscription::default()/* use (different) setters */,
2770 /// ]);
2771 /// ```
2772 pub fn set_speech_transcriptions<T, V>(mut self, v: T) -> Self
2773 where
2774 T: std::iter::IntoIterator<Item = V>,
2775 V: std::convert::Into<crate::model::SpeechTranscription>,
2776 {
2777 use std::iter::Iterator;
2778 self.speech_transcriptions = v.into_iter().map(|i| i.into()).collect();
2779 self
2780 }
2781
2782 /// Sets the value of [text_annotations][crate::model::VideoAnnotationResults::text_annotations].
2783 ///
2784 /// # Example
2785 /// ```ignore,no_run
2786 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2787 /// use google_cloud_videointelligence_v1::model::TextAnnotation;
2788 /// let x = VideoAnnotationResults::new()
2789 /// .set_text_annotations([
2790 /// TextAnnotation::default()/* use setters */,
2791 /// TextAnnotation::default()/* use (different) setters */,
2792 /// ]);
2793 /// ```
2794 pub fn set_text_annotations<T, V>(mut self, v: T) -> Self
2795 where
2796 T: std::iter::IntoIterator<Item = V>,
2797 V: std::convert::Into<crate::model::TextAnnotation>,
2798 {
2799 use std::iter::Iterator;
2800 self.text_annotations = v.into_iter().map(|i| i.into()).collect();
2801 self
2802 }
2803
2804 /// Sets the value of [object_annotations][crate::model::VideoAnnotationResults::object_annotations].
2805 ///
2806 /// # Example
2807 /// ```ignore,no_run
2808 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2809 /// use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
2810 /// let x = VideoAnnotationResults::new()
2811 /// .set_object_annotations([
2812 /// ObjectTrackingAnnotation::default()/* use setters */,
2813 /// ObjectTrackingAnnotation::default()/* use (different) setters */,
2814 /// ]);
2815 /// ```
2816 pub fn set_object_annotations<T, V>(mut self, v: T) -> Self
2817 where
2818 T: std::iter::IntoIterator<Item = V>,
2819 V: std::convert::Into<crate::model::ObjectTrackingAnnotation>,
2820 {
2821 use std::iter::Iterator;
2822 self.object_annotations = v.into_iter().map(|i| i.into()).collect();
2823 self
2824 }
2825
2826 /// Sets the value of [logo_recognition_annotations][crate::model::VideoAnnotationResults::logo_recognition_annotations].
2827 ///
2828 /// # Example
2829 /// ```ignore,no_run
2830 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2831 /// use google_cloud_videointelligence_v1::model::LogoRecognitionAnnotation;
2832 /// let x = VideoAnnotationResults::new()
2833 /// .set_logo_recognition_annotations([
2834 /// LogoRecognitionAnnotation::default()/* use setters */,
2835 /// LogoRecognitionAnnotation::default()/* use (different) setters */,
2836 /// ]);
2837 /// ```
2838 pub fn set_logo_recognition_annotations<T, V>(mut self, v: T) -> Self
2839 where
2840 T: std::iter::IntoIterator<Item = V>,
2841 V: std::convert::Into<crate::model::LogoRecognitionAnnotation>,
2842 {
2843 use std::iter::Iterator;
2844 self.logo_recognition_annotations = v.into_iter().map(|i| i.into()).collect();
2845 self
2846 }
2847
2848 /// Sets the value of [person_detection_annotations][crate::model::VideoAnnotationResults::person_detection_annotations].
2849 ///
2850 /// # Example
2851 /// ```ignore,no_run
2852 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2853 /// use google_cloud_videointelligence_v1::model::PersonDetectionAnnotation;
2854 /// let x = VideoAnnotationResults::new()
2855 /// .set_person_detection_annotations([
2856 /// PersonDetectionAnnotation::default()/* use setters */,
2857 /// PersonDetectionAnnotation::default()/* use (different) setters */,
2858 /// ]);
2859 /// ```
2860 pub fn set_person_detection_annotations<T, V>(mut self, v: T) -> Self
2861 where
2862 T: std::iter::IntoIterator<Item = V>,
2863 V: std::convert::Into<crate::model::PersonDetectionAnnotation>,
2864 {
2865 use std::iter::Iterator;
2866 self.person_detection_annotations = v.into_iter().map(|i| i.into()).collect();
2867 self
2868 }
2869
2870 /// Sets the value of [error][crate::model::VideoAnnotationResults::error].
2871 ///
2872 /// # Example
2873 /// ```ignore,no_run
2874 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2875 /// use google_cloud_rpc::model::Status;
2876 /// let x = VideoAnnotationResults::new().set_error(Status::default()/* use setters */);
2877 /// ```
2878 pub fn set_error<T>(mut self, v: T) -> Self
2879 where
2880 T: std::convert::Into<google_cloud_rpc::model::Status>,
2881 {
2882 self.error = std::option::Option::Some(v.into());
2883 self
2884 }
2885
2886 /// Sets or clears the value of [error][crate::model::VideoAnnotationResults::error].
2887 ///
2888 /// # Example
2889 /// ```ignore,no_run
2890 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2891 /// use google_cloud_rpc::model::Status;
2892 /// let x = VideoAnnotationResults::new().set_or_clear_error(Some(Status::default()/* use setters */));
2893 /// let x = VideoAnnotationResults::new().set_or_clear_error(None::<Status>);
2894 /// ```
2895 pub fn set_or_clear_error<T>(mut self, v: std::option::Option<T>) -> Self
2896 where
2897 T: std::convert::Into<google_cloud_rpc::model::Status>,
2898 {
2899 self.error = v.map(|x| x.into());
2900 self
2901 }
2902}
2903
2904impl wkt::message::Message for VideoAnnotationResults {
2905 fn typename() -> &'static str {
2906 "type.googleapis.com/google.cloud.videointelligence.v1.VideoAnnotationResults"
2907 }
2908}
2909
2910/// Video annotation response. Included in the `response`
2911/// field of the `Operation` returned by the `GetOperation`
2912/// call of the `google::longrunning::Operations` service.
2913#[derive(Clone, Default, PartialEq)]
2914#[non_exhaustive]
2915pub struct AnnotateVideoResponse {
2916 /// Annotation results for all videos specified in `AnnotateVideoRequest`.
2917 pub annotation_results: std::vec::Vec<crate::model::VideoAnnotationResults>,
2918
2919 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2920}
2921
2922impl AnnotateVideoResponse {
2923 /// Creates a new default instance.
2924 pub fn new() -> Self {
2925 std::default::Default::default()
2926 }
2927
2928 /// Sets the value of [annotation_results][crate::model::AnnotateVideoResponse::annotation_results].
2929 ///
2930 /// # Example
2931 /// ```ignore,no_run
2932 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoResponse;
2933 /// use google_cloud_videointelligence_v1::model::VideoAnnotationResults;
2934 /// let x = AnnotateVideoResponse::new()
2935 /// .set_annotation_results([
2936 /// VideoAnnotationResults::default()/* use setters */,
2937 /// VideoAnnotationResults::default()/* use (different) setters */,
2938 /// ]);
2939 /// ```
2940 pub fn set_annotation_results<T, V>(mut self, v: T) -> Self
2941 where
2942 T: std::iter::IntoIterator<Item = V>,
2943 V: std::convert::Into<crate::model::VideoAnnotationResults>,
2944 {
2945 use std::iter::Iterator;
2946 self.annotation_results = v.into_iter().map(|i| i.into()).collect();
2947 self
2948 }
2949}
2950
2951impl wkt::message::Message for AnnotateVideoResponse {
2952 fn typename() -> &'static str {
2953 "type.googleapis.com/google.cloud.videointelligence.v1.AnnotateVideoResponse"
2954 }
2955}
2956
2957/// Annotation progress for a single video.
2958#[derive(Clone, Default, PartialEq)]
2959#[non_exhaustive]
2960pub struct VideoAnnotationProgress {
2961 /// Video file location in
2962 /// [Cloud Storage](https://cloud.google.com/storage/).
2963 pub input_uri: std::string::String,
2964
2965 /// Approximate percentage processed thus far. Guaranteed to be
2966 /// 100 when fully processed.
2967 pub progress_percent: i32,
2968
2969 /// Time when the request was received.
2970 pub start_time: std::option::Option<wkt::Timestamp>,
2971
2972 /// Time of the most recent update.
2973 pub update_time: std::option::Option<wkt::Timestamp>,
2974
2975 /// Specifies which feature is being tracked if the request contains more than
2976 /// one feature.
2977 pub feature: crate::model::Feature,
2978
2979 /// Specifies which segment is being tracked if the request contains more than
2980 /// one segment.
2981 pub segment: std::option::Option<crate::model::VideoSegment>,
2982
2983 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
2984}
2985
2986impl VideoAnnotationProgress {
2987 /// Creates a new default instance.
2988 pub fn new() -> Self {
2989 std::default::Default::default()
2990 }
2991
2992 /// Sets the value of [input_uri][crate::model::VideoAnnotationProgress::input_uri].
2993 ///
2994 /// # Example
2995 /// ```ignore,no_run
2996 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
2997 /// let x = VideoAnnotationProgress::new().set_input_uri("example");
2998 /// ```
2999 pub fn set_input_uri<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3000 self.input_uri = v.into();
3001 self
3002 }
3003
3004 /// Sets the value of [progress_percent][crate::model::VideoAnnotationProgress::progress_percent].
3005 ///
3006 /// # Example
3007 /// ```ignore,no_run
3008 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3009 /// let x = VideoAnnotationProgress::new().set_progress_percent(42);
3010 /// ```
3011 pub fn set_progress_percent<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3012 self.progress_percent = v.into();
3013 self
3014 }
3015
3016 /// Sets the value of [start_time][crate::model::VideoAnnotationProgress::start_time].
3017 ///
3018 /// # Example
3019 /// ```ignore,no_run
3020 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3021 /// use wkt::Timestamp;
3022 /// let x = VideoAnnotationProgress::new().set_start_time(Timestamp::default()/* use setters */);
3023 /// ```
3024 pub fn set_start_time<T>(mut self, v: T) -> Self
3025 where
3026 T: std::convert::Into<wkt::Timestamp>,
3027 {
3028 self.start_time = std::option::Option::Some(v.into());
3029 self
3030 }
3031
3032 /// Sets or clears the value of [start_time][crate::model::VideoAnnotationProgress::start_time].
3033 ///
3034 /// # Example
3035 /// ```ignore,no_run
3036 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3037 /// use wkt::Timestamp;
3038 /// let x = VideoAnnotationProgress::new().set_or_clear_start_time(Some(Timestamp::default()/* use setters */));
3039 /// let x = VideoAnnotationProgress::new().set_or_clear_start_time(None::<Timestamp>);
3040 /// ```
3041 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3042 where
3043 T: std::convert::Into<wkt::Timestamp>,
3044 {
3045 self.start_time = v.map(|x| x.into());
3046 self
3047 }
3048
3049 /// Sets the value of [update_time][crate::model::VideoAnnotationProgress::update_time].
3050 ///
3051 /// # Example
3052 /// ```ignore,no_run
3053 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3054 /// use wkt::Timestamp;
3055 /// let x = VideoAnnotationProgress::new().set_update_time(Timestamp::default()/* use setters */);
3056 /// ```
3057 pub fn set_update_time<T>(mut self, v: T) -> Self
3058 where
3059 T: std::convert::Into<wkt::Timestamp>,
3060 {
3061 self.update_time = std::option::Option::Some(v.into());
3062 self
3063 }
3064
3065 /// Sets or clears the value of [update_time][crate::model::VideoAnnotationProgress::update_time].
3066 ///
3067 /// # Example
3068 /// ```ignore,no_run
3069 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3070 /// use wkt::Timestamp;
3071 /// let x = VideoAnnotationProgress::new().set_or_clear_update_time(Some(Timestamp::default()/* use setters */));
3072 /// let x = VideoAnnotationProgress::new().set_or_clear_update_time(None::<Timestamp>);
3073 /// ```
3074 pub fn set_or_clear_update_time<T>(mut self, v: std::option::Option<T>) -> Self
3075 where
3076 T: std::convert::Into<wkt::Timestamp>,
3077 {
3078 self.update_time = v.map(|x| x.into());
3079 self
3080 }
3081
3082 /// Sets the value of [feature][crate::model::VideoAnnotationProgress::feature].
3083 ///
3084 /// # Example
3085 /// ```ignore,no_run
3086 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3087 /// use google_cloud_videointelligence_v1::model::Feature;
3088 /// let x0 = VideoAnnotationProgress::new().set_feature(Feature::LabelDetection);
3089 /// let x1 = VideoAnnotationProgress::new().set_feature(Feature::ShotChangeDetection);
3090 /// let x2 = VideoAnnotationProgress::new().set_feature(Feature::ExplicitContentDetection);
3091 /// ```
3092 pub fn set_feature<T: std::convert::Into<crate::model::Feature>>(mut self, v: T) -> Self {
3093 self.feature = v.into();
3094 self
3095 }
3096
3097 /// Sets the value of [segment][crate::model::VideoAnnotationProgress::segment].
3098 ///
3099 /// # Example
3100 /// ```ignore,no_run
3101 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3102 /// use google_cloud_videointelligence_v1::model::VideoSegment;
3103 /// let x = VideoAnnotationProgress::new().set_segment(VideoSegment::default()/* use setters */);
3104 /// ```
3105 pub fn set_segment<T>(mut self, v: T) -> Self
3106 where
3107 T: std::convert::Into<crate::model::VideoSegment>,
3108 {
3109 self.segment = std::option::Option::Some(v.into());
3110 self
3111 }
3112
3113 /// Sets or clears the value of [segment][crate::model::VideoAnnotationProgress::segment].
3114 ///
3115 /// # Example
3116 /// ```ignore,no_run
3117 /// # use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3118 /// use google_cloud_videointelligence_v1::model::VideoSegment;
3119 /// let x = VideoAnnotationProgress::new().set_or_clear_segment(Some(VideoSegment::default()/* use setters */));
3120 /// let x = VideoAnnotationProgress::new().set_or_clear_segment(None::<VideoSegment>);
3121 /// ```
3122 pub fn set_or_clear_segment<T>(mut self, v: std::option::Option<T>) -> Self
3123 where
3124 T: std::convert::Into<crate::model::VideoSegment>,
3125 {
3126 self.segment = v.map(|x| x.into());
3127 self
3128 }
3129}
3130
3131impl wkt::message::Message for VideoAnnotationProgress {
3132 fn typename() -> &'static str {
3133 "type.googleapis.com/google.cloud.videointelligence.v1.VideoAnnotationProgress"
3134 }
3135}
3136
3137/// Video annotation progress. Included in the `metadata`
3138/// field of the `Operation` returned by the `GetOperation`
3139/// call of the `google::longrunning::Operations` service.
3140#[derive(Clone, Default, PartialEq)]
3141#[non_exhaustive]
3142pub struct AnnotateVideoProgress {
3143 /// Progress metadata for all videos specified in `AnnotateVideoRequest`.
3144 pub annotation_progress: std::vec::Vec<crate::model::VideoAnnotationProgress>,
3145
3146 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3147}
3148
3149impl AnnotateVideoProgress {
3150 /// Creates a new default instance.
3151 pub fn new() -> Self {
3152 std::default::Default::default()
3153 }
3154
3155 /// Sets the value of [annotation_progress][crate::model::AnnotateVideoProgress::annotation_progress].
3156 ///
3157 /// # Example
3158 /// ```ignore,no_run
3159 /// # use google_cloud_videointelligence_v1::model::AnnotateVideoProgress;
3160 /// use google_cloud_videointelligence_v1::model::VideoAnnotationProgress;
3161 /// let x = AnnotateVideoProgress::new()
3162 /// .set_annotation_progress([
3163 /// VideoAnnotationProgress::default()/* use setters */,
3164 /// VideoAnnotationProgress::default()/* use (different) setters */,
3165 /// ]);
3166 /// ```
3167 pub fn set_annotation_progress<T, V>(mut self, v: T) -> Self
3168 where
3169 T: std::iter::IntoIterator<Item = V>,
3170 V: std::convert::Into<crate::model::VideoAnnotationProgress>,
3171 {
3172 use std::iter::Iterator;
3173 self.annotation_progress = v.into_iter().map(|i| i.into()).collect();
3174 self
3175 }
3176}
3177
3178impl wkt::message::Message for AnnotateVideoProgress {
3179 fn typename() -> &'static str {
3180 "type.googleapis.com/google.cloud.videointelligence.v1.AnnotateVideoProgress"
3181 }
3182}
3183
3184/// Config for SPEECH_TRANSCRIPTION.
3185#[derive(Clone, Default, PartialEq)]
3186#[non_exhaustive]
3187pub struct SpeechTranscriptionConfig {
3188 /// Required. *Required* The language of the supplied audio as a
3189 /// [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag.
3190 /// Example: "en-US".
3191 /// See [Language Support](https://cloud.google.com/speech/docs/languages)
3192 /// for a list of the currently supported language codes.
3193 pub language_code: std::string::String,
3194
3195 /// Optional. Maximum number of recognition hypotheses to be returned.
3196 /// Specifically, the maximum number of `SpeechRecognitionAlternative` messages
3197 /// within each `SpeechTranscription`. The server may return fewer than
3198 /// `max_alternatives`. Valid values are `0`-`30`. A value of `0` or `1` will
3199 /// return a maximum of one. If omitted, will return a maximum of one.
3200 pub max_alternatives: i32,
3201
3202 /// Optional. If set to `true`, the server will attempt to filter out
3203 /// profanities, replacing all but the initial character in each filtered word
3204 /// with asterisks, e.g. "f***". If set to `false` or omitted, profanities
3205 /// won't be filtered out.
3206 pub filter_profanity: bool,
3207
3208 /// Optional. A means to provide context to assist the speech recognition.
3209 pub speech_contexts: std::vec::Vec<crate::model::SpeechContext>,
3210
3211 /// Optional. If 'true', adds punctuation to recognition result hypotheses.
3212 /// This feature is only available in select languages. Setting this for
3213 /// requests in other languages has no effect at all. The default 'false' value
3214 /// does not add punctuation to result hypotheses. NOTE: "This is currently
3215 /// offered as an experimental service, complimentary to all users. In the
3216 /// future this may be exclusively available as a premium feature."
3217 pub enable_automatic_punctuation: bool,
3218
3219 /// Optional. For file formats, such as MXF or MKV, supporting multiple audio
3220 /// tracks, specify up to two tracks. Default: track 0.
3221 pub audio_tracks: std::vec::Vec<i32>,
3222
3223 /// Optional. If 'true', enables speaker detection for each recognized word in
3224 /// the top alternative of the recognition result using a speaker_tag provided
3225 /// in the WordInfo.
3226 /// Note: When this is true, we send all the words from the beginning of the
3227 /// audio for the top alternative in every consecutive response.
3228 /// This is done in order to improve our speaker tags as our models learn to
3229 /// identify the speakers in the conversation over time.
3230 pub enable_speaker_diarization: bool,
3231
3232 /// Optional. If set, specifies the estimated number of speakers in the
3233 /// conversation. If not set, defaults to '2'. Ignored unless
3234 /// enable_speaker_diarization is set to true.
3235 pub diarization_speaker_count: i32,
3236
3237 /// Optional. If `true`, the top result includes a list of words and the
3238 /// confidence for those words. If `false`, no word-level confidence
3239 /// information is returned. The default is `false`.
3240 pub enable_word_confidence: bool,
3241
3242 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3243}
3244
3245impl SpeechTranscriptionConfig {
3246 /// Creates a new default instance.
3247 pub fn new() -> Self {
3248 std::default::Default::default()
3249 }
3250
3251 /// Sets the value of [language_code][crate::model::SpeechTranscriptionConfig::language_code].
3252 ///
3253 /// # Example
3254 /// ```ignore,no_run
3255 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3256 /// let x = SpeechTranscriptionConfig::new().set_language_code("example");
3257 /// ```
3258 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3259 self.language_code = v.into();
3260 self
3261 }
3262
3263 /// Sets the value of [max_alternatives][crate::model::SpeechTranscriptionConfig::max_alternatives].
3264 ///
3265 /// # Example
3266 /// ```ignore,no_run
3267 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3268 /// let x = SpeechTranscriptionConfig::new().set_max_alternatives(42);
3269 /// ```
3270 pub fn set_max_alternatives<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3271 self.max_alternatives = v.into();
3272 self
3273 }
3274
3275 /// Sets the value of [filter_profanity][crate::model::SpeechTranscriptionConfig::filter_profanity].
3276 ///
3277 /// # Example
3278 /// ```ignore,no_run
3279 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3280 /// let x = SpeechTranscriptionConfig::new().set_filter_profanity(true);
3281 /// ```
3282 pub fn set_filter_profanity<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3283 self.filter_profanity = v.into();
3284 self
3285 }
3286
3287 /// Sets the value of [speech_contexts][crate::model::SpeechTranscriptionConfig::speech_contexts].
3288 ///
3289 /// # Example
3290 /// ```ignore,no_run
3291 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3292 /// use google_cloud_videointelligence_v1::model::SpeechContext;
3293 /// let x = SpeechTranscriptionConfig::new()
3294 /// .set_speech_contexts([
3295 /// SpeechContext::default()/* use setters */,
3296 /// SpeechContext::default()/* use (different) setters */,
3297 /// ]);
3298 /// ```
3299 pub fn set_speech_contexts<T, V>(mut self, v: T) -> Self
3300 where
3301 T: std::iter::IntoIterator<Item = V>,
3302 V: std::convert::Into<crate::model::SpeechContext>,
3303 {
3304 use std::iter::Iterator;
3305 self.speech_contexts = v.into_iter().map(|i| i.into()).collect();
3306 self
3307 }
3308
3309 /// Sets the value of [enable_automatic_punctuation][crate::model::SpeechTranscriptionConfig::enable_automatic_punctuation].
3310 ///
3311 /// # Example
3312 /// ```ignore,no_run
3313 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3314 /// let x = SpeechTranscriptionConfig::new().set_enable_automatic_punctuation(true);
3315 /// ```
3316 pub fn set_enable_automatic_punctuation<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3317 self.enable_automatic_punctuation = v.into();
3318 self
3319 }
3320
3321 /// Sets the value of [audio_tracks][crate::model::SpeechTranscriptionConfig::audio_tracks].
3322 ///
3323 /// # Example
3324 /// ```ignore,no_run
3325 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3326 /// let x = SpeechTranscriptionConfig::new().set_audio_tracks([1, 2, 3]);
3327 /// ```
3328 pub fn set_audio_tracks<T, V>(mut self, v: T) -> Self
3329 where
3330 T: std::iter::IntoIterator<Item = V>,
3331 V: std::convert::Into<i32>,
3332 {
3333 use std::iter::Iterator;
3334 self.audio_tracks = v.into_iter().map(|i| i.into()).collect();
3335 self
3336 }
3337
3338 /// Sets the value of [enable_speaker_diarization][crate::model::SpeechTranscriptionConfig::enable_speaker_diarization].
3339 ///
3340 /// # Example
3341 /// ```ignore,no_run
3342 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3343 /// let x = SpeechTranscriptionConfig::new().set_enable_speaker_diarization(true);
3344 /// ```
3345 pub fn set_enable_speaker_diarization<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3346 self.enable_speaker_diarization = v.into();
3347 self
3348 }
3349
3350 /// Sets the value of [diarization_speaker_count][crate::model::SpeechTranscriptionConfig::diarization_speaker_count].
3351 ///
3352 /// # Example
3353 /// ```ignore,no_run
3354 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3355 /// let x = SpeechTranscriptionConfig::new().set_diarization_speaker_count(42);
3356 /// ```
3357 pub fn set_diarization_speaker_count<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3358 self.diarization_speaker_count = v.into();
3359 self
3360 }
3361
3362 /// Sets the value of [enable_word_confidence][crate::model::SpeechTranscriptionConfig::enable_word_confidence].
3363 ///
3364 /// # Example
3365 /// ```ignore,no_run
3366 /// # use google_cloud_videointelligence_v1::model::SpeechTranscriptionConfig;
3367 /// let x = SpeechTranscriptionConfig::new().set_enable_word_confidence(true);
3368 /// ```
3369 pub fn set_enable_word_confidence<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
3370 self.enable_word_confidence = v.into();
3371 self
3372 }
3373}
3374
3375impl wkt::message::Message for SpeechTranscriptionConfig {
3376 fn typename() -> &'static str {
3377 "type.googleapis.com/google.cloud.videointelligence.v1.SpeechTranscriptionConfig"
3378 }
3379}
3380
3381/// Provides "hints" to the speech recognizer to favor specific words and phrases
3382/// in the results.
3383#[derive(Clone, Default, PartialEq)]
3384#[non_exhaustive]
3385pub struct SpeechContext {
3386 /// Optional. A list of strings containing words and phrases "hints" so that
3387 /// the speech recognition is more likely to recognize them. This can be used
3388 /// to improve the accuracy for specific words and phrases, for example, if
3389 /// specific commands are typically spoken by the user. This can also be used
3390 /// to add additional words to the vocabulary of the recognizer. See
3391 /// [usage limits](https://cloud.google.com/speech/limits#content).
3392 pub phrases: std::vec::Vec<std::string::String>,
3393
3394 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3395}
3396
3397impl SpeechContext {
3398 /// Creates a new default instance.
3399 pub fn new() -> Self {
3400 std::default::Default::default()
3401 }
3402
3403 /// Sets the value of [phrases][crate::model::SpeechContext::phrases].
3404 ///
3405 /// # Example
3406 /// ```ignore,no_run
3407 /// # use google_cloud_videointelligence_v1::model::SpeechContext;
3408 /// let x = SpeechContext::new().set_phrases(["a", "b", "c"]);
3409 /// ```
3410 pub fn set_phrases<T, V>(mut self, v: T) -> Self
3411 where
3412 T: std::iter::IntoIterator<Item = V>,
3413 V: std::convert::Into<std::string::String>,
3414 {
3415 use std::iter::Iterator;
3416 self.phrases = v.into_iter().map(|i| i.into()).collect();
3417 self
3418 }
3419}
3420
3421impl wkt::message::Message for SpeechContext {
3422 fn typename() -> &'static str {
3423 "type.googleapis.com/google.cloud.videointelligence.v1.SpeechContext"
3424 }
3425}
3426
3427/// A speech recognition result corresponding to a portion of the audio.
3428#[derive(Clone, Default, PartialEq)]
3429#[non_exhaustive]
3430pub struct SpeechTranscription {
3431 /// May contain one or more recognition hypotheses (up to the maximum specified
3432 /// in `max_alternatives`). These alternatives are ordered in terms of
3433 /// accuracy, with the top (first) alternative being the most probable, as
3434 /// ranked by the recognizer.
3435 pub alternatives: std::vec::Vec<crate::model::SpeechRecognitionAlternative>,
3436
3437 /// Output only. The [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt)
3438 /// language tag of the language in this result. This language code was
3439 /// detected to have the most likelihood of being spoken in the audio.
3440 pub language_code: std::string::String,
3441
3442 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3443}
3444
3445impl SpeechTranscription {
3446 /// Creates a new default instance.
3447 pub fn new() -> Self {
3448 std::default::Default::default()
3449 }
3450
3451 /// Sets the value of [alternatives][crate::model::SpeechTranscription::alternatives].
3452 ///
3453 /// # Example
3454 /// ```ignore,no_run
3455 /// # use google_cloud_videointelligence_v1::model::SpeechTranscription;
3456 /// use google_cloud_videointelligence_v1::model::SpeechRecognitionAlternative;
3457 /// let x = SpeechTranscription::new()
3458 /// .set_alternatives([
3459 /// SpeechRecognitionAlternative::default()/* use setters */,
3460 /// SpeechRecognitionAlternative::default()/* use (different) setters */,
3461 /// ]);
3462 /// ```
3463 pub fn set_alternatives<T, V>(mut self, v: T) -> Self
3464 where
3465 T: std::iter::IntoIterator<Item = V>,
3466 V: std::convert::Into<crate::model::SpeechRecognitionAlternative>,
3467 {
3468 use std::iter::Iterator;
3469 self.alternatives = v.into_iter().map(|i| i.into()).collect();
3470 self
3471 }
3472
3473 /// Sets the value of [language_code][crate::model::SpeechTranscription::language_code].
3474 ///
3475 /// # Example
3476 /// ```ignore,no_run
3477 /// # use google_cloud_videointelligence_v1::model::SpeechTranscription;
3478 /// let x = SpeechTranscription::new().set_language_code("example");
3479 /// ```
3480 pub fn set_language_code<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3481 self.language_code = v.into();
3482 self
3483 }
3484}
3485
3486impl wkt::message::Message for SpeechTranscription {
3487 fn typename() -> &'static str {
3488 "type.googleapis.com/google.cloud.videointelligence.v1.SpeechTranscription"
3489 }
3490}
3491
3492/// Alternative hypotheses (a.k.a. n-best list).
3493#[derive(Clone, Default, PartialEq)]
3494#[non_exhaustive]
3495pub struct SpeechRecognitionAlternative {
3496 /// Transcript text representing the words that the user spoke.
3497 pub transcript: std::string::String,
3498
3499 /// Output only. The confidence estimate between 0.0 and 1.0. A higher number
3500 /// indicates an estimated greater likelihood that the recognized words are
3501 /// correct. This field is set only for the top alternative.
3502 /// This field is not guaranteed to be accurate and users should not rely on it
3503 /// to be always provided.
3504 /// The default of 0.0 is a sentinel value indicating `confidence` was not set.
3505 pub confidence: f32,
3506
3507 /// Output only. A list of word-specific information for each recognized word.
3508 /// Note: When `enable_speaker_diarization` is set to true, you will see all
3509 /// the words from the beginning of the audio.
3510 pub words: std::vec::Vec<crate::model::WordInfo>,
3511
3512 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3513}
3514
3515impl SpeechRecognitionAlternative {
3516 /// Creates a new default instance.
3517 pub fn new() -> Self {
3518 std::default::Default::default()
3519 }
3520
3521 /// Sets the value of [transcript][crate::model::SpeechRecognitionAlternative::transcript].
3522 ///
3523 /// # Example
3524 /// ```ignore,no_run
3525 /// # use google_cloud_videointelligence_v1::model::SpeechRecognitionAlternative;
3526 /// let x = SpeechRecognitionAlternative::new().set_transcript("example");
3527 /// ```
3528 pub fn set_transcript<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3529 self.transcript = v.into();
3530 self
3531 }
3532
3533 /// Sets the value of [confidence][crate::model::SpeechRecognitionAlternative::confidence].
3534 ///
3535 /// # Example
3536 /// ```ignore,no_run
3537 /// # use google_cloud_videointelligence_v1::model::SpeechRecognitionAlternative;
3538 /// let x = SpeechRecognitionAlternative::new().set_confidence(42.0);
3539 /// ```
3540 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3541 self.confidence = v.into();
3542 self
3543 }
3544
3545 /// Sets the value of [words][crate::model::SpeechRecognitionAlternative::words].
3546 ///
3547 /// # Example
3548 /// ```ignore,no_run
3549 /// # use google_cloud_videointelligence_v1::model::SpeechRecognitionAlternative;
3550 /// use google_cloud_videointelligence_v1::model::WordInfo;
3551 /// let x = SpeechRecognitionAlternative::new()
3552 /// .set_words([
3553 /// WordInfo::default()/* use setters */,
3554 /// WordInfo::default()/* use (different) setters */,
3555 /// ]);
3556 /// ```
3557 pub fn set_words<T, V>(mut self, v: T) -> Self
3558 where
3559 T: std::iter::IntoIterator<Item = V>,
3560 V: std::convert::Into<crate::model::WordInfo>,
3561 {
3562 use std::iter::Iterator;
3563 self.words = v.into_iter().map(|i| i.into()).collect();
3564 self
3565 }
3566}
3567
3568impl wkt::message::Message for SpeechRecognitionAlternative {
3569 fn typename() -> &'static str {
3570 "type.googleapis.com/google.cloud.videointelligence.v1.SpeechRecognitionAlternative"
3571 }
3572}
3573
3574/// Word-specific information for recognized words. Word information is only
3575/// included in the response when certain request parameters are set, such
3576/// as `enable_word_time_offsets`.
3577#[derive(Clone, Default, PartialEq)]
3578#[non_exhaustive]
3579pub struct WordInfo {
3580 /// Time offset relative to the beginning of the audio, and
3581 /// corresponding to the start of the spoken word. This field is only set if
3582 /// `enable_word_time_offsets=true` and only in the top hypothesis. This is an
3583 /// experimental feature and the accuracy of the time offset can vary.
3584 pub start_time: std::option::Option<wkt::Duration>,
3585
3586 /// Time offset relative to the beginning of the audio, and
3587 /// corresponding to the end of the spoken word. This field is only set if
3588 /// `enable_word_time_offsets=true` and only in the top hypothesis. This is an
3589 /// experimental feature and the accuracy of the time offset can vary.
3590 pub end_time: std::option::Option<wkt::Duration>,
3591
3592 /// The word corresponding to this set of information.
3593 pub word: std::string::String,
3594
3595 /// Output only. The confidence estimate between 0.0 and 1.0. A higher number
3596 /// indicates an estimated greater likelihood that the recognized words are
3597 /// correct. This field is set only for the top alternative.
3598 /// This field is not guaranteed to be accurate and users should not rely on it
3599 /// to be always provided.
3600 /// The default of 0.0 is a sentinel value indicating `confidence` was not set.
3601 pub confidence: f32,
3602
3603 /// Output only. A distinct integer value is assigned for every speaker within
3604 /// the audio. This field specifies which one of those speakers was detected to
3605 /// have spoken this word. Value ranges from 1 up to diarization_speaker_count,
3606 /// and is only set if speaker diarization is enabled.
3607 pub speaker_tag: i32,
3608
3609 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3610}
3611
3612impl WordInfo {
3613 /// Creates a new default instance.
3614 pub fn new() -> Self {
3615 std::default::Default::default()
3616 }
3617
3618 /// Sets the value of [start_time][crate::model::WordInfo::start_time].
3619 ///
3620 /// # Example
3621 /// ```ignore,no_run
3622 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3623 /// use wkt::Duration;
3624 /// let x = WordInfo::new().set_start_time(Duration::default()/* use setters */);
3625 /// ```
3626 pub fn set_start_time<T>(mut self, v: T) -> Self
3627 where
3628 T: std::convert::Into<wkt::Duration>,
3629 {
3630 self.start_time = std::option::Option::Some(v.into());
3631 self
3632 }
3633
3634 /// Sets or clears the value of [start_time][crate::model::WordInfo::start_time].
3635 ///
3636 /// # Example
3637 /// ```ignore,no_run
3638 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3639 /// use wkt::Duration;
3640 /// let x = WordInfo::new().set_or_clear_start_time(Some(Duration::default()/* use setters */));
3641 /// let x = WordInfo::new().set_or_clear_start_time(None::<Duration>);
3642 /// ```
3643 pub fn set_or_clear_start_time<T>(mut self, v: std::option::Option<T>) -> Self
3644 where
3645 T: std::convert::Into<wkt::Duration>,
3646 {
3647 self.start_time = v.map(|x| x.into());
3648 self
3649 }
3650
3651 /// Sets the value of [end_time][crate::model::WordInfo::end_time].
3652 ///
3653 /// # Example
3654 /// ```ignore,no_run
3655 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3656 /// use wkt::Duration;
3657 /// let x = WordInfo::new().set_end_time(Duration::default()/* use setters */);
3658 /// ```
3659 pub fn set_end_time<T>(mut self, v: T) -> Self
3660 where
3661 T: std::convert::Into<wkt::Duration>,
3662 {
3663 self.end_time = std::option::Option::Some(v.into());
3664 self
3665 }
3666
3667 /// Sets or clears the value of [end_time][crate::model::WordInfo::end_time].
3668 ///
3669 /// # Example
3670 /// ```ignore,no_run
3671 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3672 /// use wkt::Duration;
3673 /// let x = WordInfo::new().set_or_clear_end_time(Some(Duration::default()/* use setters */));
3674 /// let x = WordInfo::new().set_or_clear_end_time(None::<Duration>);
3675 /// ```
3676 pub fn set_or_clear_end_time<T>(mut self, v: std::option::Option<T>) -> Self
3677 where
3678 T: std::convert::Into<wkt::Duration>,
3679 {
3680 self.end_time = v.map(|x| x.into());
3681 self
3682 }
3683
3684 /// Sets the value of [word][crate::model::WordInfo::word].
3685 ///
3686 /// # Example
3687 /// ```ignore,no_run
3688 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3689 /// let x = WordInfo::new().set_word("example");
3690 /// ```
3691 pub fn set_word<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
3692 self.word = v.into();
3693 self
3694 }
3695
3696 /// Sets the value of [confidence][crate::model::WordInfo::confidence].
3697 ///
3698 /// # Example
3699 /// ```ignore,no_run
3700 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3701 /// let x = WordInfo::new().set_confidence(42.0);
3702 /// ```
3703 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3704 self.confidence = v.into();
3705 self
3706 }
3707
3708 /// Sets the value of [speaker_tag][crate::model::WordInfo::speaker_tag].
3709 ///
3710 /// # Example
3711 /// ```ignore,no_run
3712 /// # use google_cloud_videointelligence_v1::model::WordInfo;
3713 /// let x = WordInfo::new().set_speaker_tag(42);
3714 /// ```
3715 pub fn set_speaker_tag<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
3716 self.speaker_tag = v.into();
3717 self
3718 }
3719}
3720
3721impl wkt::message::Message for WordInfo {
3722 fn typename() -> &'static str {
3723 "type.googleapis.com/google.cloud.videointelligence.v1.WordInfo"
3724 }
3725}
3726
3727/// A vertex represents a 2D point in the image.
3728/// NOTE: the normalized vertex coordinates are relative to the original image
3729/// and range from 0 to 1.
3730#[derive(Clone, Default, PartialEq)]
3731#[non_exhaustive]
3732pub struct NormalizedVertex {
3733 /// X coordinate.
3734 pub x: f32,
3735
3736 /// Y coordinate.
3737 pub y: f32,
3738
3739 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3740}
3741
3742impl NormalizedVertex {
3743 /// Creates a new default instance.
3744 pub fn new() -> Self {
3745 std::default::Default::default()
3746 }
3747
3748 /// Sets the value of [x][crate::model::NormalizedVertex::x].
3749 ///
3750 /// # Example
3751 /// ```ignore,no_run
3752 /// # use google_cloud_videointelligence_v1::model::NormalizedVertex;
3753 /// let x = NormalizedVertex::new().set_x(42.0);
3754 /// ```
3755 pub fn set_x<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3756 self.x = v.into();
3757 self
3758 }
3759
3760 /// Sets the value of [y][crate::model::NormalizedVertex::y].
3761 ///
3762 /// # Example
3763 /// ```ignore,no_run
3764 /// # use google_cloud_videointelligence_v1::model::NormalizedVertex;
3765 /// let x = NormalizedVertex::new().set_y(42.0);
3766 /// ```
3767 pub fn set_y<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3768 self.y = v.into();
3769 self
3770 }
3771}
3772
3773impl wkt::message::Message for NormalizedVertex {
3774 fn typename() -> &'static str {
3775 "type.googleapis.com/google.cloud.videointelligence.v1.NormalizedVertex"
3776 }
3777}
3778
3779/// Normalized bounding polygon for text (that might not be aligned with axis).
3780/// Contains list of the corner points in clockwise order starting from
3781/// top-left corner. For example, for a rectangular bounding box:
3782/// When the text is horizontal it might look like:
3783/// 0----1
3784/// | |
3785/// 3----2
3786///
3787/// When it's clockwise rotated 180 degrees around the top-left corner it
3788/// becomes:
3789/// 2----3
3790/// | |
3791/// 1----0
3792///
3793/// and the vertex order will still be (0, 1, 2, 3). Note that values can be less
3794/// than 0, or greater than 1 due to trignometric calculations for location of
3795/// the box.
3796#[derive(Clone, Default, PartialEq)]
3797#[non_exhaustive]
3798pub struct NormalizedBoundingPoly {
3799 /// Normalized vertices of the bounding polygon.
3800 pub vertices: std::vec::Vec<crate::model::NormalizedVertex>,
3801
3802 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3803}
3804
3805impl NormalizedBoundingPoly {
3806 /// Creates a new default instance.
3807 pub fn new() -> Self {
3808 std::default::Default::default()
3809 }
3810
3811 /// Sets the value of [vertices][crate::model::NormalizedBoundingPoly::vertices].
3812 ///
3813 /// # Example
3814 /// ```ignore,no_run
3815 /// # use google_cloud_videointelligence_v1::model::NormalizedBoundingPoly;
3816 /// use google_cloud_videointelligence_v1::model::NormalizedVertex;
3817 /// let x = NormalizedBoundingPoly::new()
3818 /// .set_vertices([
3819 /// NormalizedVertex::default()/* use setters */,
3820 /// NormalizedVertex::default()/* use (different) setters */,
3821 /// ]);
3822 /// ```
3823 pub fn set_vertices<T, V>(mut self, v: T) -> Self
3824 where
3825 T: std::iter::IntoIterator<Item = V>,
3826 V: std::convert::Into<crate::model::NormalizedVertex>,
3827 {
3828 use std::iter::Iterator;
3829 self.vertices = v.into_iter().map(|i| i.into()).collect();
3830 self
3831 }
3832}
3833
3834impl wkt::message::Message for NormalizedBoundingPoly {
3835 fn typename() -> &'static str {
3836 "type.googleapis.com/google.cloud.videointelligence.v1.NormalizedBoundingPoly"
3837 }
3838}
3839
3840/// Video segment level annotation results for text detection.
3841#[derive(Clone, Default, PartialEq)]
3842#[non_exhaustive]
3843pub struct TextSegment {
3844 /// Video segment where a text snippet was detected.
3845 pub segment: std::option::Option<crate::model::VideoSegment>,
3846
3847 /// Confidence for the track of detected text. It is calculated as the highest
3848 /// over all frames where OCR detected text appears.
3849 pub confidence: f32,
3850
3851 /// Information related to the frames where OCR detected text appears.
3852 pub frames: std::vec::Vec<crate::model::TextFrame>,
3853
3854 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3855}
3856
3857impl TextSegment {
3858 /// Creates a new default instance.
3859 pub fn new() -> Self {
3860 std::default::Default::default()
3861 }
3862
3863 /// Sets the value of [segment][crate::model::TextSegment::segment].
3864 ///
3865 /// # Example
3866 /// ```ignore,no_run
3867 /// # use google_cloud_videointelligence_v1::model::TextSegment;
3868 /// use google_cloud_videointelligence_v1::model::VideoSegment;
3869 /// let x = TextSegment::new().set_segment(VideoSegment::default()/* use setters */);
3870 /// ```
3871 pub fn set_segment<T>(mut self, v: T) -> Self
3872 where
3873 T: std::convert::Into<crate::model::VideoSegment>,
3874 {
3875 self.segment = std::option::Option::Some(v.into());
3876 self
3877 }
3878
3879 /// Sets or clears the value of [segment][crate::model::TextSegment::segment].
3880 ///
3881 /// # Example
3882 /// ```ignore,no_run
3883 /// # use google_cloud_videointelligence_v1::model::TextSegment;
3884 /// use google_cloud_videointelligence_v1::model::VideoSegment;
3885 /// let x = TextSegment::new().set_or_clear_segment(Some(VideoSegment::default()/* use setters */));
3886 /// let x = TextSegment::new().set_or_clear_segment(None::<VideoSegment>);
3887 /// ```
3888 pub fn set_or_clear_segment<T>(mut self, v: std::option::Option<T>) -> Self
3889 where
3890 T: std::convert::Into<crate::model::VideoSegment>,
3891 {
3892 self.segment = v.map(|x| x.into());
3893 self
3894 }
3895
3896 /// Sets the value of [confidence][crate::model::TextSegment::confidence].
3897 ///
3898 /// # Example
3899 /// ```ignore,no_run
3900 /// # use google_cloud_videointelligence_v1::model::TextSegment;
3901 /// let x = TextSegment::new().set_confidence(42.0);
3902 /// ```
3903 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
3904 self.confidence = v.into();
3905 self
3906 }
3907
3908 /// Sets the value of [frames][crate::model::TextSegment::frames].
3909 ///
3910 /// # Example
3911 /// ```ignore,no_run
3912 /// # use google_cloud_videointelligence_v1::model::TextSegment;
3913 /// use google_cloud_videointelligence_v1::model::TextFrame;
3914 /// let x = TextSegment::new()
3915 /// .set_frames([
3916 /// TextFrame::default()/* use setters */,
3917 /// TextFrame::default()/* use (different) setters */,
3918 /// ]);
3919 /// ```
3920 pub fn set_frames<T, V>(mut self, v: T) -> Self
3921 where
3922 T: std::iter::IntoIterator<Item = V>,
3923 V: std::convert::Into<crate::model::TextFrame>,
3924 {
3925 use std::iter::Iterator;
3926 self.frames = v.into_iter().map(|i| i.into()).collect();
3927 self
3928 }
3929}
3930
3931impl wkt::message::Message for TextSegment {
3932 fn typename() -> &'static str {
3933 "type.googleapis.com/google.cloud.videointelligence.v1.TextSegment"
3934 }
3935}
3936
3937/// Video frame level annotation results for text annotation (OCR).
3938/// Contains information regarding timestamp and bounding box locations for the
3939/// frames containing detected OCR text snippets.
3940#[derive(Clone, Default, PartialEq)]
3941#[non_exhaustive]
3942pub struct TextFrame {
3943 /// Bounding polygon of the detected text for this frame.
3944 pub rotated_bounding_box: std::option::Option<crate::model::NormalizedBoundingPoly>,
3945
3946 /// Timestamp of this frame.
3947 pub time_offset: std::option::Option<wkt::Duration>,
3948
3949 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
3950}
3951
3952impl TextFrame {
3953 /// Creates a new default instance.
3954 pub fn new() -> Self {
3955 std::default::Default::default()
3956 }
3957
3958 /// Sets the value of [rotated_bounding_box][crate::model::TextFrame::rotated_bounding_box].
3959 ///
3960 /// # Example
3961 /// ```ignore,no_run
3962 /// # use google_cloud_videointelligence_v1::model::TextFrame;
3963 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingPoly;
3964 /// let x = TextFrame::new().set_rotated_bounding_box(NormalizedBoundingPoly::default()/* use setters */);
3965 /// ```
3966 pub fn set_rotated_bounding_box<T>(mut self, v: T) -> Self
3967 where
3968 T: std::convert::Into<crate::model::NormalizedBoundingPoly>,
3969 {
3970 self.rotated_bounding_box = std::option::Option::Some(v.into());
3971 self
3972 }
3973
3974 /// Sets or clears the value of [rotated_bounding_box][crate::model::TextFrame::rotated_bounding_box].
3975 ///
3976 /// # Example
3977 /// ```ignore,no_run
3978 /// # use google_cloud_videointelligence_v1::model::TextFrame;
3979 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingPoly;
3980 /// let x = TextFrame::new().set_or_clear_rotated_bounding_box(Some(NormalizedBoundingPoly::default()/* use setters */));
3981 /// let x = TextFrame::new().set_or_clear_rotated_bounding_box(None::<NormalizedBoundingPoly>);
3982 /// ```
3983 pub fn set_or_clear_rotated_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
3984 where
3985 T: std::convert::Into<crate::model::NormalizedBoundingPoly>,
3986 {
3987 self.rotated_bounding_box = v.map(|x| x.into());
3988 self
3989 }
3990
3991 /// Sets the value of [time_offset][crate::model::TextFrame::time_offset].
3992 ///
3993 /// # Example
3994 /// ```ignore,no_run
3995 /// # use google_cloud_videointelligence_v1::model::TextFrame;
3996 /// use wkt::Duration;
3997 /// let x = TextFrame::new().set_time_offset(Duration::default()/* use setters */);
3998 /// ```
3999 pub fn set_time_offset<T>(mut self, v: T) -> Self
4000 where
4001 T: std::convert::Into<wkt::Duration>,
4002 {
4003 self.time_offset = std::option::Option::Some(v.into());
4004 self
4005 }
4006
4007 /// Sets or clears the value of [time_offset][crate::model::TextFrame::time_offset].
4008 ///
4009 /// # Example
4010 /// ```ignore,no_run
4011 /// # use google_cloud_videointelligence_v1::model::TextFrame;
4012 /// use wkt::Duration;
4013 /// let x = TextFrame::new().set_or_clear_time_offset(Some(Duration::default()/* use setters */));
4014 /// let x = TextFrame::new().set_or_clear_time_offset(None::<Duration>);
4015 /// ```
4016 pub fn set_or_clear_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
4017 where
4018 T: std::convert::Into<wkt::Duration>,
4019 {
4020 self.time_offset = v.map(|x| x.into());
4021 self
4022 }
4023}
4024
4025impl wkt::message::Message for TextFrame {
4026 fn typename() -> &'static str {
4027 "type.googleapis.com/google.cloud.videointelligence.v1.TextFrame"
4028 }
4029}
4030
4031/// Annotations related to one detected OCR text snippet. This will contain the
4032/// corresponding text, confidence value, and frame level information for each
4033/// detection.
4034#[derive(Clone, Default, PartialEq)]
4035#[non_exhaustive]
4036pub struct TextAnnotation {
4037 /// The detected text.
4038 pub text: std::string::String,
4039
4040 /// All video segments where OCR detected text appears.
4041 pub segments: std::vec::Vec<crate::model::TextSegment>,
4042
4043 /// Feature version.
4044 pub version: std::string::String,
4045
4046 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4047}
4048
4049impl TextAnnotation {
4050 /// Creates a new default instance.
4051 pub fn new() -> Self {
4052 std::default::Default::default()
4053 }
4054
4055 /// Sets the value of [text][crate::model::TextAnnotation::text].
4056 ///
4057 /// # Example
4058 /// ```ignore,no_run
4059 /// # use google_cloud_videointelligence_v1::model::TextAnnotation;
4060 /// let x = TextAnnotation::new().set_text("example");
4061 /// ```
4062 pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4063 self.text = v.into();
4064 self
4065 }
4066
4067 /// Sets the value of [segments][crate::model::TextAnnotation::segments].
4068 ///
4069 /// # Example
4070 /// ```ignore,no_run
4071 /// # use google_cloud_videointelligence_v1::model::TextAnnotation;
4072 /// use google_cloud_videointelligence_v1::model::TextSegment;
4073 /// let x = TextAnnotation::new()
4074 /// .set_segments([
4075 /// TextSegment::default()/* use setters */,
4076 /// TextSegment::default()/* use (different) setters */,
4077 /// ]);
4078 /// ```
4079 pub fn set_segments<T, V>(mut self, v: T) -> Self
4080 where
4081 T: std::iter::IntoIterator<Item = V>,
4082 V: std::convert::Into<crate::model::TextSegment>,
4083 {
4084 use std::iter::Iterator;
4085 self.segments = v.into_iter().map(|i| i.into()).collect();
4086 self
4087 }
4088
4089 /// Sets the value of [version][crate::model::TextAnnotation::version].
4090 ///
4091 /// # Example
4092 /// ```ignore,no_run
4093 /// # use google_cloud_videointelligence_v1::model::TextAnnotation;
4094 /// let x = TextAnnotation::new().set_version("example");
4095 /// ```
4096 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4097 self.version = v.into();
4098 self
4099 }
4100}
4101
4102impl wkt::message::Message for TextAnnotation {
4103 fn typename() -> &'static str {
4104 "type.googleapis.com/google.cloud.videointelligence.v1.TextAnnotation"
4105 }
4106}
4107
4108/// Video frame level annotations for object detection and tracking. This field
4109/// stores per frame location, time offset, and confidence.
4110#[derive(Clone, Default, PartialEq)]
4111#[non_exhaustive]
4112pub struct ObjectTrackingFrame {
4113 /// The normalized bounding box location of this object track for the frame.
4114 pub normalized_bounding_box: std::option::Option<crate::model::NormalizedBoundingBox>,
4115
4116 /// The timestamp of the frame in microseconds.
4117 pub time_offset: std::option::Option<wkt::Duration>,
4118
4119 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4120}
4121
4122impl ObjectTrackingFrame {
4123 /// Creates a new default instance.
4124 pub fn new() -> Self {
4125 std::default::Default::default()
4126 }
4127
4128 /// Sets the value of [normalized_bounding_box][crate::model::ObjectTrackingFrame::normalized_bounding_box].
4129 ///
4130 /// # Example
4131 /// ```ignore,no_run
4132 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingFrame;
4133 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
4134 /// let x = ObjectTrackingFrame::new().set_normalized_bounding_box(NormalizedBoundingBox::default()/* use setters */);
4135 /// ```
4136 pub fn set_normalized_bounding_box<T>(mut self, v: T) -> Self
4137 where
4138 T: std::convert::Into<crate::model::NormalizedBoundingBox>,
4139 {
4140 self.normalized_bounding_box = std::option::Option::Some(v.into());
4141 self
4142 }
4143
4144 /// Sets or clears the value of [normalized_bounding_box][crate::model::ObjectTrackingFrame::normalized_bounding_box].
4145 ///
4146 /// # Example
4147 /// ```ignore,no_run
4148 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingFrame;
4149 /// use google_cloud_videointelligence_v1::model::NormalizedBoundingBox;
4150 /// let x = ObjectTrackingFrame::new().set_or_clear_normalized_bounding_box(Some(NormalizedBoundingBox::default()/* use setters */));
4151 /// let x = ObjectTrackingFrame::new().set_or_clear_normalized_bounding_box(None::<NormalizedBoundingBox>);
4152 /// ```
4153 pub fn set_or_clear_normalized_bounding_box<T>(mut self, v: std::option::Option<T>) -> Self
4154 where
4155 T: std::convert::Into<crate::model::NormalizedBoundingBox>,
4156 {
4157 self.normalized_bounding_box = v.map(|x| x.into());
4158 self
4159 }
4160
4161 /// Sets the value of [time_offset][crate::model::ObjectTrackingFrame::time_offset].
4162 ///
4163 /// # Example
4164 /// ```ignore,no_run
4165 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingFrame;
4166 /// use wkt::Duration;
4167 /// let x = ObjectTrackingFrame::new().set_time_offset(Duration::default()/* use setters */);
4168 /// ```
4169 pub fn set_time_offset<T>(mut self, v: T) -> Self
4170 where
4171 T: std::convert::Into<wkt::Duration>,
4172 {
4173 self.time_offset = std::option::Option::Some(v.into());
4174 self
4175 }
4176
4177 /// Sets or clears the value of [time_offset][crate::model::ObjectTrackingFrame::time_offset].
4178 ///
4179 /// # Example
4180 /// ```ignore,no_run
4181 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingFrame;
4182 /// use wkt::Duration;
4183 /// let x = ObjectTrackingFrame::new().set_or_clear_time_offset(Some(Duration::default()/* use setters */));
4184 /// let x = ObjectTrackingFrame::new().set_or_clear_time_offset(None::<Duration>);
4185 /// ```
4186 pub fn set_or_clear_time_offset<T>(mut self, v: std::option::Option<T>) -> Self
4187 where
4188 T: std::convert::Into<wkt::Duration>,
4189 {
4190 self.time_offset = v.map(|x| x.into());
4191 self
4192 }
4193}
4194
4195impl wkt::message::Message for ObjectTrackingFrame {
4196 fn typename() -> &'static str {
4197 "type.googleapis.com/google.cloud.videointelligence.v1.ObjectTrackingFrame"
4198 }
4199}
4200
4201/// Annotations corresponding to one tracked object.
4202#[derive(Clone, Default, PartialEq)]
4203#[non_exhaustive]
4204pub struct ObjectTrackingAnnotation {
4205 /// Entity to specify the object category that this track is labeled as.
4206 pub entity: std::option::Option<crate::model::Entity>,
4207
4208 /// Object category's labeling confidence of this track.
4209 pub confidence: f32,
4210
4211 /// Information corresponding to all frames where this object track appears.
4212 /// Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame
4213 /// messages in frames.
4214 /// Streaming mode: it can only be one ObjectTrackingFrame message in frames.
4215 pub frames: std::vec::Vec<crate::model::ObjectTrackingFrame>,
4216
4217 /// Feature version.
4218 pub version: std::string::String,
4219
4220 /// Different representation of tracking info in non-streaming batch
4221 /// and streaming modes.
4222 pub track_info: std::option::Option<crate::model::object_tracking_annotation::TrackInfo>,
4223
4224 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4225}
4226
4227impl ObjectTrackingAnnotation {
4228 /// Creates a new default instance.
4229 pub fn new() -> Self {
4230 std::default::Default::default()
4231 }
4232
4233 /// Sets the value of [entity][crate::model::ObjectTrackingAnnotation::entity].
4234 ///
4235 /// # Example
4236 /// ```ignore,no_run
4237 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4238 /// use google_cloud_videointelligence_v1::model::Entity;
4239 /// let x = ObjectTrackingAnnotation::new().set_entity(Entity::default()/* use setters */);
4240 /// ```
4241 pub fn set_entity<T>(mut self, v: T) -> Self
4242 where
4243 T: std::convert::Into<crate::model::Entity>,
4244 {
4245 self.entity = std::option::Option::Some(v.into());
4246 self
4247 }
4248
4249 /// Sets or clears the value of [entity][crate::model::ObjectTrackingAnnotation::entity].
4250 ///
4251 /// # Example
4252 /// ```ignore,no_run
4253 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4254 /// use google_cloud_videointelligence_v1::model::Entity;
4255 /// let x = ObjectTrackingAnnotation::new().set_or_clear_entity(Some(Entity::default()/* use setters */));
4256 /// let x = ObjectTrackingAnnotation::new().set_or_clear_entity(None::<Entity>);
4257 /// ```
4258 pub fn set_or_clear_entity<T>(mut self, v: std::option::Option<T>) -> Self
4259 where
4260 T: std::convert::Into<crate::model::Entity>,
4261 {
4262 self.entity = v.map(|x| x.into());
4263 self
4264 }
4265
4266 /// Sets the value of [confidence][crate::model::ObjectTrackingAnnotation::confidence].
4267 ///
4268 /// # Example
4269 /// ```ignore,no_run
4270 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4271 /// let x = ObjectTrackingAnnotation::new().set_confidence(42.0);
4272 /// ```
4273 pub fn set_confidence<T: std::convert::Into<f32>>(mut self, v: T) -> Self {
4274 self.confidence = v.into();
4275 self
4276 }
4277
4278 /// Sets the value of [frames][crate::model::ObjectTrackingAnnotation::frames].
4279 ///
4280 /// # Example
4281 /// ```ignore,no_run
4282 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4283 /// use google_cloud_videointelligence_v1::model::ObjectTrackingFrame;
4284 /// let x = ObjectTrackingAnnotation::new()
4285 /// .set_frames([
4286 /// ObjectTrackingFrame::default()/* use setters */,
4287 /// ObjectTrackingFrame::default()/* use (different) setters */,
4288 /// ]);
4289 /// ```
4290 pub fn set_frames<T, V>(mut self, v: T) -> Self
4291 where
4292 T: std::iter::IntoIterator<Item = V>,
4293 V: std::convert::Into<crate::model::ObjectTrackingFrame>,
4294 {
4295 use std::iter::Iterator;
4296 self.frames = v.into_iter().map(|i| i.into()).collect();
4297 self
4298 }
4299
4300 /// Sets the value of [version][crate::model::ObjectTrackingAnnotation::version].
4301 ///
4302 /// # Example
4303 /// ```ignore,no_run
4304 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4305 /// let x = ObjectTrackingAnnotation::new().set_version("example");
4306 /// ```
4307 pub fn set_version<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
4308 self.version = v.into();
4309 self
4310 }
4311
4312 /// Sets the value of [track_info][crate::model::ObjectTrackingAnnotation::track_info].
4313 ///
4314 /// Note that all the setters affecting `track_info` are mutually
4315 /// exclusive.
4316 ///
4317 /// # Example
4318 /// ```ignore,no_run
4319 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4320 /// use google_cloud_videointelligence_v1::model::object_tracking_annotation::TrackInfo;
4321 /// let x = ObjectTrackingAnnotation::new().set_track_info(Some(TrackInfo::TrackId(42)));
4322 /// ```
4323 pub fn set_track_info<
4324 T: std::convert::Into<
4325 std::option::Option<crate::model::object_tracking_annotation::TrackInfo>,
4326 >,
4327 >(
4328 mut self,
4329 v: T,
4330 ) -> Self {
4331 self.track_info = v.into();
4332 self
4333 }
4334
4335 /// The value of [track_info][crate::model::ObjectTrackingAnnotation::track_info]
4336 /// if it holds a `Segment`, `None` if the field is not set or
4337 /// holds a different branch.
4338 pub fn segment(&self) -> std::option::Option<&std::boxed::Box<crate::model::VideoSegment>> {
4339 #[allow(unreachable_patterns)]
4340 self.track_info.as_ref().and_then(|v| match v {
4341 crate::model::object_tracking_annotation::TrackInfo::Segment(v) => {
4342 std::option::Option::Some(v)
4343 }
4344 _ => std::option::Option::None,
4345 })
4346 }
4347
4348 /// Sets the value of [track_info][crate::model::ObjectTrackingAnnotation::track_info]
4349 /// to hold a `Segment`.
4350 ///
4351 /// Note that all the setters affecting `track_info` are
4352 /// mutually exclusive.
4353 ///
4354 /// # Example
4355 /// ```ignore,no_run
4356 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4357 /// use google_cloud_videointelligence_v1::model::VideoSegment;
4358 /// let x = ObjectTrackingAnnotation::new().set_segment(VideoSegment::default()/* use setters */);
4359 /// assert!(x.segment().is_some());
4360 /// assert!(x.track_id().is_none());
4361 /// ```
4362 pub fn set_segment<T: std::convert::Into<std::boxed::Box<crate::model::VideoSegment>>>(
4363 mut self,
4364 v: T,
4365 ) -> Self {
4366 self.track_info = std::option::Option::Some(
4367 crate::model::object_tracking_annotation::TrackInfo::Segment(v.into()),
4368 );
4369 self
4370 }
4371
4372 /// The value of [track_info][crate::model::ObjectTrackingAnnotation::track_info]
4373 /// if it holds a `TrackId`, `None` if the field is not set or
4374 /// holds a different branch.
4375 pub fn track_id(&self) -> std::option::Option<&i64> {
4376 #[allow(unreachable_patterns)]
4377 self.track_info.as_ref().and_then(|v| match v {
4378 crate::model::object_tracking_annotation::TrackInfo::TrackId(v) => {
4379 std::option::Option::Some(v)
4380 }
4381 _ => std::option::Option::None,
4382 })
4383 }
4384
4385 /// Sets the value of [track_info][crate::model::ObjectTrackingAnnotation::track_info]
4386 /// to hold a `TrackId`.
4387 ///
4388 /// Note that all the setters affecting `track_info` are
4389 /// mutually exclusive.
4390 ///
4391 /// # Example
4392 /// ```ignore,no_run
4393 /// # use google_cloud_videointelligence_v1::model::ObjectTrackingAnnotation;
4394 /// let x = ObjectTrackingAnnotation::new().set_track_id(42);
4395 /// assert!(x.track_id().is_some());
4396 /// assert!(x.segment().is_none());
4397 /// ```
4398 pub fn set_track_id<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
4399 self.track_info = std::option::Option::Some(
4400 crate::model::object_tracking_annotation::TrackInfo::TrackId(v.into()),
4401 );
4402 self
4403 }
4404}
4405
4406impl wkt::message::Message for ObjectTrackingAnnotation {
4407 fn typename() -> &'static str {
4408 "type.googleapis.com/google.cloud.videointelligence.v1.ObjectTrackingAnnotation"
4409 }
4410}
4411
4412/// Defines additional types related to [ObjectTrackingAnnotation].
4413pub mod object_tracking_annotation {
4414 #[allow(unused_imports)]
4415 use super::*;
4416
4417 /// Different representation of tracking info in non-streaming batch
4418 /// and streaming modes.
4419 #[derive(Clone, Debug, PartialEq)]
4420 #[non_exhaustive]
4421 pub enum TrackInfo {
4422 /// Non-streaming batch mode ONLY.
4423 /// Each object track corresponds to one video segment where it appears.
4424 Segment(std::boxed::Box<crate::model::VideoSegment>),
4425 /// Streaming mode ONLY.
4426 /// In streaming mode, we do not know the end time of a tracked object
4427 /// before it is completed. Hence, there is no VideoSegment info returned.
4428 /// Instead, we provide a unique identifiable integer track_id so that
4429 /// the customers can correlate the results of the ongoing
4430 /// ObjectTrackAnnotation of the same track_id over time.
4431 TrackId(i64),
4432 }
4433}
4434
4435/// Annotation corresponding to one detected, tracked and recognized logo class.
4436#[derive(Clone, Default, PartialEq)]
4437#[non_exhaustive]
4438pub struct LogoRecognitionAnnotation {
4439 /// Entity category information to specify the logo class that all the logo
4440 /// tracks within this LogoRecognitionAnnotation are recognized as.
4441 pub entity: std::option::Option<crate::model::Entity>,
4442
4443 /// All logo tracks where the recognized logo appears. Each track corresponds
4444 /// to one logo instance appearing in consecutive frames.
4445 pub tracks: std::vec::Vec<crate::model::Track>,
4446
4447 /// All video segments where the recognized logo appears. There might be
4448 /// multiple instances of the same logo class appearing in one VideoSegment.
4449 pub segments: std::vec::Vec<crate::model::VideoSegment>,
4450
4451 pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
4452}
4453
4454impl LogoRecognitionAnnotation {
4455 /// Creates a new default instance.
4456 pub fn new() -> Self {
4457 std::default::Default::default()
4458 }
4459
4460 /// Sets the value of [entity][crate::model::LogoRecognitionAnnotation::entity].
4461 ///
4462 /// # Example
4463 /// ```ignore,no_run
4464 /// # use google_cloud_videointelligence_v1::model::LogoRecognitionAnnotation;
4465 /// use google_cloud_videointelligence_v1::model::Entity;
4466 /// let x = LogoRecognitionAnnotation::new().set_entity(Entity::default()/* use setters */);
4467 /// ```
4468 pub fn set_entity<T>(mut self, v: T) -> Self
4469 where
4470 T: std::convert::Into<crate::model::Entity>,
4471 {
4472 self.entity = std::option::Option::Some(v.into());
4473 self
4474 }
4475
4476 /// Sets or clears the value of [entity][crate::model::LogoRecognitionAnnotation::entity].
4477 ///
4478 /// # Example
4479 /// ```ignore,no_run
4480 /// # use google_cloud_videointelligence_v1::model::LogoRecognitionAnnotation;
4481 /// use google_cloud_videointelligence_v1::model::Entity;
4482 /// let x = LogoRecognitionAnnotation::new().set_or_clear_entity(Some(Entity::default()/* use setters */));
4483 /// let x = LogoRecognitionAnnotation::new().set_or_clear_entity(None::<Entity>);
4484 /// ```
4485 pub fn set_or_clear_entity<T>(mut self, v: std::option::Option<T>) -> Self
4486 where
4487 T: std::convert::Into<crate::model::Entity>,
4488 {
4489 self.entity = v.map(|x| x.into());
4490 self
4491 }
4492
4493 /// Sets the value of [tracks][crate::model::LogoRecognitionAnnotation::tracks].
4494 ///
4495 /// # Example
4496 /// ```ignore,no_run
4497 /// # use google_cloud_videointelligence_v1::model::LogoRecognitionAnnotation;
4498 /// use google_cloud_videointelligence_v1::model::Track;
4499 /// let x = LogoRecognitionAnnotation::new()
4500 /// .set_tracks([
4501 /// Track::default()/* use setters */,
4502 /// Track::default()/* use (different) setters */,
4503 /// ]);
4504 /// ```
4505 pub fn set_tracks<T, V>(mut self, v: T) -> Self
4506 where
4507 T: std::iter::IntoIterator<Item = V>,
4508 V: std::convert::Into<crate::model::Track>,
4509 {
4510 use std::iter::Iterator;
4511 self.tracks = v.into_iter().map(|i| i.into()).collect();
4512 self
4513 }
4514
4515 /// Sets the value of [segments][crate::model::LogoRecognitionAnnotation::segments].
4516 ///
4517 /// # Example
4518 /// ```ignore,no_run
4519 /// # use google_cloud_videointelligence_v1::model::LogoRecognitionAnnotation;
4520 /// use google_cloud_videointelligence_v1::model::VideoSegment;
4521 /// let x = LogoRecognitionAnnotation::new()
4522 /// .set_segments([
4523 /// VideoSegment::default()/* use setters */,
4524 /// VideoSegment::default()/* use (different) setters */,
4525 /// ]);
4526 /// ```
4527 pub fn set_segments<T, V>(mut self, v: T) -> Self
4528 where
4529 T: std::iter::IntoIterator<Item = V>,
4530 V: std::convert::Into<crate::model::VideoSegment>,
4531 {
4532 use std::iter::Iterator;
4533 self.segments = v.into_iter().map(|i| i.into()).collect();
4534 self
4535 }
4536}
4537
4538impl wkt::message::Message for LogoRecognitionAnnotation {
4539 fn typename() -> &'static str {
4540 "type.googleapis.com/google.cloud.videointelligence.v1.LogoRecognitionAnnotation"
4541 }
4542}
4543
4544/// Video annotation feature.
4545///
4546/// # Working with unknown values
4547///
4548/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4549/// additional enum variants at any time. Adding new variants is not considered
4550/// a breaking change. Applications should write their code in anticipation of:
4551///
4552/// - New values appearing in future releases of the client library, **and**
4553/// - New values received dynamically, without application changes.
4554///
4555/// Please consult the [Working with enums] section in the user guide for some
4556/// guidelines.
4557///
4558/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4559#[derive(Clone, Debug, PartialEq)]
4560#[non_exhaustive]
4561pub enum Feature {
4562 /// Unspecified.
4563 Unspecified,
4564 /// Label detection. Detect objects, such as dog or flower.
4565 LabelDetection,
4566 /// Shot change detection.
4567 ShotChangeDetection,
4568 /// Explicit content detection.
4569 ExplicitContentDetection,
4570 /// Human face detection.
4571 FaceDetection,
4572 /// Speech transcription.
4573 SpeechTranscription,
4574 /// OCR text detection and tracking.
4575 TextDetection,
4576 /// Object detection and tracking.
4577 ObjectTracking,
4578 /// Logo detection, tracking, and recognition.
4579 LogoRecognition,
4580 /// Person detection.
4581 PersonDetection,
4582 /// If set, the enum was initialized with an unknown value.
4583 ///
4584 /// Applications can examine the value using [Feature::value] or
4585 /// [Feature::name].
4586 UnknownValue(feature::UnknownValue),
4587}
4588
4589#[doc(hidden)]
4590pub mod feature {
4591 #[allow(unused_imports)]
4592 use super::*;
4593 #[derive(Clone, Debug, PartialEq)]
4594 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4595}
4596
4597impl Feature {
4598 /// Gets the enum value.
4599 ///
4600 /// Returns `None` if the enum contains an unknown value deserialized from
4601 /// the string representation of enums.
4602 pub fn value(&self) -> std::option::Option<i32> {
4603 match self {
4604 Self::Unspecified => std::option::Option::Some(0),
4605 Self::LabelDetection => std::option::Option::Some(1),
4606 Self::ShotChangeDetection => std::option::Option::Some(2),
4607 Self::ExplicitContentDetection => std::option::Option::Some(3),
4608 Self::FaceDetection => std::option::Option::Some(4),
4609 Self::SpeechTranscription => std::option::Option::Some(6),
4610 Self::TextDetection => std::option::Option::Some(7),
4611 Self::ObjectTracking => std::option::Option::Some(9),
4612 Self::LogoRecognition => std::option::Option::Some(12),
4613 Self::PersonDetection => std::option::Option::Some(14),
4614 Self::UnknownValue(u) => u.0.value(),
4615 }
4616 }
4617
4618 /// Gets the enum value as a string.
4619 ///
4620 /// Returns `None` if the enum contains an unknown value deserialized from
4621 /// the integer representation of enums.
4622 pub fn name(&self) -> std::option::Option<&str> {
4623 match self {
4624 Self::Unspecified => std::option::Option::Some("FEATURE_UNSPECIFIED"),
4625 Self::LabelDetection => std::option::Option::Some("LABEL_DETECTION"),
4626 Self::ShotChangeDetection => std::option::Option::Some("SHOT_CHANGE_DETECTION"),
4627 Self::ExplicitContentDetection => {
4628 std::option::Option::Some("EXPLICIT_CONTENT_DETECTION")
4629 }
4630 Self::FaceDetection => std::option::Option::Some("FACE_DETECTION"),
4631 Self::SpeechTranscription => std::option::Option::Some("SPEECH_TRANSCRIPTION"),
4632 Self::TextDetection => std::option::Option::Some("TEXT_DETECTION"),
4633 Self::ObjectTracking => std::option::Option::Some("OBJECT_TRACKING"),
4634 Self::LogoRecognition => std::option::Option::Some("LOGO_RECOGNITION"),
4635 Self::PersonDetection => std::option::Option::Some("PERSON_DETECTION"),
4636 Self::UnknownValue(u) => u.0.name(),
4637 }
4638 }
4639}
4640
4641impl std::default::Default for Feature {
4642 fn default() -> Self {
4643 use std::convert::From;
4644 Self::from(0)
4645 }
4646}
4647
4648impl std::fmt::Display for Feature {
4649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4650 wkt::internal::display_enum(f, self.name(), self.value())
4651 }
4652}
4653
4654impl std::convert::From<i32> for Feature {
4655 fn from(value: i32) -> Self {
4656 match value {
4657 0 => Self::Unspecified,
4658 1 => Self::LabelDetection,
4659 2 => Self::ShotChangeDetection,
4660 3 => Self::ExplicitContentDetection,
4661 4 => Self::FaceDetection,
4662 6 => Self::SpeechTranscription,
4663 7 => Self::TextDetection,
4664 9 => Self::ObjectTracking,
4665 12 => Self::LogoRecognition,
4666 14 => Self::PersonDetection,
4667 _ => Self::UnknownValue(feature::UnknownValue(
4668 wkt::internal::UnknownEnumValue::Integer(value),
4669 )),
4670 }
4671 }
4672}
4673
4674impl std::convert::From<&str> for Feature {
4675 fn from(value: &str) -> Self {
4676 use std::string::ToString;
4677 match value {
4678 "FEATURE_UNSPECIFIED" => Self::Unspecified,
4679 "LABEL_DETECTION" => Self::LabelDetection,
4680 "SHOT_CHANGE_DETECTION" => Self::ShotChangeDetection,
4681 "EXPLICIT_CONTENT_DETECTION" => Self::ExplicitContentDetection,
4682 "FACE_DETECTION" => Self::FaceDetection,
4683 "SPEECH_TRANSCRIPTION" => Self::SpeechTranscription,
4684 "TEXT_DETECTION" => Self::TextDetection,
4685 "OBJECT_TRACKING" => Self::ObjectTracking,
4686 "LOGO_RECOGNITION" => Self::LogoRecognition,
4687 "PERSON_DETECTION" => Self::PersonDetection,
4688 _ => Self::UnknownValue(feature::UnknownValue(
4689 wkt::internal::UnknownEnumValue::String(value.to_string()),
4690 )),
4691 }
4692 }
4693}
4694
4695impl serde::ser::Serialize for Feature {
4696 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4697 where
4698 S: serde::Serializer,
4699 {
4700 match self {
4701 Self::Unspecified => serializer.serialize_i32(0),
4702 Self::LabelDetection => serializer.serialize_i32(1),
4703 Self::ShotChangeDetection => serializer.serialize_i32(2),
4704 Self::ExplicitContentDetection => serializer.serialize_i32(3),
4705 Self::FaceDetection => serializer.serialize_i32(4),
4706 Self::SpeechTranscription => serializer.serialize_i32(6),
4707 Self::TextDetection => serializer.serialize_i32(7),
4708 Self::ObjectTracking => serializer.serialize_i32(9),
4709 Self::LogoRecognition => serializer.serialize_i32(12),
4710 Self::PersonDetection => serializer.serialize_i32(14),
4711 Self::UnknownValue(u) => u.0.serialize(serializer),
4712 }
4713 }
4714}
4715
4716impl<'de> serde::de::Deserialize<'de> for Feature {
4717 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4718 where
4719 D: serde::Deserializer<'de>,
4720 {
4721 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Feature>::new(
4722 ".google.cloud.videointelligence.v1.Feature",
4723 ))
4724 }
4725}
4726
4727/// Label detection mode.
4728///
4729/// # Working with unknown values
4730///
4731/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4732/// additional enum variants at any time. Adding new variants is not considered
4733/// a breaking change. Applications should write their code in anticipation of:
4734///
4735/// - New values appearing in future releases of the client library, **and**
4736/// - New values received dynamically, without application changes.
4737///
4738/// Please consult the [Working with enums] section in the user guide for some
4739/// guidelines.
4740///
4741/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4742#[derive(Clone, Debug, PartialEq)]
4743#[non_exhaustive]
4744pub enum LabelDetectionMode {
4745 /// Unspecified.
4746 Unspecified,
4747 /// Detect shot-level labels.
4748 ShotMode,
4749 /// Detect frame-level labels.
4750 FrameMode,
4751 /// Detect both shot-level and frame-level labels.
4752 ShotAndFrameMode,
4753 /// If set, the enum was initialized with an unknown value.
4754 ///
4755 /// Applications can examine the value using [LabelDetectionMode::value] or
4756 /// [LabelDetectionMode::name].
4757 UnknownValue(label_detection_mode::UnknownValue),
4758}
4759
4760#[doc(hidden)]
4761pub mod label_detection_mode {
4762 #[allow(unused_imports)]
4763 use super::*;
4764 #[derive(Clone, Debug, PartialEq)]
4765 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4766}
4767
4768impl LabelDetectionMode {
4769 /// Gets the enum value.
4770 ///
4771 /// Returns `None` if the enum contains an unknown value deserialized from
4772 /// the string representation of enums.
4773 pub fn value(&self) -> std::option::Option<i32> {
4774 match self {
4775 Self::Unspecified => std::option::Option::Some(0),
4776 Self::ShotMode => std::option::Option::Some(1),
4777 Self::FrameMode => std::option::Option::Some(2),
4778 Self::ShotAndFrameMode => std::option::Option::Some(3),
4779 Self::UnknownValue(u) => u.0.value(),
4780 }
4781 }
4782
4783 /// Gets the enum value as a string.
4784 ///
4785 /// Returns `None` if the enum contains an unknown value deserialized from
4786 /// the integer representation of enums.
4787 pub fn name(&self) -> std::option::Option<&str> {
4788 match self {
4789 Self::Unspecified => std::option::Option::Some("LABEL_DETECTION_MODE_UNSPECIFIED"),
4790 Self::ShotMode => std::option::Option::Some("SHOT_MODE"),
4791 Self::FrameMode => std::option::Option::Some("FRAME_MODE"),
4792 Self::ShotAndFrameMode => std::option::Option::Some("SHOT_AND_FRAME_MODE"),
4793 Self::UnknownValue(u) => u.0.name(),
4794 }
4795 }
4796}
4797
4798impl std::default::Default for LabelDetectionMode {
4799 fn default() -> Self {
4800 use std::convert::From;
4801 Self::from(0)
4802 }
4803}
4804
4805impl std::fmt::Display for LabelDetectionMode {
4806 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4807 wkt::internal::display_enum(f, self.name(), self.value())
4808 }
4809}
4810
4811impl std::convert::From<i32> for LabelDetectionMode {
4812 fn from(value: i32) -> Self {
4813 match value {
4814 0 => Self::Unspecified,
4815 1 => Self::ShotMode,
4816 2 => Self::FrameMode,
4817 3 => Self::ShotAndFrameMode,
4818 _ => Self::UnknownValue(label_detection_mode::UnknownValue(
4819 wkt::internal::UnknownEnumValue::Integer(value),
4820 )),
4821 }
4822 }
4823}
4824
4825impl std::convert::From<&str> for LabelDetectionMode {
4826 fn from(value: &str) -> Self {
4827 use std::string::ToString;
4828 match value {
4829 "LABEL_DETECTION_MODE_UNSPECIFIED" => Self::Unspecified,
4830 "SHOT_MODE" => Self::ShotMode,
4831 "FRAME_MODE" => Self::FrameMode,
4832 "SHOT_AND_FRAME_MODE" => Self::ShotAndFrameMode,
4833 _ => Self::UnknownValue(label_detection_mode::UnknownValue(
4834 wkt::internal::UnknownEnumValue::String(value.to_string()),
4835 )),
4836 }
4837 }
4838}
4839
4840impl serde::ser::Serialize for LabelDetectionMode {
4841 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4842 where
4843 S: serde::Serializer,
4844 {
4845 match self {
4846 Self::Unspecified => serializer.serialize_i32(0),
4847 Self::ShotMode => serializer.serialize_i32(1),
4848 Self::FrameMode => serializer.serialize_i32(2),
4849 Self::ShotAndFrameMode => serializer.serialize_i32(3),
4850 Self::UnknownValue(u) => u.0.serialize(serializer),
4851 }
4852 }
4853}
4854
4855impl<'de> serde::de::Deserialize<'de> for LabelDetectionMode {
4856 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
4857 where
4858 D: serde::Deserializer<'de>,
4859 {
4860 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LabelDetectionMode>::new(
4861 ".google.cloud.videointelligence.v1.LabelDetectionMode",
4862 ))
4863 }
4864}
4865
4866/// Bucketized representation of likelihood.
4867///
4868/// # Working with unknown values
4869///
4870/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
4871/// additional enum variants at any time. Adding new variants is not considered
4872/// a breaking change. Applications should write their code in anticipation of:
4873///
4874/// - New values appearing in future releases of the client library, **and**
4875/// - New values received dynamically, without application changes.
4876///
4877/// Please consult the [Working with enums] section in the user guide for some
4878/// guidelines.
4879///
4880/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
4881#[derive(Clone, Debug, PartialEq)]
4882#[non_exhaustive]
4883pub enum Likelihood {
4884 /// Unspecified likelihood.
4885 Unspecified,
4886 /// Very unlikely.
4887 VeryUnlikely,
4888 /// Unlikely.
4889 Unlikely,
4890 /// Possible.
4891 Possible,
4892 /// Likely.
4893 Likely,
4894 /// Very likely.
4895 VeryLikely,
4896 /// If set, the enum was initialized with an unknown value.
4897 ///
4898 /// Applications can examine the value using [Likelihood::value] or
4899 /// [Likelihood::name].
4900 UnknownValue(likelihood::UnknownValue),
4901}
4902
4903#[doc(hidden)]
4904pub mod likelihood {
4905 #[allow(unused_imports)]
4906 use super::*;
4907 #[derive(Clone, Debug, PartialEq)]
4908 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
4909}
4910
4911impl Likelihood {
4912 /// Gets the enum value.
4913 ///
4914 /// Returns `None` if the enum contains an unknown value deserialized from
4915 /// the string representation of enums.
4916 pub fn value(&self) -> std::option::Option<i32> {
4917 match self {
4918 Self::Unspecified => std::option::Option::Some(0),
4919 Self::VeryUnlikely => std::option::Option::Some(1),
4920 Self::Unlikely => std::option::Option::Some(2),
4921 Self::Possible => std::option::Option::Some(3),
4922 Self::Likely => std::option::Option::Some(4),
4923 Self::VeryLikely => std::option::Option::Some(5),
4924 Self::UnknownValue(u) => u.0.value(),
4925 }
4926 }
4927
4928 /// Gets the enum value as a string.
4929 ///
4930 /// Returns `None` if the enum contains an unknown value deserialized from
4931 /// the integer representation of enums.
4932 pub fn name(&self) -> std::option::Option<&str> {
4933 match self {
4934 Self::Unspecified => std::option::Option::Some("LIKELIHOOD_UNSPECIFIED"),
4935 Self::VeryUnlikely => std::option::Option::Some("VERY_UNLIKELY"),
4936 Self::Unlikely => std::option::Option::Some("UNLIKELY"),
4937 Self::Possible => std::option::Option::Some("POSSIBLE"),
4938 Self::Likely => std::option::Option::Some("LIKELY"),
4939 Self::VeryLikely => std::option::Option::Some("VERY_LIKELY"),
4940 Self::UnknownValue(u) => u.0.name(),
4941 }
4942 }
4943}
4944
4945impl std::default::Default for Likelihood {
4946 fn default() -> Self {
4947 use std::convert::From;
4948 Self::from(0)
4949 }
4950}
4951
4952impl std::fmt::Display for Likelihood {
4953 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
4954 wkt::internal::display_enum(f, self.name(), self.value())
4955 }
4956}
4957
4958impl std::convert::From<i32> for Likelihood {
4959 fn from(value: i32) -> Self {
4960 match value {
4961 0 => Self::Unspecified,
4962 1 => Self::VeryUnlikely,
4963 2 => Self::Unlikely,
4964 3 => Self::Possible,
4965 4 => Self::Likely,
4966 5 => Self::VeryLikely,
4967 _ => Self::UnknownValue(likelihood::UnknownValue(
4968 wkt::internal::UnknownEnumValue::Integer(value),
4969 )),
4970 }
4971 }
4972}
4973
4974impl std::convert::From<&str> for Likelihood {
4975 fn from(value: &str) -> Self {
4976 use std::string::ToString;
4977 match value {
4978 "LIKELIHOOD_UNSPECIFIED" => Self::Unspecified,
4979 "VERY_UNLIKELY" => Self::VeryUnlikely,
4980 "UNLIKELY" => Self::Unlikely,
4981 "POSSIBLE" => Self::Possible,
4982 "LIKELY" => Self::Likely,
4983 "VERY_LIKELY" => Self::VeryLikely,
4984 _ => Self::UnknownValue(likelihood::UnknownValue(
4985 wkt::internal::UnknownEnumValue::String(value.to_string()),
4986 )),
4987 }
4988 }
4989}
4990
4991impl serde::ser::Serialize for Likelihood {
4992 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
4993 where
4994 S: serde::Serializer,
4995 {
4996 match self {
4997 Self::Unspecified => serializer.serialize_i32(0),
4998 Self::VeryUnlikely => serializer.serialize_i32(1),
4999 Self::Unlikely => serializer.serialize_i32(2),
5000 Self::Possible => serializer.serialize_i32(3),
5001 Self::Likely => serializer.serialize_i32(4),
5002 Self::VeryLikely => serializer.serialize_i32(5),
5003 Self::UnknownValue(u) => u.0.serialize(serializer),
5004 }
5005 }
5006}
5007
5008impl<'de> serde::de::Deserialize<'de> for Likelihood {
5009 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
5010 where
5011 D: serde::Deserializer<'de>,
5012 {
5013 deserializer.deserialize_any(wkt::internal::EnumVisitor::<Likelihood>::new(
5014 ".google.cloud.videointelligence.v1.Likelihood",
5015 ))
5016 }
5017}